ngx-extended-pdf-viewer
Version:
Embedding PDF files in your Angular application. Highly configurable viewer including the toolbar, sidebar, and all the features you're used to.
44 lines • 547 kB
JavaScript
/**
* @licstart The following is the entire license notice for the
* Javascript code in this page
*
* Copyright 2021 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @licend The above is the entire license notice for the
* Javascript code in this page
*/
!function webpackUniversalModuleDefinition(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("pdfjs-dist/build/pdf",[],t):"object"==typeof exports?exports["pdfjs-dist/build/pdf"]=t():e["pdfjs-dist/build/pdf"]=e.pdfjsLib=t()}(this,(function(){return(()=>{"use strict";var __webpack_modules__=[,(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.addLinkAttributes=function addLinkAttributes(e,{url:t,target:i,rel:s,enabled:r=!0}={}){(0,n.assert)(t&&"string"==typeof t,'addLinkAttributes: A valid "url" parameter must provided.');const o=(0,n.removeNullCharacters)(t);if(r)e.href=e.title=o;else{e.href="";e.title=`Disabled: ${o}`;e.onclick=()=>!1}let l="";switch(i){case a.NONE:break;case a.SELF:l="_self";break;case a.BLANK:l="_blank";break;case a.PARENT:l="_parent";break;case a.TOP:l="_top"}e.target=l;e.rel="string"==typeof s?s:"noopener noreferrer nofollow"};t.deprecated=function deprecated(e){console.log("Deprecated API usage: "+e)};t.getFilenameFromUrl=function getFilenameFromUrl(e){const t=e.indexOf("#"),i=e.indexOf("?"),n=Math.min(t>0?t:e.length,i>0?i:e.length);return e.substring(e.lastIndexOf("/",n)+1,n)};t.getPdfFilenameFromUrl=function getPdfFilenameFromUrl(e,t="document.pdf"){if(window.PDFViewerApplication.appConfig.filenameForDownload)return window.PDFViewerApplication.appConfig.filenameForDownload;if("string"!=typeof e)return t;if(isDataScheme(e)){(0,n.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.');return t}const i=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,s=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(e);let r=i.exec(s[1])||i.exec(s[2])||i.exec(s[3]);if(r){r=r[0];if(r.includes("%"))try{r=i.exec(decodeURIComponent(r))[0]}catch(e){}}return r||t};t.getXfaPageViewport=function getXfaPageViewport(e,{scale:t=1,rotation:i=0}){const{width:n,height:s}=e.attributes.style,r=[0,0,parseInt(n),parseInt(s)];return new PageViewport({viewBox:r,scale:t,rotation:i})};t.isDataScheme=isDataScheme;t.isPdfFile=function isPdfFile(e){return"string"==typeof e&&/\.pdf$/i.test(e)};t.isValidFetchUrl=isValidFetchUrl;t.loadScript=function loadScript(e,t=!1){return new Promise(((i,n)=>{const s=document.createElement("script");"Function"===e.constructor.name?s.src=e():s.src=e;s.onload=function(e){t&&s.remove();i(e)};s.onerror=function(){n(new Error(`Cannot load script at: ${s.src}`))};(document.head||document.documentElement).appendChild(s)}))};t.StatTimer=t.RenderingCancelledException=t.PixelsPerInch=t.PDFDateString=t.PageViewport=t.LinkTarget=t.DOMSVGFactory=t.DOMStandardFontDataFactory=t.DOMCMapReaderFactory=t.DOMCanvasFactory=void 0;var n=i(2),s=i(4);const r={CSS:96,PDF:72,get PDF_TO_CSS_UNITS(){return(0,n.shadow)(this,"PDF_TO_CSS_UNITS",this.CSS/this.PDF)}};t.PixelsPerInch=r;class DOMCanvasFactory extends s.BaseCanvasFactory{constructor({ownerDocument:e=globalThis.document}={}){super();this._document=e}_createCanvas(e,t){const i=this._document.createElement("canvas");i.width=e;i.height=t;return i}}t.DOMCanvasFactory=DOMCanvasFactory;async function fetchData(e,t=!1){if(isValidFetchUrl(e,document.baseURI)){const i=await fetch(e);if(!i.ok)throw new Error(i.statusText);return t?new Uint8Array(await i.arrayBuffer()):(0,n.stringToBytes)(await i.text())}return new Promise(((i,s)=>{const r=new XMLHttpRequest;r.open("GET",e,!0);t&&(r.responseType="arraybuffer");r.onreadystatechange=()=>{if(r.readyState===XMLHttpRequest.DONE){if(200===r.status||0===r.status){let e;t&&r.response?e=new Uint8Array(r.response):!t&&r.responseText&&(e=(0,n.stringToBytes)(r.responseText));if(e){i(e);return}}s(new Error(r.statusText))}};r.send(null)}))}class DOMCMapReaderFactory extends s.BaseCMapReaderFactory{_fetchData(e,t){return fetchData(e,this.isCompressed).then((e=>({cMapData:e,compressionType:t})))}}t.DOMCMapReaderFactory=DOMCMapReaderFactory;class DOMStandardFontDataFactory extends s.BaseStandardFontDataFactory{_fetchData(e){return fetchData(e,!0)}}t.DOMStandardFontDataFactory=DOMStandardFontDataFactory;class DOMSVGFactory extends s.BaseSVGFactory{_createSVG(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}}t.DOMSVGFactory=DOMSVGFactory;class PageViewport{constructor({viewBox:e,scale:t,rotation:i,offsetX:n=0,offsetY:s=0,dontFlip:r=!1}){this.viewBox=e;this.scale=t;this.rotation=i;this.offsetX=n;this.offsetY=s;const a=(e[2]+e[0])/2,o=(e[3]+e[1])/2;let l,h,c,d,u,p,g,f;(i%=360)<0&&(i+=360);switch(i){case 180:l=-1;h=0;c=0;d=1;break;case 90:l=0;h=1;c=1;d=0;break;case 270:l=0;h=-1;c=-1;d=0;break;case 0:l=1;h=0;c=0;d=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}if(r){c=-c;d=-d}if(0===l){u=Math.abs(o-e[1])*t+n;p=Math.abs(a-e[0])*t+s;g=Math.abs(e[3]-e[1])*t;f=Math.abs(e[2]-e[0])*t}else{u=Math.abs(a-e[0])*t+n;p=Math.abs(o-e[1])*t+s;g=Math.abs(e[2]-e[0])*t;f=Math.abs(e[3]-e[1])*t}this.transform=[l*t,h*t,c*t,d*t,u-l*t*a-c*t*o,p-h*t*a-d*t*o];this.width=g;this.height=f}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:i=this.offsetX,offsetY:n=this.offsetY,dontFlip:s=!1}={}){return new PageViewport({viewBox:this.viewBox.slice(),scale:e,rotation:t,offsetX:i,offsetY:n,dontFlip:s})}convertToViewportPoint(e,t){return n.Util.applyTransform([e,t],this.transform)}convertToViewportRectangle(e){const t=n.Util.applyTransform([e[0],e[1]],this.transform),i=n.Util.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],i[0],i[1]]}convertToPdfPoint(e,t){return n.Util.applyInverseTransform([e,t],this.transform)}}t.PageViewport=PageViewport;class RenderingCancelledException extends n.BaseException{constructor(e,t){super(e,"RenderingCancelledException");this.type=t}}t.RenderingCancelledException=RenderingCancelledException;const a={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};t.LinkTarget=a;function isDataScheme(e){const t=e.length;let i=0;for(;i<t&&""===e[i].trim();)i++;return"data:"===e.substring(i,i+5).toLowerCase()}t.StatTimer=class StatTimer{constructor(){this.started=Object.create(null);this.times=[]}time(e){e in this.started&&(0,n.warn)(`Timer is already running for ${e}`);this.started[e]=Date.now()}timeEnd(e){e in this.started||(0,n.warn)(`Timer has not been started for ${e}`);this.times.push({name:e,start:this.started[e],end:Date.now()});delete this.started[e]}toString(){const e=[];let t=0;for(const e of this.times){const i=e.name;i.length>t&&(t=i.length)}for(const i of this.times){const n=i.end-i.start;e.push(`${i.name.padEnd(t)} ${n}ms\n`)}return e.join("")}};function isValidFetchUrl(e,t){try{const{protocol:i}=t?new URL(e,t):new URL(e);return"http:"===i||"https:"===i||"capacitor:"===i}catch(e){return!1}}let o;t.PDFDateString=class PDFDateString{static toDateObject(e){if(!e||!(0,n.isString)(e))return null;o||(o=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const t=o.exec(e);if(!t)return null;const i=parseInt(t[1],10);let s=parseInt(t[2],10);s=s>=1&&s<=12?s-1:0;let r=parseInt(t[3],10);r=r>=1&&r<=31?r:1;let a=parseInt(t[4],10);a=a>=0&&a<=23?a:0;let l=parseInt(t[5],10);l=l>=0&&l<=59?l:0;let h=parseInt(t[6],10);h=h>=0&&h<=59?h:0;const c=t[7]||"Z";let d=parseInt(t[8],10);d=d>=0&&d<=23?d:0;let u=parseInt(t[9],10)||0;u=u>=0&&u<=59?u:0;if("-"===c){a+=d;l+=u}else if("+"===c){a-=d;l-=u}return new Date(Date.UTC(i,s,r,a,l,h))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.arrayByteLength=arrayByteLength;t.arraysToBytes=function arraysToBytes(e){const t=e.length;if(1===t&&e[0]instanceof Uint8Array)return e[0];let i=0;for(let n=0;n<t;n++)i+=arrayByteLength(e[n]);let n=0;const s=new Uint8Array(i);for(let i=0;i<t;i++){let t=e[i];t instanceof Uint8Array||(t="string"==typeof t?stringToBytes(t):new Uint8Array(t));const r=t.byteLength;s.set(t,n);n+=r}return s};t.assert=assert;t.bytesToString=function bytesToString(e){assert(null!==e&&"object"==typeof e&&void 0!==e.length,"Invalid argument for bytesToString");const t=e.length,i=8192;if(t<i)return String.fromCharCode.apply(null,e);const n=[];for(let s=0;s<t;s+=i){const r=Math.min(s+i,t),a=e.subarray(s,r);n.push(String.fromCharCode.apply(null,a))}return n.join("")};t.createObjectURL=function createObjectURL(e,t="",i=!1){if(URL.createObjectURL&&!i)return URL.createObjectURL(new Blob([e],{type:t}));const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let s=`data:${t};base64,`;for(let t=0,i=e.length;t<i;t+=3){const r=255&e[t],a=255&e[t+1],o=255&e[t+2];s+=n[r>>2]+n[(3&r)<<4|a>>4]+n[t+1<i?(15&a)<<2|o>>6:64]+n[t+2<i?63&o:64]}return s};t.createPromiseCapability=function createPromiseCapability(){const e=Object.create(null);let t=!1;Object.defineProperty(e,"settled",{get:()=>t});e.promise=new Promise((function(i,n){e.resolve=function(e){t=!0;i(e)};e.reject=function(e){t=!0;n(e)}}));return e};t.createValidAbsoluteUrl=function createValidAbsoluteUrl(e,t=null,i=null){if(!e)return null;try{if(i&&"string"==typeof e){if(i.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\./g);t&&t.length>=2&&(e=`http://${e}`)}if(i.tryConvertEncoding)try{e=stringToUTF8String(e)}catch(e){}}const n=t?new URL(e,t):new URL(e);if(function _isValidProtocol(e){if(!e)return!1;switch(e.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":case"capacitor":return!0;default:return!1}}(n))return n}catch(e){}return null};t.escapeString=function escapeString(e){return e.replace(/([()\\\n\r])/g,(e=>"\n"===e?"\\n":"\r"===e?"\\r":`\\${e}`))};t.getModificationDate=function getModificationDate(e=new Date){return[e.getUTCFullYear().toString(),(e.getUTCMonth()+1).toString().padStart(2,"0"),e.getUTCDate().toString().padStart(2,"0"),e.getUTCHours().toString().padStart(2,"0"),e.getUTCMinutes().toString().padStart(2,"0"),e.getUTCSeconds().toString().padStart(2,"0")].join("")};t.getVerbosityLevel=function getVerbosityLevel(){return s};t.info=function info(e){s>=n.INFOS&&console.log(`Info: ${e}`)};t.isArrayBuffer=function isArrayBuffer(e){return"object"==typeof e&&null!==e&&void 0!==e.byteLength};t.isArrayEqual=function isArrayEqual(e,t){if(e.length!==t.length)return!1;for(let i=0,n=e.length;i<n;i++)if(e[i]!==t[i])return!1;return!0};t.isAscii=function isAscii(e){return/^[\x00-\x7F]*$/.test(e)};t.isBool=function isBool(e){return"boolean"==typeof e};t.isNum=function isNum(e){return"number"==typeof e};t.isSameOrigin=function isSameOrigin(e,t){let i;try{i=new URL(e);if(!i.origin||"null"===i.origin)return!1}catch(e){return!1}const n=new URL(t,i);return i.origin===n.origin};t.isString=function isString(e){return"string"==typeof e};t.objectFromMap=function objectFromMap(e){const t=Object.create(null);for(const[i,n]of e)t[i]=n;return t};t.objectSize=function objectSize(e){return Object.keys(e).length};t.removeNullCharacters=function removeNullCharacters(e){if("string"!=typeof e){warn("The argument for removeNullCharacters must be a string.");return e}return e.replace(a,"")};t.setVerbosityLevel=function setVerbosityLevel(e){Number.isInteger(e)&&(s=e)};t.shadow=shadow;t.string32=function string32(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)};t.stringToBytes=stringToBytes;t.stringToPDFString=function stringToPDFString(e){const t=e.length,i=[];if("þ"===e[0]&&"ÿ"===e[1])for(let n=2;n<t;n+=2)i.push(String.fromCharCode(e.charCodeAt(n)<<8|e.charCodeAt(n+1)));else if("ÿ"===e[0]&&"þ"===e[1])for(let n=2;n<t;n+=2)i.push(String.fromCharCode(e.charCodeAt(n+1)<<8|e.charCodeAt(n)));else for(let n=0;n<t;++n){const t=c[e.charCodeAt(n)];i.push(t?String.fromCharCode(t):e.charAt(n))}return i.join("")};t.stringToUTF16BEString=function stringToUTF16BEString(e){const t=["þÿ"];for(let i=0,n=e.length;i<n;i++){const n=e.charCodeAt(i);t.push(String.fromCharCode(n>>8&255),String.fromCharCode(255&n))}return t.join("")};t.stringToUTF8String=stringToUTF8String;t.unreachable=unreachable;t.utf8StringToString=function utf8StringToString(e){return unescape(encodeURIComponent(e))};t.warn=warn;t.VerbosityLevel=t.Util=t.UNSUPPORTED_FEATURES=t.UnknownErrorException=t.UnexpectedResponseException=t.TextRenderingMode=t.StreamType=t.RenderingIntentFlag=t.PermissionFlag=t.PasswordResponses=t.PasswordException=t.PageActionEventType=t.OPS=t.MissingPDFException=t.IsLittleEndianCached=t.IsEvalSupportedCached=t.InvalidPDFException=t.ImageKind=t.IDENTITY_MATRIX=t.FormatError=t.FontType=t.FONT_IDENTITY_MATRIX=t.DocumentActionEventType=t.CMapCompressionType=t.BaseException=t.AnnotationType=t.AnnotationStateModelType=t.AnnotationReviewState=t.AnnotationReplyType=t.AnnotationMode=t.AnnotationMarkedState=t.AnnotationFlag=t.AnnotationFieldFlag=t.AnnotationBorderStyleType=t.AnnotationActionEventType=t.AbortException=void 0;i(3);t.IDENTITY_MATRIX=[1,0,0,1,0,0];t.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0];t.RenderingIntentFlag={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};t.AnnotationMode={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};t.PermissionFlag={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};t.TextRenderingMode={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4};t.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};t.AnnotationType={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26};t.AnnotationStateModelType={MARKED:"Marked",REVIEW:"Review"};t.AnnotationMarkedState={MARKED:"Marked",UNMARKED:"Unmarked"};t.AnnotationReviewState={ACCEPTED:"Accepted",REJECTED:"Rejected",CANCELLED:"Cancelled",COMPLETED:"Completed",NONE:"None"};t.AnnotationReplyType={GROUP:"Group",REPLY:"R"};t.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};t.AnnotationFieldFlag={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864};t.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};t.AnnotationActionEventType={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"};t.DocumentActionEventType={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};t.PageActionEventType={O:"PageOpen",C:"PageClose"};t.StreamType={UNKNOWN:"UNKNOWN",FLATE:"FLATE",LZW:"LZW",DCT:"DCT",JPX:"JPX",JBIG:"JBIG",A85:"A85",AHX:"AHX",CCF:"CCF",RLX:"RLX"};t.FontType={UNKNOWN:"UNKNOWN",TYPE1:"TYPE1",TYPE1STANDARD:"TYPE1STANDARD",TYPE1C:"TYPE1C",CIDFONTTYPE0:"CIDFONTTYPE0",CIDFONTTYPE0C:"CIDFONTTYPE0C",TRUETYPE:"TRUETYPE",CIDFONTTYPE2:"CIDFONTTYPE2",TYPE3:"TYPE3",OPENTYPE:"OPENTYPE",TYPE0:"TYPE0",MMTYPE1:"MMTYPE1"};const n={ERRORS:0,WARNINGS:1,INFOS:5};t.VerbosityLevel=n;t.CMapCompressionType={NONE:0,BINARY:1,STREAM:2};t.OPS={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotations:78,endAnnotations:79,beginAnnotation:80,endAnnotation:81,paintJpegXObject:82,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91};t.UNSUPPORTED_FEATURES={unknown:"unknown",forms:"forms",javaScript:"javaScript",signatures:"signatures",smask:"smask",shadingPattern:"shadingPattern",font:"font",errorTilingPattern:"errorTilingPattern",errorExtGState:"errorExtGState",errorXObject:"errorXObject",errorFontLoadType3:"errorFontLoadType3",errorFontState:"errorFontState",errorFontMissing:"errorFontMissing",errorFontTranslate:"errorFontTranslate",errorColorSpace:"errorColorSpace",errorOperatorList:"errorOperatorList",errorFontToUnicode:"errorFontToUnicode",errorFontLoadNative:"errorFontLoadNative",errorFontBuildPath:"errorFontBuildPath",errorFontGetPath:"errorFontGetPath",errorMarkedContent:"errorMarkedContent",errorContentSubStream:"errorContentSubStream"};t.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let s=n.WARNINGS;function warn(e){s>=n.WARNINGS&&console.log(`Warning: ${e}`)}function unreachable(e){throw new Error(e)}function assert(e,t){e||unreachable(t)}function shadow(e,t,i){Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!1});return i}const r=function BaseExceptionClosure(){function BaseException(e,t){this.constructor===BaseException&&unreachable("Cannot initialize BaseException.");this.message=e;this.name=t}BaseException.prototype=new Error;BaseException.constructor=BaseException;return BaseException}();t.BaseException=r;t.PasswordException=class PasswordException extends r{constructor(e,t){super(e,"PasswordException");this.code=t}};t.UnknownErrorException=class UnknownErrorException extends r{constructor(e,t){super(e,"UnknownErrorException");this.details=t}};t.InvalidPDFException=class InvalidPDFException extends r{constructor(e){super(e,"InvalidPDFException")}};t.MissingPDFException=class MissingPDFException extends r{constructor(e){super(e,"MissingPDFException")}};t.UnexpectedResponseException=class UnexpectedResponseException extends r{constructor(e,t){super(e,"UnexpectedResponseException");this.status=t}};t.FormatError=class FormatError extends r{constructor(e){super(e,"FormatError")}};t.AbortException=class AbortException extends r{constructor(e){super(e,"AbortException")}};const a=/\x00/g;function stringToBytes(e){assert("string"==typeof e,"Invalid argument for stringToBytes");const t=e.length,i=new Uint8Array(t);for(let n=0;n<t;++n)i[n]=255&e.charCodeAt(n);return i}function arrayByteLength(e){if(void 0!==e.length)return e.length;assert(void 0!==e.byteLength,"arrayByteLength - invalid argument.");return e.byteLength}const o={get value(){return shadow(this,"value",function isLittleEndian(){const e=new Uint8Array(4);e[0]=1;return 1===new Uint32Array(e.buffer,0,1)[0]}())}};t.IsLittleEndianCached=o;const l={get value(){return shadow(this,"value",function isEvalSupported(){try{new Function("");return!0}catch(e){return!1}}())}};t.IsEvalSupportedCached=l;const h=[...Array(256).keys()].map((e=>e.toString(16).padStart(2,"0")));class Util{static makeHexColor(e,t,i){return`#${h[e]}${h[t]}${h[i]}`}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]}static applyInverseTransform(e,t){const i=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/i,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/i]}static getAxialAlignedBoundingBox(e,t){const i=Util.applyTransform(e,t),n=Util.applyTransform(e.slice(2,4),t),s=Util.applyTransform([e[0],e[3]],t),r=Util.applyTransform([e[2],e[1]],t);return[Math.min(i[0],n[0],s[0],r[0]),Math.min(i[1],n[1],s[1],r[1]),Math.max(i[0],n[0],s[0],r[0]),Math.max(i[1],n[1],s[1],r[1])]}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static apply3dTransform(e,t){return[e[0]*t[0]+e[1]*t[1]+e[2]*t[2],e[3]*t[0]+e[4]*t[1]+e[5]*t[2],e[6]*t[0]+e[7]*t[1]+e[8]*t[2]]}static singularValueDecompose2dScale(e){const t=[e[0],e[2],e[1],e[3]],i=e[0]*t[0]+e[1]*t[2],n=e[0]*t[1]+e[1]*t[3],s=e[2]*t[0]+e[3]*t[2],r=e[2]*t[1]+e[3]*t[3],a=(i+r)/2,o=Math.sqrt((i+r)**2-4*(i*r-s*n))/2,l=a+o||1,h=a-o||1;return[Math.sqrt(l),Math.sqrt(h)]}static normalizeRect(e){const t=e.slice(0);if(e[0]>e[2]){t[0]=e[2];t[2]=e[0]}if(e[1]>e[3]){t[1]=e[3];t[3]=e[1]}return t}static intersect(e,t){function compare(e,t){return e-t}const i=[e[0],e[2],t[0],t[2]].sort(compare),n=[e[1],e[3],t[1],t[3]].sort(compare),s=[];e=Util.normalizeRect(e);t=Util.normalizeRect(t);if(!(i[0]===e[0]&&i[1]===t[0]||i[0]===t[0]&&i[1]===e[0]))return null;s[0]=i[1];s[2]=i[2];if(!(n[0]===e[1]&&n[1]===t[1]||n[0]===t[1]&&n[1]===e[1]))return null;s[1]=n[1];s[3]=n[2];return s}}t.Util=Util;const c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function stringToUTF8String(e){return decodeURIComponent(escape(e))}},()=>{},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.BaseSVGFactory=t.BaseStandardFontDataFactory=t.BaseCMapReaderFactory=t.BaseCanvasFactory=void 0;var n=i(2);class BaseCanvasFactory{constructor(){this.constructor===BaseCanvasFactory&&(0,n.unreachable)("Cannot initialize BaseCanvasFactory.")}create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const i=this._createCanvas(e,t);return{canvas:i,context:i.getContext("2d")}}reset(e,t,i){if(!e.canvas)throw new Error("Canvas is not specified");if(t<=0||i<=0)throw new Error("Invalid canvas size");e.canvas.width=t;e.canvas.height=i}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0;e.canvas.height=0;e.canvas=null;e.context=null}_createCanvas(e,t){(0,n.unreachable)("Abstract method `_createCanvas` called.")}}t.BaseCanvasFactory=BaseCanvasFactory;class BaseCMapReaderFactory{constructor({baseUrl:e=null,isCompressed:t=!1}){this.constructor===BaseCMapReaderFactory&&(0,n.unreachable)("Cannot initialize BaseCMapReaderFactory.");this.baseUrl=e;this.isCompressed=t}async fetch({name:e}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!e)throw new Error("CMap name must be specified.");const t=this.baseUrl+e+(this.isCompressed?".bcmap":""),i=this.isCompressed?n.CMapCompressionType.BINARY:n.CMapCompressionType.NONE;return this._fetchData(t,i).catch((e=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${t}`)}))}_fetchData(e,t){(0,n.unreachable)("Abstract method `_fetchData` called.")}}t.BaseCMapReaderFactory=BaseCMapReaderFactory;class BaseStandardFontDataFactory{constructor({baseUrl:e=null}){this.constructor===BaseStandardFontDataFactory&&(0,n.unreachable)("Cannot initialize BaseStandardFontDataFactory.");this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!e)throw new Error("Font filename must be specified.");const t=`${this.baseUrl}${e}`;return this._fetchData(t).catch((e=>{throw new Error(`Unable to load font data at: ${t}`)}))}_fetchData(e){(0,n.unreachable)("Abstract method `_fetchData` called.")}}t.BaseStandardFontDataFactory=BaseStandardFontDataFactory;class BaseSVGFactory{constructor(){this.constructor===BaseSVGFactory&&(0,n.unreachable)("Cannot initialize BaseSVGFactory.")}create(e,t){if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");const i=this._createSVG("svg:svg");i.setAttribute("version","1.1");i.setAttribute("width",`${e}px`);i.setAttribute("height",`${t}px`);i.setAttribute("preserveAspectRatio","none");i.setAttribute("viewBox",`0 0 ${e} ${t}`);return i}createElement(e){if("string"!=typeof e)throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){(0,n.unreachable)("Abstract method `_createSVG` called.")}}t.BaseSVGFactory=BaseSVGFactory},(__unused_webpack_module,exports,__w_pdfjs_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0});exports.getDocument=getDocument;exports.setPDFNetworkStreamFactory=setPDFNetworkStreamFactory;exports.version=exports.RenderTask=exports.PDFWorker=exports.PDFPageProxy=exports.PDFDocumentProxy=exports.PDFDocumentLoadingTask=exports.PDFDataRangeTransport=exports.LoopbackPort=exports.DefaultStandardFontDataFactory=exports.DefaultCMapReaderFactory=exports.DefaultCanvasFactory=exports.build=void 0;var _util=__w_pdfjs_require__(2),_display_utils=__w_pdfjs_require__(1),_font_loader=__w_pdfjs_require__(6),_node_utils=__w_pdfjs_require__(7),_annotation_storage=__w_pdfjs_require__(9),_canvas=__w_pdfjs_require__(10),_worker_options=__w_pdfjs_require__(12),_is_node=__w_pdfjs_require__(8),_message_handler=__w_pdfjs_require__(13),_metadata=__w_pdfjs_require__(14),_optional_content_config=__w_pdfjs_require__(15),_transport_stream=__w_pdfjs_require__(16),_xfa_text=__w_pdfjs_require__(17);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100,ServiceWorkerOptions={showUnverifiedSignatures:!1};window.ServiceWorkerOptions=ServiceWorkerOptions;const DefaultCanvasFactory=_is_node.isNodeJS?_node_utils.NodeCanvasFactory:_display_utils.DOMCanvasFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory;const DefaultCMapReaderFactory=_is_node.isNodeJS?_node_utils.NodeCMapReaderFactory:_display_utils.DOMCMapReaderFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory;const DefaultStandardFontDataFactory=_is_node.isNodeJS?_node_utils.NodeStandardFontDataFactory:_display_utils.DOMStandardFontDataFactory;exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory;let createPDFNetworkStream;function setPDFNetworkStreamFactory(e){createPDFNetworkStream=e}function getDocument(e){const t=new PDFDocumentLoadingTask;let i;if("string"==typeof e||e instanceof URL)i={url:e};else if((0,_util.isArrayBuffer)(e))i={data:e};else if(e instanceof PDFDataRangeTransport)i={range:e};else{if("object"!=typeof e)throw new Error("Invalid parameter in getDocument, need either string, URL, Uint8Array, or parameter object.");if(!e.url&&!e.data&&!e.range)throw new Error("Invalid parameter object: need either .data, .range or .url");i=e}const n=e.baseHref,s=Object.create(null);let r=null,a=null;for(const e in i){const t=i[e];switch(e){case"url":if("undefined"!=typeof window)try{s[e]=n?new URL(t,window.location.origin+n).href:new URL(t,window.location).href;continue}catch(e){(0,_util.warn)(`Cannot create valid URL: "${e}".`)}else if("string"==typeof t||t instanceof URL){s[e]=t.toString();continue}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.");case"range":r=t;continue;case"worker":a=t;continue;case"data":if(_is_node.isNodeJS&&"undefined"!=typeof Buffer&&t instanceof Buffer)s[e]=new Uint8Array(t);else{if(t instanceof Uint8Array)break;if("string"==typeof t)s[e]=(0,_util.stringToBytes)(t);else if("object"!=typeof t||null===t||isNaN(t.length)){if(!(0,_util.isArrayBuffer)(t))throw new Error("Invalid PDF binary data: either typed array, string, or array-like object is expected in the data property.");s[e]=new Uint8Array(t)}else s[e]=new Uint8Array(t)}continue}s[e]=t}s.rangeChunkSize=s.rangeChunkSize||DEFAULT_RANGE_CHUNK_SIZE;s.CMapReaderFactory=s.CMapReaderFactory||DefaultCMapReaderFactory;s.StandardFontDataFactory=s.StandardFontDataFactory||DefaultStandardFontDataFactory;s.ignoreErrors=!0!==s.stopAtErrors;s.fontExtraProperties=!0===s.fontExtraProperties;s.pdfBug=!0===s.pdfBug;s.enableXfa=!0===s.enableXfa;("string"!=typeof s.docBaseUrl||(0,_display_utils.isDataScheme)(s.docBaseUrl))&&(s.docBaseUrl=null);Number.isInteger(s.maxImageSize)||(s.maxImageSize=-1);"boolean"!=typeof s.useWorkerFetch&&(s.useWorkerFetch=s.CMapReaderFactory===_display_utils.DOMCMapReaderFactory&&s.StandardFontDataFactory===_display_utils.DOMStandardFontDataFactory);"boolean"!=typeof s.isEvalSupported&&(s.isEvalSupported=!0);"boolean"!=typeof s.disableFontFace&&(s.disableFontFace=_is_node.isNodeJS);"boolean"!=typeof s.useSystemFonts&&(s.useSystemFonts=!_is_node.isNodeJS&&!s.disableFontFace);void 0===s.ownerDocument&&(s.ownerDocument=globalThis.document);"boolean"!=typeof s.disableRange&&(s.disableRange=!1);"boolean"!=typeof s.disableStream&&(s.disableStream=!1);"boolean"!=typeof s.disableAutoFetch&&(s.disableAutoFetch=!1);(0,_util.setVerbosityLevel)(s.verbosity);if(!a){const e={verbosity:s.verbosity,port:_worker_options.GlobalWorkerOptions.workerPort};a=e.port?PDFWorker.fromPort(e):new PDFWorker(e);t._worker=a}const o=t.docId;a.promise.then((function(){if(t.destroyed)throw new Error("Loading aborted");const e=_fetchDocument(a,s,r,o),i=new Promise((function(e){let t;r?t=new _transport_stream.PDFDataTransportStream({length:s.length,initialData:s.initialData,progressiveDone:s.progressiveDone,contentDispositionFilename:s.contentDispositionFilename,disableRange:s.disableRange,disableStream:s.disableStream},r):s.data||(t=createPDFNetworkStream({url:s.url,length:s.length,httpHeaders:s.httpHeaders,withCredentials:s.withCredentials,rangeChunkSize:s.rangeChunkSize,disableRange:s.disableRange,disableStream:s.disableStream}));e(t)}));return Promise.all([e,i]).then((function([e,i]){if(t.destroyed)throw new Error("Loading aborted");const n=new _message_handler.MessageHandler(o,e,a.port);n.postMessageTransfers=a.postMessageTransfers;const r=new WorkerTransport(n,t,i,s);t._transport=r;n.send("showUnverifiedSignatures",window.ServiceWorkerOptions.showUnverifiedSignatures);n.send("Ready",null)}))})).catch(t._capability.reject);return t}async function _fetchDocument(e,t,i,n){if(e.destroyed)throw new Error("Worker was destroyed");if(i){t.length=i.length;t.initialData=i.initialData;t.progressiveDone=i.progressiveDone;t.contentDispositionFilename=i.contentDispositionFilename}let s=t.cMapUrl;"Function"===s.constructor.name&&(s=s());const r=await e.messageHandler.sendWithPromise("GetDocRequest",{docId:n,apiVersion:"2.11.530",source:{data:t.data,url:t.url,password:t.password,disableAutoFetch:t.disableAutoFetch,rangeChunkSize:t.rangeChunkSize,length:t.length},maxImageSize:t.maxImageSize,disableFontFace:t.disableFontFace,postMessageTransfers:e.postMessageTransfers,docBaseUrl:t.docBaseUrl,ignoreErrors:t.ignoreErrors,isEvalSupported:t.isEvalSupported,fontExtraProperties:t.fontExtraProperties,enableXfa:t.enableXfa,useSystemFonts:t.useSystemFonts,cMapUrl:t.useWorkerFetch?s:null,standardFontDataUrl:t.useWorkerFetch?t.standardFontDataUrl:null});if(e.destroyed)throw new Error("Worker was destroyed");return r}class PDFDocumentLoadingTask{static get idCounters(){return(0,_util.shadow)(this,"idCounters",{doc:0})}constructor(){this._capability=(0,_util.createPromiseCapability)();this._transport=null;this._worker=null;this.docId="d"+PDFDocumentLoadingTask.idCounters.doc++;this.destroyed=!1;this.onPassword=null;this.onProgress=null;this.onUnsupportedFeature=null}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;await(this._transport?.destroy());this._transport=null;if(this._worker){this._worker.destroy();this._worker=null}}}exports.PDFDocumentLoadingTask=PDFDocumentLoadingTask;class PDFDataRangeTransport{constructor(e,t,i=!1,n=null){this.length=e;this.initialData=t;this.progressiveDone=i;this.contentDispositionFilename=n;this._rangeListeners=[];this._progressListeners=[];this._progressiveReadListeners=[];this._progressiveDoneListeners=[];this._readyCapability=(0,_util.createPromiseCapability)()}addRangeListener(e){this._rangeListeners.push(e)}addProgressListener(e){this._progressListeners.push(e)}addProgressiveReadListener(e){this._progressiveReadListeners.push(e)}addProgressiveDoneListener(e){this._progressiveDoneListeners.push(e)}onDataRange(e,t){for(const i of this._rangeListeners)i(e,t)}onDataProgress(e,t){this._readyCapability.promise.then((()=>{for(const i of this._progressListeners)i(e,t)}))}onDataProgressiveRead(e){this._readyCapability.promise.then((()=>{for(const t of this._progressiveReadListeners)t(e)}))}onDataProgressiveDone(){this._readyCapability.promise.then((()=>{for(const e of this._progressiveDoneListeners)e()}))}transportReady(){this._readyCapability.resolve()}requestDataRange(e,t){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}exports.PDFDataRangeTransport=PDFDataRangeTransport;class PDFDocumentProxy{constructor(e,t){this._pdfInfo=e;this._transport=t;Object.defineProperty(this,"fingerprint",{get(){(0,_display_utils.deprecated)("`PDFDocumentProxy.fingerprint`, please use `PDFDocumentProxy.fingerprints` instead.");return this.fingerprints[0]}})}get annotationStorage(){return this._transport.annotationStorage}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return!!this._transport._htmlForXfa}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJavaScript(){return this._transport.getJavaScript()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){return this._transport.getOptionalContentConfig()}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}getStats(){return this._transport.getStats()}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}saveDocument(){this._transport.annotationStorage.size<=0&&(0,_display_utils.deprecated)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");return this._transport.saveDocument()}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}exports.PDFDocumentProxy=PDFDocumentProxy;class PDFPageProxy{constructor(e,t,i,n,s=!1){this._pageIndex=e;this._pageInfo=t;this._ownerDocument=n;this._transport=i;this._stats=s?new _display_utils.StatTimer:null;this._pdfBug=s;this.commonObjs=i.commonObjs;this.objs=new PDFObjects;this.cleanupAfterRender=!1;this.pendingCleanup=!1;this._intentStates=new Map;this._annotationPromises=new Map;this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:e,rotation:t=this.rotate,offsetX:i=0,offsetY:n=0,dontFlip:s=!1}={}){return new _display_utils.PageViewport({viewBox:this.view,scale:e,rotation:t,offsetX:i,offsetY:n,dontFlip:s})}getAnnotations({intent:e="display"}={}){const t=this._transport.getRenderingIntent(e);let i=this._annotationPromises.get(t.cacheKey);if(!i){i=this._transport.getAnnotations(this._pageIndex,t.renderingIntent);this._annotationPromises.set(t.cacheKey,i);i=i.then((e=>{for(const t of e){void 0!==t.titleObj&&Object.defineProperty(t,"title",{get(){(0,_display_utils.deprecated)("`title`-property on annotation, please use `titleObj` instead.");return t.titleObj.str}});void 0!==t.contentsObj&&Object.defineProperty(t,"contents",{get(){(0,_display_utils.deprecated)("`contents`-property on annotation, please use `contentsObj` instead.");return t.contentsObj.str}})}return e}))}return i}getJSActions(){return this._jsActionsPromise||=this._transport.getPageJSActions(this._pageIndex)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:e,viewport:t,intent:i="display",annotationMode:n=_util.AnnotationMode.ENABLE,transform:s=null,imageLayer:r=null,canvasFactory:a=null,background:o=null,optionalContentConfigPromise:l=null}){if(void 0!==arguments[0]?.renderInteractiveForms){(0,_display_utils.deprecated)("render no longer accepts the `renderInteractiveForms`-option, please use the `annotationMode`-option instead.");!0===arguments[0].renderInteractiveForms&&n===_util.AnnotationMode.ENABLE&&(n=_util.AnnotationMode.ENABLE_FORMS)}if(void 0!==arguments[0]?.includeAnnotationStorage){(0,_display_utils.deprecated)("render no longer accepts the `includeAnnotationStorage`-option, please use the `annotationMode`-option instead.");!0===arguments[0].includeAnnotationStorage&&n===_util.AnnotationMode.ENABLE&&(n=_util.AnnotationMode.ENABLE_STORAGE)}this._stats&&this._stats.time("Overall");const h=this._transport.getRenderingIntent(i,n);this.pendingCleanup=!1;l||(l=this._transport.getOptionalContentConfig());let c=this._intentStates.get(h.cacheKey);if(!c){c=Object.create(null);this._intentStates.set(h.cacheKey,c)}if(c.streamReaderCancelTimeout){clearTimeout(c.streamReaderCancelTimeout);c.streamReaderCancelTimeout=null}const d=a||new DefaultCanvasFactory({ownerDocument:this._ownerDocument}),u=!!(h.renderingIntent&_util.RenderingIntentFlag.PRINT);if(!c.displayReadyCapability){c.displayReadyCapability=(0,_util.createPromiseCapability)();c.operatorList={fnArray:[],argsArray:[],lastChunk:!1};this._stats&&this._stats.time("Page Request");this._pumpOperatorList(h)}const complete=e=>{c.renderTasks.delete(p);(this.cleanupAfterRender||u)&&(this.pendingCleanup=!0);this._tryCleanup();if(e){p.capability.reject(e);this._abortOperatorList({intentState:c,reason:e instanceof Error?e:new Error(e)})}else p.capability.resolve();if(this._stats){this._stats.timeEnd("Rendering");this._stats.timeEnd("Overall")}},p=new InternalRenderTask({callback:complete,params:{canvasContext:e,viewport:t,transform:s,imageLayer:r,background:o},objs:this.objs,commonObjs:this.commonObjs,operatorList:c.operatorList,pageIndex:this._pageIndex,canvasFactory:d,useRequestAnimationFrame:!u,pdfBug:this._pdfBug});(c.renderTasks||=new Set).add(p);const g=p.task;Promise.all([c.displayReadyCapability.promise,l]).then((([e,t])=>{if(this.pendingCleanup)complete();else{this._stats&&this._stats.time("Rendering");p.initializeGraphics({transparency:e,optionalContentConfig:t});p.operatorListChanged()}})).catch(complete);return g}getOperatorList({intent:e="display",annotationMode:t=_util.AnnotationMode.ENABLE}={}){const i=this._transport.getRenderingIntent(e,t,!0);let n,s=this._intentStates.get(i.cacheKey);if(!s){s=Object.create(null);this._intentStates.set(i.cacheKey,s)}if(!s.opListReadCapability){n=Object.create(null);n.operatorListChanged=function operatorListChanged(){if(s.operatorList.lastChunk){s.opListReadCapability.resolve(s.operatorList);s.renderTasks.delete(n)}};s.opListReadCapability=(0,_util.createPromiseCapability)();(s.renderTasks||=new Set).add(n);s.operatorList={fnArray:[],argsArray:[],lastChunk:!1};this._stats&&this._stats.time("Page Request");this._pumpOperatorList(i)}return s.opListReadCapability.promise}streamTextContent({normalizeWhitespace:e=!1,disableCombineTextItems:t=!1,includeMarkedContent:i=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,normalizeWhitespace:!0===e,combineTextItems:!0!==t,includeMarkedContent:!0===i},{highWaterMark:100,size:e=>e.items.length})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then((e=>_xfa_text.XfaText.textContent(e)));const t=this.streamTextContent(e);return new Promise((function(e,i){const n=t.getReader(),s={items:[],styles:Object.create(null)};!function pump(){n.read().then((function({value:t,done:i}){if(i)e(s);else{Object.assign(s.styles,t.styles);s.items.push(...t.items);pump()}}),i)}()}))}getStructTree(){return this._structTreePromise||=this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;this._transport.pageCache[this._pageIndex]=null;const e=[];for(const t of this._intentStates.values()){this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0});if(!t.opListReadCapability)for(const i of t.renderTasks){e.push(i.completed);i.cancel()}}this.objs.clear();this._annotationPromises.clear();this._jsActionsPromise=null;this._structTreePromise=null;this.pendingCleanup=!1;return Promise.all(e)}cleanup(e=!1){this.pendingCleanup=!0;this._tryCleanup(e)||(this.cleanupAfterRender=!0);return!0}_tryCleanup(e=!1){if(!this.pendingCleanup)return!1;for(const{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;this._intentStates.clear();this.objs.clear();this._annotationPromises.clear();this._jsActionsPromise=null;this._structTreePromise=null;e&&this._stats&&(this._stats=new _display_utils.StatTimer);this.pendingCleanup=!1;return!0}_startRenderPage(e,t){const i=this._intentStates.get(t);if(i){this._stats&&this._stats.timeEnd("Page Request");i.displayReadyCapability&&i.displayReadyCapability.resolve(e)}}_renderPageChunk(e,t){for(let i=0,n=e.length;i<n;i++){t.operatorList.fnArray.push(e.fnArray[i]);t.operatorList.argsArray.push(e.argsArray[i])}t.operatorList.lastChunk=e.lastChunk;for(const e of t.renderTasks)e.operatorListChanged();e.lastChunk&&this._tryCleanup()}_pumpOperatorList({renderingIntent:e,cacheKey:t}){const i=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:e&_util.RenderingIntentFlag.ANNOTATIONS_STORAGE?this._transport.annotationStorage.serializable:null}).getReader(),n=this._intentStates.get(t);n.streamReader=i;const pump=()=>{i.read().then((({value:e,done:t})=>{if(t)n.streamReader=null;else if(!this._transport.destroyed){this._renderPageChunk(e,n);pump()}}),(e=>{n.streamReader=null;if(!this._transport.destroyed){if(n.operatorList){n.operatorList.lastChunk=!0;for(const e of n.renderTasks)e.operatorListChanged();this._tryCleanup()}if(n.displayReadyCapability)n.displayReadyCapability.reject(e);else{if(!n.opListReadCapability)throw e;n.opListReadCapability.reject(e)}}}))};pump()}_abortOperatorList({intentState:e,reason:t,force:i=!1}){if(e.streamReader){if(!i){if(e.renderTasks.size>0)return;if(t instanceof _display_utils.RenderingCancelledException){e.streamReaderCancelTimeout=setTimeout((()=>{this._abortOperatorList({intentState:e,reason:t,force:!0});e.streamReaderCancelTimeout=null}),RENDERING_CANCELLED_TIMEOUT);return}}e.streamReader.cancel(new _util.AbortException(t.message)).catch((()=>{}));e.streamReader=null;if(!this._transport.destroyed){for(const[t,i]of this._intentStates)if(i===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}}exports.PDFPageProxy=PDFPageProxy;class LoopbackPort{constructor(){this._listeners=[];this._deferred=Promise.resolve(void 0)}postMessage(e,t){const i=new WeakMap,n={data:function cloneValue(e){if("function"==typeof e||"symbol"==typeof e||e instanceof URL)throw new Error(`LoopbackPort.postMessage - cannot clone: ${e?.toString()}`);if("object"!=typeof e||null===e)return e;if(i.has(e))return i.get(e);let n,s;if((n=e.buffer)&&(0,_util.isArrayBuffer)(n)){s=t?.includes(n)?new e.constructor(n,e.byteOffset,e.byteLength):new e.constructor(e);i.set(e,s);return s}if(e instanceof Map){s=new Map;i.set(e,s);for(const[t,i]of e)s.set(t,cloneValue(i));return s}if(e instanceof Set){s=new Set;i.set(e,s);for(const t of e)s.add(cloneValue(t));return s}s=Array.isArray(e)?[]:Object.create(null);i.set(e,s);for(const t in e){let i,n=e;for(;!(i=Object.getOwnPropertyDescriptor(n,t));)n=Object.getPrototypeOf(n);if(void 0!==i.value){if("function"==typeof i.value)if("cMapUrl"===t)s[t]=cloneValue(i.value());else if(!e.hasOwnProperty?.(t))continue;s[t]=cloneValue(i.value)}}return s}(e)};this._deferred.then((()=>{for(const e of this._listeners)e.call(this,n)}))}addEventListener(e,t){this._listeners.push(t)}removeEventListener(e,t){const i=this._listeners.indexOf(t);this._listeners.splice(i,1)}terminate(){this._listeners.length=0}}exports.LoopbackPort=LoopbackPort;const PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};if(_is_node.isNodeJS&&"function"==typeof require){PDFWorkerUtil.isWorkerDisabled=!0;PDFWorkerUtil.fallbackWorkerSrc="./pdf.worker.js"}else if("object"==typeof document){const e=document?.currentScript?.src;e&&(PDFWorkerUtil.fallbackWorkerSrc=e.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}PDFWorkerUtil.createCDNWrapper=function(e){const t=`importScripts("${e}");`;return URL.createObjectURL(new Blob([t]))};class PDFWorker{static get _workerPorts(){return(0,_util.shadow)(this,"_workerPorts",new WeakMap)}constructor({name:e=null,port:t=null,verbosity:i=(0,_util.getVerbosityLevel)()}={}){if(t&&PDFWorker._workerPorts.has(t))throw new Error("Cannot use more than one PDFWorker per port.");this.name=e;this.destroyed=!1;this.postMessageTransfers=!0;this.verbosity=i;this._readyCapability=(0,_util.createPromiseCapability)();this._port=null;this._webWorker=null;this._messageHandler=null;if(t){PDFWorker._workerPorts.set(t,this);this._initializeFromPort(t)}else this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(e){this._port=e;this._messageHandler=new _message_handler.MessageHandler("main","worker",e);this._messageHandler.on("ready",(function(){}));this._readyCapability.resolve()}_initialize(){if("undefined"!=typeof Worker&&!PDFWorkerUtil.isWorkerDisabled&&!PDFWorker._mainThreadWorkerMessageHandler){let e=PDFWorker.workerSrc;try{(0,_util.isSameOrigin)(window.location.href,e)||(e=PDFWorkerUtil.createCDNWrapper(new URL(e,window.location).href));const t=new Worker(e),i=new _message_handler.MessageHandler("main","worker",t),terminateEarly=()=>{t.removeEventListener("error",onWorkerError);i.destroy();t.terminate();this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},onWorkerError=()=>{this._webWorker||terminateEarly()};t.addEventListener("error",onWorkerError);i.on("test",(e=>{t.removeEventListener("error",onWorkerError);if(this.destroyed)terminateEarly();else if(e){this._messageHandler=i;this._port=t;this._webWorker=t;e.supportTransfers||(this.postMessageTransfers=!1);this._readyCapability.resolve();i.send("configure",{verbosity:this.verbosity})}else{this._setupFakeWorker();i.destroy();t.terminate()}}));i.on("ready",(e=>{t.removeEventListener("error",onWorkerError);if(this.destroyed)terminateEarly();else try{sendTest()}catch(e){this._setupFakeWorker()}}));const sendTest=()=>{const e=new Uint8Array([this.postMessageTransfers?255:0]);try{i.send("test",e,[e.buffer])}catch(t){(0,_util.warn)("Cannot use postMessage transfers.");e[0]=0;i.send("test",e)}};sendTest();return}catch(e){(0,_util.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){if(!PDFWorkerUtil.isWorkerDisabled){(0,_util.warn)("Setting up fake worker.");PDFWorkerUtil.isWorkerDisabled=!0}PDFWorker._setupFakeWorkerGlobal.then((e=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const t=new LoopbackPort;this._port=t;const i="fake"+PDFWorkerUtil.fakeWorkerId++,n=new _message_handler.MessageHandler(i+"_worker",i,t);e.setup(n,t);const s=new _message_handler.MessageHandler(i,i+"_worker",t);this._messageHandler=s;this._readyCapability.resolve();s.send("configure",{verbosity:this.verbosity})})).catch((e=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${e.message}".`))}))}destroy(){this.destroyed=!0;if(this._webWorker){this._webWorker.terminate();this._webWorker=null}PDFWorker._workerPorts.delete(this._port);this._port=null;if(this._messageHandler){this._messageHandler.destroy();this._messageHandler=null}}static fromPort(e){if(!e?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return this._workerPorts.has(e.port)?this._workerPorts.get(e.port):new PDFWorker(e)}static get workerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return"Function"===_worker_options.GlobalWorkerOptions.workerSrc.constructor.name?_worker_options.GlobalWorkerOptions.workerSrc():_worker_options.GlobalWorkerOptions.workerSrc;if(null!==PDFWorkerUtil.fallbackWorkerSrc){_is_node.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.');return PDFWorkerUtil.fallbackWorkerSrc}throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _mainThreadWorkerMessageHandler(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch(e){return null}}static get _setupFakeWorkerGlobal(){const loader=async()=>{const mainWorkerMessageHandler=this._mainThreadWorkerMessageHandler;if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_is_node.isNodeJS&&"function"==typeof require){const worker=eval("require")(this.workerSrc);return worker.WorkerMessageHandler}await(0,_display_utils.loadScript)(this.workerSrc);return window.pdfjsWorker.WorkerMessageHandler};return(0,_util.shadow)(this,"_setupFakeWorkerGlobal",loader())}}exports.PDFWorker=PDFWorker;PDFWorker.getWorkerSrc=function(){(0,_display_utils.deprecated)("`PDFWorker.getWorkerSrc()`, please use `PDFWorker.workerSrc` instead.");return this.workerSrc};class WorkerTransport{constructor(e,t,i,n){this.messageHandler=e;this.loadingTask=t;this.commonObjs=new PDFObjects;this.fontLoader=new _font_loader.FontLoader({docId:t.docId,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),ownerDocument:n.ownerDocument,styleElement:n.styleElement});this._params=n;if(!n.useWorkerFetch){let e=n.cMapUrl;"Function"===e.constructor.name&&(e=e());this.CMapReaderFactory=new n.CMapReaderFactory({baseUrl:e,isCompressed:n.cMapPacked});this.StandardFontDataFactory=new n.StandardFontDataFactory({baseUrl:n.standardFontDataUrl})}this.destroyed=!1;this.destroyCapability=null;this._passwordCapability=null;this._networkStream=i;this._fullReader=null;this._lastProgress=null;this.pageCache=[];this.pagePromises=[];this.downloadInfoCapability=(0,_util.createPromiseCapability)();this.setupMessageHandler()}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}getRenderingIntent(e,t=_util.AnnotationMode.ENABLE,i=!1){let n=_util.RenderingIntentFlag.DISPLAY,s="";switch(e){case"any":n=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":n=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${e}`)}switch(t){case _util.AnnotationMode.DISABLE:n+=_util.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case _util.AnnotationMode.ENABLE:break;case _util.AnnotationMode.ENABLE_FORMS:n+=_util.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case _util.AnnotationMode.ENABLE_STORAGE:n+=_util.RenderingIntentFlag.ANNOTATIONS_STORAGE;s=this.annotationStorage.lastModified;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${t}`)}i&&(n+=_util.RenderingIntentFlag.OPLIST);return{renderingIntent:n,cacheKey:`${n}_${s}`}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0;this.destroyCapability=(0,_util.createPromiseCapability)();this._passwordCapability&&this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const t of this.pageCache)t&&e.push(t._destroy());this.pageCache.length=0;this.pagePromises.length=0;this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const t=this.messageHandler.sendWithPromise("Terminate",null);e.push(t);Promise.all(e).then((()=>{this.commonObjs.clear();this.fontLoader.clear();this._getFieldObjectsPromise=null;this._hasJSActionsPromise=null;this._networkStream&&this._networkStream.cancelAllRequests(new _util.AbortException("Worker was terminated."));if(this.messageHandler){this.messageHandler.destroy();this.messageHandler=null}this.destroyCapability.resolve()}),this.destroyCapability.reject);return this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:t}=this;e.on("GetReader",((e,t)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available.");this._fullReader=this._networkStream.getFullReader();this._fullReader.onProgress=e=>{this._lastProgress={loaded:e.loaded,total:e.total}};t.onPull=()=>{this._fullReader.read().then((function({value:e,done:i}){if(i)t.close();else{(0,_util.assert)((0,_util.isArrayBuffer)(e),"GetReader - expected an ArrayBuffer.");t.enqueue(new Uint8Array(e),1,[e])}})).catch((e=>{t.error(e)}))};t.onCancel=e=>{this._fullReader.cancel(e);t.ready.catch((e=>{if(!this.destroyed)throw e}))}}));e.on("ReaderHeadersReady",(e=>{const i=(0,_util.createPromiseCapability)(),n=this._fullReader;n.headersReady.then((()=>{if(!n.isStreamingSupported||!n.isRangeSupported){this._lastProgress&&t.onProgress&&t.onProgress(this._lastProgress);n.onProgress=e=>{t.onProgress&&t.onProgress({loaded:e.loaded,total:e.total})}}i.resolve({isStreamingSupported:n.isStreamingSupported,isRangeSupported:n.isRangeSupported,contentLength:n.contentLength})}),i.reject);return i.promise}));e.on("GetRangeReader",((e,t)=>{(0,_util.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const i=this._networkStream.getRangeReader(e.begin,e.end);if(i){t.onPull=()=>{i.read().then((function({value:e,done:i}){if(i)t.close();else{(0,_util.assert)((0,_util.isArrayBuffer)(e),"GetRangeReader - expected an ArrayBuffer.");t.enqueue(new Uint8Array(e),1,[e])}})).catch((e=>{t.error(e)}))};t.onCancel=e=>{i.cancel(e);t.ready.catch((e=>{if(!this.destroyed)throw e}))}}else t.close()}));e.on("GetDoc",(({pdfInfo:e})=>{this._numPages=e.numPages;this._htmlForXfa=e.htmlForXfa;delete e.htmlForXfa;t._capability.resolve(new PDFDocumentProxy(e,this))}));e.on("DocException",(function(e){let i;switch(e.name){case"PasswordException":i=new _util.PasswordException(e.message,e.code);break;case"InvalidPDFException":i=new _util.InvalidPDFException(e.message);break;case"MissingPDFException":i=new _util.MissingPDFException(e.message);break;case"UnexpectedResponseException":i=new _util.UnexpectedResponseException(e.message,e.status);break;case"UnknownErrorException":i=new _util.UnknownErrorException(e.message,e.details);break;default:(0,_util.unreachable)("DocException - expected a valid Error.")}t._capability.reject(i)}));e.on("PasswordRequest",(e=>{this._passwordCapability=(0,_util.createPromiseCapability)();if(t.onPassword){const updatePassword=e=>{this._passwordCapability.resolve({password:e})};try{t.onPassword(updatePassword,e.code)}catch(e){this._passwordCapability.reject(e)}}else this._passwordCapability.reject(new _util.PasswordException(e.message,e.code));return this._passwordCapability.promise}));e.on("DataLoaded",(e=>{t.onProgress&&t.onProgress({loaded:e.length,total:e.length});this.downloadInfoCapability.resolve(e)}));e.on("StartRenderPage",(e=>{if(this.destroyed)return;this.pageCache[e.pageIndex]._startRenderPage(e.transparency,e.cacheKey)}));e.on("commonobj",(t=>{if(this.destroyed)return;const[i,n,s]=t;if(!this.commonObjs.has(i))switch(n){case"Font":const t=this._params;if("error"in s){const e=s.error;(0,_util.warn)(`Error during font loading: ${e}`);this.commonObjs.resolve(i,e);break}let r=null;t.pdfBug&&globalThis.FontInspector?.enabled&&(r={registerFont(e,t){globalThis.FontInspector.fontAdded(e,t)}});const a=new _font_loader.FontFaceObject(s,{isEvalSupported:t.isEvalSupported,disableFontFace:t.disableFontFace,ignoreErrors:t.ignoreErrors,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),fontRegistry:r});this.fontLoader.bind(a).catch((t=>e.sendWithPromise("FontFallback",{id:i}))).finally((()=>{!t.fontExtraProperties&&a.data&&(a.data=null);this.commonObjs.resolve(i,a)}));break;case"FontPath":case"Image":this.commonObjs.resolve(i,s);break;default:throw new Error(`Got unknown common object type ${n}`)}}));e.on("obj",(e=>{if(this.destroyed)return;const[t,i,n,s]=e,r=this.pageCache[i];if(!r.objs.has(t))switch(n){case"Image":r.objs.resolve(t,s);const e=8e6;s?.data?.length>e&&(r.cleanupAfterRender=!0);break;case"Pattern":r.objs.resolve(t,s);break;default:throw new Error(`Got unknown object type ${n}`)}}));e.on("DocProgress",(e=>{this.destroyed||t.onProgress&&t.onProgress({loaded:e.loaded,total:e.total})}));e.on("UnsupportedFeature",this._onUnsupportedFeature.bind(this));e.on("FetchBuiltInCMap",(e=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.CMapReaderFactory?this.CMapReaderFactory.fetch(e):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))));e.on("FetchStandardFontData",(e=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.StandardFontDataFactory?this.StandardFontDataFactory.fetch(e):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter."))))}_onUnsupportedFeature({featureId:e}){this.destroyed||this.loadingTask.onUnsupportedFeature&&this.loadingTask.onUnsupportedFeature(e)}getData(){return this.messageHandler.sendWithPromise("GetData",null)}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request"));const t=e-1;if(t in this.pagePromises)return this.pagePromises[t];const i=this.messageHandler.sendWithPromise("GetPage",{pageIndex:t}).then((e=>{if(this.destroyed)throw new Error("Transport destroyed");const i=new PDFPageProxy(t,e,this,this._params.ownerDocument,this._params.pdfBug);this.pageCache[t]=i;return i}));this.pagePromises[t]=i;return i}getPageIndex(e){return this.messageHandler.sendWithPromise("GetPageIndex",{ref:e})}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})}saveDocument(){return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:this.annotationStorage.serializable,filename:this._fullReader?.filename??null}).finally((()=>{this.annotationStorage.resetModified()}))}getFieldObjects(){return this._getFieldObjectsPromise||=this.messageHandler.sendWithPromise("GetFieldObjects",null)}hasJSActions(){return this._hasJSActionsPromise||=this.messageHandler.sendWithPromise("HasJSActions",null)}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return"string"!=typeof e?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:e})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getJavaScript(){return this.messageHandler.sendWithPromise("GetJavaScript",null)}getDocJSActions(){return this.messageHandler.sendWithPromise("GetDocJSActions",null)}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:e})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:e})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then((e=>new _optional_content_config.OptionalContentConfig(e)))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){return this.messageHandler.sendWithPromise("GetMetadata",null).then((e=>({info:e[0],metadata:e[1]?new _metadata.Metadata(e[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null})))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}getStats(){return this.messageHandler.sendWithPromise("GetStats",null)}async startCleanup(e=!1){await this.messageHandler.sendWithPromise("Cleanup",null);if(!this.destroyed){for(let e=0,t=this.pageCache.length;e<t;e++){const t=this.pageCache[e];if(!t)continue;if(!t.cleanup())throw new Error(`startCleanup: Page ${e+1} is currently rendering.`)}this.commonObjs.clear();e||this.fontLoader.clear();this._getFieldObjectsPromise=null;this._hasJSActionsPromise=null}}get loadingParams(){const e=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:e.disableAutoFetch,enableXfa:e.enableXfa})}}class PDFObjects{constructor(){this._objs=Object.create(null)}_ensureObj(e){return this._objs[e]?this._objs[e]:this._objs[e]={capability:(0,_util.createPromiseCapability)(),data:null,resolved:!1}}get(e,t=null){if(t){this._ensureObj(e).capability.promise.then(t);return null}const i=this._objs[e];if(!i||!i.resolved)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return i.data}has(e){return this._objs[e]?.resolved||!1}resolve(e,t){const i=this._ensureObj(e);i.resolved=!0;i.data=t;i.capability.resolve(t)}clear(){this._objs=Object.create(null)}}class RenderTask{constructor(e){this._internalRenderTask=e;this.onContinue=null}get promise(){return this._internalRenderTask.capability.promise}cancel(){this._internalRenderTask.cancel()}}exports.RenderTask=RenderTask;class InternalRenderTask{static get canvasInUse(){return(0,_util.shadow)(this,"canvasInUse",new WeakSet)}constructor({callback:e,params:t,objs:i,commonObjs:n,operatorList:s,pageIndex:r,canvasFactory:a,useRequestAnimationFrame:o=!1,pdfBug:l=!1}){this.callback=e;this.params=t;this.objs=i;this.commonObjs=n;this.operatorListIdx=null;this.operatorList=s;this._pageIndex=r;this.canvasFactory=a;this._pdfBug=l;this.running=!1;this.graphicsReadyCallback=null;this.graphicsReady=!1;this._useRequestAnimationFrame=!0===o&&"undefined"!=typeof window;this.cancelled=!1;this.capability=(0,_util.createPromiseCapability)();this.task=new RenderTask(this);this._cancelBound=this.cancel.bind(this);this._continueBound=this._continue.bind(this);this._scheduleNextBound=this._scheduleNext.bind(this);this._nextBound=this._next.bind(this);this._canvas=t.canvasContext.canvas}get completed(){return this.capability.promise.catch((function(){}))}initializeGraphics({transparency:e=!1,optionalContentConfig:t}){if(this.cancelled)return;if(this._canvas){if(InternalRenderTask.canvasInUse.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");InternalRenderTask.canvasInUse.add(this._canvas)}if(this._pdfBug&&globalThis.StepperManager?.enabled){this.stepper=globalThis.StepperManager.create(this._pageIndex);this.stepper.init(this.operatorList);this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint()}const{canvasContext:i,viewport:n,transform:s,imageLayer:r,background:a}=this.params;this.gfx=new _canvas.CanvasGraphics(i,this.commonObjs,this.objs,this.canvasFactory,r,t);this.gfx.beginDrawing({transform:s,viewport:n,transparency:e,background:a});this.operatorListIdx=0;this.graphicsReady=!0;this.graphicsReadyCallback&&this.graphicsReadyCallback()}cancel(e=null){this.running=!1;this.cancelled=!0;this.gfx&&this.gfx.endDrawing();this._canvas&&InternalRenderTask.canvasInUse.delete(this._canvas);this.callback(e||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,"canvas"))}operatorListChanged(){if(this.graphicsReady){this.stepper&&this.stepper.updateOperatorList(this.operatorList);this.running||this._continue()}else this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound)}_continue(){this.running=!0;this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?window.requestAnimationFrame((()=>{this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){if(!this.cancelled){this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper);if(this.operatorListIdx===this.operatorList.argsArray.length){this.running=!1;if(this.operatorList.lastChunk){this.gfx.endDrawing();this._canvas&&InternalRenderTask.canvasInUse.delete(this._canvas);this.callback()}}}}}const version="2.11.530";exports.version=version;const build="439db56ec";exports.build=build},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.FontLoader=t.FontFaceObject=void 0;var n=i(2);class BaseFontLoader{constructor({docId:e,onUnsupportedFeature:t,ownerDocument:i=globalThis.document,styleElement:s=null}){this.constructor===BaseFontLoader&&(0,n.unreachable)("Cannot initialize BaseFontLoader.");this.docId=e;this._onUnsupportedFeature=t;this._document=i;this.nativeFontFaces=[];this.styleElement=null}addNativeFontFace(e){this.nativeFontFaces.push(e);this._document.fonts.add(e)}insertRule(e){let t=this.styleElement;if(!t){t=this.styleElement=this._document.createElement("style");t.id=`PDFJS_FONT_STYLE_TAG_${this.docId}`;this._document.documentElement.getElementsByTagName("head")[0].appendChild(t)}const i=t.sheet;i.insertRule(e,i.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.length=0;if(this.styleElement){this.styleElement.remove();this.styleElement=null}}async bind(e){if(e.attached||e.missingFile)return;e.attached=!0;if(this.isFontLoadingAPISupported){const t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(i){this._onUnsupportedFeature({featureId:n.UNSUPPORTED_FEATURES.errorFontLoadNative});(0,n.warn)(`Failed to load font '${t.family}': '${i}'.`);e.disableFontFace=!0;throw i}}return}const t=e.createFontFaceRule();if(t){this.insertRule(t);if(this.isSyncFontLoadingSupported)return;await new Promise((i=>{const n=this._queueLoadingCallback(i);this._prepareFontLoadEvent([t],[e],n)}))}}_queueLoadingCallback(e){(0,n.unreachable)("Abstract method `_queueLoadingCallback`.")}get isFontLoadingAPISupported(){const e=!!this._document?.fonts;return(0,n.shadow)(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){(0,n.unreachable)("Abstract method `isSyncFontLoadingSupported`.")}get _loadTestFont(){(0,n.unreachable)("Abstract method `_loadTestFont`.")}_prepareFontLoadEvent(e,t,i){(0,n.unreachable)("Abstract method `_prepareFontLoadEvent`.")}}let s;t.FontLoader=s;t.FontLoader=s=class GenericFontLoader extends BaseFontLoader{constructor(e){super(e);this.loadingContext={requests:[],nextRequestId:0};this.loadTestFontId=0}get isSyncFontLoadingSupported(){let e=!1;if("undefined"==typeof navigator)e=!0;else{/Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent)?.[1]>=14&&(e=!0)}return(0,n.shadow)(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(e){const t=this.loadingContext,i={id:"pdfjs-font-loading-"+t.nextRequestId++,done:!1,complete:function completeRequest(){(0,n.assert)(!i.done,"completeRequest() cannot be called twice.");i.done=!0;for(;t.requests.length>0&&t.requests[0].done;){const e=t.requests.shift();setTimeout(e.callback,0)}},callback:e};t.requests.push(i);return i}get _loadTestFont(){return(0,n.shadow)(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(e,t,i){function int32(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|255&e.charCodeAt(t+3)}function spliceString(e,t,i,n){return e.substring(0,t)+n+e.substring(t+i)}let s,r;const a=this._document.createElement("canvas");a.width=1;a.height=1;const o=a.getContext("2d");let l=0;const h=`lt${Date.now()}${this.loadTestFontId++}`;let c=this._loadTestFont;c=spliceString(c,976,h.length,h);const d=1482184792;let u=int32(c,16);for(s=0,r=h.length-3;s<r;s+=4)u=u-d+int32(h,s)|0;s<h.length&&(u=u-d+int32(h+"XXX",s)|0);c=spliceString(c,16,4,(0,n.string32)(u));const p=`@font-face {font-family:"${h}";src:${`url(data:font/opentype;base64,${btoa(c)});`}}`;this.insertRule(p);const g=[];for(const e of t)g.push(e.loadedName);g.push(h);const f=this._document.createElement("div");f.style.visibility="hidden";f.style.width=f.style.height="10px";f.style.position="absolute";f.style.top=f.style.left="0px";for(const e of g){const t=this._document.createElement("span");t.textContent="Hi";t.style.fontFamily=e;f.appendChild(t)}this._document.body.appendChild(f);!function isFontReady(e,t){l++;if(l>30){(0,n.warn)("Load test font never loaded.");t();return}o.font="30px "+e;o.fillText(".",0,20);o.getImageData(0,0,1,1).data[3]>0?t():setTimeout(isFontReady.bind(null,e,t))}(h,(()=>{this._document.body.removeChild(f);i.complete()}))}};t.FontFaceObject=class FontFaceObject{constructor(e,{isEvalSupported:t=!0,disableFontFace:i=!1,ignoreErrors:n=!1,onUnsupportedFeature:s,fontRegistry:r=null}){this.compiledGlyphs=Object.create(null);for(const t in e)this[t]=e[t];this.isEvalSupported=!1!==t;this.disableFontFace=!0===i;this.ignoreErrors=!0===n;this._onUnsupportedFeature=s;this.fontRegistry=r}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(this.cssFontInfo){const t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style=`oblique ${this.cssFontInfo.italicAngle}deg`);e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}else e=new FontFace(this.loadedName,this.data,{});this.fontRegistry&&this.fontRegistry.registerFont(this);return e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const e=(0,n.bytesToString)(this.data),t=`url(data:${this.mimetype};base64,${btoa(e)});`;let i;if(this.cssFontInfo){let e=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(e+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`);i=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${e}src:${t}}`}else i=`@font-face {font-family:"${this.loadedName}";src:${t}}`;this.fontRegistry&&this.fontRegistry.registerFont(this,t);return i}getPathGenerator(e,t){if(void 0!==this.compiledGlyphs[t])return this.compiledGlyphs[t];let i;try{i=e.get(this.loadedName+"_path_"+t)}catch(e){if(!this.ignoreErrors)throw e;this._onUnsupportedFeature({featureId:n.UNSUPPORTED_FEATURES.errorFontGetPath});(0,n.warn)(`getPathGenerator - ignoring character: "${e}".`);return this.compiledGlyphs[t]=function(e,t){}}if(this.isEvalSupported&&n.IsEvalSupportedCached.value){const e=[];for(const t of i){const i=void 0!==t.args?t.args.join(","):"";e.push("c.",t.cmd,"(",i,");\n")}return this.compiledGlyphs[t]=new Function("c","size",e.join(""))}return this.compiledGlyphs[t]=function(e,t){for(const n of i){"scale"===n.cmd&&(n.args=[t,-t]);e[n.cmd].apply(e,n.args)}}}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.NodeStandardFontDataFactory=t.NodeCMapReaderFactory=t.NodeCanvasFactory=void 0;var n=i(4),s=i(8),r=i(2);let a=class{constructor(){(0,r.unreachable)("Not implemented: NodeCanvasFactory")}};t.NodeCanvasFactory=a;let o=class{constructor(){(0,r.unreachable)("Not implemented: NodeCMapReaderFactory")}};t.NodeCMapReaderFactory=o;let l=class{constructor(){(0,r.unreachable)("Not implemented: NodeStandardFontDataFactory")}};t.NodeStandardFontDataFactory=l;if(s.isNodeJS){const fetchData=function(e){return new Promise(((t,i)=>{require("fs").readFile(e,((e,n)=>{!e&&n?t(new Uint8Array(n)):i(new Error(e))}))}))};t.NodeCanvasFactory=a=class extends n.BaseCanvasFactory{_createCanvas(e,t){return require("canvas").createCanvas(e,t)}};t.NodeCMapReaderFactory=o=class extends n.BaseCMapReaderFactory{_fetchData(e,t){return fetchData(e).then((e=>({cMapData:e,compressionType:t})))}};t.NodeStandardFontDataFactory=l=class extends n.BaseStandardFontDataFactory{_fetchData(e){return fetchData(e)}}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.isNodeJS=void 0;const i=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type);t.isNodeJS=i},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.AnnotationStorage=void 0;var n=i(2);t.AnnotationStorage=class AnnotationStorage{constructor(){this._storage=new Map;this._timeStamp=Date.now();this._modified=!1;this.onSetModified=null;this.onResetModified=null}getValue(e,t,i,n){let s=this._storage.get(e);if(void 0===s&&window.getFormValue){window.assignFormIdAndFieldName(e,t,n);const r=window.getFormValue(t);if(void 0!==r&&void 0!==r.value){if(n){s={value:r.value===n}}else s=r;this.setValue(e,void 0,s)}void 0===s&&void 0!==i&&void 0!==i.value&&""!==i.value&&(n?i.value&&window.setFormValue(t,n):window.setFormValue(t,i.value))}return void 0===s?i:Object.assign(i,s)}setValue(e,t,i,n){const s=this._storage.get(e);let r=!1;if(void 0!==s){for(const[e,t]of Object.entries(i))if("radioValue"!==e&&"emitMessage"!==e&&s[e]!==t){r=!0;s[e]=t}}else{r=!0;this._storage.set(e,i)}if(r){this._timeStamp=Date.now();this._setModified();if((t||n)&&window.setFormValue)if(i.items)window.setFormValue(t,i.items);else if(!1===i.emitMessage);else if(i.radioValue)window.setFormValue(t,i.radioValue);else for(const e of Object.values(i))window.setFormValue(t,e)}}getAll(){return this._storage.size>0?(0,n.objectFromMap)(this._storage):null}get size(){return this._storage.size}_setModified(){if(!this._modified){this._modified=!0;"function"==typeof this.onSetModified&&this.onSetModified()}}resetModified(){if(this._modified){this._modified=!1;"function"==typeof this.onResetModified&&this.onResetModified()}}get serializable(){return this._storage.size>0?this._storage:null}get lastModified(){return this._timeStamp.toString()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.CanvasGraphics=void 0;var n=i(2),s=i(11),r=i(1);const a=4096,o=16;function addContextCurrentTransform(e){if(!e.mozCurrentTransform){e._originalSave=e.save;e._originalRestore=e.restore;e._originalRotate=e.rotate;e._originalScale=e.scale;e._originalTranslate=e.translate;e._originalTransform=e.transform;e._originalSetTransform=e.setTransform;e._originalResetTransform=e.resetTransform;e._transformMatrix=e._transformMatrix||[1,0,0,1,0,0];e._transformStack=[];try{const t=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),"lineWidth");e._setLineWidth=t.set;e._getLineWidth=t.get;Object.defineProperty(e,"lineWidth",{set:function setLineWidth(e){this._setLineWidth(1.000001*e)},get:function getLineWidth(){return this._getLineWidth()}})}catch(e){}Object.defineProperty(e,"mozCurrentTransform",{get:function getCurrentTransform(){return this._transformMatrix}});Object.defineProperty(e,"mozCurrentTransformInverse",{get:function getCurrentTransformInverse(){const[e,t,i,n,s,r]=this._transformMatrix,a=e*n-t*i,o=t*i-e*n;return[n/a,t/o,i/o,e/a,(n*s-i*r)/o,(t*s-e*r)/a]}});e.save=function ctxSave(){const e=this._transformMatrix;this._transformStack.push(e);this._transformMatrix=e.slice(0,6);this._originalSave()};e.restore=function ctxRestore(){const e=this._transformStack.pop();if(e){this._transformMatrix=e;this._originalRestore()}};e.translate=function ctxTranslate(e,t){const i=this._transformMatrix;i[4]=i[0]*e+i[2]*t+i[4];i[5]=i[1]*e+i[3]*t+i[5];this._originalTranslate(e,t)};e.scale=function ctxScale(e,t){const i=this._transformMatrix;i[0]*=e;i[1]*=e;i[2]*=t;i[3]*=t;this._originalScale(e,t)};e.transform=function ctxTransform(t,i,n,s,r,a){const o=this._transformMatrix;this._transformMatrix=[o[0]*t+o[2]*i,o[1]*t+o[3]*i,o[0]*n+o[2]*s,o[1]*n+o[3]*s,o[0]*r+o[2]*a+o[4],o[1]*r+o[3]*a+o[5]];e._originalTransform(t,i,n,s,r,a)};e.setTransform=function ctxSetTransform(t,i,n,s,r,a){this._transformMatrix=[t,i,n,s,r,a];e._originalSetTransform(t,i,n,s,r,a)};e.resetTransform=function ctxResetTransform(){this._transformMatrix=[1,0,0,1,0,0];e._originalResetTransform()};e.rotate=function ctxRotate(e){const t=Math.cos(e),i=Math.sin(e),n=this._transformMatrix;this._transformMatrix=[n[0]*t+n[2]*i,n[1]*t+n[3]*i,n[0]*-i+n[2]*t,n[1]*-i+n[3]*t,n[4],n[5]];this._originalRotate(e)}}}class CachedCanvases{constructor(e){this.canvasFactory=e;this.cache=Object.create(null)}getCanvas(e,t,i,n){let s;if(void 0!==this.cache[e]){s=this.cache[e];this.canvasFactory.reset(s,t,i);s.context.setTransform(1,0,0,1,0,0)}else{s=this.canvasFactory.create(t,i);this.cache[e]=s}n&&addContextCurrentTransform(s.context);return s}clear(){for(const e in this.cache){const t=this.cache[e];this.canvasFactory.destroy(t);delete this.cache[e]}}}class LRUCache{constructor(e=0){this._cache=new Map;this._maxSize=e}has(e){return this._cache.has(e)}get(e){if(this._cache.has(e)){const t=this._cache.get(e);this._cache.delete(e);this._cache.set(e,t)}return this._cache.get(e)}set(e,t){if(!(this._maxSize<=0)){this._cache.size+1>this._maxSize&&this._cache.delete(this._cache.keys().next().value);this._cache.set(e,t)}}clear(){this._cache.clear()}}class CanvasExtraState{constructor(){this.alphaIsShape=!1;this.fontSize=0;this.fontSizeScale=1;this.textMatrix=n.IDENTITY_MATRIX;this.textMatrixScale=1;this.fontMatrix=n.FONT_IDENTITY_MATRIX;this.leading=0;this.x=0;this.y=0;this.lineX=0;this.lineY=0;this.charSpacing=0;this.wordSpacing=0;this.textHScale=1;this.textRenderingMode=n.TextRenderingMode.FILL;this.textRise=0;this.fillColor="#000000";this.strokeColor="#000000";this.patternFill=!1;this.fillAlpha=1;this.strokeAlpha=1;this.lineWidth=1;this.activeSMask=null;this.resumeSMaskCtx=null;this.transferMaps=null}clone(){return Object.create(this)}setCurrentPoint(e,t){this.x=e;this.y=t}}function putBinaryImageData(e,t,i=null){if("undefined"!=typeof ImageData&&t instanceof ImageData){e.putImageData(t,0,0);return}const s=t.height,r=t.width,a=s%o,l=(s-a)/o,h=0===a?l:l+1,c=e.createImageData(r,o);let d,u=0;const p=t.data,g=c.data;let f,m,_,b,w,v,y,S;if(i)switch(i.length){case 1:w=i[0];v=i[0];y=i[0];S=i[0];break;case 4:w=i[0];v=i[1];y=i[2];S=i[3]}if(t.kind===n.ImageKind.GRAYSCALE_1BPP){const t=p.byteLength,i=new Uint32Array(g.buffer,0,g.byteLength>>2),s=i.length,b=r+7>>3;let w=4294967295,v=n.IsLittleEndianCached.value?4278190080:255;S&&255===S[0]&&0===S[255]&&([w,v]=[v,w]);for(f=0;f<h;f++){_=f<l?o:a;d=0;for(m=0;m<_;m++){const e=t-u;let n=0;const s=e>b?r:8*e-7,a=-8&s;let o=0,l=0;for(;n<a;n+=8){l=p[u++];i[d++]=128&l?w:v;i[d++]=64&l?w:v;i[d++]=32&l?w:v;i[d++]=16&l?w:v;i[d++]=8&l?w:v;i[d++]=4&l?w:v;i[d++]=2&l?w:v;i[d++]=1&l?w:v}for(;n<s;n++){if(0===o){l=p[u++];o=128}i[d++]=l&o?w:v;o>>=1}}for(;d<s;)i[d++]=0;e.putImageData(c,0,f*o)}}else if(t.kind===n.ImageKind.RGBA_32BPP){const t=!!(w||v||y);m=0;b=r*o*4;for(f=0;f<l;f++){g.set(p.subarray(u,u+b));u+=b;if(t)for(let e=0;e<b;e+=4){w&&(g[e+0]=w[g[e+0]]);v&&(g[e+1]=v[g[e+1]]);y&&(g[e+2]=y[g[e+2]])}e.putImageData(c,0,m);m+=o}if(f<h){b=r*a*4;g.set(p.subarray(u,u+b));if(t)for(let e=0;e<b;e+=4){w&&(g[e+0]=w[g[e+0]]);v&&(g[e+1]=v[g[e+1]]);y&&(g[e+2]=y[g[e+2]])}e.putImageData(c,0,m)}}else{if(t.kind!==n.ImageKind.RGB_24BPP)throw new Error(`bad image kind: ${t.kind}`);{const t=!!(w||v||y);_=o;b=r*_;for(f=0;f<h;f++){if(f>=l){_=a;b=r*_}d=0;for(m=b;m--;){g[d++]=p[u++];g[d++]=p[u++];g[d++]=p[u++];g[d++]=255}if(t)for(let e=0;e<d;e+=4){w&&(g[e+0]=w[g[e+0]]);v&&(g[e+1]=v[g[e+1]]);y&&(g[e+2]=y[g[e+2]])}e.putImageData(c,0,f*o)}}}}function putBinaryImageMask(e,t){const i=t.height,n=t.width,s=i%o,r=(i-s)/o,a=0===s?r:r+1,l=e.createImageData(n,o);let h=0;const c=t.data,d=l.data;for(let t=0;t<a;t++){const i=t<r?o:s;let a=3;for(let e=0;e<i;e++){let e,t=0;for(let i=0;i<n;i++){if(!t){e=c[h++];t=128}d[a]=e&t?0:255;a+=4;t>>=1}}e.putImageData(l,0,t*o)}}function copyCtxState(e,t){const i=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font"];for(let n=0,s=i.length;n<s;n++){const s=i[n];void 0!==e[s]&&(t[s]=e[s])}if(void 0!==e.setLineDash){t.setLineDash(e.getLineDash());t.lineDashOffset=e.lineDashOffset}}function resetCtxToDefault(e){e.strokeStyle="#000000";e.fillStyle="#000000";e.fillRule="nonzero";e.globalAlpha=1;e.lineWidth=1;e.lineCap="butt";e.lineJoin="miter";e.miterLimit=10;e.globalCompositeOperation="source-over";e.font="10px sans-serif";if(void 0!==e.setLineDash){e.setLineDash([]);e.lineDashOffset=0}}function composeSMaskBackdrop(e,t,i,n){const s=e.length;for(let r=3;r<s;r+=4){const s=e[r];if(0===s){e[r-3]=t;e[r-2]=i;e[r-1]=n}else if(s<255){const a=255-s;e[r-3]=e[r-3]*s+t*a>>8;e[r-2]=e[r-2]*s+i*a>>8;e[r-1]=e[r-1]*s+n*a>>8}}}function composeSMaskAlpha(e,t,i){const n=e.length;for(let s=3;s<n;s+=4){const n=i?i[e[s]]:e[s];t[s]=t[s]*n*.00392156862745098|0}}function composeSMaskLuminosity(e,t,i){const n=e.length;for(let s=3;s<n;s+=4){const n=77*e[s-3]+152*e[s-2]+28*e[s-1];t[s]=i?t[s]*i[n>>8]>>8:t[s]*n>>16}}function composeSMask(e,t,i){const n=t.canvas,s=t.context;e.setTransform(t.scaleX,0,0,t.scaleY,t.offsetX,t.offsetY);!function genericComposeSMask(e,t,i,n,s,r,a){const o=!!r,l=o?r[0]:0,h=o?r[1]:0,c=o?r[2]:0;let d;d="Luminosity"===s?composeSMaskLuminosity:composeSMaskAlpha;const u=Math.min(n,Math.ceil(1048576/i));for(let s=0;s<n;s+=u){const r=Math.min(u,n-s),p=e.getImageData(0,s,i,r),g=t.getImageData(0,s,i,r);o&&composeSMaskBackdrop(p.data,l,h,c);d(p.data,g.data,a);e.putImageData(g,0,s)}}(s,i,n.width,n.height,t.subtype,t.backdrop,t.transferMap);e.drawImage(n,0,0)}function getImageSmoothingEnabled(e,t){const i=n.Util.singularValueDecompose2dScale(e);i[0]=Math.fround(i[0]);i[1]=Math.fround(i[1]);const s=Math.fround((globalThis.devicePixelRatio||1)*r.PixelsPerInch.PDF_TO_CSS_UNITS);return void 0!==t?t:i[0]<=s||i[1]<=s}const l=["butt","round","square"],h=["miter","round","bevel"],c={},d={};class CanvasGraphics{constructor(e,t,i,n,s,r){this.ctx=e;this.current=new CanvasExtraState;this.stateStack=[];this.pendingClip=null;this.pendingEOFill=!1;this.res=null;this.xobjs=null;this.commonObjs=t;this.objs=i;this.canvasFactory=n;this.imageLayer=s;this.groupStack=[];this.processingType3=null;this.baseTransform=null;this.baseTransformStack=[];this.groupLevel=0;this.smaskStack=[];this.smaskCounter=0;this.tempSMask=null;this.contentVisible=!0;this.markedContentStack=[];this.optionalContentConfig=r;this.cachedCanvases=new CachedCanvases(this.canvasFactory);this.cachedCanvasPatterns=new LRUCache(2);this.cachedPatterns=new Map;e&&addContextCurrentTransform(e);this._cachedGetSinglePixelWidth=null}beginDrawing({transform:e,viewport:t,transparency:i=!1,background:n=null}){const s=this.ctx.canvas.width,r=this.ctx.canvas.height;this.ctx.save();this.ctx.fillStyle=n||"rgb(255, 255, 255)";this.ctx.fillRect(0,0,s,r);this.ctx.restore();if(i){const e=this.cachedCanvases.getCanvas("transparent",s,r,!0);this.compositeCtx=this.ctx;this.transparentCanvas=e.canvas;this.ctx=e.context;this.ctx.save();this.ctx.transform.apply(this.ctx,this.compositeCtx.mozCurrentTransform)}this.ctx.save();resetCtxToDefault(this.ctx);e&&this.ctx.transform.apply(this.ctx,e);this.ctx.transform.apply(this.ctx,t.transform);this.baseTransform=this.ctx.mozCurrentTransform.slice();this._combinedScaleFactor=Math.hypot(this.baseTransform[0],this.baseTransform[2]);this.imageLayer&&this.imageLayer.beginLayout()}executeOperatorList(e,t,i,s){const r=e.argsArray,a=e.fnArray;let o=t||0;const l=r.length;if(l===o)return o;const h=l-o>10&&"function"==typeof i,c=h?Date.now()+15:0;let d=0;const u=this.commonObjs,p=this.objs;let g;for(;;){if(void 0!==s&&o===s.nextBreakPoint){s.breakIt(o,i);return o}g=a[o];if(g!==n.OPS.dependency)this[g].apply(this,r[o]);else for(const e of r[o]){const t=e.startsWith("g_")?u:p;if(!t.has(e)){t.get(e,i);return o}}o++;if(o===l)return o;if(h&&++d>10){if(Date.now()>c){i();return o}d=0}}}endDrawing(){for(;this.stateStack.length||null!==this.current.activeSMask;)this.restore();this.ctx.restore();if(this.transparentCanvas){this.ctx=this.compositeCtx;this.ctx.save();this.ctx.setTransform(1,0,0,1,0,0);this.ctx.drawImage(this.transparentCanvas,0,0);this.ctx.restore();this.transparentCanvas=null}this.cachedCanvases.clear();this.cachedCanvasPatterns.clear();this.cachedPatterns.clear();this.imageLayer&&this.imageLayer.endLayout()}_scaleImage(e,t){const i=e.width,n=e.height;let s,r,a=Math.max(Math.hypot(t[0],t[1]),1),o=Math.max(Math.hypot(t[2],t[3]),1),l=i,h=n,c="prescale1";for(;a>2&&l>1||o>2&&h>1;){let t=l,i=h;if(a>2&&l>1){t=Math.ceil(l/2);a/=l/t}if(o>2&&h>1){i=Math.ceil(h/2);o/=h/i}s=this.cachedCanvases.getCanvas(c,t,i);r=s.context;r.clearRect(0,0,t,i);r.drawImage(e,0,0,l,h,0,0,t,i);e=s.canvas;l=t;h=i;c="prescale1"===c?"prescale2":"prescale1"}return{img:e,paintWidth:l,paintHeight:h}}_createMaskCanvas(e){const t=this.ctx,i=e.width,s=e.height,r=this.current.fillColor,a=this.current.patternFill,o=this.cachedCanvases.getCanvas("maskCanvas",i,s);putBinaryImageMask(o.context,e);const l=t.mozCurrentTransform;let h=n.Util.transform(l,[1/i,0,0,-1/s,0,0]);h=n.Util.transform(h,[1,0,0,1,0,-s]);const c=n.Util.applyTransform([0,0],h),d=n.Util.applyTransform([i,s],h),u=n.Util.normalizeRect([c[0],c[1],d[0],d[1]]),p=Math.ceil(u[2]-u[0]),g=Math.ceil(u[3]-u[1]),f=this.cachedCanvases.getCanvas("fillCanvas",p,g,!0),m=f.context,_=Math.min(c[0],d[0]),b=Math.min(c[1],d[1]);m.translate(-_,-b);m.transform.apply(m,h);const w=this._scaleImage(o.canvas,m.mozCurrentTransformInverse);m.imageSmoothingEnabled=getImageSmoothingEnabled(m.mozCurrentTransform,e.interpolate);m.drawImage(w.img,0,0,w.img.width,w.img.height,0,0,i,s);m.globalCompositeOperation="source-in";const v=n.Util.transform(m.mozCurrentTransformInverse,[1,0,0,1,-_,-b]);m.fillStyle=a?r.getPattern(t,this,v,!1):r;m.fillRect(0,0,i,s);return{canvas:f.canvas,offsetX:Math.round(_),offsetY:Math.round(b)}}setLineWidth(e){this.current.lineWidth=e;this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=l[e]}setLineJoin(e){this.ctx.lineJoin=h[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,t){const i=this.ctx;if(void 0!==i.setLineDash){i.setLineDash(e);i.lineDashOffset=t}}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(let t=0,i=e.length;t<i;t++){const i=e[t],n=i[0],s=i[1];switch(n){case"LW":this.setLineWidth(s);break;case"LC":this.setLineCap(s);break;case"LJ":this.setLineJoin(s);break;case"ML":this.setMiterLimit(s);break;case"D":this.setDash(s[0],s[1]);break;case"RI":this.setRenderingIntent(s);break;case"FL":this.setFlatness(s);break;case"Font":this.setFont(s[0],s[1]);break;case"CA":this.current.strokeAlpha=i[1];break;case"ca":this.current.fillAlpha=i[1];this.ctx.globalAlpha=i[1];break;case"BM":this.ctx.globalCompositeOperation=s;break;case"SMask":this.current.activeSMask&&(this.stateStack.length>0&&this.stateStack[this.stateStack.length-1].activeSMask===this.current.activeSMask?this.suspendSMaskGroup():this.endSMaskGroup());this.current.activeSMask=s?this.tempSMask:null;this.current.activeSMask&&this.beginSMaskGroup();this.tempSMask=null;break;case"TR":this.current.transferMaps=s}}}beginSMaskGroup(){const e=this.current.activeSMask,t=e.canvas.width,i=e.canvas.height,n="smaskGroupAt"+this.groupLevel,s=this.cachedCanvases.getCanvas(n,t,i,!0),r=this.ctx,a=r.mozCurrentTransform;this.ctx.save();const o=s.context;o.scale(1/e.scaleX,1/e.scaleY);o.translate(-e.offsetX,-e.offsetY);o.transform.apply(o,a);e.startTransformInverse=o.mozCurrentTransformInverse;copyCtxState(r,o);this.ctx=o;this.setGState([["BM","source-over"],["ca",1],["CA",1]]);this.groupStack.push(r);this.groupLevel++}suspendSMaskGroup(){const e=this.ctx;this.groupLevel--;this.ctx=this.groupStack.pop();composeSMask(this.ctx,this.current.activeSMask,e);this.ctx.restore();this.ctx.save();copyCtxState(e,this.ctx);this.current.resumeSMaskCtx=e;const t=n.Util.transform(this.current.activeSMask.startTransformInverse,e.mozCurrentTransform);this.ctx.transform.apply(this.ctx,t);e.save();e.setTransform(1,0,0,1,0,0);e.clearRect(0,0,e.canvas.width,e.canvas.height);e.restore()}resumeSMaskGroup(){const e=this.current.resumeSMaskCtx,t=this.ctx;this.ctx=e;this.groupStack.push(t);this.groupLevel++}endSMaskGroup(){const e=this.ctx;this.groupLevel--;this.ctx=this.groupStack.pop();composeSMask(this.ctx,this.current.activeSMask,e);this.ctx.restore();copyCtxState(e,this.ctx);const t=n.Util.transform(this.current.activeSMask.startTransformInverse,e.mozCurrentTransform);this.ctx.transform.apply(this.ctx,t)}save(){this.ctx.save();const e=this.current;this.stateStack.push(e);this.current=e.clone();this.current.resumeSMaskCtx=null}restore(){this.current.resumeSMaskCtx&&this.resumeSMaskGroup();null===this.current.activeSMask||0!==this.stateStack.length&&this.stateStack[this.stateStack.length-1].activeSMask===this.current.activeSMask||this.endSMaskGroup();if(0!==this.stateStack.length){this.current=this.stateStack.pop();this.ctx.restore();this.pendingClip=null;this._cachedGetSinglePixelWidth=null}else this.current.activeSMask=null}transform(e,t,i,n,s,r){this.ctx.transform(e,t,i,n,s,r);this._cachedGetSinglePixelWidth=null}constructPath(e,t){const i=this.ctx,s=this.current;let r=s.x,a=s.y;for(let s=0,o=0,l=e.length;s<l;s++)switch(0|e[s]){case n.OPS.rectangle:r=t[o++];a=t[o++];const e=t[o++],s=t[o++],l=r+e,h=a+s;i.moveTo(r,a);if(0===e||0===s)i.lineTo(l,h);else{i.lineTo(l,a);i.lineTo(l,h);i.lineTo(r,h)}i.closePath();break;case n.OPS.moveTo:r=t[o++];a=t[o++];i.moveTo(r,a);break;case n.OPS.lineTo:r=t[o++];a=t[o++];i.lineTo(r,a);break;case n.OPS.curveTo:r=t[o+4];a=t[o+5];i.bezierCurveTo(t[o],t[o+1],t[o+2],t[o+3],r,a);o+=6;break;case n.OPS.curveTo2:i.bezierCurveTo(r,a,t[o],t[o+1],t[o+2],t[o+3]);r=t[o+2];a=t[o+3];o+=4;break;case n.OPS.curveTo3:r=t[o+2];a=t[o+3];i.bezierCurveTo(t[o],t[o+1],r,a,r,a);o+=4;break;case n.OPS.closePath:i.closePath()}s.setCurrentPoint(r,a)}closePath(){this.ctx.closePath()}stroke(e){e=void 0===e||e;const t=this.ctx,i=this.current.strokeColor;t.globalAlpha=this.current.strokeAlpha;if(this.contentVisible)if("object"==typeof i&&i?.getPattern){const e=this.getSinglePixelWidth();t.save();t.strokeStyle=i.getPattern(t,this,t.mozCurrentTransformInverse);t.lineWidth=Math.max(e,this.current.lineWidth);t.stroke();t.restore()}else{const e=this.getSinglePixelWidth();if(e<0&&-e>=this.current.lineWidth){t.save();t.resetTransform();t.lineWidth=Math.round(this._combinedScaleFactor);t.stroke();t.restore()}else{t.lineWidth=Math.max(e,this.current.lineWidth);t.stroke()}}e&&this.consumePath();t.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath();this.stroke()}fill(e){e=void 0===e||e;const t=this.ctx,i=this.current.fillColor;let n=!1;if(this.current.patternFill){t.save();t.fillStyle=i.getPattern(t,this,t.mozCurrentTransformInverse);n=!0}if(this.contentVisible)if(this.pendingEOFill){t.fill("evenodd");this.pendingEOFill=!1}else t.fill();n&&t.restore();e&&this.consumePath()}eoFill(){this.pendingEOFill=!0;this.fill()}fillStroke(){this.fill(!1);this.stroke(!1);this.consumePath()}eoFillStroke(){this.pendingEOFill=!0;this.fillStroke()}closeFillStroke(){this.closePath();this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0;this.closePath();this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=c}eoClip(){this.pendingClip=d}beginText(){this.current.textMatrix=n.IDENTITY_MATRIX;this.current.textMatrixScale=1;this.current.x=this.current.lineX=0;this.current.y=this.current.lineY=0}endText(){const e=this.pendingTextPaths,t=this.ctx;if(void 0!==e){t.save();t.beginPath();for(let i=0;i<e.length;i++){const n=e[i];t.setTransform.apply(t,n.transform);t.translate(n.x,n.y);n.addToPath(t,n.fontSize)}t.restore();t.clip();t.beginPath();delete this.pendingTextPaths}else t.beginPath()}setCharSpacing(e){this.current.charSpacing=e}setWordSpacing(e){this.current.wordSpacing=e}setHScale(e){this.current.textHScale=e/100}setLeading(e){this.current.leading=-e}setFont(e,t){const i=this.commonObjs.get(e),s=this.current;if(!i)throw new Error(`Can't find font for ${e}`);s.fontMatrix=i.fontMatrix||n.FONT_IDENTITY_MATRIX;0!==s.fontMatrix[0]&&0!==s.fontMatrix[3]||(0,n.warn)("Invalid font matrix for font "+e);if(t<0){t=-t;s.fontDirection=-1}else s.fontDirection=1;this.current.font=i;this.current.fontSize=t;if(i.isType3Font)return;const r=i.loadedName||"sans-serif";let a="normal";i.black?a="900":i.bold&&(a="bold");const o=i.italic?"italic":"normal",l=`"${r}", ${i.fallbackName}`;let h=t;t<16?h=16:t>100&&(h=100);this.current.fontSizeScale=t/h;this.ctx.font=`${o} ${a} ${h}px ${l}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,t){this.current.x=this.current.lineX+=e;this.current.y=this.current.lineY+=t}setLeadingMoveText(e,t){this.setLeading(-t);this.moveText(e,t)}setTextMatrix(e,t,i,n,s,r){this.current.textMatrix=[e,t,i,n,s,r];this.current.textMatrixScale=Math.hypot(e,t);this.current.x=this.current.lineX=0;this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(e,t,i,s,r){const a=this.ctx,o=this.current,l=o.font,h=o.textRenderingMode,c=o.fontSize/o.fontSizeScale,d=h&n.TextRenderingMode.FILL_STROKE_MASK,u=!!(h&n.TextRenderingMode.ADD_TO_PATH_FLAG),p=o.patternFill&&!l.missingFile;let g;(l.disableFontFace||u||p)&&(g=l.getPathGenerator(this.commonObjs,e));if(l.disableFontFace||p){a.save();a.translate(t,i);a.beginPath();g(a,c);s&&a.setTransform.apply(a,s);d!==n.TextRenderingMode.FILL&&d!==n.TextRenderingMode.FILL_STROKE||a.fill();if(d===n.TextRenderingMode.STROKE||d===n.TextRenderingMode.FILL_STROKE){if(r){a.resetTransform();a.lineWidth=Math.round(this._combinedScaleFactor)}a.stroke()}a.restore()}else{d!==n.TextRenderingMode.FILL&&d!==n.TextRenderingMode.FILL_STROKE||a.fillText(e,t,i);if(d===n.TextRenderingMode.STROKE||d===n.TextRenderingMode.FILL_STROKE)if(r){a.save();a.moveTo(t,i);a.resetTransform();a.lineWidth=Math.round(this._combinedScaleFactor);a.strokeText(e,0,0);a.restore()}else a.strokeText(e,t,i)}if(u){(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:a.mozCurrentTransform,x:t,y:i,fontSize:c,addToPath:g})}}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1);e.fillText("I",0,10);const t=e.getImageData(0,0,10,10).data;let i=!1;for(let e=3;e<t.length;e+=4)if(t[e]>0&&t[e]<255){i=!0;break}return(0,n.shadow)(this,"isFontSubpixelAAEnabled",i)}showText(e){const t=this.current,i=t.font;if(i.isType3Font)return this.showType3Text(e);const s=t.fontSize;if(0===s)return;const r=this.ctx,a=t.fontSizeScale,o=t.charSpacing,l=t.wordSpacing,h=t.fontDirection,c=t.textHScale*h,d=e.length,u=i.vertical,p=u?1:-1,g=i.defaultVMetrics,f=s*t.fontMatrix[0],m=t.textRenderingMode===n.TextRenderingMode.FILL&&!i.disableFontFace&&!t.patternFill;r.save();let _;if(t.patternFill){r.save();const e=t.fillColor.getPattern(r,this,r.mozCurrentTransformInverse);_=r.mozCurrentTransform;r.restore();r.fillStyle=e}r.transform.apply(r,t.textMatrix);r.translate(t.x,t.y+t.textRise);h>0?r.scale(c,-1):r.scale(c,1);let b=t.lineWidth,w=!1;const v=t.textMatrixScale;if(0===v||0===b){const e=t.textRenderingMode&n.TextRenderingMode.FILL_STROKE_MASK;if(e===n.TextRenderingMode.STROKE||e===n.TextRenderingMode.FILL_STROKE){this._cachedGetSinglePixelWidth=null;b=this.getSinglePixelWidth();w=b<0}}else b/=v;if(1!==a){r.scale(a,a);b/=a}r.lineWidth=b;let y,S=0;for(y=0;y<d;++y){const t=e[y];if((0,n.isNum)(t)){S+=p*t*s/1e3;continue}let c=!1;const d=(t.isSpace?l:0)+o,b=t.fontChar,v=t.accent;let P,A,C,x=t.width;if(u){const e=t.vmetric||g,i=-(t.vmetric?e[1]:.5*x)*f,n=e[2]*f;x=e?-e[0]:x;P=i/a;A=(S+n)/a}else{P=S/a;A=0}if(i.remeasure&&x>0){const e=1e3*r.measureText(b).width/s*a;if(x<e&&this.isFontSubpixelAAEnabled){const t=x/e;c=!0;r.save();r.scale(t,1);P/=t}else x!==e&&(P+=(x-e)/2e3*s/a)}if(this.contentVisible&&(t.isInFont||i.missingFile))if(m&&!v)r.fillText(b,P,A);else{this.paintChar(b,P,A,_,w);if(v){const e=P+s*v.offset.x/a,t=A-s*v.offset.y/a;this.paintChar(v.fontChar,e,t,_,w)}}C=u?x*f-d*h:x*f+d*h;S+=C;c&&r.restore()}u?t.y-=S:t.x+=S*c;r.restore()}showType3Text(e){const t=this.ctx,i=this.current,s=i.font,r=i.fontSize,a=i.fontDirection,o=s.vertical?1:-1,l=i.charSpacing,h=i.wordSpacing,c=i.textHScale*a,d=i.fontMatrix||n.FONT_IDENTITY_MATRIX,u=e.length;let p,g,f,m;if(!(i.textRenderingMode===n.TextRenderingMode.INVISIBLE)&&0!==r){this._cachedGetSinglePixelWidth=null;t.save();t.transform.apply(t,i.textMatrix);t.translate(i.x,i.y);t.scale(c,a);for(p=0;p<u;++p){g=e[p];if((0,n.isNum)(g)){m=o*g*r/1e3;this.ctx.translate(m,0);i.x+=m*c;continue}const a=(g.isSpace?h:0)+l,u=s.charProcOperatorList[g.operatorListId];if(!u){(0,n.warn)(`Type3 character "${g.operatorListId}" is not available.`);continue}if(this.contentVisible){this.processingType3=g;this.save();t.scale(r,r);t.transform.apply(t,d);this.executeOperatorList(u);this.restore()}f=n.Util.applyTransform([g.width,0],d)[0]*r+a;t.translate(f,0);i.x+=f*c}t.restore();this.processingType3=null}}setCharWidth(e,t){}setCharWidthAndBounds(e,t,i,n,s,r){this.ctx.rect(i,n,s-i,r-n);this.clip();this.endPath()}getColorN_Pattern(e){let t;if("TilingPattern"===e[0]){const i=e[1],n=this.baseTransform||this.ctx.mozCurrentTransform.slice(),r={createCanvasGraphics:e=>new CanvasGraphics(e,this.commonObjs,this.objs,this.canvasFactory)};t=new s.TilingPattern(e,i,this.ctx,r,n)}else t=this._getPattern(e[1],e[2]);return t}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments);this.current.patternFill=!0}setStrokeRGBColor(e,t,i){const s=n.Util.makeHexColor(e,t,i);this.ctx.strokeStyle=s;this.current.strokeColor=s}setFillRGBColor(e,t,i){const s=n.Util.makeHexColor(e,t,i);this.ctx.fillStyle=s;this.current.fillColor=s;this.current.patternFill=!1}_getPattern(e,t=null){let i;if(this.cachedPatterns.has(e))i=this.cachedPatterns.get(e);else{i=(0,s.getShadingPattern)(this.objs.get(e),this.cachedCanvasPatterns);this.cachedPatterns.set(e,i)}t&&(i.matrix=t);return i}shadingFill(e){if(!this.contentVisible)return;const t=this.ctx;this.save();const i=this._getPattern(e);t.fillStyle=i.getPattern(t,this,t.mozCurrentTransformInverse,!0);const s=t.mozCurrentTransformInverse;if(s){const e=t.canvas,i=e.width,r=e.height,a=n.Util.applyTransform([0,0],s),o=n.Util.applyTransform([0,r],s),l=n.Util.applyTransform([i,0],s),h=n.Util.applyTransform([i,r],s),c=Math.min(a[0],o[0],l[0],h[0]),d=Math.min(a[1],o[1],l[1],h[1]),u=Math.max(a[0],o[0],l[0],h[0]),p=Math.max(a[1],o[1],l[1],h[1]);this.ctx.fillRect(c,d,u-c,p-d)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.restore()}beginInlineImage(){(0,n.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,n.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(e,t){if(this.contentVisible){this.save();this.baseTransformStack.push(this.baseTransform);Array.isArray(e)&&6===e.length&&this.transform.apply(this,e);this.baseTransform=this.ctx.mozCurrentTransform;if(t){const e=t[2]-t[0],i=t[3]-t[1];this.ctx.rect(t[0],t[1],e,i);this.clip();this.endPath()}}}paintFormXObjectEnd(){if(this.contentVisible){this.restore();this.baseTransform=this.baseTransformStack.pop()}}beginGroup(e){if(!this.contentVisible)return;this.save();const t=this.ctx;e.isolated||(0,n.info)("TODO: Support non-isolated groups.");e.knockout&&(0,n.warn)("Knockout groups not supported.");const i=t.mozCurrentTransform;e.matrix&&t.transform.apply(t,e.matrix);if(!e.bbox)throw new Error("Bounding box is required.");let s=n.Util.getAxialAlignedBoundingBox(e.bbox,t.mozCurrentTransform);const r=[0,0,t.canvas.width,t.canvas.height];s=n.Util.intersect(s,r)||[0,0,0,0];const o=Math.floor(s[0]),l=Math.floor(s[1]);let h=Math.max(Math.ceil(s[2])-o,1),c=Math.max(Math.ceil(s[3])-l,1),d=1,u=1;if(h>a){d=h/a;h=a}if(c>a){u=c/a;c=a}let p="groupAt"+this.groupLevel;e.smask&&(p+="_smask_"+this.smaskCounter++%2);const g=this.cachedCanvases.getCanvas(p,h,c,!0),f=g.context;f.scale(1/d,1/u);f.translate(-o,-l);f.transform.apply(f,i);if(e.smask)this.smaskStack.push({canvas:g.canvas,context:f,offsetX:o,offsetY:l,scaleX:d,scaleY:u,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null});else{t.setTransform(1,0,0,1,0,0);t.translate(o,l);t.scale(d,u)}copyCtxState(t,f);this.ctx=f;this.setGState([["BM","source-over"],["ca",1],["CA",1]]);this.groupStack.push(t);this.groupLevel++;this.current.activeSMask=null}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;const t=this.ctx;this.ctx=this.groupStack.pop();this.ctx.imageSmoothingEnabled=!1;e.smask?this.tempSMask=this.smaskStack.pop():this.ctx.drawImage(t.canvas,0,0);this.restore()}beginAnnotations(){this.save();this.baseTransform&&this.ctx.setTransform.apply(this.ctx,this.baseTransform)}endAnnotations(){this.restore()}beginAnnotation(e,t,i,n){this.save();resetCtxToDefault(this.ctx);this.current=new CanvasExtraState;if(Array.isArray(t)&&4===t.length){const e=t[2]-t[0],i=t[3]-t[1];this.ctx.rect(t[0],t[1],e,i);this.clip();this.endPath()}this.transform.apply(this,i);this.transform.apply(this,n)}endAnnotation(){this.restore()}paintImageMaskXObject(e){if(!this.contentVisible)return;const t=this.ctx,i=e.width,n=e.height,s=this.processingType3;s&&void 0===s.compiled&&(s.compiled=i<=1e3&&n<=1e3?function compileType3Glyph(e){const t=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),i=e.width,n=e.height,s=i+1;let r,a,o,l;const h=new Uint8Array(s*(n+1)),c=i+7&-8,d=e.data,u=new Uint8Array(c*n);let p=0;for(r=0,a=d.length;r<a;r++){const e=d[r];let t=128;for(;t>0;){u[p++]=e&t?0:255;t>>=1}}let g=0;p=0;if(0!==u[p]){h[0]=1;++g}for(o=1;o<i;o++){if(u[p]!==u[p+1]){h[o]=u[p]?2:1;++g}p++}if(0!==u[p]){h[o]=2;++g}for(r=1;r<n;r++){p=r*c;l=r*s;if(u[p-c]!==u[p]){h[l]=u[p]?1:8;++g}let e=(u[p]?4:0)+(u[p-c]?8:0);for(o=1;o<i;o++){e=(e>>2)+(u[p+1]?4:0)+(u[p-c+1]?8:0);if(t[e]){h[l+o]=t[e];++g}p++}if(u[p-c]!==u[p]){h[l+o]=u[p]?2:4;++g}if(g>1e3)return null}p=c*(n-1);l=r*s;if(0!==u[p]){h[l]=8;++g}for(o=1;o<i;o++){if(u[p]!==u[p+1]){h[l+o]=u[p]?4:8;++g}p++}if(0!==u[p]){h[l+o]=4;++g}if(g>1e3)return null;const f=new Int32Array([0,s,-1,0,-s,0,0,0,1]),m=[];for(r=0;g&&r<=n;r++){let e=r*s;const t=e+i;for(;e<t&&!h[e];)e++;if(e===t)continue;const n=[e%s,r],a=e;let o=h[e];do{const t=f[o];do{e+=t}while(!h[e]);const i=h[e];if(5!==i&&10!==i){o=i;h[e]=0}else{o=i&51*o>>4;h[e]&=o>>2|o<<2}n.push(e%s,e/s|0);h[e]||--g}while(a!==e);m.push(n);--r}return function(e){e.save();e.scale(1/i,-1/n);e.translate(0,-n);e.beginPath();for(let t=0,i=m.length;t<i;t++){const i=m[t];e.moveTo(i[0],i[1]);for(let t=2,n=i.length;t<n;t+=2)e.lineTo(i[t],i[t+1])}e.fill();e.beginPath();e.restore()}}({data:e.data,width:i,height:n}):null);if(s?.compiled){s.compiled(t);return}const r=this._createMaskCanvas(e),a=r.canvas;t.save();t.setTransform(1,0,0,1,0,0);t.drawImage(a,r.offsetX,r.offsetY);t.restore()}paintImageMaskXObjectRepeat(e,t,i=0,s=0,r,a){if(!this.contentVisible)return;const o=this.ctx;o.save();const l=o.mozCurrentTransform;o.transform(t,i,s,r,0,0);const h=this._createMaskCanvas(e);o.setTransform(1,0,0,1,0,0);for(let e=0,c=a.length;e<c;e+=2){const c=n.Util.transform(l,[t,i,s,r,a[e],a[e+1]]),[d,u]=n.Util.applyTransform([0,0],c);o.drawImage(h.canvas,d,u)}o.restore()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const t=this.ctx,i=this.current.fillColor,n=this.current.patternFill;for(let s=0,r=e.length;s<r;s++){const r=e[s],a=r.width,o=r.height,l=this.cachedCanvases.getCanvas("maskCanvas",a,o),h=l.context;h.save();putBinaryImageMask(h,r);h.globalCompositeOperation="source-in";h.fillStyle=n?i.getPattern(h,this,t.mozCurrentTransformInverse,!1):i;h.fillRect(0,0,a,o);h.restore();t.save();t.transform.apply(t,r.transform);t.scale(1,-1);t.drawImage(l.canvas,0,0,a,o,0,-1,1,1);t.restore()}}paintImageXObject(e){if(!this.contentVisible)return;const t=e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e);t?this.paintInlineImageXObject(t):(0,n.warn)("Dependent image isn't ready yet")}paintImageXObjectRepeat(e,t,i,s){if(!this.contentVisible)return;const r=e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e);if(!r){(0,n.warn)("Dependent image isn't ready yet");return}const a=r.width,o=r.height,l=[];for(let e=0,n=s.length;e<n;e+=2)l.push({transform:[t,0,0,i,s[e],s[e+1]],x:0,y:0,w:a,h:o});this.paintInlineImageXObjectGroup(r,l)}paintInlineImageXObject(e){if(!this.contentVisible)return;const t=e.width,i=e.height,n=this.ctx;this.save();n.scale(1/t,-1/i);let s;if("function"==typeof HTMLElement&&e instanceof HTMLElement||!e.data)s=e;else{const n=this.cachedCanvases.getCanvas("inlineImage",t,i);putBinaryImageData(n.context,e,this.current.transferMaps);s=n.canvas}const r=this._scaleImage(s,n.mozCurrentTransformInverse);n.imageSmoothingEnabled=getImageSmoothingEnabled(n.mozCurrentTransform,e.interpolate);n.drawImage(r.img,0,0,r.paintWidth,r.paintHeight,0,-i,t,i);if(this.imageLayer){const s=this.getCanvasPosition(0,-i);this.imageLayer.appendImage({imgData:e,left:s[0],top:s[1],width:t/n.mozCurrentTransformInverse[0],height:i/n.mozCurrentTransformInverse[3]})}this.restore()}paintInlineImageXObjectGroup(e,t){if(!this.contentVisible)return;const i=this.ctx,n=e.width,s=e.height,r=this.cachedCanvases.getCanvas("inlineImage",n,s);putBinaryImageData(r.context,e,this.current.transferMaps);for(let a=0,o=t.length;a<o;a++){const o=t[a];i.save();i.transform.apply(i,o.transform);i.scale(1,-1);i.drawImage(r.canvas,o.x,o.y,o.w,o.h,0,-1,1,1);if(this.imageLayer){const t=this.getCanvasPosition(o.x,o.y);this.imageLayer.appendImage({imgData:e,left:t[0],top:t[1],width:n,height:s})}i.restore()}}paintSolidColorImageMask(){this.contentVisible&&this.ctx.fillRect(0,0,1,1)}markPoint(e){}markPointProps(e,t){}beginMarkedContent(e){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t){"OC"===e?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(t)}):this.markedContentStack.push({visible:!0});this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop();this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(){const e=this.ctx;if(this.pendingClip){this.pendingClip===d?e.clip("evenodd"):e.clip();this.pendingClip=null}e.beginPath()}getSinglePixelWidth(){if(null===this._cachedGetSinglePixelWidth){const e=this.ctx.mozCurrentTransform,t=Math.abs(e[0]*e[3]-e[2]*e[1]),i=e[0]**2+e[2]**2,n=e[1]**2+e[3]**2,s=Math.sqrt(Math.max(i,n))/t;i!==n&&this._combinedScaleFactor*s>1?this._cachedGetSinglePixelWidth=-this._combinedScaleFactor*s:t>Number.EPSILON?this._cachedGetSinglePixelWidth=s:this._cachedGetSinglePixelWidth=1}return this._cachedGetSinglePixelWidth}getCanvasPosition(e,t){const i=this.ctx.mozCurrentTransform;return[i[0]*e+i[2]*t+i[4],i[1]*e+i[3]*t+i[5]]}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}}t.CanvasGraphics=CanvasGraphics;for(const e in n.OPS)void 0!==CanvasGraphics.prototype[e]&&(CanvasGraphics.prototype[n.OPS[e]]=CanvasGraphics.prototype[e])},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.getShadingPattern=function getShadingPattern(e,t){switch(e[0]){case"RadialAxial":return new RadialAxialShadingPattern(e,t);case"Mesh":return new MeshShadingPattern(e);case"Dummy":return new DummyShadingPattern}throw new Error(`Unknown IR type: ${e[0]}`)};t.TilingPattern=void 0;var n=i(2);function applyBoundingBox(e,t){if(!t||"undefined"==typeof Path2D)return;const i=t[2]-t[0],n=t[3]-t[1],s=new Path2D;s.rect(t[0],t[1],i,n);e.clip(s)}class BaseShadingPattern{constructor(){this.constructor===BaseShadingPattern&&(0,n.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,n.unreachable)("Abstract method `getPattern` called.")}}class RadialAxialShadingPattern extends BaseShadingPattern{constructor(e,t){super();this._type=e[1];this._bbox=e[2];this._colorStops=e[3];this._p0=e[4];this._p1=e[5];this._r0=e[6];this._r1=e[7];this.matrix=null;this.cachedCanvasPatterns=t}_createGradient(e){let t;"axial"===this._type?t=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(t=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const e of this._colorStops)t.addColorStop(e[0],e[1]);return t}getPattern(e,t,i,s=!1){let r;if(s){applyBoundingBox(e,this._bbox);r=this._createGradient(e)}else if(this.cachedCanvasPatterns.has(this))r=this.cachedCanvasPatterns.get(this);else{const i=t.cachedCanvases.getCanvas("pattern",t.ctx.canvas.width,t.ctx.canvas.height,!0),n=i.context;n.clearRect(0,0,n.canvas.width,n.canvas.height);n.beginPath();n.rect(0,0,n.canvas.width,n.canvas.height);n.setTransform.apply(n,t.baseTransform);this.matrix&&n.transform.apply(n,this.matrix);applyBoundingBox(n,this._bbox);n.fillStyle=this._createGradient(n);n.fill();r=e.createPattern(i.canvas,"repeat");this.cachedCanvasPatterns.set(this,r)}if(!s){const e=new DOMMatrix(i);try{r.setTransform(e)}catch(e){(0,n.warn)(`RadialAxialShadingPattern.getPattern: "${e?.message}".`)}}return r}}function drawTriangle(e,t,i,n,s,r,a,o){const l=t.coords,h=t.colors,c=e.data,d=4*e.width;let u;if(l[i+1]>l[n+1]){u=i;i=n;n=u;u=r;r=a;a=u}if(l[n+1]>l[s+1]){u=n;n=s;s=u;u=a;a=o;o=u}if(l[i+1]>l[n+1]){u=i;i=n;n=u;u=r;r=a;a=u}const p=(l[i]+t.offsetX)*t.scaleX,g=(l[i+1]+t.offsetY)*t.scaleY,f=(l[n]+t.offsetX)*t.scaleX,m=(l[n+1]+t.offsetY)*t.scaleY,_=(l[s]+t.offsetX)*t.scaleX,b=(l[s+1]+t.offsetY)*t.scaleY;if(g>=b)return;const w=h[r],v=h[r+1],y=h[r+2],S=h[a],P=h[a+1],A=h[a+2],C=h[o],x=h[o+1],E=h[o+2],T=Math.round(g),L=Math.round(b);let k,I,R,F,D,M,O,N;for(let e=T;e<=L;e++){if(e<m){let t;t=e<g?0:(g-e)/(g-m);k=p-(p-f)*t;I=w-(w-S)*t;R=v-(v-P)*t;F=y-(y-A)*t}else{let t;t=e>b?1:m===b?0:(m-e)/(m-b);k=f-(f-_)*t;I=S-(S-C)*t;R=P-(P-x)*t;F=A-(A-E)*t}let t;t=e<g?0:e>b?1:(g-e)/(g-b);D=p-(p-_)*t;M=w-(w-C)*t;O=v-(v-x)*t;N=y-(y-E)*t;const i=Math.round(Math.min(k,D)),n=Math.round(Math.max(k,D));let s=d*e+4*i;for(let e=i;e<=n;e++){t=(k-e)/(k-D);t<0?t=0:t>1&&(t=1);c[s++]=I-(I-M)*t|0;c[s++]=R-(R-O)*t|0;c[s++]=F-(F-N)*t|0;c[s++]=255}}}function drawFigure(e,t,i){const n=t.coords,s=t.colors;let r,a;switch(t.type){case"lattice":const o=t.verticesPerRow,l=Math.floor(n.length/o)-1,h=o-1;for(r=0;r<l;r++){let t=r*o;for(let r=0;r<h;r++,t++){drawTriangle(e,i,n[t],n[t+1],n[t+o],s[t],s[t+1],s[t+o]);drawTriangle(e,i,n[t+o+1],n[t+1],n[t+o],s[t+o+1],s[t+1],s[t+o])}}break;case"triangles":for(r=0,a=n.length;r<a;r+=3)drawTriangle(e,i,n[r],n[r+1],n[r+2],s[r],s[r+1],s[r+2]);break;default:throw new Error("illegal figure")}}class MeshShadingPattern extends BaseShadingPattern{constructor(e){super();this._coords=e[2];this._colors=e[3];this._figures=e[4];this._bounds=e[5];this._bbox=e[7];this._background=e[8];this.matrix=null}_createMeshCanvas(e,t,i){const n=Math.floor(this._bounds[0]),s=Math.floor(this._bounds[1]),r=Math.ceil(this._bounds[2])-n,a=Math.ceil(this._bounds[3])-s,o=Math.min(Math.ceil(Math.abs(r*e[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(a*e[1]*1.1)),3e3),h=r/o,c=a/l,d={coords:this._coords,colors:this._colors,offsetX:-n,offsetY:-s,scaleX:1/h,scaleY:1/c},u=o+4,p=l+4,g=i.getCanvas("mesh",u,p,!1),f=g.context,m=f.createImageData(o,l);if(t){const e=m.data;for(let i=0,n=e.length;i<n;i+=4){e[i]=t[0];e[i+1]=t[1];e[i+2]=t[2];e[i+3]=255}}for(const e of this._figures)drawFigure(m,e,d);f.putImageData(m,2,2);return{canvas:g.canvas,offsetX:n-2*h,offsetY:s-2*c,scaleX:h,scaleY:c}}getPattern(e,t,i,s=!1){applyBoundingBox(e,this._bbox);let r;if(s)r=n.Util.singularValueDecompose2dScale(e.mozCurrentTransform);else{r=n.Util.singularValueDecompose2dScale(t.baseTransform);if(this.matrix){const e=n.Util.singularValueDecompose2dScale(this.matrix);r=[r[0]*e[0],r[1]*e[1]]}}const a=this._createMeshCanvas(r,s?null:this._background,t.cachedCanvases);if(!s){e.setTransform.apply(e,t.baseTransform);this.matrix&&e.transform.apply(e,this.matrix)}e.translate(a.offsetX,a.offsetY);e.scale(a.scaleX,a.scaleY);return e.createPattern(a.canvas,"no-repeat")}}class DummyShadingPattern extends BaseShadingPattern{getPattern(){return"hotpink"}}const s=1,r=2;class TilingPattern{static get MAX_PATTERN_SIZE(){return(0,n.shadow)(this,"MAX_PATTERN_SIZE",3e3)}constructor(e,t,i,n,s){this.operatorList=e[2];this.matrix=e[3]||[1,0,0,1,0,0];this.bbox=e[4];this.xstep=e[5];this.ystep=e[6];this.paintType=e[7];this.tilingType=e[8];this.color=t;this.ctx=i;this.canvasGraphicsFactory=n;this.baseTransform=s}createPatternCanvas(e){const t=this.operatorList,i=this.bbox,s=this.xstep,r=this.ystep,a=this.paintType,o=this.tilingType,l=this.color,h=this.canvasGraphicsFactory;(0,n.info)("TilingType: "+o);const c=i[0],d=i[1],u=i[2],p=i[3],g=n.Util.singularValueDecompose2dScale(this.matrix),f=n.Util.singularValueDecompose2dScale(this.baseTransform),m=[g[0]*f[0],g[1]*f[1]],_=this.getSizeAndScale(s,this.ctx.canvas.width,m[0]),b=this.getSizeAndScale(r,this.ctx.canvas.height,m[1]),w=e.cachedCanvases.getCanvas("pattern",_.size,b.size,!0),v=w.context,y=h.createCanvasGraphics(v);y.groupLevel=e.groupLevel;this.setFillAndStrokeStyleToContext(y,a,l);let S=c,P=d,A=u,C=p;if(c<0){S=0;A+=Math.abs(c)}if(d<0){P=0;C+=Math.abs(d)}v.translate(-_.scale*S,-b.scale*P);y.transform(_.scale,0,0,b.scale,0,0);this.clipBbox(y,S,P,A,C);y.baseTransform=y.ctx.mozCurrentTransform.slice();y.executeOperatorList(t);y.endDrawing();return{canvas:w.canvas,scaleX:_.scale,scaleY:b.scale,offsetX:S,offsetY:P}}getSizeAndScale(e,t,i){e=Math.abs(e);const n=Math.max(TilingPattern.MAX_PATTERN_SIZE,t);let s=Math.ceil(e*i);s>=n?s=n:i=s/e;return{scale:i,size:s}}clipBbox(e,t,i,n,s){const r=n-t,a=s-i;e.ctx.rect(t,i,r,a);e.clip();e.endPath()}setFillAndStrokeStyleToContext(e,t,i){const a=e.ctx,o=e.current;switch(t){case s:const e=this.ctx;a.fillStyle=e.fillStyle;a.strokeStyle=e.strokeStyle;o.fillColor=e.fillStyle;o.strokeColor=e.strokeStyle;break;case r:const l=n.Util.makeHexColor(i[0],i[1],i[2]);a.fillStyle=l;a.strokeStyle=l;o.fillColor=l;o.strokeColor=l;break;default:throw new n.FormatError(`Unsupported paint type: ${t}`)}}getPattern(e,t,i,s=!1){let r=i;if(!s){r=n.Util.transform(r,t.baseTransform);this.matrix&&(r=n.Util.transform(r,this.matrix))}const a=this.createPatternCanvas(t);let o=new DOMMatrix(r);o=o.translate(a.offsetX,a.offsetY);o=o.scale(1/a.scaleX,1/a.scaleY);const l=e.createPattern(a.canvas,"repeat");try{l.setTransform(o)}catch(e){(0,n.warn)(`TilingPattern.getPattern: "${e?.message}".`)}return l}}t.TilingPattern=TilingPattern},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.GlobalWorkerOptions=void 0;const i=Object.create(null);t.GlobalWorkerOptions=i;i.workerPort=void 0===i.workerPort?null:i.workerPort;i.workerSrc=void 0===i.workerSrc?"":i.workerSrc},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.MessageHandler=void 0;var n=i(2);const s=1,r=2,a=1,o=2,l=3,h=4,c=5,d=6,u=7,p=8;function wrapReason(e){if(!(e instanceof Error||"object"==typeof e&&null!==e)){(0,n.warn)('wrapReason: Expected "reason" to be a (possibly cloned) Error.');return e}switch(e.name){case"AbortException":return new n.AbortException(e.message);case"MissingPDFException":return new n.MissingPDFException(e.message);case"PasswordException":return new n.PasswordException(e.message,e.code);case"UnexpectedResponseException":return new n.UnexpectedResponseException(e.message,e.status);case"UnknownErrorException":return new n.UnknownErrorException(e.message,e.details);default:return new n.UnknownErrorException(e.message,e.toString())}}t.MessageHandler=class MessageHandler{constructor(e,t,i){this.sourceName=e;this.targetName=t;this.comObj=i;this.callbackId=1;this.streamId=1;this.postMessageTransfers=!0;this.streamSinks=Object.create(null);this.streamControllers=Object.create(null);this.callbackCapabilities=Object.create(null);this.actionHandler=Object.create(null);this._onComObjOnMessage=e=>{const t=e.data;if(t.targetName!==this.sourceName)return;if(t.stream){this._processStreamMessage(t);return}if(t.callback){const e=t.callbackId,i=this.callbackCapabilities[e];if(!i)throw new Error(`Cannot resolve callback ${e}`);delete this.callbackCapabilities[e];if(t.callback===s)i.resolve(t.data);else{if(t.callback!==r)throw new Error("Unexpected callback case");i.reject(wrapReason(t.reason))}return}const n=this.actionHandler[t.action];if(!n)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){const e=this.sourceName,a=t.sourceName;new Promise((function(e){e(n(t.data))})).then((function(n){i.postMessage({sourceName:e,targetName:a,callback:s,callbackId:t.callbackId,data:n})}),(function(n){i.postMessage({sourceName:e,targetName:a,callback:r,callbackId:t.callbackId,reason:wrapReason(n)})}))}else t.streamId?this._createStreamSink(t):n(t.data)};i.addEventListener("message",this._onComObjOnMessage)}on(e,t){const i=this.actionHandler;if(i[e])throw new Error(`There is already an actionName called "${e}"`);i[e]=t}send(e,t,i){this._postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},i)}sendWithPromise(e,t,i){const s=this.callbackId++,r=(0,n.createPromiseCapability)();this.callbackCapabilities[s]=r;try{this._postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:s,data:t},i)}catch(e){r.reject(e)}return r.promise}sendWithStream(e,t,i,s){const r=this.streamId++,o=this.sourceName,l=this.targetName,h=this.comObj;return new ReadableStream({start:i=>{const a=(0,n.createPromiseCapability)();this.streamControllers[r]={controller:i,startCall:a,pullCall:null,cancelCall:null,isClosed:!1};this._postMessage({sourceName:o,targetName:l,action:e,streamId:r,data:t,desiredSize:i.desiredSize},s);return a.promise},pull:e=>{const t=(0,n.createPromiseCapability)();this.streamControllers[r].pullCall=t;h.postMessage({sourceName:o,targetName:l,stream:d,streamId:r,desiredSize:e.desiredSize});return t.promise},cancel:e=>{(0,n.assert)(e instanceof Error,"cancel must have a valid reason");const t=(0,n.createPromiseCapability)();this.streamControllers[r].cancelCall=t;this.streamControllers[r].isClosed=!0;h.postMessage({sourceName:o,targetName:l,stream:a,streamId:r,reason:wrapReason(e)});return t.promise}},i)}_createStreamSink(e){const t=e.streamId,i=this.sourceName,s=e.sourceName,r=this.comObj,a=this,o=this.actionHandler[e.action],d={enqueue(e,r=1,o){if(this.isCancelled)return;const l=this.desiredSize;this.desiredSize-=r;if(l>0&&this.desiredSize<=0){this.sinkCapability=(0,n.createPromiseCapability)();this.ready=this.sinkCapability.promise}a._postMessage({sourceName:i,targetName:s,stream:h,streamId:t,chunk:e},o)},close(){if(!this.isCancelled){this.isCancelled=!0;r.postMessage({sourceName:i,targetName:s,stream:l,streamId:t});delete a.streamSinks[t]}},error(e){(0,n.assert)(e instanceof Error,"error must have a valid reason");if(!this.isCancelled){this.isCancelled=!0;r.postMessage({sourceName:i,targetName:s,stream:c,streamId:t,reason:wrapReason(e)})}},sinkCapability:(0,n.createPromiseCapability)(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};d.sinkCapability.resolve();d.ready=d.sinkCapability.promise;this.streamSinks[t]=d;new Promise((function(t){t(o(e.data,d))})).then((function(){r.postMessage({sourceName:i,targetName:s,stream:p,streamId:t,success:!0})}),(function(e){r.postMessage({sourceName:i,targetName:s,stream:p,streamId:t,reason:wrapReason(e)})}))}_processStreamMessage(e){const t=e.streamId,i=this.sourceName,s=e.sourceName,r=this.comObj,g=this.streamControllers[t],f=this.streamSinks[t];switch(e.stream){case p:e.success?g.startCall.resolve():g.startCall.reject(wrapReason(e.reason));break;case u:e.success?g.pullCall.resolve():g.pullCall.reject(wrapReason(e.reason));break;case d:if(!f){r.postMessage({sourceName:i,targetName:s,stream:u,streamId:t,success:!0});break}f.desiredSize<=0&&e.desiredSize>0&&f.sinkCapability.resolve();f.desiredSize=e.desiredSize;new Promise((function(e){e(f.onPull&&f.onPull())})).then((function(){r.postMessage({sourceName:i,targetName:s,stream:u,streamId:t,success:!0})}),(function(e){r.postMessage({sourceName:i,targetName:s,stream:u,streamId:t,reason:wrapReason(e)})}));break;case h:(0,n.assert)(g,"enqueue should have stream controller");if(g.isClosed)break;g.controller.enqueue(e.chunk);break;case l:(0,n.assert)(g,"close should have stream controller");if(g.isClosed)break;g.isClosed=!0;g.controller.close();this._deleteStreamController(g,t);break;case c:(0,n.assert)(g,"error should have stream controller");g.controller.error(wrapReason(e.reason));this._deleteStreamController(g,t);break;case o:e.success?g.cancelCall.resolve():g.cancelCall.reject(wrapReason(e.reason));this._deleteStreamController(g,t);break;case a:if(!f)break;new Promise((function(t){t(f.onCancel&&f.onCancel(wrapReason(e.reason)))})).then((function(){r.postMessage({sourceName:i,targetName:s,stream:o,streamId:t,success:!0})}),(function(e){r.postMessage({sourceName:i,targetName:s,stream:o,streamId:t,reason:wrapReason(e)})}));f.sinkCapability.reject(wrapReason(e.reason));f.isCancelled=!0;delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}async _deleteStreamController(e,t){await Promise.allSettled([e.startCall&&e.startCall.promise,e.pullCall&&e.pullCall.promise,e.cancelCall&&e.cancelCall.promise]);delete this.streamControllers[t]}_postMessage(e,t){t&&this.postMessageTransfers?this.comObj.postMessage(e,t):this.comObj.postMessage(e)}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.Metadata=void 0;var n=i(2);t.Metadata=class Metadata{constructor({parsedData:e,rawData:t}){this._metadataMap=e;this._data=t}getRaw(){return this._data}get(e){return this._metadataMap.get(e)??null}getAll(){return(0,n.objectFromMap)(this._metadataMap)}has(e){return this._metadataMap.has(e)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.OptionalContentConfig=void 0;var n=i(2);class OptionalContentGroup{constructor(e,t){this.visible=!0;this.name=e;this.intent=t}}t.OptionalContentConfig=class OptionalContentConfig{constructor(e){this.name=null;this.creator=null;this._order=null;this._groups=new Map;if(null!==e){this.name=e.name;this.creator=e.creator;this._order=e.order;for(const t of e.groups)this._groups.set(t.id,new OptionalContentGroup(t.name,t.intent));if("OFF"===e.baseState)for(const e of this._groups)e.visible=!1;for(const t of e.on)this._groups.get(t).visible=!0;for(const t of e.off)this._groups.get(t).visible=!1}}_evaluateVisibilityExpression(e){const t=e.length;if(t<2)return!0;const i=e[0];for(let s=1;s<t;s++){const t=e[s];let r;if(Array.isArray(t))r=this._evaluateVisibilityExpression(t);else{if(!this._groups.has(t)){(0,n.warn)(`Optional content group not found: ${t}`);return!0}r=this._groups.get(t).visible}switch(i){case"And":if(!r)return!1;break;case"Or":if(r)return!0;break;case"Not":return!r;default:return!0}}return"And"===i}isVisible(e){if(0===this._groups.size)return!0;if(!e){(0,n.warn)("Optional content group not defined.");return!0}if("OCG"===e.type){if(!this._groups.has(e.id)){(0,n.warn)(`Optional content group not found: ${e.id}`);return!0}return this._groups.get(e.id).visible}if("OCMD"===e.type){if(e.expression)return this._evaluateVisibilityExpression(e.expression);if(!e.policy||"AnyOn"===e.policy){for(const t of e.ids){if(!this._groups.has(t)){(0,n.warn)(`Optional content group not found: ${t}`);return!0}if(this._groups.get(t).visible)return!0}return!1}if("AllOn"===e.policy){for(const t of e.ids){if(!this._groups.has(t)){(0,n.warn)(`Optional content group not found: ${t}`);return!0}if(!this._groups.get(t).visible)return!1}return!0}if("AnyOff"===e.policy){for(const t of e.ids){if(!this._groups.has(t)){(0,n.warn)(`Optional content group not found: ${t}`);return!0}if(!this._groups.get(t).visible)return!0}return!1}if("AllOff"===e.policy){for(const t of e.ids){if(!this._groups.has(t)){(0,n.warn)(`Optional content group not found: ${t}`);return!0}if(this._groups.get(t).visible)return!1}return!0}(0,n.warn)(`Unknown optional content policy ${e.policy}.`);return!0}(0,n.warn)(`Unknown group type ${e.type}.`);return!0}setVisibility(e,t=!0){this._groups.has(e)?this._groups.get(e).visible=!!t:(0,n.warn)(`Optional content group not found: ${e}`)}getOrder(){return this._groups.size?this._order?this._order.slice():Array.from(this._groups.keys()):null}getGroups(){return this._groups.size>0?(0,n.objectFromMap)(this._groups):null}getGroup(e){return this._groups.get(e)||null}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFDataTransportStream=void 0;var n=i(2),s=i(1);t.PDFDataTransportStream=class PDFDataTransportStream{constructor(e,t){(0,n.assert)(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');this._queuedChunks=[];this._progressiveDone=e.progressiveDone||!1;this._contentDispositionFilename=e.contentDispositionFilename||null;const i=e.initialData;if(i?.length>0){const e=new Uint8Array(i).buffer;this._queuedChunks.push(e)}this._pdfDataRangeTransport=t;this._isStreamingSupported=!e.disableStream;this._isRangeSupported=!e.disableRange;this._contentLength=e.length;this._fullRequestReader=null;this._rangeReaders=[];this._pdfDataRangeTransport.addRangeListener(((e,t)=>{this._onReceiveData({begin:e,chunk:t})}));this._pdfDataRangeTransport.addProgressListener(((e,t)=>{this._onProgress({loaded:e,total:t})}));this._pdfDataRangeTransport.addProgressiveReadListener((e=>{this._onReceiveData({chunk:e})}));this._pdfDataRangeTransport.addProgressiveDoneListener((()=>{this._onProgressiveDone()}));this._pdfDataRangeTransport.transportReady()}_onReceiveData(e){const t=new Uint8Array(e.chunk).buffer;if(void 0===e.begin)this._fullRequestReader?this._fullRequestReader._enqueue(t):this._queuedChunks.push(t);else{const i=this._rangeReaders.some((function(i){if(i._begin!==e.begin)return!1;i._enqueue(t);return!0}));(0,n.assert)(i,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(e){if(void 0===e.total){const t=this._rangeReaders[0];t?.onProgress&&t.onProgress({loaded:e.loaded})}else{const t=this._fullRequestReader;t?.onProgress&&t.onProgress({loaded:e.loaded,total:e.total})}}_onProgressiveDone(){this._fullRequestReader&&this._fullRequestReader.progressiveDone();this._progressiveDone=!0}_removeRangeReader(e){const t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){(0,n.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;this._queuedChunks=null;return new PDFDataTransportStreamReader(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const i=new PDFDataTransportStreamRangeReader(this,e,t);this._pdfDataRangeTransport.requestDataRange(e,t);this._rangeReaders.push(i);return i}cancelAllRequests(e){this._fullRequestReader&&this._fullRequestReader.cancel(e);for(const t of this._rangeReaders.slice(0))t.cancel(e);this._pdfDataRangeTransport.abort()}};class PDFDataTransportStreamReader{constructor(e,t,i=!1,n=null){this._stream=e;this._done=i||!1;this._filename=(0,s.isPdfFile)(n)?n:null;this._queuedChunks=t||[];this._loaded=0;for(const e of this._queuedChunks)this._loaded+=e.byteLength;this._requests=[];this._headersReady=Promise.resolve();e._fullRequestReader=this;this.onProgress=null}_enqueue(e){if(!this._done){if(this._requests.length>0){this._requests.shift().resolve({value:e,done:!1})}else this._queuedChunks.push(e);this._loaded+=e.byteLength}}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0){return{value:this._queuedChunks.shift(),done:!1}}if(this._done)return{value:void 0,done:!0};const e=(0,n.createPromiseCapability)();this._requests.push(e);return e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class PDFDataTransportStreamRangeReader{constructor(e,t,i){this._stream=e;this._begin=t;this._end=i;this._queuedChunk=null;this._requests=[];this._done=!1;this.onProgress=null}_enqueue(e){if(!this._done){if(0===this._requests.length)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0;this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const e=this._queuedChunk;this._queuedChunk=null;return{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=(0,n.createPromiseCapability)();this._requests.push(e);return e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0;this._stream._removeRangeReader(this)}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.XfaText=void 0;class XfaText{static textContent(e){const t=[],i={items:t,styles:Object.create(null)};!function walk(e){if(!e)return;let i=null;const n=e.name;if("#text"===n)i=e.value;else{if(!XfaText.shouldBuildText(n))return;e?.attributes?.textContent?i=e.attributes.textContent:e.value&&(i=e.value)}null!==i&&t.push({str:i});if(e.children)for(const t of e.children)walk(t)}(e);return i}static shouldBuildText(e){return!("textarea"===e||"input"===e||"option"===e||"select"===e)}}t.XfaText=XfaText},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.AnnotationLayer=void 0;var n=i(2),s=i(1),r=i(9),a=i(19);const o=1e3,l=new WeakSet;class AnnotationElementFactory{static create(e){switch(e.data.annotationType){case n.AnnotationType.LINK:return new LinkAnnotationElement(e);case n.AnnotationType.TEXT:return new TextAnnotationElement(e);case n.AnnotationType.WIDGET:switch(e.data.fieldType){case"Tx":return new TextWidgetAnnotationElement(e);case"Btn":return e.data.radioButton?new RadioButtonWidgetAnnotationElement(e):e.data.checkBox?new CheckboxWidgetAnnotationElement(e):new PushButtonWidgetAnnotationElement(e);case"Ch":return new ChoiceWidgetAnnotationElement(e)}return new WidgetAnnotationElement(e);case n.AnnotationType.POPUP:return new PopupAnnotationElement(e);case n.AnnotationType.FREETEXT:return new FreeTextAnnotationElement(e);case n.AnnotationType.LINE:return new LineAnnotationElement(e);case n.AnnotationType.SQUARE:return new SquareAnnotationElement(e);case n.AnnotationType.CIRCLE:return new CircleAnnotationElement(e);case n.AnnotationType.POLYLINE:return new PolylineAnnotationElement(e);case n.AnnotationType.CARET:return new CaretAnnotationElement(e);case n.AnnotationType.INK:return new InkAnnotationElement(e);case n.AnnotationType.POLYGON:return new PolygonAnnotationElement(e);case n.AnnotationType.HIGHLIGHT:return new HighlightAnnotationElement(e);case n.AnnotationType.UNDERLINE:return new UnderlineAnnotationElement(e);case n.AnnotationType.SQUIGGLY:return new SquigglyAnnotationElement(e);case n.AnnotationType.STRIKEOUT:return new StrikeOutAnnotationElement(e);case n.AnnotationType.STAMP:return new StampAnnotationElement(e);case n.AnnotationType.FILEATTACHMENT:return new FileAttachmentAnnotationElement(e);default:return new AnnotationElement(e)}}}class AnnotationElement{constructor(e,{isRenderable:t=!1,ignoreBorder:i=!1,createQuadrilaterals:n=!1}={}){this.isRenderable=t;this.data=e.data;this.layer=e.layer;this.page=e.page;this.viewport=e.viewport;this.linkService=e.linkService;this.downloadManager=e.downloadManager;this.imageResourcesPath=e.imageResourcesPath;this.renderForms=e.renderForms;this.svgFactory=e.svgFactory;this.annotationStorage=e.annotationStorage;this.enableScripting=e.enableScripting;this.hasJSActions=e.hasJSActions;this._fieldObjects=e.fieldObjects;this._mouseState=e.mouseState;t&&(this.container=this._createContainer(i));n&&(this.quadrilaterals=this._createQuadrilaterals(i))}_createContainer(e=!1){const t=this.data,i=this.page,s=this.viewport,r=document.createElement("section");let a=t.rect[2]-t.rect[0],o=t.rect[3]-t.rect[1];r.setAttribute("data-annotation-id",t.id);const l=n.Util.normalizeRect([t.rect[0],i.view[3]-t.rect[1]+i.view[1],t.rect[2],i.view[3]-t.rect[3]+i.view[1]]);r.style.transform=`matrix(${s.transform.join(",")})`;r.style.transformOrigin=`${-l[0]}px ${-l[1]}px`;if(!e&&t.borderStyle.width>0){r.style.borderWidth=`${t.borderStyle.width}px`;if(t.borderStyle.style!==n.AnnotationBorderStyleType.UNDERLINE){a-=2*t.borderStyle.width;o-=2*t.borderStyle.width}const e=t.borderStyle.horizontalCornerRadius,i=t.borderStyle.verticalCornerRadius;if(e>0||i>0){const t=`${e}px / ${i}px`;r.style.borderRadius=t}switch(t.borderStyle.style){case n.AnnotationBorderStyleType.SOLID:r.style.borderStyle="solid";break;case n.AnnotationBorderStyleType.DASHED:r.style.borderStyle="dashed";break;case n.AnnotationBorderStyleType.BEVELED:(0,n.warn)("Unimplemented border style: beveled");break;case n.AnnotationBorderStyleType.INSET:(0,n.warn)("Unimplemented border style: inset");break;case n.AnnotationBorderStyleType.UNDERLINE:r.style.borderBottomStyle="solid"}t.borderColor||t.color||null?r.style.borderColor=n.Util.makeHexColor(0|t.color[0],0|t.color[1],0|t.color[2]):r.style.borderWidth=0}r.style.left=`${l[0]}px`;r.style.top=`${l[1]}px`;r.style.width=`${a}px`;r.style.height=`${o}px`;return r}_createQuadrilaterals(e=!1){if(!this.data.quadPoints)return null;const t=[],i=this.data.rect;for(const i of this.data.quadPoints){this.data.rect=[i[2].x,i[2].y,i[1].x,i[1].y];t.push(this._createContainer(e))}this.data.rect=i;return t}_createPopup(e,t){let i=this.container;if(this.quadrilaterals){e=e||this.quadrilaterals;i=this.quadrilaterals[0]}if(!e){(e=document.createElement("div")).style.height=i.style.height;e.style.width=i.style.width;i.appendChild(e)}const n=new PopupElement({container:i,trigger:e,color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,hideWrapper:!0}).render();n.style.left=i.style.width;i.appendChild(n)}_renderQuadrilaterals(e){for(const t of this.quadrilaterals)t.className=e;return this.quadrilaterals}render(){(0,n.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){const i=[];if(this._fieldObjects){const s=this._fieldObjects[e];if(s)for(const{page:e,id:r,exportValues:a}of s){if(-1===e)continue;if(r===t)continue;const s="string"==typeof a?a:null,o=document.getElementById(r);!o||l.has(o)?i.push({id:r,exportValue:s,domElement:o}):(0,n.warn)(`_getElementsByName - element not allowed: ${r}`)}return i}for(const n of document.getElementsByName(e)){const{id:e,exportValue:s}=n;e!==t&&(l.has(n)&&i.push({id:e,exportValue:s,domElement:n}))}return i}static get platform(){const e="undefined"!=typeof navigator?navigator.platform:"";return(0,n.shadow)(this,"platform",{isWin:e.includes("Win"),isMac:e.includes("Mac")})}}class LinkAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.url||e.data.dest||e.data.action||e.data.isTooltipOnly||e.data.resetForm||e.data.actions&&(e.data.actions.Action||e.data.actions["Mouse Up"]||e.data.actions["Mouse Down"])),createQuadrilaterals:!0})}render(){const{data:e,linkService:t}=this,i=document.createElement("a");if(e.url){t.addLinkAttributes||(0,n.warn)("LinkAnnotationElement.render - missing `addLinkAttributes`-method on the `linkService`-instance.");t.addLinkAttributes?.(i,e.url,e.newWindow)}else if(e.action)this._bindNamedAction(i,e.action);else if(e.dest)this._bindLink(i,e.dest);else{let t=!1;if(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions){t=!0;this._bindJSAction(i,e)}e.resetForm?this._bindResetFormAction(i,e.resetForm):t||this._bindLink(i,"")}if(this.quadrilaterals)return this._renderQuadrilaterals("linkAnnotation").map(((e,t)=>{const n=0===t?i:i.cloneNode();e.appendChild(n);return e}));this.container.className="linkAnnotation";this.container.appendChild(i);return this.container}_bindLink(e,t){e.href=this.linkService.getDestinationHash(t);e.onclick=()=>{t&&this.linkService.goToDestination(t);return!1};(t||""===t)&&(e.className="internalLink")}_bindNamedAction(e,t){e.href=this.linkService.getAnchorUrl("");e.onclick=()=>{this.linkService.executeNamedAction(t);return!1};e.className="internalLink"}_bindJSAction(e,t){e.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(t.actions)){const s=i.get(n);s&&(e[s]=()=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t.id,name:n}});return!1})}e.onclick||(e.onclick=()=>!1);e.className="internalLink"}_bindResetFormAction(e,t){const i=e.onclick;i||(e.href=this.linkService.getAnchorUrl(""));e.className="internalLink";if(this._fieldObjects)e.onclick=()=>{i&&i();const{fields:e,refs:n,include:s}=t,r=[];if(0!==e.length||0!==n.length){const t=new Set(n);for(const i of e){const e=this._fieldObjects[i]||[];for(const{id:i}of e)t.add(i)}for(const e of Object.values(this._fieldObjects))for(const i of e)t.has(i.id)===s&&r.push(i)}else for(const e of Object.values(this._fieldObjects))r.push(...e);const a=this.annotationStorage,o=[];for(const e of r){const{id:t}=e;o.push(t);switch(e.type){case"text":{const i=e.defaultValue||"";a.setValue(t,{value:i,valueAsString:i});break}case"checkbox":case"radiobutton":{const i=e.defaultValue===e.exportValues;a.setValue(t,{value:i});break}case"combobox":case"listbox":{const i=e.defaultValue||"";a.setValue(t,{value:i});break}default:continue}const i=document.getElementById(t);i&&l.has(i)&&i.dispatchEvent(new Event("resetform"))}this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:o,name:"ResetForm"}});return!1};else{(0,n.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.');i||(e.onclick=()=>!1)}}}class TextAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str)})}render(){this.container.className="textAnnotation";const e=document.createElement("img");e.style.height=this.container.style.height;e.style.width=this.container.style.width;e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg";e.alt="[{{type}} Annotation]";e.dataset.l10nId="text_annotation_type";e.dataset.l10nArgs=JSON.stringify({type:this.data.name});this.data.hasPopup||this._createPopup(e,this.data);this.container.appendChild(e);return this.container}}class WidgetAnnotationElement extends AnnotationElement{render(){this.data.alternativeText&&(this.container.title=this.data.alternativeText);return this.container}_getKeyModifier(e){const{isWin:t,isMac:i}=AnnotationElement.platform;return t&&e.ctrlKey||i&&e.metaKey}_setEventListener(e,t,i,n){t.includes("mouse")?e.addEventListener(t,(e=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(e),shift:e.shiftKey,modifier:this._getKeyModifier(e)}})})):e.addEventListener(t,(e=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:e.target.checked}})}))}_setEventListeners(e,t,i){for(const[n,s]of t)("Action"===s||this.data.actions?.[s])&&this._setEventListener(e,n,s,i)}_setBackgroundColor(e){const t=this.data.backgroundColor||null;e.style.backgroundColor=null===t?"transparent":n.Util.makeHexColor(t[0],t[1],t[2])}_dispatchEventFromSandbox(e,t){const setColor=(e,t,i)=>{const n=i.detail[e];i.target.style[t]=a.ColorConverters[`${n[0]}_HTML`](n.slice(1))},i={display:e=>{const t=e.detail.display%2==1;e.target.style.visibility=t?"hidden":"visible";this.annotationStorage.setValue(this.data.id,this.data.fieldName,{hidden:t,print:0===e.detail.display||3===e.detail.display})},print:e=>{this.annotationStorage.setValue(this.data.id,this.data.fieldName,{print:e.detail.print})},hidden:e=>{e.target.style.visibility=e.detail.hidden?"hidden":"visible";this.annotationStorage.setValue(this.data.id,this.data.fieldName,{hidden:e.detail.hidden})},focus:e=>{setTimeout((()=>e.target.focus({preventScroll:!1})),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.detail.readonly?e.target.setAttribute("readonly",""):e.target.removeAttribute("readonly")},required:e=>{e.detail.required?e.target.setAttribute("required",""):e.target.removeAttribute("required")},bgColor:e=>{setColor("bgColor","backgroundColor",e)},fillColor:e=>{setColor("fillColor","backgroundColor",e)},fgColor:e=>{setColor("fgColor","color",e)},textColor:e=>{setColor("textColor","color",e)},borderColor:e=>{setColor("borderColor","borderColor",e)},strokeColor:e=>{setColor("strokeColor","borderColor",e)}};for(const n of Object.keys(t.detail)){const s=e[n]||i[n];s&&s(t)}}}class TextWidgetAnnotationElement extends WidgetAnnotationElement{constructor(e){super(e,{isRenderable:e.renderForms||!e.data.hasAppearance&&!!e.data.fieldValue})}setPropertyOnSiblings(e,t,i,n){const s=this.annotationStorage;for(const r of this._getElementsByName(e.name,e.id)){r.domElement&&(r.domElement[t]=i);s.setValue(r.id,this.data.fieldName,{[n]:i})}}render(){const e=this.annotationStorage,t=this.data.id;this.container.className="textWidgetAnnotation";let i=null;if(this.renderForms){const n=e.getValue(t,this.data.fieldName,{value:this.data.fieldValue,valueAsString:this.data.fieldValue}),s=n.valueAsString||n.value||"",r={userValue:null,formattedValue:null,beforeInputSelectionRange:null,beforeInputValue:null};if(this.data.multiLine){i=document.createElement("textarea");i.textContent=s}else{i=document.createElement("input");i.type="text";i.setAttribute("value",s)}l.add(i);i.disabled=this.data.readOnly;i.name=this.data.fieldName;i.tabIndex=o;r.userValue=s;i.setAttribute("id",t);i.addEventListener("input",(n=>{e.setValue(t,this.data.fieldName,{value:n.target.value});this.setPropertyOnSiblings(i,"value",n.target.value,"value")}));i.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue||"";i.value=r.userValue=t;delete r.formattedValue}));let blurListener=e=>{r.formattedValue&&(e.target.value=r.formattedValue);e.target.scrollLeft=0;r.beforeInputSelectionRange=null};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",(e=>{r.userValue&&(e.target.value=r.userValue)}));const n=this.data.fieldName;i.addEventListener("updatefromsandbox",(i=>{const s={value(i){r.userValue=i.detail.value||"";e.setValue(t,n,{value:r.userValue.toString()});r.formattedValue||(i.target.value=r.userValue)},valueAsString(i){r.formattedValue=i.detail.valueAsString||"";i.target!==document.activeElement&&(i.target.value=r.formattedValue);e.setValue(t,n,{formattedValue:r.formattedValue})},selRange(e){const[t,i]=e.detail.selRange;t>=0&&i<e.target.value.length&&e.target.setSelectionRange(t,i)}};this._dispatchEventFromSandbox(s,i)}));i.addEventListener("keydown",(e=>{r.beforeInputValue=e.target.value;let i=-1;"Escape"===e.key?i=0:"Enter"===e.key?i=2:"Tab"===e.key&&(i=3);if(-1!==i){r.userValue=e.target.value;this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:e.target.value,willCommit:!0,commitKey:i,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}})}}));const s=blurListener;blurListener=null;i.addEventListener("blur",(e=>{if(this._mouseState.isDown){r.userValue=e.target.value;this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:e.target.value,willCommit:!0,commitKey:1,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}})}s(e)}));i.addEventListener("mousedown",(e=>{r.beforeInputValue=e.target.value;r.beforeInputSelectionRange=null}));i.addEventListener("keyup",(e=>{e.target.selectionStart===e.target.selectionEnd&&(r.beforeInputSelectionRange=null)}));i.addEventListener("select",(e=>{r.beforeInputSelectionRange=[e.target.selectionStart,e.target.selectionEnd]}));this.data.actions?.Keystroke&&i.addEventListener("input",(e=>{let i=-1,n=-1;r.beforeInputSelectionRange&&([i,n]=r.beforeInputSelectionRange);this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:r.beforeInputValue,change:e.data,willCommit:!1,selStart:i,selEnd:n}})}));this._setEventListeners(i,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.value))}blurListener&&i.addEventListener("blur",blurListener);null!==this.data.maxLen&&(i.maxLength=this.data.maxLen);if(this.data.comb){const e=(this.data.rect[2]-this.data.rect[0])/this.data.maxLen;i.classList.add("comb");i.style.letterSpacing=`calc(${e}px - 1ch)`}}else{i=document.createElement("div");i.textContent=this.data.fieldValue;i.style.verticalAlign="middle";i.style.display="table-cell"}this._setTextStyle(i);this._setBackgroundColor(i);this.container.appendChild(i);return this.container}_setTextStyle(e){const t=["left","center","right"],{fontSize:i,fontColor:s}=this.data.defaultAppearanceData,r=e.style;i&&(r.fontSize=`${i}px`);r.color=n.Util.makeHexColor(s[0],s[1],s[2]);null!==this.data.textAlignment&&(r.textAlign=t[this.data.textAlignment])}}class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,t=this.data,i=t.id;let n=e.getValue(i,`${this.data.fieldName}/${this.data.exportValue}`,{value:t.exportValue===t.fieldValue}).value;if("string"==typeof n){n="Off"!==n;e.setValue(i,this.data.fieldName,{value:n})}this.container.className="buttonWidgetAnnotation checkBox";const s=document.createElement("input");l.add(s);s.disabled=t.readOnly;s.type="checkbox";s.name=t.fieldName;n&&s.setAttribute("checked",!0);s.setAttribute("id",i);s.setAttribute("exportValue",t.exportValue);s.tabIndex=o;s.addEventListener("change",(n=>{const{name:s,checked:r}=n.target;for(const n of this._getElementsByName(s,i)){const i=r&&n.exportValue===t.exportValue;n.domElement&&(n.domElement.checked=i);e.setValue(n.id,this.data.fieldName,{value:i})}e.setValue(i,this.data.fieldName,{value:r})}));s.addEventListener("resetform",(e=>{const i=t.defaultFieldValue||"Off";e.target.checked=i===t.exportValue}));if(this.enableScripting&&this.hasJSActions){const t=this.data.fieldName;s.addEventListener("updatefromsandbox",(n=>{const s={value(n){n.target.checked="Off"!==n.detail.value;e.setValue(i,t,{value:n.target.checked})}};this._dispatchEventFromSandbox(s,n)}));this._setEventListeners(s,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.checked))}this._setBackgroundColor(s);this.container.appendChild(s);return this.container}}class RadioButtonWidgetAnnotationElement extends WidgetAnnotationElement{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.className="buttonWidgetAnnotation radioButton";const e=this.annotationStorage,t=this.data,i=t.id;let n=e.getValue(i,this.data.fieldName,{value:t.fieldValue===t.buttonValue},this.data.buttonValue).value;if("string"==typeof n){n=n!==t.buttonValue;e.setValue(i,this.data.fieldName,{value:n},this.data.buttonValue)}const s=document.createElement("input");l.add(s);s.disabled=t.readOnly;s.type="radio";s.name=t.fieldName;n&&s.setAttribute("checked",!0);s.setAttribute("id",i);s.tabIndex=o;s.addEventListener("change",(t=>{const{name:n,checked:s}=t.target;for(const t of this._getElementsByName(n,i))e.setValue(t.id,this.data.fieldName,{value:!1,emitMessage:!1});e.setValue(i,this.data.fieldName,{value:s,radioValue:this.data.buttonValue})}));s.addEventListener("resetform",(e=>{const i=t.defaultFieldValue;e.target.checked=null!=i&&i===t.buttonValue}));if(this.enableScripting&&this.hasJSActions){const n=t.buttonValue;s.addEventListener("updatefromsandbox",(t=>{const s=this.data.fieldName,r={value:t=>{const r=n===t.detail.value;for(const n of this._getElementsByName(t.target.name)){const t=r&&n.id===i;n.domElement&&(n.domElement.checked=t);e.setValue(n.id,s,{value:t})}}};this._dispatchEventFromSandbox(r,t)}));this._setEventListeners(s,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.checked))}this._setBackgroundColor(s);this.container.appendChild(s);return this.container}}class PushButtonWidgetAnnotationElement extends LinkAnnotationElement{render(){const e=super.render();e.className="buttonWidgetAnnotation pushButton";this.data.alternativeText&&(e.title=this.data.alternativeText);return e}}class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.className="choiceWidgetAnnotation";const e=this.annotationStorage,t=this.data.id,i=e.getValue(t,this.data.fieldName,{value:this.data.fieldValue.length>0?this.data.fieldValue[0]:void 0}).value;this.data.fieldValue=i;let{fontSize:n}=this.data.defaultAppearanceData;n||(n=9);const s=`calc(${n}px * var(--zoom-factor))`,r=document.createElement("select");l.add(r);r.disabled=this.data.readOnly;r.name=this.data.fieldName;r.setAttribute("id",t);r.tabIndex=o;r.style.fontSize=`${n}px`;if(!this.data.combo){r.size=this.data.options.length;this.data.multiSelect&&(r.multiple=!0)}r.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue;for(const e of r.options)e.selected=e.value===t}));for(const e of this.data.options){const t=document.createElement("option");t.textContent=e.displayValue;t.value=e.exportValue;this.data.combo&&(t.style.fontSize=s);this.data.fieldValue.includes(e.exportValue)&&t.setAttribute("selected",!0);r.appendChild(t)}const getValue=(e,t)=>{const i=t?"value":"textContent",n=e.target.options;return e.target.multiple?Array.prototype.filter.call(n,(e=>e.selected)).map((e=>e[i])):-1===n.selectedIndex?null:n[n.selectedIndex][i]},getItems=e=>{const t=e.target.options;return Array.prototype.map.call(t,(e=>({displayValue:e.textContent,exportValue:e.value})))};if(this.enableScripting&&this.hasJSActions){r.addEventListener("updatefromsandbox",(i=>{const n=this.data.fieldName,s={value(i){const s=i.detail.value,a=new Set(Array.isArray(s)?s:[s]);for(const e of r.options)e.selected=a.has(e.value);e.setValue(t,n,{value:getValue(i,!0)})},multipleSelection(e){r.multiple=!0},remove(i){const n=r.options,s=i.detail.remove;n[s].selected=!1;r.remove(s);if(n.length>0){-1===Array.prototype.findIndex.call(n,(e=>e.selected))&&(n[0].selected=!0)}e.setValue(t,this.data.fieldName,{value:getValue(i,!0),items:getItems(i)})},clear(i){for(;0!==r.length;)r.remove(0);e.setValue(t,this.data.fieldName,{value:null,items:[]})},insert(i){const{index:n,displayValue:s,exportValue:a}=i.detail.insert,o=document.createElement("option");o.textContent=s;o.value=a;r.insertBefore(o,r.children[n]);e.setValue(t,this.data.fieldName,{value:getValue(i,!0),items:getItems(i)})},items(i){const{items:n}=i.detail;for(;0!==r.length;)r.remove(0);for(const e of n){const{displayValue:t,exportValue:i}=e,n=document.createElement("option");n.textContent=t;n.value=i;r.appendChild(n)}r.options.length>0&&(r.options[0].selected=!0);e.setValue(t,this.data.fieldName,{value:getValue(i,!0),items:getItems(i)})},indices(i){const n=new Set(i.detail.indices);for(const e of i.target.options)e.selected=n.has(e.index);e.setValue(t,this.data.fieldName,{value:getValue(i,!0)})},editable(e){e.target.disabled=!e.detail.editable}};this._dispatchEventFromSandbox(s,i)}));r.addEventListener("input",(i=>{const n=getValue(i,!0),s=getValue(i,!1);e.setValue(t,this.data.fieldName,{value:n});this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:s,changeEx:n,willCommit:!0,commitKey:1,keyDown:!1}})}));this._setEventListeners(r,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"]],(e=>e.target.checked))}else r.addEventListener("input",(i=>{e.setValue(t,this.data.fieldName,{value:getValue(i),radioValue:getValue(i,!0)})}));this._setBackgroundColor(r);this.container.appendChild(r);return this.container}}class PopupAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!(!e.data.titleObj?.str&&!e.data.contentsObj?.str)})}render(){this.container.className="popupAnnotation";if(["Line","Square","Circle","PolyLine","Polygon","Ink"].includes(this.data.parentType))return this.container;const e=`[data-annotation-id="${this.data.parentId}"]`,t=this.layer.querySelectorAll(e);if(0===t.length)return this.container;const i=new PopupElement({container:this.container,trigger:Array.from(t),color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj}),s=this.page,r=n.Util.normalizeRect([this.data.parentRect[0],s.view[3]-this.data.parentRect[1]+s.view[1],this.data.parentRect[2],s.view[3]-this.data.parentRect[3]+s.view[1]]),a=r[0]+this.data.parentRect[2]-this.data.parentRect[0],o=r[1];this.container.style.transformOrigin=`${-a}px ${-o}px`;this.container.style.left=`${a}px`;this.container.style.top=`${o}px`;this.container.appendChild(i.render());return this.container}}class PopupElement{constructor(e){this.container=e.container;this.trigger=e.trigger;this.color=e.color;this.titleObj=e.titleObj;this.modificationDate=e.modificationDate;this.contentsObj=e.contentsObj;this.hideWrapper=e.hideWrapper||!1;this.pinned=!1}render(){const e=document.createElement("div");e.className="popupWrapper";this.hideElement=this.hideWrapper?e:this.container;this.hideElement.hidden=!0;const t=document.createElement("div");t.className="popup";const i=this.color;if(i){const e=.7*(255-i[0])+i[0],s=.7*(255-i[1])+i[1],r=.7*(255-i[2])+i[2];t.style.backgroundColor=n.Util.makeHexColor(0|e,0|s,0|r)}const r=document.createElement("h1");r.dir=this.titleObj.dir;r.textContent=this.titleObj.str;t.appendChild(r);const a=s.PDFDateString.toDateObject(this.modificationDate);if(a){const e=document.createElement("span");e.textContent="{{date}}, {{time}}";e.dataset.l10nId="annotation_date_string";e.dataset.l10nArgs=JSON.stringify({date:a.toLocaleDateString(),time:a.toLocaleTimeString()});t.appendChild(e)}const o=this._formatContents(this.contentsObj);t.appendChild(o);Array.isArray(this.trigger)||(this.trigger=[this.trigger]);for(const e of this.trigger){e.addEventListener("click",this._toggle.bind(this));e.addEventListener("mouseover",this._show.bind(this,!1));e.addEventListener("mouseout",this._hide.bind(this,!1))}t.addEventListener("click",this._hide.bind(this,!0));e.appendChild(t);return e}_formatContents({str:e,dir:t}){const i=document.createElement("p");i.dir=t;const n=e.split(/(?:\r\n?|\n)/);for(let e=0,t=n.length;e<t;++e){const s=n[e];i.appendChild(document.createTextNode(s));e<t-1&&i.appendChild(document.createElement("br"))}return i}_toggle(){this.pinned?this._hide(!0):this._show(!0)}_show(e=!1){e&&(this.pinned=!0);if(this.hideElement.hidden){this.hideElement.hidden=!1;this.container.style.zIndex+=1}}_hide(e=!0){e&&(this.pinned=!1);if(!this.hideElement.hidden&&!this.pinned){this.hideElement.hidden=!0;this.container.style.zIndex-=1}}}class FreeTextAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str),ignoreBorder:!0})}render(){this.container.className="freeTextAnnotation";this.data.hasPopup||this._createPopup(null,this.data);return this.container}}class LineAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str),ignoreBorder:!0})}render(){this.container.className="lineAnnotation";const e=this.data,t=e.rect[2]-e.rect[0],i=e.rect[3]-e.rect[1],n=this.svgFactory.create(t,i),s=this.svgFactory.createElement("svg:line");s.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]);s.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]);s.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]);s.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]);s.setAttribute("stroke-width",e.borderStyle.width||1);s.setAttribute("stroke","transparent");n.appendChild(s);this.container.append(n);this._createPopup(s,e);return this.container}}class SquareAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str),ignoreBorder:!0})}render(){this.container.className="squareAnnotation";const e=this.data,t=e.rect[2]-e.rect[0],i=e.rect[3]-e.rect[1],n=this.svgFactory.create(t,i),s=e.borderStyle.width,r=this.svgFactory.createElement("svg:rect");r.setAttribute("x",s/2);r.setAttribute("y",s/2);r.setAttribute("width",t-s);r.setAttribute("height",i-s);r.setAttribute("stroke-width",s||1);r.setAttribute("stroke","transparent");r.setAttribute("fill","none");n.appendChild(r);this.container.append(n);this._createPopup(r,e);return this.container}}class CircleAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str),ignoreBorder:!0})}render(){this.container.className="circleAnnotation";const e=this.data,t=e.rect[2]-e.rect[0],i=e.rect[3]-e.rect[1],n=this.svgFactory.create(t,i),s=e.borderStyle.width,r=this.svgFactory.createElement("svg:ellipse");r.setAttribute("cx",t/2);r.setAttribute("cy",i/2);r.setAttribute("rx",t/2-s/2);r.setAttribute("ry",i/2-s/2);r.setAttribute("stroke-width",s||1);r.setAttribute("stroke","transparent");r.setAttribute("fill","none");n.appendChild(r);this.container.append(n);this._createPopup(r,e);return this.container}}class PolylineAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str),ignoreBorder:!0});this.containerClassName="polylineAnnotation";this.svgElementName="svg:polyline"}render(){this.container.className=this.containerClassName;const e=this.data,t=e.rect[2]-e.rect[0],i=e.rect[3]-e.rect[1],n=this.svgFactory.create(t,i);let s=[];for(const t of e.vertices){const i=t.x-e.rect[0],n=e.rect[3]-t.y;s.push(i+","+n)}s=s.join(" ");const r=this.svgFactory.createElement(this.svgElementName);r.setAttribute("points",s);r.setAttribute("stroke-width",e.borderStyle.width||1);r.setAttribute("stroke","transparent");r.setAttribute("fill","none");n.appendChild(r);this.container.append(n);this._createPopup(r,e);return this.container}}class PolygonAnnotationElement extends PolylineAnnotationElement{constructor(e){super(e);this.containerClassName="polygonAnnotation";this.svgElementName="svg:polygon"}}class CaretAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str),ignoreBorder:!0})}render(){this.container.className="caretAnnotation";this.data.hasPopup||this._createPopup(null,this.data);return this.container}}class InkAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str),ignoreBorder:!0});this.containerClassName="inkAnnotation";this.svgElementName="svg:polyline"}render(){this.container.className=this.containerClassName;const e=this.data,t=e.rect[2]-e.rect[0],i=e.rect[3]-e.rect[1],n=this.svgFactory.create(t,i);for(const t of e.inkLists){let i=[];for(const n of t){const t=n.x-e.rect[0],s=e.rect[3]-n.y;i.push(`${t},${s}`)}i=i.join(" ");const s=this.svgFactory.createElement(this.svgElementName);s.setAttribute("points",i);s.setAttribute("stroke-width",e.borderStyle.width||1);s.setAttribute("stroke","transparent");s.setAttribute("fill","none");this._createPopup(s,e);n.appendChild(s)}this.container.append(n);return this.container}}class HighlightAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){this.data.hasPopup||this._createPopup(null,this.data);if(this.quadrilaterals)return this._renderQuadrilaterals("highlightAnnotation");this.container.className="highlightAnnotation";return this.container}}class UnderlineAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){this.data.hasPopup||this._createPopup(null,this.data);if(this.quadrilaterals)return this._renderQuadrilaterals("underlineAnnotation");this.container.className="underlineAnnotation";return this.container}}class SquigglyAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){this.data.hasPopup||this._createPopup(null,this.data);if(this.quadrilaterals)return this._renderQuadrilaterals("squigglyAnnotation");this.container.className="squigglyAnnotation";return this.container}}class StrikeOutAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){this.data.hasPopup||this._createPopup(null,this.data);if(this.quadrilaterals)return this._renderQuadrilaterals("strikeoutAnnotation");this.container.className="strikeoutAnnotation";return this.container}}class StampAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str),ignoreBorder:!0})}render(){this.container.className="stampAnnotation";this.data.hasPopup||this._createPopup(null,this.data);return this.container}}class FileAttachmentAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!0});const{filename:t,content:i}=this.data.file;this.filename=(0,s.getFilenameFromUrl)(t);this.content=i;this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,id:(0,n.stringToPDFString)(t),filename:t,content:i})}render(){this.container.className="fileAttachmentAnnotation";const e=document.createElement("div");e.style.height=this.container.style.height;e.style.width=this.container.style.width;e.addEventListener("dblclick",this._download.bind(this));this.data.hasPopup||!this.data.titleObj?.str&&!this.data.contentsObj?.str||this._createPopup(e,this.data);this.container.appendChild(e);return this.container}_download(){this.downloadManager?.openOrDownloadData(this.container,this.content,this.filename)}}t.AnnotationLayer=class AnnotationLayer{static render(e){const t=[],i=[];for(const s of e.annotations)s&&(s.annotationType!==n.AnnotationType.POPUP?t.push(s):i.push(s));i.length&&t.push(...i);window.registerAcroformAnnotations&&window.registerAcroformAnnotations(t);for(const i of t){const t=AnnotationElementFactory.create({data:i,layer:e.div,page:e.page,viewport:e.viewport,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:!1!==e.renderForms,svgFactory:new s.DOMSVGFactory,annotationStorage:e.annotationStorage||new r.AnnotationStorage,enableScripting:e.enableScripting,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,mouseState:e.mouseState||{isDown:!1}});if(t.isRenderable){const n=t.render();i.hidden&&(n.style.visibility="hidden");if(Array.isArray(n))for(const t of n)e.div.appendChild(t);else t instanceof PopupAnnotationElement?e.div.prepend(n):e.div.appendChild(n)}}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;for(const i of e.annotations){const n=e.div.querySelectorAll(`[data-annotation-id="${i.id}"]`);if(n)for(const e of n)e.style.transform=t}e.div.hidden=!1}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.ColorConverters=void 0;function makeColorComp(e){return Math.floor(255*Math.max(0,Math.min(1,e))).toString(16).padStart(2,"0")}t.ColorConverters=class ColorConverters{static CMYK_G([e,t,i,n]){return["G",1-Math.min(1,.3*e+.59*i+.11*t+n)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_HTML([e]){const t=makeColorComp(e);return`#${t}${t}${t}`}static RGB_G([e,t,i]){return["G",.3*e+.59*t+.11*i]}static RGB_HTML([e,t,i]){return`#${makeColorComp(e)}${makeColorComp(t)}${makeColorComp(i)}`}static T_HTML(){return"#00000000"}static CMYK_RGB([e,t,i,n]){return["RGB",1-Math.min(1,e+n),1-Math.min(1,i+n),1-Math.min(1,t+n)]}static CMYK_HTML(e){return this.RGB_HTML(this.CMYK_RGB(e))}static RGB_CMYK([e,t,i]){const n=1-e,s=1-t,r=1-i;return["CMYK",n,s,r,Math.min(n,s,r)]}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.renderTextLayer=function renderTextLayer(e){const t=new TextLayerRenderTask({textContent:e.textContent,textContentStream:e.textContentStream,container:e.container,viewport:e.viewport,textDivs:e.textDivs,textContentItemsStr:e.textContentItemsStr,enhanceTextSelection:e.enhanceTextSelection});t._render(e.timeout);return t};var n=i(2);const s=30,r=new Map,a=/^\s+$/g;function appendText(e,t,i,o){const l=document.createElement("span"),h=e._enhanceTextSelection?{angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,originalTransform:null,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,scale:1}:{angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL};e._textDivs.push(l);const c=n.Util.transform(e._viewport.transform,t.transform);let d=Math.atan2(c[1],c[0]);const u=i[t.fontName];u.vertical&&(d+=Math.PI/2);const p=Math.hypot(c[2],c[3]),g=p*function getAscent(e,t){const i=r.get(e);if(i)return i;t.save();t.font=`30px ${e}`;const n=t.measureText("");let a=n?.fontBoundingBoxAscent,o=Math.abs(n?.fontBoundingBoxDescent);if(a){t.restore();const i=a/(a+o);r.set(e,i);return i}t.strokeStyle="red";t.clearRect(0,0,s,s);t.strokeText("g",0,0);let l=t.getImageData(0,0,s,s).data;o=0;for(let e=l.length-1-3;e>=0;e-=4)if(l[e]>0){o=Math.ceil(e/4/s);break}t.clearRect(0,0,s,s);t.strokeText("A",0,s);l=t.getImageData(0,0,s,s).data;a=0;for(let e=0,t=l.length;e<t;e+=4)if(l[e]>0){a=s-Math.floor(e/4/s);break}t.restore();if(a){const t=a/(a+o);r.set(e,t);return t}r.set(e,.8);return.8}(u.fontFamily,o);let f,m;if(0===d){f=c[4];m=c[5]-g}else{f=c[4]+g*Math.sin(d);m=c[5]-g*Math.cos(d)}l.style.left=`${f}px`;l.style.top=`${m}px`;l.style.fontSize=`${p}px`;l.style.fontFamily=u.fontFamily;l.setAttribute("role","presentation");l.textContent=t.str;l.dir=t.dir;e._fontInspectorEnabled&&(l.dataset.fontName=t.fontName);0!==d&&(h.angle=d*(180/Math.PI));let _=!1;if(t.str.length>1||e._enhanceTextSelection&&a.test(t.str))_=!0;else if(t.transform[0]!==t.transform[3]){const e=Math.abs(t.transform[0]),i=Math.abs(t.transform[3]);e!==i&&Math.max(e,i)/Math.min(e,i)>1.5&&(_=!0)}_&&(u.vertical?h.canvasWidth=t.height*e._viewport.scale:h.canvasWidth=t.width*e._viewport.scale);e._textDivProperties.set(l,h);e._textContentStream&&e._layoutText(l);if(e._enhanceTextSelection&&h.hasText){let i=1,s=0;if(0!==d){i=Math.cos(d);s=Math.sin(d)}const r=(u.vertical?t.height:t.width)*e._viewport.scale,a=p;let o,h;if(0!==d){o=[i,s,-s,i,f,m];h=n.Util.getAxialAlignedBoundingBox([0,0,r,a],o)}else h=[f,m,f+r,m+a];e._bounds.push({left:h[0],top:h[1],right:h[2],bottom:h[3],div:l,size:[r,a],m:o})}}function render(e){if(e._canceled)return;const t=e._textDivs,i=e._capability,n=t.length;if(n>1e5){e._renderingDone=!0;i.resolve()}else{if(!e._textContentStream)for(let i=0;i<n;i++)e._layoutText(t[i]);e._renderingDone=!0;i.resolve()}}function findPositiveMin(e,t,i){let n=0;for(let s=0;s<i;s++){const i=e[t++];i>0&&(n=n?Math.min(i,n):i)}return n}function expand(e){const t=e._bounds,i=e._viewport,s=function expandBounds(e,t,i){const n=i.map((function(e,t){return{x1:e.left,y1:e.top,x2:e.right,y2:e.bottom,index:t,x1New:void 0,x2New:void 0}}));expandBoundsLTR(e,n);const s=new Array(i.length);for(const e of n){const t=e.index;s[t]={left:e.x1New,top:0,right:e.x2New,bottom:0}}i.map((function(t,i){const r=s[i],a=n[i];a.x1=t.top;a.y1=e-r.right;a.x2=t.bottom;a.y2=e-r.left;a.index=i;a.x1New=void 0;a.x2New=void 0}));expandBoundsLTR(t,n);for(const e of n){const t=e.index;s[t].top=e.x1New;s[t].bottom=e.x2New}return s}(i.width,i.height,t);for(let i=0;i<s.length;i++){const r=t[i].div,a=e._textDivProperties.get(r);if(0===a.angle){a.paddingLeft=t[i].left-s[i].left;a.paddingTop=t[i].top-s[i].top;a.paddingRight=s[i].right-t[i].right;a.paddingBottom=s[i].bottom-t[i].bottom;e._textDivProperties.set(r,a);continue}const o=s[i],l=t[i],h=l.m,c=h[0],d=h[1],u=[[0,0],[0,l.size[1]],[l.size[0],0],l.size],p=new Float64Array(64);for(let e=0,t=u.length;e<t;e++){const t=n.Util.applyTransform(u[e],h);p[e+0]=c&&(o.left-t[0])/c;p[e+4]=d&&(o.top-t[1])/d;p[e+8]=c&&(o.right-t[0])/c;p[e+12]=d&&(o.bottom-t[1])/d;p[e+16]=d&&(o.left-t[0])/-d;p[e+20]=c&&(o.top-t[1])/c;p[e+24]=d&&(o.right-t[0])/-d;p[e+28]=c&&(o.bottom-t[1])/c;p[e+32]=c&&(o.left-t[0])/-c;p[e+36]=d&&(o.top-t[1])/-d;p[e+40]=c&&(o.right-t[0])/-c;p[e+44]=d&&(o.bottom-t[1])/-d;p[e+48]=d&&(o.left-t[0])/d;p[e+52]=c&&(o.top-t[1])/-c;p[e+56]=d&&(o.right-t[0])/d;p[e+60]=c&&(o.bottom-t[1])/-c}const g=1+Math.min(Math.abs(c),Math.abs(d));a.paddingLeft=findPositiveMin(p,32,16)/g;a.paddingTop=findPositiveMin(p,48,16)/g;a.paddingRight=findPositiveMin(p,0,16)/g;a.paddingBottom=findPositiveMin(p,16,16)/g;e._textDivProperties.set(r,a)}}function expandBoundsLTR(e,t){t.sort((function(e,t){return e.x1-t.x1||e.index-t.index}));const i=[{start:-1/0,end:1/0,boundary:{x1:-1/0,y1:-1/0,x2:0,y2:1/0,index:-1,x1New:0,x2New:0}}];for(const e of t){let t=0;for(;t<i.length&&i[t].end<=e.y1;)t++;let n,s,r=i.length-1;for(;r>=0&&i[r].start>=e.y2;)r--;let a,o,l=-1/0;for(a=t;a<=r;a++){n=i[a];s=n.boundary;let t;t=s.x2>e.x1?s.index>e.index?s.x1New:e.x1:void 0===s.x2New?(s.x2+e.x1)/2:s.x2New;t>l&&(l=t)}e.x1New=l;for(a=t;a<=r;a++){n=i[a];s=n.boundary;void 0===s.x2New?s.x2>e.x1?s.index>e.index&&(s.x2New=s.x2):s.x2New=l:s.x2New>l&&(s.x2New=Math.max(l,s.x2))}const h=[];let c=null;for(a=t;a<=r;a++){n=i[a];s=n.boundary;const t=s.x2>e.x2?s:e;if(c===t)h[h.length-1].end=n.end;else{h.push({start:n.start,end:n.end,boundary:t});c=t}}if(i[t].start<e.y1){h[0].start=e.y1;h.unshift({start:i[t].start,end:e.y1,boundary:i[t].boundary})}if(e.y2<i[r].end){h[h.length-1].end=e.y2;h.push({start:e.y2,end:i[r].end,boundary:i[r].boundary})}for(a=t;a<=r;a++){n=i[a];s=n.boundary;if(void 0!==s.x2New)continue;let e=!1;for(o=t-1;!e&&o>=0&&i[o].start>=s.y1;o--)e=i[o].boundary===s;for(o=r+1;!e&&o<i.length&&i[o].end<=s.y2;o++)e=i[o].boundary===s;for(o=0;!e&&o<h.length;o++)e=h[o].boundary===s;e||(s.x2New=l)}Array.prototype.splice.apply(i,[t,r-t+1].concat(h))}for(const t of i){const i=t.boundary;void 0===i.x2New&&(i.x2New=Math.max(e,i.x2))}}class TextLayerRenderTask{constructor({textContent:e,textContentStream:t,container:i,viewport:s,textDivs:r,textContentItemsStr:a,enhanceTextSelection:o}){this._textContent=e;this._textContentStream=t;this._container=i;this._document=i.ownerDocument;this._viewport=s;this._textDivs=r||[];this._textContentItemsStr=a||[];this._enhanceTextSelection=!!o;this._fontInspectorEnabled=!!globalThis.FontInspector?.enabled;this._reader=null;this._layoutTextLastFontSize=null;this._layoutTextLastFontFamily=null;this._layoutTextCtx=null;this._textDivProperties=new WeakMap;this._renderingDone=!1;this._canceled=!1;this._capability=(0,n.createPromiseCapability)();this._renderTimer=null;this._bounds=[];this._capability.promise.finally((()=>{this._enhanceTextSelection||(this._textDivProperties=null);if(this._layoutTextCtx){this._layoutTextCtx.canvas.width=0;this._layoutTextCtx.canvas.height=0;this._layoutTextCtx=null}})).catch((()=>{}))}get promise(){return this._capability.promise}cancel(){this._canceled=!0;if(this._reader){this._reader.cancel(new n.AbortException("TextLayer task cancelled.")).catch((()=>{}));this._reader=null}if(null!==this._renderTimer){clearTimeout(this._renderTimer);this._renderTimer=null}this._capability.reject(new Error("TextLayer task cancelled."))}_processItems(e,t){for(let i=0,n=e.length;i<n;i++)if(void 0!==e[i].str){this._textContentItemsStr.push(e[i].str);appendText(this,e[i],t,this._layoutTextCtx)}else if("beginMarkedContentProps"===e[i].type||"beginMarkedContent"===e[i].type){const t=this._container;this._container=document.createElement("span");this._container.classList.add("markedContent");null!==e[i].id&&this._container.setAttribute("id",`${e[i].id}`);t.appendChild(this._container)}else"endMarkedContent"===e[i].type&&(this._container=this._container.parentNode)}_layoutText(e){const t=this._textDivProperties.get(e);let i="";if(0!==t.canvasWidth&&t.hasText){const{fontSize:n,fontFamily:s}=e.style;if(n!==this._layoutTextLastFontSize||s!==this._layoutTextLastFontFamily){this._layoutTextCtx.font=`${n} ${s}`;this._layoutTextLastFontSize=n;this._layoutTextLastFontFamily=s}try{const{width:n}=this._layoutTextCtx.measureText(e.textContent);if(n>0){t.scale=t.canvasWidth/n;const e=t.canvasWidth/n;this._enhanceTextSelection&&(t.scale=e);i=`scaleX(${e})`}}catch(e){}}0!==t.angle&&(i=`rotate(${t.angle}deg) ${i}`);if(i.length>0){this._enhanceTextSelection&&(t.originalTransform=i);e.style.transform=i}t.hasText&&this._container.appendChild(e);if(t.hasEOL){const e=document.createElement("br");e.setAttribute("role","presentation");this._container.appendChild(e)}}_render(e=0){const t=(0,n.createPromiseCapability)();let i=Object.create(null);const r=this._document.createElement("canvas");r.height=r.width=s;r.mozOpaque=!0;this._layoutTextCtx=r.getContext("2d",{alpha:!1});if(this._textContent){const e=this._textContent.items,i=this._textContent.styles;this._processItems(e,i);t.resolve()}else{if(!this._textContentStream)throw new Error('Neither "textContent" nor "textContentStream" parameters specified.');{const pump=()=>{this._reader.read().then((({value:e,done:n})=>{if(n)t.resolve();else{Object.assign(i,e.styles);this._processItems(e.items,i);pump()}}),t.reject)};this._reader=this._textContentStream.getReader();pump()}}t.promise.then((()=>{i=null;e?this._renderTimer=setTimeout((()=>{render(this);this._renderTimer=null}),e):render(this)}),this._capability.reject)}expandTextDivs(e=!1){if(!this._enhanceTextSelection||!this._renderingDone)return;if(null!==this._bounds){expand(this);this._bounds=null}const t=[],i=[];for(let n=0,s=this._textDivs.length;n<s;n++){const s=this._textDivs[n],r=this._textDivProperties.get(s);if(r.hasText)if(e){t.length=0;i.length=0;r.originalTransform&&t.push(r.originalTransform);if(r.paddingTop>0){i.push(`${r.paddingTop}px`);t.push(`translateY(${-r.paddingTop}px)`)}else i.push(0);r.paddingRight>0?i.push(r.paddingRight/r.scale+"px"):i.push(0);r.paddingBottom>0?i.push(`${r.paddingBottom}px`):i.push(0);if(r.paddingLeft>0){i.push(r.paddingLeft/r.scale+"px");t.push(`translateX(${-r.paddingLeft/r.scale}px)`)}else i.push(0);s.style.padding=i.join(" ");t.length&&(s.style.transform=t.join(" "))}else{s.style.padding=null;s.style.transform=r.originalTransform}}}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.SVGGraphics=void 0;var n=i(2),s=i(1);let r=class{constructor(){(0,n.unreachable)("Not implemented: SVGGraphics")}};t.SVGGraphics=r;{const e={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},i="http://www.w3.org/XML/1998/namespace",a="http://www.w3.org/1999/xlink",o=["butt","round","square"],l=["miter","round","bevel"],h=function(){const e=new Uint8Array([137,80,78,71,13,10,26,10]),t=new Int32Array(256);for(let e=0;e<256;e++){let i=e;for(let e=0;e<8;e++)i=1&i?3988292384^i>>1&2147483647:i>>1&2147483647;t[e]=i}function writePngChunk(e,i,n,s){let r=s;const a=i.length;n[r]=a>>24&255;n[r+1]=a>>16&255;n[r+2]=a>>8&255;n[r+3]=255&a;r+=4;n[r]=255&e.charCodeAt(0);n[r+1]=255&e.charCodeAt(1);n[r+2]=255&e.charCodeAt(2);n[r+3]=255&e.charCodeAt(3);r+=4;n.set(i,r);r+=i.length;const o=function crc32(e,i,n){let s=-1;for(let r=i;r<n;r++){const i=255&(s^e[r]);s=s>>>8^t[i]}return-1^s}(n,s+4,r);n[r]=o>>24&255;n[r+1]=o>>16&255;n[r+2]=o>>8&255;n[r+3]=255&o}function deflateSync(e){return function deflateSyncUncompressed(e){let t=e.length;const i=65535,n=Math.ceil(t/i),s=new Uint8Array(2+t+5*n+4);let r=0;s[r++]=120;s[r++]=156;let a=0;for(;t>i;){s[r++]=0;s[r++]=255;s[r++]=255;s[r++]=0;s[r++]=0;s.set(e.subarray(a,a+i),r);r+=i;a+=i;t-=i}s[r++]=1;s[r++]=255&t;s[r++]=t>>8&255;s[r++]=255&~t;s[r++]=(65535&~t)>>8&255;s.set(e.subarray(a),r);r+=e.length-a;const o=function adler32(e,t,i){let n=1,s=0;for(let r=t;r<i;++r){n=(n+(255&e[r]))%65521;s=(s+n)%65521}return s<<16|n}(e,0,e.length);s[r++]=o>>24&255;s[r++]=o>>16&255;s[r++]=o>>8&255;s[r++]=255&o;return s}(e)}return function convertImgDataToPng(t,i,s){return function encode(t,i,s,r){const a=t.width,o=t.height;let l,h,c;const d=t.data;switch(i){case n.ImageKind.GRAYSCALE_1BPP:h=0;l=1;c=a+7>>3;break;case n.ImageKind.RGB_24BPP:h=2;l=8;c=3*a;break;case n.ImageKind.RGBA_32BPP:h=6;l=8;c=4*a;break;default:throw new Error("invalid format")}const u=new Uint8Array((1+c)*o);let p=0,g=0;for(let e=0;e<o;++e){u[p++]=0;u.set(d.subarray(g,g+c),p);g+=c;p+=c}if(i===n.ImageKind.GRAYSCALE_1BPP&&r){p=0;for(let e=0;e<o;e++){p++;for(let e=0;e<c;e++)u[p++]^=255}}const f=new Uint8Array([a>>24&255,a>>16&255,a>>8&255,255&a,o>>24&255,o>>16&255,o>>8&255,255&o,l,h,0,0,0]),m=deflateSync(u),_=e.length+36+f.length+m.length,b=new Uint8Array(_);let w=0;b.set(e,w);w+=e.length;writePngChunk("IHDR",f,b,w);w+=12+f.length;writePngChunk("IDATA",m,b,w);w+=12+m.length;writePngChunk("IEND",new Uint8Array(0),b,w);return(0,n.createObjectURL)(b,"image/png",s)}(t,void 0===t.kind?n.ImageKind.GRAYSCALE_1BPP:t.kind,i,s)}}();class SVGExtraState{constructor(){this.fontSizeScale=1;this.fontWeight=e.fontWeight;this.fontSize=0;this.textMatrix=n.IDENTITY_MATRIX;this.fontMatrix=n.FONT_IDENTITY_MATRIX;this.leading=0;this.textRenderingMode=n.TextRenderingMode.FILL;this.textMatrixScale=1;this.x=0;this.y=0;this.lineX=0;this.lineY=0;this.charSpacing=0;this.wordSpacing=0;this.textHScale=1;this.textRise=0;this.fillColor=e.fillColor;this.strokeColor="#000000";this.fillAlpha=1;this.strokeAlpha=1;this.lineWidth=1;this.lineJoin="";this.lineCap="";this.miterLimit=0;this.dashArray=[];this.dashPhase=0;this.dependencies=[];this.activeClipUrl=null;this.clipGroup=null;this.maskId=""}clone(){return Object.create(this)}setCurrentPoint(e,t){this.x=e;this.y=t}}function opListToTree(e){let t=[];const i=[];for(const n of e)if("save"!==n.fn)"restore"===n.fn?t=i.pop():t.push(n);else{t.push({fnId:92,fn:"group",items:[]});i.push(t);t=t[t.length-1].items}return t}function pf(e){if(Number.isInteger(e))return e.toString();const t=e.toFixed(10);let i=t.length-1;if("0"!==t[i])return t;do{i--}while("0"===t[i]);return t.substring(0,"."===t[i]?i:i+1)}function pm(e){if(0===e[4]&&0===e[5]){if(0===e[1]&&0===e[2])return 1===e[0]&&1===e[3]?"":`scale(${pf(e[0])} ${pf(e[3])})`;if(e[0]===e[3]&&e[1]===-e[2]){return`rotate(${pf(180*Math.acos(e[0])/Math.PI)})`}}else if(1===e[0]&&0===e[1]&&0===e[2]&&1===e[3])return`translate(${pf(e[4])} ${pf(e[5])})`;return`matrix(${pf(e[0])} ${pf(e[1])} ${pf(e[2])} ${pf(e[3])} ${pf(e[4])} ${pf(e[5])})`}let c=0,d=0,u=0;t.SVGGraphics=r=class{constructor(e,t,i=!1){this.svgFactory=new s.DOMSVGFactory;this.current=new SVGExtraState;this.transformMatrix=n.IDENTITY_MATRIX;this.transformStack=[];this.extraStack=[];this.commonObjs=e;this.objs=t;this.pendingClip=null;this.pendingEOFill=!1;this.embedFonts=!1;this.embeddedFonts=Object.create(null);this.cssStyle=null;this.forceDataSchema=!!i;this._operatorIdMapping=[];for(const e in n.OPS)this._operatorIdMapping[n.OPS[e]]=e}save(){this.transformStack.push(this.transformMatrix);const e=this.current;this.extraStack.push(e);this.current=e.clone()}restore(){this.transformMatrix=this.transformStack.pop();this.current=this.extraStack.pop();this.pendingClip=null;this.tgrp=null}group(e){this.save();this.executeOpTree(e);this.restore()}loadDependencies(e){const t=e.fnArray,i=e.argsArray;for(let e=0,s=t.length;e<s;e++)if(t[e]===n.OPS.dependency)for(const t of i[e]){const e=t.startsWith("g_")?this.commonObjs:this.objs,i=new Promise((i=>{e.get(t,i)}));this.current.dependencies.push(i)}return Promise.all(this.current.dependencies)}transform(e,t,i,s,r,a){const o=[e,t,i,s,r,a];this.transformMatrix=n.Util.transform(this.transformMatrix,o);this.tgrp=null}getSVG(e,t){this.viewport=t;const i=this._initialize(t);return this.loadDependencies(e).then((()=>{this.transformMatrix=n.IDENTITY_MATRIX;this.executeOpTree(this.convertOpList(e));return i}))}convertOpList(e){const t=this._operatorIdMapping,i=e.argsArray,n=e.fnArray,s=[];for(let e=0,r=n.length;e<r;e++){const r=n[e];s.push({fnId:r,fn:t[r],args:i[e]})}return opListToTree(s)}executeOpTree(e){for(const t of e){const e=t.fn,i=t.fnId,s=t.args;switch(0|i){case n.OPS.beginText:this.beginText();break;case n.OPS.dependency:break;case n.OPS.setLeading:this.setLeading(s);break;case n.OPS.setLeadingMoveText:this.setLeadingMoveText(s[0],s[1]);break;case n.OPS.setFont:this.setFont(s);break;case n.OPS.showText:case n.OPS.showSpacedText:this.showText(s[0]);break;case n.OPS.endText:this.endText();break;case n.OPS.moveText:this.moveText(s[0],s[1]);break;case n.OPS.setCharSpacing:this.setCharSpacing(s[0]);break;case n.OPS.setWordSpacing:this.setWordSpacing(s[0]);break;case n.OPS.setHScale:this.setHScale(s[0]);break;case n.OPS.setTextMatrix:this.setTextMatrix(s[0],s[1],s[2],s[3],s[4],s[5]);break;case n.OPS.setTextRise:this.setTextRise(s[0]);break;case n.OPS.setTextRenderingMode:this.setTextRenderingMode(s[0]);break;case n.OPS.setLineWidth:this.setLineWidth(s[0]);break;case n.OPS.setLineJoin:this.setLineJoin(s[0]);break;case n.OPS.setLineCap:this.setLineCap(s[0]);break;case n.OPS.setMiterLimit:this.setMiterLimit(s[0]);break;case n.OPS.setFillRGBColor:this.setFillRGBColor(s[0],s[1],s[2]);break;case n.OPS.setStrokeRGBColor:this.setStrokeRGBColor(s[0],s[1],s[2]);break;case n.OPS.setStrokeColorN:this.setStrokeColorN(s);break;case n.OPS.setFillColorN:this.setFillColorN(s);break;case n.OPS.shadingFill:this.shadingFill(s[0]);break;case n.OPS.setDash:this.setDash(s[0],s[1]);break;case n.OPS.setRenderingIntent:this.setRenderingIntent(s[0]);break;case n.OPS.setFlatness:this.setFlatness(s[0]);break;case n.OPS.setGState:this.setGState(s[0]);break;case n.OPS.fill:this.fill();break;case n.OPS.eoFill:this.eoFill();break;case n.OPS.stroke:this.stroke();break;case n.OPS.fillStroke:this.fillStroke();break;case n.OPS.eoFillStroke:this.eoFillStroke();break;case n.OPS.clip:this.clip("nonzero");break;case n.OPS.eoClip:this.clip("evenodd");break;case n.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case n.OPS.paintImageXObject:this.paintImageXObject(s[0]);break;case n.OPS.paintInlineImageXObject:this.paintInlineImageXObject(s[0]);break;case n.OPS.paintImageMaskXObject:this.paintImageMaskXObject(s[0]);break;case n.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(s[0],s[1]);break;case n.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case n.OPS.closePath:this.closePath();break;case n.OPS.closeStroke:this.closeStroke();break;case n.OPS.closeFillStroke:this.closeFillStroke();break;case n.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case n.OPS.nextLine:this.nextLine();break;case n.OPS.transform:this.transform(s[0],s[1],s[2],s[3],s[4],s[5]);break;case n.OPS.constructPath:this.constructPath(s[0],s[1]);break;case n.OPS.endPath:this.endPath();break;case 92:this.group(t.items);break;default:(0,n.warn)(`Unimplemented operator ${e}`)}}}setWordSpacing(e){this.current.wordSpacing=e}setCharSpacing(e){this.current.charSpacing=e}nextLine(){this.moveText(0,this.current.leading)}setTextMatrix(e,t,i,n,s,r){const a=this.current;a.textMatrix=a.lineMatrix=[e,t,i,n,s,r];a.textMatrixScale=Math.hypot(e,t);a.x=a.lineX=0;a.y=a.lineY=0;a.xcoords=[];a.ycoords=[];a.tspan=this.svgFactory.createElement("svg:tspan");a.tspan.setAttributeNS(null,"font-family",a.fontFamily);a.tspan.setAttributeNS(null,"font-size",`${pf(a.fontSize)}px`);a.tspan.setAttributeNS(null,"y",pf(-a.y));a.txtElement=this.svgFactory.createElement("svg:text");a.txtElement.appendChild(a.tspan)}beginText(){const e=this.current;e.x=e.lineX=0;e.y=e.lineY=0;e.textMatrix=n.IDENTITY_MATRIX;e.lineMatrix=n.IDENTITY_MATRIX;e.textMatrixScale=1;e.tspan=this.svgFactory.createElement("svg:tspan");e.txtElement=this.svgFactory.createElement("svg:text");e.txtgrp=this.svgFactory.createElement("svg:g");e.xcoords=[];e.ycoords=[]}moveText(e,t){const i=this.current;i.x=i.lineX+=e;i.y=i.lineY+=t;i.xcoords=[];i.ycoords=[];i.tspan=this.svgFactory.createElement("svg:tspan");i.tspan.setAttributeNS(null,"font-family",i.fontFamily);i.tspan.setAttributeNS(null,"font-size",`${pf(i.fontSize)}px`);i.tspan.setAttributeNS(null,"y",pf(-i.y))}showText(t){const s=this.current,r=s.font,a=s.fontSize;if(0===a)return;const o=s.fontSizeScale,l=s.charSpacing,h=s.wordSpacing,c=s.fontDirection,d=s.textHScale*c,u=r.vertical,p=u?1:-1,g=r.defaultVMetrics,f=a*s.fontMatrix[0];let m=0;for(const e of t){if(null===e){m+=c*h;continue}if((0,n.isNum)(e)){m+=p*e*a/1e3;continue}const t=(e.isSpace?h:0)+l,i=e.fontChar;let d,_,b,w=e.width;if(u){let t;const i=e.vmetric||g;t=e.vmetric?i[1]:.5*w;t=-t*f;const n=i[2]*f;w=i?-i[0]:w;d=t/o;_=(m+n)/o}else{d=m/o;_=0}if(e.isInFont||r.missingFile){s.xcoords.push(s.x+d);u&&s.ycoords.push(-s.y+_);s.tspan.textContent+=i}b=u?w*f-t*c:w*f+t*c;m+=b}s.tspan.setAttributeNS(null,"x",s.xcoords.map(pf).join(" "));u?s.tspan.setAttributeNS(null,"y",s.ycoords.map(pf).join(" ")):s.tspan.setAttributeNS(null,"y",pf(-s.y));u?s.y-=m:s.x+=m*d;s.tspan.setAttributeNS(null,"font-family",s.fontFamily);s.tspan.setAttributeNS(null,"font-size",`${pf(s.fontSize)}px`);s.fontStyle!==e.fontStyle&&s.tspan.setAttributeNS(null,"font-style",s.fontStyle);s.fontWeight!==e.fontWeight&&s.tspan.setAttributeNS(null,"font-weight",s.fontWeight);const _=s.textRenderingMode&n.TextRenderingMode.FILL_STROKE_MASK;if(_===n.TextRenderingMode.FILL||_===n.TextRenderingMode.FILL_STROKE){s.fillColor!==e.fillColor&&s.tspan.setAttributeNS(null,"fill",s.fillColor);s.fillAlpha<1&&s.tspan.setAttributeNS(null,"fill-opacity",s.fillAlpha)}else s.textRenderingMode===n.TextRenderingMode.ADD_TO_PATH?s.tspan.setAttributeNS(null,"fill","transparent"):s.tspan.setAttributeNS(null,"fill","none");if(_===n.TextRenderingMode.STROKE||_===n.TextRenderingMode.FILL_STROKE){const e=1/(s.textMatrixScale||1);this._setStrokeAttributes(s.tspan,e)}let b=s.textMatrix;if(0!==s.textRise){b=b.slice();b[5]+=s.textRise}s.txtElement.setAttributeNS(null,"transform",`${pm(b)} scale(${pf(d)}, -1)`);s.txtElement.setAttributeNS(i,"xml:space","preserve");s.txtElement.appendChild(s.tspan);s.txtgrp.appendChild(s.txtElement);this._ensureTransformGroup().appendChild(s.txtElement)}setLeadingMoveText(e,t){this.setLeading(-t);this.moveText(e,t)}addFontStyle(e){if(!e.data)throw new Error('addFontStyle: No font data available, ensure that the "fontExtraProperties" API parameter is set.');if(!this.cssStyle){this.cssStyle=this.svgFactory.createElement("svg:style");this.cssStyle.setAttributeNS(null,"type","text/css");this.defs.appendChild(this.cssStyle)}const t=(0,n.createObjectURL)(e.data,e.mimetype,this.forceDataSchema);this.cssStyle.textContent+=`@font-face { font-family: "${e.loadedName}"; src: url(${t}); }\n`}setFont(e){const t=this.current,i=this.commonObjs.get(e[0]);let s=e[1];t.font=i;if(this.embedFonts&&!i.missingFile&&!this.embeddedFonts[i.loadedName]){this.addFontStyle(i);this.embeddedFonts[i.loadedName]=i}t.fontMatrix=i.fontMatrix||n.FONT_IDENTITY_MATRIX;let r="normal";i.black?r="900":i.bold&&(r="bold");const a=i.italic?"italic":"normal";if(s<0){s=-s;t.fontDirection=-1}else t.fontDirection=1;t.fontSize=s;t.fontFamily=i.loadedName;t.fontWeight=r;t.fontStyle=a;t.tspan=this.svgFactory.createElement("svg:tspan");t.tspan.setAttributeNS(null,"y",pf(-t.y));t.xcoords=[];t.ycoords=[]}endText(){const e=this.current;if(e.textRenderingMode&n.TextRenderingMode.ADD_TO_PATH_FLAG&&e.txtElement?.hasChildNodes()){e.element=e.txtElement;this.clip("nonzero");this.endPath()}}setLineWidth(e){e>0&&(this.current.lineWidth=e)}setLineCap(e){this.current.lineCap=o[e]}setLineJoin(e){this.current.lineJoin=l[e]}setMiterLimit(e){this.current.miterLimit=e}setStrokeAlpha(e){this.current.strokeAlpha=e}setStrokeRGBColor(e,t,i){this.current.strokeColor=n.Util.makeHexColor(e,t,i)}setFillAlpha(e){this.current.fillAlpha=e}setFillRGBColor(e,t,i){this.current.fillColor=n.Util.makeHexColor(e,t,i);this.current.tspan=this.svgFactory.createElement("svg:tspan");this.current.xcoords=[];this.current.ycoords=[]}setStrokeColorN(e){this.current.strokeColor=this._makeColorN_Pattern(e)}setFillColorN(e){this.current.fillColor=this._makeColorN_Pattern(e)}shadingFill(e){const t=this.viewport.width,i=this.viewport.height,s=n.Util.inverseTransform(this.transformMatrix),r=n.Util.applyTransform([0,0],s),a=n.Util.applyTransform([0,i],s),o=n.Util.applyTransform([t,0],s),l=n.Util.applyTransform([t,i],s),h=Math.min(r[0],a[0],o[0],l[0]),c=Math.min(r[1],a[1],o[1],l[1]),d=Math.max(r[0],a[0],o[0],l[0]),u=Math.max(r[1],a[1],o[1],l[1]),p=this.svgFactory.createElement("svg:rect");p.setAttributeNS(null,"x",h);p.setAttributeNS(null,"y",c);p.setAttributeNS(null,"width",d-h);p.setAttributeNS(null,"height",u-c);p.setAttributeNS(null,"fill",this._makeShadingPattern(e));this.current.fillAlpha<1&&p.setAttributeNS(null,"fill-opacity",this.current.fillAlpha);this._ensureTransformGroup().appendChild(p)}_makeColorN_Pattern(e){return"TilingPattern"===e[0]?this._makeTilingPattern(e):this._makeShadingPattern(e)}_makeTilingPattern(e){const t=e[1],i=e[2],s=e[3]||n.IDENTITY_MATRIX,[r,a,o,l]=e[4],h=e[5],c=e[6],d=e[7],p="shading"+u++,[g,f,m,_]=n.Util.normalizeRect([...n.Util.applyTransform([r,a],s),...n.Util.applyTransform([o,l],s)]),[b,w]=n.Util.singularValueDecompose2dScale(s),v=h*b,y=c*w,S=this.svgFactory.createElement("svg:pattern");S.setAttributeNS(null,"id",p);S.setAttributeNS(null,"patternUnits","userSpaceOnUse");S.setAttributeNS(null,"width",v);S.setAttributeNS(null,"height",y);S.setAttributeNS(null,"x",`${g}`);S.setAttributeNS(null,"y",`${f}`);const P=this.svg,A=this.transformMatrix,C=this.current.fillColor,x=this.current.strokeColor,E=this.svgFactory.create(m-g,_-f);this.svg=E;this.transformMatrix=s;if(2===d){const e=n.Util.makeHexColor(...t);this.current.fillColor=e;this.current.strokeColor=e}this.executeOpTree(this.convertOpList(i));this.svg=P;this.transformMatrix=A;this.current.fillColor=C;this.current.strokeColor=x;S.appendChild(E.childNodes[0]);this.defs.appendChild(S);return`url(#${p})`}_makeShadingPattern(e){switch(e[0]){case"RadialAxial":const t="shading"+u++,i=e[3];let s;switch(e[1]){case"axial":const i=e[4],n=e[5];s=this.svgFactory.createElement("svg:linearGradient");s.setAttributeNS(null,"id",t);s.setAttributeNS(null,"gradientUnits","userSpaceOnUse");s.setAttributeNS(null,"x1",i[0]);s.setAttributeNS(null,"y1",i[1]);s.setAttributeNS(null,"x2",n[0]);s.setAttributeNS(null,"y2",n[1]);break;case"radial":const r=e[4],a=e[5],o=e[6],l=e[7];s=this.svgFactory.createElement("svg:radialGradient");s.setAttributeNS(null,"id",t);s.setAttributeNS(null,"gradientUnits","userSpaceOnUse");s.setAttributeNS(null,"cx",a[0]);s.setAttributeNS(null,"cy",a[1]);s.setAttributeNS(null,"r",l);s.setAttributeNS(null,"fx",r[0]);s.setAttributeNS(null,"fy",r[1]);s.setAttributeNS(null,"fr",o);break;default:throw new Error(`Unknown RadialAxial type: ${e[1]}`)}for(const e of i){const t=this.svgFactory.createElement("svg:stop");t.setAttributeNS(null,"offset",e[0]);t.setAttributeNS(null,"stop-color",e[1]);s.appendChild(t)}this.defs.appendChild(s);return`url(#${t})`;case"Mesh":(0,n.warn)("Unimplemented pattern Mesh");return null;case"Dummy":return"hotpink";default:throw new Error(`Unknown IR type: ${e[0]}`)}}setDash(e,t){this.current.dashArray=e;this.current.dashPhase=t}constructPath(e,t){const i=this.current;let s=i.x,r=i.y,a=[],o=0;for(const i of e)switch(0|i){case n.OPS.rectangle:s=t[o++];r=t[o++];const e=s+t[o++],i=r+t[o++];a.push("M",pf(s),pf(r),"L",pf(e),pf(r),"L",pf(e),pf(i),"L",pf(s),pf(i),"Z");break;case n.OPS.moveTo:s=t[o++];r=t[o++];a.push("M",pf(s),pf(r));break;case n.OPS.lineTo:s=t[o++];r=t[o++];a.push("L",pf(s),pf(r));break;case n.OPS.curveTo:s=t[o+4];r=t[o+5];a.push("C",pf(t[o]),pf(t[o+1]),pf(t[o+2]),pf(t[o+3]),pf(s),pf(r));o+=6;break;case n.OPS.curveTo2:a.push("C",pf(s),pf(r),pf(t[o]),pf(t[o+1]),pf(t[o+2]),pf(t[o+3]));s=t[o+2];r=t[o+3];o+=4;break;case n.OPS.curveTo3:s=t[o+2];r=t[o+3];a.push("C",pf(t[o]),pf(t[o+1]),pf(s),pf(r),pf(s),pf(r));o+=4;break;case n.OPS.closePath:a.push("Z")}a=a.join(" ");if(i.path&&e.length>0&&e[0]!==n.OPS.rectangle&&e[0]!==n.OPS.moveTo)a=i.path.getAttributeNS(null,"d")+a;else{i.path=this.svgFactory.createElement("svg:path");this._ensureTransformGroup().appendChild(i.path)}i.path.setAttributeNS(null,"d",a);i.path.setAttributeNS(null,"fill","none");i.element=i.path;i.setCurrentPoint(s,r)}endPath(){const e=this.current;e.path=null;if(!this.pendingClip)return;if(!e.element){this.pendingClip=null;return}const t="clippath"+c++,i=this.svgFactory.createElement("svg:clipPath");i.setAttributeNS(null,"id",t);i.setAttributeNS(null,"transform",pm(this.transformMatrix));const n=e.element.cloneNode(!0);"evenodd"===this.pendingClip?n.setAttributeNS(null,"clip-rule","evenodd"):n.setAttributeNS(null,"clip-rule","nonzero");this.pendingClip=null;i.appendChild(n);this.defs.appendChild(i);if(e.activeClipUrl){e.clipGroup=null;for(const e of this.extraStack)e.clipGroup=null;i.setAttributeNS(null,"clip-path",e.activeClipUrl)}e.activeClipUrl=`url(#${t})`;this.tgrp=null}clip(e){this.pendingClip=e}closePath(){const e=this.current;if(e.path){const t=`${e.path.getAttributeNS(null,"d")}Z`;e.path.setAttributeNS(null,"d",t)}}setLeading(e){this.current.leading=-e}setTextRise(e){this.current.textRise=e}setTextRenderingMode(e){this.current.textRenderingMode=e}setHScale(e){this.current.textHScale=e/100}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[t,i]of e)switch(t){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i);break;case"CA":this.setStrokeAlpha(i);break;case"ca":this.setFillAlpha(i);break;default:(0,n.warn)(`Unimplemented graphic state operator ${t}`)}}fill(){const e=this.current;if(e.element){e.element.setAttributeNS(null,"fill",e.fillColor);e.element.setAttributeNS(null,"fill-opacity",e.fillAlpha);this.endPath()}}stroke(){const e=this.current;if(e.element){this._setStrokeAttributes(e.element);e.element.setAttributeNS(null,"fill","none");this.endPath()}}_setStrokeAttributes(e,t=1){const i=this.current;let n=i.dashArray;1!==t&&n.length>0&&(n=n.map((function(e){return t*e})));e.setAttributeNS(null,"stroke",i.strokeColor);e.setAttributeNS(null,"stroke-opacity",i.strokeAlpha);e.setAttributeNS(null,"stroke-miterlimit",pf(i.miterLimit));e.setAttributeNS(null,"stroke-linecap",i.lineCap);e.setAttributeNS(null,"stroke-linejoin",i.lineJoin);e.setAttributeNS(null,"stroke-width",pf(t*i.lineWidth)+"px");e.setAttributeNS(null,"stroke-dasharray",n.map(pf).join(" "));e.setAttributeNS(null,"stroke-dashoffset",pf(t*i.dashPhase)+"px")}eoFill(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd");this.fill()}fillStroke(){this.stroke();this.fill()}eoFillStroke(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd");this.fillStroke()}closeStroke(){this.closePath();this.stroke()}closeFillStroke(){this.closePath();this.fillStroke()}closeEOFillStroke(){this.closePath();this.eoFillStroke()}paintSolidColorImageMask(){const e=this.svgFactory.createElement("svg:rect");e.setAttributeNS(null,"x","0");e.setAttributeNS(null,"y","0");e.setAttributeNS(null,"width","1px");e.setAttributeNS(null,"height","1px");e.setAttributeNS(null,"fill",this.current.fillColor);this._ensureTransformGroup().appendChild(e)}paintImageXObject(e){const t=e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e);t?this.paintInlineImageXObject(t):(0,n.warn)(`Dependent image with object ID ${e} is not ready yet`)}paintInlineImageXObject(e,t){const i=e.width,n=e.height,s=h(e,this.forceDataSchema,!!t),r=this.svgFactory.createElement("svg:rect");r.setAttributeNS(null,"x","0");r.setAttributeNS(null,"y","0");r.setAttributeNS(null,"width",pf(i));r.setAttributeNS(null,"height",pf(n));this.current.element=r;this.clip("nonzero");const o=this.svgFactory.createElement("svg:image");o.setAttributeNS(a,"xlink:href",s);o.setAttributeNS(null,"x","0");o.setAttributeNS(null,"y",pf(-n));o.setAttributeNS(null,"width",pf(i)+"px");o.setAttributeNS(null,"height",pf(n)+"px");o.setAttributeNS(null,"transform",`scale(${pf(1/i)} ${pf(-1/n)})`);t?t.appendChild(o):this._ensureTransformGroup().appendChild(o)}paintImageMaskXObject(e){const t=this.current,i=e.width,n=e.height,s=t.fillColor;t.maskId="mask"+d++;const r=this.svgFactory.createElement("svg:mask");r.setAttributeNS(null,"id",t.maskId);const a=this.svgFactory.createElement("svg:rect");a.setAttributeNS(null,"x","0");a.setAttributeNS(null,"y","0");a.setAttributeNS(null,"width",pf(i));a.setAttributeNS(null,"height",pf(n));a.setAttributeNS(null,"fill",s);a.setAttributeNS(null,"mask",`url(#${t.maskId})`);this.defs.appendChild(r);this._ensureTransformGroup().appendChild(a);this.paintInlineImageXObject(e,r)}paintFormXObjectBegin(e,t){Array.isArray(e)&&6===e.length&&this.transform(e[0],e[1],e[2],e[3],e[4],e[5]);if(t){const e=t[2]-t[0],i=t[3]-t[1],n=this.svgFactory.createElement("svg:rect");n.setAttributeNS(null,"x",t[0]);n.setAttributeNS(null,"y",t[1]);n.setAttributeNS(null,"width",pf(e));n.setAttributeNS(null,"height",pf(i));this.current.element=n;this.clip("nonzero");this.endPath()}}paintFormXObjectEnd(){}_initialize(e){const t=this.svgFactory.create(e.width,e.height),i=this.svgFactory.createElement("svg:defs");t.appendChild(i);this.defs=i;const n=this.svgFactory.createElement("svg:g");n.setAttributeNS(null,"transform",pm(e.transform));t.appendChild(n);this.svg=n;return t}_ensureClipGroup(){if(!this.current.clipGroup){const e=this.svgFactory.createElement("svg:g");e.setAttributeNS(null,"clip-path",this.current.activeClipUrl);this.svg.appendChild(e);this.current.clipGroup=e}return this.current.clipGroup}_ensureTransformGroup(){if(!this.tgrp){this.tgrp=this.svgFactory.createElement("svg:g");this.tgrp.setAttributeNS(null,"transform",pm(this.transformMatrix));this.current.activeClipUrl?this._ensureClipGroup().appendChild(this.tgrp):this.svg.appendChild(this.tgrp)}return this.tgrp}}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.XfaLayer=void 0;var n=i(2),s=i(17);t.XfaLayer=class XfaLayer{static setupStorage(e,t,i,n,s){const r=n.getValue(t,{value:null});switch(i.name){case"textarea":null!==r.value&&(e.textContent=r.value);if("print"===s)break;e.addEventListener("input",(e=>{n.setValue(t,{value:e.target.value})}));break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){r.value===i.attributes.xfaOn?e.setAttribute("checked",!0):r.value===i.attributes.xfaOff&&e.removeAttribute("checked");if("print"===s)break;e.addEventListener("change",(e=>{n.setValue(t,{value:e.target.checked?e.target.getAttribute("xfaOn"):e.target.getAttribute("xfaOff")})}))}else{null!==r.value&&e.setAttribute("value",r.value);if("print"===s)break;e.addEventListener("input",(e=>{n.setValue(t,{value:e.target.value})}))}break;case"select":if(null!==r.value)for(const e of i.children)e.attributes.value===r.value&&(e.attributes.selected=!0);e.addEventListener("input",(e=>{const i=e.target.options,s=-1===i.selectedIndex?"":i[i.selectedIndex].value;n.setValue(t,{value:s})}))}}static setAttributes({html:e,element:t,storage:i=null,intent:s,linkService:r}){const{attributes:a}=t,o=e instanceof HTMLAnchorElement;"radio"===a.type&&(a.name=`${a.name}-${s}`);for(const[t,i]of Object.entries(a))if(null!=i&&"dataId"!==t)if("style"!==t)if("textContent"===t)e.textContent=i;else if("class"===t)e.setAttribute(t,i.join(" "));else{if(o&&("href"===t||"newWindow"===t))continue;e.setAttribute(t,i)}else Object.assign(e.style,i);if(o){r.addLinkAttributes||(0,n.warn)("XfaLayer.setAttribute - missing `addLinkAttributes`-method on the `linkService`-instance.");r.addLinkAttributes?.(e,a.href,a.newWindow)}i&&a.dataId&&this.setupStorage(e,a.dataId,t,i)}static render(e){const t=e.annotationStorage,i=e.linkService,n=e.xfa,r=e.intent||"display",a=document.createElement(n.name);n.attributes&&this.setAttributes({html:a,element:n,intent:r,linkService:i});const o=[[n,-1,a]],l=e.div;l.appendChild(a);const h=`matrix(${e.viewport.transform.join(",")})`;l.style.transform=h;l.setAttribute("class","xfaLayer xfaFont");const c=[];for(;o.length>0;){const[e,n,a]=o[o.length-1];if(n+1===e.children.length){o.pop();continue}const l=e.children[++o[o.length-1][1]];if(null===l)continue;const{name:h}=l;if("#text"===h){const e=document.createTextNode(l.value);c.push(e);a.appendChild(e);continue}let d;d=l?.attributes?.xmlns?document.createElementNS(l.attributes.xmlns,h):document.createElement(h);a.appendChild(d);l.attributes&&this.setAttributes({html:d,element:l,storage:t,intent:r,linkService:i});if(l.children&&l.children.length>0)o.push([l,-1,d]);else if(l.value){const e=document.createTextNode(l.value);s.XfaText.shouldBuildText(h)&&c.push(e);d.appendChild(e)}}for(const e of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))e.setAttribute("readOnly",!0);return{textDivs:c}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t;e.div.hidden=!1}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFNodeStream=void 0;var n=i(2),s=i(24);const r=require("fs"),a=require("http"),o=require("https"),l=require("url"),h=/^file:\/\/\/[a-zA-Z]:\//;t.PDFNodeStream=class PDFNodeStream{constructor(e){this.source=e;this.url=function parseUrl(e){const t=l.parse(e);if("file:"===t.protocol||t.host)return t;if(/^[a-z]:[/\\]/i.test(e))return l.parse(`file:///${e}`);t.host||(t.protocol="file:");return t}(e.url);this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol||"capacitor:"===this.url.protocol;this.isFsUrl="file:"===this.url.protocol;this.httpHeaders=this.isHttp&&e.httpHeaders||{};this._fullRequestReader=null;this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){(0,n.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once.");this._fullRequestReader=this.isFsUrl?new PDFNodeStreamFsFullReader(this):new PDFNodeStreamFullReader(this);return this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const i=this.isFsUrl?new PDFNodeStreamFsRangeReader(this,e,t):new PDFNodeStreamRangeReader(this,e,t);this._rangeRequestReaders.push(i);return i}cancelAllRequests(e){this._fullRequestReader&&this._fullRequestReader.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}};class BaseFullReader{constructor(e){this._url=e.url;this._done=!1;this._storedError=null;this.onProgress=null;const t=e.source;this._contentLength=t.length;this._loaded=0;this._filename=null;this._disableRange=t.disableRange||!1;this._rangeChunkSize=t.rangeChunkSize;this._rangeChunkSize||this._disableRange||(this._disableRange=!0);this._isStreamingSupported=!t.disableStream;this._isRangeSupported=!t.disableRange;this._readableStream=null;this._readCapability=(0,n.createPromiseCapability)();this._headersCapability=(0,n.createPromiseCapability)()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;if(this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();if(null===e){this._readCapability=(0,n.createPromiseCapability)();return this.read()}this._loaded+=e.length;this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength});return{value:new Uint8Array(e).buffer,done:!1}}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e;this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e;e.on("readable",(()=>{this._readCapability.resolve()}));e.on("end",(()=>{e.destroy();this._done=!0;this._readCapability.resolve()}));e.on("error",(e=>{this._error(e)}));!this._isStreamingSupported&&this._isRangeSupported&&this._error(new n.AbortException("streaming is disabled"));this._storedError&&this._readableStream.destroy(this._storedError)}}class BaseRangeReader{constructor(e){this._url=e.url;this._done=!1;this._storedError=null;this.onProgress=null;this._loaded=0;this._readableStream=null;this._readCapability=(0,n.createPromiseCapability)();const t=e.source;this._isStreamingSupported=!t.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;if(this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();if(null===e){this._readCapability=(0,n.createPromiseCapability)();return this.read()}this._loaded+=e.length;this.onProgress&&this.onProgress({loaded:this._loaded});return{value:new Uint8Array(e).buffer,done:!1}}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e;this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e;e.on("readable",(()=>{this._readCapability.resolve()}));e.on("end",(()=>{e.destroy();this._done=!0;this._readCapability.resolve()}));e.on("error",(e=>{this._error(e)}));this._storedError&&this._readableStream.destroy(this._storedError)}}function createRequestOptions(e,t){return{protocol:e.protocol,auth:e.auth,host:e.hostname,port:e.port,path:e.path,method:"GET",headers:t}}class PDFNodeStreamFullReader extends BaseFullReader{constructor(e){super(e);const handleResponse=t=>{if(404===t.statusCode){const e=new n.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=e;this._headersCapability.reject(e);return}this._headersCapability.resolve();this._setReadableStream(t);const getResponseHeader=e=>this._readableStream.headers[e.toLowerCase()],{allowRangeRequests:i,suggestedLength:r}=(0,s.validateRangeRequestCapabilities)({getResponseHeader:getResponseHeader,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=i;this._contentLength=r||this._contentLength;this._filename=(0,s.extractFilenameFromHeader)(getResponseHeader)};this._request=null;"http:"===this._url.protocol?this._request=a.request(createRequestOptions(this._url,e.httpHeaders),handleResponse):this._request=o.request(createRequestOptions(this._url,e.httpHeaders),handleResponse);this._request.on("error",(e=>{this._storedError=e;this._headersCapability.reject(e)}));this._request.end()}}class PDFNodeStreamRangeReader extends BaseRangeReader{constructor(e,t,i){super(e);this._httpHeaders={};for(const t in e.httpHeaders){const i=e.httpHeaders[t];void 0!==i&&(this._httpHeaders[t]=i)}this._httpHeaders.Range=`bytes=${t}-${i-1}`;const handleResponse=e=>{if(404!==e.statusCode)this._setReadableStream(e);else{const e=new n.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=e}};this._request=null;"http:"===this._url.protocol?this._request=a.request(createRequestOptions(this._url,this._httpHeaders),handleResponse):this._request=o.request(createRequestOptions(this._url,this._httpHeaders),handleResponse);this._request.on("error",(e=>{this._storedError=e}));this._request.end()}}class PDFNodeStreamFsFullReader extends BaseFullReader{constructor(e){super(e);let t=decodeURIComponent(this._url.path);h.test(this._url.href)&&(t=t.replace(/^\//,""));r.lstat(t,((e,i)=>{if(e){"ENOENT"===e.code&&(e=new n.MissingPDFException(`Missing PDF "${t}".`));this._storedError=e;this._headersCapability.reject(e)}else{this._contentLength=i.size;this._setReadableStream(r.createReadStream(t));this._headersCapability.resolve()}}))}}class PDFNodeStreamFsRangeReader extends BaseRangeReader{constructor(e,t,i){super(e);let n=decodeURIComponent(this._url.path);h.test(this._url.href)&&(n=n.replace(/^\//,""));this._setReadableStream(r.createReadStream(n,{start:t,end:i-1}))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.createResponseStatusError=function createResponseStatusError(e,t){if(404===e||0===e&&t.startsWith("file:"))return new n.MissingPDFException('Missing PDF "'+t+'".');return new n.UnexpectedResponseException(`Unexpected server response (${e}) while retrieving PDF "${t}".`,e)};t.extractFilenameFromHeader=function extractFilenameFromHeader(e){const t=e("Content-Disposition");if(t){let e=(0,s.getFilenameFromContentDispositionHeader)(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch(e){}if((0,r.isPdfFile)(e))return e}return null};t.validateRangeRequestCapabilities=function validateRangeRequestCapabilities({getResponseHeader:e,isHttp:t,rangeChunkSize:i,disableRange:s}){(0,n.assert)(i>0,"Range chunk size must be larger than zero");const r={allowRangeRequests:!1,suggestedLength:void 0},a=parseInt(e("Content-Length"),10);if(!Number.isInteger(a))return r;r.suggestedLength=a;if(a<=2*i)return r;if(s||!t)return r;if("bytes"!==e("Accept-Ranges"))return r;if("identity"!==(e("Content-Encoding")||"identity"))return r;r.allowRangeRequests=!0;return r};t.validateResponseStatus=function validateResponseStatus(e){return 200===e||206===e};var n=i(2),s=i(25),r=i(1)},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.getFilenameFromContentDispositionHeader=function getFilenameFromContentDispositionHeader(e){let t=!0,i=toParamRegExp("filename\\*","i").exec(e);if(i){i=i[1];let e=rfc2616unquote(i);e=unescape(e);e=rfc5987decode(e);e=rfc2047decode(e);return fixupEncoding(e)}i=function rfc2231getparam(e){const t=[];let i;const n=toParamRegExp("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(i=n.exec(e));){let[,e,n,s]=i;e=parseInt(e,10);if(e in t){if(0===e)break}else t[e]=[n,s]}const s=[];for(let e=0;e<t.length&&e in t;++e){let[i,n]=t[e];n=rfc2616unquote(n);if(i){n=unescape(n);0===e&&(n=rfc5987decode(n))}s.push(n)}return s.join("")}(e);if(i){return fixupEncoding(rfc2047decode(i))}i=toParamRegExp("filename","i").exec(e);if(i){i=i[1];let e=rfc2616unquote(i);e=rfc2047decode(e);return fixupEncoding(e)}function toParamRegExp(e,t){return new RegExp("(?:^|;)\\s*"+e+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',t)}function textdecode(e,i){if(e){if(!/^[\x00-\xFF]+$/.test(i))return i;try{const s=new TextDecoder(e,{fatal:!0}),r=(0,n.stringToBytes)(i);i=s.decode(r);t=!1}catch(n){if(/^utf-?8$/i.test(e))try{i=decodeURIComponent(escape(i));t=!1}catch(e){}}}return i}function fixupEncoding(e){if(t&&/[\x80-\xff]/.test(e)){e=textdecode("utf-8",e);t&&(e=textdecode("iso-8859-1",e))}return e}function rfc2616unquote(e){if(e.startsWith('"')){const t=e.slice(1).split('\\"');for(let e=0;e<t.length;++e){const i=t[e].indexOf('"');if(-1!==i){t[e]=t[e].slice(0,i);t.length=e+1}t[e]=t[e].replace(/\\(.)/g,"$1")}e=t.join('"')}return e}function rfc5987decode(e){const t=e.indexOf("'");if(-1===t)return e;return textdecode(e.slice(0,t),e.slice(t+1).replace(/^[^']*'/,""))}function rfc2047decode(e){return!e.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(e)?e:e.replace(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,(function(e,t,i,n){if("q"===i||"Q"===i)return textdecode(t,n=(n=n.replace(/_/g," ")).replace(/=([0-9a-fA-F]{2})/g,(function(e,t){return String.fromCharCode(parseInt(t,16))})));try{n=atob(n)}catch(e){}return textdecode(t,n)}))}return""};var n=i(2)},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFNetworkStream=void 0;var n=i(2),s=i(24);class NetworkManager{constructor(e,t={}){this.url=e;this.isHttp=/^https?:/i.test(e);this.httpHeaders=this.isHttp&&t.httpHeaders||Object.create(null);this.withCredentials=t.withCredentials||!1;this.getXhr=t.getXhr||function NetworkManager_getXhr(){return new XMLHttpRequest};this.currXhrId=0;this.pendingRequests=Object.create(null)}requestRange(e,t,i){const n={begin:e,end:t};for(const e in i)n[e]=i[e];return this.request(n)}requestFull(e){return this.request(e)}request(e){const t=this.getXhr(),i=this.currXhrId++,n=this.pendingRequests[i]={xhr:t};t.open("GET",this.url);t.withCredentials=this.withCredentials;for(const e in this.httpHeaders){const i=this.httpHeaders[e];void 0!==i&&t.setRequestHeader(e,i)}if(this.isHttp&&"begin"in e&&"end"in e){t.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`);n.expectedStatus=206}else n.expectedStatus=200;t.responseType="arraybuffer";e.onError&&(t.onerror=function(i){e.onError(t.status)});t.onreadystatechange=this.onStateChange.bind(this,i);t.onprogress=this.onProgress.bind(this,i);n.onHeadersReceived=e.onHeadersReceived;n.onDone=e.onDone;n.onError=e.onError;n.onProgress=e.onProgress;t.send(null);return i}onProgress(e,t){const i=this.pendingRequests[e];i&&i.onProgress?.(t)}onStateChange(e,t){const i=this.pendingRequests[e];if(!i)return;const s=i.xhr;if(s.readyState>=2&&i.onHeadersReceived){i.onHeadersReceived();delete i.onHeadersReceived}if(4!==s.readyState)return;if(!(e in this.pendingRequests))return;delete this.pendingRequests[e];if(0===s.status&&this.isHttp){i.onError?.(s.status);return}const r=s.status||200;if(!(200===r&&206===i.expectedStatus)&&r!==i.expectedStatus){i.onError?.(s.status);return}const a=function getArrayBuffer(e){const t=e.response;return"string"!=typeof t?t:(0,n.stringToBytes)(t).buffer}(s);if(206===r){const e=s.getResponseHeader("Content-Range"),t=/bytes (\d+)-(\d+)\/(\d+)/.exec(e);i.onDone({begin:parseInt(t[1],10),chunk:a})}else a?i.onDone({begin:0,chunk:a}):i.onError?.(s.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const t=this.pendingRequests[e].xhr;delete this.pendingRequests[e];t.abort()}}t.PDFNetworkStream=class PDFNetworkStream{constructor(e){this._source=e;this._manager=new NetworkManager(e.url,{httpHeaders:e.httpHeaders,withCredentials:e.withCredentials});this._rangeChunkSize=e.rangeChunkSize;this._fullRequestReader=null;this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)}getFullReader(){(0,n.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once.");this._fullRequestReader=new PDFNetworkStreamFullRequestReader(this._manager,this._source);return this._fullRequestReader}getRangeReader(e,t){const i=new PDFNetworkStreamRangeRequestReader(this._manager,e,t);i.onClosed=this._onRangeRequestReaderClosed.bind(this);this._rangeRequestReaders.push(i);return i}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}};class PDFNetworkStreamFullRequestReader{constructor(e,t){this._manager=e;const i={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url;this._fullRequestId=e.requestFull(i);this._headersReceivedCapability=(0,n.createPromiseCapability)();this._disableRange=t.disableRange||!1;this._contentLength=t.length;this._rangeChunkSize=t.rangeChunkSize;this._rangeChunkSize||this._disableRange||(this._disableRange=!0);this._isStreamingSupported=!1;this._isRangeSupported=!1;this._cachedChunks=[];this._requests=[];this._done=!1;this._storedError=void 0;this._filename=null;this.onProgress=null}_onHeadersReceived(){const e=this._fullRequestId,t=this._manager.getRequestXhr(e),getResponseHeader=e=>t.getResponseHeader(e),{allowRangeRequests:i,suggestedLength:n}=(0,s.validateRangeRequestCapabilities)({getResponseHeader:getResponseHeader,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});i&&(this._isRangeSupported=!0);this._contentLength=n||this._contentLength;this._filename=(0,s.extractFilenameFromHeader)(getResponseHeader);this._isRangeSupported&&this._manager.abortRequest(e);this._headersReceivedCapability.resolve()}_onDone(e){if(e)if(this._requests.length>0){this._requests.shift().resolve({value:e.chunk,done:!1})}else this._cachedChunks.push(e.chunk);this._done=!0;if(!(this._cachedChunks.length>0)){for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=(0,s.createResponseStatusError)(e,this._url);this._headersReceivedCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0;this._cachedChunks.length=0}_onProgress(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0){return{value:this._cachedChunks.shift(),done:!1}}if(this._done)return{value:void 0,done:!0};const e=(0,n.createPromiseCapability)();this._requests.push(e);return e.promise}cancel(e){this._done=!0;this._headersReceivedCapability.reject(e);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0;this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId);this._fullRequestReader=null}}class PDFNetworkStreamRangeRequestReader{constructor(e,t,i){this._manager=e;const n={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url;this._requestId=e.requestRange(t,i,n);this._requests=[];this._queuedChunk=null;this._done=!1;this._storedError=void 0;this.onProgress=null;this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(e){const t=e.chunk;if(this._requests.length>0){this._requests.shift().resolve({value:t,done:!1})}else this._queuedChunk=t;this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0;this._close()}_onError(e){this._storedError=(0,s.createResponseStatusError)(e,this._url);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0;this._queuedChunk=null}_onProgress(e){this.isStreamingSupported||this.onProgress?.({loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){const e=this._queuedChunk;this._queuedChunk=null;return{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=(0,n.createPromiseCapability)();this._requests.push(e);return e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0;this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId);this._close()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFFetchStream=void 0;var n=i(2),s=i(24);function createFetchOptions(e,t,i){return{method:"GET",headers:e,signal:i?.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function createHeaders(e){const t=new Headers;for(const i in e){const n=e[i];void 0!==n&&t.append(i,n)}return t}t.PDFFetchStream=class PDFFetchStream{constructor(e){this.source=e;this.isHttp=/^https?:/i.test(e.url);this.httpHeaders=this.isHttp&&e.httpHeaders||{};this._fullRequestReader=null;this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){(0,n.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once.");this._fullRequestReader=new PDFFetchStreamReader(this);return this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const i=new PDFFetchStreamRangeReader(this,e,t);this._rangeRequestReaders.push(i);return i}cancelAllRequests(e){this._fullRequestReader&&this._fullRequestReader.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}};class PDFFetchStreamReader{constructor(e){this._stream=e;this._reader=null;this._loaded=0;this._filename=null;const t=e.source;this._withCredentials=t.withCredentials||!1;this._contentLength=t.length;this._headersCapability=(0,n.createPromiseCapability)();this._disableRange=t.disableRange||!1;this._rangeChunkSize=t.rangeChunkSize;this._rangeChunkSize||this._disableRange||(this._disableRange=!0);"undefined"!=typeof AbortController&&(this._abortController=new AbortController);this._isStreamingSupported=!t.disableStream;this._isRangeSupported=!t.disableRange;this._headers=createHeaders(this._stream.httpHeaders);const i=t.url;fetch(i,createFetchOptions(this._headers,this._withCredentials,this._abortController)).then((e=>{if(!(0,s.validateResponseStatus)(e.status))throw(0,s.createResponseStatusError)(e.status,i);this._reader=e.body.getReader();this._headersCapability.resolve();const getResponseHeader=t=>e.headers.get(t),{allowRangeRequests:t,suggestedLength:r}=(0,s.validateRangeRequestCapabilities)({getResponseHeader:getResponseHeader,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=t;this._contentLength=r||this._contentLength;this._filename=(0,s.extractFilenameFromHeader)(getResponseHeader);!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new n.AbortException("Streaming is disabled."))})).catch(this._headersCapability.reject);this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;const{value:e,done:t}=await this._reader.read();if(t)return{value:e,done:t};this._loaded+=e.byteLength;this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength});return{value:new Uint8Array(e).buffer,done:!1}}cancel(e){this._reader&&this._reader.cancel(e);this._abortController&&this._abortController.abort()}}class PDFFetchStreamRangeReader{constructor(e,t,i){this._stream=e;this._reader=null;this._loaded=0;const r=e.source;this._withCredentials=r.withCredentials||!1;this._readCapability=(0,n.createPromiseCapability)();this._isStreamingSupported=!r.disableStream;"undefined"!=typeof AbortController&&(this._abortController=new AbortController);this._headers=createHeaders(this._stream.httpHeaders);this._headers.append("Range",`bytes=${t}-${i-1}`);const a=r.url;fetch(a,createFetchOptions(this._headers,this._withCredentials,this._abortController)).then((e=>{if(!(0,s.validateResponseStatus)(e.status))throw(0,s.createResponseStatusError)(e.status,a);this._readCapability.resolve();this._reader=e.body.getReader()})).catch(this._readCapability.reject);this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:e,done:t}=await this._reader.read();if(t)return{value:e,done:t};this._loaded+=e.byteLength;this.onProgress&&this.onProgress({loaded:this._loaded});return{value:new Uint8Array(e).buffer,done:!1}}cancel(e){this._reader&&this._reader.cancel(e);this._abortController&&this._abortController.abort()}}}],__webpack_module_cache__={};function __w_pdfjs_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var i=__webpack_module_cache__[e]={exports:{}};__webpack_modules__[e](i,i.exports,__w_pdfjs_require__);return i.exports}var __webpack_exports__={};(()=>{var e=__webpack_exports__;Object.defineProperty(e,"__esModule",{value:!0});Object.defineProperty(e,"addLinkAttributes",{enumerable:!0,get:function(){return t.addLinkAttributes}});Object.defineProperty(e,"getFilenameFromUrl",{enumerable:!0,get:function(){return t.getFilenameFromUrl}});Object.defineProperty(e,"getPdfFilenameFromUrl",{enumerable:!0,get:function(){return t.getPdfFilenameFromUrl}});Object.defineProperty(e,"getXfaPageViewport",{enumerable:!0,get:function(){return t.getXfaPageViewport}});Object.defineProperty(e,"isPdfFile",{enumerable:!0,get:function(){return t.isPdfFile}});Object.defineProperty(e,"LinkTarget",{enumerable:!0,get:function(){return t.LinkTarget}});Object.defineProperty(e,"loadScript",{enumerable:!0,get:function(){return t.loadScript}});Object.defineProperty(e,"PDFDateString",{enumerable:!0,get:function(){return t.PDFDateString}});Object.defineProperty(e,"PixelsPerInch",{enumerable:!0,get:function(){return t.PixelsPerInch}});Object.defineProperty(e,"RenderingCancelledException",{enumerable:!0,get:function(){return t.RenderingCancelledException}});Object.defineProperty(e,"AnnotationMode",{enumerable:!0,get:function(){return i.AnnotationMode}});Object.defineProperty(e,"CMapCompressionType",{enumerable:!0,get:function(){return i.CMapCompressionType}});Object.defineProperty(e,"createObjectURL",{enumerable:!0,get:function(){return i.createObjectURL}});Object.defineProperty(e,"createPromiseCapability",{enumerable:!0,get:function(){return i.createPromiseCapability}});Object.defineProperty(e,"createValidAbsoluteUrl",{enumerable:!0,get:function(){return i.createValidAbsoluteUrl}});Object.defineProperty(e,"InvalidPDFException",{enumerable:!0,get:function(){return i.InvalidPDFException}});Object.defineProperty(e,"MissingPDFException",{enumerable:!0,get:function(){return i.MissingPDFException}});Object.defineProperty(e,"OPS",{enumerable:!0,get:function(){return i.OPS}});Object.defineProperty(e,"PasswordResponses",{enumerable:!0,get:function(){return i.PasswordResponses}});Object.defineProperty(e,"PermissionFlag",{enumerable:!0,get:function(){return i.PermissionFlag}});Object.defineProperty(e,"removeNullCharacters",{enumerable:!0,get:function(){return i.removeNullCharacters}});Object.defineProperty(e,"shadow",{enumerable:!0,get:function(){return i.shadow}});Object.defineProperty(e,"UnexpectedResponseException",{enumerable:!0,get:function(){return i.UnexpectedResponseException}});Object.defineProperty(e,"UNSUPPORTED_FEATURES",{enumerable:!0,get:function(){return i.UNSUPPORTED_FEATURES}});Object.defineProperty(e,"Util",{enumerable:!0,get:function(){return i.Util}});Object.defineProperty(e,"VerbosityLevel",{enumerable:!0,get:function(){return i.VerbosityLevel}});Object.defineProperty(e,"build",{enumerable:!0,get:function(){return n.build}});Object.defineProperty(e,"getDocument",{enumerable:!0,get:function(){return n.getDocument}});Object.defineProperty(e,"LoopbackPort",{enumerable:!0,get:function(){return n.LoopbackPort}});Object.defineProperty(e,"PDFDataRangeTransport",{enumerable:!0,get:function(){return n.PDFDataRangeTransport}});Object.defineProperty(e,"PDFWorker",{enumerable:!0,get:function(){return n.PDFWorker}});Object.defineProperty(e,"version",{enumerable:!0,get:function(){return n.version}});Object.defineProperty(e,"AnnotationLayer",{enumerable:!0,get:function(){return s.AnnotationLayer}});Object.defineProperty(e,"GlobalWorkerOptions",{enumerable:!0,get:function(){return r.GlobalWorkerOptions}});Object.defineProperty(e,"renderTextLayer",{enumerable:!0,get:function(){return o.renderTextLayer}});Object.defineProperty(e,"SVGGraphics",{enumerable:!0,get:function(){return l.SVGGraphics}});Object.defineProperty(e,"XfaLayer",{enumerable:!0,get:function(){return h.XfaLayer}});var t=__w_pdfjs_require__(1),i=__w_pdfjs_require__(2),n=__w_pdfjs_require__(5),s=__w_pdfjs_require__(18),r=__w_pdfjs_require__(12),a=__w_pdfjs_require__(8),o=__w_pdfjs_require__(20),l=__w_pdfjs_require__(21),h=__w_pdfjs_require__(22);if(a.isNodeJS){const{PDFNodeStream:e}=__w_pdfjs_require__(23);(0,n.setPDFNetworkStreamFactory)((t=>new e(t)))}else{const{PDFNetworkStream:e}=__w_pdfjs_require__(26),{PDFFetchStream:i}=__w_pdfjs_require__(27);(0,n.setPDFNetworkStreamFactory)((n=>(0,t.isValidFetchUrl)(n.url)?new i(n):new e(n)))}})();return __webpack_exports__})()}));
/**
* @licstart The following is the entire license notice for the
* Javascript code in this page
*
* Copyright 2021 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @licend The above is the entire license notice for the
* Javascript code in this page
*/(()=>{"use strict";var e=[,(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.OptionKind=t.compatibilityParams=t.AppOptions=void 0;const i=Object.create(null);t.compatibilityParams=i;{const e="undefined"!=typeof navigator&&navigator.userAgent||"",t="undefined"!=typeof navigator&&navigator.platform||"",n="undefined"!=typeof navigator&&navigator.maxTouchPoints||1,s=/Android/.test(e),r=/\b(iPad|iPhone|iPod)(?=;)/.test(e)||"MacIntel"===t&&n>1,a=/CriOS/.test(e);!function checkOnBlobSupport(){a&&(i.disableCreateObjectURL=!0)}();!function checkCanvasSizeLimitation(){(r||s)&&(i.maxCanvasPixels=5242880)}()}const n={VIEWER:2,API:4,WORKER:8,PREFERENCE:128};t.OptionKind=n;const s={annotationMode:{value:2,kind:n.VIEWER+n.PREFERENCE},cursorToolOnLoad:{value:0,kind:n.VIEWER+n.PREFERENCE},defaultUrl:{value:"",kind:n.VIEWER},defaultZoomValue:{value:"",kind:n.VIEWER+n.PREFERENCE},disableHistory:{value:!1,kind:n.VIEWER},disablePageLabels:{value:!1,kind:n.VIEWER+n.PREFERENCE},enablePermissions:{value:!1,kind:n.VIEWER+n.PREFERENCE},enablePrintAutoRotate:{value:!0,kind:n.VIEWER+n.PREFERENCE},enableScripting:{value:!0,kind:n.VIEWER+n.PREFERENCE},externalLinkRel:{value:"noopener noreferrer nofollow",kind:n.VIEWER},externalLinkTarget:{value:0,kind:n.VIEWER+n.PREFERENCE},historyUpdateUrl:{value:!1,kind:n.VIEWER+n.PREFERENCE},ignoreDestinationZoom:{value:!1,kind:n.VIEWER+n.PREFERENCE},imageResourcesPath:{value:"./images/",kind:n.VIEWER},maxCanvasPixels:{value:16777216,compatibility:i.maxCanvasPixels,kind:n.VIEWER},pdfBugEnabled:{value:!1,kind:n.VIEWER+n.PREFERENCE},printResolution:{value:150,kind:n.VIEWER},removePageBorders:{value:!1,kind:n.VIEWER+n.PREFERENCE},renderer:{value:"canvas",kind:n.VIEWER},sidebarViewOnLoad:{value:-1,kind:n.VIEWER+n.PREFERENCE},scrollModeOnLoad:{value:-1,kind:n.VIEWER+n.PREFERENCE},spreadModeOnLoad:{value:-1,kind:n.VIEWER+n.PREFERENCE},textLayerMode:{value:1,kind:n.VIEWER+n.PREFERENCE},useOnlyCssZoom:{value:!1,kind:n.VIEWER+n.PREFERENCE},viewerCssTheme:{value:0,kind:n.VIEWER+n.PREFERENCE},viewOnLoad:{value:0,kind:n.VIEWER+n.PREFERENCE},cMapPacked:{value:!0,kind:n.API},cMapUrl:{value:"../web/cmaps/",kind:n.API},disableAutoFetch:{value:!1,kind:n.API+n.PREFERENCE},disableFontFace:{value:!1,kind:n.API+n.PREFERENCE},disableRange:{value:!1,kind:n.API+n.PREFERENCE},disableStream:{value:!1,kind:n.API+n.PREFERENCE},docBaseUrl:{value:"",kind:n.API},enableXfa:{value:!0,kind:n.API+n.PREFERENCE},fontExtraProperties:{value:!1,kind:n.API},isEvalSupported:{value:!0,kind:n.API},maxImageSize:{value:-1,kind:n.API},pdfBug:{value:!1,kind:n.API},standardFontDataUrl:{value:"../web/standard_fonts/",kind:n.API},verbosity:{value:1,kind:n.API},workerPort:{value:null,kind:n.WORKER},workerSrc:{value:"./assets/pdf.worker.js",kind:n.WORKER}};s.disablePreferences={value:!1,kind:n.VIEWER};s.locale={value:"undefined"!=typeof navigator?navigator.language:"en-US",kind:n.VIEWER};s.sandboxBundleSrc={value:"../build/pdf.sandbox.js",kind:n.VIEWER};s.renderer.kind+=n.PREFERENCE;const r=Object.create(null);t.AppOptions=class AppOptions{constructor(){throw new Error("Cannot initialize AppOptions.")}static get(e){const t=r[e];if(void 0!==t)return t;const i=s[e];return void 0!==i?i.compatibility??i.value:void 0}static getAll(e=null){const t=Object.create(null);for(const i in s){const a=s[i];if(e){if(0==(e&a.kind))continue;if(e===n.PREFERENCE){const e=a.value,n=typeof e;if("boolean"===n||"string"===n||"number"===n&&Number.isInteger(e)){t[i]=e;continue}throw new Error(`Invalid type for preference: ${i}`)}}const o=r[i];t[i]=void 0!==o?o:a.compatibility??a.value}return t}static set(e,t){r[e]=t}static setAll(e){for(const t in e)r[t]=e[t]}static remove(e){delete r[e]}static _hasUserOptions(){return Object.keys(r).length>0}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFViewerApplication=t.PDFPrintServiceFactory=t.DefaultExternalServices=void 0;var n=i(3),s=i(1),r=i(4),a=i(5),o=i(7),l=i(8),h=i(9),c=i(10),d=i(12),u=i(13),p=i(14),g=i(18),f=i(19),m=i(20),_=i(21),b=i(22),w=i(23),v=i(24),y=i(25),S=i(26),P=i(28),A=i(41),C=i(43),x=i(44);const E="enablePermissions",T=-1,L=1,k={AUTOMATIC:0,LIGHT:1,DARK:2},I=["1.0","1.1","1.2","1.3","1.4","1.5","1.6","1.7","1.8","1.9","2.0","2.1","2.2","2.3"],R=["acrobat distiller","acrobat pdfwriter","adobe livecycle","adobe pdf library","adobe photoshop","ghostscript","tcpdf","cairo","dvipdfm","dvips","pdftex","pdfkit","itext","prince","quarkxpress","mac os x","microsoft","openoffice","oracle","luradocument","pdf-xchange","antenna house","aspose.cells","fpdf"];class DefaultExternalServices{constructor(){throw new Error("Cannot initialize DefaultExternalServices.")}static updateFindControlState(e){}static updateFindMatchesCount(e){}static initPassiveLoading(e){}static async fallback(e){}static reportTelemetry(e){}static createDownloadManager(e){throw new Error("Not implemented: createDownloadManager")}static createPreferences(){throw new Error("Not implemented: createPreferences")}static createL10n(e){throw new Error("Not implemented: createL10n")}static createScripting(e){throw new Error("Not implemented: createScripting")}static get supportsIntegratedFind(){return(0,r.shadow)(this,"supportsIntegratedFind",!1)}static get supportsDocumentFonts(){return(0,r.shadow)(this,"supportsDocumentFonts",!0)}static get supportedMouseWheelZoomModifierKeys(){return(0,r.shadow)(this,"supportedMouseWheelZoomModifierKeys",{ctrlKey:!0,metaKey:!0})}static get isInAutomation(){return(0,r.shadow)(this,"isInAutomation",!1)}}t.DefaultExternalServices=DefaultExternalServices;const F={initialBookmark:document.location.hash.substring(1),_initializedCapability:(0,r.createPromiseCapability)(),_fellback:!1,appConfig:null,pdfDocument:null,pdfLoadingTask:null,printService:null,pdfViewer:null,pdfThumbnailViewer:null,pdfRenderingQueue:null,pdfPresentationMode:null,pdfDocumentProperties:null,pdfLinkService:null,pdfHistory:null,pdfSidebar:null,pdfSidebarResizer:null,pdfOutlineViewer:null,pdfAttachmentViewer:null,pdfLayerViewer:null,pdfCursorTools:null,pdfScriptingManager:null,store:null,downloadManager:null,overlayManager:null,preferences:null,toolbar:null,secondaryToolbar:null,eventBus:null,l10n:null,isInitialViewSet:!1,downloadComplete:!1,isViewerEmbedded:window.parent!==window,url:"",baseUrl:"",_downloadUrl:"",externalServices:DefaultExternalServices,_boundEvents:Object.create(null),documentInfo:null,metadata:null,_contentDispositionFilename:null,_contentLength:null,_saveInProgress:!1,_wheelUnusedTicks:0,_idleCallbacks:new Set,async initialize(e){this.preferences=this.externalServices.createPreferences();this.appConfig=e;await this._readPreferences();await this._parseHashParameters();this._forceCssTheme();await this._initializeL10n();this.isViewerEmbedded&&s.AppOptions.get("externalLinkTarget")===r.LinkTarget.NONE&&s.AppOptions.set("externalLinkTarget",r.LinkTarget.TOP);await this._initializeViewerComponents();this.bindEvents();this.bindWindowEvents();const t=e.appContainer||document.documentElement;this.l10n.translate(t).then((()=>{this.eventBus.dispatch("localized",{source:this})}));this._initializedCapability.resolve();this.initializeLoadingBar()},async _readPreferences(){if(!s.AppOptions.get("disablePreferences")){s.AppOptions._hasUserOptions()&&console.warn('_readPreferences: The Preferences may override manually set AppOptions; please use the "disablePreferences"-option in order to prevent that.');try{s.AppOptions.setAll(await this.preferences.getAll())}catch(e){console.error(`_readPreferences: "${e?.message}".`)}}},async _parseHashParameters(){if(!s.AppOptions.get("pdfBugEnabled"))return;const e=document.location.hash.substring(1);if(!e)return;const t=(0,n.parseQueryString)(e),i=[];"true"===t.get("disableworker")&&i.push(async function loadFakeWorker(){r.GlobalWorkerOptions.workerSrc||(r.GlobalWorkerOptions.workerSrc=s.AppOptions.get("workerSrc"));await(0,r.loadScript)(r.PDFWorker.workerSrc)}());t.has("disablerange")&&s.AppOptions.set("disableRange","true"===t.get("disablerange"));t.has("disablestream")&&s.AppOptions.set("disableStream","true"===t.get("disablestream"));t.has("disableautofetch")&&s.AppOptions.set("disableAutoFetch","true"===t.get("disableautofetch"));t.has("disablefontface")&&s.AppOptions.set("disableFontFace","true"===t.get("disablefontface"));t.has("disablehistory")&&s.AppOptions.set("disableHistory","true"===t.get("disablehistory"));t.has("verbosity")&&s.AppOptions.set("verbosity",0|t.get("verbosity"));if(t.has("textlayer"))switch(t.get("textlayer")){case"off":s.AppOptions.set("textLayerMode",n.TextLayerMode.DISABLE);break;case"visible":case"shadow":case"hover":this.appConfig.viewerContainer.classList.add(`textLayer-${t.get("textlayer")}`)}if(t.has("pdfbug")){s.AppOptions.set("pdfBug",!0);s.AppOptions.set("fontExtraProperties",!0);const e=t.get("pdfbug").split(",");i.push(async function initPDFBug(e){const{debuggerScriptPath:t,mainContainer:i}=F.appConfig;await(0,r.loadScript)(t);PDFBug.init({OPS:r.OPS},i,e)}(e))}t.has("locale")&&s.AppOptions.set("locale",t.get("locale"));if(0!==i.length)try{await Promise.all(i)}catch(e){console.error(`_parseHashParameters: "${e.message}".`)}},async _initializeL10n(){this.l10n=this.externalServices.createL10n({locale:s.AppOptions.get("locale")});const e=await this.l10n.getDirection();document.getElementsByTagName("html")[0].dir=e},_forceCssTheme(){const e=s.AppOptions.get("viewerCssTheme");if(e!==k.AUTOMATIC&&Object.values(k).includes(e))try{const t=document.styleSheets[0],i=t?.cssRules||[],n="prefers-color-scheme",s=`(${n}: dark)`,r=new RegExp(`^@media \\(${n}: dark\\) {\\n\\s*([\\w\\s-.,:;/\\\\{}()]+)\\n}$`);for(let n=0,a=i.length;n<a;n++){const a=i[n];if(a instanceof CSSMediaRule&&a.media?.[0]===s){if(e===k.LIGHT){t.deleteRule(n);return}const i=r.exec(a.cssText);if(i?.[1]){t.deleteRule(n);t.insertRule(i[1],n)}return}}}catch(e){console.error(`_forceCssTheme: "${e?.message}".`)}},async _initializeViewerComponents(){const{appConfig:e,externalServices:t}=this;let i;i=e.eventBus?e.eventBus:t.isInAutomation?new n.AutomationEventBus:new n.EventBus;this.eventBus=i;this.overlayManager=new l.OverlayManager;const r=new o.PDFRenderingQueue;r.onIdle=this._cleanup.bind(this);this.pdfRenderingQueue=r;const x=new m.PDFLinkService({eventBus:i,externalLinkTarget:s.AppOptions.get("externalLinkTarget"),externalLinkRel:s.AppOptions.get("externalLinkRel"),ignoreDestinationZoom:s.AppOptions.get("ignoreDestinationZoom")});this.pdfLinkService=x;const E=t.createDownloadManager();this.downloadManager=E;const T=new p.PDFFindController({linkService:x,eventBus:i,pageViewMode:s.AppOptions.get("pageViewMode")});this.findController=T;const L=new w.PDFScriptingManager({eventBus:i,sandboxBundleSrc:s.AppOptions.get("sandboxBundleSrc"),scriptingFactory:t,docPropertiesLookup:this._scriptingDocProperties.bind(this)});this.pdfScriptingManager=L;const k=e.mainContainer,I=e.viewerContainer;this.pdfViewer=new P.PDFViewer({container:k,viewer:I,eventBus:i,renderingQueue:r,linkService:x,downloadManager:E,findController:T,scriptingManager:s.AppOptions.get("enableScripting")&&L,renderer:s.AppOptions.get("renderer"),l10n:this.l10n,textLayerMode:s.AppOptions.get("textLayerMode"),annotationMode:s.AppOptions.get("annotationMode"),imageResourcesPath:s.AppOptions.get("imageResourcesPath"),removePageBorders:s.AppOptions.get("removePageBorders"),renderInteractiveForms:s.AppOptions.get("renderInteractiveForms"),enablePrintAutoRotate:s.AppOptions.get("enablePrintAutoRotate"),useOnlyCssZoom:s.AppOptions.get("useOnlyCssZoom"),maxCanvasPixels:s.AppOptions.get("maxCanvasPixels"),pageViewMode:s.AppOptions.get("pageViewMode")});r.setViewer(this.pdfViewer);x.setViewer(this.pdfViewer);L.setViewer(this.pdfViewer);this.pdfThumbnailViewer=new S.PDFThumbnailViewer({container:e.sidebar.thumbnailView,eventBus:i,renderingQueue:r,linkService:x,l10n:this.l10n});r.setThumbnailViewer(this.pdfThumbnailViewer);if(!this.isViewerEmbedded&&!s.AppOptions.get("disableHistory")){this.pdfHistory=new g.PDFHistory({linkService:x,eventBus:i});x.setHistory(this.pdfHistory)}this.supportsIntegratedFind||(this.findBar=new u.PDFFindBar(e.findBar,i,this.l10n));this.pdfDocumentProperties=new d.PDFDocumentProperties(e.documentProperties,this.overlayManager,i,this.l10n);this.pdfCursorTools=new a.PDFCursorTools({container:k,eventBus:i,cursorToolOnLoad:s.AppOptions.get("cursorToolOnLoad")});this.toolbar=new C.Toolbar(e.toolbar,i,this.l10n);this.secondaryToolbar=new A.SecondaryToolbar(e.secondaryToolbar,k,i);this.supportsFullscreen&&(this.pdfPresentationMode=new b.PDFPresentationMode({container:k,pdfViewer:this.pdfViewer,eventBus:i}));this.passwordPrompt=new h.PasswordPrompt(e.passwordOverlay,this.overlayManager,this.l10n,this.isViewerEmbedded);this.pdfOutlineViewer=new _.PDFOutlineViewer({container:e.sidebar.outlineView,eventBus:i,linkService:x});this.pdfAttachmentViewer=new c.PDFAttachmentViewer({container:e.sidebar.attachmentsView,eventBus:i,downloadManager:E});this.pdfLayerViewer=new f.PDFLayerViewer({container:e.sidebar.layersView,eventBus:i,l10n:this.l10n});this.pdfSidebar=new v.PDFSidebar({elements:e.sidebar,pdfViewer:this.pdfViewer,pdfThumbnailViewer:this.pdfThumbnailViewer,eventBus:i,l10n:this.l10n});this.pdfSidebar.onToggled=this.forceRendering.bind(this);this.pdfSidebarResizer=new y.PDFSidebarResizer(e.sidebarResizer,i,this.l10n)},run(e){this.initialize(e).then(webViewerInitialized)},get initialized(){return this._initializedCapability.settled},get initializedPromise(){return this._initializedCapability.promise},zoomIn(e){this.pdfViewer.isInPresentationMode||this.pdfViewer.increaseScale(e)},zoomOut(e){this.pdfViewer.isInPresentationMode||this.pdfViewer.decreaseScale(e)},zoomReset(){this.pdfViewer.isInPresentationMode||(this.pdfViewer.currentScaleValue=n.DEFAULT_SCALE_VALUE)},get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0},get page(){return this.pdfViewer.currentPageNumber},set page(e){this.pdfViewer.currentPageNumber=e},get supportsPrinting(){return B.instance.supportsPrinting},get supportsFullscreen(){return(0,r.shadow)(this,"supportsFullscreen",document.fullscreenEnabled||document.mozFullScreenEnabled||document.webkitFullscreenEnabled)},get supportsIntegratedFind(){return this.externalServices.supportsIntegratedFind},get supportsDocumentFonts(){return this.externalServices.supportsDocumentFonts},initializeLoadingBar(){const e=new n.ProgressBar("#loadingBar");e.hide();return(0,r.shadow)(this,"loadingBar",e)},get supportedMouseWheelZoomModifierKeys(){return this.externalServices.supportedMouseWheelZoomModifierKeys},initPassiveLoading(){throw new Error("Not implemented: initPassiveLoading")},setTitleUsingUrl(e="",t=null){this.url=e;this.baseUrl=e.split("#")[0];t&&(this._downloadUrl=t===e?this.baseUrl:t.split("#")[0]);let i=(0,r.getPdfFilenameFromUrl)(e,"");if(!i)try{i=decodeURIComponent((0,r.getFilenameFromUrl)(e))||e}catch(t){i=e}this.setTitle(i)},setTitle(e){this.isViewerEmbedded||(document.title=e)},get _docFilename(){return this._contentDispositionFilename||(0,r.getPdfFilenameFromUrl)(this.url)},_hideViewBookmark(){const{toolbar:e,secondaryToolbar:t}=this.appConfig;e.viewBookmark.hidden=!0;t.viewBookmarkButton.hidden=!0},_cancelIdleCallbacks(){if(this._idleCallbacks.size){for(const e of this._idleCallbacks)window.cancelIdleCallback(e);this._idleCallbacks.clear()}},async close(){this._unblockDocumentLoadEvent();this._hideViewBookmark();const{container:e}=this.appConfig.errorWrapper;e.hidden=!0;if(!this.pdfLoadingTask)return;if(this.pdfDocument?.annotationStorage.size>0&&this._annotationStorageModified)try{await this.save({sourceEventType:"save"})}catch(e){}const t=[];t.push(this.pdfLoadingTask.destroy());this.pdfLoadingTask=null;if(this.pdfDocument){this.pdfDocument=null;this.pdfThumbnailViewer.setDocument(null);this.pdfViewer.setDocument(null);this.pdfLinkService.setDocument(null);this.pdfDocumentProperties.setDocument(null)}!function webViewerResetPermissions(){const{appConfig:e}=F;if(!e)return;e.viewerContainer.classList.remove(E)}();this.pdfLinkService.externalLinkEnabled=!0;this._fellback=!1;this.store=null;this.isInitialViewSet=!1;this.downloadComplete=!1;this.url="";this.baseUrl="";this._downloadUrl="";this.documentInfo=null;this.metadata=null;this._contentDispositionFilename=null;this._contentLength=null;this._saveInProgress=!1;this._cancelIdleCallbacks();t.push(this.pdfScriptingManager.destroyPromise);this.pdfSidebar.reset();this.pdfOutlineViewer.reset();this.pdfAttachmentViewer.reset();this.pdfLayerViewer.reset();this.pdfHistory?.reset();this.findBar?.reset();this.toolbar.reset();this.secondaryToolbar.reset();"undefined"!=typeof PDFBug&&PDFBug.cleanup();await Promise.all(t)},async open(e,t){this.pdfLoadingTask&&await this.close();const i=s.AppOptions.getAll(s.OptionKind.WORKER);for(const e in i)r.GlobalWorkerOptions[e]=i[e];const n=Object.create(null);if("string"==typeof e){this.setTitleUsingUrl(e,e);n.url=e}else if(e&&"byteLength"in e)n.data=e;else if(e.url&&e.originalUrl){this.setTitleUsingUrl(e.originalUrl,e.url);n.url=e.url}const a=s.AppOptions.getAll(s.OptionKind.API);for(const e in a){let t=a[e];n[e]=t}if(t)for(const e in t)n[e]=t[e];const o=(0,r.getDocument)(n);this.pdfLoadingTask=o;o.onPassword=(e,t)=>{this.pdfLinkService.externalLinkEnabled=!1;this.passwordPrompt.setUpdateCallback(e,t);this.passwordPrompt.open()};o.onProgress=({loaded:e,total:t})=>{this.progress(e/t);this.eventBus.dispatch("progress",{source:this,type:"load",total:t,loaded:e,percent:100*e/t})};o.onUnsupportedFeature=this.fallback.bind(this);this.loadingBar.show();return o.promise.then((e=>{this.load(e)}),(e=>{if(o!==this.pdfLoadingTask)return;let t="loading_error";e instanceof r.InvalidPDFException?t="invalid_file_error":e instanceof r.MissingPDFException?t="missing_file_error":e instanceof r.UnexpectedResponseException&&(t="unexpected_response_error");return this.l10n.get(t).then((t=>{this._documentError(t,{message:e?.message});this.onError(e);throw e}))}))},_ensureDownloadComplete(){if(!this.pdfDocument||!this.downloadComplete)throw new Error("PDF document not downloaded.")},async download({sourceEventType:e="download"}={}){const t=this._downloadUrl,i=this._docFilename;try{this._ensureDownloadComplete();const n=await this.pdfDocument.getData(),s=new Blob([n],{type:"application/pdf"});await this.downloadManager.download(s,t,i,e)}catch(e){await this.downloadManager.downloadUrl(t,i)}},async save({sourceEventType:e="download"}={}){if(this._saveInProgress)return;this._saveInProgress=!0;await this.pdfScriptingManager.dispatchWillSave();const t=this._downloadUrl,i=this._docFilename;try{this._ensureDownloadComplete();const n=await this.pdfDocument.saveDocument(),s=new Blob([n],{type:"application/pdf"});await this.downloadManager.download(s,t,i,e)}catch(t){console.error(`Error when saving the document: ${t.message}`);await this.download({sourceEventType:e})}finally{await this.pdfScriptingManager.dispatchDidSave();this._saveInProgress=!1}},downloadOrSave(e){this.pdfDocument?.annotationStorage.size>0?this.save(e):this.download(e)},fallback(e){this.externalServices.reportTelemetry({type:"unsupportedFeature",featureId:e});if(!this._fellback){this._fellback=!0;this.externalServices.fallback({featureId:e,url:this.baseUrl}).then((e=>{e&&this.download({sourceEventType:"download"})}))}},_documentError(e,t=null){this._unblockDocumentLoadEvent();this._otherError(e,t)},_otherError(e,t=null){const i=[this.l10n.get("error_version_info",{version:r.version||"?",build:r.build||"?"})];if(t){i.push(this.l10n.get("error_message",{message:t.message}));if(t.stack)i.push(this.l10n.get("error_stack",{stack:t.stack}));else{t.filename&&i.push(this.l10n.get("error_file",{file:t.filename}));t.lineNumber&&i.push(this.l10n.get("error_line",{line:t.lineNumber}))}}const s=this.appConfig.errorWrapper,a=s.container;a.hidden=!1;s.errorMessage.textContent=e;const o=s.closeButton;o.onclick=function(){a.hidden=!0};const l=s.errorMoreInfo,h=s.moreInfoButton,c=s.lessInfoButton;h.onclick=function(){l.hidden=!1;h.hidden=!0;c.hidden=!1;l.style.height=l.scrollHeight+"px"};c.onclick=function(){l.hidden=!0;h.hidden=!1;c.hidden=!0};h.oncontextmenu=n.noContextMenuHandler;c.oncontextmenu=n.noContextMenuHandler;o.oncontextmenu=n.noContextMenuHandler;h.hidden=!1;c.hidden=!0;Promise.all(i).then((e=>{l.value=e.join("\n")}))},progress(e){if(this.downloadComplete)return;const t=Math.round(100*e);if(t>this.loadingBar.percent||isNaN(t)){this.loadingBar.percent=t;if((this.pdfDocument?this.pdfDocument.loadingParams.disableAutoFetch:s.AppOptions.get("disableAutoFetch"))&&t){if(this.disableAutoFetchLoadingBarTimeout){clearTimeout(this.disableAutoFetchLoadingBarTimeout);this.disableAutoFetchLoadingBarTimeout=null}this.loadingBar.show();this.disableAutoFetchLoadingBarTimeout=setTimeout((()=>{this.loadingBar.hide();this.disableAutoFetchLoadingBarTimeout=null}),5e3)}}},load(e){this.pdfDocument=e;e.getDownloadInfo().then((({length:e})=>{this._contentLength=e;this.downloadComplete=!0;this.loadingBar.hide();l.then((()=>{this.eventBus.dispatch("documentloaded",{source:this})}))}));const t=e.getPageLayout().catch((function(){})),i=e.getPageMode().catch((function(){})),r=e.getOpenAction().catch((function(){}));this.toolbar.setPagesCount(e.numPages,!1);this.secondaryToolbar.setPagesCount(e.numPages);let a;a=null;this.pdfLinkService.setDocument(e,null);this.pdfDocumentProperties.setDocument(e,this.url);const o=this.pdfViewer;o.setDocument(e);const{firstPagePromise:l,onePageRendered:h,pagesPromise:c}=o;this.pdfThumbnailViewer.setDocument(e);const d=(this.store=new x.ViewHistory(e.fingerprints[0])).getMultiple({page:null,zoom:n.DEFAULT_SCALE_VALUE,scrollLeft:"0",scrollTop:"0",rotation:null,sidebarView:n.SidebarView.UNKNOWN,scrollMode:n.ScrollMode.UNKNOWN,spreadMode:n.SpreadMode.UNKNOWN}).catch((()=>Object.create(null)));l.then((a=>{this.loadingBar.setWidth(this.appConfig.viewerContainer);this._initializeAnnotationStorageCallbacks(e);Promise.all([n.animationStarted,d,t,i,r]).then((async([t,i,r,a,l])=>{const h=s.AppOptions.get("viewOnLoad");this._initializePdfHistory({fingerprint:e.fingerprints[0],viewOnLoad:h,initialDest:l?.dest});const d=this.initialBookmark,u=s.AppOptions.get("defaultZoomValue");let p=u?`zoom=${u}`:null,g=null,f=s.AppOptions.get("sidebarViewOnLoad"),m=s.AppOptions.get("scrollModeOnLoad"),_=s.AppOptions.get("spreadModeOnLoad");if(i.page&&h!==L){p=`page=${i.page}&zoom=${u||i.zoom},${i.scrollLeft},${i.scrollTop}`;g=parseInt(i.rotation,10);f===n.SidebarView.UNKNOWN&&(f=0|i.sidebarView);m===n.ScrollMode.UNKNOWN&&(m=0|i.scrollMode);_===n.SpreadMode.UNKNOWN&&(_=0|i.spreadMode)}a&&f===n.SidebarView.UNKNOWN&&(f=(0,n.apiPageModeToSidebarView)(a));r&&_===n.SpreadMode.UNKNOWN&&(_=(0,n.apiPageLayoutToSpreadMode)(r));this.setInitialView(p,{rotation:g,sidebarView:f,scrollMode:m,spreadMode:_});this.eventBus.dispatch("documentinit",{source:this});this.isViewerEmbedded||o.focus();this._initializePermissions(e);await Promise.race([c,new Promise((e=>{setTimeout(e,1e4)}))]);if((d||p)&&!o.hasEqualPageSizes){this.initialBookmark=d;o.currentScaleValue=o.currentScaleValue;this.setInitialView(p)}})).catch((()=>{this.setInitialView()})).then((function(){o.update()}))}));c.then((()=>{this._unblockDocumentLoadEvent();this._initializeAutoPrint(e,r)}));h.then((()=>{e.getOutline().then((t=>{e===this.pdfDocument&&this.pdfOutlineViewer.render({outline:t,pdfDocument:e})}));e.getAttachments().then((t=>{e===this.pdfDocument&&this.pdfAttachmentViewer.render({attachments:t})}));o.optionalContentConfigPromise.then((t=>{e===this.pdfDocument&&this.pdfLayerViewer.render({optionalContentConfig:t,pdfDocument:e})}));if("requestIdleCallback"in window){const t=window.requestIdleCallback((()=>{this._collectTelemetry(e);this._idleCallbacks.delete(t)}),{timeout:1e3});this._idleCallbacks.add(t)}}));this._initializePageLabels(e);this._initializeMetadata(e)},async _scriptingDocProperties(e){if(!this.documentInfo){await new Promise((e=>{this.eventBus._on("metadataloaded",e,{once:!0})}));if(e!==this.pdfDocument)return null}if(!this._contentLength){await new Promise((e=>{this.eventBus._on("documentloaded",e,{once:!0})}));if(e!==this.pdfDocument)return null}return{...this.documentInfo,baseURL:this.baseUrl,filesize:this._contentLength,filename:this._docFilename,metadata:this.metadata?.getRaw(),authors:this.metadata?.get("dc:creator"),numPages:this.pagesCount,URL:this.url}},async _collectTelemetry(e){const t=await this.pdfDocument.getMarkInfo();if(e!==this.pdfDocument)return;const i=t?.Marked||!1;this.externalServices.reportTelemetry({type:"tagged",tagged:i})},async _initializeAutoPrint(e,t){const[i,s]=await Promise.all([t,this.pdfViewer.enableScripting?null:e.getJavaScript()]);if(e!==this.pdfDocument)return;let a=!1;"Print"===i?.action&&(a=!0);if(s){s.some((e=>{if(!e)return!1;console.warn("Warning: JavaScript support is not enabled");this.fallback(r.UNSUPPORTED_FEATURES.javaScript);return!0}));if(!a)for(const e of s)if(e&&n.AutoPrintRegExp.test(e)){a=!0;break}}a&&this.triggerPrinting()},async _initializeMetadata(e){const{info:t,metadata:i,contentDispositionFilename:n,contentLength:s}=await e.getMetadata();if(e!==this.pdfDocument)return;this.documentInfo=t;this.metadata=i;this._contentDispositionFilename??=n;this._contentLength??=s;const a=window.PDFViewerApplicationOptions;if(!a||a.get("verbosity")>0){console.log("PDF viewer: ngx-extended-pdf-viewer running on pdf.js "+(window["pdfjs-dist/build/pdf"]?window["pdfjs-dist/build/pdf"].version:" developer version (?)"));console.log(`PDF ${e.fingerprints[0]} [${t.PDFFormatVersion} ${(t.Producer||"-").trim()} / ${(t.Creator||"-").trim()}] (PDF.js: ${r.version||"-"}`+(this.pdfViewer.enableWebGL?" [WebGL]":"")+") modified by ngx-extended-pdf-viewer)")}let o=t?.Title;const l=i?.get("dc:title");l&&("Untitled"===l||/[\uFFF0-\uFFFF]/g.test(l)||(o=l));o?this.setTitle(`${o} - ${n||document.title}`):n&&this.setTitle(n);if(!t.IsXFAPresent||t.IsAcroFormPresent||e.isPureXfa){if((t.IsAcroFormPresent||t.IsXFAPresent)&&!this.pdfViewer.renderForms){console.warn("Warning: Interactive form support is not enabled");this.fallback(r.UNSUPPORTED_FEATURES.forms)}}else{e.loadingParams.enableXfa?console.warn("Warning: XFA Foreground documents are not supported"):console.warn("Warning: XFA support is not enabled");this.fallback(r.UNSUPPORTED_FEATURES.forms)}if(t.IsSignaturesPresent){console.warn("Warning: Digital signatures validation is not supported");this.fallback(r.UNSUPPORTED_FEATURES.signatures)}let h="other";I.includes(t.PDFFormatVersion)&&(h=`v${t.PDFFormatVersion.replace(".","_")}`);let c="other";if(t.Producer){const e=t.Producer.toLowerCase();R.some((function(t){if(!e.includes(t))return!1;c=t.replace(/[ .-]/g,"_");return!0}))}let d=null;t.IsXFAPresent?d="xfa":t.IsAcroFormPresent&&(d="acroform");this.externalServices.reportTelemetry({type:"documentInfo",version:h,generator:c,formType:d});this.eventBus.dispatch("metadataloaded",{source:this})},async _initializePageLabels(e){const t=await e.getPageLabels();if(e!==this.pdfDocument)return;if(!t||s.AppOptions.get("disablePageLabels"))return;const i=t.length;if(i!==this.pagesCount){console.error("The number of Page Labels does not match the number of pages in the document.");return}let n=0;for(;n<i&&t[n]===(n+1).toString();)n++;if(n===i)return;const{pdfViewer:r,pdfThumbnailViewer:a,toolbar:o}=this;r.setPageLabels(t);a.setPageLabels(t);o.setPagesCount(i,!0);o.setPageNumber(r.currentPageNumber,r.currentPageLabel)},_initializePdfHistory({fingerprint:e,viewOnLoad:t,initialDest:i=null}){if(this.pdfHistory){this.pdfHistory.initialize({fingerprint:e,resetHistory:t===L,updateUrl:s.AppOptions.get("historyUpdateUrl")});if(this.pdfHistory.initialBookmark){this.initialBookmark=this.pdfHistory.initialBookmark;this.initialRotation=this.pdfHistory.initialRotation}if(i&&!this.initialBookmark&&t===T){this.initialBookmark=JSON.stringify(i);this.pdfHistory.push({explicitDest:i,pageNumber:null})}}},async _initializePermissions(e){const t=await e.getPermissions();e===this.pdfDocument&&t&&s.AppOptions.get("enablePermissions")&&(t.includes(r.PermissionFlag.COPY)||this.appConfig.viewerContainer.classList.add(E))},_initializeAnnotationStorageCallbacks(e){if(e!==this.pdfDocument)return;const{annotationStorage:t}=e;t.onSetModified=()=>{window.addEventListener("beforeunload",beforeUnload);this._annotationStorageModified=!0};t.onResetModified=()=>{window.removeEventListener("beforeunload",beforeUnload);delete this._annotationStorageModified}},setInitialView(e,{rotation:t,sidebarView:i,scrollMode:s,spreadMode:r}={}){const setRotation=e=>{(0,n.isValidRotation)(e)&&(this.pdfViewer.pagesRotation=e)};this.isInitialViewSet=!0;this.pdfSidebar.setInitialView(i);((e,t)=>{(0,n.isValidScrollMode)(e)&&(this.pdfViewer.scrollMode=e);(0,n.isValidSpreadMode)(t)&&(this.pdfViewer.spreadMode=t)})(s,r);if(this.initialBookmark){setRotation(this.initialRotation);delete this.initialRotation;this.pdfLinkService.setHash(this.initialBookmark);this.initialBookmark=null}else if(e){setRotation(t);this.pdfLinkService.setHash(e)}this.toolbar.setPageNumber(this.pdfViewer.currentPageNumber,this.pdfViewer.currentPageLabel);this.secondaryToolbar.setPageNumber(this.pdfViewer.currentPageNumber);if(!this.pdfViewer.currentScaleValue){const e=PDFViewerApplicationOptions.get("defaultZoomValue");e&&(this.pdfViewer.currentScaleValue=e)}},_cleanup(){if(this.pdfDocument){this.pdfViewer.cleanup();this.pdfThumbnailViewer.cleanup();this.pdfDocument.cleanup(this.pdfViewer.renderer===n.RendererType.SVG)}},forceRendering(){this.pdfRenderingQueue.printing=!!this.printService;this.pdfRenderingQueue.isThumbnailViewEnabled=this.pdfSidebar.isThumbnailViewVisible;this.pdfRenderingQueue.renderHighestPriority()},beforePrint(){this.pdfScriptingManager.dispatchWillPrint();if(this.printService)return;if(!this.supportsPrinting){this.l10n.get("printing_not_supported").then((e=>{this._otherError(e)}));return}if(!this.pdfViewer.pageViewsReady){this.l10n.get("printing_not_ready").then((e=>{window.alert(e)}));return}const e=this.pdfViewer.getPagesOverview(),t=this.appConfig.printContainer,i=s.AppOptions.get("printResolution"),n=this.pdfViewer.optionalContentConfigPromise,r=B.instance.createPrintService(this.pdfDocument,e,t,i,n,this.l10n,this.pdfViewer.eventBus);this.printService=r;this.forceRendering();r.layout();this.externalServices.reportTelemetry({type:"print"})},afterPrint(){this.pdfScriptingManager.dispatchDidPrint();if(this.printService){document.body.removeAttribute("data-pdfjsprinting");this.printService.destroy();this.printService=null;this.pdfDocument?.annotationStorage.resetModified()}this.forceRendering()},rotatePages(e){this.pdfViewer.pagesRotation+=e},requestPresentationMode(){this.pdfPresentationMode?.request()},triggerPrinting(){this.supportsPrinting&&window.printPDF()},bindEvents(){const{eventBus:e,_boundEvents:t}=this;t.beforePrint=this.beforePrint.bind(this);t.afterPrint=this.afterPrint.bind(this);e._on("resize",webViewerResize);e._on("hashchange",webViewerHashchange);e._on("beforeprint",t.beforePrint);e._on("afterprint",t.afterPrint);e._on("pagerendered",webViewerPageRendered);e._on("updateviewarea",webViewerUpdateViewarea);e._on("pagechanging",webViewerPageChanging);e._on("scalechanging",webViewerScaleChanging);e._on("rotationchanging",webViewerRotationChanging);e._on("sidebarviewchanged",webViewerSidebarViewChanged);e._on("pagemode",webViewerPageMode);e._on("namedaction",webViewerNamedAction);e._on("presentationmodechanged",webViewerPresentationModeChanged);e._on("presentationmode",webViewerPresentationMode);e._on("print",webViewerPrint);e._on("download",webViewerDownload);e._on("save",webViewerSave);e._on("firstpage",webViewerFirstPage);e._on("lastpage",webViewerLastPage);e._on("nextpage",webViewerNextPage);e._on("previouspage",webViewerPreviousPage);e._on("zoomin",webViewerZoomIn);e._on("zoomout",webViewerZoomOut);e._on("zoomreset",webViewerZoomReset);e._on("pagenumberchanged",webViewerPageNumberChanged);e._on("scalechanged",webViewerScaleChanged);e._on("rotatecw",webViewerRotateCw);e._on("rotateccw",webViewerRotateCcw);e._on("optionalcontentconfig",webViewerOptionalContentConfig);e._on("switchscrollmode",webViewerSwitchScrollMode);e._on("scrollmodechanged",webViewerScrollModeChanged);e._on("switchspreadmode",webViewerSwitchSpreadMode);e._on("spreadmodechanged",webViewerSpreadModeChanged);e._on("documentproperties",webViewerDocumentProperties);e._on("find",webViewerFind);e._on("findfromurlhash",webViewerFindFromUrlHash);e._on("updatefindmatchescount",webViewerUpdateFindMatchesCount);e._on("updatefindcontrolstate",webViewerUpdateFindControlState);if(s.AppOptions.get("pdfBug")){t.reportPageStatsPDFBug=reportPageStatsPDFBug;e._on("pagerendered",t.reportPageStatsPDFBug);e._on("pagechanging",t.reportPageStatsPDFBug)}e._on("fileinputchange",M);e._on("openfile",O)},bindWindowEvents(){const{eventBus:e,_boundEvents:t}=this;t.windowResize=()=>{e.dispatch("resize",{source:window})};t.windowHashChange=()=>{e.dispatch("hashchange",{source:window,hash:document.location.hash.substring(1)})};t.windowBeforePrint=()=>{e.dispatch("beforeprint",{source:window})};t.windowAfterPrint=()=>{e.dispatch("afterprint",{source:window})};t.windowUpdateFromSandbox=t=>{e.dispatch("updatefromsandbox",{source:window,detail:t.detail})};window.addEventListener("visibilitychange",webViewerVisibilityChange);window.addEventListener("wheel",webViewerWheel,{passive:!1});window.addEventListener("click",webViewerClick);window.addEventListener("keydown",webViewerKeyDown);window.addEventListener("resize",t.windowResize);window.addEventListener("hashchange",t.windowHashChange);window.addEventListener("beforeprint",t.windowBeforePrint);window.addEventListener("afterprint",t.windowAfterPrint);window.addEventListener("updatefromsandbox",t.windowUpdateFromSandbox)},unbindEvents(){const{eventBus:e,_boundEvents:t}=this;e._off("resize",webViewerResize);e._off("hashchange",webViewerHashchange);e._off("beforeprint",t.beforePrint);e._off("afterprint",t.afterPrint);e._off("pagerendered",webViewerPageRendered);e._off("updateviewarea",webViewerUpdateViewarea);e._off("pagechanging",webViewerPageChanging);e._off("scalechanging",webViewerScaleChanging);e._off("rotationchanging",webViewerRotationChanging);e._off("sidebarviewchanged",webViewerSidebarViewChanged);e._off("pagemode",webViewerPageMode);e._off("namedaction",webViewerNamedAction);e._off("presentationmodechanged",webViewerPresentationModeChanged);e._off("presentationmode",webViewerPresentationMode);e._off("print",webViewerPrint);e._off("download",webViewerDownload);e._off("save",webViewerSave);e._off("firstpage",webViewerFirstPage);e._off("lastpage",webViewerLastPage);e._off("nextpage",webViewerNextPage);e._off("previouspage",webViewerPreviousPage);e._off("zoomin",webViewerZoomIn);e._off("zoomout",webViewerZoomOut);e._off("zoomreset",webViewerZoomReset);e._off("pagenumberchanged",webViewerPageNumberChanged);e._off("scalechanged",webViewerScaleChanged);e._off("rotatecw",webViewerRotateCw);e._off("rotateccw",webViewerRotateCcw);e._off("optionalcontentconfig",webViewerOptionalContentConfig);e._off("switchscrollmode",webViewerSwitchScrollMode);e._off("scrollmodechanged",webViewerScrollModeChanged);e._off("switchspreadmode",webViewerSwitchSpreadMode);e._off("spreadmodechanged",webViewerSpreadModeChanged);e._off("documentproperties",webViewerDocumentProperties);e._off("find",webViewerFind);e._off("findfromurlhash",webViewerFindFromUrlHash);e._off("updatefindmatchescount",webViewerUpdateFindMatchesCount);e._off("updatefindcontrolstate",webViewerUpdateFindControlState);if(t.reportPageStatsPDFBug){e._off("pagerendered",t.reportPageStatsPDFBug);e._off("pagechanging",t.reportPageStatsPDFBug);t.reportPageStatsPDFBug=null}e._off("fileinputchange",M);e._off("openfile",O);t.beforePrint=null;t.afterPrint=null},unbindWindowEvents(){const{_boundEvents:e}=this;window.removeEventListener("visibilitychange",webViewerVisibilityChange);window.removeEventListener("wheel",webViewerWheel,{passive:!1});window.removeEventListener("click",webViewerClick);window.removeEventListener("keydown",webViewerKeyDown);window.removeEventListener("resize",e.windowResize);window.removeEventListener("hashchange",e.windowHashChange);window.removeEventListener("beforeprint",e.windowBeforePrint);window.removeEventListener("afterprint",e.windowAfterPrint);window.removeEventListener("updatefromsandbox",e.windowUpdateFromSandbox);e.windowResize=null;e.windowHashChange=null;e.windowBeforePrint=null;e.windowAfterPrint=null;e.windowUpdateFromSandbox=null},accumulateWheelTicks(e){(this._wheelUnusedTicks>0&&e<0||this._wheelUnusedTicks<0&&e>0)&&(this._wheelUnusedTicks=0);this._wheelUnusedTicks+=e;const t=Math.sign(this._wheelUnusedTicks)*Math.floor(Math.abs(this._wheelUnusedTicks));this._wheelUnusedTicks-=t;return t},_unblockDocumentLoadEvent(){document.blockUnblockOnload&&document.blockUnblockOnload(!1);this._unblockDocumentLoadEvent=()=>{}},get scriptingReady(){return this.pdfScriptingManager.ready}};t.PDFViewerApplication=F;let D,M,O;{const e=["null","http://mozilla.github.io","https://mozilla.github.io"];D=function(t){if(void 0!==t)try{const i=new URL(window.location.href).origin||"null";if(e.includes(i))return;const{origin:n,protocol:s}=new URL(t,window.location.href);if(n!==i&&"blob:"!==s)throw new Error("file origin does not match viewer's")}catch(e){F.l10n.get("loading_error").then((t=>{F._documentError(t,{message:e?.message})}));throw e}}}function reportPageStatsPDFBug({pageNumber:e}){if("undefined"==typeof Stats||!Stats.enabled)return;const t=F.pdfViewer.getPageView(e-1)?.pdfPage?.stats;t&&Stats.add(e,t)}function webViewerInitialized(){const e=F.appConfig;const t=document.createElement("input");t.id=e.openFileInputName;t.className="fileInput";t.setAttribute("accept",".pdf,application/pdf");t.setAttribute("type","file");t.oncontextmenu=n.noContextMenuHandler;document.body.appendChild(t);if(window.File&&window.FileReader&&window.FileList&&window.Blob)t.value=null;else{e.toolbar.openFile.hidden=!0;e.secondaryToolbar.openFileButton.hidden=!0}t.addEventListener("change",(function(e){const t=e.target.files;t&&0!==t.length&&F.eventBus.dispatch("fileinputchange",{source:this,fileInput:e.target})}));e.mainContainer.addEventListener("dragover",(function(e){if(s.AppOptions.get("enableDragAndDrop")){e.preventDefault();e.dataTransfer.dropEffect="move"}}));e.mainContainer.addEventListener("drop",(function(e){if(s.AppOptions.get("enableDragAndDrop")){e.preventDefault();const t=e.dataTransfer.files;if(!t||0===t.length)return;F.eventBus.dispatch("fileinputchange",{source:this,fileInput:e.dataTransfer,dropEvent:e})}}));if(!F.supportsDocumentFonts){s.AppOptions.set("disableFontFace",!0);F.l10n.get("web_fonts_disabled").then((e=>{console.warn(e)}))}if(!F.supportsPrinting){e.toolbar.print.classList.add("hidden");e.secondaryToolbar.printButton.classList.add("hidden")}if(!F.supportsFullscreen){e.toolbar.presentationModeButton.classList.add("hidden");e.secondaryToolbar.presentationModeButton.classList.add("hidden")}F.supportsIntegratedFind&&e.toolbar.viewFind.classList.add("hidden");e.mainContainer.addEventListener("transitionend",(function(e){e.target===this&&F.eventBus.dispatch("resize",{source:this})}),!0);try{!function webViewerOpenFileViaURL(e){e?F.open(e):F._hideViewBookmark()}(undefined)}catch(e){F.l10n.get("loading_error").then((t=>{F._documentError(t,e)}))}}function webViewerPageRendered({pageNumber:e,timestamp:t,error:i}){e===F.page&&F.toolbar.updateLoadingIndicatorState(!1);if(F.pdfSidebar.isThumbnailViewVisible){const t=F.pdfViewer.getPageView(e-1),i=F.pdfThumbnailViewer.getThumbnail(e-1);t&&i&&i.setImage(t)}i&&F.l10n.get("rendering_error").then((e=>{F._otherError(e,i)}));F.externalServices.reportTelemetry({type:"pageInfo",timestamp:t});F.pdfDocument.getStats().then((function(e){F.externalServices.reportTelemetry({type:"documentStats",stats:e})}))}function webViewerPageMode({mode:e}){let t;switch(e){case"thumbs":t=n.SidebarView.THUMBS;break;case"bookmarks":case"outline":t=n.SidebarView.OUTLINE;break;case"attachments":t=n.SidebarView.ATTACHMENTS;break;case"layers":t=n.SidebarView.LAYERS;break;case"none":t=n.SidebarView.NONE;break;default:console.error('Invalid "pagemode" hash parameter: '+e);return}F.pdfSidebar.switchView(t,!0)}function webViewerNamedAction(e){switch(e.action){case"GoToPage":F.appConfig.toolbar.pageNumber.select();break;case"Find":F.supportsIntegratedFind||F.findBar.toggle();break;case"Print":F.triggerPrinting();break;case"SaveAs":webViewerSave()}}function webViewerPresentationModeChanged(e){F.pdfViewer.presentationModeState=e.state}function webViewerSidebarViewChanged(e){F.pdfRenderingQueue.isThumbnailViewEnabled=F.pdfSidebar.isThumbnailViewVisible;const t=F.store;t&&F.isInitialViewSet&&t.set("sidebarView",e.view).catch((function(){}))}function webViewerUpdateViewarea(e){const t=e.location,i=F.store;if(i&&F.isInitialViewSet){const e={};void 0===t.pageNumber&&null===t.pageNumber||(e.page=t.pageNumber);t.scale&&(e.zoom=t.scale);t.left&&(e.scrollLeft=t.left);t.top&&(e.scrollTop=t.top);void 0===t.rotation&&null===t.rotation||(e.rotation=t.rotation);i.setMultiple(e).catch((function(){}))}const n=F.pdfLinkService.getAnchorUrl(t.pdfOpenParams);F.appConfig.toolbar.viewBookmark.href=n;F.appConfig.secondaryToolbar.viewBookmarkButton.href=n;const s=F.pdfViewer.getPageView(F.page-1)?.renderingState!==o.RenderingStates.FINISHED;F.toolbar.updateLoadingIndicatorState(s)}function webViewerScrollModeChanged(e){const t=F.store;t&&F.isInitialViewSet&&t.set("scrollMode",e.mode).catch((function(){}))}function webViewerSpreadModeChanged(e){const t=F.store;t&&F.isInitialViewSet&&t.set("spreadMode",e.mode).catch((function(){}))}function webViewerResize(){const{pdfDocument:e,pdfViewer:t}=F;if(!e)return;const i=t.currentScaleValue;"auto"!==i&&"page-fit"!==i&&"page-width"!==i||(t.currentScaleValue=i);t.update()}function webViewerHashchange(e){const t=e.hash;t&&(F.isInitialViewSet?F.pdfHistory?.popStateInProgress||F.pdfLinkService.setHash(t):F.initialBookmark=t)}M=function(e){if(F.pdfViewer?.isInPresentationMode)return;const t=e.fileInput.files[0];if(s.compatibilityParams.disableCreateObjectURL){F.setTitleUsingUrl(t.name);const e=new FileReader;e.onload=function webViewerChangeFileReaderOnload(e){const t=e.target.result;F.open(new Uint8Array(t))};e.readAsArrayBuffer(t)}else{let e=URL.createObjectURL(t);t.name&&(e={url:e,originalUrl:t.name});F.open(e)}};O=function(e){const t=F.appConfig.openFileInputName;document.getElementById(t).click()};function webViewerPresentationMode(){F.requestPresentationMode()}function webViewerPrint(){F.triggerPrinting()}function webViewerDownload(){F.downloadOrSave({sourceEventType:"download"})}function webViewerSave(){F.downloadOrSave({sourceEventType:"save"})}function webViewerFirstPage(){F.pdfDocument&&(F.page=1)}function webViewerLastPage(){if(F.pdfDocument){F.page=F.pagesCount;"single"===F.pageViewMode&&F.pdfViewer&&F.pdfViewer.container&&(F.pdfViewer.container.scrollTop=0)}}function webViewerNextPage(){F.pdfViewer.nextPage();"single"===F.pageViewMode&&F.pdfViewer&&F.pdfViewer.container&&(F.pdfViewer.container.scrollTop=0)}function webViewerPreviousPage(){F.pdfViewer.previousPage()}function webViewerZoomIn(){F.zoomIn()}function webViewerZoomOut(){F.zoomOut()}function webViewerZoomReset(){F.zoomReset()}function webViewerPageNumberChanged(e){const t=F.pdfViewer;""!==e.value&&F.pdfLinkService.goToPage(e.value);e.value!==t.currentPageNumber.toString()&&e.value!==t.currentPageLabel&&F.toolbar.setPageNumber(t.currentPageNumber,t.currentPageLabel)}function webViewerScaleChanged(e){F.pdfViewer.currentScaleValue=e.value}function webViewerRotateCw(){F.rotatePages(90)}function webViewerRotateCcw(){F.rotatePages(-90)}function webViewerOptionalContentConfig(e){F.pdfViewer.optionalContentConfigPromise=e.promise}function webViewerSwitchScrollMode(e){F.pdfViewer.scrollMode=e.mode}function webViewerSwitchSpreadMode(e){F.pdfViewer.spreadMode=e.mode}function webViewerDocumentProperties(){F.pdfDocumentProperties.open()}function webViewerFind(e){F.findController.executeCommand("find"+e.type,{query:e.query,phraseSearch:e.phraseSearch,caseSensitive:e.caseSensitive,entireWord:e.entireWord,ignoreAccents:e.ignoreAccents,fuzzySearch:e.fuzzySearch,highlightAll:e.highlightAll,findPrevious:e.findPrevious})}function webViewerFindFromUrlHash(e){F.findController.executeCommand("find",{query:e.query,phraseSearch:e.phraseSearch,caseSensitive:!1,entireWord:!1,ignoreAccents:!1,fuzzySearch:!1,highlightAll:!0,findPrevious:!1})}function webViewerUpdateFindMatchesCount({matchesCount:e}){F.supportsIntegratedFind?F.externalServices.updateFindMatchesCount(e):F.findBar.updateResultsCount(e)}function webViewerUpdateFindControlState({state:e,previous:t,matchesCount:i,rawQuery:n}){F.supportsIntegratedFind?F.externalServices.updateFindControlState({result:e,findPrevious:t,matchesCount:i,rawQuery:n}):F.findBar.updateUIState(e,t,i)}function webViewerScaleChanging(e){F.toolbar.setPageScale(e.presetValue,e.scale);F.pdfViewer.update()}function webViewerRotationChanging(e){F.pdfThumbnailViewer.pagesRotation=e.pagesRotation;F.forceRendering();F.pdfViewer.currentPageNumber=e.pageNumber}function webViewerPageChanging({pageNumber:e,pageLabel:t}){F.toolbar.setPageNumber(e,t);F.secondaryToolbar.setPageNumber(e);F.pdfSidebar.isThumbnailViewVisible&&F.pdfThumbnailViewer.scrollThumbnailIntoView(e);const i=document.getElementById("pageNumber");if(i){const e=new CustomEvent("page-change");i.dispatchEvent(e)}}function webViewerVisibilityChange(e){"visible"===document.visibilityState&&setZoomDisabledTimeout()}let N=null;function setZoomDisabledTimeout(){N&&clearTimeout(N);N=setTimeout((function(){N=null}),1e3)}function webViewerWheel(e){const{pdfViewer:t,supportedMouseWheelZoomModifierKeys:i}=F;if(t.isInPresentationMode)return;const s=(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0);if(!window.isKeyIgnored||!window.isKeyIgnored(s,"WHEEL"))if(e.ctrlKey&&i.ctrlKey||e.metaKey&&i.metaKey){e.preventDefault();if(N||"hidden"===document.visibilityState)return;const i=t.currentScale,s=(0,n.normalizeWheelEventDirection)(e);let r=0;if(e.deltaMode===WheelEvent.DOM_DELTA_LINE||e.deltaMode===WheelEvent.DOM_DELTA_PAGE)r=Math.abs(s)>=1?Math.sign(s):F.accumulateWheelTicks(s);else{const e=30;r=F.accumulateWheelTicks(s/e)}r<0?F.zoomOut(-r):r>0&&F.zoomIn(r);const a=t.currentScale;if(i!==a){const n=a/i-1,s=t.container.getBoundingClientRect(),r=e.clientX-s.left,o=e.clientY-s.top;t.container.scrollLeft+=r*n;t.container.scrollTop+=o*n}}else setZoomDisabledTimeout()}function webViewerClick(e){if(!F.secondaryToolbar.isOpen)return;const t=F.appConfig;if(F.pdfViewer.containsElement(e.target)||t.toolbar.container.contains(e.target)&&e.target!==t.secondaryToolbar.toggleButton){if(e.target&&e.target.parentElement===t.secondaryToolbar.toggleButton)return;if(e.target&&e.target.parentElement&&e.target.parentElement.parentElement===t.secondaryToolbar.toggleButton)return;F.secondaryToolbar.close()}}function webViewerKeyDown(e){if(F.overlayManager.active)return;let t=!1,i=!1;const s=(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0),r=F.pdfViewer,o=r?.isInPresentationMode;if(window.isKeyIgnored&&window.isKeyIgnored(s,e.keyCode))return;if(1===s||8===s||5===s||12===s)switch(e.keyCode){case 70:if(!F.supportsIntegratedFind&&!e.shiftKey){F.findBar.open();t=!0}break;case 71:if(!F.supportsIntegratedFind){const e=F.findController.state;e&&F.findController.executeCommand("findagain",{query:e.query,phraseSearch:e.phraseSearch,caseSensitive:e.caseSensitive,entireWord:e.entireWord,ignoreAccents:e.ignoreAccents,fuzzySearch:e.fuzzySearch,highlightAll:e.highlightAll,findPrevious:5===s||12===s});t=!0}break;case 61:case 107:case 187:case 171:o||F.zoomIn();t=!0;break;case 173:case 109:case 189:o||F.zoomOut();t=!0;break;case 48:case 96:if(!o){setTimeout((function(){F.zoomReset()}));t=!1}break;case 38:if(o||F.page>1){F.page=1;t=!0;i=!0}break;case 40:if(o||F.page<F.pagesCount){F.page=F.pagesCount;t=!0;i=!0}}const{eventBus:l}=F;if(1===s||8===s)switch(e.keyCode){case 83:l.dispatch("download",{source:window});t=!0;break;case 79:l.dispatch("openfile",{source:window});t=!0}if(3===s||10===s)switch(e.keyCode){case 80:F.requestPresentationMode();t=!0;break;case 71:F.appConfig.toolbar.pageNumber.select();t=!0}if(t){i&&!o&&r.focus();e.preventDefault();return}const h=(0,n.getActiveOrFocusedElement)(),c=h?.tagName.toUpperCase();if("INPUT"!==c&&"TEXTAREA"!==c&&"SELECT"!==c&&!h?.isContentEditable||27===e.keyCode){if(0===s){let n=0,s=!1;switch(e.keyCode){case 38:case 33:r.isVerticalScrollbarEnabled&&(s=!0);n=-1;break;case 8:o||(s=!0);n=-1;break;case 37:r.isHorizontalScrollbarEnabled&&(s=!0);case 75:case 80:n=-1;break;case 27:if(F.secondaryToolbar.isOpen){F.secondaryToolbar.close();t=!0}if(!F.supportsIntegratedFind&&F.findBar.opened){F.findBar.close();t=!0}break;case 40:case 34:r.isVerticalScrollbarEnabled&&(s=!0);n=1;break;case 13:case 32:o||(s=!0);n=1;break;case 39:r.isHorizontalScrollbarEnabled&&(s=!0);case 74:case 78:n=1;break;case 36:if(o||F.page>1){F.page=1;t=!0;i=!0}break;case 35:if(o||F.page<F.pagesCount){F.page=F.pagesCount;t=!0;i=!0}break;case 83:F.pdfCursorTools.switchTool(a.CursorTool.SELECT);break;case 72:F.pdfCursorTools.switchTool(a.CursorTool.HAND);break;case 82:F.rotatePages(90);break;case 115:F.pdfSidebar.toggle()}if(0!==n&&(!s||"page-fit"===r.currentScaleValue)){n>0?r.nextPage():r.previousPage();t=!0}}if(4===s)switch(e.keyCode){case 13:case 32:if(!o&&"page-fit"!==r.currentScaleValue)break;F.page>1&&F.page--;t=!0;break;case 82:F.rotatePages(-90)}i&&!r.containsElement(h)&&r.focus();t&&e.preventDefault()}}function beforeUnload(e){e.preventDefault();e.returnValue="";return!1}const B={instance:{supportsPrinting:!1,createPrintService(){throw new Error("Not implemented: createPrintService")}}};t.PDFPrintServiceFactory=B},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.apiPageLayoutToSpreadMode=function apiPageLayoutToSpreadMode(e){switch(e){case"SinglePage":case"OneColumn":return s.NONE;case"TwoColumnLeft":case"TwoPageLeft":return s.ODD;case"TwoColumnRight":case"TwoPageRight":return s.EVEN}return s.NONE};t.apiPageModeToSidebarView=function apiPageModeToSidebarView(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 approximateFraction(e){if(Math.floor(e)===e)return[e,1];const t=1/e;if(t>8)return[1,8];if(Math.floor(t)===t)return[1,t];const i=e>1?t:e;let n,s=0,r=1,a=1,o=1;for(;;){const e=s+a,t=r+o;if(t>8)break;if(i<=e/t){a=e;o=t}else{s=e;r=t}}n=i-s/r<a/o-i?i===e?[s,r]:[r,s]:i===e?[a,o]:[o,a];return n};t.backtrackBeforeAllVisibleElements=backtrackBeforeAllVisibleElements;t.binarySearchFirstItem=binarySearchFirstItem;t.getActiveOrFocusedElement=function getActiveOrFocusedElement(){let e=document,t=e.activeElement||e.querySelector(":focus");for(;t?.shadowRoot;){e=t.shadowRoot;t=e.activeElement||e.querySelector(":focus")}return t};t.getOutputScale=function getOutputScale(e){const t=window.devicePixelRatio||1,i=e.webkitBackingStorePixelRatio||e.mozBackingStorePixelRatio||e.backingStorePixelRatio||1,n=t/i;return{sx:n,sy:n,scaled:1!==n}};t.getPageSizeInches=function getPageSizeInches({view:e,userUnit:t,rotate:i}){const[n,s,r,a]=e,o=i%180!=0,l=(r-n)/72*t,h=(a-s)/72*t;return{width:o?h:l,height:o?l:h}};t.getVisibleElements=function getVisibleElements({scrollEl:e,views:t,sortByVisibility:i=!1,horizontal:n=!1,rtl:s=!1}){const r=e.scrollTop,a=r+e.clientHeight,o=e.scrollLeft,l=o+e.clientWidth;const h=[],c=t.length;let d=binarySearchFirstItem(t,n?function isElementNextAfterViewHorizontally(e){const t=e.div,i=t.offsetLeft+t.clientLeft,n=i+t.clientWidth;return s?i<l:n>o}:function isElementBottomAfterViewTop(e){const t=e.div;return t.offsetTop+t.clientTop+t.clientHeight>r});d>0&&d<c&&!n&&(d=backtrackBeforeAllVisibleElements(d,t,r));let u=n?l:-1;for(let e=d;e<c;e++){const i=t[e],s=i.div,c=s.offsetLeft+s.clientLeft,d=s.offsetTop+s.clientTop,p=s.clientWidth,g=s.clientHeight,f=c+p,m=d+g;if(-1===u)m>=a&&(u=m);else if((n?c:d)>u)break;if(m<=r||d>=a||f<=o||c>=l)continue;const _=Math.max(0,r-d)+Math.max(0,m-a),b=Math.max(0,o-c)+Math.max(0,f-l),w=(p-b)/p,v=(g-_)/g*w*100|0;h.push({id:i.id,x:c,y:d,view:i,percent:v,widthPercent:100*w|0})}const p=h[0],g=h[h.length-1];i&&h.sort((function(e,t){const i=e.percent-t.percent;return Math.abs(i)>.001?-i:e.id-t.id}));return{first:p,last:g,views:h}};t.isPortraitOrientation=function isPortraitOrientation(e){return e.width<=e.height};t.isValidRotation=function isValidRotation(e){return Number.isInteger(e)&&e%90==0};t.isValidScrollMode=function isValidScrollMode(e){return Number.isInteger(e)&&Object.values(n).includes(e)&&e!==n.UNKNOWN};t.isValidSpreadMode=function isValidSpreadMode(e){return Number.isInteger(e)&&Object.values(s).includes(e)&&e!==s.UNKNOWN};t.moveToEndOfArray=function moveToEndOfArray(e,t){const i=[],n=e.length;let s=0;for(let r=0;r<n;++r)if(t(e[r]))i.push(e[r]);else{e[s]=e[r];++s}for(let t=0;s<n;++t,++s)e[s]=i[t]};t.noContextMenuHandler=function noContextMenuHandler(e){e.preventDefault()};t.normalizeWheelEventDelta=function normalizeWheelEventDelta(e){let t=normalizeWheelEventDirection(e);0===e.deltaMode?t/=900:1===e.deltaMode&&(t/=30);return t};t.normalizeWheelEventDirection=normalizeWheelEventDirection;t.parseQueryString=function parseQueryString(e){const t=new Map;for(const i of e.split("&")){const e=i.split("="),n=e[0].toLowerCase(),s=e.length>1?e[1]:"";t.set(decodeURIComponent(n),decodeURIComponent(s))}return t};t.roundToDivide=function roundToDivide(e,t){const i=e%t;return 0===i?e:Math.round(e-i+t)};t.scrollIntoView=function scrollIntoView(e,t,i=!1,n=!1){if(e.classList.contains("stf__item")){console.log("don't scroll in book mode");return}let s=e.offsetParent;if(!s){console.error("offsetParent is not set -- cannot scroll");return}let r=e.offsetTop+e.clientTop,a=e.offsetLeft+e.clientLeft;for(;s.clientHeight===s.scrollHeight&&s.clientWidth===s.scrollWidth||i&&(s.classList.contains("markedContent")||"hidden"===getComputedStyle(s).overflow);){r+=s.offsetTop;a+=s.offsetLeft;s=s.offsetParent;if(!s){if(n&&document.body.clientHeight>r){r-=32;window.scrollTo(window.scrollX,r)}return}}if(t){void 0!==t.top&&(r+=t.top);if(void 0!==t.left){a+=t.left;s.scrollLeft=a}}s.scrollTop=r};t.waitOnEventOrTimeout=function waitOnEventOrTimeout({target:e,name:t,delay:i=0}){return new Promise((function(n,s){if("object"!=typeof e||!t||"string"!=typeof t||!(Number.isInteger(i)&&i>=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");function handler(i){e instanceof EventBus?e._off(t,a):e.removeEventListener(t,a);l&&clearTimeout(l);n(i)}const a=handler.bind(null,r.EVENT);e instanceof EventBus?e._on(t,a):e.addEventListener(t,a);const o=handler.bind(null,r.TIMEOUT),l=setTimeout(o,i)}))};t.watchScroll=function watchScroll(e,t){const debounceScroll=function(s){n||(n=window.requestAnimationFrame((function viewAreaElementScrolled(){n=null;const s=e.scrollLeft,r=i.lastX;s!==r&&(i.right=s>r);i.lastX=s;const a=e.scrollTop,o=i.lastY;a!==o&&(i.down=a>o);i.lastY=a;t(i)})))},i={right:!0,down:!0,lastX:e.scrollLeft,lastY:e.scrollTop,_eventHandler:debounceScroll};let n=null;e.addEventListener("scroll",debounceScroll,!0);return i};t.WaitOnType=t.VERTICAL_PADDING=t.UNKNOWN_SCALE=t.TextLayerMode=t.SpreadMode=t.SidebarView=t.ScrollMode=t.SCROLLBAR_PADDING=t.RendererType=t.ProgressBar=t.PresentationModeState=t.MIN_SCALE=t.MAX_SCALE=t.MAX_AUTO_SCALE=t.EventBus=t.DEFAULT_SCALE_VALUE=t.DEFAULT_SCALE_DELTA=t.DEFAULT_SCALE=t.AutoPrintRegExp=t.AutomationEventBus=t.animationStarted=void 0;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.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,ENABLE_ENHANCE:2};const n={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2};t.ScrollMode=n;const s={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2};t.SpreadMode=s;t.AutoPrintRegExp=/\bprint\s*\(/;function binarySearchFirstItem(e,t){let i=0,n=e.length-1;if(n<0||!t(e[n]))return e.length;if(t(e[i]))return i;for(;i<n;){const s=i+n>>1;t(e[s])?n=s:i=s+1}return i}function backtrackBeforeAllVisibleElements(e,t,i){if(e<2)return e;let n=t[e].div,s=n.offsetTop+n.clientTop;if(s>=i){n=t[e-1].div;s=n.offsetTop+n.clientTop}for(let i=e-2;i>=0;--i){n=t[i].div;if(n.offsetTop+n.clientTop+n.clientHeight<=s)break;e=i}return e}function normalizeWheelEventDirection(e){let t=Math.hypot(e.deltaX,e.deltaY);const i=Math.atan2(e.deltaY,e.deltaX);-.25*Math.PI<i&&i<.75*Math.PI&&(t=-t);return t}const r={EVENT:"event",TIMEOUT:"timeout"};t.WaitOnType=r;const a=new Promise((function(e){window.requestAnimationFrame(e)}));t.animationStarted=a;class EventBus{constructor(){this._listeners=Object.create(null)}on(e,t,i=null){this._on(e,t,{external:!0,once:i?.once})}off(e,t,i=null){this._off(e,t,{external:!0,once:i?.once})}dispatch(e,t){const i=this._listeners[e];if(!i||0===i.length)return;let n;for(const{listener:s,external:r,once:a}of i.slice(0)){a&&this._off(e,s);r?(n||=[]).push(s):s(t)}if(n){for(const e of n)e(t);n=null}}_on(e,t,i=null){(this._listeners[e]||=[]).push({listener:t,external:!0===i?.external,once:!0===i?.once})}_off(e,t,i=null){const n=this._listeners[e];if(n)for(let e=0,i=n.length;e<i;e++)if(n[e].listener===t){n.splice(e,1);return}}}t.EventBus=EventBus;t.AutomationEventBus=class AutomationEventBus extends EventBus{dispatch(e,t){throw new Error("Not implemented: AutomationEventBus.dispatch")}};t.ProgressBar=class ProgressBar{constructor(e,{height:t,width:i,units:n}={}){this.visible=!0;this.div=document.querySelector(e+" .progress");this.div&&(this.bar=this.div.parentNode);this.height=t||100;this.width=i||100;this.units=n||"%";this.div&&(this.div.style.height=this.height+this.units);this.percent=0}_updateBar(){if(this._indeterminate){this.div.classList.add("indeterminate");this.div.style.width=this.width+this.units;return}this.div&&this.div.classList.remove("indeterminate");const e=this.width*this._percent/100;this.div&&(this.div.style.width=e+this.units)}get percent(){return this._percent}set percent(e){this._indeterminate=isNaN(e);this._percent=function clamp(e,t,i){return Math.min(Math.max(e,t),i)}(e,0,100);this._updateBar()}setWidth(e){if(!e)return;const t=e.parentNode.offsetWidth-e.offsetWidth;if(t>0){document.documentElement.style.setProperty("--loadingBar-end-offset",`${t}px`)}}hide(){if(this.visible){this.visible=!1;this.div=document.querySelector(".body #mainContainer .progress");if(this.div){this.bar=this.div.parentNode;this.bar.classList.add("hidden")}document.body.classList.remove("loadingInProgress")}}show(){if(!this.visible){this.visible=!0;this.bar.classList.remove("hidden")}}}},e=>{e.exports=window["pdfjs-dist/build/pdf"]},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFCursorTools=t.CursorTool=void 0;var n=i(6),s=i(3);const r={SELECT:0,HAND:1,ZOOM:2};t.CursorTool=r;t.PDFCursorTools=class PDFCursorTools{constructor({container:e,eventBus:t,cursorToolOnLoad:i=r.SELECT}){this.container=e;this.eventBus=t;this.active=r.SELECT;this.activeBeforePresentationMode=null;this.handTool=new n.GrabToPan({element:this.container});this._addEventListeners();Promise.resolve().then((()=>{this.switchTool(i)}))}get activeTool(){return this.active}switchTool(e){if(null!==this.activeBeforePresentationMode)return;if(e===this.active)return;const disableActiveTool=()=>{switch(this.active){case r.SELECT:break;case r.HAND:this.handTool.deactivate()}};switch(e){case r.SELECT:disableActiveTool();break;case r.HAND:disableActiveTool();this.handTool.activate();break;default:console.error(`switchTool: "${e}" is an unsupported value.`);return}this.active=e;this._dispatchEvent()}_dispatchEvent(){this.eventBus.dispatch("cursortoolchanged",{source:this,tool:this.active})}_addEventListeners(){this.eventBus._on("switchcursortool",(e=>{this.switchTool(e.tool)}));this.eventBus._on("presentationmodechanged",(e=>{switch(e.state){case s.PresentationModeState.FULLSCREEN:{const e=this.active;this.switchTool(r.SELECT);this.activeBeforePresentationMode=e;break}case s.PresentationModeState.NORMAL:{const e=this.activeBeforePresentationMode;this.activeBeforePresentationMode=null;this.switchTool(e);break}}}))}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.GrabToPan=GrabToPan;function GrabToPan(e){this.element=e.element;this.document=e.element.ownerDocument;"function"==typeof e.ignoreTarget&&(this.ignoreTarget=e.ignoreTarget);this.onActiveChanged=e.onActiveChanged;this.activate=this.activate.bind(this);this.deactivate=this.deactivate.bind(this);this.toggle=this.toggle.bind(this);this._onmousedown=this._onmousedown.bind(this);this._onmousemove=this._onmousemove.bind(this);this._endPan=this._endPan.bind(this);(this.overlay=document.createElement("div")).className="grab-to-pan-grabbing"}GrabToPan.prototype={CSS_CLASS_GRAB:"grab-to-pan-grab",activate:function GrabToPan_activate(){if(!this.active){this.active=!0;this.element.addEventListener("mousedown",this._onmousedown,!0);this.element.classList.add(this.CSS_CLASS_GRAB);this.onActiveChanged&&this.onActiveChanged(!0)}},deactivate:function GrabToPan_deactivate(){if(this.active){this.active=!1;this.element.removeEventListener("mousedown",this._onmousedown,!0);this._endPan();this.element.classList.remove(this.CSS_CLASS_GRAB);this.onActiveChanged&&this.onActiveChanged(!1)}},toggle:function GrabToPan_toggle(){this.active?this.deactivate():this.activate()},ignoreTarget:function GrabToPan_ignoreTarget(e){return!!document.querySelector(".stf__item")||e.matches("a[href], a[href] *, input, textarea, button, button *, select, option")},_onmousedown:function GrabToPan__onmousedown(e){if(0!==e.button||this.ignoreTarget(e.target))return;if(e.originalTarget)try{e.originalTarget.tagName}catch(e){return}this.scrollLeftStart=this.element.scrollLeft;this.scrollTopStart=this.element.scrollTop;this.clientXStart=e.clientX;this.clientYStart=e.clientY;if(isOverPerfectScrollbar(this.clientXStart,this.clientYStart,"ps__rail-x"))return;if(isOverPerfectScrollbar(this.clientXStart,this.clientYStart,"ps__rail-y"))return;this.document.addEventListener("mousemove",this._onmousemove,!0);this.document.addEventListener("mouseup",this._endPan,!0);this.element.addEventListener("scroll",this._endPan,!0);e.preventDefault();e.stopPropagation();const t=document.activeElement;t&&!t.contains(e.target)&&t.blur()},_onmousemove:function GrabToPan__onmousemove(e){this.element.removeEventListener("scroll",this._endPan,!0);if(function isLeftMouseReleased(e){if("buttons"in e)return!(1&e.buttons);const t=window.chrome,i=t&&(t.webstore||t.app),n=/Apple/.test(navigator.vendor)&&/Version\/([6-9]\d*|[1-5]\d+)/.test(navigator.userAgent);if(i||n)return 0===e.which;return!1}(e)){this._endPan();return}const t=e.clientX-this.clientXStart,i=e.clientY-this.clientYStart,n=this.scrollTopStart-i,s=this.scrollLeftStart-t;if(this.element.scrollTo)this.element.scrollTo({top:n,left:s,behavior:"instant"});else{this.element.scrollTop=n;this.element.scrollLeft=s}this.overlay.parentNode||document.body.appendChild(this.overlay)},_endPan:function GrabToPan__endPan(){this.element.removeEventListener("scroll",this._endPan,!0);this.document.removeEventListener("mousemove",this._onmousemove,!0);this.document.removeEventListener("mouseup",this._endPan,!0);this.overlay.remove()}};function isOverPerfectScrollbar(e,t,i){const n=document.getElementsByClassName(i);if(n&&1===n.length){var{top:s,right:r,bottom:a,left:o}=n[0].getBoundingClientRect();if(t>=s&&t<=a&&e<=r&&e>=o)return!0}return!1}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.RenderingStates=t.PDFRenderingQueue=void 0;var n=i(4);const s={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3};t.RenderingStates=s;t.PDFRenderingQueue=class PDFRenderingQueue{constructor(){this.pdfViewer=null;this.pdfThumbnailViewer=null;this.onIdle=null;this.highestPriorityPage=null;this.idleTimeout=null;this.printing=!1;this.isThumbnailViewEnabled=!1}setViewer(e){this.pdfViewer=e}setThumbnailViewer(e){this.pdfThumbnailViewer=e}isHighestPriority(e){return this.highestPriorityPage===e.renderingId}hasViewer(){return!!this.pdfViewer}renderHighestPriority(e){if(this.idleTimeout){clearTimeout(this.idleTimeout);this.idleTimeout=null}this.pdfViewer.forceRendering(e)||this.pdfThumbnailViewer&&this.isThumbnailViewEnabled&&this.pdfThumbnailViewer.forceRendering()||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),3e4))}getHighestPriority(e,t,i,n=!1){const s=e.views,r=s.length;if(0===r)return null;for(let e=0;e<r;++e){const t=s[e].view;if(!this.isViewFinished(t))return t}let a=i?e.last.id:e.first.id-2,o=t[a];if(o&&!this.isViewFinished(o))return o;if(n){a+=i?1:-1;o=t[a];if(o&&!this.isViewFinished(o))return o}return null}isViewFinished(e){return e.renderingState===s.FINISHED}renderView(e){switch(e.renderingState){case s.FINISHED:return!1;case s.PAUSED:this.highestPriorityPage=e.renderingId;e.resume();break;case s.RUNNING:this.highestPriorityPage=e.renderingId;break;case s.INITIAL:this.highestPriorityPage=e.renderingId;e.draw().finally((()=>{this.renderHighestPriority()})).catch((e=>{e instanceof n.RenderingCancelledException||console.error(`renderView: "${e}"`)}))}return!0}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.OverlayManager=void 0;t.OverlayManager=class OverlayManager{constructor(){this._overlays={};this._active=null;this._keyDownBound=this._keyDown.bind(this)}get active(){return this._active}async register(e,t,i=null,n=!1){let s;if(!(e&&t&&(s=t.parentNode)))throw new Error("Not enough parameters.");if(this._overlays[e])throw new Error("The overlay is already registered.");this._overlays[e]={element:t,container:s,callerCloseMethod:i,canForceClose:n}}async unregister(e){if(!this._overlays[e])throw new Error("The overlay does not exist.");if(this._active===e)throw new Error("The overlay cannot be removed while it is active.");delete this._overlays[e]}async open(e){if(!this._overlays[e])throw new Error("The overlay does not exist.");if(this._active){if(!this._overlays[e].canForceClose)throw this._active===e?new Error("The overlay is already active."):new Error("Another overlay is currently active.");this._closeThroughCaller()}this._active=e;this._overlays[this._active].element.classList.remove("hidden");this._overlays[this._active].container.classList.remove("hidden");window.addEventListener("keydown",this._keyDownBound)}async close(e){if(!this._overlays[e])throw new Error("The overlay does not exist.");if(!this._active)throw new Error("The overlay is currently not active.");if(this._active!==e)throw new Error("Another overlay is currently active.");this._overlays[this._active].container.classList.add("hidden");this._overlays[this._active].element.classList.add("hidden");this._active=null;window.removeEventListener("keydown",this._keyDownBound)}_keyDown(e){if(this._active&&27===e.keyCode){this._closeThroughCaller();e.preventDefault()}}_closeThroughCaller(){this._overlays[this._active].callerCloseMethod&&this._overlays[this._active].callerCloseMethod();this._active&&this.close(this._active)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PasswordPrompt=void 0;var n=i(4);t.PasswordPrompt=class PasswordPrompt{constructor(e,t,i,n=!1){this.overlayName=e.overlayName;this.container=e.container;this.label=e.label;this.input=e.input;this.submitButton=e.submitButton;this.cancelButton=e.cancelButton;this.overlayManager=t;this.l10n=i;this._isViewerEmbedded=n;this.updateCallback=null;this.reason=null;this.submitButton.addEventListener("click",this.verify.bind(this));this.cancelButton.addEventListener("click",this.close.bind(this));this.input.addEventListener("keydown",(e=>{13===e.keyCode&&this.verify()}));this.overlayManager.register(this.overlayName,this.container,this.close.bind(this),!0)}async open(){await this.overlayManager.open(this.overlayName);this.input.type="password";this.input.focus();const e=this.reason===n.PasswordResponses.INCORRECT_PASSWORD;this._isViewerEmbedded&&!e||this.input.focus();this.label.textContent=await this.l10n.get("password_"+(e?"invalid":"label"))}close(){this.overlayManager.close(this.overlayName).then((()=>{this.input.type="";this.input.value=""}))}verify(){const e=this.input.value;if(e?.length>0){this.close();this.updateCallback(e)}}setUpdateCallback(e,t){this.updateCallback=e;this.reason=t}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFAttachmentViewer=void 0;var n=i(4),s=i(11);class PDFAttachmentViewer extends s.BaseTreeViewer{constructor(e){super(e);this.downloadManager=e.downloadManager;this.eventBus._on("fileattachmentannotation",this._appendAttachment.bind(this))}reset(e=!1){super.reset();this._attachments=null;e||(this._renderedCapability=(0,n.createPromiseCapability)());this._pendingDispatchEvent&&clearTimeout(this._pendingDispatchEvent);this._pendingDispatchEvent=null}_dispatchEvent(e){this._renderedCapability.resolve();if(this._pendingDispatchEvent){clearTimeout(this._pendingDispatchEvent);this._pendingDispatchEvent=null}0!==e?this.eventBus.dispatch("attachmentsloaded",{source:this,attachmentsCount:e}):this._pendingDispatchEvent=setTimeout((()=>{this.eventBus.dispatch("attachmentsloaded",{source:this,attachmentsCount:0});this._pendingDispatchEvent=null}))}_bindLink(e,{content:t,filename:i}){e.onclick=()=>{this.downloadManager.openOrDownloadData(e,t,i);return!1}}render({attachments:e,keepRenderedCapability:t=!1}){this._attachments&&this.reset(t);this._attachments=e||null;if(!e){this._dispatchEvent(0);return}const i=Object.keys(e).sort((function(e,t){return e.toLowerCase().localeCompare(t.toLowerCase())})),s=document.createDocumentFragment();let r=0;for(const t of i){const i=e[t],a=i.content,o=(0,n.getFilenameFromUrl)(i.filename),l=document.createElement("div");l.className="treeItem";const h=document.createElement("a");this._bindLink(h,{content:a,filename:o});h.textContent=this._normalizeTextContent(o);l.appendChild(h);s.appendChild(l);r++}this._finishRendering(s,r)}_appendAttachment({id:e,filename:t,content:i}){const n=this._renderedCapability.promise;n.then((()=>{if(n!==this._renderedCapability.promise)return;let s=this._attachments;if(s){for(const t in s)if(e===t)return}else s=Object.create(null);s[e]={filename:t,content:i};this.render({attachments:s,keepRenderedCapability:!0})}))}}t.PDFAttachmentViewer=PDFAttachmentViewer},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.BaseTreeViewer=void 0;var n=i(4);const s="selected";class BaseTreeViewer{constructor(e){if(this.constructor===BaseTreeViewer)throw new Error("Cannot initialize BaseTreeViewer.");this.container=e.container;this.eventBus=e.eventBus;this.reset()}reset(){this._pdfDocument=null;this._lastToggleIsShow=!0;this._currentTreeItem=null;this.container.textContent="";this.container.classList.remove("treeWithDeepNesting")}_dispatchEvent(e){throw new Error("Not implemented: _dispatchEvent")}_bindLink(e,t){throw new Error("Not implemented: _bindLink")}_normalizeTextContent(e){return(0,n.removeNullCharacters)(e)||"–"}_addToggleButton(e,t=!1){const i=document.createElement("div");i.className="treeItemToggler";t&&i.classList.add("treeItemsHidden");i.onclick=t=>{t.stopPropagation();i.classList.toggle("treeItemsHidden");if(t.shiftKey){const t=!i.classList.contains("treeItemsHidden");this._toggleTreeItem(e,t)}};e.insertBefore(i,e.firstChild)}_toggleTreeItem(e,t=!1){this._lastToggleIsShow=t;for(const i of e.querySelectorAll(".treeItemToggler"))i.classList.toggle("treeItemsHidden",!t)}_toggleAllTreeItems(){this._toggleTreeItem(this.container,!this._lastToggleIsShow)}_finishRendering(e,t,i=!1){if(i){this.container.classList.add("treeWithDeepNesting");this._lastToggleIsShow=!e.querySelector(".treeItemsHidden")}this.container.appendChild(e);this._dispatchEvent(t)}render(e){throw new Error("Not implemented: render")}_updateCurrentTreeItem(e=null){if(this._currentTreeItem){this._currentTreeItem.classList.remove(s);this._currentTreeItem=null}if(e){e.classList.add(s);this._currentTreeItem=e}}_scrollToCurrentTreeItem(e){if(!e)return;let t=e.parentNode;for(;t&&t!==this.container;){if(t.classList.contains("treeItem")){t.firstElementChild?.classList.remove("treeItemsHidden")}t=t.parentNode}this._updateCurrentTreeItem(e);this.container.scrollTo(e.offsetLeft,e.offsetTop+-100)}}t.BaseTreeViewer=BaseTreeViewer},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFDocumentProperties=void 0;var n=i(4),s=i(3);const r=["en-us","en-lr","my"],a={"8.5x11":"Letter","8.5x14":"Legal"},o={"297x420":"A3","210x297":"A4"};function getPageName(e,t,i){return i[`${t?e.width:e.height}x${t?e.height:e.width}`]}t.PDFDocumentProperties=class PDFDocumentProperties{constructor({overlayName:e,fields:t,container:i,closeButton:n},s,a,o){this.overlayName=e;this.fields=t;this.container=i;this.overlayManager=s;this.l10n=o;this._reset();n.addEventListener("click",this.close.bind(this));this.overlayManager.register(this.overlayName,this.container,this.close.bind(this));a._on("pagechanging",(e=>{this._currentPageNumber=e.pageNumber}));a._on("rotationchanging",(e=>{this._pagesRotation=e.pagesRotation}));this._isNonMetricLocale=!0;o.getLanguage().then((e=>{this._isNonMetricLocale=r.includes(e)}))}async open(){const freezeFieldData=e=>{Object.defineProperty(this,"fieldData",{value:Object.freeze(e),writable:!1,enumerable:!0,configurable:!0})};await Promise.all([this.overlayManager.open(this.overlayName),this._dataAvailableCapability.promise]);const e=this._currentPageNumber,t=this._pagesRotation;if(this.fieldData&&e===this.fieldData._currentPageNumber&&t===this.fieldData._pagesRotation){this._updateUI();return}const{info:i,contentDispositionFilename:r,contentLength:a}=await this.pdfDocument.getMetadata(),[o,l,h,c,d,u]=await Promise.all([r||(0,n.getPdfFilenameFromUrl)(this.url),this._parseFileSize(a),this._parseDate(i.CreationDate),this._parseDate(i.ModDate),this.pdfDocument.getPage(e).then((e=>this._parsePageSize((0,s.getPageSizeInches)(e),t))),this._parseLinearization(i.IsLinearized)]);freezeFieldData({fileName:o,fileSize:l,title:i.Title,author:i.Author,subject:i.Subject,keywords:i.Keywords,creationDate:h,modificationDate:c,creator:i.Creator,producer:i.Producer,version:i.PDFFormatVersion,pageCount:this.pdfDocument.numPages,pageSize:d,linearized:u,_currentPageNumber:e,_pagesRotation:t});this._updateUI();const{length:p}=await this.pdfDocument.getDownloadInfo();if(a===p)return;const g=Object.assign(Object.create(null),this.fieldData);g.fileSize=await this._parseFileSize(p);freezeFieldData(g);this._updateUI()}close(){this.overlayManager.close(this.overlayName)}setDocument(e,t=null){if(this.pdfDocument){this._reset();this._updateUI(!0)}if(e){this.pdfDocument=e;this.url=t;this._dataAvailableCapability.resolve()}}_reset(){this.pdfDocument=null;this.url=null;delete this.fieldData;this._dataAvailableCapability=(0,n.createPromiseCapability)();this._currentPageNumber=1;this._pagesRotation=0}_updateUI(e=!1){if(!e&&this.fieldData){if(this.overlayManager.active===this.overlayName)for(const e in this.fields){const t=this.fieldData[e];this.fields[e].textContent=t||0===t?t:"-"}}else for(const e in this.fields)this.fields[e].textContent="-"}async _parseFileSize(e=0){const t=e/1024,i=t/1024;if(t)return this.l10n.get("document_properties_"+(i>=1?"mb":"kb"),{size_mb:i>=1&&(+i.toPrecision(3)).toLocaleString(),size_kb:i<1&&(+t.toPrecision(3)).toLocaleString(),size_b:e.toLocaleString()})}async _parsePageSize(e,t){if(!e)return;t%180!=0&&(e={width:e.height,height:e.width});const i=(0,s.isPortraitOrientation)(e);let n={width:Math.round(100*e.width)/100,height:Math.round(100*e.height)/100},r={width:Math.round(25.4*e.width*10)/10,height:Math.round(25.4*e.height*10)/10},l=getPageName(n,i,a)||getPageName(r,i,o);if(!(l||Number.isInteger(r.width)&&Number.isInteger(r.height))){const t={width:25.4*e.width,height:25.4*e.height},s={width:Math.round(r.width),height:Math.round(r.height)};if(Math.abs(t.width-s.width)<.1&&Math.abs(t.height-s.height)<.1){l=getPageName(s,i,o);if(l){n={width:Math.round(s.width/25.4*100)/100,height:Math.round(s.height/25.4*100)/100};r=s}}}const[{width:h,height:c},d,u,p]=await Promise.all([this._isNonMetricLocale?n:r,this.l10n.get("document_properties_page_size_unit_"+(this._isNonMetricLocale?"inches":"millimeters")),l&&this.l10n.get(`document_properties_page_size_name_${l.toLowerCase()}`),this.l10n.get("document_properties_page_size_orientation_"+(i?"portrait":"landscape"))]);return this.l10n.get(`document_properties_page_size_dimension_${u?"name_":""}string`,{width:h.toLocaleString(),height:c.toLocaleString(),unit:d,name:u,orientation:p})}async _parseDate(e){const t=n.PDFDateString.toDateObject(e);if(t)return this.l10n.get("document_properties_date_string",{date:t.toLocaleDateString(),time:t.toLocaleTimeString()})}_parseLinearization(e){return this.l10n.get("document_properties_linearized_"+(e?"yes":"no"))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFFindBar=void 0;var n=i(14);t.PDFFindBar=class PDFFindBar{constructor(e,t,i){this.opened=!1;this.bar=e.bar;this.toggleButton=e.toggleButton;this.findField=e.findField;this.highlightAll=e.highlightAllCheckbox;this.caseSensitive=e.caseSensitiveCheckbox;this.entireWord=e.entireWordCheckbox;this.findMsg=e.findMsg;this.findResultsCount=e.findResultsCount;this.findPreviousButton=e.findPreviousButton;this.findNextButton=e.findNextButton;this.findFieldMultiline=e.findFieldMultiline||null;this.multipleSearchTexts=e.findMultipleSearchTextsCheckbox||null;this.ignoreAccents=e.ignoreAccentsCheckbox||null;this.fuzzySearch=e.fuzzyCheckbox||null;this.eventBus=t;this.l10n=i;this.toggleButton.addEventListener("click",(()=>{this.toggle()}));this.findFieldMultiline.addEventListener("input",(()=>{this.dispatchEvent("")}));this.findField.addEventListener("input",(()=>{this.dispatchEvent("")}));this.bar.addEventListener("keydown",(e=>{switch(e.keyCode){case 13:e.target===this.findField&&this.dispatchEvent("again",e.shiftKey);break;case 27:this.close()}}));this.findPreviousButton.addEventListener("click",(()=>{this.dispatchEvent("again",!0)}));this.findNextButton.addEventListener("click",(()=>{this.dispatchEvent("again",!1)}));this.highlightAll.addEventListener("click",(()=>{this.dispatchEvent("highlightallchange")}));this.caseSensitive.addEventListener("click",(()=>{this.dispatchEvent("casesensitivitychange")}));this.entireWord.addEventListener("click",(()=>{this.dispatchEvent("entirewordchange")}));this.multipleSearchTexts.addEventListener("click",(()=>{this.dispatchEvent("multiplesearchtextschange")}));this.ignoreAccents.addEventListener("click",(()=>{this.dispatchEvent("ignoreAccentsChange")}));this.fuzzySearch.addEventListener("click",(()=>{this.dispatchEvent("fuzzySearchChange")}));this.eventBus._on("resize",this._adjustWidth.bind(this))}reset(){this.updateUIState()}dispatchEvent(e,t){this.eventBus.dispatch("find",{source:this,type:e,query:this.findFieldMultiline.classList.contains("hidden")?this.findField.value:this.findFieldMultiline.value,phraseSearch:!this.multipleSearchTexts.checked,caseSensitive:this.caseSensitive.checked,entireWord:this.entireWord.checked,ignoreAccents:this.ignoreAccents.checked,fuzzySearch:this.fuzzySearch.checked,highlightAll:this.highlightAll.checked,findPrevious:t})}updateUIState(e,t,i){let s=Promise.resolve(""),r="";switch(e){case n.FindState.FOUND:break;case n.FindState.PENDING:r="pending";break;case n.FindState.NOT_FOUND:s=this.l10n.get("find_not_found");r="notFound";break;case n.FindState.WRAPPED:s=this.l10n.get("find_reached_"+(t?"top":"bottom"))}this.findField.setAttribute("data-status",r);this.findFieldMultiline.classList.toggle("notFound","notFound"===r);this.findFieldMultiline.setAttribute("data-status",r);s.then((e=>{this.findMsg.textContent=e;this._adjustWidth()}));this.updateResultsCount(i)}updateResultsCount({current:e=0,total:t=0}={}){let i=Promise.resolve("");if(t>0)if(t>1e3){let e="find_match_count_limit";i=this.l10n.get(e,{limit:1e3})}else{let n="find_match_count";i=this.l10n.get(n,{current:e,total:t})}i.then((e=>{this.findResultsCount.textContent=e;this.findResultsCount.classList.toggle("hidden",!t);this._adjustWidth()}))}open(){if(!this.opened){this.opened=!0;this.toggleButton.classList.add("toggled");this.toggleButton.setAttribute("aria-expanded","true");this.bar.classList.remove("hidden")}this.findField.select();this.findField.focus();this.dispatchEvent("");this._adjustWidth()}close(){if(this.opened){this.opened=!1;this.toggleButton.classList.remove("toggled");this.toggleButton.setAttribute("aria-expanded","false");this.bar.classList.add("hidden");this.eventBus.dispatch("findbarclose",{source:this})}}toggle(){this.opened?this.close():this.open()}_adjustWidth(){if(!this.opened)return;this.bar.classList.remove("wrapContainers");this.bar.clientHeight>this.bar.firstElementChild.clientHeight&&this.bar.classList.add("wrapContainers")}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFFindController=t.FindState=void 0;var n=i(4),s=i(15),r=i(16),a=i(17),o=i(3);const l={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3};t.FindState=l;const h={"‐":"-","‘":"'","’":"'","‚":"'","‛":"'","“":'"',"”":'"',"„":'"',"‟":'"',"¼":"1/4","½":"1/2","¾":"3/4"};let c=null;function normalize(e){if(!c){const e=Object.keys(h).join("");c=new RegExp(`[${e}]`,"g")}let t=null;return[e.replace(c,(function(e,i){const n=h[e],s=n.length-e.length;0!==s&&(t||=[]).push([i,s]);return n})),t]}function getOriginalIndex(e,t=null){if(!t)return e;let i=0;for(const[n,s]of t){const t=n+i;if(t>=e)break;if(t+s>e){i+=e-t;break}i+=s}return e-i}t.PDFFindController=class PDFFindController{constructor({linkService:e,eventBus:t,pageViewMode:i}){this._linkService=e;this._eventBus=t;this._pageViewMode=i;this._reset();t._on("findbarclose",this._onFindBarClose.bind(this))}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesColor(){return this._pageMatchesColor}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return this._state}setDocument(e){this._pdfDocument&&this._reset();if(e){this._pdfDocument=e;this._firstPageCapability.resolve()}}executeCommand(e,t){if(!t)return;const i=this._pdfDocument;(null===this._state||this._shouldDirtyMatch(e,t))&&(this._dirtyMatch=!0);this._state=t;"findhighlightallchange"!==e&&this._updateUIState(l.PENDING);this._firstPageCapability.promise.then((()=>{if(!this._pdfDocument||i&&this._pdfDocument!==i)return;this._extractText();const t=!this._highlightMatches,n=!!this._findTimeout;if(this._findTimeout){clearTimeout(this._findTimeout);this._findTimeout=null}if("find"===e)this._findTimeout=setTimeout((()=>{this._nextMatch();this._findTimeout=null}),250);else if(this._dirtyMatch)this._nextMatch();else if("findagain"===e){this._nextMatch();t&&this._state.highlightAll&&this._updateAllPages()}else if("findhighlightallchange"===e){n?this._nextMatch():this._highlightMatches=!0;this._updateAllPages()}else this._nextMatch()}))}scrollMatchIntoView({element:e=null,selectedLeft:t=0,pageIndex:i=-1,matchIndex:n=-1}){if(!this._scrollMatches||!e)return;if(-1===n||n!==this._selected.matchIdx)return;if(-1===i||i!==this._selected.pageIdx)return;this._scrollMatches=!1;const s={top:-50,left:t+-400};(0,o.scrollIntoView)(e,s,!0,"infinite-scroll"===this._pageViewMode)}_reset(){this._highlightMatches=!1;this._scrollMatches=!1;this._pdfDocument=null;this._pageMatches=[];this._pageMatchesLength=[];this._pageMatchesColor=[];this._state=null;this._selected={pageIdx:-1,matchIdx:-1};this._offset={pageIdx:null,matchIdx:null,wrapped:!1};this._extractTextPromises=[];this._pageContents=[];this._pageDiffs=[];this._matchesCountTotal=0;this._pagesToSearch=null;this._pendingFindMatches=new Set;this._resumePageIdx=null;this._dirtyMatch=!1;clearTimeout(this._findTimeout);this._findTimeout=null;this._firstPageCapability=(0,n.createPromiseCapability)()}get _query(){if(this._state.query!==this._rawQuery){this._rawQuery=this._state.query;[this._normalizedQuery]=normalize(this._state.query)}return this._normalizedQuery}_shouldDirtyMatch(e,t){if(t.query!==this._state.query)return!0;switch(e){case"findagain":const e=this._selected.pageIdx+1,t=this._linkService;return e>=1&&e<=t.pagesCount&&e!==t.page&&!t.isPageVisible(e);case"findhighlightallchange":return!1}return!0}_prepareMatches(e,t,i,n){function isSubTerm(t){const i=e[t],n=e[t+1];if(t<e.length-1&&i.match===n.match){i.skipped=!0;return!0}for(let n=t-1;n>=0;n--){const t=e[n];if(!t.skipped){if(t.match+t.matchLength<i.match)break;if(t.match+t.matchLength>=i.match+i.matchLength){i.skipped=!0;return!0}}}return!1}e.sort((function(e,t){return e.match===t.match?e.matchLength-t.matchLength:e.match-t.match}));for(let s=0,r=e.length;s<r;s++)if(!isSubTerm(s)){t.push(e[s].match);i.push(e[s].matchLength);n.push(e[s].color)}}_isEntireWord(e,t,i){if(t>0){const i=e.charCodeAt(t),n=e.charCodeAt(t-1);if((0,r.getCharacterType)(i)===(0,r.getCharacterType)(n))return!1}const n=t+i-1;if(n<e.length-1){const t=e.charCodeAt(n),i=e.charCodeAt(n+1);if((0,r.getCharacterType)(t)===(0,r.getCharacterType)(i))return!1}return!0}_calculateFuzzyMatch(e,t,i,n){const s=[],r=[],o=e.length,l=o<5?o:5,h=Math.round(o/5),c=e.substring(0,l),d={useCollator:!0};for(let t=0;t<i.length-o;t++){const u=i.substring(t,t+l);if(a.Levenshtein.distance(c,u,d)<3){const l=i.substring(t,t+o),c=a.Levenshtein.distance(e,l,d);if(c<=h){if(t+1<i.length-o){const n=i.substring(t+1,t+1+o);if(c>=a.Levenshtein.distance(e,n,d))continue}const l=getOriginalIndex(t,n),h=getOriginalIndex(t+o-1,n)-l+1;s.push(l);r.push(h);t+=o-1}}}this._pageMatches[t]=s;this._pageMatchesLength[t]=r}_calculatePhraseMatch(e,t,i,n,r,a){if(a){i=(0,s.deburr)(i);e=(0,s.deburr)(e)}const o=[],l=[],h=e.length;let c=-h;for(;;){c=i.indexOf(e,c+h);if(-1===c)break;if(r&&!this._isEntireWord(i,c,h))continue;const t=getOriginalIndex(c,n),s=getOriginalIndex(c+h-1,n)-t+1;o.push(t);l.push(s)}this._pageMatches[t]=o;this._pageMatchesLength[t]=l}_calculateWordMatch(e,t,i,n,r,a){if(a){i=(0,s.deburr)(i);e=(0,s.deburr)(e)}const o=[],l=e.includes("\n")?e.trim().split(/\n+/g):e.trim().match(/\S+/g);for(let e=0,t=l.length;e<t;e++){const t=l[e],s=t.length;if(0===s)continue;let a=-s;for(;;){a=i.indexOf(t,a+s);if(-1===a)break;if(r&&!this._isEntireWord(i,a,s))continue;const l=getOriginalIndex(a,n),h=getOriginalIndex(a+s-1,n)-l+1;o.push({match:l,matchLength:h,skipped:!1,color:e})}}this._pageMatchesLength[t]=[];this._pageMatchesColor[t]=[];this._pageMatches[t]=[];this._prepareMatches(o,this._pageMatches[t],this._pageMatchesLength[t],this._pageMatchesColor[t])}_calculateMatch(e){let t=this._pageContents[e];const i=this._pageDiffs[e];let n=this._query;const{caseSensitive:s,entireWord:r,ignoreAccents:a,fuzzySearch:o,phraseSearch:l}=this._state;if(0===n.length)return;if(!s){t=t.toLowerCase();n=n.toLowerCase()}o?n.length<=2?this._calculatePhraseMatch(n,e,t,i,!1):this._calculateFuzzyMatch(n,e,t,i):l?this._calculatePhraseMatch(n,e,t,i,r,a):this._calculateWordMatch(n,e,t,i,r,a);this._state.highlightAll&&this._updatePage(e);if(this._resumePageIdx===e){this._resumePageIdx=null;this._nextPageMatch()}const h=this._pageMatches[e].length;if(h>0){this._matchesCountTotal+=h;this._updateUIResultsCount()}}_extractText(){if(this._extractTextPromises.length>0)return;let e=Promise.resolve();for(let t=0,i=this._linkService.pagesCount;t<i;t++){const i=(0,n.createPromiseCapability)();this._extractTextPromises[t]=i.promise;e=e.then((()=>this._pdfDocument.getPage(t+1).then((e=>e.getTextContent({normalizeWhitespace:!0}))).then((e=>{const n=e.items,s=[];for(let e=0,t=n.length;e<t;e++)s.push(n[e].str);[this._pageContents[t],this._pageDiffs[t]]=normalize(s.join(""));i.resolve(t)}),(e=>{console.error(`Unable to get text content for page ${t+1}`,e);this._pageContents[t]="";this._pageDiffs[t]=null;i.resolve(t)}))))}}_updatePage(e){this._scrollMatches&&this._selected.pageIdx===e&&(this._linkService.page=e+1);this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:e})}_updateAllPages(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})}_nextMatch(){const e=this._state.findPrevious,t=this._linkService.page-1,i=this._linkService.pagesCount;this._highlightMatches=!0;if(this._dirtyMatch){this._dirtyMatch=!1;this._selected.pageIdx=this._selected.matchIdx=-1;this._offset.pageIdx=t;this._offset.matchIdx=null;this._offset.wrapped=!1;this._resumePageIdx=null;this._pageMatches.length=0;this._pageMatchesLength.length=0;this._pageMatchesColor.length=0;this._matchesCountTotal=0;this._updateAllPages();for(let e=0;e<i;e++)if(!this._pendingFindMatches.has(e)){this._pendingFindMatches.add(e);this._extractTextPromises[e].then((e=>{this._pendingFindMatches.delete(e);this._calculateMatch(e)}))}}if(""===this._query){this._updateUIState(l.FOUND);return}if(this._resumePageIdx)return;const n=this._offset;this._pagesToSearch=i;if(null!==n.matchIdx){const t=this._pageMatches[n.pageIdx].length;if(!e&&n.matchIdx+1<t||e&&n.matchIdx>0){n.matchIdx=e?n.matchIdx-1:n.matchIdx+1;this._updateMatch(!0);return}this._advanceOffsetPage(e)}this._nextPageMatch()}_matchesReady(e){const t=this._offset,i=e.length,n=this._state.findPrevious;if(i){t.matchIdx=n?i-1:0;this._updateMatch(!0);return!0}this._advanceOffsetPage(n);if(t.wrapped){t.matchIdx=null;if(this._pagesToSearch<0){this._updateMatch(!1);return!0}}return!1}_nextPageMatch(){null!==this._resumePageIdx&&console.error("There can only be one pending page.");let e=null;do{const t=this._offset.pageIdx;e=this._pageMatches[t];if(!e){this._resumePageIdx=t;break}}while(!this._matchesReady(e))}_advanceOffsetPage(e){const t=this._offset,i=this._linkService.pagesCount;t.pageIdx=e?t.pageIdx-1:t.pageIdx+1;t.matchIdx=null;this._pagesToSearch--;if(t.pageIdx>=i||t.pageIdx<0){t.pageIdx=e?i-1:0;t.wrapped=!0}}_updateMatch(e=!1){let t=l.NOT_FOUND;const i=this._offset.wrapped;this._offset.wrapped=!1;if(e){const e=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx;this._selected.matchIdx=this._offset.matchIdx;t=i?l.WRAPPED:l.FOUND;-1!==e&&e!==this._selected.pageIdx&&this._updatePage(e)}this._updateUIState(t,this._state.findPrevious);if(-1!==this._selected.pageIdx){this._scrollMatches=!0;this._updatePage(this._selected.pageIdx)}}_onFindBarClose(e){const t=this._pdfDocument;this._firstPageCapability.promise.then((()=>{if(this._pdfDocument&&(!t||this._pdfDocument===t)){if(this._findTimeout){clearTimeout(this._findTimeout);this._findTimeout=null}if(this._resumePageIdx){this._resumePageIdx=null;this._dirtyMatch=!0}this._updateUIState(l.FOUND);this._highlightMatches=!1;this._updateAllPages()}}))}_requestMatchesCount(){const{pageIdx:e,matchIdx:t}=this._selected;let i=0,n=this._matchesCountTotal;if(-1!==t){for(let t=0;t<e;t++)i+=this._pageMatches[t]?.length||0;i+=t+1}(i<1||i>n)&&(i=n=0);return{current:i,total:n}}_updateUIResultsCount(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:this._requestMatchesCount()})}_updateUIState(e,t){this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:e,previous:t,matchesCount:this._requestMatchesCount(),rawQuery:this._state?.query??null})}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.deburr=function deburr(e){return(e=function toString(e){return null==e?"":function baseToString(e){if("string"==typeof e)return e;if(function isSymbol(e){return"symbol"==typeof e||function isObjectLike(e){return!!e&&"object"==typeof e}(e)&&h.call(e)==i}(e))return u?u.call(e):"";var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}(e))&&e.replace(n,l).replace(s,"")};var i="[object Symbol]",n=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,s=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]","g"),r="object"==typeof global&&global&&global.Object===Object&&global,a="object"==typeof self&&self&&self.Object===Object&&self,o=r||a||Function("return this")();var l=function basePropertyOf(e){return function(t){return null==e?void 0:e[t]}}({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"ss"}),h=Object.prototype.toString,c=o.Symbol,d=c?c.prototype:void 0,u=d?d.toString:void 0},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.getCharacterType=function getCharacterType(e){if(function isAlphabeticalScript(e){return e<11904}(e))return function isAscii(e){return 0==(65408&e)}(e)?function isAsciiSpace(e){return 32===e||9===e||13===e||10===e}(e)?i.SPACE:function isAsciiAlpha(e){return e>=97&&e<=122||e>=65&&e<=90}(e)||function isAsciiDigit(e){return e>=48&&e<=57}(e)||95===e?i.ALPHA_LETTER:i.PUNCT:function isThai(e){return 3584==(65408&e)}(e)?i.THAI_LETTER:160===e?i.SPACE:i.ALPHA_LETTER;if(function isHan(e){return e>=13312&&e<=40959||e>=63744&&e<=64255}(e))return i.HAN_LETTER;if(function isKatakana(e){return e>=12448&&e<=12543}(e))return i.KATAKANA_LETTER;if(function isHiragana(e){return e>=12352&&e<=12447}(e))return i.HIRAGANA_LETTER;if(function isHalfwidthKatakana(e){return e>=65376&&e<=65439}(e))return i.HALFWIDTH_KATAKANA_LETTER;return i.ALPHA_LETTER};t.CharacterType=void 0;const i={SPACE:0,ALPHA_LETTER:1,PUNCT:2,HAN_LETTER:3,KATAKANA_LETTER:4,HIRAGANA_LETTER:5,HALFWIDTH_KATAKANA_LETTER:6,THAI_LETTER:7};t.CharacterType=i},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.Levenshtein=void 0;let i;try{i=Intl.Collator("und",{sensitivity:"base"})}catch(e){try{i=Intl.Collator("generic",{sensitivity:"base"})}catch(e){i=void 0}}const n=[],s=[];t.Levenshtein=class Levenshtein{static distance(e,t,r){const a=r&&i&&r.useCollator,o=e.length,l=t.length;if(0===o)return l;if(0===l)return o;let h,c,d,u,p,g;for(d=0;d<l;++d){n[d]=d;s[d]=t.charCodeAt(d)}n[l]=l;if(a)for(d=0;d<o;++d){c=d+1;for(u=0;u<l;++u){h=c;g=0===i.compare(e.charAt(d),String.fromCharCode(s[u]));c=n[u]+(g?0:1);p=h+1;c>p&&(c=p);p=n[u+1]+1;c>p&&(c=p);n[u]=h}n[u]=c}else for(d=0;d<o;++d){c=d+1;for(u=0;u<l;++u){h=c;g=e.charCodeAt(d)===s[u];c=n[u]+(g?0:1);p=h+1;c>p&&(c=p);p=n[u+1]+1;c>p&&(c=p);n[u]=h}n[u]=c}return c}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.isDestArraysEqual=isDestArraysEqual;t.isDestHashesEqual=isDestHashesEqual;t.PDFHistory=void 0;var n=i(3);function getCurrentHash(){return document.location.hash}t.PDFHistory=class PDFHistory{constructor({linkService:e,eventBus:t}){this.linkService=e;this.eventBus=t;this._initialized=!1;this._fingerprint="";this.reset();this._boundEvents=null;this._isViewerInPresentationMode=!1;this.eventBus._on("presentationmodechanged",(e=>{this._isViewerInPresentationMode=e.state!==n.PresentationModeState.NORMAL}));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){console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');return}this._initialized&&this.reset();const n=""!==this._fingerprint&&this._fingerprint!==e;this._fingerprint=e;this._updateUrl=!0===i;this._initialized=!0;this._bindEvents();const s=window.history.state;this._popStateInProgress=!1;this._blockHashChange=0;this._currentHash=getCurrentHash();this._numPositionUpdates=0;this._uid=this._maxUid=0;this._destination=null;this._position=null;if(!this._isValidState(s,!0)||t){const{hash:e,page:i,rotation:s}=this._parseCurrentHash(!0);if(!e||n||t){this._pushOrReplaceState(null,!0);return}this._pushOrReplaceState({hash:e,page:i,rotation:s},!0);return}const r=s.destination;this._updateInternalState(r,s.uid,!0);void 0!==r.rotation&&(this._initialRotation=r.rotation);if(r.dest){this._initialBookmark=JSON.stringify(r.dest);this._destination.page=null}else r.hash?this._initialBookmark=r.hash:r.page&&(this._initialBookmark=`page=${r.page}`)}reset(){if(this._initialized){this._pageHide();this._initialized=!1;this._unbindEvents()}if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}this._initialBookmark=null;this._initialRotation=null}push({namedDest:e=null,explicitDest:t,pageNumber:i}){if(!this._initialized)return;if(e&&"string"!=typeof e){console.error(`PDFHistory.push: "${e}" is not a valid namedDest parameter.`);return}if(!Array.isArray(t)){console.error(`PDFHistory.push: "${t}" is not a valid explicitDest parameter.`);return}if(!this._isValidPage(i)&&(null!==i||this._destination)){console.error(`PDFHistory.push: "${i}" is not a valid pageNumber parameter.`);return}const n=e||JSON.stringify(t);if(!n)return;let s=!1;if(this._destination&&(isDestHashesEqual(this._destination.hash,n)||isDestArraysEqual(this._destination.dest,t))){if(this._destination.page)return;s=!0}if(!this._popStateInProgress||s){this._pushOrReplaceState({dest:t,hash:n,page:i,rotation:this.linkService.rotation},s);if(!this._popStateInProgress){this._popStateInProgress=!0;Promise.resolve().then((()=>{this._popStateInProgress=!1}))}}}pushPage(e){if(this._initialized)if(this._isValidPage(e)){if(this._destination?.page!==e&&!this._popStateInProgress){this._pushOrReplaceState({dest:null,hash:`page=${e}`,page:e,rotation:this.linkService.rotation});if(!this._popStateInProgress){this._popStateInProgress=!0;Promise.resolve().then((()=>{this._popStateInProgress=!1}))}}}else console.error(`PDFHistory.pushPage: "${e}" is not a valid page number.`)}pushCurrentPosition(){this._initialized&&!this._popStateInProgress&&this._tryPushCurrentPosition()}back(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;this._isValidState(e)&&e.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;this._isValidState(e)&&e.uid<this._maxUid&&window.history.forward()}get popStateInProgress(){return this._initialized&&(this._popStateInProgress||this._blockHashChange>0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}_pushOrReplaceState(e,t=!1){const i=t||!this._destination,n={fingerprint:this._fingerprint,uid:i?this._uid:this._uid+1,destination:e};this._updateInternalState(e,n.uid);let s;if(this._updateUrl&&e?.hash){const t=document.location.href.split("#")[0];t.startsWith("file://")||(s=`${t}#${e.hash}`)}i?window.history.replaceState(n,"",s):window.history.pushState(n,"",s)}_tryPushCurrentPosition(e=!1){if(!this._position)return;let t=this._position;if(e){t=Object.assign(Object.create(null),this._position);t.temporary=!0}if(!this._destination){this._pushOrReplaceState(t);return}if(this._destination.temporary){this._pushOrReplaceState(t,!0);return}if(this._destination.hash===t.hash)return;if(!this._destination.page&&this._numPositionUpdates<=50)return;let i=!1;if(this._destination.page>=t.first&&this._destination.page<=t.page){if(void 0!==this._destination.dest||!this._destination.first)return;i=!0}this._pushOrReplaceState(t,i)}_isValidPage(e){return Number.isInteger(e)&&e>0&&e<=this.linkService.pagesCount}_isValidState(e,t=!1){if(!e)return!1;if(e.fingerprint!==this._fingerprint){if(!t)return!1;{if("string"!=typeof e.fingerprint||e.fingerprint.length!==this._fingerprint.length)return!1;const[t]=performance.getEntriesByType("navigation");if("reload"!==t?.type)return!1}}return!(!Number.isInteger(e.uid)||e.uid<0)&&(null!==e.destination&&"object"==typeof e.destination)}_updateInternalState(e,t,i=!1){if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}i&&e?.temporary&&delete e.temporary;this._destination=e;this._uid=t;this._maxUid=Math.max(this._maxUid,t);this._numPositionUpdates=0}_parseCurrentHash(e=!1){const t=unescape(getCurrentHash()).substring(1),i=(0,n.parseQueryString)(t),s=i.get("nameddest")||"";let r=0|i.get("page");(!this._isValidPage(r)||e&&s.length>0)&&(r=null);return{hash:t,page:r,rotation:this.linkService.rotation}}_updateViewarea({location:e}){if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}this._position={hash:this._isViewerInPresentationMode?`page=${e.pageNumber}`:e.pdfOpenParams.substring(1),page:this.linkService.page,first:e.pageNumber,rotation:e.rotation};if(!this._popStateInProgress){this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++;this._updateViewareaTimeout=setTimeout((()=>{this._popStateInProgress||this._tryPushCurrentPosition(!0);this._updateViewareaTimeout=null}),1e3)}}_popState({state:e}){const t=getCurrentHash(),i=this._currentHash!==t;this._currentHash=t;if(!e){this._uid++;const{hash:e,page:t,rotation:i}=this._parseCurrentHash();this._pushOrReplaceState({hash:e,page:t,rotation:i},!0);return}if(!this._isValidState(e))return;this._popStateInProgress=!0;if(i){this._blockHashChange++;(0,n.waitOnEventOrTimeout)({target:window,name:"hashchange",delay:1e3}).then((()=>{this._blockHashChange--}))}const s=e.destination;this._updateInternalState(s,e.uid,!0);(0,n.isValidRotation)(s.rotation)&&(this.linkService.rotation=s.rotation);s.dest?this.linkService.goToDestination(s.dest):s.hash?this.linkService.setHash(s.hash):s.page&&(this.linkService.page=s.page);Promise.resolve().then((()=>{this._popStateInProgress=!1}))}_pageHide(){this._destination&&!this._destination.temporary||this._tryPushCurrentPosition()}_bindEvents(){if(!this._boundEvents){this._boundEvents={updateViewarea:this._updateViewarea.bind(this),popState:this._popState.bind(this),pageHide:this._pageHide.bind(this)};this.eventBus._on("updateviewarea",this._boundEvents.updateViewarea);window.addEventListener("popstate",this._boundEvents.popState);window.addEventListener("pagehide",this._boundEvents.pageHide)}}_unbindEvents(){if(this._boundEvents){this.eventBus._off("updateviewarea",this._boundEvents.updateViewarea);window.removeEventListener("popstate",this._boundEvents.popState);window.removeEventListener("pagehide",this._boundEvents.pageHide);this._boundEvents=null}}};function isDestHashesEqual(e,t){if("string"!=typeof e||"string"!=typeof t)return!1;if(e===t)return!0;return(0,n.parseQueryString)(e).get("nameddest")===t}function isDestArraysEqual(e,t){function isEntryEqual(e,t){if(typeof e!=typeof t)return!1;if(Array.isArray(e)||Array.isArray(t))return!1;if(null!==e&&"object"==typeof e&&null!==t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(!isEntryEqual(e[i],t[i]))return!1;return!0}return e===t||Number.isNaN(e)&&Number.isNaN(t)}if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(let i=0,n=e.length;i<n;i++)if(!isEntryEqual(e[i],t[i]))return!1;return!0}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFLayerViewer=void 0;var n=i(11);class PDFLayerViewer extends n.BaseTreeViewer{constructor(e){super(e);this.l10n=e.l10n;this.eventBus._on("resetlayers",this._resetLayers.bind(this));this.eventBus._on("togglelayerstree",this._toggleAllTreeItems.bind(this))}reset(){super.reset();this._optionalContentConfig=null}_dispatchEvent(e){this.eventBus.dispatch("layersloaded",{source:this,layersCount:e})}_bindLink(e,{groupId:t,input:i}){const setVisibility=()=>{this._optionalContentConfig.setVisibility(t,i.checked);this.eventBus.dispatch("optionalcontentconfig",{source:this,promise:Promise.resolve(this._optionalContentConfig)})};e.onclick=t=>{if(t.target===i){setVisibility();return!0}if(t.target!==e)return!0;i.checked=!i.checked;setVisibility();return!1}}async _setNestedName(e,{name:t=null}){if("string"!=typeof t){e.textContent=await this.l10n.get("additional_layers");e.style.fontStyle="italic"}else e.textContent=this._normalizeTextContent(t)}_addToggleButton(e,{name:t=null}){super._addToggleButton(e,null===t)}_toggleAllTreeItems(){this._optionalContentConfig&&super._toggleAllTreeItems()}render({optionalContentConfig:e,pdfDocument:t}){this._optionalContentConfig&&this.reset();this._optionalContentConfig=e||null;this._pdfDocument=t||null;const i=e?.getOrder();if(!i){this._dispatchEvent(0);return}const n=document.createDocumentFragment(),s=[{parent:n,groups:i}];let r=0,a=!1;for(;s.length>0;){const t=s.shift();for(const i of t.groups){const n=document.createElement("div");n.className="treeItem";const o=document.createElement("a");n.appendChild(o);if("object"==typeof i){a=!0;this._addToggleButton(n,i);this._setNestedName(o,i);const e=document.createElement("div");e.className="treeItems";n.appendChild(e);s.push({parent:e,groups:i.order})}else{const t=e.getGroup(i),n=document.createElement("input");this._bindLink(o,{groupId:i,input:n});n.type="checkbox";n.id=i;n.checked=t.visible;const s=document.createElement("label");s.setAttribute("for",i);s.textContent=this._normalizeTextContent(t.name);o.appendChild(n);o.appendChild(s);r++}t.parent.appendChild(n)}}this._finishRendering(n,r,a)}async _resetLayers(){if(!this._optionalContentConfig)return;const e=await this._pdfDocument.getOptionalContentConfig();this.eventBus.dispatch("optionalcontentconfig",{source:this,promise:Promise.resolve(e)});this.render({optionalContentConfig:e,pdfDocument:this._pdfDocument})}}t.PDFLayerViewer=PDFLayerViewer},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.SimpleLinkService=t.PDFLinkService=void 0;var n=i(4),s=i(3);t.PDFLinkService=class PDFLinkService{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;this._pagesRefCache=null}setDocument(e,t=null){this.baseUrl=t;this.pdfDocument=e;this._pagesRefCache=Object.create(null)}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}_goToDestinationHelper(e,t=null,i){const n=i[0];let s;if("object"==typeof n&&null!==n){s=this._cachedPageNumber(n);if(null===s){this.pdfDocument.getPageIndex(n).then((s=>{this.cachePageRef(s+1,n);this._goToDestinationHelper(e,t,i)})).catch((()=>{console.error(`PDFLinkService._goToDestinationHelper: "${n}" is not a valid page reference, for dest="${e}".`)}));return}}else{if(!Number.isInteger(n)){console.error(`PDFLinkService._goToDestinationHelper: "${n}" is not a valid destination reference, for dest="${e}".`);return}s=n+1}if(!s||s<1||s>this.pagesCount)console.error(`PDFLinkService._goToDestinationHelper: "${s}" is not a valid page number, for dest="${e}".`);else{if(this.pdfHistory){this.pdfHistory.pushCurrentPosition();this.pdfHistory.push({namedDest:t,explicitDest:i,pageNumber:s})}this.pdfViewer.scrollPageIntoView({pageNumber:s,destArray:i,ignoreDestinationZoom:this._ignoreDestinationZoom})}}async goToDestination(e){if(!this.pdfDocument)return;let t,i;if("string"==typeof e){t=e;i=await this.pdfDocument.getDestination(e)}else{t=null;i=await e}Array.isArray(i)?this._goToDestinationHelper(e,t,i):console.error(`PDFLinkService.goToDestination: "${i}" is not a valid destination array, for dest="${e}".`)}goToPage(e){if(!this.pdfDocument)return;const t="string"==typeof e&&this.pdfViewer.pageLabelToPageNumber(e)||0|e;if(Number.isInteger(t)&&t>0&&t<=this.pagesCount){if(this.pdfHistory){this.pdfHistory.pushCurrentPosition();this.pdfHistory.pushPage(t)}this.pdfViewer.scrollPageIntoView({pageNumber:t})}else console.error(`PDFLinkService.goToPage: "${e}" is not a valid page.`)}addLinkAttributes(e,t,i=!1){(0,n.addLinkAttributes)(e,{url:t,target:i?n.LinkTarget.BLANK:this.externalLinkTarget,rel:this.externalLinkRel,enabled:this.externalLinkEnabled})}getDestinationHash(e){if("string"==typeof e){if(e.length>0)return this.getAnchorUrl("#"+escape(e))}else if(Array.isArray(e)){const t=JSON.stringify(e);if(t.length>0)return this.getAnchorUrl("#"+escape(t))}return this.getAnchorUrl("")}getAnchorUrl(e){return(this.baseUrl||"")+e}setHash(e){if(!this.pdfDocument)return;let t,i;if(e.includes("=")){const n=(0,s.parseQueryString)(e);n.has("search")&&this.eventBus.dispatch("findfromurlhash",{source:this,query:n.get("search").replace(/"/g,""),phraseSearch:"true"===n.get("phrase")});n.has("page")&&(t=0|n.get("page")||1);if(n.has("zoom")){const e=n.get("zoom").split(","),t=e[0],s=parseFloat(t);t.includes("Fit")?"Fit"===t||"FitB"===t?i=[null,{name:t}]:"FitH"===t||"FitBH"===t||"FitV"===t||"FitBV"===t?i=[null,{name:t},e.length>1?0|e[1]:null]:"FitR"===t?5!==e.length?console.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):i=[null,{name:t},0|e[1],0|e[2],0|e[3],0|e[4]]:console.error(`PDFLinkService.setHash: "${t}" is not a valid zoom value.`):i=[null,{name:"XYZ"},e.length>1?0|e[1]:null,e.length>2?0|e[2]:null,s?s/100:t]}i?this.pdfViewer.scrollPageIntoView({pageNumber:t||this.page,destArray:i,allowNegativeOffset:!0}):t&&(this.page=t);n.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:n.get("pagemode")});n.has("nameddest")&&this.goToDestination(n.get("nameddest"))}else{i=unescape(e);try{i=JSON.parse(i);Array.isArray(i)||(i=i.toString())}catch(e){}if("string"==typeof i||function isValidExplicitDestination(e){if(!Array.isArray(e))return!1;const t=e.length;if(t<2)return!1;const i=e[0];if(!("object"==typeof i&&Number.isInteger(i.num)&&Number.isInteger(i.gen)||Number.isInteger(i)&&i>=0))return!1;const n=e[1];if("object"!=typeof n||"string"!=typeof n.name)return!1;let s=!0;switch(n.name){case"XYZ":if(5!==t)return!1;break;case"Fit":case"FitB":return 2===t;case"FitH":case"FitBH":case"FitV":case"FitBV":if(3!==t)return!1;break;case"FitR":if(6!==t)return!1;s=!1;break;default:return!1}for(let i=2;i<t;i++){const t=e[i];if(!("number"==typeof t||s&&null===t))return!1}return!0}(i)){this.goToDestination(i);return}console.error(`PDFLinkService.setHash: "${unescape(e)}" is not a valid destination.`)}}executeNamedAction(e){switch(e){case"GoBack":this.pdfHistory?.back();break;case"GoForward":this.pdfHistory?.forward();break;case"NextPage":this.pdfViewer.nextPage();break;case"PrevPage":this.pdfViewer.previousPage();break;case"LastPage":this.page=this.pagesCount;break;case"FirstPage":this.page=1}this.eventBus.dispatch("namedaction",{source:this,action:e})}cachePageRef(e,t){if(!t)return;const i=0===t.gen?`${t.num}R`:`${t.num}R${t.gen}`;this._pagesRefCache[i]=e}_cachedPageNumber(e){const t=0===e.gen?`${e.num}R`:`${e.num}R${e.gen}`;return this._pagesRefCache?.[t]||null}isPageVisible(e){return this.pdfViewer.isPageVisible(e)}isPageCached(e){return this.pdfViewer.isPageCached(e)}};t.SimpleLinkService=class SimpleLinkService{constructor(){this.externalLinkEnabled=!0}get pagesCount(){return 0}get page(){return 0}set page(e){}get rotation(){return 0}set rotation(e){}async goToDestination(e){}goToPage(e){}addLinkAttributes(e,t,i=!1){(0,n.addLinkAttributes)(e,{url:t,enabled:this.externalLinkEnabled})}getDestinationHash(e){return"#"}getAnchorUrl(e){return"#"}setHash(e){}executeNamedAction(e){}cachePageRef(e,t){}isPageVisible(e){return!0}isPageCached(e){return!0}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFOutlineViewer=void 0;var n=i(11),s=i(4),r=i(3);class PDFOutlineViewer extends n.BaseTreeViewer{constructor(e){super(e);this.linkService=e.linkService;this.eventBus._on("toggleoutlinetree",this._toggleAllTreeItems.bind(this));this.eventBus._on("currentoutlineitem",this._currentOutlineItem.bind(this));this.eventBus._on("pagechanging",(e=>{this._currentPageNumber=e.pageNumber}));this.eventBus._on("pagesloaded",(e=>{this._isPagesLoaded=!!e.pagesCount;this._currentOutlineItemCapability&&!this._currentOutlineItemCapability.settled&&this._currentOutlineItemCapability.resolve(this._isPagesLoaded)}));this.eventBus._on("sidebarviewchanged",(e=>{this._sidebarView=e.view}))}reset(){super.reset();this._outline=null;this._pageNumberToDestHashCapability=null;this._currentPageNumber=1;this._isPagesLoaded=!1;this._currentOutlineItemCapability&&!this._currentOutlineItemCapability.settled&&this._currentOutlineItemCapability.resolve(!1);this._currentOutlineItemCapability=null}_dispatchEvent(e){this._currentOutlineItemCapability=(0,s.createPromiseCapability)();0===e||this._pdfDocument?.loadingParams.disableAutoFetch?this._currentOutlineItemCapability.resolve(!1):this._isPagesLoaded&&this._currentOutlineItemCapability.resolve(!0);this.eventBus.dispatch("outlineloaded",{source:this,outlineCount:e,currentOutlineItemPromise:this._currentOutlineItemCapability.promise})}_bindLink(e,{url:t,newWindow:i,dest:n}){const{linkService:s}=this;if(t)s.addLinkAttributes(e,t,i);else{e.href=s.getDestinationHash(n);e.onclick=e=>{this._updateCurrentTreeItem(e.target.parentNode);n&&s.goToDestination(n);return!1}}}_setStyles(e,{bold:t,italic:i}){t&&(e.style.fontWeight="bold");i&&(e.style.fontStyle="italic")}_addToggleButton(e,{count:t,items:i}){let n=!1;if(t<0){let e=i.length;if(e>0){const t=[...i];for(;t.length>0;){const{count:i,items:n}=t.shift();if(i>0&&n.length>0){e+=n.length;t.push(...n)}}}Math.abs(t)===e&&(n=!0)}super._addToggleButton(e,n)}_toggleAllTreeItems(){this._outline&&super._toggleAllTreeItems()}render({outline:e,pdfDocument:t}){this._outline&&this.reset();this._outline=e||null;this._pdfDocument=t||null;if(!e){this._dispatchEvent(0);return}const i=document.createDocumentFragment(),n=[{parent:i,items:e}];let s=0,r=!1;for(;n.length>0;){const e=n.shift();for(const t of e.items){const i=document.createElement("div");i.className="treeItem";const a=document.createElement("a");this._bindLink(a,t);this._setStyles(a,t);a.textContent=this._normalizeTextContent(t.title);i.appendChild(a);if(t.items.length>0){r=!0;this._addToggleButton(i,t);const e=document.createElement("div");e.className="treeItems";i.appendChild(e);n.push({parent:e,items:t.items})}e.parent.appendChild(i);s++}}this._finishRendering(i,s,r)}async _currentOutlineItem(){if(!this._isPagesLoaded)throw new Error("_currentOutlineItem: All pages have not been loaded.");if(!this._outline||!this._pdfDocument)return;const e=await this._getPageNumberToDestHash(this._pdfDocument);if(e){this._updateCurrentTreeItem(null);if(this._sidebarView===r.SidebarView.OUTLINE)for(let t=this._currentPageNumber;t>0;t--){const i=e.get(t);if(!i)continue;const n=this.container.querySelector(`a[href="${i}"]`);if(n){this._scrollToCurrentTreeItem(n.parentNode);break}}}}async _getPageNumberToDestHash(e){if(this._pageNumberToDestHashCapability)return this._pageNumberToDestHashCapability.promise;this._pageNumberToDestHashCapability=(0,s.createPromiseCapability)();const t=new Map,i=new Map,n=[{nesting:0,items:this._outline}];for(;n.length>0;){const s=n.shift(),r=s.nesting;for(const{dest:a,items:o}of s.items){let s,l;if("string"==typeof a){s=await e.getDestination(a);if(e!==this._pdfDocument)return null}else s=a;if(Array.isArray(s)){const[n]=s;if("object"==typeof n&&null!==n){l=this.linkService._cachedPageNumber(n);if(!l)try{l=await e.getPageIndex(n)+1;if(e!==this._pdfDocument)return null;this.linkService.cachePageRef(l,n)}catch(e){}}else Number.isInteger(n)&&(l=n+1);if(Number.isInteger(l)&&(!t.has(l)||r>i.get(l))){const e=this.linkService.getDestinationHash(a);t.set(l,e);i.set(l,r)}}o.length>0&&n.push({nesting:r+1,items:o})}}this._pageNumberToDestHashCapability.resolve(t.size>0?t:null);return this._pageNumberToDestHashCapability.promise}}t.PDFOutlineViewer=PDFOutlineViewer},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFPresentationMode=void 0;var n=i(3);const s="pdfPresentationMode",r="pdfPresentationModeControls",a=Math.PI/6;t.PDFPresentationMode=class PDFPresentationMode{constructor({container:e,pdfViewer:t,eventBus:i}){this.container=e;this.pdfViewer=t;this.eventBus=i;this.active=!1;this.args=null;this.contextMenuOpen=!1;this.mouseScrollTimeStamp=0;this.mouseScrollDelta=0;this.touchSwipeState=null}request(){if(this.switchInProgress||this.active||!this.pdfViewer.pagesCount)return!1;this._addFullscreenChangeListeners();this._setSwitchInProgress();this._notifyStateChange();if(this.container.requestFullscreen)this.container.requestFullscreen();else if(this.container.mozRequestFullScreen)this.container.mozRequestFullScreen();else{if(!this.container.webkitRequestFullscreen)return!1;document.body.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);this._prepareFullscreenMode()}this.args={page:this.pdfViewer.currentPageNumber,previousScale:this.pdfViewer.currentScaleValue};return!0}_mouseWheel(e){if(!this.active)return;e.preventDefault();const t=(0,n.normalizeWheelEventDelta)(e),i=Date.now(),s=this.mouseScrollTimeStamp;if(!(i>s&&i-s<50)){(this.mouseScrollDelta>0&&t<0||this.mouseScrollDelta<0&&t>0)&&this._resetMouseScrollState();this.mouseScrollDelta+=t;if(Math.abs(this.mouseScrollDelta)>=.1){const e=this.mouseScrollDelta;this._resetMouseScrollState();(e>0?this.pdfViewer.previousPage():this.pdfViewer.nextPage())&&(this.mouseScrollTimeStamp=i)}}}get isFullscreen(){return!!(document.fullscreenElement||document.mozFullScreen||document.webkitIsFullScreen)}_notifyStateChange(){let e=n.PresentationModeState.NORMAL;this.switchInProgress?e=n.PresentationModeState.CHANGING:this.active&&(e=n.PresentationModeState.FULLSCREEN);this.eventBus.dispatch("presentationmodechanged",{source:this,state:e})}_setSwitchInProgress(){this.switchInProgress&&clearTimeout(this.switchInProgress);this.switchInProgress=setTimeout((()=>{this._removeFullscreenChangeListeners();delete this.switchInProgress;this._notifyStateChange()}),1500)}_resetSwitchInProgress(){if(this.switchInProgress){clearTimeout(this.switchInProgress);delete this.switchInProgress}}_enter(){this.active=!0;this._resetSwitchInProgress();this._notifyStateChange();this.container.classList.add(s);setTimeout((()=>{this.pdfViewer.currentPageNumber=this.args.page;this.pdfViewer.currentScaleValue="page-fit"}),0);this._addWindowListeners();this._showControls();this.contextMenuOpen=!1;window.getSelection().removeAllRanges()}_exit(){this._tidyUpFullscreenMode();const e=this.pdfViewer.currentPageNumber;this.container.classList.remove(s);setTimeout((()=>{this.active=!1;this._removeFullscreenChangeListeners();this._notifyStateChange();this.pdfViewer.currentScaleValue=this.args.previousScale;this.pdfViewer.currentPageNumber=e;this.args=null}),0);this._removeWindowListeners();this._hideControls();this._resetMouseScrollState();this.contextMenuOpen=!1}_prepareFullscreenMode(){const e=document.getElementsByClassName("zoom")[0].parentElement,t=e.parentElement;this.ngxContainer=t;for(let i=0;i<t.childElementCount;i++)t.children.item(i)===e&&(this.ngxContainerIndex=i);t.removeChild(e);document.body.append(e);const i=document.body.children;for(let t=0;t<i.length;t++){const n=i.item(t);n!==e&&n instanceof HTMLElement&&n.classList.add("hidden-by-fullscreen")}document.getElementById("sidebarContainer").classList.add("hidden-by-fullscreen");document.getElementsByClassName("toolbar")[0].classList.add("hidden-by-fullscreen")}_tidyUpFullscreenMode(){if(this.ngxContainer){const e=document.getElementsByClassName("zoom")[0].parentElement;document.body.removeChild(e);this.ngxContainerIndex>=this.ngxContainer.childElementCount?this.ngxContainer.append(e):this.ngxContainer.insertBefore(e,this.ngxContainer.children.item(this.ngxContainerIndex));this.ngxContainer=void 0;const t=document.body.children;for(let i=0;i<t.length;i++){const n=t.item(i);n!==e&&n instanceof HTMLElement&&n.classList.contains("hidden-by-fullscreen")&&n.classList.remove("hidden-by-fullscreen")}document.getElementById("sidebarContainer").classList.remove("hidden-by-fullscreen");document.getElementsByClassName("toolbar")[0].classList.remove("hidden-by-fullscreen")}}_mouseDown(e){if(this.contextMenuOpen){this.contextMenuOpen=!1;e.preventDefault()}else if(0===e.button){if(!(e.target.href&&e.target.classList.contains("internalLink"))){e.preventDefault();e.shiftKey?this.pdfViewer.previousPage():this.pdfViewer.nextPage()}}}_contextMenu(){this.contextMenuOpen=!0}_showControls(){this.controlsTimeout?clearTimeout(this.controlsTimeout):this.container.classList.add(r);this.controlsTimeout=setTimeout((()=>{this.container.classList.remove(r);delete this.controlsTimeout}),3e3)}_hideControls(){if(this.controlsTimeout){clearTimeout(this.controlsTimeout);this.container.classList.remove(r);delete this.controlsTimeout}}_resetMouseScrollState(){this.mouseScrollTimeStamp=0;this.mouseScrollDelta=0}_touchSwipe(e){if(this.active)if(e.touches.length>1)this.touchSwipeState=null;else switch(e.type){case"touchstart":this.touchSwipeState={startX:e.touches[0].pageX,startY:e.touches[0].pageY,endX:e.touches[0].pageX,endY:e.touches[0].pageY};break;case"touchmove":if(null===this.touchSwipeState)return;this.touchSwipeState.endX=e.touches[0].pageX;this.touchSwipeState.endY=e.touches[0].pageY;e.preventDefault();break;case"touchend":if(null===this.touchSwipeState)return;let t=0;const i=this.touchSwipeState.endX-this.touchSwipeState.startX,n=this.touchSwipeState.endY-this.touchSwipeState.startY,s=Math.abs(Math.atan2(n,i));Math.abs(i)>50&&(s<=a||s>=Math.PI-a)?t=i:Math.abs(n)>50&&Math.abs(s-Math.PI/2)<=a&&(t=n);t>0?this.pdfViewer.previousPage():t<0&&this.pdfViewer.nextPage()}}_addWindowListeners(){this.showControlsBind=this._showControls.bind(this);this.mouseDownBind=this._mouseDown.bind(this);this.mouseWheelBind=this._mouseWheel.bind(this);this.resetMouseScrollStateBind=this._resetMouseScrollState.bind(this);this.contextMenuBind=this._contextMenu.bind(this);this.touchSwipeBind=this._touchSwipe.bind(this);window.addEventListener("mousemove",this.showControlsBind);window.addEventListener("mousedown",this.mouseDownBind);window.addEventListener("wheel",this.mouseWheelBind,{passive:!1});window.addEventListener("keydown",this.resetMouseScrollStateBind);window.addEventListener("contextmenu",this.contextMenuBind);window.addEventListener("touchstart",this.touchSwipeBind);window.addEventListener("touchmove",this.touchSwipeBind);window.addEventListener("touchend",this.touchSwipeBind)}_removeWindowListeners(){window.removeEventListener("mousemove",this.showControlsBind);window.removeEventListener("mousedown",this.mouseDownBind);window.removeEventListener("wheel",this.mouseWheelBind,{passive:!1});window.removeEventListener("keydown",this.resetMouseScrollStateBind);window.removeEventListener("contextmenu",this.contextMenuBind);window.removeEventListener("touchstart",this.touchSwipeBind);window.removeEventListener("touchmove",this.touchSwipeBind);window.removeEventListener("touchend",this.touchSwipeBind);delete this.showControlsBind;delete this.mouseDownBind;delete this.mouseWheelBind;delete this.resetMouseScrollStateBind;delete this.contextMenuBind;delete this.touchSwipeBind}_fullscreenChange(){this.isFullscreen?this._enter():this._exit()}_addFullscreenChangeListeners(){this.fullscreenChangeBind=this._fullscreenChange.bind(this);window.addEventListener("fullscreenchange",this.fullscreenChangeBind);window.addEventListener("mozfullscreenchange",this.fullscreenChangeBind);window.addEventListener("webkitfullscreenchange",this.fullscreenChangeBind)}_removeFullscreenChangeListeners(){window.removeEventListener("fullscreenchange",this.fullscreenChangeBind);window.removeEventListener("mozfullscreenchange",this.fullscreenChangeBind);window.removeEventListener("webkitfullscreenchange",this.fullscreenChangeBind);delete this.fullscreenChangeBind}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFScriptingManager=void 0;var n=i(4),s=i(3),r=i(7);t.PDFScriptingManager=class PDFScriptingManager{constructor({eventBus:e,sandboxBundleSrc:t=null,scriptingFactory:i=null,docPropertiesLookup:n=null}){this._pdfDocument=null;this._pdfViewer=null;this._closeCapability=null;this._destroyCapability=null;this._scripting=null;this._mouseState=Object.create(null);this._ready=!1;this._eventBus=e;this._sandboxBundleSrc=t;this._scriptingFactory=i;this._docPropertiesLookup=n}setViewer(e){this._pdfViewer=e}async setDocument(e){this._pdfDocument&&await this._destroyScripting();this._pdfDocument=e;if(!e)return;const[t,i,n]=await Promise.all([e.getFieldObjects(),e.getCalculationOrderIds(),e.getJSActions()]);if(t||n){if(e===this._pdfDocument){try{this._scripting=this._createScripting()}catch(e){console.error(`PDFScriptingManager.setDocument: "${e?.message}".`);await this._destroyScripting();return}this._internalEvents.set("updatefromsandbox",(e=>{e?.source===window&&this._updateFromSandbox(e.detail)}));this._internalEvents.set("dispatcheventinsandbox",(e=>{this._scripting?.dispatchEventInSandbox(e.detail)}));this._internalEvents.set("pagechanging",(({pageNumber:e,previous:t})=>{if(e!==t){this._dispatchPageClose(t);this._dispatchPageOpen(e)}}));this._internalEvents.set("pagerendered",(({pageNumber:e})=>{this._pageOpenPending.has(e)&&e===this._pdfViewer.currentPageNumber&&this._dispatchPageOpen(e)}));this._internalEvents.set("pagesdestroy",(async e=>{await this._dispatchPageClose(this._pdfViewer.currentPageNumber);await(this._scripting?.dispatchEventInSandbox({id:"doc",name:"WillClose"}));this._closeCapability?.resolve()}));this._domEvents.set("mousedown",(e=>{this._mouseState.isDown=!0}));this._domEvents.set("mouseup",(e=>{this._mouseState.isDown=!1}));for(const[e,t]of this._internalEvents)this._eventBus._on(e,t);for(const[e,t]of this._domEvents)window.addEventListener(e,t);try{const s=await this._getDocProperties();if(e!==this._pdfDocument)return;await this._scripting.createSandbox({objects:t,calculationOrder:i,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...s,actions:n}});this._eventBus.dispatch("sandboxcreated",{source:this})}catch(e){console.error(`PDFScriptingManager.setDocument: "${e?.message}".`);await this._destroyScripting();return}await(this._scripting?.dispatchEventInSandbox({id:"doc",name:"Open"}));await this._dispatchPageOpen(this._pdfViewer.currentPageNumber,!0);Promise.resolve().then((()=>{e===this._pdfDocument&&(this._ready=!0)}))}}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 mouseState(){return this._mouseState}get destroyPromise(){return this._destroyCapability?.promise||null}get ready(){return this._ready}get _internalEvents(){return(0,n.shadow)(this,"_internalEvents",new Map)}get _domEvents(){return(0,n.shadow)(this,"_domEvents",new Map)}get _pageOpenPending(){return(0,n.shadow)(this,"_pageOpenPending",new Set)}get _visitedPages(){return(0,n.shadow)(this,"_visitedPages",new Map)}async _updateFromSandbox(e){const t=this._pdfViewer.isInPresentationMode||this._pdfViewer.isChangingPresentationMode,{id:i,siblings:n,command:r,value:a}=e;if(!i){switch(r){case"clear":console.clear();break;case"error":console.error(a);break;case"layout":this._pdfViewer.spreadMode=(0,s.apiPageLayoutToSpreadMode)(a);break;case"page-num":this._pdfViewer.currentPageNumber=a+1;break;case"print":await this._pdfViewer.pagesPromise;this._eventBus.dispatch("print",{source:this});break;case"println":console.log(a);break;case"zoom":if(t)return;this._pdfViewer.currentScaleValue=a;break;case"SaveAs":this._eventBus.dispatch("save",{source:this});break;case"FirstPage":this._pdfViewer.currentPageNumber=1;break;case"LastPage":this._pdfViewer.currentPageNumber=this._pdfViewer.pagesCount;break;case"NextPage":this._pdfViewer.nextPage();break;case"PrevPage":this._pdfViewer.previousPage();break;case"ZoomViewIn":if(t)return;this._pdfViewer.increaseScale();break;case"ZoomViewOut":if(t)return;this._pdfViewer.decreaseScale()}return}if(t&&e.focus)return;delete e.id;delete e.siblings;const o=n?[i,...n]:[i];for(const t of o){const i=document.getElementById(t);i?i.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:e})):this._pdfDocument?.annotationStorage.setValue(t,void 0,e)}}async _dispatchPageOpen(e,t=!1){const i=this._pdfDocument,s=this._visitedPages;t&&(this._closeCapability=(0,n.createPromiseCapability)());if(!this._closeCapability)return;const a=this._pdfViewer.getPageView(e-1);if(a?.renderingState!==r.RenderingStates.FINISHED){this._pageOpenPending.add(e);return}this._pageOpenPending.delete(e);const o=(async()=>{const t=await(s.has(e)?null:a.pdfPage?.getJSActions());i===this._pdfDocument&&await(this._scripting?.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:e,actions:t}))})();s.set(e,o)}async _dispatchPageClose(e){const t=this._pdfDocument,i=this._visitedPages;if(!this._closeCapability)return;if(this._pageOpenPending.has(e))return;const n=i.get(e);if(n){i.set(e,null);await n;t===this._pdfDocument&&await(this._scripting?.dispatchEventInSandbox({id:"page",name:"PageClose",pageNumber:e}))}}async _getDocProperties(){if(this._docPropertiesLookup)return this._docPropertiesLookup(this._pdfDocument);throw new Error("_getDocProperties: Unable to lookup properties.")}_createScripting(){this._destroyCapability=(0,n.createPromiseCapability)();if(this._scripting)throw new Error("_createScripting: Scripting already exists.");if(this._scriptingFactory)return this._scriptingFactory.createScripting({sandboxBundleSrc:this._sandboxBundleSrc});throw new Error("_createScripting: Cannot create scripting.")}async _destroyScripting(){if(this._scripting){if(this._closeCapability){await Promise.race([this._closeCapability.promise,new Promise((e=>{setTimeout(e,1e3)}))]).catch((e=>{}));this._closeCapability=null}this._pdfDocument=null;try{await this._scripting.destroySandbox()}catch(e){}for(const[e,t]of this._internalEvents)this._eventBus._off(e,t);this._internalEvents.clear();for(const[e,t]of this._domEvents)window.removeEventListener(e,t);this._domEvents.clear();this._pageOpenPending.clear();this._visitedPages.clear();this._scripting=null;delete this._mouseState.isDown;this._ready=!1;this._destroyCapability?.resolve()}else{this._pdfDocument=null;this._destroyCapability?.resolve()}}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFSidebar=void 0;var n=i(3),s=i(7);const r="pdfSidebarNotification";t.PDFSidebar=class PDFSidebar{constructor({elements:e,pdfViewer:t,pdfThumbnailViewer:i,eventBus:s,l10n:r}){this.isOpen=!1;this.active=n.SidebarView.THUMBS;this.isInitialViewSet=!1;this.onToggled=null;this.pdfViewer=t;this.pdfThumbnailViewer=i;this.outerContainer=e.outerContainer;this.viewerContainer=e.viewerContainer;this.toggleButton=e.toggleButton;this.thumbnailButton=e.thumbnailButton;this.outlineButton=e.outlineButton;this.attachmentsButton=e.attachmentsButton;this.layersButton=e.layersButton;this.thumbnailView=e.thumbnailView;this.outlineView=e.outlineView;this.attachmentsView=e.attachmentsView;this.layersView=e.layersView;this._outlineOptionsContainer=e.outlineOptionsContainer;this._currentOutlineItemButton=e.currentOutlineItemButton;this.eventBus=s;this.l10n=r;this._addEventListeners()}reset(){this.isInitialViewSet=!1;this._hideUINotification(!0);this.switchView(n.SidebarView.THUMBS);this.outlineButton.disabled=!1;this.attachmentsButton.disabled=!1;this.layersButton.disabled=!1;this.outlineButton.hidden=!1;this.attachmentsButton.hidden=!1;this.layersButton.hidden=!1;this._currentOutlineItemButton.disabled=!0}get visibleView(){return this.isOpen?this.active:n.SidebarView.NONE}get isThumbnailViewVisible(){return this.isOpen&&this.active===n.SidebarView.THUMBS}get isOutlineViewVisible(){return this.isOpen&&this.active===n.SidebarView.OUTLINE}get isAttachmentsViewVisible(){return this.isOpen&&this.active===n.SidebarView.ATTACHMENTS}get isLayersViewVisible(){return this.isOpen&&this.active===n.SidebarView.LAYERS}setInitialView(e=n.SidebarView.NONE){if(!this.isInitialViewSet){this.isInitialViewSet=!0;e!==n.SidebarView.NONE&&e!==n.SidebarView.UNKNOWN&&this._switchView(e,!0)||this._dispatchEvent()}}switchView(e,t=!1){this._switchView(e,t)}_switchView(e,t=!1){const i=e!==this.active;let s=!1;switch(e){case n.SidebarView.NONE:if(this.isOpen){this.close();return!0}return!1;case n.SidebarView.THUMBS:this.isOpen&&i&&(s=!0);break;case n.SidebarView.OUTLINE:if(this.outlineButton.disabled)return!1;break;case n.SidebarView.ATTACHMENTS:if(this.attachmentsButton.disabled)return!1;break;case n.SidebarView.LAYERS:if(this.layersButton.disabled)return!1;break;default:console.error(`PDFSidebar._switchView: "${e}" is not a valid view.`);return!1}this.active=e;this.thumbnailButton.classList.toggle("toggled",e===n.SidebarView.THUMBS);this.outlineButton.classList.toggle("toggled",e===n.SidebarView.OUTLINE);this.attachmentsButton.classList.toggle("toggled",e===n.SidebarView.ATTACHMENTS);this.layersButton.classList.toggle("toggled",e===n.SidebarView.LAYERS);this.thumbnailView.classList.toggle("hidden",e!==n.SidebarView.THUMBS);this.outlineView.classList.toggle("hidden",e!==n.SidebarView.OUTLINE);this.attachmentsView.classList.toggle("hidden",e!==n.SidebarView.ATTACHMENTS);this.layersView.classList.toggle("hidden",e!==n.SidebarView.LAYERS);this._outlineOptionsContainer.classList.toggle("hidden",e!==n.SidebarView.OUTLINE);if(t&&!this.isOpen){this.open();return!0}if(s){this._updateThumbnailViewer();this._forceRendering()}i&&this._dispatchEvent();return i}open(){if(!this.isOpen){this.isOpen=!0;this.toggleButton.classList.add("toggled");this.toggleButton.setAttribute("aria-expanded","true");this.outerContainer.classList.add("sidebarMoving","sidebarOpen");this.active===n.SidebarView.THUMBS&&this._updateThumbnailViewer();this._forceRendering();this._dispatchEvent();this._hideUINotification()}}close(){if(this.isOpen){this.isOpen=!1;this.toggleButton.classList.remove("toggled");this.toggleButton.setAttribute("aria-expanded","false");this.outerContainer.classList.add("sidebarMoving");this.outerContainer.classList.remove("sidebarOpen");this._forceRendering();this._dispatchEvent()}}toggle(){this.isOpen?this.close():this.open()}_dispatchEvent(){this.eventBus.dispatch("sidebarviewchanged",{source:this,view:this.visibleView})}_forceRendering(){if(this.onToggled)this.onToggled();else{this.pdfViewer.forceRendering();this.pdfThumbnailViewer.forceRendering()}}_updateThumbnailViewer(){const{pdfViewer:e,pdfThumbnailViewer:t}=this,i=e.pagesCount;for(let n=0;n<i;n++){const i=e.getPageView(n);if(i?.renderingState===s.RenderingStates.FINISHED){t.getThumbnail(n).setImage(i)}}t.scrollThumbnailIntoView(e.currentPageNumber)}_showUINotification(){this.l10n.get("toggle_sidebar_notification2.title").then((e=>{this.toggleButton.title=e}));this.isOpen||this.toggleButton.classList.add(r)}_hideUINotification(e=!1){(this.isOpen||e)&&this.toggleButton.classList.remove(r);e&&this.l10n.get("toggle_sidebar.title").then((e=>{this.toggleButton.title=e}))}_addEventListeners(){this.viewerContainer.addEventListener("transitionend",(e=>{e.target===this.viewerContainer&&this.outerContainer.classList.remove("sidebarMoving")}));this.toggleButton.addEventListener("click",(()=>{this.toggle()}));this.thumbnailButton.addEventListener("click",(()=>{this.switchView(n.SidebarView.THUMBS)}));this.outlineButton.addEventListener("click",(()=>{this.switchView(n.SidebarView.OUTLINE)}));this.outlineButton.addEventListener("dblclick",(()=>{this.eventBus.dispatch("toggleoutlinetree",{source:this})}));this.attachmentsButton.addEventListener("click",(()=>{this.switchView(n.SidebarView.ATTACHMENTS)}));this.layersButton.addEventListener("click",(()=>{this.switchView(n.SidebarView.LAYERS)}));this.layersButton.addEventListener("dblclick",(()=>{this.eventBus.dispatch("resetlayers",{source:this})}));this._currentOutlineItemButton.addEventListener("click",(()=>{this.eventBus.dispatch("currentoutlineitem",{source:this})}));const onTreeLoaded=(e,t,i)=>{t.disabled=!e;t.hidden=!e;e?this._showUINotification():this.active===i&&this.switchView(n.SidebarView.THUMBS)};this.eventBus._on("outlineloaded",(e=>{onTreeLoaded(e.outlineCount,this.outlineButton,n.SidebarView.OUTLINE);e.enableCurrentOutlineItemButton&&e.currentOutlineItemPromise&&e.currentOutlineItemPromise.then((e=>{this.isInitialViewSet&&(this._currentOutlineItemButton.disabled=!e)}))}));this.eventBus._on("attachmentsloaded",(e=>{onTreeLoaded(e.attachmentsCount,this.attachmentsButton,n.SidebarView.ATTACHMENTS)}));this.eventBus._on("layersloaded",(e=>{onTreeLoaded(e.layersCount,this.layersButton,n.SidebarView.LAYERS)}));this.eventBus._on("presentationmodechanged",(e=>{e.state===n.PresentationModeState.NORMAL&&this.isThumbnailViewVisible&&this._updateThumbnailViewer()}))}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFSidebarResizer=void 0;const i="sidebarResizing";t.PDFSidebarResizer=class PDFSidebarResizer{constructor(e,t,i){this.isRTL=!1;this.sidebarOpen=!1;this.doc=document.documentElement;this._width=null;this._outerContainerWidth=null;this._boundEvents=Object.create(null);this.outerContainer=e.outerContainer;this.resizer=e.resizer;this.eventBus=t;i.getDirection().then((e=>{this.isRTL="rtl"===e}));this._addEventListeners()}get outerContainerWidth(){return this._outerContainerWidth||=this.outerContainer.clientWidth}_updateWidth(e=0){const t=Math.floor(this.outerContainerWidth/2);e>t&&(e=t);e<200&&(e=200);if(e===this._width)return!1;this._width=e;this.doc.style.setProperty("--sidebar-width",`${e}px`);return!0}_mouseMove(e){let t=e.clientX;this.isRTL&&(t=this.outerContainerWidth-t);this._updateWidth(t)}_mouseUp(e){this.outerContainer.classList.remove(i);this.eventBus.dispatch("resize",{source:this});const t=this._boundEvents;window.removeEventListener("mousemove",t.mouseMove);window.removeEventListener("mouseup",t.mouseUp)}_addEventListeners(){const e=this._boundEvents;e.mouseMove=this._mouseMove.bind(this);e.mouseUp=this._mouseUp.bind(this);this.resizer.addEventListener("mousedown",(t=>{if(0===t.button){this.outerContainer.classList.add(i);window.addEventListener("mousemove",e.mouseMove);window.addEventListener("mouseup",e.mouseUp)}}));this.eventBus._on("sidebarviewchanged",(e=>{this.sidebarOpen=!!e?.view}));this.eventBus._on("resize",(e=>{if(e?.source!==window)return;this._outerContainerWidth=null;if(!this._width)return;if(!this.sidebarOpen){this._updateWidth(this._width);return}this.outerContainer.classList.add(i);const t=this._updateWidth(this._width);Promise.resolve().then((()=>{this.outerContainer.classList.remove(i);t&&this.eventBus.dispatch("resize",{source:this})}))}))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFThumbnailViewer=void 0;var n=i(3),s=i(27),r=i(7);const a="selected";t.PDFThumbnailViewer=class PDFThumbnailViewer{constructor({container:e,eventBus:t,linkService:i,renderingQueue:s,l10n:r}){this.container=e;this.linkService=i;this.renderingQueue=s;this.l10n=r;this.scroll=(0,n.watchScroll)(this.container,this._scrollUpdated.bind(this));this._resetView();t._on("optionalcontentconfigchanged",(()=>{this._setImageDisabled=!0}))}_scrollUpdated(){this.renderingQueue.renderHighestPriority()}getThumbnail(e){return this._thumbnails[e]}_getVisibleThumbs(){return(0,n.getVisibleElements)({scrollEl:this.container,views:this._thumbnails})}scrollThumbnailIntoView(e){if(!this.pdfDocument)return;const t=this._thumbnails[e-1];if(!t){console.error('scrollThumbnailIntoView: Invalid "pageNumber" parameter.');return}if(e!==this._currentPageNumber){this._thumbnails[this._currentPageNumber-1].div.classList.remove(a);t.div.classList.add(a)}const i=this._getVisibleThumbs(),s=i.views.length;if(s>0){const r=i.first.id,a=s>1?i.last.id:r;let o=!1;e<=r||e>=a?o=!0:i.views.some((function(t){if(t.id!==e)return!1;o=t.percent<100;return!0}));o&&(0,n.scrollIntoView)(t.div,{top:-19})}this._currentPageNumber=e}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!(0,n.isValidRotation)(e))throw new Error("Invalid thumbnails rotation angle.");if(!this.pdfDocument)return;if(this._pagesRotation===e)return;this._pagesRotation=e;const t={rotation:e};for(const e of this._thumbnails)e.update(t)}cleanup(){for(let e=0,t=this._thumbnails.length;e<t;e++)this._thumbnails[e]&&this._thumbnails[e].renderingState!==r.RenderingStates.FINISHED&&this._thumbnails[e].reset();s.TempImageFactory.destroyCanvas()}_resetView(){this._thumbnails=[];this._currentPageNumber=1;this._pageLabels=null;this._pagesRotation=0;this._optionalContentConfigPromise=null;this._pagesRequests=new WeakMap;this._setImageDisabled=!1;this.container.textContent=""}setDocument(e){if(this.pdfDocument){this._cancelRendering();this._resetView()}this.pdfDocument=e;if(!e)return;const t=e.getPage(1),i=e.getOptionalContentConfig();t.then((t=>{this._optionalContentConfigPromise=i;const n=e.numPages,r=t.getViewport({scale:1}),checkSetImageDisabled=()=>this._setImageDisabled;for(let e=1;e<=n;++e){const t=new s.PDFThumbnailView({container:this.container,id:e,defaultViewport:r.clone(),optionalContentConfigPromise:i,linkService:this.linkService,renderingQueue:this.renderingQueue,checkSetImageDisabled:checkSetImageDisabled,l10n:this.l10n});this._thumbnails.push(t)}const o=this._thumbnails[0];o&&o.setPdfPage(t);this._thumbnails[this._currentPageNumber-1].div.classList.add(a)})).catch((e=>{console.error("Unable to initialize thumbnail viewer",e)}))}_cancelRendering(){for(let e=0,t=this._thumbnails.length;e<t;e++)this._thumbnails[e]&&this._thumbnails[e].cancelRendering()}setPageLabels(e){if(this.pdfDocument){if(e)if(Array.isArray(e)&&this.pdfDocument.numPages===e.length)this._pageLabels=e;else{this._pageLabels=null;console.error("PDFThumbnailViewer_setPageLabels: Invalid page labels.")}else this._pageLabels=null;for(let e=0,t=this._thumbnails.length;e<t;e++)this._thumbnails[e].setPageLabel(this._pageLabels?.[e]??null)}}_ensurePdfPageLoaded(e){if(e.pdfPage)return Promise.resolve(e.pdfPage);if(this._pagesRequests.has(e))return this._pagesRequests.get(e);const t=this.pdfDocument.getPage(e.id).then((t=>{e.pdfPage||e.setPdfPage(t);this._pagesRequests.delete(e);return t})).catch((t=>{console.error("Unable to get page for thumb view",t);this._pagesRequests.delete(e)}));this._pagesRequests.set(e,t);return t}forceRendering(){const e=this._getVisibleThumbs(),t=this.renderingQueue.getHighestPriority(e,this._thumbnails,this.scroll.down);if(t){this._ensurePdfPageLoaded(t).then((()=>{this.renderingQueue.renderView(t)}));return!0}return!1}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.TempImageFactory=t.PDFThumbnailView=void 0;var n=i(3),s=i(4),r=i(7);const a=function TempImageFactoryClosure(){let e=null;return{getCanvas(t,i){let n=e;if(!n){n=document.createElement("canvas");e=n}n.width=t;n.height=i;n.mozOpaque=!0;const s=n.getContext("2d",{alpha:!1});s.save();s.fillStyle="rgb(255, 255, 255)";s.fillRect(0,0,t,i);s.restore();return[n,n.getContext("2d")]},destroyCanvas(){const t=e;if(t){t.width=0;t.height=0}e=null}}}();t.TempImageFactory=a;t.PDFThumbnailView=class PDFThumbnailView{constructor({container:e,id:t,defaultViewport:i,optionalContentConfigPromise:n,linkService:s,renderingQueue:a,checkSetImageDisabled:o,l10n:l}){this.id=t;this.renderingId="thumbnail"+t;this.pageLabel=null;this.pdfPage=null;this.rotation=0;this.viewport=i;this.pdfPageRotate=i.rotation;this._optionalContentConfigPromise=n||null;this.linkService=s;this.renderingQueue=a;this.renderTask=null;this.renderingState=r.RenderingStates.INITIAL;this.resume=null;this._checkSetImageDisabled=o||function(){return!1};const h=this.viewport.width,c=h/this.viewport.height;this.canvasWidth=98;this.canvasHeight=this.canvasWidth/c|0;this.scale=this.canvasWidth/h;this.l10n=l;window.pdfThumbnailGenerator?window.pdfThumbnailGenerator(this,s,t,e,this._thumbPageTitle):this.createThumbnail(this,s,t,e,this._thumbPageTitle)}createThumbnail(e,t,i,n,s){const r=document.createElement("a");r.href=t.getAnchorUrl("#page="+i);s.then((e=>{r.title=e}));r.onclick=function(){t.goToPage(i);return!1};e.anchor=r;const a=document.createElement("div");a.className="thumbnail";a.setAttribute("data-page-number",this.id);e.div=a;const o=document.createElement("div");o.className="thumbnailSelectionRing";o.style.width=this.canvasWidth+2+"px";o.style.height=this.canvasHeight+2+"px";e.ring=o;a.appendChild(o);r.appendChild(a);n.appendChild(r)}setPdfPage(e){this.pdfPage=e;this.pdfPageRotate=e.rotate;const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:1,rotation:t});this.reset()}reset(){this.cancelRendering();this.renderingState=r.RenderingStates.INITIAL;const e=this.viewport.width,t=e/this.viewport.height;this.canvasHeight=this.canvasWidth/t|0;this.scale=this.canvasWidth/e;this.div.removeAttribute("data-loaded");const i=this.ring;i.textContent="";i.style.width=this.canvasWidth+2+"px";i.style.height=this.canvasHeight+2+"px";if(this.canvas){this.canvas.width=0;this.canvas.height=0;delete this.canvas}if(this.image){this.image.removeAttribute("src");delete this.image}}update({rotation:e=null}){"number"==typeof e&&(this.rotation=e);const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:1,rotation:t});this.reset()}cancelRendering(){if(this.renderTask){this.renderTask.cancel();this.renderTask=null}this.resume=null}_getPageDrawContext(e=1){const t=document.createElement("canvas");t.mozOpaque=!0;const i=t.getContext("2d",{alpha:!1}),s=(0,n.getOutputScale)(i);t.width=e*this.canvasWidth*s.sx|0;t.height=e*this.canvasHeight*s.sy|0;return{ctx:i,canvas:t,transform:s.scaled?[s.sx,0,0,s.sy,0,0]:null}}_convertCanvasToImage(e){if(this.renderingState!==r.RenderingStates.FINISHED)throw new Error("_convertCanvasToImage: Rendering has not finished.");const t=this._reduceImage(e),i=document.createElement("img");i.className="thumbnailImage";this._thumbPageCanvas.then((e=>{i.setAttribute("aria-label",e)}));i.style.width=this.canvasWidth+"px";i.style.height=this.canvasHeight+"px";i.src=t.toDataURL();this.image=i;this.div.setAttribute("data-loaded",!0);this.ring.appendChild(i);t.width=0;t.height=0}draw(){if(this.renderingState!==r.RenderingStates.INITIAL){console.error("Must be in new state before drawing");return Promise.resolve(void 0)}const{pdfPage:e}=this;if(!e){this.renderingState=r.RenderingStates.FINISHED;return Promise.reject(new Error("pdfPage is not loaded"))}this.renderingState=r.RenderingStates.RUNNING;const finishRenderTask=async(e=null)=>{o===this.renderTask&&(this.renderTask=null);if(!(e instanceof s.RenderingCancelledException)){this.renderingState=r.RenderingStates.FINISHED;this._convertCanvasToImage(i);if(e)throw e}},{ctx:t,canvas:i,transform:n}=this._getPageDrawContext(2),a={canvasContext:t,transform:n,viewport:this.viewport.clone({scale:2*this.scale}),optionalContentConfigPromise:this._optionalContentConfigPromise,background:PDFViewerApplicationOptions.get("pdfBackgroundColor")},o=this.renderTask=e.render(a);o.onContinue=e=>{if(this.renderingQueue.isHighestPriority(this))e();else{this.renderingState=r.RenderingStates.PAUSED;this.resume=()=>{this.renderingState=r.RenderingStates.RUNNING;e()}}};const l=o.promise.then((function(){return finishRenderTask(null)}),(function(e){return finishRenderTask(e)}));l.finally((()=>{i.width=0;i.height=0;this.linkService.isPageCached(this.id)||this.pdfPage?.cleanup()}));return l}setImage(e){if(this._checkSetImageDisabled())return;if(this.renderingState!==r.RenderingStates.INITIAL)return;const{canvas:t,pdfPage:i}=e;if(t){this.pdfPage||this.setPdfPage(i);this.renderingState=r.RenderingStates.FINISHED;this._convertCanvasToImage(t)}}_reduceImage(e){const{ctx:t,canvas:i}=this._getPageDrawContext();if(e.width<=2*i.width){t.drawImage(e,0,0,e.width,e.height,0,0,i.width,i.height);return i}let n=i.width<<3,s=i.height<<3;const[r,o]=a.getCanvas(n,s);for(;n>e.width||s>e.height;){n>>=1;s>>=1}o.drawImage(e,0,0,e.width,e.height,0,0,n,s);for(;n>2*i.width;){o.drawImage(r,0,0,n,s,0,0,n>>1,s>>1);n>>=1;s>>=1}t.drawImage(r,0,0,n,s,0,0,i.width,i.height);return i}get _thumbPageTitle(){return this.l10n.get("thumb_page_title",{page:this.pageLabel??this.id})}get _thumbPageCanvas(){return this.l10n.get("thumb_page_canvas",{page:this.pageLabel??this.id})}setPageLabel(e){this.pageLabel="string"==typeof e?e:null;this._thumbPageTitle.then((e=>{this.anchor.title=e}));this.renderingState===r.RenderingStates.FINISHED&&this._thumbPageCanvas.then((e=>{this.image?.setAttribute("aria-label",e)}))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFViewer=void 0;var n=i(3),s=i(29),r=i(4);class PDFViewer extends s.BaseViewer{get _viewerElement(){return(0,r.shadow)(this,"_viewerElement",this.viewer)}_scrollIntoView({pageDiv:e,pageSpot:t=null,pageNumber:i=null}){if(!t&&!this.isInPresentationMode){const i=e.offsetLeft+e.clientLeft,n=i+e.clientWidth,{scrollLeft:s,clientWidth:r}=this.container;(this._isScrollModeHorizontal||i<s||n>s+r)&&(t={left:0,top:0})}super._scrollIntoView({pageDiv:e,pageSpot:t,pageNumber:i})}_getVisiblePages(){return this.isInPresentationMode?this._getCurrentVisiblePage():super._getVisiblePages()}_updateHelper(e){if(this.isInPresentationMode)return;let t=this._currentPageNumber,i=!1;for(const s of e){if(s.percent<100)break;if(s.id===t&&this._scrollMode===n.ScrollMode.VERTICAL&&this._spreadMode===n.SpreadMode.NONE){i=!0;break}}if(!i){e.some((e=>t===e.id))||(t=e[0].id)}this._setCurrentPageNumber(t)}}t.PDFViewer=PDFViewer},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.BaseViewer=void 0;var n=i(4),s=i(3),r=i(7),a=i(30),o=i(31),l=i(32),h=i(33),c=i(20),d=i(37),u=i(38),p=i(39),g=i(40);function PDFPageViewBuffer(e){const t=[];this.push=function(i){const n=t.indexOf(i);n>=0&&t.splice(n,1);t.push(i);t.length>e&&t.shift().destroy()};this.resize=function(i,n){e=i;if(n){const e=new Set;for(let t=0,i=n.length;t<i;++t)e.add(n[t].id);(0,s.moveToEndOfArray)(t,(function(t){return e.has(t.id)}))}for(;t.length>e;)t.shift().destroy()};this.has=function(e){return t.includes(e)}}class BaseViewer{constructor(e){if(this.constructor===BaseViewer)throw new Error("Cannot initialize BaseViewer.");const t="2.11.530";if(n.version!==t)throw new Error(`The API version "${n.version}" does not match the Viewer version "2.11.530".`);this.container=e.container;this.viewer=e.viewer||e.container.firstElementChild;this.pageViewMode=e.pageViewMode||"single";if("DIV"!==this.container?.tagName.toUpperCase()||"DIV"!==this.viewer?.tagName.toUpperCase())throw new Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&"absolute"!==getComputedStyle(this.container).position)throw new Error("The `container` must be absolutely positioned.");this.eventBus=e.eventBus;this.linkService=e.linkService||new c.SimpleLinkService;this.downloadManager=e.downloadManager||null;this.findController=e.findController||null;this._scriptingManager=e.scriptingManager||null;this.removePageBorders=e.removePageBorders||!1;this.textLayerMode=e.textLayerMode??s.TextLayerMode.ENABLE;this._annotationMode=e.annotationMode??n.AnnotationMode.ENABLE_FORMS;this.imageResourcesPath=e.imageResourcesPath||"";this.enablePrintAutoRotate=e.enablePrintAutoRotate||!1;this.renderer=e.renderer||s.RendererType.CANVAS;this.useOnlyCssZoom=e.useOnlyCssZoom||!1;this.maxCanvasPixels=e.maxCanvasPixels;this.l10n=e.l10n||o.NullL10n;this.defaultRenderingQueue=!e.renderingQueue;if(this.defaultRenderingQueue){this.renderingQueue=new r.PDFRenderingQueue;this.renderingQueue.setViewer(this)}else this.renderingQueue=e.renderingQueue;this._doc=document.documentElement;this.scroll=(0,s.watchScroll)(this.container,this._scrollUpdate.bind(this));this.presentationModeState=s.PresentationModeState.UNKNOWN;this._onBeforeDraw=this._onAfterDraw=null;this._resetView();this.removePageBorders&&this.viewer.classList.add("removePageBorders");Promise.resolve().then((()=>{this.eventBus.dispatch("baseviewerinit",{source:this})}))}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===n.AnnotationMode.ENABLE_FORMS}get enableScripting(){return!!this._scriptingManager}get currentPageNumber(){return this._currentPageNumber}set currentPageNumber(e){if(!Number.isInteger(e))throw new Error("Invalid page number.");if(!this.pdfDocument)return;const t=Math.abs(this._currentPageNumber-e)<2;this._setCurrentPageNumber(e,!0)||console.error(`currentPageNumber: "${e}" is not a valid page.`);if(this.pageFlip)if(t){console.log("Flip");this.pageFlip.flip(e-1)}else{console.log("turn to page");this.pageFlip.turnToPage(e-1)}}hidePagesDependingOnpageViewMode(){if("single"===this.pageViewMode){this._pages.forEach((e=>{e.div.style.display="none"}));this._pages.forEach((e=>{if(e.id===this.currentPageNumber){e.div.style.display="inline-block";e.div.parentElement.classList.contains("spread")&&e.div.parentElement.childNodes.forEach(((e,t)=>{e.style.display="inline-block"}))}}))}else"book"===this.pageViewMode&&(this.pageFlip||setTimeout((()=>{if(!this.pageFlip){const e=this._pages[0].div,t=e.parentElement,i=t.parentElement;i.style.width=2*e.clientWidth+"px";i.style.overflow="hidden";i.style.marginLeft="auto";i.style.marginRight="auto";this.pageFlip=new l.PageFlip(t,{width:e.clientWidth,height:e.clientHeight,showCover:!0,size:"fixed"});this.pageFlip.loadFromHTML(document.querySelectorAll(".page"));this.ensureAdjecentPagesAreLoaded();this.pageFlip.on("flip",(e=>{this._currentPageNumber!==e.data+1&&this._setCurrentPageNumber(e.data+1,!1)}))}}),100))}_setCurrentPageNumber(e,t=!1){if(this._currentPageNumber===e){t&&this._resetCurrentPageView();return!0}if(!(0<e&&e<=this.pagesCount))return!1;const i=this._currentPageNumber;this._currentPageNumber=e;this.hidePagesDependingOnpageViewMode();if("single"===this.pageViewMode||"book"===this.pageViewMode||"infinite-scroll"===this.pageViewMode){const e=this._pages[this.currentPageNumber-1];if(e.div.parentElement.classList.contains("spread"))e.div.parentElement.childNodes.forEach((e=>{const t=Number(e.getAttribute("data-page-number")),i=this._pages[t-1];this._ensurePdfPageLoaded(i).then((()=>{this.renderingQueue.renderView(i)}));e.style.display="inline-block"}));else{this._ensurePdfPageLoaded(e).then((()=>{this.renderingQueue.renderView(e)}));"book"===this.pageViewMode&&this.ensureAdjecentPagesAreLoaded()}}this.eventBus.dispatch("pagechanging",{source:this,pageNumber:e,pageLabel:this._pageLabels?.[e-1]??null,previous:i});t&&this._resetCurrentPageView();return!0}addPageToRenderQueue(e=0){if(e>=0&&e<=this._pages.length-1){const t=this._pages[e];if(t.div.querySelector(".loadingIcon")){this._ensurePdfPageLoaded(t).then((()=>{this.renderingQueue.renderView(t)}));return!0}}return!1}ensureAdjecentPagesAreLoaded(){if(!window.adjacentPagesLoader){window.adjacentPagesLoader=e=>{console.log("rendered",e);let t=this._pages[Math.min(this._pages.length-1,this.currentPageNumber)],i=t.div.querySelector(".loadingIcon");if(i){console.log("asking for the next page");this._ensurePdfPageLoaded(t).then((()=>{this.renderingQueue.renderView(t)}))}else{t=this._pages[Math.min(this._pages.length-1,this.currentPageNumber+1)];i=t.div.querySelector(".loadingIcon");if(i){console.log("asking for the next + 1 page");this._ensurePdfPageLoaded(t).then((()=>{this.renderingQueue.renderView(t)}))}else{t=this._pages[Math.min(this._pages.length-1,this.currentPageNumber+2)];i=t.div.querySelector(".loadingIcon");if(i){console.log("asking for the next + 2 page");this._ensurePdfPageLoaded(t).then((()=>{this.renderingQueue.renderView(t)}))}else{t=this._pages[Math.min(this._pages.length-1,this.currentPageNumber+3)];i=t.div.querySelector(".loadingIcon");if(i){console.log("asking for the next + 3 page");this._ensurePdfPageLoaded(t).then((()=>{this.renderingQueue.renderView(t)}))}else{t=this._pages[Math.max(0,this.currentPageNumber-1)];i=t.div.querySelector(".loadingIcon");if(i){console.log("asking for the current page");this._ensurePdfPageLoaded(t).then((()=>{this.renderingQueue.renderView(t)}))}else{t=this._pages[Math.max(0,this.currentPageNumber-2)];i=t.div.querySelector(".loadingIcon");if(i){console.log("asking for the previous page");this._ensurePdfPageLoaded(t).then((()=>{this.renderingQueue.renderView(t)}))}else console.log("Finished preloading the pages")}}}}}};this.eventBus._on("pagerendered",window.adjacentPagesLoader)}window.adjacentPagesLoader()}get currentPageLabel(){return this._pageLabels?.[this._currentPageNumber-1]??null}set currentPageLabel(e){if(!this.pdfDocument)return;let t=0|e;if(this._pageLabels){const i=this._pageLabels.indexOf(e);i>=0&&(t=i+1)}this._setCurrentPageNumber(t,!0)||console.error(`currentPageLabel: "${e}" is not a valid page.`)}get currentScale(){return this._currentScale!==s.UNKNOWN_SCALE?this._currentScale:s.DEFAULT_SCALE}set currentScale(e){if(isNaN(e))throw new Error("Invalid numeric scale.");this.pdfDocument&&this._setScale(e,"single"===this.pageViewMode)}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(e){this.pdfDocument&&this._setScale(e,"single"===this.pageViewMode)}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!(0,s.isValidRotation)(e))throw new Error("Invalid pages rotation angle.");if(!this.pdfDocument)return;(e%=360)<0&&(e+=360);if(this._pagesRotation===e)return;this._pagesRotation=e;const t=this._currentPageNumber,i={rotation:e};for(const e of this._pages)e.update(i);this._currentScaleValue&&this._setScale(this._currentScaleValue,!0);this.eventBus.dispatch("rotationchanging",{source:this,pagesRotation:e,pageNumber:t});this.defaultRenderingQueue&&this.update()}get firstPagePromise(){return this.pdfDocument?this._firstPageCapability.promise:null}get onePageRendered(){return this.pdfDocument?this._onePageRenderedCapability.promise:null}get pagesPromise(){return this.pdfDocument?this._pagesCapability.promise:null}get _viewerElement(){throw new Error("Not implemented: _viewerElement")}_onePageRenderedOrForceFetch(){return this.container.offsetParent&&0!==this._getVisiblePages().views.length?this._onePageRenderedCapability.promise:Promise.resolve()}setDocument(e){if(this.pdfDocument){this.eventBus.dispatch("pagesdestroy",{source:this});this._cancelRendering();this._resetView();this.findController&&this.findController.setDocument(null);this._scriptingManager&&this._scriptingManager.setDocument(null)}this.pdfDocument=e;if(!e)return;const t=e.isPureXfa,i=e.numPages,r=e.getPage(1),a=e.getOptionalContentConfig();this._pagesCapability.promise.then((()=>{this.eventBus.dispatch("pagesloaded",{source:this,pagesCount:i})}));this._onBeforeDraw=e=>{const t=this._pages[e.pageNumber-1];t&&this._buffer.push(t)};this.eventBus._on("pagerender",this._onBeforeDraw);this._onAfterDraw=e=>{if(!e.cssTransform&&!this._onePageRenderedCapability.settled){this._onePageRenderedCapability.resolve();this.eventBus._off("pagerendered",this._onAfterDraw);this._onAfterDraw=null}};this.eventBus._on("pagerendered",this._onAfterDraw);r.then((r=>{this._firstPageCapability.resolve(r);this._optionalContentConfigPromise=a;const o=this.currentScale,l=r.getViewport({scale:o*n.PixelsPerInch.PDF_TO_CSS_UNITS}),c=this.textLayerMode===s.TextLayerMode.DISABLE||t?null:this,d=this._annotationMode!==n.AnnotationMode.DISABLE?this:null,u=t?this:null;for(let e=1;e<=i;++e){const t=new h.PDFPageView({container:this._viewerElement,eventBus:this.eventBus,id:e,scale:o,defaultViewport:l.clone(),optionalContentConfigPromise:a,renderingQueue:this.renderingQueue,textLayerFactory:c,textLayerMode:this.textLayerMode,annotationLayerFactory:d,annotationMode:this._annotationMode,xfaLayerFactory:u,textHighlighterFactory:this,structTreeLayerFactory:this,imageResourcesPath:this.imageResourcesPath,removePageBorders:this.removePageBorders,renderer:this.renderer,useOnlyCssZoom:this.useOnlyCssZoom,maxCanvasPixels:this.maxCanvasPixels,l10n:this.l10n});this._pages.push(t)}const p=this._pages[0];if(p){p.setPdfPage(r);this.linkService.cachePageRef(1,r.ref)}this._spreadMode!==s.SpreadMode.NONE&&this._updateSpreadMode();this._onePageRenderedOrForceFetch().then((()=>{this.findController&&this.findController.setDocument(e);this._scriptingManager&&this._scriptingManager.setDocument(e);if(e.loadingParams.disableAutoFetch||i>7500){this._pagesCapability.resolve();return}let t=i-1;if(t<=0)this._pagesCapability.resolve();else for(let n=2;n<=i;++n)e.getPage(n).then((e=>{const i=this._pages[n-1];i.pdfPage||i.setPdfPage(e);this.linkService.cachePageRef(n,e.ref);0==--t&&this._pagesCapability.resolve()}),(e=>{console.error(`Unable to get page ${n} to initialize viewer`,e);0==--t&&this._pagesCapability.resolve()}))}));this.hidePagesDependingOnpageViewMode();this.eventBus.dispatch("pagesinit",{source:this});this.defaultRenderingQueue&&this.update()})).catch((e=>{console.error("Unable to initialize viewer",e)}))}setPageLabels(e){if(this.pdfDocument){if(e)if(Array.isArray(e)&&this.pdfDocument.numPages===e.length)this._pageLabels=e;else{this._pageLabels=null;console.error("setPageLabels: Invalid page labels.")}else this._pageLabels=null;for(let e=0,t=this._pages.length;e<t;e++)this._pages[e].setPageLabel(this._pageLabels?.[e]??null)}}_resetView(){this._pages=[];this._currentPageNumber=1;this._currentScale=s.UNKNOWN_SCALE;this._currentScaleValue=null;this._pageLabels=null;const e=Number(PDFViewerApplicationOptions.get("defaultCacheSize"))||10;this._buffer=new PDFPageViewBuffer(e);this._location=null;this._pagesRotation=0;this._optionalContentConfigPromise=null;this._pagesRequests=new WeakMap;this._firstPageCapability=(0,n.createPromiseCapability)();this._onePageRenderedCapability=(0,n.createPromiseCapability)();this._pagesCapability=(0,n.createPromiseCapability)();this._scrollMode=s.ScrollMode.VERTICAL;this._spreadMode=s.SpreadMode.NONE;if(this._onBeforeDraw){this.eventBus._off("pagerender",this._onBeforeDraw);this._onBeforeDraw=null}if(this._onAfterDraw){this.eventBus._off("pagerendered",this._onAfterDraw);this._onAfterDraw=null}this.viewer.textContent="";this._updateScrollMode()}_scrollUpdate(){0!==this.pagesCount&&this.update()}_scrollIntoView({pageDiv:e,pageSpot:t=null,pageNumber:i=null}){"single"===this.pageViewMode&&this._pages.forEach((()=>{e.style.display="inline-block"}));(0,s.scrollIntoView)(e,t,!1,"infinite-scroll"===this.pageViewMode)}_setScaleUpdatePages(e,t,i=!1,n=!1){this._currentScaleValue=t.toString();if(function isSameScale(e,t){return t===e||Math.abs(t-e)<1e-15}(this._currentScale,e)){n&&this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:t});return}this._doc.style.setProperty("--zoom-factor",e);const s={scale:e};for(const e of this._pages)e.update(s);this._currentScale=e;if(!i){let e,t=this._currentPageNumber;if(this._location&&!this.isInPresentationMode&&!this.isChangingPresentationMode){t=this._location.pageNumber;e=[null,{name:"XYZ"},this._location.left,this._location.top,null]}this.scrollPageIntoView({pageNumber:t,destArray:e,allowNegativeOffset:!0})}this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:n?t:void 0});this.defaultRenderingQueue&&this.update()}get _pageWidthScaleFactor(){return this._spreadMode===s.SpreadMode.NONE||this._scrollMode===s.ScrollMode.HORIZONTAL||this.isInPresentationMode?1:2}_setScale(e,t=!1){null===e&&(e="auto");let i=parseFloat(e);if(i>0)this._setScaleUpdatePages(i,e,t,!1);else{const n=this._pages[this._currentPageNumber-1];if(!n)return;const r=this.isInPresentationMode||this.removePageBorders;let a=s.VERTICAL_PADDING;"single"===this.pageViewMode&&(a+=15);let o=r?0:s.SCROLLBAR_PADDING,l=r?"single"===this.pageViewMode?10:0:a;!r&&this._isScrollModeHorizontal&&([o,l]=[l,o]);const h=(this.container.clientWidth-o)/n.width*n.scale/this._pageWidthScaleFactor,c=(this.container.clientHeight-l)/n.height*n.scale;switch(e){case"page-actual":i=1;break;case"page-width":i=h;break;case"page-height":i=c;break;case"page-fit":i=Math.min(h,c);break;case"auto":const t=(0,s.isPortraitOrientation)(n)?h:Math.min(c,h);i=Math.min(s.MAX_AUTO_SCALE,t);break;default:console.error(`_setScale: "${e}" is an unknown zoom value.`);return}this._setScaleUpdatePages(i,e,t,!0)}}_resetCurrentPageView(){this.isInPresentationMode&&this._setScale(this._currentScaleValue,!0);const e=this._pages[this._currentPageNumber-1];this._scrollIntoView({pageDiv:e.div})}pageLabelToPageNumber(e){if(!this._pageLabels)return null;const t=this._pageLabels.indexOf(e);return t<0?null:t+1}scrollPageIntoView({pageNumber:e,destArray:t=null,allowNegativeOffset:i=!1,ignoreDestinationZoom:r=!1}){if(!this.pdfDocument)return;const a=Number.isInteger(e)&&this._pages[e-1];if(!a){console.error(`scrollPageIntoView: "${e}" is not a valid pageNumber parameter.`);return}if(this.isInPresentationMode||!t){this._setCurrentPageNumber(e,!0);return}let o,l,h=0,c=0,d=0,u=0;const p=a.rotation%180!=0,g=(p?a.height:a.width)/a.scale/n.PixelsPerInch.PDF_TO_CSS_UNITS,f=(p?a.width:a.height)/a.scale/n.PixelsPerInch.PDF_TO_CSS_UNITS;let m=0;switch(t[1].name){case"XYZ":h=t[2];c=t[3];m=t[4];h=null!==h?h:0;c=null!==c?c:f;break;case"Fit":case"FitB":m="page-fit";break;case"FitH":case"FitBH":c=t[2];m="page-width";if(null===c&&this._location){h=this._location.left;c=this._location.top}else"number"!=typeof c&&(c=f);break;case"FitV":case"FitBV":h=t[2];d=g;u=f;m="page-height";break;case"FitR":h=t[2];c=t[3];d=t[4]-h;u=t[5]-c;const e=this.removePageBorders?0:s.SCROLLBAR_PADDING,i=this.removePageBorders?0:s.VERTICAL_PADDING;o=(this.container.clientWidth-e)/d/n.PixelsPerInch.PDF_TO_CSS_UNITS;l=(this.container.clientHeight-i)/u/n.PixelsPerInch.PDF_TO_CSS_UNITS;m=Math.min(Math.abs(o),Math.abs(l));break;default:console.error(`scrollPageIntoView: "${t[1].name}" is not a valid destination type.`);return}r||(m&&m!==this._currentScale?this.currentScaleValue=m:this._currentScale===s.UNKNOWN_SCALE&&(this.currentScaleValue=s.DEFAULT_SCALE_VALUE));this._ensurePdfPageLoaded(a).then((()=>{this.renderingQueue.renderView(a);this.currentPageNumber!==e&&(this.currentPageNumber=e)}));if("page-fit"===m&&!t[4]){this._scrollIntoView({pageDiv:a.div,pageNumber:e});return}const _=[a.viewport.convertToViewportPoint(h,c),a.viewport.convertToViewportPoint(h+d,c+u)];let b=Math.min(_[0][0],_[1][0]),w=Math.min(_[0][1],_[1][1]);if(!i){b=Math.max(b,0);w=Math.max(w,0)}this._scrollIntoView({pageDiv:a.div,pageSpot:{left:b,top:w},pageNumber:e})}_updateLocation(e){const t=this._currentScale,i=this._currentScaleValue,n=parseFloat(i)===t?Math.round(1e4*t)/100:i,s=e.id;let r="#page="+s;r+="&zoom="+n;const a=this._pages[s-1],o=this.container,l=a.getPagePoint(o.scrollLeft-e.x,o.scrollTop-e.y),h=Math.round(l[0]),c=Math.round(l[1]);r+=","+h+","+c;this._location={pageNumber:s,scale:n,top:c,left:h,rotation:this._pagesRotation,pdfOpenParams:r}}_updateHelper(e){throw new Error("Not implemented: _updateHelper")}update(){const e=this._getVisiblePages(),t=e.views,i=t.length;if(0===i)return;const n=Number(PDFViewerApplicationOptions.get("defaultCacheSize"))||10,s=Math.max(n,2*i+1);this._buffer.resize(s,t);this.renderingQueue.renderHighestPriority(e);this._updateHelper(t);this._updateLocation(e.first);this.eventBus.dispatch("updateviewarea",{source:this,location:this._location});this.hidePagesDependingOnpageViewMode()}containsElement(e){return this.container.contains(e)}focus(){this.container.focus()}get _isScrollModeHorizontal(){return!this.isInPresentationMode&&this._scrollMode===s.ScrollMode.HORIZONTAL}get _isContainerRtl(){return"rtl"===getComputedStyle(this.container).direction}get isInPresentationMode(){return this.presentationModeState===s.PresentationModeState.FULLSCREEN}get isChangingPresentationMode(){return this.presentationModeState===s.PresentationModeState.CHANGING}get isHorizontalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollHeight>this.container.clientHeight}_getCurrentVisiblePage(){if(!this.pagesCount)return{views:[]};const e=this._pages[this._currentPageNumber-1],t=e.div,i={id:e.id,x:t.offsetLeft+t.clientLeft,y:t.offsetTop+t.clientTop,view:e};return{first:i,last:i,views:[i]}}_getVisiblePages(){if("single"===this.pageViewMode){if(!this.pagesCount)return{views:[]};const e=this._pages[this._currentPageNumber-1];if(e.div.parentElement.classList.contains("spread")){const t=[];e.div.parentElement.childNodes.forEach((e=>{const i=Number(e.getAttribute("data-page-number")),n=this._pages[i-1],s=n.div,r={id:n.id,x:s.offsetLeft+s.clientLeft,y:s.offsetTop+s.clientTop,view:n};t.push(r)}));return{first:t[0],last:t[t.length-1],views:t}}return this._getCurrentVisiblePage()}return(0,s.getVisibleElements)({scrollEl:this.container,views:this._pages,sortByVisibility:!0,horizontal:this._isScrollModeHorizontal,rtl:this._isScrollModeHorizontal&&this._isContainerRtl})}isPageVisible(e){if(!this.pdfDocument)return!1;if(!(Number.isInteger(e)&&e>0&&e<=this.pagesCount)){console.error(`isPageVisible: "${e}" is not a valid page.`);return!1}return this._getVisiblePages().views.some((function(t){return t.id===e}))}isPageCached(e){if(!this.pdfDocument||!this._buffer)return!1;if(!(Number.isInteger(e)&&e>0&&e<=this.pagesCount)){console.error(`isPageCached: "${e}" is not a valid page.`);return!1}const t=this._pages[e-1];return!!t&&this._buffer.has(t)}cleanup(){for(let e=0,t=this._pages.length;e<t;e++)this._pages[e]&&this._pages[e].renderingState!==r.RenderingStates.FINISHED&&this._pages[e].reset()}_cancelRendering(){for(let e=0,t=this._pages.length;e<t;e++)this._pages[e]&&this._pages[e].cancelRendering()}_ensurePdfPageLoaded(e){if(e.pdfPage)return Promise.resolve(e.pdfPage);if(this._pagesRequests.has(e))return this._pagesRequests.get(e);const t=this.pdfDocument.getPage(e.id).then((t=>{e.pdfPage||e.setPdfPage(t);this._pagesRequests.delete(e);return t})).catch((t=>{console.error("Unable to get page for page view",t);this._pagesRequests.delete(e)}));this._pagesRequests.set(e,t);return t}forceRendering(e){const t=e||this._getVisiblePages(),i=this._isScrollModeHorizontal?this.scroll.right:this.scroll.down,n=this._scrollMode===s.ScrollMode.VERTICAL&&this._spreadMode!==s.SpreadMode.NONE&&!this.isInPresentationMode,r=this.renderingQueue.getHighestPriority(t,this._pages,i,n);if(r){this._ensurePdfPageLoaded(r).then((()=>{this.renderingQueue.renderView(r)}));return!0}return!1}createTextLayerBuilder(e,t,i,n=!1,s,r){return new p.TextLayerBuilder({textLayerDiv:e,eventBus:s,pageIndex:t,viewport:i,enhanceTextSelection:!this.isInPresentationMode&&n,highlighter:r})}createTextHighlighter(e,t){return new u.TextHighlighter({eventBus:t,pageIndex:e,findController:this.isInPresentationMode?null:this.findController})}createAnnotationLayerBuilder(e,t,i=null,n="",s=!0,r=o.NullL10n,l=null,h=null,c=null,d=null){return new a.AnnotationLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:i||this.pdfDocument?.annotationStorage,imageResourcesPath:n,renderForms:s,linkService:this.linkService,downloadManager:this.downloadManager,l10n:r,enableScripting:l??this.enableScripting,hasJSActionsPromise:h||this.pdfDocument?.hasJSActions(),fieldObjectsPromise:d||this.pdfDocument?.getFieldObjects(),mouseState:c||this._scriptingManager?.mouseState})}createXfaLayerBuilder(e,t,i=null){return new g.XfaLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:i||this.pdfDocument?.annotationStorage,linkService:this.linkService})}createStructTreeLayerBuilder(e){return new d.StructTreeLayerBuilder({pdfPage:e})}get hasEqualPageSizes(){const e=this._pages[0];for(let t=1,i=this._pages.length;t<i;++t){const i=this._pages[t];if(i.width!==e.width||i.height!==e.height)return!1}return!0}getPagesOverview(){return this._pages.map((e=>{const t=e.pdfPage.getViewport({scale:1});return!this.enablePrintAutoRotate||(0,s.isPortraitOrientation)(t)?{width:t.width,height:t.height,rotation:t.rotation}:{width:t.height,height:t.width,rotation:(t.rotation-90)%360}}))}get optionalContentConfigPromise(){return this.pdfDocument?this._optionalContentConfigPromise?this._optionalContentConfigPromise:this.pdfDocument.getOptionalContentConfig():Promise.resolve(null)}set optionalContentConfigPromise(e){if(!(e instanceof Promise))throw new Error(`Invalid optionalContentConfigPromise: ${e}`);if(!this.pdfDocument)return;if(!this._optionalContentConfigPromise)return;this._optionalContentConfigPromise=e;const t={optionalContentConfigPromise:e};for(const e of this._pages)e.update(t);this.update();this.eventBus.dispatch("optionalcontentconfigchanged",{source:this,promise:e})}get scrollMode(){return this._scrollMode}set scrollMode(e){if(this._scrollMode!==e){if(!(0,s.isValidScrollMode)(e))throw new Error(`Invalid scroll mode: ${e}`);this._scrollMode=e;this.eventBus.dispatch("scrollmodechanged",{source:this,mode:e});this._updateScrollMode(this._currentPageNumber)}}_updateScrollMode(e=null){const t=this._scrollMode,i=this.viewer;i.classList.toggle("scrollHorizontal",t===s.ScrollMode.HORIZONTAL);i.classList.toggle("scrollWrapped",t===s.ScrollMode.WRAPPED);if(this.pdfDocument&&e){this._currentScaleValue&&isNaN(this._currentScaleValue)&&this._setScale(this._currentScaleValue,!0);this._setCurrentPageNumber(e,!0);this.update()}}get spreadMode(){return this._spreadMode}set spreadMode(e){if(this._spreadMode!==e){if(!(0,s.isValidSpreadMode)(e))throw new Error(`Invalid spread mode: ${e}`);this._spreadMode=e;this.eventBus.dispatch("spreadmodechanged",{source:this,mode:e});this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(e=null){if(!this.pdfDocument)return;const t=this.viewer,i=this._pages;t.textContent="";if(this._spreadMode===s.SpreadMode.NONE)for(let e=0,n=i.length;e<n;++e)t.appendChild(i[e].div);else{const e=this._spreadMode-1;let n=null;for(let s=0,r=i.length;s<r;++s){if(null===n){n=document.createElement("div");n.className="spread";t.appendChild(n)}else if(s%2===e){n=n.cloneNode(!1);t.appendChild(n)}n.appendChild(i[s].div)}}this.hidePagesDependingOnpageViewMode();if(e){this._currentScaleValue&&isNaN(this._currentScaleValue)&&this._setScale(this._currentScaleValue,!0);this._setCurrentPageNumber(e,!0);this.update()}}_getPageAdvance(e,t=!1){if(this.isInPresentationMode)return 1;switch(this._scrollMode){case s.ScrollMode.WRAPPED:{const{views:i}=this._getVisiblePages(),n=new Map;for(const{id:e,y:t,percent:s,widthPercent:r}of i){if(0===s||r<100)continue;let i=n.get(t);i||n.set(t,i||=[]);i.push(e)}for(const i of n.values()){const n=i.indexOf(e);if(-1===n)continue;const s=i.length;if(1===s)break;if(t)for(let t=n-1,s=0;t>=s;t--){const n=i[t],s=i[t+1]-1;if(n<s)return e-s}else for(let t=n+1,r=s;t<r;t++){const n=i[t],s=i[t-1]+1;if(n>s)return s-e}if(t){const t=i[0];if(t<e)return e-t+1}else{const t=i[s-1];if(t>e)return t-e+1}break}break}case s.ScrollMode.HORIZONTAL:break;case s.ScrollMode.VERTICAL:{if(this._spreadMode===s.SpreadMode.NONE)break;if("single"===this.pageViewMode)return 2;const i=this._spreadMode-1;if(t&&e%2!==i)break;if(!t&&e%2===i)break;const{views:n}=this._getVisiblePages(),r=t?e-1:e+1;for(const{id:e,percent:t,widthPercent:i}of n)if(e===r){if(t>0&&100===i)return 2;break}break}}return 1}nextPage(){const e=this._currentPageNumber,t=this.pagesCount;if(e>=t)return!1;const i=this._getPageAdvance(e,!1)||1;this.currentPageNumber=Math.min(e+i,t);return!0}previousPage(){const e=this._currentPageNumber;if(e<=1)return!1;const t=this._getPageAdvance(e,!0)||1;this.currentPageNumber=Math.max(e-t,1);return!0}increaseScale(e=1){let t=this._currentScale,i=Number(PDFViewerApplicationOptions.get("maxZoom"));i||(i=s.MAX_SCALE);do{t=(t*s.DEFAULT_SCALE_DELTA).toFixed(2);t=Math.ceil(10*t)/10;t=Math.min(i,t)}while(--e>0&&t<i);this.currentScaleValue=t}decreaseScale(e=1){let t=this._currentScale,i=Number(PDFViewerApplicationOptions.get("minZoom"));i||(i=s.MIN_SCALE);do{t=(t/s.DEFAULT_SCALE_DELTA).toFixed(2);t=Math.floor(10*t)/10;t=Math.max(i,t)}while(--e>0&&t>i);this.currentScaleValue=t}}t.BaseViewer=BaseViewer},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.DefaultAnnotationLayerFactory=t.AnnotationLayerBuilder=void 0;var n=i(4),s=i(31),r=i(20);class AnnotationLayerBuilder{constructor({pageDiv:e,pdfPage:t,linkService:i,downloadManager:n,annotationStorage:r=null,imageResourcesPath:a="",renderForms:o=!0,l10n:l=s.NullL10n,enableScripting:h=!1,hasJSActionsPromise:c=null,fieldObjectsPromise:d=null,mouseState:u=null}){this.pageDiv=e;this.pdfPage=t;this.linkService=i;this.downloadManager=n;this.imageResourcesPath=a;this.renderForms=o;this.l10n=l;this.annotationStorage=r;this.enableScripting=h;this._hasJSActionsPromise=c;this._fieldObjectsPromise=d;this._mouseState=u;this.div=null;this._cancelled=!1}async render(e,t="display"){const[i,s=!1,r=null]=await Promise.all([this.pdfPage.getAnnotations({intent:t}),this._hasJSActionsPromise,this._fieldObjectsPromise]);if(this._cancelled||0===i.length)return;const a={viewport:e.clone({dontFlip:!0}),div:this.div,annotations:i,page:this.pdfPage,imageResourcesPath:this.imageResourcesPath,renderForms:this.renderForms,linkService:this.linkService,downloadManager:this.downloadManager,annotationStorage:this.annotationStorage,enableScripting:this.enableScripting,hasJSActions:s,fieldObjects:r,mouseState:this._mouseState};if(this.div)n.AnnotationLayer.update(a);else{this.div=document.createElement("div");this.div.className="annotationLayer";this.pageDiv.appendChild(this.div);a.div=this.div;n.AnnotationLayer.render(a);this.l10n.translate(this.div)}}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}t.AnnotationLayerBuilder=AnnotationLayerBuilder;t.DefaultAnnotationLayerFactory=class DefaultAnnotationLayerFactory{createAnnotationLayerBuilder(e,t,i=null,n="",a=!0,o=s.NullL10n,l=!1,h=null,c=null,d=null){return new AnnotationLayerBuilder({pageDiv:e,pdfPage:t,imageResourcesPath:n,renderForms:a,linkService:new r.SimpleLinkService,l10n:o,annotationStorage:i,enableScripting:l,hasJSActionsPromise:h,fieldObjectsPromise:d,mouseState:c})}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.fixupLangCode=function fixupLangCode(e){return n[e?.toLowerCase()]||e};t.getL10nFallback=getL10nFallback;t.NullL10n=void 0;const i={of_pages:"of {{pagesCount}}",page_of_pages:"({{pageNumber}} of {{pagesCount}})",document_properties_kb:"{{size_kb}} KB ({{size_b}} bytes)",document_properties_mb:"{{size_mb}} MB ({{size_b}} bytes)",document_properties_date_string:"{{date}}, {{time}}",document_properties_page_size_unit_inches:"in",document_properties_page_size_unit_millimeters:"mm",document_properties_page_size_orientation_portrait:"portrait",document_properties_page_size_orientation_landscape:"landscape",document_properties_page_size_name_a3:"A3",document_properties_page_size_name_a4:"A4",document_properties_page_size_name_letter:"Letter",document_properties_page_size_name_legal:"Legal",document_properties_page_size_dimension_string:"{{width}} × {{height}} {{unit}} ({{orientation}})",document_properties_page_size_dimension_name_string:"{{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})",document_properties_linearized_yes:"Yes",document_properties_linearized_no:"No",print_progress_percent:"{{progress}}%","toggle_sidebar.title":"Toggle Sidebar","toggle_sidebar_notification2.title":"Toggle Sidebar (document contains outline/attachments/layers)",additional_layers:"Additional Layers",page_landmark:"Page {{page}}",thumb_page_title:"Page {{page}}",thumb_page_canvas:"Thumbnail of Page {{page}}",find_reached_top:"Reached top of document, continued from bottom",find_reached_bottom:"Reached end of document, continued from top","find_match_count[one]":"{{current}} of {{total}} match","find_match_count[other]":"{{current}} of {{total}} matches","find_match_count_limit[one]":"More than {{limit}} match","find_match_count_limit[other]":"More than {{limit}} matches",find_not_found:"Phrase not found",error_version_info:"PDF.js v{{version}} (build: {{build}})",error_message:"Message: {{message}}",error_stack:"Stack: {{stack}}",error_file:"File: {{file}}",error_line:"Line: {{line}}",rendering_error:"An error occurred while rendering the page.",page_scale_width:"Page Width",page_scale_fit:"Page Fit",page_scale_auto:"Automatic Zoom",page_scale_actual:"Actual Size",page_scale_percent:"{{scale}}%",loading:"Loading…",loading_error:"An error occurred while loading the PDF.",invalid_file_error:"Invalid or corrupted PDF file.",missing_file_error:"Missing PDF file.",unexpected_response_error:"Unexpected server response.",printing_not_supported:"Warning: Printing is not fully supported by this browser.",printing_not_ready:"Warning: The PDF is not fully loaded for printing.",web_fonts_disabled:"Web fonts are disabled: unable to use embedded PDF fonts."};function getL10nFallback(e,t){switch(e){case"find_match_count":e=`find_match_count[${1===t.total?"one":"other"}]`;break;case"find_match_count_limit":e=`find_match_count_limit[${1===t.limit?"one":"other"}]`}return i[e]||""}const n={en:"en-US",es:"es-ES",fy:"fy-NL",ga:"ga-IE",gu:"gu-IN",hi:"hi-IN",hy:"hy-AM",nb:"nb-NO",ne:"ne-NP",nn:"nn-NO",pa:"pa-IN",pt:"pt-PT",sv:"sv-SE",zh:"zh-CN"};const s={getLanguage:async()=>"en-us",getDirection:async()=>"ltr",get:async(e,t=null,i=getL10nFallback(e,t))=>function formatL10nValue(e,t){return t?e.replace(/\{\{\s*(\w+)\s*\}\}/g,((e,i)=>i in t?t[i]:"{{"+i+"}}")):e}(i,t),async translate(e){}};t.NullL10n=s},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PageFlip=void 0;class Page{constructor(e,t){this.state={angle:0,area:[],position:{x:0,y:0},hardAngle:0,hardDrawingAngle:0};this.createdDensity=t;this.nowDrawingDensity=this.createdDensity;this.render=e}setDensity(e){this.createdDensity=e;this.nowDrawingDensity=e}setDrawingDensity(e){this.nowDrawingDensity=e}setPosition(e){this.state.position=e}setAngle(e){this.state.angle=e}setArea(e){this.state.area=e}setHardDrawingAngle(e){this.state.hardDrawingAngle=e}setHardAngle(e){this.state.hardAngle=e;this.state.hardDrawingAngle=e}setOrientation(e){this.orientation=e}getDrawingDensity(){return this.nowDrawingDensity}getDensity(){return this.createdDensity}getHardAngle(){return this.state.hardAngle}}class ImagePage extends Page{constructor(e,t,i){super(e,i);this.image=null;this.isLoad=!1;this.loadingAngle=0;this.image=new Image;this.image.src=t}draw(e){const t=this.render.getContext(),i=this.render.convertToGlobal(this.state.position),n=this.render.getRect().pageWidth,s=this.render.getRect().height;t.save();t.translate(i.x,i.y);t.beginPath();for(let e of this.state.area)if(null!==e){e=this.render.convertToGlobal(e);t.lineTo(e.x-i.x,e.y-i.y)}t.rotate(this.state.angle);t.clip();this.isLoad?t.drawImage(this.image,0,0,n,s):this.drawLoader(t,{x:0,y:0},n,s);t.restore()}simpleDraw(e){const t=this.render.getRect(),i=this.render.getContext(),n=t.pageWidth,s=t.height,r=1===e?t.left+t.pageWidth:t.left,a=t.top;this.isLoad?i.drawImage(this.image,r,a,n,s):this.drawLoader(i,{x:r,y:a},n,s)}drawLoader(e,t,i,n){e.beginPath();e.strokeStyle="rgb(200, 200, 200)";e.fillStyle="rgb(255, 255, 255)";e.lineWidth=1;e.rect(t.x+1,t.y+1,i-1,n-1);e.stroke();e.fill();const s={x:t.x+i/2,y:t.y+n/2};e.beginPath();e.lineWidth=10;e.arc(s.x,s.y,20,this.loadingAngle,3*Math.PI/2+this.loadingAngle);e.stroke();e.closePath();this.loadingAngle+=.07;this.loadingAngle>=2*Math.PI&&(this.loadingAngle=0)}load(){this.isLoad||(this.image.onload=()=>{this.isLoad=!0})}newTemporaryCopy(){return this}getTemporaryCopy(){return this}hideTemporaryCopy(){}}class PageCollection{constructor(e,t){this.pages=[];this.currentPageIndex=0;this.currentSpreadIndex=0;this.landscapeSpread=[];this.portraitSpread=[];this.render=t;this.app=e;this.currentPageIndex=0;this.isShowCover=this.app.getSettings().showCover}destroy(){this.pages=[]}createSpread(){this.landscapeSpread=[];this.portraitSpread=[];for(let e=0;e<this.pages.length;e++)this.portraitSpread.push([e]);let e=0;if(this.isShowCover){this.pages[0].setDensity("hard");this.landscapeSpread.push([e]);e++}for(let t=e;t<this.pages.length;t+=2)if(t<this.pages.length-1)this.landscapeSpread.push([t,t+1]);else{this.landscapeSpread.push([t]);this.pages[t].setDensity("hard")}}getSpread(){return"landscape"===this.render.getOrientation()?this.landscapeSpread:this.portraitSpread}getSpreadIndexByPage(e){const t=this.getSpread();for(let i=0;i<t.length;i++)if(e===t[i][0]||e===t[i][1])return i;return null}getPageCount(){return this.pages.length}getPages(){return this.pages}getPage(e){if(e>=0&&e<this.pages.length)return this.pages[e];throw new Error("Invalid page number")}nextBy(e){const t=this.pages.indexOf(e);return t<this.pages.length-1?this.pages[t+1]:null}prevBy(e){const t=this.pages.indexOf(e);return t>0?this.pages[t-1]:null}getFlippingPage(e){const t=this.currentSpreadIndex;if("portrait"===this.render.getOrientation())return 0===e?this.pages[t].newTemporaryCopy():this.pages[t-1];{const i=0===e?this.getSpread()[t+1]:this.getSpread()[t-1];return 1===i.length||0===e?this.pages[i[0]]:this.pages[i[1]]}}getBottomPage(e){const t=this.currentSpreadIndex;if("portrait"===this.render.getOrientation())return 0===e?this.pages[t+1]:this.pages[t-1];{const i=0===e?this.getSpread()[t+1]:this.getSpread()[t-1];return 1===i.length?this.pages[i[0]]:0===e?this.pages[i[1]]:this.pages[i[0]]}}showNext(){if(this.currentSpreadIndex<this.getSpread().length){this.currentSpreadIndex++;this.showSpread()}}showPrev(){if(this.currentSpreadIndex>0){this.currentSpreadIndex--;this.showSpread()}}getCurrentPageIndex(){return this.currentPageIndex}show(e=null){null===e&&(e=this.currentPageIndex);if(e<0||e>=this.pages.length)return;const t=this.getSpreadIndexByPage(e);if(null!==t){this.currentSpreadIndex=t;this.showSpread()}}getCurrentSpreadIndex(){return this.currentSpreadIndex}setCurrentSpreadIndex(e){if(!(e>=0&&e<this.getSpread().length))throw new Error("Invalid page");this.currentSpreadIndex=e}showSpread(){const e=this.getSpread()[this.currentSpreadIndex];if(2===e.length){this.render.setLeftPage(this.pages[e[0]]);this.render.setRightPage(this.pages[e[1]])}else if("landscape"===this.render.getOrientation())if(e[0]===this.pages.length-1){this.render.setLeftPage(this.pages[e[0]]);this.render.setRightPage(null)}else{this.render.setLeftPage(null);this.render.setRightPage(this.pages[e[0]])}else{this.render.setLeftPage(null);this.render.setRightPage(this.pages[e[0]])}this.currentPageIndex=e[0];this.app.updatePageIndex(this.currentPageIndex)}}class ImagePageCollection extends PageCollection{constructor(e,t,i){super(e,t);this.imagesHref=i}load(){for(const e of this.imagesHref){const t=new ImagePage(this.render,e,"soft");t.load();this.pages.push(t)}this.createSpread()}}class Helper{static GetDistanceBetweenTwoPoint(e,t){return null===e||null===t?1/0:Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}static GetSegmentLength(e){return Helper.GetDistanceBetweenTwoPoint(e[0],e[1])}static GetAngleBetweenTwoLine(e,t){const i=e[0].y-e[1].y,n=t[0].y-t[1].y,s=e[1].x-e[0].x,r=t[1].x-t[0].x;return Math.acos((i*n+s*r)/(Math.sqrt(i*i+s*s)*Math.sqrt(n*n+r*r)))}static PointInRect(e,t){return null===t?null:t.x>=e.left&&t.x<=e.width+e.left&&t.y>=e.top&&t.y<=e.top+e.height?t:null}static GetRotatedPoint(e,t,i){return{x:e.x*Math.cos(i)+e.y*Math.sin(i)+t.x,y:e.y*Math.cos(i)-e.x*Math.sin(i)+t.y}}static LimitPointToCircle(e,t,i){if(Helper.GetDistanceBetweenTwoPoint(e,i)<=t)return i;const n=e.x,s=e.y,r=i.x,a=i.y;let o=Math.sqrt(Math.pow(t,2)*Math.pow(n-r,2)/(Math.pow(n-r,2)+Math.pow(s-a,2)))+n;i.x<0&&(o*=-1);let l=(o-n)*(s-a)/(n-r)+s;n-r+s===0&&(l=t);return{x:o,y:l}}static GetIntersectBetweenTwoSegment(e,t,i){return Helper.PointInRect(e,Helper.GetIntersectBeetwenTwoLine(t,i))}static GetIntersectBeetwenTwoLine(e,t){const i=e[0].y-e[1].y,n=t[0].y-t[1].y,s=e[1].x-e[0].x,r=t[1].x-t[0].x,a=e[0].x*e[1].y-e[1].x*e[0].y,o=t[0].x*t[1].y-t[1].x*t[0].y,l=i*o-n*a,h=s*o-r*a,c=-(a*r-o*s)/(i*r-n*s),d=-(i*o-n*a)/(i*r-n*s);if(isFinite(c)&&isFinite(d))return{x:c,y:d};if(Math.abs(l-h)<.1)throw new Error("Segment included");return null}static GetCordsFromTwoPoint(e,t){const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y),s=Math.max(i,n),r=[e];function getCord(e,t,i,n,s){return t>e?e+s*(i/n):t<e?e-s*(i/n):e}for(let a=1;a<=s;a+=1)r.push({x:getCord(e.x,t.x,i,s,a),y:getCord(e.y,t.y,n,s,a)});return r}}class HTMLPage extends Page{constructor(e,t,i){super(e,i);this.copiedElement=null;this.temporaryCopy=null;this.isLoad=!1;this.element=t;this.element.classList.add("stf__item");this.element.classList.add("--"+i)}newTemporaryCopy(){if("hard"===this.nowDrawingDensity)return this;if(null===this.temporaryCopy){this.copiedElement=this.element.cloneNode(!0);this.element.parentElement.appendChild(this.copiedElement);this.temporaryCopy=new HTMLPage(this.render,this.copiedElement,this.nowDrawingDensity)}return this.getTemporaryCopy()}getTemporaryCopy(){return this.temporaryCopy}hideTemporaryCopy(){if(null!==this.temporaryCopy){this.copiedElement.remove();this.copiedElement=null;this.temporaryCopy=null}}draw(e){const t=e||this.nowDrawingDensity,i=this.render.convertToGlobal(this.state.position),n=this.render.getRect().pageWidth,s=this.render.getRect().height;this.element.classList.remove("--simple");const r=`\n position: absolute;\n display: block;\n z-index: ${this.element.style.zIndex};\n left: 0;\n top: 0;\n width: ${n}px;\n height: ${s}px;\n `;"hard"===t?this.drawHard(r):this.drawSoft(i,r)}drawHard(e=""){const t=this.render.getRect().left+this.render.getRect().width/2,i=this.state.hardDrawingAngle,n=e+"\n backface-visibility: hidden;\n -webkit-backface-visibility: hidden;\n clip-path: none;\n -webkit-clip-path: none;\n "+(0===this.orientation?`transform-origin: ${this.render.getRect().pageWidth}px 0;\n transform: translate3d(0, 0, 0) rotateY(${i}deg);`:`transform-origin: 0 0;\n transform: translate3d(${t}px, 0, 0) rotateY(${i}deg);`);this.element.style.cssText=n}drawSoft(e,t=""){let i="polygon( ";for(const e of this.state.area)if(null!==e){let t=1===this.render.getDirection()?{x:-e.x+this.state.position.x,y:e.y-this.state.position.y}:{x:e.x-this.state.position.x,y:e.y-this.state.position.y};t=Helper.GetRotatedPoint(t,{x:0,y:0},this.state.angle);i+=t.x+"px "+t.y+"px, "}i=i.slice(0,-2);i+=")";const n=t+`transform-origin: 0 0; clip-path: ${i}; -webkit-clip-path: ${i};`+(this.render.isSafari()&&0===this.state.angle?`transform: translate(${e.x}px, ${e.y}px);`:`transform: translate3d(${e.x}px, ${e.y}px, 0) rotate(${this.state.angle}rad);`);this.element.style.cssText=n}simpleDraw(e){const t=this.render.getRect(),i=t.pageWidth,n=t.height,s=1===e?t.left+t.pageWidth:t.left,r=t.top;this.element.classList.add("--simple");this.element.style.cssText=`\n position: absolute;\n display: block;\n height: ${n}px;\n left: ${s}px;\n top: ${r}px;\n width: ${i}px;\n z-index: ${this.render.getSettings().startZIndex+1};`}getElement(){return this.element}load(){this.isLoad=!0}setOrientation(e){super.setOrientation(e);this.element.classList.remove("--left","--right");this.element.classList.add(1===e?"--right":"--left")}setDrawingDensity(e){this.element.classList.remove("--soft","--hard");this.element.classList.add("--"+e);super.setDrawingDensity(e)}}class HTMLPageCollection extends PageCollection{constructor(e,t,i,n){super(e,t);this.element=i;this.pagesElement=n}load(){for(const e of this.pagesElement){const t=new HTMLPage(this.render,e,"hard"===e.dataset.density?"hard":"soft");t.load();this.pages.push(t)}this.createSpread()}}class FlipCalculation{constructor(e,t,i,n){this.direction=e;this.corner=t;this.topIntersectPoint=null;this.sideIntersectPoint=null;this.bottomIntersectPoint=null;this.pageWidth=parseInt(i,10);this.pageHeight=parseInt(n,10)}calc(e){try{this.position=this.calcAngleAndPosition(e);this.calculateIntersectPoint(this.position);return!0}catch(e){return!1}}getFlippingClipArea(){const e=[];let t=!1;e.push(this.rect.topLeft);e.push(this.topIntersectPoint);if(null===this.sideIntersectPoint)t=!0;else{e.push(this.sideIntersectPoint);null===this.bottomIntersectPoint&&(t=!1)}e.push(this.bottomIntersectPoint);(t||"bottom"===this.corner)&&e.push(this.rect.bottomLeft);return e}getBottomClipArea(){const e=[];e.push(this.topIntersectPoint);if("top"===this.corner)e.push({x:this.pageWidth,y:0});else{null!==this.topIntersectPoint&&e.push({x:this.pageWidth,y:0});e.push({x:this.pageWidth,y:this.pageHeight})}null!==this.sideIntersectPoint?Helper.GetDistanceBetweenTwoPoint(this.sideIntersectPoint,this.topIntersectPoint)>=10&&e.push(this.sideIntersectPoint):"top"===this.corner&&e.push({x:this.pageWidth,y:this.pageHeight});e.push(this.bottomIntersectPoint);e.push(this.topIntersectPoint);return e}getAngle(){return 0===this.direction?-this.angle:this.angle}getRect(){return this.rect}getPosition(){return this.position}getActiveCorner(){return 0===this.direction?this.rect.topLeft:this.rect.topRight}getDirection(){return this.direction}getFlippingProgress(){return Math.abs((this.position.x-this.pageWidth)/(2*this.pageWidth)*100)}getCorner(){return this.corner}getBottomPagePosition(){return 1===this.direction?{x:this.pageWidth,y:0}:{x:0,y:0}}getShadowStartPoint(){return"top"===this.corner?this.topIntersectPoint:null!==this.sideIntersectPoint?this.sideIntersectPoint:this.topIntersectPoint}getShadowAngle(){const e=Helper.GetAngleBetweenTwoLine(this.getSegmentToShadowLine(),[{x:0,y:0},{x:this.pageWidth,y:0}]);return 0===this.direction?e:Math.PI-e}calcAngleAndPosition(e){let t=e;this.updateAngleAndGeometry(t);t="top"===this.corner?this.checkPositionAtCenterLine(t,{x:0,y:0},{x:0,y:this.pageHeight}):this.checkPositionAtCenterLine(t,{x:0,y:this.pageHeight},{x:0,y:0});if(Math.abs(t.x-this.pageWidth)<1&&Math.abs(t.y)<1)throw new Error("Point is too small");return t}updateAngleAndGeometry(e){this.angle=this.calculateAngle(e);this.rect=this.getPageRect(e)}calculateAngle(e){const t=this.pageWidth-e.x+1,i="bottom"===this.corner?this.pageHeight-e.y:e.y;let n=2*Math.acos(t/Math.sqrt(i*i+t*t));i<0&&(n=-n);const s=Math.PI-n;if(!isFinite(n)||s>=0&&s<.003)throw new Error("The G point is too small");"bottom"===this.corner&&(n=-n);return n}getPageRect(e){return"top"===this.corner?this.getRectFromBasePoint([{x:0,y:0},{x:this.pageWidth,y:0},{x:0,y:this.pageHeight},{x:this.pageWidth,y:this.pageHeight}],e):this.getRectFromBasePoint([{x:0,y:-this.pageHeight},{x:this.pageWidth,y:-this.pageHeight},{x:0,y:0},{x:this.pageWidth,y:0}],e)}getRectFromBasePoint(e,t){return{topLeft:this.getRotatedPoint(e[0],t),topRight:this.getRotatedPoint(e[1],t),bottomLeft:this.getRotatedPoint(e[2],t),bottomRight:this.getRotatedPoint(e[3],t)}}getRotatedPoint(e,t){return{x:e.x*Math.cos(this.angle)+e.y*Math.sin(this.angle)+t.x,y:e.y*Math.cos(this.angle)-e.x*Math.sin(this.angle)+t.y}}calculateIntersectPoint(e){const t={left:-1,top:-1,width:this.pageWidth+2,height:this.pageHeight+2};if("top"===this.corner){this.topIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[e,this.rect.topRight],[{x:0,y:0},{x:this.pageWidth,y:0}]);this.sideIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[e,this.rect.bottomLeft],[{x:this.pageWidth,y:0},{x:this.pageWidth,y:this.pageHeight}]);this.bottomIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[this.rect.bottomLeft,this.rect.bottomRight],[{x:0,y:this.pageHeight},{x:this.pageWidth,y:this.pageHeight}])}else{this.topIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[this.rect.topLeft,this.rect.topRight],[{x:0,y:0},{x:this.pageWidth,y:0}]);this.sideIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[e,this.rect.topLeft],[{x:this.pageWidth,y:0},{x:this.pageWidth,y:this.pageHeight}]);this.bottomIntersectPoint=Helper.GetIntersectBetweenTwoSegment(t,[this.rect.bottomLeft,this.rect.bottomRight],[{x:0,y:this.pageHeight},{x:this.pageWidth,y:this.pageHeight}])}}checkPositionAtCenterLine(e,t,i){let n=e;const s=Helper.LimitPointToCircle(t,this.pageWidth,n);if(n!==s){n=s;this.updateAngleAndGeometry(n)}const r=Math.sqrt(Math.pow(this.pageWidth,2)+Math.pow(this.pageHeight,2));let a=this.rect.bottomRight,o=this.rect.topLeft;if("bottom"===this.corner){a=this.rect.topRight;o=this.rect.bottomLeft}if(a.x<=0){const e=Helper.LimitPointToCircle(i,r,o);if(e!==n){n=e;this.updateAngleAndGeometry(n)}}return n}getSegmentToShadowLine(){const e=this.getShadowStartPoint();return[e,e!==this.sideIntersectPoint&&null!==this.sideIntersectPoint?this.sideIntersectPoint:this.bottomIntersectPoint]}}class Flip{constructor(e,t){this.flippingPage=null;this.bottomPage=null;this.calc=null;this.state="read";this.render=e;this.app=t}fold(e){this.setState("user_fold");null===this.calc&&this.start(e);this.do(this.render.convertToPage(e))}flip(e){if(this.app.getSettings().disableFlipByClick&&!this.isPointOnCorners(e))return;null!==this.calc&&this.render.finishAnimation();if(!this.start(e))return;const t=this.getBoundsRect();this.setState("flipping");const i=t.height/10,n="bottom"===this.calc.getCorner()?t.height-i:i,s="bottom"===this.calc.getCorner()?t.height:0;this.calc.calc({x:t.pageWidth-i,y:n});this.animateFlippingTo({x:t.pageWidth-i,y:n},{x:-t.pageWidth,y:s},!0)}start(e){this.reset();const t=this.render.convertToBook(e),i=this.getBoundsRect(),n=this.getDirectionByPoint(t),s=t.y>=i.height/2?"bottom":"top";if(!this.checkDirection(n))return!1;try{this.flippingPage=this.app.getPageCollection().getFlippingPage(n);this.bottomPage=this.app.getPageCollection().getBottomPage(n);if("landscape"===this.render.getOrientation())if(1===n){const e=this.app.getPageCollection().nextBy(this.flippingPage);if(null!==e&&this.flippingPage.getDensity()!==e.getDensity()){this.flippingPage.setDrawingDensity("hard");e.setDrawingDensity("hard")}}else{const e=this.app.getPageCollection().prevBy(this.flippingPage);if(null!==e&&this.flippingPage.getDensity()!==e.getDensity()){this.flippingPage.setDrawingDensity("hard");e.setDrawingDensity("hard")}}this.render.setDirection(n);this.calc=new FlipCalculation(n,s,i.pageWidth.toString(10),i.height.toString(10));return!0}catch(e){return!1}}do(e){if(null!==this.calc&&this.calc.calc(e)){const e=this.calc.getFlippingProgress();this.bottomPage.setArea(this.calc.getBottomClipArea());this.bottomPage.setPosition(this.calc.getBottomPagePosition());this.bottomPage.setAngle(0);this.bottomPage.setHardAngle(0);this.flippingPage.setArea(this.calc.getFlippingClipArea());this.flippingPage.setPosition(this.calc.getActiveCorner());this.flippingPage.setAngle(this.calc.getAngle());0===this.calc.getDirection()?this.flippingPage.setHardAngle(90*(200-2*e)/100):this.flippingPage.setHardAngle(-90*(200-2*e)/100);this.render.setPageRect(this.calc.getRect());this.render.setBottomPage(this.bottomPage);this.render.setFlippingPage(this.flippingPage);this.render.setShadowData(this.calc.getShadowStartPoint(),this.calc.getShadowAngle(),e,this.calc.getDirection())}}flipToPage(e,t){const i=this.app.getPageCollection().getCurrentSpreadIndex(),n=this.app.getPageCollection().getSpreadIndexByPage(e);try{if(n>i){this.app.getPageCollection().setCurrentSpreadIndex(n-1);this.flipNext(t)}if(n<i){this.app.getPageCollection().setCurrentSpreadIndex(n+1);this.flipPrev(t)}}catch(e){}}flipNext(e){this.flip({x:this.render.getRect().left+2*this.render.getRect().pageWidth-10,y:"top"===e?1:this.render.getRect().height-2})}flipPrev(e){this.flip({x:10,y:"top"===e?1:this.render.getRect().height-2})}stopMove(){if(null===this.calc)return;const e=this.calc.getPosition(),t=this.getBoundsRect(),i="bottom"===this.calc.getCorner()?t.height:0;e.x<=0?this.animateFlippingTo(e,{x:-t.pageWidth,y:i},!0):this.animateFlippingTo(e,{x:t.pageWidth,y:i},!1)}showCorner(e){if(!this.checkState("read","fold_corner"))return;const t=this.getBoundsRect(),i=t.pageWidth;if(this.isPointOnCorners(e))if(null===this.calc){if(!this.start(e))return;this.setState("fold_corner");this.calc.calc({x:i-1,y:1});const n=50,s="bottom"===this.calc.getCorner()?t.height-1:1,r="bottom"===this.calc.getCorner()?t.height-n:n;this.animateFlippingTo({x:i-1,y:s},{x:i-n,y:r},!1,!1)}else this.do(this.render.convertToPage(e));else{this.setState("read");this.render.finishAnimation();this.stopMove()}}animateFlippingTo(e,t,i,n=!0){const s=Helper.GetCordsFromTwoPoint(e,t),r=[];for(const e of s)r.push((()=>this.do(e)));const a=this.getAnimationDuration(s.length);this.render.startAnimation(r,a,(()=>{if(this.calc){i&&(1===this.calc.getDirection()?this.app.turnToPrevPage():this.app.turnToNextPage());if(n){this.render.setBottomPage(null);this.render.setFlippingPage(null);this.render.clearShadow();this.setState("read");this.reset()}}}))}getCalculation(){return this.calc}getState(){return this.state}setState(e){if(this.state!==e){this.app.updateState(e);this.state=e}}getDirectionByPoint(e){const t=this.getBoundsRect();if("portrait"===this.render.getOrientation()){if(e.x-t.pageWidth<=t.width/5)return 1}else if(e.x<t.width/2)return 1;return 0}getAnimationDuration(e){const t=this.app.getSettings().flippingTime;return e>=1e3?t:e/1e3*t}checkDirection(e){return 0===e?this.app.getCurrentPageIndex()<this.app.getPageCount()-1:this.app.getCurrentPageIndex()>=1}reset(){this.calc=null;this.flippingPage=null;this.bottomPage=null}getBoundsRect(){return this.render.getRect()}checkState(...e){for(const t of e)if(this.state===t)return!0;return!1}isPointOnCorners(e){const t=this.getBoundsRect(),i=t.pageWidth,n=Math.sqrt(Math.pow(i,2)+Math.pow(t.height,2))/5,s=this.render.convertToBook(e);return s.x>0&&s.y>0&&s.x<t.width&&s.y<t.height&&(s.x<n||s.x>t.width-n)&&(s.y<n||s.y>t.height-n)}}class Render{constructor(e,t){this.leftPage=null;this.rightPage=null;this.flippingPage=null;this.bottomPage=null;this.direction=null;this.orientation=null;this.shadow=null;this.animation=null;this.pageRect=null;this.boundsRect=null;this.timer=0;this.safari=!1;this.setting=t;this.app=e;const i=new RegExp("Version\\/[\\d\\.]+.*Safari/");this.safari=null!==i.exec(window.navigator.userAgent)}render(e){if(null!==this.animation){const t=Math.round((e-this.animation.startedAt)/this.animation.durationFrame);if(t<this.animation.frames.length)this.animation.frames[t]();else{this.animation.onAnimateEnd();this.animation=null}}this.timer=e;this.drawFrame()}start(){this.update();const loop=e=>{this.render(e);requestAnimationFrame(loop)};requestAnimationFrame(loop)}startAnimation(e,t,i){this.finishAnimation();this.animation={frames:e,duration:t,durationFrame:t/e.length,onAnimateEnd:i,startedAt:this.timer}}finishAnimation(){if(null!==this.animation){this.animation.frames[this.animation.frames.length-1]();null!==this.animation.onAnimateEnd&&this.animation.onAnimateEnd()}this.animation=null}update(){this.boundsRect=null;const e=this.calculateBoundsRect();if(this.orientation!==e){this.orientation=e;this.app.updateOrientation(e)}}calculateBoundsRect(){let e="landscape";const t=this.getBlockWidth(),i=t/2,n=this.getBlockHeight()/2,s=this.setting.width/this.setting.height;let r=this.setting.width,a=this.setting.height,o=i-r;if("stretch"===this.setting.size){t<2*this.setting.minWidth&&this.app.getSettings().usePortrait&&(e="portrait");r="portrait"===e?this.getBlockWidth():this.getBlockWidth()/2;r>this.setting.maxWidth&&(r=this.setting.maxWidth);a=r/s;if(a>this.getBlockHeight()){a=this.getBlockHeight();r=a*s}o="portrait"===e?i-r/2-r:i-r}else if(t<2*r&&this.app.getSettings().usePortrait){e="portrait";o=i-r/2-r}this.boundsRect={left:o,top:n-a/2,width:2*r,height:a,pageWidth:r};return e}setShadowData(e,t,i,n){if(!this.app.getSettings().drawShadow)return;const s=100*this.getSettings().maxShadowOpacity;this.shadow={pos:e,angle:t,width:3*this.getRect().pageWidth/4*i/100,opacity:(100-i)*s/100/100,direction:n,progress:2*i}}clearShadow(){this.shadow=null}getBlockWidth(){return this.app.getUI().getDistElement().offsetWidth}getBlockHeight(){return this.app.getUI().getDistElement().offsetHeight}getDirection(){return this.direction}getRect(){null===this.boundsRect&&this.calculateBoundsRect();return this.boundsRect}getSettings(){return this.app.getSettings()}getOrientation(){return this.orientation}setPageRect(e){this.pageRect=e}setDirection(e){this.direction=e}setRightPage(e){null!==e&&e.setOrientation(1);this.rightPage=e}setLeftPage(e){null!==e&&e.setOrientation(0);this.leftPage=e}setBottomPage(e){null!==e&&e.setOrientation(1===this.direction?0:1);this.bottomPage=e}setFlippingPage(e){null!==e&&e.setOrientation(0===this.direction&&"portrait"!==this.orientation?0:1);this.flippingPage=e}convertToBook(e){const t=this.getRect();return{x:e.x-t.left,y:e.y-t.top}}isSafari(){return this.safari}convertToPage(e,t){t||(t=this.direction);const i=this.getRect();return{x:0===t?e.x-i.left-i.width/2:i.width/2-e.x+i.left,y:e.y-i.top}}convertToGlobal(e,t){t||(t=this.direction);if(null==e)return null;const i=this.getRect();return{x:0===t?e.x+i.left+i.width/2:i.width/2-e.x+i.left,y:e.y+i.top}}convertRectToGlobal(e,t){t||(t=this.direction);return{topLeft:this.convertToGlobal(e.topLeft,t),topRight:this.convertToGlobal(e.topRight,t),bottomLeft:this.convertToGlobal(e.bottomLeft,t),bottomRight:this.convertToGlobal(e.bottomRight,t)}}}class CanvasRender extends Render{constructor(e,t,i){super(e,t);this.canvas=i;this.ctx=i.getContext("2d")}getContext(){return this.ctx}reload(){}drawFrame(){this.clear();"portrait"!==this.orientation&&null!=this.leftPage&&this.leftPage.simpleDraw(0);null!=this.rightPage&&this.rightPage.simpleDraw(1);null!=this.bottomPage&&this.bottomPage.draw();this.drawBookShadow();null!=this.flippingPage&&this.flippingPage.draw();if(null!=this.shadow){this.drawOuterShadow();this.drawInnerShadow()}const e=this.getRect();if("portrait"===this.orientation){this.ctx.beginPath();this.ctx.rect(e.left+e.pageWidth,e.top,e.width,e.height);this.ctx.clip()}}drawBookShadow(){const e=this.getRect();this.ctx.save();this.ctx.beginPath();const t=e.width/20;this.ctx.rect(e.left,e.top,e.width,e.height);const i={x:e.left+e.width/2-t/2,y:0};this.ctx.translate(i.x,i.y);const n=this.ctx.createLinearGradient(0,0,t,0);n.addColorStop(0,"rgba(0, 0, 0, 0)");n.addColorStop(.4,"rgba(0, 0, 0, 0.2)");n.addColorStop(.49,"rgba(0, 0, 0, 0.1)");n.addColorStop(.5,"rgba(0, 0, 0, 0.5)");n.addColorStop(.51,"rgba(0, 0, 0, 0.4)");n.addColorStop(1,"rgba(0, 0, 0, 0)");this.ctx.clip();this.ctx.fillStyle=n;this.ctx.fillRect(0,0,t,2*e.height);this.ctx.restore()}drawOuterShadow(){const e=this.getRect();this.ctx.save();this.ctx.beginPath();this.ctx.rect(e.left,e.top,e.width,e.height);const t=this.convertToGlobal({x:this.shadow.pos.x,y:this.shadow.pos.y});this.ctx.translate(t.x,t.y);this.ctx.rotate(Math.PI+this.shadow.angle+Math.PI/2);const i=this.ctx.createLinearGradient(0,0,this.shadow.width,0);if(0===this.shadow.direction){this.ctx.translate(0,-100);i.addColorStop(0,"rgba(0, 0, 0, "+this.shadow.opacity+")");i.addColorStop(1,"rgba(0, 0, 0, 0)")}else{this.ctx.translate(-this.shadow.width,-100);i.addColorStop(0,"rgba(0, 0, 0, 0)");i.addColorStop(1,"rgba(0, 0, 0, "+this.shadow.opacity+")")}this.ctx.clip();this.ctx.fillStyle=i;this.ctx.fillRect(0,0,this.shadow.width,2*e.height);this.ctx.restore()}drawInnerShadow(){const e=this.getRect();this.ctx.save();this.ctx.beginPath();const t=this.convertToGlobal({x:this.shadow.pos.x,y:this.shadow.pos.y}),i=this.convertRectToGlobal(this.pageRect);this.ctx.moveTo(i.topLeft.x,i.topLeft.y);this.ctx.lineTo(i.topRight.x,i.topRight.y);this.ctx.lineTo(i.bottomRight.x,i.bottomRight.y);this.ctx.lineTo(i.bottomLeft.x,i.bottomLeft.y);this.ctx.translate(t.x,t.y);this.ctx.rotate(Math.PI+this.shadow.angle+Math.PI/2);const n=3*this.shadow.width/4,s=this.ctx.createLinearGradient(0,0,n,0);if(0===this.shadow.direction){this.ctx.translate(-n,-100);s.addColorStop(1,"rgba(0, 0, 0, "+this.shadow.opacity+")");s.addColorStop(.9,"rgba(0, 0, 0, 0.05)");s.addColorStop(.7,"rgba(0, 0, 0, "+this.shadow.opacity+")");s.addColorStop(0,"rgba(0, 0, 0, 0)")}else{this.ctx.translate(0,-100);s.addColorStop(0,"rgba(0, 0, 0, "+this.shadow.opacity+")");s.addColorStop(.1,"rgba(0, 0, 0, 0.05)");s.addColorStop(.3,"rgba(0, 0, 0, "+this.shadow.opacity+")");s.addColorStop(1,"rgba(0, 0, 0, 0)")}this.ctx.clip();this.ctx.fillStyle=s;this.ctx.fillRect(0,0,n,2*e.height);this.ctx.restore()}clear(){this.ctx.fillStyle="white";this.ctx.fillRect(0,0,this.canvas.width,this.canvas.height)}}class UI{constructor(e,t,i){this.touchPoint=null;this.swipeTimeout=250;this.onResize=()=>{this.update()};this.onMouseDown=e=>{if(this.checkTarget(e.target)){const t=this.getMousePos(e.clientX,e.clientY);this.app.startUserTouch(t);e.preventDefault()}};this.onTouchStart=e=>{if(this.checkTarget(e.target)&&e.changedTouches.length>0){const t=e.changedTouches[0],i=this.getMousePos(t.clientX,t.clientY);this.touchPoint={point:i,time:Date.now()};setTimeout((()=>{null!==this.touchPoint&&this.app.startUserTouch(i)}),this.swipeTimeout);this.app.getSettings().mobileScrollSupport||e.preventDefault()}};this.onMouseUp=e=>{const t=this.getMousePos(e.clientX,e.clientY);this.app.userStop(t)};this.onMouseMove=e=>{const t=this.getMousePos(e.clientX,e.clientY);this.app.userMove(t,!1)};this.onTouchMove=e=>{if(e.changedTouches.length>0){const t=e.changedTouches[0],i=this.getMousePos(t.clientX,t.clientY);if(this.app.getSettings().mobileScrollSupport){null!==this.touchPoint&&(Math.abs(this.touchPoint.point.x-i.x)>10||"read"!==this.app.getState())&&e.cancelable&&this.app.userMove(i,!0);"read"!==this.app.getState()&&e.preventDefault()}else this.app.userMove(i,!0)}};this.onTouchEnd=e=>{if(e.changedTouches.length>0){const t=e.changedTouches[0],i=this.getMousePos(t.clientX,t.clientY);let n=!1;if(null!==this.touchPoint){const e=i.x-this.touchPoint.point.x,t=Math.abs(i.y-this.touchPoint.point.y);if(Math.abs(e)>this.swipeDistance&&t<2*this.swipeDistance&&Date.now()-this.touchPoint.time<this.swipeTimeout){e>0?this.app.flipPrev(this.touchPoint.point.y<this.app.getRender().getRect().height/2?"top":"bottom"):this.app.flipNext(this.touchPoint.point.y<this.app.getRender().getRect().height/2?"top":"bottom");n=!0}this.touchPoint=null}this.app.userStop(i,n)}};this.parentElement=e;e.classList.add("stf__parent");e.insertAdjacentHTML("afterbegin",'<div class="stf__wrapper"></div>');this.wrapper=e.querySelector(".stf__wrapper");this.app=t;const n=this.app.getSettings().usePortrait?1:2;e.style.minWidth=i.minWidth*n+"px";e.style.minHeight=i.minHeight+"px";if("fixed"===i.size){e.style.minWidth=i.width*n+"px";e.style.minHeight=i.height+"px"}if(i.autoSize){e.style.width="100%";e.style.maxWidth=2*i.maxWidth+"px"}e.style.display="block";window.addEventListener("resize",this.onResize,!1);this.swipeDistance=i.swipeDistance}destroy(){this.app.getSettings().useMouseEvents&&this.removeHandlers();this.distElement.remove();this.wrapper.remove()}getDistElement(){return this.distElement}getWrapper(){return this.wrapper}setOrientationStyle(e){this.wrapper.classList.remove("--portrait","--landscape");if("portrait"===e){this.app.getSettings().autoSize&&(this.wrapper.style.paddingBottom=this.app.getSettings().height/this.app.getSettings().width*100+"%");this.wrapper.classList.add("--portrait")}else{this.app.getSettings().autoSize&&(this.wrapper.style.paddingBottom=this.app.getSettings().height/(2*this.app.getSettings().width)*100+"%");this.wrapper.classList.add("--landscape")}this.update()}removeHandlers(){window.removeEventListener("resize",this.onResize);this.distElement.removeEventListener("mousedown",this.onMouseDown);this.distElement.removeEventListener("touchstart",this.onTouchStart);window.removeEventListener("mousemove",this.onMouseMove);window.removeEventListener("touchmove",this.onTouchMove);window.removeEventListener("mouseup",this.onMouseUp);window.removeEventListener("touchend",this.onTouchEnd)}setHandlers(){window.addEventListener("resize",this.onResize,!1);if(this.app.getSettings().useMouseEvents){this.distElement.addEventListener("mousedown",this.onMouseDown);this.distElement.addEventListener("touchstart",this.onTouchStart);window.addEventListener("mousemove",this.onMouseMove);window.addEventListener("touchmove",this.onTouchMove,{passive:!this.app.getSettings().mobileScrollSupport});window.addEventListener("mouseup",this.onMouseUp);window.addEventListener("touchend",this.onTouchEnd)}}getMousePos(e,t){const i=this.distElement.getBoundingClientRect();return{x:e-i.left,y:t-i.top}}checkTarget(e){return!this.app.getSettings().clickEventForward||!["a","button"].includes(e.tagName.toLowerCase())}}class HTMLUI extends UI{constructor(e,t,i,n){super(e,t,i);this.wrapper.insertAdjacentHTML("afterbegin",'<div class="stf__block"></div>');this.distElement=e.querySelector(".stf__block");this.items=n;for(const e of n)this.distElement.appendChild(e);this.setHandlers()}clear(){for(const e of this.items)this.parentElement.appendChild(e)}updateItems(e){this.removeHandlers();this.distElement.innerHTML="";for(const t of e)this.distElement.appendChild(t);this.items=e;this.setHandlers()}update(){this.app.getRender().update()}}class CanvasUI extends UI{constructor(e,t,i){super(e,t,i);this.wrapper.innerHTML='<canvas class="stf__canvas"></canvas>';this.canvas=e.querySelectorAll("canvas")[0];this.distElement=this.canvas;this.resizeCanvas();this.setHandlers()}resizeCanvas(){const e=getComputedStyle(this.canvas),t=parseInt(e.getPropertyValue("width"),10),i=parseInt(e.getPropertyValue("height"),10);this.canvas.width=t;this.canvas.height=i}getCanvas(){return this.canvas}update(){this.resizeCanvas();this.app.getRender().update()}}class HTMLRender extends Render{constructor(e,t,i){super(e,t);this.outerShadow=null;this.innerShadow=null;this.hardShadow=null;this.hardInnerShadow=null;this.element=i;this.createShadows()}createShadows(){this.element.insertAdjacentHTML("beforeend",'<div class="stf__outerShadow"></div>\n <div class="stf__innerShadow"></div>\n <div class="stf__hardShadow"></div>\n <div class="stf__hardInnerShadow"></div>');this.outerShadow=this.element.querySelector(".stf__outerShadow");this.innerShadow=this.element.querySelector(".stf__innerShadow");this.hardShadow=this.element.querySelector(".stf__hardShadow");this.hardInnerShadow=this.element.querySelector(".stf__hardInnerShadow")}clearShadow(){super.clearShadow();this.outerShadow.style.cssText="display: none";this.innerShadow.style.cssText="display: none";this.hardShadow.style.cssText="display: none";this.hardInnerShadow.style.cssText="display: none"}reload(){this.element.querySelector(".stf__outerShadow")||this.createShadows()}drawHardInnerShadow(){const e=this.getRect(),t=this.shadow.progress>100?200-this.shadow.progress:this.shadow.progress;let i=(100-t)*(2.5*e.pageWidth)/100+20;i>e.pageWidth&&(i=e.pageWidth);let n=`\n display: block;\n z-index: ${(this.getSettings().startZIndex+5).toString(10)};\n width: ${i}px;\n height: ${e.height}px;\n background: linear-gradient(to right,\n rgba(0, 0, 0, ${this.shadow.opacity*t/100}) 5%,\n rgba(0, 0, 0, 0) 100%);\n left: ${e.left+e.width/2}px;\n transform-origin: 0 0;\n `;n+=0===this.getDirection()&&this.shadow.progress>100||1===this.getDirection()&&this.shadow.progress<=100?"transform: translate3d(0, 0, 0);":"transform: translate3d(0, 0, 0) rotateY(180deg);";this.hardInnerShadow.style.cssText=n}drawHardOuterShadow(){const e=this.getRect();let t=(100-(this.shadow.progress>100?200-this.shadow.progress:this.shadow.progress))*(2.5*e.pageWidth)/100+20;t>e.pageWidth&&(t=e.pageWidth);let i=`\n display: block;\n z-index: ${(this.getSettings().startZIndex+4).toString(10)};\n width: ${t}px;\n height: ${e.height}px;\n background: linear-gradient(to left, rgba(0, 0, 0, ${this.shadow.opacity}) 5%, rgba(0, 0, 0, 0) 100%);\n left: ${e.left+e.width/2}px;\n transform-origin: 0 0;\n `;i+=0===this.getDirection()&&this.shadow.progress>100||1===this.getDirection()&&this.shadow.progress<=100?"transform: translate3d(0, 0, 0) rotateY(180deg);":"transform: translate3d(0, 0, 0);";this.hardShadow.style.cssText=i}drawInnerShadow(){const e=this.getRect(),t=3*this.shadow.width/4,i=0===this.getDirection()?t:0,n=0===this.getDirection()?"to left":"to right",s=this.convertToGlobal(this.shadow.pos),r=this.shadow.angle+3*Math.PI/2,a=[this.pageRect.topLeft,this.pageRect.topRight,this.pageRect.bottomRight,this.pageRect.bottomLeft];let o="polygon( ";for(const e of a){let t=1===this.getDirection()?{x:-e.x+this.shadow.pos.x,y:e.y-this.shadow.pos.y}:{x:e.x-this.shadow.pos.x,y:e.y-this.shadow.pos.y};t=Helper.GetRotatedPoint(t,{x:i,y:100},r);o+=t.x+"px "+t.y+"px, "}o=o.slice(0,-2);o+=")";const l=`\n display: block;\n z-index: ${(this.getSettings().startZIndex+10).toString(10)};\n width: ${t}px;\n height: ${2*e.height}px;\n background: linear-gradient(${n},\n rgba(0, 0, 0, ${this.shadow.opacity}) 5%,\n rgba(0, 0, 0, 0.05) 15%,\n rgba(0, 0, 0, ${this.shadow.opacity}) 35%,\n rgba(0, 0, 0, 0) 100%);\n transform-origin: ${i}px 100px;\n transform: translate3d(${s.x-i}px, ${s.y-100}px, 0) rotate(${r}rad);\n clip-path: ${o};\n -webkit-clip-path: ${o};\n `;this.innerShadow.style.cssText=l}drawOuterShadow(){const e=this.getRect(),t=this.convertToGlobal({x:this.shadow.pos.x,y:this.shadow.pos.y}),i=this.shadow.angle+3*Math.PI/2,n=1===this.getDirection()?this.shadow.width:0,s=0===this.getDirection()?"to right":"to left",r=[{x:0,y:0},{x:e.pageWidth,y:0},{x:e.pageWidth,y:e.height},{x:0,y:e.height}];let a="polygon( ";for(const e of r)if(null!==e){let t=1===this.getDirection()?{x:-e.x+this.shadow.pos.x,y:e.y-this.shadow.pos.y}:{x:e.x-this.shadow.pos.x,y:e.y-this.shadow.pos.y};t=Helper.GetRotatedPoint(t,{x:n,y:100},i);a+=t.x+"px "+t.y+"px, "}a=a.slice(0,-2);a+=")";const o=`\n display: block;\n z-index: ${(this.getSettings().startZIndex+10).toString(10)};\n width: ${this.shadow.width}px;\n height: ${2*e.height}px;\n background: linear-gradient(${s}, rgba(0, 0, 0, ${this.shadow.opacity}), rgba(0, 0, 0, 0));\n transform-origin: ${n}px 100px;\n transform: translate3d(${t.x-n}px, ${t.y-100}px, 0) rotate(${i}rad);\n clip-path: ${a};\n -webkit-clip-path: ${a};\n `;this.outerShadow.style.cssText=o}drawLeftPage(){if("portrait"!==this.orientation&&null!==this.leftPage)if(1===this.direction&&null!==this.flippingPage&&"hard"===this.flippingPage.getDrawingDensity()){this.leftPage.getElement().style.zIndex=(this.getSettings().startZIndex+5).toString(10);this.leftPage.setHardDrawingAngle(180+this.flippingPage.getHardAngle());this.leftPage.draw(this.flippingPage.getDrawingDensity())}else this.leftPage.simpleDraw(0)}drawRightPage(){if(null!==this.rightPage)if(0===this.direction&&null!==this.flippingPage&&"hard"===this.flippingPage.getDrawingDensity()){this.rightPage.getElement().style.zIndex=(this.getSettings().startZIndex+5).toString(10);this.rightPage.setHardDrawingAngle(180+this.flippingPage.getHardAngle());this.rightPage.draw(this.flippingPage.getDrawingDensity())}else this.rightPage.simpleDraw(1)}drawBottomPage(){if(null===this.bottomPage)return;const e=null!=this.flippingPage?this.flippingPage.getDrawingDensity():null;if("portrait"!==this.orientation||1!==this.direction){this.bottomPage.getElement().style.zIndex=(this.getSettings().startZIndex+3).toString(10);this.bottomPage.draw(e)}}drawFrame(){this.clear();this.drawLeftPage();this.drawRightPage();this.drawBottomPage();if(null!=this.flippingPage){this.flippingPage.getElement().style.zIndex=(this.getSettings().startZIndex+5).toString(10);this.flippingPage.draw()}if(null!=this.shadow&&null!==this.flippingPage)if("soft"===this.flippingPage.getDrawingDensity()){this.drawOuterShadow();this.drawInnerShadow()}else{this.drawHardOuterShadow();this.drawHardInnerShadow()}}clear(){for(const e of this.app.getPageCollection().getPages()){if(e!==this.leftPage&&e!==this.rightPage&&e!==this.flippingPage&&e!==this.bottomPage){const t=e.getElement().style;"none"!==t.display&&(t.cssText="display: none")}e.getTemporaryCopy()!==this.flippingPage&&e.hideTemporaryCopy()}}update(){super.update();null!==this.rightPage&&this.rightPage.setOrientation(1);null!==this.leftPage&&this.leftPage.setOrientation(0)}}class Settings{constructor(){this._default={startPage:0,size:"fixed",width:0,height:0,minWidth:0,maxWidth:0,minHeight:0,maxHeight:0,drawShadow:!0,flippingTime:1e3,usePortrait:!0,startZIndex:0,autoSize:!0,maxShadowOpacity:1,showCover:!1,mobileScrollSupport:!0,swipeDistance:30,clickEventForward:!0,useMouseEvents:!0,showPageCorners:!0,disableFlipByClick:!1}}getSettings(e){const t=this._default;Object.assign(t,e);if("stretch"!==t.size&&"fixed"!==t.size)throw new Error('Invalid size type. Available only "fixed" and "stretch" value');if(t.width<=0||t.height<=0)throw new Error("Invalid width or height");if(t.flippingTime<=0)throw new Error("Invalid flipping time");if("stretch"===t.size){t.minWidth<=0&&(t.minWidth=100);t.maxWidth<t.minWidth&&(t.maxWidth=2e3);t.minHeight<=0&&(t.minHeight=100);t.maxHeight<t.minHeight&&(t.maxHeight=2e3)}else{t.minWidth=t.width;t.maxWidth=t.width;t.minHeight=t.height;t.maxHeight=t.height}return t}}!function styleInject(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css";"top"===i&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s);s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}(".stf__parent {\n position: relative;\n display: block;\n box-sizing: border-box;\n transform: translateZ(0);\n\n -ms-touch-action: pan-y;\n touch-action: pan-y;\n}\n\n.sft__wrapper {\n position: relative;\n width: 100%;\n box-sizing: border-box;\n}\n\n.stf__parent canvas {\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n}\n\n.stf__block {\n position: absolute;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n perspective: 2000px;\n}\n\n.stf__item {\n display: none;\n position: absolute;\n transform-style: preserve-3d;\n}\n\n.stf__outerShadow {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.stf__innerShadow {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.stf__hardShadow {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.stf__hardInnerShadow {\n position: absolute;\n left: 0;\n top: 0;\n}");t.PageFlip=class PageFlip extends class EventObject{constructor(){this.events=new Map}on(e,t){this.events.has(e)?this.events.get(e).push(t):this.events.set(e,[t]);return this}off(e){this.events.delete(e)}trigger(e,t,i=null){if(this.events.has(e))for(const n of this.events.get(e))n({data:i,object:t})}}{constructor(e,t){super();this.isUserTouch=!1;this.isUserMove=!1;this.setting=null;this.pages=null;this.setting=(new Settings).getSettings(t);this.block=e}destroy(){this.ui.destroy();this.block.remove()}update(){this.render.update();this.pages.show()}loadFromImages(e){this.ui=new CanvasUI(this.block,this,this.setting);const t=this.ui.getCanvas();this.render=new CanvasRender(this,this.setting,t);this.flipController=new Flip(this.render,this);this.pages=new ImagePageCollection(this,this.render,e);this.pages.load();this.render.start();this.pages.show(this.setting.startPage);setTimeout((()=>{this.ui.update();this.trigger("init",this,{page:this.setting.startPage,mode:this.render.getOrientation()})}),1)}loadFromHTML(e){this.ui=new HTMLUI(this.block,this,this.setting,e);this.render=new HTMLRender(this,this.setting,this.ui.getDistElement());this.flipController=new Flip(this.render,this);this.pages=new HTMLPageCollection(this,this.render,this.ui.getDistElement(),e);this.pages.load();this.render.start();this.pages.show(this.setting.startPage);setTimeout((()=>{this.ui.update();this.trigger("init",this,{page:this.setting.startPage,mode:this.render.getOrientation()})}),1)}updateFromImages(e){const t=this.pages.getCurrentPageIndex();this.pages.destroy();this.pages=new ImagePageCollection(this,this.render,e);this.pages.load();this.pages.show(t);this.trigger("update",this,{page:t,mode:this.render.getOrientation()})}updateFromHtml(e){const t=this.pages.getCurrentPageIndex();this.pages.destroy();this.pages=new HTMLPageCollection(this,this.render,this.ui.getDistElement(),e);this.pages.load();this.ui.updateItems(e);this.render.reload();this.pages.show(t);this.trigger("update",this,{page:t,mode:this.render.getOrientation()})}clear(){this.pages.destroy();this.ui.clear()}turnToPrevPage(){this.pages.showPrev()}turnToNextPage(){this.pages.showNext()}turnToPage(e){this.pages.show(e)}flipNext(e="top"){this.flipController.flipNext(e)}flipPrev(e="top"){this.flipController.flipPrev(e)}flip(e,t="top"){this.flipController.flipToPage(e,t)}updateState(e){this.trigger("changeState",this,e)}updatePageIndex(e){this.trigger("flip",this,e)}updateOrientation(e){this.ui.setOrientationStyle(e);this.update();this.trigger("changeOrientation",this,e)}getPageCount(){return this.pages.getPageCount()}getCurrentPageIndex(){return this.pages.getCurrentPageIndex()}getPage(e){return this.pages.getPage(e)}getRender(){return this.render}getFlipController(){return this.flipController}getOrientation(){return this.render.getOrientation()}getBoundsRect(){return this.render.getRect()}getSettings(){return this.setting}getUI(){return this.ui}getState(){return this.flipController.getState()}getPageCollection(){return this.pages}startUserTouch(e){this.mousePosition=e;this.isUserTouch=!0;this.isUserMove=!1}userMove(e,t){if(this.isUserTouch||t||!this.setting.showPageCorners){if(this.isUserTouch&&Helper.GetDistanceBetweenTwoPoint(this.mousePosition,e)>5){this.isUserMove=!0;this.flipController.fold(e)}}else this.flipController.showCorner(e)}userStop(e,t=!1){if(this.isUserTouch){this.isUserTouch=!1;t||(this.isUserMove?this.flipController.stopMove():this.flipController.flip(e))}}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFPageView=void 0;var n=i(4),s=i(3),r=i(1),a=i(31),o=i(7),l=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(i(34)),h=i(35);const c=r.compatibilityParams.maxCanvasPixels||16777216;t.PDFPageView=class PDFPageView{constructor(e){const t=e.container,i=e.defaultViewport;this.id=e.id;this.renderingId="page"+this.id;this.pdfPage=null;this.pageLabel=null;this.rotation=0;this.scale=e.scale||s.DEFAULT_SCALE;this.viewport=i;this.pdfPageRotate=i.rotation;this._optionalContentConfigPromise=e.optionalContentConfigPromise||null;this.hasRestrictedScaling=!1;this.textLayerMode=e.textLayerMode??s.TextLayerMode.ENABLE;this._annotationMode=e.annotationMode??n.AnnotationMode.ENABLE_FORMS;this.imageResourcesPath=e.imageResourcesPath||"";this.useOnlyCssZoom=e.useOnlyCssZoom||!1;this.maxCanvasPixels=e.maxCanvasPixels||c;this.eventBus=e.eventBus;this.renderingQueue=e.renderingQueue;this.textLayerFactory=e.textLayerFactory;this.annotationLayerFactory=e.annotationLayerFactory;this.xfaLayerFactory=e.xfaLayerFactory;this.textHighlighter=e.textHighlighterFactory?.createTextHighlighter(this.id-1,this.eventBus);this.structTreeLayerFactory=e.structTreeLayerFactory;this.renderer=e.renderer||s.RendererType.CANVAS;this.l10n=e.l10n||a.NullL10n;this.paintTask=null;this.paintedViewportMap=new WeakMap;this.renderingState=o.RenderingStates.INITIAL;this.resume=null;this._renderError=null;this._isStandalone=!this.renderingQueue?.hasViewer();this.annotationLayer=null;this.textLayer=null;this.zoomLayer=null;this.xfaLayer=null;this.structTreeLayer=null;const r=document.createElement("div");r.className="page";r.style.width=Math.floor(this.viewport.width)+"px";r.style.height=Math.floor(this.viewport.height)+"px";r.setAttribute("data-page-number",this.id);r.setAttribute("role","region");this.l10n.get("page_landmark",{page:this.id}).then((e=>{r.setAttribute("aria-label",e)}));this.div=r;t.appendChild(r)}setPdfPage(e){this.pdfPage=e;this.pdfPageRotate=e.rotate;const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:this.scale*n.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:t});this.reset()}destroy(){this.reset();this.pdfPage&&this.pdfPage.cleanup()}async _renderAnnotationLayer(){let e=null;try{await this.annotationLayer.render(this.viewport,"display")}catch(t){e=t}finally{this.eventBus.dispatch("annotationlayerrendered",{source:this,pageNumber:this.id,error:e})}}async _renderXfaLayer(){let e=null;try{const t=await this.xfaLayer.render(this.viewport,"display");this.textHighlighter&&this._buildXfaTextContentItems(t.textDivs)}catch(t){e=t}finally{this.eventBus.dispatch("xfalayerrendered",{source:this,pageNumber:this.id,error:e})}}async _buildXfaTextContentItems(e){const t=await this.pdfPage.getTextContent(),i=[];for(const e of t.items)i.push(e.str);this.textHighlighter.setTextMapping(e,i);this.textHighlighter.enable()}_resetZoomLayer(e=!1){if(!this.zoomLayer)return;const t=this.zoomLayer.firstChild;this.paintedViewportMap.delete(t);t.width=0;t.height=0;e&&this.zoomLayer.remove();this.zoomLayer=null}reset({keepZoomLayer:e=!1,keepAnnotationLayer:t=!1,keepXfaLayer:i=!1}={}){this.cancelRendering({keepAnnotationLayer:t,keepXfaLayer:i});this.renderingState=o.RenderingStates.INITIAL;const n=this.div;n.style.width=Math.floor(this.viewport.width)+"px";n.style.height=Math.floor(this.viewport.height)+"px";const s=n.childNodes,r=e&&this.zoomLayer||null,a=t&&this.annotationLayer?.div||null,l=i&&this.xfaLayer?.div||null;for(let e=s.length-1;e>=0;e--){const t=s[e];switch(t){case r:case a:case l:continue}n.removeChild(t)}n.removeAttribute("data-loaded");a&&this.annotationLayer.hide();l&&this.xfaLayer.hide();if(!r){if(this.canvas){this.paintedViewportMap.delete(this.canvas);this.canvas.width=0;this.canvas.height=0;delete this.canvas}this._resetZoomLayer()}if(this.svg){this.paintedViewportMap.delete(this.svg);delete this.svg}this.loadingIconDiv=document.createElement("div");this.loadingIconDiv.className="loadingIcon";this.loadingIconDiv.setAttribute("role","img");this.l10n.get("loading").then((e=>{this.loadingIconDiv?.setAttribute("aria-label",e)}));n.appendChild(this.loadingIconDiv)}update({scale:e=0,rotation:t=null,optionalContentConfigPromise:i=null}){if("object"!=typeof arguments[0]){console.error("PDFPageView.update called with separate parameters, please use an object instead.");this.update({scale:arguments[0],rotation:arguments[1],optionalContentConfigPromise:arguments[2]});return}this.scale=e||this.scale;"number"==typeof t&&(this.rotation=t);i instanceof Promise&&(this._optionalContentConfigPromise=i);if(this._isStandalone){document.documentElement.style.setProperty("--zoom-factor",this.scale)}const s=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:this.scale*n.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:s});if(this.svg){this.cssTransform({target:this.svg,redrawAnnotationLayer:!0,redrawXfaLayer:!0});this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this._renderError});return}let r=!1;if(this.canvas&&this.maxCanvasPixels>0){const e=this.outputScale;(Math.floor(this.viewport.width)*e.sx|0)*(Math.floor(this.viewport.height)*e.sy|0)>this.maxCanvasPixels&&(r=!0)}if(this.canvas){if(this.useOnlyCssZoom||this.hasRestrictedScaling&&r){this.cssTransform({target:this.canvas,redrawAnnotationLayer:!0,redrawXfaLayer:!0});this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this._renderError});return}if(!this.zoomLayer&&!this.canvas.hidden){this.zoomLayer=this.canvas.parentNode;this.zoomLayer.style.position="absolute"}}this.zoomLayer&&this.cssTransform({target:this.zoomLayer.firstChild});this.reset({keepZoomLayer:!0,keepAnnotationLayer:!0,keepXfaLayer:!0})}cancelRendering({keepAnnotationLayer:e=!1,keepXfaLayer:t=!1}={}){if(this.paintTask){this.paintTask.cancel();this.paintTask=null}this.resume=null;if(this.textLayer){this.textLayer.cancel();this.textLayer=null}if(this.annotationLayer&&(!e||!this.annotationLayer.div)){this.annotationLayer.cancel();this.annotationLayer=null}if(this.xfaLayer&&(!t||!this.xfaLayer.div)){this.xfaLayer.cancel();this.xfaLayer=null;this.textHighlighter?.disable()}if(this._onTextLayerRendered){this.eventBus._off("textlayerrendered",this._onTextLayerRendered);this._onTextLayerRendered=null}}cssTransform({target:e,redrawAnnotationLayer:t=!1,redrawXfaLayer:i=!1}){const n=this.viewport.width,s=this.viewport.height,r=this.div;e.style.width=e.parentNode.style.width=r.style.width=Math.floor(n)+"px";e.style.height=e.parentNode.style.height=r.style.height=Math.floor(s)+"px";const a=this.viewport.rotation-this.paintedViewportMap.get(e).rotation,o=Math.abs(a);let l=1,h=1;if(90===o||270===o){l=s/n;h=n/s}e.style.transform=`rotate(${a}deg) scale(${l}, ${h})`;if(this.textLayer){const e=this.textLayer.viewport,t=this.viewport.rotation-e.rotation,i=Math.abs(t);let s=n/e.width;90!==i&&270!==i||(s=n/e.height);const r=this.textLayer.textLayerDiv;let a,o;switch(i){case 0:a=o=0;break;case 90:a=0;o="-"+r.style.height;break;case 180:a="-"+r.style.width;o="-"+r.style.height;break;case 270:a="-"+r.style.width;o=0;break;default:console.error("Bad rotation value.")}r.style.transform=`rotate(${i}deg) scale(${s}) translate(${a}, ${o})`;r.style.transformOrigin="0% 0%"}t&&this.annotationLayer&&this._renderAnnotationLayer();i&&this.xfaLayer&&this._renderXfaLayer()}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(e,t){return this.viewport.convertToPdfPoint(e,t)}draw(){if(this.renderingState!==o.RenderingStates.INITIAL){console.error("Must be in new state before drawing");this.reset()}const{div:e,pdfPage:t}=this;if(!t){this.renderingState=o.RenderingStates.FINISHED;if(this.loadingIconDiv){e.removeChild(this.loadingIconDiv);delete this.loadingIconDiv}return Promise.reject(new Error("pdfPage is not loaded"))}this.renderingState=o.RenderingStates.RUNNING;const i=document.createElement("div");i.style.width=e.style.width;i.style.height=e.style.height;i.classList.add("canvasWrapper");this.annotationLayer?.div?e.insertBefore(i,this.annotationLayer.div):e.appendChild(i);let r=null;if(this.textLayerMode!==s.TextLayerMode.DISABLE&&this.textLayerFactory){const t=document.createElement("div");t.className="textLayer";t.style.width=i.style.width;t.style.height=i.style.height;this.annotationLayer?.div?e.insertBefore(t,this.annotationLayer.div):e.appendChild(t);r=this.textLayerFactory.createTextLayerBuilder(t,this.id-1,this.viewport,this.textLayerMode===s.TextLayerMode.ENABLE_ENHANCE,this.eventBus,this.textHighlighter)}this.textLayer=r;this.xfaLayer?.div&&e.appendChild(this.xfaLayer.div);let a=null;this.renderingQueue&&(a=e=>{if(this.renderingQueue.isHighestPriority(this))e();else{this.renderingState=o.RenderingStates.PAUSED;this.resume=()=>{this.renderingState=o.RenderingStates.RUNNING;e()}}});const finishPaintTask=async(t=null)=>{l===this.paintTask&&(this.paintTask=null);if(t instanceof n.RenderingCancelledException)this._renderError=null;else{this._renderError=t;this.renderingState=o.RenderingStates.FINISHED;if(this.loadingIconDiv){e.removeChild(this.loadingIconDiv);delete this.loadingIconDiv}this._resetZoomLayer(!0);this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!1,timestamp:performance.now(),error:this._renderError});if(t)throw t}},l=this.renderer===s.RendererType.SVG?this.paintOnSvg(i):this.paintOnCanvas(i);l.onRenderContinue=a;this.paintTask=l;const h=l.promise.then((()=>finishPaintTask(null).then((()=>{if(r){const e=t.streamTextContent({normalizeWhitespace:!0,includeMarkedContent:!0});r.setTextContentStream(e);r.render()}}))),(function(e){return finishPaintTask(e)}));if(this._annotationMode!==n.AnnotationMode.DISABLE&&this.annotationLayerFactory){this.annotationLayer||(this.annotationLayer=this.annotationLayerFactory.createAnnotationLayerBuilder(e,t,null,this.imageResourcesPath,this._annotationMode===n.AnnotationMode.ENABLE_FORMS,this.l10n,null,null,null,null));this._renderAnnotationLayer()}if(this.xfaLayerFactory){this.xfaLayer||(this.xfaLayer=this.xfaLayerFactory.createXfaLayerBuilder(e,t,null));this._renderXfaLayer()}if(this.structTreeLayerFactory&&this.textLayer&&this.canvas){this._onTextLayerRendered=e=>{if(e.pageNumber===this.id){this.eventBus._off("textlayerrendered",this._onTextLayerRendered);this._onTextLayerRendered=null;this.canvas&&this.pdfPage.getStructTree().then((e=>{if(!e)return;if(!this.canvas)return;const t=this.structTreeLayer.render(e);t.classList.add("structTree");this.canvas.appendChild(t)}))}};this.eventBus._on("textlayerrendered",this._onTextLayerRendered);this.structTreeLayer=this.structTreeLayerFactory.createStructTreeLayerBuilder(t)}e.setAttribute("data-loaded",!0);this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id});return h}paintOnCanvas(e){const t=(0,n.createPromiseCapability)(),i={promise:t.promise,onRenderContinue(e){e()},cancel(){_.cancel()}},r=this.viewport,a=document.createElement("canvas");a.hidden=!0;let o=!0;const showCanvas=function(){if(o){a.hidden=!1;o=!1}};e.appendChild(a);this.canvas=a;a.mozOpaque=!0;const c=a.getContext("2d",{alpha:!1}),d=(0,s.getOutputScale)(c);this.outputScale=d;if(this.useOnlyCssZoom){const e=r.clone({scale:n.PixelsPerInch.PDF_TO_CSS_UNITS});d.sx*=e.width/r.width;d.sy*=e.height/r.height;d.scaled=!0}if(this.maxCanvasPixels>0){const e=r.width*r.height,t=Math.sqrt(this.maxCanvasPixels/e);if(d.sx>t||d.sy>t){d.sx=t;d.sy=t;d.scaled=!0;this.hasRestrictedScaling=!0}else this.hasRestrictedScaling=!1}const u=(0,s.approximateFraction)(d.sx),p=(0,s.approximateFraction)(d.sy),g=(0,s.roundToDivide)(r.width*d.sx,u[0]),f=(0,s.roundToDivide)(r.height*d.sy,p[0]);if((g>=4096||f>=4096)&&(this.maxWidth||!l.default.test({width:g,height:f}))){const e=this.determineMaxDimensions();let t=Math.max(g/e,f/e);const i=Math.floor(100*this.scale/t)/100;t=this.scale/i;this.scale=i;window.PDFViewerApplicationOptions.set("maxZoom",i);PDFViewerApplication.pdfViewer.currentScaleValue=this.scale;r.width/=t;r.height/=t;(0,h.warn)("Page "+this.id+": Reduced the maximum zoom to "+i+" because the browser can't render larger canvases.")}a.width=(0,s.roundToDivide)(r.width*d.sx,u[0]);a.height=(0,s.roundToDivide)(r.height*d.sy,p[0]);a.style.width=(0,s.roundToDivide)(r.width,u[1])+"px";a.style.height=(0,s.roundToDivide)(r.height,p[1])+"px";this.paintedViewportMap.set(a,r);const m={canvasContext:c,transform:d.scaled?[d.sx,0,0,d.sy,0,0]:null,viewport:this.viewport,annotationMode:this._annotationMode,optionalContentConfigPromise:this._optionalContentConfigPromise,background:PDFViewerApplicationOptions.get("pdfBackgroundColor")},_=this.pdfPage.render(m);_.onContinue=function(e){showCanvas();i.onRenderContinue?i.onRenderContinue(e):e()};_.promise.then((function(){showCanvas();t.resolve(void 0)}),(function(e){showCanvas();t.reject(e)}));return i}paintOnSvg(e){let t=!1;const ensureNotCancelled=()=>{if(t)throw new n.RenderingCancelledException(`Rendering cancelled, page ${this.id}`,"svg")},i=this.pdfPage,s=this.viewport.clone({scale:n.PixelsPerInch.PDF_TO_CSS_UNITS});return{promise:i.getOperatorList({annotationMode:this._annotationMode}).then((t=>{ensureNotCancelled();return new n.SVGGraphics(i.commonObjs,i.objs,r.compatibilityParams.disableCreateObjectURL).getSVG(t,s).then((t=>{ensureNotCancelled();this.svg=t;this.paintedViewportMap.set(t,s);t.style.width=e.style.width;t.style.height=e.style.height;this.renderingState=o.RenderingStates.FINISHED;e.appendChild(t)}))})),onRenderContinue(e){e()},cancel(){t=!0}}}setPageLabel(e){this.pageLabel="string"==typeof e?e:null;null!==this.pageLabel?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}determineMaxDimensions(){if(this.maxWidth)return this.maxWidth;const e=[4096,8192,10836,11180,11402,14188,16384];for(let t of e)if(!l.default.test({width:t+1,height:t+1})){this.maxWidth=t;return this.maxWidth}return 16384}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.default=void 0;function ownKeys(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})));i.push.apply(i,n)}return i}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(i),!0).forEach((function(t){_defineProperty(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function _defineProperty(e,t,i){t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i;return e}function _objectWithoutProperties(e,t){if(null==e)return{};var i,n,s=function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var i,n,s={},r=Object.keys(e);for(n=0;n<r.length;n++){i=r[n];t.indexOf(i)>=0||(s[i]=e[i])}return s}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++){i=r[n];t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(s[i]=e[i])}}return s}function _slicedToArray(e,t){return function _arrayWithHoles(e){if(Array.isArray(e))return e}(e)||function _iterableToArrayLimit(e,t){var i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==i)return;var n,s,r=[],a=!0,o=!1;try{for(i=i.call(e);!(a=(n=i.next()).done);a=!0){r.push(n.value);if(t&&r.length===t)break}}catch(e){o=!0;s=e}finally{try{a||null==i.return||i.return()}finally{if(o)throw s}}return r}(e,t)||_unsupportedIterableToArray(e,t)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _toConsumableArray(e){return function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}(e)||function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||_unsupportedIterableToArray(e)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);"Object"===i&&e.constructor&&(i=e.constructor.name);return"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}function canvasTest(e){var t,i,n=e.sizes.shift(),s=Math.max(Math.ceil(n[0]),1),r=Math.max(Math.ceil(n[1]),1),a=[s-1,r-1,1,1],o=Date.now(),l="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope;if(l){t=new OffscreenCanvas(1,1);i=new OffscreenCanvas(s,r)}else{(t=document.createElement("canvas")).width=1;t.height=1;(i=document.createElement("canvas")).width=s;i.height=r}var h=t.getContext("2d"),c=i.getContext("2d");if(c){c.fillRect.apply(c,a);h.drawImage(i,s-1,r-1,1,1,0,0,1,1)}var d=h&&0!==h.getImageData(0,0,1,1).data[3],u=Date.now()-o;if(l){postMessage({width:s,height:r,benchmark:u,isTestPass:d});!d&&e.sizes.length&&canvasTest(e)}else if(d)e.onSuccess(s,r,u);else{e.onError(s,r,u);e.sizes.length&&canvasTest(e)}return d}var i=[16384,14188,11402,11180,10836,8192,4096,1],n=[8388607,65535,32767,16384,8192,4096,1],s=[4194303,65535,32767,16384,8192,4096,1],r=["onError","onSuccess"],a={max:null,min:1,sizes:[],step:1024,usePromise:!1,useWorker:!1,onError:Function.prototype,onSuccess:Function.prototype},o={};function createSizesArray(e){var t=e.width===e.height,i=1===e.height,n=1===e.width,s=[];if(e.width&&e.height)for(var r=e.min||a.min,o=e.step||a.step,l=Math.max(e.width,e.height);l>=r;){var h=t||i?l:1,c=t||n?l:1;s.push([h,c]);l-=o}else e.sizes.forEach((function(e){var r=t||i?e:1,a=t||n?e:1;s.push([r,a])}));return s}function handleMethod(e){var t=window&&"HTMLCanvasElement"in window,i=window&&"OffscreenCanvas"in window,n=Date.now(),s=e.onError,a=e.onSuccess,l=_objectWithoutProperties(e,r),h=null;if(!t)return!1;if(e.useWorker&&i){var c="\n var canvasTest = ".concat(canvasTest.toString(),";\n onmessage = function(e) {\n canvasTest(e.data);\n };\n "),d=new Blob([c],{type:"application/javascript"}),u=URL.createObjectURL(d);h=new Worker(u);URL.revokeObjectURL(u);h.onmessage=function(e){var t=e.data,i=t.width,s=t.height,r=t.benchmark;if(t.isTestPass){o[n].onSuccess(i,s,r);delete o[n]}else o[n].onError(i,s,r)}}if(e.usePromise)return new Promise((function(t,i){var r=_objectSpread2(_objectSpread2({},e),{},{onError:function onError(t,n,r){var a;if(0===e.sizes.length)a=!0;else{var o=_slicedToArray(e.sizes.slice(-1),1),l=_slicedToArray(o[0],2),h=l[0],c=l[1];a=t===h&&n===c}s(t,n,r);a&&i({width:t,height:n,benchmark:r})},onSuccess:function onSuccess(e,i,n){a(e,i,n);t({width:e,height:i,benchmark:n})}});if(h){var c=r.onError,d=r.onSuccess;o[n]={onError:c,onSuccess:d};h.postMessage(l)}else canvasTest(r)}));if(!h)return canvasTest(e);o[n]={onError:s,onSuccess:a};h.postMessage(l)}var l={maxArea:function maxArea(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=createSizesArray({width:e.max,height:e.max,min:e.min,step:e.step,sizes:_toConsumableArray(i)}),n=_objectSpread2(_objectSpread2(_objectSpread2({},a),e),{},{sizes:t});return handleMethod(n)},maxHeight:function maxHeight(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=createSizesArray({width:1,height:e.max,min:e.min,step:e.step,sizes:_toConsumableArray(n)}),i=_objectSpread2(_objectSpread2(_objectSpread2({},a),e),{},{sizes:t});return handleMethod(i)},maxWidth:function maxWidth(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=createSizesArray({width:e.max,height:1,min:e.min,step:e.step,sizes:_toConsumableArray(s)}),i=_objectSpread2(_objectSpread2(_objectSpread2({},a),e),{},{sizes:t});return handleMethod(i)},test:function test(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=_objectSpread2(_objectSpread2({},a),e);t.sizes=_toConsumableArray(t.sizes);t.width&&t.height&&(t.sizes=[[t.width,t.height]]);return handleMethod(t)}};t.default=l},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.arrayByteLength=arrayByteLength;t.arraysToBytes=function arraysToBytes(e){const t=e.length;if(1===t&&e[0]instanceof Uint8Array)return e[0];let i=0;for(let n=0;n<t;n++)i+=arrayByteLength(e[n]);let n=0;const s=new Uint8Array(i);for(let i=0;i<t;i++){let t=e[i];t instanceof Uint8Array||(t="string"==typeof t?stringToBytes(t):new Uint8Array(t));const r=t.byteLength;s.set(t,n);n+=r}return s};t.assert=assert;t.bytesToString=function bytesToString(e){assert(null!==e&&"object"==typeof e&&void 0!==e.length,"Invalid argument for bytesToString");const t=e.length,i=8192;if(t<i)return String.fromCharCode.apply(null,e);const n=[];for(let s=0;s<t;s+=i){const r=Math.min(s+i,t),a=e.subarray(s,r);n.push(String.fromCharCode.apply(null,a))}return n.join("")};t.createObjectURL=function createObjectURL(e,t="",i=!1){if(URL.createObjectURL&&!i)return URL.createObjectURL(new Blob([e],{type:t}));const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let s=`data:${t};base64,`;for(let t=0,i=e.length;t<i;t+=3){const r=255&e[t],a=255&e[t+1],o=255&e[t+2];s+=n[r>>2]+n[(3&r)<<4|a>>4]+n[t+1<i?(15&a)<<2|o>>6:64]+n[t+2<i?63&o:64]}return s};t.createPromiseCapability=function createPromiseCapability(){const e=Object.create(null);let t=!1;Object.defineProperty(e,"settled",{get:()=>t});e.promise=new Promise((function(i,n){e.resolve=function(e){t=!0;i(e)};e.reject=function(e){t=!0;n(e)}}));return e};t.createValidAbsoluteUrl=function createValidAbsoluteUrl(e,t=null,i=null){if(!e)return null;try{if(i&&"string"==typeof e){if(i.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\./g);t&&t.length>=2&&(e=`http://${e}`)}if(i.tryConvertEncoding)try{e=stringToUTF8String(e)}catch(e){}}const n=t?new URL(e,t):new URL(e);if(function _isValidProtocol(e){if(!e)return!1;switch(e.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":case"capacitor":return!0;default:return!1}}(n))return n}catch(e){}return null};t.escapeString=function escapeString(e){return e.replace(/([()\\\n\r])/g,(e=>"\n"===e?"\\n":"\r"===e?"\\r":`\\${e}`))};t.getModificationDate=function getModificationDate(e=new Date){return[e.getUTCFullYear().toString(),(e.getUTCMonth()+1).toString().padStart(2,"0"),e.getUTCDate().toString().padStart(2,"0"),e.getUTCHours().toString().padStart(2,"0"),e.getUTCMinutes().toString().padStart(2,"0"),e.getUTCSeconds().toString().padStart(2,"0")].join("")};t.getVerbosityLevel=function getVerbosityLevel(){return s};t.info=function info(e){s>=n.INFOS&&console.log(`Info: ${e}`)};t.isArrayBuffer=function isArrayBuffer(e){return"object"==typeof e&&null!==e&&void 0!==e.byteLength};t.isArrayEqual=function isArrayEqual(e,t){if(e.length!==t.length)return!1;for(let i=0,n=e.length;i<n;i++)if(e[i]!==t[i])return!1;return!0};t.isAscii=function isAscii(e){return/^[\x00-\x7F]*$/.test(e)};t.isBool=function isBool(e){return"boolean"==typeof e};t.isNum=function isNum(e){return"number"==typeof e};t.isSameOrigin=function isSameOrigin(e,t){let i;try{i=new URL(e);if(!i.origin||"null"===i.origin)return!1}catch(e){return!1}const n=new URL(t,i);return i.origin===n.origin};t.isString=function isString(e){return"string"==typeof e};t.objectFromMap=function objectFromMap(e){const t=Object.create(null);for(const[i,n]of e)t[i]=n;return t};t.objectSize=function objectSize(e){return Object.keys(e).length};t.removeNullCharacters=function removeNullCharacters(e){if("string"!=typeof e){warn("The argument for removeNullCharacters must be a string.");return e}return e.replace(a,"")};t.setVerbosityLevel=function setVerbosityLevel(e){Number.isInteger(e)&&(s=e)};t.shadow=shadow;t.string32=function string32(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)};t.stringToBytes=stringToBytes;t.stringToPDFString=function stringToPDFString(e){const t=e.length,i=[];if("þ"===e[0]&&"ÿ"===e[1])for(let n=2;n<t;n+=2)i.push(String.fromCharCode(e.charCodeAt(n)<<8|e.charCodeAt(n+1)));else if("ÿ"===e[0]&&"þ"===e[1])for(let n=2;n<t;n+=2)i.push(String.fromCharCode(e.charCodeAt(n+1)<<8|e.charCodeAt(n)));else for(let n=0;n<t;++n){const t=c[e.charCodeAt(n)];i.push(t?String.fromCharCode(t):e.charAt(n))}return i.join("")};t.stringToUTF16BEString=function stringToUTF16BEString(e){const t=["þÿ"];for(let i=0,n=e.length;i<n;i++){const n=e.charCodeAt(i);t.push(String.fromCharCode(n>>8&255),String.fromCharCode(255&n))}return t.join("")};t.stringToUTF8String=stringToUTF8String;t.unreachable=unreachable;t.utf8StringToString=function utf8StringToString(e){return unescape(encodeURIComponent(e))};t.warn=warn;t.VerbosityLevel=t.Util=t.UNSUPPORTED_FEATURES=t.UnknownErrorException=t.UnexpectedResponseException=t.TextRenderingMode=t.StreamType=t.RenderingIntentFlag=t.PermissionFlag=t.PasswordResponses=t.PasswordException=t.PageActionEventType=t.OPS=t.MissingPDFException=t.IsLittleEndianCached=t.IsEvalSupportedCached=t.InvalidPDFException=t.ImageKind=t.IDENTITY_MATRIX=t.FormatError=t.FontType=t.FONT_IDENTITY_MATRIX=t.DocumentActionEventType=t.CMapCompressionType=t.BaseException=t.AnnotationType=t.AnnotationStateModelType=t.AnnotationReviewState=t.AnnotationReplyType=t.AnnotationMode=t.AnnotationMarkedState=t.AnnotationFlag=t.AnnotationFieldFlag=t.AnnotationBorderStyleType=t.AnnotationActionEventType=t.AbortException=void 0;i(36);t.IDENTITY_MATRIX=[1,0,0,1,0,0];t.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0];t.RenderingIntentFlag={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};t.AnnotationMode={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};t.PermissionFlag={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};t.TextRenderingMode={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4};t.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};t.AnnotationType={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26};t.AnnotationStateModelType={MARKED:"Marked",REVIEW:"Review"};t.AnnotationMarkedState={MARKED:"Marked",UNMARKED:"Unmarked"};t.AnnotationReviewState={ACCEPTED:"Accepted",REJECTED:"Rejected",CANCELLED:"Cancelled",COMPLETED:"Completed",NONE:"None"};t.AnnotationReplyType={GROUP:"Group",REPLY:"R"};t.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};t.AnnotationFieldFlag={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864};t.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};t.AnnotationActionEventType={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"};t.DocumentActionEventType={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};t.PageActionEventType={O:"PageOpen",C:"PageClose"};t.StreamType={UNKNOWN:"UNKNOWN",FLATE:"FLATE",LZW:"LZW",DCT:"DCT",JPX:"JPX",JBIG:"JBIG",A85:"A85",AHX:"AHX",CCF:"CCF",RLX:"RLX"};t.FontType={UNKNOWN:"UNKNOWN",TYPE1:"TYPE1",TYPE1STANDARD:"TYPE1STANDARD",TYPE1C:"TYPE1C",CIDFONTTYPE0:"CIDFONTTYPE0",CIDFONTTYPE0C:"CIDFONTTYPE0C",TRUETYPE:"TRUETYPE",CIDFONTTYPE2:"CIDFONTTYPE2",TYPE3:"TYPE3",OPENTYPE:"OPENTYPE",TYPE0:"TYPE0",MMTYPE1:"MMTYPE1"};const n={ERRORS:0,WARNINGS:1,INFOS:5};t.VerbosityLevel=n;t.CMapCompressionType={NONE:0,BINARY:1,STREAM:2};t.OPS={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotations:78,endAnnotations:79,beginAnnotation:80,endAnnotation:81,paintJpegXObject:82,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91};t.UNSUPPORTED_FEATURES={unknown:"unknown",forms:"forms",javaScript:"javaScript",signatures:"signatures",smask:"smask",shadingPattern:"shadingPattern",font:"font",errorTilingPattern:"errorTilingPattern",errorExtGState:"errorExtGState",errorXObject:"errorXObject",errorFontLoadType3:"errorFontLoadType3",errorFontState:"errorFontState",errorFontMissing:"errorFontMissing",errorFontTranslate:"errorFontTranslate",errorColorSpace:"errorColorSpace",errorOperatorList:"errorOperatorList",errorFontToUnicode:"errorFontToUnicode",errorFontLoadNative:"errorFontLoadNative",errorFontBuildPath:"errorFontBuildPath",errorFontGetPath:"errorFontGetPath",errorMarkedContent:"errorMarkedContent",errorContentSubStream:"errorContentSubStream"};t.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let s=n.WARNINGS;function warn(e){s>=n.WARNINGS&&console.log(`Warning: ${e}`)}function unreachable(e){throw new Error(e)}function assert(e,t){e||unreachable(t)}function shadow(e,t,i){Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!1});return i}const r=function BaseExceptionClosure(){function BaseException(e,t){this.constructor===BaseException&&unreachable("Cannot initialize BaseException.");this.message=e;this.name=t}BaseException.prototype=new Error;BaseException.constructor=BaseException;return BaseException}();t.BaseException=r;t.PasswordException=class PasswordException extends r{constructor(e,t){super(e,"PasswordException");this.code=t}};t.UnknownErrorException=class UnknownErrorException extends r{constructor(e,t){super(e,"UnknownErrorException");this.details=t}};t.InvalidPDFException=class InvalidPDFException extends r{constructor(e){super(e,"InvalidPDFException")}};t.MissingPDFException=class MissingPDFException extends r{constructor(e){super(e,"MissingPDFException")}};t.UnexpectedResponseException=class UnexpectedResponseException extends r{constructor(e,t){super(e,"UnexpectedResponseException");this.status=t}};t.FormatError=class FormatError extends r{constructor(e){super(e,"FormatError")}};t.AbortException=class AbortException extends r{constructor(e){super(e,"AbortException")}};const a=/\x00/g;function stringToBytes(e){assert("string"==typeof e,"Invalid argument for stringToBytes");const t=e.length,i=new Uint8Array(t);for(let n=0;n<t;++n)i[n]=255&e.charCodeAt(n);return i}function arrayByteLength(e){if(void 0!==e.length)return e.length;assert(void 0!==e.byteLength,"arrayByteLength - invalid argument.");return e.byteLength}const o={get value(){return shadow(this,"value",function isLittleEndian(){const e=new Uint8Array(4);e[0]=1;return 1===new Uint32Array(e.buffer,0,1)[0]}())}};t.IsLittleEndianCached=o;const l={get value(){return shadow(this,"value",function isEvalSupported(){try{new Function("");return!0}catch(e){return!1}}())}};t.IsEvalSupportedCached=l;const h=[...Array(256).keys()].map((e=>e.toString(16).padStart(2,"0")));class Util{static makeHexColor(e,t,i){return`#${h[e]}${h[t]}${h[i]}`}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]}static applyInverseTransform(e,t){const i=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/i,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/i]}static getAxialAlignedBoundingBox(e,t){const i=Util.applyTransform(e,t),n=Util.applyTransform(e.slice(2,4),t),s=Util.applyTransform([e[0],e[3]],t),r=Util.applyTransform([e[2],e[1]],t);return[Math.min(i[0],n[0],s[0],r[0]),Math.min(i[1],n[1],s[1],r[1]),Math.max(i[0],n[0],s[0],r[0]),Math.max(i[1],n[1],s[1],r[1])]}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static apply3dTransform(e,t){return[e[0]*t[0]+e[1]*t[1]+e[2]*t[2],e[3]*t[0]+e[4]*t[1]+e[5]*t[2],e[6]*t[0]+e[7]*t[1]+e[8]*t[2]]}static singularValueDecompose2dScale(e){const t=[e[0],e[2],e[1],e[3]],i=e[0]*t[0]+e[1]*t[2],n=e[0]*t[1]+e[1]*t[3],s=e[2]*t[0]+e[3]*t[2],r=e[2]*t[1]+e[3]*t[3],a=(i+r)/2,o=Math.sqrt((i+r)**2-4*(i*r-s*n))/2,l=a+o||1,h=a-o||1;return[Math.sqrt(l),Math.sqrt(h)]}static normalizeRect(e){const t=e.slice(0);if(e[0]>e[2]){t[0]=e[2];t[2]=e[0]}if(e[1]>e[3]){t[1]=e[3];t[3]=e[1]}return t}static intersect(e,t){function compare(e,t){return e-t}const i=[e[0],e[2],t[0],t[2]].sort(compare),n=[e[1],e[3],t[1],t[3]].sort(compare),s=[];e=Util.normalizeRect(e);t=Util.normalizeRect(t);if(!(i[0]===e[0]&&i[1]===t[0]||i[0]===t[0]&&i[1]===e[0]))return null;s[0]=i[1];s[2]=i[2];if(!(n[0]===e[1]&&n[1]===t[1]||n[0]===t[1]&&n[1]===e[1]))return null;s[1]=n[1];s[3]=n[2];return s}}t.Util=Util;const c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function stringToUTF8String(e){return decodeURIComponent(escape(e))}},()=>{},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.StructTreeLayerBuilder=t.DefaultStructTreeLayerFactory=void 0;const i={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},n=/^H(\d+)$/;class StructTreeLayerBuilder{constructor({pdfPage:e}){this.pdfPage=e}render(e){return this._walk(e)}_setAttributes(e,t){void 0!==e.alt&&t.setAttribute("aria-label",e.alt);void 0!==e.id&&t.setAttribute("aria-owns",e.id)}_walk(e){if(!e)return null;const t=document.createElement("span");if("role"in e){const{role:s}=e,r=s.match(n);if(r){t.setAttribute("role","heading");t.setAttribute("aria-level",r[1])}else i[s]&&t.setAttribute("role",i[s])}this._setAttributes(e,t);if(e.children)if(1===e.children.length&&"id"in e.children[0])this._setAttributes(e.children[0],t);else for(const i of e.children)t.appendChild(this._walk(i));return t}}t.StructTreeLayerBuilder=StructTreeLayerBuilder;t.DefaultStructTreeLayerFactory=class DefaultStructTreeLayerFactory{createStructTreeLayerBuilder(e){return new StructTreeLayerBuilder({pdfPage:e})}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.TextHighlighter=void 0;t.TextHighlighter=class TextHighlighter{constructor({findController:e,eventBus:t,pageIndex:i}){this.findController=e;this.matches=[];this.eventBus=t;this.pageIdx=i;this._onUpdateTextLayerMatches=null;this.textDivs=null;this.textContentItemsStr=null;this.enabled=!1}setTextMapping(e,t){this.textDivs=e;this.textContentItemsStr=t}enable(){if(!this.textDivs||!this.textContentItemsStr)throw new Error("Text divs and strings have not been set.");if(this.enabled)throw new Error("TextHighlighter is already enabled.");this.enabled=!0;if(!this._onUpdateTextLayerMatches){this._onUpdateTextLayerMatches=e=>{e.pageIndex!==this.pageIdx&&-1!==e.pageIndex||this._updateMatches()};this.eventBus._on("updatetextlayermatches",this._onUpdateTextLayerMatches)}this._updateMatches()}disable(){if(this.enabled){this.enabled=!1;if(this._onUpdateTextLayerMatches){this.eventBus._off("updatetextlayermatches",this._onUpdateTextLayerMatches);this._onUpdateTextLayerMatches=null}}}_convertMatches(e,t,i){if(!e)return[];const{textContentItemsStr:n}=this;let s=0,r=0;const a=n.length-1,o=[];for(let l=0,h=e.length;l<h;l++){let h=e[l];for(;s!==a&&h>=r+n[s].length;){r+=n[s].length;s++}s===n.length&&console.error("Could not find a matching mapping");const c={color:i?i[l]:0,begin:{divIdx:s,offset:h-r}};h+=t[l];for(;s!==a&&h>r+n[s].length;){r+=n[s].length;s++}c.end={divIdx:s,offset:h-r};o.push(c)}return o}_renderMatches(e){if(0===e.length)return;const{findController:t,pageIdx:i}=this,{textContentItemsStr:n,textDivs:s}=this,r=i===t.selected.pageIdx,a=t.selected.matchIdx;let o=null;const l={divIdx:-1,offset:void 0};function beginText(e,t){const i=e.divIdx;s[i].textContent="";return appendTextToDiv(i,0,e.offset,t)}function appendTextToDiv(e,t,i,r){let a=s[e];if(a.nodeType===Node.TEXT_NODE){const t=document.createElement("span");a.parentNode.insertBefore(t,a);t.appendChild(a);s[e]=t;a=t}const o=n[e].substring(t,i),l=document.createTextNode(o);if(r){const e=document.createElement("span");e.className=`${r} appended`;e.appendChild(l);a.appendChild(e);return r.includes("selected")?e.offsetLeft:0}a.appendChild(l);return 0}let h=a,c=h+1;if(t.state.highlightAll){h=0;c=e.length}else if(!r)return;for(let n=h;n<c;n++){const h=e[n],c=h.begin,d=h.end,u=r&&n===a,p=(u?" selected":"")+" color"+h.color;let g=0;if(o&&c.divIdx===o.divIdx)appendTextToDiv(o.divIdx,o.offset,c.offset);else{null!==o&&appendTextToDiv(o.divIdx,o.offset,l.offset);beginText(c)}if(c.divIdx===d.divIdx)g=appendTextToDiv(c.divIdx,c.offset,d.offset,"highlight"+p);else{g=appendTextToDiv(c.divIdx,c.offset,l.offset,"highlight begin"+p);for(let e=c.divIdx+1,t=d.divIdx;e<t;e++)s[e].className="highlight middle"+p;beginText(d,"highlight end"+p)}o=d;u&&t.scrollMatchIntoView({element:s[c.divIdx],selectedLeft:g,pageIndex:i,matchIndex:a})}o&&appendTextToDiv(o.divIdx,o.offset,l.offset)}_updateMatches(){if(!this.enabled)return;const{findController:e,matches:t,pageIdx:i}=this,{textContentItemsStr:n,textDivs:s}=this;let r=-1;for(let e=0,i=t.length;e<i;e++){const i=t[e];for(let e=Math.max(r,i.begin.divIdx),t=i.end.divIdx;e<=t;e++){const t=s[e];t.textContent=n[e];t.className=""}r=i.end.divIdx+1}if(!e?.highlightMatches)return;const a=e.pageMatches[i]||null,o=e.pageMatchesLength[i]||null,l=e.pageMatchesColor[i]||null;this.matches=this._convertMatches(a,o,l);this._renderMatches(this.matches)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.TextLayerBuilder=t.DefaultTextLayerFactory=void 0;var n=i(4);class TextLayerBuilder{constructor({textLayerDiv:e,eventBus:t,pageIndex:i,viewport:n,highlighter:s=null,enhanceTextSelection:r=!1}){this.textLayerDiv=e;this.eventBus=t;this.textContent=null;this.textContentItemsStr=[];this.textContentStream=null;this.renderingDone=!1;this.pageNumber=i+1;this.viewport=n;this.textDivs=[];this.textLayerRenderTask=null;this.highlighter=s;this.enhanceTextSelection=r;this._bindMouse()}_finishRendering(){this.renderingDone=!0;if(!this.enhanceTextSelection){const e=document.createElement("div");e.className="endOfContent";this.textLayerDiv.appendChild(e)}this.eventBus.dispatch("textlayerrendered",{source:this,pageNumber:this.pageNumber,numTextDivs:this.textDivs.length})}render(e=0){if(!this.textContent&&!this.textContentStream||this.renderingDone)return;this.cancel();this.textDivs.length=0;this.highlighter?.setTextMapping(this.textDivs,this.textContentItemsStr);const t=document.createDocumentFragment();this.textLayerRenderTask=(0,n.renderTextLayer)({textContent:this.textContent,textContentStream:this.textContentStream,container:t,viewport:this.viewport,textDivs:this.textDivs,textContentItemsStr:this.textContentItemsStr,timeout:e,enhanceTextSelection:this.enhanceTextSelection});this.textLayerRenderTask.promise.then((()=>{this.textLayerDiv.appendChild(t);this._finishRendering();this.highlighter?.enable()}),(function(e){}))}cancel(){if(this.textLayerRenderTask){this.textLayerRenderTask.cancel();this.textLayerRenderTask=null}this.highlighter?.disable()}setTextContentStream(e){this.cancel();this.textContentStream=e}setTextContent(e){this.cancel();this.textContent=e}_bindMouse(){const e=this.textLayerDiv;let t=null;e.addEventListener("mousedown",(i=>{if(this.enhanceTextSelection&&this.textLayerRenderTask){this.textLayerRenderTask.expandTextDivs(!0);if(t){clearTimeout(t);t=null}return}const n=e.querySelector(".endOfContent");if(!n)return;let s=i.target!==e;s=s&&"none"!==window.getComputedStyle(n).getPropertyValue("-moz-user-select");if(s){const t=e.getBoundingClientRect(),s=Math.max(0,(i.pageY-t.top)/t.height);n.style.top=(100*s).toFixed(2)+"%"}n.classList.add("active")}));e.addEventListener("mouseup",(()=>{if(this.enhanceTextSelection&&this.textLayerRenderTask){t=setTimeout((()=>{this.textLayerRenderTask&&this.textLayerRenderTask.expandTextDivs(!1);t=null}),300);return}const i=e.querySelector(".endOfContent");if(i){i.style.top="";i.classList.remove("active")}}))}}t.TextLayerBuilder=TextLayerBuilder;t.DefaultTextLayerFactory=class DefaultTextLayerFactory{createTextLayerBuilder(e,t,i,n=!1,s,r){return new TextLayerBuilder({textLayerDiv:e,pageIndex:t,viewport:i,enhanceTextSelection:n,eventBus:s,highlighter:r})}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.XfaLayerBuilder=t.DefaultXfaLayerFactory=void 0;var n=i(20),s=i(4);class XfaLayerBuilder{constructor({pageDiv:e,pdfPage:t,annotationStorage:i,linkService:n,xfaHtml:s}){this.pageDiv=e;this.pdfPage=t;this.annotationStorage=i;this.linkService=n;this.xfaHtml=s;this.div=null;this._cancelled=!1}render(e,t="display"){if("print"===t){const i={viewport:e.clone({dontFlip:!0}),div:this.div,xfa:this.xfaHtml,page:null,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t},n=document.createElement("div");this.pageDiv.appendChild(n);i.div=n;const r=s.XfaLayer.render(i);return Promise.resolve(r)}return this.pdfPage.getXfa().then((i=>{if(this._cancelled||!i)return{textDivs:[]};const n={viewport:e.clone({dontFlip:!0}),div:this.div,xfa:i,page:this.pdfPage,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t};if(this.div)return s.XfaLayer.update(n);this.div=document.createElement("div");this.pageDiv.appendChild(this.div);n.div=this.div;return s.XfaLayer.render(n)})).catch((e=>{console.error(e)}))}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}t.XfaLayerBuilder=XfaLayerBuilder;t.DefaultXfaLayerFactory=class DefaultXfaLayerFactory{createXfaLayerBuilder(e,t,i=null,s=null){return new XfaLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:i,linkService:new n.SimpleLinkService,xfaHtml:s})}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.SecondaryToolbar=void 0;var n=i(3),s=i(5),r=i(42);t.SecondaryToolbar=class SecondaryToolbar{constructor(e,t,i){this.toolbar=e.toolbar;this.toggleButton=e.toggleButton;this.toolbarButtonContainer=e.toolbarButtonContainer;this.buttons=[{element:e.presentationModeButton,eventName:"presentationmode",close:!0},{element:e.openFileButton,eventName:"openfile",close:!0},{element:e.printButton,eventName:"print",close:!0},{element:e.downloadButton,eventName:"download",close:!0},{element:e.viewBookmarkButton,eventName:null,close:!0},{element:e.firstPageButton,eventName:"firstpage",close:!0},{element:e.lastPageButton,eventName:"lastpage",close:!0},{element:e.pageRotateCwButton,eventName:"rotatecw",close:!1},{element:e.pageRotateCcwButton,eventName:"rotateccw",close:!1},{element:e.cursorSelectToolButton,eventName:"switchcursortool",eventDetails:{tool:s.CursorTool.SELECT},close:!0},{element:e.cursorHandToolButton,eventName:"switchcursortool",eventDetails:{tool:s.CursorTool.HAND},close:!0},{element:e.scrollVerticalButton,eventName:"switchscrollmode",eventDetails:{mode:n.ScrollMode.VERTICAL},close:!0},{element:e.scrollHorizontalButton,eventName:"switchscrollmode",eventDetails:{mode:n.ScrollMode.HORIZONTAL},close:!0},{element:e.scrollWrappedButton,eventName:"switchscrollmode",eventDetails:{mode:n.ScrollMode.WRAPPED},close:!0},{element:e.spreadNoneButton,eventName:"switchspreadmode",eventDetails:{mode:n.SpreadMode.NONE},close:!0},{element:e.spreadOddButton,eventName:"switchspreadmode",eventDetails:{mode:n.SpreadMode.ODD},close:!0},{element:e.spreadEvenButton,eventName:"switchspreadmode",eventDetails:{mode:n.SpreadMode.EVEN},close:!0},{element:e.documentPropertiesButton,eventName:"documentproperties",close:!0}];this.items={firstPage:e.firstPageButton,lastPage:e.lastPageButton,pageRotateCw:e.pageRotateCwButton,pageRotateCcw:e.pageRotateCcwButton};this.mainContainer=t;this.eventBus=i;this.opened=!1;this.containerHeight=null;this.previousContainerHeight=null;this.reset();this._bindClickListeners();this._bindCursorToolsListener(e);this._bindScrollModeListener(e);this._bindSpreadModeListener(e);this.eventBus._on("resize",this._setMaxHeight.bind(this));this.eventBus._on("baseviewerinit",(e=>{e.source instanceof r.PDFSinglePageViewer?this.toolbarButtonContainer.classList.add("hiddenScrollModeButtons","hiddenSpreadModeButtons"):this.toolbarButtonContainer.classList.remove("hiddenScrollModeButtons","hiddenSpreadModeButtons")}))}get isOpen(){return this.opened}setPageNumber(e){this.pageNumber=e;this._updateUIState()}setPagesCount(e){this.pagesCount=e;this._updateUIState()}reset(){this.pageNumber=0;this.pagesCount=0;this._updateUIState();this.eventBus.dispatch("secondarytoolbarreset",{source:this})}_updateUIState(){this.items.firstPage.disabled=this.pageNumber<=1;document.getElementById("previousPage")&&(document.getElementById("previousPage").disabled=this.pageNumber<=1);this.items.lastPage.disabled=this.pageNumber>=this.pagesCount;document.getElementById("nextPage")&&(document.getElementById("nextPage").disabled=this.pageNumber>=this.pagesCount);this.items.pageRotateCw.disabled=0===this.pagesCount;this.items.pageRotateCcw.disabled=0===this.pagesCount;this.eventBus.dispatch("updateuistate",{source:this,widget:"SecondaryToolbar",pageNumber:this.pageNumber,pagesCount:this.pagesCount})}_bindClickListeners(){this.toggleButton.addEventListener("click",this.toggle.bind(this));for(const{element:e,eventName:t,close:i,eventDetails:n}of this.buttons)e.addEventListener("click",(e=>{if(null!==t){const e={source:this};for(const t in n)e[t]=n[t];this.eventBus.dispatch(t,e)}i&&this.close()}))}_bindCursorToolsListener(e){this.eventBus._on("cursortoolchanged",(function({tool:t}){e.cursorSelectToolButton.classList.toggle("toggled",t===s.CursorTool.SELECT);e.cursorHandToolButton.classList.toggle("toggled",t===s.CursorTool.HAND)}))}_bindScrollModeListener(e){function scrollModeChanged({mode:t}){e.scrollVerticalButton.classList.toggle("toggled",t===n.ScrollMode.VERTICAL);e.scrollHorizontalButton.classList.toggle("toggled",t===n.ScrollMode.HORIZONTAL);e.scrollWrappedButton.classList.toggle("toggled",t===n.ScrollMode.WRAPPED);const i=t===n.ScrollMode.HORIZONTAL;e.spreadNoneButton.disabled=i;e.spreadOddButton.disabled=i;e.spreadEvenButton.disabled=i}this.eventBus._on("scrollmodechanged",scrollModeChanged);this.eventBus._on("secondarytoolbarreset",(e=>{e.source===this&&scrollModeChanged({mode:n.ScrollMode.VERTICAL})}))}_bindSpreadModeListener(e){function spreadModeChanged({mode:t}){e.spreadNoneButton.classList.toggle("toggled",t===n.SpreadMode.NONE);e.spreadOddButton.classList.toggle("toggled",t===n.SpreadMode.ODD);e.spreadEvenButton.classList.toggle("toggled",t===n.SpreadMode.EVEN)}this.eventBus._on("spreadmodechanged",spreadModeChanged);this.eventBus._on("secondarytoolbarreset",(e=>{e.source===this&&spreadModeChanged({mode:n.SpreadMode.NONE})}))}open(){if(!this.opened){this.opened=!0;this.toggleButton.classList.add("toggled");this.toggleButton.setAttribute("aria-expanded","true");this.toolbar.classList.remove("hidden")}}close(){if(this.opened){this.opened=!1;this.toolbar.classList.add("hidden");this.toggleButton.classList.remove("toggled");this.toggleButton.setAttribute("aria-expanded","false")}}toggle(){this.opened?this.close():this.open()}_setMaxHeight(){if(this.opened){this.containerHeight=this.mainContainer.clientHeight;if(this.containerHeight!==this.previousContainerHeight){this.toolbarButtonContainer.style.maxHeight=this.containerHeight-n.SCROLLBAR_PADDING+"px";this.previousContainerHeight=this.containerHeight}}}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFSinglePageViewer=void 0;var n=i(29),s=i(4);class PDFSinglePageViewer extends n.BaseViewer{constructor(e){super(e);this.eventBus._on("pagesinit",(e=>{this._ensurePageViewVisible()}))}get _viewerElement(){return(0,s.shadow)(this,"_viewerElement",this._shadowViewer)}get _pageWidthScaleFactor(){return 1}_resetView(){super._resetView();this._previousPageNumber=1;this._shadowViewer=document.createDocumentFragment();this._updateScrollDown=null}_ensurePageViewVisible(){const e=this._pages[this._currentPageNumber-1],t=this._pages[this._previousPageNumber-1],i=this.viewer.childNodes;switch(i.length){case 0:this.viewer.appendChild(e.div);break;case 1:if(i[0]!==t.div)throw new Error("_ensurePageViewVisible: Unexpected previously visible page.");if(e===t)break;this._shadowViewer.appendChild(t.div);this.viewer.appendChild(e.div);this.container.scrollTop=0;break;default:throw new Error("_ensurePageViewVisible: Only one page should be visible at a time.")}this._previousPageNumber=this._currentPageNumber}_scrollUpdate(){this._updateScrollDown&&this._updateScrollDown();super._scrollUpdate()}_scrollIntoView({pageDiv:e,pageSpot:t=null,pageNumber:i=null}){i&&this._setCurrentPageNumber(i);const n=this._currentPageNumber>=this._previousPageNumber;this._ensurePageViewVisible();this.update();super._scrollIntoView({pageDiv:e,pageSpot:t,pageNumber:i});this._updateScrollDown=()=>{this.scroll.down=n;this._updateScrollDown=null}}_getVisiblePages(){return this._getCurrentVisiblePage()}_updateHelper(e){}get _isScrollModeHorizontal(){return(0,s.shadow)(this,"_isScrollModeHorizontal",!1)}_updateScrollMode(){}_updateSpreadMode(){}_getPageAdvance(){return 1}}t.PDFSinglePageViewer=PDFSinglePageViewer},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.Toolbar=void 0;var n=i(3);t.Toolbar=class Toolbar{constructor(e,t,i){this.toolbar=e.container;this.eventBus=t;this.l10n=i;this.buttons=[{element:e.previous,eventName:"previouspage"},{element:e.next,eventName:"nextpage"},{element:e.zoomIn,eventName:"zoomin"},{element:e.zoomOut,eventName:"zoomout"},{element:e.openFile,eventName:"openfile"},{element:e.print,eventName:"print"},{element:e.presentationModeButton,eventName:"presentationmode"},{element:e.download,eventName:"download"},{element:e.viewBookmark,eventName:null}];this.items={numPages:e.numPages,pageNumber:e.pageNumber,scaleSelect:e.scaleSelect,customScaleOption:e.customScaleOption,previous:e.previous,next:e.next,zoomIn:e.zoomIn,zoomOut:e.zoomOut};this._wasLocalized=!1;this.reset();this._bindListeners()}setPageNumber(e,t){this.pageNumber=e;this.pageLabel=t;this._updateUIState(!1)}setPagesCount(e,t){this.pagesCount=e;this.hasPageLabels=t;this._updateUIState(!0)}setPageScale(e,t){this.pageScaleValue=(e||t).toString();this.pageScale=t;this._updateUIState(!1)}reset(){this.pageNumber=0;this.pageLabel=null;this.hasPageLabels=!1;this.pagesCount=0;const e=PDFViewerApplicationOptions.get("defaultZoomValue");if(e){this.pageScaleValue=e;Number(e)&&(this.pageScale=Number(e))}else{this.pageScaleValue=n.DEFAULT_SCALE_VALUE;this.pageScale=n.DEFAULT_SCALE}this._updateUIState(!0);this.updateLoadingIndicatorState()}_bindListeners(){const{pageNumber:e,scaleSelect:t}=this.items,i=this;for(const{element:e,eventName:t}of this.buttons)e.addEventListener("click",(e=>{null!==t&&this.eventBus.dispatch(t,{source:this})}));e.addEventListener("click",(function(){this.select()}));e.addEventListener("change",(function(){i.eventBus.dispatch("pagenumberchanged",{source:i,value:this.value})}));t.addEventListener("change",(function(){"custom"!==this.value&&i.eventBus.dispatch("scalechanged",{source:i,value:this.value})}));t.addEventListener("click",(function(e){const t=e.target;this.value===i.pageScaleValue&&"OPTION"===t.tagName.toUpperCase()&&this.blur()}));t.oncontextmenu=n.noContextMenuHandler;this.eventBus._on("localized",(()=>{this._wasLocalized=!0;this._updateUIState(!0)}))}_updateUIState(e=!1){if(!this._wasLocalized)return;const{pageNumber:t,pagesCount:i,pageScaleValue:s,pageScale:r,items:a}=this;if(e){if(this.hasPageLabels)a.pageNumber.type="text";else{a.pageNumber.type="number";this.l10n.get("of_pages",{pagesCount:i}).then((e=>{a.numPages.textContent=e}))}a.pageNumber.max=i}if(this.hasPageLabels){a.pageNumber.value=this.pageLabel;this.l10n.get("page_of_pages",{pageNumber:t,pagesCount:i}).then((e=>{a.numPages.textContent=e}))}else a.pageNumber.value=t;a.previous.disabled=t<=1;a.next.disabled=t>=i;a.zoomOut.disabled=r<=n.MIN_SCALE;a.zoomIn.disabled=r>=n.MAX_SCALE;this.l10n.get("page_scale_percent",{scale:Math.round(1e4*r)/100}).then((e=>{let t=!1;for(const e of a.scaleSelect.options)if(e.value===s){e.selected=!0;t=!0}else e.selected=!1;if(!t){a.customScaleOption.textContent=e;a.customScaleOption.selected=!0}}));this.eventBus.dispatch("updateuistate",{source:this,widget:"Toolbar",pageNumber:t,pagesCount:i,pageScaleValue:s,pageScale:r})}updateLoadingIndicatorState(e=!1){this.items.pageNumber.classList.toggle("visiblePageIsLoading",e)}async _adjustScaleWidth(){const{items:e,l10n:t}=this,i=Promise.all([t.get("page_scale_auto"),t.get("page_scale_actual"),t.get("page_scale_fit"),t.get("page_scale_width")]),s=getComputedStyle(e.scaleSelect),r=parseInt(s.getPropertyValue("--scale-select-container-width"),10),a=parseInt(s.getPropertyValue("--scale-select-overflow"),10);let o=document.createElement("canvas");o.mozOpaque=!0;let l=o.getContext("2d",{alpha:!1});await n.animationStarted;l.font=`${s.fontSize} ${s.fontFamily}`;let h=0;for(const e of await i)try{const{width:t}=l.measureText(e);t>h&&(h=t)}catch(e){}h+=2*a;if(h>r){document.documentElement.style.setProperty("--scale-select-container-width",`${h}px`)}o.width=0;o.height=0;o=l=null}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.ViewHistory=void 0;t.ViewHistory=class ViewHistory{constructor(e,t=20){this.fingerprint=e;this.cacheSize=t;this._initializedPromise=this._readFromStorage().then((e=>{const t=JSON.parse(e||"{}");let i=-1;if(Array.isArray(t.files)){for(;t.files.length>=this.cacheSize;)t.files.shift();for(let e=0,n=t.files.length;e<n;e++){if(t.files[e].fingerprint===this.fingerprint){i=e;break}}}else t.files=[];-1===i&&(i=t.files.push({fingerprint:this.fingerprint})-1);this.file=t.files[i];this.database=t}))}async _writeToStorage(){const e=JSON.stringify(this.database);localStorage.setItem("pdfjs.history",e)}async _readFromStorage(){return localStorage.getItem("pdfjs.history")}async set(e,t){await this._initializedPromise;this.file[e]=t;return this._writeToStorage()}async setMultiple(e){await this._initializedPromise;for(const t in e)this.file[t]=e[t];return this._writeToStorage()}async get(e,t){await this._initializedPromise;const i=this.file[e];return void 0!==i?i:t}async getMultiple(e){await this._initializedPromise;const t=Object.create(null);for(const i in e){const n=this.file[i];t[i]=void 0!==n?n:e[i]}return t}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.GenericCom=void 0;var n=i(2),s=i(46),r=i(47),a=i(48),o=i(50);t.GenericCom={};class GenericPreferences extends s.BasePreferences{async _writeToStorage(e){localStorage.setItem("pdfjs.preferences",JSON.stringify(e))}async _readFromStorage(e){return JSON.parse(localStorage.getItem("pdfjs.preferences"))}}class GenericExternalServices extends n.DefaultExternalServices{static createDownloadManager(e){return new r.DownloadManager}static createPreferences(){return new GenericPreferences}static createL10n({locale:e="en-US"}){return new a.GenericL10n(e)}static createScripting({sandboxBundleSrc:e}){return new o.GenericScripting(e)}}n.PDFViewerApplication.externalServices=GenericExternalServices},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.BasePreferences=void 0;i(1);class BasePreferences{constructor(){if(this.constructor===BasePreferences)throw new Error("Cannot initialize BasePreferences.");Object.defineProperty(this,"defaults",{value:Object.freeze({annotationMode:2,cursorToolOnLoad:0,defaultZoomValue:"",disablePageLabels:!1,enablePermissions:!1,enablePrintAutoRotate:!0,enableScripting:!0,externalLinkTarget:0,historyUpdateUrl:!1,ignoreDestinationZoom:!1,pdfBugEnabled:!1,removePageBorders:!1,renderer:"canvas",sidebarViewOnLoad:-1,scrollModeOnLoad:-1,spreadModeOnLoad:-1,textLayerMode:1,useOnlyCssZoom:!1,viewerCssTheme:0,viewOnLoad:0,disableAutoFetch:!1,disableFontFace:!1,disableRange:!1,disableStream:!1,enableXfa:!0}),writable:!1,enumerable:!0,configurable:!1});this.prefs=Object.create(null);this._initializedPromise=this._readFromStorage(this.defaults).then((e=>{for(const t in this.defaults){const i=e?.[t];typeof i==typeof this.defaults[t]&&(this.prefs[t]=i)}}))}async _writeToStorage(e){throw new Error("Not implemented: _writeToStorage")}async _readFromStorage(e){throw new Error("Not implemented: _readFromStorage")}async reset(){await this._initializedPromise;this.prefs=Object.create(null);return this._writeToStorage(this.defaults)}async set(e,t){await this._initializedPromise;const i=this.defaults[e];if(void 0===i)throw new Error(`Set preference: "${e}" is undefined.`);if(void 0===t)throw new Error("Set preference: no value is specified.");const n=typeof t,s=typeof i;if(n!==s){if("number"!==n||"string"!==s)throw new Error(`Set preference: "${t}" is a ${n}, expected a ${s}.`);t=t.toString()}else if("number"===n&&!Number.isInteger(t))throw new Error(`Set preference: "${t}" must be an integer.`);this.prefs[e]=t;return this._writeToStorage(this.prefs)}async get(e){await this._initializedPromise;const t=this.defaults[e],i=this.prefs[e];if(void 0===t)throw new Error(`Get preference: "${e}" is undefined.`);return void 0!==i?i:t}async getAll(){await this._initializedPromise;const e=Object.create(null);for(const t in this.defaults){const i=this.prefs[t];e[t]=void 0!==i?i:this.defaults[t]}return e}}t.BasePreferences=BasePreferences},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.DownloadManager=void 0;var n=i(4),s=i(1);function download(e,t){const i=document.createElement("a");if(!i.click)throw new Error('DownloadManager: "a.click()" is not supported.');i.href=e;i.target="_parent";"download"in i&&(i.download=t);(document.body||document.documentElement).appendChild(i);i.click();i.remove()}t.DownloadManager=class DownloadManager{constructor(){this._openBlobUrls=new WeakMap}downloadUrl(e,t){(0,n.createValidAbsoluteUrl)(e,"http://example.com")?download(e+"#pdfjs.action=download",t):console.error(`downloadUrl - not a valid URL: ${e}`)}downloadData(e,t,i){download((0,n.createObjectURL)(e,i,s.compatibilityParams.disableCreateObjectURL),t)}openOrDownloadData(e,t,i){const r=(0,n.isPdfFile)(i),a=r?"application/pdf":"";if(r&&!s.compatibilityParams.disableCreateObjectURL){let n,s=this._openBlobUrls.get(e);if(!s){s=URL.createObjectURL(new Blob([t],{type:a}));this._openBlobUrls.set(e,s)}n="?file="+encodeURIComponent(s+"#"+i);try{window.open(n);return!0}catch(t){console.error(`openOrDownloadData: ${t}`);URL.revokeObjectURL(s);this._openBlobUrls.delete(e)}}this.downloadData(t,i,a);return!1}download(e,t,i,n="download"){if(s.compatibilityParams.disableCreateObjectURL&&t){this.downloadUrl(t,i);return}download(URL.createObjectURL(e),i)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.GenericL10n=void 0;i(49);var n=i(31);const s=document.webL10n;t.GenericL10n=class GenericL10n{constructor(e){this._lang=e;this._ready=new Promise(((t,i)=>{s.setLanguage((0,n.fixupLangCode)(e),(()=>{t(s)}))}))}async getLanguage(){return(await this._ready).getLanguage()}async getDirection(){return(await this._ready).getDirection()}async get(e,t=null,i=(0,n.getL10nFallback)(e,t)){return(await this._ready).get(e,t,i)}async translate(e){return(await this._ready).translate(e)}}},()=>{document.webL10n=function(e,t,i){var n={},s="",r="textContent",a="",o={},l="loading";function fireL10nReadyEvent(e){var i=t.createEvent("Event");i.initEvent("localized",!0,!1);i.language=e;t.dispatchEvent(i)}function xhrLoadText(e,t,i){t=t||function _onSuccess(e){};i=i||function _onFailure(){};var n=new XMLHttpRequest;n.open("GET",e,true);n.overrideMimeType&&n.overrideMimeType("text/plain; charset=utf-8");n.onreadystatechange=function(){4==n.readyState&&(200==n.status||0===n.status?t(n.responseText):i())};n.onerror=i;n.ontimeout=i;try{n.send(null)}catch(e){i()}}function parseResource(t,i,a,o){var l=t.replace(/[^\/]*$/,"")||"./";function evalString(e){return e.lastIndexOf("\\")<0?e:e.replace(/\\\\/g,"\\").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\t/g,"\t").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/\\"/g,'"').replace(/\\'/g,"'")}xhrLoadText(t,(function(t){s+=t;!function parseProperties(t,n){var s={},r=/^\s*|\s*$/,a=/^\s*#|^\s*$/,o=/^\s*\[(.*)\]\s*$/,h=/^\s*@import\s+url\((.*)\)\s*$/i,c=/^([^=\s]*)\s*=\s*(.+)$/;function parseRawLines(e,t,n){var d=e.replace(r,"").split(/[\r\n]+/),u="*",p=i.split("-",1)[0],g=!1,f="",m=!1;!function nextEntry(){for(var e=void 0;;){if(!d.length&&e){m?nextEntry():loadImport(e,nextEntry);return}if(!d.length){n();return}var r=d.shift();if(!a.test(r)){if(t){if(f=o.exec(r)){u=f[1].toLowerCase();g="*"!==u&&u!==i&&u!==p;continue}if(g)continue;if(f=h.exec(r)){if("*"===u||u===i){loadImport(l+f[1],nextEntry);m=!0;return}e=l+f[1]}}var _=r.match(c);_&&3==_.length&&(s[_[1]]=evalString(_[2]))}}}()}function loadImport(t,i){xhrLoadText(t,(function(e){parseRawLines(e,!1,i)}),(function(){const n=e.PDFViewerApplicationOptions;(!n||n.get("verbosity")>0)&&console.warn(t+" not found.");i()}))}parseRawLines(t,!0,(function(){n(s)}))}(t,(function(e){for(var t in e){var i,s,o=t.lastIndexOf(".");if(o>0){i=t.substring(0,o);s=t.substring(o+1)}else{i=t;s=r}n[i]||(n[i]={});n[i][s]=e[t]}a&&a()}))}),o)}function loadLocale(i,r){let o=i;i&&(i=i.toLowerCase());r=r||function _callback(){};!function clear(){n={};s="";a=""}();a=i;var h=function getL10nResourceLinks(){return t.querySelectorAll('link[type="application/l10n"]')}(),c=h.length;if(0!==c){var d,u=0;d=function(){if(++u>=c){r();fireL10nReadyEvent(i);l="complete"}};for(var p=0;p<c;p++){new L10nResourceLink(h[p]).load(i,d)}}else{var g=function getL10nDictionary(){var e=t.querySelector('script[type="application/l10n"]');return e?JSON.parse(e.innerHTML):null}();if(g&&g.locales&&g.default_locale){console.log("The PDF viewer uses the pre-compiled language bundle stored in the HTML page.");if(!(n=g.locales[o])){var f=g.default_locale.toLowerCase();for(var m in g.locales){o=m;if((m=m.toLowerCase())===i){n=g.locales[o];break}m===f&&(n=g.locales[o])}}r()}else console.log("Could not load the translation files for the PDF viewer. Check the flag useBrowserLocale, check the locales subfolder of the assets folder, or add the locale definition to the index.html");fireL10nReadyEvent(i);l="complete"}function L10nResourceLink(t){var i=t.href;this.load=function(t,n){parseResource(i,t,n,(function(){const s=e.PDFViewerApplicationOptions;if(!s||s.get("verbosity")>0){console.warn(i+" not found.");console.warn('"'+t+'" resource not found')}a="";n()}))}}}o.plural=function(t,i,s,l){var h=parseFloat(i);if(isNaN(h))return t;if(l!=r)return t;o._pluralRules||(o._pluralRules=function getPluralRules(t){function isIn(e,t){return-1!==t.indexOf(e)}function isBetween(e,t,i){return t<=e&&e<=i}var i={0:function(e){return"other"},1:function(e){return isBetween(e%100,3,10)?"few":0===e?"zero":isBetween(e%100,11,99)?"many":2==e?"two":1==e?"one":"other"},2:function(e){return 0!==e&&e%10==0?"many":2==e?"two":1==e?"one":"other"},3:function(e){return 1==e?"one":"other"},4:function(e){return isBetween(e,0,1)?"one":"other"},5:function(e){return isBetween(e,0,2)&&2!=e?"one":"other"},6:function(e){return 0===e?"zero":e%10==1&&e%100!=11?"one":"other"},7:function(e){return 2==e?"two":1==e?"one":"other"},8:function(e){return isBetween(e,3,6)?"few":isBetween(e,7,10)?"many":2==e?"two":1==e?"one":"other"},9:function(e){return 0===e||1!=e&&isBetween(e%100,1,19)?"few":1==e?"one":"other"},10:function(e){return isBetween(e%10,2,9)&&!isBetween(e%100,11,19)?"few":e%10!=1||isBetween(e%100,11,19)?"other":"one"},11:function(e){return isBetween(e%10,2,4)&&!isBetween(e%100,12,14)?"few":e%10==0||isBetween(e%10,5,9)||isBetween(e%100,11,14)?"many":e%10==1&&e%100!=11?"one":"other"},12:function(e){return isBetween(e,2,4)?"few":1==e?"one":"other"},13:function(e){return isBetween(e%10,2,4)&&!isBetween(e%100,12,14)?"few":1!=e&&isBetween(e%10,0,1)||isBetween(e%10,5,9)||isBetween(e%100,12,14)?"many":1==e?"one":"other"},14:function(e){return isBetween(e%100,3,4)?"few":e%100==2?"two":e%100==1?"one":"other"},15:function(e){return 0===e||isBetween(e%100,2,10)?"few":isBetween(e%100,11,19)?"many":1==e?"one":"other"},16:function(e){return e%10==1&&11!=e?"one":"other"},17:function(e){return 3==e?"few":0===e?"zero":6==e?"many":2==e?"two":1==e?"one":"other"},18:function(e){return 0===e?"zero":isBetween(e,0,2)&&0!==e&&2!=e?"one":"other"},19:function(e){return isBetween(e,2,10)?"few":isBetween(e,0,1)?"one":"other"},20:function(e){return!isBetween(e%10,3,4)&&e%10!=9||isBetween(e%100,10,19)||isBetween(e%100,70,79)||isBetween(e%100,90,99)?e%1e6==0&&0!==e?"many":e%10!=2||isIn(e%100,[12,72,92])?e%10!=1||isIn(e%100,[11,71,91])?"other":"one":"two":"few"},21:function(e){return 0===e?"zero":1==e?"one":"other"},22:function(e){return isBetween(e,0,1)||isBetween(e,11,99)?"one":"other"},23:function(e){return isBetween(e%10,1,2)||e%20==0?"one":"other"},24:function(e){return isBetween(e,3,10)||isBetween(e,13,19)?"few":isIn(e,[2,12])?"two":isIn(e,[1,11])?"one":"other"}},n={af:3,ak:4,am:4,ar:1,asa:3,az:0,be:11,bem:3,bez:3,bg:3,bh:4,bm:0,bn:3,bo:0,br:20,brx:3,bs:11,ca:3,cgg:3,chr:3,cs:12,cy:17,da:3,de:3,dv:3,dz:0,ee:3,el:3,en:3,eo:3,es:3,et:3,eu:3,fa:0,ff:5,fi:3,fil:4,fo:3,fr:5,fur:3,fy:3,ga:8,gd:24,gl:3,gsw:3,gu:3,guw:4,gv:23,ha:3,haw:3,he:2,hi:4,hr:11,hu:0,id:0,ig:0,ii:0,is:3,it:3,iu:7,ja:0,jmc:3,jv:0,ka:0,kab:5,kaj:3,kcg:3,kde:0,kea:0,kk:3,kl:3,km:0,kn:0,ko:0,ksb:3,ksh:21,ku:3,kw:7,lag:18,lb:3,lg:3,ln:4,lo:0,lt:10,lv:6,mas:3,mg:4,mk:16,ml:3,mn:3,mo:9,mr:3,ms:0,mt:15,my:0,nah:3,naq:7,nb:3,nd:3,ne:3,nl:3,nn:3,no:3,nr:3,nso:4,ny:3,nyn:3,om:3,or:3,pa:3,pap:3,pl:13,ps:3,pt:3,rm:3,ro:9,rof:3,ru:11,rwk:3,sah:0,saq:3,se:7,seh:3,ses:0,sg:0,sh:11,shi:19,sk:12,sl:14,sma:7,smi:7,smj:7,smn:7,sms:7,sn:3,so:3,sq:3,sr:11,ss:3,ssy:3,st:3,sv:3,sw:3,syr:3,ta:3,te:3,teo:3,th:0,ti:4,tig:3,tk:3,tl:4,tn:3,to:0,tr:0,ts:3,tzm:22,uk:11,ur:3,ve:3,vi:0,vun:3,wa:4,wae:3,wo:0,xh:3,xog:3,yo:0,zh:0,zu:3}[t.replace(/-.*$/,"")];if(!(n in i)){const i=e.PDFViewerApplicationOptions;(!i||i.get("verbosity")>0)&&console.warn("plural form unknown for ["+t+"]");return function(){return"other"}}return i[n]}(a));var c="["+o._pluralRules(h)+"]";0===h&&s+"[zero]"in n?t=n[s+"[zero]"][l]:1==h&&s+"[one]"in n?t=n[s+"[one]"][l]:2==h&&s+"[two]"in n?t=n[s+"[two]"][l]:s+c in n?t=n[s+c][l]:s+"[other]"in n&&(t=n[s+"[other]"][l]);return t};function getL10nData(t,i,s){var r=n[t];if(!r){const i=e.PDFViewerApplicationOptions;(!i||i.get("verbosity")>0)&&console.warn("Translation for the key #"+t+" is missing.");if(!s)return null;r=s}var a={};for(var o in r){var l=r[o];l=substArguments(l=substIndexes(l,i,t,o),i,t);a[o]=l}return a}function substIndexes(e,t,i,s){var r=/\{\[\s*([a-zA-Z]+)\(([a-zA-Z]+)\)\s*\]\}/.exec(e);if(!r||!r.length)return e;var a,l=r[1],h=r[2];t&&h in t?a=t[h]:h in n&&(a=n[h]);if(l in o){e=(0,o[l])(e,a,i,s)}return e}function substArguments(e,t,i){return e.replace(/\{\{\s*(.+?)\s*\}\}/g,(function(e,s){if(t&&s in t)return t[s];if(s in n)return n[s];console.log("argument {{"+s+"}} for #"+i+" is undefined.");return e}))}function translateElement(i){var n=function getL10nAttributes(t){if(!t)return{};var i=t.getAttribute("data-l10n-id"),n=t.getAttribute("data-l10n-args"),s={};if(n)try{s=JSON.parse(n)}catch(t){const n=e.PDFViewerApplicationOptions;(!n||n.get("verbosity")>0)&&console.warn("could not parse arguments for #"+i)}return{id:i,args:s}}(i);if(n.id){var s=getL10nData(n.id,n.args);if(s){if(s[r]){if(0===function getChildElementCount(e){if(e.children)return e.children.length;if(void 0!==e.childElementCount)return e.childElementCount;for(var t=0,i=0;i<e.childNodes.length;i++)t+=1===e.nodeType?1:0;return t}(i))i[r]=s[r];else{for(var a=i.childNodes,o=!1,l=0,h=a.length;l<h;l++)if(3===a[l].nodeType&&/\S/.test(a[l].nodeValue))if(o)a[l].nodeValue="";else{a[l].nodeValue=s[r];o=!0}if(!o){var c=t.createTextNode(s[r]);i.insertBefore(c,i.firstChild)}}delete s[r]}for(var d in s)i[d]=s[d]}else{const t=e.PDFViewerApplicationOptions;(!t||t.get("verbosity")>0)&&console.warn("#"+n.id+" is undefined.")}}}return{get:function(e,t,i){var n,s=e.lastIndexOf("."),a=r;if(s>0){a=e.substring(s+1);e=e.substring(0,s)}i&&((n={})[a]=i);var o=getL10nData(e,t,n);return o&&a in o?o[a]:"{{"+e+"}}"},getData:function(){return n},getText:function(){return s},getLanguage:function(){return a},setLanguage:function(e,t){loadLocale(e,(function(){t&&t()}))},getDirection:function(){var e=a.split("-",1)[0];return["ar","he","fa","ps","ur"].indexOf(e)>=0?"rtl":"ltr"},translate:function translateFragment(e){for(var i=function getTranslatableChildren(e){return e?e.querySelectorAll("*[data-l10n-id]"):[]}(e=e||t.documentElement),n=i.length,s=0;s<n;s++)translateElement(i[s]);translateElement(e)},getReadyState:function(){return l},ready:function(i){i&&("complete"==l||"interactive"==l?e.setTimeout((function(){i()})):t.addEventListener&&t.addEventListener("localized",(function once(){t.removeEventListener("localized",once);i()})))}}}(window,document)},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.docPropertiesLookup=async function docPropertiesLookup(e){const t="".split("#")[0];let{info:i,metadata:s,contentDispositionFilename:r,contentLength:a}=await e.getMetadata();if(!a){const{length:t}=await e.getDownloadInfo();a=t}return{...i,baseURL:t,filesize:a,filename:r||(0,n.getPdfFilenameFromUrl)(""),metadata:s?.getRaw(),authors:s?.get("dc:creator"),numPages:e.numPages,URL:""}};t.GenericScripting=void 0;var n=i(4);t.GenericScripting=class GenericScripting{constructor(e){this._ready=(0,n.loadScript)(e,!0).then((()=>window.pdfjsSandbox.QuickJSSandbox()))}async createSandbox(e){(await this._ready).create(e)}async dispatchEventInSandbox(e){(await this._ready).dispatchEvent(e)}async destroySandbox(){(await this._ready).nukeSandbox()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFPrintService=PDFPrintService;var n=i(4),s=i(2),r=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(i(34)),a=i(1),o=i(52);let l=null,h=null;function renderPage(e,t,i,s,a,o){const h=l.scratchCanvas;let c=a/n.PixelsPerInch.PDF,d=1;const u=Math.floor(s.width*c),p=Math.floor(s.height*c);if(u>=4096||p>=4096){if(!r.default.test({width:u,height:p})){const e=function determineMaxDimensions(){const e=[4096,8192,10836,11180,11402,14188,16384];for(let t of e)if(!r.default.test({width:t+1,height:t+1}))return t;return 16384}();d=.95*Math.min(e/u,e/p)}warn("Page "+i+": Reduced the [printResolution] to "+Math.floor(a*d)+" because the browser can't render larger canvases. If you see blank page in the print preview, reduce [printResolution] manually to a lower value.")}c*=d;h.width=Math.floor(s.width*c);h.height=Math.floor(s.height*c);const g=h.getContext("2d");g.save();g.fillStyle="rgb(255, 255, 255)";g.fillRect(0,0,h.width,h.height);g.restore();return t.getPage(i).then((function(e){const t={canvasContext:g,transform:[c,0,0,c,0,0],viewport:e.getViewport({scale:1,rotation:s.rotation}),intent:"print",annotationMode:n.AnnotationMode.ENABLE_STORAGE,optionalContentConfigPromise:o,background:PDFViewerApplicationOptions.get("pdfBackgroundColor")};return e.render(t).promise}))}function PDFPrintService(e,t,i,n,s=null,r,a){this.pdfDocument=e;this.pagesOverview=t;this.printContainer=i;this._printResolution=n||150;this._optionalContentConfigPromise=s||e.getOptionalContentConfig();this.l10n=r;this.currentPage=-1;this.scratchCanvas=document.createElement("canvas");this.eventBus=a}PDFPrintService.prototype={layout(){this.throwIfInactive();const e=document.querySelector("body");e.setAttribute("data-pdfjsprinting",!0);this.pagesOverview.every((function(e){return e.width===this.pagesOverview[0].width&&e.height===this.pagesOverview[0].height}),this)||console.warn("Not all pages have the same size. The printed result may be incorrect!");this.pageStyleSheet=document.createElement("style");const t=this.pagesOverview[0];this.pageStyleSheet.textContent="@page { size: "+t.width+"pt "+t.height+"pt;}";e.appendChild(this.pageStyleSheet)},destroy(){if(l!==this)return;this.printContainer.textContent="";document.querySelector("body").removeAttribute("data-pdfjsprinting");if(this.pageStyleSheet){this.pageStyleSheet.remove();this.pageStyleSheet=null}this.scratchCanvas.width=this.scratchCanvas.height=0;this.scratchCanvas=null;l=null;ensureOverlay().then((function(){if("printServiceOverlay"===h.active){h.close("printServiceOverlay");h.unregister("printServiceOverlay")}}));d=void 0},renderPages(){if(this.pdfDocument.isPureXfa){(0,o.getXfaHtmlForPrinting)(this.printContainer,this.pdfDocument);return Promise.resolve()}const e=this.pagesOverview.length,renderNextPage=(t,i)=>{this.throwIfInactive();for(;;){++this.currentPage;if(this.currentPage>=e)break;if(!window.isInPDFPrintRange||window.isInPDFPrintRange(this.currentPage))break}if(this.currentPage>=e){renderProgress(window.filteredPageCount|e,window.filteredPageCount|e,this.l10n,this.eventBus);t();return}const n=this.currentPage;renderProgress(n,window.filteredPageCount|e,this.l10n,this.eventBus);renderPage(0,this.pdfDocument,n+1,this.pagesOverview[n],this._printResolution,this._optionalContentConfigPromise).then(this.useRenderedPage.bind(this)).then((function(){renderNextPage(t,i)}),i)};return new Promise(renderNextPage)},useRenderedPage(){this.throwIfInactive();const e=document.createElement("img"),t=this.scratchCanvas;"toBlob"in t&&!a.compatibilityParams.disableCreateObjectURL?t.toBlob((function(t){e.src=URL.createObjectURL(t)})):e.src=t.toDataURL();const i=document.createElement("div");i.className="printedPage";i.appendChild(e);this.printContainer.appendChild(i);return new Promise((function(t,i){e.onload=t;e.onerror=i}))},performPrint(){this.throwIfInactive();return new Promise((e=>{setTimeout((()=>{if(this.active){c.call(window);setTimeout(e,20)}else e()}),0)}))},get active(){return this===l},throwIfInactive(){if(!this.active)throw new Error("This print request was cancelled or completed.")}};const c=window.print;window.printPDF=function(){if(s.PDFViewerApplication.enablePrint)if(l)console.warn("Ignored window.printPDF() because of a pending print job.");else{ensureOverlay().then((function(){l&&h.open("printServiceOverlay")}));try{dispatchEvent("beforeprint")}finally{if(!l){console.error("Expected print service to be initialized.");ensureOverlay().then((function(){"printServiceOverlay"===h.active&&h.close("printServiceOverlay")}));return}const e=l;l.renderPages().then((function(){const t=document.getElementById("printServiceOverlay");t&&t.classList.add("hidden");return e.performPrint()})).catch((function(){})).then((function(){e.active&&abort()}))}}};function dispatchEvent(e){const t=document.createEvent("CustomEvent");t.initCustomEvent(e,!1,!1,"custom");window.dispatchEvent(t)}function abort(){if(l){l.destroy();dispatchEvent("afterprint")}}function renderProgress(e,t,i,n){const s=document.getElementById("printServiceOverlay"),r=Math.round(100*e/t),a=s.querySelector("progress"),o=s.querySelector(".relative-progress");a.value=r;i.get("print_progress_percent",{progress:r}).then((e=>{o.textContent=e}));n.dispatch("progress",{source:this,type:"print",total:t,page:e,percent:100*e/t})}s.PDFViewerApplication.printKeyDownListener=function(e){if(80===e.keyCode&&(e.ctrlKey||e.metaKey)&&!e.altKey&&(!e.shiftKey||window.chrome||window.opera)){window.printPDF();e.preventDefault();e.stopImmediatePropagation?e.stopImmediatePropagation():e.stopPropagation()}};if("onbeforeprint"in window){const stopPropagationIfNeeded=function(e){"custom"!==e.detail&&e.stopImmediatePropagation&&e.stopImmediatePropagation()};window.addEventListener("beforeprint",stopPropagationIfNeeded);window.addEventListener("afterprint",stopPropagationIfNeeded)}let d;function ensureOverlay(){if(!d){h=s.PDFViewerApplication.overlayManager;if(!h)throw new Error("The overlay manager has not yet been initialized.");d=h.register("printServiceOverlay",document.getElementById("printServiceOverlay"),abort,!0);document.getElementById("printCancel").onclick=abort}return d}s.PDFPrintServiceFactory.instance={supportsPrinting:!0,createPrintService(e,t,i,n,s,r,a){if(l)throw new Error("The print service is created and active.");l=new PDFPrintService(e,t,i,n,s,r,a);return l}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.getXfaHtmlForPrinting=function getXfaHtmlForPrinting(e,t){const i=t.allXfaHtml,r=new s.DefaultXfaLayerFactory,a=Math.round(100*n.PixelsPerInch.PDF_TO_CSS_UNITS)/100;for(const s of i.children){const i=document.createElement("div");i.className="xfaPrintedPage";e.appendChild(i);const o=r.createXfaLayerBuilder(i,null,t.annotationStorage,s),l=(0,n.getXfaPageViewport)(s,{scale:a});o.render(l,"print")}};var n=i(4),s=i(40)}],t={};function __webpack_require__(i){var n=t[i];if(void 0!==n)return n.exports;var s=t[i]={exports:{}};e[i](s,s.exports,__webpack_require__);return s.exports}var i={};(()=>{var e=i;Object.defineProperty(e,"__esModule",{value:!0});Object.defineProperty(e,"PDFViewerApplicationOptions",{enumerable:!0,get:function(){return t.AppOptions}});Object.defineProperty(e,"PDFViewerApplication",{enumerable:!0,get:function(){return n.PDFViewerApplication}});var t=__webpack_require__(1),n=__webpack_require__(2);window.PDFViewerApplication=n.PDFViewerApplication;window.PDFViewerApplicationOptions=t.AppOptions;HTMLCollection.prototype[Symbol.iterator]||(HTMLCollection.prototype[Symbol.iterator]=Array.prototype[Symbol.iterator]);"function"!=typeof window.CustomEvent&&(window.CustomEvent=function CustomEvent(e,t){t=t||{bubbles:!1,cancelable:!1,detail:null};const i=document.createEvent("CustomEvent");i.initCustomEvent(e,t.bubbles,t.cancelable,t.detail);return i});__webpack_require__(45);__webpack_require__(51);document.blockUnblockOnload&&document.blockUnblockOnload(!0);window.webViewerLoad=function webViewerLoad(){const e=function getViewerConfiguration(){let e=null;e={container:document.getElementById("errorWrapper"),errorMessage:document.getElementById("errorMessage"),closeButton:document.getElementById("errorClose"),errorMoreInfo:document.getElementById("errorMoreInfo"),moreInfoButton:document.getElementById("errorShowMore"),lessInfoButton:document.getElementById("errorShowLess")};return{appContainer:document.body,mainContainer:document.getElementById("viewerContainer"),viewerContainer:document.getElementById("viewer"),eventBus:null,toolbar:{container:document.getElementById("toolbarViewer"),numPages:document.getElementById("numPages"),pageNumber:document.getElementById("pageNumber"),scaleSelect:document.getElementById("scaleSelect"),customScaleOption:document.getElementById("customScaleOption"),previous:document.getElementById("previous"),next:document.getElementById("next"),zoomIn:document.getElementById("zoomIn"),zoomOut:document.getElementById("zoomOut"),viewFind:document.getElementById("viewFind"),openFile:document.getElementById("openFile"),print:document.getElementById("print"),presentationModeButton:document.getElementById("presentationMode"),download:document.getElementById("download"),viewBookmark:document.getElementById("viewBookmark")},secondaryToolbar:{toolbar:document.getElementById("secondaryToolbar"),toggleButton:document.getElementById("secondaryToolbarToggle"),toolbarButtonContainer:document.getElementById("secondaryToolbarButtonContainer"),presentationModeButton:document.getElementById("secondaryPresentationMode"),openFileButton:document.getElementById("secondaryOpenFile"),printButton:document.getElementById("secondaryPrint"),downloadButton:document.getElementById("secondaryDownload"),viewBookmarkButton:document.getElementById("secondaryViewBookmark"),firstPageButton:document.getElementById("firstPage"),lastPageButton:document.getElementById("lastPage"),pageRotateCwButton:document.getElementById("pageRotateCw"),pageRotateCcwButton:document.getElementById("pageRotateCcw"),cursorSelectToolButton:document.getElementById("cursorSelectTool"),cursorHandToolButton:document.getElementById("cursorHandTool"),scrollVerticalButton:document.getElementById("scrollVertical"),scrollHorizontalButton:document.getElementById("scrollHorizontal"),scrollWrappedButton:document.getElementById("scrollWrapped"),spreadNoneButton:document.getElementById("spreadNone"),spreadOddButton:document.getElementById("spreadOdd"),spreadEvenButton:document.getElementById("spreadEven"),documentPropertiesButton:document.getElementById("documentProperties")},sidebar:{outerContainer:document.getElementById("outerContainer"),viewerContainer:document.getElementById("viewerContainer"),toggleButton:document.getElementById("sidebarToggle"),thumbnailButton:document.getElementById("viewThumbnail"),outlineButton:document.getElementById("viewOutline"),attachmentsButton:document.getElementById("viewAttachments"),layersButton:document.getElementById("viewLayers"),thumbnailView:document.getElementById("thumbnailView"),outlineView:document.getElementById("outlineView"),attachmentsView:document.getElementById("attachmentsView"),layersView:document.getElementById("layersView"),outlineOptionsContainer:document.getElementById("outlineOptionsContainer"),currentOutlineItemButton:document.getElementById("currentOutlineItem")},sidebarResizer:{outerContainer:document.getElementById("outerContainer"),resizer:document.getElementById("sidebarResizer")},findBar:{bar:document.getElementById("findbar"),toggleButton:document.getElementById("viewFind"),findField:document.getElementById("findInput"),findFieldMultiline:document.getElementById("findInputMultiline"),highlightAllCheckbox:document.getElementById("findHighlightAll"),caseSensitiveCheckbox:document.getElementById("findMatchCase"),entireWordCheckbox:document.getElementById("findEntireWord"),findMultipleSearchTextsCheckbox:document.getElementById("findMultipleSearchTexts"),ignoreAccentsCheckbox:document.getElementById("findIgnoreAccents"),fuzzyCheckbox:document.getElementById("findFuzzy"),findMsg:document.getElementById("findMsg"),findResultsCount:document.getElementById("findResultsCount"),findPreviousButton:document.getElementById("findPrevious"),findNextButton:document.getElementById("findNext")},passwordOverlay:{overlayName:"passwordOverlay",container:document.getElementById("passwordOverlay"),label:document.getElementById("passwordText"),input:document.getElementById("password"),submitButton:document.getElementById("passwordSubmit"),cancelButton:document.getElementById("passwordCancel")},documentProperties:{overlayName:"documentPropertiesOverlay",container:document.getElementById("documentPropertiesOverlay"),closeButton:document.getElementById("documentPropertiesClose"),fields:{fileName:document.getElementById("fileNameField"),fileSize:document.getElementById("fileSizeField"),title:document.getElementById("titleField"),author:document.getElementById("authorField"),subject:document.getElementById("subjectField"),keywords:document.getElementById("keywordsField"),creationDate:document.getElementById("creationDateField"),modificationDate:document.getElementById("modificationDateField"),creator:document.getElementById("creatorField"),producer:document.getElementById("producerField"),version:document.getElementById("versionField"),pageCount:document.getElementById("pageCountField"),pageSize:document.getElementById("pageSizeField"),linearized:document.getElementById("linearizedField")}},errorWrapper:e,printContainer:document.getElementById("printContainer"),openFileInputName:"fileInput",debuggerScriptPath:"./debugger.js"}}(),t=document.createEvent("CustomEvent");t.initCustomEvent("webviewerloaded",!0,!0,{source:window});try{parent.document.dispatchEvent(t)}catch(e){console.error(`webviewerloaded: ${e}`);document.dispatchEvent(t)}n.PDFViewerApplication.run(e)}})()})();
//# sourceMappingURL=viewer.min.js.map