ngx-extended-pdf-viewer
Version:
Embedding PDF files in your Angular application. Highly configurable viewer including the toolbar, sidebar, and all the features you're used to.
46 lines • 713 kB
JavaScript
window.ngxZone.runOutsideAngular(() => {
/**
* @licstart The following is the entire license notice for the
* JavaScript code in this page
*
* Copyright 2023 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @licend The above is the entire license notice for the
* JavaScript code in this page
*/
!function webpackUniversalModuleDefinition(e,t){"object"==typeof exports&&"object"==typeof module?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,(()=>(()=>{var __webpack_modules__=[,(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.VerbosityLevel=t.Util=t.UnknownErrorException=t.UnexpectedResponseException=t.TextRenderingMode=t.RenderingIntentFlag=t.PromiseCapability=t.PermissionFlag=t.PasswordResponses=t.PasswordException=t.PageActionEventType=t.OPS=t.MissingPDFException=t.MAX_IMAGE_SIZE_TO_CACHE=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&&void 0!==(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 r=0;r<t;r+=i){const s=Math.min(r+i,t),a=e.subarray(r,s);n.push(String.fromCharCode.apply(null,a))}return n.join("")};t.createValidAbsoluteUrl=function createValidAbsoluteUrl(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!e)return null;try{if(i&&"string"==typeof e){if(i.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\./g);(null==t?void 0: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){switch(null==e?void 0: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(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]: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 r};t.info=function info(e){r>=n.INFOS&&("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?console.log(`Info: ${e}`):Window&&globalThis.ngxConsole?globalThis.ngxConsole.log(`Info: ${e}`):console.log(`Info: ${e}`))};t.isArrayBuffer=function isArrayBuffer(e){return"object"==typeof e&&void 0!==(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.normalizeUnicode=function normalizeUnicode(e){if(!l){l=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu;c=new Map([["ſt","ſt"]])}return e.replaceAll(l,((e,t,i)=>t?t.normalize("NFKC"):c.get(i)))};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)&&(r=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=o[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;if(!globalThis._pdfjsCompatibilityChecked){globalThis._pdfjsCompatibilityChecked=!0;i(2)}t.IDENTITY_MATRIX=[1,0,0,1,0,0];t.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0];t.MAX_IMAGE_SIZE_TO_CACHE=1e7;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 n={ERRORS:0,WARNINGS:1,INFOS:5};t.VerbosityLevel=n;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.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let r=n.WARNINGS;function warn(e){r>=n.WARNINGS&&("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?console.log(`Warning: ${e}`):Window&&globalThis.ngxConsole?globalThis.ngxConsole.log(`Warning: ${e}`):console.log(`Warning: ${e}`))}function unreachable(e){throw new Error(e)}function shadow(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];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 a=[...Array(256).keys()].map((e=>e.toString(16).padStart(2,"0")));class Util{static makeHexColor(e,t,i){return`#${a[e]}${a[t]}${a[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),r=Util.applyTransform([e[0],e[3]],t),s=Util.applyTransform([e[2],e[1]],t);return[Math.min(i[0],n[0],r[0],s[0]),Math.min(i[1],n[1],r[1],s[1]),Math.max(i[0],n[0],r[0],s[0]),Math.max(i[1],n[1],r[1],s[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],r=e[2]*t[0]+e[3]*t[2],s=e[2]*t[1]+e[3]*t[3],a=(i+s)/2,o=Math.sqrt((i+s)**2-4*(i*s-r*n))/2,l=a+o||1,c=a-o||1;return[Math.sqrt(l),Math.sqrt(c)]}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 r=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),s=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return r>s?null:[i,r,n,s]}static bezierBoundingBox(e,t,i,n,r,s,a,o){const l=[],c=[[],[]];let d,h,u,p,g,f,m,v;for(let c=0;c<2;++c){if(0===c){h=6*e-12*i+6*r;d=-3*e+9*i-9*r+3*a;u=3*i-3*e}else{h=6*t-12*n+6*s;d=-3*t+9*n-9*s+3*o;u=3*n-3*t}if(Math.abs(d)<1e-12){if(Math.abs(h)<1e-12)continue;p=-u/h;0<p&&p<1&&l.push(p)}else{m=h*h-4*u*d;v=Math.sqrt(m);if(!(m<0)){g=(-h+v)/(2*d);0<g&&g<1&&l.push(g);f=(-h-v)/(2*d);0<f&&f<1&&l.push(f)}}}let b,y=l.length;const w=y;for(;y--;){p=l[y];b=1-p;c[0][y]=b*b*b*e+3*b*b*p*i+3*b*p*p*r+p*p*p*a;c[1][y]=b*b*b*t+3*b*b*p*n+3*b*p*p*s+p*p*p*o}c[0][w]=e;c[1][w]=t;c[0][w+1]=a;c[1][w+1]=o;c[0].length=c[1].length=w+2;return[Math.min(...c[0]),Math.min(...c[1]),Math.max(...c[0]),Math.max(...c[1])]}}t.Util=Util;const o=[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))}t.PromiseCapability=class PromiseCapability{#e=!1;constructor(){this.promise=new Promise(((e,t)=>{this.resolve=t=>{this.#e=!0;e(t)};this.reject=e=>{this.#e=!0;t(e)}}))}get settled(){return this.#e}};let l=null,c=null},(e,t,i)=>{"use strict";!function checkDOMMatrix(){globalThis.DOMMatrix}();!function checkPath2D(){globalThis.Path2D}();!function checkArrayAt(){Array.prototype.at||i(3)}();!function checkTypedArrayAt(){Uint8Array.prototype.at||i(77)}();!function checkStructuredClone(){globalThis.structuredClone||i(89)}()},(e,t,i)=>{i(4);var n=i(76);e.exports=n("Array","at")},(e,t,i)=>{"use strict";var n=i(5),r=i(42),s=i(66),a=i(64),o=i(71);n({target:"Array",proto:!0},{at:function at(e){var t=r(this),i=s(t),n=a(e),o=n>=0?n:i+n;return o<0||o>=i?void 0:t[o]}});o("at")},(e,t,i)=>{var n=i(6),r=i(7).f,s=i(46),a=i(50),o=i(40),l=i(58),c=i(70);e.exports=function(e,t){var i,d,h,u,p,g=e.target,f=e.global,m=e.stat;if(i=f?n:m?n[g]||o(g,{}):(n[g]||{}).prototype)for(d in t){u=t[d];h=e.dontCallGetSet?(p=r(i,d))&&p.value:i[d];if(!c(f?d:g+(m?".":"#")+d,e.forced)&&void 0!==h){if(typeof u==typeof h)continue;l(u,h)}(e.sham||h&&h.sham)&&s(u,"sham",!0);a(i,d,u,e)}}},e=>{var check=function(e){return e&&e.Math==Math&&e};e.exports=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof global&&global)||function(){return this}()||Function("return this")()},(e,t,i)=>{var n=i(8),r=i(10),s=i(12),a=i(13),o=i(14),l=i(20),c=i(41),d=i(44),h=Object.getOwnPropertyDescriptor;t.f=n?h:function getOwnPropertyDescriptor(e,t){e=o(e);t=l(t);if(d)try{return h(e,t)}catch(e){}if(c(e,t))return a(!r(s.f,e,t),e[t])}},(e,t,i)=>{var n=i(9);e.exports=!n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},e=>{e.exports=function(e){try{return!!e()}catch(e){return!0}}},(e,t,i)=>{var n=i(11),r=Function.prototype.call;e.exports=n?r.bind(r):function(){return r.apply(r,arguments)}},(e,t,i)=>{var n=i(9);e.exports=!n((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},(e,t)=>{"use strict";var i={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,r=n&&!i.call({1:2},1);t.f=r?function propertyIsEnumerable(e){var t=n(this,e);return!!t&&t.enumerable}:i},e=>{e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},(e,t,i)=>{var n=i(15),r=i(18);e.exports=function(e){return n(r(e))}},(e,t,i)=>{var n=i(16),r=i(9),s=i(17),a=Object,o=n("".split);e.exports=r((function(){return!a("z").propertyIsEnumerable(0)}))?function(e){return"String"==s(e)?o(e,""):a(e)}:a},(e,t,i)=>{var n=i(11),r=Function.prototype,s=r.call,a=n&&r.bind.bind(s,s);e.exports=n?a:function(e){return function(){return s.apply(e,arguments)}}},(e,t,i)=>{var n=i(16),r=n({}.toString),s=n("".slice);e.exports=function(e){return s(r(e),8,-1)}},(e,t,i)=>{var n=i(19),r=TypeError;e.exports=function(e){if(n(e))throw r("Can't call method on "+e);return e}},e=>{e.exports=function(e){return null==e}},(e,t,i)=>{var n=i(21),r=i(25);e.exports=function(e){var t=n(e,"string");return r(t)?t:t+""}},(e,t,i)=>{var n=i(10),r=i(22),s=i(25),a=i(32),o=i(35),l=i(36),c=TypeError,d=l("toPrimitive");e.exports=function(e,t){if(!r(e)||s(e))return e;var i,l=a(e,d);if(l){void 0===t&&(t="default");i=n(l,e,t);if(!r(i)||s(i))return i;throw c("Can't convert object to primitive value")}void 0===t&&(t="number");return o(e,t)}},(e,t,i)=>{var n=i(23),r=i(24),s=r.all;e.exports=r.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:n(e)||e===s}:function(e){return"object"==typeof e?null!==e:n(e)}},(e,t,i)=>{var n=i(24),r=n.all;e.exports=n.IS_HTMLDDA?function(e){return"function"==typeof e||e===r}:function(e){return"function"==typeof e}},e=>{var t="object"==typeof document&&document.all,i=void 0===t&&void 0!==t;e.exports={all:t,IS_HTMLDDA:i}},(e,t,i)=>{var n=i(26),r=i(23),s=i(27),a=i(28),o=Object;e.exports=a?function(e){return"symbol"==typeof e}:function(e){var t=n("Symbol");return r(t)&&s(t.prototype,o(e))}},(e,t,i)=>{var n=i(6),r=i(23);e.exports=function(e,t){return arguments.length<2?(i=n[e],r(i)?i:void 0):n[e]&&n[e][t];var i}},(e,t,i)=>{var n=i(16);e.exports=n({}.isPrototypeOf)},(e,t,i)=>{var n=i(29);e.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},(e,t,i)=>{var n=i(30),r=i(9);e.exports=!!Object.getOwnPropertySymbols&&!r((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&n&&n<41}))},(e,t,i)=>{var n,r,s=i(6),a=i(31),o=s.process,l=s.Deno,c=o&&o.versions||l&&l.version,d=c&&c.v8;d&&(r=(n=d.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1]));!r&&a&&(!(n=a.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=a.match(/Chrome\/(\d+)/))&&(r=+n[1]);e.exports=r},e=>{e.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},(e,t,i)=>{var n=i(33),r=i(19);e.exports=function(e,t){var i=e[t];return r(i)?void 0:n(i)}},(e,t,i)=>{var n=i(23),r=i(34),s=TypeError;e.exports=function(e){if(n(e))return e;throw s(r(e)+" is not a function")}},e=>{var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},(e,t,i)=>{var n=i(10),r=i(23),s=i(22),a=TypeError;e.exports=function(e,t){var i,o;if("string"===t&&r(i=e.toString)&&!s(o=n(i,e)))return o;if(r(i=e.valueOf)&&!s(o=n(i,e)))return o;if("string"!==t&&r(i=e.toString)&&!s(o=n(i,e)))return o;throw a("Can't convert object to primitive value")}},(e,t,i)=>{var n=i(6),r=i(37),s=i(41),a=i(43),o=i(29),l=i(28),c=n.Symbol,d=r("wks"),h=l?c.for||c:c&&c.withoutSetter||a;e.exports=function(e){s(d,e)||(d[e]=o&&s(c,e)?c[e]:h("Symbol."+e));return d[e]}},(e,t,i)=>{var n=i(38),r=i(39);(e.exports=function(e,t){return r[e]||(r[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.30.0",mode:n?"pure":"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.30.0/LICENSE",source:"https://github.com/zloirock/core-js"})},e=>{e.exports=!1},(e,t,i)=>{var n=i(6),r=i(40),s="__core-js_shared__",a=n[s]||r(s,{});e.exports=a},(e,t,i)=>{var n=i(6),r=Object.defineProperty;e.exports=function(e,t){try{r(n,e,{value:t,configurable:!0,writable:!0})}catch(i){n[e]=t}return t}},(e,t,i)=>{var n=i(16),r=i(42),s=n({}.hasOwnProperty);e.exports=Object.hasOwn||function hasOwn(e,t){return s(r(e),t)}},(e,t,i)=>{var n=i(18),r=Object;e.exports=function(e){return r(n(e))}},(e,t,i)=>{var n=i(16),r=0,s=Math.random(),a=n(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+a(++r+s,36)}},(e,t,i)=>{var n=i(8),r=i(9),s=i(45);e.exports=!n&&!r((function(){return 7!=Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a}))},(e,t,i)=>{var n=i(6),r=i(22),s=n.document,a=r(s)&&r(s.createElement);e.exports=function(e){return a?s.createElement(e):{}}},(e,t,i)=>{var n=i(8),r=i(47),s=i(13);e.exports=n?function(e,t,i){return r.f(e,t,s(1,i))}:function(e,t,i){e[t]=i;return e}},(e,t,i)=>{var n=i(8),r=i(44),s=i(48),a=i(49),o=i(20),l=TypeError,c=Object.defineProperty,d=Object.getOwnPropertyDescriptor,h="enumerable",u="configurable",p="writable";t.f=n?s?function defineProperty(e,t,i){a(e);t=o(t);a(i);if("function"==typeof e&&"prototype"===t&&"value"in i&&p in i&&!i[p]){var n=d(e,t);if(n&&n[p]){e[t]=i.value;i={configurable:u in i?i[u]:n[u],enumerable:h in i?i[h]:n[h],writable:!1}}}return c(e,t,i)}:c:function defineProperty(e,t,i){a(e);t=o(t);a(i);if(r)try{return c(e,t,i)}catch(e){}if("get"in i||"set"in i)throw l("Accessors not supported");"value"in i&&(e[t]=i.value);return e}},(e,t,i)=>{var n=i(8),r=i(9);e.exports=n&&r((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},(e,t,i)=>{var n=i(22),r=String,s=TypeError;e.exports=function(e){if(n(e))return e;throw s(r(e)+" is not an object")}},(e,t,i)=>{var n=i(23),r=i(47),s=i(51),a=i(40);e.exports=function(e,t,i,o){o||(o={});var l=o.enumerable,c=void 0!==o.name?o.name:t;n(i)&&s(i,c,o);if(o.global)l?e[t]=i:a(t,i);else{try{o.unsafe?e[t]&&(l=!0):delete e[t]}catch(e){}l?e[t]=i:r.f(e,t,{value:i,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e}},(e,t,i)=>{var n=i(16),r=i(9),s=i(23),a=i(41),o=i(8),l=i(52).CONFIGURABLE,c=i(53),d=i(54),h=d.enforce,u=d.get,p=String,g=Object.defineProperty,f=n("".slice),m=n("".replace),v=n([].join),b=o&&!r((function(){return 8!==g((function(){}),"length",{value:8}).length})),y=String(String).split("String"),w=e.exports=function(e,t,i){"Symbol("===f(p(t),0,7)&&(t="["+m(p(t),/^Symbol\(([^)]*)\)/,"$1")+"]");i&&i.getter&&(t="get "+t);i&&i.setter&&(t="set "+t);(!a(e,"name")||l&&e.name!==t)&&(o?g(e,"name",{value:t,configurable:!0}):e.name=t);b&&i&&a(i,"arity")&&e.length!==i.arity&&g(e,"length",{value:i.arity});try{i&&a(i,"constructor")&&i.constructor?o&&g(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var n=h(e);a(n,"source")||(n.source=v(y,"string"==typeof t?t:""));return e};Function.prototype.toString=w((function toString(){return s(this)&&u(this).source||c(this)}),"toString")},(e,t,i)=>{var n=i(8),r=i(41),s=Function.prototype,a=n&&Object.getOwnPropertyDescriptor,o=r(s,"name"),l=o&&"something"===function something(){}.name,c=o&&(!n||n&&a(s,"name").configurable);e.exports={EXISTS:o,PROPER:l,CONFIGURABLE:c}},(e,t,i)=>{var n=i(16),r=i(23),s=i(39),a=n(Function.toString);r(s.inspectSource)||(s.inspectSource=function(e){return a(e)});e.exports=s.inspectSource},(e,t,i)=>{var n,r,s,a=i(55),o=i(6),l=i(22),c=i(46),d=i(41),h=i(39),u=i(56),p=i(57),g="Object already initialized",f=o.TypeError,m=o.WeakMap;if(a||h.state){var v=h.state||(h.state=new m);v.get=v.get;v.has=v.has;v.set=v.set;n=function(e,t){if(v.has(e))throw f(g);t.facade=e;v.set(e,t);return t};r=function(e){return v.get(e)||{}};s=function(e){return v.has(e)}}else{var b=u("state");p[b]=!0;n=function(e,t){if(d(e,b))throw f(g);t.facade=e;c(e,b,t);return t};r=function(e){return d(e,b)?e[b]:{}};s=function(e){return d(e,b)}}e.exports={set:n,get:r,has:s,enforce:function(e){return s(e)?r(e):n(e,{})},getterFor:function(e){return function(t){var i;if(!l(t)||(i=r(t)).type!==e)throw f("Incompatible receiver, "+e+" required");return i}}}},(e,t,i)=>{var n=i(6),r=i(23),s=n.WeakMap;e.exports=r(s)&&/native code/.test(String(s))},(e,t,i)=>{var n=i(37),r=i(43),s=n("keys");e.exports=function(e){return s[e]||(s[e]=r(e))}},e=>{e.exports={}},(e,t,i)=>{var n=i(41),r=i(59),s=i(7),a=i(47);e.exports=function(e,t,i){for(var o=r(t),l=a.f,c=s.f,d=0;d<o.length;d++){var h=o[d];n(e,h)||i&&n(i,h)||l(e,h,c(t,h))}}},(e,t,i)=>{var n=i(26),r=i(16),s=i(60),a=i(69),o=i(49),l=r([].concat);e.exports=n("Reflect","ownKeys")||function ownKeys(e){var t=s.f(o(e)),i=a.f;return i?l(t,i(e)):t}},(e,t,i)=>{var n=i(61),r=i(68).concat("length","prototype");t.f=Object.getOwnPropertyNames||function getOwnPropertyNames(e){return n(e,r)}},(e,t,i)=>{var n=i(16),r=i(41),s=i(14),a=i(62).indexOf,o=i(57),l=n([].push);e.exports=function(e,t){var i,n=s(e),c=0,d=[];for(i in n)!r(o,i)&&r(n,i)&&l(d,i);for(;t.length>c;)r(n,i=t[c++])&&(~a(d,i)||l(d,i));return d}},(e,t,i)=>{var n=i(14),r=i(63),s=i(66),createMethod=function(e){return function(t,i,a){var o,l=n(t),c=s(l),d=r(a,c);if(e&&i!=i){for(;c>d;)if((o=l[d++])!=o)return!0}else for(;c>d;d++)if((e||d in l)&&l[d]===i)return e||d||0;return!e&&-1}};e.exports={includes:createMethod(!0),indexOf:createMethod(!1)}},(e,t,i)=>{var n=i(64),r=Math.max,s=Math.min;e.exports=function(e,t){var i=n(e);return i<0?r(i+t,0):s(i,t)}},(e,t,i)=>{var n=i(65);e.exports=function(e){var t=+e;return t!=t||0===t?0:n(t)}},e=>{var t=Math.ceil,i=Math.floor;e.exports=Math.trunc||function trunc(e){var n=+e;return(n>0?i:t)(n)}},(e,t,i)=>{var n=i(67);e.exports=function(e){return n(e.length)}},(e,t,i)=>{var n=i(64),r=Math.min;e.exports=function(e){return e>0?r(n(e),9007199254740991):0}},e=>{e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},(e,t)=>{t.f=Object.getOwnPropertySymbols},(e,t,i)=>{var n=i(9),r=i(23),s=/#|\.prototype\./,isForced=function(e,t){var i=o[a(e)];return i==c||i!=l&&(r(t)?n(t):!!t)},a=isForced.normalize=function(e){return String(e).replace(s,".").toLowerCase()},o=isForced.data={},l=isForced.NATIVE="N",c=isForced.POLYFILL="P";e.exports=isForced},(e,t,i)=>{var n=i(36),r=i(72),s=i(47).f,a=n("unscopables"),o=Array.prototype;null==o[a]&&s(o,a,{configurable:!0,value:r(null)});e.exports=function(e){o[a][e]=!0}},(e,t,i)=>{var n,r=i(49),s=i(73),a=i(68),o=i(57),l=i(75),c=i(45),d=i(56),h="prototype",u="script",p=d("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(e){return"<"+u+">"+e+"</"+u+">"},NullProtoObjectViaActiveX=function(e){e.write(scriptTag(""));e.close();var t=e.parentWindow.Object;e=null;return t},NullProtoObject=function(){try{n=new ActiveXObject("htmlfile")}catch(e){}NullProtoObject="undefined"!=typeof document?document.domain&&n?NullProtoObjectViaActiveX(n):function(){var e,t=c("iframe"),i="java"+u+":";t.style.display="none";l.appendChild(t);t.src=String(i);(e=t.contentWindow.document).open();e.write(scriptTag("document.F=Object"));e.close();return e.F}():NullProtoObjectViaActiveX(n);for(var e=a.length;e--;)delete NullProtoObject[h][a[e]];return NullProtoObject()};o[p]=!0;e.exports=Object.create||function create(e,t){var i;if(null!==e){EmptyConstructor[h]=r(e);i=new EmptyConstructor;EmptyConstructor[h]=null;i[p]=e}else i=NullProtoObject();return void 0===t?i:s.f(i,t)}},(e,t,i)=>{var n=i(8),r=i(48),s=i(47),a=i(49),o=i(14),l=i(74);t.f=n&&!r?Object.defineProperties:function defineProperties(e,t){a(e);for(var i,n=o(t),r=l(t),c=r.length,d=0;c>d;)s.f(e,i=r[d++],n[i]);return e}},(e,t,i)=>{var n=i(61),r=i(68);e.exports=Object.keys||function keys(e){return n(e,r)}},(e,t,i)=>{var n=i(26);e.exports=n("document","documentElement")},(e,t,i)=>{var n=i(6),r=i(16);e.exports=function(e,t){return r(n[e].prototype[t])}},(e,t,i)=>{i(78)},(e,t,i)=>{"use strict";var n=i(79),r=i(66),s=i(64),a=n.aTypedArray;(0,n.exportTypedArrayMethod)("at",(function at(e){var t=a(this),i=r(t),n=s(e),o=n>=0?n:i+n;return o<0||o>=i?void 0:t[o]}))},(e,t,i)=>{"use strict";var n,r,s,a=i(80),o=i(8),l=i(6),c=i(23),d=i(22),h=i(41),u=i(81),p=i(34),g=i(46),f=i(50),m=i(83),v=i(27),b=i(84),y=i(86),w=i(36),_=i(43),S=i(54),P=S.enforce,A=S.get,E=l.Int8Array,x=E&&E.prototype,C=l.Uint8ClampedArray,T=C&&C.prototype,M=E&&b(E),I=x&&b(x),k=Object.prototype,D=l.TypeError,L=w("toStringTag"),R=_("TYPED_ARRAY_TAG"),O="TypedArrayConstructor",N=a&&!!y&&"Opera"!==u(l.opera),B=!1,V={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},U={BigInt64Array:8,BigUint64Array:8},getTypedArrayConstructor=function(e){var t=b(e);if(d(t)){var i=A(t);return i&&h(i,O)?i[O]:getTypedArrayConstructor(t)}},isTypedArray=function(e){if(!d(e))return!1;var t=u(e);return h(V,t)||h(U,t)};for(n in V)(s=(r=l[n])&&r.prototype)?P(s)[O]=r:N=!1;for(n in U)(s=(r=l[n])&&r.prototype)&&(P(s)[O]=r);if(!N||!c(M)||M===Function.prototype){M=function TypedArray(){throw D("Incorrect invocation")};if(N)for(n in V)l[n]&&y(l[n],M)}if(!N||!I||I===k){I=M.prototype;if(N)for(n in V)l[n]&&y(l[n].prototype,I)}N&&b(T)!==I&&y(T,I);if(o&&!h(I,L)){B=!0;m(I,L,{configurable:!0,get:function(){return d(this)?this[R]:void 0}});for(n in V)l[n]&&g(l[n],R,n)}e.exports={NATIVE_ARRAY_BUFFER_VIEWS:N,TYPED_ARRAY_TAG:B&&R,aTypedArray:function(e){if(isTypedArray(e))return e;throw D("Target is not a typed array")},aTypedArrayConstructor:function(e){if(c(e)&&(!y||v(M,e)))return e;throw D(p(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,i,n){if(o){if(i)for(var r in V){var s=l[r];if(s&&h(s.prototype,e))try{delete s.prototype[e]}catch(i){try{s.prototype[e]=t}catch(e){}}}I[e]&&!i||f(I,e,i?t:N&&x[e]||t,n)}},exportTypedArrayStaticMethod:function(e,t,i){var n,r;if(o){if(y){if(i)for(n in V)if((r=l[n])&&h(r,e))try{delete r[e]}catch(e){}if(M[e]&&!i)return;try{return f(M,e,i?t:N&&M[e]||t)}catch(e){}}for(n in V)!(r=l[n])||r[e]&&!i||f(r,e,t)}},getTypedArrayConstructor:getTypedArrayConstructor,isView:function isView(e){if(!d(e))return!1;var t=u(e);return"DataView"===t||h(V,t)||h(U,t)},isTypedArray:isTypedArray,TypedArray:M,TypedArrayPrototype:I}},e=>{e.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},(e,t,i)=>{var n=i(82),r=i(23),s=i(17),a=i(36)("toStringTag"),o=Object,l="Arguments"==s(function(){return arguments}());e.exports=n?s:function(e){var t,i,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(e){}}(t=o(e),a))?i:l?s(t):"Object"==(n=s(t))&&r(t.callee)?"Arguments":n}},(e,t,i)=>{var n={};n[i(36)("toStringTag")]="z";e.exports="[object z]"===String(n)},(e,t,i)=>{var n=i(51),r=i(47);e.exports=function(e,t,i){i.get&&n(i.get,t,{getter:!0});i.set&&n(i.set,t,{setter:!0});return r.f(e,t,i)}},(e,t,i)=>{var n=i(41),r=i(23),s=i(42),a=i(56),o=i(85),l=a("IE_PROTO"),c=Object,d=c.prototype;e.exports=o?c.getPrototypeOf:function(e){var t=s(e);if(n(t,l))return t[l];var i=t.constructor;return r(i)&&t instanceof i?i.prototype:t instanceof c?d:null}},(e,t,i)=>{var n=i(9);e.exports=!n((function(){function F(){}F.prototype.constructor=null;return Object.getPrototypeOf(new F)!==F.prototype}))},(e,t,i)=>{var n=i(87),r=i(49),s=i(88);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,i={};try{(e=n(Object.prototype,"__proto__","set"))(i,[]);t=i instanceof Array}catch(e){}return function setPrototypeOf(i,n){r(i);s(n);t?e(i,n):i.__proto__=n;return i}}():void 0)},(e,t,i)=>{var n=i(16),r=i(33);e.exports=function(e,t,i){try{return n(r(Object.getOwnPropertyDescriptor(e,t)[i]))}catch(e){}}},(e,t,i)=>{var n=i(23),r=String,s=TypeError;e.exports=function(e){if("object"==typeof e||n(e))return e;throw s("Can't set "+r(e)+" as a prototype")}},(e,t,i)=>{i(90);i(97);i(99);i(122);i(124);var n=i(136);e.exports=n.structuredClone},(e,t,i)=>{"use strict";var n=i(14),r=i(71),s=i(91),a=i(54),o=i(47).f,l=i(92),c=i(96),d=i(38),h=i(8),u="Array Iterator",p=a.set,g=a.getterFor(u);e.exports=l(Array,"Array",(function(e,t){p(this,{type:u,target:n(e),index:0,kind:t})}),(function(){var e=g(this),t=e.target,i=e.kind,n=e.index++;if(!t||n>=t.length){e.target=void 0;return c(void 0,!0)}return c("keys"==i?n:"values"==i?t[n]:[n,t[n]],!1)}),"values");var f=s.Arguments=s.Array;r("keys");r("values");r("entries");if(!d&&h&&"values"!==f.name)try{o(f,"name",{value:"values"})}catch(e){}},e=>{e.exports={}},(e,t,i)=>{"use strict";var n=i(5),r=i(10),s=i(38),a=i(52),o=i(23),l=i(93),c=i(84),d=i(86),h=i(95),u=i(46),p=i(50),g=i(36),f=i(91),m=i(94),v=a.PROPER,b=a.CONFIGURABLE,y=m.IteratorPrototype,w=m.BUGGY_SAFARI_ITERATORS,_=g("iterator"),S="keys",P="values",A="entries",returnThis=function(){return this};e.exports=function(e,t,i,a,g,m,E){l(i,t,a);var x,C,T,getIterationMethod=function(e){if(e===g&&L)return L;if(!w&&e in k)return k[e];switch(e){case S:return function keys(){return new i(this,e)};case P:return function values(){return new i(this,e)};case A:return function entries(){return new i(this,e)}}return function(){return new i(this)}},M=t+" Iterator",I=!1,k=e.prototype,D=k[_]||k["@@iterator"]||g&&k[g],L=!w&&D||getIterationMethod(g),R="Array"==t&&k.entries||D;if(R&&(x=c(R.call(new e)))!==Object.prototype&&x.next){s||c(x)===y||(d?d(x,y):o(x[_])||p(x,_,returnThis));h(x,M,!0,!0);s&&(f[M]=returnThis)}if(v&&g==P&&D&&D.name!==P)if(!s&&b)u(k,"name",P);else{I=!0;L=function values(){return r(D,this)}}if(g){C={values:getIterationMethod(P),keys:m?L:getIterationMethod(S),entries:getIterationMethod(A)};if(E)for(T in C)(w||I||!(T in k))&&p(k,T,C[T]);else n({target:t,proto:!0,forced:w||I},C)}s&&!E||k[_]===L||p(k,_,L,{name:g});f[t]=L;return C}},(e,t,i)=>{"use strict";var n=i(94).IteratorPrototype,r=i(72),s=i(13),a=i(95),o=i(91),returnThis=function(){return this};e.exports=function(e,t,i,l){var c=t+" Iterator";e.prototype=r(n,{next:s(+!l,i)});a(e,c,!1,!0);o[c]=returnThis;return e}},(e,t,i)=>{"use strict";var n,r,s,a=i(9),o=i(23),l=i(22),c=i(72),d=i(84),h=i(50),u=i(36),p=i(38),g=u("iterator"),f=!1;[].keys&&("next"in(s=[].keys())?(r=d(d(s)))!==Object.prototype&&(n=r):f=!0);!l(n)||a((function(){var e={};return n[g].call(e)!==e}))?n={}:p&&(n=c(n));o(n[g])||h(n,g,(function(){return this}));e.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:f}},(e,t,i)=>{var n=i(47).f,r=i(41),s=i(36)("toStringTag");e.exports=function(e,t,i){e&&!i&&(e=e.prototype);e&&!r(e,s)&&n(e,s,{configurable:!0,value:t})}},e=>{e.exports=function(e,t){return{value:e,done:t}}},(e,t,i)=>{var n=i(82),r=i(50),s=i(98);n||r(Object.prototype,"toString",s,{unsafe:!0})},(e,t,i)=>{"use strict";var n=i(82),r=i(81);e.exports=n?{}.toString:function toString(){return"[object "+r(this)+"]"}},(e,t,i)=>{i(100)},(e,t,i)=>{"use strict";i(101)("Map",(function(e){return function Map(){return e(this,arguments.length?arguments[0]:void 0)}}),i(119))},(e,t,i)=>{"use strict";var n=i(5),r=i(6),s=i(16),a=i(70),o=i(50),l=i(102),c=i(109),d=i(116),h=i(23),u=i(19),p=i(22),g=i(9),f=i(117),m=i(95),v=i(118);e.exports=function(e,t,i){var b=-1!==e.indexOf("Map"),y=-1!==e.indexOf("Weak"),w=b?"set":"add",_=r[e],S=_&&_.prototype,P=_,A={},fixMethod=function(e){var t=s(S[e]);o(S,e,"add"==e?function add(e){t(this,0===e?0:e);return this}:"delete"==e?function(e){return!(y&&!p(e))&&t(this,0===e?0:e)}:"get"==e?function get(e){return y&&!p(e)?void 0:t(this,0===e?0:e)}:"has"==e?function has(e){return!(y&&!p(e))&&t(this,0===e?0:e)}:function set(e,i){t(this,0===e?0:e,i);return this})};if(a(e,!h(_)||!(y||S.forEach&&!g((function(){(new _).entries().next()}))))){P=i.getConstructor(t,e,b,w);l.enable()}else if(a(e,!0)){var E=new P,x=E[w](y?{}:-0,1)!=E,C=g((function(){E.has(1)})),T=f((function(e){new _(e)})),M=!y&&g((function(){for(var e=new _,t=5;t--;)e[w](t,t);return!e.has(-0)}));if(!T){(P=t((function(e,t){d(e,S);var i=v(new _,e,P);u(t)||c(t,i[w],{that:i,AS_ENTRIES:b});return i}))).prototype=S;S.constructor=P}if(C||M){fixMethod("delete");fixMethod("has");b&&fixMethod("get")}(M||x)&&fixMethod(w);y&&S.clear&&delete S.clear}A[e]=P;n({global:!0,constructor:!0,forced:P!=_},A);m(P,e);y||i.setStrong(P,e,b);return P}},(e,t,i)=>{var n=i(5),r=i(16),s=i(57),a=i(22),o=i(41),l=i(47).f,c=i(60),d=i(103),h=i(106),u=i(43),p=i(108),g=!1,f=u("meta"),m=0,setMetadata=function(e){l(e,f,{value:{objectID:"O"+m++,weakData:{}}})},v=e.exports={enable:function(){v.enable=function(){};g=!0;var e=c.f,t=r([].splice),i={};i[f]=1;if(e(i).length){c.f=function(i){for(var n=e(i),r=0,s=n.length;r<s;r++)if(n[r]===f){t(n,r,1);break}return n};n({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:d.f})}},fastKey:function(e,t){if(!a(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,f)){if(!h(e))return"F";if(!t)return"E";setMetadata(e)}return e[f].objectID},getWeakData:function(e,t){if(!o(e,f)){if(!h(e))return!0;if(!t)return!1;setMetadata(e)}return e[f].weakData},onFreeze:function(e){p&&g&&h(e)&&!o(e,f)&&setMetadata(e);return e}};s[f]=!0},(e,t,i)=>{var n=i(17),r=i(14),s=i(60).f,a=i(104),o="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function getOwnPropertyNames(e){return o&&"Window"==n(e)?function(e){try{return s(e)}catch(e){return a(o)}}(e):s(r(e))}},(e,t,i)=>{var n=i(63),r=i(66),s=i(105),a=Array,o=Math.max;e.exports=function(e,t,i){for(var l=r(e),c=n(t,l),d=n(void 0===i?l:i,l),h=a(o(d-c,0)),u=0;c<d;c++,u++)s(h,u,e[c]);h.length=u;return h}},(e,t,i)=>{"use strict";var n=i(20),r=i(47),s=i(13);e.exports=function(e,t,i){var a=n(t);a in e?r.f(e,a,s(0,i)):e[a]=i}},(e,t,i)=>{var n=i(9),r=i(22),s=i(17),a=i(107),o=Object.isExtensible,l=n((function(){o(1)}));e.exports=l||a?function isExtensible(e){return!!r(e)&&((!a||"ArrayBuffer"!=s(e))&&(!o||o(e)))}:o},(e,t,i)=>{var n=i(9);e.exports=n((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}}))},(e,t,i)=>{var n=i(9);e.exports=!n((function(){return Object.isExtensible(Object.preventExtensions({}))}))},(e,t,i)=>{var n=i(110),r=i(10),s=i(49),a=i(34),o=i(112),l=i(66),c=i(27),d=i(113),h=i(114),u=i(115),p=TypeError,Result=function(e,t){this.stopped=e;this.result=t},g=Result.prototype;e.exports=function(e,t,i){var f,m,v,b,y,w,_,S=i&&i.that,P=!(!i||!i.AS_ENTRIES),A=!(!i||!i.IS_RECORD),E=!(!i||!i.IS_ITERATOR),x=!(!i||!i.INTERRUPTED),C=n(t,S),stop=function(e){f&&u(f,"normal",e);return new Result(!0,e)},callFn=function(e){if(P){s(e);return x?C(e[0],e[1],stop):C(e[0],e[1])}return x?C(e,stop):C(e)};if(A)f=e.iterator;else if(E)f=e;else{if(!(m=h(e)))throw p(a(e)+" is not iterable");if(o(m)){for(v=0,b=l(e);b>v;v++)if((y=callFn(e[v]))&&c(g,y))return y;return new Result(!1)}f=d(e,m)}w=A?e.next:f.next;for(;!(_=r(w,f)).done;){try{y=callFn(_.value)}catch(e){u(f,"throw",e)}if("object"==typeof y&&y&&c(g,y))return y}return new Result(!1)}},(e,t,i)=>{var n=i(111),r=i(33),s=i(11),a=n(n.bind);e.exports=function(e,t){r(e);return void 0===t?e:s?a(e,t):function(){return e.apply(t,arguments)}}},(e,t,i)=>{var n=i(17),r=i(16);e.exports=function(e){if("Function"===n(e))return r(e)}},(e,t,i)=>{var n=i(36),r=i(91),s=n("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||a[s]===e)}},(e,t,i)=>{var n=i(10),r=i(33),s=i(49),a=i(34),o=i(114),l=TypeError;e.exports=function(e,t){var i=arguments.length<2?o(e):t;if(r(i))return s(n(i,e));throw l(a(e)+" is not iterable")}},(e,t,i)=>{var n=i(81),r=i(32),s=i(19),a=i(91),o=i(36)("iterator");e.exports=function(e){if(!s(e))return r(e,o)||r(e,"@@iterator")||a[n(e)]}},(e,t,i)=>{var n=i(10),r=i(49),s=i(32);e.exports=function(e,t,i){var a,o;r(e);try{if(!(a=s(e,"return"))){if("throw"===t)throw i;return i}a=n(a,e)}catch(e){o=!0;a=e}if("throw"===t)throw i;if(o)throw a;r(a);return i}},(e,t,i)=>{var n=i(27),r=TypeError;e.exports=function(e,t){if(n(t,e))return e;throw r("Incorrect invocation")}},(e,t,i)=>{var n=i(36)("iterator"),r=!1;try{var s=0,a={next:function(){return{done:!!s++}},return:function(){r=!0}};a[n]=function(){return this};Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!r)return!1;var i=!1;try{var s={};s[n]=function(){return{next:function(){return{done:i=!0}}}};e(s)}catch(e){}return i}},(e,t,i)=>{var n=i(23),r=i(22),s=i(86);e.exports=function(e,t,i){var a,o;s&&n(a=t.constructor)&&a!==i&&r(o=a.prototype)&&o!==i.prototype&&s(e,o);return e}},(e,t,i)=>{"use strict";var n=i(72),r=i(83),s=i(120),a=i(110),o=i(116),l=i(19),c=i(109),d=i(92),h=i(96),u=i(121),p=i(8),g=i(102).fastKey,f=i(54),m=f.set,v=f.getterFor;e.exports={getConstructor:function(e,t,i,d){var h=e((function(e,r){o(e,u);m(e,{type:t,index:n(null),first:void 0,last:void 0,size:0});p||(e.size=0);l(r)||c(r,e[d],{that:e,AS_ENTRIES:i})})),u=h.prototype,f=v(t),define=function(e,t,i){var n,r,s=f(e),a=getEntry(e,t);if(a)a.value=i;else{s.last=a={index:r=g(t,!0),key:t,value:i,previous:n=s.last,next:void 0,removed:!1};s.first||(s.first=a);n&&(n.next=a);p?s.size++:e.size++;"F"!==r&&(s.index[r]=a)}return e},getEntry=function(e,t){var i,n=f(e),r=g(t);if("F"!==r)return n.index[r];for(i=n.first;i;i=i.next)if(i.key==t)return i};s(u,{clear:function clear(){for(var e=f(this),t=e.index,i=e.first;i;){i.removed=!0;i.previous&&(i.previous=i.previous.next=void 0);delete t[i.index];i=i.next}e.first=e.last=void 0;p?e.size=0:this.size=0},delete:function(e){var t=this,i=f(t),n=getEntry(t,e);if(n){var r=n.next,s=n.previous;delete i.index[n.index];n.removed=!0;s&&(s.next=r);r&&(r.previous=s);i.first==n&&(i.first=r);i.last==n&&(i.last=s);p?i.size--:t.size--}return!!n},forEach:function forEach(e){for(var t,i=f(this),n=a(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:i.first;){n(t.value,t.key,this);for(;t&&t.removed;)t=t.previous}},has:function has(e){return!!getEntry(this,e)}});s(u,i?{get:function get(e){var t=getEntry(this,e);return t&&t.value},set:function set(e,t){return define(this,0===e?0:e,t)}}:{add:function add(e){return define(this,e=0===e?0:e,e)}});p&&r(u,"size",{configurable:!0,get:function(){return f(this).size}});return h},setStrong:function(e,t,i){var n=t+" Iterator",r=v(t),s=v(n);d(e,t,(function(e,t){m(this,{type:n,target:e,state:r(e),kind:t,last:void 0})}),(function(){for(var e=s(this),t=e.kind,i=e.last;i&&i.removed;)i=i.previous;if(!e.target||!(e.last=i=i?i.next:e.state.first)){e.target=void 0;return h(void 0,!0)}return h("keys"==t?i.key:"values"==t?i.value:[i.key,i.value],!1)}),i?"entries":"values",!i,!0);u(t)}}},(e,t,i)=>{var n=i(50);e.exports=function(e,t,i){for(var r in t)n(e,r,t[r],i);return e}},(e,t,i)=>{"use strict";var n=i(26),r=i(83),s=i(36),a=i(8),o=s("species");e.exports=function(e){var t=n(e);a&&t&&!t[o]&&r(t,o,{configurable:!0,get:function(){return this}})}},(e,t,i)=>{i(123)},(e,t,i)=>{"use strict";i(101)("Set",(function(e){return function Set(){return e(this,arguments.length?arguments[0]:void 0)}}),i(119))},(e,t,i)=>{var n,r=i(38),s=i(5),a=i(6),o=i(26),l=i(16),c=i(9),d=i(43),h=i(23),u=i(125),p=i(19),g=i(22),f=i(25),m=i(109),v=i(49),b=i(81),y=i(41),w=i(105),_=i(46),S=i(66),P=i(126),A=i(127),E=i(129),x=i(130),C=i(131),T=i(132),M=a.Object,I=a.Array,k=a.Date,D=a.Error,L=a.EvalError,R=a.RangeError,O=a.ReferenceError,N=a.SyntaxError,B=a.TypeError,V=a.URIError,U=a.PerformanceMark,j=a.WebAssembly,H=j&&j.CompileError||D,W=j&&j.LinkError||D,z=j&&j.RuntimeError||D,G=o("DOMException"),q=E.Map,$=E.has,X=E.get,K=E.set,Y=x.Set,Q=x.add,Z=o("Object","keys"),J=l([].push),ee=l((!0).valueOf),te=l(1..valueOf),ie=l("".valueOf),ne=l(k.prototype.getTime),re=d("structuredClone"),se="DataCloneError",ae="Transferring",checkBasicSemantic=function(e){return!c((function(){var t=new a.Set([7]),i=e(t),n=e(M(7));return i==t||!i.has(7)||"object"!=typeof n||7!=n}))&&e},checkErrorsCloning=function(e,t){return!c((function(){var i=new t,n=e({a:i,b:i});return!(n&&n.a===n.b&&n.a instanceof t&&n.a.stack===i.stack)}))},oe=a.structuredClone,le=r||!checkErrorsCloning(oe,D)||!checkErrorsCloning(oe,G)||!(n=oe,!c((function(){var e=n(new a.AggregateError([1],re,{cause:3}));return"AggregateError"!=e.name||1!=e.errors[0]||e.message!=re||3!=e.cause}))),ce=!oe&&checkBasicSemantic((function(e){return new U(re,{detail:e}).detail})),de=checkBasicSemantic(oe)||ce,throwUncloneable=function(e){throw new G("Uncloneable type: "+e,se)},throwUnpolyfillable=function(e,t){throw new G((t||"Cloning")+" of "+e+" cannot be properly polyfilled in this engine",se)},structuredCloneInternal=function(e,t){f(e)&&throwUncloneable("Symbol");if(!g(e))return e;if(t){if($(t,e))return X(t,e)}else t=new q;var i,n,r,s,l,c,d,u,p,m,v,P=b(e),E=!1;switch(P){case"Array":r=I(S(e));E=!0;break;case"Object":r={};E=!0;break;case"Map":r=new q;E=!0;break;case"Set":r=new Y;E=!0;break;case"RegExp":r=new RegExp(e.source,A(e));break;case"Error":switch(n=e.name){case"AggregateError":r=o("AggregateError")([]);break;case"EvalError":r=L();break;case"RangeError":r=R();break;case"ReferenceError":r=O();break;case"SyntaxError":r=N();break;case"TypeError":r=B();break;case"URIError":r=V();break;case"CompileError":r=H();break;case"LinkError":r=W();break;case"RuntimeError":r=z();break;default:r=D()}E=!0;break;case"DOMException":r=new G(e.message,e.name);E=!0;break;case"DataView":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"BigInt64Array":case"BigUint64Array":i=a[P];g(i)||throwUnpolyfillable(P);r=new i(structuredCloneInternal(e.buffer,t),e.byteOffset,"DataView"===P?e.byteLength:e.length);break;case"DOMQuad":try{r=new DOMQuad(structuredCloneInternal(e.p1,t),structuredCloneInternal(e.p2,t),structuredCloneInternal(e.p3,t),structuredCloneInternal(e.p4,t))}catch(t){de?r=de(e):throwUnpolyfillable(P)}break;case"FileList":if(s=function(){var e;try{e=new a.DataTransfer}catch(t){try{e=new a.ClipboardEvent("").clipboardData}catch(e){}}return e&&e.items&&e.files?e:null}()){for(l=0,c=S(e);l<c;l++)s.items.add(structuredCloneInternal(e[l],t));r=s.files}else de?r=de(e):throwUnpolyfillable(P);break;case"ImageData":try{r=new ImageData(structuredCloneInternal(e.data,t),e.width,e.height,{colorSpace:e.colorSpace})}catch(t){de?r=de(e):throwUnpolyfillable(P)}break;default:if(de)r=de(e);else switch(P){case"BigInt":r=M(e.valueOf());break;case"Boolean":r=M(ee(e));break;case"Number":r=M(te(e));break;case"String":r=M(ie(e));break;case"Date":r=new k(ne(e));break;case"ArrayBuffer":(i=a.DataView)||"function"==typeof e.slice||throwUnpolyfillable(P);try{if("function"!=typeof e.slice||e.resizable){c=e.byteLength;v="maxByteLength"in e?{maxByteLength:e.maxByteLength}:void 0;r=new ArrayBuffer(c,v);p=new i(e);m=new i(r);for(l=0;l<c;l++)m.setUint8(l,p.getUint8(l))}else r=e.slice(0)}catch(e){throw new G("ArrayBuffer is detached",se)}break;case"SharedArrayBuffer":r=e;break;case"Blob":try{r=e.slice(0,e.size,e.type)}catch(e){throwUnpolyfillable(P)}break;case"DOMPoint":case"DOMPointReadOnly":i=a[P];try{r=i.fromPoint?i.fromPoint(e):new i(e.x,e.y,e.z,e.w)}catch(e){throwUnpolyfillable(P)}break;case"DOMRect":case"DOMRectReadOnly":i=a[P];try{r=i.fromRect?i.fromRect(e):new i(e.x,e.y,e.width,e.height)}catch(e){throwUnpolyfillable(P)}break;case"DOMMatrix":case"DOMMatrixReadOnly":i=a[P];try{r=i.fromMatrix?i.fromMatrix(e):new i(e)}catch(e){throwUnpolyfillable(P)}break;case"AudioData":case"VideoFrame":h(e.clone)||throwUnpolyfillable(P);try{r=e.clone()}catch(e){throwUncloneable(P)}break;case"File":try{r=new File([e],e.name,e)}catch(e){throwUnpolyfillable(P)}break;case"CropTarget":case"CryptoKey":case"FileSystemDirectoryHandle":case"FileSystemFileHandle":case"FileSystemHandle":case"GPUCompilationInfo":case"GPUCompilationMessage":case"ImageBitmap":case"RTCCertificate":case"WebAssembly.Module":throwUnpolyfillable(P);default:throwUncloneable(P)}}K(t,e,r);if(E)switch(P){case"Array":case"Object":d=Z(e);for(l=0,c=S(d);l<c;l++){u=d[l];w(r,u,structuredCloneInternal(e[u],t))}break;case"Map":e.forEach((function(e,i){K(r,structuredCloneInternal(i,t),structuredCloneInternal(e,t))}));break;case"Set":e.forEach((function(e){Q(r,structuredCloneInternal(e,t))}));break;case"Error":_(r,"message",structuredCloneInternal(e.message,t));y(e,"cause")&&_(r,"cause",structuredCloneInternal(e.cause,t));"AggregateError"==n&&(r.errors=structuredCloneInternal(e.errors,t));case"DOMException":C&&_(r,"stack",structuredCloneInternal(e.stack,t))}return r};s({global:!0,enumerable:!0,sham:!T,forced:le},{structuredClone:function structuredClone(e){var t,i=P(arguments.length,1)>1&&!p(arguments[1])?v(arguments[1]):void 0,n=i?i.transfer:void 0;void 0!==n&&function(e,t){if(!g(e))throw B("Transfer option cannot be converted to a sequence");var i=[];m(e,(function(e){J(i,v(e))}));var n,r,s,o,l,c,d=0,p=S(i);if(T){o=oe(i,{transfer:i});for(;d<p;)K(t,i[d],o[d++])}else for(;d<p;){n=i[d++];if($(t,n))throw new G("Duplicate transferable",se);switch(r=b(n)){case"ImageBitmap":s=a.OffscreenCanvas;u(s)||throwUnpolyfillable(r,ae);try{(c=new s(n.width,n.height)).getContext("bitmaprenderer").transferFromImageBitmap(n);l=c.transferToImageBitmap()}catch(e){}break;case"AudioData":case"VideoFrame":h(n.clone)&&h(n.close)||throwUnpolyfillable(r,ae);try{l=n.clone();n.close()}catch(e){}break;case"ArrayBuffer":h(n.transfer)||throwUnpolyfillable(r,ae);l=n.transfer();break;case"MediaSourceHandle":case"MessagePort":case"OffscreenCanvas":case"ReadableStream":case"TransformStream":case"WritableStream":throwUnpolyfillable(r,ae)}if(void 0===l)throw new G("This object cannot be transferred: "+r,se);K(t,n,l)}}(n,t=new q);return structuredCloneInternal(e,t)}})},(e,t,i)=>{var n=i(16),r=i(9),s=i(23),a=i(81),o=i(26),l=i(53),noop=function(){},c=[],d=o("Reflect","construct"),h=/^\s*(?:class|function)\b/,u=n(h.exec),p=!h.exec(noop),g=function isConstructor(e){if(!s(e))return!1;try{d(noop,c,e);return!0}catch(e){return!1}},f=function isConstructor(e){if(!s(e))return!1;switch(a(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return p||!!u(h,l(e))}catch(e){return!0}};f.sham=!0;e.exports=!d||r((function(){var e;return g(g.call)||!g(Object)||!g((function(){e=!0}))||e}))?f:g},e=>{var t=TypeError;e.exports=function(e,i){if(e<i)throw t("Not enough arguments");return e}},(e,t,i)=>{var n=i(10),r=i(41),s=i(27),a=i(128),o=RegExp.prototype;e.exports=function(e){var t=e.flags;return void 0!==t||"flags"in o||r(e,"flags")||!s(o,e)?t:n(a,e)}},(e,t,i)=>{"use strict";var n=i(49);e.exports=function(){var e=n(this),t="";e.hasIndices&&(t+="d");e.global&&(t+="g");e.ignoreCase&&(t+="i");e.multiline&&(t+="m");e.dotAll&&(t+="s");e.unicode&&(t+="u");e.unicodeSets&&(t+="v");e.sticky&&(t+="y");return t}},(e,t,i)=>{var n=i(16),r=Map.prototype;e.exports={Map:Map,set:n(r.set),get:n(r.get),has:n(r.has),remove:n(r.delete),proto:r}},(e,t,i)=>{var n=i(16),r=Set.prototype;e.exports={Set:Set,add:n(r.add),has:n(r.has),remove:n(r.delete),proto:r}},(e,t,i)=>{var n=i(9),r=i(13);e.exports=!n((function(){var e=Error("a");if(!("stack"in e))return!0;Object.defineProperty(e,"stack",r(1,7));return 7!==e.stack}))},(e,t,i)=>{var n=i(6),r=i(9),s=i(30),a=i(133),o=i(134),l=i(135),c=n.structuredClone;e.exports=!!c&&!r((function(){if(o&&s>92||l&&s>94||a&&s>97)return!1;var e=new ArrayBuffer(8),t=c(e,{transfer:[e]});return 0!=e.byteLength||8!=t.byteLength}))},(e,t,i)=>{var n=i(134),r=i(135);e.exports=!n&&!r&&"object"==typeof window&&"object"==typeof document},e=>{e.exports="object"==typeof Deno&&Deno&&"object"==typeof Deno.version},(e,t,i)=>{var n=i(17);e.exports="undefined"!=typeof process&&"process"==n(process)},(e,t,i)=>{var n=i(6);e.exports=n},(__unused_webpack_module,exports,__w_pdfjs_require__)=>{"use strict";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.DefaultFilterFactory=exports.DefaultCanvasFactory=exports.DefaultCMapReaderFactory=void 0;exports.getDocument=getDocument;exports.version=void 0;var _util=__w_pdfjs_require__(1),_annotation_storage=__w_pdfjs_require__(138),_display_utils=__w_pdfjs_require__(141),_font_loader=__w_pdfjs_require__(144),_canvas=__w_pdfjs_require__(146),_worker_options=__w_pdfjs_require__(149),_is_node=__w_pdfjs_require__(145),_message_handler=__w_pdfjs_require__(150),_metadata=__w_pdfjs_require__(151),_optional_content_config=__w_pdfjs_require__(152),_transport_stream=__w_pdfjs_require__(153),_xfa_text=__w_pdfjs_require__(154);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100,DELAYED_CLEANUP_TIMEOUT=5e3,ServiceWorkerOptions={showUnverifiedSignatures:!1};window.ServiceWorkerOptions=ServiceWorkerOptions;let DefaultCanvasFactory=_display_utils.DOMCanvasFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory;let DefaultCMapReaderFactory=_display_utils.DOMCMapReaderFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory;let DefaultFilterFactory=_display_utils.DOMFilterFactory;exports.DefaultFilterFactory=DefaultFilterFactory;let DefaultStandardFontDataFactory=_display_utils.DOMStandardFontDataFactory,createPDFNetworkStream;exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory;if(_is_node.isNodeJS){const{NodeCanvasFactory:e,NodeCMapReaderFactory:t,NodeFilterFactory:i,NodeStandardFontDataFactory:n}=__w_pdfjs_require__(155);exports.DefaultCanvasFactory=DefaultCanvasFactory=e;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory=t;exports.DefaultFilterFactory=DefaultFilterFactory=i;exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory=n}if(_is_node.isNodeJS){const{PDFNodeStream:e}=__w_pdfjs_require__(156);createPDFNetworkStream=t=>new e(t)}else{const{PDFNetworkStream:e}=__w_pdfjs_require__(159),{PDFFetchStream:t}=__w_pdfjs_require__(160);createPDFNetworkStream=i=>(0,_display_utils.isValidFetchUrl)(i.url)?new t(i):new e(i)}function getDocument(e){"string"==typeof e||e instanceof URL?e={url:e}:(0,_util.isArrayBuffer)(e)&&(e={data:e});if("object"!=typeof e)throw new Error("Invalid parameter in getDocument, need 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,{docId:i}=t,n=e.url?getUrlProp(e.url,e.baseHref):null,r=e.data?getDataProp(e.data):null,s=e.httpHeaders||null,a=!0===e.withCredentials,o=e.password??null,l=e.range instanceof PDFDataRangeTransport?e.range:null,c=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:DEFAULT_RANGE_CHUNK_SIZE;let d=e.worker instanceof PDFWorker?e.worker:null;const h=e.verbosity,u="string"!=typeof e.docBaseUrl||(0,_display_utils.isDataScheme)(e.docBaseUrl)?null:e.docBaseUrl,p="function"==typeof e.cMapUrl?e.cMapUrl():"string"==typeof e.cMapUrl?e.cMapUrl:null,g=!1!==e.cMapPacked,f=e.CMapReaderFactory||DefaultCMapReaderFactory,m="function"==typeof e.standardFontDataUrl?e.standardFontDataUrl():"string"==typeof e.standardFontDataUrl?e.standardFontDataUrl:null,v=e.StandardFontDataFactory||DefaultStandardFontDataFactory,b=!0!==e.stopAtErrors,y=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,w=!1!==e.isEvalSupported,_="boolean"==typeof e.isOffscreenCanvasSupported?e.isOffscreenCanvasSupported:!_is_node.isNodeJS,S=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,P="boolean"==typeof e.disableFontFace?e.disableFontFace:_is_node.isNodeJS,A=!0===e.fontExtraProperties,E=!0===e.enableXfa,x=e.ownerDocument||globalThis.document,C=!0===e.disableRange,T=!0===e.disableStream,M=!0===e.disableAutoFetch,I=!0===e.pdfBug,k=l?l.length:e.length??NaN,D="boolean"==typeof e.useSystemFonts?e.useSystemFonts:!_is_node.isNodeJS&&!P,L="boolean"==typeof e.useWorkerFetch?e.useWorkerFetch:f===_display_utils.DOMCMapReaderFactory&&v===_display_utils.DOMStandardFontDataFactory&&(0,_display_utils.isValidFetchUrl)(p,document.baseURI)&&(0,_display_utils.isValidFetchUrl)(m,document.baseURI),R=e.canvasFactory||new DefaultCanvasFactory({ownerDocument:x}),O=e.filterFactory||new DefaultFilterFactory({docId:i,ownerDocument:x});(0,_util.setVerbosityLevel)(h);const N={canvasFactory:R,filterFactory:O};if(!L){N.cMapReaderFactory=new f({baseUrl:p,isCompressed:g});N.standardFontDataFactory=new v({baseUrl:m})}if(!d){const e={verbosity:h,port:_worker_options.GlobalWorkerOptions.workerPort};d=e.port?PDFWorker.fromPort(e):new PDFWorker(e);t._worker=d}const B={docId:i,apiVersion:"3.7.506",data:r,password:o,disableAutoFetch:M,rangeChunkSize:c,length:k,docBaseUrl:u,enableXfa:E,evaluatorOptions:{maxImageSize:y,disableFontFace:P,ignoreErrors:b,isEvalSupported:w,isOffscreenCanvasSupported:_,canvasMaxAreaInBytes:S,fontExtraProperties:A,useSystemFonts:D,cMapUrl:L?p:null,standardFontDataUrl:L?m:null}},V={ignoreErrors:b,isEvalSupported:w,disableFontFace:P,fontExtraProperties:A,enableXfa:E,ownerDocument:x,disableAutoFetch:M,pdfBug:I,styleElement:null};d.promise.then((function(){if(t.destroyed)throw new Error("Loading aborted");const e=_fetchDocument(d,B),o=new Promise((function(e){let t;l?t=new _transport_stream.PDFDataTransportStream({length:k,initialData:l.initialData,progressiveDone:l.progressiveDone,contentDispositionFilename:l.contentDispositionFilename,disableRange:C,disableStream:T},l):r||(t=createPDFNetworkStream({url:n,length:k,httpHeaders:s,withCredentials:a,rangeChunkSize:c,disableRange:C,disableStream:T}));e(t)}));return Promise.all([e,o]).then((function(e){let[n,r]=e;if(t.destroyed)throw new Error("Loading aborted");const s=new _message_handler.MessageHandler(i,n,d.port),a=new WorkerTransport(s,t,r,V,N);t._transport=a;s.send("showUnverifiedSignatures",window.ServiceWorkerOptions.showUnverifiedSignatures);s.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(null==e?void 0: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#t=0;constructor(){this._capability=new _util.PromiseCapability;this._transport=null;this._worker=null;this.docId="d"+PDFDocumentLoadingTask.#t++;this.destroyed=!1;this.onPassword=null;this.onProgress=null}get promise(){return this._capability.promise}async destroy(){var e;this.destroyed=!0;await(null===(e=this._transport)||void 0===e?void 0:e.destroy());this._transport=null;if(this._worker){this._worker.destroy();this._worker=null}}}exports.PDFDocumentLoadingTask=PDFDocumentLoadingTask;class PDFDataRangeTransport{constructor(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this.length=e;this.initialData=t;this.progressiveDone=i;this.contentDispositionFilename=n;this._rangeListeners=[];this._progressListeners=[];this._progressiveReadListeners=[];this._progressiveDoneListeners=[];this._readyCapability=new _util.PromiseCapability}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 filterFactory(){return this._transport.filterFactory}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(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];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{#i=null;#n=!1;constructor(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this._pageIndex=e;this._pageInfo=t;this._transport=i;this._stats=n?new _display_utils.StatTimer:null;this._pdfBug=n;this.commonObjs=i.commonObjs;this.objs=new PDFObjects;this._maybeCleanupAfterRender=!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(){let{scale:e,rotation:t=this.rotate,offsetX:i=0,offsetY:n=0,dontFlip:r=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new _display_utils.PageViewport({viewBox:this.view,scale:e,rotation:t,offsetX:i,offsetY:n,dontFlip:r})}getAnnotations(){let{intent:e="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};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(){var e;return(null===(e=this._transport._htmlForXfa)||void 0===e?void 0:e.children[this._pageIndex])||null}render(e){var t,i;let{canvasContext:n,viewport:r,intent:s="display",annotationMode:a=_util.AnnotationMode.ENABLE,transform:o=null,background:l=null,optionalContentConfigPromise:c=null,annotationCanvasMap:d=null,pageColors:h=null,printAnnotationStorage:u=null}=e;if(null!==(t=arguments[0])&&void 0!==t&&t.canvasFactory)throw new Error("render no longer accepts the `canvasFactory`-option, please pass it to the `getDocument`-function instead.");null===(i=this._stats)||void 0===i||i.time("Overall");const p=this._transport.getRenderingIntent(s,a,u);this.#n=!1;this.#r();c||(c=this._transport.getOptionalContentConfig());let g=this._intentStates.get(p.cacheKey);if(!g){g=Object.create(null);this._intentStates.set(p.cacheKey,g)}if(g.streamReaderCancelTimeout){clearTimeout(g.streamReaderCancelTimeout);g.streamReaderCancelTimeout=null}const f=!!(p.renderingIntent&_util.RenderingIntentFlag.PRINT);if(!g.displayReadyCapability){var m;g.displayReadyCapability=new _util.PromiseCapability;g.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null};null===(m=this._stats)||void 0===m||m.time("Page Request");this._pumpOperatorList(p)}const complete=e=>{var t,i;g.renderTasks.delete(v);(this._maybeCleanupAfterRender||f)&&(this.#n=!0);this.#s(!f);if(e){v.capability.reject(e);this._abortOperatorList({intentState:g,reason:e instanceof Error?e:new Error(e)})}else v.capability.resolve();null===(t=this._stats)||void 0===t||t.timeEnd("Rendering");null===(i=this._stats)||void 0===i||i.timeEnd("Overall")},v=new InternalRenderTask({callback:complete,params:{canvasContext:n,viewport:r,transform:o,background:l},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:d,operatorList:g.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!f,pdfBug:this._pdfBug,pageColors:h});(g.renderTasks||=new Set).add(v);const b=v.task;Promise.all([g.displayReadyCapability.promise,c]).then((e=>{var t;let[i,n]=e;if(this.#n)complete();else{null===(t=this._stats)||void 0===t||t.time("Rendering");v.initializeGraphics({transparency:i,optionalContentConfig:n});v.operatorListChanged()}})).catch(complete);return b}getOperatorList(){let{intent:e="display",annotationMode:t=_util.AnnotationMode.ENABLE,printAnnotationStorage:i=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=this._transport.getRenderingIntent(e,t,i,!0);let r,s=this._intentStates.get(n.cacheKey);if(!s){s=Object.create(null);this._intentStates.set(n.cacheKey,s)}if(!s.opListReadCapability){var a;r=Object.create(null);r.operatorListChanged=function operatorListChanged(){if(s.operatorList.lastChunk){s.opListReadCapability.resolve(s.operatorList);s.renderTasks.delete(r)}};s.opListReadCapability=new _util.PromiseCapability;(s.renderTasks||=new Set).add(r);s.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null};null===(a=this._stats)||void 0===a||a.time("Page Request");this._pumpOperatorList(n)}return s.opListReadCapability.promise}streamTextContent(){let{includeMarkedContent:e=!1,disableNormalization:t=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===e,disableNormalization:!0===t},{highWaterMark:100,size:e=>e.items.length})}getTextContent(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};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(),r={items:[],styles:Object.create(null)};!function pump(){n.read().then((function(t){let{value:i,done:n}=t;if(n)e(r);else{Object.assign(r.styles,i.styles);r.items.push(...i.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.#n=!1;this.#r();return Promise.all(e)}cleanup(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.#n=!0;const t=this.#s(!1);e&&t&&(this._stats&&=new _display_utils.StatTimer);return t}#s(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.#r();if(!this.#n)return!1;if(e){this.#i=setTimeout((()=>{this.#i=null;this.#s(!1)}),DELAYED_CLEANUP_TIMEOUT);return!1}for(const{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;this._intentStates.clear();this.objs.clear();this.#n=!1;return!0}#r(){if(this.#i){clearTimeout(this.#i);this.#i=null}}_startRenderPage(e,t){var i,n;const r=this._intentStates.get(t);if(r){null===(i=this._stats)||void 0===i||i.timeEnd("Page Request");null===(n=r.displayReadyCapability)||void 0===n||n.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.#s(!0)}_pumpOperatorList(e){let{renderingIntent:t,cacheKey:i,annotationStorageMap:n}=e;const r=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:i,annotationStorage:n}).getReader(),s=this._intentStates.get(i);s.streamReader=r;const pump=()=>{r.read().then((e=>{let{value:t,done:i}=e;if(i)s.streamReader=null;else if(!this._transport.destroyed){this._renderPageChunk(t,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.#s(!0)}if(s.displayReadyCapability)s.displayReadyCapability.reject(e);else{if(!s.opListReadCapability)throw e;s.opListReadCapability.reject(e)}}}))};pump()}_abortOperatorList(e){let{intentState:t,reason:i,force:n=!1}=e;if(t.streamReader){if(t.streamReaderCancelTimeout){clearTimeout(t.streamReaderCancelTimeout);t.streamReaderCancelTimeout=null}if(!n){if(t.renderTasks.size>0)return;if(i instanceof _display_utils.RenderingCancelledException){let e=RENDERING_CANCELLED_TIMEOUT;i.extraDelay>0&&i.extraDelay<1e3&&(e+=i.extraDelay);t.streamReaderCancelTimeout=setTimeout((()=>{t.streamReaderCancelTimeout=null;this._abortOperatorList({intentState:t,reason:i,force:!0})}),e);return}}t.streamReader.cancel(new _util.AbortException(i.message)).catch((()=>{}));t.streamReader=null;if(!this._transport.destroyed){for(const[e,i]of this._intentStates)if(i===t){this._intentStates.delete(e);break}this.cleanup()}}}get stats(){return this._stats}}exports.PDFPageProxy=PDFPageProxy;class LoopbackPort{#a=new Set;#o=Promise.resolve();postMessage(e,t){const i={data:structuredClone(e,null)};this.#o.then((()=>{for(const e of this.#a)e.call(this,i)}))}addEventListener(e,t){this.#a.add(t)}removeEventListener(e,t){this.#a.delete(t)}terminate(){this.#a.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){var _document,_document$currentScri;const e=null===(_document=document)||void 0===_document||null===(_document$currentScri=_document.currentScript)||void 0===_document$currentScri?void 0:_document$currentScri.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#l=new WeakMap;constructor(){let{name:e=null,port:t=null,verbosity:i=(0,_util.getVerbosityLevel)()}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(t&&PDFWorker.#l.has(t))throw new Error("Cannot use more than one PDFWorker per port.");this.name=e;this.destroyed=!1;this.verbosity=i;this._readyCapability=new _util.PromiseCapability;this._port=null;this._webWorker=null;this._messageHandler=null;if(t){PDFWorker.#l.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})}#c(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.#c(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 r=new _message_handler.MessageHandler(i,i+"_worker",t);this._messageHandler=r;this._readyCapability.resolve();r.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.#l.delete(this._port);this._port=null;if(this._messageHandler){this._messageHandler.destroy();this._messageHandler=null}}static fromPort(e){if(null==e||!e.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return this.#l.has(e.port)?this.#l.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{var e;return(null===(e=globalThis.pdfjsWorker)||void 0===e?void 0:e.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{#d=new Map;#h=new Map;#u=new Map;constructor(e,t,i,n,r){this.messageHandler=e;this.loadingTask=t;this.commonObjs=new PDFObjects;this.fontLoader=new _font_loader.FontLoader({ownerDocument:n.ownerDocument,styleElement:n.styleElement});this._params=n;this.canvasFactory=r.canvasFactory;this.filterFactory=r.filterFactory;this.cMapReaderFactory=r.cMapReaderFactory;this.standardFontDataFactory=r.standardFontDataFactory;this.destroyed=!1;this.destroyCapability=null;this._passwordCapability=null;this._networkStream=i;this._fullReader=null;this._lastProgress=null;this.downloadInfoCapability=new _util.PromiseCapability;this.setupMessageHandler()}#p(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=this.#d.get(e);if(i)return i;const n=this.messageHandler.sendWithPromise(e,t);this.#d.set(e,n);return n}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}getRenderingIntent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_util.AnnotationMode.ENABLE,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=_util.RenderingIntentFlag.DISPLAY,s=null;switch(e){case"any":r=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":r=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${e}`)}switch(t){case _util.AnnotationMode.DISABLE:r+=_util.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case _util.AnnotationMode.ENABLE:break;case _util.AnnotationMode.ENABLE_FORMS:r+=_util.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case _util.AnnotationMode.ENABLE_STORAGE:r+=_util.RenderingIntentFlag.ANNOTATIONS_STORAGE;s=(r&_util.RenderingIntentFlag.PRINT&&i instanceof _annotation_storage.PrintAnnotationStorage?i:this.annotationStorage).serializable;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${t}`)}n&&(r+=_util.RenderingIntentFlag.OPLIST);return{renderingIntent:r,cacheKey:`${r}_${_annotation_storage.AnnotationStorage.getHash(s)}`,annotationStorageMap:s}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0;this.destroyCapability=new _util.PromiseCapability;this._passwordCapability&&this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const t of this.#h.values())e.push(t._destroy());this.#h.clear();this.#u.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.#d.clear();this.filterFactory.destroy();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(e){let{value:i,done:n}=e;if(n)t.close();else{(0,_util.assert)(i instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer.");t.enqueue(new Uint8Array(i),1,[i])}})).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=new _util.PromiseCapability,n=this._fullReader;n.headersReady.then((()=>{if(!n.isStreamingSupported||!n.isRangeSupported){if(this._lastProgress){var e;null===(e=t.onProgress)||void 0===e||e.call(t,this._lastProgress)}n.onProgress=e=>{var i;null===(i=t.onProgress)||void 0===i||i.call(t,{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(e){let{value:i,done:n}=e;if(n)t.close();else{(0,_util.assert)(i instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer.");t.enqueue(new Uint8Array(i),1,[i])}})).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",(e=>{let{pdfInfo:i}=e;this._numPages=i.numPages;this._htmlForXfa=i.htmlForXfa;delete i.htmlForXfa;t._capability.resolve(new PDFDocumentProxy(i,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=new _util.PromiseCapability;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=>{var i;null===(i=t.onProgress)||void 0===i||i.call(t,{loaded:e.length,total:e.length});this.downloadInfoCapability.resolve(e)}));e.on("StartRenderPage",(e=>{if(this.destroyed)return;this.#h.get(e.pageIndex)._startRenderPage(e.transparency,e.cacheKey)}));e.on("commonobj",(t=>{var i;let[n,r,s]=t;if(!this.destroyed&&!this.commonObjs.has(n))switch(r){case"Font":const t=this._params;if("error"in s){const e=s.error;(0,_util.warn)(`Error during font loading: ${e}`);this.commonObjs.resolve(n,e);break}const a=t.pdfBug&&null!==(i=globalThis.FontInspector)&&void 0!==i&&i.enabled?(e,t)=>globalThis.FontInspector.fontAdded(e,t):null,o=new _font_loader.FontFaceObject(s,{isEvalSupported:t.isEvalSupported,disableFontFace:t.disableFontFace,ignoreErrors:t.ignoreErrors,inspectFont:a});this.fontLoader.bind(o).catch((t=>e.sendWithPromise("FontFallback",{id:n}))).finally((()=>{!t.fontExtraProperties&&o.data&&(o.data=null);this.commonObjs.resolve(n,o)}));break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(n,s);break;default:throw new Error(`Got unknown common object type ${r}`)}}));e.on("obj",(e=>{let[t,i,n,r]=e;if(this.destroyed)return;const s=this.#h.get(i);if(!s.objs.has(t))switch(n){case"Image":s.objs.resolve(t,r);if(r){let e;if(r.bitmap){const{width:t,height:i}=r;e=t*i*4}else{var a;e=(null===(a=r.data)||void 0===a?void 0:a.length)||0}e>_util.MAX_IMAGE_SIZE_TO_CACHE&&(s._maybeCleanupAfterRender=!0)}break;case"Pattern":s.objs.resolve(t,r);break;default:throw new Error(`Got unknown object type ${n}`)}}));e.on("DocProgress",(e=>{var i;this.destroyed||null===(i=t.onProgress)||void 0===i||i.call(t,{loaded:e.loaded,total:e.total})}));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."))))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var e;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:(null===(e=this._fullReader)||void 0===e?void 0:e.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.#u.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.pdfBug);this.#h.set(t,i);return i}));this.#u.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.#p("GetFieldObjects")}hasJSActions(){return this.#p("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.#d.get(e);if(t)return t;const i=this.messageHandler.sendWithPromise(e,null).then((e=>{var t,i;return{info:e[0],metadata:e[1]?new _metadata.Metadata(e[1]):null,contentDispositionFilename:(null===(t=this._fullReader)||void 0===t?void 0:t.filename)??null,contentLength:(null===(i=this._fullReader)||void 0===i?void 0:i.contentLength)??null}}));this.#d.set(e,i);return i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const e of this.#h.values()){if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`)}this.commonObjs.clear();e||this.fontLoader.clear();this.#d.clear();this.filterFactory.destroy(!0)}}get loadingParams(){const{disableAutoFetch:e,enableXfa:t}=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:e,enableXfa:t})}}class PDFObjects{#g=Object.create(null);#f(e){const t=this.#g[e];return t||(this.#g[e]={capability:new _util.PromiseCapability,data:null})}get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t){const i=this.#f(e);i.capability.promise.then((()=>t(i.data)));return null}const i=this.#g[e];if(null==i||!i.capability.settled)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return i.data}has(e){const t=this.#g[e];return(null==t?void 0:t.capability.settled)||!1}resolve(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=this.#f(e);i.data=t;i.capability.resolve()}clear(){for(const t in this.#g){var e;const{data:i}=this.#g[t];null==i||null===(e=i.bitmap)||void 0===e||e.close()}this.#g=Object.create(null)}}class RenderTask{#m=null;constructor(e){this.#m=e;this.onContinue=null}get promise(){return this.#m.capability.promise}cancel(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.#m.cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=this.#m.operatorList;if(!e)return!1;const{annotationCanvasMap:t}=this.#m;return e.form||e.canvas&&(null==t?void 0:t.size)>0}}exports.RenderTask=RenderTask;class InternalRenderTask{static#v=new WeakSet;constructor(e){let{callback:t,params:i,objs:n,commonObjs:r,annotationCanvasMap:s,operatorList:a,pageIndex:o,canvasFactory:l,filterFactory:c,useRequestAnimationFrame:d=!1,pdfBug:h=!1,pageColors:u=null}=e;this.callback=t;this.params=i;this.objs=n;this.commonObjs=r;this.annotationCanvasMap=s;this.operatorListIdx=null;this.operatorList=a;this._pageIndex=o;this.canvasFactory=l;this.filterFactory=c;this._pdfBug=h;this.pageColors=u;this.running=!1;this.graphicsReadyCallback=null;this.graphicsReady=!1;this._useRequestAnimationFrame=!0===d&&"undefined"!=typeof window;this.cancelled=!1;this.capability=new _util.PromiseCapability;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=i.canvasContext.canvas}get completed(){return this.capability.promise.catch((function(){}))}initializeGraphics(e){var t,i;let{transparency:n=!1,optionalContentConfig:r}=e;if(this.cancelled)return;if(this._canvas){if(InternalRenderTask.#v.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.#v.add(this._canvas)}if(this._pdfBug&&null!==(t=globalThis.StepperManager)&&void 0!==t&&t.enabled){this.stepper=globalThis.StepperManager.create(this._pageIndex);this.stepper.init(this.operatorList);this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint()}const{canvasContext:s,viewport:a,transform:o,background:l}=this.params;this.gfx=new _canvas.CanvasGraphics(s,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:r},this.annotationCanvasMap,this.pageColors);this.gfx.beginDrawing({transform:o,viewport:a,transparency:n,background:l});this.operatorListIdx=0;this.graphicsReady=!0;null===(i=this.graphicsReadyCallback)||void 0===i||i.call(this)}cancel(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.running=!1;this.cancelled=!0;null===(e=this.gfx)||void 0===e||e.endDrawing();this._canvas&&InternalRenderTask.#v.delete(this._canvas);this.callback(t||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,"canvas",i))}operatorListChanged(){var e;if(this.graphicsReady){null===(e=this.stepper)||void 0===e||e.updateOperatorList(this.operatorList);this.running||this._continue()}else 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.pageColors);this._canvas&&InternalRenderTask.#v.delete(this._canvas);this.callback()}}}}}const version="3.7.506";exports.version=version;const build="10381092e";exports.build=build},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PrintAnnotationStorage=t.AnnotationStorage=void 0;var n=i(1),r=i(139),s=i(143);class AnnotationStorage{#b=!1;#y=new Map;constructor(){this.onSetModified=null;this.onResetModified=null;this.onAnnotationEditor=null}getValue(e,t){const i=this.#y.get(e);return void 0===i?t:Object.assign(t,i)}getRawValue(e){return this.#y.get(e)}remove(e){this.#y.delete(e);0===this.#y.size&&this.resetModified();if("function"==typeof this.onAnnotationEditor){for(const e of this.#y.values())if(e instanceof r.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(e,t){const i=this.#y.get(e);let n=!1;if(void 0!==i){for(const[e,r]of Object.entries(t))if(i[e]!==r){n=!0;i[e]=r}}else{n=!0;this.#y.set(e,t)}n&&this.#w();t instanceof r.AnnotationEditor&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(t.constructor._type)}has(e){return this.#y.has(e)}getAll(){return this.#y.size>0?(0,n.objectFromMap)(this.#y):null}setAll(e){for(const[t,i]of Object.entries(e))this.setValue(t,i)}get size(){return this.#y.size}#w(){if(!this.#b){this.#b=!0;"function"==typeof this.onSetModified&&this.onSetModified()}}resetModified(){if(this.#b){this.#b=!1;"function"==typeof this.onResetModified&&this.onResetModified()}}get print(){return new PrintAnnotationStorage(this)}get serializable(){if(0===this.#y.size)return null;const e=new Map;for(const[t,i]of this.#y){const n=i instanceof r.AnnotationEditor?i.serialize():i;n&&e.set(t,n)}return e}static getHash(e){if(!e)return"";const t=new s.MurmurHash3_64;for(const[i,n]of e)t.update(`${i}:${JSON.stringify(n)}`);return t.hexdigest()}}t.AnnotationStorage=AnnotationStorage;class PrintAnnotationStorage extends AnnotationStorage{#_=null;constructor(e){super();this.#_=structuredClone(e.serializable)}get print(){(0,n.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#_}}t.PrintAnnotationStorage=PrintAnnotationStorage},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.AnnotationEditor=void 0;var n=i(140),r=i(1);class AnnotationEditor{#S=this.focusin.bind(this);#P=this.focusout.bind(this);#A=!1;#E=!1;#x=!1;_uiManager=null;#C=AnnotationEditor._zIndex++;static _colorManager=new n.ColorManager;static _zIndex=1;constructor(e){this.constructor===AnnotationEditor&&(0,r.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:s,pageY:a}}=this.parent.viewport;this.rotation=t;this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360;this.pageDimensions=[i,n];this.pageTranslation=[s,a];const[o,l]=this.parentDimensions;this.x=e.x/o;this.y=e.y/l;this.isAttachedToDOM=!1}static get _defaultLineColor(){return(0,r.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.#C}setParent(e){if(null!==e){this.pageIndex=e.pageIndex;this.pageDimensions=e.pageDimensions}this.parent=e}focusin(e){this.#A?this.#A=!1:this.parent.setSelected(this)}focusout(e){var t;if(!this.isAttachedToDOM)return;const i=e.relatedTarget;if(null==i||!i.closest(`#${this.id}`)){e.preventDefault();null!==(t=this.parent)&&void 0!==t&&t.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[r,s]=this.parentDimensions;[i,n]=this.screenToPageTranslation(i,n);this.x=(e+i)/r;this.y=(t+n)/s;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+this.pageRotation)%360}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("%"),r=t.endsWith("%");if(n&&r)return;const[s,a]=this.parentDimensions;n||(e.width=100*parseFloat(i)/s+"%");r||(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.#S);this.div.addEventListener("focusout",this.#P);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}=r.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.#A=!0}}getRect(e,t){const i=this.parentScale,[n,r]=this.pageDimensions,[s,a]=this.pageTranslation,o=e/i,l=t/i,c=this.x*n,d=this.y*r,h=this.width*n,u=this.height*r;switch(this.rotation){case 0:return[c+o+s,r-d-l-u+a,c+o+h+s,r-d-l+a];case 90:return[c+l+s,r-d+o+a,c+l+u+s,r-d+o+h+a];case 180:return[c-o-h+s,r-d+l+a,c-o+s,r-d+l+u+a];case 270:return[c-l-u+s,r-d-o-h+a,c-l+s,r-d-o+a];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,t){const[i,n,r,s]=e,a=r-i,o=s-n;switch(this.rotation){case 0:return[i,t-s,a,o];case 90:return[i,t-n,o,a];case 180:return[r,t-n,a,o];case 270:return[r,t-s,o,a];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#x=!0}disableEditMode(){this.#x=!1}isInEditMode(){return this.#x}shouldGetKeyboardEvents(){return!1}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){var e;null===(e=this.div)||void 0===e||e.addEventListener("focusin",this.#S)}serialize(){(0,r.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[r,s]=n.pageDimensions,[a,o,l,c]=n.getRectInCurrentCoords(e.rect,s);n.x=a/r;n.y=o/s;n.width=l/r;n.height=c/s;return n}remove(){this.div.removeEventListener("focusin",this.#S);this.div.removeEventListener("focusout",this.#P);this.isEmpty()||this.commit();this.parent.remove(this)}select(){var e;null===(e=this.div)||void 0===e||e.classList.add("selectedEditor")}unselect(){var e;null===(e=this.div)||void 0===e||e.classList.remove("selectedEditor")}updateParams(e,t){}disableEditing(){}enableEditing(){}get propertiesToUpdate(){return{}}get contentDiv(){return this.div}get isEditing(){return this.#E}set isEditing(e){this.#E=e;if(e){this.parent.setSelected(this);this.parent.setActiveEditor(this)}else this.parent.setActiveEditor(null)}}t.AnnotationEditor=AnnotationEditor},(e,t,i)=>{"use strict";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),r=i(141);class IdManager{#T=0;getId(){return`${n.AnnotationEditorPrefix}${this.#T++}`}}class CommandManager{#M=[];#I=!1;#k;#D=-1;constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:128;this.#k=e}add(e){let{cmd:t,undo:i,mustExec:n,type:r=NaN,overwriteIfSameType:s=!1,keepUndo:a=!1}=e;n&&t();if(this.#I)return;const o={cmd:t,undo:i,type:r};if(-1===this.#D){this.#M.length>0&&(this.#M.length=0);this.#D=0;this.#M.push(o);return}if(s&&this.#M[this.#D].type===r){a&&(o.undo=this.#M[this.#D].undo);this.#M[this.#D]=o;return}const l=this.#D+1;if(l===this.#k)this.#M.splice(0,1);else{this.#D=l;l<this.#M.length&&this.#M.splice(l)}this.#M.push(o)}undo(){if(-1!==this.#D){this.#I=!0;this.#M[this.#D].undo();this.#I=!1;this.#D-=1}}redo(){if(this.#D<this.#M.length-1){this.#D+=1;this.#I=!0;this.#M[this.#D].cmd();this.#I=!1}}hasSomethingToUndo(){return-1!==this.#D}hasSomethingToRedo(){return this.#D<this.#M.length-1}destroy(){this.#M=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))}}}#F(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.#F(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,r.getColorValues)(e);return(0,n.shadow)(this,"_colors",e)}convert(e){const t=(0,r.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{#L=null;#R=new Map;#O=new Map;#N=null;#B=new CommandManager;#V=0;#U=null;#j=new Set;#H=null;#W=new IdManager;#z=!1;#G=n.AnnotationEditorType.NONE;#q=new Set;#$=this.copy.bind(this);#X=this.cut.bind(this);#K=this.paste.bind(this);#Y=this.keydown.bind(this);#Q=this.onEditingAction.bind(this);#Z=this.onPageChanging.bind(this);#J=this.onScaleChanging.bind(this);#ee=this.onRotationChanging.bind(this);#te={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1};#ie=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.#ie=e;this.#H=t;this.#H._on("editingaction",this.#Q);this.#H._on("pagechanging",this.#Z);this.#H._on("scalechanging",this.#J);this.#H._on("rotationchanging",this.#ee);this.#N=i;this.viewParameters={realScale:r.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0}}destroy(){this.#ne();this.#H._off("editingaction",this.#Q);this.#H._off("pagechanging",this.#Z);this.#H._off("scalechanging",this.#J);this.#H._off("rotationchanging",this.#ee);for(const e of this.#O.values())e.destroy();this.#O.clear();this.#R.clear();this.#j.clear();this.#L=null;this.#q.clear();this.#B.destroy()}onPageChanging(e){let{pageNumber:t}=e;this.#V=t-1}focusMainContainer(){this.#ie.focus()}addShouldRescale(e){this.#j.add(e)}removeShouldRescale(e){this.#j.delete(e)}onScaleChanging(e){let{scale:t}=e;this.commitOrRemove();this.viewParameters.realScale=t*r.PixelsPerInch.PDF_TO_CSS_UNITS;for(const e of this.#j)e.onScaleChanging()}onRotationChanging(e){let{pagesRotation:t}=e;this.commitOrRemove();this.viewParameters.rotation=t}addToAnnotationStorage(e){e.isEmpty()||!this.#N||this.#N.has(e.id)||this.#N.setValue(e.id,e)}#re(){this.#ie.addEventListener("keydown",this.#Y)}#ne(){this.#ie.removeEventListener("keydown",this.#Y)}#se(){document.addEventListener("copy",this.#$);document.addEventListener("cut",this.#X);document.addEventListener("paste",this.#K)}#ae(){document.removeEventListener("copy",this.#$);document.removeEventListener("cut",this.#X);document.removeEventListener("paste",this.#K)}copy(e){e.preventDefault();this.#L&&this.#L.commitOrRemove();if(!this.hasSelection)return;const t=[];for(const e of this.#q)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.#O.get(this.#V);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.#oe(t);this.#le(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){var t;null!==(t=this.getActive())&&void 0!==t&&t.shouldGetKeyboardEvents()||AnnotationEditorUIManager._keyboardManager.exec(this,e)}onEditingAction(e){["undo","redo","delete","selectAll"].includes(e.name)&&this[e.name]()}#ce(e){Object.entries(e).some((e=>{let[t,i]=e;return this.#te[t]!==i}))&&this.#H.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#te,e)})}#de(e){this.#H.dispatch("annotationeditorparamschanged",{source:this,details:e})}setEditingState(e){if(e){this.#re();this.#se();this.#ce({isEditing:this.#G!==n.AnnotationEditorType.NONE,isEmpty:this.#he(),hasSomethingToUndo:this.#B.hasSomethingToUndo(),hasSomethingToRedo:this.#B.hasSomethingToRedo(),hasSelectedEditor:!1})}else{this.#ne();this.#ae();this.#ce({isEditing:!1})}}registerEditorTypes(e){if(!this.#U){this.#U=e;for(const e of this.#U)this.#de(e.defaultPropertiesToUpdate)}}getId(){return this.#W.getId()}get currentLayer(){return this.#O.get(this.#V)}get currentPageIndex(){return this.#V}addLayer(e){this.#O.set(e.pageIndex,e);this.#z?e.enable():e.disable()}removeLayer(e){this.#O.delete(e.pageIndex)}updateMode(e){this.#G=e;if(e===n.AnnotationEditorType.NONE){this.setEditingState(!1);this.#ue()}else{this.setEditingState(!0);this.#pe();for(const t of this.#O.values())t.updateMode(e)}}updateToolbar(e){e!==this.#G&&this.#H.dispatch("switchannotationeditormode",{source:this,mode:e})}updateParams(e,t){if(this.#U){for(const i of this.#q)i.updateParams(e,t);for(const i of this.#U)i.updateDefaultParams(e,t)}}#pe(){if(!this.#z){this.#z=!0;for(const e of this.#O.values())e.enable()}}#ue(){this.unselectAll();if(this.#z){this.#z=!1;for(const e of this.#O.values())e.disable()}}getEditors(e){const t=[];for(const i of this.#R.values())i.pageIndex===e&&t.push(i);return t}getEditor(e){return this.#R.get(e)}addEditor(e){this.#R.set(e.id,e)}removeEditor(e){var t;this.#R.delete(e.id);this.unselect(e);null===(t=this.#N)||void 0===t||t.remove(e.id)}#oe(e){const t=this.#O.get(e.pageIndex);t?t.addOrRebuild(e):this.addEditor(e)}setActiveEditor(e){if(this.#L!==e){this.#L=e;e&&this.#de(e.propertiesToUpdate)}}toggleSelected(e){if(this.#q.has(e)){this.#q.delete(e);e.unselect();this.#ce({hasSelectedEditor:this.hasSelection})}else{this.#q.add(e);e.select();this.#de(e.propertiesToUpdate);this.#ce({hasSelectedEditor:!0})}}setSelected(e){for(const t of this.#q)t!==e&&t.unselect();this.#q.clear();this.#q.add(e);e.select();this.#de(e.propertiesToUpdate);this.#ce({hasSelectedEditor:!0})}isSelected(e){return this.#q.has(e)}unselect(e){e.unselect();this.#q.delete(e);this.#ce({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#q.size}undo(){this.#B.undo();this.#ce({hasSomethingToUndo:this.#B.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#he()})}redo(){this.#B.redo();this.#ce({hasSomethingToUndo:!0,hasSomethingToRedo:this.#B.hasSomethingToRedo(),isEmpty:this.#he()})}addCommands(e){this.#B.add(e);this.#ce({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#he()})}#he(){if(0===this.#R.size)return!0;if(1===this.#R.size)for(const e of this.#R.values())return e.isEmpty();return!1}delete(){this.commitOrRemove();if(!this.hasSelection)return;const e=[...this.#q];this.addCommands({cmd:()=>{for(const t of e)t.remove()},undo:()=>{for(const t of e)this.#oe(t)},mustExec:!0})}commitOrRemove(){var e;null===(e=this.#L)||void 0===e||e.commitOrRemove()}#le(e){this.#q.clear();for(const t of e)if(!t.isEmpty()){this.#q.add(t);t.select()}this.#ce({hasSelectedEditor:!0})}selectAll(){for(const e of this.#q)e.commit();this.#le(this.#R.values())}unselectAll(){if(this.#L)this.#L.commitOrRemove();else if(0!==this.#q.size){for(const e of this.#q)e.unselect();this.#q.clear();this.#ce({hasSelectedEditor:!1})}}isActive(e){return this.#L===e}getActive(){return this.#L}getMode(){return this.#G}}t.AnnotationEditorUIManager=AnnotationEditorUIManager},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.StatTimer=t.RenderingCancelledException=t.PixelsPerInch=t.PageViewport=t.PDFDateString=t.DOMStandardFontDataFactory=t.DOMSVGFactory=t.DOMFilterFactory=t.DOMCanvasFactory=t.DOMCMapReaderFactory=t.AnnotationPrefix=void 0;t.deprecated=function deprecated(e){globalThis.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:r,e:s,f:a}=e.getTransform();return[t,i,n,r,s,a]};t.getCurrentTransformInverse=function getCurrentTransformInverse(e){const{a:t,b:i,c:n,d:r,e:s,f:a}=e.getTransform().invertSelf();return[t,i,n,r,s,a]};t.getFilenameFromUrl=function getFilenameFromUrl(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]||([e]=e.split(/[#?]/,1));return e.substring(e.lastIndexOf("/")+1)};t.getPdfFilenameFromUrl=function getPdfFilenameFromUrl(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"document.pdf";if(window.PDFViewerApplication.appConfig.filenameForDownload)return window.PDFViewerApplication.appConfig.filenameForDownload;if("string"!=typeof e)return t;if(isDataScheme(e)){(0,r.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.');return t}const i=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,n=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(e);let s=i.exec(n[1])||i.exec(n[2])||i.exec(n[3]);if(s){s=s[0];if(s.includes("%"))try{s=i.exec(decodeURIComponent(s))[0]}catch(e){}}return s||t};t.getRGB=getRGB;t.getXfaPageViewport=function getXfaPageViewport(e,t){let{scale:i=1,rotation:n=0}=t;const{width:r,height:s}=e.attributes.style,a=[0,0,parseInt(r),parseInt(s)];return new PageViewport({viewBox:a,scale:i,rotation:n})};t.isDataScheme=isDataScheme;t.isPdfFile=function isPdfFile(e){return"string"==typeof e&&/\.pdf$/i.test(e)};t.isValidFetchUrl=isValidFetchUrl;t.loadScript=function loadScript(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new Promise(((i,n)=>{const r=document.createElement("script");let s=e;"Function"===e.constructor.name&&(s=e());const a=function generateTrustedURL(e){if(window.trustedTypes){return window.trustedTypes.createPolicy("foo",{createScriptURL:e=>e}).createScriptURL(e)}return e}(s);r.src=a;r.onload=function(e){t&&r.remove();i(e)};r.onerror=function(e){globalThis.ngxConsole.log(e);n(new Error(`Cannot load script at: ${r.src}`))};(document.head||document.documentElement).append(r)}))};t.setLayerDimensions=function setLayerDimensions(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(t instanceof PageViewport){const{pageWidth:n,pageHeight:r}=t.rawDims,{style:s}=e,a=`calc(var(--scale-factor) * ${n}px)`,o=`calc(var(--scale-factor) * ${r}px)`;if(i&&t.rotation%180!=0){s.width=o;s.height=a}else{s.width=a;s.height=o}}n&&e.setAttribute("data-main-rotation",t.rotation)};var n=i(142),r=i(1);const s="http://www.w3.org/2000/svg";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 DOMFilterFactory extends n.BaseFilterFactory{#ge;#fe;#t;#me;#ve;#be;#ye;#T=0;constructor(){let{docId:e,ownerDocument:t=globalThis.document}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super();this.#t=e;this.#me=t}get#we(){return this.#ge||=new Map}get#_e(){if(!this.#fe){const e=this.#me.createElement("div"),{style:t}=e;t.visibility="hidden";t.contain="strict";t.width=t.height=0;t.position="absolute";t.top=t.left=0;t.zIndex=-1;const i=this.#me.createElementNS(s,"svg");i.setAttribute("width",0);i.setAttribute("height",0);this.#fe=this.#me.createElementNS(s,"defs");e.append(i);i.append(this.#fe);this.#me.body.append(e)}return this.#fe}#Se(e,t,i){const n=this.#me.createElementNS(s,t);n.setAttribute("type","discrete");n.setAttribute("tableValues",i);e.append(n)}addFilter(e){if(!e)return"none";let t,i,n,r,a=this.#we.get(e);if(a)return a;if(1===e.length){const s=e[0],a=new Array(256);for(let e=0;e<256;e++)a[e]=s[e]/255;r=t=i=n=a.join(",")}else{const[s,a,o]=e,l=new Array(256),c=new Array(256),d=new Array(256);for(let e=0;e<256;e++){l[e]=s[e]/255;c[e]=a[e]/255;d[e]=o[e]/255}t=l.join(",");i=c.join(",");n=d.join(",");r=`${t}${i}${n}`}a=this.#we.get(r);if(a){this.#we.set(e,a);return a}const o=`g_${this.#t}_transfer_map_${this.#T++}`,l=`url(#${o})`;this.#we.set(e,l);this.#we.set(r,l);const c=this.#me.createElementNS(s,"filter",s);c.setAttribute("id",o);c.setAttribute("color-interpolation-filters","sRGB");const d=this.#me.createElementNS(s,"feComponentTransfer");c.append(d);this.#Se(d,"feFuncR",t);this.#Se(d,"feFuncG",i);this.#Se(d,"feFuncB",n);this.#_e.append(c);return l}addHCMFilter(e,t){var i;const n=`${e}-${t}`;if(this.#be===n)return this.#ye;this.#be=n;this.#ye="none";null===(i=this.#ve)||void 0===i||i.remove();if(!e||!t)return this.#ye;this.#_e.style.color=e;const a=getRGB(e=getComputedStyle(this.#_e).getPropertyValue("color"));e=r.Util.makeHexColor(...a);this.#_e.style.color=t;const o=getRGB(t=getComputedStyle(this.#_e).getPropertyValue("color"));t=r.Util.makeHexColor(...o);this.#_e.style.color="";if("#000000"===e&&"#ffffff"===t||e===t)return this.#ye;const l=new Array(256);for(let e=0;e<=255;e++){const t=e/255;l[e]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}const c=l.join(","),d=`g_${this.#t}_hcm_filter`,h=this.#ve=this.#me.createElementNS(s,"filter",s);h.setAttribute("id",d);h.setAttribute("color-interpolation-filters","sRGB");let u=this.#me.createElementNS(s,"feComponentTransfer");h.append(u);this.#Se(u,"feFuncR",c);this.#Se(u,"feFuncG",c);this.#Se(u,"feFuncB",c);const p=this.#me.createElementNS(s,"feColorMatrix");p.setAttribute("type","matrix");p.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0");h.append(p);u=this.#me.createElementNS(s,"feComponentTransfer");h.append(u);const getSteps=(e,t)=>{const i=a[e]/255,n=o[e]/255,r=new Array(t+1);for(let e=0;e<=t;e++)r[e]=i+e/t*(n-i);return r.join(",")};this.#Se(u,"feFuncR",getSteps(0,5));this.#Se(u,"feFuncG",getSteps(1,5));this.#Se(u,"feFuncB",getSteps(2,5));this.#_e.append(h);this.#ye=`url(#${d})`;return this.#ye}destroy(){if(!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])||!this.#ye){if(this.#fe){this.#fe.parentNode.parentNode.remove();this.#fe=null}if(this.#ge){this.#ge.clear();this.#ge=null}this.#T=0}}}t.DOMFilterFactory=DOMFilterFactory;class DOMCanvasFactory extends n.BaseCanvasFactory{constructor(){let{ownerDocument:e=globalThis.document}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};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){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[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,r.stringToBytes)(await i.text())}return new Promise(((i,n)=>{const s=new XMLHttpRequest;s.open("GET",e,!0);t&&(s.responseType="arraybuffer");s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE){if(200===s.status||0===s.status){let e;t&&s.response?e=new Uint8Array(s.response):!t&&s.responseText&&(e=(0,r.stringToBytes)(s.responseText));if(e){i(e);return}}n(new Error(s.statusText))}};s.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(s,e)}}t.DOMSVGFactory=DOMSVGFactory;class PageViewport{constructor(e){let{viewBox:t,scale:i,rotation:n,offsetX:r=0,offsetY:s=0,dontFlip:a=!1}=e;this.viewBox=t;this.scale=i;this.rotation=n;this.offsetX=r;this.offsetY=s;const o=(t[2]+t[0])/2,l=(t[3]+t[1])/2;let c,d,h,u,p,g,f,m;n%=360;n<0&&(n+=360);switch(n){case 180:c=-1;d=0;h=0;u=1;break;case 90:c=0;d=1;h=1;u=0;break;case 270:c=0;d=-1;h=-1;u=0;break;case 0:c=1;d=0;h=0;u=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}if(a){h=-h;u=-u}if(0===c){p=Math.abs(l-t[1])*i+r;g=Math.abs(o-t[0])*i+s;f=(t[3]-t[1])*i;m=(t[2]-t[0])*i}else{p=Math.abs(o-t[0])*i+r;g=Math.abs(l-t[1])*i+s;f=(t[2]-t[0])*i;m=(t[3]-t[1])*i}this.transform=[c*i,d*i,h*i,u*i,p-c*i*o-h*i*l,g-d*i*o-u*i*l];this.width=f;this.height=m}get rawDims(){const{viewBox:e}=this;return(0,r.shadow)(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone(){let{scale:e=this.scale,rotation:t=this.rotation,offsetX:i=this.offsetX,offsetY:n=this.offsetY,dontFlip:r=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new PageViewport({viewBox:this.viewBox.slice(),scale:e,rotation:t,offsetX:i,offsetY:n,dontFlip:r})}convertToViewportPoint(e,t){return r.Util.applyTransform([e,t],this.transform)}convertToViewportRectangle(e){const t=r.Util.applyTransform([e[0],e[1]],this.transform),i=r.Util.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],i[0],i[1]]}convertToPdfPoint(e,t){return r.Util.applyInverseTransform([e,t],this.transform)}}t.PageViewport=PageViewport;class RenderingCancelledException extends r.BaseException{constructor(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]: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,r.warn)(`Timer is already running for ${e}`);this.started[e]=Date.now()}timeEnd(e){e in this.started||(0,r.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:r}of this.times)e.push(`${i.padEnd(t)} ${r-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 a;t.PDFDateString=class PDFDateString{static toDateObject(e){if(!e||"string"!=typeof e)return null;a||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const t=a.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 r=parseInt(t[3],10);r=r>=1&&r<=31?r:1;let s=parseInt(t[4],10);s=s>=0&&s<=23?s: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 c=t[7]||"Z";let d=parseInt(t[8],10);d=d>=0&&d<=23?d:0;let h=parseInt(t[9],10)||0;h=h>=0&&h<=59?h:0;if("-"===c){s+=d;o+=h}else if("+"===c){s-=d;o-=h}return new Date(Date.UTC(i,n,r,s,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,r.warn)(`Not a valid color format: "${e}"`);return[0,0,0]}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.BaseStandardFontDataFactory=t.BaseSVGFactory=t.BaseFilterFactory=t.BaseCanvasFactory=t.BaseCMapReaderFactory=void 0;var n=i(1);class BaseFilterFactory{constructor(){this.constructor===BaseFilterFactory&&(0,n.unreachable)("Cannot initialize BaseFilterFactory.")}addFilter(e){return"none"}addHCMFilter(e,t){return"none"}destroy(){}}t.BaseFilterFactory=BaseFilterFactory;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,r=i.getContext("2d",n);return{canvas:i,context:r}}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(e){let{baseUrl:t=null,isCompressed:i=!0}=e;this.constructor===BaseCMapReaderFactory&&(0,n.unreachable)("Cannot initialize BaseCMapReaderFactory.");this.baseUrl=t;this.isCompressed=i}async fetch(e){let{name:t}=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(!t)throw new Error("CMap name must be specified.");const i=this.baseUrl+t+(this.isCompressed?".bcmap":""),r=this.isCompressed?n.CMapCompressionType.BINARY:n.CMapCompressionType.NONE;return this._fetchData(i,r).catch((e=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${i}`)}))}_fetchData(e,t){(0,n.unreachable)("Abstract method `_fetchData` called.")}}t.BaseCMapReaderFactory=BaseCMapReaderFactory;class BaseStandardFontDataFactory{constructor(e){let{baseUrl:t=null}=e;this.constructor===BaseStandardFontDataFactory&&(0,n.unreachable)("Cannot initialize BaseStandardFontDataFactory.");this.baseUrl=t}async fetch(e){let{filename:t}=e;if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!t)throw new Error("Font filename must be specified.");const i=`${this.baseUrl}${t}`;return this._fetchData(i).catch((e=>{throw new Error(`Unable to load font data at: ${i}`)}))}_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){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];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)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.MurmurHash3_64=void 0;var n=i(1);const r=3285377520,s=4294901760,a=65535;t.MurmurHash3_64=class MurmurHash3_64{constructor(e){this.h1=e?4294967295&e:r;this.h2=e?4294967295&e:r}update(e){let t,i;if("string"==typeof e){t=new Uint8Array(2*e.length);i=0;for(let n=0,r=e.length;n<r;n++){const r=e.charCodeAt(n);if(r<=255)t[i++]=r;else{t[i++]=r>>>8;t[i++]=255&r}}}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 r=i>>2,o=i-4*r,l=new Uint32Array(t.buffer,0,r);let c=0,d=0,h=this.h1,u=this.h2;const p=3432918353,g=461845907,f=11601,m=13715;for(let e=0;e<r;e++)if(1&e){c=l[e];c=c*p&s|c*f&a;c=c<<15|c>>>17;c=c*g&s|c*m&a;h^=c;h=h<<13|h>>>19;h=5*h+3864292196}else{d=l[e];d=d*p&s|d*f&a;d=d<<15|d>>>17;d=d*g&s|d*m&a;u^=d;u=u<<13|u>>>19;u=5*u+3864292196}c=0;switch(o){case 3:c^=t[4*r+2]<<16;case 2:c^=t[4*r+1]<<8;case 1:c^=t[4*r];c=c*p&s|c*f&a;c=c<<15|c>>>17;c=c*g&s|c*m&a;1&r?h^=c:u^=c}this.h1=h;this.h2=u}hexdigest(){let e=this.h1,t=this.h2;e^=t>>>1;e=3981806797*e&s|36045*e&a;t=4283543511*t&s|(2950163797*(t<<16|e>>>16)&s)>>>16;e^=t>>>1;e=444984403*e&s|60499*e&a;t=3301882366*t&s|(3120437893*(t<<16|e>>>16)&s)>>>16;e^=t>>>1;return(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.FontLoader=t.FontFaceObject=void 0;var n=i(1),r=i(145);t.FontLoader=class FontLoader{#Pe=new Set;constructor(e){let{ownerDocument:t=globalThis.document,styleElement:i=null}=e;this._document=t;this.nativeFontFaces=new Set;this.styleElement=null;this.loadingRequests=[];this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e);this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e);this._document.fonts.delete(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.clear();this.#Pe.clear();if(this.styleElement){this.styleElement.remove();this.styleElement=null}}async loadSystemFont(e){if(e&&!this.#Pe.has(e.loadedName)){(0,n.assert)(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set.");if(this.isFontLoadingAPISupported){const{loadedName:t,src:i,style:r}=e,s=new FontFace(t,i,r);this.addNativeFontFace(s);try{await s.load();this.#Pe.add(t)}catch{(0,n.warn)(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`);this.removeNativeFontFace(s)}}else(0,n.unreachable)("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;e.attached=!0;if(e.systemFontInfo){await this.loadSystemFont(e.systemFontInfo);return}if(this.isFontLoadingAPISupported){const t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(i){(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(){var e;const t=!(null===(e=this._document)||void 0===e||!e.fonts);return(0,n.shadow)(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){let e=!1;(r.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,r;const s=this._document.createElement("canvas");s.width=1;s.height=1;const a=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0}:void 0,o=s.getContext("2d",a);let l=0;const c=`lt${Date.now()}${this.loadTestFontId++}`;let d=this._loadTestFont;d=spliceString(d,976,c.length,c);const h=1482184792;let u=int32(d,16);for(i=0,r=c.length-3;i<r;i+=4)u=u-h+int32(c,i)|0;i<c.length&&(u=u-h+int32(c+"XXX",i)|0);d=spliceString(d,16,4,(0,n.string32)(u));const p=`@font-face {font-family:"${c}";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,c]){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))}(c,(()=>{g.remove();t.complete()}))}};t.FontFaceObject=class FontFaceObject{constructor(e,t){let{isEvalSupported:i=!0,disableFontFace:n=!1,ignoreErrors:r=!1,inspectFont:s=null}=t;this.compiledGlyphs=Object.create(null);for(const t in e)this[t]=e[t];this.isEvalSupported=!1!==i;this.disableFontFace=!0===n;this.ignoreErrors=!0===r;this._inspectFont=s}createNativeFontFace(){var e;if(!this.data||this.disableFontFace)return null;let t;if(this.cssFontInfo){const e={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(e.style=`oblique ${this.cssFontInfo.italicAngle}deg`);t=new FontFace(this.cssFontInfo.fontFamily,this.data,e)}else t=new FontFace(this.loadedName,this.data,{});null===(e=this._inspectFont)||void 0===e||e.call(this,this);return t}createFontFaceRule(){var e;if(!this.data||this.disableFontFace)return null;const t=(0,n.bytesToString)(this.data),i=`url(data:${this.mimetype};base64,${btoa(t)});`;let r;if(this.cssFontInfo){let e=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(e+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`);r=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${e}src:${i}}`}else r=`@font-face {font-family:"${this.loadedName}";src:${i}}`;null===(e=this._inspectFont)||void 0===e||e.call(this,this,i);return r}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;(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)=>{"use strict";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)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.CanvasGraphics=void 0;var n=i(1),r=i(141),s=i(147),a=i(148),o=i(145);const l=4096,c=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,s,a,o,l,c,d){const[h,u,p,g,f,m]=(0,r.getCurrentTransform)(e);if(0===u&&0===p){const r=o*h+f,v=Math.round(r),b=l*g+m,y=Math.round(b),w=(o+c)*h+f,_=Math.abs(Math.round(w)-v)||1,S=(l+d)*g+m,P=Math.abs(Math.round(S)-y)||1;e.setTransform(Math.sign(h),0,0,Math.sign(g),v,y);e.drawImage(t,i,n,s,a,0,0,_,P);e.setTransform(h,u,p,g,f,m);return[_,P]}if(0===h&&0===g){const r=l*p+f,v=Math.round(r),b=o*u+m,y=Math.round(b),w=(l+d)*p+f,_=Math.abs(Math.round(w)-v)||1,S=(o+c)*u+m,P=Math.abs(Math.round(S)-y)||1;e.setTransform(0,Math.sign(u),Math.sign(p),0,v,y);e.drawImage(t,i,n,s,a,0,0,P,_);e.setTransform(h,u,p,g,f,m);return[P,_]}e.drawImage(t,i,n,s,a,o,l,c,d);return[Math.hypot(h,u)*c,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="none";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),r=n.Util.applyTransform(t.slice(2),e);this.minX=Math.min(this.minX,i[0],r[0]);this.minY=Math.min(this.minY,i[1],r[1]);this.maxX=Math.max(this.maxX,i[0],r[0]);this.maxY=Math.max(this.maxY,i[1],r[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,r,s,a,o,l,c,d){const h=n.Util.bezierBoundingBox(t,i,r,s,a,o,l,c);if(d){d[0]=Math.min(d[0],h[0],h[2]);d[1]=Math.max(d[1],h[0],h[2]);d[2]=Math.min(d[2],h[1],h[3]);d[3]=Math.max(d[3],h[1],h[3])}else this.updateRectMinMax(e,h)}getPathBoundingBox(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s.PathType.FILL,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=[this.minX,this.minY,this.maxX,this.maxY];if(e===s.PathType.STROKE){t||(0,n.unreachable)("Stroke bounding box must include transform.");const e=n.Util.singularValueDecompose2dScale(t),r=e[0]*this.lineWidth/2,s=e[1]*this.lineWidth/2;i[0]-=r;i[1]-=s;i[2]+=r;i[3]+=s}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(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:s.PathType.FILL,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return n.Util.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function putBinaryImageData(e,t){if("undefined"!=typeof ImageData&&t instanceof ImageData){e.putImageData(t,0,0);return}const i=t.height,r=t.width,s=i%c,a=(i-s)/c,o=0===s?a:a+1,l=e.createImageData(r,c);let d,h=0;const u=t.data,p=l.data;let g,f,m,v;if(t.kind===n.ImageKind.GRAYSCALE_1BPP){const t=u.byteLength,i=new Uint32Array(p.buffer,0,p.byteLength>>2),v=i.length,b=r+7>>3,y=4294967295,w=n.FeatureTest.isLittleEndian?4278190080:255;for(g=0;g<o;g++){m=g<a?c:s;d=0;for(f=0;f<m;f++){const e=t-h;let n=0;const s=e>b?r:8*e-7,a=-8&s;let o=0,l=0;for(;n<a;n+=8){l=u[h++];i[d++]=128&l?y:w;i[d++]=64&l?y:w;i[d++]=32&l?y:w;i[d++]=16&l?y:w;i[d++]=8&l?y:w;i[d++]=4&l?y:w;i[d++]=2&l?y:w;i[d++]=1&l?y:w}for(;n<s;n++){if(0===o){l=u[h++];o=128}i[d++]=l&o?y:w;o>>=1}}for(;d<v;)i[d++]=0;e.putImageData(l,0,g*c)}}else if(t.kind===n.ImageKind.RGBA_32BPP){f=0;v=r*c*4;for(g=0;g<a;g++){p.set(u.subarray(h,h+v));h+=v;e.putImageData(l,0,f);f+=c}if(g<o){v=r*s*4;p.set(u.subarray(h,h+v));e.putImageData(l,0,f)}}else{if(t.kind!==n.ImageKind.RGB_24BPP)throw new Error(`bad image kind: ${t.kind}`);m=c;v=r*m;for(g=0;g<o;g++){if(g>=a){m=s;v=r*m}d=0;for(f=v;f--;){p[d++]=u[h++];p[d++]=u[h++];p[d++]=u[h++];p[d++]=255}e.putImageData(l,0,g*c)}}}function putBinaryImageMask(e,t){if(t.bitmap){e.drawImage(t.bitmap,0,0);return}const i=t.height,n=t.width,r=i%c,s=(i-r)/c,o=0===r?s:s+1,l=e.createImageData(n,c);let d=0;const h=t.data,u=l.data;for(let t=0;t<o;t++){const i=t<s?c:r;({srcPos:d}=(0,a.convertBlackAndWhiteToRGBA)({src:h,srcPos:d,dest:u,width:n,height:i,nonBlackColor:0}));e.putImageData(l,0,t*c)}}function copyCtxState(e,t){const i=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];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){e.strokeStyle=e.fillStyle="#000000";e.fillRule="nonzero";e.globalAlpha=1;e.lineWidth=1;e.lineCap="butt";e.lineJoin="miter";e.miterLimit=10;e.globalCompositeOperation="source-over";e.font="10px sans-serif";if(void 0!==e.setLineDash){e.setLineDash([]);e.lineDashOffset=0}o.isNodeJS||(e.filter="none")}function composeSMaskBackdrop(e,t,i,n){const r=e.length;for(let s=3;s<r;s+=4){const r=e[s];if(0===r){e[s-3]=t;e[s-2]=i;e[s-1]=n}else if(r<255){const a=255-r;e[s-3]=e[s-3]*r+t*a>>8;e[s-2]=e[s-2]*r+i*a>>8;e[s-1]=e[s-1]*r+n*a>>8}}}function composeSMaskAlpha(e,t,i){const n=e.length;for(let r=3;r<n;r+=4){const n=i?i[e[r]]:e[r];t[r]=t[r]*n*.00392156862745098|0}}function composeSMaskLuminosity(e,t,i){const n=e.length;for(let r=3;r<n;r+=4){const n=77*e[r-3]+152*e[r-2]+28*e[r-1];t[r]=i?t[r]*i[n>>8]>>8:t[r]*n>>16}}function composeSMask(e,t,i,n){const r=n[0],s=n[1],a=n[2]-r,o=n[3]-s;if(0!==a&&0!==o){!function genericComposeSMask(e,t,i,n,r,s,a,o,l,c,d){const h=!!s,u=h?s[0]:0,p=h?s[1]:0,g=h?s[2]:0;let f;f="Luminosity"===r?composeSMaskLuminosity:composeSMaskAlpha;const m=Math.min(n,Math.ceil(1048576/i));for(let r=0;r<n;r+=m){const s=Math.min(m,n-r),v=e.getImageData(o-c,r+(l-d),i,s),b=t.getImageData(o,r+l,i,s);h&&composeSMaskBackdrop(v.data,u,p,g);f(v.data,b.data,a);t.putImageData(b,o,r+l)}}(t.context,i,a,o,t.subtype,t.backdrop,t.transferMap,r,s,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 s=Math.fround((globalThis.devicePixelRatio||1)*r.PixelsPerInch.PDF_TO_CSS_UNITS);return void 0!==t?t:i[0]<=s||i[1]<=s}const d=["butt","round","square"],h=["miter","round","bevel"],u={},p={};class CanvasGraphics{constructor(e,t,i,n,r,s,a,o){let{optionalContentConfig:l,markedContentStack:c=null}=s;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.filterFactory=r;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=c||[];this.optionalContentConfig=l;this.cachedCanvases=new CachedCanvases(this.canvasFactory);this.cachedPatterns=new Map;this.annotationCanvasMap=a;this.viewportScale=1;this.outputScaleX=1;this.outputScaleY=1;this.pageColors=o;this._cachedScaleForStroking=[-1,0];this._cachedGetSinglePixelWidth=null;this._cachedBitmapsMap=new Map}getObject(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return"string"==typeof e?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}beginDrawing(e){let{transform:t,viewport:i,transparency:n=!1,background:s=null}=e;const a=this.ctx.canvas.width,o=this.ctx.canvas.height,l=this.ctx.fillStyle;this.ctx.fillStyle=s||"#ffffff";this.ctx.fillRect(0,0,a,o);this.ctx.fillStyle=l;if(n){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,r.getCurrentTransform)(this.compositeCtx))}this.ctx.save();resetCtxToDefault(this.ctx);if(t){this.ctx.transform(...t);this.outputScaleX=t[0];this.outputScaleY=t[0]}this.ctx.transform(...i.transform);this.viewportScale=i.scale;this.baseTransform=(0,r.getCurrentTransform)(this.ctx)}executeOperatorList(e,t,i,r){const s=e.argsArray,a=e.fnArray;let o=t||0;const l=s.length;if(l===o)return o;const c=l-o>10&&"function"==typeof i,d=c?Date.now()+15:0;let h=0;const u=this.commonObjs,p=this.objs;let g;for(;;){if(void 0!==r&&o===r.nextBreakPoint){r.breakIt(o,i);return o}g=a[o];if(g!==n.OPS.dependency)this[g].apply(this,s[o]);else for(const e of s[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(c&&++h>10){if(Date.now()>d){i();return o}h=0}}}#Ae(){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.#Ae();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();this.#Ee()}#Ee(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==e){const t=this.ctx.filter;this.ctx.filter=e;this.ctx.drawImage(this.ctx.canvas,0,0);this.ctx.filter=t}}}_scaleImage(e,t){const i=e.width,n=e.height;let r,s,a=Math.max(Math.hypot(t[0],t[1]),1),o=Math.max(Math.hypot(t[2],t[3]),1),l=i,c=n,d="prescale1";for(;a>2&&l>1||o>2&&c>1;){let t=l,i=c;if(a>2&&l>1){t=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2);a/=l/t}if(o>2&&c>1){i=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c)/2;o/=c/i}r=this.cachedCanvases.getCanvas(d,t,i);s=r.context;s.clearRect(0,0,t,i);s.drawImage(e,0,0,l,c,0,0,t,i);e=r.canvas;l=t;c=i;d="prescale1"===d?"prescale2":"prescale1"}return{img:e,paintWidth:l,paintHeight:c}}_createMaskCanvas(e){const t=this.ctx,{width:i,height:a}=e,o=this.current.fillColor,l=this.current.patternFill,c=(0,r.getCurrentTransform)(t);let d,h,u,p;if((e.bitmap||e.data)&&e.count>1){const t=e.bitmap||e.data.buffer;h=JSON.stringify(l?c:[c.slice(0,4),o]);d=this._cachedBitmapsMap.get(t);if(!d){d=new Map;this._cachedBitmapsMap.set(t,d)}const i=d.get(h);if(i&&!l){return{canvas:i,offsetX:Math.round(Math.min(c[0],c[2])+c[4]),offsetY:Math.round(Math.min(c[1],c[3])+c[5])}}u=i}if(!u){p=this.cachedCanvases.getCanvas("maskCanvas",i,a);putBinaryImageMask(p.context,e)}let g=n.Util.transform(c,[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),v=n.Util.normalizeRect([f[0],f[1],m[0],m[1]]),b=Math.round(v[2]-v[0])||1,y=Math.round(v[3]-v[1])||1,w=this.cachedCanvases.getCanvas("fillCanvas",b,y),_=w.context,S=Math.min(f[0],m[0]),P=Math.min(f[1],m[1]);_.translate(-S,-P);_.transform(...g);if(!u){u=this._scaleImage(p.canvas,(0,r.getCurrentTransformInverse)(_));u=u.img;d&&l&&d.set(h,u)}_.imageSmoothingEnabled=getImageSmoothingEnabled((0,r.getCurrentTransform)(_),e.interpolate);drawImageAtIntegerCoords(_,u,0,0,u.width,u.height,0,0,i,a);_.globalCompositeOperation="source-in";const A=n.Util.transform((0,r.getCurrentTransformInverse)(_),[1,0,0,1,-S,-P]);_.fillStyle=l?o.getPattern(t,this,A,s.PathType.FILL):o;_.fillRect(0,0,i,a);if(d&&!l){this.cachedCanvases.delete("fillCanvas");d.set(h,w.canvas)}return{canvas:w.canvas,offsetX:Math.round(S),offsetY:Math.round(P)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1);this.current.lineWidth=e;this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=d[e]}setLineJoin(e){this.ctx.lineJoin=h[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,t){const i=this.ctx;if(void 0!==i.setLineDash){i.setLineDash(e);i.lineDashOffset=t}}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(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.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(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 s=this.ctx;s.setTransform(...(0,r.getCurrentTransform)(this.suspendedCtx));copyCtxState(this.suspendedCtx,s);!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,r,s,a){t.transform(e,i,n,r,s,a);this.__originalTransform(e,i,n,r,s,a)};e.setTransform=function ctxSetTransform(e,i,n,r,s,a){t.setTransform(e,i,n,r,s,a);this.__originalSetTransform(e,i,n,r,s,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,r,s,a){t.bezierCurveTo(e,i,n,r,s,a);this.__originalBezierCurveTo(e,i,n,r,s,a)};e.rect=function(e,i,n,r){t.rect(e,i,n,r);this.__originalRect(e,i,n,r)};e.closePath=function(){t.closePath();this.__originalClosePath()};e.beginPath=function(){t.beginPath();this.__originalBeginPath()}}(s,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[0]=-1;this._cachedGetSinglePixelWidth=null}}transform(e,t,i,n,r,s){this.ctx.transform(e,t,i,n,r,s);this._cachedScaleForStroking[0]=-1;this._cachedGetSinglePixelWidth=null}constructPath(e,t,i){const s=this.ctx,a=this.current;let o,l,c=a.x,d=a.y;const h=(0,r.getCurrentTransform)(s),u=0===h[0]&&0===h[3]||0===h[1]&&0===h[2],p=u?i.slice(0):null;for(let i=0,r=0,g=e.length;i<g;i++)switch(0|e[i]){case n.OPS.rectangle:c=t[r++];d=t[r++];const e=t[r++],i=t[r++],g=c+e,f=d+i;s.moveTo(c,d);if(0===e||0===i)s.lineTo(g,f);else{s.lineTo(g,d);s.lineTo(g,f);s.lineTo(c,f)}u||a.updateRectMinMax(h,[c,d,g,f]);s.closePath();break;case n.OPS.moveTo:c=t[r++];d=t[r++];s.moveTo(c,d);u||a.updatePathMinMax(h,c,d);break;case n.OPS.lineTo:c=t[r++];d=t[r++];s.lineTo(c,d);u||a.updatePathMinMax(h,c,d);break;case n.OPS.curveTo:o=c;l=d;c=t[r+4];d=t[r+5];s.bezierCurveTo(t[r],t[r+1],t[r+2],t[r+3],c,d);a.updateCurvePathMinMax(h,o,l,t[r],t[r+1],t[r+2],t[r+3],c,d,p);r+=6;break;case n.OPS.curveTo2:o=c;l=d;s.bezierCurveTo(c,d,t[r],t[r+1],t[r+2],t[r+3]);a.updateCurvePathMinMax(h,o,l,c,d,t[r],t[r+1],t[r+2],t[r+3],p);c=t[r+2];d=t[r+3];r+=4;break;case n.OPS.curveTo3:o=c;l=d;c=t[r+2];d=t[r+3];s.bezierCurveTo(t[r],t[r+1],c,d,c,d);a.updateCurvePathMinMax(h,o,l,t[r],t[r+1],c,d,c,d,p);r+=4;break;case n.OPS.closePath:s.closePath()}u&&a.updateScalingPathMinMax(h,p);a.setCurrentPoint(c,d)}closePath(){this.ctx.closePath()}stroke(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=this.ctx,i=this.current.strokeColor;t.globalAlpha=this.current.strokeAlpha;if(this.contentVisible)if("object"==typeof i&&null!=i&&i.getPattern){t.save();t.strokeStyle=i.getPattern(t,this,(0,r.getCurrentTransformInverse)(t),s.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(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=this.ctx,i=this.current.fillColor;let n=!1;if(this.current.patternFill){t.save();t.fillStyle=i.getPattern(t,this,(0,r.getCurrentTransformInverse)(t),s.PathType.FILL);n=!0}const a=this.current.getClippedPathBoundingBox();if(this.contentVisible&&null!==a)if(this.pendingEOFill){t.fill("evenodd");this.pendingEOFill=!1}else t.fill();n&&t.restore();e&&this.consumePath(a)}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){var i;const r=this.commonObjs.get(e),s=this.current;if(!r)throw new Error(`Can't find font for ${e}`);s.fontMatrix=r.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=r;this.current.fontSize=t;if(r.isType3Font)return;const a=r.loadedName||"sans-serif",o=(null===(i=r.systemFontInfo)||void 0===i?void 0:i.css)||`"${a}", ${r.fallbackName}`;let l="normal";r.black?l="900":r.bold&&(l="bold");const c=r.italic?"italic":"normal";let d=t;t<16?d=16:t>100&&(d=100);this.current.fontSizeScale=t/d;this.ctx.font=`${c} ${l} ${d}px ${o}`}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,r,s){this.current.textMatrix=[e,t,i,n,r,s];this.current.textMatrixScale=Math.hypot(e,t);this.current.x=this.current.lineX=0;this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(e,t,i,s){const a=this.ctx,o=this.current,l=o.font,c=o.textRenderingMode,d=o.fontSize/o.fontSizeScale,h=c&n.TextRenderingMode.FILL_STROKE_MASK,u=!!(c&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);s&&a.setTransform(...s);h!==n.TextRenderingMode.FILL&&h!==n.TextRenderingMode.FILL_STROKE||a.fill();h!==n.TextRenderingMode.STROKE&&h!==n.TextRenderingMode.FILL_STROKE||a.stroke();a.restore()}else{h!==n.TextRenderingMode.FILL&&h!==n.TextRenderingMode.FILL_STROKE||a.fillText(e,t,i);h!==n.TextRenderingMode.STROKE&&h!==n.TextRenderingMode.FILL_STROKE||a.strokeText(e,t,i)}if(u){(this.pendingTextPaths||=[]).push({transform:(0,r.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,c=t.charSpacing,d=t.wordSpacing,h=t.fontDirection,u=t.textHScale*h,p=e.length,g=i.vertical,f=g?1:-1,m=i.defaultVMetrics,v=a*t.fontMatrix[0],b=t.textRenderingMode===n.TextRenderingMode.FILL&&!i.disableFontFace&&!t.patternFill;o.save();o.transform(...t.textMatrix);o.translate(t.x,t.y+t.textRise);h>0?o.scale(u,-1):o.scale(u,1);let y;if(t.patternFill){o.save();const e=t.fillColor.getPattern(o,this,(0,r.getCurrentTransformInverse)(o),s.PathType.FILL);y=(0,r.getCurrentTransform)(o);o.restore();o.fillStyle=e}let w=t.lineWidth;const _=t.textMatrixScale;if(0===_||0===w){const e=t.textRenderingMode&n.TextRenderingMode.FILL_STROKE_MASK;e!==n.TextRenderingMode.STROKE&&e!==n.TextRenderingMode.FILL_STROKE||(w=this.getSinglePixelWidth())}else w/=_;if(1!==l){o.scale(l,l);w/=l}o.lineWidth=w;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*v*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 r=(t.isSpace?d:0)+c,s=t.fontChar,u=t.accent;let p,w,_,A=t.width;if(g){const e=t.vmetric||m,i=-(t.vmetric?e[1]:.5*A)*v,n=e[2]*v;A=e?-e[0]:A;p=i/l;w=(P+n)/l}else{p=P/l;w=0}if(i.remeasure&&A>0){const e=1e3*o.measureText(s).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(b&&!u)o.fillText(s,p,w);else{this.paintChar(s,p,w,y);if(u){const e=p+a*u.offset.x/l,t=w-a*u.offset.y/l;this.paintChar(u.fontChar,e,t,y)}}_=g?A*v-r*h:A*v+r*h;P+=_;n&&o.restore()}g?t.y-=P:t.x+=P*u;o.restore();this.compose()}showType3Text(e){const t=this.ctx,i=this.current,r=i.font,s=i.fontSize,a=i.fontDirection,o=r.vertical?1:-1,l=i.charSpacing,c=i.wordSpacing,d=i.textHScale*a,h=i.fontMatrix||n.FONT_IDENTITY_MATRIX,u=e.length;let p,g,f,m;if(!(i.textRenderingMode===n.TextRenderingMode.INVISIBLE)&&0!==s){this._cachedScaleForStroking[0]=-1;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*s/1e3;this.ctx.translate(m,0);i.x+=m*d;continue}const a=(g.isSpace?c:0)+l,u=r.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(s,s);t.transform(...h);this.executeOperatorList(u);this.restore()}f=n.Util.applyTransform([g.width,0],h)[0]*s+a;t.translate(f,0);i.x+=f*d}t.restore();this.processingType3=null}}setCharWidth(e,t){}setCharWidthAndBounds(e,t,i,n,r,s){this.ctx.rect(i,n,r-i,s-n);this.ctx.clip();this.endPath()}getColorN_Pattern(e){let t;if("TilingPattern"===e[0]){const i=e[1],n=this.baseTransform||(0,r.getCurrentTransform)(this.ctx),a={createCanvasGraphics:e=>new CanvasGraphics(e,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};t=new s.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 r=n.Util.makeHexColor(e,t,i);this.ctx.strokeStyle=r;this.current.strokeColor=r}setFillRGBColor(e,t,i){const r=n.Util.makeHexColor(e,t,i);this.ctx.fillStyle=r;this.current.fillColor=r;this.current.patternFill=!1}_getPattern(e){let t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.cachedPatterns.has(e))t=this.cachedPatterns.get(e);else{t=(0,s.getShadingPattern)(this.getObject(e));this.cachedPatterns.set(e,t)}i&&(t.matrix=i);return t}shadingFill(e){if(!this.contentVisible)return;const t=this.ctx;this.save();const i=this._getPattern(e);t.fillStyle=i.getPattern(t,this,(0,r.getCurrentTransformInverse)(t),s.PathType.SHADING);const a=(0,r.getCurrentTransformInverse)(t);if(a){const e=t.canvas,i=e.width,r=e.height,s=n.Util.applyTransform([0,0],a),o=n.Util.applyTransform([0,r],a),l=n.Util.applyTransform([i,0],a),c=n.Util.applyTransform([i,r],a),d=Math.min(s[0],o[0],l[0],c[0]),h=Math.min(s[1],o[1],l[1],c[1]),u=Math.max(s[0],o[0],l[0],c[0]),p=Math.max(s[1],o[1],l[1],c[1]);this.ctx.fillRect(d,h,u-d,p-h)}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,r.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,r.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,r.getCurrentTransform)(t);e.matrix&&t.transform(...e.matrix);if(!e.bbox)throw new Error("Bounding box is required.");let s=n.Util.getAxialAlignedBoundingBox(e.bbox,(0,r.getCurrentTransform)(t));const a=[0,0,t.canvas.width,t.canvas.height];s=n.Util.intersect(s,a)||[0,0,0,0];const o=Math.floor(s[0]),c=Math.floor(s[1]);let d=Math.max(Math.ceil(s[2])-o,1),h=Math.max(Math.ceil(s[3])-c,1),u=1,p=1;if(d>l){u=d/l;d=l}if(h>l){p=h/l;h=l}this.current.startNewPathAndClipBox([0,0,d,h]);let g="groupAt"+this.groupLevel;e.smask&&(g+="_smask_"+this.smaskCounter++%2);const f=this.cachedCanvases.getCanvas(g,d,h),m=f.context;m.scale(1/u,1/p);m.translate(-o,-c);m.transform(...i);if(e.smask)this.smaskStack.push({canvas:f.canvas,context:m,offsetX:o,offsetY:c,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(o,c);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,r.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,s,a){this.#Ae();resetCtxToDefault(this.ctx);this.ctx.save();this.save();this.baseTransform&&this.ctx.setTransform(...this.baseTransform);if(Array.isArray(t)&&4===t.length){const s=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]=s;t[3]=o;const[a,l]=n.Util.singularValueDecompose2dScale((0,r.getCurrentTransform)(this.ctx)),{viewportScale:c}=this,d=Math.ceil(s*this.outputScaleX*c),h=Math.ceil(o*this.outputScaleY*c);this.annotationCanvas=this.canvasFactory.create(d,h);const{canvas:u,context:p}=this.annotationCanvas;this.annotationCanvasMap.set(e,u);this.annotationCanvas.savedCtx=this.ctx;this.ctx=p;this.ctx.save();this.ctx.setTransform(a,0,0,-l,0,o*l);resetCtxToDefault(this.ctx)}else{resetCtxToDefault(this.ctx);this.ctx.rect(t[0],t[1],s,o);this.ctx.clip();this.endPath()}}this.current=new CanvasExtraState(this.ctx.canvas.width,this.ctx.canvas.height);this.transform(...i);this.transform(...s)}endAnnotation(){if(this.annotationCanvas){this.ctx.restore();this.#Ee();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>1e3||i>1e3)return null;const n=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),r=t+1;let s,a,o,l=new Uint8Array(r*(i+1));const c=t+7&-8;let d=new Uint8Array(c*i),h=0;for(const t of e.data){let e=128;for(;e>0;){d[h++]=t&e?0:255;e>>=1}}let u=0;h=0;if(0!==d[h]){l[0]=1;++u}for(a=1;a<t;a++){if(d[h]!==d[h+1]){l[a]=d[h]?2:1;++u}h++}if(0!==d[h]){l[a]=2;++u}for(s=1;s<i;s++){h=s*c;o=s*r;if(d[h-c]!==d[h]){l[o]=d[h]?1:8;++u}let e=(d[h]?4:0)+(d[h-c]?8:0);for(a=1;a<t;a++){e=(e>>2)+(d[h+1]?4:0)+(d[h-c+1]?8:0);if(n[e]){l[o+a]=n[e];++u}h++}if(d[h-c]!==d[h]){l[o+a]=d[h]?2:4;++u}if(u>1e3)return null}h=c*(i-1);o=s*r;if(0!==d[h]){l[o]=8;++u}for(a=1;a<t;a++){if(d[h]!==d[h+1]){l[o+a]=d[h]?4:8;++u}h++}if(0!==d[h]){l[o+a]=4;++u}if(u>1e3)return null;const p=new Int32Array([0,r,-1,0,-r,0,0,0,1]),g=new Path2D;for(s=0;u&&s<=i;s++){let e=s*r;const i=e+t;for(;e<i&&!l[e];)e++;if(e===i)continue;g.moveTo(e%r,s);const n=e;let a=l[e];do{const t=p[a];do{e+=t}while(!l[e]);const i=l[e];if(5!==i&&10!==i){a=i;l[e]=0}else{a=i&51*a>>4;l[e]&=a>>2|a<<2}g.lineTo(e%r,e/r|0);l[e]||--u}while(n!==e);--s}d=null;l=null;return function(e){e.save();e.scale(1/t,-1/i);e.translate(0,-i);e.fill(g);e.beginPath();e.restore()}}(e));if(n.compiled){n.compiled(i);return}}const r=this._createMaskCanvas(e),s=r.canvas;i.save();i.setTransform(1,0,0,1,0,0);i.drawImage(s,r.offsetX,r.offsetY);i.restore();this.compose()}paintImageMaskXObjectRepeat(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4?arguments[4]:void 0,o=arguments.length>5?arguments[5]:void 0;if(!this.contentVisible)return;e=this.getObject(e.data,e);const l=this.ctx;l.save();const c=(0,r.getCurrentTransform)(l);l.transform(t,i,s,a,0,0);const d=this._createMaskCanvas(e);l.setTransform(1,0,0,1,d.offsetX-c[4],d.offsetY-c[5]);for(let e=0,r=o.length;e<r;e+=2){const r=n.Util.transform(c,[t,i,s,a,o[e],o[e+1]]),[h,u]=n.Util.applyTransform([0,0],r);l.drawImage(d.canvas,h,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:c}=a,d=this.cachedCanvases.getCanvas("maskCanvas",o,l),h=d.context;h.save();putBinaryImageMask(h,this.getObject(e,a));h.globalCompositeOperation="source-in";h.fillStyle=n?i.getPattern(h,this,(0,r.getCurrentTransformInverse)(t),s.PathType.FILL):i;h.fillRect(0,0,o,l);h.restore();t.save();t.transform(...c);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,r){if(!this.contentVisible)return;const s=this.getObject(e);if(!s){(0,n.warn)("Dependent image isn't ready yet");return}const a=s.width,o=s.height,l=[];for(let e=0,n=r.length;e<n;e+=2)l.push({transform:[t,0,0,i,r[e],r[e+1]],x:0,y:0,w:a,h:o});this.paintInlineImageXObjectGroup(s,l)}applyTransferMapsToCanvas(e){if("none"!==this.current.transferMaps){e.filter=this.current.transferMaps;e.drawImage(e.canvas,0,0);e.filter="none"}return e.canvas}applyTransferMapsToBitmap(e){if("none"===this.current.transferMaps)return e.bitmap;const{bitmap:t,width:i,height:n}=e,r=this.cachedCanvases.getCanvas("inlineImage",i,n),s=r.context;s.filter=this.current.transferMaps;s.drawImage(t,0,0);s.filter="none";return r.canvas}paintInlineImageXObject(e){if(!this.contentVisible)return;const t=e.width,i=e.height,n=this.ctx;this.save();o.isNodeJS||(n.filter="none");n.scale(1/t,-1/i);let s;if(e.bitmap)s=this.applyTransferMapsToBitmap(e);else if("function"==typeof HTMLElement&&e instanceof HTMLElement||!e.data)s=e;else{const n=this.cachedCanvases.getCanvas("inlineImage",t,i).context;putBinaryImageData(n,e);s=this.applyTransferMapsToCanvas(n)}const a=this._scaleImage(s,(0,r.getCurrentTransformInverse)(n));n.imageSmoothingEnabled=getImageSmoothingEnabled((0,r.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;let n;if(e.bitmap)n=e.bitmap;else{const t=e.width,i=e.height,r=this.cachedCanvases.getCanvas("inlineImage",t,i).context;putBinaryImageData(r,e);n=this.applyTransferMapsToCanvas(r)}for(const e of t){i.save();i.transform(...e.transform);i.scale(1,-1);drawImageAtIntegerCoords(i,n,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,r.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(-1===this._cachedScaleForStroking[0]){const{lineWidth:e}=this.current,{a:t,b:i,c:n,d:r}=this.ctx.getTransform();let s,a;if(0===i&&0===n){const i=Math.abs(t),n=Math.abs(r);if(i===n)if(0===e)s=a=1/i;else{const t=i*e;s=a=t<1?1/t:1}else if(0===e){s=1/i;a=1/n}else{const t=i*e,r=n*e;s=t<1?1/t:1;a=r<1?1/r:1}}else{const o=Math.abs(t*r-i*n),l=Math.hypot(t,i),c=Math.hypot(n,r);if(0===e){s=c/o;a=l/o}else{const t=e*o;s=c>t?c/t:1;a=l>t?l/t:1}}this._cachedScaleForStroking[0]=s;this._cachedScaleForStroking[1]=a}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}const s=t.getLineDash();e&&t.save();t.scale(n,r);if(s.length>0){const e=Math.max(n,r);t.setLineDash(s.map((t=>t/e)));t.lineDashOffset/=e}t.stroke();e&&t.restore()}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)=>{"use strict";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),r=i(141);const s={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};t.PathType=s;function applyBoundingBox(e,t){if(!t)return;const i=t[2]-t[0],n=t[3]-t[1],r=new Path2D;r.rect(t[0],t[1],i,n);e.clip(r)}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===s.STROKE||a===s.FILL){const s=t.current.getClippedPathBoundingBox(a,(0,r.getCurrentTransform)(e))||[0,0,0,0],l=Math.ceil(s[2]-s[0])||1,c=Math.ceil(s[3]-s[1])||1,d=t.cachedCanvases.getCanvas("pattern",l,c,!0),h=d.context;h.clearRect(0,0,h.canvas.width,h.canvas.height);h.beginPath();h.rect(0,0,h.canvas.width,h.canvas.height);h.translate(-s[0],-s[1]);i=n.Util.transform(i,[1,0,0,1,s[0],s[1]]);h.transform(...t.baseTransform);this.matrix&&h.transform(...this.matrix);applyBoundingBox(h,this._bbox);h.fillStyle=this._createGradient(h);h.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,r,s,a,o){const l=t.coords,c=t.colors,d=e.data,h=4*e.width;let u;if(l[i+1]>l[n+1]){u=i;i=n;n=u;u=s;s=a;a=u}if(l[n+1]>l[r+1]){u=n;n=r;r=u;u=a;a=o;o=u}if(l[i+1]>l[n+1]){u=i;i=n;n=u;u=s;s=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,v=(l[r]+t.offsetX)*t.scaleX,b=(l[r+1]+t.offsetY)*t.scaleY;if(g>=b)return;const y=c[s],w=c[s+1],_=c[s+2],S=c[a],P=c[a+1],A=c[a+2],E=c[o],x=c[o+1],C=c[o+2],T=Math.round(g),M=Math.round(b);let I,k,D,L,R,O,N,B;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;k=y-(y-S)*t;D=w-(w-P)*t;L=_-(_-A)*t}else{let t;t=e>b?1:m===b?0:(m-e)/(m-b);I=f-(f-v)*t;k=S-(S-E)*t;D=P-(P-x)*t;L=A-(A-C)*t}let t;t=e<g?0:e>b?1:(g-e)/(g-b);R=p-(p-v)*t;O=y-(y-E)*t;N=w-(w-x)*t;B=_-(_-C)*t;const i=Math.round(Math.min(I,R)),n=Math.round(Math.max(I,R));let r=h*e+4*i;for(let e=i;e<=n;e++){t=(I-e)/(I-R);t<0?t=0:t>1&&(t=1);d[r++]=k-(k-O)*t|0;d[r++]=D-(D-N)*t|0;d[r++]=L-(L-B)*t|0;d[r++]=255}}}function drawFigure(e,t,i){const n=t.coords,r=t.colors;let s,a;switch(t.type){case"lattice":const o=t.verticesPerRow,l=Math.floor(n.length/o)-1,c=o-1;for(s=0;s<l;s++){let t=s*o;for(let s=0;s<c;s++,t++){drawTriangle(e,i,n[t],n[t+1],n[t+o],r[t],r[t+1],r[t+o]);drawTriangle(e,i,n[t+o+1],n[t+1],n[t+o],r[t+o+1],r[t+1],r[t+o])}}break;case"triangles":for(s=0,a=n.length;s<a;s+=3)drawTriangle(e,i,n[s],n[s+1],n[s+2],r[s],r[s+1],r[s+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]),r=Math.floor(this._bounds[1]),s=Math.ceil(this._bounds[2])-n,a=Math.ceil(this._bounds[3])-r,o=Math.min(Math.ceil(Math.abs(s*e[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(a*e[1]*1.1)),3e3),c=s/o,d=a/l,h={coords:this._coords,colors:this._colors,offsetX:-n,offsetY:-r,scaleX:1/c,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,h);f.putImageData(m,2,2);return{canvas:g.canvas,offsetX:n-2*c,offsetY:r-2*d,scaleX:c,scaleY:d}}getPattern(e,t,i,a){applyBoundingBox(e,this._bbox);let o;if(a===s.SHADING)o=n.Util.singularValueDecompose2dScale((0,r.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===s.SHADING?null:this._background,t.cachedCanvases);if(a!==s.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 MAX_PATTERN_SIZE=3e3;constructor(e,t,i,n,r){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=r}createPatternCanvas(e){const t=this.operatorList,i=this.bbox,s=this.xstep,a=this.ystep,o=this.paintType,l=this.tilingType,c=this.color,d=this.canvasGraphicsFactory;(0,n.info)("TilingType: "+l);const h=i[0],u=i[1],p=i[2],g=i[3],f=n.Util.singularValueDecompose2dScale(this.matrix),m=n.Util.singularValueDecompose2dScale(this.baseTransform),v=[f[0]*m[0],f[1]*m[1]],b=this.getSizeAndScale(s,this.ctx.canvas.width,v[0]),y=this.getSizeAndScale(a,this.ctx.canvas.height,v[1]),w=e.cachedCanvases.getCanvas("pattern",b.size,y.size,!0),_=w.context,S=d.createCanvasGraphics(_);S.groupLevel=e.groupLevel;this.setFillAndStrokeStyleToContext(S,o,c);let P=h,A=u,E=p,x=g;if(h<0){P=0;E+=Math.abs(h)}if(u<0){A=0;x+=Math.abs(u)}_.translate(-b.scale*P,-y.scale*A);S.transform(b.scale,0,0,y.scale,0,0);_.save();this.clipBbox(S,P,A,E,x);S.baseTransform=(0,r.getCurrentTransform)(S.ctx);S.executeOperatorList(t);S.endDrawing();return{canvas:w.canvas,scaleX:b.scale,scaleY:y.scale,offsetX:P,offsetY:A}}getSizeAndScale(e,t,i){e=Math.abs(e);const n=Math.max(TilingPattern.MAX_PATTERN_SIZE,t);let r=Math.ceil(e*i);r>=n?r=n:i=r/e;return{scale:i,size:r}}clipBbox(e,t,i,n,s){const a=n-t,o=s-i;e.ctx.rect(t,i,a,o);e.current.updateRectMinMax((0,r.getCurrentTransform)(e.ctx),[t,i,n,s]);e.clip();e.endPath()}setFillAndStrokeStyleToContext(e,t,i){const r=e.ctx,s=e.current;switch(t){case a:const e=this.ctx;r.fillStyle=e.fillStyle;r.strokeStyle=e.strokeStyle;s.fillColor=e.fillStyle;s.strokeColor=e.strokeStyle;break;case o:const l=n.Util.makeHexColor(i[0],i[1],i[2]);r.fillStyle=l;r.strokeStyle=l;s.fillColor=l;s.strokeColor=l;break;default:throw new n.FormatError(`Unsupported paint type: ${t}`)}}getPattern(e,t,i,r){let a=i;if(r!==s.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 c=e.createPattern(o.canvas,"repeat");c.setTransform(l);return c}}t.TilingPattern=TilingPattern},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.convertBlackAndWhiteToRGBA=convertBlackAndWhiteToRGBA;t.convertToRGBA=function convertToRGBA(e){switch(e.kind){case n.ImageKind.GRAYSCALE_1BPP:return convertBlackAndWhiteToRGBA(e);case n.ImageKind.RGB_24BPP:return function convertRGBToRGBA(e){let{src:t,srcPos:i=0,dest:r,destPos:s=0,width:a,height:o}=e,l=0;const c=t.length>>2,d=new Uint32Array(t.buffer,i,c);if(n.FeatureTest.isLittleEndian){for(;l<c-2;l+=3,s+=4){const e=d[l],t=d[l+1],i=d[l+2];r[s]=4278190080|e;r[s+1]=e>>>24|t<<8|4278190080;r[s+2]=t>>>16|i<<16|4278190080;r[s+3]=i>>>8|4278190080}for(let e=4*l,i=t.length;e<i;e+=3)r[s++]=t[e]|t[e+1]<<8|t[e+2]<<16|4278190080}else{for(;l<c-2;l+=3,s+=4){const e=d[l],t=d[l+1],i=d[l+2];r[s]=255|e;r[s+1]=e<<24|t>>>8|255;r[s+2]=t<<16|i>>>16|255;r[s+3]=i<<8|255}for(let e=4*l,i=t.length;e<i;e+=3)r[s++]=t[e]<<24|t[e+1]<<16|t[e+2]<<8|255}return{srcPos:i,destPos:s}}(e)}return null};t.grayToRGBA=function grayToRGBA(e,t){if(n.FeatureTest.isLittleEndian)for(let i=0,n=e.length;i<n;i++)t[i]=65793*e[i]|4278190080;else for(let i=0,n=e.length;i<n;i++)t[i]=16843008*e[i]|255};var n=i(1);function convertBlackAndWhiteToRGBA(e){let{src:t,srcPos:i=0,dest:r,width:s,height:a,nonBlackColor:o=4294967295,inverseDecode:l=!1}=e;const c=n.FeatureTest.isLittleEndian?4278190080:255,[d,h]=l?[o,c]:[c,o],u=s>>3,p=7&s,g=t.length;r=new Uint32Array(r.buffer);let f=0;for(let e=0;e<a;e++){for(const e=i+u;i<e;i++){const e=i<g?t[i]:255;r[f++]=128&e?h:d;r[f++]=64&e?h:d;r[f++]=32&e?h:d;r[f++]=16&e?h:d;r[f++]=8&e?h:d;r[f++]=4&e?h:d;r[f++]=2&e?h:d;r[f++]=1&e?h:d}if(0===p)continue;const e=i<g?t[i++]:255;for(let t=0;t<p;t++)r[f++]=e&1<<7-t?h:d}return{srcPos:i,destPos:f}}},(e,t)=>{"use strict";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)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.MessageHandler=void 0;var n=i(1);const r=1,s=2,a=1,o=2,l=3,c=4,d=5,h=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.#xe(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===r)i.resolve(t.data);else{if(t.callback!==s)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:r,callbackId:t.callbackId,data:n})}),(function(n){i.postMessage({sourceName:e,targetName:a,callback:s,callbackId:t.callbackId,reason:wrapReason(n)})}))}else t.streamId?this.#Ce(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 r=this.callbackId++,s=new n.PromiseCapability;this.callbackCapabilities[r]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:r,data:t},i)}catch(e){s.reject(e)}return s.promise}sendWithStream(e,t,i,r){const s=this.streamId++,o=this.sourceName,l=this.targetName,c=this.comObj;return new ReadableStream({start:i=>{const a=new n.PromiseCapability;this.streamControllers[s]={controller:i,startCall:a,pullCall:null,cancelCall:null,isClosed:!1};c.postMessage({sourceName:o,targetName:l,action:e,streamId:s,data:t,desiredSize:i.desiredSize},r);return a.promise},pull:e=>{const t=new n.PromiseCapability;this.streamControllers[s].pullCall=t;c.postMessage({sourceName:o,targetName:l,stream:h,streamId:s,desiredSize:e.desiredSize});return t.promise},cancel:e=>{(0,n.assert)(e instanceof Error,"cancel must have a valid reason");const t=new n.PromiseCapability;this.streamControllers[s].cancelCall=t;this.streamControllers[s].isClosed=!0;c.postMessage({sourceName:o,targetName:l,stream:a,streamId:s,reason:wrapReason(e)});return t.promise}},i)}#Ce(e){const t=e.streamId,i=this.sourceName,r=e.sourceName,s=this.comObj,a=this,o=this.actionHandler[e.action],h={enqueue(e){let a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2?arguments[2]:void 0;if(this.isCancelled)return;const l=this.desiredSize;this.desiredSize-=a;if(l>0&&this.desiredSize<=0){this.sinkCapability=new n.PromiseCapability;this.ready=this.sinkCapability.promise}s.postMessage({sourceName:i,targetName:r,stream:c,streamId:t,chunk:e},o)},close(){if(!this.isCancelled){this.isCancelled=!0;s.postMessage({sourceName:i,targetName:r,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;s.postMessage({sourceName:i,targetName:r,stream:d,streamId:t,reason:wrapReason(e)})}},sinkCapability:new n.PromiseCapability,onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};h.sinkCapability.resolve();h.ready=h.sinkCapability.promise;this.streamSinks[t]=h;new Promise((function(t){t(o(e.data,h))})).then((function(){s.postMessage({sourceName:i,targetName:r,stream:p,streamId:t,success:!0})}),(function(e){s.postMessage({sourceName:i,targetName:r,stream:p,streamId:t,reason:wrapReason(e)})}))}#xe(e){const t=e.streamId,i=this.sourceName,r=e.sourceName,s=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 h:if(!f){s.postMessage({sourceName:i,targetName:r,stream:u,streamId:t,success:!0});break}f.desiredSize<=0&&e.desiredSize>0&&f.sinkCapability.resolve();f.desiredSize=e.desiredSize;new Promise((function(e){var t;e(null===(t=f.onPull)||void 0===t?void 0:t.call(f))})).then((function(){s.postMessage({sourceName:i,targetName:r,stream:u,streamId:t,success:!0})}),(function(e){s.postMessage({sourceName:i,targetName:r,stream:u,streamId:t,reason:wrapReason(e)})}));break;case c:(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.#Te(g,t);break;case d:(0,n.assert)(g,"error should have stream controller");g.controller.error(wrapReason(e.reason));this.#Te(g,t);break;case o:e.success?g.cancelCall.resolve():g.cancelCall.reject(wrapReason(e.reason));this.#Te(g,t);break;case a:if(!f)break;new Promise((function(t){var i;t(null===(i=f.onCancel)||void 0===i?void 0:i.call(f,wrapReason(e.reason)))})).then((function(){s.postMessage({sourceName:i,targetName:r,stream:o,streamId:t,success:!0})}),(function(e){s.postMessage({sourceName:i,targetName:r,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#Te(e,t){var i,n,r;await Promise.allSettled([null===(i=e.startCall)||void 0===i?void 0:i.promise,null===(n=e.pullCall)||void 0===n?void 0:n.promise,null===(r=e.cancelCall)||void 0===r?void 0:r.promise]);delete this.streamControllers[t]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.Metadata=void 0;var n=i(1);t.Metadata=class Metadata{#Me;#Ie;constructor(e){let{parsedData:t,rawData:i}=e;this.#Me=t;this.#Ie=i}getRaw(){return this.#Ie}get(e){return this.#Me.get(e)??null}getAll(){return(0,n.objectFromMap)(this.#Me)}has(e){return this.#Me.has(e)}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.OptionalContentConfig=void 0;var n=i(1),r=i(143);const s=Symbol("INTERNAL");class OptionalContentGroup{#ke=!0;constructor(e,t){this.name=e;this.intent=t}get visible(){return this.#ke}_setVisible(e,t){e!==s&&(0,n.unreachable)("Internal method `_setVisible` called.");this.#ke=t}}t.OptionalContentConfig=class OptionalContentConfig{#De=null;#Fe=new Map;#Le=null;#Re=null;constructor(e){this.name=null;this.creator=null;if(null!==e){this.name=e.name;this.creator=e.creator;this.#Re=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(s,!1);for(const t of e.on)this.#Fe.get(t)._setVisible(s,!0);for(const t of e.off)this.#Fe.get(t)._setVisible(s,!1);this.#Le=this.getHash()}}#Oe(e){const t=e.length;if(t<2)return!0;const i=e[0];for(let r=1;r<t;r++){const t=e[r];let s;if(Array.isArray(t))s=this.#Oe(t);else{if(!this.#Fe.has(t)){(0,n.warn)(`Optional content group not found: ${t}`);return!0}s=this.#Fe.get(t).visible}switch(i){case"And":if(!s)return!1;break;case"Or":if(s)return!0;break;case"Not":return!s;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.#Oe(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){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.#Fe.has(e)){this.#Fe.get(e)._setVisible(s,!!t);this.#De=null}else(0,n.warn)(`Optional content group not found: ${e}`)}get hasInitialVisibility(){return this.getHash()===this.#Le}getOrder(){return this.#Fe.size?this.#Re?this.#Re.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.#De)return this.#De;const e=new r.MurmurHash3_64;for(const[t,i]of this.#Fe)e.update(`${t}:${i.visible}`);return this.#De=e.hexdigest()}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PDFDataTransportStream=void 0;var n=i(1),r=i(141);t.PDFDataTransportStream=class PDFDataTransportStream{constructor(e,t){let{length:i,initialData:r,progressiveDone:s=!1,contentDispositionFilename:a=null,disableRange:o=!1,disableStream:l=!1}=e;(0,n.assert)(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');this._queuedChunks=[];this._progressiveDone=s;this._contentDispositionFilename=a;if((null==r?void 0:r.length)>0){const e=r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength?r.buffer:new Uint8Array(r).buffer;this._queuedChunks.push(e)}this._pdfDataRangeTransport=t;this._isStreamingSupported=!l;this._isRangeSupported=!o;this._contentLength=i;this._fullRequestReader=null;this._rangeReaders=[];this._pdfDataRangeTransport.addRangeListener(((e,t)=>{this._onReceiveData({begin:e,chunk:t})}));this._pdfDataRangeTransport.addProgressListener(((e,t)=>{this._onProgress({loaded:e,total:t})}));this._pdfDataRangeTransport.addProgressiveReadListener((e=>{this._onReceiveData({chunk:e})}));this._pdfDataRangeTransport.addProgressiveDoneListener((()=>{this._onProgressiveDone()}));this._pdfDataRangeTransport.transportReady()}_onReceiveData(e){let{begin:t,chunk:i}=e;const r=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;if(void 0===t)this._fullRequestReader?this._fullRequestReader._enqueue(r):this._queuedChunks.push(r);else{const e=this._rangeReaders.some((function(e){if(e._begin!==t)return!1;e._enqueue(r);return!0}));(0,n.assert)(e,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var e;return(null===(e=this._fullRequestReader)||void 0===e?void 0:e._loaded)??0}_onProgress(e){if(void 0===e.total){var t,i;null===(t=this._rangeReaders[0])||void 0===t||null===(i=t.onProgress)||void 0===i||i.call(t,{loaded:e.loaded})}else{var n,r;null===(n=this._fullRequestReader)||void 0===n||null===(r=n.onProgress)||void 0===r||r.call(n,{loaded:e.loaded,total:e.total})}}_onProgressiveDone(){var e;null===(e=this._fullRequestReader)||void 0===e||e.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){var t;null===(t=this._fullRequestReader)||void 0===t||t.cancel(e);for(const t of this._rangeReaders.slice(0))t.cancel(e);this._pdfDataRangeTransport.abort()}};class PDFDataTransportStreamReader{constructor(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this._stream=e;this._done=i||!1;this._filename=(0,r.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=new n.PromiseCapability;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=new n.PromiseCapability;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)=>{"use strict";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){var i;if(!e)return;let n=null;const r=e.name;if("#text"===r)n=e.value;else{if(!XfaText.shouldBuildText(r))return;null!=e&&null!==(i=e.attributes)&&void 0!==i&&i.textContent?n=e.attributes.textContent:e.value&&(n=e.value)}null!==n&&t.push({str:n});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)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.NodeStandardFontDataFactory=t.NodeFilterFactory=t.NodeCanvasFactory=t.NodeCMapReaderFactory=void 0;var n=i(142);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 NodeFilterFactory extends n.BaseFilterFactory{}t.NodeFilterFactory=NodeFilterFactory;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)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PDFNodeStream=void 0;var n=i(1),r=i(157);const s=require("fs"),a=require("http"),o=require("https"),l=require("url"),c=/^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(){var e;return(null===(e=this._fullRequestReader)||void 0===e?void 0:e._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){var t;null===(t=this._fullRequestReader)||void 0===t||t.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=new n.PromiseCapability;this._headersCapability=new n.PromiseCapability}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(){var e;await this._readCapability.promise;if(this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();if(null===t){this._readCapability=new n.PromiseCapability;return this.read()}this._loaded+=t.length;null===(e=this.onProgress)||void 0===e||e.call(this,{loaded:this._loaded,total:this._contentLength});return{value:new Uint8Array(t).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=new n.PromiseCapability;const t=e.source;this._isStreamingSupported=!t.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){var e;await this._readCapability.promise;if(this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();if(null===t){this._readCapability=new n.PromiseCapability;return this.read()}this._loaded+=t.length;null===(e=this.onProgress)||void 0===e||e.call(this,{loaded:this._loaded});return{value:new Uint8Array(t).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:s}=(0,r.validateRangeRequestCapabilities)({getResponseHeader:getResponseHeader,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=i;this._contentLength=s||this._contentLength;this._filename=(0,r.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);c.test(this._url.href)&&(t=t.replace(/^\//,""));s.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(s.createReadStream(t));this._headersCapability.resolve()}}))}}class PDFNodeStreamFsRangeReader extends BaseRangeReader{constructor(e,t,i){super(e);let n=decodeURIComponent(this._url.path);c.test(this._url.href)&&(n=n.replace(/^\//,""));this._setReadableStream(s.createReadStream(n,{start:t,end:i-1}))}}},(e,t,i)=>{"use strict";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,r.getFilenameFromContentDispositionHeader)(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch(e){}if((0,s.isPdfFile)(e))return e}return null};t.validateRangeRequestCapabilities=function validateRangeRequestCapabilities(e){let{getResponseHeader:t,isHttp:i,rangeChunkSize:n,disableRange:r}=e;const s={allowRangeRequests:!1,suggestedLength:void 0},a=parseInt(t("Content-Length"),10);if(!Number.isInteger(a))return s;s.suggestedLength=a;if(a<=2*n)return s;if(r||!i)return s;if("bytes"!==t("Accept-Ranges"))return s;if("identity"!==(t("Content-Encoding")||"identity"))return s;s.allowRangeRequests=!0;return s};t.validateResponseStatus=function validateResponseStatus(e){return 200===e||206===e};var n=i(1),r=i(158),s=i(141)},(e,t,i)=>{"use strict";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,r]=i;e=parseInt(e,10);if(e in t){if(0===e)break}else t[e]=[n,r]}const r=[];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))}r.push(n)}return r.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 r=new TextDecoder(e,{fatal:!0}),s=(0,n.stringToBytes)(i);i=r.decode(s);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].replaceAll(/\\(.)/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.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,(function(e,t,i,n){if("q"===i||"Q"===i)return textdecode(t,n=(n=n.replaceAll("_"," ")).replaceAll(/=([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)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PDFNetworkStream=void 0;var n=i(1),r=i(157);class NetworkManager{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.url=e;this.isHttp=/^https?:/i.test(e);this.httpHeaders=this.isHttp&&t.httpHeaders||Object.create(null);this.withCredentials=t.withCredentials||!1;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=new XMLHttpRequest,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){var i;const n=this.pendingRequests[e];n&&(null===(i=n.onProgress)||void 0===i||i.call(n,t))}onStateChange(e,t){const i=this.pendingRequests[e];if(!i)return;const r=i.xhr;if(r.readyState>=2&&i.onHeadersReceived){i.onHeadersReceived();delete i.onHeadersReceived}if(4!==r.readyState)return;if(!(e in this.pendingRequests))return;delete this.pendingRequests[e];if(0===r.status&&this.isHttp){var s;null===(s=i.onError)||void 0===s||s.call(i,r.status);return}const a=r.status||200;if(!(200===a&&206===i.expectedStatus)&&a!==i.expectedStatus){var o;null===(o=i.onError)||void 0===o||o.call(i,r.status);return}const l=function getArrayBuffer(e){const t=e.response;return"string"!=typeof t?t:(0,n.stringToBytes)(t).buffer}(r);if(206===a){const e=r.getResponseHeader("Content-Range"),t=/bytes (\d+)-(\d+)\/(\d+)/.exec(e);i.onDone({begin:parseInt(t[1],10),chunk:l})}else if(l)i.onDone({begin:0,chunk:l});else{var c;null===(c=i.onError)||void 0===c||c.call(i,r.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){var t;null===(t=this._fullRequestReader)||void 0===t||t.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=new n.PromiseCapability;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,r.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,r.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,r.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){var t;null===(t=this.onProgress)||void 0===t||t.call(this,{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=new n.PromiseCapability;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(){var e;null===(e=this.onClosed)||void 0===e||e.call(this,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,r.createResponseStatusError)(e,this._url);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0;this._queuedChunk=null}_onProgress(e){if(!this.isStreamingSupported){var t;null===(t=this.onProgress)||void 0===t||t.call(this,{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=new n.PromiseCapability;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)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PDFFetchStream=void 0;var n=i(1),r=i(157);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(){var e;return(null===(e=this._fullRequestReader)||void 0===e?void 0:e._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){var t;null===(t=this._fullRequestReader)||void 0===t||t.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=new n.PromiseCapability;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,r.validateResponseStatus)(e.status))throw(0,r.createResponseStatusError)(e.status,i);this._reader=e.body.getReader();this._headersCapability.resolve();const getResponseHeader=t=>e.headers.get(t),{allowRangeRequests:t,suggestedLength:s}=(0,r.validateRangeRequestCapabilities)({getResponseHeader:getResponseHeader,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=t;this._contentLength=s||this._contentLength;this._filename=(0,r.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(){var e;await this._headersCapability.promise;const{value:t,done:i}=await this._reader.read();if(i)return{value:t,done:i};this._loaded+=t.byteLength;null===(e=this.onProgress)||void 0===e||e.call(this,{loaded:this._loaded,total:this._contentLength});return{value:getArrayBuffer(t),done:!1}}cancel(e){var t;null===(t=this._reader)||void 0===t||t.cancel(e);this._abortController.abort()}}class PDFFetchStreamRangeReader{constructor(e,t,i){this._stream=e;this._reader=null;this._loaded=0;const s=e.source;this._withCredentials=s.withCredentials||!1;this._readCapability=new n.PromiseCapability;this._isStreamingSupported=!s.disableStream;this._abortController=new AbortController;this._headers=createHeaders(this._stream.httpHeaders);this._headers.append("Range",`bytes=${t}-${i-1}`);const a=s.url;fetch(a,createFetchOptions(this._headers,this._withCredentials,this._abortController)).then((e=>{if(!(0,r.validateResponseStatus)(e.status))throw(0,r.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(){var e;await this._readCapability.promise;const{value:t,done:i}=await this._reader.read();if(i)return{value:t,done:i};this._loaded+=t.byteLength;null===(e=this.onProgress)||void 0===e||e.call(this,{loaded:this._loaded});return{value:getArrayBuffer(t),done:!1}}cancel(e){var t;null===(t=this._reader)||void 0===t||t.cancel(e);this._abortController.abort()}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.TextLayerRenderTask=void 0;t.renderTextLayer=function renderTextLayer(e){if(!e.textContentSource&&(e.textContent||e.textContentStream)){(0,r.deprecated)("The TextLayerRender `textContent`/`textContentStream` parameters will be removed in the future, please use `textContentSource` instead.");e.textContentSource=e.textContent||e.textContentStream}const{container:t,viewport:i}=e,n=getComputedStyle(t),s=n.getPropertyValue("visibility"),a=parseFloat(n.getPropertyValue("--scale-factor"));"visible"===s&&(!a||Math.abs(a-i.scale)>1e-5)&&console.error("The `--scale-factor` CSS-variable must be set, to the same value as `viewport.scale`, either on the `container`-element itself or higher up in the DOM.");const o=new TextLayerRenderTask(e);o._render();return o};t.updateTextLayer=function updateTextLayer(e){let{container:t,viewport:i,textDivs:n,textDivProperties:s,isOffscreenCanvasSupported:a,mustRotate:o=!0,mustRescale:l=!0}=e;o&&(0,r.setLayerDimensions)(t,{rotation:i.rotation});if(l){const e=getCtx(0,a),t={prevFontSize:null,prevFontFamily:null,div:null,scale:i.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:e};for(const e of n){t.properties=s.get(e);t.div=e;layout(t)}}};var n=i(1),r=i(141);const s=30,a=.8,o=new Map;function getCtx(e,t){let i;const r=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0,alpha:!1}:{alpha:!1};if(t&&n.FeatureTest.isOffscreenCanvasSupported)i=new OffscreenCanvas(e,e).getContext("2d",r);else{const t=document.createElement("canvas");t.width=t.height=e;i=t.getContext("2d",r)}return i}function appendText(e,t,i){const r=document.createElement("span"),l={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};e._textDivs.push(r);const c=n.Util.transform(e._transform,t.transform);let d=Math.atan2(c[1],c[0]);const h=i[t.fontName];h.vertical&&(d+=Math.PI/2);const u=Math.hypot(c[2],c[3]),p=u*function getAscent(e,t){const i=o.get(e);if(i)return i;const n=getCtx(s,t);n.font=`${s}px ${e}`;const r=n.measureText("");let l=null==r?void 0:r.fontBoundingBoxAscent,c=Math.abs(null==r?void 0:r.fontBoundingBoxDescent);if(l){const t=l/(l+c);o.set(e,t);n.canvas.width=n.canvas.height=0;return t}n.strokeStyle="red";n.clearRect(0,0,s,s);n.strokeText("g",0,0);let d=n.getImageData(0,0,s,s).data;c=0;for(let e=d.length-1-3;e>=0;e-=4)if(d[e]>0){c=Math.ceil(e/4/s);break}n.clearRect(0,0,s,s);n.strokeText("A",0,s);d=n.getImageData(0,0,s,s).data;l=0;for(let e=0,t=d.length;e<t;e+=4)if(d[e]>0){l=s-Math.floor(e/4/s);break}n.canvas.width=n.canvas.height=0;if(l){const t=l/(l+c);o.set(e,t);return t}o.set(e,a);return a}(h.fontFamily,e._isOffscreenCanvasSupported);let g,f;if(0===d){g=c[4];f=c[5]-p}else{g=c[4]+p*Math.sin(d);f=c[5]-p*Math.cos(d)}const m="calc(var(--scale-factor)*",v=r.style;if(e._container===e._rootContainer){v.left=`${(100*g/e._pageWidth).toFixed(2)}%`;v.top=`${(100*f/e._pageHeight).toFixed(2)}%`}else{v.left=`${m}${g.toFixed(2)}px)`;v.top=`${m}${f.toFixed(2)}px)`}v.fontSize=`${m}${u.toFixed(2)}px)`;v.fontFamily=h.fontFamily;l.fontSize=u;r.setAttribute("role","presentation");r.textContent=t.str;r.dir=t.dir;e._fontInspectorEnabled&&(r.dataset.fontName=t.fontName);0!==d&&(l.angle=d*(180/Math.PI));let b=!1;if(t.str.length>1)b=!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&&(b=!0)}b&&(l.canvasWidth=h.vertical?t.height:t.width);e._textDivProperties.set(r,l);e._isReadableStream&&e._layoutText(r)}function layout(e){const{div:t,scale:i,properties:n,ctx:r,prevFontSize:s,prevFontFamily:a}=e,{style:o}=t;let l="";if(0!==n.canvasWidth&&n.hasText){const{fontFamily:c}=o,{canvasWidth:d,fontSize:h}=n;if(s!==h||a!==c){r.font=`${h*i}px ${c}`;e.prevFontSize=h;e.prevFontFamily=c}try{const{width:e}=r.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(e){var t;let{textContentSource:i,container:s,viewport:a,textDivs:o,textDivProperties:l,textContentItemsStr:c,isOffscreenCanvasSupported:d}=e;this._textContentSource=i;this._isReadableStream=i instanceof ReadableStream;this._container=this._rootContainer=s;this._textDivs=o||[];this._textContentItemsStr=c||[];this._isOffscreenCanvasSupported=d;this._fontInspectorEnabled=!(null===(t=globalThis.FontInspector)||void 0===t||!t.enabled);this._reader=null;this._textDivProperties=l||new WeakMap;this._canceled=!1;this._capability=new n.PromiseCapability;this._layoutTextParams={prevFontSize:null,prevFontFamily:null,div:null,scale:a.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:getCtx(0,d)};const{pageWidth:h,pageHeight:u,pageX:p,pageY:g}=a.rawDims;this._transform=[1,0,0,-1,-p,g+u];this._pageWidth=h;this._pageHeight=u;(0,r.setLayerDimensions)(s,a);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=new n.PromiseCapability;let t=Object.create(null);if(this._isReadableStream){const pump=()=>{this._reader.read().then((i=>{let{value:n,done:r}=i;if(r)e.resolve();else{Object.assign(t,n.styles);this._processItems(n.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>1e5)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)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.AnnotationEditorLayer=void 0;var n=i(1),r=i(140),s=i(163),a=i(164),o=i(141);class AnnotationEditorLayer{#Ne;#Be=!1;#Ve=this.pointerup.bind(this);#Ue=this.pointerdown.bind(this);#je=new Map;#He=!1;#We=!1;#ze;static _initialized=!1;constructor(e){if(!AnnotationEditorLayer._initialized){AnnotationEditorLayer._initialized=!0;s.FreeTextEditor.initialize(e.l10n);a.InkEditor.initialize(e.l10n)}e.uiManager.registerEditorTypes([s.FreeTextEditor,a.InkEditor]);this.#ze=e.uiManager;this.pageIndex=e.pageIndex;this.div=e.div;this.#Ne=e.accessibilityManager;this.#ze.addLayer(this)}get isEmpty(){return 0===this.#je.size}updateToolbar(e){this.#ze.updateToolbar(e)}updateMode(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.#ze.getMode();this.#Ge();if(e===n.AnnotationEditorType.INK){this.addInkEditorIfNeeded(!1);this.disableClick()}else this.enableClick();this.#ze.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.#ze.getMode()!==n.AnnotationEditorType.INK)return;if(!e)for(const e of this.#je.values())if(e.isEmpty()){e.setInBackground();return}this.#qe({offsetX:0,offsetY:0}).setInBackground()}setEditingState(e){this.#ze.setEditingState(e)}addCommands(e){this.#ze.addCommands(e)}enable(){this.div.style.pointerEvents="auto";for(const e of this.#je.values())e.enableEditing()}disable(){this.div.style.pointerEvents="none";for(const e of this.#je.values())e.disableEditing();this.#Ge();this.isEmpty&&(this.div.hidden=!0)}setActiveEditor(e){this.#ze.getActive()!==e&&this.#ze.setActiveEditor(e)}enableClick(){this.div.addEventListener("pointerdown",this.#Ue);this.div.addEventListener("pointerup",this.#Ve)}disableClick(){this.div.removeEventListener("pointerdown",this.#Ue);this.div.removeEventListener("pointerup",this.#Ve)}attach(e){this.#je.set(e.id,e)}detach(e){var t;this.#je.delete(e.id);null===(t=this.#Ne)||void 0===t||t.removePointerInTextLayer(e.contentDiv)}remove(e){this.#ze.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.#ze.focusMainContainer()}),0);this.#We||this.addInkEditorIfNeeded(!1)}#$e(e){var t;if(e.parent!==this){this.attach(e);null===(t=e.parent)||void 0===t||t.detach(e);e.setParent(this);if(e.div&&e.isAttachedToDOM){e.div.remove();this.div.append(e.div)}}}add(e){this.#$e(e);this.#ze.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.#ze.addToAnnotationStorage(e)}moveEditorInDOM(e){var t;null===(t=this.#Ne)||void 0===t||t.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.#ze.getId()}#Xe(e){switch(this.#ze.getMode()){case n.AnnotationEditorType.FREETEXT:return new s.FreeTextEditor(e);case n.AnnotationEditorType.INK:return new a.InkEditor(e)}return null}deserialize(e){switch(e.annotationType){case n.AnnotationEditorType.FREETEXT:return s.FreeTextEditor.deserialize(e,this,this.#ze);case n.AnnotationEditorType.INK:return a.InkEditor.deserialize(e,this,this.#ze)}return null}#qe(e){const t=this.getNextId(),i=this.#Xe({parent:this,id:t,x:e.offsetX,y:e.offsetY,uiManager:this.#ze});i&&this.add(i);return i}setSelected(e){this.#ze.setSelected(e)}toggleSelected(e){this.#ze.toggleSelected(e)}isSelected(e){return this.#ze.isSelected(e)}unselect(e){this.#ze.unselect(e)}pointerup(e){const{isMac:t}=n.FeatureTest.platform;if(!(0!==e.button||e.ctrlKey&&t)&&e.target===this.div&&this.#He){this.#He=!1;this.#Be?this.#qe(e):this.#Be=!0}}pointerdown(e){const{isMac:t}=n.FeatureTest.platform;if(0!==e.button||e.ctrlKey&&t)return;if(e.target!==this.div)return;this.#He=!0;const i=this.#ze.getActive();this.#Be=!i||i.isEmpty()}drop(e){const t=e.dataTransfer.getData("text/plain"),i=this.#ze.getEditor(t);if(!i)return;e.preventDefault();e.dataTransfer.dropEffect="move";this.#$e(i);const n=this.div.getBoundingClientRect(),r=e.clientX-n.x,s=e.clientY-n.y;i.translate(r-i.startX,s-i.startY);this.moveEditorInDOM(i);i.div.focus()}dragover(e){e.preventDefault()}destroy(){var e;(null===(e=this.#ze.getActive())||void 0===e?void 0:e.parent)===this&&this.#ze.setActiveEditor(null);for(const e of this.#je.values()){var t;null===(t=this.#Ne)||void 0===t||t.removePointerInTextLayer(e.contentDiv);e.setParent(null);e.isAttachedToDOM=!1;e.div.remove()}this.div=null;this.#je.clear();this.#ze.removeLayer(this)}#Ge(){this.#We=!0;for(const e of this.#je.values())e.isEmpty()&&e.remove();this.#We=!1}render(e){let{viewport:t}=e;this.viewport=t;(0,o.setLayerDimensions)(this.div,t);(0,r.bindEvents)(this,this.div,["dragover","drop"]);for(const e of this.#ze.getEditors(this.pageIndex))this.add(e);this.updateMode()}update(e){let{viewport:t}=e;this.#ze.commitOrRemove();this.viewport=t;(0,o.setLayerDimensions)(this.div,{rotation:t.rotation});this.updateMode()}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}}t.AnnotationEditorLayer=AnnotationEditorLayer},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.FreeTextEditor=void 0;var n=i(1),r=i(140),s=i(139);class FreeTextEditor extends s.AnnotationEditor{#Ke=this.editorDivBlur.bind(this);#Ye=this.editorDivFocus.bind(this);#Qe=this.editorDivInput.bind(this);#Ze=this.editorDivKeydown.bind(this);#Je;#et="";#tt=`${this.id}-editor`;#it=!1;#nt;static _freeTextDefaultContent="";static _l10nPromise;static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static _keyboardManager=new r.KeyboardManager([[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],FreeTextEditor.prototype.commitOrRemove]]);static _type="freetext";constructor(e){super({...e,name:"freeTextEditor"});this.#Je=e.color||FreeTextEditor._defaultColor||s.AnnotationEditor._defaultLineColor;this.#nt=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.#rt(t);break;case n.AnnotationEditorParamsType.FREETEXT_COLOR:this.#st(t)}}static get defaultPropertiesToUpdate(){return[[n.AnnotationEditorParamsType.FREETEXT_SIZE,FreeTextEditor._defaultFontSize],[n.AnnotationEditorParamsType.FREETEXT_COLOR,FreeTextEditor._defaultColor||s.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[n.AnnotationEditorParamsType.FREETEXT_SIZE,this.#nt],[n.AnnotationEditorParamsType.FREETEXT_COLOR,this.#Je]]}#rt(e){const setFontsize=e=>{this.editorDiv.style.fontSize=`calc(${e}px * var(--scale-factor))`;this.translate(0,-(e-this.#nt)*this.parentScale);this.#nt=e;this.#at()},t=this.#nt;this.addCommands({cmd:()=>{setFontsize(e)},undo:()=>{setFontsize(t)},mustExec:!0,type:n.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#st(e){const t=this.#Je;this.addCommands({cmd:()=>{this.#Je=this.editorDiv.style.color=e},undo:()=>{this.#Je=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.#nt)*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.#Ze);this.editorDiv.addEventListener("focus",this.#Ye);this.editorDiv.addEventListener("blur",this.#Ke);this.editorDiv.addEventListener("input",this.#Qe)}}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.#tt);this.div.draggable=!0;this.editorDiv.removeEventListener("keydown",this.#Ze);this.editorDiv.removeEventListener("focus",this.#Ye);this.editorDiv.removeEventListener("blur",this.#Ke);this.editorDiv.removeEventListener("input",this.#Qe);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()}#ot(){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")}#at(){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.#it){this.#it=!0;this.parent.addUndoableEditor(this)}this.disableEditMode();this.#et=this.#ot().trimEnd();this.#at()}}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.#tt);this.enableEditing();FreeTextEditor._l10nPromise.get("editor_free_text2_aria_label").then((e=>{var t;return null===(t=this.editorDiv)||void 0===t?void 0:t.setAttribute("aria-label",e)}));FreeTextEditor._l10nPromise.get("free_text2_default_content").then((e=>{var t;return null===(t=this.editorDiv)||void 0===t?void 0:t.setAttribute("default-content",e)}));this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;i.fontSize=`calc(${this.#nt}px * var(--scale-factor))`;i.color=this.#Je;this.div.append(this.editorDiv);this.overlayDiv=document.createElement("div");this.overlayDiv.classList.add("overlay","enabled");this.div.append(this.overlayDiv);(0,r.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.#et.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 r=super.deserialize(e,t,i);r.#nt=e.fontSize;r.#Je=n.Util.makeHexColor(...e.color);r.#et=e.value;return r}serialize(){if(this.isEmpty())return null;const e=FreeTextEditor._internalPadding*this.parentScale,t=this.getRect(e,e),i=s.AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#Je);return{annotationType:n.AnnotationEditorType.FREETEXT,color:i,fontSize:this.#nt,value:this.#et,pageIndex:this.pageIndex,rect:t,rotation:this.rotation}}}t.FreeTextEditor=FreeTextEditor},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.InkEditor=void 0;var n=i(1),r=i(139),s=i(140);const a=16;class InkEditor extends r.AnnotationEditor{#lt=0;#ct=0;#dt=0;#ht=this.canvasContextMenu.bind(this);#ut=this.canvasPointermove.bind(this);#pt=this.canvasPointerleave.bind(this);#gt=this.canvasPointerup.bind(this);#ft=this.canvasPointerdown.bind(this);#mt=new Path2D;#vt=!1;#bt=!1;#yt=!1;#wt=null;#_t=0;#St=0;#Pt=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.allRawPaths=[];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.#At(t);break;case n.AnnotationEditorParamsType.INK_COLOR:this.#st(t);break;case n.AnnotationEditorParamsType.INK_OPACITY:this.#Et(t)}}static get defaultPropertiesToUpdate(){return[[n.AnnotationEditorParamsType.INK_THICKNESS,InkEditor._defaultThickness],[n.AnnotationEditorParamsType.INK_COLOR,InkEditor._defaultColor||r.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||r.AnnotationEditor._defaultLineColor],[n.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??InkEditor._defaultOpacity))]]}#At(e){const t=this.thickness;this.addCommands({cmd:()=>{this.thickness=e;this.#xt()},undo:()=>{this.thickness=t;this.#xt()},mustExec:!0,type:n.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#st(e){const t=this.color;this.addCommands({cmd:()=>{this.color=e;this.#Ct()},undo:()=>{this.color=t;this.#Ct()},mustExec:!0,type:n.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#Et(e){e/=100;const t=this.opacity;this.addCommands({cmd:()=>{this.opacity=e;this.#Ct()},undo:()=>{this.opacity=t;this.#Ct()},mustExec:!0,type:n.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){super.rebuild();if(null!==this.div){if(!this.canvas){this.#Tt();this.#Mt()}if(!this.isAttachedToDOM){this.parent.add(this);this.#It()}this.#xt()}}remove(){if(null!==this.canvas){this.isEmpty()||this.commit();this.canvas.width=this.canvas.height=0;this.canvas.remove();this.canvas=null;this.#wt.disconnect();this.#wt=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.#vt&&null!==this.canvas){super.enableEditMode();this.div.draggable=!1;this.canvas.addEventListener("pointerdown",this.#ft)}}disableEditMode(){if(this.isInEditMode()&&null!==this.canvas){super.disableEditMode();this.div.draggable=!this.isEmpty();this.div.classList.remove("editing");this.canvas.removeEventListener("pointerdown",this.#ft)}}onceAdded(){this.div.draggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}#kt(){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]}}#Dt(){const{ctx:e,color:t,opacity:i,thickness:n,parentScale:r,scaleFactor:a}=this;e.lineWidth=n*r/a;e.lineCap="round";e.lineJoin="round";e.miterLimit=10;e.strokeStyle=`${t}${(0,s.opacityToHex)(i)}`}#Ft(e,t){this.canvas.addEventListener("contextmenu",this.#ht);this.canvas.addEventListener("pointerleave",this.#pt);this.canvas.addEventListener("pointermove",this.#ut);this.canvas.addEventListener("pointerup",this.#gt);this.canvas.removeEventListener("pointerdown",this.#ft);this.isEditing=!0;if(!this.#yt){this.#yt=!0;this.#It();this.thickness||=InkEditor._defaultThickness;this.color||=InkEditor._defaultColor||r.AnnotationEditor._defaultLineColor;this.opacity??=InkEditor._defaultOpacity}this.currentPath.push([e,t]);this.#bt=!1;this.#Dt();this.#Pt=()=>{this.#Lt();this.#Pt&&window.requestAnimationFrame(this.#Pt)};window.requestAnimationFrame(this.#Pt)}#Rt(e,t){const[i,n]=this.currentPath.at(-1);if(this.currentPath.length>1&&e===i&&t===n)return;const r=this.currentPath;let s=this.#mt;r.push([e,t]);this.#bt=!0;if(r.length<=2){s.moveTo(...r[0]);s.lineTo(e,t)}else{if(3===r.length){this.#mt=s=new Path2D;s.moveTo(...r[0])}this.#Ot(s,...r.at(-3),...r.at(-2),e,t)}}#Nt(){if(0===this.currentPath.length)return;const e=this.currentPath.at(-1);this.#mt.lineTo(...e)}#Bt(e,t){this.#Pt=null;e=Math.min(Math.max(e,0),this.canvas.width);t=Math.min(Math.max(t,0),this.canvas.height);this.#Rt(e,t);this.#Nt();let i;if(1!==this.currentPath.length)i=this.#Vt();else{const n=[e,t];i=[[n,n.slice(),n.slice(),n]]}const n=this.#mt,r=this.currentPath;this.currentPath=[];this.#mt=new Path2D;this.addCommands({cmd:()=>{this.allRawPaths.push(r);this.paths.push(i);this.bezierPath2D.push(n);this.rebuild()},undo:()=>{this.allRawPaths.pop();this.paths.pop();this.bezierPath2D.pop();if(0===this.paths.length)this.remove();else{if(!this.canvas){this.#Tt();this.#Mt()}this.#xt()}},mustExec:!0})}#Lt(){if(!this.#bt)return;this.#bt=!1;const e=Math.ceil(this.thickness*this.parentScale),t=this.currentPath.slice(-3),i=t.map((e=>e[0])),n=t.map((e=>e[1])),{ctx:r}=(Math.min(...i),Math.max(...i),Math.min(...n),Math.max(...n),this);r.save();r.clearRect(0,0,this.canvas.width,this.canvas.height);for(const e of this.bezierPath2D)r.stroke(e);r.stroke(this.#mt);r.restore()}#Ot(e,t,i,n,r,s,a){const o=(t+n)/2,l=(i+r)/2,c=(n+s)/2,d=(r+a)/2;e.bezierCurveTo(o+2*(n-o)/3,l+2*(r-l)/3,c+2*(n-c)/3,d+2*(r-d)/3,c,d)}#Vt(){const e=this.currentPath;if(e.length<=2)return[[e[0],e[0],e.at(-1),e.at(-1)]];const t=[];let i,[n,r]=e[0];for(i=1;i<e.length-2;i++){const[s,a]=e[i],[o,l]=e[i+1],c=(s+o)/2,d=(a+l)/2,h=[n+2*(s-n)/3,r+2*(a-r)/3],u=[c+2*(s-c)/3,d+2*(a-d)/3];t.push([[n,r],h,u,[c,d]]);[n,r]=[c,d]}const[s,a]=e[i],[o,l]=e[i+1],c=[n+2*(s-n)/3,r+2*(a-r)/3],d=[o+2*(s-o)/3,l+2*(a-l)/3];t.push([[n,r],c,d,[o,l]]);return t}#Ct(){if(this.isEmpty()){this.#Ut();return}this.#Dt();const{canvas:e,ctx:t}=this;t.setTransform(1,0,0,1,0,0);t.clearRect(0,0,e.width,e.height);this.#Ut();for(const e of this.bezierPath2D)t.stroke(e)}commit(){if(!this.#vt){super.commit();this.isEditing=!1;this.disableEditMode();this.setInForeground();this.#vt=!0;this.div.classList.add("disabled");this.#xt(!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.#vt){this.setInForeground();e.preventDefault();"mouse"!==e.type&&this.div.focus();this.#Ft(e.offsetX,e.offsetY)}}canvasContextMenu(e){e.preventDefault()}canvasPointermove(e){e.preventDefault();this.#Rt(e.offsetX,e.offsetY)}canvasPointerup(e){e.preventDefault();this.#jt(e)}canvasPointerleave(e){this.#jt(e)}#jt(e){this.canvas.removeEventListener("pointerleave",this.#pt);this.canvas.removeEventListener("pointermove",this.#ut);this.canvas.removeEventListener("pointerup",this.#gt);this.canvas.addEventListener("pointerdown",this.#ft);setTimeout((()=>{this.canvas.removeEventListener("contextmenu",this.#ht)}),10);this.#Bt(e.offsetX,e.offsetY);this.addToAnnotationStorage();this.setInBackground()}#Tt(){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=>{var t;return null===(t=this.canvas)||void 0===t?void 0:t.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)}#Mt(){this.#wt=new ResizeObserver((e=>{const t=e[0].contentRect;t.width&&t.height&&this.setDimensions(t.width,t.height)}));this.#wt.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=>{var t;return null===(t=this.div)||void 0===t?void 0:t.setAttribute("aria-label",e)}));const[i,n,r,s]=this.#kt();this.setAt(i,n,0,0);this.setDims(r,s);this.#Tt();if(this.width){const[i,n]=this.parentDimensions;this.setAt(e*i,t*n,this.width*i,this.height*n);this.#yt=!0;this.#It();this.setDims(this.width*i,this.height*n);this.#Ct();this.#Ht();this.div.classList.add("disabled")}else{this.div.classList.add("editing");this.enableEditMode()}this.#Mt();return this.div}#It(){if(!this.#yt)return;const[e,t]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*e);this.canvas.height=Math.ceil(this.height*t);this.#Ut()}setDimensions(e,t){const i=Math.round(e),n=Math.round(t);if(this.#_t===i&&this.#St===n)return;this.#_t=i;this.#St=n;this.canvas.style.visibility="hidden";if(this.#lt&&Math.abs(this.#lt-e/t)>.01){t=Math.ceil(e/this.#lt);this.setDims(e,t)}const[r,s]=this.parentDimensions;this.width=e/r;this.height=t/s;this.#vt&&this.#Wt(e,t);this.#It();this.#Ct();this.canvas.style.visibility="visible";this.fixDims()}#Wt(e,t){const i=this.#zt(),n=(e-i)/this.#dt,r=(t-i)/this.#ct;this.scaleFactor=Math.min(n,r)}#Ut(){const e=this.#zt()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+e,this.translationY*this.scaleFactor+e)}static#Gt(e){const t=new Path2D;for(let i=0,n=e.length;i<n;i++){const[n,r,s,a]=e[i];0===i&&t.moveTo(...n);t.bezierCurveTo(r[0],r[1],s[0],s[1],a[0],a[1])}return t}#qt(e,t,i,n){const r=[],s=this.thickness/2;let a,o;for(const l of this.paths){a=[];o=[];for(let r=0,c=l.length;r<c;r++){const[c,d,h,u]=l[r],p=e*(c[0]+t)+s,g=n-e*(c[1]+i)-s,f=e*(d[0]+t)+s,m=n-e*(d[1]+i)-s,v=e*(h[0]+t)+s,b=n-e*(h[1]+i)-s,y=e*(u[0]+t)+s,w=n-e*(u[1]+i)-s;if(0===r){a.push(p,g);o.push(p,g)}a.push(f,m,v,b,y,w);this.#$t(p,g,f,m,v,b,y,w,4,o)}r.push({bezier:a,points:o})}return r}#$t(e,t,i,n,r,s,a,o,l,c){if(this.#Xt(e,t,i,n,r,s,a,o))c.push(a,o);else{for(let d=1;d<l-1;d++){const h=d/l,u=1-h;let p=h*e+u*i,g=h*t+u*n,f=h*i+u*r,m=h*n+u*s;p=h*p+u*f;g=h*g+u*m;f=h*f+u*(h*r+u*a);m=h*m+u*(h*s+u*o);p=h*p+u*f;g=h*g+u*m;c.push(p,g)}c.push(a,o)}}#Xt(e,t,i,n,r,s,a,o){const l=(3*i-2*e-a)**2,c=(3*n-2*t-o)**2,d=(3*r-e-2*a)**2,h=(3*s-t-2*o)**2;return Math.max(l,d)+Math.max(c,h)<=10}#Kt(){let e=1/0,t=-1/0,i=1/0,r=-1/0;for(const s of this.paths)for(const[a,o,l,c]of s){const s=n.Util.bezierBoundingBox(...a,...o,...l,...c);e=Math.min(e,s[0]);i=Math.min(i,s[1]);t=Math.max(t,s[2]);r=Math.max(r,s[3])}return[e,i,t,r]}#zt(){return this.#vt?Math.ceil(this.thickness*this.parentScale):0}#xt(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return;if(!this.#vt){this.#Ct();return}const t=this.#Kt(),i=this.#zt();this.#dt=Math.max(a,t[2]-t[0]);this.#ct=Math.max(a,t[3]-t[1]);const n=Math.ceil(i+this.#dt*this.scaleFactor),r=Math.ceil(i+this.#ct*this.scaleFactor),[s,o]=this.parentDimensions;this.width=n/s;this.height=r/o;this.#lt=n/r;this.#Ht();const l=this.translationX,c=this.translationY;this.translationX=-t[0];this.translationY=-t[1];this.#It();this.#Ct();this.#_t=n;this.#St=r;this.setDims(n,r);const d=e?i/this.scaleFactor/2:0;this.translate(l-this.translationX-d,c-this.translationY-d)}#Ht(){const{style:e}=this.div;if(this.#lt>=1){e.minHeight="16px";e.minWidth=`${Math.round(this.#lt*a)}px`}else{e.minWidth="16px";e.minHeight=`${Math.round(a/this.#lt)}px`}}static deserialize(e,t,i){const r=super.deserialize(e,t,i);r.thickness=e.thickness;r.color=n.Util.makeHexColor(...e.color);r.opacity=e.opacity;const[s,o]=r.pageDimensions,l=r.width*s,c=r.height*o,d=r.parentScale,h=e.thickness/2;r.#lt=l/c;r.#vt=!0;r.#_t=Math.round(l);r.#St=Math.round(c);for(const{bezier:t}of e.paths){const e=[];r.paths.push(e);let i=d*(t[0]-h),n=d*(c-t[1]-h);for(let r=2,s=t.length;r<s;r+=6){const s=d*(t[r]-h),a=d*(c-t[r+1]-h),o=d*(t[r+2]-h),l=d*(c-t[r+3]-h),u=d*(t[r+4]-h),p=d*(c-t[r+5]-h);e.push([[i,n],[s,a],[o,l],[u,p]]);i=u;n=p}const s=this.#Gt(e);r.bezierPath2D.push(s)}const u=r.#Kt();r.#dt=Math.max(a,u[2]-u[0]);r.#ct=Math.max(a,u[3]-u[1]);r.#Wt(l,c);return r}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=r.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:n.AnnotationEditorType.INK,color:i,thickness:this.thickness,opacity:this.opacity,paths:this.#qt(this.scaleFactor/this.parentScale,this.translationX,this.translationY,t),pageIndex:this.pageIndex,rect:e,rotation:this.rotation}}}t.InkEditor=InkEditor},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.AnnotationLayer=void 0;var n=i(1),r=i(141),s=i(138),a=i(166),o=i(167);const l=1e3,c=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){let{isRenderable:t=!1,ignoreBorder:i=!1,createQuadrilaterals:n=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[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(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{data:t,page:i,viewport:r}=this,s=document.createElement("section");s.setAttribute("data-annotation-id",t.id);t.noRotate&&s.classList.add("norotate");const{pageWidth:a,pageHeight:o,pageX:l,pageY:c}=r.rawDims,{width:d,height:h}=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){s.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))`;s.style.borderRadius=t}else if(this instanceof RadioButtonWidgetAnnotationElement){const e=`calc(${d}px * var(--scale-factor)) / calc(${h}px * var(--scale-factor))`;s.style.borderRadius=e}switch(t.borderStyle.style){case n.AnnotationBorderStyleType.SOLID:s.style.borderStyle="solid";break;case n.AnnotationBorderStyleType.DASHED:s.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:s.style.borderBottomStyle="solid"}const r=t.borderColor||null;r?s.style.borderColor=n.Util.makeHexColor(0|r[0],0|r[1],0|r[2]):s.style.borderWidth=0}s.style.left=100*(u[0]-l)/a+"%";s.style.top=100*(u[1]-c)/o+"%";const{rotation:p}=t;if(t.hasOwnCanvas||0===p){s.style.width=100*d/a+"%";s.style.height=100*h/o+"%"}else this.setRotation(p,s);return s}setRotation(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.container;const{pageWidth:i,pageHeight:n}=this.viewport.rawDims,{width:r,height:s}=getRectDims(this.data.rect);let a,o;if(e%180==0){a=100*r/i;o=100*s/n}else{a=100*s/i;o=100*r/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,{hidden:t,print:0===e.detail.display||3===e.detail.display})},print:e=>{this.annotationStorage.setValue(this.data.id,{print:e.detail.print})},hidden:e=>{this.container.style.visibility=e.detail.hidden?"hidden":"visible";this.annotationStorage.setValue(this.data.id,{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,{rotation:t})}})}_dispatchEventFromSandbox(e,t){const i=this._commonActions;for(const n of Object.keys(t.detail)){const r=e[n]||i[n];null==r||r(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,r]of Object.entries(t)){const s=i[n];if(s){s({detail:{[n]:r},target:e});delete t[n]}}}_createQuadrilaterals(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];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||=this.quadrilaterals;i=this.quadrilaterals[0]}if(!e){(e=document.createElement("div")).classList.add("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.classList.add(e);return this.quadrilaterals}render(){(0,n.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=[];if(this._fieldObjects){const r=this._fieldObjects[e];if(r)for(const{page:e,id:s,exportValues:a}of r){if(-1===e)continue;if(s===t)continue;const r="string"==typeof a?a:null,o=document.querySelector(`[data-element-id="${s}"]`);!o||c.has(o)?i.push({id:s,exportValue:r,domElement:o}):(0,n.warn)(`_getElementsByName - element not allowed: ${s}`)}return i}for(const n of document.getElementsByName(e)){const{exportValue:e}=n,r=n.getAttribute("data-element-id");r!==t&&(c.has(n)&&i.push({id:r,exportValue:e,domElement:n}))}return i}}class LinkAnnotationElement extends AnnotationElement{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;super(e,{isRenderable:!0,ignoreBorder:!(null==t||!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.#Yt(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.classList.add("linkAnnotation");n&&this.container.append(i);return this.container}#Qt(){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.#Qt()}_bindNamedAction(e,t){e.href=this.linkService.getAnchorUrl("");e.onclick=()=>{this.linkService.executeNamedAction(t);return!1};this.#Qt()}_bindAttachment(e,t){e.href=this.linkService.getAnchorUrl("");e.onclick=()=>{var e;null===(e=this.downloadManager)||void 0===e||e.openOrDownloadData(this.container,t.content,t.filename);return!1};this.#Qt()}#Yt(e,t){e.href=this.linkService.getAnchorUrl("");e.onclick=()=>{this.linkService.executeSetOCGState(t);return!1};this.#Qt()}_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 r=i.get(n);r&&(e[r]=()=>{var e;null===(e=this.linkService.eventBus)||void 0===e||e.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t.id,name:n}});return!1})}e.onclick||(e.onclick=()=>!1);this.#Qt()}_bindResetFormAction(e,t){const i=e.onclick;i||(e.href=this.linkService.getAnchorUrl(""));this.#Qt();if(this._fieldObjects)e.onclick=()=>{null==i||i();const{fields:e,refs:r,include:s}=t,a=[];if(0!==e.length||0!==r.length){const t=new Set(r);for(const i of e){const e=this._fieldObjects[i]||[];for(const{id:i}of e)t.add(i)}for(const e of Object.values(this._fieldObjects))for(const i of e)t.has(i.id)===s&&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,{value:i});window.updateAngularFormValue(t,{value:i});break}case"checkbox":case"radiobutton":{const i=e.defaultValue===e.exportValues;o.setValue(t,{value:i});window.updateAngularFormValue(t,{value:i});break}case"combobox":case"listbox":{const i=e.defaultValue||"";o.setValue(t,{value:i});window.updateAngularFormValue(t,{value:i});break}default:continue}const i=document.querySelector(`[data-element-id="${t}"]`);i&&(c.has(i)?i.dispatchEvent(new Event("resetform")):(0,n.warn)(`_bindResetFormAction - element not allowed: ${t}`))}if(this.enableScripting){var d;null===(d=this.linkService.eventBus)||void 0===d||d.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){var t,i,n;super(e,{isRenderable:!!(e.data.hasPopup||null!==(t=e.data.titleObj)&&void 0!==t&&t.str||null!==(i=e.data.contentsObj)&&void 0!==i&&i.str||null!==(n=e.data.richText)&&void 0!==n&&n.str)})}render(){this.container.classList.add("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}showElementAndHideCanvas(e){if(this.data.hasOwnCanvas){var t;"CANVAS"===(null===(t=e.previousSibling)||void 0===t?void 0:t.nodeName)&&(e.previousSibling.hidden=!0);e.hidden=!1}}_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=>{var t;null===(t=this.linkService.eventBus)||void 0===t||t.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=>{var t;null===(t=this.linkService.eventBus)||void 0===t||t.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(e)}})}))}_setEventListeners(e,t,i){for(const[r,s]of t){var n;("Action"===s||null!==(n=this.data.actions)&&void 0!==n&&n[s])&&this._setEventListener(e,r,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,r=this.data.defaultAppearanceData.fontSize||9,s=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*r))||1);a=Math.min(r,roundToOneDecimal(t/n.LINE_FACTOR))}else{const e=Math.abs(this.data.rect[3]-this.data.rect[1]-2);a=Math.min(r,roundToOneDecimal(e/n.LINE_FACTOR))}s.fontSize=`calc(${a}px * var(--scale-factor))`;s.color=n.Util.makeHexColor(i[0],i[1],i[2]);null!==this.data.textAlignment&&(s.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 r=this.annotationStorage;for(const s of this._getElementsByName(e.name,e.id)){s.domElement&&(s.domElement[t]=i);r.setValue(s.id,{[n]:i})}}render(){const e=this.annotationStorage,t=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){var n;const s=window.getFormValueFromAngular(this.data.fieldName),a=s.value?s:e.getValue(t,{value:this.data.fieldValue});let o=a.value||"";const d=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;d&&o.length>d&&(o=o.slice(0,d));let h=a.formattedValue||(null===(n=this.data.textContent)||void 0===n?void 0:n.join("\n"))||null;h&&this.data.comb&&(h=h.replaceAll(/\s+/g,""));const u={userValue:o,formattedValue:h,lastCommittedValue:null,commitKey:1};if(this.data.multiLine){i=document.createElement("textarea");i.textContent=h??o;this.data.doNotScroll&&(i.style.overflowY="hidden")}else{i=document.createElement("input");i.type="text";i.setAttribute("value",h??o);this.data.doNotScroll&&(i.style.overflowX="hidden")}this.data.hasOwnCanvas&&(i.hidden=!0);c.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);d&&(i.maxLength=d);i.addEventListener("input",(n=>{e.setValue(t,{value:n.target.value});window.updateAngularFormValue(t,{value:n.target.value});this.setPropertyOnSiblings(i,"value",n.target.value,"value");u.formattedValue=null}));i.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue??"";i.value=u.userValue=t;u.formattedValue=null}));let blurListener=e=>{const{formattedValue:t}=u;null!=t&&(e.target.value=t);e.target.scrollLeft=0};window.registerAcroformField(t,i,a.value);i.addEventListener("updateFromAngular",(i=>e.setValue(t,{value:i.detail})));if(this.enableScripting&&this.hasJSActions){var r;i.addEventListener("focus",(e=>{const{target:t}=e;u.userValue&&(t.value=u.userValue);u.lastCommittedValue=t.value;u.commitKey=1}));i.addEventListener("updatefromsandbox",(i=>{this.showElementAndHideCanvas(i.target);const n={value(i){u.userValue=i.detail.value??"";e.setValue(t,{value:u.userValue.toString()});window.updateAngularFormValue(t,{value:u.userValue.toString()});i.target.value=u.userValue},formattedValue(i){const{formattedValue:n}=i.detail;u.formattedValue=n;null!=n&&i.target!==document.activeElement&&(i.target.value=n);e.setValue(t,{formattedValue:n});window.updateAngularFormValue(t,{formattedValue:n})},selRange(e){e.target.setSelectionRange(...e.detail.selRange)},charLimit:i=>{var n;const{charLimit:r}=i.detail,{target:s}=i;if(0===r){s.removeAttribute("maxLength");return}s.setAttribute("maxLength",r);let a=u.userValue;if(a&&!(a.length<=r)){a=a.slice(0,r);s.value=u.userValue=a;e.setValue(t,{value:a});window.updateAngularFormValue(t,{value:a});null===(n=this.linkService.eventBus)||void 0===n||n.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:a,willCommit:!0,commitKey:1,selStart:s.selectionStart,selEnd:s.selectionEnd}})}}};this._dispatchEventFromSandbox(n,i)}));i.addEventListener("keydown",(e=>{var i;u.commitKey=1;let n=-1;"Escape"===e.key?n=0:"Enter"!==e.key||this.data.multiLine?"Tab"===e.key&&(u.commitKey=3):n=2;if(-1===n)return;const{value:r}=e.target;if(u.lastCommittedValue!==r){u.lastCommittedValue=r;u.userValue=r;null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:r,willCommit:!0,commitKey:n,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}})}}));const n=blurListener;blurListener=null;i.addEventListener("blur",(e=>{if(!e.relatedTarget)return;const{value:i}=e.target;u.userValue=i;if(u.lastCommittedValue!==i){var r;null===(r=this.linkService.eventBus)||void 0===r||r.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:i,willCommit:!0,commitKey:u.commitKey,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}})}n(e)}));null!==(r=this.data.actions)&&void 0!==r&&r.Keystroke&&i.addEventListener("beforeinput",(e=>{var i;u.lastCommittedValue=null;const{data:n,target:r}=e,{value:s,selectionStart:a,selectionEnd:o}=r;let l=a,c=o;switch(e.inputType){case"deleteWordBackward":{const e=s.substring(0,a).match(/\w*[^\w]*$/);e&&(l-=e[0].length);break}case"deleteWordForward":{const e=s.substring(a).match(/^[^\w]*\w*/);e&&(c+=e[0].length);break}case"deleteContentBackward":a===o&&(l-=1);break;case"deleteContentForward":a===o&&(c+=1)}e.preventDefault();null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:s,change:n||"",willCommit:!1,selStart:l,selEnd:c}})}));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])/d;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,n=window.getFormValueFromAngular(this.data.fieldName);let r;n.value&&(r=!0===n.value||n.value===t.exportValue);let s=void 0!==r?r:e.getValue(i,{value:t.exportValue===t.fieldValue}).value;if("string"==typeof s){s="Off"!==s;e.setValue(i,{value:s});window.updateAngularFormValue(i,{value:s})}this.container.classList.add("buttonWidgetAnnotation","checkBox");const a=document.createElement("input");c.add(a);a.setAttribute("data-element-id",i);a.disabled=t.readOnly;this._setRequired(a,this.data.required);a.type="checkbox";a.name=t.fieldName;s&&a.setAttribute("checked",!0);a.setAttribute("exportValue",t.exportValue);a.tabIndex=l;a.addEventListener("change",(n=>{const{name:r,checked:s}=n.target;for(const n of this._getElementsByName(r,i)){const r=s&&n.exportValue===t.exportValue;n.domElement&&(n.domElement.checked=r);e.setValue(n.id,{value:r});window.updateAngularFormValue(i,{value:r})}e.setValue(i,{value:s});window.updateAngularFormValue(i,{value:s})}));a.addEventListener("resetform",(e=>{const i=t.defaultFieldValue||"Off";e.target.checked=i===t.exportValue}));window.registerAcroformField(i,a,!!s&&t.exportValue);a.addEventListener("updateFromAngular",(t=>e.setValue(i,{value:t.detail})));if(this.enableScripting&&this.hasJSActions){a.addEventListener("updatefromsandbox",(t=>{const n={value(t){t.target.checked="Off"!==t.detail.value;e.setValue(i,{value:t.target.checked});window.updateAngularFormValue(i,{value:t.target.value})}};this._dispatchEventFromSandbox(n,t)}));this._setEventListeners(a,[["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(a);this._setDefaultPropertiesFromJS(a);this.container.append(a);return this.container}}class RadioButtonWidgetAnnotationElement extends WidgetAnnotationElement{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,t=this.data,i=t.id;let n=window.getFormValueFromAngular(this.data.fieldName).value??e.getValue(i,{value:t.fieldValue===t.buttonValue}).value;if("string"==typeof n){n=n===t.buttonValue;e.setValue(i,{value:n})}else n&&window.updateAngularFormValue(i,{value:t.buttonValue});const r=document.createElement("input");c.add(r);r.setAttribute("data-element-id",i);r.disabled=t.readOnly;this._setRequired(r,this.data.required);r.type="radio";r.name=t.fieldName;n&&r.setAttribute("checked",!0);r.tabIndex=l;r.addEventListener("change",(t=>{const{name:n,checked:r}=t.target;for(const t of this._getElementsByName(n,i)){e.setValue(t.id,{value:!1});window.updateAngularFormValue(t.id,{value:!1})}e.setValue(i,{value:r});window.updateAngularFormValue(i,{value:r})}));r.addEventListener("resetform",(e=>{const i=t.defaultFieldValue;e.target.checked=null!=i&&i===t.buttonValue}));window.registerAcroformField(i,r,n?t.buttonValue:void 0,t.buttonValue);r.addEventListener("updateFromAngular",(t=>e.setValue(i,{value:t.detail})));if(this.enableScripting&&this.hasJSActions){const n=t.buttonValue;r.addEventListener("updatefromsandbox",(t=>{const 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,{value:t});window.updateAngularFormValue(i,{value:t})}}};this._dispatchEventFromSandbox(r,t)}));this._setEventListeners(r,[["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(r);this._setDefaultPropertiesFromJS(r);this.container.append(r);return this.container}}class PushButtonWidgetAnnotationElement extends LinkAnnotationElement{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("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.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,t=this.data.id,i=window.getFormValueFromAngular(this.data.fieldName),n=i.value?i:e.getValue(t,{value:this.data.fieldValue}),r=document.createElement("select");c.add(r);r.setAttribute("data-element-id",t);r.disabled=this.data.readOnly;this._setRequired(r,this.data.required);r.name=this.data.fieldName;r.tabIndex=l;let s=this.data.combo&&this.data.options.length>0;if(!this.data.combo){r.size=this.data.options.length;this.data.multiSelect&&(r.multiple=!0)}r.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue;for(const e of r.options)e.selected=e.value===t}));for(const e of this.data.options){const t=document.createElement("option");t.textContent=e.displayValue;t.value=e.exportValue;if(n.value.includes(e.exportValue)){t.setAttribute("selected",!0);s=!1}r.append(t)}let a=null;if(s){const e=document.createElement("option");e.value=" ";e.setAttribute("hidden",!0);e.setAttribute("selected",!0);r.prepend(e);a=()=>{e.remove();r.removeEventListener("input",a);a=null};r.addEventListener("input",a)}const getValue=e=>{const t=e?"value":"textContent",{options:i,multiple:n}=r;return n?Array.prototype.filter.call(i,(e=>e.selected)).map((e=>e[t])):-1===i.selectedIndex?null:i[i.selectedIndex][t]};let o=getValue(!1);const getItems=e=>{const t=e.target.options;return Array.prototype.map.call(t,(e=>({displayValue:e.textContent,exportValue:e.value})))};window.registerAcroformField(t,r,o);r.addEventListener("updateFromAngular",(i=>e.setValue(t,{value:i.detail})));if(this.enableScripting&&this.hasJSActions){r.addEventListener("updatefromsandbox",(i=>{const n={value(i){var n;null===(n=a)||void 0===n||n();const s=i.detail.value,l=new Set(Array.isArray(s)?s:[s]);for(const e of r.options)e.selected=l.has(e.value);e.setValue(t,{value:getValue(!0)});o=getValue(!1);window.updateAngularFormValue(t,{value:o})},multipleSelection(e){r.multiple=!0},remove(i){const n=r.options,s=i.detail.remove;n[s].selected=!1;r.remove(s);if(n.length>0){-1===Array.prototype.findIndex.call(n,(e=>e.selected))&&(n[0].selected=!0)}e.setValue(t,{value:getValue(!0),items:getItems(i)});o=getValue(!1)},clear(i){for(;0!==r.length;)r.remove(0);e.setValue(t,{value:null,items:[]});o=getValue(!1);window.updateAngularFormValue(t,{value:o})},insert(i){const{index:n,displayValue:s,exportValue:a}=i.detail.insert,l=r.children[n],c=document.createElement("option");c.textContent=s;c.value=a;l?l.before(c):r.append(c);e.setValue(t,{value:getValue(!0),items:getItems(i)});o=getValue(!1);window.updateAngularFormValue(t,{value:o})},items(i){const{items:n}=i.detail;for(;0!==r.length;)r.remove(0);for(const e of n){const{displayValue:t,exportValue:i}=e,n=document.createElement("option");n.textContent=t;n.value=i;r.append(n)}r.options.length>0&&(r.options[0].selected=!0);e.setValue(t,{value:getValue(!0),items:getItems(i)});o=getValue(!1);window.updateAngularFormValue(t,{value:o})},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,{value:getValue(!0)});o=getValue(!1);window.updateAngularFormValue(t,{value:o})},editable(e){e.target.disabled=!e.detail.editable}};this._dispatchEventFromSandbox(n,i)}));r.addEventListener("input",(i=>{var n;const r=getValue(!0);e.setValue(t,{value:r});window.updateAngularFormValue(t,{value:r});i.preventDefault();null===(n=this.linkService.eventBus)||void 0===n||n.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:o,changeEx:r,willCommit:!1,commitKey:1,keyDown:!1}})}));this._setEventListeners(r,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],(e=>e.target.value))}else r.addEventListener("input",(function(i){e.setValue(t,{value:getValue(!0)});window.updateAngularFormValue(t,{value:getValue(!0)})}));this.data.combo&&this._setTextStyle(r);this._setBackgroundColor(r);this._setDefaultPropertiesFromJS(r);this.container.append(r);return this.container}}class PopupAnnotationElement extends AnnotationElement{static IGNORE_TYPES=new Set(["Line","Square","Circle","PolyLine","Polygon","Ink"]);constructor(e){var t,i,n;const{data:r}=e;super(e,{isRenderable:!PopupAnnotationElement.IGNORE_TYPES.has(r.parentType)&&!!(null!==(t=r.titleObj)&&void 0!==t&&t.str||null!==(i=r.contentsObj)&&void 0!==i&&i.str||null!==(n=r.richText)&&void 0!==n&&n.str)})}render(){this.container.classList.add("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,r=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]]),s=r[0]+this.data.parentRect[2]-this.data.parentRect[0],a=r[1],{pageWidth:o,pageHeight:l,pageX:c,pageY:d}=this.viewport.rawDims;this.container.style.left=100*(s-c)/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(){var e,t;const i=document.createElement("div");i.classList.add("popupWrapper");this.hideElement=this.hideWrapper?i:this.container;this.hideElement.hidden=!0;const s=document.createElement("div");s.classList.add("popup");const a=this.color;if(a){const e=.7*(255-a[0])+a[0],t=.7*(255-a[1])+a[1],i=.7*(255-a[2])+a[2];s.style.backgroundColor=n.Util.makeHexColor(0|e,0|t,0|i)}const l=document.createElement("h1");l.dir=this.titleObj.dir;l.textContent=this.titleObj.str;s.append(l);const c=r.PDFDateString.toDateObject(this.modificationDate);if(c){const e=document.createElement("span");e.classList.add("popupDate");e.textContent="{{date}}, {{time}}";e.dataset.l10nId="annotation_date_string";e.dataset.l10nArgs=JSON.stringify({date:c.toLocaleDateString(),time:c.toLocaleTimeString()});s.append(e)}if(null===(e=this.richText)||void 0===e||!e.str||null!==(t=this.contentsObj)&&void 0!==t&&t.str&&this.contentsObj.str!==this.richText.str){const e=this._formatContents(this.contentsObj);s.append(e)}else{o.XfaLayer.render({xfaHtml:this.richText.html,intent:"richText",div:s});s.lastChild.classList.add("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))}s.addEventListener("click",this._hide.bind(this,!0));i.append(s);return i}_formatContents(e){let{str:t,dir:i}=e;const n=document.createElement("p");n.classList.add("popupContent");n.dir=i;const r=t.split(/(?:\r\n?|\n)/);for(let e=0,t=r.length;e<t;++e){const i=r[e];n.append(document.createTextNode(i));e<t-1&&n.append(document.createElement("br"))}return n}_toggle(){this.pinned?this._hide(!0):this._show(!0)}_show(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this.pinned=!0);if(this.hideElement.hidden){this.hideElement.hidden=!1;this.container.style.zIndex=parseInt(this.container.style.zIndex)+1e3}}_hide(){(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&(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){var t,i,n;super(e,{isRenderable:!!(e.data.hasPopup||null!==(t=e.data.titleObj)&&void 0!==t&&t.str||null!==(i=e.data.contentsObj)&&void 0!==i&&i.str||null!==(n=e.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0});this.textContent=e.data.textContent}render(){this.container.classList.add("freeTextAnnotation");if(this.textContent){const e=document.createElement("div");e.classList.add("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){var t,i,n;super(e,{isRenderable:!!(e.data.hasPopup||null!==(t=e.data.titleObj)&&void 0!==t&&t.str||null!==(i=e.data.contentsObj)&&void 0!==i&&i.str||null!==(n=e.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");const e=this.data,{width:t,height:i}=getRectDims(e.rect),n=this.svgFactory.create(t,i,!0),r=this.svgFactory.createElement("svg:line");r.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]);r.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]);r.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]);r.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]);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 SquareAnnotationElement extends AnnotationElement{constructor(e){var t,i,n;super(e,{isRenderable:!!(e.data.hasPopup||null!==(t=e.data.titleObj)&&void 0!==t&&t.str||null!==(i=e.data.contentsObj)&&void 0!==i&&i.str||null!==(n=e.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");const e=this.data,{width:t,height:i}=getRectDims(e.rect),n=this.svgFactory.create(t,i,!0),r=e.borderStyle.width,s=this.svgFactory.createElement("svg:rect");s.setAttribute("x",r/2);s.setAttribute("y",r/2);s.setAttribute("width",t-r);s.setAttribute("height",i-r);s.setAttribute("stroke-width",r||1);s.setAttribute("stroke","transparent");s.setAttribute("fill","transparent");n.append(s);this.container.append(n);this._createPopup(s,e);return this.container}}class CircleAnnotationElement extends AnnotationElement{constructor(e){var t,i,n;super(e,{isRenderable:!!(e.data.hasPopup||null!==(t=e.data.titleObj)&&void 0!==t&&t.str||null!==(i=e.data.contentsObj)&&void 0!==i&&i.str||null!==(n=e.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");const e=this.data,{width:t,height:i}=getRectDims(e.rect),n=this.svgFactory.create(t,i,!0),r=e.borderStyle.width,s=this.svgFactory.createElement("svg:ellipse");s.setAttribute("cx",t/2);s.setAttribute("cy",i/2);s.setAttribute("rx",t/2-r/2);s.setAttribute("ry",i/2-r/2);s.setAttribute("stroke-width",r||1);s.setAttribute("stroke","transparent");s.setAttribute("fill","transparent");n.append(s);this.container.append(n);this._createPopup(s,e);return this.container}}class PolylineAnnotationElement extends AnnotationElement{constructor(e){var t,i,n;super(e,{isRenderable:!!(e.data.hasPopup||null!==(t=e.data.titleObj)&&void 0!==t&&t.str||null!==(i=e.data.contentsObj)&&void 0!==i&&i.str||null!==(n=e.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0});this.containerClassName="polylineAnnotation";this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const e=this.data,{width:t,height:i}=getRectDims(e.rect),n=this.svgFactory.create(t,i,!0);let r=[];for(const t of e.vertices){const i=t.x-e.rect[0],n=e.rect[3]-t.y;r.push(i+","+n)}r=r.join(" ");const s=this.svgFactory.createElement(this.svgElementName);s.setAttribute("points",r);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 PolygonAnnotationElement extends PolylineAnnotationElement{constructor(e){super(e);this.containerClassName="polygonAnnotation";this.svgElementName="svg:polygon"}}class CaretAnnotationElement extends AnnotationElement{constructor(e){var t,i,n;super(e,{isRenderable:!!(e.data.hasPopup||null!==(t=e.data.titleObj)&&void 0!==t&&t.str||null!==(i=e.data.contentsObj)&&void 0!==i&&i.str||null!==(n=e.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0})}render(){this.container.classList.add("caretAnnotation");this.data.hasPopup||this._createPopup(null,this.data);return this.container}}class InkAnnotationElement extends AnnotationElement{constructor(e){var t,i,n;super(e,{isRenderable:!!(e.data.hasPopup||null!==(t=e.data.titleObj)&&void 0!==t&&t.str||null!==(i=e.data.contentsObj)&&void 0!==i&&i.str||null!==(n=e.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0});this.containerClassName="inkAnnotation";this.svgElementName="svg:polyline"}render(){this.container.classList.add(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],r=e.rect[3]-n.y;i.push(`${t},${r}`)}i=i.join(" ");const r=this.svgFactory.createElement(this.svgElementName);r.setAttribute("points",i);r.setAttribute("stroke-width",e.borderStyle.width||1);r.setAttribute("stroke","transparent");r.setAttribute("fill","transparent");this._createPopup(r,e);n.append(r)}this.container.append(n);return this.container}}class HighlightAnnotationElement extends AnnotationElement{constructor(e){var t,i,n;super(e,{isRenderable:!!(e.data.hasPopup||null!==(t=e.data.titleObj)&&void 0!==t&&t.str||null!==(i=e.data.contentsObj)&&void 0!==i&&i.str||null!==(n=e.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){this.data.hasPopup||this._createPopup(null,this.data);if(this.quadrilaterals)return this._renderQuadrilaterals("highlightAnnotation");this.container.classList.add("highlightAnnotation");return this.container}}class UnderlineAnnotationElement extends AnnotationElement{constructor(e){var t,i,n;super(e,{isRenderable:!!(e.data.hasPopup||null!==(t=e.data.titleObj)&&void 0!==t&&t.str||null!==(i=e.data.contentsObj)&&void 0!==i&&i.str||null!==(n=e.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){this.data.hasPopup||this._createPopup(null,this.data);if(this.quadrilaterals)return this._renderQuadrilaterals("underlineAnnotation");this.container.classList.add("underlineAnnotation");return this.container}}class SquigglyAnnotationElement extends AnnotationElement{constructor(e){var t,i,n;super(e,{isRenderable:!!(e.data.hasPopup||null!==(t=e.data.titleObj)&&void 0!==t&&t.str||null!==(i=e.data.contentsObj)&&void 0!==i&&i.str||null!==(n=e.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){this.data.hasPopup||this._createPopup(null,this.data);if(this.quadrilaterals)return this._renderQuadrilaterals("squigglyAnnotation");this.container.classList.add("squigglyAnnotation");return this.container}}class StrikeOutAnnotationElement extends AnnotationElement{constructor(e){var t,i,n;super(e,{isRenderable:!!(e.data.hasPopup||null!==(t=e.data.titleObj)&&void 0!==t&&t.str||null!==(i=e.data.contentsObj)&&void 0!==i&&i.str||null!==(n=e.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){this.data.hasPopup||this._createPopup(null,this.data);if(this.quadrilaterals)return this._renderQuadrilaterals("strikeoutAnnotation");this.container.classList.add("strikeoutAnnotation");return this.container}}class StampAnnotationElement extends AnnotationElement{constructor(e){var t,i,n;super(e,{isRenderable:!!(e.data.hasPopup||null!==(t=e.data.titleObj)&&void 0!==t&&t.str||null!==(i=e.data.contentsObj)&&void 0!==i&&i.str||null!==(n=e.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0})}render(){this.container.classList.add("stampAnnotation");this.data.hasPopup||this._createPopup(null,this.data);return this.container}}class FileAttachmentAnnotationElement extends AnnotationElement{constructor(e){var t;super(e,{isRenderable:!0});const{filename:i,content:n}=this.data.file;this.filename=(0,r.getFilenameFromUrl)(i,!0);this.content=n;null===(t=this.linkService.eventBus)||void 0===t||t.dispatch("fileattachmentannotation",{source:this,filename:i,content:n})}render(){var e,t;this.container.classList.add("fileAttachmentAnnotation");let i;if(this.data.hasAppearance)i=document.createElement("div");else{i=document.createElement("img");i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(this.data.name)?"paperclip":"pushpin"}.svg`}i.classList.add("popupTriggerArea");i.addEventListener("dblclick",this._download.bind(this));!this.data.hasPopup&&(null!==(e=this.data.titleObj)&&void 0!==e&&e.str||null!==(t=this.data.contentsObj)&&void 0!==t&&t.str||this.data.richText)&&this._createPopup(i,this.data);this.container.append(i);return this.container}_download(){var e;null===(e=this.downloadManager)||void 0===e||e.openOrDownloadData(this.container,this.content,this.filename)}}class AnnotationLayer{static#Zt(e,t,i,n){const s=e.firstChild||e;s.id=`${r.AnnotationPrefix}${t}`;i.append(e);null==n||n.moveElementInDOM(i,e,s,!1)}static render(e){const{annotations:t,div:i,viewport:a,accessibilityManager:o}=e;(0,r.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 r.DOMSVGFactory,annotationStorage:e.annotationStorage||new s.AnnotationStorage,enableScripting:!0===e.enableScripting,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects};let c=0;for(const e of t){if(e.noHTML)continue;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 r=t.render();e.hidden&&(r.style.visibility="hidden");if(Array.isArray(r))for(const t of r){t.style.zIndex=c++;AnnotationLayer.#Zt(t,e.id,i,o)}else{r.style.zIndex=c++;t instanceof PopupAnnotationElement?i.prepend(r):AnnotationLayer.#Zt(r,e.id,i,o)}}this.#Jt(i,e.annotationCanvasMap)}static update(e){const{annotationCanvasMap:t,div:i,viewport:n}=e;(0,r.setLayerDimensions)(i,{rotation:n.rotation});this.#Jt(i,t);i.hidden=!1}static#Jt(e,t){if(t){for(const[i,n]of t){const t=e.querySelector(`[data-annotation-id="${i}"]`);if(!t)continue;const{firstChild:r}=t;r?"CANVAS"===r.nodeName?r.replaceWith(n):r.before(n):t.append(n)}t.clear()}}}t.AnnotationLayer=AnnotationLayer},(e,t)=>{"use strict";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){let[t,i,n,r]=e;return["G",1-Math.min(1,.3*t+.59*n+.11*i+r)]}static G_CMYK(e){let[t]=e;return["CMYK",0,0,0,1-t]}static G_RGB(e){let[t]=e;return["RGB",t,t,t]}static G_HTML(e){let[t]=e;const i=makeColorComp(t);return`#${i}${i}${i}`}static RGB_G(e){let[t,i,n]=e;return["G",.3*t+.59*i+.11*n]}static RGB_HTML(e){let[t,i,n]=e;return`#${makeColorComp(t)}${makeColorComp(i)}${makeColorComp(n)}`}static T_HTML(){return"#00000000"}static CMYK_RGB(e){let[t,i,n,r]=e;return["RGB",1-Math.min(1,t+r),1-Math.min(1,n+r),1-Math.min(1,i+r)]}static CMYK_HTML(e){const t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK(e){let[t,i,n]=e;const r=1-t,s=1-i,a=1-n;return["CMYK",r,s,a,Math.min(r,s,a)]}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.XfaLayer=void 0;var n=i(154);t.XfaLayer=class XfaLayer{static setupStorage(e,t,i,n,r){const s=window.getFormValueFromAngular(e);s.value&&n.setValue(t,s);const a=s.value?s:n.getValue(t,{value:null});window.registerXFAField(e,a);e.addEventListener("updateFromAngular",(e=>n.setValue(t,{value:e.detail})));switch(i.name){case"textarea":null!==a.value&&(e.textContent=a.value);if("print"===r)break;e.addEventListener("input",(i=>{window.updateAngularFormValue(e,{value:i.target.value});n.setValue(t,{value:i.target.value})}));break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){a.value===i.attributes.xfaOn?e.setAttribute("checked",!0):e.removeAttribute("checked");if("print"===r)break;e.addEventListener("change",(i=>{window.updateAngularFormValue(e,{value:i.target.checked?i.target.getAttribute("xfaOn"):i.target.getAttribute("xfaOff")});n.setValue(t,{value:i.target.checked?i.target.getAttribute("xfaOn"):i.target.getAttribute("xfaOff")})}))}else{null!==a.value&&e.setAttribute("value",a.value);if("print"===r)break;e.addEventListener("input",(i=>{window.updateAngularFormValue(e,{value:i.target.value});n.setValue(t,{value:i.target.value})}))}break;case"select":if(null!==a.value){i.attributes.value=a.value;for(const e of i.children)e.attributes.value===a.value?e.attributes.selected=!0:delete e.attributes.selected}e.addEventListener("input",(i=>{const r=i.target.options,s=-1===r.selectedIndex?"":r[r.selectedIndex].value;window.updateAngularFormValue(e,{value:s});n.setValue(t,{value:s})}))}}static setAttributes(e){let{html:t,element:i,storage:n=null,intent:r,linkService:s}=e;const{attributes:a}=i,o=t instanceof HTMLAnchorElement;"radio"===a.type&&(a.name=`${a.name}-${r}`);for(const[e,i]of Object.entries(a))if(null!=i)switch(e){case"class":i.length&&t.setAttribute(e,i.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",i);break;case"style":Object.assign(t.style,i);break;case"textContent":t.textContent=i;break;default:(!o||"href"!==e&&"newWindow"!==e)&&t.setAttribute(e,i)}o&&s.addLinkAttributes(t,a.href,a.newWindow);n&&a.dataId&&this.setupStorage(t,a.dataId,i,n)}static render(e){const t=e.annotationStorage,i=e.linkService,r=e.xfaHtml,s=e.intent||"display",a=document.createElement(r.name);r.attributes&&this.setAttributes({html:a,element:r,intent:s,linkService:i});const o=[[r,-1,a]],l=e.div;l.append(a);if(e.viewport){const t=`matrix(${e.viewport.transform.join(",")})`;l.style.transform=t}"richText"!==s&&l.setAttribute("class","xfaLayer xfaFont");const c=[];for(;o.length>0;){var d;const[e,r,a]=o.at(-1);if(r+1===e.children.length){o.pop();continue}const l=e.children[++o.at(-1)[1]];if(null===l)continue;const{name:h}=l;if("#text"===h){const e=document.createTextNode(l.value);c.push(e);a.append(e);continue}let u;u=null!=l&&null!==(d=l.attributes)&&void 0!==d&&d.xmlns?document.createElementNS(l.attributes.xmlns,h):document.createElement(h);a.append(u);l.attributes&&this.setAttributes({html:u,element:l,storage:t,intent:s,linkService:i});if(l.children&&l.children.length>0)o.push([l,-1,u]);else if(l.value){const e=document.createTextNode(l.value);n.XfaText.shouldBuildText(h)&&c.push(e);u.append(e)}}for(const e of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))e.setAttribute("readOnly",!0);return{textDivs:c}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t;e.div.hidden=!1}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.SVGGraphics=void 0;var n=i(141),r=i(1);i(145);let s=class{constructor(){(0,r.unreachable)("Not implemented: SVGGraphics")}};t.SVGGraphics=s;{const a={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},o="http://www.w3.org/XML/1998/namespace",l="http://www.w3.org/1999/xlink",c=["butt","round","square"],d=["miter","round","bevel"],createObjectURL=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(URL.createObjectURL&&"undefined"!=typeof Blob&&!i)return URL.createObjectURL(new Blob([e],{type:t}));const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let r=`data:${t};base64,`;for(let t=0,i=e.length;t<i;t+=3){const s=255&e[t],a=255&e[t+1],o=255&e[t+2];r+=n[s>>2]+n[(3&s)<<4|a>>4]+n[t+1<i?(15&a)<<2|o>>6:64]+n[t+2<i?63&o:64]}return r},h=function(){const e=new Uint8Array([137,80,78,71,13,10,26,10]),t=new Int32Array(256);for(let e=0;e<256;e++){let i=e;for(let e=0;e<8;e++)i=1&i?3988292384^i>>1&2147483647:i>>1&2147483647;t[e]=i}function writePngChunk(e,i,n,r){let s=r;const a=i.length;n[s]=a>>24&255;n[s+1]=a>>16&255;n[s+2]=a>>8&255;n[s+3]=255&a;s+=4;n[s]=255&e.charCodeAt(0);n[s+1]=255&e.charCodeAt(1);n[s+2]=255&e.charCodeAt(2);n[s+3]=255&e.charCodeAt(3);s+=4;n.set(i,s);s+=i.length;const o=function crc32(e,i,n){let r=-1;for(let s=i;s<n;s++){const i=255&(r^e[s]);r=r>>>8^t[i]}return-1^r}(n,r+4,s);n[s]=o>>24&255;n[s+1]=o>>16&255;n[s+2]=o>>8&255;n[s+3]=255&o}function deflateSync(e){return function deflateSyncUncompressed(e){let t=e.length;const i=65535,n=Math.ceil(t/i),r=new Uint8Array(2+t+5*n+4);let s=0;r[s++]=120;r[s++]=156;let a=0;for(;t>i;){r[s++]=0;r[s++]=255;r[s++]=255;r[s++]=0;r[s++]=0;r.set(e.subarray(a,a+i),s);s+=i;a+=i;t-=i}r[s++]=1;r[s++]=255&t;r[s++]=t>>8&255;r[s++]=255&~t;r[s++]=(65535&~t)>>8&255;r.set(e.subarray(a),s);s+=e.length-a;const o=function adler32(e,t,i){let n=1,r=0;for(let s=t;s<i;++s){n=(n+(255&e[s]))%65521;r=(r+n)%65521}return r<<16|n}(e,0,e.length);r[s++]=o>>24&255;r[s++]=o>>16&255;r[s++]=o>>8&255;r[s++]=255&o;return r}(e)}return function convertImgDataToPng(t,i,n){return function encode(t,i,n,s){const a=t.width,o=t.height;let l,c,d;const h=t.data;switch(i){case r.ImageKind.GRAYSCALE_1BPP:c=0;l=1;d=a+7>>3;break;case r.ImageKind.RGB_24BPP:c=2;l=8;d=3*a;break;case r.ImageKind.RGBA_32BPP:c=6;l=8;d=4*a;break;default:throw new Error("invalid format")}const u=new Uint8Array((1+d)*o);let p=0,g=0;for(let e=0;e<o;++e){u[p++]=0;u.set(h.subarray(g,g+d),p);g+=d;p+=d}if(i===r.ImageKind.GRAYSCALE_1BPP&&s){p=0;for(let e=0;e<o;e++){p++;for(let e=0;e<d;e++)u[p++]^=255}}const f=new Uint8Array([a>>24&255,a>>16&255,a>>8&255,255&a,o>>24&255,o>>16&255,o>>8&255,255&o,l,c,0,0,0]),m=deflateSync(u),v=e.length+36+f.length+m.length,b=new Uint8Array(v);let y=0;b.set(e,y);y+=e.length;writePngChunk("IHDR",f,b,y);y+=12+f.length;writePngChunk("IDATA",m,b,y);y+=12+m.length;writePngChunk("IEND",new Uint8Array(0),b,y);return createObjectURL(b,"image/png",n)}(t,void 0===t.kind?r.ImageKind.GRAYSCALE_1BPP:t.kind,i,n)}}();class SVGExtraState{constructor(){this.fontSizeScale=1;this.fontWeight=a.fontWeight;this.fontSize=0;this.textMatrix=r.IDENTITY_MATRIX;this.fontMatrix=r.FONT_IDENTITY_MATRIX;this.leading=0;this.textRenderingMode=r.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=s=class{constructor(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];(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=r.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 r.OPS)this._operatorIdMapping[r.OPS[e]]=e}getObject(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]: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]===r.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,s,a){const o=[e,t,i,n,s,a];this.transformMatrix=r.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=r.IDENTITY_MATRIX;this.executeOpTree(this.convertOpList(e));return i}))}convertOpList(e){const t=this._operatorIdMapping,i=e.argsArray,n=e.fnArray,r=[];for(let e=0,s=n.length;e<s;e++){const s=n[e];r.push({fnId:s,fn:t[s],args:i[e]})}return opListToTree(r)}executeOpTree(e){for(const t of e){const e=t.fn,i=t.fnId,n=t.args;switch(0|i){case r.OPS.beginText:this.beginText();break;case r.OPS.dependency:break;case r.OPS.setLeading:this.setLeading(n);break;case r.OPS.setLeadingMoveText:this.setLeadingMoveText(n[0],n[1]);break;case r.OPS.setFont:this.setFont(n);break;case r.OPS.showText:case r.OPS.showSpacedText:this.showText(n[0]);break;case r.OPS.endText:this.endText();break;case r.OPS.moveText:this.moveText(n[0],n[1]);break;case r.OPS.setCharSpacing:this.setCharSpacing(n[0]);break;case r.OPS.setWordSpacing:this.setWordSpacing(n[0]);break;case r.OPS.setHScale:this.setHScale(n[0]);break;case r.OPS.setTextMatrix:this.setTextMatrix(n[0],n[1],n[2],n[3],n[4],n[5]);break;case r.OPS.setTextRise:this.setTextRise(n[0]);break;case r.OPS.setTextRenderingMode:this.setTextRenderingMode(n[0]);break;case r.OPS.setLineWidth:this.setLineWidth(n[0]);break;case r.OPS.setLineJoin:this.setLineJoin(n[0]);break;case r.OPS.setLineCap:this.setLineCap(n[0]);break;case r.OPS.setMiterLimit:this.setMiterLimit(n[0]);break;case r.OPS.setFillRGBColor:this.setFillRGBColor(n[0],n[1],n[2]);break;case r.OPS.setStrokeRGBColor:this.setStrokeRGBColor(n[0],n[1],n[2]);break;case r.OPS.setStrokeColorN:this.setStrokeColorN(n);break;case r.OPS.setFillColorN:this.setFillColorN(n);break;case r.OPS.shadingFill:this.shadingFill(n[0]);break;case r.OPS.setDash:this.setDash(n[0],n[1]);break;case r.OPS.setRenderingIntent:this.setRenderingIntent(n[0]);break;case r.OPS.setFlatness:this.setFlatness(n[0]);break;case r.OPS.setGState:this.setGState(n[0]);break;case r.OPS.fill:this.fill();break;case r.OPS.eoFill:this.eoFill();break;case r.OPS.stroke:this.stroke();break;case r.OPS.fillStroke:this.fillStroke();break;case r.OPS.eoFillStroke:this.eoFillStroke();break;case r.OPS.clip:this.clip("nonzero");break;case r.OPS.eoClip:this.clip("evenodd");break;case r.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case r.OPS.paintImageXObject:this.paintImageXObject(n[0]);break;case r.OPS.paintInlineImageXObject:this.paintInlineImageXObject(n[0]);break;case r.OPS.paintImageMaskXObject:this.paintImageMaskXObject(n[0]);break;case r.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(n[0],n[1]);break;case r.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case r.OPS.closePath:this.closePath();break;case r.OPS.closeStroke:this.closeStroke();break;case r.OPS.closeFillStroke:this.closeFillStroke();break;case r.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case r.OPS.nextLine:this.nextLine();break;case r.OPS.transform:this.transform(n[0],n[1],n[2],n[3],n[4],n[5]);break;case r.OPS.constructPath:this.constructPath(n[0],n[1]);break;case r.OPS.endPath:this.endPath();break;case 92:this.group(t.items);break;default:(0,r.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,r,s){const a=this.current;a.textMatrix=a.lineMatrix=[e,t,i,n,r,s];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=r.IDENTITY_MATRIX;e.lineMatrix=r.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 s=t.fontSizeScale,l=t.charSpacing,c=t.wordSpacing,d=t.fontDirection,h=t.textHScale*d,u=i.vertical,p=u?1:-1,g=i.defaultVMetrics,f=n*t.fontMatrix[0];let m=0;for(const r of e){if(null===r){m+=d*c;continue}if("number"==typeof r){m+=p*r*n/1e3;continue}const e=(r.isSpace?c:0)+l,a=r.fontChar;let o,h,v,b=r.width;if(u){let e;const t=r.vmetric||g;e=r.vmetric?t[1]:.5*b;e=-e*f;const i=t[2]*f;b=t?-t[0]:b;o=e/s;h=(m+i)/s}else{o=m/s;h=0}if(r.isInFont||i.missingFile){t.xcoords.push(t.x+o);u&&t.ycoords.push(-t.y+h);t.tspan.textContent+=a}v=u?b*f-e*d:b*f+e*d;m+=v}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*h;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 v=t.textRenderingMode&r.TextRenderingMode.FILL_STROKE_MASK;if(v===r.TextRenderingMode.FILL||v===r.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===r.TextRenderingMode.ADD_TO_PATH?t.tspan.setAttributeNS(null,"fill","transparent"):t.tspan.setAttributeNS(null,"fill","none");if(v===r.TextRenderingMode.STROKE||v===r.TextRenderingMode.FILL_STROKE){const e=1/(t.textMatrixScale||1);this._setStrokeAttributes(t.tspan,e)}let b=t.textMatrix;if(0!==t.textRise){b=b.slice();b[5]+=t.textRise}t.txtElement.setAttributeNS(null,"transform",`${pm(b)} scale(${pf(h)}, -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||r.FONT_IDENTITY_MATRIX;let s="normal";i.black?s="900":i.bold&&(s="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=s;t.fontStyle=a;t.tspan=this.svgFactory.createElement("svg:tspan");t.tspan.setAttributeNS(null,"y",pf(-t.y));t.xcoords=[];t.ycoords=[]}endText(){var e;const t=this.current;if(t.textRenderingMode&r.TextRenderingMode.ADD_TO_PATH_FLAG&&null!==(e=t.txtElement)&&void 0!==e&&e.hasChildNodes()){t.element=t.txtElement;this.clip("nonzero");this.endPath()}}setLineWidth(e){e>0&&(this.current.lineWidth=e)}setLineCap(e){this.current.lineCap=c[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=r.Util.makeHexColor(e,t,i)}setFillAlpha(e){this.current.fillAlpha=e}setFillRGBColor(e,t,i){this.current.fillColor=r.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=r.Util.inverseTransform(this.transformMatrix),s=r.Util.applyTransform([0,0],n),a=r.Util.applyTransform([0,i],n),o=r.Util.applyTransform([t,0],n),l=r.Util.applyTransform([t,i],n),c=Math.min(s[0],a[0],o[0],l[0]),d=Math.min(s[1],a[1],o[1],l[1]),h=Math.max(s[0],a[0],o[0],l[0]),u=Math.max(s[1],a[1],o[1],l[1]),p=this.svgFactory.createElement("svg:rect");p.setAttributeNS(null,"x",c);p.setAttributeNS(null,"y",d);p.setAttributeNS(null,"width",h-c);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]||r.IDENTITY_MATRIX,[s,a,o,l]=e[4],c=e[5],d=e[6],h=e[7],u="shading"+g++,[p,f,m,v]=r.Util.normalizeRect([...r.Util.applyTransform([s,a],n),...r.Util.applyTransform([o,l],n)]),[b,y]=r.Util.singularValueDecompose2dScale(n),w=c*b,_=d*y,S=this.svgFactory.createElement("svg:pattern");S.setAttributeNS(null,"id",u);S.setAttributeNS(null,"patternUnits","userSpaceOnUse");S.setAttributeNS(null,"width",w);S.setAttributeNS(null,"height",_);S.setAttributeNS(null,"x",`${p}`);S.setAttributeNS(null,"y",`${f}`);const P=this.svg,A=this.transformMatrix,E=this.current.fillColor,x=this.current.strokeColor,C=this.svgFactory.create(m-p,v-f);this.svg=C;this.transformMatrix=n;if(2===h){const e=r.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=x;S.append(C.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],r=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",r[0]);n.setAttributeNS(null,"y2",r[1]);break;case"radial":const s=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",s[0]);n.setAttributeNS(null,"fy",s[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,r.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,s=i.y,a=[],o=0;for(const i of e)switch(0|i){case r.OPS.rectangle:n=t[o++];s=t[o++];const e=n+t[o++],i=s+t[o++];a.push("M",pf(n),pf(s),"L",pf(e),pf(s),"L",pf(e),pf(i),"L",pf(n),pf(i),"Z");break;case r.OPS.moveTo:n=t[o++];s=t[o++];a.push("M",pf(n),pf(s));break;case r.OPS.lineTo:n=t[o++];s=t[o++];a.push("L",pf(n),pf(s));break;case r.OPS.curveTo:n=t[o+4];s=t[o+5];a.push("C",pf(t[o]),pf(t[o+1]),pf(t[o+2]),pf(t[o+3]),pf(n),pf(s));o+=6;break;case r.OPS.curveTo2:a.push("C",pf(n),pf(s),pf(t[o]),pf(t[o+1]),pf(t[o+2]),pf(t[o+3]));n=t[o+2];s=t[o+3];o+=4;break;case r.OPS.curveTo3:n=t[o+2];s=t[o+3];a.push("C",pf(t[o]),pf(t[o+1]),pf(n),pf(s),pf(n),pf(s));o+=4;break;case r.OPS.closePath:a.push("Z")}a=a.join(" ");if(i.path&&e.length>0&&e[0]!==r.OPS.rectangle&&e[0]!==r.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,s)}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,r.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){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]: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(){var e;null===(e=this.current.element)||void 0===e||e.setAttributeNS(null,"fill-rule","evenodd");this.fill()}fillStroke(){this.stroke();this.fill()}eoFillStroke(){var e;null===(e=this.current.element)||void 0===e||e.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,r.warn)(`Dependent image with object ID ${e} is not ready yet`)}paintInlineImageXObject(e,t){const i=e.width,n=e.height,r=h(e,this.forceDataSchema,!!t),s=this.svgFactory.createElement("svg:rect");s.setAttributeNS(null,"x","0");s.setAttributeNS(null,"y","0");s.setAttributeNS(null,"width",pf(i));s.setAttributeNS(null,"height",pf(n));this.current.element=s;this.clip("nonzero");const a=this.svgFactory.createElement("svg:image");a.setAttributeNS(l,"xlink:href",r);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,r.warn)("paintImageMaskXObject: ImageBitmap support is not implemented, ensure that the `isOffscreenCanvasSupported` API parameter is disabled.");return}const i=this.current,n=t.width,s=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(s));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__={};(()=>{"use strict";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 s.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,"PromiseCapability",{enumerable:!0,get:function(){return t.PromiseCapability}});Object.defineProperty(e,"RenderingCancelledException",{enumerable:!0,get:function(){return n.RenderingCancelledException}});Object.defineProperty(e,"SVGGraphics",{enumerable:!0,get:function(){return c.SVGGraphics}});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,"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,"normalizeUnicode",{enumerable:!0,get:function(){return t.normalizeUnicode}});Object.defineProperty(e,"renderTextLayer",{enumerable:!0,get:function(){return r.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 r.updateTextLayer}});Object.defineProperty(e,"version",{enumerable:!0,get:function(){return i.version}});var t=__w_pdfjs_require__(1),i=__w_pdfjs_require__(137),n=__w_pdfjs_require__(141),r=__w_pdfjs_require__(161),s=__w_pdfjs_require__(162),a=__w_pdfjs_require__(140),o=__w_pdfjs_require__(165),l=__w_pdfjs_require__(149),c=__w_pdfjs_require__(168),d=__w_pdfjs_require__(167)})();return __webpack_exports__})()));
/**
* @licstart The following is the entire license notice for the
* JavaScript code in this page
*
* Copyright 2023 Mozilla Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @licend The above is the entire license notice for the
* JavaScript code in this page
*/(()=>{var e=[,(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.GenericCom=void 0;var n=i(2),r=i(181),s=i(182),a=i(183),o=i(185);t.GenericCom={};class GenericPreferences extends r.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 s.DownloadManager}static createPreferences(){return new GenericPreferences}static createL10n(e){let{locale:t="en-US"}=e;return new a.GenericL10n(t)}static createScripting(e){let{sandboxBundleSrc:t}=e;return new o.GenericScripting(t)}}n.PDFViewerApplication.externalServices=GenericExternalServices},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PDFViewerApplication=t.PDFPrintServiceFactory=t.DefaultExternalServices=void 0;var n=i(3),r=i(4),s=i(5),a=i(6),o=i(7),l=i(8),c=i(9),d=i(10),h=i(11),u=i(13),p=i(15),g=i(16),f=i(17),m=i(21),v=i(22),b=i(23),y=i(24),w=i(25),_=i(26),S=i(27),P=i(28),A=i(30),E=i(178),x=i(179),C=i(180);const T=1e3,M=-1,I=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,r.shadow)(this,"supportsPinchToZoom",!0)}static get supportsIntegratedFind(){return(0,r.shadow)(this,"supportsIntegratedFind",!1)}static get supportsDocumentFonts(){return(0,r.shadow)(this,"supportsDocumentFonts",!0)}static get supportedMouseWheelZoomModifierKeys(){return(0,r.shadow)(this,"supportedMouseWheelZoomModifierKeys",{ctrlKey:!0,metaKey:!0})}static get isInAutomation(){return(0,r.shadow)(this,"isInAutomation",!1)}static updateEditorStates(e){throw new Error("Not implemented: updateEditorStates")}static get canvasMaxAreaInBytes(){return(0,r.shadow)(this,"canvasMaxAreaInBytes",-1)}static getNimbusExperimentData(){return(0,r.shadow)(this,"getNimbusExperimentData",Promise.resolve(null))}}t.DefaultExternalServices=DefaultExternalServices;const D={initialBookmark:document.location.hash.substring(1),_initializedCapability:new r.PromiseCapability,appConfig:null,pdfDocument:null,pdfLoadingTask:null,printService:null,pdfViewer:null,pdfThumbnailViewer:null,pdfRenderingQueue:null,pdfPresentationMode:null,pdfDocumentProperties:null,pdfLinkService:null,pdfHistory:null,pdfSidebar: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,_nimbusDataPromise:null,async initialize(e){this.preferences=this.externalServices.createPreferences();this.appConfig=e;await this._initializeOptions();this._forceCssTheme();await this._initializeL10n();this.isViewerEmbedded&&s.AppOptions.get("externalLinkTarget")===o.LinkTarget.NONE&&s.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(s.AppOptions.get("disablePreferences"))s.AppOptions.get("pdfBugEnabled")&&await this._parseHashParams();else{s.AppOptions._hasUserOptions()&&globalThis.ngxConsole.warn('_initializeOptions: The Preferences may override manually set AppOptions; please use the "disablePreferences"-option in order to prevent that.');try{s.AppOptions.setAll(await this.preferences.getAll())}catch(e){globalThis.ngxConsole.error(`_initializeOptions: "${null==e?void 0:e.message}".`)}s.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(){r.GlobalWorkerOptions.workerSrc||=s.AppOptions.get("workerSrc");"Function"===r.GlobalWorkerOptions.workerSrc.constructor.name&&(r.GlobalWorkerOptions.workerSrc=r.GlobalWorkerOptions.workerSrc());await(0,r.loadScript)(r.PDFWorker.workerSrc)}()}catch(e){console.error(`_parseHashParams: "${e.message}".`)}a.has("disablerange")&&s.AppOptions.set("disableRange","true"===a.get("disablerange"));a.has("disablestream")&&s.AppOptions.set("disableStream","true"===a.get("disablestream"));a.has("disableautofetch")&&s.AppOptions.set("disableAutoFetch","true"===a.get("disableautofetch"));a.has("disablefontface")&&s.AppOptions.set("disableFontFace","true"===a.get("disablefontface"));a.has("disablehistory")&&s.AppOptions.set("disableHistory","true"===a.get("disablehistory"));a.has("verbosity")&&s.AppOptions.set("verbosity",0|a.get("verbosity"));if(a.has("textlayer"))switch(a.get("textlayer")){case"off":s.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")){s.AppOptions.set("pdfBug",!0);s.AppOptions.set("fontExtraProperties",!0);const e=a.get("pdfbug").split(",");try{await loadPDFBug(this);this._PDFBug.init({OPS:r.OPS},t,e)}catch(e){console.error(`_parseHashParams: "${e.message}".`)}}a.has("locale")&&s.AppOptions.set("locale",a.get("locale"))},async _initializeL10n(){this.l10n=this.externalServices.createL10n({locale:s.AppOptions.get("locale")});const e=await this.l10n.getDirection();document.getElementsByTagName("html")[0].dir=e},_forceCssTheme(){const e=s.AppOptions.get("viewerCssTheme");if(e!==k.AUTOMATIC&&Object.values(k).includes(e))try{const i=document.styleSheets[0],n=(null==i?void 0:i.cssRules)||[];for(let r=0,s=n.length;r<s;r++){var t;const s=n[r];if(s instanceof CSSMediaRule&&"(prefers-color-scheme: dark)"===(null===(t=s.media)||void 0===t?void 0:t[0])){if(e===k.LIGHT){i.deleteRule(r);return}const t=/^@media \(prefers-color-scheme: dark\) {\n\s*([\w\s-.,:;/\\{}()]+)\n}$/.exec(s.cssText);if(null!=t&&t[1]){i.deleteRule(r);i.insertRule(t[1],r)}return}}}catch(e){globalThis.ngxConsole.error(`_forceCssTheme: "${null==e?void 0:e.message}".`)}},async _initializeViewerComponents(){var e,t,i,C,T,M;const{appConfig:I,externalServices:k,l10n:D}=this,L=k.isInAutomation?new a.AutomationEventBus:new a.EventBus;this.eventBus=L;this.overlayManager=new c.OverlayManager;const R=new w.PDFRenderingQueue;R.onIdle=this._cleanup.bind(this);this.pdfRenderingQueue=R;const O=new o.PDFLinkService({eventBus:L,externalLinkTarget:s.AppOptions.get("externalLinkTarget"),externalLinkRel:s.AppOptions.get("externalLinkRel"),ignoreDestinationZoom:s.AppOptions.get("ignoreDestinationZoom")});this.pdfLinkService=O;const N=k.createDownloadManager();this.downloadManager=N;const B=new f.PDFFindController({linkService:O,eventBus:L,pageViewMode:s.AppOptions.get("pageViewMode"),updateMatchesCountOnProgress:!0});this.findController=B;const V=new _.PDFScriptingManager({eventBus:L,sandboxBundleSrc:s.AppOptions.get("sandboxBundleSrc"),scriptingFactory:k,docPropertiesLookup:this._scriptingDocProperties.bind(this)});this.pdfScriptingManager=V;const U=I.mainContainer,j=I.viewerContainer,H=s.AppOptions.get("annotationEditorMode"),W=s.AppOptions.get("forcePageColors")||window.matchMedia("(forced-colors: active)").matches?{background:s.AppOptions.get("pageColorsBackground"),foreground:s.AppOptions.get("pageColorsForeground")}:null,z=new A.PDFViewer({container:U,viewer:j,eventBus:L,renderingQueue:R,linkService:O,downloadManager:N,findController:B,scriptingManager:s.AppOptions.get("enableScripting")&&V,l10n:D,textLayerMode:s.AppOptions.get("textLayerMode"),annotationMode:s.AppOptions.get("annotationMode"),annotationEditorMode:H,imageResourcesPath:s.AppOptions.get("imageResourcesPath"),removePageBorders:s.AppOptions.get("removePageBorders"),enablePrintAutoRotate:s.AppOptions.get("enablePrintAutoRotate"),useOnlyCssZoom:s.AppOptions.get("useOnlyCssZoom"),isOffscreenCanvasSupported:s.AppOptions.get("isOffscreenCanvasSupported"),maxCanvasPixels:s.AppOptions.get("maxCanvasPixels"),pageViewMode:s.AppOptions.get("pageViewMode"),enablePermissions:s.AppOptions.get("enablePermissions"),pageColors:W});this.pdfViewer=z;R.setViewer(z);O.setViewer(z);V.setViewer(z);if(null!==(e=I.sidebar)&&void 0!==e&&e.thumbnailView){this.pdfThumbnailViewer=new P.PDFThumbnailViewer({container:I.sidebar.thumbnailView,eventBus:L,renderingQueue:R,linkService:O,l10n:D,pageColors:W});R.setThumbnailViewer(this.pdfThumbnailViewer)}if(!this.isViewerEmbedded&&!s.AppOptions.get("disableHistory")){this.pdfHistory=new m.PDFHistory({linkService:O,eventBus:L});O.setHistory(this.pdfHistory)}!this.supportsIntegratedFind&&I.findBar&&(this.findBar=new g.PDFFindBar(I.findBar,L,D));if(I.annotationEditorParams)if(H!==r.AnnotationEditorType.DISABLE)this.annotationEditorParams=new l.AnnotationEditorParams(I.annotationEditorParams,L);else for(const e of["editorModeButtons","editorModeSeparator"]){var G;null===(G=document.getElementById(e))||void 0===G||G.classList.add("hidden")}I.documentProperties&&(this.pdfDocumentProperties=new p.PDFDocumentProperties(I.documentProperties,this.overlayManager,L,D,(()=>this._docFilename)));null!==(t=I.secondaryToolbar)&&void 0!==t&&t.cursorHandToolButton&&(this.pdfCursorTools=new u.PDFCursorTools({container:U,eventBus:L,cursorToolOnLoad:s.AppOptions.get("cursorToolOnLoad")}));I.toolbar&&(this.toolbar=new x.Toolbar(I.toolbar,L,D));I.secondaryToolbar&&(this.secondaryToolbar=new E.SecondaryToolbar(I.secondaryToolbar,L,k));this.supportsFullscreen&&null!==(i=I.secondaryToolbar)&&void 0!==i&&i.presentationModeButton&&(this.pdfPresentationMode=new y.PDFPresentationMode({container:U,pdfViewer:z,eventBus:L}));let q=s.AppOptions.get("passwordPrompt");q||I.passwordOverlay&&(q=new d.PasswordPrompt(I.passwordOverlay,this.overlayManager,D,this.isViewerEmbedded));this.passwordPrompt=q;null!==(C=I.sidebar)&&void 0!==C&&C.outlineView&&(this.pdfOutlineViewer=new b.PDFOutlineViewer({container:I.sidebar.outlineView,eventBus:L,linkService:O,downloadManager:N}));null!==(T=I.sidebar)&&void 0!==T&&T.attachmentsView&&(this.pdfAttachmentViewer=new h.PDFAttachmentViewer({container:I.sidebar.attachmentsView,eventBus:L,downloadManager:N}));null!==(M=I.sidebar)&&void 0!==M&&M.layersView&&(this.pdfLayerViewer=new v.PDFLayerViewer({container:I.sidebar.layersView,eventBus:L,l10n:D}));if(I.sidebar){this.pdfSidebar=new S.PDFSidebar({elements:I.sidebar,eventBus:L,l10n:D});this.pdfSidebar.onToggled=this.forceRendering.bind(this);this.pdfSidebar.onUpdateThumbnails=()=>{for(const t of z.getCachedPageViews())if(t.renderingState===n.RenderingStates.FINISHED){var e;null===(e=this.pdfThumbnailViewer.getThumbnail(t.id-1))||void 0===e||e.setImage(t)}this.pdfThumbnailViewer.scrollThumbnailIntoView(z.currentPageNumber)}}},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:s.AppOptions.get("defaultZoomDelay"),steps:e,scaleFactor:t})},zoomOut(e,t){this.pdfViewer.isInPresentationMode||this.pdfViewer.decreaseScale({drawingDelay:s.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 R.instance.supportsPrinting},get supportsFullscreen(){return(0,r.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;null==t||t.hide();return(0,r.shadow)(this,"loadingBar",t)},get supportedMouseWheelZoomModifierKeys(){return this.externalServices.supportedMouseWheelZoomModifierKeys},initPassiveLoading(){throw new Error("Not implemented: initPassiveLoading")},setTitleUsingUrl(){},setTitle(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]: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,r.getPdfFilenameFromUrl)(this.url)},_hideViewBookmark(){const{secondaryToolbar:e}=this.appConfig;null==e||e.viewBookmarkButton.classList.add("hidden");if(null!=e&&e.presentationModeButton.classList.contains("hidden")){var t;null===(t=document.getElementById("viewBookmarkSeparator"))||void 0===t||t.classList.add("hidden")}},async close(){var e,t,i,n,r,s,a,o,l,c;this._unblockDocumentLoadEvent();this._hideViewBookmark();if(!this.pdfLoadingTask)return;if((null===(e=this.pdfDocument)||void 0===e?void 0:e.annotationStorage.size)>0&&this._annotationStorageModified)try{await this.save()}catch(e){}const d=[];d.push(this.pdfLoadingTask.destroy());this.pdfLoadingTask=null;if(this.pdfDocument){var h,u;this.pdfDocument=null;null===(h=this.pdfThumbnailViewer)||void 0===h||h.setDocument(null);this.pdfViewer.setDocument(null);this.pdfLinkService.setDocument(null);null===(u=this.pdfDocumentProperties)||void 0===u||u.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;d.push(this.pdfScriptingManager.destroyPromise);this.setTitle();null===(t=this.pdfSidebar)||void 0===t||t.reset();null===(i=this.pdfOutlineViewer)||void 0===i||i.reset();null===(n=this.pdfAttachmentViewer)||void 0===n||n.reset();null===(r=this.pdfLayerViewer)||void 0===r||r.reset();null===(s=this.pdfHistory)||void 0===s||s.reset();null===(a=this.findBar)||void 0===a||a.reset();null===(o=this.toolbar)||void 0===o||o.reset();null===(l=this.secondaryToolbar)||void 0===l||l.reset();null===(c=this._PDFBug)||void 0===c||c.cleanup();await Promise.all(d)},async open(e){window.adjacentPagesLoader=void 0;window.ngxZone.runOutsideAngular((async()=>{var t;let i=!1;if("string"==typeof e){e={url:e};i=!0}else if(null!==(t=e)&&void 0!==t&&t.byteLength){e={data:e};i=!0}i&&console.error("The `PDFViewerApplication.open` signature was updated, please use an object instead.");this.pdfLoadingTask&&await this.close();const n=s.AppOptions.getAll(s.OptionKind.WORKER);Object.assign(r.GlobalWorkerOptions,n);e.url&&this.setTitleUsingUrl(e.originalUrl||e.url,e.url);const a=s.AppOptions.getAll(s.OptionKind.API),o={canvasMaxAreaInBytes:this.externalServices.canvasMaxAreaInBytes,...a,...e},l=(0,r.getDocument)(o);this.pdfLoadingTask=l;l.onPassword=(e,t)=>{this.isViewerEmbedded&&this._unblockDocumentLoadEvent();this.pdfLinkService.externalLinkEnabled=!1;this.passwordPrompt.setUpdateCallback(e,t);this.passwordPrompt.open()};l.onProgress=e=>{var t;let{loaded:i,total:n}=e;this.progress(i/n);null===(t=this.eventBus)||void 0===t||t.dispatch("progress",{source:this,type:"load",total:n,loaded:i,percent:100*i/n})};return l.promise.then((e=>{this.load(e)}),(e=>{if(l!==this.pdfLoadingTask)return;let t="loading_error";e instanceof r.InvalidPDFException?t="invalid_file_error":e instanceof r.MissingPDFException?t="missing_file_error":e instanceof r.UnexpectedResponseException&&(t="unexpected_response_error");D.onError&&D.onError(e);return this.l10n.get(t).then((t=>{this._documentError(t,{message:null==e?void 0:e.message});throw e}))}))}))},_ensureDownloadComplete(){if(!this.pdfDocument||!this.downloadComplete)throw new Error("PDF document not downloaded.")},async download(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=this._downloadUrl,i=this._docFilename;try{this._ensureDownloadComplete();const n=await this.pdfDocument.getData(),r=new Blob([n],{type:"application/pdf"});await this.downloadManager.download(r,t,i,e)}catch(n){await this.downloadManager.downloadUrl(t,i,e)}},async save(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._saveInProgress)return;this._saveInProgress=!0;await this.pdfScriptingManager.dispatchWillSave();const t=this._downloadUrl,i=this._docFilename;try{this._ensureDownloadComplete();const n=await this.pdfDocument.saveDocument(),r=new Blob([n],{type:"application/pdf"});await this.downloadManager.download(r,t,i,e)}catch(t){globalThis.ngxConsole.error(`Error when saving the document: ${t.message}`);await this.download(e)}finally{await this.pdfScriptingManager.dispatchDidSave();this._saveInProgress=!1}this._hasAnnotationEditors&&this.externalServices.reportTelemetry({type:"editing",data:{type:"save"}})},downloadOrSave(){var e;let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};(null===(e=this.pdfDocument)||void 0===e?void 0:e.annotationStorage.size)>0?this.save(t):this.download(t)},async _exportWithAnnotations(){if(this._saveInProgress)throw new Error("Already downloading");this._saveInProgress=!0;await this.pdfScriptingManager.dispatchWillSave();try{this._ensureDownloadComplete();const e=await this.pdfDocument.saveDocument();return new Blob([e],{type:"application/pdf"})}catch(e){throw new Error(`Error when saving the document: ${e.message}`)}finally{await this.pdfScriptingManager.dispatchDidSave();this._saveInProgress=!1}},async _exportWithoutAnnotations(){try{this._ensureDownloadComplete();const e=await this.pdfDocument.getData();return new Blob([e],{type:"application/pdf"})}catch(e){throw new Error(`Error when saving the document: ${e.message}`)}},async export(){var e;return(null===(e=this.pdfDocument)||void 0===e?void 0:e.annotationStorage.size)>0?this._exportWithAnnotations():this._exportWithoutAnnotations()},openInExternalApp(){this.downloadOrSave({openInExternalApp:!0})},_documentError(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this._unblockDocumentLoadEvent();this._otherError(e,t);this.eventBus.dispatch("documenterror",{source:this,message:e,reason:(null==t?void 0:t.message)??null})},_otherError(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=[`PDF.js v${r.version||"?"} (build: ${r.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){var t;if(!this.loadingBar||this.downloadComplete)return;const i=Math.round(100*e);if(!(i<=this.loadingBar.percent)){this.loadingBar.percent=i;((null===(t=this.pdfDocument)||void 0===t?void 0:t.loadingParams.disableAutoFetch)??s.AppOptions.get("disableAutoFetch"))&&this.loadingBar.setDisableAutoFetch()}},load(e){var t,i,r,a;this.pdfDocument=e;e.getDownloadInfo().then((e=>{var t;let{length:i}=e;this._contentLength=i;this.downloadComplete=!0;null===(t=this.loadingBar)||void 0===t||t.hide();h.then((()=>{var e;null===(e=this.eventBus)||void 0===e||e.dispatch("documentloaded",{source:this})}))}));const o=e.getPageLayout().catch((function(){})),l=e.getPageMode().catch((function(){})),c=e.getOpenAction().catch((function(){}));null===(t=this.toolbar)||void 0===t||t.setPagesCount(e.numPages,!1);null===(i=this.secondaryToolbar)||void 0===i||i.setPagesCount(e.numPages);this.pdfLinkService.setDocument(e);null===(r=this.pdfDocumentProperties)||void 0===r||r.setDocument(e);const d=this.pdfViewer;d.setDocument(e);const{firstPagePromise:h,onePageRendered:u,pagesPromise:p}=d;null===(a=this.pdfThumbnailViewer)||void 0===a||a.setDocument(e);const g=(this.store=new C.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((t=>{var i;null===(i=this.loadingBar)||void 0===i||i.setWidth(this.appConfig.viewerContainer);this._initializeAnnotationStorageCallbacks(e);Promise.all([n.animationStarted,g,o,l,c]).then((async t=>{let[i,r,a,o,l]=t;const c=s.AppOptions.get("viewOnLoad");this._initializePdfHistory({fingerprint:e.fingerprints[0],viewOnLoad:c,initialDest:null==l?void 0:l.dest});const h=this.initialBookmark,u=s.AppOptions.get("defaultZoomValue");let g=u?`zoom=${u}`:null,f=null,m=s.AppOptions.get("sidebarViewOnLoad"),v=s.AppOptions.get("scrollModeOnLoad"),b=s.AppOptions.get("spreadModeOnLoad");if(r.page&&c!==I){g=`page=${r.page}&zoom=${u||r.zoom},${r.scrollLeft},${r.scrollTop}`;f=parseInt(r.rotation,10);m===n.SidebarView.UNKNOWN&&(m=0|r.sidebarView);v===n.ScrollMode.UNKNOWN&&(v=0|r.scrollMode);b===n.SpreadMode.UNKNOWN&&(b=0|r.spreadMode)}o&&m===n.SidebarView.UNKNOWN&&(m=(0,n.apiPageModeToSidebarView)(o));if(a&&v===n.ScrollMode.UNKNOWN&&b===n.SpreadMode.UNKNOWN){b=(0,n.apiPageLayoutToViewerModes)(a).spreadMode}this.setInitialView(g,{rotation:f,sidebarView:m,scrollMode:v,spreadMode:b});this.eventBus.dispatch("documentinit",{source:this});this.isViewerEmbedded||d.focus();await Promise.race([p,new Promise((e=>{setTimeout(e,10)}))]);if((h||g)&&!d.hasEqualPageSizes){this.initialBookmark=h;d.currentScaleValue=d.currentScaleValue;this.setInitialView(g)}})).catch((()=>{this.setInitialView()})).then((function(){d.update()}))}));p.then((()=>{this._unblockDocumentLoadEvent();this._initializeAutoPrint(e,c)}),(e=>{D.onError&&D.onError(e);this.l10n.get("loading_error").then((t=>{this._documentError(t,{message:null==e?void 0:e.message})}))}));u.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&&d.optionalContentConfigPromise.then((t=>{e===this.pdfDocument&&this.pdfLayerViewer.render({optionalContentConfig:t,pdfDocument:e})}))}));this._initializePageLabels(e);this._initializeMetadata(e)},async _scriptingDocProperties(e){var t,i;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:null===(t=this.metadata)||void 0===t?void 0:t.getRaw(),authors:null===(i=this.metadata)||void 0===i?void 0:i.get("dc:creator"),numPages:this.pagesCount,URL:this.url}},async _initializeAutoPrint(e,t){const[i,r]=await Promise.all([t,this.pdfViewer.enableScripting?null:e.getJavaScript()]);if(e!==this.pdfDocument)return;let s=!1;"Print"===(null==i?void 0:i.action)&&(s=!0);if(r){r.some((e=>{if(!e)return!1;globalThis.ngxConsole.warn("Warning: JavaScript support is not enabled");return!0}));if(!s)for(const e of r)if(e&&n.AutoPrintRegExp.test(e)){s=!0;break}}s&&this.triggerPrinting()},async _initializeMetadata(e){const{info:t,metadata:i,contentDispositionFilename:n,contentLength:s}=await e.getMetadata();if(e!==this.pdfDocument)return;this.documentInfo=t;this.metadata=i;this._contentDispositionFilename??=n;this._contentLength??=s;globalThis.ngxConsole.log(`PDF ${e.fingerprints[0]} [${t.PDFFormatVersion} ${(t.Producer||"-").trim()} / ${(t.Creator||"-").trim()}] (PDF.js: ${r.version||"?"} [${r.build||"?"}]) modified by ngx-extended-pdf-viewer`);let a=t.Title;const o=null==i?void 0: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?globalThis.ngxConsole.warn("Warning: XFA Foreground documents are not supported"):globalThis.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||s.AppOptions.get("disablePageLabels"))return;const i=t.length;let n=0,r=0;for(let e=0;e<i;e++){const i=t[e];if(i===(e+1).toString())n++;else{if(""!==i)break;r++}}if(n>=i||r>=i)return;const{pdfViewer:a,pdfThumbnailViewer:o,toolbar:l}=this;a.setPageLabels(t);null==o||o.setPageLabels(t);null==l||l.setPagesCount(i,!0);null==l||l.setPageNumber(a.currentPageNumber,a.currentPageLabel)},_initializePdfHistory(e){let{fingerprint:t,viewOnLoad:i,initialDest:n=null}=e;if(this.pdfHistory){this.pdfHistory.initialize({fingerprint:t,resetHistory:i===I,updateUrl:s.AppOptions.get("historyUpdateUrl")});if(this.pdfHistory.initialBookmark){this.initialBookmark=this.pdfHistory.initialBookmark;this.initialRotation=this.pdfHistory.initialRotation}if(n&&!this.initialBookmark&&i===M){this.initialBookmark=JSON.stringify(n);this.pdfHistory.push({explicitDest:n,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){var t,i,r;let{rotation:s,sidebarView:a,scrollMode:o,spreadMode:l}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const setRotation=e=>{(0,n.isValidRotation)(e)&&(this.pdfViewer.pagesRotation=e)};this.isInitialViewSet=!0;null===(t=this.pdfSidebar)||void 0===t||t.setInitialView(a);((e,t)=>{(0,n.isValidScrollMode)(e)&&(this.pdfViewer.scrollMode=e);(0,n.isValidSpreadMode)(t)&&(this.pdfViewer.spreadMode=t)})(o,l);if(this.initialBookmark){setRotation(this.initialRotation);delete this.initialRotation;this.pdfLinkService.setHash(this.initialBookmark);this.initialBookmark=null}else if(e){setRotation(s);this.pdfLinkService.setHash(e)}null===(i=this.toolbar)||void 0===i||i.setPageNumber(this.pdfViewer.currentPageNumber,this.pdfViewer.currentPageLabel);null===(r=this.secondaryToolbar)||void 0===r||r.setPageNumber(this.pdfViewer.currentPageNumber);if(!this.pdfViewer.currentScaleValue){const e=PDFViewerApplicationOptions.get("defaultZoomValue");e&&(this.pdfViewer.currentScaleValue=e)}},_cleanup(){var e;if(this.pdfDocument){this.pdfViewer.cleanup();null===(e=this.pdfThumbnailViewer)||void 0===e||e.cleanup();this.pdfDocument.cleanup()}},forceRendering(){var e;this.pdfRenderingQueue.printing=!!this.printService;this.pdfRenderingQueue.isThumbnailViewEnabled=(null===(e=this.pdfSidebar)||void 0===e?void 0:e.visibleView)===n.SidebarView.THUMBS;this.pdfRenderingQueue.renderHighestPriority()},beforePrint(){this._printAnnotationStoragePromise=this.pdfScriptingManager.dispatchWillPrint().catch((()=>{})).then((()=>{var e;return null===(e=this.pdfDocument)||void 0===e?void 0:e.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=s.AppOptions.get("printResolution"),n=this.pdfViewer.optionalContentConfigPromise,r=R.instance.createPrintService(this.pdfDocument,e,t,i,n,this._printAnnotationStoragePromise,this.l10n,this.pdfViewer.eventBus);this.printService=r;this.forceRendering();this.setTitle();r.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){var e;this.printService.destroy();this.printService=null;null===(e=this.pdfDocument)||void 0===e||e.annotationStorage.resetModified()}this.forceRendering();this.setTitle()},rotatePages(e){this.pdfViewer.pagesRotation+=e},requestPresentationMode(){var e;null===(e=this.pdfPresentationMode)||void 0===e||e.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("openinexternalapp",webViewerOpenInExternalApp);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(s.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(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]: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});const i=document.getElementById("mainContainer");i.addEventListener("touchstart",webViewerTouchStart,{passive:!1});i.addEventListener("touchmove",webViewerTouchMove,{passive:!1});i.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("openinexternalapp",webViewerOpenInExternalApp);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(){var e;const{_boundEvents:t}=this;window.removeEventListener("visibilitychange",webViewerVisibilityChange);window.removeEventListener("wheel",webViewerWheel,{passive:!1});const i=document.getElementById("mainContainer");if(i){i.removeEventListener("touchstart",webViewerTouchStart,{passive:!1});i.removeEventListener("touchmove",webViewerTouchMove,{passive:!1});i.removeEventListener("touchend",webViewerTouchEnd,{passive:!1})}window.removeEventListener("click",webViewerClick);window.removeEventListener("keydown",webViewerKeyDown);window.removeEventListener("keyup",webViewerKeyUp);window.removeEventListener("resize",t.windowResize);window.removeEventListener("hashchange",t.windowHashChange);window.removeEventListener("beforeprint",t.windowBeforePrint);window.removeEventListener("afterprint",t.windowAfterPrint);window.removeEventListener("updatefromsandbox",t.windowUpdateFromSandbox);null===(e=t.removeWindowResolutionChange)||void 0===e||e.call(t);t.windowResize=null;t.windowHashChange=null;t.windowBeforePrint=null;t.windowAfterPrint=null;t.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,r=n.currentScale/e-1;if(0!==r){const[e,s]=n.containerTopLeft;n.container.scrollLeft+=(t-s)*r;n.container.scrollTop+=(i-e)*r}},_unblockDocumentLoadEvent(){var e,t;null===(e=(t=document).blockUnblockOnload)||void 0===e||e.call(t,!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:null==e?void 0:e.message})}));throw e}}}async function loadPDFBug(e){const{debuggerScriptPath:t}=e.appConfig,{PDFBug:i}=await import(t);e._PDFBug=i}function reportPageStatsPDFBug(e){var t,i;let{pageNumber:n}=e;if(null===(t=globalThis.Stats)||void 0===t||!t.enabled)return;const r=D.pdfViewer.getPageView(n-1);globalThis.Stats.add(n,null==r||null===(i=r.pdfPage)||void 0===i?void 0:i.stats)}function webViewerInitialized(){const{appConfig:e,eventBus:t,l10n:i}=D;let r;const a=document.location.search.substring(1);r=(0,n.parseQueryString)(a).get("file")??s.AppOptions.get("defaultUrl");validateFileURL(r);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(s.AppOptions.get("enableDragAndDrop")){e.preventDefault();e.dataTransfer.dropEffect="copy"===e.dataTransfer.effectAllowed?"copy":"move"}}));e.mainContainer.addEventListener("drop",(function(e){if(s.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){s.AppOptions.set("disableFontFace",!0);i.get("web_fonts_disabled").then((e=>{globalThis.ngxConsole.warn(e)}))}if(!D.supportsPrinting){var l,c,d;null===(l=e.toolbar)||void 0===l||null===(c=l.print)||void 0===c||c.classList.add("hidden");null===(d=e.secondaryToolbar)||void 0===d||d.printButton.classList.add("hidden")}if(!D.supportsFullscreen){var h;null===(h=e.secondaryToolbar)||void 0===h||h.presentationModeButton.classList.add("hidden")}if(D.supportsIntegratedFind){var u,p;null===(u=e.toolbar)||void 0===u||null===(p=u.viewFind)||void 0===p||p.classList.add("hidden")}e.mainContainer.addEventListener("transitionend",(function(e){e.target===this&&t.dispatch("resize",{source:this})}),!0);try{r?D.open({url:r}):D._hideViewBookmark()}catch(e){D.onError&&D.onError(e);i.get("loading_error").then((t=>{D._documentError(t,e)}))}}function webViewerPageRender(e){let{pageNumber:t}=e;if(t===D.page){var i;null===(i=D.toolbar)||void 0===i||i.updateLoadingIndicatorState(!0)}}function webViewerPageRendered(e){var t;let{pageNumber:i,error:r}=e;if(i===D.page){var s;null===(s=D.toolbar)||void 0===s||s.updateLoadingIndicatorState(!1)}if((null===(t=D.pdfSidebar)||void 0===t?void 0:t.visibleView)===n.SidebarView.THUMBS){var a;const e=D.pdfViewer.getPageView(i-1),t=null===(a=D.pdfThumbnailViewer)||void 0===a?void 0:a.getThumbnail(i-1);e&&(null==t||t.setImage(e))}r&&D.l10n.get("rendering_error").then((e=>{D._otherError(e,r)}))}function webViewerPageMode(e){var t;let i,{mode:r}=e;switch(r){case"thumbs":i=n.SidebarView.THUMBS;break;case"bookmarks":case"outline":i=n.SidebarView.OUTLINE;break;case"attachments":i=n.SidebarView.ATTACHMENTS;break;case"layers":i=n.SidebarView.LAYERS;break;case"none":i=n.SidebarView.NONE;break;default:globalThis.ngxConsole.error('Invalid "pagemode" hash parameter: '+r);return}null===(t=D.pdfSidebar)||void 0===t||t.switchView(i,!0)}function webViewerNamedAction(e){var t;switch(e.action){case"GoToPage":null===(t=D.appConfig.toolbar)||void 0===t||t.pageNumber.select();break;case"Find":D.supportsIntegratedFind||null==D||D.findBar.toggle();break;case"Print":D.triggerPrinting();break;case"SaveAs":D.downloadOrSave()}}function webViewerPresentationModeChanged(e){D.pdfViewer.presentationModeState=e.state}function webViewerSidebarViewChanged(e){let{view:t}=e;D.pdfRenderingQueue.isThumbnailViewEnabled=t===n.SidebarView.THUMBS;if(D.isInitialViewSet){var i;null===(i=D.store)||void 0===i||i.set("sidebarView",t).catch((()=>{}))}}function webViewerUpdateViewarea(e){let{location:t}=e;if(D.isInitialViewSet){var i;const e={};void 0===t.pageNumber&&null===t.pageNumber||(e.page=t.pageNumber);t.scale&&(e.zoom=t.scale);t.left&&(e.scrollLeft=t.left);t.top&&(e.scrollTop=t.top);void 0===t.rotation&&null===t.rotation||(e.rotation=t.rotation);null===(i=D.store)||void 0===i||i.setMultiple(e).catch((()=>{}))}if(D.appConfig.secondaryToolbar){const e=D.pdfLinkService.getAnchorUrl(t.pdfOpenParams);D.appConfig.secondaryToolbar.viewBookmarkButton.href=e}}function webViewerScrollModeChanged(e){if(D.isInitialViewSet&&!D.pdfViewer.isInPresentationMode){var t;null===(t=D.store)||void 0===t||t.set("scrollMode",e.mode).catch((()=>{}))}}function webViewerSpreadModeChanged(e){if(D.isInitialViewSet&&!D.pdfViewer.isInPresentationMode){var t;null===(t=D.store)||void 0===t||t.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){var t;const i=e.hash;i&&(D.isInitialViewSet?null!==(t=D.pdfHistory)&&void 0!==t&&t.popStateInProgress||D.pdfLinkService.setHash(i):D.initialBookmark=i)}var webViewerFileInputChange=function(e){var t;if(null!==(t=D.pdfViewer)&&void 0!==t&&t.isInPresentationMode)return;const i=e.fileInput.files[0];D.open({url:URL.createObjectURL(i),originalUrl:i.name});window.setNgxExtendedPdfViewerSource&&window.setNgxExtendedPdfViewerSource(i.name?i.name:URL.createObjectURL(i))},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 webViewerOpenInExternalApp(){D.openInExternalApp()}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);if(e.value!==t.currentPageNumber.toString()&&e.value!==t.currentPageLabel){var i;null===(i=D.toolbar)||void 0===i||i.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(){var e;null===(e=D.pdfDocumentProperties)||void 0===e||e.open()}function webViewerFindFromUrlHash(e){D.eventBus.dispatch("find",{source:e.source,type:"",query:e.query,caseSensitive:!1,entireWord:!1,ignoreAccents:!1,fuzzySearch:!1,highlightAll:!0,findPrevious:!1,matchDiacritics:!0})}function webViewerUpdateFindMatchesCount(e){let{matchesCount:t}=e;D.supportsIntegratedFind?D.externalServices.updateFindMatchesCount(t):D.findBar.updateResultsCount(t)}function webViewerUpdateFindControlState(e){let{state:t,previous:i,matchesCount:n,rawQuery:r}=e;if(D.supportsIntegratedFind)D.externalServices.updateFindControlState({result:t,findPrevious:i,matchesCount:n,rawQuery:r});else{var s;null===(s=D.findBar)||void 0===s||s.updateUIState(t,i,n)}}function webViewerScaleChanging(e){var t;null===(t=D.toolbar)||void 0===t||t.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(e){var t,i,r,s;let{pageNumber:a,pageLabel:o}=e;null===(t=D.toolbar)||void 0===t||t.setPageNumber(a,o);null===(i=D.secondaryToolbar)||void 0===i||i.setPageNumber(a);if((null===(r=D.pdfSidebar)||void 0===r?void 0:r.visibleView)===n.SidebarView.THUMBS){var l;null===(l=D.pdfThumbnailViewer)||void 0===l||l.scrollThumbnailIntoView(a)}const c=D.pdfViewer.getPageView(a-1);null===(s=D.toolbar)||void 0===s||s.updateLoadingIndicatorState((null==c?void 0:c.renderingState)===n.RenderingStates.RUNNING);const d=document.getElementById("pageNumber");if(d){const e=new CustomEvent("page-change");d.dispatchEvent(e)}}function webViewerVisibilityChange(e){"visible"===document.visibilityState&&setZoomDisabledTimeout()}let L=null;function setZoomDisabledTimeout(){L&&clearTimeout(L);L=setTimeout((function(){L=null}),T)}function webViewerWheel(e){const t=document.getElementById("viewerContainer");if(t.parentNode.querySelector(":hover")!==t)return;const{pdfViewer:i,supportedMouseWheelZoomModifierKeys:r,supportsPinchToZoom:s}=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 c=e.ctrlKey&&!D._isCtrlKeyDown&&o===WheelEvent.DOM_DELTA_PIXEL&&0===e.deltaX&&(Math.abs(l-1)<.05||!1)&&0===e.deltaZ;if(c||e.ctrlKey&&r.ctrlKey||e.metaKey&&r.metaKey){e.preventDefault();if(L||"hidden"===document.visibilityState)return;const t=i.currentScale;if(c&&s){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[r,s]=e.touches;r.identifier>s.identifier&&([r,s]=[s,r]);const{pageX:a,pageY:o}=r,{pageX:l,pageY:c}=s,{touch0X:d,touch0Y:h,touch1X:u,touch1Y:p}=i;if(Math.abs(d-a)<=1&&Math.abs(h-o)<=1&&Math.abs(u-l)<=1&&Math.abs(p-c)<=1)return;i.touch0X=a;i.touch0Y=o;i.touch1X=l;i.touch1Y=c;if(d===a&&h===o){const e=u-a,t=p-o,i=l-a,n=c-o,r=e*n-t*i;if(Math.abs(r)>.02*Math.hypot(e,t)*Math.hypot(i,n))return}else if(u===l&&p===c){const e=d-l,t=h-c,i=a-l,n=o-c,r=e*n-t*i;if(Math.abs(r)>.02*Math.hypot(e,t)*Math.hypot(i,n))return}else{if((a-d)*(l-u)+(o-h)*(c-p)>=0)return}e.preventDefault();const g=Math.hypot(a-l,o-c)||1,f=Math.hypot(d-u,h-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+c)/2)}function webViewerTouchEnd(e){if(D._touchInfo){e.preventDefault();D._touchInfo=null;D._touchUnusedTicks=0;D._touchUnusedFactor=1}}function webViewerClick(e){var t,i,n;if(null===(t=D.secondaryToolbar)||void 0===t||!t.isOpen)return;const r=D.appConfig;if(D.pdfViewer.containsElement(e.target)||null!==(i=r.toolbar)&&void 0!==i&&i.container.contains(e.target)&&e.target!==(null===(n=r.secondaryToolbar)||void 0===n?void 0:n.toggleButton)){if(e.target&&e.target.parentElement===r.secondaryToolbar.toggleButton)return;if(e.target&&e.target.parentElement&&e.target.parentElement.parentElement===r.secondaryToolbar.toggleButton)return;D.secondaryToolbar.close()}}function webViewerKeyUp(e){"Control"===e.key&&(D._isCtrlKeyDown=!1)}function webViewerKeyDown(e){var t,i,r,s,a;D._isCtrlKeyDown="Control"===e.key;if(D.overlayManager.active)return;const{eventBus:o,pdfViewer:l}=D,c=l.isInPresentationMode;let d=!1,h=!1;const u=(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0);if(window.isKeyIgnored&&window.isKeyIgnored(u,e.keyCode))return;if(1===u||8===u||5===u||12===u)switch(e.keyCode){case 70:if(!D.supportsIntegratedFind&&!e.shiftKey){var p;null===(p=D.findBar)||void 0===p||p.open();d=!0}break;case 71:if(!D.supportsIntegratedFind){const{state:e}=D.findController;if(e){const t={source:window,type:"again",findPrevious:5===u||12===u};o.dispatch("find",{...e,...t})}d=!0}break;case 61:case 107:case 187:case 171:D.zoomIn();d=!0;break;case 173:case 109:case 189:D.zoomOut();d=!0;break;case 48:case 96:if(!c){setTimeout((function(){D.zoomReset()}));d=!1}break;case 38:if(c||D.page>1){D.page=1;d=!0;h=!0}break;case 40:if(c||D.page<D.pagesCount){D.page=D.pagesCount;d=!0;h=!0}}if(1===u||8===u)switch(e.keyCode){case 83:o.dispatch("download",{source:window});d=!0;break;case 79:o.dispatch("openfile",{source:window});d=!0}if(3===u||10===u)switch(e.keyCode){case 80:D.requestPresentationMode();d=!0;D.externalServices.reportTelemetry({type:"buttons",data:{id:"presentationModeKeyboard"}});break;case 71:if(D.appConfig.toolbar){D.appConfig.toolbar.pageNumber.select();d=!0}}if(d){h&&!c&&l.focus();e.preventDefault();return}const g=(0,n.getActiveOrFocusedElement)(),f=null==g?void 0:g.tagName.toUpperCase();if(!("INPUT"===f||"TEXTAREA"===f||"SELECT"===f||null!=g&&g.isContentEditable)||27===e.keyCode){if(0===u){let o=0,u=!1;switch(e.keyCode){case 38:case 33:l.isVerticalScrollbarEnabled&&(u=!0);o=-1;break;case 8:c||(u=!0);o=-1;break;case 37:l.isHorizontalScrollbarEnabled&&(u=!0);case 75:case 80:o=-1;break;case 27:if(null!==(t=D.secondaryToolbar)&&void 0!==t&&t.isOpen){D.secondaryToolbar.close();d=!0}if(!D.supportsIntegratedFind&&null!==(i=D.findBar)&&void 0!==i&&i.opened){D.findBar.close();d=!0}break;case 40:case 34:l.isVerticalScrollbarEnabled&&(u=!0);o=1;break;case 13:case 32:c||(u=!0);o=1;break;case 39:l.isHorizontalScrollbarEnabled&&(u=!0);case 74:case 78:o=1;break;case 36:if(c||D.page>1){D.page=1;d=!0;h=!0}break;case 35:if(c||D.page<D.pagesCount){D.page=D.pagesCount;d=!0;h=!0}break;case 83:null===(r=D.pdfCursorTools)||void 0===r||r.switchTool(n.CursorTool.SELECT);break;case 72:null===(s=D.pdfCursorTools)||void 0===s||s.switchTool(n.CursorTool.HAND);break;case 82:D.rotatePages(90);break;case 115:null===(a=D.pdfSidebar)||void 0===a||a.toggle()}if(0!==o&&(!u||"page-fit"===l.currentScaleValue)){o>0?l.nextPage():l.previousPage();d=!0}}if(4===u)switch(e.keyCode){case 13:case 32:if(!c&&"page-fit"!==l.currentScaleValue)break;l.previousPage();d=!0;break;case 82:D.rotatePages(-90)}h&&!l.containsElement(g)&&l.focus();d&&e.preventDefault()}}function beforeUnload(e){e.preventDefault();e.returnValue="";return!1}const R={instance:{supportsPrinting:!1,createPrintService(){throw new Error("Not implemented: createPrintService")}}};t.PDFPrintServiceFactory=R},(e,t)=>{"use strict";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.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=r.NONE;switch(e){case"SinglePage":t=n.PAGE;break;case"OneColumn":break;case"TwoPageLeft":t=n.PAGE;case"TwoColumnLeft":i=r.ODD;break;case"TwoPageRight":t=n.PAGE;case"TwoColumnRight":i=r.EVEN}return{scrollMode:t,spreadMode:i}};t.apiPageModeToSidebarView=function 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,r=0,s=1,a=1,o=1;for(;;){const e=r+a,t=s+o;if(t>8)break;if(i<=e/t){a=e;o=t}else{r=e;s=t}}n=i-r/s<a/o-i?i===e?[r,s]:[s,r]: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(;null!==(i=t)&&void 0!==i&&i.shadowRoot;){var i;e=t.shadowRoot;t=e.activeElement||e.querySelector(":focus")}return t};t.getPageSizeInches=function getPageSizeInches(e){let{view:t,userUnit:i,rotate:n}=e;const[r,s,a,o]=t,l=n%180!=0,c=(a-r)/72*i,d=(o-s)/72*i;return{width:l?d:c,height:l?c:d}};t.getVisibleElements=function getVisibleElements(e){let{scrollEl:t,views:i,sortByVisibility:n=!1,horizontal:r=!1,rtl:s=!1}=e;const a=t.scrollTop,o=a+t.clientHeight,l=t.scrollLeft,c=l+t.clientWidth;const d=[],h=new Set,u=i.length;let p=binarySearchFirstItem(i,r?function isElementNextAfterViewHorizontally(e){const t=e.div,i=t.offsetLeft+t.clientLeft,n=i+t.clientWidth;return s?i<c:n>l}:function isElementBottomAfterViewTop(e){const t=e.div;return t.offsetTop+t.clientTop+t.clientHeight>a});p>0&&p<u&&!r&&(p=backtrackBeforeAllVisibleElements(p,i,a));let g=r?c:-1;for(let e=p;e<u;e++){const t=i[e],n=t.div,s=n.offsetLeft+n.clientLeft,u=n.offsetTop+n.clientTop,p=n.clientWidth,f=n.clientHeight,m=s+p,v=u+f;if(-1===g)v>=o&&(g=v);else if((r?s:u)>g)break;if(v<=a||u>=o||m<=l||s>=c)continue;const b=Math.max(0,a-u)+Math.max(0,v-o),y=(p-(Math.max(0,l-s)+Math.max(0,m-c)))/p,w=(f-b)/f*y*100|0;d.push({id:t.id,x:s,y:u,view:t,percent:w,widthPercent:100*y|0});h.add(t.id)}const f=d[0],m=d.at(-1);n&&d.sort((function(e,t){const i=e.percent-t.percent;return Math.abs(i)>.001?-i:e.id-t.id}));return{first:f,last:m,views:d,ids:h}};t.isPortraitOrientation=function isPortraitOrientation(e){return e.width<=e.height};t.isValidRotation=function isValidRotation(e){return Number.isInteger(e)&&e%90==0};t.isValidScrollMode=function isValidScrollMode(e){return Number.isInteger(e)&&Object.values(n).includes(e)&&e!==n.UNKNOWN};t.isValidSpreadMode=function isValidSpreadMode(e){return Number.isInteger(e)&&Object.values(r).includes(e)&&e!==r.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){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("string"!=typeof e){console.error("The argument must be a string.");return e}t&&(e=e.replaceAll(s," "));return e.replaceAll("\0","")};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){var i,n,r;let s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e.classList.contains("stf__item")||null!==(i=e.parentElement)&&void 0!==i&&i.classList.contains("stf__item")||null!==(n=e.parentElement)&&void 0!==n&&null!==(r=n.parentElement)&&void 0!==r&&r.classList.contains("stf__item"))return;let o=e.offsetParent;if(!o){globalThis.ngxConsole.error("offsetParent is not set -- cannot scroll");return}let l=e.offsetTop+e.clientTop,c=e.offsetLeft+e.clientLeft;for(;o.clientHeight===o.scrollHeight&&o.clientWidth===o.scrollWidth||s&&(o.classList.contains("markedContent")||"hidden"===getComputedStyle(o).overflow);){l+=o.offsetTop;c+=o.offsetLeft;o=o.offsetParent;if(!o){if(a&&document.body.clientHeight>l){l-=32;window.scrollTo(window.scrollX,l)}return}}if(t){void 0!==t.top&&(l+=t.top);if(void 0!==t.left){c+=t.left;o.scrollLeft=c}}o.scrollTop=l};t.toggleCheckedBtn=function toggleCheckedBtn(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e.classList.toggle("toggled",t);e.setAttribute("aria-checked",t);null==i||i.classList.toggle("hidden",!t)};t.toggleExpandedBtn=function toggleExpandedBtn(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e.classList.toggle("toggled",t);e.setAttribute("aria-expanded",t);null==i||i.classList.toggle("hidden",!t)};t.watchScroll=function watchScroll(e,t){const debounceScroll=function(r){n||(n=window.requestAnimationFrame((function viewAreaElementScrolled(){n=null;const r=e.scrollLeft,s=i.lastX;r!==s&&(i.right=r>s);i.lastX=r;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.TextLayerMode={DISABLE:0,ENABLE:1,ENABLE_PERMISSIONS:2};const n={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3};t.ScrollMode=n;const r={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2};t.SpreadMode=r;t.CursorTool={SELECT:0,HAND:1,ZOOM:2};t.AutoPrintRegExp=/\bprint\s*\(/;t.OutputScale=class OutputScale{constructor(){const e=window.devicePixelRatio||1;this.sx=e;this.sy=e}get scaled(){return 1!==this.sx||1!==this.sy}};const s=/[\x01-\x1F]/g;function binarySearchFirstItem(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=e.length-1;if(n<0||!t(e[n]))return e.length;if(t(e[i]))return i;for(;i<n;){const r=i+n>>1;t(e[r])?n=r:i=r+1}return i}function backtrackBeforeAllVisibleElements(e,t,i){if(e<2)return e;let n=t[e].div,r=n.offsetTop+n.clientTop;if(r>=i){n=t[e-1].div;r=n.offsetTop+n.clientTop}for(let i=e-2;i>=0;--i){n=t[i].div;if(n.offsetTop+n.clientTop+n.clientHeight<=r)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 a=new Promise((function(e){window.ngxZone.runOutsideAngular((()=>{window.requestAnimationFrame(e)}))}));t.animationStarted=a;const o=document.documentElement.style;t.docStyle=o;t.ProgressBar=class ProgressBar{#ei=null;#ti=null;#ii=0;#ni=null;#ke=!0;constructor(e){this.#ei=e.classList;this.#ni=e.style}get percent(){return this.#ii}set percent(e){this.#ii=function clamp(e,t,i){return Math.min(Math.max(e,t),i)}(e,0,100);if(isNaN(e))this.#ei.add("indeterminate");else{this.#ei.remove("indeterminate");this.#ni.setProperty("--progressBar-percent",`${this.#ii}%`)}}setWidth(e){if(!e)return;const t=e.parentNode.offsetWidth-e.offsetWidth;t>0&&this.#ni.setProperty("--progressBar-end-offset",`${t}px`)}setDisableAutoFetch(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5e3;if(!isNaN(this.#ii)){this.#ti&&clearTimeout(this.#ti);this.show();this.#ti=setTimeout((()=>{this.#ti=null;this.hide()}),e)}}hide(){if(this.#ke){this.#ke=!1;this.#ei.add("hidden")}}show(){if(!this.#ke){this.#ke=!0;this.#ei.remove("hidden")}}}},e=>{"use strict";e.exports=window["pdfjs-dist/build/pdf"]},(e,t)=>{"use strict";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,r=/Android/.test(e),s=/\b(iPad|iPhone|iPod)(?=;)/.test(e)||"MacIntel"===t&&n>1;!function checkCanvasSizeLimitation(){(s||r)&&(i.maxCanvasPixels=5242880)}()}const n={VIEWER:2,API:4,WORKER:8,PREFERENCE:128};t.OptionKind=n;const r={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},enableFloatingToolbar:{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}};r.defaultUrl={value:"compressed.tracemonkey-pldi-09.pdf",kind:n.VIEWER};r.disablePreferences={value:!1,kind:n.VIEWER};r.locale={value:navigator.language||"en-US",kind:n.VIEWER};r.sandboxBundleSrc={value:"../build/pdf.sandbox.js",kind:n.VIEWER};const s=Object.create(null);if(globalThis.pdfDefaultOptions)for(const e in globalThis.pdfDefaultOptions)s[e]=globalThis.pdfDefaultOptions[e];class AppOptions{constructor(){throw new Error("Cannot initialize AppOptions.")}static get(e){const t=s[e];if(void 0!==t)return t;const n=r[e];return void 0!==n?i[e]??n.value:void 0}static getAll(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const t=Object.create(null);for(const a in r){const o=r[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=s[a];t[a]=void 0!==l?l:i[a]??o.value}return t}static set(e,t){s[e]=t}static setAll(e){for(const t in e)s[t]=e[t]}static remove(e){delete s[e]}}t.AppOptions=AppOptions;AppOptions._hasUserOptions=function(){return Object.keys(s).length>0}},(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.WaitOnType=t.EventBus=t.AutomationEventBus=void 0;t.waitOnEventOrTimeout=function waitOnEventOrTimeout(e){let{target:t,name:n,delay:r=0}=e;return new Promise((function(e,s){if("object"!=typeof t||!n||"string"!=typeof n||!(Number.isInteger(r)&&r>=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");function handler(i){t instanceof EventBus?t._off(n,a):t.removeEventListener(n,a);l&&clearTimeout(l);e(i)}const a=handler.bind(null,i.EVENT);t instanceof EventBus?t._on(n,a):t.addEventListener(n,a);const o=handler.bind(null,i.TIMEOUT),l=setTimeout(o,r)}))};const i={EVENT:"event",TIMEOUT:"timeout"};t.WaitOnType=i;class EventBus{#a=Object.create(null);on(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this._on(e,t,{external:!0,once:null==i?void 0:i.once})}off(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;this._off(e,t,{external:!0,once:null==i?void 0:i.once})}dispatch(e,t){const i=this.#a[e];if(!i||0===i.length)return;let n;for(const{listener:r,external:s,once:a}of i.slice(0)){a&&this._off(e,r);s?(n||=[]).push(r):r(t)}if(n){for(const e of n)e(t);n=null}}_on(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;(this.#a[e]||=[]).push({listener:t,external:!0===(null==i?void 0:i.external),once:!0===(null==i?void 0:i.once)})}_off(e,t){const i=this.#a[e];if(i)for(let e=0,n=i.length;e<n;e++)if(i[e].listener===t){i.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)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.SimpleLinkService=t.PDFLinkService=t.LinkTarget=void 0;var n=i(3);const r={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};t.LinkTarget=r;function addLinkAttributes(e){let{url:t,target:i,rel:s,enabled:a=!0}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t||"string"!=typeof t)throw new Error('A valid "url" parameter must provided.');const o=(0,n.removeNullCharacters)(t);if(a)e.href=e.title=o;else{e.href="";e.title=`Disabled: ${o}`;e.onclick=()=>!1}let l="";switch(i){case r.NONE:break;case r.SELF:l="_self";break;case r.BLANK:l="_blank";break;case r.PARENT:l="_parent";break;case r.TOP:l="_top"}e.target=l;e.rel="string"==typeof s?s:"noopener noreferrer nofollow"}class PDFLinkService{#ri=new Map;constructor(){let{eventBus:e,externalLinkTarget:t=null,externalLinkRel:i=null,ignoreDestinationZoom:n=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};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){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.baseUrl=t;this.pdfDocument=e;this.#ri.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}#si(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2?arguments[2]:void 0;const n=i[0];let r;if("object"==typeof n&&null!==n){r=this._cachedPageNumber(n);if(!r){this.pdfDocument.getPageIndex(n).then((r=>{this.cachePageRef(r+1,n);this.#si(e,t,i)})).catch((()=>{globalThis.ngxConsole.error(`PDFLinkService.#goToDestinationHelper: "${n}" is not a valid page reference, for dest="${e}".`)}));return}}else{if(!Number.isInteger(n)){globalThis.ngxConsole.error(`PDFLinkService.#goToDestinationHelper: "${n}" is not a valid destination reference, for dest="${e}".`);return}r=n+1}if(!r||r<1||r>this.pagesCount)globalThis.ngxConsole.error(`PDFLinkService.#goToDestinationHelper: "${r}" is not a valid page number, for dest="${e}".`);else{if(this.pdfHistory){this.pdfHistory.pushCurrentPosition();this.pdfHistory.push({namedDest:t,explicitDest:i,pageNumber:r})}this.pdfViewer.scrollPageIntoView({pageNumber:r,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.#si(e,t,i):globalThis.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 globalThis.ngxConsole.error(`PDFLinkService.goToPage: "${e}" is not a valid page.`)}addLinkAttributes(e,t){addLinkAttributes(e,{url:t,target:arguments.length>2&&void 0!==arguments[2]&&arguments[2]?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?this.baseUrl+e:e}setHash(e){if(!this.pdfDocument)return;let t,i;if(e.includes("=")){const r=(0,n.parseQueryString)(e);if(r.has("search")){const e=r.get("search").replaceAll('"',""),t="true"===r.get("phrase");this.eventBus.dispatch("findfromurlhash",{source:this,query:t?e:e.match(/\S+/g)})}r.has("page")&&(t=0|r.get("page")||1);if(r.has("zoom")){const e=r.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?globalThis.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]]:globalThis.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);r.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:r.get("pagemode")});r.has("nameddest")&&this.goToDestination(r.get("nameddest"))}else{i=unescape(e);try{i=JSON.parse(i);Array.isArray(i)||(i=i.toString())}catch(e){}if("string"==typeof i||PDFLinkService.#ai(i)){this.goToDestination(i);return}globalThis.ngxConsole.error(`PDFLinkService.setHash: "${unescape(e)}" is not a valid destination.`)}}executeNamedAction(e){var t,i;switch(e){case"GoBack":null===(t=this.pdfHistory)||void 0===t||t.back();break;case"GoForward":null===(i=this.pdfHistory)||void 0===i||i.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.#ri.set(i,e)}_cachedPageNumber(e){if(!e)return null;const t=0===e.gen?`${e.num}R`:`${e.num}R${e.gen}`;return this.#ri.get(t)||null}static#ai(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 r=!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;r=!1;break;default:return!1}for(let i=2;i<t;i++){const t=e[i];if(!("number"==typeof t||r&&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){addLinkAttributes(e,{url:t,enabled:this.externalLinkEnabled})}getDestinationHash(e){return"#"}getAnchorUrl(e){return"#"}setHash(e){}executeNamedAction(e){}executeSetOCGState(e){}cachePageRef(e,t){}}},(e,t,i)=>{"use strict";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.#oi(e)}#oi(e){let{editorFreeTextFontSize:t,editorFreeTextColor:i,editorInkColor:r,editorInkThickness:s,editorInkOpacity:a}=e;const dispatchEvent=(e,t)=>{this.eventBus.dispatch("switchannotationeditorparams",{source:this,type:n.AnnotationEditorParamsType[e],value:t})};t.addEventListener("input",(function(){dispatchEvent("FREETEXT_SIZE",this.valueAsNumber)}));i.addEventListener("input",(function(){dispatchEvent("FREETEXT_COLOR",this.value)}));r.addEventListener("input",(function(){dispatchEvent("INK_COLOR",this.value)}));s.addEventListener("input",(function(){dispatchEvent("INK_THICKNESS",this.valueAsNumber)}));a.addEventListener("input",(function(){dispatchEvent("INK_OPACITY",this.valueAsNumber)}));this.eventBus._on("annotationeditorparamschanged",(e=>{for(const[o,l]of e.details)switch(o){case n.AnnotationEditorParamsType.FREETEXT_SIZE:t.value=l;break;case n.AnnotationEditorParamsType.FREETEXT_COLOR:i.value=l;break;case n.AnnotationEditorParamsType.INK_COLOR:r.value=l;break;case n.AnnotationEditorParamsType.INK_THICKNESS:s.value=l;break;case n.AnnotationEditorParamsType.INK_OPACITY:a.value=l}}))}}},(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.OverlayManager=void 0;t.OverlayManager=class OverlayManager{#li=new WeakMap;#ci=null;get active(){return this.#ci}async register(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("object"!=typeof e)throw new Error("Not enough parameters.");if(this.#li.has(e))throw new Error("The overlay is already registered.");this.#li.set(e,{canForceClose:t});e.addEventListener("cancel",(e=>{this.#ci=null}))}async unregister(e){if(!this.#li.has(e))throw new Error("The overlay does not exist.");if(this.#ci===e)throw new Error("The overlay cannot be removed while it is active.");this.#li.delete(e)}async open(e){if(!this.#li.has(e))throw new Error("The overlay does not exist.");if(this.#ci){if(this.#ci===e)throw new Error("The overlay is already active.");if(!this.#li.get(e).canForceClose)throw new Error("Another overlay is currently active.");await this.close()}this.#ci=e;e.showModal();e.classList.remove("hidden")}async close(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.#ci;if(!this.#li.has(e))throw new Error("The overlay does not exist.");if(!this.#ci)throw new Error("The overlay is currently not active.");if(this.#ci!==e)throw new Error("Another overlay is currently active.");e.close();this.#ci=null}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PasswordPrompt=void 0;var n=i(4);t.PasswordPrompt=class PasswordPrompt{#di=null;#hi=null;#ui=null;constructor(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];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.#pi.bind(this));this.cancelButton.addEventListener("click",this.close.bind(this));this.input.addEventListener("keydown",(e=>{13===e.keyCode&&this.#pi()}));this.overlayManager.register(this.dialog,!0);this.dialog.addEventListener("close",this.#gi.bind(this))}async open(){this.#di&&await this.#di.promise;this.#di=new n.PromiseCapability;try{await this.overlayManager.open(this.dialog);this.input.type="password";this.input.focus()}catch(e){this.#di=null;throw e}const e=this.#ui===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"}}#pi(){const e=this.input.value;(null==e?void 0:e.length)>0&&this.#fi(e)}#gi(){this.#fi(new Error("PasswordPrompt cancelled."));this.#di.resolve()}#fi(e){if(this.#hi){this.close();this.input.value="";this.#hi(e);this.#hi=null}}async setUpdateCallback(e,t){this.#di&&await this.#di.promise;this.#hi=e;this.#ui=t}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PDFAttachmentViewer=void 0;var n=i(4),r=i(12),s=i(6);class PDFAttachmentViewer extends r.BaseTreeViewer{constructor(e){super(e);this.downloadManager=e.downloadManager;this.eventBus._on("fileattachmentannotation",this.#mi.bind(this))}reset(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];super.reset();this._attachments=null;e||(this._renderedCapability=new n.PromiseCapability);this._pendingDispatchEvent=!1}async _dispatchEvent(e){this._renderedCapability.resolve();if(0===e&&!this._pendingDispatchEvent){this._pendingDispatchEvent=!0;await(0,s.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,t){let{content:i,filename:n}=t;e.onclick=()=>{this.downloadManager.openOrDownloadData(e,i,n);return!1}}render(e){let{attachments:t,keepRenderedCapability:i=!1}=e;this._attachments&&this.reset(i);this._attachments=t||null;if(!t){this._dispatchEvent(0);return}const r=document.createDocumentFragment();let s=0;for(const e in t){const i=t[e],a=i.content,o=(0,n.getFilenameFromUrl)(i.filename,!0),l=document.createElement("div");l.className="treeItem";const c=document.createElement("a");this._bindLink(c,{content:a,filename:o});c.textContent=this._normalizeTextContent(o);l.append(c);r.append(l);s++}this._finishRendering(r,s)}#mi(e){let{filename:t,content:i}=e;const n=this._renderedCapability.promise;n.then((()=>{if(n!==this._renderedCapability.promise)return;const e=this._attachments||Object.create(null);for(const i in e)if(t===i)return;e[t]={filename:t,content:i};this.render({attachments:e,keepRenderedCapability:!0})}))}}t.PDFAttachmentViewer=PDFAttachmentViewer},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.BaseTreeViewer=void 0;var n=i(3);const r="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){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[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){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[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){if(arguments.length>2&&void 0!==arguments[2]&&arguments[2]){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(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(this._currentTreeItem){this._currentTreeItem.classList.remove(r);this._currentTreeItem=null}if(e){e.classList.add(r);this._currentTreeItem=e}}_scrollToCurrentTreeItem(e){if(!e)return;let t=e.parentNode;for(;t&&t!==this.container;){if(t.classList.contains("treeItem")){const e=t.firstElementChild;null==e||e.classList.remove("treeItemsHidden")}t=t.parentNode}this._updateCurrentTreeItem(e);this.container.scrollTo(e.offsetLeft,e.offsetTop+-100)}}t.BaseTreeViewer=BaseTreeViewer},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PDFCursorTools=void 0;var n=i(3),r=i(4),s=i(14);t.PDFCursorTools=class PDFCursorTools{constructor(e){let{container:t,eventBus:i,cursorToolOnLoad:r=n.CursorTool.SELECT}=e;this.container=t;this.eventBus=i;this.active=n.CursorTool.SELECT;this.previouslyActive=null;this.handTool=new s.GrabToPan({element:this.container});this.#vi();Promise.resolve().then((()=>{this.switchTool(r)}))}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:globalThis.ngxConsole.error(`switchTool: "${e}" is an unsupported value.`);return}this.active=e;this.#bi()}#bi(){this.eventBus.dispatch("cursortoolchanged",{source:this,tool:this.active})}#vi(){this.eventBus._on("switchcursortool",(e=>{this.switchTool(e.tool)}));let e=r.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===r.AnnotationEditorType.NONE&&t===n.PresentationModeState.NORMAL){this.previouslyActive=null;this.switchTool(i)}};this.eventBus._on("secondarytoolbarreset",(i=>{if(null!==this.previouslyActive){e=r.AnnotationEditorType.NONE;t=n.PresentationModeState.NORMAL;enableActive()}}));this.eventBus._on("annotationeditormodechanged",(t=>{let{mode:i}=t;e=i;i===r.AnnotationEditorType.NONE?enableActive():disableActive()}));this.eventBus._on("presentationmodechanged",(e=>{let{state:i}=e;t=i;i===n.PresentationModeState.NORMAL?enableActive():i===n.PresentationModeState.FULLSCREEN&&disableActive()}))}}},(e,t)=>{"use strict";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.#yi.bind(this);this._onMouseMove=this.#wi.bind(this);this._endPan=this.#_i.bind(this);(this.overlay=document.createElement("div")).className="grab-to-pan-grabbing"}activate(){if(!this.active){var e;this.active=!0;this.element.addEventListener("mousedown",this._onMouseDown);this.element.classList.add(i);null===(e=this.onActiveChanged)||void 0===e||e.call(this,!0)}}deactivate(){if(this.active){var e;this.active=!1;this.element.removeEventListener("mousedown",this._onMouseDown);this._endPan();this.element.classList.remove(i);null===(e=this.onActiveChanged)||void 0===e||e.call(this,!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")}#yi(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()}#wi(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,r=this.scrollLeftStart-t;if(this.element.scrollTo)this.element.scrollTo({top:n,left:r,behavior:"instant"});else{this.element.scrollTop=n;this.element.scrollLeft=r}this.overlay.parentNode||document.body.append(this.overlay)}#_i(){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:r,right:s,bottom:a,left:o}=n[0].getBoundingClientRect();if(t>=r&&t<=a&&e<=s&&e>=o)return!0}return!1}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PDFDocumentProperties=void 0;var n=i(3),r=i(4);const s=["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{#Si=null;constructor(e,t,i,n,r){let{dialog:a,fields:o,closeButton:l}=e;this.dialog=a;this.fields=o;this.overlayManager=t;this.l10n=n;this._fileNameLookup=r;this.#Pi();l.addEventListener("click",this.close.bind(this));this.overlayManager.register(this.dialog);i._on("pagechanging",(e=>{this._currentPageNumber=e.pageNumber}));i._on("rotationchanging",(e=>{this._pagesRotation=e.pagesRotation}));this._isNonMetricLocale=!0;n.getLanguage().then((e=>{this._isNonMetricLocale=s.includes(e)}))}async open(){await Promise.all([this.overlayManager.open(this.dialog),this._dataAvailableCapability.promise]);const e=this._currentPageNumber,t=this._pagesRotation;if(this.#Si&&e===this.#Si._currentPageNumber&&t===this.#Si._pagesRotation){this.#Ai();return}const{info:i,contentLength:r}=await this.pdfDocument.getMetadata(),[s,a,o,l,c,d]=await Promise.all([this._fileNameLookup(),this.#Ei(r),this.#xi(i.CreationDate),this.#xi(i.ModDate),this.pdfDocument.getPage(e).then((e=>this.#Ci((0,n.getPageSizeInches)(e),t))),this.#Ti(i.IsLinearized)]);this.#Si=Object.freeze({fileName:s,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:c,linearized:d,_currentPageNumber:e,_pagesRotation:t});this.#Ai();const{length:h}=await this.pdfDocument.getDownloadInfo();if(r===h)return;const u=Object.assign(Object.create(null),this.#Si);u.fileSize=await this.#Ei(h);this.#Si=Object.freeze(u);this.#Ai()}async close(){this.overlayManager.close(this.dialog)}setDocument(e){if(this.pdfDocument){this.#Pi();this.#Ai(!0)}if(e){this.pdfDocument=e;this._dataAvailableCapability.resolve()}}#Pi(){this.pdfDocument=null;this.#Si=null;this._dataAvailableCapability=new r.PromiseCapability;this._currentPageNumber=1;this._pagesRotation=0}#Ai(){if(!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.#Si){if(this.overlayManager.active===this.dialog)for(const e in this.fields){const t=this.#Si[e];this.fields[e].textContent=t||0===t?t:"-"}}else for(const e in this.fields)this.fields[e].textContent="-"}async#Ei(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]: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#Ci(e,t){if(!e)return;t%180!=0&&(e={width:e.height,height:e.width});const i=(0,n.isPortraitOrientation)(e);let r={width:Math.round(100*e.width)/100,height:Math.round(100*e.height)/100},s={width:Math.round(25.4*e.width*10)/10,height:Math.round(25.4*e.height*10)/10},l=getPageName(r,i,a)||getPageName(s,i,o);if(!(l||Number.isInteger(s.width)&&Number.isInteger(s.height))){const t={width:25.4*e.width,height:25.4*e.height},n={width:Math.round(s.width),height:Math.round(s.height)};if(Math.abs(t.width-n.width)<.1&&Math.abs(t.height-n.height)<.1){l=getPageName(n,i,o);if(l){r={width:Math.round(n.width/25.4*100)/100,height:Math.round(n.height/25.4*100)/100};s=n}}}const[{width:c,height:d},h,u,p]=await Promise.all([this._isNonMetricLocale?r:s,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:c.toLocaleString(),height:d.toLocaleString(),unit:h,name:u,orientation:p})}async#xi(e){const t=r.PDFDateString.toDateObject(e);if(t)return this.l10n.get("document_properties_date_string",{date:t.toLocaleDateString(),time:t.toLocaleTimeString()})}#Ti(e){return this.l10n.get("document_properties_linearized_"+(e?"yes":"no"))}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PDFFindBar=void 0;var n=i(17),r=i(3);t.PDFFindBar=class PDFFindBar{constructor(e,t,i){var n;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")}));null===(n=this.matchDiacritics)||void 0===n||n.addEventListener("click",(()=>{this.dispatchEvent("diacriticmatchingchange")}));this.eventBus._on("resize",this.#Mi.bind(this))}reset(){this.updateUIState()}dispatchEvent(e){var t;let i=arguments.length>1&&void 0!==arguments[1]&&arguments[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:i,matchDiacritics:null===(t=this.matchDiacritics)||void 0===t?void 0:t.checked})}updateUIState(e,t,i){let r=Promise.resolve(""),s="";switch(e){case n.FindState.FOUND:break;case n.FindState.PENDING:s="pending";break;case n.FindState.NOT_FOUND:r=this.l10n.get("find_not_found");s="notFound";break;case n.FindState.WRAPPED:r=this.l10n.get("find_reached_"+(t?"top":"bottom"))}this.findField.setAttribute("data-status",s);this.findFieldMultiline.classList.toggle("notFound","notFound"===s);this.findFieldMultiline.setAttribute("data-status",s);this.findField.setAttribute("aria-invalid",e===n.FindState.NOT_FOUND);r.then((e=>{this.findMsg.setAttribute("data-status",s);this.findMsg.textContent=e;this.#Mi()}));this.updateResultsCount(i)}updateResultsCount(){let{current:e=0,total:t=0}=arguments.length>0&&void 0!==arguments[0]?arguments[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.#Mi()}))}open(){if(!this.opened){this.opened=!0;(0,r.toggleExpandedBtn)(this.toggleButton,!0,this.bar)}this.findField.select();this.findField.focus();this.dispatchEvent("");this.#Mi()}close(){if(this.opened){this.opened=!1;(0,r.toggleExpandedBtn)(this.toggleButton,!1,this.bar);this.eventBus.dispatch("findbarclose",{source:this})}}toggle(){this.opened?this.close():this.open()}#Mi(){if(!this.opened)return;this.bar.classList.remove("wrapContainers");this.bar.clientHeight>this.bar.firstElementChild.clientHeight&&this.bar.classList.add("wrapContainers")}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PDFFindController=t.FindState=void 0;var n=i(18),r=i(19),s=i(20),a=i(3),o=i(4);const l={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3};t.FindState=l;const c={"‐":"-","‘":"'","’":"'","‚":"'","‛":"'","“":'"',"”":'"',"„":'"',"‟":'"',"¼":"1/4","½":"1/2","¾":"3/4","\n":" "};let d=null;function normalize(e){if(!d){const e=Object.keys(c).join("");d=new RegExp(`[${e}]`,"g")}let t=null;return[e.replace(d,(function(e,i){const n=c[e],r=n.length-e.length;"\n"===e?(t||=[]).push([i-1,1]):0!==r&&(t||=[]).push([i,r]);return n})),t]}function getOriginalIndex(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!t)return e;let i=0;for(const[n,r]of t){const t=n+i;if(n>=e)break;if(n+r>e){i+=e-t;break}i+=r}return e-i}t.PDFFindController=class PDFFindController{constructor(e){let{linkService:t,eventBus:i,pageViewMode:n}=e;this._linkService=t;this._eventBus=i;this._pageViewMode=n;this._reset();i._on("find",this._onFind.bind(this));i._on("findbarclose",this._onFindBarClose.bind(this));this.executeCommand=(e,t)=>{globalThis.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(e){let{element:t=null,selectedLeft:i=0,pageIndex:n=-1,matchIndex:r=-1}=e;if(!this._scrollMatches||!t)return;if(-1===r||r!==this._selected.matchIdx)return;if(-1===n||n!==this._selected.pageIdx)return;this._scrollMatches=!1;const s={top:-50,left:i+-400};(0,a.scrollIntoView)(t,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=new o.PromiseCapability}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 r=0,s=e.length;r<s;r++)if(!isSubTerm(r)){t.push(e[r].match);i.push(e[r].matchLength);n.push(e[r].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 r=[],a=[],o=e.length,l=o<5?o:5,c=Math.round(o/5),d=e.substring(0,l),h={useCollator:!0};for(let t=0;t<i.length-o;t++){const u=i.substring(t,t+l);if(s.Levenshtein.distance(d,u,h)<3){const l=i.substring(t,t+o),d=s.Levenshtein.distance(e,l,h);if(d<=c){if(t+1<i.length-o){const n=i.substring(t+1,t+1+o);if(d>=s.Levenshtein.distance(e,n,h))continue}const l=getOriginalIndex(t,n),c=getOriginalIndex(t+o-1,n)-l+1;r.push(l);a.push(c);t+=o-1}}}this._pageMatches[t]=r;this._pageMatchesLength[t]=a}_calculatePhraseMatch(e,t,i,r,s,a){if(a){i=(0,n.deburr)(i);e=(0,n.deburr)(e)}const o=[],l=[],c=e.length;let d=-c;for(;;){d=i.indexOf(e,d+c);if(-1===d)break;if(s&&!this._isEntireWord(i,d,c))continue;const t=getOriginalIndex(d,r),n=getOriginalIndex(d+c-1,r)-t+1;o.push(t);l.push(n)}this._pageMatches[t]=o;this._pageMatchesLength[t]=l}_calculateWordMatch(e,t,i,r,s,a){if(a){i=(0,n.deburr)(i);e=(0,n.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],n=t.length;if(0===n)continue;let a=-n;for(;;){a=i.indexOf(t,a+n);if(-1===a)break;if(s&&!this._isEntireWord(i,a,n))continue;const l=getOriginalIndex(a,r),c=getOriginalIndex(a+n-1,r)-l+1;o.push({match:l,matchLength:c,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(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1?arguments[1]:void 0;try{if(!t)return!0;return t.split(",").some((t=>this._isInPageRange(e,t)))}catch(e){return!0}}_isInPageRange(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"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 r=i[1].trim();if(r.length>0&&e>Number(r))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:r,entireWord:s,ignoreAccents:a,fuzzySearch:o,phraseSearch:l,currentPage:c,pageRange:d}=this._state;let h=!1;if(c&&e!==this._linkService.page-1){h=!0;this._pageMatches[e]=[]}if(!this._isInPageRanges(e+1,d)){h=!0;this._pageMatches[e]=[]}if(0===n.length)return;if(!h){if(!r){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,s,a):this._calculateWordMatch(n,e,t,i,s,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():c&&!h&&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=new o.PromiseCapability;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,r=[];for(let e=0,t=n.length;e<t;e++){r.push(n[e].str);n[e].hasEOL&&r.push("\n")}[this._pageContents[t],this._pageDiffs[t]]=normalize(r.join(""));i.resolve(t)}),(e=>{globalThis.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,r=i-1;if(e){n=this._linkService.page-1;r=n}for(let e=n;e<=r;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&&globalThis.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(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],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++){var r;i+=(null===(r=this._pageMatches[t])||void 0===r?void 0:r.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){var t;let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:e,previous:i,matchesCount:this._requestMatchesCount(),rawQuery:(null===(t=this._state)||void 0===t?void 0:t.query)??null})}}},(e,t)=>{"use strict";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(r,c).replace(s,"")};var i=1/0,n="[object Symbol]",r=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,s=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 c=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,h=l.Symbol,u=h?h.prototype:void 0,p=u?u.toString:void 0},(e,t)=>{"use strict";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};t.getNormalizeWithNFKC=function getNormalizeWithNFKC(){n||=" ¨ª¯²-µ¸-º¼-¾IJ-ijĿ-ŀʼnſDŽ-njDZ-dzʰ-ʸ˘-˝ˠ-ˤʹͺ;΄-΅·ϐ-ϖϰ-ϲϴ-ϵϹևٵ-ٸक़-य़ড়-ঢ়য়ਲ਼ਸ਼ਖ਼-ਜ਼ਫ਼ଡ଼-ଢ଼ำຳໜ-ໝ༌གྷཌྷདྷབྷཛྷཀྵჼᴬ-ᴮᴰ-ᴺᴼ-ᵍᵏ-ᵪᵸᶛ-ᶿẚ-ẛάέήίόύώΆ᾽-῁ΈΉ῍-῏ΐΊ῝-῟ΰΎ῭-`ΌΏ´-῾ - ‑‗․-… ″-‴‶-‷‼‾⁇-⁉⁗ ⁰-ⁱ⁴-₎ₐ-ₜ₨℀-℃℅-ℇ℉-ℓℕ-№ℙ-ℝ℠-™ℤΩℨK-ℭℯ-ℱℳ-ℹ℻-⅀ⅅ-ⅉ⅐-ⅿ↉∬-∭∯-∰〈-〉①-⓪⨌⩴-⩶⫝̸ⱼ-ⱽⵯ⺟⻳⼀-⿕ 〶〸-〺゛-゜ゟヿㄱ-ㆎ㆒-㆟㈀-㈞㈠-㉇㉐-㉾㊀-㏿ꚜ-ꚝꝰꟲ-ꟴꟸ-ꟹꭜ-ꭟꭩ豈-嗀塚晴凞-羽蘒諸逸-都飯-舘並-龎ff-stﬓ-ﬗיִײַ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-﷼︐-︙︰-﹄﹇-﹒﹔-﹦﹨-﹫ﹰ-ﹲﹴﹶ-ﻼ!-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ¢-₩";return n};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;let n},(e,t)=>{"use strict";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=[],r=[];t.Levenshtein=class Levenshtein{static distance(e,t,s){const a=s&&i&&s.useCollator,o=e.length,l=t.length;if(0===o)return l;if(0===l)return o;let c,d,h,u,p,g;for(h=0;h<l;++h){n[h]=h;r[h]=t.charCodeAt(h)}n[l]=l;if(a)for(h=0;h<o;++h){d=h+1;for(u=0;u<l;++u){c=d;g=0===i.compare(e.charAt(h),String.fromCharCode(r[u]));d=n[u]+(g?0:1);p=c+1;d>p&&(d=p);p=n[u+1]+1;d>p&&(d=p);n[u]=c}n[u]=d}else for(h=0;h<o;++h){d=h+1;for(u=0;u<l;++u){c=d;g=e.charCodeAt(h)===r[u];d=n[u]+(g?0:1);p=c+1;d>p&&(d=p);p=n[u+1]+1;d>p&&(d=p);n[u]=c}n[u]=d}return d}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PDFHistory=void 0;t.isDestArraysEqual=isDestArraysEqual;t.isDestHashesEqual=isDestHashesEqual;var n=i(3),r=i(6);function getCurrentHash(){return document.location.hash}t.PDFHistory=class PDFHistory{constructor(e){let{linkService:t,eventBus:i}=e;this.linkService=t;this.eventBus=i;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(e){let{fingerprint:t,resetHistory:i=!1,updateUrl:n=!1}=e;if(!t||"string"!=typeof t){globalThis.ngxConsole.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');return}this._initialized&&this.reset();const r=""!==this._fingerprint&&this._fingerprint!==t;this._fingerprint=t;this._updateUrl=!0===n;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)||i){const{hash:e,page:t,rotation:n}=this._parseCurrentHash(!0);if(!e||r||i){this._pushOrReplaceState(null,!0);return}this._pushOrReplaceState({hash:e,page:t,rotation:n},!0);return}const a=s.destination;this._updateInternalState(a,s.uid,!0);void 0!==a.rotation&&(this._initialRotation=a.rotation);if(a.dest){this._initialBookmark=JSON.stringify(a.dest);this._destination.page=null}else a.hash?this._initialBookmark=a.hash:a.page&&(this._initialBookmark=`page=${a.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(e){let{namedDest:t=null,explicitDest:i,pageNumber:n}=e;if(!this._initialized)return;if(t&&"string"!=typeof t){globalThis.ngxConsole.error(`PDFHistory.push: "${t}" is not a valid namedDest parameter.`);return}if(!Array.isArray(i)){globalThis.ngxConsole.error(`PDFHistory.push: "${i}" is not a valid explicitDest parameter.`);return}if(!this._isValidPage(n)&&(null!==n||this._destination)){globalThis.ngxConsole.error(`PDFHistory.push: "${n}" is not a valid pageNumber parameter.`);return}const r=t||JSON.stringify(i);if(!r)return;let s=!1;if(this._destination&&(isDestHashesEqual(this._destination.hash,r)||isDestArraysEqual(this._destination.dest,i))){if(this._destination.page)return;s=!0}if(!this._popStateInProgress||s){this._pushOrReplaceState({dest:i,hash:r,page:n,rotation:this.linkService.rotation},s);if(!this._popStateInProgress){this._popStateInProgress=!0;Promise.resolve().then((()=>{this._popStateInProgress=!1}))}}}pushPage(e){var t;if(this._initialized)if(this._isValidPage(e)){if((null===(t=this._destination)||void 0===t?void 0:t.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 globalThis.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){const t=arguments.length>1&&void 0!==arguments[1]&&arguments[1]||!this._destination,i={fingerprint:this._fingerprint,uid:t?this._uid:this._uid+1,destination:e};this._updateInternalState(e,i.uid);let n;if(this._updateUrl&&null!=e&&e.hash){const t=document.location.href.split("#")[0];t.startsWith("file://")||(n=`${t}#${e.hash}`)}t?window.history.replaceState(i,"",n):window.history.pushState(i,"",n)}_tryPushCurrentPosition(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];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){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[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"!==(null==t?void 0:t.type))return!1}}return!(!Number.isInteger(e.uid)||e.uid<0)&&(null!==e.destination&&"object"==typeof e.destination)}_updateInternalState(e,t){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}i&&null!=e&&e.temporary&&delete e.temporary;this._destination=e;this._uid=t;this._maxUid=Math.max(this._maxUid,t);this._numPositionUpdates=0}_parseCurrentHash(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=unescape(getCurrentHash()).substring(1),i=(0,n.parseQueryString)(t),r=i.get("nameddest")||"";let s=0|i.get("page");(!this._isValidPage(s)||e&&r.length>0)&&(s=null);return{hash:t,page:s,rotation:this.linkService.rotation}}_updateViewarea(e){let{location:t}=e;if(this._updateViewareaTimeout){clearTimeout(this._updateViewareaTimeout);this._updateViewareaTimeout=null}this._position={hash:t.pdfOpenParams.substring(1),page:this.linkService.page,first:t.pageNumber,rotation:t.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(e){let{state:t}=e;const i=getCurrentHash(),s=this._currentHash!==i;this._currentHash=i;if(!t){this._uid++;const{hash:e,page:t,rotation:i}=this._parseCurrentHash();this._pushOrReplaceState({hash:e,page:t,rotation:i},!0);return}if(!this._isValidState(t))return;this._popStateInProgress=!0;if(s){this._blockHashChange++;(0,r.waitOnEventOrTimeout)({target:window,name:"hashchange",delay:1e3}).then((()=>{this._blockHashChange--}))}const a=t.destination;this._updateInternalState(a,t.uid,!0);(0,n.isValidRotation)(a.rotation)&&(this.linkService.rotation=a.rotation);a.dest?this.linkService.goToDestination(a.dest):a.hash?this.linkService.setHash(a.hash):a.page&&(this.linkService.page=a.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)=>{"use strict";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.#Ii(e.promise)}));this.eventBus._on("resetlayers",(()=>{this.#Ii()}));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,t){let{groupId:i,input:n}=t;const setVisibility=()=>{this._optionalContentConfig.setVisibility(i,n.checked);this._optionalContentHash=this._optionalContentConfig.getHash();this.eventBus.dispatch("optionalcontentconfig",{source:this,promise:Promise.resolve(this._optionalContentConfig)})};e.onclick=t=>{if(t.target===n){setVisibility();return!0}if(t.target!==e)return!0;n.checked=!n.checked;setVisibility();return!1}}async _setNestedName(e,t){let{name:i=null}=t;if("string"!=typeof i){e.textContent=await this.l10n.get("additional_layers");e.style.fontStyle="italic"}else e.textContent=this._normalizeTextContent(i)}_addToggleButton(e,t){let{name:i=null}=t;super._addToggleButton(e,null===i)}_toggleAllTreeItems(){this._optionalContentConfig&&super._toggleAllTreeItems()}render(e){let{optionalContentConfig:t,pdfDocument:i}=e;this._optionalContentConfig&&this.reset();this._optionalContentConfig=t||null;this._pdfDocument=i||null;const n=null==t?void 0:t.getOrder();if(!n){this._dispatchEvent(0);return}this._optionalContentHash=t.getHash();const r=document.createDocumentFragment(),s=[{parent:r,groups:n}];let a=0,o=!1;for(;s.length>0;){const e=s.shift();for(const i of e.groups){const n=document.createElement("div");n.className="treeItem";const r=document.createElement("a");n.append(r);if("object"==typeof i){o=!0;this._addToggleButton(n,i);this._setNestedName(r,i);const e=document.createElement("div");e.className="treeItems";n.append(e);s.push({parent:e,groups:i.order})}else{const e=t.getGroup(i),n=document.createElement("input");this._bindLink(r,{groupId:i,input:n});n.type="checkbox";n.checked=e.visible;const s=document.createElement("label");s.textContent=this._normalizeTextContent(e.name);s.append(n);r.append(s);a++}e.parent.append(n)}}this._finishRendering(r,a,o)}async#Ii(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]: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)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PDFOutlineViewer=void 0;var n=i(12),r=i(4),s=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){var t;this._currentOutlineItemCapability=new r.PromiseCapability;0===e||null!==(t=this._pdfDocument)&&void 0!==t&&t.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,t){let{url:i,newWindow:n,action:r,attachment:s,dest:a,setOCGState:o}=t;const{linkService:l}=this;if(i)l.addLinkAttributes(e,i,n);else if(r){e.href=l.getAnchorUrl("");e.onclick=()=>{l.executeNamedAction(r);return!1}}else if(s){e.href=l.getAnchorUrl("");e.onclick=()=>{this.downloadManager.openOrDownloadData(e,s.content,s.filename);return!1}}else if(o){e.href=l.getAnchorUrl("");e.onclick=()=>{l.executeSetOCGState(o);return!1}}else{e.href=l.getDestinationHash(a);e.onclick=e=>{this._updateCurrentTreeItem(e.target.parentNode);a&&l.goToDestination(a);return!1}}}_setStyles(e,t){let{bold:i,italic:n}=t;i&&(e.style.fontWeight="bold");n&&(e.style.fontStyle="italic")}_addToggleButton(e,t){let{count:i,items:n}=t,r=!1;if(i<0){let e=n.length;if(e>0){const t=[...n];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(i)===e&&(r=!0)}super._addToggleButton(e,r)}_toggleAllTreeItems(){this._outline&&super._toggleAllTreeItems()}render(e){let{outline:t,pdfDocument:i}=e;this._outline&&this.reset();this._outline=t||null;this._pdfDocument=i||null;if(!t){this._dispatchEvent(0);return}const n=document.createDocumentFragment(),r=[{parent:n,items:t}];let s=0,a=!1;for(;r.length>0;){const e=r.shift();for(const t of e.items){const i=document.createElement("div");i.className="treeItem";const n=document.createElement("a");this._bindLink(n,t);this._setStyles(n,t);n.textContent=this._normalizeTextContent(t.title);i.append(n);if(t.items.length>0){a=!0;this._addToggleButton(i,t);const e=document.createElement("div");e.className="treeItems";i.append(e);r.push({parent:e,items:t.items})}e.parent.append(i);s++}}this._finishRendering(n,s,a)}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===s.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=new r.PromiseCapability;const t=new Map,i=new Map,n=[{nesting:0,items:this._outline}];for(;n.length>0;){const r=n.shift(),s=r.nesting;for(const{dest:a,items:o}of r.items){let r,l;if("string"==typeof a){r=await e.getDestination(a);if(e!==this._pdfDocument)return null}else r=a;if(Array.isArray(r)){const[n]=r;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)||s>i.get(l))){const e=this.linkService.getDestinationHash(a);t.set(l,e);i.set(l,s)}}o.length>0&&n.push({nesting:s+1,items:o})}}this._pageNumberToDestHashCapability.resolve(t.size>0?t:null);return this._pageNumberToDestHashCapability.promise}}t.PDFOutlineViewer=PDFOutlineViewer},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PDFPresentationMode=void 0;var n=i(3),r=i(4);const s="pdfPresentationMode",a="pdfPresentationModeControls",o=Math.PI/6;t.PDFPresentationMode=class PDFPresentationMode{#ki=n.PresentationModeState.UNKNOWN;#Di=null;constructor(e){let{container:t,pdfViewer:i,eventBus:n}=e;this.container=t;this.pdfViewer=i;this.eventBus=n;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.#Fi();this.#Li(n.PresentationModeState.CHANGING);const i=e.requestFullscreen();this.#Di={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.#Di.spreadMode=t.spreadMode}t.annotationEditorMode!==r.AnnotationEditorType.DISABLE&&(this.#Di.annotationEditorMode=t.annotationEditorMode);try{await i;t.focus();return!0}catch(e){this.#Ri();this.#Li(n.PresentationModeState.NORMAL)}return!1}get active(){return this.#ki===n.PresentationModeState.CHANGING||this.#ki===n.PresentationModeState.FULLSCREEN}#Oi(e){if(!this.active)return;e.preventDefault();const t=(0,n.normalizeWheelEventDelta)(e),i=Date.now(),r=this.mouseScrollTimeStamp;if(!(i>r&&i-r<50)){(this.mouseScrollDelta>0&&t<0||this.mouseScrollDelta<0&&t>0)&&this.#Ni();this.mouseScrollDelta+=t;if(Math.abs(this.mouseScrollDelta)>=.1){const e=this.mouseScrollDelta;this.#Ni();(e>0?this.pdfViewer.previousPage():this.pdfViewer.nextPage())&&(this.mouseScrollTimeStamp=i)}}}#Li(e){this.#ki=e;this.eventBus.dispatch("presentationmodechanged",{source:this,state:e})}#Bi(){this.#Li(n.PresentationModeState.FULLSCREEN);this.container.classList.add(s);setTimeout((()=>{this.pdfViewer.scrollMode=n.ScrollMode.PAGE;null!==this.#Di.spreadMode&&(this.pdfViewer.spreadMode=n.SpreadMode.NONE);this.pdfViewer.currentPageNumber=this.#Di.pageNumber;this.pdfViewer.currentScaleValue="page-fit";null!==this.#Di.annotationEditorMode&&(this.pdfViewer.annotationEditorMode=r.AnnotationEditorType.NONE)}),0);this.#Vi();this.#Ui();this.contextMenuOpen=!1;window.getSelection().removeAllRanges()}#ji(){const e=this.pdfViewer.currentPageNumber;this.container.classList.remove(s);setTimeout((()=>{this.#Ri();this.#Li(n.PresentationModeState.NORMAL);this.pdfViewer.scrollMode=this.#Di.scrollMode;null!==this.#Di.spreadMode&&(this.pdfViewer.spreadMode=this.#Di.spreadMode);this.pdfViewer.currentScaleValue=this.#Di.scaleValue;this.pdfViewer.currentPageNumber=e;null!==this.#Di.annotationEditorMode&&(this.pdfViewer.annotationEditorMode=this.#Di.annotationEditorMode);this.#Di=null}),0);this.#Hi();this.#Wi();this.#Ni();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")}}#zi(e){var t;if(this.contextMenuOpen){this.contextMenuOpen=!1;e.preventDefault()}else if(!(0!==e.button||e.target.href&&null!==(t=e.target.parentNode)&&void 0!==t&&t.hasAttribute("data-internal-link"))){e.preventDefault();e.shiftKey?this.pdfViewer.previousPage():this.pdfViewer.nextPage()}}#Gi(){this.contextMenuOpen=!0}#Ui(){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}}#Ni(){this.mouseScrollTimeStamp=0;this.mouseScrollDelta=0}#qi(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,r=Math.abs(Math.atan2(n,i));Math.abs(i)>50&&(r<=o||r>=Math.PI-o)?t=i:Math.abs(n)>50&&Math.abs(r-Math.PI/2)<=o&&(t=n);t>0?this.pdfViewer.previousPage():t<0&&this.pdfViewer.nextPage()}}#Vi(){this.showControlsBind=this.#Ui.bind(this);this.mouseDownBind=this.#zi.bind(this);this.mouseWheelBind=this.#Oi.bind(this);this.resetMouseScrollStateBind=this.#Ni.bind(this);this.contextMenuBind=this.#Gi.bind(this);this.touchSwipeBind=this.#qi.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)}#Hi(){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}#$i(){document.fullscreenElement?this.#Bi():this.#ji()}#Fi(){this.fullscreenChangeBind=this.#$i.bind(this);window.addEventListener("fullscreenchange",this.fullscreenChangeBind)}#Ri(){window.removeEventListener("fullscreenchange",this.fullscreenChangeBind);delete this.fullscreenChangeBind}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PDFRenderingQueue=void 0;var n=i(4),r=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){var t;if(this.idleTimeout){clearTimeout(this.idleTimeout);this.idleTimeout=null}this.pdfViewer.forceRendering(e)||this.isThumbnailViewEnabled&&null!==(t=this.pdfThumbnailViewer)&&void 0!==t&&t.forceRendering()||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),3e4))}getHighestPriority(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=e.views,s=r.length;if(0===s)return null;for(let e=0;e<s;e++){const t=r[e].view;if(!this.isViewFinished(t))return t}const a=e.first.id,o=e.last.id;if(o-a+1>s){const n=e.ids;for(let e=1,r=o-a;e<r;e++){const r=i?a+e:o-e;if(n.has(r))continue;const s=t[r-1];if(!this.isViewFinished(s))return s}}let l=i?o:a-2,c=t[l];if(c&&!this.isViewFinished(c))return c;if(n){l+=i?1:-1;c=t[l];if(c&&!this.isViewFinished(c))return c}return null}isViewFinished(e){return e.renderingState===r.RenderingStates.FINISHED}renderView(e){switch(e.renderingState){case r.RenderingStates.FINISHED:return!1;case r.RenderingStates.PAUSED:this.highestPriorityPage=e.renderingId;e.resume();break;case r.RenderingStates.RUNNING:this.highestPriorityPage=e.renderingId;break;case r.RenderingStates.INITIAL:this.highestPriorityPage=e.renderingId;e.draw().finally((()=>{this.renderHighestPriority()})).catch((e=>{e instanceof n.RenderingCancelledException||globalThis.ngxConsole.error(`renderView: "${e}"`)}))}return!0}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PDFScriptingManager=void 0;var n=i(3),r=i(4);t.PDFScriptingManager=class PDFScriptingManager{constructor(e){let{eventBus:t,sandboxBundleSrc:i=null,scriptingFactory:n=null,docPropertiesLookup:r=null}=e;this._pdfDocument=null;this._pdfViewer=null;this._closeCapability=null;this._destroyCapability=null;this._scripting=null;this._ready=!1;this._eventBus=t;this._sandboxBundleSrc=i;this._scriptingFactory=n;this._docPropertiesLookup=r}setViewer(e){this._pdfViewer=e}async setDocument(e){var t;this._pdfDocument&&await this._destroyScripting();this._pdfDocument=e;if(!e)return;const[i,n,r]=await Promise.all([e.getFieldObjects(),e.getCalculationOrderIds(),e.getJSActions()]);if(i||r){if(e===this._pdfDocument){try{this._scripting=this._createScripting()}catch(e){globalThis.ngxConsole.error(`PDFScriptingManager.setDocument: "${null==e?void 0:e.message}".`);await this._destroyScripting();return}this._internalEvents.set("updatefromsandbox",(e=>{(null==e?void 0:e.source)===window&&this._updateFromSandbox(e.detail)}));this._internalEvents.set("dispatcheventinsandbox",(e=>{var t;null===(t=this._scripting)||void 0===t||t.dispatchEventInSandbox(e.detail)}));this._internalEvents.set("pagechanging",(e=>{let{pageNumber:t,previous:i}=e;if(t!==i){this._dispatchPageClose(i);this._dispatchPageOpen(t)}}));this._internalEvents.set("pagerendered",(e=>{let{pageNumber:t}=e;this._pageOpenPending.has(t)&&t===this._pdfViewer.currentPageNumber&&this._dispatchPageOpen(t)}));this._internalEvents.set("pagesdestroy",(async e=>{var t,i;await this._dispatchPageClose(this._pdfViewer.currentPageNumber);await(null===(t=this._scripting)||void 0===t?void 0:t.dispatchEventInSandbox({id:"doc",name:"WillClose"}));null===(i=this._closeCapability)||void 0===i||i.resolve()}));for(const[e,t]of this._internalEvents)this._eventBus._on(e,t);try{const t=await this._getDocProperties();if(e!==this._pdfDocument)return;await this._scripting.createSandbox({objects:i,calculationOrder:n,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...t,actions:r}});this._eventBus.dispatch("sandboxcreated",{source:this})}catch(e){globalThis.ngxConsole.error(`PDFScriptingManager.setDocument: "${null==e?void 0:e.message}".`);await this._destroyScripting();return}await(null===(t=this._scripting)||void 0===t?void 0:t.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){var t;return null===(t=this._scripting)||void 0===t?void 0:t.dispatchEventInSandbox({id:"doc",name:"WillSave"})}async dispatchDidSave(e){var t;return null===(t=this._scripting)||void 0===t?void 0:t.dispatchEventInSandbox({id:"doc",name:"DidSave"})}async dispatchWillPrint(e){var t;return null===(t=this._scripting)||void 0===t?void 0:t.dispatchEventInSandbox({id:"doc",name:"WillPrint"})}async dispatchDidPrint(e){var t;return null===(t=this._scripting)||void 0===t?void 0:t.dispatchEventInSandbox({id:"doc",name:"DidPrint"})}get destroyPromise(){var e;return(null===(e=this._destroyCapability)||void 0===e?void 0:e.promise)||null}get ready(){return this._ready}get _internalEvents(){return(0,r.shadow)(this,"_internalEvents",new Map)}get _pageOpenPending(){return(0,r.shadow)(this,"_pageOpenPending",new Set)}get _visitedPages(){return(0,r.shadow)(this,"_visitedPages",new Map)}async _updateFromSandbox(e){const t=this._pdfViewer.isInPresentationMode||this._pdfViewer.isChangingPresentationMode,{id:i,siblings:r,command:s,value:a}=e;if(!i){switch(s){case"clear":globalThis.ngxConsole.clear();break;case"error":globalThis.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":globalThis.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=r?[i,...r]:[i];for(const t of o){const i=document.querySelector(`[data-element-id="${t}"]`);if(i)i.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:e}));else{var l;null===(l=this._pdfDocument)||void 0===l||l.annotationStorage.setValue(t,e)}}}async _dispatchPageOpen(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=this._pdfDocument,s=this._visitedPages;t&&(this._closeCapability=new r.PromiseCapability);if(!this._closeCapability)return;const a=this._pdfViewer.getPageView(e-1);if((null==a?void 0:a.renderingState)!==n.RenderingStates.FINISHED){this._pageOpenPending.add(e);return}this._pageOpenPending.delete(e);const o=(async()=>{var t,n;const r=await(s.has(e)?null:null===(t=a.pdfPage)||void 0===t?void 0:t.getJSActions());i===this._pdfDocument&&await(null===(n=this._scripting)||void 0===n?void 0:n.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:e,actions:r}))})();s.set(e,o)}async _dispatchPageClose(e){var t;const i=this._pdfDocument,n=this._visitedPages;if(!this._closeCapability)return;if(this._pageOpenPending.has(e))return;const r=n.get(e);if(r){n.set(e,null);await r;i===this._pdfDocument&&await(null===(t=this._scripting)||void 0===t?void 0:t.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=new r.PromiseCapability;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(){var e;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;null===(e=this._destroyCapability)||void 0===e||e.resolve()}else{var t;this._pdfDocument=null;null===(t=this._destroyCapability)||void 0===t||t.resolve()}}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PDFSidebar=void 0;var n=i(3);const r="sidebarResizing",s="pdfSidebarNotification";t.PDFSidebar=class PDFSidebar{#Xi=!1;#Ki=this.#Yi.bind(this);#Qi=this.#Zi.bind(this);#Ji=null;#en=null;constructor(e){let{elements:t,eventBus:i,l10n:r}=e;this.isOpen=!1;this.active=n.SidebarView.THUMBS;this.isInitialViewSet=!1;this.isInitialEventDispatched=!1;this.onToggled=null;this.onUpdateThumbnails=null;this.outerContainer=t.outerContainer;this.sidebarContainer=t.sidebarContainer;this.toggleButton=t.toggleButton;this.resizer=t.resizer;this.thumbnailButton=t.thumbnailButton;this.outlineButton=t.outlineButton;this.attachmentsButton=t.attachmentsButton;this.layersButton=t.layersButton;this.thumbnailView=t.thumbnailView;this.outlineView=t.outlineView;this.attachmentsView=t.attachmentsView;this.layersView=t.layersView;this._outlineOptionsContainer=t.outlineOptionsContainer;this._currentOutlineItemButton=t.currentOutlineItemButton;this.eventBus=i;this.l10n=r;r.getDirection().then((e=>{this.#Xi="rtl"===e}));this.#vi()}reset(){this.isInitialViewSet=!1;this.isInitialEventDispatched=!1;this.#tn(!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(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]: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.#bi()}else this.#bi()}}switchView(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=e!==this.active;let r=!1;switch(e){case n.SidebarView.NONE:this.isOpen&&this.close();return;case n.SidebarView.THUMBS:this.isOpen&&i&&(r=!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:globalThis.ngxConsole.error(`PDFSidebar.switchView: "${e}" is not a valid view.`);return}this.active=e;(0,n.toggleCheckedBtn)(this.thumbnailButton,e===n.SidebarView.THUMBS,this.thumbnailView);(0,n.toggleCheckedBtn)(this.outlineButton,e===n.SidebarView.OUTLINE,this.outlineView);(0,n.toggleCheckedBtn)(this.attachmentsButton,e===n.SidebarView.ATTACHMENTS,this.attachmentsView);(0,n.toggleCheckedBtn)(this.layersButton,e===n.SidebarView.LAYERS,this.layersView);this._outlineOptionsContainer.classList.toggle("hidden",e!==n.SidebarView.OUTLINE);if(!t||this.isOpen){if(r){this.onUpdateThumbnails();this.onToggled()}i&&this.#bi()}else this.open()}open(){if(!this.isOpen){this.isOpen=!0;(0,n.toggleExpandedBtn)(this.toggleButton,!0);this.outerContainer.classList.add("sidebarMoving","sidebarOpen");this.active===n.SidebarView.THUMBS&&this.onUpdateThumbnails();this.onToggled();this.#bi();this.#tn()}}close(){if(this.isOpen){this.isOpen=!1;(0,n.toggleExpandedBtn)(this.toggleButton,!1);this.outerContainer.classList.add("sidebarMoving");this.outerContainer.classList.remove("sidebarOpen");this.onToggled();this.#bi()}}toggle(){this.isOpen?this.close():this.open()}#bi(){this.isInitialViewSet&&(this.isInitialEventDispatched||=!0);this.eventBus.dispatch("sidebarviewchanged",{source:this,view:this.visibleView})}#in(){this.toggleButton.setAttribute("data-l10n-id","toggle_sidebar_notification2");this.l10n.translate(this.toggleButton);this.isOpen||this.toggleButton.classList.add(s)}#tn(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(this.isOpen||e)&&this.toggleButton.classList.remove(s);if(e){this.toggleButton.setAttribute("data-l10n-id","toggle_sidebar");this.l10n.translate(this.toggleButton)}}#vi(){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.#in():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.onUpdateThumbnails()}));this.resizer.addEventListener("mousedown",(e=>{if(0===e.button){this.outerContainer.classList.add(r);window.addEventListener("mousemove",this.#Ki);window.addEventListener("mouseup",this.#Qi)}}));this.eventBus._on("resize",(e=>{if(e.source!==window)return;this.#Ji=null;if(!this.#en)return;if(!this.isOpen){this.#nn(this.#en);return}this.outerContainer.classList.add(r);const t=this.#nn(this.#en);Promise.resolve().then((()=>{this.outerContainer.classList.remove(r);t&&this.eventBus.dispatch("resize",{source:this})}))}))}get outerContainerWidth(){return this.#Ji||=this.outerContainer.clientWidth}#nn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const t=Math.floor(this.outerContainerWidth/2);e>t&&(e=t);e<200&&(e=200);if(e===this.#en)return!1;this.#en=e;n.docStyle.setProperty("--sidebar-width",`${e}px`);return!0}#Yi(e){let t=e.clientX;this.#Xi&&(t=this.outerContainerWidth-t);this.#nn(t)}#Zi(e){this.outerContainer.classList.remove(r);this.eventBus.dispatch("resize",{source:this});window.removeEventListener("mousemove",this.#Ki);window.removeEventListener("mouseup",this.#Qi)}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PDFThumbnailViewer=void 0;var n=i(3),r=i(29);const s="selected";t.PDFThumbnailViewer=class PDFThumbnailViewer{constructor(e){let{container:t,eventBus:i,linkService:r,renderingQueue:s,l10n:a,pageColors:o}=e;this.container=t;this.eventBus=i;this.linkService=r;this.renderingQueue=s;this.l10n=a;this.pageColors=o||null;if(this.pageColors&&(!CSS.supports("color",this.pageColors.background)||!CSS.supports("color",this.pageColors.foreground))){(this.pageColors.background||this.pageColors.foreground)&&globalThis.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){globalThis.ngxConsole.error('scrollThumbnailIntoView: Invalid "pageNumber" parameter.');return}if(e!==this._currentPageNumber){this._thumbnails[this._currentPageNumber-1].div.classList.remove(s);t.div.classList.add(s)}const{first:i,last:r,views:a}=this._getVisibleThumbs();if(a.length>0){let s=!1;if(e<=i.id||e>=r.id)s=!0;else for(const{id:t,percent:i}of a)if(t===e){s=i<100;break}s&&(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();r.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=>{var n;const a=e.numPages,o=t.getViewport({scale:1});for(let e=1;e<=a;++e){const t=new r.PDFThumbnailView({container:this.container,eventBus:this.eventBus,id:e,defaultViewport:o.clone(),optionalContentConfigPromise:i,linkService:this.linkService,renderingQueue:this.renderingQueue,l10n:this.l10n,pageColors:this.pageColors,eventBus:this.eventBus});this._thumbnails.push(t)}null===(n=this._thumbnails[0])||void 0===n||n.setPdfPage(t);this._thumbnails[this._currentPageNumber-1].div.classList.add(s)})).catch((e=>{globalThis.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;globalThis.ngxConsole.error("PDFThumbnailViewer_setPageLabels: Invalid page labels.")}else this._pageLabels=null;for(let e=0,i=this._thumbnails.length;e<i;e++){var t;this._thumbnails[e].setPageLabel((null===(t=this._pageLabels)||void 0===t?void 0:t[e])??null)}}}async#rn(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){globalThis.ngxConsole.error("Unable to get page for thumb view",e);return null}}#sn(e){var t,i;return 1===(null===(t=e.first)||void 0===t?void 0:t.id)||(null===(i=e.last)||void 0===i?void 0:i.id)!==this._thumbnails.length&&this.scroll.down}forceRendering(){const e=this._getVisibleThumbs(),t=this.#sn(e),i=this.renderingQueue.getHighestPriority(e,this._thumbnails,t);if(i){this.#rn(i).then((()=>{this.renderingQueue.renderView(i)}));return!0}return!1}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.TempImageFactory=t.PDFThumbnailView=void 0;var n=i(3),r=i(4);class TempImageFactory{static#an=null;static getCanvas(e,t){const i=this.#an||=document.createElement("canvas");i.width=e;i.height=t;const n=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0,alpha:!1}:{alpha:!1},r=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0}:void 0,s=i.getContext("2d",n);s.save();s.fillStyle="rgb(255, 255, 255)";s.fillRect(0,0,e,t);s.restore();return[i,i.getContext("2d",r)]}static destroyCanvas(){const e=this.#an;if(e){e.width=0;e.height=0}this.#an=null}}t.TempImageFactory=TempImageFactory;t.PDFThumbnailView=class PDFThumbnailView{constructor(e){let{container:t,eventBus:i,id:r,defaultViewport:s,optionalContentConfigPromise:a,linkService:o,renderingQueue:l,l10n:c,pageColors:d}=e;this.id=r;this.renderingId="thumbnail"+r;this.pageLabel=null;this.pdfPage=null;this.rotation=0;this.viewport=s;this.pdfPageRotate=s.rotation;this._optionalContentConfigPromise=a||null;this.pageColors=d||null;this.eventBus=i;this.linkService=o;this.renderingQueue=l;this.eventBus=i;this.renderTask=null;this.renderingState=n.RenderingStates.INITIAL;this.resume=null;this.l10n=c;window.pdfThumbnailGenerator?this._placeholderImg=window.pdfThumbnailGenerator(this,o,r,t,this._thumbPageTitle):this.createThumbnail(this,o,r,t,this._thumbPageTitle)}createThumbnail(e,t,i,n,r){const s=document.createElement("a");s.href=t.getAnchorUrl("#page="+i);this._thumbPageTitle.then((e=>{s.title=e}));s.onclick=function(){t.goToPage(i);return!1};this.anchor=s;const a=document.createElement("div");a.className="thumbnail";a.setAttribute("data-page-number",this.id);this.div=a;this.#on();const o=document.createElement("div");o.className="thumbnailImage";this._placeholderImg=o;a.append(o);s.append(a);n.append(s)}#on(){const{width:e,height:t}=this.viewport,i=e/t;this.canvasWidth=98;this.canvasHeight=this.canvasWidth/i|0;this.scale=this.canvasWidth/e;const{style:n}=this.div;n.setProperty("--thumbnail-width",`${this.canvasWidth}px`);n.setProperty("--thumbnail-height",`${this.canvasHeight}px`)}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(){var e;this.cancelRendering();this.renderingState=n.RenderingStates.INITIAL;this.div.removeAttribute("data-loaded");null===(e=this.image)||void 0===e||e.replaceWith(this._placeholderImg);this.#on();if(this.image){this.image.removeAttribute("src");delete this.image}}update(e){let{rotation:t=null}=e;"number"==typeof t&&(this.rotation=t);const i=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:1,rotation:i});this.reset()}cancelRendering(){if(this.renderTask){this.renderTask.cancel();this.renderTask=null}this.resume=null}_getPageDrawContext(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;const t=document.createElement("canvas"),i=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0,alpha:!1}:{alpha:!1},r=t.getContext("2d",i),s=new n.OutputScale;t.width=e*this.canvasWidth*s.sx|0;t.height=e*this.canvasHeight*s.sy|0;return{ctx:r,canvas:t,transform:s.scaled?[s.sx,0,0,s.sy,0,0]:null}}_convertCanvasToImage(e){if(this.renderingState!==n.RenderingStates.FINISHED)throw new Error("_convertCanvasToImage: Rendering has not finished.");const t=this._reduceImage(e),i=document.createElement("img");i.className="thumbnailImage";this._thumbPageCanvas.then((e=>{i.setAttribute("aria-label",e)}));i.src=t.toDataURL();this.image=i;this.div.setAttribute("data-loaded",!0);this._placeholderImg.replaceWith(i);t.width=0;t.height=0}async#ln(e,t){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;e===this.renderTask&&(this.renderTask=null);if(!(i instanceof r.RenderingCancelledException)){this.renderingState=n.RenderingStates.FINISHED;this._convertCanvasToImage(t);if(i)throw i;this.eventBus.dispatch("thumbnailRendered",this.id)}}async draw(){if(this.renderingState!==n.RenderingStates.INITIAL){globalThis.ngxConsole.error("Must be in new state before drawing");return}const{pdfPage:e}=this;if(!e){this.renderingState=n.RenderingStates.FINISHED;throw new Error("pdfPage is not loaded")}this.renderingState=n.RenderingStates.RUNNING;const{ctx:t,canvas:i,transform:r}=this._getPageDrawContext(2),s={canvasContext:t,transform:r,viewport:this.viewport.clone({scale:2*this.scale}),optionalContentConfigPromise:this._optionalContentConfigPromise,pageColors:this.pageColors},a=this.renderTask=e.render(s);a.onContinue=e=>{if(this.renderingQueue.isHighestPriority(this))e();else{this.renderingState=n.RenderingStates.PAUSED;this.resume=()=>{this.renderingState=n.RenderingStates.RUNNING;e()}}};const o=a.promise.then((()=>this.#ln(a,i)),(e=>this.#ln(a,i,e)));o.finally((()=>{i.width=0;i.height=0;this.eventBus.dispatch("thumbnailrendered",{source:this,pageNumber:this.id,pdfPage:this.pdfPage})}));return o}setImage(e){if(this.renderingState!==n.RenderingStates.INITIAL)return;const{thumbnailCanvas:t,pdfPage:i,scale:r}=e;if(t){this.pdfPage||this.setPdfPage(i);if(!(r<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,r=i.height<<3;const[s,a]=TempImageFactory.getCanvas(n,r);for(;n>e.width||r>e.height;){n>>=1;r>>=1}a.drawImage(e,0,0,e.width,e.height,0,0,n,r);for(;n>2*i.width;){a.drawImage(s,0,0,n,r,0,0,n>>1,r>>1);n>>=1;r>>=1}t.drawImage(s,0,0,n,r,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=>{var t;null===(t=this.image)||void 0===t||t.setAttribute("aria-label",e)}))}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PagesCountLimit=t.PDFViewer=t.PDFPageViewBuffer=void 0;var n=i(4),r=i(3),s=i(31),a=i(32),o=i(33),l=i(25),c=i(7);const d={FORCE_SCROLL_MODE_PAGE:15e3,FORCE_LAZY_PAGE_INIT:7500,PAUSE_EAGER_PAGE_INIT:250};t.PagesCountLimit=d;function isValidAnnotationEditorMode(e){return Object.values(n.AnnotationEditorType).includes(e)&&e!==n.AnnotationEditorType.DISABLE}class PDFPageViewBuffer{#cn=new Set;#dn=0;constructor(e){this.#dn=e}push(e){const t=this.#cn;t.has(e)&&t.delete(e);t.add(e);t.size>this.#dn&&this.#hn()}resize(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.#dn=e;const i=this.#cn;if(t){const e=i.size;let n=1;for(const r of i){if(t.has(r.id)){i.delete(r);i.add(r)}if(++n>e)break}}for(;i.size>this.#dn;)this.#hn()}has(e){return this.#cn.has(e)}[Symbol.iterator](){return this.#cn.keys()}#hn(){const e=this.#cn.keys().next().value;null==e||e.destroy();this.#cn.delete(e)}}t.PDFPageViewBuffer=PDFPageViewBuffer;t.PDFViewer=class PDFViewer{#un=null;#pn=n.AnnotationEditorType.NONE;#gn=null;#fn=n.AnnotationMode.ENABLE_FORMS;#mn=null;#vn=null;#bn=!1;#yn=!1;#wn=null;#_n=!1;#Sn=0;#Pn=new ResizeObserver(this.#An.bind(this));#En=null;#xn=null;#Cn=null;#Tn=r.TextLayerMode.ENABLE;constructor(e){var t,i;const a="3.7.506";if(n.version!==a)throw new Error(`The API version "${n.version}" does not match the Viewer version "${a}".`);this.container=e.container;this.viewer=e.viewer||e.container.firstElementChild;this.pageViewMode=e.pageViewMode||"multiple";if("DIV"!==(null===(t=this.container)||void 0===t?void 0:t.tagName)||"DIV"!==(null===(i=this.viewer)||void 0===i?void 0:i.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.#Pn.observe(this.container);this.eventBus=e.eventBus;this.linkService=e.linkService||new c.SimpleLinkService;this.downloadManager=e.downloadManager||null;this.findController=e.findController||null;this.findController&&(this.findController.onIsPageVisible=e=>this._getVisiblePages().ids.has(e));this._scriptingManager=e.scriptingManager||null;this.#Tn=e.textLayerMode??r.TextLayerMode.ENABLE;this.#fn=e.annotationMode??n.AnnotationMode.ENABLE_FORMS;this.#pn=e.annotationEditorMode??n.AnnotationEditorType.NONE;this.imageResourcesPath=e.imageResourcesPath||"";this.enablePrintAutoRotate=e.enablePrintAutoRotate||!1;this.removePageBorders=e.removePageBorders||!1;this.useOnlyCssZoom=e.useOnlyCssZoom||!1;this.isOffscreenCanvasSupported=e.isOffscreenCanvasSupported??!0;this.maxCanvasPixels=e.maxCanvasPixels;this.l10n=e.l10n||s.NullL10n;this.#bn=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,r.watchScroll)(this.container,this._scrollUpdate.bind(this));this.presentationModeState=r.PresentationModeState.UNKNOWN;this._onBeforeDraw=this._onAfterDraw=null;this._resetView();this.removePageBorders&&this.viewer.classList.add("removePageBorders");this.#Mn();this.eventBus._on("thumbnailrendered",(e=>{let{pageNumber:t,pdfPage:i}=e;const n=this._pages[t-1];this.#un.has(n)||null==i||i.cleanup()}))}get pagesCount(){return this._pages.length}getPageView(e){return this._pages[e]}getCachedPageViews(){return new Set(this.#un)}get pageViewsReady(){return this._pagesCapability.settled&&this._pages.every((e=>null==e?void 0:e.pdfPage))}get renderForms(){return this.#fn===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)||globalThis.ngxConsole.error(`currentPageNumber: "${e}" is not a valid page.`);this.pageFlip&&(t?this.pageFlip.flip(e-1):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){var t;let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this._currentPageNumber===e){i&&this.#In();return!0}if(!(0<e&&e<=this.pagesCount))return!1;const n=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.#rn(i).then((()=>{this.renderingQueue.renderView(i)}));e.style.display="inline-block"}));else{this.#rn(e).then((()=>{this.renderingQueue.renderView(e)}));"book"===this.pageViewMode&&this.ensureAdjecentPagesAreLoaded()}}this.eventBus.dispatch("pagechanging",{source:this,pageNumber:e,pageLabel:(null===(t=this._pageLabels)||void 0===t?void 0:t[e-1])??null,previous:n});i&&this.#In();return!0}addPageToRenderQueue(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(e>=0&&e<=this._pages.length-1){const t=this._pages[e];if(t.renderingState===r.RenderingStates.INITIAL){this.#rn(t).then((()=>{this.renderingQueue.renderView(t)}));return!0}}return!1}async ensureAdjecentPagesAreLoaded(){const e=[0,1,-1,2,-2];for(const t of e){const e=this.currentPageNumber+t;if(e>=0&&e<this._pages.length){const t=this._pages[e];await this.#rn(t)}}const loader=()=>this.adjacentPagesLoader(loader);this.eventBus._on("pagerendered",loader);this.eventBus._on("thumbnailRendered",loader)}adjacentPagesLoader(e){const t=[0,1,-1,2,-2];if(this._pages.some((e=>e.renderingState===r.RenderingStates.RUNNING)))return;const i=this._pages.find((e=>e.renderingState===r.RenderingStates.PAUSED));if(i)this.renderingQueue.renderView(i);else{for(const e of t){const t=this.currentPageNumber+e;if(t>=0&&t<this._pages.length){const e=this._pages[t];if(e.renderingState===r.RenderingStates.INITIAL){this.renderingQueue.renderView(e);return}}}this.eventBus._off("pagerendered",e);this.eventBus._off("thumbnailRendered",e)}}get currentPageLabel(){var e;return(null===(e=this._pageLabels)||void 0===e?void 0:e[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)||globalThis.ngxConsole.error(`currentPageLabel: "${e}" is not a valid page.`)}get currentScale(){return this._currentScale!==r.UNKNOWN_SCALE?this._currentScale:r.DEFAULT_SCALE}set currentScale(e){if(isNaN(e))throw new Error("Invalid numeric scale.");this.pdfDocument&&this.#kn(e,{noScroll:!1})}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(e){this.pdfDocument&&this.#kn(e,{noScroll:!1})}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!(0,r.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.#kn(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}#Dn(){const e=this;return{get annotationEditorUIManager(){return e.#gn},get annotationStorage(){var t;return null===(t=e.pdfDocument)||void 0===t?void 0:t.annotationStorage},get downloadManager(){return e.downloadManager},get enableScripting(){return!!e._scriptingManager},get fieldObjectsPromise(){var t;return null===(t=e.pdfDocument)||void 0===t?void 0:t.getFieldObjects()},get findController(){return e.findController},get hasJSActionsPromise(){var t;return null===(t=e.pdfDocument)||void 0===t?void 0:t.hasJSActions()},get linkService(){return e.linkService}}}#Fn(e){const t={annotationEditorMode:this.#pn,annotationMode:this.#fn,textLayerMode:this.#Tn};if(!e)return t;e.includes(n.PermissionFlag.COPY)||this.#Tn!==r.TextLayerMode.ENABLE||(t.textLayerMode=r.TextLayerMode.ENABLE_PERMISSIONS);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.#fn!==n.AnnotationMode.ENABLE_FORMS||(t.annotationMode=n.AnnotationMode.ENABLE);return t}#Ln(){if("hidden"===document.visibilityState||!this.container.offsetParent||0===this._getVisiblePages().views.length)return Promise.resolve();const e=new Promise((e=>{this.#xn=()=>{if("hidden"===document.visibilityState){e();document.removeEventListener("visibilitychange",this.#xn);this.#xn=null}};document.addEventListener("visibilitychange",this.#xn)}));return Promise.race([this._onePageRenderedCapability.promise,e])}async getAllText(){const e=[],t=[];for(let i=1,n=this.pdfDocument.numPages;i<=n;++i){if(this.#_n)return null;t.length=0;const n=await this.pdfDocument.getPage(i),{items:s}=await n.getTextContent();for(const e of s){e.str&&t.push(e.str);e.hasEOL&&t.push("\n")}e.push((0,r.removeNullCharacters)(t.join("")))}return e.join("\n")}#Rn(e,t){const i=document.getSelection(),{focusNode:n,anchorNode:s}=i;if(s&&n&&i.containsNode(this.#wn)){if(this.#yn||e===r.TextLayerMode.ENABLE_PERMISSIONS){t.preventDefault();t.stopPropagation();return}this.#yn=!0;const i=this.container.style.cursor;this.container.style.cursor="wait";const interruptCopy=e=>this.#_n="Escape"===e.key;window.addEventListener("keydown",interruptCopy);this.getAllText().then((async e=>{null!==e&&await navigator.clipboard.writeText(e)})).catch((e=>{console.warn(`Something goes wrong when extracting the text: ${e.message}`)})).finally((()=>{this.#yn=!1;this.#_n=!1;window.removeEventListener("keydown",interruptCopy);this.container.style.cursor=i}));t.preventDefault();t.stopPropagation()}}setDocument(e){if(this.pdfDocument){var t,i;this.eventBus.dispatch("pagesdestroy",{source:this});this._cancelRendering();this._resetView();null===(t=this.findController)||void 0===t||t.setDocument(null);null===(i=this._scriptingManager)||void 0===i||i.setDocument(null);if(this.#gn){this.#gn.destroy();this.#gn=null}}this.pdfDocument=e;if(!e)return;const s=e.numPages,a=e.getPage(1),l=e.getOptionalContentConfig(),c=this.#bn?e.getPermissions():Promise.resolve();if(s>d.FORCE_SCROLL_MODE_PAGE){console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");const e=this._scrollMode=r.ScrollMode.PAGE;this.eventBus.dispatch("scrollmodechanged",{source:this,mode:e})}this._pagesCapability.promise.then((()=>{this.eventBus.dispatch("pagesloaded",{source:this,pagesCount:s})}),(()=>{}));this._onBeforeDraw=e=>{const t=this._pages[e.pageNumber-1];t&&this.#un.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.#xn){document.removeEventListener("visibilitychange",this.#xn);this.#xn=null}}};this.eventBus._on("pagerendered",this._onAfterDraw);Promise.all([a,c]).then((t=>{let[i,a]=t;if(e!==this.pdfDocument)return;this._firstPageCapability.resolve(i);this._optionalContentConfigPromise=l;const{annotationEditorMode:c,annotationMode:h,textLayerMode:u}=this.#Fn(a);if(u!==r.TextLayerMode.DISABLE){const e=this.#wn=document.createElement("div");e.id="hiddenCopyElement";this.viewer.before(e)}if(c!==n.AnnotationEditorType.DISABLE){const t=c;if(e.isPureXfa)console.warn("Warning: XFA-editing is not implemented.");else if(isValidAnnotationEditorMode(t)){this.#gn=new n.AnnotationEditorUIManager(this.container,this.eventBus,null==e?void 0:e.annotationStorage);t!==n.AnnotationEditorType.NONE&&this.#gn.updateMode(t)}else console.error(`Invalid AnnotationEditor mode: ${t}`)}const p=this.#Dn.bind(this),g=this._scrollMode===r.ScrollMode.PAGE?null:this.viewer,f=this.currentScale,m=i.getViewport({scale:f*n.PixelsPerInch.PDF_TO_CSS_UNITS});this.viewer.style.setProperty("--scale-factor",m.scale);for(let e=1;e<=s;++e){const t=new o.PDFPageView({container:g,eventBus:this.eventBus,id:e,scale:f,defaultViewport:m.clone(),optionalContentConfigPromise:l,renderingQueue:this.renderingQueue,textLayerMode:u,annotationMode:h,imageResourcesPath:this.imageResourcesPath,removePageBorders:this.removePageBorders,useOnlyCssZoom:this.useOnlyCssZoom,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported,maxCanvasPixels:this.maxCanvasPixels,pageColors:this.pageColors,l10n:this.l10n,layerProperties:p});this._pages.push(t)}const v=this._pages[0];if(v){v.setPdfPage(i);this.linkService.cachePageRef(1,i.ref)}this._scrollMode===r.ScrollMode.PAGE?this.#On():this._spreadMode!==r.SpreadMode.NONE&&this._updateSpreadMode();this.#Ln().then((async()=>{var t,i;null===(t=this.findController)||void 0===t||t.setDocument(e);null===(i=this._scriptingManager)||void 0===i||i.setDocument(e);if(this.#wn){this.#vn=this.#Rn.bind(this,u);document.addEventListener("copy",this.#vn)}this.#gn&&this.eventBus.dispatch("annotationeditormodechanged",{source:this,mode:this.#pn});if(e.loadingParams.disableAutoFetch||s>d.FORCE_LAZY_PAGE_INIT){this._pagesCapability.resolve();return}let n=s-1;if(n<=0)this._pagesCapability.resolve();else for(let t=2;t<=s;++t){const i=e.getPage(t).then((e=>{const i=this._pages[t-1];i.pdfPage||i.setPdfPage(e);this.linkService.cachePageRef(t,e.ref);0==--n&&this._pagesCapability.resolve()}),(e=>{console.error(`Unable to get page ${t} to initialize viewer`,e);0==--n&&this._pagesCapability.resolve()}));t%d.PAUSE_EAGER_PAGE_INIT==0&&await i}}));this.hidePagesDependingOnpageViewMode();this.eventBus.dispatch("pagesinit",{source:this});e.getMetadata().then((t=>{let{info:i}=t;e===this.pdfDocument&&i.Language&&(this.viewer.lang=i.Language)}));this.defaultRenderingQueue&&this.update()})).catch((e=>{globalThis.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;globalThis.ngxConsole.error("setPageLabels: Invalid page labels.")}else this._pageLabels=null;for(let e=0,i=this._pages.length;e<i;e++){var t;this._pages[e].setPageLabel((null===(t=this._pageLabels)||void 0===t?void 0:t[e])??null)}}}_resetView(){this._pages=[];this._currentPageNumber=1;this._currentScale=r.UNKNOWN_SCALE;this._currentScaleValue=null;this._pageLabels=null;const e=Number(PDFViewerApplicationOptions.get("defaultCacheSize"))||10;this.#un=new PDFPageViewBuffer(e);this._location=null;this._pagesRotation=0;this._optionalContentConfigPromise=null;this._firstPageCapability=new n.PromiseCapability;this._onePageRenderedCapability=new n.PromiseCapability;this._pagesCapability=new n.PromiseCapability;this._scrollMode=r.ScrollMode.VERTICAL;this._previousScrollMode=r.ScrollMode.UNKNOWN;this._spreadMode=r.SpreadMode.NONE;this.#En={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.#xn){document.removeEventListener("visibilitychange",this.#xn);this.#xn=null}this.viewer.textContent="";this._updateScrollMode();this.viewer.removeAttribute("lang");if(this.#wn){document.removeEventListener("copy",this.#vn);this.#vn=null;this.#wn.remove();this.#wn=null}}#On(){if(this._scrollMode!==r.ScrollMode.PAGE)throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");const e=this._currentPageNumber,t=this.#En,i=this.viewer;i.textContent="";t.pages.length=0;if(this._spreadMode!==r.SpreadMode.NONE||this.isInPresentationMode){const n=new Set,r=this._spreadMode-1;if(-1===r)n.add(e-1);else if(e%2!==r){n.add(e-1);n.add(e)}else{n.add(e-2);n.add(e-1)}const s=document.createElement("div");s.className="spread";if(this.isInPresentationMode){const e=document.createElement("div");e.className="dummyPage";s.append(e)}for(const e of n){const i=this._pages[e];if(i){s.append(i.div);t.pages.push(i)}}i.append(s)}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 s={...t};if("string"==typeof s.top&&s.top.endsWith("%")){var n;const e=Number(s.top.replace("%","")),t=null===(n=this.viewer.querySelector(".page"))||void 0===n?void 0:n.clientHeight;let r=i.clientHeight?i.clientHeight:t;const a=this.viewer.parentElement.clientHeight;r=Math.max(0,r-a);s.top=e*r/100}if("string"==typeof s.left&&s.left.endsWith("%")){var r;const e=Number(s.left.replace("%","")),t=null===(r=this.viewer.querySelector(".page"))||void 0===r?void 0:r.clientWidth,n=i.clientWidth?i.clientWidth:t;s.left=e*n/100}this.#Nn({div:i,id:e},s)}else this.#Nn({pageDiv:i,pageNumber:e})}#Nn(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!e)return;const{div:i,id:n}=e;this._currentPageNumber!==n&&this._setCurrentPageNumber(n);if(this._scrollMode===r.ScrollMode.PAGE){this.#On();this.update()}if(!t&&!this.isInPresentationMode){const e=i.offsetLeft+i.clientLeft,n=e+i.clientWidth,{scrollLeft:s,clientWidth:a}=this.container;(this._scrollMode===r.ScrollMode.HORIZONTAL||e<s||n>s+a)&&(t={left:0,top:0})}(0,r.scrollIntoView)(i,t,!1,"infinite-scroll"===this.pageViewMode);!this._currentScaleValue&&this._location&&(this._location=null)}#Bn(e){return e===this._currentScale||Math.abs(e-this._currentScale)<1e-15}#Vn(e,t,i){let{noScroll:r=!1,preset:s=!1,drawingDelay:a=-1}=i;const o=isNaN(Number(this.currentScale))?void 0:Number(this.currentScale),l=this.currentScaleValue;this._currentScaleValue=t.toString();if(this.#Bn(e)){s&&this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:t,previousScale:o,previousPresetValue:l});return}this.viewer.style.setProperty("--scale-factor",e*n.PixelsPerInch.PDF_TO_CSS_UNITS);const c=a>=0&&a<1e3;this.refresh(!0,{scale:e,drawingDelay:c?a:-1});c&&(this.#Cn=setTimeout((()=>{this.#Cn=null;this.refresh()}),a));this._currentScale=e;if(!r){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:o,previousPresetValue:l});this.defaultRenderingQueue&&this.update()}get#Un(){return this._spreadMode!==r.SpreadMode.NONE&&this._scrollMode!==r.ScrollMode.HORIZONTAL?2:1}#kn(e,t){e||(e="auto");let i=parseFloat(e);if(this._currentScale!==i)if(i>0){t.preset=!1;this.#Vn(i,e,t)}else{const n=this._pages[this._currentPageNumber-1];if(!n)return;let s=r.SCROLLBAR_PADDING,a=r.VERTICAL_PADDING;if(this.isInPresentationMode){s=a=4;this._spreadMode!==r.SpreadMode.NONE&&(s*=2)}else this.removePageBorders?s=a=0:this._scrollMode===r.ScrollMode.HORIZONTAL&&([s,a]=[a,s]);const o=(this.container.clientWidth-s)/n.width*n.scale/this.#Un,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,r.isPortraitOrientation)(n)?o:Math.min(l,o);i=Math.min(r.MAX_AUTO_SCALE,t);break;default:globalThis.ngxConsole.error(`#setScale: "${e}" is an unknown zoom value.`);return}t.preset=!0;this.#Vn(i,e,t)}}#In(){const e=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&this.#kn(this._currentScaleValue,{noScroll:!0});this.#Nn(e)}pageLabelToPageNumber(e){if(!this._pageLabels)return null;const t=this._pageLabels.indexOf(e);return t<0?null:t+1}scrollPageIntoView(e){let{pageNumber:t,destArray:i=null,allowNegativeOffset:s=!1,ignoreDestinationZoom:a=!1}=e;if(!this.pdfDocument)return;const o=Number.isInteger(t)&&this._pages[t-1];if(!o){console.error(`scrollPageIntoView: "${t}" is not a valid pageNumber parameter.`);return}if(this.isInPresentationMode||!i){this._setCurrentPageNumber(t,!0);return}let l,c,d=0,h=0,u=0,p=0;const g=o.rotation%180!=0,f=(g?o.height:o.width)/o.scale/n.PixelsPerInch.PDF_TO_CSS_UNITS,m=(g?o.width:o.height)/o.scale/n.PixelsPerInch.PDF_TO_CSS_UNITS;let v=0;switch(i[1].name){case"XYZ":d=i[2];h=i[3];v=i[4];d=null!==d?d:0;h=null!==h?h:m;break;case"Fit":case"FitB":v="page-fit";break;case"FitH":case"FitBH":h=i[2];v="page-width";if(null===h&&this._location){d=this._location.left;h=this._location.top}else("number"!=typeof h||h<0)&&(h=m);break;case"FitV":case"FitBV":d=i[2];u=f;p=m;v="page-height";break;case"FitR":d=i[2];h=i[3];u=i[4]-d;p=i[5]-h;let e=r.SCROLLBAR_PADDING,t=r.VERTICAL_PADDING;this.removePageBorders&&(e=t=0);l=(this.container.clientWidth-e)/u/n.PixelsPerInch.PDF_TO_CSS_UNITS;c=(this.container.clientHeight-t)/p/n.PixelsPerInch.PDF_TO_CSS_UNITS;v=Math.min(Math.abs(l),Math.abs(c));break;default:console.error(`scrollPageIntoView: "${i[1].name}" is not a valid destination type.`);return}a||(v&&v!==this._currentScale?this.currentScaleValue=v:this._currentScale===r.UNKNOWN_SCALE&&(this.currentScaleValue=r.DEFAULT_SCALE_VALUE));this.#rn(o).then((()=>{this.renderingQueue.renderView(o);"single"===this.pageViewMode&&this.currentPageNumber!==t&&(this.currentPageNumber=t)}));if("page-fit"===v&&!i[4]){this.#Nn(o);return}const b=[o.viewport.convertToViewportPoint(d,h),o.viewport.convertToViewportPoint(d+u,h+p)];let y=Math.min(b[0][0],b[1][0]),w=Math.min(b[0][1],b[1][1]);if(!s){y=Math.max(y,0);w=Math.max(w,0)}this.#Nn(o,{left:y,top:w})}_updateLocation(e){const t=this._currentScale,i=this._currentScaleValue,n=parseFloat(i)===t?Math.round(1e4*t)/100:i,r=e.id,s=this._pages[r-1],a=this.container,o=s.getPagePoint(a.scrollLeft-e.x,a.scrollTop-e.y),l=Math.round(o[0]),c=Math.round(o[1]);let d=`#page=${r}`;this.isInPresentationMode||(d+=`&zoom=${n},${l},${c}`);this._location={pageNumber:r,scale:n,top:c,left:l,rotation:this._pagesRotation,pdfOpenParams:d}}update(){this.scrollMode===r.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,s=Math.max(n,2*i+1);this.#un.resize(s,e.ids);this.renderingQueue.renderHighestPriority(e);const a=this._spreadMode===r.SpreadMode.NONE&&(this._scrollMode===r.ScrollMode.PAGE||this._scrollMode===r.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===r.PresentationModeState.FULLSCREEN}get isChangingPresentationMode(){return this.presentationModeState===r.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===r.ScrollMode.PAGE?this.#En.pages:this._pages,t=this._scrollMode===r.ScrollMode.HORIZONTAL,i=t&&this._isContainerRtl;return(0,r.getVisibleElements)({scrollEl:this.container,views:e,sortByVisibility:!0,horizontal:t,rtl:i})}cleanup(){for(const e of this._pages)e.renderingState!==r.RenderingStates.FINISHED&&e.reset()}_cancelRendering(){for(const e of this._pages)e.cancelRendering()}async#rn(e){if(e.pdfPage)return e.pdfPage;try{var t,i;const n=await this.pdfDocument.getPage(e.id);e.pdfPage||e.setPdfPage(n);null!==(t=(i=this.linkService)._cachedPageNumber)&&void 0!==t&&t.call(i,n.ref)||this.linkService.cachePageRef(e.id,n.ref);return n}catch(e){console.error("Unable to get page for page view",e);return null}}#sn(e){var t,i;if(1===(null===(t=e.first)||void 0===t?void 0:t.id))return!0;if((null===(i=e.last)||void 0===i?void 0:i.id)===this.pagesCount)return!1;switch(this._scrollMode){case r.ScrollMode.PAGE:return this.#En.scrollDown;case r.ScrollMode.HORIZONTAL:return this.scroll.right}return this.scroll.down}forceRendering(e){const t=e||this._getVisiblePages(),i=this.#sn(t),n=this._spreadMode!==r.SpreadMode.NONE&&this._scrollMode!==r.ScrollMode.HORIZONTAL,s=this.renderingQueue.getHighestPriority(t,this._pages,i,n);if(s){this.#rn(s).then((()=>{this.renderingQueue.renderView(s)}));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(){let e;return this._pages.map((t=>{const i=t.pdfPage.getViewport({scale:1}),n=(0,r.isPortraitOrientation)(i);if(void 0===e)e=n;else if(this.enablePrintAutoRotate&&n!==e)return{width:i.height,height:i.width,rotation:(i.rotation-90)%360};return{width:i.width,height:i.height,rotation:i.rotation}}))}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,r.isValidScrollMode)(e))throw new Error(`Invalid scroll mode: ${e}`);if(!(this.pagesCount>d.FORCE_SCROLL_MODE_PAGE)){this._previousScrollMode=this._scrollMode;this._scrollMode=e;this.eventBus.dispatch("scrollmodechanged",{source:this,mode:e});this._updateScrollMode(this._currentPageNumber)}}}_updateScrollMode(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;const t=this._scrollMode,i=this.viewer;i.classList.toggle("scrollHorizontal",t===r.ScrollMode.HORIZONTAL);i.classList.toggle("scrollWrapped",t===r.ScrollMode.WRAPPED);if(this.pdfDocument&&e){t===r.ScrollMode.PAGE?this.#On():this._previousScrollMode===r.ScrollMode.PAGE&&this._updateSpreadMode();this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#kn(this._currentScaleValue,{noScroll:!0});this._setCurrentPageNumber(e,!0);this.update()}}get spreadMode(){return this._spreadMode}set spreadMode(e){if(this._spreadMode!==e){if(!(0,r.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(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!this.pdfDocument)return;const t=this.viewer,i=this._pages;if(this._scrollMode===r.ScrollMode.PAGE)this.#On();else{t.textContent="";if(this._spreadMode===r.SpreadMode.NONE)for(const e of this._pages)t.append(e.div);else{const e=this._spreadMode-1;let n=null;for(let r=0,s=i.length;r<s;++r){if(null===n){n=document.createElement("div");n.className="spread";t.append(n)}else if(r%2===e){n=n.cloneNode(!1);t.append(n)}n.append(i[r].div)}}}this.hidePagesDependingOnpageViewMode();if(e){this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#kn(this._currentScaleValue,{noScroll:!0});this._setCurrentPageNumber(e,!0);this.update()}}_getPageAdvance(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if("book"===this.pageViewMode)return 2;switch(this._scrollMode){case r.ScrollMode.WRAPPED:{const{views:i}=this._getVisiblePages(),n=new Map;for(const{id:e,y:t,percent:r,widthPercent:s}of i){if(0===r||s<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 r=i.length;if(1===r)break;if(t)for(let t=n-1,r=0;t>=r;t--){const n=i[t],r=i[t+1]-1;if(n<r)return e-r}else for(let t=n+1,s=r;t<s;t++){const n=i[t],r=i[t-1]+1;if(n>r)return r-e}if(t){const t=i[0];if(t<e)return e-t+1}else{const t=i[r-1];if(t>e)return t-e+1}break}break}case r.ScrollMode.HORIZONTAL:break;case r.ScrollMode.PAGE:case r.ScrollMode.VERTICAL:{if(this._spreadMode===r.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(),s=t?e-1:e+1;for(const{id:e,percent:t,widthPercent:i}of n)if(e===s){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(){let{drawingDelay:e,scaleFactor:t,steps:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.pdfDocument)return;let n=this._currentScale;if(t>1)n=Math.round(n*t*100)/100;else{i??=1;do{n=Math.ceil(10*(n*r.DEFAULT_SCALE_DELTA).toFixed(2))/10}while(--i>0&&n<r.MAX_SCALE)}let s=Number(PDFViewerApplicationOptions.get("maxZoom"));s||(s=r.MAX_SCALE);this.#kn(Math.min(s,n),{noScroll:!1,drawingDelay:e})}decreaseScale(){let{drawingDelay:e,scaleFactor:t,steps:i}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.pdfDocument)return;let n=this._currentScale;if(t>0&&t<1)n=Math.round(n*t*100)/100;else{i??=1;do{n=Math.floor(10*(n/r.DEFAULT_SCALE_DELTA).toFixed(2))/10}while(--i>0&&n>r.MIN_SCALE)}let s=Number(PDFViewerApplicationOptions.get("minZoom"));s||(s=r.MIN_SCALE);this.#kn(Math.max(s,n),{noScroll:!1,drawingDelay:e})}#Mn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.container.clientHeight;if(e!==this.#Sn){this.#Sn=e;r.docStyle.setProperty("--viewer-container-height",`${e}px`)}}#An(e){for(const t of e)if(t.target===this.container){this.#Mn(Math.floor(t.borderBoxSize[0].blockSize));this.#mn=null;break}}get containerTopLeft(){return this.#mn||=[this.container.offsetTop,this.container.offsetLeft]}get annotationEditorMode(){return this.#gn?this.#pn:n.AnnotationEditorType.DISABLE}set annotationEditorMode(e){if(!this.#gn)throw new Error("The AnnotationEditor is not enabled.");if(this.#pn!==e){if(!isValidAnnotationEditorMode(e))throw new Error(`Invalid AnnotationEditor mode: ${e}`);if(this.pdfDocument){this.#pn=e;this.eventBus.dispatch("annotationeditormodechanged",{source:this,mode:e});this.#gn.updateMode(e)}}}set annotationEditorParams(e){let{type:t,value:i}=e;if(!this.#gn)throw new Error("The AnnotationEditor is not enabled.");this.#gn.updateParams(t,i)}refresh(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object.create(null);if(this.pdfDocument){for(const e of this._pages)e.update(t);if(null!==this.#Cn){clearTimeout(this.#Cn);this.#Cn=null}e||this.update()}}}},(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.NullL10n=void 0;t.fixupLangCode=function fixupLangCode(e){return n[null==e?void 0: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 r={getLanguage:async()=>"en-us",getDirection:async()=>"ltr",async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function formatL10nValue(e,t){return t?e.replaceAll(/\{\{\s*(\w+)\s*\}\}/g,((e,i)=>i in t?t[i]:"{{"+i+"}}")):e}(arguments.length>2&&void 0!==arguments[2]?arguments[2]:getL10nFallback(e,t),t)},async translate(e){}};t.NullL10n=r},(e,t)=>{"use strict";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),r=this.render.getRect().pageWidth,s=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,r,s):this.drawLoader(i,{x:0,y:0},r,s);i.restore()}simpleDraw(e){const t=this.render.getRect(),i=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0}:void 0,n=canvas.getContext("2d",i),r=t.pageWidth,s=t.height,a=1===e?t.left+t.pageWidth:t.left,o=t.top;this.isLoad?n.drawImage(this.image,a,o,r,s):this.drawLoader(n,{x:a,y:o},r,s)}drawLoader(e,t,i,n){e.beginPath();e.strokeStyle="rgb(200, 200, 200)";e.fillStyle="rgb(255, 255, 255)";e.lineWidth=1;e.rect(t.x+1,t.y+1,i-1,n-1);e.stroke();e.fill();const r={x:t.x+i/2,y:t.y+n/2};e.beginPath();e.lineWidth=10;e.arc(r.x,r.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(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]: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,r=e[1].x-e[0].x,s=t[1].x-t[0].x;return Math.acos((i*n+r*s)/(Math.sqrt(i*i+r*r)*Math.sqrt(n*n+s*s)))}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,r=e.y,s=i.x,a=i.y;let o=Math.sqrt(Math.pow(t,2)*Math.pow(n-s,2)/(Math.pow(n-s,2)+Math.pow(r-a,2)))+n;i.x<0&&(o*=-1);let l=(o-n)*(r-a)/(n-s)+r;n-s+r===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,r=e[1].x-e[0].x,s=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,c=r*o-s*a,d=-(a*s-o*r)/(i*s-n*r),h=-(i*o-n*a)/(i*s-n*r);if(isFinite(d)&&isFinite(h))return{x:d,y:h};if(Math.abs(l-c)<.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),r=Math.max(i,n),s=[e];function getCord(e,t,i,n,r){return t>e?e+r*(i/n):t<e?e-r*(i/n):e}for(let a=1;a<=r;a+=1)s.push({x:getCord(e.x,t.x,i,r,a),y:getCord(e.y,t.y,n,r,a)});return s}}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,r=this.render.getRect().height;this.element.classList.remove("--simple");const s=`\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: ${r}px;\n `;"hard"===t?this.drawHard(s):this.drawSoft(i,s)}drawHard(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";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){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",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,r=1===e?t.left+t.pageWidth:t.left,s=t.top;this.element.classList.add("--simple");this.element.style.cssText=`\n position: absolute;\n display: block;\n height: ${n}px;\n left: ${r}px;\n top: ${s}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 r=Math.PI-n;if(!isFinite(n)||r>=0&&r<.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 r=Helper.LimitPointToCircle(t,this.pageWidth,n);if(n!==r){n=r;this.updateAngleAndGeometry(n)}const s=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,s,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,r="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:r},!0)}start(e){this.reset();const t=this.render.convertToBook(e),i=this.getBoundsRect(),n=this.getDirectionByPoint(t),r=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,r,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,r="bottom"===this.calc.getCorner()?t.height-1:1,s="bottom"===this.calc.getCorner()?t.height-n:n;this.animateFlippingTo({x:i-1,y:r},{x:i-n,y:s},!1,!1)}else this.do(this.render.convertToPage(e));else{this.setState("read");this.render.finishAnimation();this.stopMove()}}animateFlippingTo(e,t,i){let n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];const r=Helper.GetCordsFromTwoPoint(e,t),s=[];for(const e of r)s.push((()=>this.do(e)));const a=this.getAnimationDuration(r.length);this.render.startAnimation(s,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(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];for(const e of t)if(this.state===e)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,r=this.render.convertToBook(e);return r.x>0&&r.y>0&&r.x<t.width&&r.y<t.height&&(r.x<n||r.x>t.width-n)&&(r.y<n||r.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,r=this.setting.width/this.setting.height;let s=this.setting.width,a=this.setting.height,o=i-s;if("stretch"===this.setting.size){t<2*this.setting.minWidth&&this.app.getSettings().usePortrait&&(e="portrait");s="portrait"===e?this.getBlockWidth():this.getBlockWidth()/2;s>this.setting.maxWidth&&(s=this.setting.maxWidth);a=s/r;if(a>this.getBlockHeight()){a=this.getBlockHeight();s=a*r}o="portrait"===e?i-s/2-s:i-s}else if(t<2*s&&this.app.getSettings().usePortrait){e="portrait";o=i-s/2-s}this.boundsRect={left:o,top:n-a/2,width:2*s,height:a,pageWidth:s};return e}setShadowData(e,t,i,n){if(!this.app.getSettings().drawShadow)return;const r=100*this.getSettings().maxShadowOpacity;this.shadow={pos:e,angle:t,width:3*this.getRect().pageWidth/4*i/100,opacity:(100-i)*r/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,r=this.ctx.createLinearGradient(0,0,n,0);if(0===this.shadow.direction){this.ctx.translate(-n,-100);r.addColorStop(1,"rgba(0, 0, 0, "+this.shadow.opacity+")");r.addColorStop(.9,"rgba(0, 0, 0, 0.05)");r.addColorStop(.7,"rgba(0, 0, 0, "+this.shadow.opacity+")");r.addColorStop(0,"rgba(0, 0, 0, 0)")}else{this.ctx.translate(0,-100);r.addColorStop(0,"rgba(0, 0, 0, "+this.shadow.opacity+")");r.addColorStop(.1,"rgba(0, 0, 0, 0.05)");r.addColorStop(.3,"rgba(0, 0, 0, "+this.shadow.opacity+")");r.addColorStop(1,"rgba(0, 0, 0, 0)")}this.ctx.clip();this.ctx.fillStyle=r;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){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]: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",r=this.convertToGlobal(this.shadow.pos),s=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},s);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(${r.x-i}px, ${r.y-100}px, 0) rotate(${s}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,r=0===this.getDirection()?"to right":"to left",s=[{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 s)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(${r}, 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],r=document.createElement("style");r.type="text/css";"top"===i&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r);r.styleSheet?r.styleSheet.cssText=e:r.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(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"top";this.flipController.flipNext(e)}flipPrev(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"top";this.flipController.flipPrev(e)}flip(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"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){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.isUserTouch){this.isUserTouch=!1;t||(this.isUserMove?this.flipController.stopMove():this.flipController.flip(e))}}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PDFPageView=void 0;var n=i(4),r=i(3),s=i(34),a=i(35),o=i(5),l=i(31),c=(i(7),i(36)),d=i(37),h=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(i(38)),u=i(39),p=i(175),g=i(176),f=i(177);const m=o.compatibilityParams.maxCanvasPixels||16777216,DEFAULT_LAYER_PROPERTIES=()=>null;t.PDFPageView=class PDFPageView{#fn=n.AnnotationMode.ENABLE_FORMS;#Dn=null;#jn=null;#Hn=null;#Wn=null;#zn=r.RenderingStates.INITIAL;#Tn=r.TextLayerMode.ENABLE;#Gn={initialOptionalContent:!0,regularAnnotations:!0};#qn=new WeakMap;constructor(e){var t;const i=e.container,s=e.defaultViewport;this.id=e.id;this.renderingId="page"+this.id;this.#Dn=e.layerProperties||DEFAULT_LAYER_PROPERTIES;this.pdfPage=null;this.pageLabel=null;this.rotation=0;this.scale=e.scale||r.DEFAULT_SCALE;this.viewport=s;this.pdfPageRotate=s.rotation;this._optionalContentConfigPromise=e.optionalContentConfigPromise||null;this.hasRestrictedScaling=!1;this.#Tn=e.textLayerMode??r.TextLayerMode.ENABLE;this.#fn=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.l10n=e.l10n||l.NullL10n;this.renderTask=null;this.resume=null;this._isStandalone=!(null!==(t=this.renderingQueue)&&void 0!==t&&t.hasViewer());this._annotationCanvasMap=null;this.annotationLayer=null;this.annotationEditorLayer=null;this.textLayer=null;this.zoomLayer=null;this.xfaLayer=null;this.structTreeLayer=null;const a=document.createElement("div");a.className="page";a.setAttribute("data-page-number",this.id);a.setAttribute("role","region");this.l10n.get("page_landmark",{page:this.id}).then((e=>{a.setAttribute("aria-label",e)}));this.div=a;this.#$n();null==i||i.append(a);if(this._isStandalone){null==i||i.style.setProperty("--scale-factor",this.scale*n.PixelsPerInch.PDF_TO_CSS_UNITS);const{optionalContentConfigPromise:t}=e;t&&t.then((e=>{t===this._optionalContentConfigPromise&&(this.#Gn.initialOptionalContent=e.hasInitialVisibility)}))}}get renderingState(){return this.#zn}set renderingState(e){if(e!==this.#zn){this.#zn=e;if(this.#jn){clearTimeout(this.#jn);this.#jn=null}switch(e){case r.RenderingStates.PAUSED:this.div.classList.remove("loading");break;case r.RenderingStates.RUNNING:this.div.classList.add("loadingIcon");this.#jn=setTimeout((()=>{this.div.classList.add("loading");this.#jn=null}),0);break;case r.RenderingStates.INITIAL:case r.RenderingStates.FINISHED:this.div.classList.remove("loadingIcon","loading")}}}#$n(){const{viewport:e}=this;if(this.pdfPage){if(this.#Hn===e.rotation)return;this.#Hn=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.#$n();this.reset()}destroy(){var e;this.reset();null===(e=this.pdfPage)||void 0===e||e.cleanup()}get _textHighlighter(){return(0,n.shadow)(this,"_textHighlighter",new p.TextHighlighter({pageIndex:this.id-1,eventBus:this.eventBus,findController:this.#Dn().findController}))}async#Xn(){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#Kn(){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#Yn(){let e=null;try{const e=await this.xfaLayer.render(this.viewport,"display");null!=e&&e.textDivs&&this._textHighlighter&&this.#Qn(e.textDivs)}catch(t){console.error(`#renderXfaLayer: "${t}".`);e=t}finally{this.eventBus.dispatch("xfalayerrendered",{source:this,pageNumber:this.id,error:e})}}async#Zn(){const{pdfPage:e,textLayer:t,viewport:i}=this;if(!t)return;let r=null;try{if(!t.renderingDone){const i=e.streamTextContent({includeMarkedContent:!0,disableNormalization:!0});t.setTextContentSource(i)}await t.render(i)}catch(e){if(e instanceof n.AbortException)return;console.error(`#renderTextLayer: "${e}".`);r=e}this.eventBus.dispatch("textlayerrendered",{source:this,pageNumber:this.id,numTextDivs:t.numTextDivs,error:r});this.#Jn()}async#Jn(){var e,t;if(!this.textLayer)return;this.structTreeLayer||=new c.StructTreeLayerBuilder;const i=await(this.structTreeLayer.renderingDone?null:this.pdfPage.getStructTree()),n=null===(e=this.structTreeLayer)||void 0===e?void 0:e.render(i);if(n){var r;null===(r=this.canvas)||void 0===r||r.append(n)}null===(t=this.structTreeLayer)||void 0===t||t.show()}async#Qn(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(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.zoomLayer)return;const t=this.zoomLayer.firstChild;this.#qn.delete(t);t.width=0;t.height=0;e&&this.zoomLayer.remove();this.zoomLayer=null}reset(){var e,t,i,n,s;let{keepZoomLayer:a=!1,keepAnnotationLayer:o=!1,keepAnnotationEditorLayer:l=!1,keepXfaLayer:c=!1,keepTextLayer:d=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.cancelRendering({keepAnnotationLayer:o,keepAnnotationEditorLayer:l,keepXfaLayer:c,keepTextLayer:d});this.renderingState=r.RenderingStates.INITIAL;const h=this.div,u=h.childNodes,p=a&&this.zoomLayer||null,g=o&&(null===(e=this.annotationLayer)||void 0===e?void 0:e.div)||null,f=l&&(null===(t=this.annotationEditorLayer)||void 0===t?void 0:t.div)||null,m=c&&(null===(i=this.xfaLayer)||void 0===i?void 0:i.div)||null,v=d&&(null===(n=this.textLayer)||void 0===n?void 0:n.div)||null;for(let e=u.length-1;e>=0;e--){const t=u[e];switch(t){case p:case g:case f:case m:case v:continue}t.remove()}h.removeAttribute("data-loaded");g&&this.annotationLayer.hide();f&&this.annotationEditorLayer.hide();m&&this.xfaLayer.hide();v&&this.textLayer.hide();null===(s=this.structTreeLayer)||void 0===s||s.hide();if(!p){if(this.canvas){this.#qn.delete(this.canvas);this.canvas.width=0;this.canvas.height=0;delete this.canvas}this._resetZoomLayer()}}update(e){let{scale:t=0,rotation:i=null,optionalContentConfigPromise:s=null,drawingDelay:a=-1}=e;this.scale=t||this.scale;"number"==typeof i&&(this.rotation=i);if(s instanceof Promise){this._optionalContentConfigPromise=s;s.then((e=>{s===this._optionalContentConfigPromise&&(this.#Gn.initialOptionalContent=e.hasInitialVisibility)}))}const o=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:this.scale*n.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:o});this.#$n();if(this._isStandalone){var l;null===(l=this.div.parentNode)||void 0===l||l.style.setProperty("--scale-factor",this.viewport.scale)}let c=!1;if(this.canvas&&this.maxCanvasPixels>0){const{width:e,height:t}=this.viewport,{sx:i,sy:n}=this.outputScale;(Math.floor(e)*i|0)*(Math.floor(t)*n|0)>this.maxCanvasPixels&&(c=!0)}const d=this.useOnlyCssZoom||this.hasRestrictedScaling&&c,h=!d&&a>=0&&a<1e3;if(this.canvas){if(h||d){if(h&&this.renderingState!==r.RenderingStates.FINISHED){this.cancelRendering({keepZoomLayer:!0,keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,cancelExtraDelay:a});this.renderingState=r.RenderingStates.FINISHED}this.cssTransform({target:this.canvas,redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!h,hideTextLayer:h});this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this.#Wn});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(){let{keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:i=!1,keepTextLayer:n=!1,cancelExtraDelay:r=0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.renderTask){this.renderTask.cancel(r);this.renderTask=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)){var s;this.xfaLayer.cancel();this.xfaLayer=null;null===(s=this._textHighlighter)||void 0===s||s.disable()}}cssTransform(e){let{target:t,redrawAnnotationLayer:i=!1,redrawAnnotationEditorLayer:n=!1,redrawXfaLayer:r=!1,redrawTextLayer:s=!1,hideTextLayer:a=!1}=e;if(!t.hasAttribute("zooming")){t.setAttribute("zooming",!0);const{style:e}=t;e.width=e.height=""}const o=this.#qn.get(t);if(this.viewport!==o){const e=this.viewport.rotation-o.rotation,i=Math.abs(e);let n=1,r=1;if(90===i||270===i){const{width:e,height:t}=this.viewport;n=t/e;r=e/t}t.style.transform=`rotate(${e}deg) scale(${n}, ${r})`}i&&this.annotationLayer&&this.#Xn();n&&this.annotationEditorLayer&&this.#Kn();r&&this.xfaLayer&&this.#Yn();if(this.textLayer)if(a){var l;this.textLayer.hide();null===(l=this.structTreeLayer)||void 0===l||l.hide()}else s&&this.#Zn()}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(e,t){return this.viewport.convertToPdfPoint(e,t)}async#ln(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;e===this.renderTask&&(this.renderTask=null);if(t instanceof n.RenderingCancelledException)this.#Wn=null;else{this.#Wn=t;this.renderingState=r.RenderingStates.FINISHED;this._resetZoomLayer(!0);this.#Gn.regularAnnotations=!e.separateAnnots;this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!1,timestamp:performance.now(),error:this.#Wn});if(t)throw t}}async draw(){if(this.renderingState!==r.RenderingStates.INITIAL){globalThis.ngxConsole.error("Must be in new state before drawing");this.reset()}const{div:e,l10n:t,pageColors:i,pdfPage:o,viewport:l}=this;if(!o){this.renderingState=r.RenderingStates.FINISHED;throw new Error("pdfPage is not loaded")}this.renderingState=r.RenderingStates.RUNNING;const c=document.createElement("div");c.classList.add("canvasWrapper");e.append(c);if(!this.textLayer&&this.#Tn!==r.TextLayerMode.DISABLE&&!o.isPureXfa){this._accessibilityManager||=new d.TextAccessibilityManager;this.textLayer=new g.TextLayerBuilder({highlighter:this._textHighlighter,accessibilityManager:this._accessibilityManager,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported,enablePermissions:this.#Tn===r.TextLayerMode.ENABLE_PERMISSIONS});e.append(this.textLayer.div)}if(!this.annotationLayer&&this.#fn!==n.AnnotationMode.DISABLE){const{annotationStorage:i,downloadManager:r,enableScripting:s,fieldObjectsPromise:l,hasJSActionsPromise:c,linkService:d}=this.#Dn();this._annotationCanvasMap||=new Map;this.annotationLayer=new a.AnnotationLayerBuilder({pageDiv:e,pdfPage:o,annotationStorage:i,imageResourcesPath:this.imageResourcesPath,renderForms:this.#fn===n.AnnotationMode.ENABLE_FORMS,linkService:d,downloadManager:r,l10n:t,enableScripting:s,hasJSActionsPromise:c,fieldObjectsPromise:l,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager})}let{width:p,height:m}=l;const v=document.createElement("canvas");v.setAttribute("role","presentation");v.hidden=!0;const b=!(null==i||!i.background||null==i||!i.foreground);let showCanvas=e=>{if(!b||e){v.hidden=!1;showCanvas=null}};c.append(v);this.canvas=v;const y=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0,alpha:!1}:{alpha:!1},w=v.getContext("2d",y),_=this.outputScale=new r.OutputScale;if(this.useOnlyCssZoom){const e=l.clone({scale:n.PixelsPerInch.PDF_TO_CSS_UNITS});_.sx*=e.width/p;_.sy*=e.height/m}if(this.maxCanvasPixels>0){const e=p*m,t=Math.sqrt(this.maxCanvasPixels/e);if(_.sx>t||_.sy>t){_.sx=t;_.sy=t;this.hasRestrictedScaling=!0}else this.hasRestrictedScaling=!1}const S=(0,r.approximateFraction)(_.sx),P=(0,r.approximateFraction)(_.sy);p=(0,r.roundToDivide)(p*_.sx,S[0]);m=(0,r.roundToDivide)(m*_.sy,P[0]);let A=1;if((p>=4096||m>=4096)&&(this.maxWidth||!h.default.test({width:p,height:m}))){const e=this.determineMaxDimensions();A=Math.max(p/e,m/e);if(A>1){const e=Math.floor(100*this.scale/A)/100;A=this.scale/e;l.width/=A;l.height/=A;(0,u.warn)(`Page ${this.id}: Reduced the maximum zoom to ${e} because the browser can't render larger canvases.`)}else A=1}v.width=(0,r.roundToDivide)(l.width*_.sx,S[0]);v.height=(0,r.roundToDivide)(l.height*_.sy,P[0]);const{style:E}=v;E.width=(0,r.roundToDivide)(l.width,S[1])+"px";E.height=(0,r.roundToDivide)(l.height,P[1])+"px";this.#qn.set(v,l);const x={canvasContext:w,transform:_.scaled?[_.sx,0,0,_.sy,0,0]:null,viewport:l,annotationMode:this.#fn,optionalContentConfigPromise:this._optionalContentConfigPromise,annotationCanvasMap:this._annotationCanvasMap,pageColors:i},C=this.renderTask=this.pdfPage.render(x);C.onContinue=e=>{var t;null===(t=showCanvas)||void 0===t||t(!1);if(!this.renderingQueue||this.renderingQueue.isHighestPriority(this))e();else{this.renderingState=r.RenderingStates.PAUSED;this.resume=()=>{this.renderingState=r.RenderingStates.RUNNING;e()}}};const T=C.promise.then((async()=>{var i;null===(i=showCanvas)||void 0===i||i(!0);await this.#ln(C);this.#Zn();this.annotationLayer&&await this.#Xn();if(!this.annotationEditorLayer){const{annotationEditorUIManager:i}=this.#Dn();if(!i)return;this.annotationEditorLayer=new s.AnnotationEditorLayerBuilder({uiManager:i,pageDiv:e,pdfPage:o,l10n:t,accessibilityManager:this._accessibilityManager})}this.#Kn()}),(e=>{if(!(e instanceof n.RenderingCancelledException)){var t;null===(t=showCanvas)||void 0===t||t(!0)}return this.#ln(C,e)}));if(o.isPureXfa){if(this.xfaLayer)this.xfaLayer.div&&e.append(this.xfaLayer.div);else{const{annotationStorage:t,linkService:i}=this.#Dn();this.xfaLayer=new f.XfaLayerBuilder({pageDiv:e,pdfPage:o,annotationStorage:t,linkService:i})}this.#Yn()}e.setAttribute("data-loaded",!0);this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id});return T}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(!h.default.test({width:t+1,height:t+1})){this.maxWidth=t;return this.maxWidth}return 16384}get thumbnailCanvas(){const{initialOptionalContent:e,regularAnnotations:t}=this.#Gn;return e&&t?this.canvas:null}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.AnnotationEditorLayerBuilder=void 0;var n=i(4),r=i(31);t.AnnotationEditorLayerBuilder=class AnnotationEditorLayerBuilder{#ze;constructor(e){this.pageDiv=e.pageDiv;this.pdfPage=e.pdfPage;this.accessibilityManager=e.accessibilityManager;this.l10n=e.l10n||r.NullL10n;this.annotationEditorLayer=null;this.div=null;this._cancelled=!1;this.#ze=e.uiManager}async render(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"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 r=this.div=document.createElement("div");r.className="annotationEditorLayer";r.tabIndex=0;r.hidden=!0;this.pageDiv.append(r);this.annotationEditorLayer=new n.AnnotationEditorLayer({uiManager:this.#ze,div:r,accessibilityManager:this.accessibilityManager,pageIndex:this.pdfPage.pageNumber-1,l10n:this.l10n,viewport:i});const s={viewport:i,div:r,annotations:null,intent:t};this.annotationEditorLayer.render(s);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)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.AnnotationLayerBuilder=void 0;var n=i(4),r=i(31),s=i(3);t.AnnotationLayerBuilder=class AnnotationLayerBuilder{#er=0;#tr=null;constructor(e){let{pageDiv:t,pdfPage:i,linkService:n,downloadManager:s,annotationStorage:a=null,imageResourcesPath:o="",renderForms:l=!0,l10n:c=r.NullL10n,enableScripting:d=!1,hasJSActionsPromise:h=null,fieldObjectsPromise:u=null,annotationCanvasMap:p=null,accessibilityManager:g=null}=e;this.pageDiv=t;this.pdfPage=i;this.linkService=n;this.downloadManager=s;this.imageResourcesPath=o;this.renderForms=l;this.l10n=c;this.annotationStorage=a;this.enableScripting=d;this._hasJSActionsPromise=h||Promise.resolve(!1);this._fieldObjectsPromise=u||Promise.resolve(null);this._annotationCanvasMap=p;this._accessibilityManager=g;this.div=null;this._cancelled=!1;this._eventBus=n.eventBus}async render(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"display";if(this.div){if(this._cancelled||0===this.#er)return;n.AnnotationLayer.update({viewport:e.clone({dontFlip:!0}),div:this.div,annotationCanvasMap:this._annotationCanvasMap});return}const[i,r,a]=await Promise.all([this.pdfPage.getAnnotations({intent:t}),this._hasJSActionsPromise,this._fieldObjectsPromise]);if(!this._cancelled){this.#er=i.length;this.div=document.createElement("div");this.div.className="annotationLayer";this.pageDiv.append(this.div);if(0!==this.#er){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:r,fieldObjects:a,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager});this.l10n.translate(this.div);this.linkService.isInPresentationMode&&this.#ir(s.PresentationModeState.FULLSCREEN);if(!this.#tr){var o;this.#tr=e=>{this.#ir(e.state)};null===(o=this._eventBus)||void 0===o||o._on("presentationmodechanged",this.#tr)}}else this.hide()}}cancel(){this._cancelled=!0;if(this.#tr){var e;null===(e=this._eventBus)||void 0===e||e._off("presentationmodechanged",this.#tr);this.#tr=null}}hide(){this.div&&(this.div.hidden=!0)}#ir(e){if(!this.div)return;let t=!1;switch(e){case s.PresentationModeState.FULLSCREEN:t=!0;break;case s.PresentationModeState.NORMAL:break;default:return}for(const e of this.div.childNodes)e.hasAttribute("data-internal-link")||(e.inert=t)}}},(e,t)=>{"use strict";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{#nr=void 0;get renderingDone(){return void 0!==this.#nr}render(e){if(void 0!==this.#nr)return this.#nr;const t=this.#rr(e);null==t||t.classList.add("structTree");return this.#nr=t}hide(){this.#nr&&!this.#nr.hidden&&(this.#nr.hidden=!0)}show(){var e;null!==(e=this.#nr)&&void 0!==e&&e.hidden&&(this.#nr.hidden=!1)}#sr(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)}#rr(e){if(!e)return null;const t=document.createElement("span");if("role"in e){const{role:r}=e,s=r.match(n);if(s){t.setAttribute("role","heading");t.setAttribute("aria-level",s[1])}else i[r]&&t.setAttribute("role",i[r])}this.#sr(e,t);if(e.children)if(1===e.children.length&&"id"in e.children[0])this.#sr(e.children[0],t);else for(const i of e.children)t.append(this.#rr(i));return t}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.TextAccessibilityManager=void 0;var n=i(3);class TextAccessibilityManager{#ar=!1;#or=null;#lr=new Map;#cr=new Map;setTextMapping(e){this.#or=e}static#dr(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 r=i.y,s=i.y+i.height,a=i.y+i.height/2,o=n.y,l=n.y+n.height,c=n.y+n.height/2;if(a<=o&&c>=s)return-1;if(c<=r&&a>=l)return 1;return i.x+i.width/2-(n.x+n.width/2)}enable(){if(this.#ar)throw new Error("TextAccessibilityManager is already enabled.");if(!this.#or)throw new Error("Text divs and strings have not been set.");this.#ar=!0;this.#or=this.#or.slice();this.#or.sort(TextAccessibilityManager.#dr);if(this.#lr.size>0){const e=this.#or;for(const[t,i]of this.#lr){document.getElementById(t)?this.#hr(t,e[i]):this.#lr.delete(t)}}for(const[e,t]of this.#cr)this.addPointerInTextLayer(e,t);this.#cr.clear()}disable(){if(this.#ar){this.#cr.clear();this.#or=null;this.#ar=!1}}removePointerInTextLayer(e){var t;if(!this.#ar){this.#cr.delete(e);return}const i=this.#or;if(!i||0===i.length)return;const{id:n}=e,r=this.#lr.get(n);if(void 0===r)return;const s=i[r];this.#lr.delete(n);let a=s.getAttribute("aria-owns");if(null!==(t=a)&&void 0!==t&&t.includes(n)){a=a.split(" ").filter((e=>e!==n)).join(" ");if(a)s.setAttribute("aria-owns",a);else{s.removeAttribute("aria-owns");s.setAttribute("role","presentation")}}}#hr(e,t){const i=t.getAttribute("aria-owns");null!=i&&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.#ar){this.#cr.set(e,t);return}t&&this.removePointerInTextLayer(e);const r=this.#or;if(!r||0===r.length)return;const s=(0,n.binarySearchFirstItem)(r,(t=>TextAccessibilityManager.#dr(e,t)<0)),a=Math.max(0,s-1);this.#hr(i,r[a]);this.#lr.set(i,a)}moveElementInDOM(e,t,i,r){this.addPointerInTextLayer(i,r);if(!e.hasChildNodes()){e.append(t);return}const s=Array.from(e.childNodes).filter((e=>e!==t));if(0===s.length)return;const a=i||t,o=(0,n.binarySearchFirstItem)(s,(e=>TextAccessibilityManager.#dr(a,e)<0));0===o?s[0].before(t):s[o-1].after(t)}}t.TextAccessibilityManager=TextAccessibilityManager},(e,t)=>{"use strict";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=function _toPropertyKey(e){var t=function _toPrimitive(e,t){if("object"!=typeof e||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var n=i.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(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,r=function _objectWithoutPropertiesLoose(e,t){if(null==e)return{};var i,n,r={},s=Object.keys(e);for(n=0;n<s.length;n++){i=s[n];t.indexOf(i)>=0||(r[i]=e[i])}return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n<s.length;n++){i=s[n];t.indexOf(i)>=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}}return r}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){var n,r,s,a,o=[],l=!0,c=!1;try{if(s=(i=i.call(e)).next,0===t){if(Object(i)!==i)return;l=!1}else for(;!(l=(n=s.call(i)).done)&&(o.push(n.value),o.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=i.return&&(a=i.return(),Object(a)!==a))return}finally{if(c)throw r}}return o}}(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(),r=Math.max(Math.ceil(n[0]),1),s=Math.max(Math.ceil(n[1]),1),a=[r-1,s-1,1,1],o=Date.now(),l="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope;if(l){t=new OffscreenCanvas(1,1);i=new OffscreenCanvas(r,s)}else{(t=document.createElement("canvas")).width=1;t.height=1;(i=document.createElement("canvas")).width=r;i.height=s}var c=t.getContext("2d"),d=i.getContext("2d");if(d){d.fillRect.apply(d,a);c.drawImage(i,r-1,s-1,1,1,0,0,1,1)}var h=c&&0!==c.getImageData(0,0,1,1).data[3],u=Date.now()-o;[t,i].forEach((function(e){e.height=0;e.width=0}));if(l){postMessage({width:r,height:s,benchmark:u,isTestPass:h});!h&&e.sizes.length&&canvasTest(e)}else if(h)e.onSuccess(r,s,u);else{e.onError(r,s,u);e.sizes.length&&canvasTest(e)}return h}var i=[16384,14188,11402,11180,10836,8192,4096,1],n=[8388607,65535,32767,16384,8192,4096,1],r=[4194303,65535,32767,16384,8192,4096,1],s=["onError","onSuccess"],a={max:null,min:1,sizes:[],step:1024,usePromise:!1,useWorker:!1,onError:Function.prototype,onSuccess:Function.prototype},o={};function createSizesArray(e){var t=e.width===e.height,i=1===e.height,n=1===e.width,r=[];if(e.width&&e.height)for(var s=e.min||a.min,o=e.step||a.step,l=Math.max(e.width,e.height);l>=s;){var c=t||i?l:1,d=t||n?l:1;r.push([c,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,n=Date.now(),r=e.onError,a=e.onSuccess,l=_objectWithoutProperties(e,s),c=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 "),h=new Blob([d],{type:"application/javascript"}),u=URL.createObjectURL(h);c=new Worker(u);URL.revokeObjectURL(u);c.onmessage=function(e){var t=e.data,i=t.width,r=t.height,s=t.benchmark;if(t.isTestPass){o[n].onSuccess(i,r,s);delete o[n]}else o[n].onError(i,r,s)}}if(e.usePromise)return new Promise((function(t,i){var s=_objectSpread2(_objectSpread2({},e),{},{onError:function onError(t,n,s){var a;if(0===e.sizes.length)a=!0;else{var o=_slicedToArray(e.sizes.slice(-1),1),l=_slicedToArray(o[0],2),c=l[0],d=l[1];a=t===c&&n===d}r(t,n,s);a&&i({width:t,height:n,benchmark:s})},onSuccess:function onSuccess(e,i,n){a(e,i,n);t({width:e,height:i,benchmark:n})}});if(c){var d=s.onError,h=s.onSuccess;o[n]={onError:d,onSuccess:h};c.postMessage(l)}else canvasTest(s)}));if(!c)return canvasTest(e);o[n]={onError:r,onSuccess:a};c.postMessage(l)}var l={maxArea:function maxArea(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=createSizesArray({width:e.max,height:e.max,min:e.min,step:e.step,sizes:_toConsumableArray(i)});return handleMethod(_objectSpread2(_objectSpread2(_objectSpread2({},a),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(n)});return handleMethod(_objectSpread2(_objectSpread2(_objectSpread2({},a),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(r)});return handleMethod(_objectSpread2(_objectSpread2(_objectSpread2({},a),e),{},{sizes:t}))},test:function test(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=_objectSpread2(_objectSpread2({},a),e);t.sizes=_toConsumableArray(t.sizes);t.width&&t.height&&(t.sizes=[[t.width,t.height]]);return handleMethod(t)}};t.default=l},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.VerbosityLevel=t.Util=t.UnknownErrorException=t.UnexpectedResponseException=t.TextRenderingMode=t.RenderingIntentFlag=t.PromiseCapability=t.PermissionFlag=t.PasswordResponses=t.PasswordException=t.PageActionEventType=t.OPS=t.MissingPDFException=t.MAX_IMAGE_SIZE_TO_CACHE=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&&void 0!==(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 r=0;r<t;r+=i){const s=Math.min(r+i,t),a=e.subarray(r,s);n.push(String.fromCharCode.apply(null,a))}return n.join("")};t.createValidAbsoluteUrl=function createValidAbsoluteUrl(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!e)return null;try{if(i&&"string"==typeof e){if(i.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\./g);(null==t?void 0: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){switch(null==e?void 0: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(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]: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 r};t.info=function info(e){r>=n.INFOS&&("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?console.log(`Info: ${e}`):Window&&globalThis.ngxConsole?globalThis.ngxConsole.log(`Info: ${e}`):console.log(`Info: ${e}`))};t.isArrayBuffer=function isArrayBuffer(e){return"object"==typeof e&&void 0!==(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.normalizeUnicode=function normalizeUnicode(e){if(!l){l=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu;c=new Map([["ſt","ſt"]])}return e.replaceAll(l,((e,t,i)=>t?t.normalize("NFKC"):c.get(i)))};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)&&(r=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=o[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;if(!globalThis._pdfjsCompatibilityChecked){globalThis._pdfjsCompatibilityChecked=!0;i(40)}t.IDENTITY_MATRIX=[1,0,0,1,0,0];t.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0];t.MAX_IMAGE_SIZE_TO_CACHE=1e7;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 n={ERRORS:0,WARNINGS:1,INFOS:5};t.VerbosityLevel=n;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.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let r=n.WARNINGS;function warn(e){r>=n.WARNINGS&&("undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?console.log(`Warning: ${e}`):Window&&globalThis.ngxConsole?globalThis.ngxConsole.log(`Warning: ${e}`):console.log(`Warning: ${e}`))}function unreachable(e){throw new Error(e)}function shadow(e,t,i){let n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];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 a=[...Array(256).keys()].map((e=>e.toString(16).padStart(2,"0")));class Util{static makeHexColor(e,t,i){return`#${a[e]}${a[t]}${a[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),r=Util.applyTransform([e[0],e[3]],t),s=Util.applyTransform([e[2],e[1]],t);return[Math.min(i[0],n[0],r[0],s[0]),Math.min(i[1],n[1],r[1],s[1]),Math.max(i[0],n[0],r[0],s[0]),Math.max(i[1],n[1],r[1],s[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],r=e[2]*t[0]+e[3]*t[2],s=e[2]*t[1]+e[3]*t[3],a=(i+s)/2,o=Math.sqrt((i+s)**2-4*(i*s-r*n))/2,l=a+o||1,c=a-o||1;return[Math.sqrt(l),Math.sqrt(c)]}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 r=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),s=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return r>s?null:[i,r,n,s]}static bezierBoundingBox(e,t,i,n,r,s,a,o){const l=[],c=[[],[]];let d,h,u,p,g,f,m,v;for(let c=0;c<2;++c){if(0===c){h=6*e-12*i+6*r;d=-3*e+9*i-9*r+3*a;u=3*i-3*e}else{h=6*t-12*n+6*s;d=-3*t+9*n-9*s+3*o;u=3*n-3*t}if(Math.abs(d)<1e-12){if(Math.abs(h)<1e-12)continue;p=-u/h;0<p&&p<1&&l.push(p)}else{m=h*h-4*u*d;v=Math.sqrt(m);if(!(m<0)){g=(-h+v)/(2*d);0<g&&g<1&&l.push(g);f=(-h-v)/(2*d);0<f&&f<1&&l.push(f)}}}let b,y=l.length;const w=y;for(;y--;){p=l[y];b=1-p;c[0][y]=b*b*b*e+3*b*b*p*i+3*b*p*p*r+p*p*p*a;c[1][y]=b*b*b*t+3*b*b*p*n+3*b*p*p*s+p*p*p*o}c[0][w]=e;c[1][w]=t;c[0][w+1]=a;c[1][w+1]=o;c[0].length=c[1].length=w+2;return[Math.min(...c[0]),Math.min(...c[1]),Math.max(...c[0]),Math.max(...c[1])]}}t.Util=Util;const o=[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))}t.PromiseCapability=class PromiseCapability{#e=!1;constructor(){this.promise=new Promise(((e,t)=>{this.resolve=t=>{this.#e=!0;e(t)};this.reject=e=>{this.#e=!0;t(e)}}))}get settled(){return this.#e}};let l=null,c=null},(e,t,i)=>{"use strict";!function checkDOMMatrix(){globalThis.DOMMatrix}();!function checkPath2D(){globalThis.Path2D}();!function checkArrayAt(){Array.prototype.at||i(41)}();!function checkTypedArrayAt(){Uint8Array.prototype.at||i(115)}();!function checkStructuredClone(){globalThis.structuredClone||i(127)}()},(e,t,i)=>{i(42);var n=i(114);e.exports=n("Array","at")},(e,t,i)=>{"use strict";var n=i(43),r=i(80),s=i(104),a=i(102),o=i(109);n({target:"Array",proto:!0},{at:function at(e){var t=r(this),i=s(t),n=a(e),o=n>=0?n:i+n;return o<0||o>=i?void 0:t[o]}});o("at")},(e,t,i)=>{var n=i(44),r=i(45).f,s=i(84),a=i(88),o=i(78),l=i(96),c=i(108);e.exports=function(e,t){var i,d,h,u,p,g=e.target,f=e.global,m=e.stat;if(i=f?n:m?n[g]||o(g,{}):(n[g]||{}).prototype)for(d in t){u=t[d];h=e.dontCallGetSet?(p=r(i,d))&&p.value:i[d];if(!c(f?d:g+(m?".":"#")+d,e.forced)&&void 0!==h){if(typeof u==typeof h)continue;l(u,h)}(e.sham||h&&h.sham)&&s(u,"sham",!0);a(i,d,u,e)}}},e=>{var check=function(e){return e&&e.Math==Math&&e};e.exports=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof global&&global)||function(){return this}()||Function("return this")()},(e,t,i)=>{var n=i(46),r=i(48),s=i(50),a=i(51),o=i(52),l=i(58),c=i(79),d=i(82),h=Object.getOwnPropertyDescriptor;t.f=n?h:function getOwnPropertyDescriptor(e,t){e=o(e);t=l(t);if(d)try{return h(e,t)}catch(e){}if(c(e,t))return a(!r(s.f,e,t),e[t])}},(e,t,i)=>{var n=i(47);e.exports=!n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},e=>{e.exports=function(e){try{return!!e()}catch(e){return!0}}},(e,t,i)=>{var n=i(49),r=Function.prototype.call;e.exports=n?r.bind(r):function(){return r.apply(r,arguments)}},(e,t,i)=>{var n=i(47);e.exports=!n((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},(e,t)=>{"use strict";var i={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,r=n&&!i.call({1:2},1);t.f=r?function propertyIsEnumerable(e){var t=n(this,e);return!!t&&t.enumerable}:i},e=>{e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},(e,t,i)=>{var n=i(53),r=i(56);e.exports=function(e){return n(r(e))}},(e,t,i)=>{var n=i(54),r=i(47),s=i(55),a=Object,o=n("".split);e.exports=r((function(){return!a("z").propertyIsEnumerable(0)}))?function(e){return"String"==s(e)?o(e,""):a(e)}:a},(e,t,i)=>{var n=i(49),r=Function.prototype,s=r.call,a=n&&r.bind.bind(s,s);e.exports=n?a:function(e){return function(){return s.apply(e,arguments)}}},(e,t,i)=>{var n=i(54),r=n({}.toString),s=n("".slice);e.exports=function(e){return s(r(e),8,-1)}},(e,t,i)=>{var n=i(57),r=TypeError;e.exports=function(e){if(n(e))throw r("Can't call method on "+e);return e}},e=>{e.exports=function(e){return null==e}},(e,t,i)=>{var n=i(59),r=i(63);e.exports=function(e){var t=n(e,"string");return r(t)?t:t+""}},(e,t,i)=>{var n=i(48),r=i(60),s=i(63),a=i(70),o=i(73),l=i(74),c=TypeError,d=l("toPrimitive");e.exports=function(e,t){if(!r(e)||s(e))return e;var i,l=a(e,d);if(l){void 0===t&&(t="default");i=n(l,e,t);if(!r(i)||s(i))return i;throw c("Can't convert object to primitive value")}void 0===t&&(t="number");return o(e,t)}},(e,t,i)=>{var n=i(61),r=i(62),s=r.all;e.exports=r.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:n(e)||e===s}:function(e){return"object"==typeof e?null!==e:n(e)}},(e,t,i)=>{var n=i(62),r=n.all;e.exports=n.IS_HTMLDDA?function(e){return"function"==typeof e||e===r}:function(e){return"function"==typeof e}},e=>{var t="object"==typeof document&&document.all,i=void 0===t&&void 0!==t;e.exports={all:t,IS_HTMLDDA:i}},(e,t,i)=>{var n=i(64),r=i(61),s=i(65),a=i(66),o=Object;e.exports=a?function(e){return"symbol"==typeof e}:function(e){var t=n("Symbol");return r(t)&&s(t.prototype,o(e))}},(e,t,i)=>{var n=i(44),r=i(61);e.exports=function(e,t){return arguments.length<2?(i=n[e],r(i)?i:void 0):n[e]&&n[e][t];var i}},(e,t,i)=>{var n=i(54);e.exports=n({}.isPrototypeOf)},(e,t,i)=>{var n=i(67);e.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},(e,t,i)=>{var n=i(68),r=i(47);e.exports=!!Object.getOwnPropertySymbols&&!r((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&n&&n<41}))},(e,t,i)=>{var n,r,s=i(44),a=i(69),o=s.process,l=s.Deno,c=o&&o.versions||l&&l.version,d=c&&c.v8;d&&(r=(n=d.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1]));!r&&a&&(!(n=a.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=a.match(/Chrome\/(\d+)/))&&(r=+n[1]);e.exports=r},e=>{e.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},(e,t,i)=>{var n=i(71),r=i(57);e.exports=function(e,t){var i=e[t];return r(i)?void 0:n(i)}},(e,t,i)=>{var n=i(61),r=i(72),s=TypeError;e.exports=function(e){if(n(e))return e;throw s(r(e)+" is not a function")}},e=>{var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},(e,t,i)=>{var n=i(48),r=i(61),s=i(60),a=TypeError;e.exports=function(e,t){var i,o;if("string"===t&&r(i=e.toString)&&!s(o=n(i,e)))return o;if(r(i=e.valueOf)&&!s(o=n(i,e)))return o;if("string"!==t&&r(i=e.toString)&&!s(o=n(i,e)))return o;throw a("Can't convert object to primitive value")}},(e,t,i)=>{var n=i(44),r=i(75),s=i(79),a=i(81),o=i(67),l=i(66),c=n.Symbol,d=r("wks"),h=l?c.for||c:c&&c.withoutSetter||a;e.exports=function(e){s(d,e)||(d[e]=o&&s(c,e)?c[e]:h("Symbol."+e));return d[e]}},(e,t,i)=>{var n=i(76),r=i(77);(e.exports=function(e,t){return r[e]||(r[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.30.0",mode:n?"pure":"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.30.0/LICENSE",source:"https://github.com/zloirock/core-js"})},e=>{e.exports=!1},(e,t,i)=>{var n=i(44),r=i(78),s="__core-js_shared__",a=n[s]||r(s,{});e.exports=a},(e,t,i)=>{var n=i(44),r=Object.defineProperty;e.exports=function(e,t){try{r(n,e,{value:t,configurable:!0,writable:!0})}catch(i){n[e]=t}return t}},(e,t,i)=>{var n=i(54),r=i(80),s=n({}.hasOwnProperty);e.exports=Object.hasOwn||function hasOwn(e,t){return s(r(e),t)}},(e,t,i)=>{var n=i(56),r=Object;e.exports=function(e){return r(n(e))}},(e,t,i)=>{var n=i(54),r=0,s=Math.random(),a=n(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+a(++r+s,36)}},(e,t,i)=>{var n=i(46),r=i(47),s=i(83);e.exports=!n&&!r((function(){return 7!=Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a}))},(e,t,i)=>{var n=i(44),r=i(60),s=n.document,a=r(s)&&r(s.createElement);e.exports=function(e){return a?s.createElement(e):{}}},(e,t,i)=>{var n=i(46),r=i(85),s=i(51);e.exports=n?function(e,t,i){return r.f(e,t,s(1,i))}:function(e,t,i){e[t]=i;return e}},(e,t,i)=>{var n=i(46),r=i(82),s=i(86),a=i(87),o=i(58),l=TypeError,c=Object.defineProperty,d=Object.getOwnPropertyDescriptor,h="enumerable",u="configurable",p="writable";t.f=n?s?function defineProperty(e,t,i){a(e);t=o(t);a(i);if("function"==typeof e&&"prototype"===t&&"value"in i&&p in i&&!i[p]){var n=d(e,t);if(n&&n[p]){e[t]=i.value;i={configurable:u in i?i[u]:n[u],enumerable:h in i?i[h]:n[h],writable:!1}}}return c(e,t,i)}:c:function defineProperty(e,t,i){a(e);t=o(t);a(i);if(r)try{return c(e,t,i)}catch(e){}if("get"in i||"set"in i)throw l("Accessors not supported");"value"in i&&(e[t]=i.value);return e}},(e,t,i)=>{var n=i(46),r=i(47);e.exports=n&&r((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},(e,t,i)=>{var n=i(60),r=String,s=TypeError;e.exports=function(e){if(n(e))return e;throw s(r(e)+" is not an object")}},(e,t,i)=>{var n=i(61),r=i(85),s=i(89),a=i(78);e.exports=function(e,t,i,o){o||(o={});var l=o.enumerable,c=void 0!==o.name?o.name:t;n(i)&&s(i,c,o);if(o.global)l?e[t]=i:a(t,i);else{try{o.unsafe?e[t]&&(l=!0):delete e[t]}catch(e){}l?e[t]=i:r.f(e,t,{value:i,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return e}},(e,t,i)=>{var n=i(54),r=i(47),s=i(61),a=i(79),o=i(46),l=i(90).CONFIGURABLE,c=i(91),d=i(92),h=d.enforce,u=d.get,p=String,g=Object.defineProperty,f=n("".slice),m=n("".replace),v=n([].join),b=o&&!r((function(){return 8!==g((function(){}),"length",{value:8}).length})),y=String(String).split("String"),w=e.exports=function(e,t,i){"Symbol("===f(p(t),0,7)&&(t="["+m(p(t),/^Symbol\(([^)]*)\)/,"$1")+"]");i&&i.getter&&(t="get "+t);i&&i.setter&&(t="set "+t);(!a(e,"name")||l&&e.name!==t)&&(o?g(e,"name",{value:t,configurable:!0}):e.name=t);b&&i&&a(i,"arity")&&e.length!==i.arity&&g(e,"length",{value:i.arity});try{i&&a(i,"constructor")&&i.constructor?o&&g(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var n=h(e);a(n,"source")||(n.source=v(y,"string"==typeof t?t:""));return e};Function.prototype.toString=w((function toString(){return s(this)&&u(this).source||c(this)}),"toString")},(e,t,i)=>{var n=i(46),r=i(79),s=Function.prototype,a=n&&Object.getOwnPropertyDescriptor,o=r(s,"name"),l=o&&"something"===function something(){}.name,c=o&&(!n||n&&a(s,"name").configurable);e.exports={EXISTS:o,PROPER:l,CONFIGURABLE:c}},(e,t,i)=>{var n=i(54),r=i(61),s=i(77),a=n(Function.toString);r(s.inspectSource)||(s.inspectSource=function(e){return a(e)});e.exports=s.inspectSource},(e,t,i)=>{var n,r,s,a=i(93),o=i(44),l=i(60),c=i(84),d=i(79),h=i(77),u=i(94),p=i(95),g="Object already initialized",f=o.TypeError,m=o.WeakMap;if(a||h.state){var v=h.state||(h.state=new m);v.get=v.get;v.has=v.has;v.set=v.set;n=function(e,t){if(v.has(e))throw f(g);t.facade=e;v.set(e,t);return t};r=function(e){return v.get(e)||{}};s=function(e){return v.has(e)}}else{var b=u("state");p[b]=!0;n=function(e,t){if(d(e,b))throw f(g);t.facade=e;c(e,b,t);return t};r=function(e){return d(e,b)?e[b]:{}};s=function(e){return d(e,b)}}e.exports={set:n,get:r,has:s,enforce:function(e){return s(e)?r(e):n(e,{})},getterFor:function(e){return function(t){var i;if(!l(t)||(i=r(t)).type!==e)throw f("Incompatible receiver, "+e+" required");return i}}}},(e,t,i)=>{var n=i(44),r=i(61),s=n.WeakMap;e.exports=r(s)&&/native code/.test(String(s))},(e,t,i)=>{var n=i(75),r=i(81),s=n("keys");e.exports=function(e){return s[e]||(s[e]=r(e))}},e=>{e.exports={}},(e,t,i)=>{var n=i(79),r=i(97),s=i(45),a=i(85);e.exports=function(e,t,i){for(var o=r(t),l=a.f,c=s.f,d=0;d<o.length;d++){var h=o[d];n(e,h)||i&&n(i,h)||l(e,h,c(t,h))}}},(e,t,i)=>{var n=i(64),r=i(54),s=i(98),a=i(107),o=i(87),l=r([].concat);e.exports=n("Reflect","ownKeys")||function ownKeys(e){var t=s.f(o(e)),i=a.f;return i?l(t,i(e)):t}},(e,t,i)=>{var n=i(99),r=i(106).concat("length","prototype");t.f=Object.getOwnPropertyNames||function getOwnPropertyNames(e){return n(e,r)}},(e,t,i)=>{var n=i(54),r=i(79),s=i(52),a=i(100).indexOf,o=i(95),l=n([].push);e.exports=function(e,t){var i,n=s(e),c=0,d=[];for(i in n)!r(o,i)&&r(n,i)&&l(d,i);for(;t.length>c;)r(n,i=t[c++])&&(~a(d,i)||l(d,i));return d}},(e,t,i)=>{var n=i(52),r=i(101),s=i(104),createMethod=function(e){return function(t,i,a){var o,l=n(t),c=s(l),d=r(a,c);if(e&&i!=i){for(;c>d;)if((o=l[d++])!=o)return!0}else for(;c>d;d++)if((e||d in l)&&l[d]===i)return e||d||0;return!e&&-1}};e.exports={includes:createMethod(!0),indexOf:createMethod(!1)}},(e,t,i)=>{var n=i(102),r=Math.max,s=Math.min;e.exports=function(e,t){var i=n(e);return i<0?r(i+t,0):s(i,t)}},(e,t,i)=>{var n=i(103);e.exports=function(e){var t=+e;return t!=t||0===t?0:n(t)}},e=>{var t=Math.ceil,i=Math.floor;e.exports=Math.trunc||function trunc(e){var n=+e;return(n>0?i:t)(n)}},(e,t,i)=>{var n=i(105);e.exports=function(e){return n(e.length)}},(e,t,i)=>{var n=i(102),r=Math.min;e.exports=function(e){return e>0?r(n(e),9007199254740991):0}},e=>{e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},(e,t)=>{t.f=Object.getOwnPropertySymbols},(e,t,i)=>{var n=i(47),r=i(61),s=/#|\.prototype\./,isForced=function(e,t){var i=o[a(e)];return i==c||i!=l&&(r(t)?n(t):!!t)},a=isForced.normalize=function(e){return String(e).replace(s,".").toLowerCase()},o=isForced.data={},l=isForced.NATIVE="N",c=isForced.POLYFILL="P";e.exports=isForced},(e,t,i)=>{var n=i(74),r=i(110),s=i(85).f,a=n("unscopables"),o=Array.prototype;null==o[a]&&s(o,a,{configurable:!0,value:r(null)});e.exports=function(e){o[a][e]=!0}},(e,t,i)=>{var n,r=i(87),s=i(111),a=i(106),o=i(95),l=i(113),c=i(83),d=i(94),h="prototype",u="script",p=d("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(e){return"<"+u+">"+e+"</"+u+">"},NullProtoObjectViaActiveX=function(e){e.write(scriptTag(""));e.close();var t=e.parentWindow.Object;e=null;return t},NullProtoObject=function(){try{n=new ActiveXObject("htmlfile")}catch(e){}NullProtoObject="undefined"!=typeof document?document.domain&&n?NullProtoObjectViaActiveX(n):function(){var e,t=c("iframe"),i="java"+u+":";t.style.display="none";l.appendChild(t);t.src=String(i);(e=t.contentWindow.document).open();e.write(scriptTag("document.F=Object"));e.close();return e.F}():NullProtoObjectViaActiveX(n);for(var e=a.length;e--;)delete NullProtoObject[h][a[e]];return NullProtoObject()};o[p]=!0;e.exports=Object.create||function create(e,t){var i;if(null!==e){EmptyConstructor[h]=r(e);i=new EmptyConstructor;EmptyConstructor[h]=null;i[p]=e}else i=NullProtoObject();return void 0===t?i:s.f(i,t)}},(e,t,i)=>{var n=i(46),r=i(86),s=i(85),a=i(87),o=i(52),l=i(112);t.f=n&&!r?Object.defineProperties:function defineProperties(e,t){a(e);for(var i,n=o(t),r=l(t),c=r.length,d=0;c>d;)s.f(e,i=r[d++],n[i]);return e}},(e,t,i)=>{var n=i(99),r=i(106);e.exports=Object.keys||function keys(e){return n(e,r)}},(e,t,i)=>{var n=i(64);e.exports=n("document","documentElement")},(e,t,i)=>{var n=i(44),r=i(54);e.exports=function(e,t){return r(n[e].prototype[t])}},(e,t,i)=>{i(116)},(e,t,i)=>{"use strict";var n=i(117),r=i(104),s=i(102),a=n.aTypedArray;(0,n.exportTypedArrayMethod)("at",(function at(e){var t=a(this),i=r(t),n=s(e),o=n>=0?n:i+n;return o<0||o>=i?void 0:t[o]}))},(e,t,i)=>{"use strict";var n,r,s,a=i(118),o=i(46),l=i(44),c=i(61),d=i(60),h=i(79),u=i(119),p=i(72),g=i(84),f=i(88),m=i(121),v=i(65),b=i(122),y=i(124),w=i(74),_=i(81),S=i(92),P=S.enforce,A=S.get,E=l.Int8Array,x=E&&E.prototype,C=l.Uint8ClampedArray,T=C&&C.prototype,M=E&&b(E),I=x&&b(x),k=Object.prototype,D=l.TypeError,L=w("toStringTag"),R=_("TYPED_ARRAY_TAG"),O="TypedArrayConstructor",N=a&&!!y&&"Opera"!==u(l.opera),B=!1,V={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},U={BigInt64Array:8,BigUint64Array:8},getTypedArrayConstructor=function(e){var t=b(e);if(d(t)){var i=A(t);return i&&h(i,O)?i[O]:getTypedArrayConstructor(t)}},isTypedArray=function(e){if(!d(e))return!1;var t=u(e);return h(V,t)||h(U,t)};for(n in V)(s=(r=l[n])&&r.prototype)?P(s)[O]=r:N=!1;for(n in U)(s=(r=l[n])&&r.prototype)&&(P(s)[O]=r);if(!N||!c(M)||M===Function.prototype){M=function TypedArray(){throw D("Incorrect invocation")};if(N)for(n in V)l[n]&&y(l[n],M)}if(!N||!I||I===k){I=M.prototype;if(N)for(n in V)l[n]&&y(l[n].prototype,I)}N&&b(T)!==I&&y(T,I);if(o&&!h(I,L)){B=!0;m(I,L,{configurable:!0,get:function(){return d(this)?this[R]:void 0}});for(n in V)l[n]&&g(l[n],R,n)}e.exports={NATIVE_ARRAY_BUFFER_VIEWS:N,TYPED_ARRAY_TAG:B&&R,aTypedArray:function(e){if(isTypedArray(e))return e;throw D("Target is not a typed array")},aTypedArrayConstructor:function(e){if(c(e)&&(!y||v(M,e)))return e;throw D(p(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,i,n){if(o){if(i)for(var r in V){var s=l[r];if(s&&h(s.prototype,e))try{delete s.prototype[e]}catch(i){try{s.prototype[e]=t}catch(e){}}}I[e]&&!i||f(I,e,i?t:N&&x[e]||t,n)}},exportTypedArrayStaticMethod:function(e,t,i){var n,r;if(o){if(y){if(i)for(n in V)if((r=l[n])&&h(r,e))try{delete r[e]}catch(e){}if(M[e]&&!i)return;try{return f(M,e,i?t:N&&M[e]||t)}catch(e){}}for(n in V)!(r=l[n])||r[e]&&!i||f(r,e,t)}},getTypedArrayConstructor:getTypedArrayConstructor,isView:function isView(e){if(!d(e))return!1;var t=u(e);return"DataView"===t||h(V,t)||h(U,t)},isTypedArray:isTypedArray,TypedArray:M,TypedArrayPrototype:I}},e=>{e.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},(e,t,i)=>{var n=i(120),r=i(61),s=i(55),a=i(74)("toStringTag"),o=Object,l="Arguments"==s(function(){return arguments}());e.exports=n?s:function(e){var t,i,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(e){}}(t=o(e),a))?i:l?s(t):"Object"==(n=s(t))&&r(t.callee)?"Arguments":n}},(e,t,i)=>{var n={};n[i(74)("toStringTag")]="z";e.exports="[object z]"===String(n)},(e,t,i)=>{var n=i(89),r=i(85);e.exports=function(e,t,i){i.get&&n(i.get,t,{getter:!0});i.set&&n(i.set,t,{setter:!0});return r.f(e,t,i)}},(e,t,i)=>{var n=i(79),r=i(61),s=i(80),a=i(94),o=i(123),l=a("IE_PROTO"),c=Object,d=c.prototype;e.exports=o?c.getPrototypeOf:function(e){var t=s(e);if(n(t,l))return t[l];var i=t.constructor;return r(i)&&t instanceof i?i.prototype:t instanceof c?d:null}},(e,t,i)=>{var n=i(47);e.exports=!n((function(){function F(){}F.prototype.constructor=null;return Object.getPrototypeOf(new F)!==F.prototype}))},(e,t,i)=>{var n=i(125),r=i(87),s=i(126);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,i={};try{(e=n(Object.prototype,"__proto__","set"))(i,[]);t=i instanceof Array}catch(e){}return function setPrototypeOf(i,n){r(i);s(n);t?e(i,n):i.__proto__=n;return i}}():void 0)},(e,t,i)=>{var n=i(54),r=i(71);e.exports=function(e,t,i){try{return n(r(Object.getOwnPropertyDescriptor(e,t)[i]))}catch(e){}}},(e,t,i)=>{var n=i(61),r=String,s=TypeError;e.exports=function(e){if("object"==typeof e||n(e))return e;throw s("Can't set "+r(e)+" as a prototype")}},(e,t,i)=>{i(128);i(135);i(137);i(160);i(162);var n=i(174);e.exports=n.structuredClone},(e,t,i)=>{"use strict";var n=i(52),r=i(109),s=i(129),a=i(92),o=i(85).f,l=i(130),c=i(134),d=i(76),h=i(46),u="Array Iterator",p=a.set,g=a.getterFor(u);e.exports=l(Array,"Array",(function(e,t){p(this,{type:u,target:n(e),index:0,kind:t})}),(function(){var e=g(this),t=e.target,i=e.kind,n=e.index++;if(!t||n>=t.length){e.target=void 0;return c(void 0,!0)}return c("keys"==i?n:"values"==i?t[n]:[n,t[n]],!1)}),"values");var f=s.Arguments=s.Array;r("keys");r("values");r("entries");if(!d&&h&&"values"!==f.name)try{o(f,"name",{value:"values"})}catch(e){}},e=>{e.exports={}},(e,t,i)=>{"use strict";var n=i(43),r=i(48),s=i(76),a=i(90),o=i(61),l=i(131),c=i(122),d=i(124),h=i(133),u=i(84),p=i(88),g=i(74),f=i(129),m=i(132),v=a.PROPER,b=a.CONFIGURABLE,y=m.IteratorPrototype,w=m.BUGGY_SAFARI_ITERATORS,_=g("iterator"),S="keys",P="values",A="entries",returnThis=function(){return this};e.exports=function(e,t,i,a,g,m,E){l(i,t,a);var x,C,T,getIterationMethod=function(e){if(e===g&&L)return L;if(!w&&e in k)return k[e];switch(e){case S:return function keys(){return new i(this,e)};case P:return function values(){return new i(this,e)};case A:return function entries(){return new i(this,e)}}return function(){return new i(this)}},M=t+" Iterator",I=!1,k=e.prototype,D=k[_]||k["@@iterator"]||g&&k[g],L=!w&&D||getIterationMethod(g),R="Array"==t&&k.entries||D;if(R&&(x=c(R.call(new e)))!==Object.prototype&&x.next){s||c(x)===y||(d?d(x,y):o(x[_])||p(x,_,returnThis));h(x,M,!0,!0);s&&(f[M]=returnThis)}if(v&&g==P&&D&&D.name!==P)if(!s&&b)u(k,"name",P);else{I=!0;L=function values(){return r(D,this)}}if(g){C={values:getIterationMethod(P),keys:m?L:getIterationMethod(S),entries:getIterationMethod(A)};if(E)for(T in C)(w||I||!(T in k))&&p(k,T,C[T]);else n({target:t,proto:!0,forced:w||I},C)}s&&!E||k[_]===L||p(k,_,L,{name:g});f[t]=L;return C}},(e,t,i)=>{"use strict";var n=i(132).IteratorPrototype,r=i(110),s=i(51),a=i(133),o=i(129),returnThis=function(){return this};e.exports=function(e,t,i,l){var c=t+" Iterator";e.prototype=r(n,{next:s(+!l,i)});a(e,c,!1,!0);o[c]=returnThis;return e}},(e,t,i)=>{"use strict";var n,r,s,a=i(47),o=i(61),l=i(60),c=i(110),d=i(122),h=i(88),u=i(74),p=i(76),g=u("iterator"),f=!1;[].keys&&("next"in(s=[].keys())?(r=d(d(s)))!==Object.prototype&&(n=r):f=!0);!l(n)||a((function(){var e={};return n[g].call(e)!==e}))?n={}:p&&(n=c(n));o(n[g])||h(n,g,(function(){return this}));e.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:f}},(e,t,i)=>{var n=i(85).f,r=i(79),s=i(74)("toStringTag");e.exports=function(e,t,i){e&&!i&&(e=e.prototype);e&&!r(e,s)&&n(e,s,{configurable:!0,value:t})}},e=>{e.exports=function(e,t){return{value:e,done:t}}},(e,t,i)=>{var n=i(120),r=i(88),s=i(136);n||r(Object.prototype,"toString",s,{unsafe:!0})},(e,t,i)=>{"use strict";var n=i(120),r=i(119);e.exports=n?{}.toString:function toString(){return"[object "+r(this)+"]"}},(e,t,i)=>{i(138)},(e,t,i)=>{"use strict";i(139)("Map",(function(e){return function Map(){return e(this,arguments.length?arguments[0]:void 0)}}),i(157))},(e,t,i)=>{"use strict";var n=i(43),r=i(44),s=i(54),a=i(108),o=i(88),l=i(140),c=i(147),d=i(154),h=i(61),u=i(57),p=i(60),g=i(47),f=i(155),m=i(133),v=i(156);e.exports=function(e,t,i){var b=-1!==e.indexOf("Map"),y=-1!==e.indexOf("Weak"),w=b?"set":"add",_=r[e],S=_&&_.prototype,P=_,A={},fixMethod=function(e){var t=s(S[e]);o(S,e,"add"==e?function add(e){t(this,0===e?0:e);return this}:"delete"==e?function(e){return!(y&&!p(e))&&t(this,0===e?0:e)}:"get"==e?function get(e){return y&&!p(e)?void 0:t(this,0===e?0:e)}:"has"==e?function has(e){return!(y&&!p(e))&&t(this,0===e?0:e)}:function set(e,i){t(this,0===e?0:e,i);return this})};if(a(e,!h(_)||!(y||S.forEach&&!g((function(){(new _).entries().next()}))))){P=i.getConstructor(t,e,b,w);l.enable()}else if(a(e,!0)){var E=new P,x=E[w](y?{}:-0,1)!=E,C=g((function(){E.has(1)})),T=f((function(e){new _(e)})),M=!y&&g((function(){for(var e=new _,t=5;t--;)e[w](t,t);return!e.has(-0)}));if(!T){(P=t((function(e,t){d(e,S);var i=v(new _,e,P);u(t)||c(t,i[w],{that:i,AS_ENTRIES:b});return i}))).prototype=S;S.constructor=P}if(C||M){fixMethod("delete");fixMethod("has");b&&fixMethod("get")}(M||x)&&fixMethod(w);y&&S.clear&&delete S.clear}A[e]=P;n({global:!0,constructor:!0,forced:P!=_},A);m(P,e);y||i.setStrong(P,e,b);return P}},(e,t,i)=>{var n=i(43),r=i(54),s=i(95),a=i(60),o=i(79),l=i(85).f,c=i(98),d=i(141),h=i(144),u=i(81),p=i(146),g=!1,f=u("meta"),m=0,setMetadata=function(e){l(e,f,{value:{objectID:"O"+m++,weakData:{}}})},v=e.exports={enable:function(){v.enable=function(){};g=!0;var e=c.f,t=r([].splice),i={};i[f]=1;if(e(i).length){c.f=function(i){for(var n=e(i),r=0,s=n.length;r<s;r++)if(n[r]===f){t(n,r,1);break}return n};n({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:d.f})}},fastKey:function(e,t){if(!a(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!o(e,f)){if(!h(e))return"F";if(!t)return"E";setMetadata(e)}return e[f].objectID},getWeakData:function(e,t){if(!o(e,f)){if(!h(e))return!0;if(!t)return!1;setMetadata(e)}return e[f].weakData},onFreeze:function(e){p&&g&&h(e)&&!o(e,f)&&setMetadata(e);return e}};s[f]=!0},(e,t,i)=>{var n=i(55),r=i(52),s=i(98).f,a=i(142),o="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function getOwnPropertyNames(e){return o&&"Window"==n(e)?function(e){try{return s(e)}catch(e){return a(o)}}(e):s(r(e))}},(e,t,i)=>{var n=i(101),r=i(104),s=i(143),a=Array,o=Math.max;e.exports=function(e,t,i){for(var l=r(e),c=n(t,l),d=n(void 0===i?l:i,l),h=a(o(d-c,0)),u=0;c<d;c++,u++)s(h,u,e[c]);h.length=u;return h}},(e,t,i)=>{"use strict";var n=i(58),r=i(85),s=i(51);e.exports=function(e,t,i){var a=n(t);a in e?r.f(e,a,s(0,i)):e[a]=i}},(e,t,i)=>{var n=i(47),r=i(60),s=i(55),a=i(145),o=Object.isExtensible,l=n((function(){o(1)}));e.exports=l||a?function isExtensible(e){return!!r(e)&&((!a||"ArrayBuffer"!=s(e))&&(!o||o(e)))}:o},(e,t,i)=>{var n=i(47);e.exports=n((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}}))},(e,t,i)=>{var n=i(47);e.exports=!n((function(){return Object.isExtensible(Object.preventExtensions({}))}))},(e,t,i)=>{var n=i(148),r=i(48),s=i(87),a=i(72),o=i(150),l=i(104),c=i(65),d=i(151),h=i(152),u=i(153),p=TypeError,Result=function(e,t){this.stopped=e;this.result=t},g=Result.prototype;e.exports=function(e,t,i){var f,m,v,b,y,w,_,S=i&&i.that,P=!(!i||!i.AS_ENTRIES),A=!(!i||!i.IS_RECORD),E=!(!i||!i.IS_ITERATOR),x=!(!i||!i.INTERRUPTED),C=n(t,S),stop=function(e){f&&u(f,"normal",e);return new Result(!0,e)},callFn=function(e){if(P){s(e);return x?C(e[0],e[1],stop):C(e[0],e[1])}return x?C(e,stop):C(e)};if(A)f=e.iterator;else if(E)f=e;else{if(!(m=h(e)))throw p(a(e)+" is not iterable");if(o(m)){for(v=0,b=l(e);b>v;v++)if((y=callFn(e[v]))&&c(g,y))return y;return new Result(!1)}f=d(e,m)}w=A?e.next:f.next;for(;!(_=r(w,f)).done;){try{y=callFn(_.value)}catch(e){u(f,"throw",e)}if("object"==typeof y&&y&&c(g,y))return y}return new Result(!1)}},(e,t,i)=>{var n=i(149),r=i(71),s=i(49),a=n(n.bind);e.exports=function(e,t){r(e);return void 0===t?e:s?a(e,t):function(){return e.apply(t,arguments)}}},(e,t,i)=>{var n=i(55),r=i(54);e.exports=function(e){if("Function"===n(e))return r(e)}},(e,t,i)=>{var n=i(74),r=i(129),s=n("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||a[s]===e)}},(e,t,i)=>{var n=i(48),r=i(71),s=i(87),a=i(72),o=i(152),l=TypeError;e.exports=function(e,t){var i=arguments.length<2?o(e):t;if(r(i))return s(n(i,e));throw l(a(e)+" is not iterable")}},(e,t,i)=>{var n=i(119),r=i(70),s=i(57),a=i(129),o=i(74)("iterator");e.exports=function(e){if(!s(e))return r(e,o)||r(e,"@@iterator")||a[n(e)]}},(e,t,i)=>{var n=i(48),r=i(87),s=i(70);e.exports=function(e,t,i){var a,o;r(e);try{if(!(a=s(e,"return"))){if("throw"===t)throw i;return i}a=n(a,e)}catch(e){o=!0;a=e}if("throw"===t)throw i;if(o)throw a;r(a);return i}},(e,t,i)=>{var n=i(65),r=TypeError;e.exports=function(e,t){if(n(t,e))return e;throw r("Incorrect invocation")}},(e,t,i)=>{var n=i(74)("iterator"),r=!1;try{var s=0,a={next:function(){return{done:!!s++}},return:function(){r=!0}};a[n]=function(){return this};Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!r)return!1;var i=!1;try{var s={};s[n]=function(){return{next:function(){return{done:i=!0}}}};e(s)}catch(e){}return i}},(e,t,i)=>{var n=i(61),r=i(60),s=i(124);e.exports=function(e,t,i){var a,o;s&&n(a=t.constructor)&&a!==i&&r(o=a.prototype)&&o!==i.prototype&&s(e,o);return e}},(e,t,i)=>{"use strict";var n=i(110),r=i(121),s=i(158),a=i(148),o=i(154),l=i(57),c=i(147),d=i(130),h=i(134),u=i(159),p=i(46),g=i(140).fastKey,f=i(92),m=f.set,v=f.getterFor;e.exports={getConstructor:function(e,t,i,d){var h=e((function(e,r){o(e,u);m(e,{type:t,index:n(null),first:void 0,last:void 0,size:0});p||(e.size=0);l(r)||c(r,e[d],{that:e,AS_ENTRIES:i})})),u=h.prototype,f=v(t),define=function(e,t,i){var n,r,s=f(e),a=getEntry(e,t);if(a)a.value=i;else{s.last=a={index:r=g(t,!0),key:t,value:i,previous:n=s.last,next:void 0,removed:!1};s.first||(s.first=a);n&&(n.next=a);p?s.size++:e.size++;"F"!==r&&(s.index[r]=a)}return e},getEntry=function(e,t){var i,n=f(e),r=g(t);if("F"!==r)return n.index[r];for(i=n.first;i;i=i.next)if(i.key==t)return i};s(u,{clear:function clear(){for(var e=f(this),t=e.index,i=e.first;i;){i.removed=!0;i.previous&&(i.previous=i.previous.next=void 0);delete t[i.index];i=i.next}e.first=e.last=void 0;p?e.size=0:this.size=0},delete:function(e){var t=this,i=f(t),n=getEntry(t,e);if(n){var r=n.next,s=n.previous;delete i.index[n.index];n.removed=!0;s&&(s.next=r);r&&(r.previous=s);i.first==n&&(i.first=r);i.last==n&&(i.last=s);p?i.size--:t.size--}return!!n},forEach:function forEach(e){for(var t,i=f(this),n=a(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:i.first;){n(t.value,t.key,this);for(;t&&t.removed;)t=t.previous}},has:function has(e){return!!getEntry(this,e)}});s(u,i?{get:function get(e){var t=getEntry(this,e);return t&&t.value},set:function set(e,t){return define(this,0===e?0:e,t)}}:{add:function add(e){return define(this,e=0===e?0:e,e)}});p&&r(u,"size",{configurable:!0,get:function(){return f(this).size}});return h},setStrong:function(e,t,i){var n=t+" Iterator",r=v(t),s=v(n);d(e,t,(function(e,t){m(this,{type:n,target:e,state:r(e),kind:t,last:void 0})}),(function(){for(var e=s(this),t=e.kind,i=e.last;i&&i.removed;)i=i.previous;if(!e.target||!(e.last=i=i?i.next:e.state.first)){e.target=void 0;return h(void 0,!0)}return h("keys"==t?i.key:"values"==t?i.value:[i.key,i.value],!1)}),i?"entries":"values",!i,!0);u(t)}}},(e,t,i)=>{var n=i(88);e.exports=function(e,t,i){for(var r in t)n(e,r,t[r],i);return e}},(e,t,i)=>{"use strict";var n=i(64),r=i(121),s=i(74),a=i(46),o=s("species");e.exports=function(e){var t=n(e);a&&t&&!t[o]&&r(t,o,{configurable:!0,get:function(){return this}})}},(e,t,i)=>{i(161)},(e,t,i)=>{"use strict";i(139)("Set",(function(e){return function Set(){return e(this,arguments.length?arguments[0]:void 0)}}),i(157))},(e,t,i)=>{var n,r=i(76),s=i(43),a=i(44),o=i(64),l=i(54),c=i(47),d=i(81),h=i(61),u=i(163),p=i(57),g=i(60),f=i(63),m=i(147),v=i(87),b=i(119),y=i(79),w=i(143),_=i(84),S=i(104),P=i(164),A=i(165),E=i(167),x=i(168),C=i(169),T=i(170),M=a.Object,I=a.Array,k=a.Date,D=a.Error,L=a.EvalError,R=a.RangeError,O=a.ReferenceError,N=a.SyntaxError,B=a.TypeError,V=a.URIError,U=a.PerformanceMark,j=a.WebAssembly,H=j&&j.CompileError||D,W=j&&j.LinkError||D,z=j&&j.RuntimeError||D,G=o("DOMException"),q=E.Map,$=E.has,X=E.get,K=E.set,Y=x.Set,Q=x.add,Z=o("Object","keys"),J=l([].push),ee=l((!0).valueOf),te=l(1..valueOf),ie=l("".valueOf),ne=l(k.prototype.getTime),re=d("structuredClone"),se="DataCloneError",ae="Transferring",checkBasicSemantic=function(e){return!c((function(){var t=new a.Set([7]),i=e(t),n=e(M(7));return i==t||!i.has(7)||"object"!=typeof n||7!=n}))&&e},checkErrorsCloning=function(e,t){return!c((function(){var i=new t,n=e({a:i,b:i});return!(n&&n.a===n.b&&n.a instanceof t&&n.a.stack===i.stack)}))},oe=a.structuredClone,le=r||!checkErrorsCloning(oe,D)||!checkErrorsCloning(oe,G)||!(n=oe,!c((function(){var e=n(new a.AggregateError([1],re,{cause:3}));return"AggregateError"!=e.name||1!=e.errors[0]||e.message!=re||3!=e.cause}))),ce=!oe&&checkBasicSemantic((function(e){return new U(re,{detail:e}).detail})),de=checkBasicSemantic(oe)||ce,throwUncloneable=function(e){throw new G("Uncloneable type: "+e,se)},throwUnpolyfillable=function(e,t){throw new G((t||"Cloning")+" of "+e+" cannot be properly polyfilled in this engine",se)},structuredCloneInternal=function(e,t){f(e)&&throwUncloneable("Symbol");if(!g(e))return e;if(t){if($(t,e))return X(t,e)}else t=new q;var i,n,r,s,l,c,d,u,p,m,v,P=b(e),E=!1;switch(P){case"Array":r=I(S(e));E=!0;break;case"Object":r={};E=!0;break;case"Map":r=new q;E=!0;break;case"Set":r=new Y;E=!0;break;case"RegExp":r=new RegExp(e.source,A(e));break;case"Error":switch(n=e.name){case"AggregateError":r=o("AggregateError")([]);break;case"EvalError":r=L();break;case"RangeError":r=R();break;case"ReferenceError":r=O();break;case"SyntaxError":r=N();break;case"TypeError":r=B();break;case"URIError":r=V();break;case"CompileError":r=H();break;case"LinkError":r=W();break;case"RuntimeError":r=z();break;default:r=D()}E=!0;break;case"DOMException":r=new G(e.message,e.name);E=!0;break;case"DataView":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"BigInt64Array":case"BigUint64Array":i=a[P];g(i)||throwUnpolyfillable(P);r=new i(structuredCloneInternal(e.buffer,t),e.byteOffset,"DataView"===P?e.byteLength:e.length);break;case"DOMQuad":try{r=new DOMQuad(structuredCloneInternal(e.p1,t),structuredCloneInternal(e.p2,t),structuredCloneInternal(e.p3,t),structuredCloneInternal(e.p4,t))}catch(t){de?r=de(e):throwUnpolyfillable(P)}break;case"FileList":if(s=function(){var e;try{e=new a.DataTransfer}catch(t){try{e=new a.ClipboardEvent("").clipboardData}catch(e){}}return e&&e.items&&e.files?e:null}()){for(l=0,c=S(e);l<c;l++)s.items.add(structuredCloneInternal(e[l],t));r=s.files}else de?r=de(e):throwUnpolyfillable(P);break;case"ImageData":try{r=new ImageData(structuredCloneInternal(e.data,t),e.width,e.height,{colorSpace:e.colorSpace})}catch(t){de?r=de(e):throwUnpolyfillable(P)}break;default:if(de)r=de(e);else switch(P){case"BigInt":r=M(e.valueOf());break;case"Boolean":r=M(ee(e));break;case"Number":r=M(te(e));break;case"String":r=M(ie(e));break;case"Date":r=new k(ne(e));break;case"ArrayBuffer":(i=a.DataView)||"function"==typeof e.slice||throwUnpolyfillable(P);try{if("function"!=typeof e.slice||e.resizable){c=e.byteLength;v="maxByteLength"in e?{maxByteLength:e.maxByteLength}:void 0;r=new ArrayBuffer(c,v);p=new i(e);m=new i(r);for(l=0;l<c;l++)m.setUint8(l,p.getUint8(l))}else r=e.slice(0)}catch(e){throw new G("ArrayBuffer is detached",se)}break;case"SharedArrayBuffer":r=e;break;case"Blob":try{r=e.slice(0,e.size,e.type)}catch(e){throwUnpolyfillable(P)}break;case"DOMPoint":case"DOMPointReadOnly":i=a[P];try{r=i.fromPoint?i.fromPoint(e):new i(e.x,e.y,e.z,e.w)}catch(e){throwUnpolyfillable(P)}break;case"DOMRect":case"DOMRectReadOnly":i=a[P];try{r=i.fromRect?i.fromRect(e):new i(e.x,e.y,e.width,e.height)}catch(e){throwUnpolyfillable(P)}break;case"DOMMatrix":case"DOMMatrixReadOnly":i=a[P];try{r=i.fromMatrix?i.fromMatrix(e):new i(e)}catch(e){throwUnpolyfillable(P)}break;case"AudioData":case"VideoFrame":h(e.clone)||throwUnpolyfillable(P);try{r=e.clone()}catch(e){throwUncloneable(P)}break;case"File":try{r=new File([e],e.name,e)}catch(e){throwUnpolyfillable(P)}break;case"CropTarget":case"CryptoKey":case"FileSystemDirectoryHandle":case"FileSystemFileHandle":case"FileSystemHandle":case"GPUCompilationInfo":case"GPUCompilationMessage":case"ImageBitmap":case"RTCCertificate":case"WebAssembly.Module":throwUnpolyfillable(P);default:throwUncloneable(P)}}K(t,e,r);if(E)switch(P){case"Array":case"Object":d=Z(e);for(l=0,c=S(d);l<c;l++){u=d[l];w(r,u,structuredCloneInternal(e[u],t))}break;case"Map":e.forEach((function(e,i){K(r,structuredCloneInternal(i,t),structuredCloneInternal(e,t))}));break;case"Set":e.forEach((function(e){Q(r,structuredCloneInternal(e,t))}));break;case"Error":_(r,"message",structuredCloneInternal(e.message,t));y(e,"cause")&&_(r,"cause",structuredCloneInternal(e.cause,t));"AggregateError"==n&&(r.errors=structuredCloneInternal(e.errors,t));case"DOMException":C&&_(r,"stack",structuredCloneInternal(e.stack,t))}return r};s({global:!0,enumerable:!0,sham:!T,forced:le},{structuredClone:function structuredClone(e){var t,i=P(arguments.length,1)>1&&!p(arguments[1])?v(arguments[1]):void 0,n=i?i.transfer:void 0;void 0!==n&&function(e,t){if(!g(e))throw B("Transfer option cannot be converted to a sequence");var i=[];m(e,(function(e){J(i,v(e))}));var n,r,s,o,l,c,d=0,p=S(i);if(T){o=oe(i,{transfer:i});for(;d<p;)K(t,i[d],o[d++])}else for(;d<p;){n=i[d++];if($(t,n))throw new G("Duplicate transferable",se);switch(r=b(n)){case"ImageBitmap":s=a.OffscreenCanvas;u(s)||throwUnpolyfillable(r,ae);try{(c=new s(n.width,n.height)).getContext("bitmaprenderer").transferFromImageBitmap(n);l=c.transferToImageBitmap()}catch(e){}break;case"AudioData":case"VideoFrame":h(n.clone)&&h(n.close)||throwUnpolyfillable(r,ae);try{l=n.clone();n.close()}catch(e){}break;case"ArrayBuffer":h(n.transfer)||throwUnpolyfillable(r,ae);l=n.transfer();break;case"MediaSourceHandle":case"MessagePort":case"OffscreenCanvas":case"ReadableStream":case"TransformStream":case"WritableStream":throwUnpolyfillable(r,ae)}if(void 0===l)throw new G("This object cannot be transferred: "+r,se);K(t,n,l)}}(n,t=new q);return structuredCloneInternal(e,t)}})},(e,t,i)=>{var n=i(54),r=i(47),s=i(61),a=i(119),o=i(64),l=i(91),noop=function(){},c=[],d=o("Reflect","construct"),h=/^\s*(?:class|function)\b/,u=n(h.exec),p=!h.exec(noop),g=function isConstructor(e){if(!s(e))return!1;try{d(noop,c,e);return!0}catch(e){return!1}},f=function isConstructor(e){if(!s(e))return!1;switch(a(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return p||!!u(h,l(e))}catch(e){return!0}};f.sham=!0;e.exports=!d||r((function(){var e;return g(g.call)||!g(Object)||!g((function(){e=!0}))||e}))?f:g},e=>{var t=TypeError;e.exports=function(e,i){if(e<i)throw t("Not enough arguments");return e}},(e,t,i)=>{var n=i(48),r=i(79),s=i(65),a=i(166),o=RegExp.prototype;e.exports=function(e){var t=e.flags;return void 0!==t||"flags"in o||r(e,"flags")||!s(o,e)?t:n(a,e)}},(e,t,i)=>{"use strict";var n=i(87);e.exports=function(){var e=n(this),t="";e.hasIndices&&(t+="d");e.global&&(t+="g");e.ignoreCase&&(t+="i");e.multiline&&(t+="m");e.dotAll&&(t+="s");e.unicode&&(t+="u");e.unicodeSets&&(t+="v");e.sticky&&(t+="y");return t}},(e,t,i)=>{var n=i(54),r=Map.prototype;e.exports={Map:Map,set:n(r.set),get:n(r.get),has:n(r.has),remove:n(r.delete),proto:r}},(e,t,i)=>{var n=i(54),r=Set.prototype;e.exports={Set:Set,add:n(r.add),has:n(r.has),remove:n(r.delete),proto:r}},(e,t,i)=>{var n=i(47),r=i(51);e.exports=!n((function(){var e=Error("a");if(!("stack"in e))return!0;Object.defineProperty(e,"stack",r(1,7));return 7!==e.stack}))},(e,t,i)=>{var n=i(44),r=i(47),s=i(68),a=i(171),o=i(172),l=i(173),c=n.structuredClone;e.exports=!!c&&!r((function(){if(o&&s>92||l&&s>94||a&&s>97)return!1;var e=new ArrayBuffer(8),t=c(e,{transfer:[e]});return 0!=e.byteLength||8!=t.byteLength}))},(e,t,i)=>{var n=i(172),r=i(173);e.exports=!n&&!r&&"object"==typeof window&&"object"==typeof document},e=>{e.exports="object"==typeof Deno&&Deno&&"object"==typeof Deno.version},(e,t,i)=>{var n=i(55);e.exports="undefined"!=typeof process&&"process"==n(process)},(e,t,i)=>{var n=i(44);e.exports=n},(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.TextHighlighter=void 0;t.TextHighlighter=class TextHighlighter{constructor(e){let{findController:t,eventBus:i,pageIndex:n}=e;this.findController=t;this.matches=[];this.eventBus=i;this.pageIdx=n;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 r=0,s=0;const a=n.length-1,o=[];for(let l=0,c=e.length;l<c;l++){let c=e[l];for(;r!==a&&c>=s+n[r].length;){s+=n[r].length;r++}r===n.length&&globalThis.ngxConsole.error("Could not find a matching mapping");const d={color:i?i[l]:0,begin:{divIdx:r,offset:c-s}};c+=t[l];for(;r!==a&&c>s+n[r].length;){s+=n[r].length;r++}d.end={divIdx:r,offset:c-s};o.push(d)}return o}_renderMatches(e){if(0===e.length)return;const{findController:t,pageIdx:i}=this,{textContentItemsStr:n,textDivs:r}=this,s=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;r[i].textContent="";return appendTextToDiv(i,0,e.offset,t)}function appendTextToDiv(e,t,i,s){let a=r[e];if(a.nodeType===Node.TEXT_NODE){const t=document.createElement("span");a.before(t);t.append(a);r[e]=t;a=t}const o=n[e].substring(t,i),l=document.createTextNode(o);if(s){const e=document.createElement("span");e.className=`${s} appended`;e.append(l);a.append(e);return s.includes("selected")?e.offsetLeft:0}a.append(l);return 0}let c=a,d=c+1;if(t.state.highlightAll){c=0;d=e.length}else if(!s)return;let h=-1,u=-1;for(let n=c;n<d;n++){const c=e[n],d=c.begin;if(d.divIdx===h&&d.offset===u)continue;h=d.divIdx;u=d.offset;const p=c.end,g=s&&n===a,f=(g?" selected":"")+" color"+c.color%5;let m=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===p.divIdx)m=appendTextToDiv(d.divIdx,d.offset,p.offset,"highlight"+f);else{m=appendTextToDiv(d.divIdx,d.offset,l.offset,"highlight begin"+f);for(let e=d.divIdx+1,t=p.divIdx;e<t;e++)r[e].className="highlight middle"+f;beginText(p,"highlight end"+f)}o=p;g&&t.scrollMatchIntoView({element:r[d.divIdx],selectedLeft:m,pageIndex:i,matchIndex:a})}o&&appendTextToDiv(o.divIdx,o.offset,l.offset)}_updateMatches(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.enabled&&!e)return;const{findController:t,matches:i,pageIdx:n}=this,{textContentItemsStr:r,textDivs:s}=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=s[t];e.textContent=r[t];e.className=""}a=e.end.divIdx+1}if(null==t||!t.highlightMatches||e)return;const o=t.pageMatches[n]||null,l=t.pageMatchesLength[n]||null,c=t.pageMatchesColor[n]||null;this.matches=this._convertMatches(o,l,c);this._renderMatches(this.matches)}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.TextLayerBuilder=void 0;var n=i(4),r=i(3);t.TextLayerBuilder=class TextLayerBuilder{#bn=!1;#ur=0;#pr=0;#gr=null;constructor(e){let{highlighter:t=null,accessibilityManager:i=null,isOffscreenCanvasSupported:n=!0,enablePermissions:r=!1}=e;this.textContentItemsStr=[];this.renderingDone=!1;this.textDivs=[];this.textDivProperties=new WeakMap;this.textLayerRenderTask=null;this.highlighter=t;this.accessibilityManager=i;this.isOffscreenCanvasSupported=n;this.#bn=!0===r;this.div=document.createElement("div");this.div.className="textLayer";this.hide()}#fr(){this.renderingDone=!0;const e=document.createElement("div");e.className="endOfContent";this.div.append(e);this.#mr()}get numTextDivs(){return this.textDivs.length}async render(e){var t,i,r;if(!this.#gr)throw new Error('No "textContentSource" parameter specified.');const s=e.scale*(globalThis.devicePixelRatio||1),{rotation:a}=e;if(this.renderingDone){const t=a!==this.#ur,i=s!==this.#pr;if(t||i){this.hide();(0,n.updateTextLayer)({container:this.div,viewport:e,textDivs:this.textDivs,textDivProperties:this.textDivProperties,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported,mustRescale:i,mustRotate:t});this.#pr=s;this.#ur=a}this.show()}else{this.cancel();null===(t=this.highlighter)||void 0===t||t.setTextMapping(this.textDivs,this.textContentItemsStr);null===(i=this.accessibilityManager)||void 0===i||i.setTextMapping(this.textDivs);this.textLayerRenderTask=(0,n.renderTextLayer)({textContentSource:this.#gr,container:this.div,viewport:e,textDivs:this.textDivs,textDivProperties:this.textDivProperties,textContentItemsStr:this.textContentItemsStr,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported});await this.textLayerRenderTask.promise;this.#fr();this.#pr=s;this.#ur=a;this.show();null===(r=this.accessibilityManager)||void 0===r||r.enable()}}hide(){if(!this.div.hidden){var e;null===(e=this.highlighter)||void 0===e||e.disable();this.div.hidden=!0}}show(){if(this.div.hidden&&this.renderingDone){var e;this.div.hidden=!1;null===(e=this.highlighter)||void 0===e||e.enable()}}cancel(){var e,t;if(this.textLayerRenderTask){this.textLayerRenderTask.cancel();this.textLayerRenderTask=null}null===(e=this.highlighter)||void 0===e||e.disable();null===(t=this.accessibilityManager)||void 0===t||t.disable();this.textContentItemsStr.length=0;this.textDivs.length=0;this.textDivProperties=new WeakMap}setTextContentSource(e){this.cancel();this.#gr=e}#mr(){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(),r=Math.max(0,(t.pageY-n.top)/n.height);i.style.top=(100*r).toFixed(2)+"%"}i.classList.add("active")}));e.addEventListener("mouseup",(()=>{const t=e.querySelector(".endOfContent");if(t){t.style.top="";t.classList.remove("active")}}));e.addEventListener("copy",(e=>{if(!this.#bn){const t=document.getSelection();e.clipboardData.setData("text/plain",(0,r.removeNullCharacters)((0,n.normalizeUnicode)(t.toString())))}e.preventDefault();e.stopPropagation()}))}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.XfaLayerBuilder=void 0;var n=i(4);t.XfaLayerBuilder=class XfaLayerBuilder{constructor(e){let{pageDiv:t,pdfPage:i,annotationStorage:n=null,linkService:r,xfaHtml:s=null}=e;this.pageDiv=t;this.pdfPage=i;this.annotationStorage=n;this.linkService=r;this.xfaHtml=s;this.div=null;this._cancelled=!1}async render(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"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},r=document.createElement("div");this.pageDiv.append(r);i.div=r;return n.XfaLayer.render(i)}const i=await this.pdfPage.getXfa();if(this._cancelled||!i)return{textDivs:[]};const r={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(r);this.div=document.createElement("div");this.pageDiv.append(this.div);r.div=this.div;return n.XfaLayer.render(r)}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.SecondaryToolbar=void 0;var n=i(3),r=i(30);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.#vr();this.#br(e);this.#yr(e);this.#wr(e);this.reset()}get isOpen(){return this.opened}setPageNumber(e){this.pageNumber=e;this.#_r()}setPagesCount(e){this.pagesCount=e;this.#_r()}reset(){this.pageNumber=0;this.pagesCount=0;this.#_r();this.eventBus.dispatch("secondarytoolbarreset",{source:this})}#_r(){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})}#vr(){this.toggleButton.addEventListener("click",this.toggle.bind(this));for(const{element:e,eventName:t,close:i,eventDetails:n}of this.buttons)null==e||e.addEventListener("click",(r=>{null!==t&&this.eventBus.dispatch(t,{source:this,...n});i&&this.close();this.externalServices.reportTelemetry({type:"buttons",data:{id:e.id}})}))}#br(e){let{cursorSelectToolButton:t,cursorHandToolButton:i}=e;this.eventBus._on("cursortoolchanged",(e=>{let{tool:r}=e;(0,n.toggleCheckedBtn)(t,r===n.CursorTool.SELECT);(0,n.toggleCheckedBtn)(i,r===n.CursorTool.HAND)}))}#yr(e){let{scrollPageButton:t,scrollVerticalButton:i,scrollHorizontalButton:s,scrollWrappedButton:a,spreadNoneButton:o,spreadOddButton:l,spreadEvenButton:c}=e;const scrollModeChanged=e=>{let{mode:d}=e;(0,n.toggleCheckedBtn)(t,d===n.ScrollMode.PAGE);(0,n.toggleCheckedBtn)(i,d===n.ScrollMode.VERTICAL);(0,n.toggleCheckedBtn)(s,d===n.ScrollMode.HORIZONTAL);(0,n.toggleCheckedBtn)(a,d===n.ScrollMode.WRAPPED);const h=this.pagesCount>r.PagesCountLimit.FORCE_SCROLL_MODE_PAGE;t.disabled=h;i.disabled=h;s.disabled=h;a.disabled=h;const u=d===n.ScrollMode.HORIZONTAL;o.disabled=u;l.disabled=u;c.disabled=u};this.eventBus._on("scrollmodechanged",scrollModeChanged);this.eventBus._on("secondarytoolbarreset",(e=>{e.source===this&&scrollModeChanged({mode:n.ScrollMode.VERTICAL})}))}#wr(e){let{spreadNoneButton:t,spreadOddButton:i,spreadEvenButton:r}=e;const spreadModeChanged=e=>{let{mode:s}=e;(0,n.toggleCheckedBtn)(t,s===n.SpreadMode.NONE);(0,n.toggleCheckedBtn)(i,s===n.SpreadMode.ODD);(0,n.toggleCheckedBtn)(r,s===n.SpreadMode.EVEN)};this.eventBus._on("spreadmodechanged",spreadModeChanged);this.eventBus._on("secondarytoolbarreset",(e=>{e.source===this&&spreadModeChanged({mode:n.SpreadMode.NONE})}))}open(){if(!this.opened){this.opened=!0;(0,n.toggleExpandedBtn)(this.toggleButton,!0,this.toolbar)}}close(){if(this.opened){this.opened=!1;(0,n.toggleExpandedBtn)(this.toggleButton,!1,this.toolbar)}}toggle(){this.opened?this.close():this.open()}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.Toolbar=void 0;var n=i(3),r=i(4);t.Toolbar=class Toolbar{#Sr=!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")?r.AnnotationEditorType.NONE:r.AnnotationEditorType.FREETEXT}}},{element:e.editorInkButton,eventName:"switchannotationeditormode",eventDetails:{get mode(){const{classList:t}=e.editorInkButton;return t.contains("toggled")?r.AnnotationEditorType.NONE:r.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.#oi(e);this.reset()}setPageNumber(e,t){this.pageNumber=e;this.pageLabel=t;this.#_r(!1)}setPagesCount(e,t){this.pagesCount=e;this.hasPageLabels=t;this.#_r(!0)}setPageScale(e,t){this.pageScaleValue=(e||t).toString();this.pageScale=t;this.#_r(!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.#_r(!0);this.updateLoadingIndicatorState();this.eventBus.dispatch("toolbarreset",{source:this})}#oi(e){const{pageNumber:t,scaleSelect:i}=this.items,r=this;for(const{element:e,eventName:t,eventDetails:i}of this.buttons)null==e||e.addEventListener("click",(e=>{null!==t&&this.eventBus.dispatch(t,{source:this,...i})}));t.addEventListener("click",(function(){this.select()}));t.addEventListener("change",(function(){r.eventBus.dispatch("pagenumberchanged",{source:r,value:this.value})}));i.addEventListener("change",(function(){"custom"!==this.value&&r.eventBus.dispatch("scalechanged",{source:r,value:this.value})}));i.addEventListener("click",(function(e){const t=e.target;this.value===r.pageScaleValue&&"OPTION"===t.tagName.toUpperCase()&&this.blur()}));i.oncontextmenu=n.noContextMenuHandler;this.eventBus._on("localized",(()=>{this.#Sr=!0;this.#Pr();this.#_r(!0)}));this.#Ar(e)}#Ar(e){let{editorFreeTextButton:t,editorFreeTextParamsToolbar:i,editorInkButton:s,editorInkParamsToolbar:a}=e;const editorModeChanged=e=>{let{mode:o}=e;(0,n.toggleCheckedBtn)(t,o===r.AnnotationEditorType.FREETEXT,i);(0,n.toggleCheckedBtn)(s,o===r.AnnotationEditorType.INK,a);const l=o===r.AnnotationEditorType.DISABLE;t.disabled=l;s.disabled=l};this.eventBus._on("annotationeditormodechanged",editorModeChanged);this.eventBus._on("toolbarreset",(e=>{e.source===this&&editorModeChanged({mode:r.AnnotationEditorType.DISABLE})}))}#_r(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.#Sr)return;const{pageNumber:t,pagesCount:i,pageScaleValue:r,pageScale:s,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=s<=n.MIN_SCALE;a.zoomIn.disabled=s>=n.MAX_SCALE;this.l10n.get("page_scale_percent",{scale:Math.round(1e4*s)/100}).then((e=>{let t=!1;if(a.scaleSelect.options)for(const e of a.scaleSelect.options)if(e.value===r){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:r,pageScale:s})}updateLoadingIndicatorState(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{pageNumber:t}=this.items;t.classList.toggle("visiblePageIsLoading",e)}async#Pr(){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 r=getComputedStyle(e.scaleSelect),s=parseFloat(r.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=`${r.fontSize} ${r.fontFamily}`;let c=0;for(const e of await i)try{const{width:t}=l.measureText(e);t>c&&(c=t)}catch(e){}c+=.3*s;if(c>s){e.scaleSelect.parentNode.style.setProperty("--scale-select-width",`${c}px`)}a.width=0;a.height=0}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.ViewHistory=void 0;var n=i(5);t.ViewHistory=class ViewHistory{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]: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)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.BasePreferences=void 0;i(5);class BasePreferences{#Er=Object.freeze({annotationEditorMode:0,annotationMode:2,cursorToolOnLoad:0,defaultZoomDelay:400,defaultZoomValue:"",disablePageLabels:!1,enableFloatingToolbar:!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});#xr=Object.create(null);#Cr=null;constructor(){if(this.constructor===BasePreferences)throw new Error("Cannot initialize BasePreferences.");this.#Cr=this._readFromStorage(this.#Er).then((e=>{for(const t in this.#Er){const i=null==e?void 0:e[t];typeof i==typeof this.#Er[t]&&(this.#xr[t]=i)}}))}async _writeToStorage(e){throw new Error("Not implemented: _writeToStorage")}async _readFromStorage(e){throw new Error("Not implemented: _readFromStorage")}async reset(){await this.#Cr;const e=this.#xr;this.#xr=Object.create(null);return this._writeToStorage(this.#Er).catch((t=>{this.#xr=e;throw t}))}async set(e,t){await this.#Cr;const i=this.#Er[e],n=this.#xr;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 r=typeof t,s=typeof i;if(r!==s){if("number"!==r||"string"!==s)throw new Error(`Set preference: "${t}" is a ${r}, expected a ${s}.`);t=t.toString()}else if("number"===r&&!Number.isInteger(t))throw new Error(`Set preference: "${t}" must be an integer.`);this.#xr[e]=t;return this._writeToStorage(this.#xr).catch((e=>{this.#xr=n;throw e}))}async get(e){await this.#Cr;const t=this.#Er[e];if(void 0===t)throw new Error(`Get preference: "${e}" is undefined.`);return this.#xr[e]??t}async getAll(){await this.#Cr;const e=Object.create(null);for(const t in this.#Er)e[t]=this.#xr[t]??this.#Er[t];return e}}t.BasePreferences=BasePreferences},(e,t,i)=>{"use strict";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{#Tr=new WeakMap;downloadUrl(e,t,i){(0,n.createValidAbsoluteUrl)(e,"http://example.com")?download(e+"#pdfjs.action=download",t):globalThis.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 r=(0,n.isPdfFile)(i),s=r?"application/pdf":"";if(r){let i=this.#Tr.get(e);if(!i){i=URL.createObjectURL(new Blob([t],{type:s}));this.#Tr.set(e,i)}try{window.open(i);return!0}catch(t){globalThis.ngxConsole.error(`openOrDownloadData: ${t}`);URL.revokeObjectURL(i);this.#Tr.delete(e)}}this.downloadData(t,i,s);return!1}download(e,t,i,n){download(URL.createObjectURL(e),i)}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.GenericL10n=void 0;i(184);var n=i(31);const r=document.webL10n;t.GenericL10n=class GenericL10n{constructor(e){this._lang=e;this._ready=new Promise(((t,i)=>{r.setLanguage((0,n.fixupLangCode)(e),(()=>{t(r)}))}))}async getLanguage(){return(await this._ready).getLanguage()}async getDirection(){return(await this._ready).getDirection()}async get(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:(0,n.getL10nFallback)(e,t);return(await this._ready).get(e,t,i)}async translate(e){return(await this._ready).translate(e)}}},()=>{"use strict";document.webL10n=function(e,t,i){var n={},r="",s="textContent",a="",o={},l="loading",c=!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,c);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 c=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){r+=t;!function parseProperties(t,n){var r={},s=/^\s*|\s*$/,o=/^\s*#|^\s*$/,l=/^\s*\[(.*)\]\s*$/,d=/^\s*@import\s+url\((.*)\)\s*$/i,h=/^([^=\s]*)\s*=\s*(.+)$/;function parseRawLines(e,t,n){var u=e.replace(s,"").split(/[\r\n]+/),p="*",g=a.split("-",1)[0],f=!1,m="",v=!1;!function nextEntry(){for(var e=i;;){if(!u.length&&e){v?nextEntry():loadImport(e,nextEntry);return}if(!u.length){n();return}var s=u.shift();if(!o.test(s)){if(t){if(m=l.exec(s)){p=m[1].toLowerCase();f="*"!==p&&p!==a&&p!==g;continue}if(f)continue;if(m=d.exec(s)){if("*"===p||p===a){loadImport(c+m[1],nextEntry);v=!0;return}e=c+m[1]}}var b=s.match(h);b&&3==b.length&&(r[b[1]]=evalString(b[2]))}}}()}function loadImport(t,i){xhrLoadText(t,(function(e){parseRawLines(e,!1,i)}),(function(){const n=e.PDFViewerApplicationOptions;(!n||n.get("verbosity")>0)&&globalThis.ngxConsole.warn(t+" not found.");i()}))}parseRawLines(t,!0,(function(){n(r)}))}(t,(function(e){for(var t in e){var i,r,a=t.lastIndexOf(".");if(a>0){i=t.substring(0,a);r=t.substring(a+1)}else{i=t;r=s}n[i]||(n[i]={});n[i][r]=e[t]}o&&o()}))}),l)}function loadLocale(i,s){let o=i;i&&(i=i.toLowerCase());s=s||function _callback(){};!function clear(){n={};r="";a=""}();a=i;var c=function getL10nResourceLinks(){return t.querySelectorAll('link[type="application/l10n"]')}(),d=c.length;if(0!==d){var h,u=0;h=function(){if(++u>=d){s();fireL10nReadyEvent(i);l="complete"}};for(var p=0;p<d;p++){new L10nResourceLink(c[p]).load(i,h)}}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){globalThis.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])}}s()}else globalThis.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 r=e.PDFViewerApplicationOptions;if(!r||r.get("verbosity")>0){globalThis.ngxConsole.warn(i+" not found.");globalThis.ngxConsole.warn('"'+t+'" resource not found')}a="";n()}))}}}o.plural=function(t,i,r,l){var c=parseFloat(i);if(isNaN(c))return t;if(l!=s)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)&&globalThis.ngxConsole.warn("plural form unknown for ["+t+"]");return function(){return"other"}}return i[n]}(a));var d="["+o._pluralRules(c)+"]";0===c&&r+"[zero]"in n?t=n[r+"[zero]"][l]:1==c&&r+"[one]"in n?t=n[r+"[one]"][l]:2==c&&r+"[two]"in n?t=n[r+"[two]"][l]:r+d in n?t=n[r+d][l]:r+"[other]"in n&&(t=n[r+"[other]"][l]);return t};function getL10nData(t,i,r){var s=n[t];if(!s){const i=e.PDFViewerApplicationOptions;(!i||i.get("verbosity")>0)&&globalThis.ngxConsole.warn("Translation for the key #"+t+" is missing.");if(!r)return null;s=r}var a={};for(var o in s){var l=s[o];l=substArguments(l=substIndexes(l,i,t,o),i,t);a[o]=l}return a}function substIndexes(e,t,i,r){var s=/\{\[\s*([a-zA-Z]+)\(([a-zA-Z]+)\)\s*\]\}/.exec(e);if(!s||!s.length)return e;var a,l=s[1],c=s[2];t&&c in t?a=t[c]:c in n&&(a=n[c]);if(l in o){e=(0,o[l])(e,a,i,r)}return e}function substArguments(e,t,i){return e.replace(/\{\{\s*(.+?)\s*\}\}/g,(function(e,r){if(t&&r in t)return t[r];if(r in n)return n[r];globalThis.ngxConsole.log("argument {{"+r+"}} 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"),r={};if(n)try{r=JSON.parse(n)}catch(t){const n=e.PDFViewerApplicationOptions;(!n||n.get("verbosity")>0)&&globalThis.ngxConsole.warn("could not parse arguments for #"+i)}return{id:i,args:r}}(i);if(n.id){var r=getL10nData(n.id,n.args);if(r){if(r[s]){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[s]=r[s];else{for(var a=i.childNodes,o=!1,l=0,c=a.length;l<c;l++)if(3===a[l].nodeType&&/\S/.test(a[l].nodeValue))if(o)a[l].nodeValue="";else{a[l].nodeValue=r[s];o=!0}if(!o){var d=t.createTextNode(r[s]);i.prepend(d)}}delete r[s]}for(var h in r)i[h]=r[h]}else{const t=e.PDFViewerApplicationOptions;(!t||t.get("verbosity")>0)&&globalThis.ngxConsole.warn("#"+n.id+" is undefined.")}}}return{get:function(e,t,i){var n,r=e.lastIndexOf("."),a=s;if(r>0){a=e.substring(r+1);e=e.substring(0,r)}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 r},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,r=0;r<n;r++)translateElement(i[r]);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)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.GenericScripting=void 0;t.docPropertiesLookup=async function docPropertiesLookup(e){const t="".split("#")[0];let{info:i,metadata:r,contentDispositionFilename:s,contentLength:a}=await e.getMetadata();if(!a){const{length:t}=await e.getDownloadInfo();a=t}return{...i,baseURL:t,filesize:a,filename:s||(0,n.getPdfFilenameFromUrl)(""),metadata:null==r?void 0:r.getRaw(),authors:null==r?void 0:r.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)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PDFPrintService=void 0;var n=i(4),r=i(2),s=function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}(i(38)),a=i(187),o=i(39);let l=null,c=null,d=null;function renderPage(e,t,i,r,a,c,d){const h=l.scratchCanvas;let u=a/n.PixelsPerInch.PDF,p=1;const g=Math.floor(r.width*u),f=Math.floor(r.height*u);if(g>=4096||f>=4096){if(!s.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(!s.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;h.width=Math.floor(r.width*u);h.height=Math.floor(r.height*u);const m=window.pdfDefaultOptions.activateWillReadFrequentlyFlag?{willReadFrequently:!0}:void 0,v=h.getContext("2d",m);v.save();v.fillStyle="rgb(255, 255, 255)";v.fillRect(0,0,h.width,h.height);v.restore();return Promise.all([t.getPage(i),d]).then((function(e){let[t,i]=e;const s={canvasContext:v,transform:[u,0,0,u,0,0],viewport:t.getViewport({scale:1,rotation:r.rotation}),intent:"print",annotationMode:n.AnnotationMode.ENABLE_STORAGE,optionalContentConfigPromise:c,printAnnotationStorage:i};return t.render(s).promise}))}class PDFPrintService{constructor(e,t,i,n){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,a=arguments.length>6?arguments[6]:void 0,o=arguments.length>7?arguments[7]:void 0;this.pdfDocument=e;this.pagesOverview=t;this.printContainer=i;this._printResolution=n||150;this._optionalContentConfigPromise=r||e.getOptionalContentConfig();this._printAnnotationStoragePromise=s||Promise.resolve();this.l10n=a;this.currentPage=-1;this.scratchCanvas=document.createElement("canvas");this.eventBus=o}layout(){this.throwIfInactive();const e=document.querySelector("body");e.setAttribute("data-pdfjsprinting",!0);document.querySelector("html").setAttribute("data-pdfjsprinting",!0);const{width:t,height:i}=this.pagesOverview[0];this.pagesOverview.every((e=>e.width===t&&e.height===i))||globalThis.ngxConsole.warn("Not all pages have the same size. The printed result may be incorrect!");this.pageStyleSheet=document.createElement("style");this.pageStyleSheet.textContent=`@page { size: ${t}pt ${i}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===c){d.close(c);d.unregister(c)}}));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}h.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.")}}t.PDFPrintService=PDFPrintService;const h=window.print;window.printPDF=function printPdf(){if(r.PDFViewerApplication.enablePrint)if(l)globalThis.ngxConsole.warn("Ignored window.printPDF() because of a pending print job.");else{ensureOverlay().then((function(){l&&d.open(c)}));try{dispatchEvent("beforeprint")}finally{if(!l){globalThis.ngxConsole.error("Expected print service to be initialized.");ensureOverlay().then((function(){d.active===c&&d.close(c)}));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=new CustomEvent(e,{bubbles:!1,cancelable:!1,detail:"custom"});window.dispatchEvent(t)}function abort(){if(l){l.destroy();dispatchEvent("afterprint")}}function renderProgress(e,t,i,n){c=document.getElementById("printServiceDialog");const r=Math.round(100*e/t),s=c.querySelector("progress"),a=c.querySelector(".relative-progress");s.value=r;i.get("print_progress_percent",{progress:r}).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=r.PDFViewerApplication.overlayManager;if(!d)throw new Error("The overlay manager has not yet been initialized.");c=document.getElementById("printServiceDialog");u=d.register(c,!0);document.getElementById("printCancel").onclick=abort;c.addEventListener("close",abort)}return u}r.PDFPrintServiceFactory.instance={supportsPrinting:!0,createPrintService(e,t,i,n,r,s,a,o){if(l)throw new Error("The print service is created and active.");l=new PDFPrintService(e,t,i,n,r,s,a,o);return l}}},(e,t,i)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.getXfaHtmlForPrinting=function getXfaHtmlForPrinting(e,t){const i=t.allXfaHtml,a=new r.SimpleLinkService,o=Math.round(100*n.PixelsPerInch.PDF_TO_CSS_UNITS)/100;for(const r of i.children){const i=document.createElement("div");i.className="xfaPrintedPage";e.append(i);const l=new s.XfaLayerBuilder({pageDiv:i,pdfPage:null,annotationStorage:t.annotationStorage,linkService:a,xfaHtml:r}),c=(0,n.getXfaPageViewport)(r,{scale:o});l.render(c,"print")}};var n=i(4),r=i(7),s=i(177)}],t={};function __webpack_require__(i){var n=t[i];if(void 0!==n)return n.exports;var r=t[i]={exports:{}};e[i](r,r.exports,__webpack_require__);return r.exports}var i={};(()=>{"use strict";var e=i;Object.defineProperty(e,"__esModule",{value:!0});Object.defineProperty(e,"PDFViewerApplication",{enumerable:!0,get:function(){return o.PDFViewerApplication}});e.PDFViewerApplicationConstants=void 0;Object.defineProperty(e,"PDFViewerApplicationOptions",{enumerable:!0,get:function(){return s.AppOptions}});__webpack_require__(1);__webpack_require__(186);var t,n,r=__webpack_require__(3),s=__webpack_require__(5),a=__webpack_require__(7),o=__webpack_require__(2);const l={LinkTarget:a.LinkTarget,RenderingStates:r.RenderingStates,ScrollMode:r.ScrollMode,SpreadMode:r.SpreadMode};e.PDFViewerApplicationConstants=l;window.PDFViewerApplication=o.PDFViewerApplication;window.PDFViewerApplicationConstants=l;window.PDFViewerApplicationOptions=s.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});null===(t=(n=document).blockUnblockOnload)||void 0===t||t.call(n,!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"),resizer:document.getElementById("sidebarResizer"),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")},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=new CustomEvent("webviewerloaded",{bubbles:!0,cancelable:!0,detail:{source:window}});try{parent.document.dispatchEvent(t)}catch(e){console.error(`webviewerloaded: ${e}`);document.dispatchEvent(t)}o.PDFViewerApplication.run(e)}})()})();
});