UNPKG

617 kBJavaScriptView Raw
1window.ngxZone.runOutsideAngular(() => {
2/**
3 * @licstart The following is the entire license notice for the
4 * JavaScript code in this page
5 *
6 * Copyright 2023 Mozilla Foundation
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 *
20 * @licend The above is the entire license notice for the
21 * JavaScript code in this page
22 */
23!function webpackUniversalModuleDefinition(e,t){"object"==typeof exports&&"object"==typeof module?globalThis["pdfjs-dist/build/pdf"]=module.exports=t():"function"==typeof define&&define.amd?define("pdfjs-dist/build/pdf",[],t):"object"==typeof exports?globalThis["pdfjs-dist/build/pdf"]=exports["pdfjs-dist/build/pdf"]=t():e["pdfjs-dist/build/pdf"]=e.pdfjsLib=t()}(globalThis,(()=>(()=>{"use strict";var __webpack_modules__=[,(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.VerbosityLevel=t.Util=t.UnknownErrorException=t.UnexpectedResponseException=t.UNSUPPORTED_FEATURES=t.TextRenderingMode=t.RenderingIntentFlag=t.PermissionFlag=t.PasswordResponses=t.PasswordException=t.PageActionEventType=t.OPS=t.MissingPDFException=t.LINE_FACTOR=t.LINE_DESCENT_FACTOR=t.InvalidPDFException=t.ImageKind=t.IDENTITY_MATRIX=t.FormatError=t.FeatureTest=t.FONT_IDENTITY_MATRIX=t.DocumentActionEventType=t.CMapCompressionType=t.BaseException=t.BASELINE_FACTOR=t.AnnotationType=t.AnnotationStateModelType=t.AnnotationReviewState=t.AnnotationReplyType=t.AnnotationMode=t.AnnotationMarkedState=t.AnnotationFlag=t.AnnotationFieldFlag=t.AnnotationEditorType=t.AnnotationEditorPrefix=t.AnnotationEditorParamsType=t.AnnotationBorderStyleType=t.AnnotationActionEventType=t.AbortException=void 0;t.assert=function assert(e,t){e||unreachable(t)};t.bytesToString=function bytesToString(e){"object"==typeof e&&null!==e&&void 0!==e.length||unreachable("Invalid argument for bytesToString");const t=e.length,i=8192;if(t<i)return String.fromCharCode.apply(null,e);const n=[];for(let s=0;s<t;s+=i){const r=Math.min(s+i,t),a=e.subarray(s,r);n.push(String.fromCharCode.apply(null,a))}return n.join("")};t.createPromiseCapability=function createPromiseCapability(){const e=Object.create(null);let t=!1;Object.defineProperty(e,"settled",{get:()=>t});e.promise=new Promise((function(i,n){e.resolve=function(e){t=!0;i(e)};e.reject=function(e){t=!0;n(e)}}));return e};t.createValidAbsoluteUrl=function createValidAbsoluteUrl(e,t=null,i=null){if(!e)return null;try{if(i&&"string"==typeof e){if(i.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\./g);t&&t.length>=2&&(e=`http://${e}`)}if(i.tryConvertEncoding)try{e=stringToUTF8String(e)}catch(e){}}const n=t?new URL(e,t):new URL(e);if(function _isValidProtocol(e){if(!e)return!1;switch(e.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":case"capacitor":return!0;default:return!1}}(n))return n}catch(e){}return null};t.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 n};t.info=function info(e){n>=i.INFOS&&("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?console.log(`Info: ${e}`):Window&&Window.ngxConsole?Window.ngxConsole.log(`Info: ${e}`):console.log(`Info: ${e}`))};t.isArrayBuffer=function isArrayBuffer(e){return"object"==typeof e&&null!==e&&void 0!==e.byteLength};t.isArrayEqual=function isArrayEqual(e,t){if(e.length!==t.length)return!1;for(let i=0,n=e.length;i<n;i++)if(e[i]!==t[i])return!1;return!0};t.objectFromMap=function objectFromMap(e){const t=Object.create(null);for(const[i,n]of e)t[i]=n;return t};t.objectSize=function objectSize(e){return Object.keys(e).length};t.setVerbosityLevel=function setVerbosityLevel(e){Number.isInteger(e)&&(n=e)};t.shadow=shadow;t.string32=function string32(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)};t.stringToBytes=stringToBytes;t.stringToPDFString=function stringToPDFString(e){if(e[0]>="ï"){let t;"þ"===e[0]&&"ÿ"===e[1]?t="utf-16be":"ÿ"===e[0]&&"þ"===e[1]?t="utf-16le":"ï"===e[0]&&"»"===e[1]&&"¿"===e[2]&&(t="utf-8");if(t)try{const i=new TextDecoder(t,{fatal:!0}),n=stringToBytes(e);return i.decode(n)}catch(e){warn(`stringToPDFString: "${e}".`)}}const t=[];for(let i=0,n=e.length;i<n;i++){const n=a[e.charCodeAt(i)];t.push(n?String.fromCharCode(n):e.charAt(i))}return t.join("")};t.stringToUTF8String=stringToUTF8String;t.unreachable=unreachable;t.utf8StringToString=function utf8StringToString(e){return unescape(encodeURIComponent(e))};t.warn=warn;t.IDENTITY_MATRIX=[1,0,0,1,0,0];t.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0];t.LINE_FACTOR=1.35;t.LINE_DESCENT_FACTOR=.35;t.BASELINE_FACTOR=.25925925925925924;t.RenderingIntentFlag={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};t.AnnotationMode={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};t.AnnotationEditorPrefix="pdfjs_internal_editor_";t.AnnotationEditorType={DISABLE:-1,NONE:0,FREETEXT:3,INK:15};t.AnnotationEditorParamsType={FREETEXT_SIZE:1,FREETEXT_COLOR:2,FREETEXT_OPACITY:3,INK_COLOR:11,INK_THICKNESS:12,INK_OPACITY:13};t.PermissionFlag={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};t.TextRenderingMode={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4};t.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};t.AnnotationType={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26};t.AnnotationStateModelType={MARKED:"Marked",REVIEW:"Review"};t.AnnotationMarkedState={MARKED:"Marked",UNMARKED:"Unmarked"};t.AnnotationReviewState={ACCEPTED:"Accepted",REJECTED:"Rejected",CANCELLED:"Cancelled",COMPLETED:"Completed",NONE:"None"};t.AnnotationReplyType={GROUP:"Group",REPLY:"R"};t.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};t.AnnotationFieldFlag={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864};t.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};t.AnnotationActionEventType={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"};t.DocumentActionEventType={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};t.PageActionEventType={O:"PageOpen",C:"PageClose"};const i={ERRORS:0,WARNINGS:1,INFOS:5};t.VerbosityLevel=i;t.CMapCompressionType={NONE:0,BINARY:1};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,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91};t.UNSUPPORTED_FEATURES={forms:"forms",javaScript:"javaScript",signatures:"signatures",smask:"smask",shadingPattern:"shadingPattern",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 n=i.WARNINGS;function warn(e){n>=i.WARNINGS&&("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?console.log(`Warning: ${e}`):Window&&Window.ngxConsole?Window.ngxConsole.log(`Warning: ${e}`):console.log(`Warning: ${e}`))}function unreachable(e){throw new Error(e)}function shadow(e,t,i,n=!1){Object.defineProperty(e,t,{value:i,enumerable:!n,configurable:!0,writable:!1});return i}const s=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=s;t.PasswordException=class PasswordException extends s{constructor(e,t){super(e,"PasswordException");this.code=t}};t.UnknownErrorException=class UnknownErrorException extends s{constructor(e,t){super(e,"UnknownErrorException");this.details=t}};t.InvalidPDFException=class InvalidPDFException extends s{constructor(e){super(e,"InvalidPDFException")}};t.MissingPDFException=class MissingPDFException extends s{constructor(e){super(e,"MissingPDFException")}};t.UnexpectedResponseException=class UnexpectedResponseException extends s{constructor(e,t){super(e,"UnexpectedResponseException");this.status=t}};t.FormatError=class FormatError extends s{constructor(e){super(e,"FormatError")}};t.AbortException=class AbortException extends s{constructor(e){super(e,"AbortException")}};function stringToBytes(e){"string"!=typeof e&&unreachable("Invalid argument for stringToBytes");const t=e.length,i=new Uint8Array(t);for(let n=0;n<t;++n)i[n]=255&e.charCodeAt(n);return i}t.FeatureTest=class FeatureTest{static get isLittleEndian(){return shadow(this,"isLittleEndian",function isLittleEndian(){const e=new Uint8Array(4);e[0]=1;return 1===new Uint32Array(e.buffer,0,1)[0]}())}static get isEvalSupported(){return shadow(this,"isEvalSupported",function isEvalSupported(){try{new Function("");return!0}catch(e){return!1}}())}static get isOffscreenCanvasSupported(){return shadow(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get platform(){return"undefined"==typeof navigator?shadow(this,"platform",{isWin:!1,isMac:!1}):shadow(this,"platform",{isWin:navigator.platform.includes("Win"),isMac:navigator.platform.includes("Mac")})}};const r=[...Array(256).keys()].map((e=>e.toString(16).padStart(2,"0")));class Util{static makeHexColor(e,t,i){return`#${r[e]}${r[t]}${r[i]}`}static scaleMinMax(e,t){let i;if(e[0]){if(e[0]<0){i=t[0];t[0]=t[1];t[1]=i}t[0]*=e[0];t[1]*=e[0];if(e[3]<0){i=t[2];t[2]=t[3];t[3]=i}t[2]*=e[3];t[3]*=e[3]}else{i=t[0];t[0]=t[2];t[2]=i;i=t[1];t[1]=t[3];t[3]=i;if(e[1]<0){i=t[2];t[2]=t[3];t[3]=i}t[2]*=e[1];t[3]*=e[1];if(e[2]<0){i=t[0];t[0]=t[1];t[1]=i}t[0]*=e[2];t[1]*=e[2]}t[0]+=e[4];t[1]+=e[4];t[2]+=e[5];t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]}static applyInverseTransform(e,t){const i=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/i,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/i]}static getAxialAlignedBoundingBox(e,t){const i=Util.applyTransform(e,t),n=Util.applyTransform(e.slice(2,4),t),s=Util.applyTransform([e[0],e[3]],t),r=Util.applyTransform([e[2],e[1]],t);return[Math.min(i[0],n[0],s[0],r[0]),Math.min(i[1],n[1],s[1],r[1]),Math.max(i[0],n[0],s[0],r[0]),Math.max(i[1],n[1],s[1],r[1])]}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static 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){const i=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),n=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(i>n)return null;const s=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),r=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return s>r?null:[i,s,n,r]}static bezierBoundingBox(e,t,i,n,s,r,a,o){const l=[],h=[[],[]];let d,c,u,p,g,f,m,b;for(let h=0;h<2;++h){if(0===h){c=6*e-12*i+6*s;d=-3*e+9*i-9*s+3*a;u=3*i-3*e}else{c=6*t-12*n+6*r;d=-3*t+9*n-9*r+3*o;u=3*n-3*t}if(Math.abs(d)<1e-12){if(Math.abs(c)<1e-12)continue;p=-u/c;0<p&&p<1&&l.push(p)}else{m=c*c-4*u*d;b=Math.sqrt(m);if(!(m<0)){g=(-c+b)/(2*d);0<g&&g<1&&l.push(g);f=(-c-b)/(2*d);0<f&&f<1&&l.push(f)}}}let v,w=l.length;const _=w;for(;w--;){p=l[w];v=1-p;h[0][w]=v*v*v*e+3*v*v*p*i+3*v*p*p*s+p*p*p*a;h[1][w]=v*v*v*t+3*v*v*p*n+3*v*p*p*r+p*p*p*o}h[0][_]=e;h[1][_]=t;h[0][_+1]=a;h[1][_+1]=o;h[0].length=h[1].length=_+2;return[Math.min(...h[0]),Math.min(...h[1]),Math.max(...h[0]),Math.max(...h[1])]}}t.Util=Util;const a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function stringToUTF8String(e){return decodeURIComponent(escape(e))}},(__unused_webpack_module,exports,__w_pdfjs_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0});exports.build=exports.RenderTask=exports.PDFWorkerUtil=exports.PDFWorker=exports.PDFPageProxy=exports.PDFDocumentProxy=exports.PDFDocumentLoadingTask=exports.PDFDataRangeTransport=exports.LoopbackPort=exports.DefaultStandardFontDataFactory=exports.DefaultCanvasFactory=exports.DefaultCMapReaderFactory=void 0;exports.getDocument=getDocument;exports.version=void 0;var _util=__w_pdfjs_require__(1),_annotation_storage=__w_pdfjs_require__(3),_display_utils=__w_pdfjs_require__(6),_font_loader=__w_pdfjs_require__(9),_canvas=__w_pdfjs_require__(11),_worker_options=__w_pdfjs_require__(14),_is_node=__w_pdfjs_require__(10),_message_handler=__w_pdfjs_require__(15),_metadata=__w_pdfjs_require__(16),_optional_content_config=__w_pdfjs_require__(17),_transport_stream=__w_pdfjs_require__(18),_xfa_text=__w_pdfjs_require__(19);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100,ServiceWorkerOptions={showUnverifiedSignatures:!1};window.ServiceWorkerOptions=ServiceWorkerOptions;let DefaultCanvasFactory=_display_utils.DOMCanvasFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory;let DefaultCMapReaderFactory=_display_utils.DOMCMapReaderFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory;let DefaultStandardFontDataFactory=_display_utils.DOMStandardFontDataFactory,createPDFNetworkStream;exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory;if(_is_node.isNodeJS){const{NodeCanvasFactory:e,NodeCMapReaderFactory:t,NodeStandardFontDataFactory:i}=__w_pdfjs_require__(20);exports.DefaultCanvasFactory=DefaultCanvasFactory=e;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory=t;exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory=i}if(_is_node.isNodeJS){const{PDFNodeStream:e}=__w_pdfjs_require__(21);createPDFNetworkStream=t=>new e(t)}else{const{PDFNetworkStream:e}=__w_pdfjs_require__(24),{PDFFetchStream:t}=__w_pdfjs_require__(25);createPDFNetworkStream=i=>(0,_display_utils.isValidFetchUrl)(i.url)?new t(i):new e(i)}function getDocument(e){if("string"==typeof e||e instanceof URL)e={url:e};else if((0,_util.isArrayBuffer)(e))e={data:e};else if(e instanceof PDFDataRangeTransport){(0,_display_utils.deprecated)("`PDFDataRangeTransport`-instance, please use a parameter object with `range`-property instead.");e={range:e}}else if("object"!=typeof e)throw new Error("Invalid parameter in getDocument, need either string, URL, TypedArray, or parameter object.");if(!e.url&&!e.data&&!e.range)throw new Error("Invalid parameter object: need either .data, .range or .url");const t=new PDFDocumentLoadingTask,i=e.url?getUrlProp(e.url,e.baseHref):null,n=e.data?getDataProp(e.data):null,s=e.httpHeaders||null,r=!0===e.withCredentials,a=e.password??null,o=e.range instanceof PDFDataRangeTransport?e.range:null,l=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:DEFAULT_RANGE_CHUNK_SIZE;let h=e.worker instanceof PDFWorker?e.worker:null;const d=e.verbosity,c="string"!=typeof e.docBaseUrl||(0,_display_utils.isDataScheme)(e.docBaseUrl)?null:e.docBaseUrl,u="function"==typeof e.cMapUrl?e.cMapUrl():"string"==typeof e.cMapUrl?e.cMapUrl:null,p=!1!==e.cMapPacked,g=e.CMapReaderFactory||DefaultCMapReaderFactory,f="function"==typeof e.standardFontDataUrl?e.standardFontDataUrl():"string"==typeof e.standardFontDataUrl?e.standardFontDataUrl:null,m=e.StandardFontDataFactory||DefaultStandardFontDataFactory,b=!0!==e.stopAtErrors,v=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,w=!1!==e.isEvalSupported,_="boolean"==typeof e.isOffscreenCanvasSupported?e.isOffscreenCanvasSupported:!_is_node.isNodeJS,y="boolean"==typeof e.disableFontFace?e.disableFontFace:_is_node.isNodeJS,S=!0===e.fontExtraProperties,P=!0===e.enableXfa,A=e.ownerDocument||globalThis.document,E=!0===e.disableRange,C=!0===e.disableStream,x=!0===e.disableAutoFetch,T=!0===e.pdfBug,M=o?o.length:e.length??NaN,I="boolean"==typeof e.useSystemFonts?e.useSystemFonts:!_is_node.isNodeJS&&!y,L="boolean"==typeof e.useWorkerFetch?e.useWorkerFetch:g===_display_utils.DOMCMapReaderFactory&&m===_display_utils.DOMStandardFontDataFactory&&(0,_display_utils.isValidFetchUrl)(u,document.baseURI)&&(0,_display_utils.isValidFetchUrl)(f,document.baseURI);(0,_util.setVerbosityLevel)(d);const k=L?null:{cMapReaderFactory:new g({baseUrl:u,isCompressed:p}),standardFontDataFactory:new m({baseUrl:f})};if(!h){const e={verbosity:d,port:_worker_options.GlobalWorkerOptions.workerPort};h=e.port?PDFWorker.fromPort(e):new PDFWorker(e);t._worker=h}const D=t.docId,R={docId:D,apiVersion:"3.4.493",data:n,password:a,disableAutoFetch:x,rangeChunkSize:l,length:M,docBaseUrl:c,enableXfa:P,evaluatorOptions:{maxImageSize:v,disableFontFace:y,ignoreErrors:b,isEvalSupported:w,isOffscreenCanvasSupported:_,fontExtraProperties:S,useSystemFonts:I,cMapUrl:L?u:null,standardFontDataUrl:L?f:null}},F={ignoreErrors:b,isEvalSupported:w,disableFontFace:y,fontExtraProperties:S,enableXfa:P,ownerDocument:A,disableAutoFetch:x,pdfBug:T,styleElement:null};h.promise.then((function(){if(t.destroyed)throw new Error("Loading aborted");const e=_fetchDocument(h,R),a=new Promise((function(e){let t;o?t=new _transport_stream.PDFDataTransportStream({length:M,initialData:o.initialData,progressiveDone:o.progressiveDone,contentDispositionFilename:o.contentDispositionFilename,disableRange:E,disableStream:C},o):n||(t=createPDFNetworkStream({url:i,length:M,httpHeaders:s,withCredentials:r,rangeChunkSize:l,disableRange:E,disableStream:C}));e(t)}));return Promise.all([e,a]).then((function([e,i]){if(t.destroyed)throw new Error("Loading aborted");const n=new _message_handler.MessageHandler(D,e,h.port),s=new WorkerTransport(n,t,i,F,k);t._transport=s;n.send("showUnverifiedSignatures",window.ServiceWorkerOptions.showUnverifiedSignatures);n.send("Ready",null)}))})).catch(t._capability.reject);return t}async function _fetchDocument(e,t){if(e.destroyed)throw new Error("Worker was destroyed");const i=await e.messageHandler.sendWithPromise("GetDocRequest",t,t.data?[t.data.buffer]:null);if(e.destroyed)throw new Error("Worker was destroyed");return i}function getUrlProp(e,t){if(e instanceof URL)return e.href;try{return t?new URL(e,window.location.origin+t).href:new URL(e,window.location).href}catch(t){if(_is_node.isNodeJS&&"string"==typeof e)return e}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function getDataProp(e){if(_is_node.isNodeJS&&"undefined"!=typeof Buffer&&e instanceof Buffer){(0,_display_utils.deprecated)("Please provide binary data as `Uint8Array`, rather than `Buffer`.");return new Uint8Array(e)}if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if("string"==typeof e)return(0,_util.stringToBytes)(e);if("object"==typeof e&&!isNaN(e?.length)||(0,_util.isArrayBuffer)(e))return new Uint8Array(e);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}class PDFDocumentLoadingTask{static#e=0;#t=null;constructor(){this._capability=(0,_util.createPromiseCapability)();this._transport=null;this._worker=null;this.docId="d"+PDFDocumentLoadingTask.#e++;this.destroyed=!1;this.onPassword=null;this.onProgress=null}get onUnsupportedFeature(){return this.#t}set onUnsupportedFeature(e){(0,_display_utils.deprecated)("The PDFDocumentLoadingTask onUnsupportedFeature property will be removed in the future.");this.#t=e}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}get annotationStorage(){return this._transport.annotationStorage}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return(0,_util.shadow)(this,"isPureXfa",!!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()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}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}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.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);return this._transport.getAnnotations(this._pageIndex,t.renderingIntent)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get isPureXfa(){return(0,_util.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}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,canvasFactory:r=null,background:a=null,backgroundColorToReplace:o=null,optionalContentConfigPromise:l=null,annotationCanvasMap:h=null,pageColors:d=null,printAnnotationStorage:c=null}){this._stats?.time("Overall");const u=this._transport.getRenderingIntent(i,n,c);this.pendingCleanup=!1;l||(l=this._transport.getOptionalContentConfig());let p=this._intentStates.get(u.cacheKey);if(!p){p=Object.create(null);this._intentStates.set(u.cacheKey,p)}if(p.streamReaderCancelTimeout){clearTimeout(p.streamReaderCancelTimeout);p.streamReaderCancelTimeout=null}const g=r||new DefaultCanvasFactory({ownerDocument:this._ownerDocument}),f=!!(u.renderingIntent&_util.RenderingIntentFlag.PRINT);if(!p.displayReadyCapability){p.displayReadyCapability=(0,_util.createPromiseCapability)();p.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null};this._stats?.time("Page Request");this._pumpOperatorList(u)}const complete=e=>{p.renderTasks.delete(m);(this.cleanupAfterRender||f)&&(this.pendingCleanup=!0);this._tryCleanup();if(e){m.capability.reject(e);this._abortOperatorList({intentState:p,reason:e instanceof Error?e:new Error(e)})}else m.capability.resolve();this._stats?.timeEnd("Rendering");this._stats?.timeEnd("Overall")},m=new InternalRenderTask({callback:complete,params:{canvasContext:e,viewport:t,transform:s,background:a,backgroundColorToReplace:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:h,operatorList:p.operatorList,pageIndex:this._pageIndex,canvasFactory:g,useRequestAnimationFrame:!f,pdfBug:this._pdfBug,pageColors:d});(p.renderTasks||=new Set).add(m);const b=m.task;Promise.all([p.displayReadyCapability.promise,l]).then((([e,t])=>{if(this.pendingCleanup)complete();else{this._stats?.time("Rendering");m.initializeGraphics({transparency:e,optionalContentConfig:t});m.operatorListChanged()}})).catch(complete);return b}getOperatorList({intent:e="display",annotationMode:t=_util.AnnotationMode.ENABLE,printAnnotationStorage:i=null}={}){const n=this._transport.getRenderingIntent(e,t,i,!0);let s,r=this._intentStates.get(n.cacheKey);if(!r){r=Object.create(null);this._intentStates.set(n.cacheKey,r)}if(!r.opListReadCapability){s=Object.create(null);s.operatorListChanged=function operatorListChanged(){if(r.operatorList.lastChunk){r.opListReadCapability.resolve(r.operatorList);r.renderTasks.delete(s)}};r.opListReadCapability=(0,_util.createPromiseCapability)();(r.renderTasks||=new Set).add(s);r.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null};this._stats?.time("Page Request");this._pumpOperatorList(n)}return r.opListReadCapability.promise}streamTextContent({disableCombineTextItems:e=!1,includeMarkedContent:t=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,combineTextItems:!0!==e,includeMarkedContent:!0===t},{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._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;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.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();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?.timeEnd("Page Request");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;t.operatorList.separateAnnots=e.separateAnnots;for(const e of t.renderTasks)e.operatorListChanged();e.lastChunk&&this._tryCleanup()}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageMap:i}){const n=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:i}).getReader(),s=this._intentStates.get(t);s.streamReader=n;const pump=()=>{n.read().then((({value:e,done:t})=>{if(t)s.streamReader=null;else if(!this._transport.destroyed){this._renderPageChunk(e,s);pump()}}),(e=>{s.streamReader=null;if(!this._transport.destroyed){if(s.operatorList){s.operatorList.lastChunk=!0;for(const e of s.renderTasks)e.operatorListChanged();this._tryCleanup()}if(s.displayReadyCapability)s.displayReadyCapability.reject(e);else{if(!s.opListReadCapability)throw e;s.opListReadCapability.reject(e)}}}))};pump()}_abortOperatorList({intentState:e,reason:t,force:i=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout){clearTimeout(e.streamReaderCancelTimeout);e.streamReaderCancelTimeout=null}if(!i){if(e.renderTasks.size>0)return;if(t instanceof _display_utils.RenderingCancelledException){let i=RENDERING_CANCELLED_TIMEOUT;t.extraDelay>0&&t.extraDelay<1e3&&(i+=t.extraDelay);e.streamReaderCancelTimeout=setTimeout((()=>{e.streamReaderCancelTimeout=null;this._abortOperatorList({intentState:e,reason:t,force:!0})}),i);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{#i=new Set;#n=Promise.resolve();postMessage(e,t){const i={data:structuredClone(e,t)};this.#n.then((()=>{for(const e of this.#i)e.call(this,i)}))}addEventListener(e,t){this.#i.add(t)}removeEventListener(e,t){this.#i.delete(t)}terminate(){this.#i.clear()}}exports.LoopbackPort=LoopbackPort;const PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};exports.PDFWorkerUtil=PDFWorkerUtil;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.isSameOrigin=function(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};PDFWorkerUtil.createCDNWrapper=function(e){const t=`importScripts("${e}");`;return URL.createObjectURL(new Blob([t]))};class PDFWorker{static#s=new WeakMap;constructor({name:e=null,port:t=null,verbosity:i=(0,_util.getVerbosityLevel)()}={}){if(t&&PDFWorker.#s.has(t))throw new Error("Cannot use more than one PDFWorker per port.");this.name=e;this.destroyed=!1;this.verbosity=i;this._readyCapability=(0,_util.createPromiseCapability)();this._port=null;this._webWorker=null;this._messageHandler=null;if(t){PDFWorker.#s.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();this._messageHandler.send("configure",{verbosity:this.verbosity})}#r(e){if(window.trustedTypes){return window.trustedTypes.createPolicy("foo",{createScriptURL:e=>e}).createScriptURL(e)}return e}_initialize(){if(!PDFWorkerUtil.isWorkerDisabled&&!PDFWorker._mainThreadWorkerMessageHandler){let{workerSrc:e}=PDFWorker;try{PDFWorkerUtil.isSameOrigin(window.location.href,e)||(e=PDFWorkerUtil.createCDNWrapper(new URL(e,window.location).href));const t=new Worker(this.#r(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;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;i.send("test",e,[e.buffer])};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.#s.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.#s.has(e.port)?this.#s.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;class WorkerTransport{#a=new Map;#o=new Map;#l=new Map;constructor(e,t,i,n,s){this.messageHandler=e;this.loadingTask=t;this.commonObjs=new PDFObjects;this.fontLoader=new _font_loader.FontLoader({onUnsupportedFeature:this._onUnsupportedFeature.bind(this),ownerDocument:n.ownerDocument,styleElement:n.styleElement});this._params=n;this.cMapReaderFactory=s?.cMapReaderFactory;this.standardFontDataFactory=s?.standardFontDataFactory;this.destroyed=!1;this.destroyCapability=null;this._passwordCapability=null;this._networkStream=i;this._fullReader=null;this._lastProgress=null;this.downloadInfoCapability=(0,_util.createPromiseCapability)();this.setupMessageHandler()}#h(e,t=null){const i=this.#a.get(e);if(i)return i;const n=this.messageHandler.sendWithPromise(e,t);this.#a.set(e,n);return n}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}getRenderingIntent(e,t=_util.AnnotationMode.ENABLE,i=null,n=!1){let s=_util.RenderingIntentFlag.DISPLAY,r=null;switch(e){case"any":s=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":s=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${e}`)}switch(t){case _util.AnnotationMode.DISABLE:s+=_util.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case _util.AnnotationMode.ENABLE:break;case _util.AnnotationMode.ENABLE_FORMS:s+=_util.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case _util.AnnotationMode.ENABLE_STORAGE:s+=_util.RenderingIntentFlag.ANNOTATIONS_STORAGE;r=(s&_util.RenderingIntentFlag.PRINT&&i instanceof _annotation_storage.PrintAnnotationStorage?i:this.annotationStorage).serializable;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${t}`)}n&&(s+=_util.RenderingIntentFlag.OPLIST);return{renderingIntent:s,cacheKey:`${s}_${_annotation_storage.AnnotationStorage.getHash(r)}`,annotationStorageMap:r}}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.#o.values())e.push(t._destroy());this.#o.clear();this.#l.clear();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.#a.clear();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)(e instanceof ArrayBuffer,"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?.(this._lastProgress);n.onProgress=e=>{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)(e instanceof ArrayBuffer,"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=>{e instanceof Error?this._passwordCapability.reject(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?.({loaded:e.length,total:e.length});this.downloadInfoCapability.resolve(e)}));e.on("StartRenderPage",(e=>{if(this.destroyed)return;this.#o.get(e.pageIndex)._startRenderPage(e.transparency,e.cacheKey)}));e.on("commonobj",(([t,i,n])=>{if(!this.destroyed&&!this.commonObjs.has(t))switch(i){case"Font":const s=this._params;if("error"in n){const e=n.error;(0,_util.warn)(`Error during font loading: ${e}`);this.commonObjs.resolve(t,e);break}let r=null;s.pdfBug&&globalThis.FontInspector?.enabled&&(r={registerFont(e,t){globalThis.FontInspector.fontAdded(e,t)}});const a=new _font_loader.FontFaceObject(n,{isEvalSupported:s.isEvalSupported,disableFontFace:s.disableFontFace,ignoreErrors:s.ignoreErrors,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),fontRegistry:r});this.fontLoader.bind(a).catch((i=>e.sendWithPromise("FontFallback",{id:t}))).finally((()=>{!s.fontExtraProperties&&a.data&&(a.data=null);this.commonObjs.resolve(t,a)}));break;case"FontPath":case"Image":this.commonObjs.resolve(t,n);break;default:throw new Error(`Got unknown common object type ${i}`)}}));e.on("obj",(([e,t,i,n])=>{if(this.destroyed)return;const s=this.#o.get(t);if(!s.objs.has(e))switch(i){case"Image":s.objs.resolve(e,n);const t=8e6;if(n){let e;if(n.bitmap){const{width:t,height:i}=n;e=t*i*4}else e=n.data?.length||0;e>t&&(s.cleanupAfterRender=!0)}break;case"Pattern":s.objs.resolve(e,n);break;default:throw new Error(`Got unknown object type ${i}`)}}));e.on("DocProgress",(e=>{this.destroyed||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?.(e)}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&(0,_util.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:this.annotationStorage.serializable,filename:this._fullReader?.filename??null}).finally((()=>{this.annotationStorage.resetModified()}))}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const t=e-1,i=this.#l.get(t);if(i)return i;const n=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.#o.set(t,i);return i}));this.#l.set(t,n);return n}getPageIndex(e){return"object"!=typeof e||null===e||!Number.isInteger(e.num)||e.num<0||!Number.isInteger(e.gen)||e.gen<0?Promise.reject(new Error("Invalid pageIndex request.")):this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen})}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})}getFieldObjects(){return this.#h("GetFieldObjects")}hasJSActions(){return this.#h("HasJSActions")}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(){const e="GetMetadata",t=this.#a.get(e);if(t)return t;const i=this.messageHandler.sendWithPromise(e,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})));this.#a.set(e,i);return i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const e of this.#o.values()){if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`)}this.commonObjs.clear();e||this.fontLoader.clear();this.#a.clear()}}get loadingParams(){const{disableAutoFetch:e,enableXfa:t}=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:e,enableXfa:t})}}class PDFObjects{#d=Object.create(null);#c(e){const t=this.#d[e];return t||(this.#d[e]={capability:(0,_util.createPromiseCapability)(),data:null})}get(e,t=null){if(t){const i=this.#c(e);i.capability.promise.then((()=>t(i.data)));return null}const i=this.#d[e];if(!i?.capability.settled)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return i.data}has(e){return this.#d[e]?.capability.settled||!1}resolve(e,t=null){const i=this.#c(e);i.data=t;i.capability.resolve()}clear(){for(const e in this.#d){const{data:t}=this.#d[e];t?.bitmap?.close()}this.#d=Object.create(null)}}class RenderTask{#u=null;constructor(e){this.#u=e;this.onContinue=null}get promise(){return this.#u.capability.promise}cancel(e=0){this.#u.cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=this.#u.operatorList;if(!e)return!1;const{annotationCanvasMap:t}=this.#u;return e.form||e.canvas&&t?.size>0}}exports.RenderTask=RenderTask;class InternalRenderTask{static#p=new WeakSet;constructor({callback:e,params:t,objs:i,commonObjs:n,annotationCanvasMap:s,operatorList:r,pageIndex:a,canvasFactory:o,useRequestAnimationFrame:l=!1,pdfBug:h=!1,pageColors:d=null}){this.callback=e;this.params=t;this.objs=i;this.commonObjs=n;this.annotationCanvasMap=s;this.operatorListIdx=null;this.operatorList=r;this._pageIndex=a;this.canvasFactory=o;this._pdfBug=h;this.pageColors=d;this.running=!1;this.graphicsReadyCallback=null;this.graphicsReady=!1;this._useRequestAnimationFrame=!0===l&&"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.#p.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.#p.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,background:r,backgroundColorToReplace:a}=this.params;this.gfx=new _canvas.CanvasGraphics(i,this.commonObjs,this.objs,this.canvasFactory,{optionalContentConfig:t},this.annotationCanvasMap,this.pageColors);this.gfx.beginDrawing({transform:s,viewport:n,transparency:e,background:r,backgroundColorToReplace:a});this.operatorListIdx=0;this.graphicsReady=!0;this.graphicsReadyCallback?.()}cancel(e=null,t=0){this.running=!1;this.cancelled=!0;this.gfx?.endDrawing();this._canvas&&InternalRenderTask.#p.delete(this._canvas);this.callback(e||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,"canvas",t))}operatorListChanged(){if(this.graphicsReady){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(){window.ngxZone.runOutsideAngular((()=>{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.#p.delete(this._canvas);this.callback()}}}}}const version="3.4.493";exports.version=version;const build="7b85cf0e7";exports.build=build},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PrintAnnotationStorage=t.AnnotationStorage=void 0;var n=i(1),s=i(4),r=i(8);class AnnotationStorage{#g=!1;#f=new Map;constructor(){this.onSetModified=null;this.onResetModified=null;this.onAnnotationEditor=null}getValue(e,t,i,n){let s=this.#f.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,!0)}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)}getRawValue(e){return this.#f.get(e)}remove(e){this.#f.delete(e);0===this.#f.size&&this.resetModified();if("function"==typeof this.onAnnotationEditor){for(const e of this.#f.values())if(e instanceof s.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(e,t,i,n,r=!1){const a=this.#f.get(e);let o=!1;if(void 0!==a){for(const[e,t]of Object.entries(i))if("radioValue"!==e&&"emitMessage"!==e&&a[e]!==t){o=!0;a[e]=t}}else{r||(o=!0);this.#f.set(e,i)}if(o){this.#m();if("FreeTextEditor"!==t?.constructor.name&&(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 if(i.exportValue)window.setFormValue(t,i.exportValue);else for(const e of Object.values(i))window.setFormValue(t,e)}i instanceof s.AnnotationEditor&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(i.constructor._type)}has(e){return this.#f.has(e)}getAll(){return this.#f.size>0?(0,n.objectFromMap)(this.#f):null}setAll(e){for(const[t,i]of Object.entries(e))this.setValue(t,i)}get size(){return this.#f.size}#m(){if(!this.#g){this.#g=!0;"function"==typeof this.onSetModified&&this.onSetModified()}}resetModified(){if(this.#g){this.#g=!1;"function"==typeof this.onResetModified&&this.onResetModified()}}get print(){return new PrintAnnotationStorage(this)}get serializable(){if(0===this.#f.size)return null;const e=new Map;for(const[t,i]of this.#f){const n=i instanceof s.AnnotationEditor?i.serialize():i;n&&e.set(t,n)}return e}static getHash(e){if(!e)return"";const t=new r.MurmurHash3_64;for(const[i,n]of e)t.update(`${i}:${JSON.stringify(n)}`);return t.hexdigest()}}t.AnnotationStorage=AnnotationStorage;class PrintAnnotationStorage extends AnnotationStorage{#b=null;constructor(e){super();this.#b=structuredClone(e.serializable)}get print(){(0,n.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#b}}t.PrintAnnotationStorage=PrintAnnotationStorage},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.AnnotationEditor=void 0;var n=i(5),s=i(1);class AnnotationEditor{#v=this.focusin.bind(this);#w=this.focusout.bind(this);#_=!1;#y=!1;#S=!1;_uiManager=null;#P=AnnotationEditor._zIndex++;static _colorManager=new n.ColorManager;static _zIndex=1;constructor(e){this.constructor===AnnotationEditor&&(0,s.unreachable)("Cannot initialize AnnotationEditor.");this.parent=e.parent;this.id=e.id;this.width=this.height=null;this.pageIndex=e.parent.pageIndex;this.name=e.name;this.div=null;this._uiManager=e.uiManager;const{rotation:t,rawDims:{pageWidth:i,pageHeight:n,pageX:r,pageY:a}}=this.parent.viewport;this.rotation=t;this.pageDimensions=[i,n];this.pageTranslation=[r,a];const[o,l]=this.parentDimensions;this.x=e.x/o;this.y=e.y/l;this.isAttachedToDOM=!1}static get _defaultLineColor(){return(0,s.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#P}setParent(e){if(null!==e){this.pageIndex=e.pageIndex;this.pageDimensions=e.pageDimensions}this.parent=e}focusin(e){this.#_?this.#_=!1:this.parent.setSelected(this)}focusout(e){if(!this.isAttachedToDOM)return;if(!e.relatedTarget?.closest(`#${this.id}`)){e.preventDefault();this.parent?.isMultipleSelection||this.commitOrRemove()}}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}dragstart(e){const t=this.parent.div.getBoundingClientRect();this.startX=e.clientX-t.x;this.startY=e.clientY-t.y;e.dataTransfer.setData("text/plain",this.id);e.dataTransfer.effectAllowed="move"}setAt(e,t,i,n){const[s,r]=this.parentDimensions;[i,n]=this.screenToPageTranslation(i,n);this.x=(e+i)/s;this.y=(t+n)/r;this.div.style.left=100*this.x+"%";this.div.style.top=100*this.y+"%"}translate(e,t){const[i,n]=this.parentDimensions;[e,t]=this.screenToPageTranslation(e,t);this.x+=e/i;this.y+=t/n;this.div.style.left=100*this.x+"%";this.div.style.top=100*this.y+"%"}screenToPageTranslation(e,t){switch(this.parentRotation){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return this._uiManager.viewParameters.rotation}get parentDimensions(){const{realScale:e}=this._uiManager.viewParameters,[t,i]=this.pageDimensions;return[t*e,i*e]}setDims(e,t){const[i,n]=this.parentDimensions;this.div.style.width=100*e/i+"%";this.div.style.height=100*t/n+"%"}fixDims(){const{style:e}=this.div,{height:t,width:i}=e,n=i.endsWith("%"),s=t.endsWith("%");if(n&&s)return;const[r,a]=this.parentDimensions;n||(e.width=100*parseFloat(i)/r+"%");s||(e.height=100*parseFloat(t)/a+"%")}getInitialTranslation(){return[0,0]}render(){this.div=document.createElement("div");this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360);this.div.className=this.name;this.div.setAttribute("id",this.id);this.div.setAttribute("tabIndex",0);this.setInForeground();this.div.addEventListener("focusin",this.#v);this.div.addEventListener("focusout",this.#w);const[e,t]=this.getInitialTranslation();this.translate(e,t);(0,n.bindEvents)(this,this.div,["dragstart","pointerdown"]);return this.div}pointerdown(e){const{isMac:t}=s.FeatureTest.platform;if(0!==e.button||e.ctrlKey&&t)e.preventDefault();else{e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this);this.#_=!0}}getRect(e,t){const i=this.parentScale,[n,s]=this.pageDimensions,[r,a]=this.pageTranslation,o=e/i,l=t/i,h=this.x*n,d=this.y*s,c=this.width*n,u=this.height*s;switch(this.rotation){case 0:return[h+o+r,s-d-l-u+a,h+o+c+r,s-d-l+a];case 90:return[h+l+r,s-d+o+a,h+l+u+r,s-d+o+c+a];case 180:return[h-o-c+r,s-d+l+a,h-o+r,s-d+l+u+a];case 270:return[h-l-u+r,s-d-o-c+a,h-l+r,s-d-o+a];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,t){const[i,n,s,r]=e,a=s-i,o=r-n;switch(this.rotation){case 0:return[i,t-r,a,o];case 90:return[i,t-n,o,a];case 180:return[s,t-n,a,o];case 270:return[s,t-r,o,a];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#S=!0}disableEditMode(){this.#S=!1}isInEditMode(){return this.#S}shouldGetKeyboardEvents(){return!1}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){this.div?.addEventListener("focusin",this.#v)}serialize(){(0,s.unreachable)("An editor must be serializable")}static deserialize(e,t,i){const n=new this.prototype.constructor({parent:t,id:t.getNextId(),uiManager:i});n.rotation=e.rotation;const[s,r]=n.pageDimensions,[a,o,l,h]=n.getRectInCurrentCoords(e.rect,r);n.x=a/s;n.y=o/r;n.width=l/s;n.height=h/r;return n}remove(){this.div.removeEventListener("focusin",this.#v);this.div.removeEventListener("focusout",this.#w);this.isEmpty()||this.commit();this.parent.remove(this)}select(){this.div?.classList.add("selectedEditor")}unselect(){this.div?.classList.remove("selectedEditor")}updateParams(e,t){}disableEditing(){}enableEditing(){}get propertiesToUpdate(){return{}}get contentDiv(){return this.div}get isEditing(){return this.#y}set isEditing(e){this.#y=e;if(e){this.parent.setSelected(this);this.parent.setActiveEditor(this)}else this.parent.setActiveEditor(null)}}t.AnnotationEditor=AnnotationEditor},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.KeyboardManager=t.CommandManager=t.ColorManager=t.AnnotationEditorUIManager=void 0;t.bindEvents=function bindEvents(e,t,i){for(const n of i)t.addEventListener(n,e[n].bind(e))};t.opacityToHex=function opacityToHex(e){return Math.round(Math.min(255,Math.max(1,255*e))).toString(16).padStart(2,"0")};var n=i(1),s=i(6);class IdManager{#A=0;getId(){return`${n.AnnotationEditorPrefix}${this.#A++}`}}class CommandManager{#E=[];#C=!1;#x;#T=-1;constructor(e=128){this.#x=e}add({cmd:e,undo:t,mustExec:i,type:n=NaN,overwriteIfSameType:s=!1,keepUndo:r=!1}){i&&e();if(this.#C)return;const a={cmd:e,undo:t,type:n};if(-1===this.#T){this.#E.length>0&&(this.#E.length=0);this.#T=0;this.#E.push(a);return}if(s&&this.#E[this.#T].type===n){r&&(a.undo=this.#E[this.#T].undo);this.#E[this.#T]=a;return}const o=this.#T+1;if(o===this.#x)this.#E.splice(0,1);else{this.#T=o;o<this.#E.length&&this.#E.splice(o)}this.#E.push(a)}undo(){if(-1!==this.#T){this.#C=!0;this.#E[this.#T].undo();this.#C=!1;this.#T-=1}}redo(){if(this.#T<this.#E.length-1){this.#T+=1;this.#C=!0;this.#E[this.#T].cmd();this.#C=!1}}hasSomethingToUndo(){return-1!==this.#T}hasSomethingToRedo(){return this.#T<this.#E.length-1}destroy(){this.#E=null}}t.CommandManager=CommandManager;class KeyboardManager{constructor(e){this.buffer=[];this.callbacks=new Map;this.allKeys=new Set;const{isMac:t}=n.FeatureTest.platform;for(const[i,n]of e)for(const e of i){const i=e.startsWith("mac+");if(t&&i){this.callbacks.set(e.slice(4),n);this.allKeys.add(e.split("+").at(-1))}else if(!t&&!i){this.callbacks.set(e,n);this.allKeys.add(e.split("+").at(-1))}}}#M(e){e.altKey&&this.buffer.push("alt");e.ctrlKey&&this.buffer.push("ctrl");e.metaKey&&this.buffer.push("meta");e.shiftKey&&this.buffer.push("shift");this.buffer.push(e.key);const t=this.buffer.join("+");this.buffer.length=0;return t}exec(e,t){if(!this.allKeys.has(t.key))return;const i=this.callbacks.get(this.#M(t));if(i){i.bind(e)();t.stopPropagation();t.preventDefault()}}}t.KeyboardManager=KeyboardManager;class ColorManager{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);(0,s.getColorValues)(e);return(0,n.shadow)(this,"_colors",e)}convert(e){const t=(0,s.getRGB)(e);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[e,i]of this._colors)if(i.every(((e,i)=>e===t[i])))return ColorManager._colorsMapping.get(e);return t}getHexCode(e){const t=this._colors.get(e);return t?n.Util.makeHexColor(...t):e}}t.ColorManager=ColorManager;class AnnotationEditorUIManager{#I=null;#L=new Map;#k=new Map;#D=null;#R=new CommandManager;#F=0;#O=null;#N=new Set;#B=null;#V=new IdManager;#U=!1;#W=n.AnnotationEditorType.NONE;#H=new Set;#j=this.copy.bind(this);#z=this.cut.bind(this);#G=this.paste.bind(this);#q=this.keydown.bind(this);#$=this.onEditingAction.bind(this);#X=this.onPageChanging.bind(this);#K=this.onScaleChanging.bind(this);#Y=this.onRotationChanging.bind(this);#Q={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1};#Z=null;static _keyboardManager=new KeyboardManager([[["ctrl+a","mac+meta+a"],AnnotationEditorUIManager.prototype.selectAll],[["ctrl+z","mac+meta+z"],AnnotationEditorUIManager.prototype.undo],[["ctrl+y","ctrl+shift+Z","mac+meta+shift+Z"],AnnotationEditorUIManager.prototype.redo],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete"],AnnotationEditorUIManager.prototype.delete],[["Escape","mac+Escape"],AnnotationEditorUIManager.prototype.unselectAll]]);constructor(e,t,i){this.#Z=e;this.#B=t;this.#B._on("editingaction",this.#$);this.#B._on("pagechanging",this.#X);this.#B._on("scalechanging",this.#K);this.#B._on("rotationchanging",this.#Y);this.#D=i;this.viewParameters={realScale:s.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0}}destroy(){this.#J();this.#B._off("editingaction",this.#$);this.#B._off("pagechanging",this.#X);this.#B._off("scalechanging",this.#K);this.#B._off("rotationchanging",this.#Y);for(const e of this.#k.values())e.destroy();this.#k.clear();this.#L.clear();this.#N.clear();this.#I=null;this.#H.clear();this.#R.destroy()}onPageChanging({pageNumber:e}){this.#F=e-1}focusMainContainer(){this.#Z.focus()}addShouldRescale(e){this.#N.add(e)}removeShouldRescale(e){this.#N.delete(e)}onScaleChanging({scale:e}){this.commitOrRemove();this.viewParameters.realScale=e*s.PixelsPerInch.PDF_TO_CSS_UNITS;for(const e of this.#N)e.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove();this.viewParameters.rotation=e}addToAnnotationStorage(e){e.isEmpty()||!this.#D||this.#D.has(e.id)||this.#D.setValue(e.id,null,e)}#ee(){this.#Z.addEventListener("keydown",this.#q)}#J(){this.#Z.removeEventListener("keydown",this.#q)}#te(){document.addEventListener("copy",this.#j);document.addEventListener("cut",this.#z);document.addEventListener("paste",this.#G)}#ie(){document.removeEventListener("copy",this.#j);document.removeEventListener("cut",this.#z);document.removeEventListener("paste",this.#G)}copy(e){e.preventDefault();this.#I&&this.#I.commitOrRemove();if(!this.hasSelection)return;const t=[];for(const e of this.#H)e.isEmpty()||t.push(e.serialize());0!==t.length&&e.clipboardData.setData("application/pdfjs",JSON.stringify(t))}cut(e){this.copy(e);this.delete()}paste(e){e.preventDefault();let t=e.clipboardData.getData("application/pdfjs");if(!t)return;try{t=JSON.parse(t)}catch(e){(0,n.warn)(`paste: "${e.message}".`);return}if(!Array.isArray(t))return;this.unselectAll();const i=this.#k.get(this.#F);try{const e=[];for(const n of t){const t=i.deserialize(n);if(!t)return;e.push(t)}const cmd=()=>{for(const t of e)this.#ne(t);this.#se(e)},undo=()=>{for(const t of e)t.remove()};this.addCommands({cmd:cmd,undo:undo,mustExec:!0})}catch(e){(0,n.warn)(`paste: "${e.message}".`)}}keydown(e){this.getActive()?.shouldGetKeyboardEvents()||AnnotationEditorUIManager._keyboardManager.exec(this,e)}onEditingAction(e){["undo","redo","delete","selectAll"].includes(e.name)&&this[e.name]()}#re(e){Object.entries(e).some((([e,t])=>this.#Q[e]!==t))&&this.#B.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#Q,e)})}#ae(e){this.#B.dispatch("annotationeditorparamschanged",{source:this,details:e})}setEditingState(e){if(e){this.#ee();this.#te();this.#re({isEditing:this.#W!==n.AnnotationEditorType.NONE,isEmpty:this.#oe(),hasSomethingToUndo:this.#R.hasSomethingToUndo(),hasSomethingToRedo:this.#R.hasSomethingToRedo(),hasSelectedEditor:!1})}else{this.#J();this.#ie();this.#re({isEditing:!1})}}registerEditorTypes(e){if(!this.#O){this.#O=e;for(const e of this.#O)this.#ae(e.defaultPropertiesToUpdate)}}getId(){return this.#V.getId()}get currentLayer(){return this.#k.get(this.#F)}get currentPageIndex(){return this.#F}addLayer(e){this.#k.set(e.pageIndex,e);this.#U?e.enable():e.disable()}removeLayer(e){this.#k.delete(e.pageIndex)}updateMode(e){this.#W=e;if(e===n.AnnotationEditorType.NONE){this.setEditingState(!1);this.#le()}else{this.setEditingState(!0);this.#he();for(const t of this.#k.values())t.updateMode(e)}}updateToolbar(e){e!==this.#W&&this.#B.dispatch("switchannotationeditormode",{source:this,mode:e})}updateParams(e,t){if(this.#O){for(const i of this.#H)i.updateParams(e,t);for(const i of this.#O)i.updateDefaultParams(e,t)}}#he(){if(!this.#U){this.#U=!0;for(const e of this.#k.values())e.enable()}}#le(){this.unselectAll();if(this.#U){this.#U=!1;for(const e of this.#k.values())e.disable()}}getEditors(e){const t=[];for(const i of this.#L.values())i.pageIndex===e&&t.push(i);return t}getEditor(e){return this.#L.get(e)}addEditor(e){this.#L.set(e.id,e)}removeEditor(e){this.#L.delete(e.id);this.unselect(e);this.#D?.remove(e.id)}#ne(e){const t=this.#k.get(e.pageIndex);t?t.addOrRebuild(e):this.addEditor(e)}setActiveEditor(e){if(this.#I!==e){this.#I=e;e&&this.#ae(e.propertiesToUpdate)}}toggleSelected(e){if(this.#H.has(e)){this.#H.delete(e);e.unselect();this.#re({hasSelectedEditor:this.hasSelection})}else{this.#H.add(e);e.select();this.#ae(e.propertiesToUpdate);this.#re({hasSelectedEditor:!0})}}setSelected(e){for(const t of this.#H)t!==e&&t.unselect();this.#H.clear();this.#H.add(e);e.select();this.#ae(e.propertiesToUpdate);this.#re({hasSelectedEditor:!0})}isSelected(e){return this.#H.has(e)}unselect(e){e.unselect();this.#H.delete(e);this.#re({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#H.size}undo(){this.#R.undo();this.#re({hasSomethingToUndo:this.#R.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#oe()})}redo(){this.#R.redo();this.#re({hasSomethingToUndo:!0,hasSomethingToRedo:this.#R.hasSomethingToRedo(),isEmpty:this.#oe()})}addCommands(e){this.#R.add(e);this.#re({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#oe()})}#oe(){if(0===this.#L.size)return!0;if(1===this.#L.size)for(const e of this.#L.values())return e.isEmpty();return!1}delete(){this.commitOrRemove();if(!this.hasSelection)return;const e=[...this.#H];this.addCommands({cmd:()=>{for(const t of e)t.remove()},undo:()=>{for(const t of e)this.#ne(t)},mustExec:!0})}commitOrRemove(){this.#I?.commitOrRemove()}#se(e){this.#H.clear();for(const t of e)if(!t.isEmpty()){this.#H.add(t);t.select()}this.#re({hasSelectedEditor:!0})}selectAll(){for(const e of this.#H)e.commit();this.#se(this.#L.values())}unselectAll(){if(this.#I)this.#I.commitOrRemove();else if(0!==this.#H.size){for(const e of this.#H)e.unselect();this.#H.clear();this.#re({hasSelectedEditor:!1})}}isActive(e){return this.#I===e}getActive(){return this.#I}getMode(){return this.#W}}t.AnnotationEditorUIManager=AnnotationEditorUIManager},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.StatTimer=t.RenderingCancelledException=t.PixelsPerInch=t.PageViewport=t.PDFDateString=t.DOMStandardFontDataFactory=t.DOMSVGFactory=t.DOMCanvasFactory=t.DOMCMapReaderFactory=t.AnnotationPrefix=void 0;t.deprecated=function deprecated(e){Window.ngxConsole.log("Deprecated API usage: "+e)};t.getColorValues=function getColorValues(e){const t=document.createElement("span");t.style.visibility="hidden";document.body.append(t);for(const i of e.keys()){t.style.color=i;const n=window.getComputedStyle(t).color;e.set(i,getRGB(n))}t.remove()};t.getCurrentTransform=function getCurrentTransform(e){const{a:t,b:i,c:n,d:s,e:r,f:a}=e.getTransform();return[t,i,n,s,r,a]};t.getCurrentTransformInverse=function getCurrentTransformInverse(e){const{a:t,b:i,c:n,d:s,e:r,f:a}=e.getTransform().invertSelf();return[t,i,n,s,r,a]};t.getFilenameFromUrl=function getFilenameFromUrl(e,t=!1){t||([e]=e.split(/[#?]/,1));return e.substring(e.lastIndexOf("/")+1)};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,s.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.');return t}const i=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,n=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(e);let r=i.exec(n[1])||i.exec(n[2])||i.exec(n[3]);if(r){r=r[0];if(r.includes("%"))try{r=i.exec(decodeURIComponent(r))[0]}catch(e){}}return r||t};t.getRGB=getRGB;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");let r=e;"Function"===e.constructor.name&&(r=e());const a=function generateTrustedURL(e){if(window.trustedTypes){return window.trustedTypes.createPolicy("foo",{createScriptURL:e=>e}).createScriptURL(e)}return e}(r);s.src=a;s.onload=function(e){t&&s.remove();i(e)};s.onerror=function(e){Window.ngxConsole.log(e);n(new Error(`Cannot load script at: ${s.src}`))};(document.head||document.documentElement).append(s)}))};t.setLayerDimensions=function setLayerDimensions(e,t,i=!1,n=!0){if(t instanceof PageViewport){const{pageWidth:n,pageHeight:s}=t.rawDims,{style:r}=e,a=`calc(var(--scale-factor) * ${n}px)`,o=`calc(var(--scale-factor) * ${s}px)`;if(i&&t.rotation%180!=0){r.width=o;r.height=a}else{r.width=a;r.height=o}}n&&e.setAttribute("data-main-rotation",t.rotation)};var n=i(7),s=i(1);t.AnnotationPrefix="pdfjs_internal_id_";class PixelsPerInch{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}t.PixelsPerInch=PixelsPerInch;class DOMCanvasFactory extends n.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,s.stringToBytes)(await i.text())}return new Promise(((i,n)=>{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,s.stringToBytes)(r.responseText));if(e){i(e);return}}n(new Error(r.statusText))}};r.send(null)}))}class DOMCMapReaderFactory extends n.BaseCMapReaderFactory{_fetchData(e,t){return fetchData(e,this.isCompressed).then((e=>({cMapData:e,compressionType:t})))}}t.DOMCMapReaderFactory=DOMCMapReaderFactory;class DOMStandardFontDataFactory extends n.BaseStandardFontDataFactory{_fetchData(e){return fetchData(e,!0)}}t.DOMStandardFontDataFactory=DOMStandardFontDataFactory;class DOMSVGFactory extends n.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,d,c,u,p,g,f;(i%=360)<0&&(i+=360);switch(i){case 180:l=-1;h=0;d=0;c=1;break;case 90:l=0;h=1;d=1;c=0;break;case 270:l=0;h=-1;d=-1;c=0;break;case 0:l=1;h=0;d=0;c=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}if(r){d=-d;c=-c}if(0===l){u=Math.abs(o-e[1])*t+n;p=Math.abs(a-e[0])*t+s;g=(e[3]-e[1])*t;f=(e[2]-e[0])*t}else{u=Math.abs(a-e[0])*t+n;p=Math.abs(o-e[1])*t+s;g=(e[2]-e[0])*t;f=(e[3]-e[1])*t}this.transform=[l*t,h*t,d*t,c*t,u-l*t*a-d*t*o,p-h*t*a-c*t*o];this.width=g;this.height=f}get rawDims(){const{viewBox:e}=this;return(0,s.shadow)(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}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 s.Util.applyTransform([e,t],this.transform)}convertToViewportRectangle(e){const t=s.Util.applyTransform([e[0],e[1]],this.transform),i=s.Util.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],i[0],i[1]]}convertToPdfPoint(e,t){return s.Util.applyInverseTransform([e,t],this.transform)}}t.PageViewport=PageViewport;class RenderingCancelledException extends s.BaseException{constructor(e,t,i=0){super(e,"RenderingCancelledException");this.type=t;this.extraDelay=i}}t.RenderingCancelledException=RenderingCancelledException;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{started=Object.create(null);times=[];time(e){e in this.started&&(0,s.warn)(`Timer is already running for ${e}`);this.started[e]=Date.now()}timeEnd(e){e in this.started||(0,s.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{name:e}of this.times)t=Math.max(e.length,t);for(const{name:i,start:n,end:s}of this.times)e.push(`${i.padEnd(t)} ${s-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 r;t.PDFDateString=class PDFDateString{static toDateObject(e){if(!e||"string"!=typeof e)return null;r||(r=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const t=r.exec(e);if(!t)return null;const i=parseInt(t[1],10);let n=parseInt(t[2],10);n=n>=1&&n<=12?n-1:0;let s=parseInt(t[3],10);s=s>=1&&s<=31?s:1;let a=parseInt(t[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(t[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(t[6],10);l=l>=0&&l<=59?l:0;const h=t[7]||"Z";let d=parseInt(t[8],10);d=d>=0&&d<=23?d:0;let c=parseInt(t[9],10)||0;c=c>=0&&c<=59?c:0;if("-"===h){a+=d;o+=c}else if("+"===h){a-=d;o-=c}return new Date(Date.UTC(i,n,s,a,o,l))}};function getRGB(e){if(e.startsWith("#")){const t=parseInt(e.slice(1),16);return[(16711680&t)>>16,(65280&t)>>8,255&t]}if(e.startsWith("rgb("))return e.slice(4,-1).split(",").map((e=>parseInt(e)));if(e.startsWith("rgba("))return e.slice(5,-1).split(",").map((e=>parseInt(e))).slice(0,3);(0,s.warn)(`Not a valid color format: "${e}"`);return[0,0,0]}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.BaseStandardFontDataFactory=t.BaseSVGFactory=t.BaseCanvasFactory=t.BaseCMapReaderFactory=void 0;var n=i(1);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),n=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0}:void 0,s=i.getContext("2d",n);return{canvas:i,context:s}}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=!0}){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,i=!1){if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");const n=this._createSVG("svg:svg");n.setAttribute("version","1.1");if(!i){n.setAttribute("width",`${e}px`);n.setAttribute("height",`${t}px`)}n.setAttribute("preserveAspectRatio","none");n.setAttribute("viewBox",`0 0 ${e} ${t}`);return n}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},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.MurmurHash3_64=void 0;var n=i(1);const s=3285377520,r=4294901760,a=65535;t.MurmurHash3_64=class MurmurHash3_64{constructor(e){this.h1=e?4294967295&e:s;this.h2=e?4294967295&e:s}update(e){let t,i;if("string"==typeof e){t=new Uint8Array(2*e.length);i=0;for(let n=0,s=e.length;n<s;n++){const s=e.charCodeAt(n);if(s<=255)t[i++]=s;else{t[i++]=s>>>8;t[i++]=255&s}}}else{if(!(0,n.isArrayBuffer)(e))throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");t=e.slice();i=t.byteLength}const s=i>>2,o=i-4*s,l=new Uint32Array(t.buffer,0,s);let h=0,d=0,c=this.h1,u=this.h2;const p=3432918353,g=461845907,f=11601,m=13715;for(let e=0;e<s;e++)if(1&e){h=l[e];h=h*p&r|h*f&a;h=h<<15|h>>>17;h=h*g&r|h*m&a;c^=h;c=c<<13|c>>>19;c=5*c+3864292196}else{d=l[e];d=d*p&r|d*f&a;d=d<<15|d>>>17;d=d*g&r|d*m&a;u^=d;u=u<<13|u>>>19;u=5*u+3864292196}h=0;switch(o){case 3:h^=t[4*s+2]<<16;case 2:h^=t[4*s+1]<<8;case 1:h^=t[4*s];h=h*p&r|h*f&a;h=h<<15|h>>>17;h=h*g&r|h*m&a;1&s?c^=h:u^=h}this.h1=c;this.h2=u}hexdigest(){let e=this.h1,t=this.h2;e^=t>>>1;e=3981806797*e&r|36045*e&a;t=4283543511*t&r|(2950163797*(t<<16|e>>>16)&r)>>>16;e^=t>>>1;e=444984403*e&r|60499*e&a;t=3301882366*t&r|(3120437893*(t<<16|e>>>16)&r)>>>16;e^=t>>>1;return(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.FontLoader=t.FontFaceObject=void 0;var n=i(1),s=i(10);t.FontLoader=class FontLoader{constructor({onUnsupportedFeature:e,ownerDocument:t=globalThis.document,styleElement:i=null}){this._onUnsupportedFeature=e;this._document=t;this.nativeFontFaces=[];this.styleElement=null;this.loadingRequests=[];this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.push(e);this._document.fonts.add(e)}insertRule(e){if(!this.styleElement){this.styleElement=this._document.createElement("style");this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement)}const t=this.styleElement.sheet;t.insertRule(e,t.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((t=>{const i=this._queueLoadingCallback(t);this._prepareFontLoadEvent(e,i)}))}}get isFontLoadingAPISupported(){const e=!!this._document?.fonts;return(0,n.shadow)(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){let e=!1;(s.isNodeJS||"undefined"!=typeof navigator&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(e=!0);return(0,n.shadow)(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(e){const{loadingRequests:t}=this,i={done:!1,complete:function completeRequest(){(0,n.assert)(!i.done,"completeRequest() cannot be called twice.");i.done=!0;for(;t.length>0&&t[0].done;){const e=t.shift();setTimeout(e.callback,0)}},callback:e};t.push(i);return i}get _loadTestFont(){const e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return(0,n.shadow)(this,"_loadTestFont",e)}_prepareFontLoadEvent(e,t){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 i,s;const r=this._document.createElement("canvas");r.width=1;r.height=1;const a=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0}:void 0,o=r.getContext("2d",a);let l=0;const h=`lt${Date.now()}${this.loadTestFontId++}`;let d=this._loadTestFont;d=spliceString(d,976,h.length,h);const c=1482184792;let u=int32(d,16);for(i=0,s=h.length-3;i<s;i+=4)u=u-c+int32(h,i)|0;i<h.length&&(u=u-c+int32(h+"XXX",i)|0);d=spliceString(d,16,4,(0,n.string32)(u));const p=`@font-face {font-family:"${h}";src:${`url(data:font/opentype;base64,${btoa(d)});`}}`;this.insertRule(p);const g=this._document.createElement("div");g.style.visibility="hidden";g.style.width=g.style.height="10px";g.style.position="absolute";g.style.top=g.style.left="0px";for(const t of[e.loadedName,h]){const e=this._document.createElement("span");e.textContent="Hi";e.style.fontFamily=t;g.append(e)}this._document.body.append(g);!function isFontReady(e,t){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,(()=>{g.remove();t.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?.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?.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.FeatureTest.isEvalSupported){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)=>{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.CanvasGraphics=void 0;var n=i(1),s=i(6),r=i(12),a=i(13);const o=4096,l=1e3,h=16;class CachedCanvases{constructor(e){this.canvasFactory=e;this.cache=Object.create(null)}getCanvas(e,t,i){let n;if(void 0!==this.cache[e]){n=this.cache[e];this.canvasFactory.reset(n,t,i)}else{n=this.canvasFactory.create(t,i);this.cache[e]=n}return n}delete(e){delete this.cache[e]}clear(){for(const e in this.cache){const t=this.cache[e];this.canvasFactory.destroy(t);delete this.cache[e]}}}function drawImageAtIntegerCoords(e,t,i,n,r,a,o,l,h,d){const[c,u,p,g,f,m]=(0,s.getCurrentTransform)(e);if(0===u&&0===p){const s=o*c+f,b=Math.round(s),v=l*g+m,w=Math.round(v),_=(o+h)*c+f,y=Math.abs(Math.round(_)-b)||1,S=(l+d)*g+m,P=Math.abs(Math.round(S)-w)||1;e.setTransform(Math.sign(c),0,0,Math.sign(g),b,w);e.drawImage(t,i,n,r,a,0,0,y,P);e.setTransform(c,u,p,g,f,m);return[y,P]}if(0===c&&0===g){const s=l*p+f,b=Math.round(s),v=o*u+m,w=Math.round(v),_=(l+d)*p+f,y=Math.abs(Math.round(_)-b)||1,S=(o+h)*u+m,P=Math.abs(Math.round(S)-w)||1;e.setTransform(0,Math.sign(u),Math.sign(p),0,b,w);e.drawImage(t,i,n,r,a,0,0,P,y);e.setTransform(c,u,p,g,f,m);return[P,y]}e.drawImage(t,i,n,r,a,o,l,h,d);return[Math.hypot(c,u)*h,Math.hypot(p,g)*d]}class CanvasExtraState{constructor(e,t){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.transferMaps=null;this.startNewPathAndClipBox([0,0,e,t])}clone(){const e=Object.create(this);e.clipBox=this.clipBox.slice();return e}setCurrentPoint(e,t){this.x=e;this.y=t}updatePathMinMax(e,t,i){[t,i]=n.Util.applyTransform([t,i],e);this.minX=Math.min(this.minX,t);this.minY=Math.min(this.minY,i);this.maxX=Math.max(this.maxX,t);this.maxY=Math.max(this.maxY,i)}updateRectMinMax(e,t){const i=n.Util.applyTransform(t,e),s=n.Util.applyTransform(t.slice(2),e);this.minX=Math.min(this.minX,i[0],s[0]);this.minY=Math.min(this.minY,i[1],s[1]);this.maxX=Math.max(this.maxX,i[0],s[0]);this.maxY=Math.max(this.maxY,i[1],s[1])}updateScalingPathMinMax(e,t){n.Util.scaleMinMax(e,t);this.minX=Math.min(this.minX,t[0]);this.maxX=Math.max(this.maxX,t[1]);this.minY=Math.min(this.minY,t[2]);this.maxY=Math.max(this.maxY,t[3])}updateCurvePathMinMax(e,t,i,s,r,a,o,l,h,d){const c=n.Util.bezierBoundingBox(t,i,s,r,a,o,l,h);if(d){d[0]=Math.min(d[0],c[0],c[2]);d[1]=Math.max(d[1],c[0],c[2]);d[2]=Math.min(d[2],c[1],c[3]);d[3]=Math.max(d[3],c[1],c[3])}else this.updateRectMinMax(e,c)}getPathBoundingBox(e=r.PathType.FILL,t=null){const i=[this.minX,this.minY,this.maxX,this.maxY];if(e===r.PathType.STROKE){t||(0,n.unreachable)("Stroke bounding box must include transform.");const e=n.Util.singularValueDecompose2dScale(t),s=e[0]*this.lineWidth/2,r=e[1]*this.lineWidth/2;i[0]-=s;i[1]-=r;i[2]+=s;i[3]+=r}return i}updateClipFromPath(){const e=n.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(e){this.clipBox=e;this.minX=1/0;this.minY=1/0;this.maxX=0;this.maxY=0}getClippedPathBoundingBox(e=r.PathType.FILL,t=null){return n.Util.intersect(this.clipBox,this.getPathBoundingBox(e,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%h,o=(s-a)/h,l=0===a?o:o+1,d=e.createImageData(r,h);let c,u=0;const p=t.data,g=d.data;let f,m,b,v,w,_,y,S;if(i)switch(i.length){case 1:w=i[0];_=i[0];y=i[0];S=i[0];break;case 4:w=i[0];_=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,v=r+7>>3;let w=4294967295,_=n.FeatureTest.isLittleEndian?4278190080:255;S&&255===S[0]&&0===S[255]&&([w,_]=[_,w]);for(f=0;f<l;f++){b=f<o?h:a;c=0;for(m=0;m<b;m++){const e=t-u;let n=0;const s=e>v?r:8*e-7,a=-8&s;let o=0,l=0;for(;n<a;n+=8){l=p[u++];i[c++]=128&l?w:_;i[c++]=64&l?w:_;i[c++]=32&l?w:_;i[c++]=16&l?w:_;i[c++]=8&l?w:_;i[c++]=4&l?w:_;i[c++]=2&l?w:_;i[c++]=1&l?w:_}for(;n<s;n++){if(0===o){l=p[u++];o=128}i[c++]=l&o?w:_;o>>=1}}for(;c<s;)i[c++]=0;e.putImageData(d,0,f*h)}}else if(t.kind===n.ImageKind.RGBA_32BPP){const t=!!(w||_||y);m=0;v=r*h*4;for(f=0;f<o;f++){g.set(p.subarray(u,u+v));u+=v;if(t)for(let e=0;e<v;e+=4){w&&(g[e+0]=w[g[e+0]]);_&&(g[e+1]=_[g[e+1]]);y&&(g[e+2]=y[g[e+2]])}e.putImageData(d,0,m);m+=h}if(f<l){v=r*a*4;g.set(p.subarray(u,u+v));if(t)for(let e=0;e<v;e+=4){w&&(g[e+0]=w[g[e+0]]);_&&(g[e+1]=_[g[e+1]]);y&&(g[e+2]=y[g[e+2]])}e.putImageData(d,0,m)}}else{if(t.kind!==n.ImageKind.RGB_24BPP)throw new Error(`bad image kind: ${t.kind}`);{const t=!!(w||_||y);b=h;v=r*b;for(f=0;f<l;f++){if(f>=o){b=a;v=r*b}c=0;for(m=v;m--;){g[c++]=p[u++];g[c++]=p[u++];g[c++]=p[u++];g[c++]=255}if(t)for(let e=0;e<c;e+=4){w&&(g[e+0]=w[g[e+0]]);_&&(g[e+1]=_[g[e+1]]);y&&(g[e+2]=y[g[e+2]])}e.putImageData(d,0,f*h)}}}}function putBinaryImageMask(e,t){if(t.bitmap){e.drawImage(t.bitmap,0,0);return}const i=t.height,n=t.width,s=i%h,r=(i-s)/h,o=0===s?r:r+1,l=e.createImageData(n,h);let d=0;const c=t.data,u=l.data;for(let t=0;t<o;t++){const i=t<r?h:s;({srcPos:d}=(0,a.applyMaskImageData)({src:c,srcPos:d,dest:u,width:n,height:i}));e.putImageData(l,0,t*h)}}function copyCtxState(e,t){const i=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font"];for(const n of i)void 0!==e[n]&&(t[n]=e[n]);if(void 0!==e.setLineDash){t.setLineDash(e.getLineDash());t.lineDashOffset=e.lineDashOffset}}function resetCtxToDefault(e,t){e.strokeStyle=e.fillStyle=t||"#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,n){const s=n[0],r=n[1],a=n[2]-s,o=n[3]-r;if(0!==a&&0!==o){!function genericComposeSMask(e,t,i,n,s,r,a,o,l,h,d){const c=!!r,u=c?r[0]:0,p=c?r[1]:0,g=c?r[2]:0;let f;f="Luminosity"===s?composeSMaskLuminosity:composeSMaskAlpha;const m=Math.min(n,Math.ceil(1048576/i));for(let s=0;s<n;s+=m){const r=Math.min(m,n-s),b=e.getImageData(o-h,s+(l-d),i,r),v=t.getImageData(o,s+l,i,r);c&&composeSMaskBackdrop(b.data,u,p,g);f(b.data,v.data,a);t.putImageData(v,o,s+l)}}(t.context,i,a,o,t.subtype,t.backdrop,t.transferMap,s,r,t.offsetX,t.offsetY);e.save();e.globalAlpha=1;e.globalCompositeOperation="source-over";e.setTransform(1,0,0,1,0,0);e.drawImage(i.canvas,0,0);e.restore()}}function getImageSmoothingEnabled(e,t){const i=n.Util.singularValueDecompose2dScale(e);i[0]=Math.fround(i[0]);i[1]=Math.fround(i[1]);const r=Math.fround((globalThis.devicePixelRatio||1)*s.PixelsPerInch.PDF_TO_CSS_UNITS);return void 0!==t?t:i[0]<=r||i[1]<=r}const d=["butt","round","square"],c=["miter","round","bevel"],u={},p={};class CanvasGraphics{constructor(e,t,i,n,{optionalContentConfig:s,markedContentStack:r=null},a,o){this.ctx=e;this.current=new CanvasExtraState(this.ctx.canvas.width,this.ctx.canvas.height);this.stateStack=[];this.pendingClip=null;this.pendingEOFill=!1;this.res=null;this.xobjs=null;this.commonObjs=t;this.objs=i;this.canvasFactory=n;this.groupStack=[];this.processingType3=null;this.baseTransform=null;this.baseTransformStack=[];this.groupLevel=0;this.smaskStack=[];this.smaskCounter=0;this.tempSMask=null;this.suspendedCtx=null;this.contentVisible=!0;this.markedContentStack=r||[];this.optionalContentConfig=s;this.cachedCanvases=new CachedCanvases(this.canvasFactory);this.cachedPatterns=new Map;this.annotationCanvasMap=a;this.viewportScale=1;this.outputScaleX=1;this.outputScaleY=1;this.backgroundColor=o?.background||null;this.foregroundColor=o?.foreground||null;this._cachedScaleForStroking=null;this._cachedGetSinglePixelWidth=null;this._cachedBitmapsMap=new Map}getObject(e,t=null){return"string"==typeof e?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}beginDrawing({transform:e,viewport:t,transparency:i=!1,background:n=null,backgroundColorToReplace:r=null}){const a=this.ctx.canvas.width,o=this.ctx.canvas.height,l=n||"#ffffff";this.ctx.save();if("function"==typeof n)n({context:this.ctx,width:a,height:o});else if(this.foregroundColor&&this.backgroundColor){this.ctx.fillStyle=this.foregroundColor;const e=this.foregroundColor=this.ctx.fillStyle;this.ctx.fillStyle=this.backgroundColor;const t=this.backgroundColor=this.ctx.fillStyle;let i=!0,n=l;this.ctx.fillStyle=l;n=this.ctx.fillStyle;i="string"==typeof n&&/^#[0-9A-Fa-f]{6}$/.test(n);if("#000000"===e&&"#ffffff"===t||e===t||!i)this.foregroundColor=this.backgroundColor=null;else{const[i,r,a]=(0,s.getRGB)(n),newComp=e=>(e/=255)<=.03928?e/12.92:((e+.055)/1.055)**2.4,o=Math.round(.2126*newComp(i)+.7152*newComp(r)+.0722*newComp(a));this.selectColor=(i,n,s)=>{const r=.2126*newComp(i)+.7152*newComp(n)+.0722*newComp(s);return Math.round(r)===o?t:e}}}else{n&&(this.background=n);this.backgroundColor=n}if("function"!=typeof n){this.ctx.fillStyle=this.backgroundColor||l;this.ctx.fillRect(0,0,a,o)}this.ctx.restore();this.backgroundColorToReplace=r;if(i){const e=this.cachedCanvases.getCanvas("transparent",a,o);this.compositeCtx=this.ctx;this.transparentCanvas=e.canvas;this.ctx=e.context;this.ctx.save();this.ctx.transform(...(0,s.getCurrentTransform)(this.compositeCtx))}this.ctx.save();resetCtxToDefault(this.ctx,this.foregroundColor);if(e){this.ctx.transform(...e);this.outputScaleX=e[0];this.outputScaleY=e[0]}this.ctx.transform(...t.transform);this.viewportScale=t.scale;this.baseTransform=(0,s.getCurrentTransform)(this.ctx)}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,d=h?Date.now()+15:0;let c=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&&++c>10){if(Date.now()>d){i();return o}c=0}}}#de(){for(;this.stateStack.length||this.inSMaskMode;)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}}endDrawing(){this.#de();this.cachedCanvases.clear();this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const t of e.values())"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear()}_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,d="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(d,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;d="prescale1"===d?"prescale2":"prescale1"}return{img:e,paintWidth:l,paintHeight:h}}_createMaskCanvas(e){const t=this.ctx,{width:i,height:a}=e,o=this.current.fillColor,l=this.current.patternFill,h=(0,s.getCurrentTransform)(t);let d,c,u,p;if((e.bitmap||e.data)&&e.count>1){const t=e.bitmap||e.data.buffer;c=JSON.stringify(l?h:[h.slice(0,4),o]);d=this._cachedBitmapsMap.get(t);if(!d){d=new Map;this._cachedBitmapsMap.set(t,d)}const i=d.get(c);if(i&&!l){return{canvas:i,offsetX:Math.round(Math.min(h[0],h[2])+h[4]),offsetY:Math.round(Math.min(h[1],h[3])+h[5])}}u=i}if(!u){p=this.cachedCanvases.getCanvas("maskCanvas",i,a);putBinaryImageMask(p.context,e)}let g=n.Util.transform(h,[1/i,0,0,-1/a,0,0]);g=n.Util.transform(g,[1,0,0,1,0,-a]);const f=n.Util.applyTransform([0,0],g),m=n.Util.applyTransform([i,a],g),b=n.Util.normalizeRect([f[0],f[1],m[0],m[1]]),v=Math.round(b[2]-b[0])||1,w=Math.round(b[3]-b[1])||1,_=this.cachedCanvases.getCanvas("fillCanvas",v,w),y=_.context,S=Math.min(f[0],m[0]),P=Math.min(f[1],m[1]);y.translate(-S,-P);y.transform(...g);if(!u){u=this._scaleImage(p.canvas,(0,s.getCurrentTransformInverse)(y));u=u.img;d&&l&&d.set(c,u)}y.imageSmoothingEnabled=getImageSmoothingEnabled((0,s.getCurrentTransform)(y),e.interpolate);drawImageAtIntegerCoords(y,u,0,0,u.width,u.height,0,0,i,a);y.globalCompositeOperation="source-in";const A=n.Util.transform((0,s.getCurrentTransformInverse)(y),[1,0,0,1,-S,-P]);y.fillStyle=l?o.getPattern(t,this,A,r.PathType.FILL):o;y.fillRect(0,0,i,a);if(d&&!l){this.cachedCanvases.delete("fillCanvas");d.set(c,_.canvas)}return{canvas:_.canvas,offsetX:Math.round(S),offsetY:Math.round(P)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking=null);this.current.lineWidth=e;this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=d[e]}setLineJoin(e){this.ctx.lineJoin=c[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(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[0],i[1]);break;case"CA":this.current.strokeAlpha=i;break;case"ca":this.current.fillAlpha=i;this.ctx.globalAlpha=i;break;case"BM":this.ctx.globalCompositeOperation=i;break;case"SMask":this.current.activeSMask=i?this.tempSMask:null;this.tempSMask=null;this.checkSMaskState();break;case"TR":this.current.transferMaps=i}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,t=this.ctx.canvas.height,i="smaskGroupAt"+this.groupLevel,n=this.cachedCanvases.getCanvas(i,e,t);this.suspendedCtx=this.ctx;this.ctx=n.context;const r=this.ctx;r.setTransform(...(0,s.getCurrentTransform)(this.suspendedCtx));copyCtxState(this.suspendedCtx,r);!function mirrorContextOperations(e,t){if(e._removeMirroring)throw new Error("Context is already forwarding operations.");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.__originalClip=e.clip;e.__originalMoveTo=e.moveTo;e.__originalLineTo=e.lineTo;e.__originalBezierCurveTo=e.bezierCurveTo;e.__originalRect=e.rect;e.__originalClosePath=e.closePath;e.__originalBeginPath=e.beginPath;e._removeMirroring=()=>{e.save=e.__originalSave;e.restore=e.__originalRestore;e.rotate=e.__originalRotate;e.scale=e.__originalScale;e.translate=e.__originalTranslate;e.transform=e.__originalTransform;e.setTransform=e.__originalSetTransform;e.resetTransform=e.__originalResetTransform;e.clip=e.__originalClip;e.moveTo=e.__originalMoveTo;e.lineTo=e.__originalLineTo;e.bezierCurveTo=e.__originalBezierCurveTo;e.rect=e.__originalRect;e.closePath=e.__originalClosePath;e.beginPath=e.__originalBeginPath;delete e._removeMirroring};e.save=function ctxSave(){t.save();this.__originalSave()};e.restore=function ctxRestore(){t.restore();this.__originalRestore()};e.translate=function ctxTranslate(e,i){t.translate(e,i);this.__originalTranslate(e,i)};e.scale=function ctxScale(e,i){t.scale(e,i);this.__originalScale(e,i)};e.transform=function ctxTransform(e,i,n,s,r,a){t.transform(e,i,n,s,r,a);this.__originalTransform(e,i,n,s,r,a)};e.setTransform=function ctxSetTransform(e,i,n,s,r,a){t.setTransform(e,i,n,s,r,a);this.__originalSetTransform(e,i,n,s,r,a)};e.resetTransform=function ctxResetTransform(){t.resetTransform();this.__originalResetTransform()};e.rotate=function ctxRotate(e){t.rotate(e);this.__originalRotate(e)};e.clip=function ctxRotate(e){t.clip(e);this.__originalClip(e)};e.moveTo=function(e,i){t.moveTo(e,i);this.__originalMoveTo(e,i)};e.lineTo=function(e,i){t.lineTo(e,i);this.__originalLineTo(e,i)};e.bezierCurveTo=function(e,i,n,s,r,a){t.bezierCurveTo(e,i,n,s,r,a);this.__originalBezierCurveTo(e,i,n,s,r,a)};e.rect=function(e,i,n,s){t.rect(e,i,n,s);this.__originalRect(e,i,n,s)};e.closePath=function(){t.closePath();this.__originalClosePath()};e.beginPath=function(){t.beginPath();this.__originalBeginPath()}}(r,this.suspendedCtx);this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring();copyCtxState(this.ctx,this.suspendedCtx);this.ctx=this.suspendedCtx;this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;if(e){e[0]=Math.floor(e[0]);e[1]=Math.floor(e[1]);e[2]=Math.ceil(e[2]);e[3]=Math.ceil(e[3])}else e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const t=this.current.activeSMask;composeSMask(this.suspendedCtx,t,this.ctx,e);this.ctx.save();this.ctx.setTransform(1,0,0,1,0,0);this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height);this.ctx.restore()}save(){if(this.inSMaskMode){copyCtxState(this.ctx,this.suspendedCtx);this.suspendedCtx.save()}else this.ctx.save();const e=this.current;this.stateStack.push(e);this.current=e.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode();if(0!==this.stateStack.length){this.current=this.stateStack.pop();if(this.inSMaskMode){this.suspendedCtx.restore();copyCtxState(this.suspendedCtx,this.ctx)}else this.ctx.restore();this.checkSMaskState();this.pendingClip=null;this._cachedScaleForStroking=null;this._cachedGetSinglePixelWidth=null}}transform(e,t,i,n,s,r){this.ctx.transform(e,t,i,n,s,r);this._cachedScaleForStroking=null;this._cachedGetSinglePixelWidth=null}constructPath(e,t,i){const r=this.ctx,a=this.current;let o,l,h=a.x,d=a.y;const c=(0,s.getCurrentTransform)(r),u=0===c[0]&&0===c[3]||0===c[1]&&0===c[2],p=u?i.slice(0):null;for(let i=0,s=0,g=e.length;i<g;i++)switch(0|e[i]){case n.OPS.rectangle:h=t[s++];d=t[s++];const e=t[s++],i=t[s++],g=h+e,f=d+i;r.moveTo(h,d);if(0===e||0===i)r.lineTo(g,f);else{r.lineTo(g,d);r.lineTo(g,f);r.lineTo(h,f)}u||a.updateRectMinMax(c,[h,d,g,f]);r.closePath();break;case n.OPS.moveTo:h=t[s++];d=t[s++];r.moveTo(h,d);u||a.updatePathMinMax(c,h,d);break;case n.OPS.lineTo:h=t[s++];d=t[s++];r.lineTo(h,d);u||a.updatePathMinMax(c,h,d);break;case n.OPS.curveTo:o=h;l=d;h=t[s+4];d=t[s+5];r.bezierCurveTo(t[s],t[s+1],t[s+2],t[s+3],h,d);a.updateCurvePathMinMax(c,o,l,t[s],t[s+1],t[s+2],t[s+3],h,d,p);s+=6;break;case n.OPS.curveTo2:o=h;l=d;r.bezierCurveTo(h,d,t[s],t[s+1],t[s+2],t[s+3]);a.updateCurvePathMinMax(c,o,l,h,d,t[s],t[s+1],t[s+2],t[s+3],p);h=t[s+2];d=t[s+3];s+=4;break;case n.OPS.curveTo3:o=h;l=d;h=t[s+2];d=t[s+3];r.bezierCurveTo(t[s],t[s+1],h,d,h,d);a.updateCurvePathMinMax(c,o,l,t[s],t[s+1],h,d,h,d,p);s+=4;break;case n.OPS.closePath:r.closePath()}u&&a.updateScalingPathMinMax(c,p);a.setCurrentPoint(h,d)}closePath(){this.ctx.closePath()}stroke(e=!0){const t=this.ctx,i=this.current.strokeColor;t.globalAlpha=this.current.strokeAlpha;if(this.contentVisible)if("object"==typeof i&&i?.getPattern){t.save();t.strokeStyle=i.getPattern(t,this,(0,s.getCurrentTransformInverse)(t),r.PathType.STROKE);this.rescaleAndStroke(!1);t.restore()}else this.rescaleAndStroke(!0);e&&this.consumePath(this.current.getClippedPathBoundingBox());t.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath();this.stroke()}fill(e=!0){const t=this.ctx;let i=!0,n=this.current.fillColor;this.backgroundColorToReplace&&n===this.backgroundColorToReplace&&(this.background&&"function"!=typeof this.background?n=this.background:i=!1);let a=!1;if(this.current.patternFill){t.save();t.fillStyle=n.getPattern(t,this,(0,s.getCurrentTransformInverse)(t),r.PathType.FILL);a=!0}const o=this.current.getClippedPathBoundingBox();if(i&&this.contentVisible&&null!==o)if(this.pendingEOFill){t.fill("evenodd");this.pendingEOFill=!1}else t.fill();a&&t.restore();e&&this.consumePath(o)}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=u}eoClip(){this.pendingClip=p}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(const i of e){t.setTransform(...i.transform);t.translate(i.x,i.y);i.addToPath(t,i.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,r){const a=this.ctx,o=this.current,l=o.font,h=o.textRenderingMode,d=o.fontSize/o.fontSizeScale,c=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,d);r&&a.setTransform(...r);c!==n.TextRenderingMode.FILL&&c!==n.TextRenderingMode.FILL_STROKE||a.fill();c!==n.TextRenderingMode.STROKE&&c!==n.TextRenderingMode.FILL_STROKE||a.stroke();a.restore()}else{c!==n.TextRenderingMode.FILL&&c!==n.TextRenderingMode.FILL_STROKE||a.fillText(e,t,i);c!==n.TextRenderingMode.STROKE&&c!==n.TextRenderingMode.FILL_STROKE||a.strokeText(e,t,i)}if(u){(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:(0,s.getCurrentTransform)(a),x:t,y:i,fontSize:d,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 a=t.fontSize;if(0===a)return;const o=this.ctx,l=t.fontSizeScale,h=t.charSpacing,d=t.wordSpacing,c=t.fontDirection,u=t.textHScale*c,p=e.length,g=i.vertical,f=g?1:-1,m=i.defaultVMetrics,b=a*t.fontMatrix[0],v=t.textRenderingMode===n.TextRenderingMode.FILL&&!i.disableFontFace&&!t.patternFill;o.save();o.transform(...t.textMatrix);o.translate(t.x,t.y+t.textRise);c>0?o.scale(u,-1):o.scale(u,1);let w;if(t.patternFill){o.save();const e=t.fillColor.getPattern(o,this,(0,s.getCurrentTransformInverse)(o),r.PathType.FILL);w=(0,s.getCurrentTransform)(o);o.restore();o.fillStyle=e}let _=t.lineWidth;const y=t.textMatrixScale;if(0===y||0===_){const e=t.textRenderingMode&n.TextRenderingMode.FILL_STROKE_MASK;e!==n.TextRenderingMode.STROKE&&e!==n.TextRenderingMode.FILL_STROKE||(_=this.getSinglePixelWidth())}else _/=y;if(1!==l){o.scale(l,l);_/=l}o.lineWidth=_;if(i.isInvalidPDFjsFont){const i=[];let n=0;for(const t of e){i.push(t.unicode);n+=t.width}o.fillText(i.join(""),0,0);t.x+=n*b*u;o.restore();this.compose();return}let S,P=0;for(S=0;S<p;++S){const t=e[S];if("number"==typeof t){P+=f*t*a/1e3;continue}let n=!1;const s=(t.isSpace?d:0)+h,r=t.fontChar,u=t.accent;let p,_,y,A=t.width;if(g){const e=t.vmetric||m,i=-(t.vmetric?e[1]:.5*A)*b,n=e[2]*b;A=e?-e[0]:A;p=i/l;_=(P+n)/l}else{p=P/l;_=0}if(i.remeasure&&A>0){const e=1e3*o.measureText(r).width/a*l;if(A<e&&this.isFontSubpixelAAEnabled){const t=A/e;n=!0;o.save();o.scale(t,1);p/=t}else A!==e&&(p+=(A-e)/2e3*a/l)}if(this.contentVisible&&(t.isInFont||i.missingFile))if(v&&!u)o.fillText(r,p,_);else{this.paintChar(r,p,_,w);if(u){const e=p+a*u.offset.x/l,t=_-a*u.offset.y/l;this.paintChar(u.fontChar,e,t,w)}}y=g?A*b-s*c:A*b+s*c;P+=y;n&&o.restore()}g?t.y-=P:t.x+=P*u;o.restore();this.compose()}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,d=i.textHScale*a,c=i.fontMatrix||n.FONT_IDENTITY_MATRIX,u=e.length;let p,g,f,m;if(!(i.textRenderingMode===n.TextRenderingMode.INVISIBLE)&&0!==r){this._cachedScaleForStroking=null;this._cachedGetSinglePixelWidth=null;t.save();t.transform(...i.textMatrix);t.translate(i.x,i.y);t.scale(d,a);for(p=0;p<u;++p){g=e[p];if("number"==typeof g){m=o*g*r/1e3;this.ctx.translate(m,0);i.x+=m*d;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(...c);this.executeOperatorList(u);this.restore()}f=n.Util.applyTransform([g.width,0],c)[0]*r+a;t.translate(f,0);i.x+=f*d}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.ctx.clip();this.endPath()}getColorN_Pattern(e){let t;if("TilingPattern"===e[0]){const i=e[1],n=this.baseTransform||(0,s.getCurrentTransform)(this.ctx),a={createCanvasGraphics:e=>new CanvasGraphics(e,this.commonObjs,this.objs,this.canvasFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};t=new r.TilingPattern(e,i,this.ctx,a,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=this.selectColor?.(e,t,i)||n.Util.makeHexColor(e,t,i);this.ctx.strokeStyle=s;this.current.strokeColor=s}setFillRGBColor(e,t,i){let s=this.selectColor?.(e,t,i)||n.Util.makeHexColor(e,t,i);this.backgroundColorToReplace&&s===this.backgroundColorToReplace&&this.background&&"function"!=typeof this.background&&(s=this.background);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,r.getShadingPattern)(this.objs.get(e));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,(0,s.getCurrentTransformInverse)(t),r.PathType.SHADING);const a=(0,s.getCurrentTransformInverse)(t);if(a){const e=t.canvas,i=e.width,s=e.height,r=n.Util.applyTransform([0,0],a),o=n.Util.applyTransform([0,s],a),l=n.Util.applyTransform([i,0],a),h=n.Util.applyTransform([i,s],a),d=Math.min(r[0],o[0],l[0],h[0]),c=Math.min(r[1],o[1],l[1],h[1]),u=Math.max(r[0],o[0],l[0],h[0]),p=Math.max(r[1],o[1],l[1],h[1]);this.ctx.fillRect(d,c,u-d,p-c)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox());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(...e);this.baseTransform=(0,s.getCurrentTransform)(this.ctx);if(t){const e=t[2]-t[0],i=t[3]-t[1];this.ctx.rect(t[0],t[1],e,i);this.current.updateRectMinMax((0,s.getCurrentTransform)(this.ctx),t);this.clip();this.endPath()}}}paintFormXObjectEnd(){if(this.contentVisible){this.restore();this.baseTransform=this.baseTransformStack.pop()}}beginGroup(e){if(!this.contentVisible)return;this.save();if(this.inSMaskMode){this.endSMaskMode();this.current.activeSMask=null}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=(0,s.getCurrentTransform)(t);e.matrix&&t.transform(...e.matrix);if(!e.bbox)throw new Error("Bounding box is required.");let r=n.Util.getAxialAlignedBoundingBox(e.bbox,(0,s.getCurrentTransform)(t));const a=[0,0,t.canvas.width,t.canvas.height];r=n.Util.intersect(r,a)||[0,0,0,0];const l=Math.floor(r[0]),h=Math.floor(r[1]);let d=Math.max(Math.ceil(r[2])-l,1),c=Math.max(Math.ceil(r[3])-h,1),u=1,p=1;if(d>o){u=d/o;d=o}if(c>o){p=c/o;c=o}this.current.startNewPathAndClipBox([0,0,d,c]);let g="groupAt"+this.groupLevel;e.smask&&(g+="_smask_"+this.smaskCounter++%2);const f=this.cachedCanvases.getCanvas(g,d,c),m=f.context;m.scale(1/u,1/p);m.translate(-l,-h);m.transform(...i);if(e.smask)this.smaskStack.push({canvas:f.canvas,context:m,offsetX:l,offsetY:h,scaleX:u,scaleY:p,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(l,h);t.scale(u,p);t.save()}copyCtxState(t,m);this.ctx=m;this.setGState([["BM","source-over"],["ca",1],["CA",1]]);this.groupStack.push(t);this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;const t=this.ctx,i=this.groupStack.pop();this.ctx=i;this.ctx.imageSmoothingEnabled=!1;if(e.smask){this.tempSMask=this.smaskStack.pop();this.restore()}else{this.ctx.restore();const e=(0,s.getCurrentTransform)(this.ctx);this.restore();this.ctx.save();this.ctx.setTransform(...e);const i=n.Util.getAxialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],e);this.ctx.drawImage(t.canvas,0,0);this.ctx.restore();this.compose(i)}}beginAnnotation(e,t,i,r,a){this.#de();resetCtxToDefault(this.ctx,this.foregroundColor);this.ctx.save();this.save();this.baseTransform&&this.ctx.setTransform(...this.baseTransform);if(Array.isArray(t)&&4===t.length){const r=t[2]-t[0],o=t[3]-t[1];if(a&&this.annotationCanvasMap){(i=i.slice())[4]-=t[0];i[5]-=t[1];(t=t.slice())[0]=t[1]=0;t[2]=r;t[3]=o;const[a,l]=n.Util.singularValueDecompose2dScale((0,s.getCurrentTransform)(this.ctx)),{viewportScale:h}=this,d=Math.ceil(r*this.outputScaleX*h),c=Math.ceil(o*this.outputScaleY*h);this.annotationCanvas=this.canvasFactory.create(d,c);const{canvas:u,context:p}=this.annotationCanvas;this.annotationCanvasMap.set(e,u);this.annotationCanvas.savedCtx=this.ctx;this.ctx=p;this.ctx.setTransform(a,0,0,-l,0,o*l);resetCtxToDefault(this.ctx,this.foregroundColor)}else{resetCtxToDefault(this.ctx,this.foregroundColor);this.ctx.rect(t[0],t[1],r,o);this.ctx.clip();this.endPath()}}this.current=new CanvasExtraState(this.ctx.canvas.width,this.ctx.canvas.height);this.transform(...i);this.transform(...r)}endAnnotation(){if(this.annotationCanvas){this.ctx=this.annotationCanvas.savedCtx;delete this.annotationCanvas.savedCtx;delete this.annotationCanvas}}paintImageMaskXObject(e){if(!this.contentVisible)return;const t=e.count;(e=this.getObject(e.data,e)).count=t;const i=this.ctx,n=this.processingType3;if(n){void 0===n.compiled&&(n.compiled=function compileType3Glyph(e){const{width:t,height:i}=e;if(t>l||i>l)return null;const n=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),s=t+1;let r,a,o,h=new Uint8Array(s*(i+1));const d=t+7&-8;let c=new Uint8Array(d*i),u=0;for(const t of e.data){let e=128;for(;e>0;){c[u++]=t&e?0:255;e>>=1}}let p=0;u=0;if(0!==c[u]){h[0]=1;++p}for(a=1;a<t;a++){if(c[u]!==c[u+1]){h[a]=c[u]?2:1;++p}u++}if(0!==c[u]){h[a]=2;++p}for(r=1;r<i;r++){u=r*d;o=r*s;if(c[u-d]!==c[u]){h[o]=c[u]?1:8;++p}let e=(c[u]?4:0)+(c[u-d]?8:0);for(a=1;a<t;a++){e=(e>>2)+(c[u+1]?4:0)+(c[u-d+1]?8:0);if(n[e]){h[o+a]=n[e];++p}u++}if(c[u-d]!==c[u]){h[o+a]=c[u]?2:4;++p}if(p>1e3)return null}u=d*(i-1);o=r*s;if(0!==c[u]){h[o]=8;++p}for(a=1;a<t;a++){if(c[u]!==c[u+1]){h[o+a]=c[u]?4:8;++p}u++}if(0!==c[u]){h[o+a]=4;++p}if(p>1e3)return null;const g=new Int32Array([0,s,-1,0,-s,0,0,0,1]),f=new Path2D;for(r=0;p&&r<=i;r++){let e=r*s;const i=e+t;for(;e<i&&!h[e];)e++;if(e===i)continue;f.moveTo(e%s,r);const n=e;let a=h[e];do{const t=g[a];do{e+=t}while(!h[e]);const i=h[e];if(5!==i&&10!==i){a=i;h[e]=0}else{a=i&51*a>>4;h[e]&=a>>2|a<<2}f.lineTo(e%s,e/s|0);h[e]||--p}while(n!==e);--r}c=null;h=null;return function(e){e.save();e.scale(1/t,-1/i);e.translate(0,-i);e.fill(f);e.beginPath();e.restore()}}(e));if(n.compiled){n.compiled(i);return}}const s=this._createMaskCanvas(e),r=s.canvas;i.save();i.setTransform(1,0,0,1,0,0);i.drawImage(r,s.offsetX,s.offsetY);i.restore();this.compose()}paintImageMaskXObjectRepeat(e,t,i=0,r=0,a,o){if(!this.contentVisible)return;e=this.getObject(e.data,e);const l=this.ctx;l.save();const h=(0,s.getCurrentTransform)(l);l.transform(t,i,r,a,0,0);const d=this._createMaskCanvas(e);l.setTransform(1,0,0,1,d.offsetX-h[4],d.offsetY-h[5]);for(let e=0,s=o.length;e<s;e+=2){const s=n.Util.transform(h,[t,i,r,a,o[e],o[e+1]]),[c,u]=n.Util.applyTransform([0,0],s);l.drawImage(d.canvas,c,u)}l.restore();this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const t=this.ctx,i=this.current.fillColor,n=this.current.patternFill;for(const a of e){const{data:e,width:o,height:l,transform:h}=a,d=this.cachedCanvases.getCanvas("maskCanvas",o,l),c=d.context;c.save();putBinaryImageMask(c,this.getObject(e,a));c.globalCompositeOperation="source-in";c.fillStyle=n?i.getPattern(c,this,(0,s.getCurrentTransformInverse)(t),r.PathType.FILL):i;c.fillRect(0,0,o,l);c.restore();t.save();t.transform(...h);t.scale(1,-1);drawImageAtIntegerCoords(t,d.canvas,0,0,o,l,0,-1,1,1);t.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;const t=this.getObject(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=this.getObject(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 r;if("function"==typeof HTMLElement&&e instanceof HTMLElement||!e.data)r=e;else{const n=this.cachedCanvases.getCanvas("inlineImage",t,i);putBinaryImageData(n.context,e,this.current.transferMaps);r=n.canvas}const a=this._scaleImage(r,(0,s.getCurrentTransformInverse)(n));n.imageSmoothingEnabled=getImageSmoothingEnabled((0,s.getCurrentTransform)(n),e.interpolate);drawImageAtIntegerCoords(n,a.img,0,0,a.paintWidth,a.paintHeight,0,-i,t,i);this.compose();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(const e of t){i.save();i.transform(...e.transform);i.scale(1,-1);drawImageAtIntegerCoords(i,r.canvas,e.x,e.y,e.w,e.h,0,-1,1,1);i.restore()}this.compose()}paintSolidColorImageMask(){if(this.contentVisible){this.ctx.fillRect(0,0,1,1);this.compose()}}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(e){const t=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath();this.pendingClip||this.compose(e);const i=this.ctx;if(this.pendingClip){t||(this.pendingClip===p?i.clip("evenodd"):i.clip());this.pendingClip=null}this.current.startNewPathAndClipBox(this.current.clipBox);i.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=(0,s.getCurrentTransform)(this.ctx);if(0===e[1]&&0===e[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const t=Math.abs(e[0]*e[3]-e[2]*e[1]),i=Math.hypot(e[0],e[2]),n=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(i,n)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(!this._cachedScaleForStroking){const{lineWidth:e}=this.current,t=(0,s.getCurrentTransform)(this.ctx);let i,n;if(0===t[1]&&0===t[2]){const s=Math.abs(t[0]),r=Math.abs(t[3]);if(0===e){i=1/s;n=1/r}else{const t=s*e,a=r*e;i=t<1?1/t:1;n=a<1?1/a:1}}else{const s=Math.abs(t[0]*t[3]-t[2]*t[1]),r=Math.hypot(t[0],t[1]),a=Math.hypot(t[2],t[3]);if(0===e){i=a/s;n=r/s}else{const t=e*s;i=a>t?a/t:1;n=r>t?r/t:1}}this._cachedScaleForStroking=[i,n]}return this._cachedScaleForStroking}rescaleAndStroke(e){const{ctx:t}=this,{lineWidth:i}=this.current,[n,r]=this.getScaleForStroking();t.lineWidth=i||1;if(1===n&&1===r){t.stroke();return}let a,o,l;if(e){a=(0,s.getCurrentTransform)(t);o=t.getLineDash().slice();l=t.lineDashOffset}t.scale(n,r);const h=Math.max(n,r);t.setLineDash(t.getLineDash().map((e=>e/h)));t.lineDashOffset/=h;t.stroke();if(e){t.setTransform(...a);t.setLineDash(o);t.lineDashOffset=l}}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.TilingPattern=t.PathType=void 0;t.getShadingPattern=function getShadingPattern(e){switch(e[0]){case"RadialAxial":return new RadialAxialShadingPattern(e);case"Mesh":return new MeshShadingPattern(e);case"Dummy":return new DummyShadingPattern}throw new Error(`Unknown IR type: ${e[0]}`)};var n=i(1),s=i(6);const r={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};t.PathType=r;function applyBoundingBox(e,t){if(!t)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){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}_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,a){let o;if(a===r.STROKE||a===r.FILL){const r=t.current.getClippedPathBoundingBox(a,(0,s.getCurrentTransform)(e))||[0,0,0,0],l=Math.ceil(r[2]-r[0])||1,h=Math.ceil(r[3]-r[1])||1,d=t.cachedCanvases.getCanvas("pattern",l,h,!0),c=d.context;c.clearRect(0,0,c.canvas.width,c.canvas.height);c.beginPath();c.rect(0,0,c.canvas.width,c.canvas.height);c.translate(-r[0],-r[1]);i=n.Util.transform(i,[1,0,0,1,r[0],r[1]]);c.transform(...t.baseTransform);this.matrix&&c.transform(...this.matrix);applyBoundingBox(c,this._bbox);c.fillStyle=this._createGradient(c);c.fill();o=e.createPattern(d.canvas,"no-repeat");const u=new DOMMatrix(i);o.setTransform(u)}else{applyBoundingBox(e,this._bbox);o=this._createGradient(e)}return o}}function drawTriangle(e,t,i,n,s,r,a,o){const l=t.coords,h=t.colors,d=e.data,c=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,b=(l[s]+t.offsetX)*t.scaleX,v=(l[s+1]+t.offsetY)*t.scaleY;if(g>=v)return;const w=h[r],_=h[r+1],y=h[r+2],S=h[a],P=h[a+1],A=h[a+2],E=h[o],C=h[o+1],x=h[o+2],T=Math.round(g),M=Math.round(v);let I,L,k,D,R,F,O,N;for(let e=T;e<=M;e++){if(e<m){let t;t=e<g?0:(g-e)/(g-m);I=p-(p-f)*t;L=w-(w-S)*t;k=_-(_-P)*t;D=y-(y-A)*t}else{let t;t=e>v?1:m===v?0:(m-e)/(m-v);I=f-(f-b)*t;L=S-(S-E)*t;k=P-(P-C)*t;D=A-(A-x)*t}let t;t=e<g?0:e>v?1:(g-e)/(g-v);R=p-(p-b)*t;F=w-(w-E)*t;O=_-(_-C)*t;N=y-(y-x)*t;const i=Math.round(Math.min(I,R)),n=Math.round(Math.max(I,R));let s=c*e+4*i;for(let e=i;e<=n;e++){t=(I-e)/(I-R);t<0?t=0:t>1&&(t=1);d[s++]=L-(L-F)*t|0;d[s++]=k-(k-O)*t|0;d[s++]=D-(D-N)*t|0;d[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,d=a/l,c={coords:this._coords,colors:this._colors,offsetX:-n,offsetY:-s,scaleX:1/h,scaleY:1/d},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,c);f.putImageData(m,2,2);return{canvas:g.canvas,offsetX:n-2*h,offsetY:s-2*d,scaleX:h,scaleY:d}}getPattern(e,t,i,a){applyBoundingBox(e,this._bbox);let o;if(a===r.SHADING)o=n.Util.singularValueDecompose2dScale((0,s.getCurrentTransform)(e));else{o=n.Util.singularValueDecompose2dScale(t.baseTransform);if(this.matrix){const e=n.Util.singularValueDecompose2dScale(this.matrix);o=[o[0]*e[0],o[1]*e[1]]}}const l=this._createMeshCanvas(o,a===r.SHADING?null:this._background,t.cachedCanvases);if(a!==r.SHADING){e.setTransform(...t.baseTransform);this.matrix&&e.transform(...this.matrix)}e.translate(l.offsetX,l.offsetY);e.scale(l.scaleX,l.scaleY);return e.createPattern(l.canvas,"no-repeat")}}class DummyShadingPattern extends BaseShadingPattern{getPattern(){return"hotpink"}}const a=1,o=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,r=this.xstep,a=this.ystep,o=this.paintType,l=this.tilingType,h=this.color,d=this.canvasGraphicsFactory;(0,n.info)("TilingType: "+l);const c=i[0],u=i[1],p=i[2],g=i[3],f=n.Util.singularValueDecompose2dScale(this.matrix),m=n.Util.singularValueDecompose2dScale(this.baseTransform),b=[f[0]*m[0],f[1]*m[1]],v=this.getSizeAndScale(r,this.ctx.canvas.width,b[0]),w=this.getSizeAndScale(a,this.ctx.canvas.height,b[1]),_=e.cachedCanvases.getCanvas("pattern",v.size,w.size,!0),y=_.context,S=d.createCanvasGraphics(y);S.groupLevel=e.groupLevel;this.setFillAndStrokeStyleToContext(S,o,h);let P=c,A=u,E=p,C=g;if(c<0){P=0;E+=Math.abs(c)}if(u<0){A=0;C+=Math.abs(u)}y.translate(-v.scale*P,-w.scale*A);S.transform(v.scale,0,0,w.scale,0,0);y.save();this.clipBbox(S,P,A,E,C);S.baseTransform=(0,s.getCurrentTransform)(S.ctx);S.executeOperatorList(t);S.endDrawing();return{canvas:_.canvas,scaleX:v.scale,scaleY:w.scale,offsetX:P,offsetY:A}}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,r){const a=n-t,o=r-i;e.ctx.rect(t,i,a,o);e.current.updateRectMinMax((0,s.getCurrentTransform)(e.ctx),[t,i,n,r]);e.clip();e.endPath()}setFillAndStrokeStyleToContext(e,t,i){const s=e.ctx,r=e.current;switch(t){case a:const e=this.ctx;s.fillStyle=e.fillStyle;s.strokeStyle=e.strokeStyle;r.fillColor=e.fillStyle;r.strokeColor=e.strokeStyle;break;case o:const l=n.Util.makeHexColor(i[0],i[1],i[2]);s.fillStyle=l;s.strokeStyle=l;r.fillColor=l;r.strokeColor=l;break;default:throw new n.FormatError(`Unsupported paint type: ${t}`)}}getPattern(e,t,i,s){let a=i;if(s!==r.SHADING){a=n.Util.transform(a,t.baseTransform);this.matrix&&(a=n.Util.transform(a,this.matrix))}const o=this.createPatternCanvas(t);let l=new DOMMatrix(a);l=l.translate(o.offsetX,o.offsetY);l=l.scale(1/o.scaleX,1/o.scaleY);const h=e.createPattern(o.canvas,"repeat");h.setTransform(l);return h}}t.TilingPattern=TilingPattern},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.applyMaskImageData=function applyMaskImageData({src:e,srcPos:t=0,dest:i,destPos:s=0,width:r,height:a,inverseDecode:o=!1}){const l=n.FeatureTest.isLittleEndian?4278190080:255,[h,d]=o?[0,l]:[l,0],c=r>>3,u=7&r,p=e.length;i=new Uint32Array(i.buffer);for(let n=0;n<a;n++){for(const n=t+c;t<n;t++){const n=t<p?e[t]:255;i[s++]=128&n?d:h;i[s++]=64&n?d:h;i[s++]=32&n?d:h;i[s++]=16&n?d:h;i[s++]=8&n?d:h;i[s++]=4&n?d:h;i[s++]=2&n?d:h;i[s++]=1&n?d:h}if(0===u)continue;const n=t<p?e[t++]:255;for(let e=0;e<u;e++)i[s++]=n&1<<7-e?d:h}return{srcPos:t,destPos:s}};var n=i(1)},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.GlobalWorkerOptions=void 0;const i=Object.create(null);t.GlobalWorkerOptions=i;i.workerPort=null;i.workerSrc=""},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.MessageHandler=void 0;var n=i(1);const s=1,r=2,a=1,o=2,l=3,h=4,d=5,c=6,u=7,p=8;function wrapReason(e){e instanceof Error||"object"==typeof e&&null!==e||(0,n.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.');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.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.comObj.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.comObj.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};h.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:c,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],c={enqueue(e,a=1,o){if(this.isCancelled)return;const l=this.desiredSize;this.desiredSize-=a;if(l>0&&this.desiredSize<=0){this.sinkCapability=(0,n.createPromiseCapability)();this.ready=this.sinkCapability.promise}r.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:d,streamId:t,reason:wrapReason(e)})}},sinkCapability:(0,n.createPromiseCapability)(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};c.sinkCapability.resolve();c.ready=c.sinkCapability.promise;this.streamSinks[t]=c;new Promise((function(t){t(o(e.data,c))})).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 c: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 d:(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]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.Metadata=void 0;var n=i(1);t.Metadata=class Metadata{#ce;#ue;constructor({parsedData:e,rawData:t}){this.#ce=e;this.#ue=t}getRaw(){return this.#ue}get(e){return this.#ce.get(e)??null}getAll(){return(0,n.objectFromMap)(this.#ce)}has(e){return this.#ce.has(e)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.OptionalContentConfig=void 0;var n=i(1),s=i(8);const r=Symbol("INTERNAL");class OptionalContentGroup{#pe=!0;constructor(e,t){this.name=e;this.intent=t}get visible(){return this.#pe}_setVisible(e,t){e!==r&&(0,n.unreachable)("Internal method `_setVisible` called.");this.#pe=t}}t.OptionalContentConfig=class OptionalContentConfig{#ge=null;#fe=new Map;#me=null;#be=null;constructor(e){this.name=null;this.creator=null;if(null!==e){this.name=e.name;this.creator=e.creator;this.#be=e.order;for(const t of e.groups)this.#fe.set(t.id,new OptionalContentGroup(t.name,t.intent));if("OFF"===e.baseState)for(const e of this.#fe.values())e._setVisible(r,!1);for(const t of e.on)this.#fe.get(t)._setVisible(r,!0);for(const t of e.off)this.#fe.get(t)._setVisible(r,!1);this.#me=this.getHash()}}#ve(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.#ve(t);else{if(!this.#fe.has(t)){(0,n.warn)(`Optional content group not found: ${t}`);return!0}r=this.#fe.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.#fe.size)return!0;if(!e){(0,n.warn)("Optional content group not defined.");return!0}if("OCG"===e.type){if(!this.#fe.has(e.id)){(0,n.warn)(`Optional content group not found: ${e.id}`);return!0}return this.#fe.get(e.id).visible}if("OCMD"===e.type){if(e.expression)return this.#ve(e.expression);if(!e.policy||"AnyOn"===e.policy){for(const t of e.ids){if(!this.#fe.has(t)){(0,n.warn)(`Optional content group not found: ${t}`);return!0}if(this.#fe.get(t).visible)return!0}return!1}if("AllOn"===e.policy){for(const t of e.ids){if(!this.#fe.has(t)){(0,n.warn)(`Optional content group not found: ${t}`);return!0}if(!this.#fe.get(t).visible)return!1}return!0}if("AnyOff"===e.policy){for(const t of e.ids){if(!this.#fe.has(t)){(0,n.warn)(`Optional content group not found: ${t}`);return!0}if(!this.#fe.get(t).visible)return!0}return!1}if("AllOff"===e.policy){for(const t of e.ids){if(!this.#fe.has(t)){(0,n.warn)(`Optional content group not found: ${t}`);return!0}if(this.#fe.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){if(this.#fe.has(e)){this.#fe.get(e)._setVisible(r,!!t);this.#ge=null}else(0,n.warn)(`Optional content group not found: ${e}`)}get hasInitialVisibility(){return this.getHash()===this.#me}getOrder(){return this.#fe.size?this.#be?this.#be.slice():[...this.#fe.keys()]:null}getGroups(){return this.#fe.size>0?(0,n.objectFromMap)(this.#fe):null}getGroup(e){return this.#fe.get(e)||null}getHash(){if(null!==this.#ge)return this.#ge;const e=new s.MurmurHash3_64;for(const[t,i]of this.#fe)e.update(`${t}:${i.visible}`);return this.#ge=e.hexdigest()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFDataTransportStream=void 0;var n=i(1),s=i(6);t.PDFDataTransportStream=class PDFDataTransportStream{constructor({length:e,initialData:t,progressiveDone:i=!1,contentDispositionFilename:s=null,disableRange:r=!1,disableStream:a=!1},o){(0,n.assert)(o,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');this._queuedChunks=[];this._progressiveDone=i;this._contentDispositionFilename=s;if(t?.length>0){const e=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;this._queuedChunks.push(e)}this._pdfDataRangeTransport=o;this._isStreamingSupported=!a;this._isRangeSupported=!r;this._contentLength=e;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({begin:e,chunk:t}){const i=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;if(void 0===e)this._fullRequestReader?this._fullRequestReader._enqueue(i):this._queuedChunks.push(i);else{const t=this._rangeReaders.some((function(t){if(t._begin!==e)return!1;t._enqueue(i);return!0}));(0,n.assert)(t,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(e){void 0===e.total?this._rangeReaders[0]?.onProgress?.({loaded:e.loaded}):this._fullRequestReader?.onProgress?.({loaded:e.loaded,total:e.total})}_onProgressiveDone(){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?.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.NodeStandardFontDataFactory=t.NodeCanvasFactory=t.NodeCMapReaderFactory=void 0;var n=i(7);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))}))}))};class NodeCanvasFactory extends n.BaseCanvasFactory{_createCanvas(e,t){return require("canvas").createCanvas(e,t)}}t.NodeCanvasFactory=NodeCanvasFactory;class NodeCMapReaderFactory extends n.BaseCMapReaderFactory{_fetchData(e,t){return fetchData(e).then((e=>({cMapData:e,compressionType:t})))}}t.NodeCMapReaderFactory=NodeCMapReaderFactory;class NodeStandardFontDataFactory extends n.BaseStandardFontDataFactory{_fetchData(e){return fetchData(e)}}t.NodeStandardFontDataFactory=NodeStandardFontDataFactory},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFNodeStream=void 0;var n=i(1),s=i(22);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?.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?.({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?.({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:n}){const s={allowRangeRequests:!1,suggestedLength:void 0},r=parseInt(e("Content-Length"),10);if(!Number.isInteger(r))return s;s.suggestedLength=r;if(r<=2*i)return s;if(n||!t)return s;if("bytes"!==e("Accept-Ranges"))return s;if("identity"!==(e("Content-Encoding")||"identity"))return s;s.allowRangeRequests=!0;return s};t.validateResponseStatus=function validateResponseStatus(e){return 200===e||206===e};var n=i(1),s=i(23),r=i(6)},(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(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(1)},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFNetworkStream=void 0;var n=i(1),s=i(22);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(1),s=i(22);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}function getArrayBuffer(e){if(e instanceof Uint8Array)return e.buffer;if(e instanceof ArrayBuffer)return e;(0,n.warn)(`getArrayBuffer - unexpected data format: ${e}`);return new Uint8Array(e).buffer}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?.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);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?.({loaded:this._loaded,total:this._contentLength});return{value:getArrayBuffer(e),done:!1}}cancel(e){this._reader?.cancel(e);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;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?.({loaded:this._loaded});return{value:getArrayBuffer(e),done:!1}}cancel(e){this._reader?.cancel(e);this._abortController.abort()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.TextLayerRenderTask=void 0;t.renderTextLayer=function renderTextLayer(e){if(!e.textContentSource&&(e.textContent||e.textContentStream)){(0,s.deprecated)("The TextLayerRender `textContent`/`textContentStream` parameters will be removed in the future, please use `textContentSource` instead.");e.textContentSource=e.textContent||e.textContentStream}const t=new TextLayerRenderTask(e);t._render();return t};t.updateTextLayer=function updateTextLayer({container:e,viewport:t,textDivs:i,textDivProperties:n,isOffscreenCanvasSupported:r,mustRotate:a=!0,mustRescale:o=!0}){a&&(0,s.setLayerDimensions)(e,{rotation:t.rotation});if(o){const e=getCtx(0,r),s={prevFontSize:null,prevFontFamily:null,div:null,scale:t.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:e};for(const e of i){s.properties=n.get(e);s.div=e;layout(s)}}};var n=i(1),s=i(6);const r=1e5,a=30,o=.8,l=new Map;function getCtx(e,t){let i;const s=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0,alpha:!1}:{alpha:!1};if(t&&n.FeatureTest.isOffscreenCanvasSupported)i=new OffscreenCanvas(e,e).getContext("2d",s);else{const t=document.createElement("canvas");t.width=t.height=e;i=t.getContext("2d",s)}return i}function appendText(e,t,i){const s=document.createElement("span"),r={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};e._textDivs.push(s);const h=n.Util.transform(e._transform,t.transform);let d=Math.atan2(h[1],h[0]);const c=i[t.fontName];c.vertical&&(d+=Math.PI/2);const u=Math.hypot(h[2],h[3]),p=u*function getAscent(e,t){const i=l.get(e);if(i)return i;const n=getCtx(a,t);n.font=`${a}px ${e}`;const s=n.measureText("");let r=s?.fontBoundingBoxAscent,h=Math.abs(s?.fontBoundingBoxDescent);if(r){const t=r/(r+h);l.set(e,t);n.canvas.width=n.canvas.height=0;return t}n.strokeStyle="red";n.clearRect(0,0,a,a);n.strokeText("g",0,0);let d=n.getImageData(0,0,a,a).data;h=0;for(let e=d.length-1-3;e>=0;e-=4)if(d[e]>0){h=Math.ceil(e/4/a);break}n.clearRect(0,0,a,a);n.strokeText("A",0,a);d=n.getImageData(0,0,a,a).data;r=0;for(let e=0,t=d.length;e<t;e+=4)if(d[e]>0){r=a-Math.floor(e/4/a);break}n.canvas.width=n.canvas.height=0;if(r){const t=r/(r+h);l.set(e,t);return t}l.set(e,o);return o}(c.fontFamily,e._isOffscreenCanvasSupported);let g,f;if(0===d){g=h[4];f=h[5]-p}else{g=h[4]+p*Math.sin(d);f=h[5]-p*Math.cos(d)}const m="calc(var(--scale-factor)*",b=s.style;if(e._container===e._rootContainer){b.left=`${(100*g/e._pageWidth).toFixed(2)}%`;b.top=`${(100*f/e._pageHeight).toFixed(2)}%`}else{b.left=`${m}${g.toFixed(2)}px)`;b.top=`${m}${f.toFixed(2)}px)`}b.fontSize=`${m}${u.toFixed(2)}px)`;b.fontFamily=c.fontFamily;r.fontSize=u;s.setAttribute("role","presentation");s.textContent=t.str;s.dir=t.dir;e._fontInspectorEnabled&&(s.dataset.fontName=t.fontName);0!==d&&(r.angle=d*(180/Math.PI));let v=!1;if(t.str.length>1)v=!0;else if(" "!==t.str&&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&&(v=!0)}v&&(r.canvasWidth=c.vertical?t.height:t.width);e._textDivProperties.set(s,r);e._isReadableStream&&e._layoutText(s)}function layout(e){const{div:t,scale:i,properties:n,ctx:s,prevFontSize:r,prevFontFamily:a}=e,{style:o}=t;let l="";if(0!==n.canvasWidth&&n.hasText){const{fontFamily:h}=o,{canvasWidth:d,fontSize:c}=n;if(r!==c||a!==h){s.font=`${c*i}px ${h}`;e.prevFontSize=c;e.prevFontFamily=h}try{const{width:e}=s.measureText(t.textContent);e>0&&(l=`scaleX(${d*i/e})`)}catch(e){}}0!==n.angle&&(l=`rotate(${n.angle}deg) ${l}`);l.length>0&&(o.transform=l)}class TextLayerRenderTask{constructor({textContentSource:e,container:t,viewport:i,textDivs:r,textDivProperties:a,textContentItemsStr:o,isOffscreenCanvasSupported:l}){this._textContentSource=e;this._isReadableStream=e instanceof ReadableStream;this._container=this._rootContainer=t;this._textDivs=r||[];this._textContentItemsStr=o||[];this._isOffscreenCanvasSupported=l;this._fontInspectorEnabled=!!globalThis.FontInspector?.enabled;this._reader=null;this._textDivProperties=a||new WeakMap;this._canceled=!1;this._capability=(0,n.createPromiseCapability)();this._layoutTextParams={prevFontSize:null,prevFontFamily:null,div:null,scale:i.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:getCtx(0,l)};const{pageWidth:h,pageHeight:d,pageX:c,pageY:u}=i.rawDims;this._transform=[1,0,0,-1,-c,u+d];this._pageWidth=h;this._pageHeight=d;(0,s.setLayerDimensions)(t,i);this._capability.promise.finally((()=>{this._layoutTextParams=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}this._capability.reject(new n.AbortException("TextLayer task cancelled."))}_processItems(e,t){for(const i of e)if(void 0!==i.str){this._textContentItemsStr.push(i.str);appendText(this,i,t)}else if("beginMarkedContentProps"===i.type||"beginMarkedContent"===i.type){const e=this._container;this._container=document.createElement("span");this._container.classList.add("markedContent");null!==i.id&&this._container.setAttribute("id",`${i.id}`);e.append(this._container)}else"endMarkedContent"===i.type&&(this._container=this._container.parentNode)}_layoutText(e){const t=this._layoutTextParams.properties=this._textDivProperties.get(e);this._layoutTextParams.div=e;layout(this._layoutTextParams);t.hasText&&this._container.append(e);if(t.hasEOL){const e=document.createElement("br");e.setAttribute("role","presentation");this._container.append(e)}}_render(){const e=(0,n.createPromiseCapability)();let t=Object.create(null);if(this._isReadableStream){const pump=()=>{this._reader.read().then((({value:i,done:n})=>{if(n)e.resolve();else{Object.assign(t,i.styles);this._processItems(i.items,t);pump()}}),e.reject)};this._reader=this._textContentSource.getReader();pump()}else{if(!this._textContentSource)throw new Error('No "textContentSource" parameter specified.');{const{items:t,styles:i}=this._textContentSource;this._processItems(t,i);e.resolve()}}e.promise.then((()=>{t=null;!function render(e){if(e._canceled)return;const t=e._textDivs,i=e._capability;if(t.length>r)i.resolve();else{if(!e._isReadableStream)for(const i of t)e._layoutText(i);i.resolve()}}(this)}),this._capability.reject)}}t.TextLayerRenderTask=TextLayerRenderTask},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.AnnotationEditorLayer=void 0;var n=i(1),s=i(5),r=i(28),a=i(29),o=i(6);class AnnotationEditorLayer{#we;#_e=!1;#ye=this.pointerup.bind(this);#Se=this.pointerdown.bind(this);#Pe=new Map;#Ae=!1;#Ee=!1;#Ce;static _initialized=!1;constructor(e){if(!AnnotationEditorLayer._initialized){AnnotationEditorLayer._initialized=!0;r.FreeTextEditor.initialize(e.l10n);a.InkEditor.initialize(e.l10n)}e.uiManager.registerEditorTypes([r.FreeTextEditor,a.InkEditor]);this.#Ce=e.uiManager;this.pageIndex=e.pageIndex;this.div=e.div;this.#we=e.accessibilityManager;this.#Ce.addLayer(this)}get isEmpty(){return 0===this.#Pe.size}updateToolbar(e){this.#Ce.updateToolbar(e)}updateMode(e=this.#Ce.getMode()){this.#xe();if(e===n.AnnotationEditorType.INK){this.addInkEditorIfNeeded(!1);this.disableClick()}else this.enableClick();this.#Ce.unselectAll();if(e!==n.AnnotationEditorType.NONE){this.div.classList.toggle("freeTextEditing",e===n.AnnotationEditorType.FREETEXT);this.div.classList.toggle("inkEditing",e===n.AnnotationEditorType.INK);this.div.hidden=!1}}addInkEditorIfNeeded(e){if(!e&&this.#Ce.getMode()!==n.AnnotationEditorType.INK)return;if(!e)for(const e of this.#Pe.values())if(e.isEmpty()){e.setInBackground();return}this.#Te({offsetX:0,offsetY:0}).setInBackground()}setEditingState(e){this.#Ce.setEditingState(e)}addCommands(e){this.#Ce.addCommands(e)}enable(){this.div.style.pointerEvents="auto";for(const e of this.#Pe.values())e.enableEditing()}disable(){this.div.style.pointerEvents="none";for(const e of this.#Pe.values())e.disableEditing();this.#xe();this.isEmpty&&(this.div.hidden=!0)}setActiveEditor(e){this.#Ce.getActive()!==e&&this.#Ce.setActiveEditor(e)}enableClick(){this.div.addEventListener("pointerdown",this.#Se);this.div.addEventListener("pointerup",this.#ye)}disableClick(){this.div.removeEventListener("pointerdown",this.#Se);this.div.removeEventListener("pointerup",this.#ye)}attach(e){this.#Pe.set(e.id,e)}detach(e){this.#Pe.delete(e.id);this.#we?.removePointerInTextLayer(e.contentDiv)}remove(e){this.#Ce.removeEditor(e);this.detach(e);e.div.style.display="none";setTimeout((()=>{e.div.style.display="";e.div.remove();e.isAttachedToDOM=!1;document.activeElement===document.body&&this.#Ce.focusMainContainer()}),0);this.#Ee||this.addInkEditorIfNeeded(!1)}#Me(e){if(e.parent!==this){this.attach(e);e.parent?.detach(e);e.setParent(this);if(e.div&&e.isAttachedToDOM){e.div.remove();this.div.append(e.div)}}}add(e){this.#Me(e);this.#Ce.addEditor(e);this.attach(e);if(!e.isAttachedToDOM){const t=e.render();this.div.append(t);e.isAttachedToDOM=!0}this.moveEditorInDOM(e);e.onceAdded();this.#Ce.addToAnnotationStorage(e)}moveEditorInDOM(e){this.#we?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?e.rebuild():this.add(e)}addANewEditor(e){this.addCommands({cmd:()=>{this.addOrRebuild(e)},undo:()=>{e.remove()},mustExec:!0})}addUndoableEditor(e){this.addCommands({cmd:()=>{this.addOrRebuild(e)},undo:()=>{e.remove()},mustExec:!1})}getNextId(){return this.#Ce.getId()}#Ie(e){switch(this.#Ce.getMode()){case n.AnnotationEditorType.FREETEXT:return new r.FreeTextEditor(e);case n.AnnotationEditorType.INK:return new a.InkEditor(e)}return null}deserialize(e){switch(e.annotationType){case n.AnnotationEditorType.FREETEXT:return r.FreeTextEditor.deserialize(e,this,this.#Ce);case n.AnnotationEditorType.INK:return a.InkEditor.deserialize(e,this,this.#Ce)}return null}#Te(e){const t=this.getNextId(),i=this.#Ie({parent:this,id:t,x:e.offsetX,y:e.offsetY,uiManager:this.#Ce});i&&this.add(i);return i}setSelected(e){this.#Ce.setSelected(e)}toggleSelected(e){this.#Ce.toggleSelected(e)}isSelected(e){return this.#Ce.isSelected(e)}unselect(e){this.#Ce.unselect(e)}pointerup(e){const{isMac:t}=n.FeatureTest.platform;if(!(0!==e.button||e.ctrlKey&&t)&&e.target===this.div&&this.#Ae){this.#Ae=!1;this.#_e?this.#Te(e):this.#_e=!0}}pointerdown(e){const{isMac:t}=n.FeatureTest.platform;if(0!==e.button||e.ctrlKey&&t)return;if(e.target!==this.div)return;this.#Ae=!0;const i=this.#Ce.getActive();this.#_e=!i||i.isEmpty()}drop(e){const t=e.dataTransfer.getData("text/plain"),i=this.#Ce.getEditor(t);if(!i)return;e.preventDefault();e.dataTransfer.dropEffect="move";this.#Me(i);const n=this.div.getBoundingClientRect(),s=e.clientX-n.x,r=e.clientY-n.y;i.translate(s-i.startX,r-i.startY);this.moveEditorInDOM(i);i.div.focus()}dragover(e){e.preventDefault()}destroy(){this.#Ce.getActive()?.parent===this&&this.#Ce.setActiveEditor(null);for(const e of this.#Pe.values()){this.#we?.removePointerInTextLayer(e.contentDiv);e.setParent(null);e.isAttachedToDOM=!1;e.div.remove()}this.div=null;this.#Pe.clear();this.#Ce.removeLayer(this)}#xe(){this.#Ee=!0;for(const e of this.#Pe.values())e.isEmpty()&&e.remove();this.#Ee=!1}render({viewport:e}){this.viewport=e;(0,o.setLayerDimensions)(this.div,e);(0,s.bindEvents)(this,this.div,["dragover","drop"]);for(const e of this.#Ce.getEditors(this.pageIndex))this.add(e);this.updateMode()}update({viewport:e}){this.#Ce.commitOrRemove();this.viewport=e;(0,o.setLayerDimensions)(this.div,{rotation:e.rotation});this.updateMode()}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}}t.AnnotationEditorLayer=AnnotationEditorLayer},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.FreeTextEditor=void 0;var n=i(1),s=i(5),r=i(4);class FreeTextEditor extends r.AnnotationEditor{#Le=this.editorDivBlur.bind(this);#ke=this.editorDivFocus.bind(this);#De=this.editorDivInput.bind(this);#Re=this.editorDivKeydown.bind(this);#Fe;#Oe="";#Ne=`${this.id}-editor`;#Be=!1;#Ve;static _freeTextDefaultContent="";static _l10nPromise;static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static _keyboardManager=new s.KeyboardManager([[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],FreeTextEditor.prototype.commitOrRemove]]);static _type="freetext";constructor(e){super({...e,name:"freeTextEditor"});this.#Fe=e.color||FreeTextEditor._defaultColor||r.AnnotationEditor._defaultLineColor;this.#Ve=e.fontSize||FreeTextEditor._defaultFontSize}static initialize(e){this._l10nPromise=new Map(["free_text2_default_content","editor_free_text2_aria_label"].map((t=>[t,e.get(t)])));const t=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(t.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,t){switch(e){case n.AnnotationEditorParamsType.FREETEXT_SIZE:FreeTextEditor._defaultFontSize=t;break;case n.AnnotationEditorParamsType.FREETEXT_COLOR:FreeTextEditor._defaultColor=t}}updateParams(e,t){switch(e){case n.AnnotationEditorParamsType.FREETEXT_SIZE:this.#Ue(t);break;case n.AnnotationEditorParamsType.FREETEXT_COLOR:this.#We(t)}}static get defaultPropertiesToUpdate(){return[[n.AnnotationEditorParamsType.FREETEXT_SIZE,FreeTextEditor._defaultFontSize],[n.AnnotationEditorParamsType.FREETEXT_COLOR,FreeTextEditor._defaultColor||r.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[n.AnnotationEditorParamsType.FREETEXT_SIZE,this.#Ve],[n.AnnotationEditorParamsType.FREETEXT_COLOR,this.#Fe]]}#Ue(e){const setFontsize=e=>{this.editorDiv.style.fontSize=`calc(${e}px * var(--scale-factor))`;this.translate(0,-(e-this.#Ve)*this.parentScale);this.#Ve=e;this.#He()},t=this.#Ve;this.addCommands({cmd:()=>{setFontsize(e)},undo:()=>{setFontsize(t)},mustExec:!0,type:n.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#We(e){const t=this.#Fe;this.addCommands({cmd:()=>{this.#Fe=this.editorDiv.style.color=e},undo:()=>{this.#Fe=this.editorDiv.style.color=t},mustExec:!0,type:n.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}getInitialTranslation(){const e=this.parentScale;return[-FreeTextEditor._internalPadding*e,-(FreeTextEditor._internalPadding+this.#Ve)*e]}rebuild(){super.rebuild();null!==this.div&&(this.isAttachedToDOM||this.parent.add(this))}enableEditMode(){if(!this.isInEditMode()){this.parent.setEditingState(!1);this.parent.updateToolbar(n.AnnotationEditorType.FREETEXT);super.enableEditMode();this.overlayDiv.classList.remove("enabled");this.editorDiv.contentEditable=!0;this.div.draggable=!1;this.div.removeAttribute("aria-activedescendant");this.editorDiv.addEventListener("keydown",this.#Re);this.editorDiv.addEventListener("focus",this.#ke);this.editorDiv.addEventListener("blur",this.#Le);this.editorDiv.addEventListener("input",this.#De)}}disableEditMode(){if(this.isInEditMode()){this.parent.setEditingState(!0);super.disableEditMode();this.overlayDiv.classList.add("enabled");this.editorDiv.contentEditable=!1;this.div.setAttribute("aria-activedescendant",this.#Ne);this.div.draggable=!0;this.editorDiv.removeEventListener("keydown",this.#Re);this.editorDiv.removeEventListener("focus",this.#ke);this.editorDiv.removeEventListener("blur",this.#Le);this.editorDiv.removeEventListener("input",this.#De);this.div.focus({preventScroll:!0});this.isEditing=!1;this.parent.div.classList.add("freeTextEditing")}}focusin(e){super.focusin(e);e.target!==this.editorDiv&&this.editorDiv.focus()}onceAdded(){if(!this.width){this.enableEditMode();this.editorDiv.focus()}}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1;this.parent.setEditingState(!0);this.parent.div.classList.add("freeTextEditing");super.remove()}#je(){const e=this.editorDiv.getElementsByTagName("div");if(0===e.length)return this.editorDiv.innerText;const t=[];for(const i of e)t.push(i.innerText.replace(/\r\n?|\n/,""));return t.join("\n")}#He(){const[e,t]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:e,div:t}=this,n=t.style.display;t.style.display="hidden";e.div.append(this.div);i=t.getBoundingClientRect();t.remove();t.style.display=n}this.width=i.width/e;this.height=i.height/t}commit(){if(this.isInEditMode()){super.commit();if(!this.#Be){this.#Be=!0;this.parent.addUndoableEditor(this)}this.disableEditMode();this.#Oe=this.#je().trimEnd();this.#He()}}shouldGetKeyboardEvents(){return this.isInEditMode()}dblclick(e){this.enableEditMode();this.editorDiv.focus()}keydown(e){if(e.target===this.div&&"Enter"===e.key){this.enableEditMode();this.editorDiv.focus()}}editorDivKeydown(e){FreeTextEditor._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle("freeTextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment");this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox");this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let e,t;if(this.width){e=this.x;t=this.y}super.render();this.editorDiv=document.createElement("div");this.editorDiv.className="internal";this.editorDiv.setAttribute("id",this.#Ne);this.enableEditing();FreeTextEditor._l10nPromise.get("editor_free_text2_aria_label").then((e=>this.editorDiv?.setAttribute("aria-label",e)));FreeTextEditor._l10nPromise.get("free_text2_default_content").then((e=>this.editorDiv?.setAttribute("default-content",e)));this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;i.fontSize=`calc(${this.#Ve}px * var(--scale-factor))`;i.color=this.#Fe;this.div.append(this.editorDiv);this.overlayDiv=document.createElement("div");this.overlayDiv.classList.add("overlay","enabled");this.div.append(this.overlayDiv);(0,s.bindEvents)(this,this.div,["dblclick","keydown"]);if(this.width){const[i,n]=this.parentDimensions;this.setAt(e*i,t*n,this.width*i,this.height*n);for(const e of this.#Oe.split("\n")){const t=document.createElement("div");t.append(e?document.createTextNode(e):document.createElement("br"));this.editorDiv.append(t)}this.div.draggable=!0;this.editorDiv.contentEditable=!1}else{this.div.draggable=!1;this.editorDiv.contentEditable=!0}return this.div}get contentDiv(){return this.editorDiv}static deserialize(e,t,i){const s=super.deserialize(e,t,i);s.#Ve=e.fontSize;s.#Fe=n.Util.makeHexColor(...e.color);s.#Oe=e.value;return s}serialize(){if(this.isEmpty())return null;const e=FreeTextEditor._internalPadding*this.parentScale,t=this.getRect(e,e),i=r.AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#Fe);return{annotationType:n.AnnotationEditorType.FREETEXT,color:i,fontSize:this.#Ve,value:this.#Oe,pageIndex:this.pageIndex,rect:t,rotation:this.rotation}}}t.FreeTextEditor=FreeTextEditor},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.InkEditor=void 0;Object.defineProperty(t,"fitCurve",{enumerable:!0,get:function(){return r.fitCurve}});var n=i(1),s=i(4),r=i(30),a=i(5);const o=16;class InkEditor extends s.AnnotationEditor{#ze=0;#Ge=0;#qe=0;#$e=this.canvasPointermove.bind(this);#Xe=this.canvasPointerleave.bind(this);#Ke=this.canvasPointerup.bind(this);#Ye=this.canvasPointerdown.bind(this);#Qe=!1;#Ze=!1;#Je=null;#et=null;#tt=0;#it=0;#nt=null;static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=1;static _l10nPromise;static _type="ink";constructor(e){super({...e,name:"inkEditor"});this.color=e.color||null;this.thickness=e.thickness||null;this.opacity=e.opacity||null;this.paths=[];this.bezierPath2D=[];this.currentPath=[];this.scaleFactor=1;this.translationX=this.translationY=0;this.x=0;this.y=0}static initialize(e){this._l10nPromise=new Map(["editor_ink_canvas_aria_label","editor_ink2_aria_label"].map((t=>[t,e.get(t)])))}static updateDefaultParams(e,t){switch(e){case n.AnnotationEditorParamsType.INK_THICKNESS:InkEditor._defaultThickness=t;break;case n.AnnotationEditorParamsType.INK_COLOR:InkEditor._defaultColor=t;break;case n.AnnotationEditorParamsType.INK_OPACITY:InkEditor._defaultOpacity=t/100}}updateParams(e,t){switch(e){case n.AnnotationEditorParamsType.INK_THICKNESS:this.#st(t);break;case n.AnnotationEditorParamsType.INK_COLOR:this.#We(t);break;case n.AnnotationEditorParamsType.INK_OPACITY:this.#rt(t)}}static get defaultPropertiesToUpdate(){return[[n.AnnotationEditorParamsType.INK_THICKNESS,InkEditor._defaultThickness],[n.AnnotationEditorParamsType.INK_COLOR,InkEditor._defaultColor||s.AnnotationEditor._defaultLineColor],[n.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*InkEditor._defaultOpacity)]]}get propertiesToUpdate(){return[[n.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||InkEditor._defaultThickness],[n.AnnotationEditorParamsType.INK_COLOR,this.color||InkEditor._defaultColor||s.AnnotationEditor._defaultLineColor],[n.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??InkEditor._defaultOpacity))]]}#st(e){const t=this.thickness;this.addCommands({cmd:()=>{this.thickness=e;this.#at()},undo:()=>{this.thickness=t;this.#at()},mustExec:!0,type:n.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#We(e){const t=this.color;this.addCommands({cmd:()=>{this.color=e;this.#ot()},undo:()=>{this.color=t;this.#ot()},mustExec:!0,type:n.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#rt(e){e/=100;const t=this.opacity;this.addCommands({cmd:()=>{this.opacity=e;this.#ot()},undo:()=>{this.opacity=t;this.#ot()},mustExec:!0,type:n.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){super.rebuild();if(null!==this.div){if(!this.canvas){this.#lt();this.#ht()}if(!this.isAttachedToDOM){this.parent.add(this);this.#dt()}this.#at()}}remove(){if(null!==this.canvas){this.isEmpty()||this.commit();this.canvas.width=this.canvas.height=0;this.canvas.remove();this.canvas=null;this.#et.disconnect();this.#et=null;super.remove()}}setParent(e){!this.parent&&e?this._uiManager.removeShouldRescale(this):this.parent&&null===e&&this._uiManager.addShouldRescale(this);super.setParent(e)}onScaleChanging(){const[e,t]=this.parentDimensions,i=this.width*e,n=this.height*t;this.setDimensions(i,n)}enableEditMode(){if(!this.#Qe&&null!==this.canvas){super.enableEditMode();this.div.draggable=!1;this.canvas.addEventListener("pointerdown",this.#Ye);this.canvas.addEventListener("pointerup",this.#Ke)}}disableEditMode(){if(this.isInEditMode()&&null!==this.canvas){super.disableEditMode();this.div.draggable=!this.isEmpty();this.div.classList.remove("editing");this.canvas.removeEventListener("pointerdown",this.#Ye);this.canvas.removeEventListener("pointerup",this.#Ke)}}onceAdded(){this.div.draggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}#ct(){const{parentRotation:e,parentDimensions:[t,i]}=this;switch(e){case 90:return[0,i,i,t];case 180:return[t,i,t,i];case 270:return[t,0,i,t];default:return[0,0,t,i]}}#ut(){const{ctx:e,color:t,opacity:i,thickness:n,parentScale:s,scaleFactor:r}=this;e.lineWidth=n*s/r;e.lineCap="round";e.lineJoin="round";e.miterLimit=10;e.strokeStyle=`${t}${(0,a.opacityToHex)(i)}`}#pt(e,t){this.isEditing=!0;if(!this.#Ze){this.#Ze=!0;this.#dt();this.thickness||=InkEditor._defaultThickness;this.color||=InkEditor._defaultColor||s.AnnotationEditor._defaultLineColor;this.opacity??=InkEditor._defaultOpacity}this.currentPath.push([e,t]);this.#Je=null;this.#ut();this.ctx.beginPath();this.ctx.moveTo(e,t);this.#nt=()=>{if(this.#nt){if(this.#Je){if(this.isEmpty()){this.ctx.setTransform(1,0,0,1,0,0);this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)}else this.#ot();this.ctx.lineTo(...this.#Je);this.#Je=null;this.ctx.stroke()}window.requestAnimationFrame(this.#nt)}};window.requestAnimationFrame(this.#nt)}#gt(e,t){const[i,n]=this.currentPath.at(-1);if(e!==i||t!==n){this.currentPath.push([e,t]);this.#Je=[e,t]}}#ft(e,t){this.ctx.closePath();this.#nt=null;e=Math.min(Math.max(e,0),this.canvas.width);t=Math.min(Math.max(t,0),this.canvas.height);const[i,n]=this.currentPath.at(-1);e===i&&t===n||this.currentPath.push([e,t]);let s;if(1!==this.currentPath.length)s=(0,r.fitCurve)(this.currentPath,30,null);else{const i=[e,t];s=[[i,i.slice(),i.slice(),i]]}const a=InkEditor.#mt(s);this.currentPath.length=0;this.addCommands({cmd:()=>{this.paths.push(s);this.bezierPath2D.push(a);this.rebuild()},undo:()=>{this.paths.pop();this.bezierPath2D.pop();if(0===this.paths.length)this.remove();else{if(!this.canvas){this.#lt();this.#ht()}this.#at()}},mustExec:!0})}#ot(){if(this.isEmpty()){this.#bt();return}this.#ut();const{canvas:e,ctx:t}=this;t.setTransform(1,0,0,1,0,0);t.clearRect(0,0,e.width,e.height);this.#bt();for(const e of this.bezierPath2D)t.stroke(e)}commit(){if(!this.#Qe){super.commit();this.isEditing=!1;this.disableEditMode();this.setInForeground();this.#Qe=!0;this.div.classList.add("disabled");this.#at(!0);this.parent.addInkEditorIfNeeded(!0);this.parent.moveEditorInDOM(this);this.div.focus({preventScroll:!0})}}focusin(e){super.focusin(e);this.enableEditMode()}canvasPointerdown(e){if(0===e.button&&this.isInEditMode()&&!this.#Qe){this.setInForeground();"mouse"!==e.type&&this.div.focus();e.stopPropagation();this.canvas.addEventListener("pointerleave",this.#Xe);this.canvas.addEventListener("pointermove",this.#$e);this.#pt(e.offsetX,e.offsetY)}}canvasPointermove(e){e.stopPropagation();this.#gt(e.offsetX,e.offsetY)}canvasPointerup(e){if(0===e.button&&this.isInEditMode()&&0!==this.currentPath.length){e.stopPropagation();this.#vt(e);this.setInBackground()}}canvasPointerleave(e){this.#vt(e);this.setInBackground()}#vt(e){this.#ft(e.offsetX,e.offsetY);this.canvas.removeEventListener("pointerleave",this.#Xe);this.canvas.removeEventListener("pointermove",this.#$e);this.addToAnnotationStorage()}#lt(){this.canvas=document.createElement("canvas");this.canvas.width=this.canvas.height=0;this.canvas.className="inkEditorCanvas";InkEditor._l10nPromise.get("editor_ink_canvas_aria_label").then((e=>this.canvas?.setAttribute("aria-label",e)));this.div.append(this.canvas);const e=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0}:void 0;this.ctx=this.canvas.getContext("2d",e)}#ht(){let e=null;this.#et=new ResizeObserver((t=>{const i=t[0].contentRect;if(i.width&&i.height){null!==e&&clearTimeout(e);e=setTimeout((()=>{this.fixDims();e=null}),100);this.setDimensions(i.width,i.height)}}));this.#et.observe(this.div)}render(){if(this.div)return this.div;let e,t;if(this.width){e=this.x;t=this.y}super.render();InkEditor._l10nPromise.get("editor_ink2_aria_label").then((e=>this.div?.setAttribute("aria-label",e)));const[i,n,s,r]=this.#ct();this.setAt(i,n,0,0);this.setDims(s,r);this.#lt();if(this.width){const[i,n]=this.parentDimensions;this.setAt(e*i,t*n,this.width*i,this.height*n);this.#Ze=!0;this.#dt();this.setDims(this.width*i,this.height*n);this.#ot();this.#wt();this.div.classList.add("disabled")}else{this.div.classList.add("editing");this.enableEditMode()}this.#ht();return this.div}#dt(){if(!this.#Ze)return;const[e,t]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*e);this.canvas.height=Math.ceil(this.height*t);this.#bt()}setDimensions(e,t){const i=Math.round(e),n=Math.round(t);if(this.#tt===i&&this.#it===n)return;this.#tt=i;this.#it=n;this.canvas.style.visibility="hidden";if(this.#ze&&Math.abs(this.#ze-e/t)>.01){t=Math.ceil(e/this.#ze);this.setDims(e,t)}const[s,r]=this.parentDimensions;this.width=e/s;this.height=t/r;this.#Qe&&this.#_t(e,t);this.#dt();this.#ot();this.canvas.style.visibility="visible"}#_t(e,t){const i=this.#yt(),n=(e-i)/this.#qe,s=(t-i)/this.#Ge;this.scaleFactor=Math.min(n,s)}#bt(){const e=this.#yt()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+e,this.translationY*this.scaleFactor+e)}static#mt(e){const t=new Path2D;for(let i=0,n=e.length;i<n;i++){const[n,s,r,a]=e[i];0===i&&t.moveTo(...n);t.bezierCurveTo(s[0],s[1],r[0],r[1],a[0],a[1])}return t}#St(e,t,i,n){const s=[],r=this.thickness/2;let a,o;for(const l of this.paths){a=[];o=[];for(let s=0,h=l.length;s<h;s++){const[h,d,c,u]=l[s],p=e*(h[0]+t)+r,g=n-e*(h[1]+i)-r,f=e*(d[0]+t)+r,m=n-e*(d[1]+i)-r,b=e*(c[0]+t)+r,v=n-e*(c[1]+i)-r,w=e*(u[0]+t)+r,_=n-e*(u[1]+i)-r;if(0===s){a.push(p,g);o.push(p,g)}a.push(f,m,b,v,w,_);this.#Pt(p,g,f,m,b,v,w,_,4,o)}s.push({bezier:a,points:o})}return s}#Pt(e,t,i,n,s,r,a,o,l,h){if(this.#At(e,t,i,n,s,r,a,o))h.push(a,o);else{for(let d=1;d<l-1;d++){const c=d/l,u=1-c;let p=c*e+u*i,g=c*t+u*n,f=c*i+u*s,m=c*n+u*r;p=c*p+u*f;g=c*g+u*m;f=c*f+u*(c*s+u*a);m=c*m+u*(c*r+u*o);p=c*p+u*f;g=c*g+u*m;h.push(p,g)}h.push(a,o)}}#At(e,t,i,n,s,r,a,o){const l=(3*i-2*e-a)**2,h=(3*n-2*t-o)**2,d=(3*s-e-2*a)**2,c=(3*r-t-2*o)**2;return Math.max(l,d)+Math.max(h,c)<=10}#Et(){let e=1/0,t=-1/0,i=1/0,s=-1/0;for(const r of this.paths)for(const[a,o,l,h]of r){const r=n.Util.bezierBoundingBox(...a,...o,...l,...h);e=Math.min(e,r[0]);i=Math.min(i,r[1]);t=Math.max(t,r[2]);s=Math.max(s,r[3])}return[e,i,t,s]}#yt(){return this.#Qe?Math.ceil(this.thickness*this.parentScale):0}#at(e=!1){if(this.isEmpty())return;if(!this.#Qe){this.#ot();return}const t=this.#Et(),i=this.#yt();this.#qe=Math.max(o,t[2]-t[0]);this.#Ge=Math.max(o,t[3]-t[1]);const n=Math.ceil(i+this.#qe*this.scaleFactor),s=Math.ceil(i+this.#Ge*this.scaleFactor),[r,a]=this.parentDimensions;this.width=n/r;this.height=s/a;this.#ze=n/s;this.#wt();const l=this.translationX,h=this.translationY;this.translationX=-t[0];this.translationY=-t[1];this.#dt();this.#ot();this.#tt=n;this.#it=s;this.setDims(n,s);const d=e?i/this.scaleFactor/2:0;this.translate(l-this.translationX-d,h-this.translationY-d)}#wt(){const{style:e}=this.div;if(this.#ze>=1){e.minHeight="16px";e.minWidth=`${Math.round(this.#ze*o)}px`}else{e.minWidth="16px";e.minHeight=`${Math.round(o/this.#ze)}px`}}static deserialize(e,t,i){const s=super.deserialize(e,t,i);s.thickness=e.thickness;s.color=n.Util.makeHexColor(...e.color);s.opacity=e.opacity;const[r,a]=s.pageDimensions,l=s.width*r,h=s.height*a,d=s.parentScale,c=e.thickness/2;s.#ze=l/h;s.#Qe=!0;s.#tt=Math.round(l);s.#it=Math.round(h);for(const{bezier:t}of e.paths){const e=[];s.paths.push(e);let i=d*(t[0]-c),n=d*(h-t[1]-c);for(let s=2,r=t.length;s<r;s+=6){const r=d*(t[s]-c),a=d*(h-t[s+1]-c),o=d*(t[s+2]-c),l=d*(h-t[s+3]-c),u=d*(t[s+4]-c),p=d*(h-t[s+5]-c);e.push([[i,n],[r,a],[o,l],[u,p]]);i=u;n=p}const r=this.#mt(e);s.bezierPath2D.push(r)}const u=s.#Et();s.#qe=Math.max(o,u[2]-u[0]);s.#Ge=Math.max(o,u[3]-u[1]);s.#_t(l,h);return s}serialize(){if(this.isEmpty())return null;const e=this.getRect(0,0),t=this.rotation%180==0?e[3]-e[1]:e[2]-e[0],i=s.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:n.AnnotationEditorType.INK,color:i,thickness:this.thickness,opacity:this.opacity,paths:this.#St(this.scaleFactor/this.parentScale,this.translationX,this.translationY,t),pageIndex:this.pageIndex,rect:e,rotation:this.rotation}}}t.InkEditor=InkEditor},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.fitCurve=void 0;const n=i(31);t.fitCurve=n},e=>{function fitCubic(e,t,i,n,s){var r,a,o,l,h,d,c,u,p,g,f,m,b;if(2===e.length){m=maths.vectorLen(maths.subtract(e[0],e[1]))/3;return[r=[e[0],maths.addArrays(e[0],maths.mulItems(t,m)),maths.addArrays(e[1],maths.mulItems(i,m)),e[1]]]}a=function chordLengthParameterize(e){var t,i,n,s=[];e.forEach(((e,r)=>{t=r?i+maths.vectorLen(maths.subtract(e,n)):0;s.push(t);i=t;n=e}));s=s.map((e=>e/i));return s}(e);[r,l,d]=generateAndReport(e,a,a,t,i,s);if(0===l||l<n)return[r];if(l<n*n){o=a;h=l;c=d;for(b=0;b<20;b++){o=reparameterize(r,e,o);[r,l,d]=generateAndReport(e,a,o,t,i,s);if(l<n)return[r];if(d===c){let e=l/h;if(e>.9999&&e<1.0001)break}h=l;c=d}}f=[];if((u=maths.subtract(e[d-1],e[d+1])).every((e=>0===e))){u=maths.subtract(e[d-1],e[d]);[u[0],u[1]]=[-u[1],u[0]]}p=maths.normalize(u);g=maths.mulItems(p,-1);return f=(f=f.concat(fitCubic(e.slice(0,d+1),t,p,n,s))).concat(fitCubic(e.slice(d),g,i,n,s))}function generateAndReport(e,t,i,n,s,r){var a,o,l;a=function generateBezier(e,t,i,n){var s,r,a,o,l,h,d,c,u,p,g,f,m,b,v,w,_,y=e[0],S=e[e.length-1];s=[y,null,null,S];r=maths.zeros_Xx2x2(t.length);for(m=0,b=t.length;m<b;m++){_=1-(w=t[m]);(a=r[m])[0]=maths.mulItems(i,3*w*(_*_));a[1]=maths.mulItems(n,3*_*(w*w))}o=[[0,0],[0,0]];l=[0,0];for(m=0,b=e.length;m<b;m++){w=t[m];a=r[m];o[0][0]+=maths.dot(a[0],a[0]);o[0][1]+=maths.dot(a[0],a[1]);o[1][0]+=maths.dot(a[0],a[1]);o[1][1]+=maths.dot(a[1],a[1]);v=maths.subtract(e[m],bezier.q([y,y,S,S],w));l[0]+=maths.dot(a[0],v);l[1]+=maths.dot(a[1],v)}h=o[0][0]*o[1][1]-o[1][0]*o[0][1];d=o[0][0]*l[1]-o[1][0]*l[0];c=l[0]*o[1][1]-l[1]*o[0][1];u=0===h?0:c/h;p=0===h?0:d/h;f=maths.vectorLen(maths.subtract(y,S));if(u<(g=1e-6*f)||p<g){s[1]=maths.addArrays(y,maths.mulItems(i,f/3));s[2]=maths.addArrays(S,maths.mulItems(n,f/3))}else{s[1]=maths.addArrays(y,maths.mulItems(i,u));s[2]=maths.addArrays(S,maths.mulItems(n,p))}return s}(e,i,n,s);[o,l]=function computeMaxError(e,t,i){var n,s,r,a,o,l,h,d;s=0;r=Math.floor(e.length/2);const c=mapTtoRelativeDistances(t,10);for(o=0,l=e.length;o<l;o++){h=e[o];d=find_t(t,i[o],c,10);if((n=(a=maths.subtract(bezier.q(t,d),h))[0]*a[0]+a[1]*a[1])>s){s=n;r=o}}return[s,r]}(e,a,t);r&&r({bez:a,points:e,params:t,maxErr:o,maxPoint:l});return[a,o,l]}function reparameterize(e,t,i){return i.map(((i,n)=>newtonRaphsonRootFind(e,t[n],i)))}function newtonRaphsonRootFind(e,t,i){var n=maths.subtract(bezier.q(e,i),t),s=bezier.qprime(e,i),r=maths.mulMatrix(n,s),a=maths.sum(maths.squareItems(s))+2*maths.mulMatrix(n,bezier.qprimeprime(e,i));return 0===a?i:i-r/a}var mapTtoRelativeDistances=function(e,t){for(var i,n=[0],s=e[0],r=0,a=1;a<=t;a++){i=bezier.q(e,a/t);r+=maths.vectorLen(maths.subtract(i,s));n.push(r);s=i}return n=n.map((e=>e/r))};function find_t(e,t,i,n){if(t<0)return 0;if(t>1)return 1;for(var s,r,a,o,l=1;l<=n;l++)if(t<=i[l]){a=(l-1)/n;r=l/n;o=(t-(s=i[l-1]))/(i[l]-s)*(r-a)+a;break}return o}function createTangent(e,t){return maths.normalize(maths.subtract(e,t))}class maths{static zeros_Xx2x2(e){for(var t=[];e--;)t.push([0,0]);return t}static mulItems(e,t){return e.map((e=>e*t))}static mulMatrix(e,t){return e.reduce(((e,i,n)=>e+i*t[n]),0)}static subtract(e,t){return e.map(((e,i)=>e-t[i]))}static addArrays(e,t){return e.map(((e,i)=>e+t[i]))}static addItems(e,t){return e.map((e=>e+t))}static sum(e){return e.reduce(((e,t)=>e+t))}static dot(e,t){return maths.mulMatrix(e,t)}static vectorLen(e){return Math.hypot(...e)}static divItems(e,t){return e.map((e=>e/t))}static squareItems(e){return e.map((e=>e*e))}static normalize(e){return this.divItems(e,this.vectorLen(e))}}class bezier{static q(e,t){var i=1-t,n=maths.mulItems(e[0],i*i*i),s=maths.mulItems(e[1],3*i*i*t),r=maths.mulItems(e[2],3*i*t*t),a=maths.mulItems(e[3],t*t*t);return maths.addArrays(maths.addArrays(n,s),maths.addArrays(r,a))}static qprime(e,t){var i=1-t,n=maths.mulItems(maths.subtract(e[1],e[0]),3*i*i),s=maths.mulItems(maths.subtract(e[2],e[1]),6*i*t),r=maths.mulItems(maths.subtract(e[3],e[2]),3*t*t);return maths.addArrays(maths.addArrays(n,s),r)}static qprimeprime(e,t){return maths.addArrays(maths.mulItems(maths.addArrays(maths.subtract(e[2],maths.mulItems(e[1],2)),e[0]),6*(1-t)),maths.mulItems(maths.addArrays(maths.subtract(e[3],maths.mulItems(e[2],2)),e[1]),6*t))}}e.exports=function fitCurve(e,t,i){if(!Array.isArray(e))throw new TypeError("First argument should be an array");e.forEach((t=>{if(!Array.isArray(t)||t.some((e=>"number"!=typeof e))||t.length!==e[0].length)throw Error("Each point should be an array of numbers. Each point should have the same amount of numbers.")}));if((e=e.filter(((t,i)=>0===i||!t.every(((t,n)=>t===e[i-1][n]))))).length<2)return[];const n=e.length,s=createTangent(e[1],e[0]),r=createTangent(e[n-2],e[n-1]);return fitCubic(e,s,r,t,i)};e.exports.fitCubic=fitCubic;e.exports.createTangent=createTangent},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.AnnotationLayer=void 0;var n=i(1),s=i(6),r=i(3),a=i(33),o=i(34);const l=1e3,h=new WeakSet;function getRectDims(e){return{width:e[2]-e[0],height:e[3]-e[1]}}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;t&&(this.container=this._createContainer(i));n&&(this.quadrilaterals=this._createQuadrilaterals(i))}_createContainer(e=!1){const{data:t,page:i,viewport:s}=this,r=document.createElement("section");r.setAttribute("data-annotation-id",t.id);const{pageWidth:a,pageHeight:o,pageX:l,pageY:h}=s.rawDims,{width:d,height:c}=getRectDims(t.rect),u=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]]);if(!e&&t.borderStyle.width>0){r.style.borderWidth=`${t.borderStyle.width}px`;const e=t.borderStyle.horizontalCornerRadius,i=t.borderStyle.verticalCornerRadius;if(e>0||i>0){const t=`calc(${e}px * var(--scale-factor)) / calc(${i}px * var(--scale-factor))`;r.style.borderRadius=t}else if(this instanceof RadioButtonWidgetAnnotationElement){const e=`calc(${d}px * var(--scale-factor)) / calc(${c}px * var(--scale-factor))`;r.style.borderRadius=e}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"}const s=t.borderColor||null;s?r.style.borderColor=n.Util.makeHexColor(0|s[0],0|s[1],0|s[2]):r.style.borderWidth=0}r.style.left=100*(u[0]-l)/a+"%";r.style.top=100*(u[1]-h)/o+"%";const{rotation:p}=t;if(t.hasOwnCanvas||0===p){r.style.width=100*d/a+"%";r.style.height=100*c/o+"%"}else this.setRotation(p,r);return r}setRotation(e,t=this.container){const{pageWidth:i,pageHeight:n}=this.viewport.rawDims,{width:s,height:r}=getRectDims(this.data.rect);let a,o;if(e%180==0){a=100*s/i;o=100*r/n}else{a=100*r/i;o=100*s/n}t.style.width=`${a}%`;t.style.height=`${o}%`;t.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const setColor=(e,t,i)=>{const n=i.detail[e];i.target.style[t]=a.ColorConverters[`${n[0]}_HTML`](n.slice(1))};return(0,n.shadow)(this,"_commonActions",{display:e=>{const t=e.detail.display%2==1;this.container.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=>{this.container.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=>{this._setRequired(e.target,e.detail.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)},rotation:e=>{const t=e.detail.rotation;this.setRotation(t);this.annotationStorage.setValue(this.data.id,this.data.fieldName,{rotation:t})}})}_dispatchEventFromSandbox(e,t){const i=this._commonActions;for(const n of Object.keys(t.detail)){(e[n]||i[n])?.(t)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;const i=this._commonActions;for(const[n,s]of Object.entries(t)){const r=i[n];if(r){r({detail:{[n]:s},target:e});delete t[n]}}}_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")).className="popupTriggerArea";i.append(e)}const n=new PopupElement({container:i,trigger:e,color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,richText:t.richText,hideWrapper:!0}).render();n.style.left="100%";i.append(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.querySelector(`[data-element-id="${r}"]`);!o||h.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{exportValue:e}=n,s=n.getAttribute("data-element-id");s!==t&&(h.has(n)&&i.push({id:s,exportValue:e,domElement:n}))}return i}}class LinkAnnotationElement extends AnnotationElement{constructor(e,t=null){super(e,{isRenderable:!0,ignoreBorder:!!t?.ignoreBorder,createQuadrilaterals:!0});this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:t}=this,i=document.createElement("a");i.setAttribute("data-element-id",e.id);let n=!1;if(e.url){t.addLinkAttributes(i,e.url,e.newWindow);n=!0}else if(e.action){this._bindNamedAction(i,e.action);n=!0}else if(e.attachment){this._bindAttachment(i,e.attachment);n=!0}else if(e.setOCGState){this.#Ct(i,e.setOCGState);n=!0}else if(e.dest){this._bindLink(i,e.dest);n=!0}else{if(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions){this._bindJSAction(i,e);n=!0}if(e.resetForm){this._bindResetFormAction(i,e.resetForm);n=!0}else if(this.isTooltipOnly&&!n){this._bindLink(i,"");n=!0}}if(this.quadrilaterals)return this._renderQuadrilaterals("linkAnnotation").map(((e,t)=>{const n=0===t?i:i.cloneNode();e.append(n);return e}));this.container.className="linkAnnotation";n&&this.container.append(i);return this.container}#xt(){this.container.setAttribute("data-internal-link","")}_bindLink(e,t){e.href=this.linkService.getDestinationHash(t);e.onclick=()=>{t&&this.linkService.goToDestination(t);return!1};(t||""===t)&&this.#xt()}_bindNamedAction(e,t){e.href=this.linkService.getAnchorUrl("");e.onclick=()=>{this.linkService.executeNamedAction(t);return!1};this.#xt()}_bindAttachment(e,t){e.href=this.linkService.getAnchorUrl("");e.onclick=()=>{this.downloadManager?.openOrDownloadData(this.container,t.content,t.filename);return!1};this.#xt()}#Ct(e,t){e.href=this.linkService.getAnchorUrl("");e.onclick=()=>{this.linkService.executeSetOCGState(t);return!1};this.#xt()}_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);this.#xt()}_bindResetFormAction(e,t){const i=e.onclick;i||(e.href=this.linkService.getAnchorUrl(""));this.#xt();if(this._fieldObjects)e.onclick=()=>{i?.();const{fields:e,refs:s,include:r}=t,a=[];if(0!==e.length||0!==s.length){const t=new Set(s);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)===r&&a.push(i)}else for(const e of Object.values(this._fieldObjects))a.push(...e);const o=this.annotationStorage,l=[];for(const e of a){const{id:t}=e;l.push(t);switch(e.type){case"text":{const i=e.defaultValue||"";o.setValue(t,this.data.fieldName,{value:i});break}case"checkbox":case"radiobutton":{const i=e.defaultValue===e.exportValues;o.setValue(t,this.data.fieldName,{value:i});break}case"combobox":case"listbox":{const i=e.defaultValue||"";o.setValue(t,this.data.fieldName,{value:i});break}default:continue}const i=document.querySelector(`[data-element-id="${t}"]`);i&&(h.has(i)?i.dispatchEvent(new Event("resetform")):(0,n.warn)(`_bindResetFormAction - element not allowed: ${t}`))}this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:l,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||e.data.richText?.str)})}render(){this.container.className="textAnnotation";const e=document.createElement("img");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.append(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}=n.FeatureTest.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:n(e)}})}))}_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])}_setTextStyle(e){const t=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,s=this.data.defaultAppearanceData.fontSize||9,r=e.style;let a;const roundToOneDecimal=e=>Math.round(10*e)/10;if(this.data.multiLine){const e=Math.abs(this.data.rect[3]-this.data.rect[1]-2),t=e/(Math.round(e/(n.LINE_FACTOR*s))||1);a=Math.min(s,roundToOneDecimal(t/n.LINE_FACTOR))}else{const e=Math.abs(this.data.rect[3]-this.data.rect[1]-2);a=Math.min(s,roundToOneDecimal(e/n.LINE_FACTOR))}r.fontSize=`calc(${a}px * var(--scale-factor))`;r.color=n.Util.makeHexColor(i[0],i[1],i[2]);null!==this.data.textAlignment&&(r.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required");e.setAttribute("aria-required",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});let s=n.formattedValue||n.value||"";const r=e.getValue(t,this.data.fieldName,{charLimit:this.data.maxLen}).charLimit;r&&s.length>r&&(s=s.slice(0,r));const a={userValue:s,formattedValue:null,lastCommittedValue:null,commitKey:1};if(this.data.multiLine){i=document.createElement("textarea");i.textContent=s;this.data.doNotScroll&&(i.style.overflowY="hidden")}else{i=document.createElement("input");i.type="text";i.setAttribute("value",s);this.data.doNotScroll&&(i.style.overflowX="hidden")}h.add(i);i.setAttribute("data-element-id",t);i.disabled=this.data.readOnly;i.name=this.data.fieldName;i.tabIndex=l;this._setRequired(i,this.data.required);r&&(i.maxLength=r);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=a.userValue=t;a.formattedValue=null}));let blurListener=e=>{const{formattedValue:t}=a;null!=t&&(e.target.value=t);e.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",(e=>{const{target:t}=e;a.userValue&&(t.value=a.userValue);a.lastCommittedValue=t.value;a.commitKey=1}));const n=this.data.fieldName;i.addEventListener("updatefromsandbox",(i=>{const s={value(i){a.userValue=i.detail.value??"";e.setValue(t,n,{value:a.userValue.toString()});i.target.value=a.userValue},formattedValue(i){const{formattedValue:s}=i.detail;a.formattedValue=s;null!=s&&i.target!==document.activeElement&&(i.target.value=s);e.setValue(t,n,{formattedValue:s})},selRange(e){e.target.setSelectionRange(...e.detail.selRange)},charLimit:i=>{const{charLimit:n}=i.detail,{target:s}=i;if(0===n){s.removeAttribute("maxLength");return}s.setAttribute("maxLength",n);let r=a.userValue;if(r&&!(r.length<=n)){r=r.slice(0,n);s.value=a.userValue=r;e.setValue(t,this.data.fieldName,{value:r});this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:r,willCommit:!0,commitKey:1,selStart:s.selectionStart,selEnd:s.selectionEnd}})}}};this._dispatchEventFromSandbox(s,i)}));i.addEventListener("keydown",(e=>{a.commitKey=1;let i=-1;"Escape"===e.key?i=0:"Enter"!==e.key||this.data.multiLine?"Tab"===e.key&&(a.commitKey=3):i=2;if(-1===i)return;const{value:n}=e.target;if(a.lastCommittedValue!==n){a.lastCommittedValue=n;a.userValue=n;this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:n,willCommit:!0,commitKey:i,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}})}}));const s=blurListener;blurListener=null;i.addEventListener("blur",(e=>{if(!e.relatedTarget)return;const{value:i}=e.target;a.userValue=i;a.lastCommittedValue!==i&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:i,willCommit:!0,commitKey:a.commitKey,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}});s(e)}));this.data.actions?.Keystroke&&i.addEventListener("beforeinput",(e=>{a.lastCommittedValue=null;const{data:i,target:n}=e,{value:s,selectionStart:r,selectionEnd:o}=n;let l=r,h=o;switch(e.inputType){case"deleteWordBackward":{const e=s.substring(0,r).match(/\w*[^\w]*$/);e&&(l-=e[0].length);break}case"deleteWordForward":{const e=s.substring(r).match(/^[^\w]*\w*/);e&&(h+=e[0].length);break}case"deleteContentBackward":r===o&&(l-=1);break;case"deleteContentForward":r===o&&(h+=1)}e.preventDefault();this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:s,change:i||"",willCommit:!1,selStart:l,selEnd:h}})}));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);if(this.data.comb){const e=(this.data.rect[2]-this.data.rect[0])/r;i.classList.add("comb");i.style.letterSpacing=`calc(${e}px * var(--scale-factor) - 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._setDefaultPropertiesFromJS(i);this.container.append(i);return this.container}}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");h.add(s);s.setAttribute("data-element-id",i);s.disabled=t.readOnly;this._setRequired(s,this.data.required);s.type="checkbox";s.name=t.fieldName;n&&s.setAttribute("checked",!0);s.setAttribute("exportValue",t.exportValue);s.tabIndex=l;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,emitMessage:!1})}e.setValue(i,this.data.fieldName,{value:r,exportValue:r?t.exportValue:null})}));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._setDefaultPropertiesFromJS(s);this.container.append(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");h.add(s);s.setAttribute("data-element-id",i);s.disabled=t.readOnly;this._setRequired(s,this.data.required);s.type="radio";s.name=t.fieldName;n&&s.setAttribute("checked",!0);s.tabIndex=l;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._setDefaultPropertiesFromJS(s);this.container.append(s);return this.container}}class PushButtonWidgetAnnotationElement extends LinkAnnotationElement{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.className="buttonWidgetAnnotation pushButton";this.data.alternativeText&&(e.title=this.data.alternativeText);const t=e.lastChild;if(this.enableScripting&&this.hasJSActions&&t){this._setDefaultPropertiesFromJS(t);t.addEventListener("updatefromsandbox",(e=>{this._dispatchEventFromSandbox({},e)}))}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}),n=document.createElement("select");h.add(n);n.setAttribute("data-element-id",t);n.disabled=this.data.readOnly;this._setRequired(n,this.data.required);n.name=this.data.fieldName;n.tabIndex=l;let s=this.data.combo&&this.data.options.length>0;if(!this.data.combo){n.size=this.data.options.length;this.data.multiSelect&&(n.multiple=!0)}n.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue;for(const e of n.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;if(i.value.includes(e.exportValue)){t.setAttribute("selected",!0);s=!1}n.append(t)}let r=null;if(s){const e=document.createElement("option");e.value=" ";e.setAttribute("hidden",!0);e.setAttribute("selected",!0);n.prepend(e);r=()=>{e.remove();n.removeEventListener("input",r);r=null};n.addEventListener("input",r)}const getValue=e=>{const t=e?"value":"textContent",{options:i,multiple:s}=n;return s?Array.prototype.filter.call(i,(e=>e.selected)).map((e=>e[t])):-1===i.selectedIndex?null:i[i.selectedIndex][t]};let a=getValue(!1);const 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){n.addEventListener("updatefromsandbox",(i=>{const s=this.data.fieldName,o={value(i){r?.();const o=i.detail.value,l=new Set(Array.isArray(o)?o:[o]);for(const e of n.options)e.selected=l.has(e.value);e.setValue(t,s,{value:getValue(!0)});a=getValue(!1)},multipleSelection(e){n.multiple=!0},remove(i){const r=n.options,o=i.detail.remove;r[o].selected=!1;n.remove(o);if(r.length>0){-1===Array.prototype.findIndex.call(r,(e=>e.selected))&&(r[0].selected=!0)}e.setValue(t,s,{value:getValue(!0),items:getItems(i)});a=getValue(!1)},clear(i){for(;0!==n.length;)n.remove(0);e.setValue(t,s,{value:null,items:[]});a=getValue(!1)},insert(i){const{index:r,displayValue:o,exportValue:l}=i.detail.insert,h=n.children[r],d=document.createElement("option");d.textContent=o;d.value=l;h?h.before(d):n.append(d);e.setValue(t,s,{value:getValue(!0),items:getItems(i)});a=getValue(!1)},items(i){const{items:r}=i.detail;for(;0!==n.length;)n.remove(0);for(const e of r){const{displayValue:t,exportValue:i}=e,s=document.createElement("option");s.textContent=t;s.value=i;n.append(s)}n.options.length>0&&(n.options[0].selected=!0);e.setValue(t,s,{value:getValue(!0),items:getItems(i)});a=getValue(!1)},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,s,{value:getValue(!0)});a=getValue(!1)},editable(e){e.target.disabled=!e.detail.editable}};this._dispatchEventFromSandbox(o,i)}));n.addEventListener("input",(i=>{const n=getValue(!0);e.setValue(t,{value:n});i.preventDefault();this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:a,changeEx:n,willCommit:!1,commitKey:1,keyDown:!1}})}));this._setEventListeners(n,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],(e=>e.target.value))}else{const i=this.data.fieldName;n.addEventListener("input",(function(n){e.setValue(t,i,{value:getValue(!0),radioValue:getValue(!0)})}))}this.data.combo&&this._setTextStyle(n);this._setBackgroundColor(n);this._setDefaultPropertiesFromJS(n);this.container.append(n);return this.container}}class PopupAnnotationElement extends AnnotationElement{static IGNORE_TYPES=new Set(["Line","Square","Circle","PolyLine","Polygon","Ink"]);constructor(e){const{data:t}=e;super(e,{isRenderable:!PopupAnnotationElement.IGNORE_TYPES.has(t.parentType)&&!!(t.titleObj?.str||t.contentsObj?.str||t.richText?.str)})}render(){this.container.className="popupAnnotation";const e=this.layer.querySelectorAll(`[data-annotation-id="${this.data.parentId}"]`);if(0===e.length)return this.container;const t=new PopupElement({container:this.container,trigger:Array.from(e),color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText}),i=this.page,s=n.Util.normalizeRect([this.data.parentRect[0],i.view[3]-this.data.parentRect[1]+i.view[1],this.data.parentRect[2],i.view[3]-this.data.parentRect[3]+i.view[1]]),r=s[0]+this.data.parentRect[2]-this.data.parentRect[0],a=s[1],{pageWidth:o,pageHeight:l,pageX:h,pageY:d}=this.viewport.rawDims;this.container.style.left=100*(r-h)/o+"%";this.container.style.top=100*(a-d)/l+"%";this.container.append(t.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.richText=e.richText;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.append(r);const a=s.PDFDateString.toDateObject(this.modificationDate);if(a){const e=document.createElement("span");e.className="popupDate";e.textContent="{{date}}, {{time}}";e.dataset.l10nId="annotation_date_string";e.dataset.l10nArgs=JSON.stringify({date:a.toLocaleDateString(),time:a.toLocaleTimeString()});t.append(e)}if(!this.richText?.str||this.contentsObj?.str&&this.contentsObj.str!==this.richText.str){const e=this._formatContents(this.contentsObj);t.append(e)}else{o.XfaLayer.render({xfaHtml:this.richText.html,intent:"richText",div:t});t.lastChild.className="richText popupContent"}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.append(t);return e}_formatContents({str:e,dir:t}){const i=document.createElement("p");i.className="popupContent";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.append(document.createTextNode(s));e<t-1&&i.append(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=parseInt(this.container.style.zIndex)+1e3}}_hide(e=!0){e&&(this.pinned=!1);if(!this.hideElement.hidden&&!this.pinned){this.hideElement.hidden=!0;this.container.style.zIndex=parseInt(this.container.style.zIndex)-1e3}}}class FreeTextAnnotationElement extends AnnotationElement{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0});this.textContent=e.data.textContent}render(){this.container.className="freeTextAnnotation";if(this.textContent){const e=document.createElement("div");e.className="annotationTextContent";e.setAttribute("role","comment");for(const t of this.textContent){const i=document.createElement("span");i.textContent=t;e.append(i)}this.container.append(e)}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||e.data.richText?.str),ignoreBorder:!0})}render(){this.container.className="lineAnnotation";const e=this.data,{width:t,height:i}=getRectDims(e.rect),n=this.svgFactory.create(t,i,!0),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");s.setAttribute("fill","transparent");n.append(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||e.data.richText?.str),ignoreBorder:!0})}render(){this.container.className="squareAnnotation";const e=this.data,{width:t,height:i}=getRectDims(e.rect),n=this.svgFactory.create(t,i,!0),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","transparent");n.append(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||e.data.richText?.str),ignoreBorder:!0})}render(){this.container.className="circleAnnotation";const e=this.data,{width:t,height:i}=getRectDims(e.rect),n=this.svgFactory.create(t,i,!0),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","transparent");n.append(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||e.data.richText?.str),ignoreBorder:!0});this.containerClassName="polylineAnnotation";this.svgElementName="svg:polyline"}render(){this.container.className=this.containerClassName;const e=this.data,{width:t,height:i}=getRectDims(e.rect),n=this.svgFactory.create(t,i,!0);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","transparent");n.append(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||e.data.richText?.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||e.data.richText?.str),ignoreBorder:!0});this.containerClassName="inkAnnotation";this.svgElementName="svg:polyline"}render(){this.container.className=this.containerClassName;const e=this.data,{width:t,height:i}=getRectDims(e.rect),n=this.svgFactory.create(t,i,!0);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","transparent");this._createPopup(s,e);n.append(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||e.data.richText?.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||e.data.richText?.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||e.data.richText?.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||e.data.richText?.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||e.data.richText?.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,!0);this.content=i;this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,filename:t,content:i})}render(){this.container.className="fileAttachmentAnnotation";let e;if(this.data.hasAppearance)e=document.createElement("div");else{e=document.createElement("img");e.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(this.data.name)?"paperclip":"pushpin"}.svg`}e.className="popupTriggerArea";e.addEventListener("dblclick",this._download.bind(this));!this.data.hasPopup&&(this.data.titleObj?.str||this.data.contentsObj?.str||this.data.richText)&&this._createPopup(e,this.data);this.container.append(e);return this.container}_download(){this.downloadManager?.openOrDownloadData(this.container,this.content,this.filename)}}class AnnotationLayer{static#Tt(e,t,i,n){const r=e.firstChild||e;r.id=`${s.AnnotationPrefix}${t}`;i.append(e);n?.moveElementInDOM(i,e,r,!1)}static render(e){const{annotations:t,div:i,viewport:a,accessibilityManager:o}=e;(0,s.setLayerDimensions)(i,a);const l={data:null,layer:i,page:e.page,viewport:a,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:!1!==e.renderForms,svgFactory:new s.DOMSVGFactory,annotationStorage:e.annotationStorage||new r.AnnotationStorage,enableScripting:!0===e.enableScripting,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects};let h=0;window.registerAcroformAnnotations&&window.registerAcroformAnnotations(t);for(const e of t){if(e.annotationType!==n.AnnotationType.POPUP){const{width:t,height:i}=getRectDims(e.rect);if(t<=0||i<=0)continue}l.data=e;const t=AnnotationElementFactory.create(l);if(!t.isRenderable)continue;const s=t.render();e.hidden&&(s.style.visibility="hidden");if(Array.isArray(s))for(const t of s){t.style.zIndex=h++;AnnotationLayer.#Tt(t,e.id,i,o)}else{s.style.zIndex=h++;t instanceof PopupAnnotationElement?i.prepend(s):AnnotationLayer.#Tt(s,e.id,i,o)}}this.#Mt(i,e.annotationCanvasMap)}static update(e){const{annotationCanvasMap:t,div:i,viewport:n}=e;(0,s.setLayerDimensions)(i,{rotation:n.rotation});this.#Mt(i,t);i.hidden=!1}static#Mt(e,t){if(t){for(const[i,n]of t){const t=e.querySelector(`[data-annotation-id="${i}"]`);if(!t)continue;const{firstChild:s}=t;s?"CANVAS"===s.nodeName?s.replaceWith(n):s.before(n):t.append(n)}t.clear()}}}t.AnnotationLayer=AnnotationLayer},(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){const t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}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.XfaLayer=void 0;var n=i(19);t.XfaLayer=class XfaLayer{static setupStorage(e,t,i,n,s){let r=t,a=e;for(;a;){if(a.getAttribute("xfaname")){r=a.getAttribute("xfaname");break}a=a.parentElement}const o=n.getValue(t,r,{value:null});switch(i.name){case"textarea":null!==o.value&&(e.textContent=o.value);if("print"===s)break;e.addEventListener("input",(e=>{n.setValue(t,r,{value:e.target.value})}));break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){o.value===i.attributes.xfaOn?e.setAttribute("checked",!0):o.value===i.attributes.xfaOff&&e.removeAttribute("checked");if("print"===s)break;e.addEventListener("change",(e=>{n.setValue(t,r,{value:e.target.checked?e.target.getAttribute("xfaOn"):e.target.getAttribute("xfaOff")})}))}else{null!==o.value&&e.setAttribute("value",o.value);if("print"===s)break;e.addEventListener("input",(e=>{n.setValue(t,r,{value:e.target.value})}))}break;case"select":if(null!==o.value)for(const e of i.children)e.attributes.value===o.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,r,{value:s})}))}}static setAttributes({html:e,element:t,storage:i=null,intent:n,linkService:s}){const{attributes:r}=t,a=e instanceof HTMLAnchorElement;"radio"===r.type&&(r.name=`${r.name}-${n}`);for(const[t,i]of Object.entries(r))if(null!=i)switch(t){case"class":i.length&&e.setAttribute(t,i.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",i);break;case"style":Object.assign(e.style,i);break;case"textContent":e.textContent=i;break;default:(!a||"href"!==t&&"newWindow"!==t)&&e.setAttribute(t,i)}a&&s.addLinkAttributes(e,r.href,r.newWindow);i&&r.dataId&&this.setupStorage(e,r.dataId,t,i)}static render(e){const t=e.annotationStorage,i=e.linkService,s=e.xfaHtml,r=e.intent||"display",a=document.createElement(s.name);s.attributes&&this.setAttributes({html:a,element:s,intent:r,linkService:i});const o=[[s,-1,a]],l=e.div;l.append(a);if(e.viewport){const t=`matrix(${e.viewport.transform.join(",")})`;l.style.transform=t}"richText"!==r&&l.setAttribute("class","xfaLayer xfaFont");const h=[];for(;o.length>0;){const[e,s,a]=o.at(-1);if(s+1===e.children.length){o.pop();continue}const l=e.children[++o.at(-1)[1]];if(null===l)continue;const{name:d}=l;if("#text"===d){const e=document.createTextNode(l.value);h.push(e);a.append(e);continue}let c;c=l?.attributes?.xmlns?document.createElementNS(l.attributes.xmlns,d):document.createElement(d);a.append(c);l.attributes&&this.setAttributes({html:c,element:l,storage:t,intent:r,linkService:i});if(l.children&&l.children.length>0)o.push([l,-1,c]);else if(l.value){const e=document.createTextNode(l.value);n.XfaText.shouldBuildText(d)&&h.push(e);c.append(e)}}for(const e of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))e.setAttribute("readOnly",!0);return{textDivs:h}}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.SVGGraphics=void 0;var n=i(6),s=i(1);i(10);let r=class{constructor(){(0,s.unreachable)("Not implemented: SVGGraphics")}};t.SVGGraphics=r;{const a={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},o="http://www.w3.org/XML/1998/namespace",l="http://www.w3.org/1999/xlink",h=["butt","round","square"],d=["miter","round","bevel"],createObjectURL=function(e,t="",i=!1){if(URL.createObjectURL&&"undefined"!=typeof Blob&&!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},c=function(){const e=new Uint8Array([137,80,78,71,13,10,26,10]),t=12,i=new Int32Array(256);for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t=1&t?3988292384^t>>1&2147483647:t>>1&2147483647;i[e]=t}function writePngChunk(e,t,n,s){let r=s;const a=t.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(t,r);r+=t.length;const o=function crc32(e,t,n){let s=-1;for(let r=t;r<n;r++){const t=255&(s^e[r]);s=s>>>8^i[t]}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(i,n,r){return function encode(i,n,r,a){const o=i.width,l=i.height;let h,d,c;const u=i.data;switch(n){case s.ImageKind.GRAYSCALE_1BPP:d=0;h=1;c=o+7>>3;break;case s.ImageKind.RGB_24BPP:d=2;h=8;c=3*o;break;case s.ImageKind.RGBA_32BPP:d=6;h=8;c=4*o;break;default:throw new Error("invalid format")}const p=new Uint8Array((1+c)*l);let g=0,f=0;for(let e=0;e<l;++e){p[g++]=0;p.set(u.subarray(f,f+c),g);f+=c;g+=c}if(n===s.ImageKind.GRAYSCALE_1BPP&&a){g=0;for(let e=0;e<l;e++){g++;for(let e=0;e<c;e++)p[g++]^=255}}const m=new Uint8Array([o>>24&255,o>>16&255,o>>8&255,255&o,l>>24&255,l>>16&255,l>>8&255,255&l,h,d,0,0,0]),b=deflateSync(p),v=e.length+3*t+m.length+b.length,w=new Uint8Array(v);let _=0;w.set(e,_);_+=e.length;writePngChunk("IHDR",m,w,_);_+=t+m.length;writePngChunk("IDATA",b,w,_);_+=t+b.length;writePngChunk("IEND",new Uint8Array(0),w,_);return createObjectURL(w,"image/png",r)}(i,void 0===i.kind?s.ImageKind.GRAYSCALE_1BPP:i.kind,n,r)}}();class SVGExtraState{constructor(){this.fontSizeScale=1;this.fontWeight=a.fontWeight;this.fontSize=0;this.textMatrix=s.IDENTITY_MATRIX;this.fontMatrix=s.FONT_IDENTITY_MATRIX;this.leading=0;this.textRenderingMode=s.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=a.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.at(-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 u=0,p=0,g=0;t.SVGGraphics=r=class{constructor(e,t,i=!1){(0,n.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future.");this.svgFactory=new n.DOMSVGFactory;this.current=new SVGExtraState;this.transformMatrix=s.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 s.OPS)this._operatorIdMapping[s.OPS[e]]=e}getObject(e,t=null){return"string"==typeof e?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}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,n=t.length;e<n;e++)if(t[e]===s.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,n,r,a){const o=[e,t,i,n,r,a];this.transformMatrix=s.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=s.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,n=t.args;switch(0|i){case s.OPS.beginText:this.beginText();break;case s.OPS.dependency:break;case s.OPS.setLeading:this.setLeading(n);break;case s.OPS.setLeadingMoveText:this.setLeadingMoveText(n[0],n[1]);break;case s.OPS.setFont:this.setFont(n);break;case s.OPS.showText:case s.OPS.showSpacedText:this.showText(n[0]);break;case s.OPS.endText:this.endText();break;case s.OPS.moveText:this.moveText(n[0],n[1]);break;case s.OPS.setCharSpacing:this.setCharSpacing(n[0]);break;case s.OPS.setWordSpacing:this.setWordSpacing(n[0]);break;case s.OPS.setHScale:this.setHScale(n[0]);break;case s.OPS.setTextMatrix:this.setTextMatrix(n[0],n[1],n[2],n[3],n[4],n[5]);break;case s.OPS.setTextRise:this.setTextRise(n[0]);break;case s.OPS.setTextRenderingMode:this.setTextRenderingMode(n[0]);break;case s.OPS.setLineWidth:this.setLineWidth(n[0]);break;case s.OPS.setLineJoin:this.setLineJoin(n[0]);break;case s.OPS.setLineCap:this.setLineCap(n[0]);break;case s.OPS.setMiterLimit:this.setMiterLimit(n[0]);break;case s.OPS.setFillRGBColor:this.setFillRGBColor(n[0],n[1],n[2]);break;case s.OPS.setStrokeRGBColor:this.setStrokeRGBColor(n[0],n[1],n[2]);break;case s.OPS.setStrokeColorN:this.setStrokeColorN(n);break;case s.OPS.setFillColorN:this.setFillColorN(n);break;case s.OPS.shadingFill:this.shadingFill(n[0]);break;case s.OPS.setDash:this.setDash(n[0],n[1]);break;case s.OPS.setRenderingIntent:this.setRenderingIntent(n[0]);break;case s.OPS.setFlatness:this.setFlatness(n[0]);break;case s.OPS.setGState:this.setGState(n[0]);break;case s.OPS.fill:this.fill();break;case s.OPS.eoFill:this.eoFill();break;case s.OPS.stroke:this.stroke();break;case s.OPS.fillStroke:this.fillStroke();break;case s.OPS.eoFillStroke:this.eoFillStroke();break;case s.OPS.clip:this.clip("nonzero");break;case s.OPS.eoClip:this.clip("evenodd");break;case s.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case s.OPS.paintImageXObject:this.paintImageXObject(n[0]);break;case s.OPS.paintInlineImageXObject:this.paintInlineImageXObject(n[0]);break;case s.OPS.paintImageMaskXObject:this.paintImageMaskXObject(n[0]);break;case s.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(n[0],n[1]);break;case s.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case s.OPS.closePath:this.closePath();break;case s.OPS.closeStroke:this.closeStroke();break;case s.OPS.closeFillStroke:this.closeFillStroke();break;case s.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case s.OPS.nextLine:this.nextLine();break;case s.OPS.transform:this.transform(n[0],n[1],n[2],n[3],n[4],n[5]);break;case s.OPS.constructPath:this.constructPath(n[0],n[1]);break;case s.OPS.endPath:this.endPath();break;case 92:this.group(t.items);break;default:(0,s.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.append(a.tspan)}beginText(){const e=this.current;e.x=e.lineX=0;e.y=e.lineY=0;e.textMatrix=s.IDENTITY_MATRIX;e.lineMatrix=s.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(e){const t=this.current,i=t.font,n=t.fontSize;if(0===n)return;const r=t.fontSizeScale,l=t.charSpacing,h=t.wordSpacing,d=t.fontDirection,c=t.textHScale*d,u=i.vertical,p=u?1:-1,g=i.defaultVMetrics,f=n*t.fontMatrix[0];let m=0;for(const s of e){if(null===s){m+=d*h;continue}if("number"==typeof s){m+=p*s*n/1e3;continue}const e=(s.isSpace?h:0)+l,a=s.fontChar;let o,c,b,v=s.width;if(u){let e;const t=s.vmetric||g;e=s.vmetric?t[1]:.5*v;e=-e*f;const i=t[2]*f;v=t?-t[0]:v;o=e/r;c=(m+i)/r}else{o=m/r;c=0}if(s.isInFont||i.missingFile){t.xcoords.push(t.x+o);u&&t.ycoords.push(-t.y+c);t.tspan.textContent+=a}b=u?v*f-e*d:v*f+e*d;m+=b}t.tspan.setAttributeNS(null,"x",t.xcoords.map(pf).join(" "));u?t.tspan.setAttributeNS(null,"y",t.ycoords.map(pf).join(" ")):t.tspan.setAttributeNS(null,"y",pf(-t.y));u?t.y-=m:t.x+=m*c;t.tspan.setAttributeNS(null,"font-family",t.fontFamily);t.tspan.setAttributeNS(null,"font-size",`${pf(t.fontSize)}px`);t.fontStyle!==a.fontStyle&&t.tspan.setAttributeNS(null,"font-style",t.fontStyle);t.fontWeight!==a.fontWeight&&t.tspan.setAttributeNS(null,"font-weight",t.fontWeight);const b=t.textRenderingMode&s.TextRenderingMode.FILL_STROKE_MASK;if(b===s.TextRenderingMode.FILL||b===s.TextRenderingMode.FILL_STROKE){t.fillColor!==a.fillColor&&t.tspan.setAttributeNS(null,"fill",t.fillColor);t.fillAlpha<1&&t.tspan.setAttributeNS(null,"fill-opacity",t.fillAlpha)}else t.textRenderingMode===s.TextRenderingMode.ADD_TO_PATH?t.tspan.setAttributeNS(null,"fill","transparent"):t.tspan.setAttributeNS(null,"fill","none");if(b===s.TextRenderingMode.STROKE||b===s.TextRenderingMode.FILL_STROKE){const e=1/(t.textMatrixScale||1);this._setStrokeAttributes(t.tspan,e)}let v=t.textMatrix;if(0!==t.textRise){v=v.slice();v[5]+=t.textRise}t.txtElement.setAttributeNS(null,"transform",`${pm(v)} scale(${pf(c)}, -1)`);t.txtElement.setAttributeNS(o,"xml:space","preserve");t.txtElement.append(t.tspan);t.txtgrp.append(t.txtElement);this._ensureTransformGroup().append(t.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.append(this.cssStyle)}const t=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 n=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||s.FONT_IDENTITY_MATRIX;let r="normal";i.black?r="900":i.bold&&(r="bold");const a=i.italic?"italic":"normal";if(n<0){n=-n;t.fontDirection=-1}else t.fontDirection=1;t.fontSize=n;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&s.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=h[e]}setLineJoin(e){this.current.lineJoin=d[e]}setMiterLimit(e){this.current.miterLimit=e}setStrokeAlpha(e){this.current.strokeAlpha=e}setStrokeRGBColor(e,t,i){this.current.strokeColor=s.Util.makeHexColor(e,t,i)}setFillAlpha(e){this.current.fillAlpha=e}setFillRGBColor(e,t,i){this.current.fillColor=s.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,n=s.Util.inverseTransform(this.transformMatrix),r=s.Util.applyTransform([0,0],n),a=s.Util.applyTransform([0,i],n),o=s.Util.applyTransform([t,0],n),l=s.Util.applyTransform([t,i],n),h=Math.min(r[0],a[0],o[0],l[0]),d=Math.min(r[1],a[1],o[1],l[1]),c=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",d);p.setAttributeNS(null,"width",c-h);p.setAttributeNS(null,"height",u-d);p.setAttributeNS(null,"fill",this._makeShadingPattern(e));this.current.fillAlpha<1&&p.setAttributeNS(null,"fill-opacity",this.current.fillAlpha);this._ensureTransformGroup().append(p)}_makeColorN_Pattern(e){return"TilingPattern"===e[0]?this._makeTilingPattern(e):this._makeShadingPattern(e)}_makeTilingPattern(e){const t=e[1],i=e[2],n=e[3]||s.IDENTITY_MATRIX,[r,a,o,l]=e[4],h=e[5],d=e[6],c=e[7],u="shading"+g++,[p,f,m,b]=s.Util.normalizeRect([...s.Util.applyTransform([r,a],n),...s.Util.applyTransform([o,l],n)]),[v,w]=s.Util.singularValueDecompose2dScale(n),_=h*v,y=d*w,S=this.svgFactory.createElement("svg:pattern");S.setAttributeNS(null,"id",u);S.setAttributeNS(null,"patternUnits","userSpaceOnUse");S.setAttributeNS(null,"width",_);S.setAttributeNS(null,"height",y);S.setAttributeNS(null,"x",`${p}`);S.setAttributeNS(null,"y",`${f}`);const P=this.svg,A=this.transformMatrix,E=this.current.fillColor,C=this.current.strokeColor,x=this.svgFactory.create(m-p,b-f);this.svg=x;this.transformMatrix=n;if(2===c){const e=s.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=E;this.current.strokeColor=C;S.append(x.childNodes[0]);this.defs.append(S);return`url(#${u})`}_makeShadingPattern(e){"string"==typeof e&&(e=this.objs.get(e));switch(e[0]){case"RadialAxial":const t="shading"+g++,i=e[3];let n;switch(e[1]){case"axial":const i=e[4],s=e[5];n=this.svgFactory.createElement("svg:linearGradient");n.setAttributeNS(null,"id",t);n.setAttributeNS(null,"gradientUnits","userSpaceOnUse");n.setAttributeNS(null,"x1",i[0]);n.setAttributeNS(null,"y1",i[1]);n.setAttributeNS(null,"x2",s[0]);n.setAttributeNS(null,"y2",s[1]);break;case"radial":const r=e[4],a=e[5],o=e[6],l=e[7];n=this.svgFactory.createElement("svg:radialGradient");n.setAttributeNS(null,"id",t);n.setAttributeNS(null,"gradientUnits","userSpaceOnUse");n.setAttributeNS(null,"cx",a[0]);n.setAttributeNS(null,"cy",a[1]);n.setAttributeNS(null,"r",l);n.setAttributeNS(null,"fx",r[0]);n.setAttributeNS(null,"fy",r[1]);n.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]);n.append(t)}this.defs.append(n);return`url(#${t})`;case"Mesh":(0,s.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 n=i.x,r=i.y,a=[],o=0;for(const i of e)switch(0|i){case s.OPS.rectangle:n=t[o++];r=t[o++];const e=n+t[o++],i=r+t[o++];a.push("M",pf(n),pf(r),"L",pf(e),pf(r),"L",pf(e),pf(i),"L",pf(n),pf(i),"Z");break;case s.OPS.moveTo:n=t[o++];r=t[o++];a.push("M",pf(n),pf(r));break;case s.OPS.lineTo:n=t[o++];r=t[o++];a.push("L",pf(n),pf(r));break;case s.OPS.curveTo:n=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(n),pf(r));o+=6;break;case s.OPS.curveTo2:a.push("C",pf(n),pf(r),pf(t[o]),pf(t[o+1]),pf(t[o+2]),pf(t[o+3]));n=t[o+2];r=t[o+3];o+=4;break;case s.OPS.curveTo3:n=t[o+2];r=t[o+3];a.push("C",pf(t[o]),pf(t[o+1]),pf(n),pf(r),pf(n),pf(r));o+=4;break;case s.OPS.closePath:a.push("Z")}a=a.join(" ");if(i.path&&e.length>0&&e[0]!==s.OPS.rectangle&&e[0]!==s.OPS.moveTo)a=i.path.getAttributeNS(null,"d")+a;else{i.path=this.svgFactory.createElement("svg:path");this._ensureTransformGroup().append(i.path)}i.path.setAttributeNS(null,"d",a);i.path.setAttributeNS(null,"fill","none");i.element=i.path;i.setCurrentPoint(n,r)}endPath(){const e=this.current;e.path=null;if(!this.pendingClip)return;if(!e.element){this.pendingClip=null;return}const t="clippath"+u++,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.append(n);this.defs.append(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,s.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?.setAttributeNS(null,"fill-rule","evenodd");this.fill()}fillStroke(){this.stroke();this.fill()}eoFillStroke(){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().append(e)}paintImageXObject(e){const t=this.getObject(e);t?this.paintInlineImageXObject(t):(0,s.warn)(`Dependent image with object ID ${e} is not ready yet`)}paintInlineImageXObject(e,t){const i=e.width,n=e.height,s=c(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 a=this.svgFactory.createElement("svg:image");a.setAttributeNS(l,"xlink:href",s);a.setAttributeNS(null,"x","0");a.setAttributeNS(null,"y",pf(-n));a.setAttributeNS(null,"width",pf(i)+"px");a.setAttributeNS(null,"height",pf(n)+"px");a.setAttributeNS(null,"transform",`scale(${pf(1/i)} ${pf(-1/n)})`);t?t.append(a):this._ensureTransformGroup().append(a)}paintImageMaskXObject(e){const t=this.getObject(e.data,e);if(t.bitmap){(0,s.warn)("paintImageMaskXObject: ImageBitmap support is not implemented, ensure that the `isOffscreenCanvasSupported` API parameter is disabled.");return}const i=this.current,n=t.width,r=t.height,a=i.fillColor;i.maskId="mask"+p++;const o=this.svgFactory.createElement("svg:mask");o.setAttributeNS(null,"id",i.maskId);const l=this.svgFactory.createElement("svg:rect");l.setAttributeNS(null,"x","0");l.setAttributeNS(null,"y","0");l.setAttributeNS(null,"width",pf(n));l.setAttributeNS(null,"height",pf(r));l.setAttributeNS(null,"fill",a);l.setAttributeNS(null,"mask",`url(#${i.maskId})`);this.defs.append(o);this._ensureTransformGroup().append(l);this.paintInlineImageXObject(t,o)}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.append(i);this.defs=i;const n=this.svgFactory.createElement("svg:g");n.setAttributeNS(null,"transform",pm(e.transform));t.append(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.append(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().append(this.tgrp):this.svg.append(this.tgrp)}return this.tgrp}}}}],__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,"AbortException",{enumerable:!0,get:function(){return t.AbortException}});Object.defineProperty(e,"AnnotationEditorLayer",{enumerable:!0,get:function(){return r.AnnotationEditorLayer}});Object.defineProperty(e,"AnnotationEditorParamsType",{enumerable:!0,get:function(){return t.AnnotationEditorParamsType}});Object.defineProperty(e,"AnnotationEditorType",{enumerable:!0,get:function(){return t.AnnotationEditorType}});Object.defineProperty(e,"AnnotationEditorUIManager",{enumerable:!0,get:function(){return a.AnnotationEditorUIManager}});Object.defineProperty(e,"AnnotationLayer",{enumerable:!0,get:function(){return o.AnnotationLayer}});Object.defineProperty(e,"AnnotationMode",{enumerable:!0,get:function(){return t.AnnotationMode}});Object.defineProperty(e,"CMapCompressionType",{enumerable:!0,get:function(){return t.CMapCompressionType}});Object.defineProperty(e,"FeatureTest",{enumerable:!0,get:function(){return t.FeatureTest}});Object.defineProperty(e,"GlobalWorkerOptions",{enumerable:!0,get:function(){return l.GlobalWorkerOptions}});Object.defineProperty(e,"InvalidPDFException",{enumerable:!0,get:function(){return t.InvalidPDFException}});Object.defineProperty(e,"MissingPDFException",{enumerable:!0,get:function(){return t.MissingPDFException}});Object.defineProperty(e,"OPS",{enumerable:!0,get:function(){return t.OPS}});Object.defineProperty(e,"PDFDataRangeTransport",{enumerable:!0,get:function(){return i.PDFDataRangeTransport}});Object.defineProperty(e,"PDFDateString",{enumerable:!0,get:function(){return n.PDFDateString}});Object.defineProperty(e,"PDFWorker",{enumerable:!0,get:function(){return i.PDFWorker}});Object.defineProperty(e,"PasswordResponses",{enumerable:!0,get:function(){return t.PasswordResponses}});Object.defineProperty(e,"PermissionFlag",{enumerable:!0,get:function(){return t.PermissionFlag}});Object.defineProperty(e,"PixelsPerInch",{enumerable:!0,get:function(){return n.PixelsPerInch}});Object.defineProperty(e,"RenderingCancelledException",{enumerable:!0,get:function(){return n.RenderingCancelledException}});Object.defineProperty(e,"SVGGraphics",{enumerable:!0,get:function(){return h.SVGGraphics}});Object.defineProperty(e,"UNSUPPORTED_FEATURES",{enumerable:!0,get:function(){return t.UNSUPPORTED_FEATURES}});Object.defineProperty(e,"UnexpectedResponseException",{enumerable:!0,get:function(){return t.UnexpectedResponseException}});Object.defineProperty(e,"Util",{enumerable:!0,get:function(){return t.Util}});Object.defineProperty(e,"VerbosityLevel",{enumerable:!0,get:function(){return t.VerbosityLevel}});Object.defineProperty(e,"XfaLayer",{enumerable:!0,get:function(){return d.XfaLayer}});Object.defineProperty(e,"build",{enumerable:!0,get:function(){return i.build}});Object.defineProperty(e,"createPromiseCapability",{enumerable:!0,get:function(){return t.createPromiseCapability}});Object.defineProperty(e,"createValidAbsoluteUrl",{enumerable:!0,get:function(){return t.createValidAbsoluteUrl}});Object.defineProperty(e,"getDocument",{enumerable:!0,get:function(){return i.getDocument}});Object.defineProperty(e,"getFilenameFromUrl",{enumerable:!0,get:function(){return n.getFilenameFromUrl}});Object.defineProperty(e,"getPdfFilenameFromUrl",{enumerable:!0,get:function(){return n.getPdfFilenameFromUrl}});Object.defineProperty(e,"getXfaPageViewport",{enumerable:!0,get:function(){return n.getXfaPageViewport}});Object.defineProperty(e,"isDataScheme",{enumerable:!0,get:function(){return n.isDataScheme}});Object.defineProperty(e,"isPdfFile",{enumerable:!0,get:function(){return n.isPdfFile}});Object.defineProperty(e,"loadScript",{enumerable:!0,get:function(){return n.loadScript}});Object.defineProperty(e,"renderTextLayer",{enumerable:!0,get:function(){return s.renderTextLayer}});Object.defineProperty(e,"setLayerDimensions",{enumerable:!0,get:function(){return n.setLayerDimensions}});Object.defineProperty(e,"shadow",{enumerable:!0,get:function(){return t.shadow}});Object.defineProperty(e,"updateTextLayer",{enumerable:!0,get:function(){return s.updateTextLayer}});Object.defineProperty(e,"version",{enumerable:!0,get:function(){return i.version}});var t=__w_pdfjs_require__(1),i=__w_pdfjs_require__(2),n=__w_pdfjs_require__(6),s=__w_pdfjs_require__(26),r=__w_pdfjs_require__(27),a=__w_pdfjs_require__(5),o=__w_pdfjs_require__(32),l=__w_pdfjs_require__(14),h=__w_pdfjs_require__(35),d=__w_pdfjs_require__(34)})();return __webpack_exports__})()));
24/**
25 * @licstart The following is the entire license notice for the
26 * JavaScript code in this page
27 *
28 * Copyright 2023 Mozilla Foundation
29 *
30 * Licensed under the Apache License, Version 2.0 (the "License");
31 * you may not use this file except in compliance with the License.
32 * You may obtain a copy of the License at
33 *
34 * http://www.apache.org/licenses/LICENSE-2.0
35 *
36 * Unless required by applicable law or agreed to in writing, software
37 * distributed under the License is distributed on an "AS IS" BASIS,
38 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
39 * See the License for the specific language governing permissions and
40 * limitations under the License.
41 *
42 * @licend The above is the entire license notice for the
43 * JavaScript code in this page
44 */(()=>{"use strict";var e=[,(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.GenericCom=void 0;var n=i(2),s=i(47),r=i(48),a=i(49),o=i(51);t.GenericCom={};class GenericPreferences extends s.BasePreferences{async _writeToStorage(e){try{localStorage.setItem("pdfjs.preferences",JSON.stringify(e))}catch(e){}}async _readFromStorage(e){try{return JSON.parse(localStorage.getItem("pdfjs.preferences"))}catch(e){return{}}}}class GenericExternalServices extends n.DefaultExternalServices{static createDownloadManager(){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.PDFViewerApplication=t.PDFPrintServiceFactory=t.DefaultExternalServices=void 0;var n=i(3),s=i(4),r=i(5),a=i(6),o=i(7),l=i(8),h=i(9),d=i(10),c=i(11),u=i(13),p=i(15),g=i(16),f=i(17),m=i(21),b=i(22),v=i(23),w=i(24),_=i(25),y=i(26),S=i(27),P=i(28),A=i(29),E=i(31),C=i(44),x=i(45),T=i(46);const M=1e3,I=-1,L=1,k={AUTOMATIC:0,LIGHT:1,DARK:2};class DefaultExternalServices{constructor(){throw new Error("Cannot initialize DefaultExternalServices.")}static updateFindControlState(e){}static updateFindMatchesCount(e){}static initPassiveLoading(e){}static reportTelemetry(e){}static createDownloadManager(){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 supportsPinchToZoom(){return(0,s.shadow)(this,"supportsPinchToZoom",!0)}static get supportsIntegratedFind(){return(0,s.shadow)(this,"supportsIntegratedFind",!1)}static get supportsDocumentFonts(){return(0,s.shadow)(this,"supportsDocumentFonts",!0)}static get supportedMouseWheelZoomModifierKeys(){return(0,s.shadow)(this,"supportedMouseWheelZoomModifierKeys",{ctrlKey:!0,metaKey:!0})}static get isInAutomation(){return(0,s.shadow)(this,"isInAutomation",!1)}static updateEditorStates(e){throw new Error("Not implemented: updateEditorStates")}}t.DefaultExternalServices=DefaultExternalServices;const D={initialBookmark:document.location.hash.substring(1),_initializedCapability:(0,s.createPromiseCapability)(),appConfig:null,pdfDocument:null,pdfLoadingTask:null,printService:null,pdfViewer:null,pdfThumbnailViewer:null,pdfRenderingQueue:null,pdfPresentationMode:null,pdfDocumentProperties:null,pdfLinkService:null,pdfHistory:null,pdfSidebar:null,pdfSidebarResizer:null,pdfOutlineViewer:null,pdfAttachmentViewer:null,pdfLayerViewer:null,pdfCursorTools:null,pdfScriptingManager:null,store:null,downloadManager:null,overlayManager:null,preferences:null,toolbar:null,secondaryToolbar:null,eventBus:null,l10n:null,annotationEditorParams:null,isInitialViewSet:!1,downloadComplete:!1,isViewerEmbedded:window.parent!==window,url:"",baseUrl:"",_downloadUrl:"",externalServices:DefaultExternalServices,_boundEvents:Object.create(null),documentInfo:null,metadata:null,_contentDispositionFilename:null,_contentLength:null,_saveInProgress:!1,_wheelUnusedTicks:0,_wheelUnusedFactor:1,_touchUnusedTicks:0,_touchUnusedFactor:1,_PDFBug:null,_hasAnnotationEditors:!1,_title:document.title,_printAnnotationStoragePromise:null,_touchInfo:null,_isCtrlKeyDown:!1,async initialize(e){this.preferences=this.externalServices.createPreferences();this.appConfig=e;await this._initializeOptions();this._forceCssTheme();await this._initializeL10n();this.isViewerEmbedded&&r.AppOptions.get("externalLinkTarget")===o.LinkTarget.NONE&&r.AppOptions.set("externalLinkTarget",o.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 _initializeOptions(){if(r.AppOptions.get("disablePreferences"))r.AppOptions.get("pdfBugEnabled")&&await this._parseHashParams();else{r.AppOptions._hasUserOptions()&&Window.ngxConsole.warn('_initializeOptions: The Preferences may override manually set AppOptions; please use the "disablePreferences"-option in order to prevent that.');try{r.AppOptions.setAll(await this.preferences.getAll())}catch(e){Window.ngxConsole.error(`_initializeOptions: "${e?.message}".`)}r.AppOptions.get("pdfBugEnabled")&&await this._parseHashParams()}},async _parseHashParams(){const e=document.location.hash.substring(1);if(!e)return;const{mainContainer:t,viewerContainer:i}=this.appConfig,a=(0,n.parseQueryString)(e);if("true"===a.get("disableworker"))try{await async function loadFakeWorker(){s.GlobalWorkerOptions.workerSrc||=r.AppOptions.get("workerSrc");"Function"===s.GlobalWorkerOptions.workerSrc.constructor.name&&(s.GlobalWorkerOptions.workerSrc=s.GlobalWorkerOptions.workerSrc());await(0,s.loadScript)(s.PDFWorker.workerSrc)}()}catch(e){console.error(`_parseHashParams: "${e.message}".`)}a.has("disablerange")&&r.AppOptions.set("disableRange","true"===a.get("disablerange"));a.has("disablestream")&&r.AppOptions.set("disableStream","true"===a.get("disablestream"));a.has("disableautofetch")&&r.AppOptions.set("disableAutoFetch","true"===a.get("disableautofetch"));a.has("disablefontface")&&r.AppOptions.set("disableFontFace","true"===a.get("disablefontface"));a.has("disablehistory")&&r.AppOptions.set("disableHistory","true"===a.get("disablehistory"));a.has("verbosity")&&r.AppOptions.set("verbosity",0|a.get("verbosity"));if(a.has("textlayer"))switch(a.get("textlayer")){case"off":r.AppOptions.set("textLayerMode",n.TextLayerMode.DISABLE);break;case"visible":case"shadow":case"hover":i.classList.add(`textLayer-${a.get("textlayer")}`);try{await loadPDFBug(this);this._PDFBug.loadCSS()}catch(e){console.error(`_parseHashParams: "${e.message}".`)}}if(a.has("pdfbug")){r.AppOptions.set("pdfBug",!0);r.AppOptions.set("fontExtraProperties",!0);const e=a.get("pdfbug").split(",");try{await loadPDFBug(this);this._PDFBug.init({OPS:s.OPS},t,e)}catch(e){console.error(`_parseHashParams: "${e.message}".`)}}a.has("locale")&&r.AppOptions.set("locale",a.get("locale"))},async _initializeL10n(){this.l10n=this.externalServices.createL10n({locale:r.AppOptions.get("locale")});const e=await this.l10n.getDirection();document.getElementsByTagName("html")[0].dir=e},_forceCssTheme(){const e=r.AppOptions.get("viewerCssTheme");if(e!==k.AUTOMATIC&&Object.values(k).includes(e))try{const t=document.styleSheets[0],i=t?.cssRules||[];for(let n=0,s=i.length;n<s;n++){const s=i[n];if(s instanceof CSSMediaRule&&"(prefers-color-scheme: dark)"===s.media?.[0]){if(e===k.LIGHT){t.deleteRule(n);return}const i=/^@media \(prefers-color-scheme: dark\) {\n\s*([\w\s-.,:;/\\{}()]+)\n}$/.exec(s.cssText);if(i?.[1]){t.deleteRule(n);t.insertRule(i[1],n)}return}}}catch(e){Window.ngxConsole.error(`_forceCssTheme: "${e?.message}".`)}},async _initializeViewerComponents(){const{appConfig:e,externalServices:t}=this,i=t.isInAutomation?new a.AutomationEventBus:new a.EventBus;this.eventBus=i;this.overlayManager=new h.OverlayManager;const n=new _.PDFRenderingQueue;n.onIdle=this._cleanup.bind(this);this.pdfRenderingQueue=n;const T=new o.PDFLinkService({eventBus:i,externalLinkTarget:r.AppOptions.get("externalLinkTarget"),externalLinkRel:r.AppOptions.get("externalLinkRel"),ignoreDestinationZoom:r.AppOptions.get("ignoreDestinationZoom")});this.pdfLinkService=T;const M=t.createDownloadManager();this.downloadManager=M;const I=new f.PDFFindController({linkService:T,eventBus:i,pageViewMode:r.AppOptions.get("pageViewMode"),updateMatchesCountOnProgress:!0});this.findController=I;const L=new y.PDFScriptingManager({eventBus:i,sandboxBundleSrc:r.AppOptions.get("sandboxBundleSrc"),scriptingFactory:t,docPropertiesLookup:this._scriptingDocProperties.bind(this)});this.pdfScriptingManager=L;const k=e.mainContainer,D=e.viewerContainer,R=r.AppOptions.get("annotationEditorMode"),F=r.AppOptions.get("forcePageColors")||window.matchMedia("(forced-colors: active)").matches?{background:r.AppOptions.get("pageColorsBackground"),foreground:r.AppOptions.get("pageColorsForeground")}:null;this.pdfViewer=new E.PDFViewer({container:k,viewer:D,eventBus:i,renderingQueue:n,linkService:T,downloadManager:M,findController:I,scriptingManager:r.AppOptions.get("enableScripting")&&L,renderer:r.AppOptions.get("renderer"),l10n:this.l10n,textLayerMode:r.AppOptions.get("textLayerMode"),annotationMode:r.AppOptions.get("annotationMode"),annotationEditorMode:R,imageResourcesPath:r.AppOptions.get("imageResourcesPath"),removePageBorders:r.AppOptions.get("removePageBorders"),enablePrintAutoRotate:r.AppOptions.get("enablePrintAutoRotate"),useOnlyCssZoom:r.AppOptions.get("useOnlyCssZoom"),isOffscreenCanvasSupported:r.AppOptions.get("isOffscreenCanvasSupported"),maxCanvasPixels:r.AppOptions.get("maxCanvasPixels"),pageViewMode:r.AppOptions.get("pageViewMode"),enablePermissions:r.AppOptions.get("enablePermissions"),pageColors:F});n.setViewer(this.pdfViewer);T.setViewer(this.pdfViewer);L.setViewer(this.pdfViewer);if(e.sidebar?.thumbnailView){this.pdfThumbnailViewer=new A.PDFThumbnailViewer({container:e.sidebar.thumbnailView,renderingQueue:n,linkService:T,l10n:this.l10n,pageColors:F});n.setThumbnailViewer(this.pdfThumbnailViewer)}if(!this.isViewerEmbedded&&!r.AppOptions.get("disableHistory")){this.pdfHistory=new m.PDFHistory({linkService:T,eventBus:i});T.setHistory(this.pdfHistory)}!this.supportsIntegratedFind&&e.findBar&&(this.findBar=new g.PDFFindBar(e.findBar,i,this.l10n));if(e.annotationEditorParams)if(R!==s.AnnotationEditorType.DISABLE)this.annotationEditorParams=new l.AnnotationEditorParams(e.annotationEditorParams,i);else for(const e of["editorModeButtons","editorModeSeparator"])document.getElementById(e)?.classList.add("hidden");e.documentProperties&&(this.pdfDocumentProperties=new p.PDFDocumentProperties(e.documentProperties,this.overlayManager,i,this.l10n,(()=>this._docFilename)));e.secondaryToolbar?.cursorHandToolButton&&(this.pdfCursorTools=new u.PDFCursorTools({container:k,eventBus:i,cursorToolOnLoad:r.AppOptions.get("cursorToolOnLoad")}));e.toolbar&&(this.toolbar=new x.Toolbar(e.toolbar,i,this.l10n));e.secondaryToolbar&&(this.secondaryToolbar=new C.SecondaryToolbar(e.secondaryToolbar,i,this.externalServices));this.supportsFullscreen&&e.secondaryToolbar?.presentationModeButton&&(this.pdfPresentationMode=new w.PDFPresentationMode({container:k,pdfViewer:this.pdfViewer,eventBus:i}));let O=r.AppOptions.get("passwordPrompt");O||e.passwordOverlay&&(O=new d.PasswordPrompt(e.passwordOverlay,this.overlayManager,this.l10n,this.isViewerEmbedded));this.passwordPrompt=O;e.sidebar?.outlineView&&(this.pdfOutlineViewer=new v.PDFOutlineViewer({container:e.sidebar.outlineView,eventBus:i,linkService:T,downloadManager:M}));e.sidebar?.attachmentsView&&(this.pdfAttachmentViewer=new c.PDFAttachmentViewer({container:e.sidebar.attachmentsView,eventBus:i,downloadManager:M}));e.sidebar?.layersView&&(this.pdfLayerViewer=new b.PDFLayerViewer({container:e.sidebar.layersView,eventBus:i,l10n:this.l10n}));if(e.sidebar){this.pdfSidebar=new S.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 P.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,t){this.pdfViewer.isInPresentationMode||this.pdfViewer.increaseScale({drawingDelay:r.AppOptions.get("defaultZoomDelay"),steps:e,scaleFactor:t})},zoomOut(e,t){this.pdfViewer.isInPresentationMode||this.pdfViewer.decreaseScale({drawingDelay:r.AppOptions.get("defaultZoomDelay"),steps:e,scaleFactor:t})},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 F.instance.supportsPrinting},get supportsFullscreen(){return(0,s.shadow)(this,"supportsFullscreen",document.fullscreenEnabled)},get supportsPinchToZoom(){return this.externalServices.supportsPinchToZoom},get supportsIntegratedFind(){return this.externalServices.supportsIntegratedFind},get supportsDocumentFonts(){return this.externalServices.supportsDocumentFonts},initializeLoadingBar(){const e=document.getElementById("loadingBar"),t=e?new n.ProgressBar(e):null;t.hide();return(0,s.shadow)(this,"loadingBar",t)},get supportedMouseWheelZoomModifierKeys(){return this.externalServices.supportedMouseWheelZoomModifierKeys},initPassiveLoading(){throw new Error("Not implemented: initPassiveLoading")},setTitleUsingUrl(e="",t=null){},setTitle(e=this._title){this._title=e;if(this.isViewerEmbedded)return;const t=this._hasAnnotationEditors&&!this.pdfRenderingQueue.printing;document.title=`${t?"* ":""}${e}`},get _docFilename(){return this._contentDispositionFilename||(0,s.getPdfFilenameFromUrl)(this.url)},_hideViewBookmark(){const{secondaryToolbar:e}=this.appConfig;e?.viewBookmarkButton.classList.add("hidden");e?.presentationModeButton.classList.contains("hidden")&&document.getElementById("viewBookmarkSeparator")?.classList.add("hidden")},async close(){this._unblockDocumentLoadEvent();this._hideViewBookmark();if(!this.pdfLoadingTask)return;if(this.pdfDocument?.annotationStorage.size>0&&this._annotationStorageModified)try{await this.save()}catch(e){}const e=[];e.push(this.pdfLoadingTask.destroy());this.pdfLoadingTask=null;if(this.pdfDocument){this.pdfDocument=null;this.pdfThumbnailViewer?.setDocument(null);this.pdfViewer.setDocument(null);this.pdfLinkService.setDocument(null);this.pdfDocumentProperties?.setDocument(null)}this.pdfLinkService.externalLinkEnabled=!0;this.store=null;this.isInitialViewSet=!1;this.downloadComplete=!1;this.url="";this.baseUrl="";this._downloadUrl="";this.documentInfo=null;this.metadata=null;this._contentDispositionFilename=null;this._contentLength=null;this._saveInProgress=!1;this._hasAnnotationEditors=!1;e.push(this.pdfScriptingManager.destroyPromise);this.setTitle();this.pdfSidebar?.reset();this.pdfOutlineViewer?.reset();this.pdfAttachmentViewer?.reset();this.pdfLayerViewer?.reset();this.pdfHistory?.reset();this.findBar?.reset();this.toolbar?.reset();this.secondaryToolbar?.reset();this._PDFBug?.cleanup();await Promise.all(e)},async open(e){window.adjacentPagesLoader=void 0;window.ngxZone.runOutsideAngular((async()=>{let t=!1;if("string"==typeof e){e={url:e};t=!0}else if(e?.byteLength){e={data:e};t=!0}t&&console.error("The `PDFViewerApplication.open` signature was updated, please use an object instead.");this.pdfLoadingTask&&await this.close();const i=r.AppOptions.getAll(r.OptionKind.WORKER);Object.assign(s.GlobalWorkerOptions,i);e.url&&this.setTitleUsingUrl(e.originalUrl||e.url,e.url);const n={...r.AppOptions.getAll(r.OptionKind.API),...e},a=(0,s.getDocument)(n);this.pdfLoadingTask=a;a.onPassword=(e,t)=>{this.isViewerEmbedded&&this._unblockDocumentLoadEvent();this.pdfLinkService.externalLinkEnabled=!1;this.passwordPrompt.setUpdateCallback(e,t);this.passwordPrompt.open()};a.onProgress=({loaded:e,total:t})=>{this.progress(e/t);this.eventBus?.dispatch("progress",{source:this,type:"load",total:t,loaded:e,percent:100*e/t})};return a.promise.then((e=>{this.load(e)}),(e=>{if(a!==this.pdfLoadingTask)return;let t="loading_error";e instanceof s.InvalidPDFException?t="invalid_file_error":e instanceof s.MissingPDFException?t="missing_file_error":e instanceof s.UnexpectedResponseException&&(t="unexpected_response_error");D.onError&&D.onError(e);return this.l10n.get(t).then((t=>{this._documentError(t,{message:e?.message});throw e}))}))}))},_ensureDownloadComplete(){if(!this.pdfDocument||!this.downloadComplete)throw new Error("PDF document not downloaded.")},async download(){const e=this._downloadUrl,t=this._docFilename;try{this._ensureDownloadComplete();const i=await this.pdfDocument.getData(),n=new Blob([i],{type:"application/pdf"});await this.downloadManager.download(n,e,t)}catch(i){await this.downloadManager.downloadUrl(e,t)}},async save(){if(this._saveInProgress)return;this._saveInProgress=!0;await this.pdfScriptingManager.dispatchWillSave();const e=this._downloadUrl,t=this._docFilename;try{this._ensureDownloadComplete();const i=await this.pdfDocument.saveDocument(),n=new Blob([i],{type:"application/pdf"});await this.downloadManager.download(n,e,t)}catch(e){Window.ngxConsole.error(`Error when saving the document: ${e.message}`);await this.download()}finally{await this.pdfScriptingManager.dispatchDidSave();this._saveInProgress=!1}this._hasAnnotationEditors&&this.externalServices.reportTelemetry({type:"editing",data:{type:"save"}})},downloadOrSave(){this.pdfDocument?.annotationStorage.size>0?this.save():this.download()},_documentError(e,t=null){this._unblockDocumentLoadEvent();this._otherError(e,t);this.eventBus.dispatch("documenterror",{source:this,message:e,reason:t?.message??null})},_otherError(e,t=null){const i=[`PDF.js v${s.version||"?"} (build: ${s.build||"?"})`];if(t){i.push(`Message: ${t.message}`);if(t.stack)i.push(`Stack: ${t.stack}`);else{t.filename&&i.push(`File: ${t.filename}`);t.lineNumber&&i.push(`Line: ${t.lineNumber}`)}}console.error(`${e}\n\n${i.join("\n")}`)},progress(e){if(!this.loadingBar||this.downloadComplete)return;const t=Math.round(100*e);if(!(t<=this.loadingBar.percent)){this.loadingBar.percent=t;(this.pdfDocument?.loadingParams.disableAutoFetch??r.AppOptions.get("disableAutoFetch"))&&this.loadingBar.setDisableAutoFetch()}},load(e){this.pdfDocument=e;e.getDownloadInfo().then((({length:e})=>{this._contentLength=e;this.downloadComplete=!0;this.loadingBar?.hide();h.then((()=>{this.eventBus?.dispatch("documentloaded",{source:this})}))}));const t=e.getPageLayout().catch((function(){})),i=e.getPageMode().catch((function(){})),a=e.getOpenAction().catch((function(){}));this.toolbar?.setPagesCount(e.numPages,!1);this.secondaryToolbar?.setPagesCount(e.numPages);let o;o=null;o&&(0,s.isDataScheme)(o)&&(o=null);this.pdfLinkService.setDocument(e,o);this.pdfDocumentProperties?.setDocument(e);const l=this.pdfViewer;l.setDocument(e);const{firstPagePromise:h,onePageRendered:d,pagesPromise:c}=l;this.pdfThumbnailViewer?.setDocument(e);const u=(this.store=new T.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)));h.then((s=>{this.loadingBar?.setWidth(this.appConfig.viewerContainer);this._initializeAnnotationStorageCallbacks(e);Promise.all([n.animationStarted,u,t,i,a]).then((async([t,i,s,a,o])=>{const h=r.AppOptions.get("viewOnLoad");this._initializePdfHistory({fingerprint:e.fingerprints[0],viewOnLoad:h,initialDest:o?.dest});const d=this.initialBookmark,u=r.AppOptions.get("defaultZoomValue");let p=u?`zoom=${u}`:null,g=null,f=r.AppOptions.get("sidebarViewOnLoad"),m=r.AppOptions.get("scrollModeOnLoad"),b=r.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);b===n.SpreadMode.UNKNOWN&&(b=0|i.spreadMode)}a&&f===n.SidebarView.UNKNOWN&&(f=(0,n.apiPageModeToSidebarView)(a));if(s&&m===n.ScrollMode.UNKNOWN&&b===n.SpreadMode.UNKNOWN){b=(0,n.apiPageLayoutToViewerModes)(s).spreadMode}this.setInitialView(p,{rotation:g,sidebarView:f,scrollMode:m,spreadMode:b});this.eventBus.dispatch("documentinit",{source:this});this.isViewerEmbedded||l.focus();await Promise.race([c,new Promise((e=>{setTimeout(e,10)}))]);if((d||p)&&!l.hasEqualPageSizes){this.initialBookmark=d;l.currentScaleValue=l.currentScaleValue;this.setInitialView(p)}})).catch((()=>{this.setInitialView()})).then((function(){l.update()}))}));c.then((()=>{this._unblockDocumentLoadEvent();this._initializeAutoPrint(e,a)}),(e=>{D.onError&&D.onError(e);this.l10n.get("loading_error").then((t=>{this._documentError(t,{message:e?.message})}))}));d.then((t=>{this.externalServices.reportTelemetry({type:"pageInfo",timestamp:t.timestamp});this.pdfOutlineViewer&&e.getOutline().then((t=>{e===this.pdfDocument&&this.pdfOutlineViewer.render({outline:t,pdfDocument:e})}));this.pdfAttachmentViewer&&e.getAttachments().then((t=>{e===this.pdfDocument&&this.pdfAttachmentViewer.render({attachments:t})}));this.pdfLayerViewer&&l.optionalContentConfigPromise.then((t=>{e===this.pdfDocument&&this.pdfLayerViewer.render({optionalContentConfig:t,pdfDocument:e})}))}));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 _initializeAutoPrint(e,t){const[i,s]=await Promise.all([t,this.pdfViewer.enableScripting?null:e.getJavaScript()]);if(e!==this.pdfDocument)return;let r=!1;"Print"===i?.action&&(r=!0);if(s){s.some((e=>{if(!e)return!1;Window.ngxConsole.warn("Warning: JavaScript support is not enabled");return!0}));if(!r)for(const e of s)if(e&&n.AutoPrintRegExp.test(e)){r=!0;break}}r&&this.triggerPrinting()},async _initializeMetadata(e){const{info:t,metadata:i,contentDispositionFilename:n,contentLength:r}=await e.getMetadata();if(e!==this.pdfDocument)return;this.documentInfo=t;this.metadata=i;this._contentDispositionFilename??=n;this._contentLength??=r;console.log(`PDF ${e.fingerprints[0]} [${t.PDFFormatVersion} ${(t.Producer||"-").trim()} / ${(t.Creator||"-").trim()}] (PDF.js: ${s.version||"?"} [${s.build||"?"}]) modified by ngx-extended-pdf-viewer`);let a=t.Title;const o=i?.get("dc:title");o&&("Untitled"===o||/[\uFFF0-\uFFFF]/g.test(o)||(a=o));a?this.setTitle(`${a} - ${this._contentDispositionFilename||this._title}`):this._contentDispositionFilename&&this.setTitle(this._contentDispositionFilename);!t.IsXFAPresent||t.IsAcroFormPresent||e.isPureXfa?!t.IsAcroFormPresent&&!t.IsXFAPresent||this.pdfViewer.renderForms||console.warn("Warning: Interactive form support is not enabled"):e.loadingParams.enableXfa?Window.ngxConsole.warn("Warning: XFA Foreground documents are not supported"):Window.ngxConsole.warn("Warning: XFA support is not enabled");t.IsSignaturesPresent&&console.warn("Warning: Digital signatures validation is not supported");this.eventBus.dispatch("metadataloaded",{source:this})},async _initializePageLabels(e){const t=await e.getPageLabels();if(e!==this.pdfDocument)return;if(!t||r.AppOptions.get("disablePageLabels"))return;const i=t.length;let n=0,s=0;for(let e=0;e<i;e++){const i=t[e];if(i===(e+1).toString())n++;else{if(""!==i)break;s++}}if(n>=i||s>=i)return;const{pdfViewer:a,pdfThumbnailViewer:o,toolbar:l}=this;a.setPageLabels(t);o?.setPageLabels(t);l?.setPagesCount(i,!0);l?.setPageNumber(a.currentPageNumber,a.currentPageLabel)},_initializePdfHistory({fingerprint:e,viewOnLoad:t,initialDest:i=null}){if(this.pdfHistory){this.pdfHistory.initialize({fingerprint:e,resetHistory:t===L,updateUrl:r.AppOptions.get("historyUpdateUrl")});if(this.pdfHistory.initialBookmark){this.initialBookmark=this.pdfHistory.initialBookmark;this.initialRotation=this.pdfHistory.initialRotation}if(i&&!this.initialBookmark&&t===I){this.initialBookmark=JSON.stringify(i);this.pdfHistory.push({explicitDest:i,pageNumber:null})}}},_initializeAnnotationStorageCallbacks(e){if(e!==this.pdfDocument)return;const{annotationStorage:t}=e;t.onSetModified=()=>{window.addEventListener("beforeunload",beforeUnload);this._annotationStorageModified=!0};t.onResetModified=()=>{window.removeEventListener("beforeunload",beforeUnload);delete this._annotationStorageModified};t.onAnnotationEditor=e=>{this._hasAnnotationEditors=!!e;this.setTitle();e&&this.externalServices.reportTelemetry({type:"editing",data:{type:e}})}},setInitialView(e,{rotation:t,sidebarView:i,scrollMode:s,spreadMode:r}={}){const setRotation=e=>{(0,n.isValidRotation)(e)&&(this.pdfViewer.pagesRotation=e)};this.isInitialViewSet=!0;this.pdfSidebar?.setInitialView(i);((e,t)=>{(0,n.isValidScrollMode)(e)&&(this.pdfViewer.scrollMode=e);(0,n.isValidSpreadMode)(t)&&(this.pdfViewer.spreadMode=t)})(s,r);if(this.initialBookmark){setRotation(this.initialRotation);delete this.initialRotation;this.pdfLinkService.setHash(this.initialBookmark);this.initialBookmark=null}else if(e){setRotation(t);this.pdfLinkService.setHash(e)}this.toolbar?.setPageNumber(this.pdfViewer.currentPageNumber,this.pdfViewer.currentPageLabel);this.secondaryToolbar?.setPageNumber(this.pdfViewer.currentPageNumber);if(!this.pdfViewer.currentScaleValue){const e=PDFViewerApplicationOptions.get("defaultZoomValue");e&&(this.pdfViewer.currentScaleValue=e)}},_cleanup(){if(this.pdfDocument){this.pdfViewer.cleanup();this.pdfThumbnailViewer?.cleanup();this.pdfDocument.cleanup(this.pdfViewer.renderer===n.RendererType.SVG)}},forceRendering(){this.pdfRenderingQueue.printing=!!this.printService;this.pdfRenderingQueue.isThumbnailViewEnabled=this.pdfSidebar?.visibleView===n.SidebarView.THUMBS;this.pdfRenderingQueue.renderHighestPriority()},beforePrint(){this._printAnnotationStoragePromise=this.pdfScriptingManager.dispatchWillPrint().catch((()=>{})).then((()=>this.pdfDocument?.annotationStorage.print));if(this.printService)return;if(!this.supportsPrinting){this.l10n.get("printing_not_supported").then((e=>{this._otherError(e)}));return}if(!this.pdfViewer.pageViewsReady){this.l10n.get("printing_not_ready").then((e=>{window.alert(e)}));return}const e=this.pdfViewer.getPagesOverview(),t=this.appConfig.printContainer,i=r.AppOptions.get("printResolution"),n=this.pdfViewer.optionalContentConfigPromise,s=F.instance.createPrintService(this.pdfDocument,e,t,i,n,this._printAnnotationStoragePromise,this.l10n,this.pdfViewer.eventBus);this.printService=s;this.forceRendering();this.setTitle();s.layout();this._hasAnnotationEditors&&this.externalServices.reportTelemetry({type:"editing",data:{type:"print"}})},afterPrint(){if(this._printAnnotationStoragePromise){this._printAnnotationStoragePromise.then((()=>{this.pdfScriptingManager.dispatchDidPrint()}));this._printAnnotationStoragePromise=null}if(this.printService){this.printService.destroy();this.printService=null;this.pdfDocument?.annotationStorage.resetModified()}this.forceRendering();this.setTitle()},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("pagerender",webViewerPageRender);e._on("pagerendered",webViewerPageRendered);e._on("updateviewarea",webViewerUpdateViewarea);e._on("pagechanging",webViewerPageChanging);e._on("scalechanging",webViewerScaleChanging);e._on("rotationchanging",webViewerRotationChanging);e._on("sidebarviewchanged",webViewerSidebarViewChanged);e._on("pagemode",webViewerPageMode);e._on("namedaction",webViewerNamedAction);e._on("presentationmodechanged",webViewerPresentationModeChanged);e._on("presentationmode",webViewerPresentationMode);e._on("switchannotationeditormode",webViewerSwitchAnnotationEditorMode);e._on("switchannotationeditorparams",webViewerSwitchAnnotationEditorParams);e._on("print",webViewerPrint);e._on("download",webViewerDownload);e._on("firstpage",webViewerFirstPage);e._on("lastpage",webViewerLastPage);e._on("nextpage",webViewerNextPage);e._on("previouspage",webViewerPreviousPage);e._on("zoomin",webViewerZoomIn);e._on("zoomout",webViewerZoomOut);e._on("zoomreset",webViewerZoomReset);e._on("pagenumberchanged",webViewerPageNumberChanged);e._on("scalechanged",webViewerScaleChanged);e._on("rotatecw",webViewerRotateCw);e._on("rotateccw",webViewerRotateCcw);e._on("optionalcontentconfig",webViewerOptionalContentConfig);e._on("switchscrollmode",webViewerSwitchScrollMode);e._on("scrollmodechanged",webViewerScrollModeChanged);e._on("switchspreadmode",webViewerSwitchSpreadMode);e._on("spreadmodechanged",webViewerSpreadModeChanged);e._on("documentproperties",webViewerDocumentProperties);e._on("findfromurlhash",webViewerFindFromUrlHash);e._on("updatefindmatchescount",webViewerUpdateFindMatchesCount);e._on("updatefindcontrolstate",webViewerUpdateFindControlState);if(r.AppOptions.get("pdfBug")){t.reportPageStatsPDFBug=reportPageStatsPDFBug;e._on("pagerendered",t.reportPageStatsPDFBug);e._on("pagechanging",t.reportPageStatsPDFBug)}e._on("fileinputchange",webViewerFileInputChange);e._on("openfile",webViewerOpenFile)},bindWindowEvents(){const{eventBus:e,_boundEvents:t}=this;!function addWindowResolutionChange(e=null){e&&function webViewerResolutionChange(e){D.pdfViewer.refresh()}();const i=window.matchMedia(`(resolution: ${window.devicePixelRatio||1}dppx)`);i.addEventListener("change",addWindowResolutionChange,{once:!0});t.removeWindowResolutionChange||=function(){i.removeEventListener("change",addWindowResolutionChange);t.removeWindowResolutionChange=null}}();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("touchstart",webViewerTouchStart,{passive:!1});window.addEventListener("touchmove",webViewerTouchMove,{passive:!1});window.addEventListener("touchend",webViewerTouchEnd,{passive:!1});window.addEventListener("click",webViewerClick);window.addEventListener("keydown",webViewerKeyDown);window.addEventListener("keyup",webViewerKeyUp);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("pagerender",webViewerPageRender);e._off("pagerendered",webViewerPageRendered);e._off("updateviewarea",webViewerUpdateViewarea);e._off("pagechanging",webViewerPageChanging);e._off("scalechanging",webViewerScaleChanging);e._off("rotationchanging",webViewerRotationChanging);e._off("sidebarviewchanged",webViewerSidebarViewChanged);e._off("pagemode",webViewerPageMode);e._off("namedaction",webViewerNamedAction);e._off("presentationmodechanged",webViewerPresentationModeChanged);e._off("presentationmode",webViewerPresentationMode);e._off("print",webViewerPrint);e._off("download",webViewerDownload);e._off("firstpage",webViewerFirstPage);e._off("lastpage",webViewerLastPage);e._off("nextpage",webViewerNextPage);e._off("previouspage",webViewerPreviousPage);e._off("zoomin",webViewerZoomIn);e._off("zoomout",webViewerZoomOut);e._off("zoomreset",webViewerZoomReset);e._off("pagenumberchanged",webViewerPageNumberChanged);e._off("scalechanged",webViewerScaleChanged);e._off("rotatecw",webViewerRotateCw);e._off("rotateccw",webViewerRotateCcw);e._off("optionalcontentconfig",webViewerOptionalContentConfig);e._off("switchscrollmode",webViewerSwitchScrollMode);e._off("scrollmodechanged",webViewerScrollModeChanged);e._off("switchspreadmode",webViewerSwitchSpreadMode);e._off("spreadmodechanged",webViewerSpreadModeChanged);e._off("documentproperties",webViewerDocumentProperties);e._off("findfromurlhash",webViewerFindFromUrlHash);e._off("updatefindmatchescount",webViewerUpdateFindMatchesCount);e._off("updatefindcontrolstate",webViewerUpdateFindControlState);if(t.reportPageStatsPDFBug){e._off("pagerendered",t.reportPageStatsPDFBug);e._off("pagechanging",t.reportPageStatsPDFBug);t.reportPageStatsPDFBug=null}e._off("fileinputchange",webViewerFileInputChange);e._off("openfile",webViewerOpenFile);t.beforePrint=null;t.afterPrint=null},unbindWindowEvents(){const{_boundEvents:e}=this;window.removeEventListener("visibilitychange",webViewerVisibilityChange);window.removeEventListener("wheel",webViewerWheel,{passive:!1});window.removeEventListener("touchstart",webViewerTouchStart,{passive:!1});window.removeEventListener("touchmove",webViewerTouchMove,{passive:!1});window.removeEventListener("touchend",webViewerTouchEnd,{passive:!1});window.removeEventListener("click",webViewerClick);window.removeEventListener("keydown",webViewerKeyDown);window.removeEventListener("keyup",webViewerKeyUp);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.removeWindowResolutionChange?.();e.windowResize=null;e.windowHashChange=null;e.windowBeforePrint=null;e.windowAfterPrint=null;e.windowUpdateFromSandbox=null},_accumulateTicks(e,t){(this[t]>0&&e<0||this[t]<0&&e>0)&&(this[t]=0);this[t]+=e;const i=Math.trunc(this[t]);this[t]-=i;return i},_accumulateFactor(e,t,i){if(1===t)return 1;(this[i]>1&&t<1||this[i]<1&&t>1)&&(this[i]=1);const n=Math.floor(e*t*this[i]*100)/(100*e);this[i]=t/n;return n},_centerAtPos(e,t,i){const{pdfViewer:n}=this,s=n.currentScale/e-1;if(0!==s){const[e,r]=n.containerTopLeft;n.container.scrollLeft+=(t-r)*s;n.container.scrollTop+=(i-e)*s}},_unblockDocumentLoadEvent(){document.blockUnblockOnload?.(!1);this._unblockDocumentLoadEvent=()=>{}},get scriptingReady(){return this.pdfScriptingManager.ready}};t.PDFViewerApplication=D;{const e=["null","http://mozilla.github.io","https://mozilla.github.io"];var validateFileURL=function(t){if(t)try{const i=new URL(window.location.href).origin||"null";if(e.includes(i))return;if(new URL(t,window.location.href).origin!==i)throw new Error("file origin does not match viewer's")}catch(e){D.onError&&D.onError(e);D.l10n.get("loading_error").then((t=>{D._documentError(t,{message:e?.message})}));throw e}}}async function loadPDFBug(e){const{debuggerScriptPath:t}=e.appConfig,{PDFBug:i}=await import(t);e._PDFBug=i}function reportPageStatsPDFBug({pageNumber:e}){if(!globalThis.Stats?.enabled)return;const t=D.pdfViewer.getPageView(e-1);globalThis.Stats.add(e,t?.pdfPage?.stats)}function webViewerInitialized(){const{appConfig:e,eventBus:t,l10n:i}=D;let s;const a=document.location.search.substring(1);s=(0,n.parseQueryString)(a).get("file")??r.AppOptions.get("defaultUrl");validateFileURL(s);const o=e.openFileInput;o.value=null;o.addEventListener("change",(function(e){const{files:i}=e.target;i&&0!==i.length&&t.dispatch("fileinputchange",{source:this,fileInput:e.target})}));e.mainContainer.addEventListener("dragover",(function(e){if(r.AppOptions.get("enableDragAndDrop")){e.preventDefault();e.dataTransfer.dropEffect="copy"===e.dataTransfer.effectAllowed?"copy":"move"}}));e.mainContainer.addEventListener("drop",(function(e){if(r.AppOptions.get("enableDragAndDrop")){e.preventDefault();const{files:t}=e.dataTransfer;if(!t||0===t.length)return;D.eventBus.dispatch("fileinputchange",{source:this,fileInput:e.dataTransfer,dropEvent:e})}}));if(!D.supportsDocumentFonts){r.AppOptions.set("disableFontFace",!0);i.get("web_fonts_disabled").then((e=>{Window.ngxConsole.warn(e)}))}if(!D.supportsPrinting){e.toolbar?.print.classList.add("hidden");e.secondaryToolbar?.printButton.classList.add("hidden")}D.supportsFullscreen||e.secondaryToolbar?.presentationModeButton.classList.add("hidden");D.supportsIntegratedFind&&e.toolbar?.viewFind.classList.add("hidden");e.mainContainer.addEventListener("transitionend",(function(e){e.target===this&&t.dispatch("resize",{source:this})}),!0);try{s?D.open({url:s}):D._hideViewBookmark()}catch(e){D.onError&&D.onError(e);i.get("loading_error").then((t=>{D._documentError(t,e)}))}}function webViewerPageRender({pageNumber:e}){e===D.page&&D.toolbar?.updateLoadingIndicatorState(!0)}function webViewerPageRendered({pageNumber:e,error:t}){e===D.page&&D.toolbar?.updateLoadingIndicatorState(!1);if(D.pdfSidebar?.visibleView===n.SidebarView.THUMBS){const t=D.pdfViewer.getPageView(e-1),i=D.pdfThumbnailViewer?.getThumbnail(e-1);t&&i&&i.setImage(t)}t&&D.l10n.get("rendering_error").then((e=>{D._otherError(e,t)}))}function webViewerPageMode({mode:e}){let t;switch(e){case"thumbs":t=n.SidebarView.THUMBS;break;case"bookmarks":case"outline":t=n.SidebarView.OUTLINE;break;case"attachments":t=n.SidebarView.ATTACHMENTS;break;case"layers":t=n.SidebarView.LAYERS;break;case"none":t=n.SidebarView.NONE;break;default:Window.ngxConsole.error('Invalid "pagemode" hash parameter: '+e);return}D.pdfSidebar?.switchView(t,!0)}function webViewerNamedAction(e){switch(e.action){case"GoToPage":D.appConfig.toolbar?.pageNumber.select();break;case"Find":D.supportsIntegratedFind||D?.findBar.toggle();break;case"Print":D.triggerPrinting();break;case"SaveAs":D.downloadOrSave()}}function webViewerPresentationModeChanged(e){D.pdfViewer.presentationModeState=e.state}function webViewerSidebarViewChanged({view:e}){D.pdfRenderingQueue.isThumbnailViewEnabled=e===n.SidebarView.THUMBS;D.isInitialViewSet&&D.store?.set("sidebarView",e).catch((()=>{}))}function webViewerUpdateViewarea({location:e}){if(D.isInitialViewSet){const t={};void 0===e.pageNumber&&null===e.pageNumber||(t.page=e.pageNumber);e.scale&&(t.zoom=e.scale);e.left&&(t.scrollLeft=e.left);e.top&&(t.scrollTop=e.top);void 0===e.rotation&&null===e.rotation||(t.rotation=e.rotation);D.store?.setMultiple(t).catch((()=>{}))}if(D.appConfig.secondaryToolbar){const t=D.pdfLinkService.getAnchorUrl(e.pdfOpenParams);D.appConfig.secondaryToolbar.viewBookmarkButton.href=t}}function webViewerScrollModeChanged(e){D.isInitialViewSet&&!D.pdfViewer.isInPresentationMode&&D.store?.set("scrollMode",e.mode).catch((()=>{}))}function webViewerSpreadModeChanged(e){D.isInitialViewSet&&!D.pdfViewer.isInPresentationMode&&D.store?.set("spreadMode",e.mode).catch((()=>{}))}function webViewerResize(){const{pdfDocument:e,pdfViewer:t,pdfRenderingQueue:i}=D;if(i.printing&&window.matchMedia("print").matches)return;if(!e)return;const n=t.currentScaleValue;"auto"!==n&&"page-fit"!==n&&"page-width"!==n||(t.currentScaleValue=n);t.update()}function webViewerHashchange(e){const t=e.hash;t&&(D.isInitialViewSet?D.pdfHistory?.popStateInProgress||D.pdfLinkService.setHash(t):D.initialBookmark=t)}var webViewerFileInputChange=function(e){if(D.pdfViewer?.isInPresentationMode)return;const t=e.fileInput.files[0];D.open({url:URL.createObjectURL(t),originalUrl:t.name});window.setNgxExtendedPdfViewerSource&&window.setNgxExtendedPdfViewerSource(t.name?t.name:URL.createObjectURL(t))},webViewerOpenFile=function(e){D.appConfig.openFileInput.click()};function webViewerPresentationMode(){D.requestPresentationMode()}function webViewerSwitchAnnotationEditorMode(e){D.pdfViewer.annotationEditorMode=e.mode}function webViewerSwitchAnnotationEditorParams(e){D.pdfViewer.annotationEditorParams=e}function webViewerPrint(){D.triggerPrinting()}function webViewerDownload(){D.downloadOrSave()}function webViewerFirstPage(){D.page=1}function webViewerLastPage(){D.page=D.pagesCount}function webViewerNextPage(){D.pdfViewer.nextPage()}function webViewerPreviousPage(){D.pdfViewer.previousPage()}function webViewerZoomIn(){D.zoomIn()}function webViewerZoomOut(){D.zoomOut()}function webViewerZoomReset(){D.zoomReset()}function webViewerPageNumberChanged(e){const t=D.pdfViewer;""!==e.value&&D.pdfLinkService.goToPage(e.value);e.value!==t.currentPageNumber.toString()&&e.value!==t.currentPageLabel&&D.toolbar?.setPageNumber(t.currentPageNumber,t.currentPageLabel)}function webViewerScaleChanged(e){D.pdfViewer.currentScaleValue=e.value}function webViewerRotateCw(){D.rotatePages(90)}function webViewerRotateCcw(){D.rotatePages(-90)}function webViewerOptionalContentConfig(e){D.pdfViewer.optionalContentConfigPromise=e.promise}function webViewerSwitchScrollMode(e){D.pdfViewer.scrollMode=e.mode}function webViewerSwitchSpreadMode(e){D.pdfViewer.spreadMode=e.mode}function webViewerDocumentProperties(){D.pdfDocumentProperties?.open()}function webViewerFindFromUrlHash(e){D.eventBus.dispatch("find",{source:e.source,type:"",query:e.query,phraseSearch:e.phraseSearch,caseSensitive:!1,entireWord:!1,ignoreAccents:!1,fuzzySearch:!1,highlightAll:!0,findPrevious:!1,matchDiacritics:!0})}function webViewerUpdateFindMatchesCount({matchesCount:e}){D.supportsIntegratedFind?D.externalServices.updateFindMatchesCount(e):D.findBar.updateResultsCount(e)}function webViewerUpdateFindControlState({state:e,previous:t,matchesCount:i,rawQuery:n}){D.supportsIntegratedFind?D.externalServices.updateFindControlState({result:e,findPrevious:t,matchesCount:i,rawQuery:n}):D.findBar?.updateUIState(e,t,i)}function webViewerScaleChanging(e){D.toolbar?.setPageScale(e.presetValue,e.scale);D.pdfViewer.update()}function webViewerRotationChanging(e){D.pdfThumbnailViewer&&(D.pdfThumbnailViewer.pagesRotation=e.pagesRotation);D.forceRendering();D.pdfViewer.currentPageNumber=e.pageNumber}function webViewerPageChanging({pageNumber:e,pageLabel:t}){D.toolbar?.setPageNumber(e,t);D.secondaryToolbar?.setPageNumber(e);D.pdfSidebar?.visibleView===n.SidebarView.THUMBS&&D.pdfThumbnailViewer?.scrollThumbnailIntoView(e);const i=D.pdfViewer.getPageView(e-1);D.toolbar?.updateLoadingIndicatorState(i?.renderingState===n.RenderingStates.RUNNING);const s=document.getElementById("pageNumber");if(s){const e=new CustomEvent("page-change");s.dispatchEvent(e)}}function webViewerVisibilityChange(e){"visible"===document.visibilityState&&setZoomDisabledTimeout()}let R=null;function setZoomDisabledTimeout(){R&&clearTimeout(R);R=setTimeout((function(){R=null}),M)}function webViewerWheel(e){const t=document.getElementById("viewerContainer");if(t.parentNode.querySelector(":hover")!==t)return;const{pdfViewer:i,supportedMouseWheelZoomModifierKeys:s,supportsPinchToZoom:r}=D;if(i.isInPresentationMode)return;const a=(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0);if(window.isKeyIgnored&&window.isKeyIgnored(a,"WHEEL"))return;const o=e.deltaMode;let l=Math.exp(-e.deltaY/100);const h=e.ctrlKey&&!D._isCtrlKeyDown&&o===WheelEvent.DOM_DELTA_PIXEL&&0===e.deltaX&&(Math.abs(l-1)<.05||!1)&&0===e.deltaZ;if(h||e.ctrlKey&&s.ctrlKey||e.metaKey&&s.metaKey){e.preventDefault();if(R||"hidden"===document.visibilityState)return;const t=i.currentScale;if(h&&r){l=D._accumulateFactor(t,l,"_wheelUnusedFactor");if(l<1)D.zoomOut(null,l);else{if(!(l>1))return;D.zoomIn(null,l)}}else{const t=(0,n.normalizeWheelEventDirection)(e);let i=0;if(o===WheelEvent.DOM_DELTA_LINE||o===WheelEvent.DOM_DELTA_PAGE)i=Math.abs(t)>=1?Math.sign(t):D._accumulateTicks(t,"_wheelUnusedTicks");else{const e=30;i=D._accumulateTicks(t/e,"_wheelUnusedTicks")}if(i<0)D.zoomOut(-i);else{if(!(i>0))return;D.zoomIn(i)}}D._centerAtPos(t,e.clientX,e.clientY)}else setZoomDisabledTimeout()}function webViewerTouchStart(e){if(D.pdfViewer.isInPresentationMode||e.touches.length<2)return;e.preventDefault();if(2!==e.touches.length){D._touchInfo=null;return}let[t,i]=e.touches;t.identifier>i.identifier&&([t,i]=[i,t]);D._touchInfo={touch0X:t.pageX,touch0Y:t.pageY,touch1X:i.pageX,touch1Y:i.pageY}}function webViewerTouchMove(e){if(!D._touchInfo||2!==e.touches.length)return;const{pdfViewer:t,_touchInfo:i,supportsPinchToZoom:n}=D;let[s,r]=e.touches;s.identifier>r.identifier&&([s,r]=[r,s]);const{pageX:a,pageY:o}=s,{pageX:l,pageY:h}=r,{touch0X:d,touch0Y:c,touch1X:u,touch1Y:p}=i;if(Math.abs(d-a)<=1&&Math.abs(c-o)<=1&&Math.abs(u-l)<=1&&Math.abs(p-h)<=1)return;i.touch0X=a;i.touch0Y=o;i.touch1X=l;i.touch1Y=h;if(d===a&&c===o){const e=u-a,t=p-o,i=l-a,n=h-o,s=e*n-t*i;if(Math.abs(s)>.02*Math.hypot(e,t)*Math.hypot(i,n))return}else if(u===l&&p===h){const e=d-l,t=c-h,i=a-l,n=o-h,s=e*n-t*i;if(Math.abs(s)>.02*Math.hypot(e,t)*Math.hypot(i,n))return}else{if((a-d)*(l-u)+(o-c)*(h-p)>=0)return}e.preventDefault();const g=Math.hypot(a-l,o-h)||1,f=Math.hypot(d-u,c-p)||1,m=t.currentScale;if(n){const e=D._accumulateFactor(m,g/f,"_touchUnusedFactor");if(e<1)D.zoomOut(null,e);else{if(!(e>1))return;D.zoomIn(null,e)}}else{const e=30,t=D._accumulateTicks((g-f)/e,"_touchUnusedTicks");if(t<0)D.zoomOut(-t);else{if(!(t>0))return;D.zoomIn(t)}}D._centerAtPos(m,(a+l)/2,(o+h)/2)}function webViewerTouchEnd(e){if(D._touchInfo){e.preventDefault();D._touchInfo=null;D._touchUnusedTicks=0;D._touchUnusedFactor=1}}function webViewerClick(e){if(!D.secondaryToolbar?.isOpen)return;const t=D.appConfig;if(D.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;D.secondaryToolbar.close()}}function webViewerKeyUp(e){"Control"===e.key&&(D._isCtrlKeyDown=!1)}function webViewerKeyDown(e){D._isCtrlKeyDown="Control"===e.key;if(D.overlayManager.active)return;const{eventBus:t,pdfViewer:i}=D,s=i.isInPresentationMode;let r=!1,a=!1;const o=(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0);if(window.isKeyIgnored&&window.isKeyIgnored(o,e.keyCode))return;if(1===o||8===o||5===o||12===o)switch(e.keyCode){case 70:if(!D.supportsIntegratedFind&&!e.shiftKey){D.findBar?.open();r=!0}break;case 71:if(!D.supportsIntegratedFind){const{state:e}=D.findController;if(e){const i={source:window,type:"again",findPrevious:5===o||12===o};t.dispatch("find",{...e,...i})}r=!0}break;case 61:case 107:case 187:case 171:D.zoomIn();r=!0;break;case 173:case 109:case 189:D.zoomOut();r=!0;break;case 48:case 96:if(!s){setTimeout((function(){D.zoomReset()}));r=!1}break;case 38:if(s||D.page>1){D.page=1;r=!0;a=!0}break;case 40:if(s||D.page<D.pagesCount){D.page=D.pagesCount;r=!0;a=!0}}if(1===o||8===o)switch(e.keyCode){case 83:t.dispatch("download",{source:window});r=!0;break;case 79:t.dispatch("openfile",{source:window});r=!0}if(3===o||10===o)switch(e.keyCode){case 80:D.requestPresentationMode();r=!0;D.externalServices.reportTelemetry({type:"buttons",data:{id:"presentationModeKeyboard"}});break;case 71:if(D.appConfig.toolbar){D.appConfig.toolbar.pageNumber.select();r=!0}}if(r){a&&!s&&i.focus();e.preventDefault();return}const l=(0,n.getActiveOrFocusedElement)(),h=l?.tagName.toUpperCase();if("INPUT"!==h&&"TEXTAREA"!==h&&"SELECT"!==h&&!l?.isContentEditable||27===e.keyCode){if(0===o){let t=0,o=!1;switch(e.keyCode){case 38:case 33:i.isVerticalScrollbarEnabled&&(o=!0);t=-1;break;case 8:s||(o=!0);t=-1;break;case 37:i.isHorizontalScrollbarEnabled&&(o=!0);case 75:case 80:t=-1;break;case 27:if(D.secondaryToolbar?.isOpen){D.secondaryToolbar.close();r=!0}if(!D.supportsIntegratedFind&&D.findBar?.opened){D.findBar.close();r=!0}break;case 40:case 34:i.isVerticalScrollbarEnabled&&(o=!0);t=1;break;case 13:case 32:s||(o=!0);t=1;break;case 39:i.isHorizontalScrollbarEnabled&&(o=!0);case 74:case 78:t=1;break;case 36:if(s||D.page>1){D.page=1;r=!0;a=!0}break;case 35:if(s||D.page<D.pagesCount){D.page=D.pagesCount;r=!0;a=!0}break;case 83:D.pdfCursorTools?.switchTool(n.CursorTool.SELECT);break;case 72:D.pdfCursorTools?.switchTool(n.CursorTool.HAND);break;case 82:D.rotatePages(90);break;case 115:D.pdfSidebar?.toggle()}if(0!==t&&(!o||"page-fit"===i.currentScaleValue)){t>0?i.nextPage():i.previousPage();r=!0}}if(4===o)switch(e.keyCode){case 13:case 32:if(!s&&"page-fit"!==i.currentScaleValue)break;i.previousPage();r=!0;break;case 82:D.rotatePages(-90)}a&&!i.containsElement(l)&&i.focus();r&&e.preventDefault()}}function beforeUnload(e){e.preventDefault();e.returnValue="";return!1}const F={instance:{supportsPrinting:!1,createPrintService(){throw new Error("Not implemented: createPrintService")}}};t.PDFPrintServiceFactory=F},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.animationStarted=t.VERTICAL_PADDING=t.UNKNOWN_SCALE=t.TextLayerMode=t.SpreadMode=t.SidebarView=t.ScrollMode=t.SCROLLBAR_PADDING=t.RenderingStates=t.RendererType=t.ProgressBar=t.PresentationModeState=t.OutputScale=t.MIN_SCALE=t.MAX_SCALE=t.MAX_AUTO_SCALE=t.DEFAULT_SCALE_VALUE=t.DEFAULT_SCALE_DELTA=t.DEFAULT_SCALE=t.CursorTool=t.AutoPrintRegExp=void 0;t.apiPageLayoutToViewerModes=function apiPageLayoutToViewerModes(e){let t=n.VERTICAL,i=s.NONE;switch(e){case"SinglePage":t=n.PAGE;break;case"OneColumn":break;case"TwoPageLeft":t=n.PAGE;case"TwoColumnLeft":i=s.ODD;break;case"TwoPageRight":t=n.PAGE;case"TwoColumnRight":i=s.EVEN}return{scrollMode:t,spreadMode:i}};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.docStyle=void 0;t.getActiveOrFocusedElement=function getActiveOrFocusedElement(){let e=document,t=e.activeElement||e.querySelector(":focus");for(;t?.shadowRoot;){e=t.shadowRoot;t=e.activeElement||e.querySelector(":focus")}return t};t.getPageSizeInches=function getPageSizeInches({view:e,userUnit:t,rotate:i}){const[n,s,r,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=[],d=new Set,c=t.length;let u=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});u>0&&u<c&&!n&&(u=backtrackBeforeAllVisibleElements(u,t,r));let p=n?l:-1;for(let e=u;e<c;e++){const i=t[e],s=i.div,c=s.offsetLeft+s.clientLeft,u=s.offsetTop+s.clientTop,g=s.clientWidth,f=s.clientHeight,m=c+g,b=u+f;if(-1===p)b>=a&&(p=b);else if((n?c:u)>p)break;if(b<=r||u>=a||m<=o||c>=l)continue;const v=Math.max(0,r-u)+Math.max(0,b-a),w=(g-(Math.max(0,o-c)+Math.max(0,m-l)))/g,_=(f-v)/f*w*100|0;h.push({id:i.id,x:c,y:u,view:i,percent:_,widthPercent:100*w|0});d.add(i.id)}const g=h[0],f=h.at(-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:g,last:f,views:h,ids:d}};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.noContextMenuHandler=function noContextMenuHandler(e){e.preventDefault()};t.normalizeWheelEventDelta=function normalizeWheelEventDelta(e){const t=e.deltaMode;let i=normalizeWheelEventDirection(e);t===WheelEvent.DOM_DELTA_PIXEL?i/=900:t===WheelEvent.DOM_DELTA_LINE&&(i/=30);return i};t.normalizeWheelEventDirection=normalizeWheelEventDirection;t.parseQueryString=function parseQueryString(e){const t=new Map;for(const[i,n]of new URLSearchParams(e))t.set(i.toLowerCase(),n);return t};t.removeNullCharacters=function removeNullCharacters(e,t=!1){if("string"!=typeof e){console.error("The argument must be a string.");return e}t&&(e=e.replace(a," "));return e.replace(r,"")};t.roundToDivide=function roundToDivide(e,t){const i=e%t;return 0===i?e:Math.round(e-i+t)};t.scrollIntoView=function scrollIntoView(e,t,i=!1,n=!1){if(e.classList.contains("stf__item")){Window.ngxConsole.log("don't scroll in book mode");return}let s=e.offsetParent;if(!s){Window.ngxConsole.error("offsetParent is not set -- cannot scroll");return}let r=e.offsetTop+e.clientTop,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.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.DEFAULT_SCALE_VALUE="auto";t.DEFAULT_SCALE=1;t.DEFAULT_SCALE_DELTA=1.1;t.MIN_SCALE=.1;t.MAX_SCALE=10;t.UNKNOWN_SCALE=0;t.MAX_AUTO_SCALE=1.25;t.SCROLLBAR_PADDING=40;t.VERTICAL_PADDING=5;t.RenderingStates={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3};t.PresentationModeState={UNKNOWN:0,NORMAL:1,CHANGING:2,FULLSCREEN:3};const i={UNKNOWN:-1,NONE:0,THUMBS:1,OUTLINE:2,ATTACHMENTS:3,LAYERS:4};t.SidebarView=i;t.RendererType={CANVAS:"canvas",SVG:"svg"};t.TextLayerMode={DISABLE:0,ENABLE:1};const n={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3};t.ScrollMode=n;const s={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2};t.SpreadMode=s;t.CursorTool={SELECT:0,HAND:1,ZOOM:2};t.AutoPrintRegExp=/\bprint\s*\(/;t.OutputScale=class OutputScale{constructor(){const e=window.devicePixelRatio||1;this.sx=e;this.sy=e}get scaled(){return 1!==this.sx||1!==this.sy}};const r=/\x00/g,a=/[\x01-\x1F]/g;function binarySearchFirstItem(e,t,i=0){let n=i,s=e.length-1;if(s<0||!t(e[s]))return e.length;if(t(e[n]))return n;for(;n<s;){const i=n+s>>1;t(e[i])?s=i:n=i+1}return n}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 o=new Promise((function(e){window.ngxZone.runOutsideAngular((()=>{window.requestAnimationFrame(e)}))}));t.animationStarted=o;const l=document.documentElement.style;t.docStyle=l;t.ProgressBar=class ProgressBar{#It=null;#Lt=null;#kt=0;#Dt=null;#pe=!0;constructor(e){this.#It=e.classList;this.#Dt=e.style}get percent(){return this.#kt}set percent(e){this.#kt=function clamp(e,t,i){return Math.min(Math.max(e,t),i)}(e,0,100);if(isNaN(e))this.#It.add("indeterminate");else{this.#It.remove("indeterminate");this.#Dt.setProperty("--progressBar-percent",`${this.#kt}%`)}}setWidth(e){if(!e)return;const t=e.parentNode.offsetWidth-e.offsetWidth;t>0&&this.#Dt.setProperty("--progressBar-end-offset",`${t}px`)}setDisableAutoFetch(e=5e3){if(!isNaN(this.#kt)){this.#Lt&&clearTimeout(this.#Lt);this.show();this.#Lt=setTimeout((()=>{this.#Lt=null;this.hide()}),e)}}hide(){if(this.#pe){this.#pe=!1;this.#It.add("hidden")}}show(){if(!this.#pe){this.#pe=!0;this.#It.remove("hidden")}}}},e=>{e.exports=window["pdfjs-dist/build/pdf"]},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.compatibilityParams=t.OptionKind=t.AppOptions=void 0;const i=Object.create(null);t.compatibilityParams=i;{const e=navigator.userAgent||"",t=navigator.platform||"",n=navigator.maxTouchPoints||1,s=/Android/.test(e),r=/\b(iPad|iPhone|iPod)(?=;)/.test(e)||"MacIntel"===t&&n>1;!function checkCanvasSizeLimitation(){(r||s)&&(i.maxCanvasPixels=5242880)}()}const n={VIEWER:2,API:4,WORKER:8,PREFERENCE:128};t.OptionKind=n;const s={annotationEditorMode:{value:0,kind:n.VIEWER+n.PREFERENCE},annotationMode:{value:2,kind:n.VIEWER+n.PREFERENCE},cursorToolOnLoad:{value:0,kind:n.VIEWER+n.PREFERENCE},defaultZoomDelay:{value:400,kind:n.VIEWER+n.PREFERENCE},defaultZoomValue:{value:"",kind:n.VIEWER+n.PREFERENCE},disableHistory:{value:!1,kind:n.VIEWER},disablePageLabels:{value:!1,kind:n.VIEWER+n.PREFERENCE},enablePermissions:{value:!1,kind:n.VIEWER+n.PREFERENCE},enablePrintAutoRotate:{value:!0,kind:n.VIEWER+n.PREFERENCE},enableScripting:{value:!0,kind:n.VIEWER+n.PREFERENCE},externalLinkRel:{value:"noopener noreferrer nofollow",kind:n.VIEWER},externalLinkTarget:{value:0,kind:n.VIEWER+n.PREFERENCE},historyUpdateUrl:{value:!1,kind:n.VIEWER+n.PREFERENCE},ignoreDestinationZoom:{value:!1,kind:n.VIEWER+n.PREFERENCE},imageResourcesPath:{value:"./images/",kind:n.VIEWER},maxCanvasPixels:{value:16777216,kind:n.VIEWER},forcePageColors:{value:!1,kind:n.VIEWER+n.PREFERENCE},pageColorsBackground:{value:"Canvas",kind:n.VIEWER+n.PREFERENCE},pageColorsForeground:{value:"CanvasText",kind:n.VIEWER+n.PREFERENCE},pdfBugEnabled:{value:!1,kind:n.VIEWER+n.PREFERENCE},printResolution:{value:150,kind:n.VIEWER},removePageBorders:{value:!1,kind:n.VIEWER+n.PREFERENCE},sidebarViewOnLoad:{value:-1,kind:n.VIEWER+n.PREFERENCE},scrollModeOnLoad:{value:-1,kind:n.VIEWER+n.PREFERENCE},spreadModeOnLoad:{value:-1,kind:n.VIEWER+n.PREFERENCE},textLayerMode:{value:1,kind:n.VIEWER+n.PREFERENCE},useOnlyCssZoom:{value:!1,kind:n.VIEWER+n.PREFERENCE},viewerCssTheme:{value:0,kind:n.VIEWER+n.PREFERENCE},viewOnLoad:{value:0,kind:n.VIEWER+n.PREFERENCE},cMapPacked:{value:!0,kind:n.API},cMapUrl:{value:"../web/cmaps/",kind:n.API},disableAutoFetch:{value:!1,kind:n.API+n.PREFERENCE},disableFontFace:{value:!1,kind:n.API+n.PREFERENCE},disableRange:{value:!1,kind:n.API+n.PREFERENCE},disableStream:{value:!1,kind:n.API+n.PREFERENCE},docBaseUrl:{value:"",kind:n.API},enableXfa:{value:!0,kind:n.API+n.PREFERENCE},fontExtraProperties:{value:!1,kind:n.API},isEvalSupported:{value:!0,kind:n.API},isOffscreenCanvasSupported:{value:!0,kind:n.API},maxImageSize:{value:-1,kind:n.API},pdfBug:{value:!1,kind:n.API},standardFontDataUrl:{value:"../web/standard_fonts/",kind:n.API},verbosity:{value:1,kind:n.API},workerPort:{value:null,kind:n.WORKER},workerSrc:{value:"./assets/pdf.worker.js",kind:n.WORKER}};s.defaultUrl={value:"compressed.tracemonkey-pldi-09.pdf",kind:n.VIEWER};s.disablePreferences={value:!1,kind:n.VIEWER};s.locale={value:navigator.language||"en-US",kind:n.VIEWER};s.renderer={value:"canvas",kind:n.VIEWER+n.PREFERENCE};s.sandboxBundleSrc={value:"../build/pdf.sandbox.js",kind:n.VIEWER};const r=Object.create(null);if(globalThis.pdfDefaultOptions)for(const e in globalThis.pdfDefaultOptions)r[e]=globalThis.pdfDefaultOptions[e];class AppOptions{constructor(){throw new Error("Cannot initialize AppOptions.")}static get(e){const t=r[e];if(void 0!==t)return t;const n=s[e];return void 0!==n?i[e]??n.value:void 0}static getAll(e=null){const t=Object.create(null);for(const a in s){const o=s[a];if(e){if(0==(e&o.kind))continue;if(e===n.PREFERENCE){const e=o.value,i=typeof e;if("boolean"===i||"string"===i||"number"===i&&Number.isInteger(e)){t[a]=e;continue}throw new Error(`Invalid type for preference: ${a}`)}}const l=r[a];t[a]=void 0!==l?l:i[a]??o.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]}}t.AppOptions=AppOptions;AppOptions._hasUserOptions=function(){return Object.keys(r).length>0}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.WaitOnType=t.EventBus=t.AutomationEventBus=void 0;t.waitOnEventOrTimeout=function waitOnEventOrTimeout({target:e,name:t,delay:n=0}){return new Promise((function(s,r){if("object"!=typeof e||!t||"string"!=typeof t||!(Number.isInteger(n)&&n>=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");function handler(i){e instanceof EventBus?e._off(t,a):e.removeEventListener(t,a);l&&clearTimeout(l);s(i)}const a=handler.bind(null,i.EVENT);e instanceof EventBus?e._on(t,a):e.addEventListener(t,a);const o=handler.bind(null,i.TIMEOUT),l=setTimeout(o,n)}))};const i={EVENT:"event",TIMEOUT:"timeout"};t.WaitOnType=i;class EventBus{#i=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.#i[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.#i[e]||=[]).push({listener:t,external:!0===i?.external,once:!0===i?.once})}_off(e,t,i=null){const n=this.#i[e];if(n)for(let e=0,i=n.length;e<i;e++)if(n[e].listener===t){n.splice(e,1);return}}}t.EventBus=EventBus;t.AutomationEventBus=class AutomationEventBus extends EventBus{dispatch(e,t){throw new Error("Not implemented: AutomationEventBus.dispatch")}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.SimpleLinkService=t.PDFLinkService=t.LinkTarget=void 0;var n=i(3);const s="noopener noreferrer nofollow",r={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};t.LinkTarget=r;function addLinkAttributes(e,{url:t,target:i,rel:a,enabled:o=!0}={}){if(!t||"string"!=typeof t)throw new Error('A valid "url" parameter must provided.');const l=(0,n.removeNullCharacters)(t);if(o)e.href=e.title=l;else{e.href="";e.title=`Disabled: ${l}`;e.onclick=()=>!1}let h="";switch(i){case r.NONE:break;case r.SELF:h="_self";break;case r.BLANK:h="_blank";break;case r.PARENT:h="_parent";break;case r.TOP:h="_top"}e.target=h;e.rel="string"==typeof a?a:s}class PDFLinkService{#Rt=new Map;constructor({eventBus:e,externalLinkTarget:t=null,externalLinkRel:i=null,ignoreDestinationZoom:n=!1}={}){this.eventBus=e;this.externalLinkTarget=t;this.externalLinkRel=i;this.externalLinkEnabled=!0;this._ignoreDestinationZoom=n;this.baseUrl=null;this.pdfDocument=null;this.pdfViewer=null;this.pdfHistory=null}setDocument(e,t=null){this.baseUrl=t;this.pdfDocument=e;this.#Rt.clear()}setViewer(e){this.pdfViewer=e}setHistory(e){this.pdfHistory=e}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return this.pdfViewer.currentPageNumber}set page(e){this.pdfViewer.currentPageNumber=e}get rotation(){return this.pdfViewer.pagesRotation}set rotation(e){this.pdfViewer.pagesRotation=e}get isInPresentationMode(){return this.pdfViewer.isInPresentationMode}#Ft(e,t=null,i){const n=i[0];let s;if("object"==typeof n&&null!==n){s=this._cachedPageNumber(n);if(!s){this.pdfDocument.getPageIndex(n).then((s=>{this.cachePageRef(s+1,n);this.#Ft(e,t,i)})).catch((()=>{Window.ngxConsole.error(`PDFLinkService.#goToDestinationHelper: "${n}" is not a valid page reference, for dest="${e}".`)}));return}}else{if(!Number.isInteger(n)){Window.ngxConsole.error(`PDFLinkService.#goToDestinationHelper: "${n}" is not a valid destination reference, for dest="${e}".`);return}s=n+1}if(!s||s<1||s>this.pagesCount)Window.ngxConsole.error(`PDFLinkService.#goToDestinationHelper: "${s}" is not a valid page number, for dest="${e}".`);else{if(this.pdfHistory){this.pdfHistory.pushCurrentPosition();this.pdfHistory.push({namedDest:t,explicitDest:i,pageNumber:s})}this.pdfViewer.scrollPageIntoView({pageNumber:s,destArray:i,ignoreDestinationZoom:this._ignoreDestinationZoom})}}async goToDestination(e){if(!this.pdfDocument)return;let t,i;if("string"==typeof e){t=e;i=await this.pdfDocument.getDestination(e)}else{t=null;i=await e}Array.isArray(i)?this.#Ft(e,t,i):Window.ngxConsole.error(`PDFLinkService.goToDestination: "${i}" is not a valid destination array, for dest="${e}".`)}goToPage(e){if(!this.pdfDocument)return;const t="string"==typeof e&&this.pdfViewer.pageLabelToPageNumber(e)||0|e;if(Number.isInteger(t)&&t>0&&t<=this.pagesCount){if(this.pdfHistory){this.pdfHistory.pushCurrentPosition();this.pdfHistory.pushPage(t)}if("book"===this.pdfViewer.pageViewMode){if(this.pdfViewer.pageFlip){this.pdfViewer.ensureAdjecentPagesAreLoaded();const e=this.pdfViewer.currentPageNumber-this.pdfViewer.currentPageNumber%2,i=t-t%2;e===i-2?this.pdfViewer.pageFlip.flipNext():e===i+2?this.pdfViewer.pageFlip.flipPrev():this.pdfViewer.pageFlip.turnToPage(t-1)}}else this.pdfViewer.scrollPageIntoView({pageNumber:t})}else Window.ngxConsole.error(`PDFLinkService.goToPage: "${e}" is not a valid page.`)}addLinkAttributes(e,t,i=!1){addLinkAttributes(e,{url:t,target:i?r.BLANK:this.externalLinkTarget,rel:this.externalLinkRel,enabled:this.externalLinkEnabled})}getDestinationHash(e){if("string"==typeof e){if(e.length>0)return this.getAnchorUrl("#"+escape(e))}else if(Array.isArray(e)){const t=JSON.stringify(e);if(t.length>0)return this.getAnchorUrl("#"+escape(t))}return this.getAnchorUrl("")}getAnchorUrl(e){return(this.baseUrl||"")+e}setHash(e){if(!this.pdfDocument)return;let t,i;if(e.includes("=")){const s=(0,n.parseQueryString)(e);s.has("search")&&this.eventBus.dispatch("findfromurlhash",{source:this,query:s.get("search").replace(/"/g,""),phraseSearch:"true"===s.get("phrase")});s.has("page")&&(t=0|s.get("page")||1);if(s.has("zoom")){const e=s.get("zoom").split(","),t=e[0],n=parseFloat(t);t.includes("Fit")?"Fit"===t||"FitB"===t?i=[null,{name:t}]:"FitH"===t||"FitBH"===t||"FitV"===t||"FitBV"===t?i=[null,{name:t},e.length>1?0|e[1]:null]:"FitR"===t?5!==e.length?Window.ngxConsole.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):i=[null,{name:t},0|e[1],0|e[2],0|e[3],0|e[4]]:Window.ngxConsole.error(`PDFLinkService.setHash: "${t}" is not a valid zoom value.`):i=[null,{name:"XYZ"},e.length>1?0|e[1]:null,e.length>2?0|e[2]:null,n?n/100:t]}i?this.pdfViewer.scrollPageIntoView({pageNumber:t||this.page,destArray:i,allowNegativeOffset:!0}):t&&(this.page=t);s.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:s.get("pagemode")});s.has("nameddest")&&this.goToDestination(s.get("nameddest"))}else{i=unescape(e);try{i=JSON.parse(i);Array.isArray(i)||(i=i.toString())}catch(e){}if("string"==typeof i||PDFLinkService.#Ot(i)){this.goToDestination(i);return}Window.ngxConsole.error(`PDFLinkService.setHash: "${unescape(e)}" is not a valid destination.`)}}executeNamedAction(e){switch(e){case"GoBack":this.pdfHistory?.back();break;case"GoForward":this.pdfHistory?.forward();break;case"NextPage":this.pdfViewer.nextPage();break;case"PrevPage":this.pdfViewer.previousPage();break;case"LastPage":this.page=this.pagesCount;break;case"FirstPage":this.page=1}this.eventBus.dispatch("namedaction",{source:this,action:e})}async executeSetOCGState(e){const t=this.pdfDocument,i=await this.pdfViewer.optionalContentConfigPromise;if(t!==this.pdfDocument)return;let n;for(const t of e.state){switch(t){case"ON":case"OFF":case"Toggle":n=t;continue}switch(n){case"ON":i.setVisibility(t,!0);break;case"OFF":i.setVisibility(t,!1);break;case"Toggle":const e=i.getGroup(t);e&&i.setVisibility(t,!e.visible)}}this.pdfViewer.optionalContentConfigPromise=Promise.resolve(i)}cachePageRef(e,t){if(!t)return;const i=0===t.gen?`${t.num}R`:`${t.num}R${t.gen}`;this.#Rt.set(i,e)}_cachedPageNumber(e){if(!e)return null;const t=0===e.gen?`${e.num}R`:`${e.num}R${e.gen}`;return this.#Rt.get(t)||null}isPageVisible(e){return this.pdfViewer.isPageVisible(e)}isPageCached(e){return this.pdfViewer.isPageCached(e)}static#Ot(e){if(!Array.isArray(e))return!1;const t=e.length;if(t<2)return!1;const i=e[0];if(!("object"==typeof i&&Number.isInteger(i.num)&&Number.isInteger(i.gen)||Number.isInteger(i)&&i>=0))return!1;const n=e[1];if("object"!=typeof n||"string"!=typeof n.name)return!1;let s=!0;switch(n.name){case"XYZ":if(5!==t)return!1;break;case"Fit":case"FitB":return 2===t;case"FitH":case"FitBH":case"FitV":case"FitBV":if(3!==t)return!1;break;case"FitR":if(6!==t)return!1;s=!1;break;default:return!1}for(let i=2;i<t;i++){const t=e[i];if(!("number"==typeof t||s&&null===t))return!1}return!0}}t.PDFLinkService=PDFLinkService;t.SimpleLinkService=class SimpleLinkService{constructor(){this.externalLinkEnabled=!0}get pagesCount(){return 0}get page(){return 0}set page(e){}get rotation(){return 0}set rotation(e){}get isInPresentationMode(){return!1}async goToDestination(e){}goToPage(e){}addLinkAttributes(e,t,i=!1){addLinkAttributes(e,{url:t,enabled:this.externalLinkEnabled})}getDestinationHash(e){return"#"}getAnchorUrl(e){return"#"}setHash(e){}executeNamedAction(e){}executeSetOCGState(e){}cachePageRef(e,t){}isPageVisible(e){return!0}isPageCached(e){return!0}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.AnnotationEditorParams=void 0;var n=i(4);t.AnnotationEditorParams=class AnnotationEditorParams{constructor(e,t){this.eventBus=t;this.#Nt(e)}#Nt({editorFreeTextFontSize:e,editorFreeTextColor:t,editorInkColor:i,editorInkThickness:s,editorInkOpacity:r}){e.addEventListener("input",(t=>{this.eventBus.dispatch("switchannotationeditorparams",{source:this,type:n.AnnotationEditorParamsType.FREETEXT_SIZE,value:e.valueAsNumber})}));t.addEventListener("input",(e=>{this.eventBus.dispatch("switchannotationeditorparams",{source:this,type:n.AnnotationEditorParamsType.FREETEXT_COLOR,value:t.value})}));i.addEventListener("input",(e=>{this.eventBus.dispatch("switchannotationeditorparams",{source:this,type:n.AnnotationEditorParamsType.INK_COLOR,value:i.value})}));s.addEventListener("input",(e=>{this.eventBus.dispatch("switchannotationeditorparams",{source:this,type:n.AnnotationEditorParamsType.INK_THICKNESS,value:s.valueAsNumber})}));r.addEventListener("input",(e=>{this.eventBus.dispatch("switchannotationeditorparams",{source:this,type:n.AnnotationEditorParamsType.INK_OPACITY,value:r.valueAsNumber})}));this.eventBus._on("annotationeditorparamschanged",(a=>{for(const[o,l]of a.details)switch(o){case n.AnnotationEditorParamsType.FREETEXT_SIZE:e.value=l;break;case n.AnnotationEditorParamsType.FREETEXT_COLOR:t.value=l;break;case n.AnnotationEditorParamsType.INK_COLOR:i.value=l;break;case n.AnnotationEditorParamsType.INK_THICKNESS:s.value=l;break;case n.AnnotationEditorParamsType.INK_OPACITY:r.value=l}}))}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.OverlayManager=void 0;t.OverlayManager=class OverlayManager{#Bt=new WeakMap;#Vt=null;get active(){return this.#Vt}async register(e,t=!1){if("object"!=typeof e)throw new Error("Not enough parameters.");if(this.#Bt.has(e))throw new Error("The overlay is already registered.");this.#Bt.set(e,{canForceClose:t});e.addEventListener("cancel",(e=>{this.#Vt=null}))}async unregister(e){if(!this.#Bt.has(e))throw new Error("The overlay does not exist.");if(this.#Vt===e)throw new Error("The overlay cannot be removed while it is active.");this.#Bt.delete(e)}async open(e){if(!this.#Bt.has(e))throw new Error("The overlay does not exist.");if(this.#Vt){if(this.#Vt===e)throw new Error("The overlay is already active.");if(!this.#Bt.get(e).canForceClose)throw new Error("Another overlay is currently active.");await this.close()}this.#Vt=e;e.showModal();e.classList.remove("hidden")}async close(e=this.#Vt){if(!this.#Bt.has(e))throw new Error("The overlay does not exist.");if(!this.#Vt)throw new Error("The overlay is currently not active.");if(this.#Vt!==e)throw new Error("Another overlay is currently active.");e.close();this.#Vt=null}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PasswordPrompt=void 0;var n=i(4);t.PasswordPrompt=class PasswordPrompt{#Ut=null;#Wt=null;#Ht=null;constructor(e,t,i,n=!1){this.dialog=e.dialog;this.label=e.label;this.input=e.input;this.submitButton=e.submitButton;this.cancelButton=e.cancelButton;this.overlayManager=t;this.l10n=i;this._isViewerEmbedded=n;this.submitButton.addEventListener("click",this.#jt.bind(this));this.cancelButton.addEventListener("click",this.close.bind(this));this.input.addEventListener("keydown",(e=>{13===e.keyCode&&this.#jt()}));this.overlayManager.register(this.dialog,!0);this.dialog.addEventListener("close",this.#zt.bind(this))}async open(){this.#Ut&&await this.#Ut.promise;this.#Ut=(0,n.createPromiseCapability)();try{await this.overlayManager.open(this.dialog);this.input.type="password";this.input.focus()}catch(e){this.#Ut=null;throw e}const e=this.#Ht===n.PasswordResponses.INCORRECT_PASSWORD;this._isViewerEmbedded&&!e||this.input.focus();this.label.textContent=await this.l10n.get("password_"+(e?"invalid":"label"))}async close(){if(this.overlayManager.active===this.dialog){this.overlayManager.close(this.dialog);this.input.value="";this.input.type="hidden"}}#jt(){const e=this.input.value;e?.length>0&&this.#Gt(e)}#zt(){this.#Gt(new Error("PasswordPrompt cancelled."));this.#Ut.resolve()}#Gt(e){if(this.#Wt){this.close();this.input.value="";this.#Wt(e);this.#Wt=null}}async setUpdateCallback(e,t){this.#Ut&&await this.#Ut.promise;this.#Wt=e;this.#Ht=t}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFAttachmentViewer=void 0;var n=i(4),s=i(12),r=i(6);class PDFAttachmentViewer extends s.BaseTreeViewer{constructor(e){super(e);this.downloadManager=e.downloadManager;this.eventBus._on("fileattachmentannotation",this.#qt.bind(this))}reset(e=!1){super.reset();this._attachments=null;e||(this._renderedCapability=(0,n.createPromiseCapability)());this._pendingDispatchEvent=!1}async _dispatchEvent(e){this._renderedCapability.resolve();if(0===e&&!this._pendingDispatchEvent){this._pendingDispatchEvent=!0;await(0,r.waitOnEventOrTimeout)({target:this.eventBus,name:"annotationlayerrendered",delay:1e3});if(!this._pendingDispatchEvent)return}this._pendingDispatchEvent=!1;this.eventBus.dispatch("attachmentsloaded",{source:this,attachmentsCount:e})}_bindLink(e,{content:t,filename:i}){e.onclick=()=>{this.downloadManager.openOrDownloadData(e,t,i);return!1}}render({attachments:e,keepRenderedCapability:t=!1}){this._attachments&&this.reset(t);this._attachments=e||null;if(!e){this._dispatchEvent(0);return}const i=Object.keys(e).sort((function(e,t){return e.toLowerCase().localeCompare(t.toLowerCase())})),s=document.createDocumentFragment();let r=0;for(const t of i){const i=e[t],a=i.content,o=(0,n.getFilenameFromUrl)(i.filename,!0),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.append(h);s.append(l);r++}this._finishRendering(s,r)}#qt({filename:e,content:t}){const i=this._renderedCapability.promise;i.then((()=>{if(i!==this._renderedCapability.promise)return;const n=this._attachments||Object.create(null);for(const t in n)if(e===t)return;n[e]={filename:e,content:t};this.render({attachments:n,keepRenderedCapability:!0})}))}}t.PDFAttachmentViewer=PDFAttachmentViewer},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.BaseTreeViewer=void 0;var n=i(3);const s="selected";class BaseTreeViewer{constructor(e){if(this.constructor===BaseTreeViewer)throw new Error("Cannot initialize BaseTreeViewer.");this.container=e.container;this.eventBus=e.eventBus;this.reset()}reset(){this._pdfDocument=null;this._lastToggleIsShow=!0;this._currentTreeItem=null;this.container.textContent="";this.container.classList.remove("treeWithDeepNesting")}_dispatchEvent(e){throw new Error("Not implemented: _dispatchEvent")}_bindLink(e,t){throw new Error("Not implemented: _bindLink")}_normalizeTextContent(e){return(0,n.removeNullCharacters)(e,!0)||"–"}_addToggleButton(e,t=!1){const i=document.createElement("div");i.className="treeItemToggler";t&&i.classList.add("treeItemsHidden");i.onclick=t=>{t.stopPropagation();i.classList.toggle("treeItemsHidden");if(t.shiftKey){const t=!i.classList.contains("treeItemsHidden");this._toggleTreeItem(e,t)}};e.prepend(i)}_toggleTreeItem(e,t=!1){this._lastToggleIsShow=t;for(const i of e.querySelectorAll(".treeItemToggler"))i.classList.toggle("treeItemsHidden",!t)}_toggleAllTreeItems(){this._toggleTreeItem(this.container,!this._lastToggleIsShow)}_finishRendering(e,t,i=!1){if(i){this.container.classList.add("treeWithDeepNesting");this._lastToggleIsShow=!e.querySelector(".treeItemsHidden")}this.container.append(e);this._dispatchEvent(t)}render(e){throw new Error("Not implemented: render")}_updateCurrentTreeItem(e=null){if(this._currentTreeItem){this._currentTreeItem.classList.remove(s);this._currentTreeItem=null}if(e){e.classList.add(s);this._currentTreeItem=e}}_scrollToCurrentTreeItem(e){if(!e)return;let t=e.parentNode;for(;t&&t!==this.container;){if(t.classList.contains("treeItem")){t.firstElementChild?.classList.remove("treeItemsHidden")}t=t.parentNode}this._updateCurrentTreeItem(e);this.container.scrollTo(e.offsetLeft,e.offsetTop+-100)}}t.BaseTreeViewer=BaseTreeViewer},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFCursorTools=void 0;var n=i(3),s=i(4),r=i(14);t.PDFCursorTools=class PDFCursorTools{constructor({container:e,eventBus:t,cursorToolOnLoad:i=n.CursorTool.SELECT}){this.container=e;this.eventBus=t;this.active=n.CursorTool.SELECT;this.previouslyActive=null;this.handTool=new r.GrabToPan({element:this.container});this.#$t();Promise.resolve().then((()=>{this.switchTool(i)}))}get activeTool(){return this.active}switchTool(e){if(null!==this.previouslyActive)return;if(e===this.active)return;const disableActiveTool=()=>{switch(this.active){case n.CursorTool.SELECT:break;case n.CursorTool.HAND:this.handTool.deactivate();case n.CursorTool.ZOOM:}};switch(e){case n.CursorTool.SELECT:disableActiveTool();break;case n.CursorTool.HAND:disableActiveTool();this.handTool.activate();break;case n.CursorTool.ZOOM:default:Window.ngxConsole.error(`switchTool: "${e}" is an unsupported value.`);return}this.active=e;this.#Xt()}#Xt(){this.eventBus.dispatch("cursortoolchanged",{source:this,tool:this.active})}#$t(){this.eventBus._on("switchcursortool",(e=>{this.switchTool(e.tool)}));let e=s.AnnotationEditorType.NONE,t=n.PresentationModeState.NORMAL;const disableActive=()=>{const e=this.active;this.switchTool(n.CursorTool.SELECT);this.previouslyActive??=e},enableActive=()=>{const i=this.previouslyActive;if(null!==i&&e===s.AnnotationEditorType.NONE&&t===n.PresentationModeState.NORMAL){this.previouslyActive=null;this.switchTool(i)}};this.eventBus._on("secondarytoolbarreset",(i=>{if(null!==this.previouslyActive){e=s.AnnotationEditorType.NONE;t=n.PresentationModeState.NORMAL;enableActive()}}));this.eventBus._on("annotationeditormodechanged",(({mode:t})=>{e=t;t===s.AnnotationEditorType.NONE?enableActive():disableActive()}));this.eventBus._on("presentationmodechanged",(({state:e})=>{t=e;e===n.PresentationModeState.NORMAL?enableActive():e===n.PresentationModeState.FULLSCREEN&&disableActive()}))}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.GrabToPan=void 0;const i="grab-to-pan-grab";t.GrabToPan=class GrabToPan{constructor(e){this.element=e.element;this.document=e.element.ownerDocument;"function"==typeof e.ignoreTarget&&(this.ignoreTarget=e.ignoreTarget);this.onActiveChanged=e.onActiveChanged;this.activate=this.activate.bind(this);this.deactivate=this.deactivate.bind(this);this.toggle=this.toggle.bind(this);this._onMouseDown=this.#Kt.bind(this);this._onMouseMove=this.#Yt.bind(this);this._endPan=this.#Qt.bind(this);(this.overlay=document.createElement("div")).className="grab-to-pan-grabbing"}activate(){if(!this.active){this.active=!0;this.element.addEventListener("mousedown",this._onMouseDown);this.element.classList.add(i);this.onActiveChanged?.(!0)}}deactivate(){if(this.active){this.active=!1;this.element.removeEventListener("mousedown",this._onMouseDown);this._endPan();this.element.classList.remove(i);this.onActiveChanged?.(!1)}}toggle(){this.active?this.deactivate():this.activate()}ignoreTarget(e){return!!document.querySelector(".stf__item")||e.matches("a[href], a[href] *, input, textarea, button, button *, select, option")}#Kt(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()}#Yt(e){this.element.removeEventListener("scroll",this._endPan,!0);if(!(1&e.buttons)){this._endPan();return}const t=e.clientX-this.clientXStart,i=e.clientY-this.clientYStart,n=this.scrollTopStart-i,s=this.scrollLeftStart-t;if(this.element.scrollTo)this.element.scrollTo({top:n,left:s,behavior:"instant"});else{this.element.scrollTop=n;this.element.scrollLeft=s}this.overlay.parentNode||document.body.append(this.overlay)}#Qt(){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.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{#Zt=null;constructor({dialog:e,fields:t,closeButton:i},n,s,a,o){this.dialog=e;this.fields=t;this.overlayManager=n;this.l10n=a;this._fileNameLookup=o;this.#Jt();i.addEventListener("click",this.close.bind(this));this.overlayManager.register(this.dialog);s._on("pagechanging",(e=>{this._currentPageNumber=e.pageNumber}));s._on("rotationchanging",(e=>{this._pagesRotation=e.pagesRotation}));this._isNonMetricLocale=!0;a.getLanguage().then((e=>{this._isNonMetricLocale=r.includes(e)}))}async open(){await Promise.all([this.overlayManager.open(this.dialog),this._dataAvailableCapability.promise]);const e=this._currentPageNumber,t=this._pagesRotation;if(this.#Zt&&e===this.#Zt._currentPageNumber&&t===this.#Zt._pagesRotation){this.#ei();return}const{info:i,contentLength:n}=await this.pdfDocument.getMetadata(),[r,a,o,l,h,d]=await Promise.all([this._fileNameLookup(),this.#ti(n),this.#ii(i.CreationDate),this.#ii(i.ModDate),this.pdfDocument.getPage(e).then((e=>this.#ni((0,s.getPageSizeInches)(e),t))),this.#si(i.IsLinearized)]);this.#Zt=Object.freeze({fileName:r,fileSize:a,title:i.Title,author:i.Author,subject:i.Subject,keywords:i.Keywords,creationDate:o,modificationDate:l,creator:i.Creator,producer:i.Producer,version:i.PDFFormatVersion,pageCount:this.pdfDocument.numPages,pageSize:h,linearized:d,_currentPageNumber:e,_pagesRotation:t});this.#ei();const{length:c}=await this.pdfDocument.getDownloadInfo();if(n===c)return;const u=Object.assign(Object.create(null),this.#Zt);u.fileSize=await this.#ti(c);this.#Zt=Object.freeze(u);this.#ei()}async close(){this.overlayManager.close(this.dialog)}setDocument(e){if(this.pdfDocument){this.#Jt();this.#ei(!0)}if(e){this.pdfDocument=e;this._dataAvailableCapability.resolve()}}#Jt(){this.pdfDocument=null;this.#Zt=null;this._dataAvailableCapability=(0,n.createPromiseCapability)();this._currentPageNumber=1;this._pagesRotation=0}#ei(e=!1){if(!e&&this.#Zt){if(this.overlayManager.active===this.dialog)for(const e in this.fields){const t=this.#Zt[e];this.fields[e].textContent=t||0===t?t:"-"}}else for(const e in this.fields)this.fields[e].textContent="-"}async#ti(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#ni(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:d},c,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:d.toLocaleString(),unit:c,name:u,orientation:p})}async#ii(e){const t=n.PDFDateString.toDateObject(e);if(t)return this.l10n.get("document_properties_date_string",{date:t.toLocaleDateString(),time:t.toLocaleTimeString()})}#si(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(17);t.PDFFindBar=class PDFFindBar{constructor(e,t,i){this.opened=!1;this.bar=e.bar;this.toggleButton=e.toggleButton;this.findField=e.findField;this.highlightAll=e.highlightAllCheckbox;this.currentPage=e.findCurrentPageCheckbox;this.pageRange=e.findPageRangeField;this.caseSensitive=e.caseSensitiveCheckbox;this.matchDiacritics=e.matchDiacriticsCheckbox;this.entireWord=e.entireWordCheckbox;this.findMsg=e.findMsg;this.findResultsCount=e.findResultsCount;this.findPreviousButton=e.findPreviousButton;this.findNextButton=e.findNextButton;this.findFieldMultiline=e.findFieldMultiline||null;this.multipleSearchTexts=e.findMultipleSearchTextsCheckbox||null;this.ignoreAccents=e.ignoreAccentsCheckbox||null;this.fuzzySearch=e.fuzzyCheckbox||null;this.eventBus=t;this.l10n=i;this.toggleButton.addEventListener("click",(()=>{this.toggle()}));this.findFieldMultiline.addEventListener("input",(()=>{this.dispatchEvent("")}));this.findField.addEventListener("input",(()=>{this.dispatchEvent("")}));this.bar.addEventListener("keydown",(e=>{switch(e.keyCode){case 13:e.target===this.findField&&this.dispatchEvent("again",e.shiftKey);break;case 27:this.close()}}));this.findPreviousButton.addEventListener("click",(()=>{this.dispatchEvent("again",!0)}));this.findNextButton.addEventListener("click",(()=>{this.dispatchEvent("again",!1)}));this.highlightAll.addEventListener("click",(()=>{this.dispatchEvent("highlightallchange")}));this.caseSensitive.addEventListener("click",(()=>{this.dispatchEvent("casesensitivitychange")}));this.entireWord.addEventListener("click",(()=>{this.dispatchEvent("entirewordchange")}));this.multipleSearchTexts.addEventListener("click",(()=>{this.dispatchEvent("multiplesearchtextschange")}));this.ignoreAccents.addEventListener("click",(()=>{this.dispatchEvent("ignoreAccentsChange")}));this.fuzzySearch.addEventListener("click",(()=>{this.dispatchEvent("fuzzySearchChange")}));this.currentPage.addEventListener("click",(()=>{this.dispatchEvent("currentPageChange")}));this.pageRange.addEventListener("input",(()=>{this.dispatchEvent("pageRangeChange")}));this.matchDiacritics?.addEventListener("click",(()=>{this.dispatchEvent("diacriticmatchingchange")}));this.eventBus._on("resize",this.#ri.bind(this))}reset(){this.updateUIState()}dispatchEvent(e,t=!1){this.eventBus.dispatch("find",{source:this,type:e,query:this.findFieldMultiline.classList.contains("hidden")?this.findField.value:this.findFieldMultiline.value+"\n",phraseSearch:!this.multipleSearchTexts.checked,caseSensitive:this.caseSensitive.checked,entireWord:this.entireWord.checked,ignoreAccents:this.ignoreAccents.checked,fuzzySearch:this.fuzzySearch.checked,highlightAll:this.highlightAll.checked,currentPage:this.currentPage.checked,pageRange:this.pageRange.value,findPrevious:t,matchDiacritics:this.matchDiacritics?.checked})}updateUIState(e,t,i){let s=Promise.resolve(""),r="";switch(e){case n.FindState.FOUND:break;case n.FindState.PENDING:r="pending";break;case n.FindState.NOT_FOUND:s=this.l10n.get("find_not_found");r="notFound";break;case n.FindState.WRAPPED:s=this.l10n.get("find_reached_"+(t?"top":"bottom"))}this.findField.setAttribute("data-status",r);this.findFieldMultiline.classList.toggle("notFound","notFound"===r);this.findFieldMultiline.setAttribute("data-status",r);this.findField.setAttribute("aria-invalid",e===n.FindState.NOT_FOUND);s.then((e=>{this.findMsg.textContent=e;this.#ri()}));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.#ri()}))}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.#ri()}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()}#ri(){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(18),r=i(19),a=i(20),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","\n":" "};new Set([12441,12442,2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,3642,3770,3972,4153,4154,5908,5940,6098,6752,6980,7082,7083,7154,7155,11647,43014,43052,43204,43347,43456,43766,44013,3158,3953,3954,3962,3963,3964,3965,3968,3956]);const d=/\p{M}+/gu,c=/[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g,u=new Map,p="[\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f]",g=new Map;let f=null,m=null;function normalize(e){const t=[];let i,n;for(;null!==(i=c.exec(e));){let{index:e}=i;for(const n of i[0]){let i=u.get(n);if(!i){i=n.normalize("NFD").length;u.set(n,i)}t.push([i,e++])}}if(0===t.length&&f)n=f;else if(t.length>0&&m)n=m;else{const e=`([${Object.keys(h).join("")}])|([${"①-⑳Ⓐ-⓿㉄-㊿㋐-㋾＀-￯"}])|(${"(?:゙|゚)"}\\n)|(\\p{M}+(?:-\\n)?)|(\\S-\\n)|(${"(?:\\p{Ideographic}|[぀-ヿ])"}\\n)|(\\n)`;n=0===t.length?f=new RegExp(e+"|(\\u0000)","gum"):m=new RegExp(e+`|(${p})`,"gum")}const s=[];for(;null!==(i=d.exec(e));)s.push([i[0].length,i.index]);let r=e.normalize("NFD");const a=[[0,0]];let o=0,l=0,b=0,v=0,w=0,_=!1;r=r.replace(n,((e,i,n,r,d,c,u,p,f,m)=>{m-=v;if(i){const e=h[i],t=e.length;for(let e=1;e<t;e++)a.push([m-b+e,b-e]);b-=t-1;return e}if(n){let e=g.get(n);if(!e){e=n.normalize("NFKC");g.set(n,e)}const t=e.length;for(let e=1;e<t;e++)a.push([m-b+e,b-e]);b-=t-1;return e}if(r){_=!0;if(m+w===s[o]?.[1])++o;else{a.push([m-1-b+1,b-1]);b-=1;v+=1}a.push([m-b+1,b]);v+=1;w+=1;return r.charAt(0)}if(d){const e=d.endsWith("\n"),t=e?d.length-2:d.length;_=!0;let i=t;if(m+w===s[o]?.[1]){i-=s[o][0];++o}for(let e=1;e<=i;e++)a.push([m-1-b+e,b-e]);b-=i;v+=i;if(e){m+=t-1;a.push([m-b+1,1+b]);b+=1;v+=1;w+=1;return d.slice(0,t)}return d}if(c){a.push([m-b+1,1+b]);b+=1;v+=1;w+=1;return c.charAt(0)}if(u){a.push([m-b+1,b]);v+=1;w+=1;return u.charAt(0)}if(p){a.push([m-b+1,b-1]);b-=1;v+=1;w+=1;return" "}if(m+w===t[l]?.[1]){const e=t[l][0]-1;++l;for(let t=1;t<=e;t++)a.push([m-(b-t),b-t]);b-=e;v+=e}return f}));a.push([r.length,b]);return[r,a,_]}function getOriginalIndex(e,t=null){if(!t)return e;let i=0;for(const[n,s]of t){const t=n+i;if(n>=e)break;if(n+s>e){i+=e-t;break}i+=s}return e-i}t.PDFFindController=class PDFFindController{constructor({linkService:e,eventBus:t,pageViewMode:i}){this._linkService=e;this._eventBus=t;this._pageViewMode=i;this._reset();t._on("find",this._onFind.bind(this));t._on("findbarclose",this._onFindBarClose.bind(this));this.executeCommand=(e,t)=>{Window.ngxConsole.error('Deprecated method `PDFFindController.executeCommand` called, please dispatch a "find"-event using the EventBus instead.');const i=Object.assign(Object.create(null),t,{type:e.substring("find".length)});this._onFind(i)}}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesColor(){return this._pageMatchesColor}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return this._state}setDocument(e){this._pdfDocument&&this._reset();if(e){this._pdfDocument=e;this._firstPageCapability.resolve()}}_onFind(e){if(!e)return;const t=this._pdfDocument,{type:i}=e;(null===this._state||this._shouldDirtyMatch(e))&&(this._dirtyMatch=!0);this._state=e;"highlightallchange"!==i&&this._updateUIState(l.PENDING);this._firstPageCapability.promise.then((()=>{if(!this._pdfDocument||t&&this._pdfDocument!==t)return;this._extractText();const e=!this._highlightMatches,n=!!this._findTimeout;if(this._findTimeout){clearTimeout(this._findTimeout);this._findTimeout=null}if(i)if(this._dirtyMatch)this._nextMatch();else if("again"===i){this._nextMatch();e&&this._state.highlightAll&&this._updateAllPages()}else if("highlightallchange"===i){n?this._nextMatch():this._highlightMatches=!0;this._updateAllPages()}else this._nextMatch();else this._findTimeout=setTimeout((()=>{this._nextMatch();this._findTimeout=null}),250)}))}scrollMatchIntoView({element:e=null,selectedLeft:t=0,pageIndex:i=-1,matchIndex:n=-1}){if(!this._scrollMatches||!e)return;if(-1===n||n!==this._selected.matchIdx)return;if(-1===i||i!==this._selected.pageIdx)return;this._scrollMatches=!1;const s={top:-50,left:t+-400};(0,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;const e=this._state.query.split("\n").map((e=>normalize(e)[0]));this._normalizedQuery=e.join("\n")}return this._normalizedQuery}_shouldDirtyMatch(e){if(e.query!==this._state.query)return!0;switch(e.type){case"again":const e=this._selected.pageIdx+1,t=this._linkService;return e>=1&&e<=t.pagesCount&&e!==t.page&&!t.isPageVisible(e);case"highlightallchange":return!1}return!0}_prepareMatches(e,t,i,n){function isSubTerm(t){const i=e[t],n=e[t+1];if(t<e.length-1&&i.match===n.match){i.skipped=!0;return!0}for(let n=t-1;n>=0;n--){const t=e[n];if(!t.skipped){if(t.match+t.matchLength<i.match)break;if(t.match+t.matchLength>=i.match+i.matchLength){i.skipped=!0;return!0}}}return!1}e.sort((function(e,t){return e.match===t.match?e.matchLength-t.matchLength:e.match-t.match}));for(let s=0,r=e.length;s<r;s++)if(!isSubTerm(s)){t.push(e[s].match);i.push(e[s].matchLength);n.push(e[s].color)}}_isEntireWord(e,t,i){if(t>0){const i=e.charCodeAt(t),n=e.charCodeAt(t-1);if((0,r.getCharacterType)(i)===(0,r.getCharacterType)(n))return!1}const n=t+i-1;if(n<e.length-1){const t=e.charCodeAt(n),i=e.charCodeAt(n+1);if((0,r.getCharacterType)(t)===(0,r.getCharacterType)(i))return!1}return!0}_calculateFuzzyMatch(e,t,i,n){const s=[],r=[],o=e.length,l=o<5?o:5,h=Math.round(o/5),d=e.substring(0,l),c={useCollator:!0};for(let t=0;t<i.length-o;t++){const u=i.substring(t,t+l);if(a.Levenshtein.distance(d,u,c)<3){const l=i.substring(t,t+o),d=a.Levenshtein.distance(e,l,c);if(d<=h){if(t+1<i.length-o){const n=i.substring(t+1,t+1+o);if(d>=a.Levenshtein.distance(e,n,c))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 d=-h;for(;;){d=i.indexOf(e,d+h);if(-1===d)break;if(r&&!this._isEntireWord(i,d,h))continue;const t=getOriginalIndex(d,n),s=getOriginalIndex(d+h-1,n)-t+1;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])}_isInPageRanges(e=1,t){try{if(!t)return!0;return t.split(",").some((t=>this._isInPageRange(e,t)))}catch(e){return!0}}_isInPageRange(e=1,t="6-7"){try{if(!t)return!0;if(t.includes("-")){const i=t.split("-"),n=i[0].trim();if(n.length>0&&e<Number(n))return!1;const s=i[1].trim();if(s.length>0&&e>Number(s))return!1}else{const i=t.trim();if(i.length>0)return Number(i)===e}return!0}catch(e){return!0}}_calculateMatch(e){if(!this.state)return;let t=this._pageContents[e];const i=this._pageDiffs[e];let n=this._query;const{caseSensitive:s,entireWord:r,ignoreAccents:a,fuzzySearch:o,phraseSearch:l,currentPage:h,pageRange:d}=this._state;let c=!1;if(h&&e!==this._linkService.page-1){c=!0;this._pageMatches[e]=[]}if(!this._isInPageRanges(e+1,d)){c=!0;this._pageMatches[e]=[]}if(0===n.length)return;if(!c){if(!s){t=t.toLowerCase();n=n.toLowerCase()}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 u=this._pageMatches[e].length;if(u>0){this._matchesCountTotal+=u;this._updateUIResultsCount()}else e+1===this._pageContents.length&&0===this._matchesCountTotal?this._updateUIResultsCount():h&&!c&&this._updateMatch(!1)}_extractText(){if(this._extractTextPromises.length>0)return;let e=Promise.resolve();for(let t=0,i=this._linkService.pagesCount;t<i;t++){const i=(0,n.createPromiseCapability)();this._extractTextPromises[t]=i.promise;e=e.then((()=>this._pdfDocument&&this._extractTextPromises.length>0?this._pdfDocument.getPage(t+1).then((e=>e.getTextContent())).then((e=>{const n=e.items,s=[];for(let e=0,t=n.length;e<t;e++){s.push(n[e].str);n[e].hasEOL&&s.push("\n")}[this._pageContents[t],this._pageDiffs[t]]=normalize(s.join(""));i.resolve(t)}),(e=>{Window.ngxConsole.error(`Unable to get text content for page ${t+1}`,e);this._pageContents[t]="";this._pageDiffs[t]=null;i.resolve(t)})):Promise.resolve()))}}_updatePage(e){this._scrollMatches&&this._selected.pageIdx===e&&(this._linkService.page=e+1);this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:e})}_updateAllPages(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})}_nextMatch(){const e=this._state.findPrevious,t=this._linkService.page-1,i=this._linkService.pagesCount;this._highlightMatches=!0;if(this._dirtyMatch){this._dirtyMatch=!1;this._selected.pageIdx=this._selected.matchIdx=-1;this._offset.pageIdx=t;this._offset.matchIdx=null;this._offset.wrapped=!1;this._resumePageIdx=null;this._pageMatches.length=0;this._pageMatchesLength.length=0;this._pageMatchesColor.length=0;this._matchesCountTotal=0;this._updateAllPages();const{currentPage:e}=this.state;let n=0,s=i-1;if(e){n=this._linkService.page-1;s=n}for(let e=n;e<=s;e++)if(!this._pendingFindMatches.has(e)){this._pendingFindMatches.add(e);this._extractTextPromises[e].then((e=>{this._pendingFindMatches.delete(e);this._calculateMatch(e)}))}}if(""===this._query){this._updateUIState(l.FOUND);return}if(this._resumePageIdx)return;const n=this._offset;this._pagesToSearch=i;if(null!==n.matchIdx){const t=this._pageMatches[n.pageIdx].length;if(!e&&n.matchIdx+1<t||e&&n.matchIdx>0){n.matchIdx=e?n.matchIdx-1:n.matchIdx+1;this._updateMatch(!0);return}if(this.state.currentPage){n.matchIdx=e?t-1:0;this._updateMatch(!0);this._updateUIState(l.WRAPPED);return}this._advanceOffsetPage(e)}this._nextPageMatch()}_matchesReady(e){const t=this._offset,i=e.length,n=this._state.findPrevious;if(i){t.matchIdx=n?i-1:0;this._updateMatch(!0);return!0}this._advanceOffsetPage(n);if(t.wrapped){t.matchIdx=null;if(this._pagesToSearch<0){this._updateMatch(!1);return!0}}return!1}_nextPageMatch(){null!==this._resumePageIdx&&Window.ngxConsole.error("There can only be one pending page.");let e=null;do{const t=this._offset.pageIdx;e=this._pageMatches[t];if(!e){this._resumePageIdx=t;break}}while(!this._matchesReady(e))}_advanceOffsetPage(e){const t=this._offset,i=this._linkService.pagesCount;t.pageIdx=e?t.pageIdx-1:t.pageIdx+1;t.matchIdx=null;this._pagesToSearch--;if(t.pageIdx>=i||t.pageIdx<0){t.pageIdx=e?i-1:0;t.wrapped=!0}}_updateMatch(e=!1){let t=l.NOT_FOUND;const i=this._offset.wrapped;this._offset.wrapped=!1;if(e){const e=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx;this._selected.matchIdx=this._offset.matchIdx;t=i?l.WRAPPED:l.FOUND;-1!==e&&e!==this._selected.pageIdx&&this._updatePage(e)}this._updateUIState(t,this._state.findPrevious);if(-1!==this._selected.pageIdx){this._scrollMatches=!0;this._updatePage(this._selected.pageIdx)}}_onFindBarClose(e){const t=this._pdfDocument;this._firstPageCapability.promise.then((()=>{if(this._pdfDocument&&(!t||this._pdfDocument===t)){if(this._findTimeout){clearTimeout(this._findTimeout);this._findTimeout=null}if(this._resumePageIdx){this._resumePageIdx=null;this._dirtyMatch=!0}this._updateUIState(l.FOUND);this._highlightMatches=!1;this._updateAllPages()}}))}_requestMatchesCount(){const{pageIdx:e,matchIdx:t}=this._selected;let i=0,n=this._matchesCountTotal;if(-1!==t){for(let t=0;t<e;t++)i+=this._pageMatches[t]?.length||0;i+=t+1}(i<1||i>n)&&(i=n=0);return{current:i,total:n}}_updateUIResultsCount(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:this._requestMatchesCount()})}_updateUIState(e,t=!1){this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:e,previous:t,matchesCount:this._requestMatchesCount(),rawQuery:this._state?.query??null})}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.deburr=function deburr(e){return(e=function toString(e){return null==e?"":function baseToString(e){if("string"==typeof e)return e;if(function isSymbol(e){return"symbol"==typeof e||function isObjectLike(e){return!!e&&"object"==typeof e}(e)&&d.call(e)==n}(e))return p?p.call(e):"";var t=e+"";return"0"==t&&1/e==-i?"-0":t}(e)}(e))&&e.replace(s,h).replace(r,"")};var i=1/0,n="[object Symbol]",s=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,r=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe23\\u20d0-\\u20f0]","g"),a="object"==typeof global&&global&&global.Object===Object&&global,o="object"==typeof self&&self&&self.Object===Object&&self,l=a||o||Function("return this")();var h=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"}),d=Object.prototype.toString,c=l.Symbol,u=c?c.prototype:void 0,p=u?u.toString:void 0},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.CharacterType=void 0;t.getCharacterType=function getCharacterType(e){if(function isAlphabeticalScript(e){return e<11904}(e))return function isAscii(e){return 0==(65408&e)}(e)?function isAsciiSpace(e){return 32===e||9===e||13===e||10===e}(e)?i.SPACE:function isAsciiAlpha(e){return e>=97&&e<=122||e>=65&&e<=90}(e)||function isAsciiDigit(e){return e>=48&&e<=57}(e)||95===e?i.ALPHA_LETTER:i.PUNCT:function isThai(e){return 3584==(65408&e)}(e)?i.THAI_LETTER:160===e?i.SPACE:i.ALPHA_LETTER;if(function isHan(e){return e>=13312&&e<=40959||e>=63744&&e<=64255}(e))return i.HAN_LETTER;if(function isKatakana(e){return e>=12448&&e<=12543}(e))return i.KATAKANA_LETTER;if(function isHiragana(e){return e>=12352&&e<=12447}(e))return i.HIRAGANA_LETTER;if(function isHalfwidthKatakana(e){return e>=65376&&e<=65439}(e))return i.HALFWIDTH_KATAKANA_LETTER;return i.ALPHA_LETTER};const i={SPACE:0,ALPHA_LETTER:1,PUNCT:2,HAN_LETTER:3,KATAKANA_LETTER:4,HIRAGANA_LETTER:5,HALFWIDTH_KATAKANA_LETTER:6,THAI_LETTER:7};t.CharacterType=i},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.Levenshtein=void 0;let i;try{i=Intl.Collator("und",{sensitivity:"base"})}catch(e){try{i=Intl.Collator("generic",{sensitivity:"base"})}catch(e){i=void 0}}const n=[],s=[];t.Levenshtein=class Levenshtein{static distance(e,t,r){const a=r&&i&&r.useCollator,o=e.length,l=t.length;if(0===o)return l;if(0===l)return o;let h,d,c,u,p,g;for(c=0;c<l;++c){n[c]=c;s[c]=t.charCodeAt(c)}n[l]=l;if(a)for(c=0;c<o;++c){d=c+1;for(u=0;u<l;++u){h=d;g=0===i.compare(e.charAt(c),String.fromCharCode(s[u]));d=n[u]+(g?0:1);p=h+1;d>p&&(d=p);p=n[u+1]+1;d>p&&(d=p);n[u]=h}n[u]=d}else for(c=0;c<o;++c){d=c+1;for(u=0;u<l;++u){h=d;g=e.charCodeAt(c)===s[u];d=n[u]+(g?0:1);p=h+1;d>p&&(d=p);p=n[u+1]+1;d>p&&(d=p);n[u]=h}n[u]=d}return d}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFHistory=void 0;t.isDestArraysEqual=isDestArraysEqual;t.isDestHashesEqual=isDestHashesEqual;var n=i(3),s=i(6);function getCurrentHash(){return document.location.hash}t.PDFHistory=class PDFHistory{constructor({linkService:e,eventBus:t}){this.linkService=e;this.eventBus=t;this._initialized=!1;this._fingerprint="";this.reset();this._boundEvents=null;this.eventBus._on("pagesinit",(()=>{this._isPagesLoaded=!1;this.eventBus._on("pagesloaded",(e=>{this._isPagesLoaded=!!e.pagesCount}),{once:!0})}))}initialize({fingerprint:e,resetHistory:t=!1,updateUrl:i=!1}){if(!e||"string"!=typeof e){Window.ngxConsole.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');return}this._initialized&&this.reset();const n=""!==this._fingerprint&&this._fingerprint!==e;this._fingerprint=e;this._updateUrl=!0===i;this._initialized=!0;this._bindEvents();const s=window.history.state;this._popStateInProgress=!1;this._blockHashChange=0;this._currentHash=getCurrentHash();this._numPositionUpdates=0;this._uid=this._maxUid=0;this._destination=null;this._position=null;if(!this._isValidState(s,!0)||t){const{hash:e,page:i,rotation:s}=this._parseCurrentHash(!0);if(!e||n||t){this._pushOrReplaceState(null,!0);return}this._pushOrReplaceState({hash:e,page:i,rotation:s},!0);return}const r=s.destination;this._updateInternalState(r,s.uid,!0);void 0!==r.rotation&&(this._initialRotation=r.rotation);if(r.dest){this._initialBookmark=JSON.stringify(r.dest);this._destination.page=null}else r.hash?this._initialBookmark=r.hash:r.page&&(this._initialBookmark=`page=${r.page}`)}reset(){if(this._initialized){this._pageHide();this._initialized=!1;this._unbindEvents()}if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}this._initialBookmark=null;this._initialRotation=null}push({namedDest:e=null,explicitDest:t,pageNumber:i}){if(!this._initialized)return;if(e&&"string"!=typeof e){Window.ngxConsole.error(`PDFHistory.push: "${e}" is not a valid namedDest parameter.`);return}if(!Array.isArray(t)){Window.ngxConsole.error(`PDFHistory.push: "${t}" is not a valid explicitDest parameter.`);return}if(!this._isValidPage(i)&&(null!==i||this._destination)){Window.ngxConsole.error(`PDFHistory.push: "${i}" is not a valid pageNumber parameter.`);return}const n=e||JSON.stringify(t);if(!n)return;let s=!1;if(this._destination&&(isDestHashesEqual(this._destination.hash,n)||isDestArraysEqual(this._destination.dest,t))){if(this._destination.page)return;s=!0}if(!this._popStateInProgress||s){this._pushOrReplaceState({dest:t,hash:n,page:i,rotation:this.linkService.rotation},s);if(!this._popStateInProgress){this._popStateInProgress=!0;Promise.resolve().then((()=>{this._popStateInProgress=!1}))}}}pushPage(e){if(this._initialized)if(this._isValidPage(e)){if(this._destination?.page!==e&&!this._popStateInProgress){this._pushOrReplaceState({dest:null,hash:`page=${e}`,page:e,rotation:this.linkService.rotation});if(!this._popStateInProgress){this._popStateInProgress=!0;Promise.resolve().then((()=>{this._popStateInProgress=!1}))}}}else Window.ngxConsole.error(`PDFHistory.pushPage: "${e}" is not a valid page number.`)}pushCurrentPosition(){this._initialized&&!this._popStateInProgress&&this._tryPushCurrentPosition()}back(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;this._isValidState(e)&&e.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;this._isValidState(e)&&e.uid<this._maxUid&&window.history.forward()}get popStateInProgress(){return this._initialized&&(this._popStateInProgress||this._blockHashChange>0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}_pushOrReplaceState(e,t=!1){const i=t||!this._destination,n={fingerprint:this._fingerprint,uid:i?this._uid:this._uid+1,destination:e};this._updateInternalState(e,n.uid);let s;if(this._updateUrl&&e?.hash){const t=document.location.href.split("#")[0];t.startsWith("file://")||(s=`${t}#${e.hash}`)}i?window.history.replaceState(n,"",s):window.history.pushState(n,"",s)}_tryPushCurrentPosition(e=!1){if(!this._position)return;let t=this._position;if(e){t=Object.assign(Object.create(null),this._position);t.temporary=!0}if(!this._destination){this._pushOrReplaceState(t);return}if(this._destination.temporary){this._pushOrReplaceState(t,!0);return}if(this._destination.hash===t.hash)return;if(!this._destination.page&&this._numPositionUpdates<=50)return;let i=!1;if(this._destination.page>=t.first&&this._destination.page<=t.page){if(void 0!==this._destination.dest||!this._destination.first)return;i=!0}this._pushOrReplaceState(t,i)}_isValidPage(e){return Number.isInteger(e)&&e>0&&e<=this.linkService.pagesCount}_isValidState(e,t=!1){if(!e)return!1;if(e.fingerprint!==this._fingerprint){if(!t)return!1;{if("string"!=typeof e.fingerprint||e.fingerprint.length!==this._fingerprint.length)return!1;const[t]=performance.getEntriesByType("navigation");if("reload"!==t?.type)return!1}}return!(!Number.isInteger(e.uid)||e.uid<0)&&(null!==e.destination&&"object"==typeof e.destination)}_updateInternalState(e,t,i=!1){if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}i&&e?.temporary&&delete e.temporary;this._destination=e;this._uid=t;this._maxUid=Math.max(this._maxUid,t);this._numPositionUpdates=0}_parseCurrentHash(e=!1){const t=unescape(getCurrentHash()).substring(1),i=(0,n.parseQueryString)(t),s=i.get("nameddest")||"";let r=0|i.get("page");(!this._isValidPage(r)||e&&s.length>0)&&(r=null);return{hash:t,page:r,rotation:this.linkService.rotation}}_updateViewarea({location:e}){if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}this._position={hash:e.pdfOpenParams.substring(1),page:this.linkService.page,first:e.pageNumber,rotation:e.rotation};if(!this._popStateInProgress){this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++;this._updateViewareaTimeout=setTimeout((()=>{this._popStateInProgress||this._tryPushCurrentPosition(!0);this._updateViewareaTimeout=null}),1e3)}}_popState({state:e}){const t=getCurrentHash(),i=this._currentHash!==t;this._currentHash=t;if(!e){this._uid++;const{hash:e,page:t,rotation:i}=this._parseCurrentHash();this._pushOrReplaceState({hash:e,page:t,rotation:i},!0);return}if(!this._isValidState(e))return;this._popStateInProgress=!0;if(i){this._blockHashChange++;(0,s.waitOnEventOrTimeout)({target:window,name:"hashchange",delay:1e3}).then((()=>{this._blockHashChange--}))}const r=e.destination;this._updateInternalState(r,e.uid,!0);(0,n.isValidRotation)(r.rotation)&&(this.linkService.rotation=r.rotation);r.dest?this.linkService.goToDestination(r.dest):r.hash?this.linkService.setHash(r.hash):r.page&&(this.linkService.page=r.page);Promise.resolve().then((()=>{this._popStateInProgress=!1}))}_pageHide(){this._destination&&!this._destination.temporary||this._tryPushCurrentPosition()}_bindEvents(){if(!this._boundEvents){this._boundEvents={updateViewarea:this._updateViewarea.bind(this),popState:this._popState.bind(this),pageHide:this._pageHide.bind(this)};this.eventBus._on("updateviewarea",this._boundEvents.updateViewarea);window.addEventListener("popstate",this._boundEvents.popState);window.addEventListener("pagehide",this._boundEvents.pageHide)}}_unbindEvents(){if(this._boundEvents){this.eventBus._off("updateviewarea",this._boundEvents.updateViewarea);window.removeEventListener("popstate",this._boundEvents.popState);window.removeEventListener("pagehide",this._boundEvents.pageHide);this._boundEvents=null}}};function isDestHashesEqual(e,t){if("string"!=typeof e||"string"!=typeof t)return!1;if(e===t)return!0;return(0,n.parseQueryString)(e).get("nameddest")===t}function isDestArraysEqual(e,t){function isEntryEqual(e,t){if(typeof e!=typeof t)return!1;if(Array.isArray(e)||Array.isArray(t))return!1;if(null!==e&&"object"==typeof e&&null!==t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(!isEntryEqual(e[i],t[i]))return!1;return!0}return e===t||Number.isNaN(e)&&Number.isNaN(t)}if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(let i=0,n=e.length;i<n;i++)if(!isEntryEqual(e[i],t[i]))return!1;return!0}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFLayerViewer=void 0;var n=i(12);class PDFLayerViewer extends n.BaseTreeViewer{constructor(e){super(e);this.l10n=e.l10n;this.eventBus._on("optionalcontentconfigchanged",(e=>{this.#ai(e.promise)}));this.eventBus._on("resetlayers",(()=>{this.#ai()}));this.eventBus._on("togglelayerstree",this._toggleAllTreeItems.bind(this))}reset(){super.reset();this._optionalContentConfig=null;this._optionalContentHash=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._optionalContentHash=this._optionalContentConfig.getHash();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}this._optionalContentHash=e.getHash();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.append(o);if("object"==typeof i){a=!0;this._addToggleButton(n,i);this._setNestedName(o,i);const e=document.createElement("div");e.className="treeItems";n.append(e);s.push({parent:e,groups:i.order})}else{const t=e.getGroup(i),n=document.createElement("input");this._bindLink(o,{groupId:i,input:n});n.type="checkbox";n.checked=t.visible;const s=document.createElement("label");s.textContent=this._normalizeTextContent(t.name);s.append(n);o.append(s);r++}t.parent.append(n)}}this._finishRendering(n,r,a)}async#ai(e=null){if(!this._optionalContentConfig)return;const t=this._pdfDocument,i=await(e||t.getOptionalContentConfig());if(t===this._pdfDocument){if(e){if(i.getHash()===this._optionalContentHash)return}else this.eventBus.dispatch("optionalcontentconfig",{source:this,promise:Promise.resolve(i)});this.render({optionalContentConfig:i,pdfDocument:this._pdfDocument})}}}t.PDFLayerViewer=PDFLayerViewer},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFOutlineViewer=void 0;var n=i(12),s=i(4),r=i(3);class PDFOutlineViewer extends n.BaseTreeViewer{constructor(e){super(e);this.linkService=e.linkService;this.downloadManager=e.downloadManager;this.eventBus._on("toggleoutlinetree",this._toggleAllTreeItems.bind(this));this.eventBus._on("currentoutlineitem",this._currentOutlineItem.bind(this));this.eventBus._on("pagechanging",(e=>{this._currentPageNumber=e.pageNumber}));this.eventBus._on("pagesloaded",(e=>{this._isPagesLoaded=!!e.pagesCount;this._currentOutlineItemCapability&&!this._currentOutlineItemCapability.settled&&this._currentOutlineItemCapability.resolve(this._isPagesLoaded)}));this.eventBus._on("sidebarviewchanged",(e=>{this._sidebarView=e.view}))}reset(){super.reset();this._outline=null;this._pageNumberToDestHashCapability=null;this._currentPageNumber=1;this._isPagesLoaded=null;this._currentOutlineItemCapability&&!this._currentOutlineItemCapability.settled&&this._currentOutlineItemCapability.resolve(!1);this._currentOutlineItemCapability=null}_dispatchEvent(e){this._currentOutlineItemCapability=(0,s.createPromiseCapability)();0===e||this._pdfDocument?.loadingParams.disableAutoFetch?this._currentOutlineItemCapability.resolve(!1):null!==this._isPagesLoaded&&this._currentOutlineItemCapability.resolve(this._isPagesLoaded);this.eventBus.dispatch("outlineloaded",{source:this,outlineCount:e,currentOutlineItemPromise:this._currentOutlineItemCapability.promise})}_bindLink(e,{url:t,newWindow:i,action:n,attachment:s,dest:r,setOCGState:a}){const{linkService:o}=this;if(t)o.addLinkAttributes(e,t,i);else if(n){e.href=o.getAnchorUrl("");e.onclick=()=>{o.executeNamedAction(n);return!1}}else if(s){e.href=o.getAnchorUrl("");e.onclick=()=>{this.downloadManager.openOrDownloadData(e,s.content,s.filename);return!1}}else if(a){e.href=o.getAnchorUrl("");e.onclick=()=>{o.executeSetOCGState(a);return!1}}else{e.href=o.getDestinationHash(r);e.onclick=e=>{this._updateCurrentTreeItem(e.target.parentNode);r&&o.goToDestination(r);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.append(a);if(t.items.length>0){r=!0;this._addToggleButton(i,t);const e=document.createElement("div");e.className="treeItems";i.append(e);n.push({parent:e,items:t.items})}e.parent.append(i);s++}}this._finishRendering(i,s,r)}async _currentOutlineItem(){if(!this._isPagesLoaded)throw new Error("_currentOutlineItem: All pages have not been loaded.");if(!this._outline||!this._pdfDocument)return;const e=await this._getPageNumberToDestHash(this._pdfDocument);if(e){this._updateCurrentTreeItem(null);if(this._sidebarView===r.SidebarView.OUTLINE)for(let t=this._currentPageNumber;t>0;t--){const i=e.get(t);if(!i)continue;const n=this.container.querySelector(`a[href="${i}"]`);if(n){this._scrollToCurrentTreeItem(n.parentNode);break}}}}async _getPageNumberToDestHash(e){if(this._pageNumberToDestHashCapability)return this._pageNumberToDestHashCapability.promise;this._pageNumberToDestHashCapability=(0,s.createPromiseCapability)();const t=new Map,i=new Map,n=[{nesting:0,items:this._outline}];for(;n.length>0;){const s=n.shift(),r=s.nesting;for(const{dest: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),s=i(4);const r="pdfPresentationMode",a="pdfPresentationModeControls",o=Math.PI/6;t.PDFPresentationMode=class PDFPresentationMode{#oi=n.PresentationModeState.UNKNOWN;#li=null;constructor({container:e,pdfViewer:t,eventBus:i}){this.container=e;this.pdfViewer=t;this.eventBus=i;this.contextMenuOpen=!1;this.mouseScrollTimeStamp=0;this.mouseScrollDelta=0;this.touchSwipeState=null}async request(){const{container:e,pdfViewer:t}=this;if(this.active||!t.pagesCount||!e.requestFullscreen)return!1;this.#hi();this.#di(n.PresentationModeState.CHANGING);const i=e.requestFullscreen();this.#li={pageNumber:t.currentPageNumber,scaleValue:t.currentScaleValue,scrollMode:t.scrollMode,spreadMode:null,annotationEditorMode:null};if(!(t.spreadMode===n.SpreadMode.NONE||t.pageViewsReady&&t.hasEqualPageSizes)){console.warn("Ignoring Spread modes when entering PresentationMode, since the document may contain varying page sizes.");this.#li.spreadMode=t.spreadMode}t.annotationEditorMode!==s.AnnotationEditorType.DISABLE&&(this.#li.annotationEditorMode=t.annotationEditorMode);try{await i;t.focus();return!0}catch(e){this.#ci();this.#di(n.PresentationModeState.NORMAL)}return!1}get active(){return this.#oi===n.PresentationModeState.CHANGING||this.#oi===n.PresentationModeState.FULLSCREEN}#ui(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.#pi();this.mouseScrollDelta+=t;if(Math.abs(this.mouseScrollDelta)>=.1){const e=this.mouseScrollDelta;this.#pi();(e>0?this.pdfViewer.previousPage():this.pdfViewer.nextPage())&&(this.mouseScrollTimeStamp=i)}}}#di(e){this.#oi=e;this.eventBus.dispatch("presentationmodechanged",{source:this,state:e})}#gi(){this.#di(n.PresentationModeState.FULLSCREEN);this.container.classList.add(r);setTimeout((()=>{this.pdfViewer.scrollMode=n.ScrollMode.PAGE;null!==this.#li.spreadMode&&(this.pdfViewer.spreadMode=n.SpreadMode.NONE);this.pdfViewer.currentPageNumber=this.#li.pageNumber;this.pdfViewer.currentScaleValue="page-fit";null!==this.#li.annotationEditorMode&&(this.pdfViewer.annotationEditorMode=s.AnnotationEditorType.NONE)}),0);this.#fi();this.#mi();this.contextMenuOpen=!1;window.getSelection().removeAllRanges()}#bi(){const e=this.pdfViewer.currentPageNumber;this.container.classList.remove(r);setTimeout((()=>{this.#ci();this.#di(n.PresentationModeState.NORMAL);this.pdfViewer.scrollMode=this.#li.scrollMode;null!==this.#li.spreadMode&&(this.pdfViewer.spreadMode=this.#li.spreadMode);this.pdfViewer.currentScaleValue=this.#li.scaleValue;this.pdfViewer.currentPageNumber=e;null!==this.#li.annotationEditorMode&&(this.pdfViewer.annotationEditorMode=this.#li.annotationEditorMode);this.#li=null}),0);this.#vi();this.#wi();this.#pi();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")}}#_i(e){if(this.contextMenuOpen){this.contextMenuOpen=!1;e.preventDefault()}else if(!(0!==e.button||e.target.href&&e.target.parentNode?.hasAttribute("data-internal-link"))){e.preventDefault();e.shiftKey?this.pdfViewer.previousPage():this.pdfViewer.nextPage()}}#yi(){this.contextMenuOpen=!0}#mi(){this.controlsTimeout?clearTimeout(this.controlsTimeout):this.container.classList.add(a);this.controlsTimeout=setTimeout((()=>{this.container.classList.remove(a);delete this.controlsTimeout}),3e3)}#wi(){if(this.controlsTimeout){clearTimeout(this.controlsTimeout);this.container.classList.remove(a);delete this.controlsTimeout}}#pi(){this.mouseScrollTimeStamp=0;this.mouseScrollDelta=0}#Si(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<=o||s>=Math.PI-o)?t=i:Math.abs(n)>50&&Math.abs(s-Math.PI/2)<=o&&(t=n);t>0?this.pdfViewer.previousPage():t<0&&this.pdfViewer.nextPage()}}#fi(){this.showControlsBind=this.#mi.bind(this);this.mouseDownBind=this.#_i.bind(this);this.mouseWheelBind=this.#ui.bind(this);this.resetMouseScrollStateBind=this.#pi.bind(this);this.contextMenuBind=this.#yi.bind(this);this.touchSwipeBind=this.#Si.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)}#vi(){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}#Pi(){document.fullscreenElement?this.#gi():this.#bi()}#hi(){this.fullscreenChangeBind=this.#Pi.bind(this);window.addEventListener("fullscreenchange",this.fullscreenChangeBind)}#ci(){window.removeEventListener("fullscreenchange",this.fullscreenChangeBind);delete this.fullscreenChangeBind}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFRenderingQueue=void 0;var n=i(4),s=i(3);t.PDFRenderingQueue=class PDFRenderingQueue{constructor(){this.pdfViewer=null;this.pdfThumbnailViewer=null;this.onIdle=null;this.highestPriorityPage=null;this.idleTimeout=null;this.printing=!1;this.isThumbnailViewEnabled=!1}setViewer(e){this.pdfViewer=e}setThumbnailViewer(e){this.pdfThumbnailViewer=e}isHighestPriority(e){return this.highestPriorityPage===e.renderingId}hasViewer(){return!!this.pdfViewer}renderHighestPriority(e){if(this.idleTimeout){clearTimeout(this.idleTimeout);this.idleTimeout=null}this.pdfViewer.forceRendering(e)||this.isThumbnailViewEnabled&&this.pdfThumbnailViewer?.forceRendering()||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),3e4))}getHighestPriority(e,t,i,n=!1){const s=e.views,r=s.length;if(0===r)return null;for(let e=0;e<r;e++){const t=s[e].view;if(!this.isViewFinished(t))return t}const a=e.first.id,o=e.last.id;if(o-a+1>r){const n=e.ids;for(let e=1,s=o-a;e<s;e++){const s=i?a+e:o-e;if(n.has(s))continue;const r=t[s-1];if(!this.isViewFinished(r))return r}}let l=i?o:a-2,h=t[l];if(h&&!this.isViewFinished(h))return h;if(n){l+=i?1:-1;h=t[l];if(h&&!this.isViewFinished(h))return h}return null}isViewFinished(e){return e.renderingState===s.RenderingStates.FINISHED}renderView(e){switch(e.renderingState){case s.RenderingStates.FINISHED:return!1;case s.RenderingStates.PAUSED:this.highestPriorityPage=e.renderingId;e.resume();break;case s.RenderingStates.RUNNING:this.highestPriorityPage=e.renderingId;break;case s.RenderingStates.INITIAL:this.highestPriorityPage=e.renderingId;e.draw().finally((()=>{this.renderHighestPriority()})).catch((e=>{e instanceof n.RenderingCancelledException||Window.ngxConsole.error(`renderView: "${e}"`)}))}return!0}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFScriptingManager=void 0;var n=i(3),s=i(4);t.PDFScriptingManager=class PDFScriptingManager{constructor({eventBus:e,sandboxBundleSrc:t=null,scriptingFactory:i=null,docPropertiesLookup:n=null}){this._pdfDocument=null;this._pdfViewer=null;this._closeCapability=null;this._destroyCapability=null;this._scripting=null;this._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){Window.ngxConsole.error(`PDFScriptingManager.setDocument: "${e?.message}".`);await this._destroyScripting();return}this._internalEvents.set("updatefromsandbox",(e=>{e?.source===window&&this._updateFromSandbox(e.detail)}));this._internalEvents.set("dispatcheventinsandbox",(e=>{this._scripting?.dispatchEventInSandbox(e.detail)}));this._internalEvents.set("pagechanging",(({pageNumber:e,previous:t})=>{if(e!==t){this._dispatchPageClose(t);this._dispatchPageOpen(e)}}));this._internalEvents.set("pagerendered",(({pageNumber:e})=>{this._pageOpenPending.has(e)&&e===this._pdfViewer.currentPageNumber&&this._dispatchPageOpen(e)}));this._internalEvents.set("pagesdestroy",(async e=>{await this._dispatchPageClose(this._pdfViewer.currentPageNumber);await(this._scripting?.dispatchEventInSandbox({id:"doc",name:"WillClose"}));this._closeCapability?.resolve()}));for(const[e,t]of this._internalEvents)this._eventBus._on(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){Window.ngxConsole.error(`PDFScriptingManager.setDocument: "${e?.message}".`);await this._destroyScripting();return}await(this._scripting?.dispatchEventInSandbox({id:"doc",name:"Open"}));await this._dispatchPageOpen(this._pdfViewer.currentPageNumber,!0);Promise.resolve().then((()=>{e===this._pdfDocument&&(this._ready=!0)}))}}else await this._destroyScripting()}async dispatchWillSave(e){return this._scripting?.dispatchEventInSandbox({id:"doc",name:"WillSave"})}async dispatchDidSave(e){return this._scripting?.dispatchEventInSandbox({id:"doc",name:"DidSave"})}async dispatchWillPrint(e){return this._scripting?.dispatchEventInSandbox({id:"doc",name:"WillPrint"})}async dispatchDidPrint(e){return this._scripting?.dispatchEventInSandbox({id:"doc",name:"DidPrint"})}get destroyPromise(){return this._destroyCapability?.promise||null}get ready(){return this._ready}get _internalEvents(){return(0,s.shadow)(this,"_internalEvents",new Map)}get _pageOpenPending(){return(0,s.shadow)(this,"_pageOpenPending",new Set)}get _visitedPages(){return(0,s.shadow)(this,"_visitedPages",new Map)}async _updateFromSandbox(e){const t=this._pdfViewer.isInPresentationMode||this._pdfViewer.isChangingPresentationMode,{id:i,siblings:s,command:r,value:a}=e;if(!i){switch(r){case"clear":Window.ngxConsole.clear();break;case"error":Window.ngxConsole.error(a);break;case"layout":{if(t)return;const e=(0,n.apiPageLayoutToViewerModes)(a);this._pdfViewer.spreadMode=e.spreadMode;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":Window.ngxConsole.log(a);break;case"zoom":if(t)return;this._pdfViewer.currentScaleValue=a;break;case"SaveAs":this._eventBus.dispatch("download",{source:this});break;case"FirstPage":this._pdfViewer.currentPageNumber=1;break;case"LastPage":this._pdfViewer.currentPageNumber=this._pdfViewer.pagesCount;break;case"NextPage":this._pdfViewer.nextPage();break;case"PrevPage":this._pdfViewer.previousPage();break;case"ZoomViewIn":if(t)return;this._pdfViewer.increaseScale();break;case"ZoomViewOut":if(t)return;this._pdfViewer.decreaseScale()}return}if(t&&e.focus)return;delete e.id;delete e.siblings;const o=s?[i,...s]:[i];for(const t of o){const i=document.querySelector(`[data-element-id="${t}"]`);i?i.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:e})):this._pdfDocument?.annotationStorage.setValue(t,void 0,e)}}async _dispatchPageOpen(e,t=!1){const i=this._pdfDocument,r=this._visitedPages;t&&(this._closeCapability=(0,s.createPromiseCapability)());if(!this._closeCapability)return;const a=this._pdfViewer.getPageView(e-1);if(a?.renderingState!==n.RenderingStates.FINISHED){this._pageOpenPending.add(e);return}this._pageOpenPending.delete(e);const o=(async()=>{const t=await(r.has(e)?null:a.pdfPage?.getJSActions());i===this._pdfDocument&&await(this._scripting?.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:e,actions:t}))})();r.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,s.createPromiseCapability)();if(this._scripting)throw new Error("_createScripting: Scripting already exists.");if(this._scriptingFactory)return this._scriptingFactory.createScripting({sandboxBundleSrc:this._sandboxBundleSrc});throw new Error("_createScripting: Cannot create scripting.")}async _destroyScripting(){if(this._scripting){if(this._closeCapability){await Promise.race([this._closeCapability.promise,new Promise((e=>{setTimeout(e,1e3)}))]).catch((e=>{}));this._closeCapability=null}this._pdfDocument=null;try{await this._scripting.destroySandbox()}catch(e){}for(const[e,t]of this._internalEvents)this._eventBus._off(e,t);this._internalEvents.clear();this._pageOpenPending.clear();this._visitedPages.clear();this._scripting=null;this._ready=!1;this._destroyCapability?.resolve()}else{this._pdfDocument=null;this._destroyCapability?.resolve()}}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFSidebar=void 0;var n=i(3);const s="pdfSidebarNotification";t.PDFSidebar=class PDFSidebar{constructor({elements:e,pdfViewer:t,pdfThumbnailViewer:i,eventBus:s,l10n:r}){this.isOpen=!1;this.active=n.SidebarView.THUMBS;this.isInitialViewSet=!1;this.isInitialEventDispatched=!1;this.onToggled=null;this.pdfViewer=t;this.pdfThumbnailViewer=i;this.outerContainer=e.outerContainer;this.sidebarContainer=e.sidebarContainer;this.toggleButton=e.toggleButton;this.thumbnailButton=e.thumbnailButton;this.outlineButton=e.outlineButton;this.attachmentsButton=e.attachmentsButton;this.layersButton=e.layersButton;this.thumbnailView=e.thumbnailView;this.outlineView=e.outlineView;this.attachmentsView=e.attachmentsView;this.layersView=e.layersView;this._outlineOptionsContainer=e.outlineOptionsContainer;this._currentOutlineItemButton=e.currentOutlineItemButton;this.eventBus=s;this.l10n=r;this.#$t()}reset(){this.isInitialViewSet=!1;this.isInitialEventDispatched=!1;this.#Ai(!0);this.switchView(n.SidebarView.THUMBS);this.outlineButton.disabled=!1;this.attachmentsButton.disabled=!1;this.layersButton.disabled=!1;this.outlineButton.hidden=!1;this.attachmentsButton.hidden=!1;this.layersButton.hidden=!1;this._currentOutlineItemButton.disabled=!0}get visibleView(){return this.isOpen?this.active:n.SidebarView.NONE}setInitialView(e=n.SidebarView.NONE){if(!this.isInitialViewSet){this.isInitialViewSet=!0;if(e!==n.SidebarView.NONE&&e!==n.SidebarView.UNKNOWN){this.switchView(e,!0);this.isInitialEventDispatched||this.#Xt()}else this.#Xt()}}switchView(e,t=!1){const i=e!==this.active;let s=!1;switch(e){case n.SidebarView.NONE:this.isOpen&&this.close();return;case n.SidebarView.THUMBS:this.isOpen&&i&&(s=!0);break;case n.SidebarView.OUTLINE:if(this.outlineButton.disabled)return;break;case n.SidebarView.ATTACHMENTS:if(this.attachmentsButton.disabled)return;break;case n.SidebarView.LAYERS:if(this.layersButton.disabled)return;break;default:Window.ngxConsole.error(`PDFSidebar.switchView: "${e}" is not a valid view.`);return}this.active=e;const r=e===n.SidebarView.THUMBS,a=e===n.SidebarView.OUTLINE,o=e===n.SidebarView.ATTACHMENTS,l=e===n.SidebarView.LAYERS;this.thumbnailButton.classList.toggle("toggled",r);this.outlineButton.classList.toggle("toggled",a);this.attachmentsButton.classList.toggle("toggled",o);this.layersButton.classList.toggle("toggled",l);this.thumbnailButton.setAttribute("aria-checked",r);this.outlineButton.setAttribute("aria-checked",a);this.attachmentsButton.setAttribute("aria-checked",o);this.layersButton.setAttribute("aria-checked",l);this.thumbnailView.classList.toggle("hidden",!r);this.outlineView.classList.toggle("hidden",!a);this.attachmentsView.classList.toggle("hidden",!o);this.layersView.classList.toggle("hidden",!l);this._outlineOptionsContainer.classList.toggle("hidden",!a);if(!t||this.isOpen){if(s){this.#Ei();this.#Ci()}i&&this.#Xt()}else this.open()}open(){if(!this.isOpen){this.isOpen=!0;this.toggleButton.classList.add("toggled");this.toggleButton.setAttribute("aria-expanded","true");this.outerContainer.classList.add("sidebarMoving","sidebarOpen");this.active===n.SidebarView.THUMBS&&this.#Ei();this.#Ci();this.#Xt();this.#Ai()}}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.#Ci();this.#Xt()}}toggle(){this.isOpen?this.close():this.open()}#Xt(){this.isInitialViewSet&&!this.isInitialEventDispatched&&(this.isInitialEventDispatched=!0);this.eventBus.dispatch("sidebarviewchanged",{source:this,view:this.visibleView})}#Ci(){if(this.onToggled)this.onToggled();else{this.pdfViewer.forceRendering();this.pdfThumbnailViewer.forceRendering()}}#Ei(){const{pdfViewer:e,pdfThumbnailViewer:t}=this,i=e.pagesCount;for(let s=0;s<i;s++){const i=e.getPageView(s);if(i?.renderingState===n.RenderingStates.FINISHED){t.getThumbnail(s).setImage(i)}}t.scrollThumbnailIntoView(e.currentPageNumber)}#xi(){this.toggleButton.setAttribute("data-l10n-id","toggle_sidebar_notification2");this.l10n.translate(this.toggleButton);this.isOpen||this.toggleButton.classList.add(s)}#Ai(e=!1){(this.isOpen||e)&&this.toggleButton.classList.remove(s);if(e){this.toggleButton.setAttribute("data-l10n-id","toggle_sidebar");this.l10n.translate(this.toggleButton)}}#$t(){this.sidebarContainer.addEventListener("transitionend",(e=>{e.target===this.sidebarContainer&&this.outerContainer.classList.remove("sidebarMoving")}));this.toggleButton.addEventListener("click",(()=>{this.toggle()}));this.thumbnailButton.addEventListener("click",(()=>{this.switchView(n.SidebarView.THUMBS)}));this.outlineButton.addEventListener("click",(()=>{this.switchView(n.SidebarView.OUTLINE)}));this.outlineButton.addEventListener("dblclick",(()=>{this.eventBus.dispatch("toggleoutlinetree",{source:this})}));this.attachmentsButton.addEventListener("click",(()=>{this.switchView(n.SidebarView.ATTACHMENTS)}));this.layersButton.addEventListener("click",(()=>{this.switchView(n.SidebarView.LAYERS)}));this.layersButton.addEventListener("dblclick",(()=>{this.eventBus.dispatch("resetlayers",{source:this})}));this._currentOutlineItemButton.addEventListener("click",(()=>{this.eventBus.dispatch("currentoutlineitem",{source:this})}));const onTreeLoaded=(e,t,i)=>{t.disabled=!e;t.hidden=!e;e?this.#xi():this.active===i&&this.switchView(n.SidebarView.THUMBS)};this.eventBus._on("outlineloaded",(e=>{onTreeLoaded(e.outlineCount,this.outlineButton,n.SidebarView.OUTLINE);e.enableCurrentOutlineItemButton&&e.currentOutlineItemPromise&&e.currentOutlineItemPromise.then((e=>{this.isInitialViewSet&&(this._currentOutlineItemButton.disabled=!e)}))}));this.eventBus._on("attachmentsloaded",(e=>{onTreeLoaded(e.attachmentsCount,this.attachmentsButton,n.SidebarView.ATTACHMENTS)}));this.eventBus._on("layersloaded",(e=>{onTreeLoaded(e.layersCount,this.layersButton,n.SidebarView.LAYERS)}));this.eventBus._on("presentationmodechanged",(e=>{e.state===n.PresentationModeState.NORMAL&&this.visibleView===n.SidebarView.THUMBS&&this.#Ei()}))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFSidebarResizer=void 0;var n=i(3);const s="sidebarResizing";t.PDFSidebarResizer=class PDFSidebarResizer{constructor(e,t,i){this.isRTL=!1;this.sidebarOpen=!1;this._width=null;this._outerContainerWidth=null;this._boundEvents=Object.create(null);this.outerContainer=e.outerContainer;this.resizer=e.resizer;this.eventBus=t;i.getDirection().then((e=>{this.isRTL="rtl"===e}));this._addEventListeners()}get outerContainerWidth(){return this._outerContainerWidth||=this.outerContainer.clientWidth}_updateWidth(e=0){const t=Math.floor(this.outerContainerWidth/2);e>t&&(e=t);e<200&&(e=200);if(e===this._width)return!1;this._width=e;n.docStyle.setProperty("--sidebar-width",`${e}px`);return!0}_mouseMove(e){let t=e.clientX;this.isRTL&&(t=this.outerContainerWidth-t);this._updateWidth(t)}_mouseUp(e){this.outerContainer.classList.remove(s);this.eventBus.dispatch("resize",{source:this});const t=this._boundEvents;window.removeEventListener("mousemove",t.mouseMove);window.removeEventListener("mouseup",t.mouseUp)}_addEventListeners(){const e=this._boundEvents;e.mouseMove=this._mouseMove.bind(this);e.mouseUp=this._mouseUp.bind(this);this.resizer.addEventListener("mousedown",(t=>{if(0===t.button){this.outerContainer.classList.add(s);window.addEventListener("mousemove",e.mouseMove);window.addEventListener("mouseup",e.mouseUp)}}));this.eventBus._on("sidebarviewchanged",(e=>{this.sidebarOpen=!!e?.view}));this.eventBus._on("resize",(e=>{if(e?.source!==window)return;this._outerContainerWidth=null;if(!this._width)return;if(!this.sidebarOpen){this._updateWidth(this._width);return}this.outerContainer.classList.add(s);const t=this._updateWidth(this._width);Promise.resolve().then((()=>{this.outerContainer.classList.remove(s);t&&this.eventBus.dispatch("resize",{source:this})}))}))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFThumbnailViewer=void 0;var n=i(3),s=i(30);const r="selected";t.PDFThumbnailViewer=class PDFThumbnailViewer{constructor({container:e,linkService:t,renderingQueue:i,l10n:s,pageColors:r}){this.container=e;this.linkService=t;this.renderingQueue=i;this.l10n=s;this.pageColors=r||null;if(this.pageColors&&(!CSS.supports("color",this.pageColors.background)||!CSS.supports("color",this.pageColors.foreground))){(this.pageColors.background||this.pageColors.foreground)&&Window.ngxConsole.warn("PDFThumbnailViewer: Ignoring `pageColors`-option, since the browser doesn't support the values used.");this.pageColors=null}this.scroll=(0,n.watchScroll)(this.container,this._scrollUpdated.bind(this));this._resetView()}_scrollUpdated(){this.renderingQueue.renderHighestPriority()}getThumbnail(e){return this._thumbnails[e]}_getVisibleThumbs(){return(0,n.getVisibleElements)({scrollEl:this.container,views:this._thumbnails})}scrollThumbnailIntoView(e){if(!this.pdfDocument)return;const t=this._thumbnails[e-1];if(!t){Window.ngxConsole.error('scrollThumbnailIntoView: Invalid "pageNumber" parameter.');return}if(e!==this._currentPageNumber){this._thumbnails[this._currentPageNumber-1].div.classList.remove(r);t.div.classList.add(r)}const{first:i,last:s,views:a}=this._getVisibleThumbs();if(a.length>0){let r=!1;if(e<=i.id||e>=s.id)r=!0;else for(const{id:t,percent:i}of a)if(t===e){r=i<100;break}r&&(0,n.scrollIntoView)(t.div,{top:-19})}this._currentPageNumber=e}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!(0,n.isValidRotation)(e))throw new Error("Invalid thumbnails rotation angle.");if(!this.pdfDocument)return;if(this._pagesRotation===e)return;this._pagesRotation=e;const t={rotation:e};for(const e of this._thumbnails)e.update(t)}cleanup(){for(const e of this._thumbnails)e.renderingState!==n.RenderingStates.FINISHED&&e.reset();s.TempImageFactory.destroyCanvas()}_resetView(){this._thumbnails=[];this._currentPageNumber=1;this._pageLabels=null;this._pagesRotation=0;this.container.textContent=""}setDocument(e){this.initialized=!1;if(this.pdfDocument){this._cancelRendering();this._resetView()}this.pdfDocument=e;if(!e)return;if(this.initialized)return;this.initialized=!0;const t=e.getPage(1),i=e.getOptionalContentConfig();t.then((t=>{const n=e.numPages,a=t.getViewport({scale:1});for(let e=1;e<=n;++e){const t=new s.PDFThumbnailView({container:this.container,id:e,defaultViewport:a.clone(),optionalContentConfigPromise:i,linkService:this.linkService,renderingQueue:this.renderingQueue,l10n:this.l10n,pageColors:this.pageColors});this._thumbnails.push(t)}this._thumbnails[0]?.setPdfPage(t);this._thumbnails[this._currentPageNumber-1].div.classList.add(r)})).catch((e=>{Window.ngxConsole.error("Unable to initialize thumbnail viewer",e)}))}_cancelRendering(){for(const e of this._thumbnails)e.cancelRendering()}setPageLabels(e){if(this.pdfDocument){if(e)if(Array.isArray(e)&&this.pdfDocument.numPages===e.length)this._pageLabels=e;else{this._pageLabels=null;Window.ngxConsole.error("PDFThumbnailViewer_setPageLabels: Invalid page labels.")}else this._pageLabels=null;for(let e=0,t=this._thumbnails.length;e<t;e++)this._thumbnails[e].setPageLabel(this._pageLabels?.[e]??null)}}async#Ti(e){if(e.pdfPage)return e.pdfPage;try{const t=await this.pdfDocument.getPage(e.id);e.pdfPage||e.setPdfPage(t);return t}catch(e){Window.ngxConsole.error("Unable to get page for thumb view",e);return null}}#Mi(e){return 1===e.first?.id||e.last?.id!==this._thumbnails.length&&this.scroll.down}forceRendering(){const e=this._getVisibleThumbs(),t=this.#Mi(e),i=this.renderingQueue.getHighestPriority(e,this._thumbnails,t);if(i){this.#Ti(i).then((()=>{this.renderingQueue.renderView(i)}));return!0}return!1}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.TempImageFactory=t.PDFThumbnailView=void 0;var n=i(3),s=i(4);class TempImageFactory{static#Ii=null;static getCanvas(e,t){const i=this.#Ii||=document.createElement("canvas");i.width=e;i.height=t;const n=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0,alpha:!1}:{alpha:!1},s=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0}:void 0,r=i.getContext("2d",n);r.save();r.fillStyle="rgb(255, 255, 255)";r.fillRect(0,0,e,t);r.restore();return[i,i.getContext("2d",s)]}static destroyCanvas(){const e=this.#Ii;if(e){e.width=0;e.height=0}this.#Ii=null}}t.TempImageFactory=TempImageFactory;t.PDFThumbnailView=class PDFThumbnailView{constructor({container:e,id:t,defaultViewport:i,optionalContentConfigPromise:s,linkService:r,renderingQueue:a,l10n:o,pageColors:l}){this.id=t;this.renderingId="thumbnail"+t;this.pageLabel=null;this.pdfPage=null;this.rotation=0;this.viewport=i;this.pdfPageRotate=i.rotation;this._optionalContentConfigPromise=s||null;this.pageColors=l||null;this.linkService=r;this.renderingQueue=a;this.renderTask=null;this.renderingState=n.RenderingStates.INITIAL;this.resume=null;const h=this.viewport.width,d=h/this.viewport.height;this.canvasWidth=98;this.canvasHeight=this.canvasWidth/d|0;this.scale=this.canvasWidth/h;this.l10n=o;window.pdfThumbnailGenerator?window.pdfThumbnailGenerator(this,r,t,e,this._thumbPageTitle):this.createThumbnail(this,r,t,e,this._thumbPageTitle)}createThumbnail(e,t,i,n,s){const r=document.createElement("a");r.href=t.getAnchorUrl("#page="+i);s.then((e=>{r.title=e}));r.onclick=function(){t.goToPage(i);return!1};e.anchor=r;const 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.append(o);r.append(a);n.append(r)}setPdfPage(e){this.pdfPage=e;this.pdfPageRotate=e.rotate;const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:1,rotation:t});this.reset()}reset(){this.cancelRendering();this.renderingState=n.RenderingStates.INITIAL;const e=this.viewport.width,t=e/this.viewport.height;this.canvasHeight=this.canvasWidth/t|0;this.scale=this.canvasWidth/e;this.div.removeAttribute("data-loaded");const i=this.ring;i.textContent="";i.style.width=this.canvasWidth+2+"px";i.style.height=this.canvasHeight+2+"px";if(this.canvas){this.canvas.width=0;this.canvas.height=0;delete this.canvas}if(this.image){this.image.removeAttribute("src");delete this.image}}update({rotation:e=null}){"number"==typeof e&&(this.rotation=e);const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:1,rotation:t});this.reset()}cancelRendering(){if(this.renderTask){this.renderTask.cancel();this.renderTask=null}this.resume=null}_getPageDrawContext(e=1){const t=document.createElement("canvas"),i=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0,alpha:!1}:{alpha:!1},s=t.getContext("2d",i),r=new n.OutputScale;t.width=e*this.canvasWidth*r.sx|0;t.height=e*this.canvasHeight*r.sy|0;return{ctx:s,canvas:t,transform:r.scaled?[r.sx,0,0,r.sy,0,0]:null}}_convertCanvasToImage(e){if(this.renderingState!==n.RenderingStates.FINISHED)throw new Error("_convertCanvasToImage: Rendering has not finished.");const t=this._reduceImage(e),i=document.createElement("img");i.className="thumbnailImage";this._thumbPageCanvas.then((e=>{i.setAttribute("aria-label",e)}));i.style.width=this.canvasWidth+"px";i.style.height=this.canvasHeight+"px";i.src=t.toDataURL();this.image=i;this.div.setAttribute("data-loaded",!0);this.ring.append(i);t.width=0;t.height=0}draw(){if(this.renderingState!==n.RenderingStates.INITIAL){Window.ngxConsole.error("Must be in new state before drawing");return Promise.resolve()}const{pdfPage:e}=this;if(!e){this.renderingState=n.RenderingStates.FINISHED;return Promise.reject(new Error("pdfPage is not loaded"))}this.renderingState=n.RenderingStates.RUNNING;const finishRenderTask=async(e=null)=>{o===this.renderTask&&(this.renderTask=null);if(!(e instanceof s.RenderingCancelledException)){this.renderingState=n.RenderingStates.FINISHED;this._convertCanvasToImage(i);if(e)throw e}},{ctx:t,canvas:i,transform:r}=this._getPageDrawContext(2),a={canvasContext:t,transform:r,viewport:this.viewport.clone({scale:2*this.scale}),optionalContentConfigPromise:this._optionalContentConfigPromise,background:PDFViewerApplicationOptions.get("pdfBackgroundColor"),pageColors:this.pageColors},o=this.renderTask=e.render(a);o.onContinue=e=>{if(this.renderingQueue.isHighestPriority(this))e();else{this.renderingState=n.RenderingStates.PAUSED;this.resume=()=>{this.renderingState=n.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.renderingState!==n.RenderingStates.INITIAL)return;const{thumbnailCanvas:t,pdfPage:i,scale:s}=e;if(t){this.pdfPage||this.setPdfPage(i);if(!(s<this.scale)){this.renderingState=n.RenderingStates.FINISHED;this._convertCanvasToImage(t)}}}_reduceImage(e){const{ctx:t,canvas:i}=this._getPageDrawContext();if(e.width<=2*i.width){t.drawImage(e,0,0,e.width,e.height,0,0,i.width,i.height);return i}let n=i.width<<3,s=i.height<<3;const[r,a]=TempImageFactory.getCanvas(n,s);for(;n>e.width||s>e.height;){n>>=1;s>>=1}a.drawImage(e,0,0,e.width,e.height,0,0,n,s);for(;n>2*i.width;){a.drawImage(r,0,0,n,s,0,0,n>>1,s>>1);n>>=1;s>>=1}t.drawImage(r,0,0,n,s,0,0,i.width,i.height);return i}get _thumbPageTitle(){return this.l10n.get("thumb_page_title",{page:this.pageLabel??this.id})}get _thumbPageCanvas(){return this.l10n.get("thumb_page_canvas",{page:this.pageLabel??this.id})}setPageLabel(e){this.pageLabel="string"==typeof e?e:null;this._thumbPageTitle.then((e=>{this.anchor.title=e}));this.renderingState===n.RenderingStates.FINISHED&&this._thumbPageCanvas.then((e=>{this.image?.setAttribute("aria-label",e)}))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PagesCountLimit=t.PDFViewer=t.PDFPageViewBuffer=void 0;var n=i(4),s=i(3),r=i(32),a=i(33),o=i(34),l=i(25),h=i(7);const d="enablePermissions",c={FORCE_SCROLL_MODE_PAGE:15e3,FORCE_LAZY_PAGE_INIT:7500,PAUSE_EAGER_PAGE_INIT:250};t.PagesCountLimit=c;function isValidAnnotationEditorMode(e){return Object.values(n.AnnotationEditorType).includes(e)&&e!==n.AnnotationEditorType.DISABLE}class PDFPageViewBuffer{#Li=new Set;#ki=0;constructor(e){this.#ki=e}push(e){const t=this.#Li;t.has(e)&&t.delete(e);t.add(e);t.size>this.#ki&&this.#Di()}resize(e,t=null){this.#ki=e;const i=this.#Li;if(t){const e=i.size;let n=1;for(const s of i){if(t.has(s.id)){i.delete(s);i.add(s)}if(++n>e)break}}for(;i.size>this.#ki;)this.#Di()}has(e){return this.#Li.has(e)}[Symbol.iterator](){return this.#Li.keys()}#Di(){const e=this.#Li.keys().next().value;e?.destroy();this.#Li.delete(e)}}t.PDFPageViewBuffer=PDFPageViewBuffer;t.PDFViewer=class PDFViewer{#Ri=null;#Fi=n.AnnotationEditorType.NONE;#Oi=null;#Ni=n.AnnotationMode.ENABLE_FORMS;#Bi=null;#Vi=!1;#Ui=0;#Wi=new ResizeObserver(this.#Hi.bind(this));#ji=null;#zi=null;#Gi=null;constructor(e){const t="3.4.493";if(n.version!==t)throw new Error(`The API version "${n.version}" does not match the Viewer version "${t}".`);this.container=e.container;this.viewer=e.viewer||e.container.firstElementChild;this.pageViewMode=e.pageViewMode||"multiple";if("DIV"!==this.container?.tagName||"DIV"!==this.viewer?.tagName)throw new Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&"absolute"!==getComputedStyle(this.container).position)throw new Error("The `container` must be absolutely positioned.");this.#Wi.observe(this.container);this.eventBus=e.eventBus;this.linkService=e.linkService||new h.SimpleLinkService;this.downloadManager=e.downloadManager||null;this.findController=e.findController||null;this._scriptingManager=e.scriptingManager||null;this.textLayerMode=e.textLayerMode??s.TextLayerMode.ENABLE;this.#Ni=e.annotationMode??n.AnnotationMode.ENABLE_FORMS;this.#Fi=e.annotationEditorMode??n.AnnotationEditorType.NONE;this.imageResourcesPath=e.imageResourcesPath||"";this.enablePrintAutoRotate=e.enablePrintAutoRotate||!1;this.removePageBorders=e.removePageBorders||!1;this.renderer=e.renderer||s.RendererType.CANVAS;this.useOnlyCssZoom=e.useOnlyCssZoom||!1;this.isOffscreenCanvasSupported=e.isOffscreenCanvasSupported??!0;this.maxCanvasPixels=e.maxCanvasPixels;this.l10n=e.l10n||r.NullL10n;this.#Vi=e.enablePermissions||!1;this.pageColors=e.pageColors||null;if(this.pageColors&&(!CSS.supports("color",this.pageColors.background)||!CSS.supports("color",this.pageColors.foreground))){(this.pageColors.background||this.pageColors.foreground)&&console.warn("PDFViewer: Ignoring `pageColors`-option, since the browser doesn't support the values used.");this.pageColors=null}this.defaultRenderingQueue=!e.renderingQueue;if(this.defaultRenderingQueue){this.renderingQueue=new l.PDFRenderingQueue;this.renderingQueue.setViewer(this)}else this.renderingQueue=e.renderingQueue;this.scroll=(0,s.watchScroll)(this.container,this._scrollUpdate.bind(this));this.presentationModeState=s.PresentationModeState.UNKNOWN;this._onBeforeDraw=this._onAfterDraw=null;this._resetView();this.removePageBorders&&this.viewer.classList.add("removePageBorders");this.#qi()}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.#Ni===n.AnnotationMode.ENABLE_FORMS}get enableScripting(){return!!this._scriptingManager}get currentPageNumber(){return this._currentPageNumber}set currentPageNumber(e){if(!Number.isInteger(e))throw new Error("Invalid page number.");if(!this.pdfDocument)return;const t=Math.abs(this._currentPageNumber-e)<2;this._setCurrentPageNumber(e,!0)||Window.ngxConsole.error(`currentPageNumber: "${e}" is not a valid page.`);if(this.pageFlip)if(t){Window.ngxConsole.log("Flip");this.pageFlip.flip(e-1)}else{Window.ngxConsole.log("turn to page");this.pageFlip.turnToPage(e-1)}}hidePagesDependingOnpageViewMode(){"book"===this.pageViewMode&&(this.pageFlip||setTimeout((()=>{if(!this.pageFlip){const e=this._pages[0].div,t=e.parentElement,i=t.parentElement;i.style.width=2*e.clientWidth+"px";i.style.overflow="hidden";i.style.marginLeft="auto";i.style.marginRight="auto";this.pageFlip=new a.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.#$i();return!0}if(!(0<e&&e<=this.pagesCount))return!1;const i=this._currentPageNumber;this._currentPageNumber=e;this.hidePagesDependingOnpageViewMode();if("book"===this.pageViewMode||"infinite-scroll"===this.pageViewMode){const e=this._pages[this.currentPageNumber-1];if(e.div.parentElement.classList.contains("spread"))e.div.parentElement.childNodes.forEach((e=>{const t=Number(e.getAttribute("data-page-number")),i=this._pages[t-1];this.#Ti(i).then((()=>{this.renderingQueue.renderView(i)}));e.style.display="inline-block"}));else{this.#Ti(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.#$i();return!0}addPageToRenderQueue(e=0){if(e>=0&&e<=this._pages.length-1){const t=this._pages[e];if(t.div.querySelector(".loadingIcon")){this.#Ti(t).then((()=>{this.renderingQueue.renderView(t)}));return!0}}return!1}ensureAdjecentPagesAreLoaded(){if(!window.adjacentPagesLoader){window.adjacentPagesLoader=e=>{Window.ngxConsole.log("rendered",e);let t=this._pages[Math.min(this._pages.length-1,this.currentPageNumber)];if(t){let e=t.div.querySelector(".loadingIcon");if(e){Window.ngxConsole.log("asking for the next page");this.#Ti(t).then((()=>{this.renderingQueue.renderView(t)}))}else{t=this._pages[Math.min(this._pages.length-1,this.currentPageNumber+1)];e=t.div.querySelector(".loadingIcon");if(e){Window.ngxConsole.log("asking for the next + 1 page");this.#Ti(t).then((()=>{this.renderingQueue.renderView(t)}))}else{t=this._pages[Math.min(this._pages.length-1,this.currentPageNumber+2)];e=t.div.querySelector(".loadingIcon");if(e){Window.ngxConsole.log("asking for the next + 2 page");this.#Ti(t).then((()=>{this.renderingQueue.renderView(t)}))}else{t=this._pages[Math.min(this._pages.length-1,this.currentPageNumber+3)];e=t.div.querySelector(".loadingIcon");if(e){Window.ngxConsole.log("asking for the next + 3 page");this.#Ti(t).then((()=>{this.renderingQueue.renderView(t)}))}else{t=this._pages[Math.max(0,this.currentPageNumber-1)];e=t.div.querySelector(".loadingIcon");if(e){Window.ngxConsole.log("asking for the current page");this.#Ti(t).then((()=>{this.renderingQueue.renderView(t)}))}else{t=this._pages[Math.max(0,this.currentPageNumber-2)];e=t.div.querySelector(".loadingIcon");if(e){Window.ngxConsole.log("asking for the previous page");this.#Ti(t).then((()=>{this.renderingQueue.renderView(t)}))}else Window.ngxConsole.log("Finished preloading the pages")}}}}}}};this.eventBus._on("pagerendered",window.adjacentPagesLoader)}window.adjacentPagesLoader()}get currentPageLabel(){return this._pageLabels?.[this._currentPageNumber-1]??null}set currentPageLabel(e){if(!this.pdfDocument)return;let t=0|e;if(this._pageLabels){const i=this._pageLabels.indexOf(e);i>=0&&(t=i+1)}this._setCurrentPageNumber(t,!0)||Window.ngxConsole.error(`currentPageLabel: "${e}" is not a valid page.`)}get currentScale(){return this._currentScale!==s.UNKNOWN_SCALE?this._currentScale:s.DEFAULT_SCALE}set currentScale(e){if(isNaN(e))throw new Error("Invalid numeric scale.");this.pdfDocument&&this._setScale(e,{noScroll:!1})}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(e){this.pdfDocument&&this._setScale(e,{noScroll:!1})}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!(0,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;this.refresh(!0,{rotation:e});this._currentScaleValue&&this._setScale(this._currentScaleValue,{noScroll:!0});this.eventBus.dispatch("rotationchanging",{source:this,pagesRotation:e,pageNumber:t});this.defaultRenderingQueue&&this.update()}get firstPagePromise(){return this.pdfDocument?this._firstPageCapability.promise:null}get onePageRendered(){return this.pdfDocument?this._onePageRenderedCapability.promise:null}get pagesPromise(){return this.pdfDocument?this._pagesCapability.promise:null}#Xi(){const e=this;return{get annotationEditorUIManager(){return e.#Oi},get annotationStorage(){return e.pdfDocument?.annotationStorage},get downloadManager(){return e.downloadManager},get enableScripting(){return!!e._scriptingManager},get fieldObjectsPromise(){return e.pdfDocument?.getFieldObjects()},get findController(){return e.findController},get hasJSActionsPromise(){return e.pdfDocument?.hasJSActions()},get linkService(){return e.linkService}}}#Ki(e){const t={annotationEditorMode:this.#Fi,annotationMode:this.#Ni,textLayerMode:this.textLayerMode};if(!e)return t;e.includes(n.PermissionFlag.COPY)||this.viewer.classList.add(d);e.includes(n.PermissionFlag.MODIFY_CONTENTS)||(t.annotationEditorMode=n.AnnotationEditorType.DISABLE);e.includes(n.PermissionFlag.MODIFY_ANNOTATIONS)||e.includes(n.PermissionFlag.FILL_INTERACTIVE_FORMS)||this.#Ni!==n.AnnotationMode.ENABLE_FORMS||(t.annotationMode=n.AnnotationMode.ENABLE);return t}#Yi(){if("hidden"===document.visibilityState||!this.container.offsetParent||0===this._getVisiblePages().views.length)return Promise.resolve();const e=new Promise((e=>{this.#zi=()=>{if("hidden"===document.visibilityState){e();document.removeEventListener("visibilitychange",this.#zi);this.#zi=null}};document.addEventListener("visibilitychange",this.#zi)}));return Promise.race([this._onePageRenderedCapability.promise,e])}setDocument(e){if(this.pdfDocument){this.eventBus.dispatch("pagesdestroy",{source:this});this._cancelRendering();this._resetView();this.findController?.setDocument(null);this._scriptingManager?.setDocument(null);if(this.#Oi){this.#Oi.destroy();this.#Oi=null}}this.pdfDocument=e;if(!e)return;const t=e.numPages,i=e.getPage(1),r=e.getOptionalContentConfig(),a=this.#Vi?e.getPermissions():Promise.resolve();if(t>c.FORCE_SCROLL_MODE_PAGE){console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");const e=this._scrollMode=s.ScrollMode.PAGE;this.eventBus.dispatch("scrollmodechanged",{source:this,mode:e})}this._pagesCapability.promise.then((()=>{this.eventBus.dispatch("pagesloaded",{source:this,pagesCount:t})}),(()=>{}));this._onBeforeDraw=e=>{const t=this._pages[e.pageNumber-1];t&&this.#Ri.push(t)};this.eventBus._on("pagerender",this._onBeforeDraw);this._onAfterDraw=e=>{if(!e.cssTransform&&!this._onePageRenderedCapability.settled){this._onePageRenderedCapability.resolve({timestamp:e.timestamp});this.eventBus._off("pagerendered",this._onAfterDraw);this._onAfterDraw=null;if(this.#zi){document.removeEventListener("visibilitychange",this.#zi);this.#zi=null}}};this.eventBus._on("pagerendered",this._onAfterDraw);Promise.all([i,a]).then((([i,a])=>{if(e!==this.pdfDocument)return;this._firstPageCapability.resolve(i);this._optionalContentConfigPromise=r;const{annotationEditorMode:l,annotationMode:h,textLayerMode:d}=this.#Ki(a);if(l!==n.AnnotationEditorType.DISABLE){const t=l;if(e.isPureXfa)console.warn("Warning: XFA-editing is not implemented.");else if(isValidAnnotationEditorMode(t)){this.#Oi=new n.AnnotationEditorUIManager(this.container,this.eventBus,e?.annotationStorage);t!==n.AnnotationEditorType.NONE&&this.#Oi.updateMode(t)}else console.error(`Invalid AnnotationEditor mode: ${t}`)}const u=this.#Xi.bind(this),p=this._scrollMode===s.ScrollMode.PAGE?null:this.viewer,g=this.currentScale,f=i.getViewport({scale:g*n.PixelsPerInch.PDF_TO_CSS_UNITS});this.viewer.style.setProperty("--scale-factor",f.scale);for(let e=1;e<=t;++e){const t=new o.PDFPageView({container:p,eventBus:this.eventBus,id:e,scale:g,defaultViewport:f.clone(),optionalContentConfigPromise:r,renderingQueue:this.renderingQueue,textLayerMode:d,annotationMode:h,imageResourcesPath:this.imageResourcesPath,removePageBorders:this.removePageBorders,renderer:this.renderer,useOnlyCssZoom:this.useOnlyCssZoom,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported,maxCanvasPixels:this.maxCanvasPixels,pageColors:this.pageColors,l10n:this.l10n,layerProperties:u});this._pages.push(t)}const m=this._pages[0];if(m){m.setPdfPage(i);this.linkService.cachePageRef(1,i.ref)}this._scrollMode===s.ScrollMode.PAGE?this.#Qi():this._spreadMode!==s.SpreadMode.NONE&&this._updateSpreadMode();this.#Yi().then((async()=>{this.findController?.setDocument(e);this._scriptingManager?.setDocument(e);this.#Oi&&this.eventBus.dispatch("annotationeditormodechanged",{source:this,mode:this.#Fi});if(e.loadingParams.disableAutoFetch||t>c.FORCE_LAZY_PAGE_INIT){this._pagesCapability.resolve();return}let i=t-1;if(i<=0)this._pagesCapability.resolve();else for(let n=2;n<=t;++n){const t=e.getPage(n).then((e=>{const t=this._pages[n-1];t.pdfPage||t.setPdfPage(e);this.linkService.cachePageRef(n,e.ref);0==--i&&this._pagesCapability.resolve()}),(e=>{console.error(`Unable to get page ${n} to initialize viewer`,e);0==--i&&this._pagesCapability.resolve()}));n%c.PAUSE_EAGER_PAGE_INIT==0&&await t}}));this.hidePagesDependingOnpageViewMode();this.eventBus.dispatch("pagesinit",{source:this});e.getMetadata().then((({info:t})=>{e===this.pdfDocument&&t.Language&&(this.viewer.lang=t.Language)}));this.defaultRenderingQueue&&this.update()})).catch((e=>{Window.ngxConsole.error("Unable to initialize viewer",e);this._pagesCapability.reject(e)}))}setPageLabels(e){if(this.pdfDocument){if(e)if(Array.isArray(e)&&this.pdfDocument.numPages===e.length)this._pageLabels=e;else{this._pageLabels=null;Window.ngxConsole.error("setPageLabels: Invalid page labels.")}else this._pageLabels=null;for(let e=0,t=this._pages.length;e<t;e++)this._pages[e].setPageLabel(this._pageLabels?.[e]??null)}}_resetView(){this._pages=[];this._currentPageNumber=1;this._currentScale=s.UNKNOWN_SCALE;this._currentScaleValue=null;this._pageLabels=null;const e=Number(PDFViewerApplicationOptions.get("defaultCacheSize"))||10;this.#Ri=new PDFPageViewBuffer(e);this._location=null;this._pagesRotation=0;this._optionalContentConfigPromise=null;this._firstPageCapability=(0,n.createPromiseCapability)();this._onePageRenderedCapability=(0,n.createPromiseCapability)();this._pagesCapability=(0,n.createPromiseCapability)();this._scrollMode=s.ScrollMode.VERTICAL;this._previousScrollMode=s.ScrollMode.UNKNOWN;this._spreadMode=s.SpreadMode.NONE;this.#ji={previousPageNumber:1,scrollDown:!0,pages:[]};if(this._onBeforeDraw){this.eventBus._off("pagerender",this._onBeforeDraw);this._onBeforeDraw=null}if(this._onAfterDraw){this.eventBus._off("pagerendered",this._onAfterDraw);this._onAfterDraw=null}if(this.#zi){document.removeEventListener("visibilitychange",this.#zi);this.#zi=null}this.viewer.textContent="";this._updateScrollMode();this.viewer.removeAttribute("lang");this.viewer.classList.remove(d)}#Qi(){if(this._scrollMode!==s.ScrollMode.PAGE)throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");const e=this._currentPageNumber,t=this.#ji,i=this.viewer;i.textContent="";t.pages.length=0;if(this._spreadMode!==s.SpreadMode.NONE||this.isInPresentationMode){const n=new Set,s=this._spreadMode-1;if(-1===s)n.add(e-1);else if(e%2!==s){n.add(e-1);n.add(e)}else{n.add(e-2);n.add(e-1)}const r=document.createElement("div");r.className="spread";if(this.isInPresentationMode){const e=document.createElement("div");e.className="dummyPage";r.append(e)}for(const e of n){const i=this._pages[e];if(i){r.append(i.div);t.pages.push(i)}}i.append(r)}else{const n=this._pages[e-1];i.append(n.div);t.pages.push(n)}t.scrollDown=e>=t.previousPageNumber;t.previousPageNumber=e}_scrollUpdate(){0!==this.pagesCount&&this.update()}scrollPagePosIntoView(e,t){const i=this._pages[e-1].div;if(t){const n={...t};if("string"==typeof n.top&&n.top.endsWith("%")){const e=Number(n.top.replace("%","")),t=this.viewer.querySelector(".page")?.clientHeight;let s=i.clientHeight?i.clientHeight:t;const r=this.viewer.parentElement.clientHeight;s=Math.max(0,s-r);n.top=e*s/100}if("string"==typeof n.left&&n.left.endsWith("%")){const e=Number(n.left.replace("%","")),t=this.viewer.querySelector(".page")?.clientWidth,s=i.clientWidth?i.clientWidth:t;n.left=e*s/100}this.#Zi({div:i,id:e},n)}else this.#Zi({pageDiv:i,pageNumber:e})}#Zi(e,t=null){if(!e)return;const{div:i,id:n}=e;this._currentPageNumber!==n&&this._setCurrentPageNumber(n);if(this._scrollMode===s.ScrollMode.PAGE){this.#Qi();this.update()}if(!t&&!this.isInPresentationMode){const e=i.offsetLeft+i.clientLeft,n=e+i.clientWidth,{scrollLeft:r,clientWidth:a}=this.container;(this._scrollMode===s.ScrollMode.HORIZONTAL||e<r||n>r+a)&&(t={left:0,top:0})}(0,s.scrollIntoView)(i,t,!1,"infinite-scroll"===this.pageViewMode);!this._currentScaleValue&&this._location&&(this._location=null)}#Ji(e){return e===this._currentScale||Math.abs(e-this._currentScale)<1e-15}_setScaleUpdatePages(e,t,{noScroll:i=!1,preset:s=!1,drawingDelay:r=-1}){const a=isNaN(Number(this.currentScale))?void 0:Number(this.currentScale),o=this.currentScaleValue;this._currentScaleValue=t.toString();if(this.#Ji(e)){s&&this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:t,previousScale:a,previousPresetValue:o});return}this.viewer.style.setProperty("--scale-factor",e*n.PixelsPerInch.PDF_TO_CSS_UNITS);const l=r>=0&&r<1e3;this.refresh(!0,{scale:e,drawingDelay:l?r:-1});l&&(this.#Gi=setTimeout((()=>{this.#Gi=null;this.refresh()}),r));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:s?t:void 0,previousScale:a,previousPresetValue:o});this.defaultRenderingQueue&&this.update()}get _pageWidthScaleFactor(){return this._spreadMode!==s.SpreadMode.NONE&&this._scrollMode!==s.ScrollMode.HORIZONTAL?2:1}_setScale(e,t){e||(e="auto");let i=parseFloat(e);if(this._currentScale!==i)if(i>0){t.preset=!1;this._setScaleUpdatePages(i,e,t)}else{const n=this._pages[this._currentPageNumber-1];if(!n)return;let r=s.SCROLLBAR_PADDING,a=s.VERTICAL_PADDING;if(this.isInPresentationMode){r=a=4;this._spreadMode!==s.SpreadMode.NONE&&(r*=2)}else this.removePageBorders?r=a=0:this._scrollMode===s.ScrollMode.HORIZONTAL&&([r,a]=[a,r]);const o=(this.container.clientWidth-r)/n.width*n.scale/this._pageWidthScaleFactor,l=(this.container.clientHeight-a)/n.height*n.scale;switch(e){case"page-actual":i=1;break;case"page-width":i=o;break;case"page-height":i=l;break;case"page-fit":i=Math.min(o,l);break;case"auto":const t=(0,s.isPortraitOrientation)(n)?o:Math.min(l,o);i=Math.min(s.MAX_AUTO_SCALE,t);break;default:Window.ngxConsole.error(`_setScale: "${e}" is an unknown zoom value.`);return}t.preset=!0;this._setScaleUpdatePages(i,e,t)}}#$i(){const e=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&this._setScale(this._currentScaleValue,{noScroll:!0});this.#Zi(e)}pageLabelToPageNumber(e){if(!this._pageLabels)return null;const t=this._pageLabels.indexOf(e);return t<0?null:t+1}scrollPageIntoView({pageNumber:e,destArray:t=null,allowNegativeOffset:i=!1,ignoreDestinationZoom:r=!1}){if(!this.pdfDocument)return;const 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,d=0,c=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];d=t[3];m=t[4];h=null!==h?h:0;d=null!==d?d:f;break;case"Fit":case"FitB":m="page-fit";break;case"FitH":case"FitBH":d=t[2];m="page-width";if(null===d&&this._location){h=this._location.left;d=this._location.top}else("number"!=typeof d||d<0)&&(d=f);break;case"FitV":case"FitBV":h=t[2];c=g;u=f;m="page-height";break;case"FitR":h=t[2];d=t[3];c=t[4]-h;u=t[5]-d;let e=s.SCROLLBAR_PADDING,i=s.VERTICAL_PADDING;this.removePageBorders&&(e=i=0);o=(this.container.clientWidth-e)/c/n.PixelsPerInch.PDF_TO_CSS_UNITS;l=(this.container.clientHeight-i)/u/n.PixelsPerInch.PDF_TO_CSS_UNITS;m=Math.min(Math.abs(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.#Ti(a).then((()=>{this.renderingQueue.renderView(a);"single"===this.pageViewMode&&this.currentPageNumber!==e&&(this.currentPageNumber=e)}));if("page-fit"===m&&!t[4]){this.#Zi(a);return}const b=[a.viewport.convertToViewportPoint(h,d),a.viewport.convertToViewportPoint(h+c,d+u)];let v=Math.min(b[0][0],b[1][0]),w=Math.min(b[0][1],b[1][1]);if(!i){v=Math.max(v,0);w=Math.max(w,0)}this.#Zi(a,{left:v,top:w})}_updateLocation(e){const t=this._currentScale,i=this._currentScaleValue,n=parseFloat(i)===t?Math.round(1e4*t)/100:i,s=e.id,r=this._pages[s-1],a=this.container,o=r.getPagePoint(a.scrollLeft-e.x,a.scrollTop-e.y),l=Math.round(o[0]),h=Math.round(o[1]);let d=`#page=${s}`;this.isInPresentationMode||(d+=`&zoom=${n},${l},${h}`);this._location={pageNumber:s,scale:n,top:h,left:l,rotation:this._pagesRotation,pdfOpenParams:d}}update(){this.scrollMode===s.ScrollMode.PAGE?this.viewer.classList.add("singlePageView"):this.viewer.classList.remove("singlePageView");const e=this._getVisiblePages(),t=e.views,i=t.length;if(0===i)return;const n=Number(PDFViewerApplicationOptions.get("defaultCacheSize"))||10,r=Math.max(n,2*i+1);this.#Ri.resize(r,e.ids);this.renderingQueue.renderHighestPriority(e);const a=this._spreadMode===s.SpreadMode.NONE&&(this._scrollMode===s.ScrollMode.PAGE||this._scrollMode===s.ScrollMode.VERTICAL),o=this._currentPageNumber;let l=!1;for(const e of t){if(e.percent<100)break;if(e.id===o&&a){l=!0;break}}this._setCurrentPageNumber(l?o:t[0].id);this._updateLocation(e.first);this.eventBus.dispatch("updateviewarea",{source:this,location:this._location});this.hidePagesDependingOnpageViewMode()}containsElement(e){return this.container.contains(e)}focus(){this.container.focus()}get _isContainerRtl(){return"rtl"===getComputedStyle(this.container).direction}get isInPresentationMode(){return this.presentationModeState===s.PresentationModeState.FULLSCREEN}get isChangingPresentationMode(){return this.presentationModeState===s.PresentationModeState.CHANGING}get isHorizontalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollHeight>this.container.clientHeight}_getVisiblePages(){const e=this._scrollMode===s.ScrollMode.PAGE?this.#ji.pages:this._pages,t=this._scrollMode===s.ScrollMode.HORIZONTAL,i=t&&this._isContainerRtl;return(0,s.getVisibleElements)({scrollEl:this.container,views:e,sortByVisibility:!0,horizontal:t,rtl:i})}isPageVisible(e){if(!this.pdfDocument)return!1;if(!(Number.isInteger(e)&&e>0&&e<=this.pagesCount)){console.error(`isPageVisible: "${e}" is not a valid page.`);return!1}return this._getVisiblePages().ids.has(e)}isPageCached(e){if(!this.pdfDocument)return!1;if(!(Number.isInteger(e)&&e>0&&e<=this.pagesCount)){console.error(`isPageCached: "${e}" is not a valid page.`);return!1}const t=this._pages[e-1];return this.#Ri.has(t)}cleanup(){for(const e of this._pages)e.renderingState!==s.RenderingStates.FINISHED&&e.reset()}_cancelRendering(){for(const e of this._pages)e.cancelRendering()}async#Ti(e){if(e.pdfPage)return e.pdfPage;try{const t=await this.pdfDocument.getPage(e.id);e.pdfPage||e.setPdfPage(t);this.linkService._cachedPageNumber?.(t.ref)||this.linkService.cachePageRef(e.id,t.ref);return t}catch(e){console.error("Unable to get page for page view",e);return null}}#Mi(e){if(1===e.first?.id)return!0;if(e.last?.id===this.pagesCount)return!1;switch(this._scrollMode){case s.ScrollMode.PAGE:return this.#ji.scrollDown;case s.ScrollMode.HORIZONTAL:return this.scroll.right}return this.scroll.down}forceRendering(e){const t=e||this._getVisiblePages(),i=this.#Mi(t),n=this._spreadMode!==s.SpreadMode.NONE&&this._scrollMode!==s.ScrollMode.HORIZONTAL,r=this.renderingQueue.getHighestPriority(t,this._pages,i,n);if(r){this.#Ti(r).then((()=>{this.renderingQueue.renderView(r)}));return!0}return!1}get hasEqualPageSizes(){const e=this._pages[0];for(let t=1,i=this._pages.length;t<i;++t){const i=this._pages[t];if(i.width!==e.width||i.height!==e.height)return!1}return!0}getPagesOverview(){return this._pages.map((e=>{const t=e.pdfPage.getViewport({scale:1});return!this.enablePrintAutoRotate||(0,s.isPortraitOrientation)(t)?{width:t.width,height:t.height,rotation:t.rotation}:{width:t.height,height:t.width,rotation:(t.rotation-90)%360}}))}get optionalContentConfigPromise(){if(!this.pdfDocument)return Promise.resolve(null);if(!this._optionalContentConfigPromise){console.error("optionalContentConfigPromise: Not initialized yet.");return this.pdfDocument.getOptionalContentConfig()}return this._optionalContentConfigPromise}set optionalContentConfigPromise(e){if(!(e instanceof Promise))throw new Error(`Invalid optionalContentConfigPromise: ${e}`);if(this.pdfDocument&&this._optionalContentConfigPromise){this._optionalContentConfigPromise=e;this.refresh(!1,{optionalContentConfigPromise:e});this.eventBus.dispatch("optionalcontentconfigchanged",{source:this,promise:e})}}get scrollMode(){return this._scrollMode}set scrollMode(e){if(this._scrollMode!==e){if(!(0,s.isValidScrollMode)(e))throw new Error(`Invalid scroll mode: ${e}`);if(!(this.pagesCount>c.FORCE_SCROLL_MODE_PAGE)){this._previousScrollMode=this._scrollMode;this._scrollMode=e;this.eventBus.dispatch("scrollmodechanged",{source:this,mode:e});this._updateScrollMode(this._currentPageNumber)}}}_updateScrollMode(e=null){const t=this._scrollMode,i=this.viewer;i.classList.toggle("scrollHorizontal",t===s.ScrollMode.HORIZONTAL);i.classList.toggle("scrollWrapped",t===s.ScrollMode.WRAPPED);if(this.pdfDocument&&e){t===s.ScrollMode.PAGE?this.#Qi():this._previousScrollMode===s.ScrollMode.PAGE&&this._updateSpreadMode();this._currentScaleValue&&isNaN(this._currentScaleValue)&&this._setScale(this._currentScaleValue,{noScroll:!0});this._setCurrentPageNumber(e,!0);this.update()}}get spreadMode(){return this._spreadMode}set spreadMode(e){if(this._spreadMode!==e){if(!(0,s.isValidSpreadMode)(e))throw new Error(`Invalid spread mode: ${e}`);this._spreadMode=e;this.eventBus.dispatch("spreadmodechanged",{source:this,mode:e});this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(e=null){if(!this.pdfDocument)return;const t=this.viewer,i=this._pages;if(this._scrollMode===s.ScrollMode.PAGE)this.#Qi();else{t.textContent="";if(this._spreadMode===s.SpreadMode.NONE)for(const e of this._pages)t.append(e.div);else{const e=this._spreadMode-1;let n=null;for(let s=0,r=i.length;s<r;++s){if(null===n){n=document.createElement("div");n.className="spread";t.append(n)}else if(s%2===e){n=n.cloneNode(!1);t.append(n)}n.append(i[s].div)}}}this.hidePagesDependingOnpageViewMode();if(e){this._currentScaleValue&&isNaN(this._currentScaleValue)&&this._setScale(this._currentScaleValue,{noScroll:!0});this._setCurrentPageNumber(e,!0);this.update()}}_getPageAdvance(e,t=!1){switch(this._scrollMode){case s.ScrollMode.WRAPPED:{const{views:i}=this._getVisiblePages(),n=new Map;for(const{id:e,y:t,percent:s,widthPercent:r}of i){if(0===s||r<100)continue;let i=n.get(t);i||n.set(t,i||=[]);i.push(e)}for(const i of n.values()){const n=i.indexOf(e);if(-1===n)continue;const s=i.length;if(1===s)break;if(t)for(let t=n-1,s=0;t>=s;t--){const n=i[t],s=i[t+1]-1;if(n<s)return e-s}else for(let t=n+1,r=s;t<r;t++){const n=i[t],s=i[t-1]+1;if(n>s)return s-e}if(t){const t=i[0];if(t<e)return e-t+1}else{const t=i[s-1];if(t>e)return t-e+1}break}break}case s.ScrollMode.HORIZONTAL:break;case s.ScrollMode.PAGE:case s.ScrollMode.VERTICAL:{if(this._spreadMode===s.SpreadMode.NONE)break;const i=this._spreadMode-1;if(t&&e%2!==i)break;if(!t&&e%2===i)break;const{views:n}=this._getVisiblePages(),r=t?e-1:e+1;for(const{id:e,percent:t,widthPercent:i}of n)if(e===r){if(t>0&&100===i)return 2;break}break}}return 1}nextPage(){const e=this._currentPageNumber,t=this.pagesCount;if(e>=t)return!1;const i=this._getPageAdvance(e,!1)||1;this.currentPageNumber=Math.min(e+i,t);return!0}previousPage(){const e=this._currentPageNumber;if(e<=1)return!1;const t=this._getPageAdvance(e,!0)||1;this.currentPageNumber=Math.max(e-t,1);return!0}increaseScale(e=null){if("number"==typeof e){console.error("The `increaseScale` method-signature was updated, please use an object instead.");e={steps:e}}if(!this.pdfDocument)return;e||=Object.create(null);let t=this._currentScale,i=Number(PDFViewerApplicationOptions.get("maxZoom"));i||(i=s.MAX_SCALE);if(e.scaleFactor>1)t=Math.min(i,Math.round(t*e.scaleFactor*100)/100);else{let n=e.steps??1;do{t=(t*s.DEFAULT_SCALE_DELTA).toFixed(2);t=Math.ceil(10*t)/10;t=Math.min(i,t)}while(--n>0&&t<i)}e.noScroll=!1;this._setScale(t,e)}decreaseScale(e=null){if("number"==typeof e){console.error("The `decreaseScale` method-signature was updated, please use an object instead.");e={steps:e}}if(!this.pdfDocument)return;e||=Object.create(null);let t=this._currentScale,i=Number(PDFViewerApplicationOptions.get("minZoom"));i||(i=s.MIN_SCALE);if(e.scaleFactor>0&&e.scaleFactor<1)t=Math.max(i,Math.round(t*e.scaleFactor*100)/100);else{let n=e.steps??1;do{t=(t/s.DEFAULT_SCALE_DELTA).toFixed(2);t=Math.floor(10*t)/10;t=Math.max(i,t)}while(--n>0&&t>i)}e.noScroll=!1;this._setScale(t,e)}#qi(e=this.container.clientHeight){if(e!==this.#Ui){this.#Ui=e;s.docStyle.setProperty("--viewer-container-height",`${e}px`)}}#Hi(e){for(const t of e)if(t.target===this.container){this.#qi(Math.floor(t.borderBoxSize[0].blockSize));this.#Bi=null;break}}get containerTopLeft(){return this.#Bi||=[this.container.offsetTop,this.container.offsetLeft]}get annotationEditorMode(){return this.#Oi?this.#Fi:n.AnnotationEditorType.DISABLE}set annotationEditorMode(e){if(!this.#Oi)throw new Error("The AnnotationEditor is not enabled.");if(this.#Fi!==e){if(!isValidAnnotationEditorMode(e))throw new Error(`Invalid AnnotationEditor mode: ${e}`);if(this.pdfDocument){this.#Fi=e;this.eventBus.dispatch("annotationeditormodechanged",{source:this,mode:e});this.#Oi.updateMode(e)}}}set annotationEditorParams({type:e,value:t}){if(!this.#Oi)throw new Error("The AnnotationEditor is not enabled.");this.#Oi.updateParams(e,t)}refresh(e=!1,t=Object.create(null)){if(this.pdfDocument){for(const e of this._pages)e.update(t);if(null!==this.#Gi){clearTimeout(this.#Gi);this.#Gi=null}e||this.update()}}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.NullL10n=void 0;t.fixupLangCode=function fixupLangCode(e){return n[e?.toLowerCase()]||e};t.getL10nFallback=getL10nFallback;const i={of_pages:"of {{pagesCount}}",page_of_pages:"({{pageNumber}} of {{pagesCount}})",document_properties_kb:"{{size_kb}} KB ({{size_b}} bytes)",document_properties_mb:"{{size_mb}} MB ({{size_b}} bytes)",document_properties_date_string:"{{date}}, {{time}}",document_properties_page_size_unit_inches:"in",document_properties_page_size_unit_millimeters:"mm",document_properties_page_size_orientation_portrait:"portrait",document_properties_page_size_orientation_landscape:"landscape",document_properties_page_size_name_a3:"A3",document_properties_page_size_name_a4:"A4",document_properties_page_size_name_letter:"Letter",document_properties_page_size_name_legal:"Legal",document_properties_page_size_dimension_string:"{{width}} × {{height}} {{unit}} ({{orientation}})",document_properties_page_size_dimension_name_string:"{{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})",document_properties_linearized_yes:"Yes",document_properties_linearized_no:"No",additional_layers:"Additional Layers",page_landmark:"Page {{page}}",thumb_page_title:"Page {{page}}",thumb_page_canvas:"Thumbnail of Page {{page}}",find_reached_top:"Reached top of document, continued from bottom",find_reached_bottom:"Reached end of document, continued from top","find_match_count[one]":"{{current}} of {{total}} match","find_match_count[other]":"{{current}} of {{total}} matches","find_match_count_limit[one]":"More than {{limit}} match","find_match_count_limit[other]":"More than {{limit}} matches",find_not_found:"Phrase not found",page_scale_width:"Page Width",page_scale_fit:"Page Fit",page_scale_auto:"Automatic Zoom",page_scale_actual:"Actual Size",page_scale_percent:"{{scale}}%",loading_error:"An error occurred while loading the PDF.",invalid_file_error:"Invalid or corrupted PDF file.",missing_file_error:"Missing PDF file.",unexpected_response_error:"Unexpected server response.",rendering_error:"An error occurred while rendering the page.",printing_not_supported:"Warning: Printing is not fully supported by this browser.",printing_not_ready:"Warning: The PDF is not fully loaded for printing.",web_fonts_disabled:"Web fonts are disabled: unable to use embedded PDF fonts.",free_text2_default_content:"Start typing…",editor_free_text2_aria_label:"Text Editor",editor_ink2_aria_label:"Draw Editor",editor_ink_canvas_aria_label:"User-created image",print_progress_percent:"{{progress}}%"};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=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0}:void 0,i=canvas.getContext("2d",t),n=this.render.convertToGlobal(this.state.position),s=this.render.getRect().pageWidth,r=this.render.getRect().height;i.save();i.translate(n.x,n.y);i.beginPath();for(let e of this.state.area)if(null!==e){e=this.render.convertToGlobal(e);i.lineTo(e.x-n.x,e.y-n.y)}i.rotate(this.state.angle);i.clip();this.isLoad?i.drawImage(this.image,0,0,s,r):this.drawLoader(i,{x:0,y:0},s,r);i.restore()}simpleDraw(e){const t=this.render.getRect(),i=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0}:void 0,n=canvas.getContext("2d",i),s=t.pageWidth,r=t.height,a=1===e?t.left+t.pageWidth:t.left,o=t.top;this.isLoad?n.drawImage(this.image,a,o,s,r):this.drawLoader(n,{x:a,y:o},s,r)}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,d=-(a*r-o*s)/(i*r-n*s),c=-(i*o-n*a)/(i*r-n*s);if(isFinite(d)&&isFinite(c))return{x:d,y:c};if(Math.abs(l-h)<.1)throw new Error("Segment included");return null}static GetCordsFromTwoPoint(e,t){const i=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y),s=Math.max(i,n),r=[e];function getCord(e,t,i,n,s){return t>e?e+s*(i/n):t<e?e-s*(i/n):e}for(let 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=>{window.ngxZone.runOutsideAngular((()=>{this.render(e);requestAnimationFrame(loop)}))};window.ngxZone.runOutsideAngular((()=>{requestAnimationFrame(loop)}))}startAnimation(e,t,i){this.finishAnimation();this.animation={frames:e,duration:t,durationFrame:t/e.length,onAnimateEnd:i,startedAt:this.timer}}finishAnimation(){if(null!==this.animation){this.animation.frames[this.animation.frames.length-1]();null!==this.animation.onAnimateEnd&&this.animation.onAnimateEnd()}this.animation=null}update(){this.boundsRect=null;const e=this.calculateBoundsRect();if(this.orientation!==e){this.orientation=e;this.app.updateOrientation(e)}}calculateBoundsRect(){let e="landscape";const t=this.getBlockWidth(),i=t/2,n=this.getBlockHeight()/2,s=this.setting.width/this.setting.height;let r=this.setting.width,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;const n=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0}:void 0;canvas.getContext("2d",n)}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 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})}}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()){if(this.flippingPage.getHardAngle()<-90){this.leftPage.getElement().style.zIndex=(this.getSettings().startZIndex+5).toString(10);this.leftPage.setHardDrawingAngle(180+this.flippingPage.getHardAngle());this.leftPage.draw(this.flippingPage.getDrawingDensity())}else this.leftPage.getElement().style.display="none"}else this.leftPage.simpleDraw(0)}drawRightPage(){if(null!==this.rightPage)if(0===this.direction&&null!==this.flippingPage&&"hard"===this.flippingPage.getDrawingDensity()){if(this.flippingPage.getHardAngle()>90){this.rightPage.getElement().style.zIndex=(this.getSettings().startZIndex+5).toString(10);this.rightPage.setHardDrawingAngle(180+this.flippingPage.getHardAngle());this.rightPage.draw(this.flippingPage.getDrawingDensity())}else this.rightPage.getElement().style.display="none"}else this.rightPage.simpleDraw(1)}drawBottomPage(){if(null===this.bottomPage)return;const e=null!=this.flippingPage?this.flippingPage.getDrawingDensity():null;if("portrait"!==this.orientation||1!==this.direction){this.bottomPage.getElement().style.zIndex=(this.getSettings().startZIndex+3).toString(10);this.bottomPage.draw(e)}}drawFrame(){if(null!==this.flippingPage){if(this.flippingPage.getHardAngle()===this.lastAngle)return;this.lastAngle=this.flippingPage.getHardAngle()}else this.lastAngle=-1234;this.clear();this.drawLeftPage();this.drawRightPage();this.drawBottomPage();if(null!=this.flippingPage){if(this.flippingPage.state.hardDrawingAngle<=90){this.flippingPage.getElement().style.zIndex=(this.getSettings().startZIndex+5).toString(10);this.flippingPage.draw()}else this.flippingPage.getElement().style.display="none"}if(null!=this.shadow&&null!==this.flippingPage)if("soft"===this.flippingPage.getDrawingDensity()){this.drawOuterShadow();this.drawInnerShadow()}else{this.drawHardOuterShadow();this.drawHardInnerShadow()}}clear(){for(const e of this.app.getPageCollection().getPages()){if(e!==this.leftPage&&e!==this.rightPage&&e!==this.flippingPage&&e!==this.bottomPage){const t=e.getElement().style;"none"!==t.display&&(t.cssText="display: none")}e.getTemporaryCopy()!==this.flippingPage&&e.hideTemporaryCopy()}}update(){super.update();null!==this.rightPage&&this.rightPage.setOrientation(1);null!==this.leftPage&&this.leftPage.setOrientation(0)}}class Settings{constructor(){this._default={startPage:0,size:"fixed",width:0,height:0,minWidth:0,maxWidth:0,minHeight:0,maxHeight:0,drawShadow:!0,flippingTime:1e3,usePortrait:!0,startZIndex:0,autoSize:!0,maxShadowOpacity:1,showCover:!1,mobileScrollSupport:!0,swipeDistance:30,clickEventForward:!0,useMouseEvents:!0,showPageCorners:!0,disableFlipByClick:!1}}getSettings(e){const t=this._default;Object.assign(t,e);if("stretch"!==t.size&&"fixed"!==t.size)throw new Error('Invalid size type. Available only "fixed" and "stretch" value');if(t.width<=0||t.height<=0)throw new Error("Invalid width or height");if(t.flippingTime<=0)throw new Error("Invalid flipping time");if("stretch"===t.size){t.minWidth<=0&&(t.minWidth=100);t.maxWidth<t.minWidth&&(t.maxWidth=2e3);t.minHeight<=0&&(t.minHeight=100);t.maxHeight<t.minHeight&&(t.maxHeight=2e3)}else{t.minWidth=t.width;t.maxWidth=t.width;t.minHeight=t.height;t.maxHeight=t.height}return t}}!function styleInject(e,t){void 0===t&&(t={});var i=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css";"top"===i&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s);s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}}(".stf__parent {\n position: relative;\n display: block;\n box-sizing: border-box;\n transform: translateZ(0);\n\n -ms-touch-action: pan-y;\n touch-action: pan-y;\n}\n\n.sft__wrapper {\n position: relative;\n width: 100%;\n box-sizing: border-box;\n}\n\n.stf__parent canvas {\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n}\n\n.stf__block {\n position: absolute;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n perspective: 2000px;\n}\n\n.stf__item {\n display: none;\n position: absolute;\n transform-style: preserve-3d;\n}\n\n.stf__outerShadow {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.stf__innerShadow {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.stf__hardShadow {\n position: absolute;\n left: 0;\n top: 0;\n}\n\n.stf__hardInnerShadow {\n position: absolute;\n left: 0;\n top: 0;\n}");t.PageFlip=class PageFlip extends EventObject{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(35),a=i(36),o=i(5),l=i(32),h=(i(7),i(37)),d=i(38),c=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(i(39)),u=i(40),p=i(41),g=i(42),f=i(43);const m=o.compatibilityParams.maxCanvasPixels||16777216,DEFAULT_LAYER_PROPERTIES=()=>null;t.PDFPageView=class PDFPageView{#Ni=n.AnnotationMode.ENABLE_FORMS;#Xi=null;#en=null;#tn=null;#in=s.RenderingStates.INITIAL;#nn={initialOptionalContent:!0,regularAnnotations:!0};constructor(e){const t=e.container,i=e.defaultViewport;this.id=e.id;this.renderingId="page"+this.id;this.#Xi=e.layerProperties||DEFAULT_LAYER_PROPERTIES;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.#Ni=e.annotationMode??n.AnnotationMode.ENABLE_FORMS;this.imageResourcesPath=e.imageResourcesPath||"";this.useOnlyCssZoom=e.useOnlyCssZoom||!1;this.isOffscreenCanvasSupported=e.isOffscreenCanvasSupported??!0;this.maxCanvasPixels=e.maxCanvasPixels||m;this.pageColors=e.pageColors||null;this.eventBus=e.eventBus;this.renderingQueue=e.renderingQueue;this.renderer=e.renderer||s.RendererType.CANVAS;this.l10n=e.l10n||l.NullL10n;this.paintTask=null;this.paintedViewportMap=new WeakMap;this.resume=null;this._renderError=null;this._isStandalone=!this.renderingQueue?.hasViewer();this._annotationCanvasMap=null;this.annotationLayer=null;this.annotationEditorLayer=null;this.textLayer=null;this.zoomLayer=null;this.xfaLayer=null;this.structTreeLayer=null;const r=document.createElement("div");r.className="page";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;this.#sn();t?.append(r);if(this._isStandalone){t?.style.setProperty("--scale-factor",this.scale*n.PixelsPerInch.PDF_TO_CSS_UNITS);const{optionalContentConfigPromise:i}=e;i&&i.then((e=>{i===this._optionalContentConfigPromise&&(this.#nn.initialOptionalContent=e.hasInitialVisibility)}))}}get renderingState(){return this.#in}set renderingState(e){if(e!==this.#in){this.#in=e;if(this.#en){clearTimeout(this.#en);this.#en=null}switch(e){case s.RenderingStates.PAUSED:this.div.classList.remove("loading");break;case s.RenderingStates.RUNNING:this.div.classList.add("loadingIcon");this.#en=setTimeout((()=>{this.div.classList.add("loading");this.#en=null}),0);break;case s.RenderingStates.INITIAL:case s.RenderingStates.FINISHED:this.div.classList.remove("loadingIcon","loading")}}}#sn(){const{viewport:e}=this;if(this.pdfPage){if(this.#tn===e.rotation)return;this.#tn=e.rotation}(0,n.setLayerDimensions)(this.div,e,!0,!1)}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.#sn();this.reset()}destroy(){this.reset();this.pdfPage?.cleanup()}get _textHighlighter(){return(0,n.shadow)(this,"_textHighlighter",new p.TextHighlighter({pageIndex:this.id-1,eventBus:this.eventBus,findController:this.#Xi().findController}))}async#rn(){let e=null;try{await this.annotationLayer.render(this.viewport,"display")}catch(t){console.error(`#renderAnnotationLayer: "${t}".`);e=t}finally{this.eventBus.dispatch("annotationlayerrendered",{source:this,pageNumber:this.id,error:e})}}async#an(){let e=null;try{await this.annotationEditorLayer.render(this.viewport,"display")}catch(t){console.error(`#renderAnnotationEditorLayer: "${t}".`);e=t}finally{this.eventBus.dispatch("annotationeditorlayerrendered",{source:this,pageNumber:this.id,error:e})}}async#on(){let e=null;try{const t=await this.xfaLayer.render(this.viewport,"display");t?.textDivs&&this._textHighlighter&&this.#ln(t.textDivs)}catch(t){console.error(`#renderXfaLayer: "${t}".`);e=t}finally{this.eventBus.dispatch("xfalayerrendered",{source:this,pageNumber:this.id,error:e})}}async#hn(){const{pdfPage:e,textLayer:t,viewport:i}=this;if(!t)return;let s=null;try{if(!t.renderingDone){const i=e.streamTextContent({includeMarkedContent:!0});t.setTextContentSource(i)}await t.render(i)}catch(e){if(e instanceof n.AbortException)return;console.error(`#renderTextLayer: "${e}".`);s=e}this.eventBus.dispatch("textlayerrendered",{source:this,pageNumber:this.id,numTextDivs:t.numTextDivs,error:s});this.#dn()}async#dn(){if(!this.textLayer)return;this.structTreeLayer||=new h.StructTreeLayerBuilder;const e=await(this.structTreeLayer.renderingDone?null:this.pdfPage.getStructTree()),t=this.structTreeLayer?.render(e);t&&this.canvas?.append(t);this.structTreeLayer?.show()}async#ln(e){const t=await this.pdfPage.getTextContent(),i=[];for(const e of t.items)i.push(e.str);this._textHighlighter.setTextMapping(e,i);this._textHighlighter.enable()}_resetZoomLayer(e=!1){if(!this.zoomLayer)return;const t=this.zoomLayer.firstChild;this.paintedViewportMap.delete(t);t.width=0;t.height=0;e&&this.zoomLayer.remove();this.zoomLayer=null}reset({keepZoomLayer:e=!1,keepAnnotationLayer:t=!1,keepAnnotationEditorLayer:i=!1,keepXfaLayer:n=!1,keepTextLayer:r=!1}={}){this.cancelRendering({keepAnnotationLayer:t,keepAnnotationEditorLayer:i,keepXfaLayer:n,keepTextLayer:r});this.renderingState=s.RenderingStates.INITIAL;const a=this.div,o=a.childNodes,l=e&&this.zoomLayer||null,h=t&&this.annotationLayer?.div||null,d=i&&this.annotationEditorLayer?.div||null,c=n&&this.xfaLayer?.div||null,u=r&&this.textLayer?.div||null;for(let e=o.length-1;e>=0;e--){const t=o[e];switch(t){case l:case h:case d:case c:case u:continue}t.remove()}a.removeAttribute("data-loaded");h&&this.annotationLayer.hide();d&&this.annotationEditorLayer.hide();c&&this.xfaLayer.hide();u&&this.textLayer.hide();this.structTreeLayer?.hide();if(!l){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}}update({scale:e=0,rotation:t=null,optionalContentConfigPromise:i=null,drawingDelay:r=-1}){this.scale=e||this.scale;"number"==typeof t&&(this.rotation=t);if(i instanceof Promise){this._optionalContentConfigPromise=i;i.then((e=>{i===this._optionalContentConfigPromise&&(this.#nn.initialOptionalContent=e.hasInitialVisibility)}))}const a=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:this.scale*n.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:a});this.#sn();this._isStandalone&&this.div.parentNode?.style.setProperty("--scale-factor",this.viewport.scale);if(this.svg){this.cssTransform({target:this.svg,redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!0});this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this._renderError});return}let o=!1;if(this.canvas&&this.maxCanvasPixels>0){const e=this.outputScale;(Math.floor(this.viewport.width)*e.sx|0)*(Math.floor(this.viewport.height)*e.sy|0)>this.maxCanvasPixels&&(o=!0)}const l=r>=0&&r<1e3;if(this.canvas){if(l||this.useOnlyCssZoom||this.hasRestrictedScaling&&o){if(l&&this.renderingState!==s.RenderingStates.FINISHED){this.cancelRendering({keepZoomLayer:!0,keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,cancelExtraDelay:r});this.renderingState=s.RenderingStates.FINISHED}this.cssTransform({target:this.canvas,redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!l,hideTextLayer:l});this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this._renderError});return}if(!this.zoomLayer&&!this.canvas.hidden){this.zoomLayer=this.canvas.parentNode;this.zoomLayer.style.position="absolute"}}this.zoomLayer&&this.cssTransform({target:this.zoomLayer.firstChild});this.reset({keepZoomLayer:!0,keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0})}cancelRendering({keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:i=!1,keepTextLayer:n=!1,cancelExtraDelay:s=0}={}){if(this.paintTask){this.paintTask.cancel(s);this.paintTask=null}this.resume=null;if(this.textLayer&&(!n||!this.textLayer.div)){this.textLayer.cancel();this.textLayer=null}this.structTreeLayer&&!this.textLayer&&(this.structTreeLayer=null);if(this.annotationLayer&&(!e||!this.annotationLayer.div)){this.annotationLayer.cancel();this.annotationLayer=null;this._annotationCanvasMap=null}if(this.annotationEditorLayer&&(!t||!this.annotationEditorLayer.div)){this.annotationEditorLayer.cancel();this.annotationEditorLayer=null}if(this.xfaLayer&&(!i||!this.xfaLayer.div)){this.xfaLayer.cancel();this.xfaLayer=null;this._textHighlighter?.disable()}}cssTransform({target:e,redrawAnnotationLayer:t=!1,redrawAnnotationEditorLayer:i=!1,redrawXfaLayer:n=!1,redrawTextLayer:s=!1,hideTextLayer:r=!1}){if(e instanceof HTMLCanvasElement){if(!e.hasAttribute("zooming")){e.setAttribute("zooming",!0);const{style:t}=e;t.width=t.height=""}}else{const t=this.div,{width:i,height:n}=this.viewport;e.style.width=e.parentNode.style.width=t.style.width=Math.floor(i)+"px";e.style.height=e.parentNode.style.height=t.style.height=Math.floor(n)+"px"}const a=this.paintedViewportMap.get(e);if(this.viewport!==a){const t=this.viewport.rotation-a.rotation,i=Math.abs(t);let n=1,s=1;if(90===i||270===i){const{width:e,height:t}=this.viewport;n=t/e;s=e/t}0!==i&&(e.style.transform=`rotate(${t}deg) scale(${n}, ${s})`)}t&&this.annotationLayer&&this.#rn();i&&this.annotationEditorLayer&&this.#an();n&&this.xfaLayer&&this.#on();if(this.textLayer)if(r){this.textLayer.hide();this.structTreeLayer?.hide()}else s&&this.#hn()}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!==s.RenderingStates.INITIAL){Window.ngxConsole.error("Must be in new state before drawing");this.reset()}const{div:e,pdfPage:t}=this;if(!t){this.renderingState=s.RenderingStates.FINISHED;return Promise.reject(new Error("pdfPage is not loaded"))}this.renderingState=s.RenderingStates.RUNNING;const i=document.createElement("div");i.classList.add("canvasWrapper");e.append(i);if(!this.textLayer&&this.textLayerMode!==s.TextLayerMode.DISABLE&&!t.isPureXfa){this._accessibilityManager||=new d.TextAccessibilityManager;this.textLayer=new g.TextLayerBuilder({highlighter:this._textHighlighter,accessibilityManager:this._accessibilityManager,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported});e.append(this.textLayer.div)}if(!this.annotationLayer&&this.#Ni!==n.AnnotationMode.DISABLE){const{annotationStorage:i,downloadManager:s,enableScripting:r,fieldObjectsPromise:o,hasJSActionsPromise:l,linkService:h}=this.#Xi();this._annotationCanvasMap||=new Map;this.annotationLayer=new a.AnnotationLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:i,imageResourcesPath:this.imageResourcesPath,renderForms:this.#Ni===n.AnnotationMode.ENABLE_FORMS,linkService:h,downloadManager:s,l10n:this.l10n,enableScripting:r,hasJSActionsPromise:l,fieldObjectsPromise:o,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager})}let o=null;this.renderingQueue&&(o=e=>{if(this.renderingQueue.isHighestPriority(this))e();else{this.renderingState=s.RenderingStates.PAUSED;this.resume=()=>{this.renderingState=s.RenderingStates.RUNNING;e()}}});const finishPaintTask=async(e=null)=>{l===this.paintTask&&(this.paintTask=null);if(e instanceof n.RenderingCancelledException)this._renderError=null;else{this._renderError=e;this.renderingState=s.RenderingStates.FINISHED;this._resetZoomLayer(!0);this.#nn.regularAnnotations=!l.separateAnnots;this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!1,timestamp:performance.now(),error:this._renderError});if(e)throw e}},l=this.renderer===s.RendererType.SVG?this.paintOnSvg(i):this.paintOnCanvas(i);l.onRenderContinue=o;this.paintTask=l;const h=l.promise.then((()=>finishPaintTask(null).then((async()=>{this.#hn();this.annotationLayer&&await this.#rn();if(!this.annotationEditorLayer){const{annotationEditorUIManager:i}=this.#Xi();if(!i)return;this.annotationEditorLayer=new r.AnnotationEditorLayerBuilder({uiManager:i,pageDiv:e,pdfPage:t,l10n:this.l10n,accessibilityManager:this._accessibilityManager})}this.#an()}))),(function(e){return finishPaintTask(e)}));if(t.isPureXfa){if(this.xfaLayer)this.xfaLayer.div&&e.append(this.xfaLayer.div);else{const{annotationStorage:i,linkService:n}=this.#Xi();this.xfaLayer=new f.XfaLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:i,linkService:n})}this.#on()}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(e=0){P.cancel(e)},get separateAnnots(){return P.separateAnnots}},r=this.viewport;let{width:a,height:o}=r;const l=document.createElement("canvas");l.setAttribute("role","presentation");l.hidden=!0;let h=!0;const showCanvas=function(){if(h){l.hidden=!1;h=!1}};e.append(l);this.canvas=l;const d=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0,alpha:!1}:{alpha:!1},p=l.getContext("2d",d),g=this.outputScale=new s.OutputScale;if(this.useOnlyCssZoom){const e=r.clone({scale:n.PixelsPerInch.PDF_TO_CSS_UNITS});g.sx*=e.width/a;g.sy*=e.height/o}if(this.maxCanvasPixels>0){const e=a*o,t=Math.sqrt(this.maxCanvasPixels/e);if(g.sx>t||g.sy>t){g.sx=t;g.sy=t;this.hasRestrictedScaling=!0}else this.hasRestrictedScaling=!1}const f=(0,s.approximateFraction)(g.sx),m=(0,s.approximateFraction)(g.sy);a=(0,s.roundToDivide)(a*g.sx,f[0]);o=(0,s.roundToDivide)(o*g.sy,m[0]);let b=1;if((a>=4096||o>=4096)&&(this.maxWidth||!c.default.test({width:a,height:o}))){const e=this.determineMaxDimensions();b=Math.max(a/e,o/e);if(b>1){const e=Math.floor(100*this.scale/b)/100;b=this.scale/e;r.width/=b;r.height/=b;(0,u.warn)(`Page ${this.id}: Reduced the maximum zoom to ${e} because the browser can't render larger canvases.`)}else b=1}l.width=(0,s.roundToDivide)(r.width*g.sx,f[0]);l.height=(0,s.roundToDivide)(r.height*g.sy,m[0]);const{style:v}=l;v.width=(0,s.roundToDivide)(r.width*b,f[1])+"px";v.height=(0,s.roundToDivide)(r.height*b,m[1])+"px";this.paintedViewportMap.set(l,r);const w=g.scaled?[g.sx,0,0,g.sy,0,0]:null;let _=PDFViewerApplicationOptions.get("pdfBackgroundColor");if("function"==typeof _){const e=_({pageNumber:this.id,pageLabel:this.pageLabel});e&&(_=e)}let y=_?PDFViewerApplicationOptions.get("pdfBackgroundColorToReplace"):null;if("function"==typeof y){const e=y({pageNumber:this.id,pageLabel:this.pageLabel});e&&(y=e)}const S={canvasContext:p,transform:w,viewport:r,annotationMode:this.#Ni,optionalContentConfigPromise:this._optionalContentConfigPromise,background:_,backgroundColorToReplace:y,annotationCanvasMap:this._annotationCanvasMap,pageColors:this.pageColors},P=this.pdfPage.render(S);P.onContinue=function(e){showCanvas();i.onRenderContinue?i.onRenderContinue(e):e()};P.promise.then((function(){showCanvas();t.resolve()}),(function(e){e instanceof n.RenderingCancelledException||showCanvas();t.reject(e)}));return i}paintOnSvg(e){let t=!1;const ensureNotCancelled=()=>{if(t)throw new n.RenderingCancelledException(`Rendering cancelled, page ${this.id}`,"svg")},i=this.pdfPage,r=this.viewport.clone({scale:n.PixelsPerInch.PDF_TO_CSS_UNITS});return{promise:i.getOperatorList({annotationMode:this.#Ni}).then((t=>{ensureNotCancelled();return new n.SVGGraphics(i.commonObjs,i.objs).getSVG(t,r).then((t=>{ensureNotCancelled();this.svg=t;this.paintedViewportMap.set(t,r);t.style.width=e.style.width;t.style.height=e.style.height;this.renderingState=s.RenderingStates.FINISHED;e.append(t)}))})),onRenderContinue(e){e()},cancel(){t=!0},get separateAnnots(){return!1}}}setPageLabel(e){this.pageLabel="string"==typeof e?e:null;null!==this.pageLabel?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}determineMaxDimensions(){if(this.maxWidth)return this.maxWidth;const e=[4096,8192,10836,11180,11402,14188,16384];for(const t of e)if(!c.default.test({width:t+1,height:t+1})){this.maxWidth=t;return this.maxWidth}return 16384}get thumbnailCanvas(){const{initialOptionalContent:e,regularAnnotations:t}=this.#nn;return e&&t?this.canvas:null}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.AnnotationEditorLayerBuilder=void 0;var n=i(4),s=i(32);t.AnnotationEditorLayerBuilder=class AnnotationEditorLayerBuilder{#Ce;constructor(e){this.pageDiv=e.pageDiv;this.pdfPage=e.pdfPage;this.accessibilityManager=e.accessibilityManager;this.l10n=e.l10n||s.NullL10n;this.annotationEditorLayer=null;this.div=null;this._cancelled=!1;this.#Ce=e.uiManager}async render(e,t="display"){if("display"!==t)return;if(this._cancelled)return;const i=e.clone({dontFlip:!0});if(this.div){this.annotationEditorLayer.update({viewport:i});this.show();return}const s=this.div=document.createElement("div");s.className="annotationEditorLayer";s.tabIndex=0;s.hidden=!0;this.pageDiv.append(s);this.annotationEditorLayer=new n.AnnotationEditorLayer({uiManager:this.#Ce,div:s,accessibilityManager:this.accessibilityManager,pageIndex:this.pdfPage.pageNumber-1,l10n:this.l10n,viewport:i});const r={viewport:i,div:s,annotations:null,intent:t};this.annotationEditorLayer.render(r);this.show()}cancel(){this._cancelled=!0;if(this.div){this.pageDiv=null;this.annotationEditorLayer.destroy();this.div.remove()}}hide(){this.div&&(this.div.hidden=!0)}show(){this.div&&!this.annotationEditorLayer.isEmpty&&(this.div.hidden=!1)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.AnnotationLayerBuilder=void 0;var n=i(4),s=i(32),r=i(3);t.AnnotationLayerBuilder=class AnnotationLayerBuilder{#cn=0;#un=null;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:d=null,fieldObjectsPromise:c=null,annotationCanvasMap:u=null,accessibilityManager:p=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=d||Promise.resolve(!1);this._fieldObjectsPromise=c||Promise.resolve(null);this._annotationCanvasMap=u;this._accessibilityManager=p;this.div=null;this._cancelled=!1;this._eventBus=i.eventBus}async render(e,t="display"){if(this.div){if(this._cancelled||0===this.#cn)return;n.AnnotationLayer.update({viewport:e.clone({dontFlip:!0}),div:this.div,annotationCanvasMap:this._annotationCanvasMap});return}const[i,s,a]=await Promise.all([this.pdfPage.getAnnotations({intent:t}),this._hasJSActionsPromise,this._fieldObjectsPromise]);if(!this._cancelled){this.#cn=i.length;this.div=document.createElement("div");this.div.className="annotationLayer";this.pageDiv.append(this.div);if(0!==this.#cn){n.AnnotationLayer.render({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:a,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager});this.l10n.translate(this.div);this.linkService.isInPresentationMode&&this.#pn(r.PresentationModeState.FULLSCREEN);if(!this.#un){this.#un=e=>{this.#pn(e.state)};this._eventBus?._on("presentationmodechanged",this.#un)}}else this.hide()}}cancel(){this._cancelled=!0;if(this.#un){this._eventBus?._off("presentationmodechanged",this.#un);this.#un=null}}hide(){this.div&&(this.div.hidden=!0)}#pn(e){if(!this.div)return;let t=!1;switch(e){case r.PresentationModeState.FULLSCREEN:t=!0;break;case r.PresentationModeState.NORMAL:break;default:return}for(const e of this.div.childNodes)e.hasAttribute("data-internal-link")||(e.inert=t)}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.StructTreeLayerBuilder=void 0;const i={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},n=/^H(\d+)$/;t.StructTreeLayerBuilder=class StructTreeLayerBuilder{#gn=void 0;get renderingDone(){return void 0!==this.#gn}render(e){if(void 0!==this.#gn)return this.#gn;const t=this.#fn(e);t?.classList.add("structTree");return this.#gn=t}hide(){this.#gn&&!this.#gn.hidden&&(this.#gn.hidden=!0)}show(){this.#gn?.hidden&&(this.#gn.hidden=!1)}#mn(e,t){void 0!==e.alt&&t.setAttribute("aria-label",e.alt);void 0!==e.id&&t.setAttribute("aria-owns",e.id);void 0!==e.lang&&t.setAttribute("lang",e.lang)}#fn(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.#mn(e,t);if(e.children)if(1===e.children.length&&"id"in e.children[0])this.#mn(e.children[0],t);else for(const i of e.children)t.append(this.#fn(i));return t}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.TextAccessibilityManager=void 0;var n=i(3);class TextAccessibilityManager{#bn=!1;#vn=null;#wn=new Map;#_n=new Map;setTextMapping(e){this.#vn=e}static#yn(e,t){const i=e.getBoundingClientRect(),n=t.getBoundingClientRect();if(0===i.width&&0===i.height)return 1;if(0===n.width&&0===n.height)return-1;const s=i.y,r=i.y+i.height,a=i.y+i.height/2,o=n.y,l=n.y+n.height,h=n.y+n.height/2;if(a<=o&&h>=r)return-1;if(h<=s&&a>=l)return 1;return i.x+i.width/2-(n.x+n.width/2)}enable(){if(this.#bn)throw new Error("TextAccessibilityManager is already enabled.");if(!this.#vn)throw new Error("Text divs and strings have not been set.");this.#bn=!0;this.#vn=this.#vn.slice();this.#vn.sort(TextAccessibilityManager.#yn);if(this.#wn.size>0){const e=this.#vn;for(const[t,i]of this.#wn){document.getElementById(t)?this.#Sn(t,e[i]):this.#wn.delete(t)}}for(const[e,t]of this.#_n)this.addPointerInTextLayer(e,t);this.#_n.clear()}disable(){if(this.#bn){this.#_n.clear();this.#vn=null;this.#bn=!1}}removePointerInTextLayer(e){if(!this.#bn){this.#_n.delete(e);return}const t=this.#vn;if(!t||0===t.length)return;const{id:i}=e,n=this.#wn.get(i);if(void 0===n)return;const s=t[n];this.#wn.delete(i);let r=s.getAttribute("aria-owns");if(r?.includes(i)){r=r.split(" ").filter((e=>e!==i)).join(" ");if(r)s.setAttribute("aria-owns",r);else{s.removeAttribute("aria-owns");s.setAttribute("role","presentation")}}}#Sn(e,t){const i=t.getAttribute("aria-owns");i?.includes(e)||t.setAttribute("aria-owns",i?`${i} ${e}`:e);t.removeAttribute("role")}addPointerInTextLayer(e,t){const{id:i}=e;if(!i)return;if(!this.#bn){this.#_n.set(e,t);return}t&&this.removePointerInTextLayer(e);const s=this.#vn;if(!s||0===s.length)return;const r=(0,n.binarySearchFirstItem)(s,(t=>TextAccessibilityManager.#yn(e,t)<0)),a=Math.max(0,r-1);this.#Sn(i,s[a]);this.#wn.set(i,a)}moveElementInDOM(e,t,i,s){this.addPointerInTextLayer(i,s);if(!e.hasChildNodes()){e.append(t);return}const r=Array.from(e.childNodes).filter((e=>e!==t));if(0===r.length)return;const a=i||t,o=(0,n.binarySearchFirstItem)(r,(e=>TextAccessibilityManager.#yn(a,e)<0));0===o?r[0].before(t):r[o-1].after(t)}}t.TextAccessibilityManager=TextAccessibilityManager},(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"),d=i.getContext("2d");if(d){d.fillRect.apply(d,a);h.drawImage(i,s-1,r-1,1,1,0,0,1,1)}var c=h&&0!==h.getImageData(0,0,1,1).data[3],u=Date.now()-o;if(l){postMessage({width:s,height:r,benchmark:u,isTestPass:c});!c&&e.sizes.length&&canvasTest(e)}else if(c)e.onSuccess(s,r,u);else{e.onError(s,r,u);e.sizes.length&&canvasTest(e)}return c}var i={area:[16384,14188,11402,11180,10836,8192,4096,1],height:[8388607,65535,32767,16384,8192,4096,1],width:[4194303,65535,32767,16384,8192,4096,1]},n=["onError","onSuccess"],s={max:null,min:1,sizes:[],step:1024,usePromise:!1,useWorker:!1,onError:Function.prototype,onSuccess:Function.prototype},r={};function createSizesArray(e){var t=e.width===e.height,i=1===e.height,n=1===e.width,r=[];if(e.width&&e.height)for(var a=e.min||s.min,o=e.step||s.step,l=Math.max(e.width,e.height);l>=a;){var h=t||i?l:1,d=t||n?l:1;r.push([h,d]);l-=o}else e.sizes.forEach((function(e){var s=t||i?e:1,a=t||n?e:1;r.push([s,a])}));return r}function handleMethod(e){var t=window&&"HTMLCanvasElement"in window,i=window&&"OffscreenCanvas"in window,s=Date.now(),a=e.onError,o=e.onSuccess,l=_objectWithoutProperties(e,n),h=null;if(!t)return!1;if(e.useWorker&&i){var d="\n var canvasTest = ".concat(canvasTest.toString(),";\n onmessage = function(e) {\n canvasTest(e.data);\n };\n "),c=new Blob([d],{type:"application/javascript"}),u=URL.createObjectURL(c);h=new Worker(u);URL.revokeObjectURL(u);h.onmessage=function(e){var t=e.data,i=t.width,n=t.height,a=t.benchmark;if(t.isTestPass){r[s].onSuccess(i,n,a);delete r[s]}else r[s].onError(i,n,a)}}if(e.usePromise)return new Promise((function(t,i){var n=_objectSpread2(_objectSpread2({},e),{},{onError:function onError(t,n,s){var r;if(0===e.sizes.length)r=!0;else{var o=_slicedToArray(e.sizes.slice(-1),1),l=_slicedToArray(o[0],2),h=l[0],d=l[1];r=t===h&&n===d}a(t,n,s);r&&i({width:t,height:n,benchmark:s})},onSuccess:function onSuccess(e,i,n){o(e,i,n);t({width:e,height:i,benchmark:n})}});if(h){var d=n.onError,c=n.onSuccess;r[s]={onError:d,onSuccess:c};h.postMessage(l)}else canvasTest(n)}));if(!h)return canvasTest(e);r[s]={onError:a,onSuccess:o};h.postMessage(l)}var a={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.area)});return handleMethod(_objectSpread2(_objectSpread2(_objectSpread2({},s),e),{},{sizes:t}))},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(i.height)});return handleMethod(_objectSpread2(_objectSpread2(_objectSpread2({},s),e),{},{sizes:t}))},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(i.width)});return handleMethod(_objectSpread2(_objectSpread2(_objectSpread2({},s),e),{},{sizes:t}))},test:function test(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=_objectSpread2(_objectSpread2({},s),e);t.sizes=_toConsumableArray(t.sizes);t.width&&t.height&&(t.sizes=[[t.width,t.height]]);return handleMethod(t)}};t.default=a},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.VerbosityLevel=t.Util=t.UnknownErrorException=t.UnexpectedResponseException=t.UNSUPPORTED_FEATURES=t.TextRenderingMode=t.RenderingIntentFlag=t.PermissionFlag=t.PasswordResponses=t.PasswordException=t.PageActionEventType=t.OPS=t.MissingPDFException=t.LINE_FACTOR=t.LINE_DESCENT_FACTOR=t.InvalidPDFException=t.ImageKind=t.IDENTITY_MATRIX=t.FormatError=t.FeatureTest=t.FONT_IDENTITY_MATRIX=t.DocumentActionEventType=t.CMapCompressionType=t.BaseException=t.BASELINE_FACTOR=t.AnnotationType=t.AnnotationStateModelType=t.AnnotationReviewState=t.AnnotationReplyType=t.AnnotationMode=t.AnnotationMarkedState=t.AnnotationFlag=t.AnnotationFieldFlag=t.AnnotationEditorType=t.AnnotationEditorPrefix=t.AnnotationEditorParamsType=t.AnnotationBorderStyleType=t.AnnotationActionEventType=t.AbortException=void 0;t.assert=function assert(e,t){e||unreachable(t)};t.bytesToString=function bytesToString(e){"object"==typeof e&&null!==e&&void 0!==e.length||unreachable("Invalid argument for bytesToString");const t=e.length,i=8192;if(t<i)return String.fromCharCode.apply(null,e);const n=[];for(let s=0;s<t;s+=i){const r=Math.min(s+i,t),a=e.subarray(s,r);n.push(String.fromCharCode.apply(null,a))}return n.join("")};t.createPromiseCapability=function createPromiseCapability(){const e=Object.create(null);let t=!1;Object.defineProperty(e,"settled",{get:()=>t});e.promise=new Promise((function(i,n){e.resolve=function(e){t=!0;i(e)};e.reject=function(e){t=!0;n(e)}}));return e};t.createValidAbsoluteUrl=function createValidAbsoluteUrl(e,t=null,i=null){if(!e)return null;try{if(i&&"string"==typeof e){if(i.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\./g);t&&t.length>=2&&(e=`http://${e}`)}if(i.tryConvertEncoding)try{e=stringToUTF8String(e)}catch(e){}}const n=t?new URL(e,t):new URL(e);if(function _isValidProtocol(e){if(!e)return!1;switch(e.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":case"capacitor":return!0;default:return!1}}(n))return n}catch(e){}return null};t.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 n};t.info=function info(e){n>=i.INFOS&&("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?console.log(`Info: ${e}`):Window&&Window.ngxConsole?Window.ngxConsole.log(`Info: ${e}`):console.log(`Info: ${e}`))};t.isArrayBuffer=function isArrayBuffer(e){return"object"==typeof e&&null!==e&&void 0!==e.byteLength};t.isArrayEqual=function isArrayEqual(e,t){if(e.length!==t.length)return!1;for(let i=0,n=e.length;i<n;i++)if(e[i]!==t[i])return!1;return!0};t.objectFromMap=function objectFromMap(e){const t=Object.create(null);for(const[i,n]of e)t[i]=n;return t};t.objectSize=function objectSize(e){return Object.keys(e).length};t.setVerbosityLevel=function setVerbosityLevel(e){Number.isInteger(e)&&(n=e)};t.shadow=shadow;t.string32=function string32(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)};t.stringToBytes=stringToBytes;t.stringToPDFString=function stringToPDFString(e){if(e[0]>="ï"){let t;"þ"===e[0]&&"ÿ"===e[1]?t="utf-16be":"ÿ"===e[0]&&"þ"===e[1]?t="utf-16le":"ï"===e[0]&&"»"===e[1]&&"¿"===e[2]&&(t="utf-8");if(t)try{const i=new TextDecoder(t,{fatal:!0}),n=stringToBytes(e);return i.decode(n)}catch(e){warn(`stringToPDFString: "${e}".`)}}const t=[];for(let i=0,n=e.length;i<n;i++){const n=a[e.charCodeAt(i)];t.push(n?String.fromCharCode(n):e.charAt(i))}return t.join("")};t.stringToUTF8String=stringToUTF8String;t.unreachable=unreachable;t.utf8StringToString=function utf8StringToString(e){return unescape(encodeURIComponent(e))};t.warn=warn;t.IDENTITY_MATRIX=[1,0,0,1,0,0];t.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0];t.LINE_FACTOR=1.35;t.LINE_DESCENT_FACTOR=.35;t.BASELINE_FACTOR=.25925925925925924;t.RenderingIntentFlag={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};t.AnnotationMode={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};t.AnnotationEditorPrefix="pdfjs_internal_editor_";t.AnnotationEditorType={DISABLE:-1,NONE:0,FREETEXT:3,INK:15};t.AnnotationEditorParamsType={FREETEXT_SIZE:1,FREETEXT_COLOR:2,FREETEXT_OPACITY:3,INK_COLOR:11,INK_THICKNESS:12,INK_OPACITY:13};t.PermissionFlag={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};t.TextRenderingMode={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4};t.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};t.AnnotationType={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26};t.AnnotationStateModelType={MARKED:"Marked",REVIEW:"Review"};t.AnnotationMarkedState={MARKED:"Marked",UNMARKED:"Unmarked"};t.AnnotationReviewState={ACCEPTED:"Accepted",REJECTED:"Rejected",CANCELLED:"Cancelled",COMPLETED:"Completed",NONE:"None"};t.AnnotationReplyType={GROUP:"Group",REPLY:"R"};t.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};t.AnnotationFieldFlag={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864};t.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};t.AnnotationActionEventType={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"};t.DocumentActionEventType={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};t.PageActionEventType={O:"PageOpen",C:"PageClose"};const i={ERRORS:0,WARNINGS:1,INFOS:5};t.VerbosityLevel=i;t.CMapCompressionType={NONE:0,BINARY:1};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,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91};t.UNSUPPORTED_FEATURES={forms:"forms",javaScript:"javaScript",signatures:"signatures",smask:"smask",shadingPattern:"shadingPattern",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 n=i.WARNINGS;function warn(e){n>=i.WARNINGS&&("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?console.log(`Warning: ${e}`):Window&&Window.ngxConsole?Window.ngxConsole.log(`Warning: ${e}`):console.log(`Warning: ${e}`))}function unreachable(e){throw new Error(e)}function shadow(e,t,i,n=!1){Object.defineProperty(e,t,{value:i,enumerable:!n,configurable:!0,writable:!1});return i}const s=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=s;t.PasswordException=class PasswordException extends s{constructor(e,t){super(e,"PasswordException");this.code=t}};t.UnknownErrorException=class UnknownErrorException extends s{constructor(e,t){super(e,"UnknownErrorException");this.details=t}};t.InvalidPDFException=class InvalidPDFException extends s{constructor(e){super(e,"InvalidPDFException")}};t.MissingPDFException=class MissingPDFException extends s{constructor(e){super(e,"MissingPDFException")}};t.UnexpectedResponseException=class UnexpectedResponseException extends s{constructor(e,t){super(e,"UnexpectedResponseException");this.status=t}};t.FormatError=class FormatError extends s{constructor(e){super(e,"FormatError")}};t.AbortException=class AbortException extends s{constructor(e){super(e,"AbortException")}};function stringToBytes(e){"string"!=typeof e&&unreachable("Invalid argument for stringToBytes");const t=e.length,i=new Uint8Array(t);for(let n=0;n<t;++n)i[n]=255&e.charCodeAt(n);return i}t.FeatureTest=class FeatureTest{static get isLittleEndian(){return shadow(this,"isLittleEndian",function isLittleEndian(){const e=new Uint8Array(4);e[0]=1;return 1===new Uint32Array(e.buffer,0,1)[0]}())}static get isEvalSupported(){return shadow(this,"isEvalSupported",function isEvalSupported(){try{new Function("");return!0}catch(e){return!1}}())}static get isOffscreenCanvasSupported(){return shadow(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get platform(){return"undefined"==typeof navigator?shadow(this,"platform",{isWin:!1,isMac:!1}):shadow(this,"platform",{isWin:navigator.platform.includes("Win"),isMac:navigator.platform.includes("Mac")})}};const r=[...Array(256).keys()].map((e=>e.toString(16).padStart(2,"0")));class Util{static makeHexColor(e,t,i){return`#${r[e]}${r[t]}${r[i]}`}static scaleMinMax(e,t){let i;if(e[0]){if(e[0]<0){i=t[0];t[0]=t[1];t[1]=i}t[0]*=e[0];t[1]*=e[0];if(e[3]<0){i=t[2];t[2]=t[3];t[3]=i}t[2]*=e[3];t[3]*=e[3]}else{i=t[0];t[0]=t[2];t[2]=i;i=t[1];t[1]=t[3];t[3]=i;if(e[1]<0){i=t[2];t[2]=t[3];t[3]=i}t[2]*=e[1];t[3]*=e[1];if(e[2]<0){i=t[0];t[0]=t[1];t[1]=i}t[0]*=e[2];t[1]*=e[2]}t[0]+=e[4];t[1]+=e[4];t[2]+=e[5];t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]}static applyInverseTransform(e,t){const i=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/i,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/i]}static getAxialAlignedBoundingBox(e,t){const i=Util.applyTransform(e,t),n=Util.applyTransform(e.slice(2,4),t),s=Util.applyTransform([e[0],e[3]],t),r=Util.applyTransform([e[2],e[1]],t);return[Math.min(i[0],n[0],s[0],r[0]),Math.min(i[1],n[1],s[1],r[1]),Math.max(i[0],n[0],s[0],r[0]),Math.max(i[1],n[1],s[1],r[1])]}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static 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){const i=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),n=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(i>n)return null;const s=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),r=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return s>r?null:[i,s,n,r]}static bezierBoundingBox(e,t,i,n,s,r,a,o){const l=[],h=[[],[]];let d,c,u,p,g,f,m,b;for(let h=0;h<2;++h){if(0===h){c=6*e-12*i+6*s;d=-3*e+9*i-9*s+3*a;u=3*i-3*e}else{c=6*t-12*n+6*r;d=-3*t+9*n-9*r+3*o;u=3*n-3*t}if(Math.abs(d)<1e-12){if(Math.abs(c)<1e-12)continue;p=-u/c;0<p&&p<1&&l.push(p)}else{m=c*c-4*u*d;b=Math.sqrt(m);if(!(m<0)){g=(-c+b)/(2*d);0<g&&g<1&&l.push(g);f=(-c-b)/(2*d);0<f&&f<1&&l.push(f)}}}let v,w=l.length;const _=w;for(;w--;){p=l[w];v=1-p;h[0][w]=v*v*v*e+3*v*v*p*i+3*v*p*p*s+p*p*p*a;h[1][w]=v*v*v*t+3*v*v*p*n+3*v*p*p*r+p*p*p*o}h[0][_]=e;h[1][_]=t;h[0][_+1]=a;h[1][_+1]=o;h[0].length=h[1].length=_+2;return[Math.min(...h[0]),Math.min(...h[1]),Math.max(...h[0]),Math.max(...h[1])]}}t.Util=Util;const a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function stringToUTF8String(e){return decodeURIComponent(escape(e))}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});t.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){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}this._updateMatches(!0)}}_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&&Window.ngxConsole.error("Could not find a matching mapping");const d={color:i?i[l]:0,begin:{divIdx:s,offset:h-r}};h+=t[l];for(;s!==a&&h>r+n[s].length;){r+=n[s].length;s++}d.end={divIdx:s,offset:h-r};o.push(d)}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.before(t);t.append(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.append(l);a.append(e);return r.includes("selected")?e.offsetLeft:0}a.append(l);return 0}let h=a,d=h+1;if(t.state.highlightAll){h=0;d=e.length}else if(!r)return;for(let n=h;n<d;n++){const h=e[n],d=h.begin,c=h.end,u=r&&n===a,p=(u?" selected":"")+" color"+h.color%5;let g=0;if(o&&d.divIdx===o.divIdx)appendTextToDiv(o.divIdx,o.offset,d.offset);else{null!==o&&appendTextToDiv(o.divIdx,o.offset,l.offset);beginText(d)}if(d.divIdx===c.divIdx)g=appendTextToDiv(d.divIdx,d.offset,c.offset,"highlight"+p);else{g=appendTextToDiv(d.divIdx,d.offset,l.offset,"highlight begin"+p);for(let e=d.divIdx+1,t=c.divIdx;e<t;e++)s[e].className="highlight middle"+p;beginText(c,"highlight end"+p)}o=c;u&&t.scrollMatchIntoView({element:s[d.divIdx],selectedLeft:g,pageIndex:i,matchIndex:a})}o&&appendTextToDiv(o.divIdx,o.offset,l.offset)}_updateMatches(e=!1){if(!this.enabled&&!e)return;const{findController:t,matches:i,pageIdx:n}=this,{textContentItemsStr:s,textDivs:r}=this;let a=-1;for(const e of i){for(let t=Math.max(a,e.begin.divIdx),i=e.end.divIdx;t<=i;t++){const e=r[t];e.textContent=s[t];e.className=""}a=e.end.divIdx+1}if(!t?.highlightMatches||e)return;const o=t.pageMatches[n]||null,l=t.pageMatchesLength[n]||null,h=t.pageMatchesColor[n]||null;this.matches=this._convertMatches(o,l,h);this._renderMatches(this.matches)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.TextLayerBuilder=void 0;var n=i(4);t.TextLayerBuilder=class TextLayerBuilder{#Pn=0;#An=0;#En=null;constructor({highlighter:e=null,accessibilityManager:t=null,isOffscreenCanvasSupported:i=!0}){this.textContentItemsStr=[];this.renderingDone=!1;this.textDivs=[];this.textDivProperties=new WeakMap;this.textLayerRenderTask=null;this.highlighter=e;this.accessibilityManager=t;this.isOffscreenCanvasSupported=i;this.div=document.createElement("div");this.div.className="textLayer";this.hide()}#Cn(){this.renderingDone=!0;const e=document.createElement("div");e.className="endOfContent";this.div.append(e);this.#xn()}get numTextDivs(){return this.textDivs.length}async render(e){if(!this.#En)throw new Error('No "textContentSource" parameter specified.');const t=e.scale*(globalThis.devicePixelRatio||1),{rotation:i}=e;if(this.renderingDone){const s=i!==this.#Pn,r=t!==this.#An;if(s||r){this.hide();(0,n.updateTextLayer)({container:this.div,viewport:e,textDivs:this.textDivs,textDivProperties:this.textDivProperties,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported,mustRescale:r,mustRotate:s});this.#An=t;this.#Pn=i}this.show()}else{this.cancel();this.highlighter?.setTextMapping(this.textDivs,this.textContentItemsStr);this.accessibilityManager?.setTextMapping(this.textDivs);this.textLayerRenderTask=(0,n.renderTextLayer)({textContentSource:this.#En,container:this.div,viewport:e,textDivs:this.textDivs,textDivProperties:this.textDivProperties,textContentItemsStr:this.textContentItemsStr,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported});await this.textLayerRenderTask.promise;this.#Cn();this.#An=t;this.#Pn=i;this.show();this.accessibilityManager?.enable()}}hide(){if(!this.div.hidden){this.highlighter?.disable();this.div.hidden=!0}}show(){if(this.div.hidden&&this.renderingDone){this.div.hidden=!1;this.highlighter?.enable()}}cancel(){if(this.textLayerRenderTask){this.textLayerRenderTask.cancel();this.textLayerRenderTask=null}this.highlighter?.disable();this.accessibilityManager?.disable();this.textContentItemsStr.length=0;this.textDivs.length=0;this.textDivProperties=new WeakMap}setTextContentSource(e){this.cancel();this.#En=e}#xn(){const{div:e}=this;e.addEventListener("mousedown",(t=>{const i=e.querySelector(".endOfContent");if(!i)return;let n=t.target!==e;n&&="none"!==getComputedStyle(i).getPropertyValue("-moz-user-select");if(n){const n=e.getBoundingClientRect(),s=Math.max(0,(t.pageY-n.top)/n.height);i.style.top=(100*s).toFixed(2)+"%"}i.classList.add("active")}));e.addEventListener("mouseup",(()=>{const t=e.querySelector(".endOfContent");if(t){t.style.top="";t.classList.remove("active")}}))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.XfaLayerBuilder=void 0;var n=i(4);t.XfaLayerBuilder=class XfaLayerBuilder{constructor({pageDiv:e,pdfPage:t,annotationStorage:i=null,linkService:n,xfaHtml:s=null}){this.pageDiv=e;this.pdfPage=t;this.annotationStorage=i;this.linkService=n;this.xfaHtml=s;this.div=null;this._cancelled=!1}async render(e,t="display"){if("print"===t){const i={viewport:e.clone({dontFlip:!0}),div:this.div,xfaHtml:this.xfaHtml,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t},s=document.createElement("div");this.pageDiv.append(s);i.div=s;return n.XfaLayer.render(i)}const i=await this.pdfPage.getXfa();if(this._cancelled||!i)return{textDivs:[]};const s={viewport:e.clone({dontFlip:!0}),div:this.div,xfaHtml:i,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t};if(this.div)return n.XfaLayer.update(s);this.div=document.createElement("div");this.pageDiv.append(this.div);s.div=this.div;return n.XfaLayer.render(s)}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.SecondaryToolbar=void 0;var n=i(3),s=i(31);t.SecondaryToolbar=class SecondaryToolbar{constructor(e,t,i){this.toolbar=e.toolbar;this.toggleButton=e.toggleButton;this.buttons=[{element:e.presentationModeButton,eventName:"presentationmode",close:!0},{element:e.printButton,eventName:"print",close:!0},{element:e.downloadButton,eventName:"download",close:!0},{element:e.viewBookmarkButton,eventName:null,close:!0},{element:e.firstPageButton,eventName:"firstpage",close:!0},{element:e.lastPageButton,eventName:"lastpage",close:!0},{element:e.pageRotateCwButton,eventName:"rotatecw",close:!1},{element:e.pageRotateCcwButton,eventName:"rotateccw",close:!1},{element:e.cursorSelectToolButton,eventName:"switchcursortool",eventDetails:{tool:n.CursorTool.SELECT},close:!0},{element:e.cursorHandToolButton,eventName:"switchcursortool",eventDetails:{tool:n.CursorTool.HAND},close:!0},{element:e.scrollPageButton,eventName:"switchscrollmode",eventDetails:{mode:n.ScrollMode.PAGE},close:!0},{element:e.scrollVerticalButton,eventName:"switchscrollmode",eventDetails:{mode:n.ScrollMode.VERTICAL},close:!0},{element:e.scrollHorizontalButton,eventName:"switchscrollmode",eventDetails:{mode:n.ScrollMode.HORIZONTAL},close:!0},{element:e.scrollWrappedButton,eventName:"switchscrollmode",eventDetails:{mode:n.ScrollMode.WRAPPED},close:!0},{element:e.spreadNoneButton,eventName:"switchspreadmode",eventDetails:{mode:n.SpreadMode.NONE},close:!0},{element:e.spreadOddButton,eventName:"switchspreadmode",eventDetails:{mode:n.SpreadMode.ODD},close:!0},{element:e.spreadEvenButton,eventName:"switchspreadmode",eventDetails:{mode:n.SpreadMode.EVEN},close:!0},{element:e.documentPropertiesButton,eventName:"documentproperties",close:!0}];this.buttons.push({element:e.openFileButton,eventName:"openfile",close:!0});this.items={firstPage:e.firstPageButton,lastPage:e.lastPageButton,pageRotateCw:e.pageRotateCwButton,pageRotateCcw:e.pageRotateCcwButton};this.eventBus=t;this.externalServices=i;this.opened=!1;this.#Tn();this.#Mn(e);this.#In(e);this.#Ln(e);this.reset()}get isOpen(){return this.opened}setPageNumber(e){this.pageNumber=e;this.#kn()}setPagesCount(e){this.pagesCount=e;this.#kn()}reset(){this.pageNumber=0;this.pagesCount=0;this.#kn();this.eventBus.dispatch("secondarytoolbarreset",{source:this})}#kn(){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})}#Tn(){this.toggleButton.addEventListener("click",this.toggle.bind(this));for(const{element:e,eventName:t,close:i,eventDetails:n}of this.buttons)e?.addEventListener("click",(s=>{if(null!==t){const e={source:this};for(const t in n)e[t]=n[t];this.eventBus.dispatch(t,e)}i&&this.close();this.externalServices.reportTelemetry({type:"buttons",data:{id:e.id}})}))}#Mn({cursorSelectToolButton:e,cursorHandToolButton:t}){this.eventBus._on("cursortoolchanged",(function({tool:i}){const s=i===n.CursorTool.SELECT,r=i===n.CursorTool.HAND;e.classList.toggle("toggled",s);t.classList.toggle("toggled",r);e.setAttribute("aria-checked",s);t.setAttribute("aria-checked",r)}))}#In({scrollPageButton:e,scrollVerticalButton:t,scrollHorizontalButton:i,scrollWrappedButton:r,spreadNoneButton:a,spreadOddButton:o,spreadEvenButton:l}){const scrollModeChanged=({mode:h})=>{const d=h===n.ScrollMode.PAGE,c=h===n.ScrollMode.VERTICAL,u=h===n.ScrollMode.HORIZONTAL,p=h===n.ScrollMode.WRAPPED;e.classList.toggle("toggled",d);t.classList.toggle("toggled",c);i.classList.toggle("toggled",u);r.classList.toggle("toggled",p);e.setAttribute("aria-checked",d);t.setAttribute("aria-checked",c);i.setAttribute("aria-checked",u);r.setAttribute("aria-checked",p);const g=this.pagesCount>s.PagesCountLimit.FORCE_SCROLL_MODE_PAGE;e.disabled=g;t.disabled=g;i.disabled=g;r.disabled=g;a.disabled=u;o.disabled=u;l.disabled=u};this.eventBus._on("scrollmodechanged",scrollModeChanged);this.eventBus._on("secondarytoolbarreset",(e=>{e.source===this&&scrollModeChanged({mode:n.ScrollMode.VERTICAL})}))}#Ln({spreadNoneButton:e,spreadOddButton:t,spreadEvenButton:i}){function spreadModeChanged({mode:s}){const r=s===n.SpreadMode.NONE,a=s===n.SpreadMode.ODD,o=s===n.SpreadMode.EVEN;e.classList.toggle("toggled",r);t.classList.toggle("toggled",a);i.classList.toggle("toggled",o);e.setAttribute("aria-checked",r);t.setAttribute("aria-checked",a);i.setAttribute("aria-checked",o)}this.eventBus._on("spreadmodechanged",spreadModeChanged);this.eventBus._on("secondarytoolbarreset",(e=>{e.source===this&&spreadModeChanged({mode:n.SpreadMode.NONE})}))}open(){if(!this.opened){this.opened=!0;this.toggleButton.classList.add("toggled");this.toggleButton.setAttribute("aria-expanded","true");this.toolbar.classList.remove("hidden")}}close(){if(this.opened){this.opened=!1;this.toolbar.classList.add("hidden");this.toggleButton.classList.remove("toggled");this.toggleButton.setAttribute("aria-expanded","false")}}toggle(){this.opened?this.close():this.open()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.Toolbar=void 0;var n=i(3),s=i(4);t.Toolbar=class Toolbar{#Dn=!1;constructor(e,t,i){this.toolbar=e.container;this.eventBus=t;this.l10n=i;this.buttons=[{element:e.previous,eventName:"previouspage"},{element:e.next,eventName:"nextpage"},{element:e.zoomIn,eventName:"zoomin"},{element:e.zoomOut,eventName:"zoomout"},{element:e.print,eventName:"print"},{element:e.download,eventName:"download"},{element:e.editorFreeTextButton,eventName:"switchannotationeditormode",eventDetails:{get mode(){const{classList:t}=e.editorFreeTextButton;return t.contains("toggled")?s.AnnotationEditorType.NONE:s.AnnotationEditorType.FREETEXT}}},{element:e.editorInkButton,eventName:"switchannotationeditormode",eventDetails:{get mode(){const{classList:t}=e.editorInkButton;return t.contains("toggled")?s.AnnotationEditorType.NONE:s.AnnotationEditorType.INK}}}];this.buttons.push({element:e.openFile,eventName:"openfile"});this.items={numPages:e.numPages,pageNumber:e.pageNumber,scaleSelect:e.scaleSelect,customScaleOption:e.customScaleOption,previous:e.previous,next:e.next,zoomIn:e.zoomIn,zoomOut:e.zoomOut};this.#Nt(e);this.reset()}setPageNumber(e,t){this.pageNumber=e;this.pageLabel=t;this.#kn(!1)}setPagesCount(e,t){this.pagesCount=e;this.hasPageLabels=t;this.#kn(!0)}setPageScale(e,t){this.pageScaleValue=(e||t).toString();this.pageScale=t;this.#kn(!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.#kn(!0);this.updateLoadingIndicatorState();this.eventBus.dispatch("toolbarreset",{source:this})}#Nt(e){const{pageNumber:t,scaleSelect:i}=this.items,s=this;for(const{element:e,eventName:t,eventDetails:i}of this.buttons)e?.addEventListener("click",(e=>{if(null!==t){const e={source:this};if(i)for(const t in i)e[t]=i[t];this.eventBus.dispatch(t,e)}}));t.addEventListener("click",(function(){this.select()}));t.addEventListener("change",(function(){s.eventBus.dispatch("pagenumberchanged",{source:s,value:this.value})}));i.addEventListener("change",(function(){"custom"!==this.value&&s.eventBus.dispatch("scalechanged",{source:s,value:this.value})}));i.addEventListener("click",(function(e){const t=e.target;this.value===s.pageScaleValue&&"OPTION"===t.tagName.toUpperCase()&&this.blur()}));i.oncontextmenu=n.noContextMenuHandler;this.eventBus._on("localized",(()=>{this.#Dn=!0;this.#Rn();this.#kn(!0)}));this.#Fn(e)}#Fn({editorFreeTextButton:e,editorFreeTextParamsToolbar:t,editorInkButton:i,editorInkParamsToolbar:n}){const editorModeChanged=(r,a=!1)=>{const o=[{mode:s.AnnotationEditorType.FREETEXT,button:e,toolbar:t},{mode:s.AnnotationEditorType.INK,button:i,toolbar:n}];for(const{mode:e,button:t,toolbar:i}of o){const n=e===r.mode;t.classList.toggle("toggled",n);t.setAttribute("aria-checked",n);t.disabled=a;i?.classList.toggle("hidden",!n)}};this.eventBus._on("annotationeditormodechanged",editorModeChanged);this.eventBus._on("toolbarreset",(e=>{e.source===this&&editorModeChanged({mode:s.AnnotationEditorType.NONE},!0)}))}#kn(e=!1){if(!this.#Dn)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;if(a.scaleSelect.options)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){const{pageNumber:t}=this.items;t.classList.toggle("visiblePageIsLoading",e)}async#Rn(){const{items:e,l10n:t}=this,i=Promise.all([t.get("page_scale_auto"),t.get("page_scale_actual"),t.get("page_scale_fit"),t.get("page_scale_width")]);await n.animationStarted;const s=getComputedStyle(e.scaleSelect),r=parseFloat(s.getPropertyValue("--scale-select-width")),a=document.createElement("canvas"),o=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0,alpha:!1}:{alpha:!1},l=a.getContext("2d",o);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+=.3*r;if(h>r){e.scaleSelect.parentNode.style.setProperty("--scale-select-width",`${h}px`)}a.width=0;a.height=0}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.ViewHistory=void 0;var n=i(5);t.ViewHistory=class ViewHistory{constructor(e,t=20){this.fingerprint=e;this.cacheSize=t;this._initializedPromise=this._readFromStorage().then((e=>{const t=JSON.parse(e||"{}");let i=-1;if(Array.isArray(t.files)){for(;t.files.length>=this.cacheSize;)t.files.shift();for(let e=0,n=t.files.length;e<n;e++){if(t.files[e].fingerprint===this.fingerprint){i=e;break}}}else t.files=[];-1===i&&(i=t.files.push({fingerprint:this.fingerprint})-1);this.file=t.files[i];this.database=t}))}async _writeToStorage(){if(n.AppOptions.get("disableHistory"))return;const e=JSON.stringify(this.database);try{localStorage.setItem("pdfjs.history",e)}catch(e){}}async _readFromStorage(){if(!n.AppOptions.get("disableHistory"))try{return localStorage.getItem("pdfjs.history")}catch(e){return}}async set(e,t){await this._initializedPromise;this.file[e]=t;return this._writeToStorage()}async setMultiple(e){await this._initializedPromise;for(const t in e)this.file[t]=e[t];return this._writeToStorage()}async get(e,t){await this._initializedPromise;const i=this.file[e];return void 0!==i?i:t}async getMultiple(e){await this._initializedPromise;const t=Object.create(null);for(const i in e){const n=this.file[i];t[i]=void 0!==n?n:e[i]}return t}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.BasePreferences=void 0;i(5);class BasePreferences{#On=Object.freeze({annotationEditorMode:0,annotationMode:2,cursorToolOnLoad:0,defaultZoomDelay:400,defaultZoomValue:"",disablePageLabels:!1,enablePermissions:!1,enablePrintAutoRotate:!0,enableScripting:!0,externalLinkTarget:0,historyUpdateUrl:!1,ignoreDestinationZoom:!1,forcePageColors:!1,pageColorsBackground:"Canvas",pageColorsForeground:"CanvasText",pdfBugEnabled:!1,removePageBorders:!1,sidebarViewOnLoad:-1,scrollModeOnLoad:-1,spreadModeOnLoad:-1,textLayerMode:1,useOnlyCssZoom:!1,viewerCssTheme:0,viewOnLoad:0,disableAutoFetch:!1,disableFontFace:!1,disableRange:!1,disableStream:!1,enableXfa:!0,renderer:"canvas"});#Nn=Object.create(null);#Bn=null;constructor(){if(this.constructor===BasePreferences)throw new Error("Cannot initialize BasePreferences.");this.#Bn=this._readFromStorage(this.#On).then((e=>{for(const t in this.#On){const i=e?.[t];typeof i==typeof this.#On[t]&&(this.#Nn[t]=i)}}))}async _writeToStorage(e){throw new Error("Not implemented: _writeToStorage")}async _readFromStorage(e){throw new Error("Not implemented: _readFromStorage")}async reset(){await this.#Bn;const e=this.#Nn;this.#Nn=Object.create(null);return this._writeToStorage(this.#On).catch((t=>{this.#Nn=e;throw t}))}async set(e,t){await this.#Bn;const i=this.#On[e],n=this.#Nn;if(void 0===i)throw new Error(`Set preference: "${e}" is undefined.`);if(void 0===t)throw new Error("Set preference: no value is specified.");const s=typeof t,r=typeof i;if(s!==r){if("number"!==s||"string"!==r)throw new Error(`Set preference: "${t}" is a ${s}, expected a ${r}.`);t=t.toString()}else if("number"===s&&!Number.isInteger(t))throw new Error(`Set preference: "${t}" must be an integer.`);this.#Nn[e]=t;return this._writeToStorage(this.#Nn).catch((e=>{this.#Nn=n;throw e}))}async get(e){await this.#Bn;const t=this.#On[e];if(void 0===t)throw new Error(`Get preference: "${e}" is undefined.`);return this.#Nn[e]??t}async getAll(){await this.#Bn;const e=Object.create(null);for(const t in this.#On)e[t]=this.#Nn[t]??this.#On[t];return e}}t.BasePreferences=BasePreferences},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.DownloadManager=void 0;var n=i(4);function download(e,t){const i=document.createElement("a");if(!i.click)throw new Error('DownloadManager: "a.click()" is not supported.');i.href=e;i.target="_parent";"download"in i&&(i.download=t);(document.body||document.documentElement).append(i);i.click();i.remove()}t.DownloadManager=class DownloadManager{#Vn=new WeakMap;downloadUrl(e,t){(0,n.createValidAbsoluteUrl)(e,"http://example.com")?download(e+"#pdfjs.action=download",t):Window.ngxConsole.error(`downloadUrl - not a valid URL: ${e}`)}downloadData(e,t,i){download(URL.createObjectURL(new Blob([e],{type:i})),t)}openOrDownloadData(e,t,i){const s=(0,n.isPdfFile)(i),r=s?"application/pdf":"";if(s){let i=this.#Vn.get(e);if(!i){i=URL.createObjectURL(new Blob([t],{type:r}));this.#Vn.set(e,i)}try{window.open(i);return!0}catch(t){Window.ngxConsole.error(`openOrDownloadData: ${t}`);URL.revokeObjectURL(i);this.#Vn.delete(e)}}this.downloadData(t,i,r);return!1}download(e,t,i){download(URL.createObjectURL(e),i)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.GenericL10n=void 0;i(50);var n=i(32);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",h=!0;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,h);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,a,o,l){var h=t.replace(/[^\/]*$/,"")||"./";function evalString(e){return e.lastIndexOf("\\")<0?e:e.replace(/\\\\/g,"\\").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\t/g,"\t").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/\\"/g,'"').replace(/\\'/g,"'")}xhrLoadText(t,(function(t){s+=t;!function parseProperties(t,n){var s={},r=/^\s*|\s*$/,o=/^\s*#|^\s*$/,l=/^\s*\[(.*)\]\s*$/,d=/^\s*@import\s+url\((.*)\)\s*$/i,c=/^([^=\s]*)\s*=\s*(.+)$/;function parseRawLines(e,t,n){var u=e.replace(r,"").split(/[\r\n]+/),p="*",g=a.split("-",1)[0],f=!1,m="",b=!1;!function nextEntry(){for(var e=i;;){if(!u.length&&e){b?nextEntry():loadImport(e,nextEntry);return}if(!u.length){n();return}var r=u.shift();if(!o.test(r)){if(t){if(m=l.exec(r)){p=m[1].toLowerCase();f="*"!==p&&p!==a&&p!==g;continue}if(f)continue;if(m=d.exec(r)){if("*"===p||p===a){loadImport(h+m[1],nextEntry);b=!0;return}e=h+m[1]}}var v=r.match(c);v&&3==v.length&&(s[v[1]]=evalString(v[2]))}}}()}function loadImport(t,i){xhrLoadText(t,(function(e){parseRawLines(e,!1,i)}),(function(){const n=e.PDFViewerApplicationOptions;(!n||n.get("verbosity")>0)&&Window.ngxConsole.warn(t+" not found.");i()}))}parseRawLines(t,!0,(function(){n(s)}))}(t,(function(e){for(var t in e){var i,s,a=t.lastIndexOf(".");if(a>0){i=t.substring(0,a);s=t.substring(a+1)}else{i=t;s=r}n[i]||(n[i]={});n[i][s]=e[t]}o&&o()}))}),l)}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"]')}(),d=h.length;if(0!==d){var c,u=0;c=function(){if(++u>=d){r();fireL10nReadyEvent(i);l="complete"}};for(var p=0;p<d;p++){new L10nResourceLink(h[p]).load(i,c)}}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){Window.ngxConsole.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 Window.ngxConsole.log("Could not load the translation files for the PDF viewer. Check the flag useBrowserLocale, check the locales subfolder of the assets folder, or add the locale definition to the index.html");fireL10nReadyEvent(i);l="complete"}function L10nResourceLink(t){var i=t.href;this.load=function(t,n){parseResource(i,t,n,(function(){const s=e.PDFViewerApplicationOptions;if(!s||s.get("verbosity")>0){Window.ngxConsole.warn(i+" not found.");Window.ngxConsole.warn('"'+t+'" resource not found')}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)&&Window.ngxConsole.warn("plural form unknown for ["+t+"]");return function(){return"other"}}return i[n]}(a));var d="["+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+d in n?t=n[s+d][l]:s+"[other]"in n&&(t=n[s+"[other]"][l]);return t};function getL10nData(t,i,s){var r=n[t];if(!r){const i=e.PDFViewerApplicationOptions;(!i||i.get("verbosity")>0)&&Window.ngxConsole.warn("Translation for the key #"+t+" is missing.");if(!s)return null;r=s}var 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];Window.ngxConsole.log("argument {{"+s+"}} for #"+i+" is undefined.");return e}))}function translateElement(i){var n=function getL10nAttributes(t){if(!t)return{};var i=t.getAttribute("data-l10n-id"),n=t.getAttribute("data-l10n-args"),s={};if(n)try{s=JSON.parse(n)}catch(t){const n=e.PDFViewerApplicationOptions;(!n||n.get("verbosity")>0)&&Window.ngxConsole.warn("could not parse arguments for #"+i)}return{id:i,args:s}}(i);if(n.id){var s=getL10nData(n.id,n.args);if(s){if(s[r]){if(0===function getChildElementCount(e){if(e.children)return e.children.length;if(void 0!==e.childElementCount)return e.childElementCount;for(var t=0,i=0;i<e.childNodes.length;i++)t+=1===e.nodeType?1:0;return t}(i))i[r]=s[r];else{for(var 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 d=t.createTextNode(s[r]);i.prepend(d)}}delete s[r]}for(var c in s)i[c]=s[c]}else{const t=e.PDFViewerApplicationOptions;(!t||t.get("verbosity")>0)&&Window.ngxConsole.warn("#"+n.id+" is undefined.")}}}return{get:function(e,t,i){var n,s=e.lastIndexOf("."),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.GenericScripting=void 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:""}};var n=i(4);t.GenericScripting=class GenericScripting{constructor(e){this._ready=(0,n.loadScript)(e,!0).then((()=>window.pdfjsSandbox.QuickJSSandbox()))}async createSandbox(e){(await this._ready).create(e)}async dispatchEventInSandbox(e){const t=await this._ready;setTimeout((()=>t.dispatchEvent(e)),0)}async destroySandbox(){(await this._ready).nukeSandbox()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.PDFPrintService=PDFPrintService;var n=i(4),s=i(2),r=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(i(39)),a=i(53),o=i(40);let l=null,h=null,d=null;function renderPage(e,t,i,s,a,h,d){const c=l.scratchCanvas;let u=a/n.PixelsPerInch.PDF,p=1;const g=Math.floor(s.width*u),f=Math.floor(s.height*u);if(g>=4096||f>=4096){if(!r.default.test({width:g,height:f})){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}();p=.95*Math.min(e/g,e/f)}(0,o.warn)("Page "+i+": Reduced the [printResolution] to "+Math.floor(a*p)+" because the browser can't render larger canvases. If you see blank page in the print preview, reduce [printResolution] manually to a lower value.")}u*=p;c.width=Math.floor(s.width*u);c.height=Math.floor(s.height*u);const m=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0}:void 0,b=c.getContext("2d",m);b.save();b.fillStyle="rgb(255, 255, 255)";b.fillRect(0,0,c.width,c.height);b.restore();return Promise.all([t.getPage(i),d]).then((function([e,t]){const i={canvasContext:b,transform:[u,0,0,u,0,0],viewport:e.getViewport({scale:1,rotation:s.rotation}),intent:"print",annotationMode:n.AnnotationMode.ENABLE_STORAGE,optionalContentConfigPromise:h,background:PDFViewerApplicationOptions.get("pdfBackgroundColor"),printAnnotationStorage:t};return e.render(i).promise}))}function PDFPrintService(e,t,i,n,s=null,r=null,a,o){this.pdfDocument=e;this.pagesOverview=t;this.printContainer=i;this._printResolution=n||150;this._optionalContentConfigPromise=s||e.getOptionalContentConfig();this._printAnnotationStoragePromise=r||Promise.resolve();this.l10n=a;this.currentPage=-1;this.scratchCanvas=document.createElement("canvas");this.eventBus=o}PDFPrintService.prototype={layout(){this.throwIfInactive();const e=document.querySelector("body");e.setAttribute("data-pdfjsprinting",!0);document.querySelector("html").setAttribute("data-pdfjsprinting",!0);this.pagesOverview.every((function(e){return e.width===this.pagesOverview[0].width&&e.height===this.pagesOverview[0].height}),this)||Window.ngxConsole.warn("Not all pages have the same size. The printed result may be incorrect!");this.pageStyleSheet=document.createElement("style");const t=this.pagesOverview[0];this.pageStyleSheet.textContent="@page { size: "+t.width+"pt "+t.height+"pt;}";e.append(this.pageStyleSheet)},destroy(){if(l!==this)return;this.printContainer.textContent="";document.querySelector("body").removeAttribute("data-pdfjsprinting");document.querySelector("html").removeAttribute("data-pdfjsprinting");if(this.pageStyleSheet){this.pageStyleSheet.remove();this.pageStyleSheet=null}this.scratchCanvas.width=this.scratchCanvas.height=0;this.scratchCanvas=null;l=null;ensureOverlay().then((function(){if(d.active===h){d.close(h);d.unregister(h)}}));u=void 0},renderPages(){if(this.pdfDocument.isPureXfa){(0,a.getXfaHtmlForPrinting)(this.printContainer,this.pdfDocument);return Promise.resolve()}const e=this.pagesOverview.length,renderNextPage=(t,i)=>{this.throwIfInactive();for(;;){++this.currentPage;if(this.currentPage>=e)break;if(!window.isInPDFPrintRange||window.isInPDFPrintRange(this.currentPage))break}if(this.currentPage>=e){renderProgress(window.filteredPageCount|e,window.filteredPageCount|e,this.l10n,this.eventBus);t();return}const n=this.currentPage;renderProgress(n,window.filteredPageCount|e,this.l10n,this.eventBus);renderPage(0,this.pdfDocument,n+1,this.pagesOverview[n],this._printResolution,this._optionalContentConfigPromise,this._printAnnotationStoragePromise).then(this.useRenderedPage.bind(this)).then((function(){renderNextPage(t,i)}),i)};return new Promise(renderNextPage)},useRenderedPage(){this.throwIfInactive();const e=document.createElement("img"),t=this.scratchCanvas;"toBlob"in t?t.toBlob((function(t){e.src=URL.createObjectURL(t)})):e.src=t.toDataURL();const i=document.createElement("div");i.className="printedPage";i.append(e);this.printContainer.append(i);return new Promise((function(t,i){e.onload=t;e.onerror=i}))},performPrint(){this.throwIfInactive();return new Promise((e=>{setTimeout((()=>{if(!this.active){e();return}c.call(window);const t=navigator.platform&&["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document;setTimeout(e,t?1500:20)}),0)}))},get active(){return this===l},throwIfInactive(){if(!this.active)throw new Error("This print request was cancelled or completed.")}};const c=window.print;window.printPDF=function printPdf(){if(s.PDFViewerApplication.enablePrint)if(l)Window.ngxConsole.warn("Ignored window.printPDF() because of a pending print job.");else{ensureOverlay().then((function(){l&&d.open(h)}));try{dispatchEvent("beforeprint")}finally{if(!l){Window.ngxConsole.error("Expected print service to be initialized.");ensureOverlay().then((function(){d.active===h&&d.close(h)}));return}const e=l;l.renderPages().then((function(){const t=document.getElementById("printServiceDialog");t&&t.classList.add("hidden");return e.performPrint()})).catch((function(){})).then((function(){e.active&&abort()}))}}};function dispatchEvent(e){const t=document.createEvent("CustomEvent");t.initCustomEvent(e,!1,!1,"custom");window.dispatchEvent(t)}function abort(){if(l){l.destroy();dispatchEvent("afterprint")}}function renderProgress(e,t,i,n){h=document.getElementById("printServiceDialog");const s=Math.round(100*e/t),r=h.querySelector("progress"),a=h.querySelector(".relative-progress");r.value=s;i.get("print_progress_percent",{progress:s}).then((e=>{a.textContent=e}));n.dispatch("progress",{source:this,type:"print",total:t,page:e,percent:100*e/t})}window.addEventListener("keydown",(function(e){if(80===e.keyCode&&(e.ctrlKey||e.metaKey)&&!e.altKey&&(!e.shiftKey||window.chrome||window.opera)){window.print();e.preventDefault();e.stopImmediatePropagation()}}),!0);if("onbeforeprint"in window){const stopPropagationIfNeeded=function(e){"custom"!==e.detail&&e.stopImmediatePropagation()};window.addEventListener("beforeprint",stopPropagationIfNeeded);window.addEventListener("afterprint",stopPropagationIfNeeded)}let u;function ensureOverlay(){if(!u){d=s.PDFViewerApplication.overlayManager;if(!d)throw new Error("The overlay manager has not yet been initialized.");h=document.getElementById("printServiceDialog");u=d.register(h,!0);document.getElementById("printCancel").onclick=abort;h.addEventListener("close",abort)}return u}s.PDFPrintServiceFactory.instance={supportsPrinting:!0,createPrintService(e,t,i,n,s,r,a,o){if(l)throw new Error("The print service is created and active.");l=new PDFPrintService(e,t,i,n,s,r,a,o);return l}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0});t.getXfaHtmlForPrinting=function getXfaHtmlForPrinting(e,t){const i=t.allXfaHtml,a=new s.SimpleLinkService,o=Math.round(100*n.PixelsPerInch.PDF_TO_CSS_UNITS)/100;for(const s of i.children){const i=document.createElement("div");i.className="xfaPrintedPage";e.append(i);const l=new r.XfaLayerBuilder({pageDiv:i,pdfPage:null,annotationStorage:t.annotationStorage,linkService:a,xfaHtml:s}),h=(0,n.getXfaPageViewport)(s,{scale:o});l.render(h,"print")}};var n=i(4),s=i(7),r=i(43)}],t={};function __webpack_require__(i){var n=t[i];if(void 0!==n)return n.exports;var s=t[i]={exports:{}};e[i](s,s.exports,__webpack_require__);return s.exports}var i={};(()=>{var e=i;Object.defineProperty(e,"__esModule",{value:!0});Object.defineProperty(e,"PDFViewerApplication",{enumerable:!0,get:function(){return r.PDFViewerApplication}});e.PDFViewerApplicationConstants=void 0;Object.defineProperty(e,"PDFViewerApplicationOptions",{enumerable:!0,get:function(){return n.AppOptions}});__webpack_require__(1);__webpack_require__(52);var t=__webpack_require__(3),n=__webpack_require__(5),s=__webpack_require__(7),r=__webpack_require__(2);const a={LinkTarget:s.LinkTarget,RenderingStates:t.RenderingStates,ScrollMode:t.ScrollMode,SpreadMode:t.SpreadMode};e.PDFViewerApplicationConstants=a;window.PDFViewerApplication=r.PDFViewerApplication;window.PDFViewerApplicationConstants=a;window.PDFViewerApplicationOptions=n.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});document.blockUnblockOnload?.(!0);window.webViewerLoad=function webViewerLoad(){const e=function getViewerConfiguration(){return{appContainer:document.body,mainContainer:document.getElementById("viewerContainer"),viewerContainer:document.getElementById("viewer"),toolbar:{container:document.getElementById("toolbarViewer"),numPages:document.getElementById("numPages"),pageNumber:document.getElementById("pageNumber"),scaleSelect:document.getElementById("scaleSelect"),customScaleOption:document.getElementById("customScaleOption"),previous:document.getElementById("previous"),next:document.getElementById("next"),zoomIn:document.getElementById("zoomIn"),zoomOut:document.getElementById("zoomOut"),viewFind:document.getElementById("viewFind"),openFile:document.getElementById("openFile"),print:document.getElementById("print"),editorFreeTextButton:document.getElementById("editorFreeText"),editorFreeTextParamsToolbar:document.getElementById("editorFreeTextParamsToolbar"),editorInkButton:document.getElementById("editorInk"),editorInkParamsToolbar:document.getElementById("editorInkParamsToolbar"),download:document.getElementById("download")},secondaryToolbar:{toolbar:document.getElementById("secondaryToolbar"),toggleButton:document.getElementById("secondaryToolbarToggle"),presentationModeButton:document.getElementById("presentationMode"),openFileButton:document.getElementById("secondaryOpenFile"),printButton:document.getElementById("secondaryPrint"),downloadButton:document.getElementById("secondaryDownload"),viewBookmarkButton:document.getElementById("viewBookmark"),firstPageButton:document.getElementById("firstPage"),lastPageButton:document.getElementById("lastPage"),pageRotateCwButton:document.getElementById("pageRotateCw"),pageRotateCcwButton:document.getElementById("pageRotateCcw"),cursorSelectToolButton:document.getElementById("cursorSelectTool"),cursorHandToolButton:document.getElementById("cursorHandTool"),scrollPageButton:document.getElementById("scrollPage"),scrollVerticalButton:document.getElementById("scrollVertical"),scrollHorizontalButton:document.getElementById("scrollHorizontal"),scrollWrappedButton:document.getElementById("scrollWrapped"),spreadNoneButton:document.getElementById("spreadNone"),spreadOddButton:document.getElementById("spreadOdd"),spreadEvenButton:document.getElementById("spreadEven"),documentPropertiesButton:document.getElementById("documentProperties")},sidebar:{outerContainer:document.getElementById("outerContainer"),sidebarContainer:document.getElementById("sidebarContainer"),toggleButton:document.getElementById("sidebarToggle"),thumbnailButton:document.getElementById("viewThumbnail"),outlineButton:document.getElementById("viewOutline"),attachmentsButton:document.getElementById("viewAttachments"),layersButton:document.getElementById("viewLayers"),thumbnailView:document.getElementById("thumbnailView"),outlineView:document.getElementById("outlineView"),attachmentsView:document.getElementById("attachmentsView"),layersView:document.getElementById("layersView"),outlineOptionsContainer:document.getElementById("outlineOptionsContainer"),currentOutlineItemButton:document.getElementById("currentOutlineItem")},sidebarResizer:{outerContainer:document.getElementById("outerContainer"),resizer:document.getElementById("sidebarResizer")},findBar:{bar:document.getElementById("findbar"),toggleButton:document.getElementById("viewFind"),findField:document.getElementById("findInput"),findFieldMultiline:document.getElementById("findInputMultiline"),highlightAllCheckbox:document.getElementById("findHighlightAll"),findCurrentPageCheckbox:document.getElementById("findCurrentPage"),findPageRangeField:document.getElementById("findRange"),caseSensitiveCheckbox:document.getElementById("findMatchCase"),matchDiacriticsCheckbox:document.getElementById("findMatchDiacritics"),entireWordCheckbox:document.getElementById("findEntireWord"),findMultipleSearchTextsCheckbox:document.getElementById("findMultipleSearchTexts"),ignoreAccentsCheckbox:document.getElementById("findIgnoreAccents"),fuzzyCheckbox:document.getElementById("findFuzzy"),findMsg:document.getElementById("findMsg"),findResultsCount:document.getElementById("findResultsCount"),findPreviousButton:document.getElementById("findPrevious"),findNextButton:document.getElementById("findNext")},passwordOverlay:{dialog:document.getElementById("passwordDialog"),label:document.getElementById("passwordText"),input:document.getElementById("password"),submitButton:document.getElementById("passwordSubmit"),cancelButton:document.getElementById("passwordCancel")},documentProperties:{dialog:document.getElementById("documentPropertiesDialog"),closeButton:document.getElementById("documentPropertiesClose"),fields:{fileName:document.getElementById("fileNameField"),fileSize:document.getElementById("fileSizeField"),title:document.getElementById("titleField"),author:document.getElementById("authorField"),subject:document.getElementById("subjectField"),keywords:document.getElementById("keywordsField"),creationDate:document.getElementById("creationDateField"),modificationDate:document.getElementById("modificationDateField"),creator:document.getElementById("creatorField"),producer:document.getElementById("producerField"),version:document.getElementById("versionField"),pageCount:document.getElementById("pageCountField"),pageSize:document.getElementById("pageSizeField"),linearized:document.getElementById("linearizedField")}},annotationEditorParams:{editorFreeTextFontSize:document.getElementById("editorFreeTextFontSize"),editorFreeTextColor:document.getElementById("editorFreeTextColor"),editorInkColor:document.getElementById("editorInkColor"),editorInkThickness:document.getElementById("editorInkThickness"),editorInkOpacity:document.getElementById("editorInkOpacity")},printContainer:document.getElementById("printContainer"),openFileInput:document.getElementById("fileInput"),debuggerScriptPath:"./debugger.js"}}(),t=document.createEvent("CustomEvent");t.initCustomEvent("webviewerloaded",!0,!0,{source:window});try{parent.document.dispatchEvent(t)}catch(e){console.error(`webviewerloaded: ${e}`);document.dispatchEvent(t)}r.PDFViewerApplication.run(e)}})()})();
45});