@pdfslick/react 1.4.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/umd/index.js CHANGED
@@ -29,7 +29,7 @@
29
29
  * @licend The above is the entire license notice for the
30
30
  * JavaScript code in this page
31
31
  */
32
- (function(module,exports){var root,factory;root=globalThis,factory=()=>(()=>{var __webpack_modules__=[,(e,t)=>{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.AnnotationReplyType=t.AnnotationPrefix=t.AnnotationMode=t.AnnotationFlag=t.AnnotationFieldFlag=t.AnnotationEditorType=t.AnnotationEditorPrefix=t.AnnotationEditorParamsType=t.AnnotationBorderStyleType=t.AnnotationActionEventType=t.AbortException=void 0,t.assert=function(e,t){e||a(t)},t.bytesToString=h,t.createValidAbsoluteUrl=function(e,t=null,i=null){if(!e)return null;try{if(i&&"string"==typeof e){if(i.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\./g);t?.length>=2&&(e=`http://${e}`)}if(i.tryConvertEncoding)try{e=p(e)}catch{}}const n=t?new URL(e,t):new URL(e);if(function(e){switch(e?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(n))return n}catch{}return null},t.getModificationDate=function(e=new Date){return[e.getUTCFullYear().toString(),(e.getUTCMonth()+1).toString().padStart(2,"0"),e.getUTCDate().toString().padStart(2,"0"),e.getUTCHours().toString().padStart(2,"0"),e.getUTCMinutes().toString().padStart(2,"0"),e.getUTCSeconds().toString().padStart(2,"0")].join("")},t.getUuid=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto?.randomUUID)return crypto.randomUUID();const e=new Uint8Array(32);if("undefined"!=typeof crypto&&"function"==typeof crypto?.getRandomValues)crypto.getRandomValues(e);else for(let t=0;t<32;t++)e[t]=Math.floor(255*Math.random());return h(e)},t.getVerbosityLevel=function(){return s},t.info=function(e){s>=n.INFOS&&console.log(`Info: ${e}`)},t.isArrayBuffer=function(e){return"object"==typeof e&&void 0!==e?.byteLength},t.isArrayEqual=function(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.isNodeJS=void 0,t.normalizeUnicode=function(e){return g||(g=/([\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,f=new Map([["ſt","ſt"]])),e.replaceAll(g,((e,t,i)=>t?t.normalize("NFKC"):f.get(i)))},t.objectFromMap=function(e){const t=Object.create(null);for(const[i,n]of e)t[i]=n;return t},t.objectSize=function(e){return Object.keys(e).length},t.setVerbosityLevel=function(e){Number.isInteger(e)&&(s=e)},t.shadow=o,t.string32=function(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)},t.stringToBytes=c,t.stringToPDFString=function(e){if(e[0]>="ï"){let t;if("þ"===e[0]&&"ÿ"===e[1]?t="utf-16be":"ÿ"===e[0]&&"þ"===e[1]?t="utf-16le":"ï"===e[0]&&"»"===e[1]&&"¿"===e[2]&&(t="utf-8"),t)try{const i=new TextDecoder(t,{fatal:!0}),n=c(e);return i.decode(n)}catch(e){r(`stringToPDFString: "${e}".`)}}const t=[];for(let i=0,n=e.length;i<n;i++){const n=u[e.charCodeAt(i)];t.push(n?String.fromCharCode(n):e.charAt(i))}return t.join("")},t.stringToUTF8String=p,t.unreachable=a,t.utf8StringToString=function(e){return unescape(encodeURIComponent(e))},t.warn=r;const i=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type);t.isNodeJS=i,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,STAMP:13,INK:15},t.AnnotationEditorParamsType={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23},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.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 s=n.WARNINGS;function r(e){s>=n.WARNINGS&&console.log(`Warning: ${e}`)}function a(e){throw new Error(e)}function o(e,t,i,n=!1){return Object.defineProperty(e,t,{value:i,enumerable:!n,configurable:!0,writable:!1}),i}const l=function(){function e(t,i){this.constructor===e&&a("Cannot initialize BaseException."),this.message=t,this.name=i}return e.prototype=new Error,e.constructor=e,e}();function h(e){"object"==typeof e&&void 0!==e?.length||a("Invalid argument for bytesToString");const t=e.length,i=8192;if(t<i)return String.fromCharCode.apply(null,e);const n=[];for(let s=0;s<t;s+=i){const r=Math.min(s+i,t),a=e.subarray(s,r);n.push(String.fromCharCode.apply(null,a))}return n.join("")}function c(e){"string"!=typeof e&&a("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.BaseException=l,t.PasswordException=class extends l{constructor(e,t){super(e,"PasswordException"),this.code=t}},t.UnknownErrorException=class extends l{constructor(e,t){super(e,"UnknownErrorException"),this.details=t}},t.InvalidPDFException=class extends l{constructor(e){super(e,"InvalidPDFException")}},t.MissingPDFException=class extends l{constructor(e){super(e,"MissingPDFException")}},t.UnexpectedResponseException=class extends l{constructor(e,t){super(e,"UnexpectedResponseException"),this.status=t}},t.FormatError=class extends l{constructor(e){super(e,"FormatError")}},t.AbortException=class extends l{constructor(e){super(e,"AbortException")}},t.FeatureTest=class{static get isLittleEndian(){return o(this,"isLittleEndian",function(){const e=new Uint8Array(4);return e[0]=1,1===new Uint32Array(e.buffer,0,1)[0]}())}static get isEvalSupported(){return o(this,"isEvalSupported",function(){try{return new Function(""),!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return o(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get platform(){return"undefined"==typeof navigator?o(this,"platform",{isWin:!1,isMac:!1}):o(this,"platform",{isWin:navigator.platform.includes("Win"),isMac:navigator.platform.includes("Mac")})}static get isCSSRoundSupported(){return o(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}};const d=[...Array(256).keys()].map((e=>e.toString(16).padStart(2,"0")));t.Util=class{static makeHexColor(e,t,i){return`#${d[e]}${d[t]}${d[i]}`}static scaleMinMax(e,t){let i;e[0]?(e[0]<0&&(i=t[0],t[0]=t[1],t[1]=i),t[0]*=e[0],t[1]*=e[0],e[3]<0&&(i=t[2],t[2]=t[3],t[3]=i),t[2]*=e[3],t[3]*=e[3]):(i=t[0],t[0]=t[2],t[2]=i,i=t[1],t[1]=t[3],t[3]=i,e[1]<0&&(i=t[2],t[2]=t[3],t[3]=i),t[2]*=e[1],t[3]*=e[1],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=this.applyTransform(e,t),n=this.applyTransform(e.slice(2,4),t),s=this.applyTransform([e[0],e[3]],t),r=this.applyTransform([e[2],e[1]],t);return[Math.min(i[0],n[0],s[0],r[0]),Math.min(i[1],n[1],s[1],r[1]),Math.max(i[0],n[0],s[0],r[0]),Math.max(i[1],n[1],s[1],r[1])]}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e){const t=[e[0],e[2],e[1],e[3]],i=e[0]*t[0]+e[1]*t[2],n=e[0]*t[1]+e[1]*t[3],s=e[2]*t[0]+e[3]*t[2],r=e[2]*t[1]+e[3]*t[3],a=(i+r)/2,o=Math.sqrt((i+r)**2-4*(i*r-s*n))/2,l=a+o||1,h=a-o||1;return[Math.sqrt(l),Math.sqrt(h)]}static normalizeRect(e){const t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){const i=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),n=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(i>n)return null;const s=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),r=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return s>r?null:[i,s,n,r]}static bezierBoundingBox(e,t,i,n,s,r,a,o){const l=[],h=[[],[]];let c,d,u,p,g,f,m,_;for(let h=0;h<2;++h)if(0===h?(d=6*e-12*i+6*s,c=-3*e+9*i-9*s+3*a,u=3*i-3*e):(d=6*t-12*n+6*r,c=-3*t+9*n-9*r+3*o,u=3*n-3*t),Math.abs(c)<1e-12){if(Math.abs(d)<1e-12)continue;p=-u/d,0<p&&p<1&&l.push(p)}else m=d*d-4*u*c,_=Math.sqrt(m),m<0||(g=(-d+_)/(2*c),0<g&&g<1&&l.push(g),f=(-d-_)/(2*c),0<f&&f<1&&l.push(f));let v,b=l.length;const y=b;for(;b--;)p=l[b],v=1-p,h[0][b]=v*v*v*e+3*v*v*p*i+3*v*p*p*s+p*p*p*a,h[1][b]=v*v*v*t+3*v*v*p*n+3*v*p*p*r+p*p*p*o;return h[0][y]=e,h[1][y]=t,h[0][y+1]=a,h[1][y+1]=o,h[0].length=h[1].length=y+2,[Math.min(...h[0]),Math.min(...h[1]),Math.max(...h[0]),Math.max(...h[1])]}};const u=[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 p(e){return decodeURIComponent(escape(e))}t.PromiseCapability=class{#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 g=null,f=null;t.AnnotationPrefix="pdfjs_internal_id_"},(__unused_webpack_module,exports,__w_pdfjs_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),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,Object.defineProperty(exports,"SVGGraphics",{enumerable:!0,get:function(){return _displaySvg.SVGGraphics}}),exports.build=void 0,exports.getDocument=getDocument,exports.version=void 0;var _util=__w_pdfjs_require__(1),_annotation_storage=__w_pdfjs_require__(3),_display_utils=__w_pdfjs_require__(6),_font_loader=__w_pdfjs_require__(9),_displayNode_utils=__w_pdfjs_require__(10),_canvas=__w_pdfjs_require__(11),_worker_options=__w_pdfjs_require__(14),_message_handler=__w_pdfjs_require__(15),_metadata=__w_pdfjs_require__(16),_optional_content_config=__w_pdfjs_require__(17),_transport_stream=__w_pdfjs_require__(18),_displayFetch_stream=__w_pdfjs_require__(19),_displayNetwork=__w_pdfjs_require__(22),_displayNode_stream=__w_pdfjs_require__(23),_displaySvg=__w_pdfjs_require__(24),_xfa_text=__w_pdfjs_require__(25);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100,DELAYED_CLEANUP_TIMEOUT=5e3,DefaultCanvasFactory=_util.isNodeJS?_displayNode_utils.NodeCanvasFactory:_display_utils.DOMCanvasFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory;const DefaultCMapReaderFactory=_util.isNodeJS?_displayNode_utils.NodeCMapReaderFactory:_display_utils.DOMCMapReaderFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory;const DefaultFilterFactory=_util.isNodeJS?_displayNode_utils.NodeFilterFactory:_display_utils.DOMFilterFactory;exports.DefaultFilterFactory=DefaultFilterFactory;const DefaultStandardFontDataFactory=_util.isNodeJS?_displayNode_utils.NodeStandardFontDataFactory:_display_utils.DOMStandardFontDataFactory;function getDocument(e){if("string"==typeof e||e instanceof URL?e={url:e}:(0,_util.isArrayBuffer)(e)&&(e={data:e}),"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):null,s=e.data?getDataProp(e.data):null,r=e.httpHeaders||null,a=!0===e.withCredentials,o=e.password??null,l=e.range instanceof PDFDataRangeTransport?e.range:null,h=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:DEFAULT_RANGE_CHUNK_SIZE;let c=e.worker instanceof PDFWorker?e.worker:null;const d=e.verbosity,u="string"!=typeof e.docBaseUrl||(0,_display_utils.isDataScheme)(e.docBaseUrl)?null:e.docBaseUrl,p="string"==typeof e.cMapUrl?e.cMapUrl:null,g=!1!==e.cMapPacked,f=e.CMapReaderFactory||DefaultCMapReaderFactory,m="string"==typeof e.standardFontDataUrl?e.standardFontDataUrl:null,_=e.StandardFontDataFactory||DefaultStandardFontDataFactory,v=!0!==e.stopAtErrors,b=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,y=!1!==e.isEvalSupported,S="boolean"==typeof e.isOffscreenCanvasSupported?e.isOffscreenCanvasSupported:!_util.isNodeJS,P=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,A="boolean"==typeof e.disableFontFace?e.disableFontFace:_util.isNodeJS,w=!0===e.fontExtraProperties,E=!0===e.enableXfa,x=e.ownerDocument||globalThis.document,C=!0===e.disableRange,M=!0===e.disableStream,T=!0===e.disableAutoFetch,D=!0===e.pdfBug,F=l?l.length:e.length??NaN,L="boolean"==typeof e.useSystemFonts?e.useSystemFonts:!_util.isNodeJS&&!A,k="boolean"==typeof e.useWorkerFetch?e.useWorkerFetch:f===_display_utils.DOMCMapReaderFactory&&_===_display_utils.DOMStandardFontDataFactory&&p&&m&&(0,_display_utils.isValidFetchUrl)(p,document.baseURI)&&(0,_display_utils.isValidFetchUrl)(m,document.baseURI),R=e.canvasFactory||new DefaultCanvasFactory({ownerDocument:x}),I=e.filterFactory||new DefaultFilterFactory({docId:i,ownerDocument:x});(0,_util.setVerbosityLevel)(d);const O={canvasFactory:R,filterFactory:I};if(k||(O.cMapReaderFactory=new f({baseUrl:p,isCompressed:g}),O.standardFontDataFactory=new _({baseUrl:m})),!c){const e={verbosity:d,port:_worker_options.GlobalWorkerOptions.workerPort};c=e.port?PDFWorker.fromPort(e):new PDFWorker(e),t._worker=c}const N={docId:i,apiVersion:"3.11.174",data:s,password:o,disableAutoFetch:T,rangeChunkSize:h,length:F,docBaseUrl:u,enableXfa:E,evaluatorOptions:{maxImageSize:b,disableFontFace:A,ignoreErrors:v,isEvalSupported:y,isOffscreenCanvasSupported:S,canvasMaxAreaInBytes:P,fontExtraProperties:w,useSystemFonts:L,cMapUrl:k?p:null,standardFontDataUrl:k?m:null}},B={ignoreErrors:v,isEvalSupported:y,disableFontFace:A,fontExtraProperties:w,enableXfa:E,ownerDocument:x,disableAutoFetch:T,pdfBug:D,styleElement:null};return c.promise.then((function(){if(t.destroyed)throw new Error("Loading aborted");const e=_fetchDocument(c,N),o=new Promise((function(e){let t;var i;l?t=new _transport_stream.PDFDataTransportStream({length:F,initialData:l.initialData,progressiveDone:l.progressiveDone,contentDispositionFilename:l.contentDispositionFilename,disableRange:C,disableStream:M},l):s||(i={url:n,length:F,httpHeaders:r,withCredentials:a,rangeChunkSize:h,disableRange:C,disableStream:M},t=_util.isNodeJS?new _displayNode_stream.PDFNodeStream(i):(0,_display_utils.isValidFetchUrl)(i.url)?new _displayFetch_stream.PDFFetchStream(i):new _displayNetwork.PDFNetworkStream(i)),e(t)}));return Promise.all([e,o]).then((function([e,n]){if(t.destroyed)throw new Error("Loading aborted");const s=new _message_handler.MessageHandler(i,e,c.port),r=new WorkerTransport(s,t,n,B,O);t._transport=r,s.send("Ready",null)}))})).catch(t._capability.reject),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){if(e instanceof URL)return e.href;try{return new URL(e,window.location).href}catch{if(_util.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(_util.isNodeJS&&"undefined"!=typeof Buffer&&e instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if("string"==typeof e)return(0,_util.stringToBytes)(e);if("object"==typeof e&&!isNaN(e?.length)||(0,_util.isArrayBuffer)(e))return new Uint8Array(e);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory;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(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await(this._transport?.destroy())}catch(e){throw this._worker?.port&&delete this._worker._pendingDestroy,e}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}exports.PDFDocumentLoadingTask=PDFDocumentLoadingTask;class PDFDataRangeTransport{constructor(e,t,i=!1,n=null){this.length=e,this.initialData=t,this.progressiveDone=i,this.contentDispositionFilename=n,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=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,Object.defineProperty(this,"getJavaScript",{value:()=>((0,_display_utils.deprecated)("`PDFDocumentProxy.getJavaScript`, please use `PDFDocumentProxy.getJSActions` instead."),this.getJSActions().then((e=>{if(!e)return e;const t=[];for(const i in e)t.push(...e[i]);return 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()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){return this._transport.getOptionalContentConfig()}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}exports.PDFDocumentProxy=PDFDocumentProxy;class PDFPageProxy{#i=null;#n=!1;constructor(e,t,i,n=!1){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({scale:e,rotation:t=this.rotate,offsetX:i=0,offsetY:n=0,dontFlip:s=!1}={}){return new _display_utils.PageViewport({viewBox:this.view,scale:e,rotation:t,offsetX:i,offsetY:n,dontFlip:s})}getAnnotations({intent:e="display"}={}){const t=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,t.renderingIntent)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return(0,_util.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:e,viewport:t,intent:i="display",annotationMode:n=_util.AnnotationMode.ENABLE,transform:s=null,background:r=null,optionalContentConfigPromise:a=null,annotationCanvasMap:o=null,pageColors:l=null,printAnnotationStorage:h=null}){this._stats?.time("Overall");const c=this._transport.getRenderingIntent(i,n,h);this.#n=!1,this.#s(),a||(a=this._transport.getOptionalContentConfig());let d=this._intentStates.get(c.cacheKey);d||(d=Object.create(null),this._intentStates.set(c.cacheKey,d)),d.streamReaderCancelTimeout&&(clearTimeout(d.streamReaderCancelTimeout),d.streamReaderCancelTimeout=null);const u=!!(c.renderingIntent&_util.RenderingIntentFlag.PRINT);d.displayReadyCapability||(d.displayReadyCapability=new _util.PromiseCapability,d.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(c));const p=e=>{d.renderTasks.delete(g),(this._maybeCleanupAfterRender||u)&&(this.#n=!0),this.#r(!u),e?(g.capability.reject(e),this._abortOperatorList({intentState:d,reason:e instanceof Error?e:new Error(e)})):g.capability.resolve(),this._stats?.timeEnd("Rendering"),this._stats?.timeEnd("Overall")},g=new InternalRenderTask({callback:p,params:{canvasContext:e,viewport:t,transform:s,background:r},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:o,operatorList:d.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!u,pdfBug:this._pdfBug,pageColors:l});(d.renderTasks||=new Set).add(g);const f=g.task;return Promise.all([d.displayReadyCapability.promise,a]).then((([e,t])=>{this.destroyed?p():(this._stats?.time("Rendering"),g.initializeGraphics({transparency:e,optionalContentConfig:t}),g.operatorListChanged())})).catch(p),f}getOperatorList({intent:e="display",annotationMode:t=_util.AnnotationMode.ENABLE,printAnnotationStorage:i=null}={}){const n=this._transport.getRenderingIntent(e,t,i,!0);let s,r=this._intentStates.get(n.cacheKey);return r||(r=Object.create(null),this._intentStates.set(n.cacheKey,r)),r.opListReadCapability||(s=Object.create(null),s.operatorListChanged=function(){r.operatorList.lastChunk&&(r.opListReadCapability.resolve(r.operatorList),r.renderTasks.delete(s))},r.opListReadCapability=new _util.PromiseCapability,(r.renderTasks||=new Set).add(s),r.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(n)),r.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===e,disableNormalization:!0===t},{highWaterMark:100,size:e=>e.items.length})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then((e=>_xfa_text.XfaText.textContent(e)));const t=this.streamTextContent(e);return new Promise((function(e,i){const n=t.getReader(),s={items:[],styles:Object.create(null)};!function t(){n.read().then((function({value:i,done:n}){n?e(s):(Object.assign(s.styles,i.styles),s.items.push(...i.items),t())}),i)}()}))}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0}),!t.opListReadCapability)for(const i of t.renderTasks)e.push(i.completed),i.cancel();return this.objs.clear(),this.#n=!1,this.#s(),Promise.all(e)}cleanup(e=!1){this.#n=!0;const t=this.#r(!1);return e&&t&&(this._stats&&=new _display_utils.StatTimer),t}#r(e=!1){if(this.#s(),!this.#n||this.destroyed)return!1;if(e)return this.#i=setTimeout((()=>{this.#i=null,this.#r(!1)}),DELAYED_CLEANUP_TIMEOUT),!1;for(const{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#n=!1,!0}#s(){this.#i&&(clearTimeout(this.#i),this.#i=null)}_startRenderPage(e,t){const i=this._intentStates.get(t);i&&(this._stats?.timeEnd("Page Request"),i.displayReadyCapability?.resolve(e))}_renderPageChunk(e,t){for(let i=0,n=e.length;i<n;i++)t.operatorList.fnArray.push(e.fnArray[i]),t.operatorList.argsArray.push(e.argsArray[i]);t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots;for(const e of t.renderTasks)e.operatorListChanged();e.lastChunk&&this.#r(!0)}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageSerializable:i}){const{map:n,transfers:s}=i,r=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:n},s).getReader(),a=this._intentStates.get(t);a.streamReader=r;const o=()=>{r.read().then((({value:e,done:t})=>{t?a.streamReader=null:this._transport.destroyed||(this._renderPageChunk(e,a),o())}),(e=>{if(a.streamReader=null,!this._transport.destroyed){if(a.operatorList){a.operatorList.lastChunk=!0;for(const e of a.renderTasks)e.operatorListChanged();this.#r(!0)}if(a.displayReadyCapability)a.displayReadyCapability.reject(e);else{if(!a.opListReadCapability)throw e;a.opListReadCapability.reject(e)}}}))};o()}_abortOperatorList({intentState:e,reason:t,force:i=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!i){if(e.renderTasks.size>0)return;if(t instanceof _display_utils.RenderingCancelledException){let i=RENDERING_CANCELLED_TIMEOUT;return t.extraDelay>0&&t.extraDelay<1e3&&(i+=t.extraDelay),void(e.streamReaderCancelTimeout=setTimeout((()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:t,force:!0})}),i))}}if(e.streamReader.cancel(new _util.AbortException(t.message)).catch((()=>{})),e.streamReader=null,!this._transport.destroyed){for(const[t,i]of this._intentStates)if(i===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}}exports.PDFPageProxy=PDFPageProxy;class LoopbackPort{#a=new Set;#o=Promise.resolve();postMessage(e,t){const i={data:structuredClone(e,t?{transfer:t}: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};if(exports.PDFWorkerUtil=PDFWorkerUtil,_util.isNodeJS&&"function"==typeof commonjsRequire)PDFWorkerUtil.isWorkerDisabled=!0,PDFWorkerUtil.fallbackWorkerSrc="./pdf.worker.js";else if("object"==typeof document){const e=document?.currentScript?.src;e&&(PDFWorkerUtil.fallbackWorkerSrc=e.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}PDFWorkerUtil.isSameOrigin=function(e,t){let i;try{if(i=new URL(e),!i.origin||"null"===i.origin)return!1}catch{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;constructor({name:e=null,port:t=null,verbosity:i=(0,_util.getVerbosityLevel)()}={}){if(this.name=e,this.destroyed=!1,this.verbosity=i,this._readyCapability=new _util.PromiseCapability,this._port=null,this._webWorker=null,this._messageHandler=null,t){if(PDFWorker.#l?.has(t))throw new Error("Cannot use more than one PDFWorker per port.");return(PDFWorker.#l||=new WeakMap).set(t,this),void this._initializeFromPort(t)}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})}_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(e),i=new _message_handler.MessageHandler("main","worker",t),n=()=>{t.removeEventListener("error",s),i.destroy(),t.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},s=()=>{this._webWorker||n()};t.addEventListener("error",s),i.on("test",(e=>{t.removeEventListener("error",s),this.destroyed?n():e?(this._messageHandler=i,this._port=t,this._webWorker=t,this._readyCapability.resolve(),i.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),i.destroy(),t.terminate())})),i.on("ready",(e=>{if(t.removeEventListener("error",s),this.destroyed)n();else try{r()}catch{this._setupFakeWorker()}}));const r=()=>{const e=new Uint8Array;i.send("test",e,[e.buffer])};return void r()}catch{(0,_util.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){PDFWorkerUtil.isWorkerDisabled||((0,_util.warn)("Setting up fake worker."),PDFWorkerUtil.isWorkerDisabled=!0),PDFWorker._setupFakeWorkerGlobal.then((e=>{if(this.destroyed)return void this._readyCapability.reject(new Error("Worker was destroyed"));const t=new LoopbackPort;this._port=t;const i="fake"+PDFWorkerUtil.fakeWorkerId++,n=new _message_handler.MessageHandler(i+"_worker",i,t);e.setup(n,t);const s=new _message_handler.MessageHandler(i,i+"_worker",t);this._messageHandler=s,this._readyCapability.resolve(),s.send("configure",{verbosity:this.verbosity})})).catch((e=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${e.message}".`))}))}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),PDFWorker.#l?.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(e){if(!e?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");const t=this.#l?.get(e.port);if(t){if(t._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return t}return new PDFWorker(e)}static get workerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(null!==PDFWorkerUtil.fallbackWorkerSrc)return _util.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'),PDFWorkerUtil.fallbackWorkerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _mainThreadWorkerMessageHandler(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){const loader=async()=>{const mainWorkerMessageHandler=this._mainThreadWorkerMessageHandler;if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_util.isNodeJS&&"function"==typeof commonjsRequire){const worker=eval("require")(this.workerSrc);return worker.WorkerMessageHandler}return await(0,_display_utils.loadScript)(this.workerSrc),window.pdfjsWorker.WorkerMessageHandler};return(0,_util.shadow)(this,"_setupFakeWorkerGlobal",loader())}}exports.PDFWorker=PDFWorker;class WorkerTransport{#h=new Map;#c=new Map;#d=new Map;#u=null;constructor(e,t,i,n,s){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=s.canvasFactory,this.filterFactory=s.filterFactory,this.cMapReaderFactory=s.cMapReaderFactory,this.standardFontDataFactory=s.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=new _util.PromiseCapability,this.setupMessageHandler()}#p(e,t=null){const i=this.#h.get(e);if(i)return i;const n=this.messageHandler.sendWithPromise(e,t);return this.#h.set(e,n),n}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}getRenderingIntent(e,t=_util.AnnotationMode.ENABLE,i=null,n=!1){let s=_util.RenderingIntentFlag.DISPLAY,r=_annotation_storage.SerializableEmpty;switch(e){case"any":s=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":s=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${e}`)}switch(t){case _util.AnnotationMode.DISABLE:s+=_util.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case _util.AnnotationMode.ENABLE:break;case _util.AnnotationMode.ENABLE_FORMS:s+=_util.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case _util.AnnotationMode.ENABLE_STORAGE:s+=_util.RenderingIntentFlag.ANNOTATIONS_STORAGE,r=(s&_util.RenderingIntentFlag.PRINT&&i instanceof _annotation_storage.PrintAnnotationStorage?i:this.annotationStorage).serializable;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${t}`)}return n&&(s+=_util.RenderingIntentFlag.OPLIST),{renderingIntent:s,cacheKey:`${s}_${r.hash}`,annotationStorageSerializable:r}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=new _util.PromiseCapability,this.#u?.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const t of this.#c.values())e.push(t._destroy());this.#c.clear(),this.#d.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const t=this.messageHandler.sendWithPromise("Terminate",null);return e.push(t),Promise.all(e).then((()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#h.clear(),this.filterFactory.destroy(),this._networkStream?.cancelAllRequests(new _util.AbortException("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()}),this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:t}=this;e.on("GetReader",((e,t)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=e=>{this._lastProgress={loaded:e.loaded,total:e.total}},t.onPull=()=>{this._fullReader.read().then((function({value:e,done:i}){i?t.close():((0,_util.assert)(e instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),t.enqueue(new Uint8Array(e),1,[e]))})).catch((e=>{t.error(e)}))},t.onCancel=e=>{this._fullReader.cancel(e),t.ready.catch((e=>{if(!this.destroyed)throw e}))}})),e.on("ReaderHeadersReady",(e=>{const i=new _util.PromiseCapability,n=this._fullReader;return n.headersReady.then((()=>{n.isStreamingSupported&&n.isRangeSupported||(this._lastProgress&&t.onProgress?.(this._lastProgress),n.onProgress=e=>{t.onProgress?.({loaded:e.loaded,total:e.total})}),i.resolve({isStreamingSupported:n.isStreamingSupported,isRangeSupported:n.isRangeSupported,contentLength:n.contentLength})}),i.reject),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);i?(t.onPull=()=>{i.read().then((function({value:e,done:i}){i?t.close():((0,_util.assert)(e instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),t.enqueue(new Uint8Array(e),1,[e]))})).catch((e=>{t.error(e)}))},t.onCancel=e=>{i.cancel(e),t.ready.catch((e=>{if(!this.destroyed)throw e}))}):t.close()})),e.on("GetDoc",(({pdfInfo:e})=>{this._numPages=e.numPages,this._htmlForXfa=e.htmlForXfa,delete e.htmlForXfa,t._capability.resolve(new PDFDocumentProxy(e,this))})),e.on("DocException",(function(e){let i;switch(e.name){case"PasswordException":i=new _util.PasswordException(e.message,e.code);break;case"InvalidPDFException":i=new _util.InvalidPDFException(e.message);break;case"MissingPDFException":i=new _util.MissingPDFException(e.message);break;case"UnexpectedResponseException":i=new _util.UnexpectedResponseException(e.message,e.status);break;case"UnknownErrorException":i=new _util.UnknownErrorException(e.message,e.details);break;default:(0,_util.unreachable)("DocException - expected a valid Error.")}t._capability.reject(i)})),e.on("PasswordRequest",(e=>{if(this.#u=new _util.PromiseCapability,t.onPassword){const i=e=>{e instanceof Error?this.#u.reject(e):this.#u.resolve({password:e})};try{t.onPassword(i,e.code)}catch(e){this.#u.reject(e)}}else this.#u.reject(new _util.PasswordException(e.message,e.code));return this.#u.promise})),e.on("DataLoaded",(e=>{t.onProgress?.({loaded:e.length,total:e.length}),this.downloadInfoCapability.resolve(e)})),e.on("StartRenderPage",(e=>{this.destroyed||this.#c.get(e.pageIndex)._startRenderPage(e.transparency,e.cacheKey)})),e.on("commonobj",(([t,i,n])=>{if(!this.destroyed&&!this.commonObjs.has(t))switch(i){case"Font":const s=this._params;if("error"in n){const e=n.error;(0,_util.warn)(`Error during font loading: ${e}`),this.commonObjs.resolve(t,e);break}const r=s.pdfBug&&globalThis.FontInspector?.enabled?(e,t)=>globalThis.FontInspector.fontAdded(e,t):null,a=new _font_loader.FontFaceObject(n,{isEvalSupported:s.isEvalSupported,disableFontFace:s.disableFontFace,ignoreErrors:s.ignoreErrors,inspectFont:r});this.fontLoader.bind(a).catch((i=>e.sendWithPromise("FontFallback",{id:t}))).finally((()=>{!s.fontExtraProperties&&a.data&&(a.data=null),this.commonObjs.resolve(t,a)}));break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(t,n);break;default:throw new Error(`Got unknown common object type ${i}`)}})),e.on("obj",(([e,t,i,n])=>{if(this.destroyed)return;const s=this.#c.get(t);if(!s.objs.has(e))switch(i){case"Image":if(s.objs.resolve(e,n),n){let e;if(n.bitmap){const{width:t,height:i}=n;e=t*i*4}else e=n.data?.length||0;e>_util.MAX_IMAGE_SIZE_TO_CACHE&&(s._maybeCleanupAfterRender=!0)}break;case"Pattern":s.objs.resolve(e,n);break;default:throw new Error(`Got unknown object type ${i}`)}})),e.on("DocProgress",(e=>{this.destroyed||t.onProgress?.({loaded:e.loaded,total:e.total})})),e.on("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(){this.annotationStorage.size<=0&&(0,_util.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfers:t}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:this._fullReader?.filename??null},t).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.#d.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);return this.#c.set(t,i),i}));return this.#d.set(t,n),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)}getDocJSActions(){return this.#p("GetDocJSActions")}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.#h.get(e);if(t)return t;const i=this.messageHandler.sendWithPromise(e,null).then((e=>({info:e[0],metadata:e[1]?new _metadata.Metadata(e[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null})));return this.#h.set(e,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const e of this.#c.values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),this.#h.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){return this.#g[e]||={capability:new _util.PromiseCapability,data:null}}get(e,t=null){if(t){const i=this.#f(e);return i.capability.promise.then((()=>t(i.data))),null}const i=this.#g[e];if(!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 t?.capability.settled||!1}resolve(e,t=null){const i=this.#f(e);i.data=t,i.capability.resolve()}clear(){for(const e in this.#g){const{data:t}=this.#g[e];t?.bitmap?.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(e=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&&t?.size>0}}exports.RenderTask=RenderTask;class InternalRenderTask{static#_=new WeakSet;constructor({callback:e,params:t,objs:i,commonObjs:n,annotationCanvasMap:s,operatorList:r,pageIndex:a,canvasFactory:o,filterFactory:l,useRequestAnimationFrame:h=!1,pdfBug:c=!1,pageColors:d=null}){this.callback=e,this.params=t,this.objs=i,this.commonObjs=n,this.annotationCanvasMap=s,this.operatorListIdx=null,this.operatorList=r,this._pageIndex=a,this.canvasFactory=o,this.filterFactory=l,this._pdfBug=c,this.pageColors=d,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===h&&"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=t.canvasContext.canvas}get completed(){return this.capability.promise.catch((function(){}))}initializeGraphics({transparency:e=!1,optionalContentConfig:t}){if(this.cancelled)return;if(this._canvas){if(InternalRenderTask.#_.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.#_.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:i,viewport:n,transform:s,background:r}=this.params;this.gfx=new _canvas.CanvasGraphics(i,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:t},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:s,viewport:n,transparency:e,background:r}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(e=null,t=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),InternalRenderTask.#_.delete(this._canvas),this.callback(e||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,t))}operatorListChanged(){this.graphicsReady?(this.stepper?.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||=this._continueBound}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?window.requestAnimationFrame((()=>{this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),InternalRenderTask.#_.delete(this._canvas),this.callback())))}}const version="3.11.174";exports.version=version;const build="ce8716743";exports.build=build},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SerializableEmpty=t.PrintAnnotationStorage=t.AnnotationStorage=void 0;var n=i(1),s=i(4),r=i(8);const a=Object.freeze({map:null,hash:"",transfers:void 0});t.SerializableEmpty=a;class o{#v=!1;#b=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,t){const i=this.#b.get(e);return void 0===i?t:Object.assign(t,i)}getRawValue(e){return this.#b.get(e)}remove(e){if(this.#b.delete(e),0===this.#b.size&&this.resetModified(),"function"==typeof this.onAnnotationEditor){for(const e of this.#b.values())if(e instanceof s.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(e,t){const i=this.#b.get(e);let n=!1;if(void 0!==i)for(const[e,s]of Object.entries(t))i[e]!==s&&(n=!0,i[e]=s);else n=!0,this.#b.set(e,t);n&&this.#y(),t instanceof s.AnnotationEditor&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(t.constructor._type)}has(e){return this.#b.has(e)}getAll(){return this.#b.size>0?(0,n.objectFromMap)(this.#b):null}setAll(e){for(const[t,i]of Object.entries(e))this.setValue(t,i)}get size(){return this.#b.size}#y(){this.#v||(this.#v=!0,"function"==typeof this.onSetModified&&this.onSetModified())}resetModified(){this.#v&&(this.#v=!1,"function"==typeof this.onResetModified&&this.onResetModified())}get print(){return new l(this)}get serializable(){if(0===this.#b.size)return a;const e=new Map,t=new r.MurmurHash3_64,i=[],n=Object.create(null);let o=!1;for(const[i,r]of this.#b){const a=r instanceof s.AnnotationEditor?r.serialize(!1,n):r;a&&(e.set(i,a),t.update(`${i}:${JSON.stringify(a)}`),o||=!!a.bitmap)}if(o)for(const t of e.values())t.bitmap&&i.push(t.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfers:i}:a}}t.AnnotationStorage=o;class l extends o{#S;constructor(e){super();const{map:t,hash:i,transfers:n}=e.serializable,s=structuredClone(t,n?{transfer:n}:null);this.#S={map:s,hash:i,transfers:n}}get print(){(0,n.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#S}}t.PrintAnnotationStorage=l},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationEditor=void 0;var n=i(5),s=i(1),r=i(6);class a{#P="";#A=!1;#w=null;#E=null;#x=null;#C=!1;#M=null;#T=this.focusin.bind(this);#D=this.focusout.bind(this);#F=!1;#L=!1;#k=!1;_initialOptions=Object.create(null);_uiManager=null;_focusEventsAllowed=!0;_l10nPromise=null;#R=!1;#I=a._zIndex++;static _borderLineWidth=-1;static _colorManager=new n.ColorManager;static _zIndex=1;static SMALL_EDITOR_SIZE=0;constructor(e){this.constructor===a&&(0,s.unreachable)("Cannot initialize AnnotationEditor."),this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null;const{rotation:t,rawDims:{pageWidth:i,pageHeight:n,pageX:r,pageY:o}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,n],this.pageTranslation=[r,o];const[l,h]=this.parentDimensions;this.x=e.x/l,this.y=e.y/h,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return(0,s.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const t=new o({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(e,t=null){if(a._l10nPromise||=new Map(["editor_alt_text_button_label","editor_alt_text_edit_button_label","editor_alt_text_decorative_tooltip"].map((t=>[t,e.get(t)]))),t?.strings)for(const i of t.strings)a._l10nPromise.set(i,e.get(i));if(-1!==a._borderLineWidth)return;const i=getComputedStyle(document.documentElement);a._borderLineWidth=parseFloat(i.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){(0,s.unreachable)("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#R}set _isDraggable(e){this.#R=e,this.div?.classList.toggle("draggable",e)}center(){const[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(2*e),this.y+=this.width*e/(2*t);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(2*e),this.y-=this.width*e/(2*t);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#I}setParent(e){null!==e&&(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions),this.parent=e}focusin(e){this._focusEventsAllowed&&(this.#F?this.#F=!1:this.parent.setSelected(this))}focusout(e){if(!this._focusEventsAllowed)return;if(!this.isAttachedToDOM)return;const t=e.relatedTarget;t?.closest(`#${this.id}`)||(e.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,i,n){const[s,r]=this.parentDimensions;[i,n]=this.screenToPageTranslation(i,n),this.x=(e+i)/s,this.y=(t+n)/r,this.fixAndSetPosition()}#O([e,t],i,n){[i,n]=this.screenToPageTranslation(i,n),this.x+=i/e,this.y+=n/t,this.fixAndSetPosition()}translate(e,t){this.#O(this.parentDimensions,e,t)}translateInPage(e,t){this.#O(this.pageDimensions,e,t),this.div.scrollIntoView({block:"nearest"})}drag(e,t){const[i,n]=this.parentDimensions;if(this.x+=e/i,this.y+=t/n,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:e,y:t}=this.div.getBoundingClientRect();this.parent.findNewParent(this,e,t)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:s,y:r}=this;const[a,o]=this.#N();s+=a,r+=o,this.div.style.left=`${(100*s).toFixed(2)}%`,this.div.style.top=`${(100*r).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}#N(){const[e,t]=this.parentDimensions,{_borderLineWidth:i}=a,n=i/e,s=i/t;switch(this.rotation){case 90:return[-n,s];case 180:return[n,s];case 270:return[n,-s];default:return[-n,-s]}}fixAndSetPosition(){const[e,t]=this.pageDimensions;let{x:i,y:n,width:s,height:r}=this;switch(s*=e,r*=t,i*=e,n*=t,this.rotation){case 0:i=Math.max(0,Math.min(e-s,i)),n=Math.max(0,Math.min(t-r,n));break;case 90:i=Math.max(0,Math.min(e-r,i)),n=Math.min(t,Math.max(s,n));break;case 180:i=Math.min(e,Math.max(s,i)),n=Math.min(t,Math.max(r,n));break;case 270:i=Math.min(e,Math.max(r,i)),n=Math.max(0,Math.min(t-s,n))}this.x=i/=e,this.y=n/=t;const[a,o]=this.#N();i+=a,n+=o;const{style:l}=this.div;l.left=`${(100*i).toFixed(2)}%`,l.top=`${(100*n).toFixed(2)}%`,this.moveInDOM()}static#B(e,t,i){switch(i){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}}screenToPageTranslation(e,t){return a.#B(e,t,this.parentRotation)}pageTranslationToScreen(e,t){return a.#B(e,t,360-this.parentRotation)}#V(e){switch(e){case 90:{const[e,t]=this.pageDimensions;return[0,-e/t,t/e,0]}case 180:return[-1,0,0,-1];case 270:{const[e,t]=this.pageDimensions;return[0,e/t,-t/e,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:e,pageDimensions:[t,i]}=this,n=t*e,r=i*e;return s.FeatureTest.isCSSRoundSupported?[Math.round(n),Math.round(r)]:[n,r]}setDims(e,t){const[i,n]=this.parentDimensions;this.div.style.width=`${(100*e/i).toFixed(2)}%`,this.#C||(this.div.style.height=`${(100*t/n).toFixed(2)}%`),this.#w?.classList.toggle("small",e<a.SMALL_EDITOR_SIZE||t<a.SMALL_EDITOR_SIZE)}fixDims(){const{style:e}=this.div,{height:t,width:i}=e,n=i.endsWith("%"),s=!this.#C&&t.endsWith("%");if(n&&s)return;const[r,a]=this.parentDimensions;n||(e.width=`${(100*parseFloat(i)/r).toFixed(2)}%`),this.#C||s||(e.height=`${(100*parseFloat(t)/a).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#U(){if(this.#M)return;this.#M=document.createElement("div"),this.#M.classList.add("resizers");const e=["topLeft","topRight","bottomRight","bottomLeft"];this._willKeepAspectRatio||e.push("topMiddle","middleRight","bottomMiddle","middleLeft");for(const t of e){const e=document.createElement("div");this.#M.append(e),e.classList.add("resizer",t),e.addEventListener("pointerdown",this.#j.bind(this,t)),e.addEventListener("contextmenu",r.noContextMenu)}this.div.prepend(this.#M)}#j(e,t){t.preventDefault();const{isMac:i}=s.FeatureTest.platform;if(0!==t.button||t.ctrlKey&&i)return;const n=this.#H.bind(this,e),r=this._isDraggable;this._isDraggable=!1;const a={passive:!0,capture:!0};window.addEventListener("pointermove",n,a);const o=this.x,l=this.y,h=this.width,c=this.height,d=this.parent.div.style.cursor,u=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;const p=()=>{this._isDraggable=r,window.removeEventListener("pointerup",p),window.removeEventListener("blur",p),window.removeEventListener("pointermove",n,a),this.parent.div.style.cursor=d,this.div.style.cursor=u;const e=this.x,t=this.y,i=this.width,s=this.height;e===o&&t===l&&i===h&&s===c||this.addCommands({cmd:()=>{this.width=i,this.height=s,this.x=e,this.y=t;const[n,r]=this.parentDimensions;this.setDims(n*i,r*s),this.fixAndSetPosition()},undo:()=>{this.width=h,this.height=c,this.x=o,this.y=l;const[e,t]=this.parentDimensions;this.setDims(e*h,t*c),this.fixAndSetPosition()},mustExec:!0})};window.addEventListener("pointerup",p),window.addEventListener("blur",p)}#H(e,t){const[i,n]=this.parentDimensions,s=this.x,r=this.y,o=this.width,l=this.height,h=a.MIN_SIZE/i,c=a.MIN_SIZE/n,d=e=>Math.round(1e4*e)/1e4,u=this.#V(this.rotation),p=(e,t)=>[u[0]*e+u[2]*t,u[1]*e+u[3]*t],g=this.#V(360-this.rotation);let f,m,_=!1,v=!1;switch(e){case"topLeft":_=!0,f=(e,t)=>[0,0],m=(e,t)=>[e,t];break;case"topMiddle":f=(e,t)=>[e/2,0],m=(e,t)=>[e/2,t];break;case"topRight":_=!0,f=(e,t)=>[e,0],m=(e,t)=>[0,t];break;case"middleRight":v=!0,f=(e,t)=>[e,t/2],m=(e,t)=>[0,t/2];break;case"bottomRight":_=!0,f=(e,t)=>[e,t],m=(e,t)=>[0,0];break;case"bottomMiddle":f=(e,t)=>[e/2,t],m=(e,t)=>[e/2,0];break;case"bottomLeft":_=!0,f=(e,t)=>[0,t],m=(e,t)=>[e,0];break;case"middleLeft":v=!0,f=(e,t)=>[0,t/2],m=(e,t)=>[e,t/2]}const b=f(o,l),y=m(o,l);let S=p(...y);const P=d(s+S[0]),A=d(r+S[1]);let w=1,E=1,[x,C]=this.screenToPageTranslation(t.movementX,t.movementY);var M,T;if([x,C]=(M=x/i,T=C/n,[g[0]*M+g[2]*T,g[1]*M+g[3]*T]),_){const e=Math.hypot(o,l);w=E=Math.max(Math.min(Math.hypot(y[0]-b[0]-x,y[1]-b[1]-C)/e,1/o,1/l),h/o,c/l)}else v?w=Math.max(h,Math.min(1,Math.abs(y[0]-b[0]-x)))/o:E=Math.max(c,Math.min(1,Math.abs(y[1]-b[1]-C)))/l;const D=d(o*w),F=d(l*E);S=p(...m(D,F));const L=P-S[0],k=A-S[1];this.width=D,this.height=F,this.x=L,this.y=k,this.setDims(i*D,n*F),this.fixAndSetPosition()}async addAltTextButton(){if(this.#w)return;const e=this.#w=document.createElement("button");e.className="altText";const t=await a._l10nPromise.get("editor_alt_text_button_label");if(e.textContent=t,e.setAttribute("aria-label",t),e.tabIndex="0",e.addEventListener("contextmenu",r.noContextMenu),e.addEventListener("pointerdown",(e=>e.stopPropagation())),e.addEventListener("click",(e=>{e.preventDefault(),this._uiManager.editAltText(this)}),{capture:!0}),e.addEventListener("keydown",(t=>{t.target===e&&"Enter"===t.key&&(t.preventDefault(),this._uiManager.editAltText(this))})),this.#W(),this.div.append(e),!a.SMALL_EDITOR_SIZE){const t=40;a.SMALL_EDITOR_SIZE=Math.min(128,Math.round(e.getBoundingClientRect().width*(1+t/100)))}}async#W(){const e=this.#w;if(!e)return;if(!this.#P&&!this.#A)return e.classList.remove("done"),void this.#E?.remove();a._l10nPromise.get("editor_alt_text_edit_button_label").then((t=>{e.setAttribute("aria-label",t)}));let t=this.#E;if(!t){this.#E=t=document.createElement("span"),t.className="tooltip",t.setAttribute("role","tooltip");const i=t.id=`alt-text-tooltip-${this.id}`;e.setAttribute("aria-describedby",i);const n=100;e.addEventListener("mouseenter",(()=>{this.#x=setTimeout((()=>{this.#x=null,this.#E.classList.add("show"),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",subtype:this.editorType,data:{action:"alt_text_tooltip"}}})}),n)})),e.addEventListener("mouseleave",(()=>{clearTimeout(this.#x),this.#x=null,this.#E?.classList.remove("show")}))}e.classList.add("done"),t.innerText=this.#A?await a._l10nPromise.get("editor_alt_text_decorative_tooltip"):this.#P,t.parentNode||e.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}get altTextData(){return{altText:this.#P,decorative:this.#A}}set altTextData({altText:e,decorative:t}){this.#P===e&&this.#A===t||(this.#P=e,this.#A=t,this.#W())}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.#T),this.div.addEventListener("focusout",this.#D);const[e,t]=this.parentDimensions;this.parentRotation%180!=0&&(this.div.style.maxWidth=`${(100*t/e).toFixed(2)}%`,this.div.style.maxHeight=`${(100*e/t).toFixed(2)}%`);const[i,s]=this.getInitialTranslation();return this.translate(i,s),(0,n.bindEvents)(this,this.div,["pointerdown"]),this.div}pointerdown(e){const{isMac:t}=s.FeatureTest.platform;0!==e.button||e.ctrlKey&&t?e.preventDefault():(this.#F=!0,this.#z(e))}#z(e){if(!this._isDraggable)return;const t=this._uiManager.isSelected(this);let i,n;this._uiManager.setUpDragSession(),t&&(i={passive:!0,capture:!0},n=e=>{const[t,i]=this.screenToPageTranslation(e.movementX,e.movementY);this._uiManager.dragSelectedEditors(t,i)},window.addEventListener("pointermove",n,i));const r=()=>{if(window.removeEventListener("pointerup",r),window.removeEventListener("blur",r),t&&window.removeEventListener("pointermove",n,i),this.#F=!1,!this._uiManager.endDragSession()){const{isMac:t}=s.FeatureTest.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)}};window.addEventListener("pointerup",r),window.addEventListener("blur",r)}moveInDOM(){this.parent?.moveEditorInDOM(this)}_setParentAndPosition(e,t,i){e.changeParent(this),this.x=t,this.y=i,this.fixAndSetPosition()}getRect(e,t){const i=this.parentScale,[n,s]=this.pageDimensions,[r,a]=this.pageTranslation,o=e/i,l=t/i,h=this.x*n,c=this.y*s,d=this.width*n,u=this.height*s;switch(this.rotation){case 0:return[h+o+r,s-c-l-u+a,h+o+d+r,s-c-l+a];case 90:return[h+l+r,s-c+o+a,h+l+u+r,s-c+o+d+a];case 180:return[h-o-d+r,s-c+l+a,h-o+r,s-c+l+u+a];case 270:return[h-l-u+r,s-c-o-d+a,h-l+r,s-c-o+a];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,t){const[i,n,s,r]=e,a=s-i,o=r-n;switch(this.rotation){case 0:return[i,t-r,a,o];case 90:return[i,t-n,o,a];case 180:return[s,t-n,a,o];case 270:return[s,t-r,o,a];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#k=!0}disableEditMode(){this.#k=!1}isInEditMode(){return this.#k}shouldGetKeyboardEvents(){return!1}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){this.div?.addEventListener("focusin",this.#T),this.div?.addEventListener("focusout",this.#D)}serialize(e=!1,t=null){(0,s.unreachable)("An editor must be serializable")}static deserialize(e,t,i){const n=new this.prototype.constructor({parent:t,id:t.getNextId(),uiManager:i});n.rotation=e.rotation;const[s,r]=n.pageDimensions,[a,o,l,h]=n.getRectInCurrentCoords(e.rect,r);return n.x=a/s,n.y=o/r,n.width=l/s,n.height=h/r,n}remove(){this.div.removeEventListener("focusin",this.#T),this.div.removeEventListener("focusout",this.#D),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#w?.remove(),this.#w=null,this.#E=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#U(),this.#M.classList.remove("hidden"))}select(){this.makeResizable(),this.div?.classList.add("selectedEditor")}unselect(){this.#M?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus()}updateParams(e,t){}disableEditing(){this.#w&&(this.#w.hidden=!0)}enableEditing(){this.#w&&(this.#w.hidden=!1)}enterInEditMode(){}get contentDiv(){return this.div}get isEditing(){return this.#L}set isEditing(e){this.#L=e,this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(e,t){this.#C=!0;const i=e/t,{style:n}=this.div;n.aspectRatio=i,n.height="auto"}static get MIN_SIZE(){return 16}}t.AnnotationEditor=a;class o extends a{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.KeyboardManager=t.CommandManager=t.ColorManager=t.AnnotationEditorUIManager=void 0,t.bindEvents=function(e,t,i){for(const n of i)t.addEventListener(n,e[n].bind(e))},t.opacityToHex=function(e){return Math.round(Math.min(255,Math.max(1,255*e))).toString(16).padStart(2,"0")};var n=i(1),s=i(6);class r{#G=0;getId(){return`${n.AnnotationEditorPrefix}${this.#G++}`}}class a{#$=(0,n.getUuid)();#G=0;#q=null;static get _isSVGFittingCanvas(){const e=new OffscreenCanvas(1,3).getContext("2d"),t=new Image;t.src='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>';const i=t.decode().then((()=>(e.drawImage(t,0,0,1,1,0,0,1,3),0===new Uint32Array(e.getImageData(0,0,1,1).data.buffer)[0])));return(0,n.shadow)(this,"_isSVGFittingCanvas",i)}async#X(e,t){this.#q||=new Map;let i=this.#q.get(e);if(null===i)return null;if(i?.bitmap)return i.refCounter+=1,i;try{let e;if(i||={bitmap:null,id:`image_${this.#$}_${this.#G++}`,refCounter:0,isSvg:!1},"string"==typeof t){i.url=t;const n=await fetch(t);if(!n.ok)throw new Error(n.statusText);e=await n.blob()}else e=i.file=t;if("image/svg+xml"===e.type){const t=a._isSVGFittingCanvas,n=new FileReader,s=new Image,r=new Promise(((e,r)=>{s.onload=()=>{i.bitmap=s,i.isSvg=!0,e()},n.onload=async()=>{const e=i.svgUrl=n.result;s.src=await t?`${e}#svgView(preserveAspectRatio(none))`:e},s.onerror=n.onerror=r}));n.readAsDataURL(e),await r}else i.bitmap=await createImageBitmap(e);i.refCounter=1}catch(e){console.error(e),i=null}return this.#q.set(e,i),i&&this.#q.set(i.id,i),i}async getFromFile(e){const{lastModified:t,name:i,size:n,type:s}=e;return this.#X(`${t}_${i}_${n}_${s}`,e)}async getFromUrl(e){return this.#X(e,e)}async getFromId(e){this.#q||=new Map;const t=this.#q.get(e);return t?t.bitmap?(t.refCounter+=1,t):t.file?this.getFromFile(t.file):this.getFromUrl(t.url):null}getSvgUrl(e){const t=this.#q.get(e);return t?.isSvg?t.svgUrl:null}deleteId(e){this.#q||=new Map;const t=this.#q.get(e);t&&(t.refCounter-=1,0===t.refCounter&&(t.bitmap=null))}isValidId(e){return e.startsWith(`image_${this.#$}_`)}}class o{#K=[];#Y=!1;#Q;#J=-1;constructor(e=128){this.#Q=e}add({cmd:e,undo:t,mustExec:i,type:n=NaN,overwriteIfSameType:s=!1,keepUndo:r=!1}){if(i&&e(),this.#Y)return;const a={cmd:e,undo:t,type:n};if(-1===this.#J)return this.#K.length>0&&(this.#K.length=0),this.#J=0,void this.#K.push(a);if(s&&this.#K[this.#J].type===n)return r&&(a.undo=this.#K[this.#J].undo),void(this.#K[this.#J]=a);const o=this.#J+1;o===this.#Q?this.#K.splice(0,1):(this.#J=o,o<this.#K.length&&this.#K.splice(o)),this.#K.push(a)}undo(){-1!==this.#J&&(this.#Y=!0,this.#K[this.#J].undo(),this.#Y=!1,this.#J-=1)}redo(){this.#J<this.#K.length-1&&(this.#J+=1,this.#Y=!0,this.#K[this.#J].cmd(),this.#Y=!1)}hasSomethingToUndo(){return-1!==this.#J}hasSomethingToRedo(){return this.#J<this.#K.length-1}destroy(){this.#K=null}}t.CommandManager=o;class l{constructor(e){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:t}=n.FeatureTest.platform;for(const[i,n,s={}]of e)for(const e of i){const i=e.startsWith("mac+");t&&i?(this.callbacks.set(e.slice(4),{callback:n,options:s}),this.allKeys.add(e.split("+").at(-1))):t||i||(this.callbacks.set(e,{callback:n,options:s}),this.allKeys.add(e.split("+").at(-1)))}}#Z(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("+");return this.buffer.length=0,t}exec(e,t){if(!this.allKeys.has(t.key))return;const i=this.callbacks.get(this.#Z(t));if(!i)return;const{callback:n,options:{bubbles:s=!1,args:r=[],checker:a=null}}=i;a&&!a(e,t)||(n.bind(e,...r)(),s||(t.stopPropagation(),t.preventDefault()))}}t.KeyboardManager=l;class h{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return(0,s.getColorValues)(e),(0,n.shadow)(this,"_colors",e)}convert(e){const t=(0,s.getRGB)(e);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[e,i]of this._colors)if(i.every(((e,i)=>e===t[i])))return h._colorsMapping.get(e);return t}getHexCode(e){const t=this._colors.get(e);return t?n.Util.makeHexColor(...t):e}}t.ColorManager=h;class c{#ee=null;#te=new Map;#ie=new Map;#ne=null;#se=null;#re=new o;#ae=0;#oe=new Set;#le=null;#he=null;#ce=new Set;#de=null;#ue=new r;#pe=!1;#ge=!1;#fe=null;#me=n.AnnotationEditorType.NONE;#_e=new Set;#ve=null;#be=this.blur.bind(this);#ye=this.focus.bind(this);#Se=this.copy.bind(this);#Pe=this.cut.bind(this);#Ae=this.paste.bind(this);#we=this.keydown.bind(this);#Ee=this.onEditingAction.bind(this);#xe=this.onPageChanging.bind(this);#Ce=this.onScaleChanging.bind(this);#Me=this.onRotationChanging.bind(this);#Te={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1};#De=[0,0];#Fe=null;#Le=null;#ke=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const e=c.prototype,t=e=>{const{activeElement:t}=document;return t&&e.#Le.contains(t)&&e.hasSomethingToControl()},i=this.TRANSLATE_SMALL,s=this.TRANSLATE_BIG;return(0,n.shadow)(this,"_keyboardManager",new l([[["ctrl+a","mac+meta+a"],e.selectAll],[["ctrl+z","mac+meta+z"],e.undo],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-i,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-s,0],checker:t}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[i,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[s,0],checker:t}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-i],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-s],checker:t}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,i],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,s],checker:t}]]))}constructor(e,t,i,n,r,a){this.#Le=e,this.#ke=t,this.#ne=i,this._eventBus=n,this._eventBus._on("editingaction",this.#Ee),this._eventBus._on("pagechanging",this.#xe),this._eventBus._on("scalechanging",this.#Ce),this._eventBus._on("rotationchanging",this.#Me),this.#se=r.annotationStorage,this.#de=r.filterFactory,this.#ve=a,this.viewParameters={realScale:s.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0}}destroy(){this.#Re(),this.#Ie(),this._eventBus._off("editingaction",this.#Ee),this._eventBus._off("pagechanging",this.#xe),this._eventBus._off("scalechanging",this.#Ce),this._eventBus._off("rotationchanging",this.#Me);for(const e of this.#ie.values())e.destroy();this.#ie.clear(),this.#te.clear(),this.#ce.clear(),this.#ee=null,this.#_e.clear(),this.#re.destroy(),this.#ne.destroy()}get hcmFilter(){return(0,n.shadow)(this,"hcmFilter",this.#ve?this.#de.addHCMFilter(this.#ve.foreground,this.#ve.background):"none")}get direction(){return(0,n.shadow)(this,"direction",getComputedStyle(this.#Le).direction)}editAltText(e){this.#ne?.editAltText(this,e)}onPageChanging({pageNumber:e}){this.#ae=e-1}focusMainContainer(){this.#Le.focus()}findParent(e,t){for(const i of this.#ie.values()){const{x:n,y:s,width:r,height:a}=i.div.getBoundingClientRect();if(e>=n&&e<=n+r&&t>=s&&t<=s+a)return i}return null}disableUserSelect(e=!1){this.#ke.classList.toggle("noUserSelect",e)}addShouldRescale(e){this.#ce.add(e)}removeShouldRescale(e){this.#ce.delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*s.PixelsPerInch.PDF_TO_CSS_UNITS;for(const e of this.#ce)e.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}addToAnnotationStorage(e){e.isEmpty()||!this.#se||this.#se.has(e.id)||this.#se.setValue(e.id,e)}#Oe(){window.addEventListener("focus",this.#ye),window.addEventListener("blur",this.#be)}#Ie(){window.removeEventListener("focus",this.#ye),window.removeEventListener("blur",this.#be)}blur(){if(!this.hasSelection)return;const{activeElement:e}=document;for(const t of this.#_e)if(t.div.contains(e)){this.#fe=[t,e],t._focusEventsAllowed=!1;break}}focus(){if(!this.#fe)return;const[e,t]=this.#fe;this.#fe=null,t.addEventListener("focusin",(()=>{e._focusEventsAllowed=!0}),{once:!0}),t.focus()}#Ne(){window.addEventListener("keydown",this.#we,{capture:!0})}#Re(){window.removeEventListener("keydown",this.#we,{capture:!0})}#Be(){document.addEventListener("copy",this.#Se),document.addEventListener("cut",this.#Pe),document.addEventListener("paste",this.#Ae)}#Ve(){document.removeEventListener("copy",this.#Se),document.removeEventListener("cut",this.#Pe),document.removeEventListener("paste",this.#Ae)}addEditListeners(){this.#Ne(),this.#Be()}removeEditListeners(){this.#Re(),this.#Ve()}copy(e){if(e.preventDefault(),this.#ee?.commitOrRemove(),!this.hasSelection)return;const t=[];for(const e of this.#_e){const i=e.serialize(!0);i&&t.push(i)}0!==t.length&&e.clipboardData.setData("application/pdfjs",JSON.stringify(t))}cut(e){this.copy(e),this.delete()}paste(e){e.preventDefault();const{clipboardData:t}=e;for(const e of t.items)for(const t of this.#he)if(t.isHandlingMimeForPasting(e.type))return void t.paste(e,this.currentLayer);let i=t.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(e){return void(0,n.warn)(`paste: "${e.message}".`)}if(!Array.isArray(i))return;this.unselectAll();const s=this.currentLayer;try{const e=[];for(const t of i){const i=s.deserialize(t);if(!i)return;e.push(i)}const t=()=>{for(const t of e)this.#Ue(t);this.#je(e)},n=()=>{for(const t of e)t.remove()};this.addCommands({cmd:t,undo:n,mustExec:!0})}catch(e){(0,n.warn)(`paste: "${e.message}".`)}}keydown(e){this.getActive()?.shouldGetKeyboardEvents()||c._keyboardManager.exec(this,e)}onEditingAction(e){["undo","redo","delete","selectAll"].includes(e.name)&&this[e.name]()}#He(e){Object.entries(e).some((([e,t])=>this.#Te[e]!==t))&&this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#Te,e)})}#We(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})}setEditingState(e){e?(this.#Oe(),this.#Ne(),this.#Be(),this.#He({isEditing:this.#me!==n.AnnotationEditorType.NONE,isEmpty:this.#ze(),hasSomethingToUndo:this.#re.hasSomethingToUndo(),hasSomethingToRedo:this.#re.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#Ie(),this.#Re(),this.#Ve(),this.#He({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!this.#he){this.#he=e;for(const e of this.#he)this.#We(e.defaultPropertiesToUpdate)}}getId(){return this.#ue.getId()}get currentLayer(){return this.#ie.get(this.#ae)}getLayer(e){return this.#ie.get(e)}get currentPageIndex(){return this.#ae}addLayer(e){this.#ie.set(e.pageIndex,e),this.#pe?e.enable():e.disable()}removeLayer(e){this.#ie.delete(e.pageIndex)}updateMode(e,t=null){if(this.#me!==e){if(this.#me=e,e===n.AnnotationEditorType.NONE)return this.setEditingState(!1),void this.#Ge();this.setEditingState(!0),this.#$e(),this.unselectAll();for(const t of this.#ie.values())t.updateMode(e);if(t)for(const e of this.#te.values())if(e.annotationElementId===t){this.setSelected(e),e.enterInEditMode();break}}}updateToolbar(e){e!==this.#me&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:e})}updateParams(e,t){if(this.#he)if(e!==n.AnnotationEditorParamsType.CREATE){for(const i of this.#_e)i.updateParams(e,t);for(const i of this.#he)i.updateDefaultParams(e,t)}else this.currentLayer.addNewEditor(e)}enableWaiting(e=!1){if(this.#ge!==e){this.#ge=e;for(const t of this.#ie.values())e?t.disableClick():t.enableClick(),t.div.classList.toggle("waiting",e)}}#$e(){if(!this.#pe){this.#pe=!0;for(const e of this.#ie.values())e.enable()}}#Ge(){if(this.unselectAll(),this.#pe){this.#pe=!1;for(const e of this.#ie.values())e.disable()}}getEditors(e){const t=[];for(const i of this.#te.values())i.pageIndex===e&&t.push(i);return t}getEditor(e){return this.#te.get(e)}addEditor(e){this.#te.set(e.id,e)}removeEditor(e){this.#te.delete(e.id),this.unselect(e),e.annotationElementId&&this.#oe.has(e.annotationElementId)||this.#se?.remove(e.id)}addDeletedAnnotationElement(e){this.#oe.add(e.annotationElementId),e.deleted=!0}isDeletedAnnotationElement(e){return this.#oe.has(e)}removeDeletedAnnotationElement(e){this.#oe.delete(e.annotationElementId),e.deleted=!1}#Ue(e){const t=this.#ie.get(e.pageIndex);t?t.addOrRebuild(e):this.addEditor(e)}setActiveEditor(e){this.#ee!==e&&(this.#ee=e,e&&this.#We(e.propertiesToUpdate))}toggleSelected(e){if(this.#_e.has(e))return this.#_e.delete(e),e.unselect(),void this.#He({hasSelectedEditor:this.hasSelection});this.#_e.add(e),e.select(),this.#We(e.propertiesToUpdate),this.#He({hasSelectedEditor:!0})}setSelected(e){for(const t of this.#_e)t!==e&&t.unselect();this.#_e.clear(),this.#_e.add(e),e.select(),this.#We(e.propertiesToUpdate),this.#He({hasSelectedEditor:!0})}isSelected(e){return this.#_e.has(e)}unselect(e){e.unselect(),this.#_e.delete(e),this.#He({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#_e.size}undo(){this.#re.undo(),this.#He({hasSomethingToUndo:this.#re.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#ze()})}redo(){this.#re.redo(),this.#He({hasSomethingToUndo:!0,hasSomethingToRedo:this.#re.hasSomethingToRedo(),isEmpty:this.#ze()})}addCommands(e){this.#re.add(e),this.#He({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#ze()})}#ze(){if(0===this.#te.size)return!0;if(1===this.#te.size)for(const e of this.#te.values())return e.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const e=[...this.#_e];this.addCommands({cmd:()=>{for(const t of e)t.remove()},undo:()=>{for(const t of e)this.#Ue(t)},mustExec:!0})}commitOrRemove(){this.#ee?.commitOrRemove()}hasSomethingToControl(){return this.#ee||this.hasSelection}#je(e){this.#_e.clear();for(const t of e)t.isEmpty()||(this.#_e.add(t),t.select());this.#He({hasSelectedEditor:!0})}selectAll(){for(const e of this.#_e)e.commit();this.#je(this.#te.values())}unselectAll(){if(this.#ee)this.#ee.commitOrRemove();else if(this.hasSelection){for(const e of this.#_e)e.unselect();this.#_e.clear(),this.#He({hasSelectedEditor:!1})}}translateSelectedEditors(e,t,i=!1){if(i||this.commitOrRemove(),!this.hasSelection)return;this.#De[0]+=e,this.#De[1]+=t;const[n,s]=this.#De,r=[...this.#_e];this.#Fe&&clearTimeout(this.#Fe),this.#Fe=setTimeout((()=>{this.#Fe=null,this.#De[0]=this.#De[1]=0,this.addCommands({cmd:()=>{for(const e of r)this.#te.has(e.id)&&e.translateInPage(n,s)},undo:()=>{for(const e of r)this.#te.has(e.id)&&e.translateInPage(-n,-s)},mustExec:!1})}),1e3);for(const i of r)i.translateInPage(e,t)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#le=new Map;for(const e of this.#_e)this.#le.set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#le)return!1;this.disableUserSelect(!1);const e=this.#le;this.#le=null;let t=!1;for(const[{x:i,y:n,pageIndex:s},r]of e)r.newX=i,r.newY=n,r.newPageIndex=s,t||=i!==r.savedX||n!==r.savedY||s!==r.savedPageIndex;if(!t)return!1;const i=(e,t,i,n)=>{if(this.#te.has(e.id)){const s=this.#ie.get(n);s?e._setParentAndPosition(s,t,i):(e.pageIndex=n,e.x=t,e.y=i)}};return this.addCommands({cmd:()=>{for(const[t,{newX:n,newY:s,newPageIndex:r}]of e)i(t,n,s,r)},undo:()=>{for(const[t,{savedX:n,savedY:s,savedPageIndex:r}]of e)i(t,n,s,r)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(this.#le)for(const i of this.#le.keys())i.drag(e,t)}rebuild(e){if(null===e.parent){const t=this.getLayer(e.pageIndex);t?(t.changeParent(e),t.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}isActive(e){return this.#ee===e}getActive(){return this.#ee}getMode(){return this.#me}get imageManager(){return(0,n.shadow)(this,"imageManager",new a)}}t.AnnotationEditorUIManager=c},(e,t,i)=>{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=void 0,t.deprecated=function(e){console.log("Deprecated API usage: "+e)},t.getColorValues=function(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,v(n))}t.remove()},t.getCurrentTransform=function(e){const{a:t,b:i,c:n,d:s,e:r,f:a}=e.getTransform();return[t,i,n,s,r,a]},t.getCurrentTransformInverse=function(e){const{a:t,b:i,c:n,d:s,e:r,f:a}=e.getTransform().invertSelf();return[t,i,n,s,r,a]},t.getFilenameFromUrl=function(e,t=!1){return t||([e]=e.split(/[#?]/,1)),e.substring(e.lastIndexOf("/")+1)},t.getPdfFilenameFromUrl=function(e,t="document.pdf"){if("string"!=typeof e)return t;if(f(e))return(0,s.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const i=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,n=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(e);let r=i.exec(n[1])||i.exec(n[2])||i.exec(n[3]);if(r&&(r=r[0],r.includes("%")))try{r=i.exec(decodeURIComponent(r))[0]}catch{}return r||t},t.getRGB=v,t.getXfaPageViewport=function(e,{scale:t=1,rotation:i=0}){const{width:n,height:s}=e.attributes.style,r=[0,0,parseInt(n),parseInt(s)];return new p({viewBox:r,scale:t,rotation:i})},t.isDataScheme=f,t.isPdfFile=function(e){return"string"==typeof e&&/\.pdf$/i.test(e)},t.isValidFetchUrl=m,t.loadScript=function(e,t=!1){return new Promise(((i,n)=>{const s=document.createElement("script");s.src=e,s.onload=function(e){t&&s.remove(),i(e)},s.onerror=function(){n(new Error(`Cannot load script at: ${s.src}`))},(document.head||document.documentElement).append(s)}))},t.noContextMenu=function(e){e.preventDefault()},t.setLayerDimensions=function(e,t,i=!1,n=!0){if(t instanceof p){const{pageWidth:n,pageHeight:r}=t.rawDims,{style:a}=e,o=s.FeatureTest.isCSSRoundSupported,l=`var(--scale-factor) * ${n}px`,h=`var(--scale-factor) * ${r}px`,c=o?`round(${l}, 1px)`:`calc(${l})`,d=o?`round(${h}, 1px)`:`calc(${h})`;i&&t.rotation%180!=0?(a.width=d,a.height=c):(a.width=c,a.height=d)}n&&e.setAttribute("data-main-rotation",t.rotation)};var n=i(7),s=i(1);const r="http://www.w3.org/2000/svg";class a{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}t.PixelsPerInch=a;class o extends n.BaseFilterFactory{#qe;#Xe;#t;#Ke;#Ye;#Qe;#Je;#Ze;#et;#tt;#G=0;constructor({docId:e,ownerDocument:t=globalThis.document}={}){super(),this.#t=e,this.#Ke=t}get#q(){return this.#qe||=new Map}get#it(){if(!this.#Xe){const e=this.#Ke.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.#Ke.createElementNS(r,"svg");i.setAttribute("width",0),i.setAttribute("height",0),this.#Xe=this.#Ke.createElementNS(r,"defs"),e.append(i),i.append(this.#Xe),this.#Ke.body.append(e)}return this.#Xe}addFilter(e){if(!e)return"none";let t,i,n,s,r=this.#q.get(e);if(r)return r;if(1===e.length){const r=e[0],a=new Array(256);for(let e=0;e<256;e++)a[e]=r[e]/255;s=t=i=n=a.join(",")}else{const[r,a,o]=e,l=new Array(256),h=new Array(256),c=new Array(256);for(let e=0;e<256;e++)l[e]=r[e]/255,h[e]=a[e]/255,c[e]=o[e]/255;t=l.join(","),i=h.join(","),n=c.join(","),s=`${t}${i}${n}`}if(r=this.#q.get(s),r)return this.#q.set(e,r),r;const a=`g_${this.#t}_transfer_map_${this.#G++}`,o=`url(#${a})`;this.#q.set(e,o),this.#q.set(s,o);const l=this.#nt(a);return this.#st(t,i,n,l),o}addHCMFilter(e,t){const i=`${e}-${t}`;if(this.#Qe===i)return this.#Je;if(this.#Qe=i,this.#Je="none",this.#Ye?.remove(),!e||!t)return this.#Je;const n=this.#rt(e);e=s.Util.makeHexColor(...n);const r=this.#rt(t);if(t=s.Util.makeHexColor(...r),this.#it.style.color="","#000000"===e&&"#ffffff"===t||e===t)return this.#Je;const a=new Array(256);for(let e=0;e<=255;e++){const t=e/255;a[e]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}const o=a.join(","),l=`g_${this.#t}_hcm_filter`,h=this.#Ze=this.#nt(l);this.#st(o,o,o,h),this.#at(h);const c=(e,t)=>{const i=n[e]/255,s=r[e]/255,a=new Array(t+1);for(let e=0;e<=t;e++)a[e]=i+e/t*(s-i);return a.join(",")};return this.#st(c(0,5),c(1,5),c(2,5),h),this.#Je=`url(#${l})`,this.#Je}addHighlightHCMFilter(e,t,i,n){const s=`${e}-${t}-${i}-${n}`;if(this.#et===s)return this.#tt;if(this.#et=s,this.#tt="none",this.#Ze?.remove(),!e||!t)return this.#tt;const[r,a]=[e,t].map(this.#rt.bind(this));let o=Math.round(.2126*r[0]+.7152*r[1]+.0722*r[2]),l=Math.round(.2126*a[0]+.7152*a[1]+.0722*a[2]),[h,c]=[i,n].map(this.#rt.bind(this));l<o&&([o,l,h,c]=[l,o,c,h]),this.#it.style.color="";const d=(e,t,i)=>{const n=new Array(256),s=(l-o)/i,r=e/255,a=(t-e)/(255*i);let h=0;for(let e=0;e<=i;e++){const t=Math.round(o+e*s),i=r+e*a;for(let e=h;e<=t;e++)n[e]=i;h=t+1}for(let e=h;e<256;e++)n[e]=n[h-1];return n.join(",")},u=`g_${this.#t}_hcm_highlight_filter`,p=this.#Ze=this.#nt(u);return this.#at(p),this.#st(d(h[0],c[0],5),d(h[1],c[1],5),d(h[2],c[2],5),p),this.#tt=`url(#${u})`,this.#tt}destroy(e=!1){e&&(this.#Je||this.#tt)||(this.#Xe&&(this.#Xe.parentNode.parentNode.remove(),this.#Xe=null),this.#qe&&(this.#qe.clear(),this.#qe=null),this.#G=0)}#at(e){const t=this.#Ke.createElementNS(r,"feColorMatrix");t.setAttribute("type","matrix"),t.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"),e.append(t)}#nt(e){const t=this.#Ke.createElementNS(r,"filter");return t.setAttribute("color-interpolation-filters","sRGB"),t.setAttribute("id",e),this.#it.append(t),t}#ot(e,t,i){const n=this.#Ke.createElementNS(r,t);n.setAttribute("type","discrete"),n.setAttribute("tableValues",i),e.append(n)}#st(e,t,i,n){const s=this.#Ke.createElementNS(r,"feComponentTransfer");n.append(s),this.#ot(s,"feFuncR",e),this.#ot(s,"feFuncG",t),this.#ot(s,"feFuncB",i)}#rt(e){return this.#it.style.color=e,v(getComputedStyle(this.#it).getPropertyValue("color"))}}t.DOMFilterFactory=o;class l extends n.BaseCanvasFactory{constructor({ownerDocument:e=globalThis.document}={}){super(),this._document=e}_createCanvas(e,t){const i=this._document.createElement("canvas");return i.width=e,i.height=t,i}}async function h(e,t=!1){if(m(e,document.baseURI)){const i=await fetch(e);if(!i.ok)throw new Error(i.statusText);return t?new Uint8Array(await i.arrayBuffer()):(0,s.stringToBytes)(await i.text())}return new Promise(((i,n)=>{const r=new XMLHttpRequest;r.open("GET",e,!0),t&&(r.responseType="arraybuffer"),r.onreadystatechange=()=>{if(r.readyState===XMLHttpRequest.DONE){if(200===r.status||0===r.status){let e;if(t&&r.response?e=new Uint8Array(r.response):!t&&r.responseText&&(e=(0,s.stringToBytes)(r.responseText)),e)return void i(e)}n(new Error(r.statusText))}},r.send(null)}))}t.DOMCanvasFactory=l;class c extends n.BaseCMapReaderFactory{_fetchData(e,t){return h(e,this.isCompressed).then((e=>({cMapData:e,compressionType:t})))}}t.DOMCMapReaderFactory=c;class d extends n.BaseStandardFontDataFactory{_fetchData(e){return h(e,!0)}}t.DOMStandardFontDataFactory=d;class u extends n.BaseSVGFactory{_createSVG(e){return document.createElementNS(r,e)}}t.DOMSVGFactory=u;class p{constructor({viewBox:e,scale:t,rotation:i,offsetX:n=0,offsetY:s=0,dontFlip:r=!1}){this.viewBox=e,this.scale=t,this.rotation=i,this.offsetX=n,this.offsetY=s;const a=(e[2]+e[0])/2,o=(e[3]+e[1])/2;let l,h,c,d,u,p,g,f;switch((i%=360)<0&&(i+=360),i){case 180:l=-1,h=0,c=0,d=1;break;case 90:l=0,h=1,c=1,d=0;break;case 270:l=0,h=-1,c=-1,d=0;break;case 0:l=1,h=0,c=0,d=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}r&&(c=-c,d=-d),0===l?(u=Math.abs(o-e[1])*t+n,p=Math.abs(a-e[0])*t+s,g=(e[3]-e[1])*t,f=(e[2]-e[0])*t):(u=Math.abs(a-e[0])*t+n,p=Math.abs(o-e[1])*t+s,g=(e[2]-e[0])*t,f=(e[3]-e[1])*t),this.transform=[l*t,h*t,c*t,d*t,u-l*t*a-c*t*o,p-h*t*a-d*t*o],this.width=g,this.height=f}get rawDims(){const{viewBox:e}=this;return(0,s.shadow)(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:i=this.offsetX,offsetY:n=this.offsetY,dontFlip:s=!1}={}){return new p({viewBox:this.viewBox.slice(),scale:e,rotation:t,offsetX:i,offsetY:n,dontFlip:s})}convertToViewportPoint(e,t){return s.Util.applyTransform([e,t],this.transform)}convertToViewportRectangle(e){const t=s.Util.applyTransform([e[0],e[1]],this.transform),i=s.Util.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],i[0],i[1]]}convertToPdfPoint(e,t){return s.Util.applyInverseTransform([e,t],this.transform)}}t.PageViewport=p;class g extends s.BaseException{constructor(e,t=0){super(e,"RenderingCancelledException"),this.extraDelay=t}}function f(e){const t=e.length;let i=0;for(;i<t&&""===e[i].trim();)i++;return"data:"===e.substring(i,i+5).toLowerCase()}function m(e,t){try{const{protocol:i}=t?new URL(e,t):new URL(e);return"http:"===i||"https:"===i}catch{return!1}}let _;function v(e){if(e.startsWith("#")){const t=parseInt(e.slice(1),16);return[(16711680&t)>>16,(65280&t)>>8,255&t]}return e.startsWith("rgb(")?e.slice(4,-1).split(",").map((e=>parseInt(e))):e.startsWith("rgba(")?e.slice(5,-1).split(",").map((e=>parseInt(e))).slice(0,3):((0,s.warn)(`Not a valid color format: "${e}"`),[0,0,0])}t.RenderingCancelledException=g,t.StatTimer=class{started=Object.create(null);times=[];time(e){e in this.started&&(0,s.warn)(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||(0,s.warn)(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){const e=[];let t=0;for(const{name:e}of this.times)t=Math.max(e.length,t);for(const{name:i,start:n,end:s}of this.times)e.push(`${i.padEnd(t)} ${s-n}ms\n`);return e.join("")}},t.PDFDateString=class{static toDateObject(e){if(!e||"string"!=typeof e)return null;_||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const t=_.exec(e);if(!t)return null;const i=parseInt(t[1],10);let n=parseInt(t[2],10);n=n>=1&&n<=12?n-1:0;let s=parseInt(t[3],10);s=s>=1&&s<=31?s:1;let r=parseInt(t[4],10);r=r>=0&&r<=23?r:0;let a=parseInt(t[5],10);a=a>=0&&a<=59?a:0;let o=parseInt(t[6],10);o=o>=0&&o<=59?o:0;const l=t[7]||"Z";let h=parseInt(t[8],10);h=h>=0&&h<=23?h:0;let c=parseInt(t[9],10)||0;return c=c>=0&&c<=59?c:0,"-"===l?(r+=h,a+=c):"+"===l&&(r-=h,a-=c),new Date(Date.UTC(i,n,s,r,a,o))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseStandardFontDataFactory=t.BaseSVGFactory=t.BaseFilterFactory=t.BaseCanvasFactory=t.BaseCMapReaderFactory=void 0;var n=i(1);class s{constructor(){this.constructor===s&&(0,n.unreachable)("Cannot initialize BaseFilterFactory.")}addFilter(e){return"none"}addHCMFilter(e,t){return"none"}addHighlightHCMFilter(e,t,i,n){return"none"}destroy(e=!1){}}t.BaseFilterFactory=s;class r{constructor(){this.constructor===r&&(0,n.unreachable)("Cannot initialize BaseCanvasFactory.")}create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const i=this._createCanvas(e,t);return{canvas:i,context:i.getContext("2d")}}reset(e,t,i){if(!e.canvas)throw new Error("Canvas is not specified");if(t<=0||i<=0)throw new Error("Invalid canvas size");e.canvas.width=t,e.canvas.height=i}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){(0,n.unreachable)("Abstract method `_createCanvas` called.")}}t.BaseCanvasFactory=r;class a{constructor({baseUrl:e=null,isCompressed:t=!0}){this.constructor===a&&(0,n.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=e,this.isCompressed=t}async fetch({name:e}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!e)throw new Error("CMap name must be specified.");const t=this.baseUrl+e+(this.isCompressed?".bcmap":""),i=this.isCompressed?n.CMapCompressionType.BINARY:n.CMapCompressionType.NONE;return this._fetchData(t,i).catch((e=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${t}`)}))}_fetchData(e,t){(0,n.unreachable)("Abstract method `_fetchData` called.")}}t.BaseCMapReaderFactory=a;class o{constructor({baseUrl:e=null}){this.constructor===o&&(0,n.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!e)throw new Error("Font filename must be specified.");const t=`${this.baseUrl}${e}`;return this._fetchData(t).catch((e=>{throw new Error(`Unable to load font data at: ${t}`)}))}_fetchData(e){(0,n.unreachable)("Abstract method `_fetchData` called.")}}t.BaseStandardFontDataFactory=o;class l{constructor(){this.constructor===l&&(0,n.unreachable)("Cannot initialize BaseSVGFactory.")}create(e,t,i=!1){if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");const n=this._createSVG("svg:svg");return n.setAttribute("version","1.1"),i||(n.setAttribute("width",`${e}px`),n.setAttribute("height",`${t}px`)),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("viewBox",`0 0 ${e} ${t}`),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=l},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MurmurHash3_64=void 0;var n=i(1);const s=3285377520,r=4294901760,a=65535;t.MurmurHash3_64=class{constructor(e){this.h1=e?4294967295&e:s,this.h2=e?4294967295&e:s}update(e){let t,i;if("string"==typeof e){t=new Uint8Array(2*e.length),i=0;for(let n=0,s=e.length;n<s;n++){const s=e.charCodeAt(n);s<=255?t[i++]=s:(t[i++]=s>>>8,t[i++]=255&s)}}else{if(!(0,n.isArrayBuffer)(e))throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");t=e.slice(),i=t.byteLength}const s=i>>2,o=i-4*s,l=new Uint32Array(t.buffer,0,s);let h=0,c=0,d=this.h1,u=this.h2;const p=3432918353,g=461845907,f=11601,m=13715;for(let e=0;e<s;e++)1&e?(h=l[e],h=h*p&r|h*f&a,h=h<<15|h>>>17,h=h*g&r|h*m&a,d^=h,d=d<<13|d>>>19,d=5*d+3864292196):(c=l[e],c=c*p&r|c*f&a,c=c<<15|c>>>17,c=c*g&r|c*m&a,u^=c,u=u<<13|u>>>19,u=5*u+3864292196);switch(h=0,o){case 3:h^=t[4*s+2]<<16;case 2:h^=t[4*s+1]<<8;case 1:h^=t[4*s],h=h*p&r|h*f&a,h=h<<15|h>>>17,h=h*g&r|h*m&a,1&s?d^=h:u^=h}this.h1=d,this.h2=u}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=3981806797*e&r|36045*e&a,t=4283543511*t&r|(2950163797*(t<<16|e>>>16)&r)>>>16,e^=t>>>1,e=444984403*e&r|60499*e&a,t=3301882366*t&r|(3120437893*(t<<16|e>>>16)&r)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FontLoader=t.FontFaceObject=void 0;var n=i(1);t.FontLoader=class{#lt=new Set;constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){this._document=e,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){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.#lt.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont(e){if(e&&!this.#lt.has(e.loadedName))if((0,n.assert)(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:t,src:i,style:s}=e,r=new FontFace(t,i,s);this.addNativeFontFace(r);try{await r.load(),this.#lt.add(t)}catch{(0,n.warn)(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(r)}}else(0,n.unreachable)("Not implemented: loadSystemFont without the Font Loading API.")}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo)return void await this.loadSystemFont(e.systemFontInfo);if(this.isFontLoadingAPISupported){const t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(i){throw(0,n.warn)(`Failed to load font '${t.family}': '${i}'.`),e.disableFontFace=!0,i}}return}const t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise((t=>{const i=this._queueLoadingCallback(t);this._prepareFontLoadEvent(e,i)}))}}get isFontLoadingAPISupported(){const e=!!this._document?.fonts;return(0,n.shadow)(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){let e=!1;return(n.isNodeJS||"undefined"!=typeof navigator&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(e=!0),(0,n.shadow)(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(e){const{loadingRequests:t}=this,i={done:!1,complete:function(){for((0,n.assert)(!i.done,"completeRequest() cannot be called twice."),i.done=!0;t.length>0&&t[0].done;){const e=t.shift();setTimeout(e.callback,0)}},callback:e};return t.push(i),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 i(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|255&e.charCodeAt(t+3)}function s(e,t,i,n){return e.substring(0,t)+n+e.substring(t+i)}let r,a;const o=this._document.createElement("canvas");o.width=1,o.height=1;const l=o.getContext("2d");let h=0;const c=`lt${Date.now()}${this.loadTestFontId++}`;let d=this._loadTestFont;d=s(d,976,c.length,c);const u=1482184792;let p=i(d,16);for(r=0,a=c.length-3;r<a;r+=4)p=p-u+i(c,r)|0;r<c.length&&(p=p-u+i(c+"XXX",r)|0),d=s(d,16,4,(0,n.string32)(p));const g=`@font-face {font-family:"${c}";src:url(data:font/opentype;base64,${btoa(d)});}`;this.insertRule(g);const f=this._document.createElement("div");f.style.visibility="hidden",f.style.width=f.style.height="10px",f.style.position="absolute",f.style.top=f.style.left="0px";for(const t of[e.loadedName,c]){const e=this._document.createElement("span");e.textContent="Hi",e.style.fontFamily=t,f.append(e)}this._document.body.append(f),function e(t,i){if(++h>30)return(0,n.warn)("Load test font never loaded."),void i();l.font="30px "+t,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0?i():setTimeout(e.bind(null,t,i))}(c,(()=>{f.remove(),t.complete()}))}},t.FontFaceObject=class{constructor(e,{isEvalSupported:t=!0,disableFontFace:i=!1,ignoreErrors:n=!1,inspectFont:s=null}){this.compiledGlyphs=Object.create(null);for(const t in e)this[t]=e[t];this.isEvalSupported=!1!==t,this.disableFontFace=!0===i,this.ignoreErrors=!0===n,this._inspectFont=s}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(this.cssFontInfo){const t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}else e=new FontFace(this.loadedName,this.data,{});return this._inspectFont?.(this),e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const e=(0,n.bytesToString)(this.data),t=`url(data:${this.mimetype};base64,${btoa(e)});`;let i;if(this.cssFontInfo){let e=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(e+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),i=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${e}src:${t}}`}else i=`@font-face {font-family:"${this.loadedName}";src:${t}}`;return this._inspectFont?.(this,t),i}getPathGenerator(e,t){if(void 0!==this.compiledGlyphs[t])return this.compiledGlyphs[t];let i;try{i=e.get(this.loadedName+"_path_"+t)}catch(e){if(!this.ignoreErrors)throw e;return(0,n.warn)(`getPathGenerator - ignoring character: "${e}".`),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,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NodeStandardFontDataFactory=t.NodeFilterFactory=t.NodeCanvasFactory=t.NodeCMapReaderFactory=void 0;var n=i(7);i(1);const s=function(e){return new Promise(((t,i)=>{require$$5.readFile(e,((e,n)=>{!e&&n?t(new Uint8Array(n)):i(new Error(e))}))}))};class r extends n.BaseFilterFactory{}t.NodeFilterFactory=r;class a extends n.BaseCanvasFactory{_createCanvas(e,t){return require$$5.createCanvas(e,t)}}t.NodeCanvasFactory=a;class o extends n.BaseCMapReaderFactory{_fetchData(e,t){return s(e).then((e=>({cMapData:e,compressionType:t})))}}t.NodeCMapReaderFactory=o;class l extends n.BaseStandardFontDataFactory{_fetchData(e){return s(e)}}t.NodeStandardFontDataFactory=l},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CanvasGraphics=void 0;var n=i(1),s=i(6),r=i(12),a=i(13);const o=4096,l=16;class h{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,t,i){let n;return void 0!==this.cache[e]?(n=this.cache[e],this.canvasFactory.reset(n,t,i)):(n=this.canvasFactory.create(t,i),this.cache[e]=n),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 c(e,t,i,n,r,a,o,l,h,c){const[d,u,p,g,f,m]=(0,s.getCurrentTransform)(e);if(0===u&&0===p){const s=o*d+f,_=Math.round(s),v=l*g+m,b=Math.round(v),y=(o+h)*d+f,S=Math.abs(Math.round(y)-_)||1,P=(l+c)*g+m,A=Math.abs(Math.round(P)-b)||1;return e.setTransform(Math.sign(d),0,0,Math.sign(g),_,b),e.drawImage(t,i,n,r,a,0,0,S,A),e.setTransform(d,u,p,g,f,m),[S,A]}if(0===d&&0===g){const s=l*p+f,_=Math.round(s),v=o*u+m,b=Math.round(v),y=(l+c)*p+f,S=Math.abs(Math.round(y)-_)||1,P=(o+h)*u+m,A=Math.abs(Math.round(P)-b)||1;return e.setTransform(0,Math.sign(u),Math.sign(p),0,_,b),e.drawImage(t,i,n,r,a,0,0,A,S),e.setTransform(d,u,p,g,f,m),[A,S]}return e.drawImage(t,i,n,r,a,o,l,h,c),[Math.hypot(d,u)*h,Math.hypot(p,g)*c]}class d{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);return e.clipBox=this.clipBox.slice(),e}setCurrentPoint(e,t){this.x=e,this.y=t}updatePathMinMax(e,t,i){[t,i]=n.Util.applyTransform([t,i],e),this.minX=Math.min(this.minX,t),this.minY=Math.min(this.minY,i),this.maxX=Math.max(this.maxX,t),this.maxY=Math.max(this.maxY,i)}updateRectMinMax(e,t){const i=n.Util.applyTransform(t,e),s=n.Util.applyTransform(t.slice(2),e);this.minX=Math.min(this.minX,i[0],s[0]),this.minY=Math.min(this.minY,i[1],s[1]),this.maxX=Math.max(this.maxX,i[0],s[0]),this.maxY=Math.max(this.maxY,i[1],s[1])}updateScalingPathMinMax(e,t){n.Util.scaleMinMax(e,t),this.minX=Math.min(this.minX,t[0]),this.maxX=Math.max(this.maxX,t[1]),this.minY=Math.min(this.minY,t[2]),this.maxY=Math.max(this.maxY,t[3])}updateCurvePathMinMax(e,t,i,s,r,a,o,l,h,c){const d=n.Util.bezierBoundingBox(t,i,s,r,a,o,l,h);if(c)return c[0]=Math.min(c[0],d[0],d[2]),c[1]=Math.max(c[1],d[0],d[2]),c[2]=Math.min(c[2],d[1],d[3]),void(c[3]=Math.max(c[3],d[1],d[3]));this.updateRectMinMax(e,d)}getPathBoundingBox(e=r.PathType.FILL,t=null){const i=[this.minX,this.minY,this.maxX,this.maxY];if(e===r.PathType.STROKE){t||(0,n.unreachable)("Stroke bounding box must include transform.");const e=n.Util.singularValueDecompose2dScale(t),s=e[0]*this.lineWidth/2,r=e[1]*this.lineWidth/2;i[0]-=s,i[1]-=r,i[2]+=s,i[3]+=r}return i}updateClipFromPath(){const e=n.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(e){this.clipBox=e,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(e=r.PathType.FILL,t=null){return n.Util.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function u(e,t){if("undefined"!=typeof ImageData&&t instanceof ImageData)return void e.putImageData(t,0,0);const i=t.height,s=t.width,r=i%l,a=(i-r)/l,o=0===r?a:a+1,h=e.createImageData(s,l);let c,d=0;const u=t.data,p=h.data;let g,f,m,_;if(t.kind===n.ImageKind.GRAYSCALE_1BPP){const t=u.byteLength,i=new Uint32Array(p.buffer,0,p.byteLength>>2),_=i.length,v=s+7>>3,b=4294967295,y=n.FeatureTest.isLittleEndian?4278190080:255;for(g=0;g<o;g++){for(m=g<a?l:r,c=0,f=0;f<m;f++){const e=t-d;let n=0;const r=e>v?s:8*e-7,a=-8&r;let o=0,l=0;for(;n<a;n+=8)l=u[d++],i[c++]=128&l?b:y,i[c++]=64&l?b:y,i[c++]=32&l?b:y,i[c++]=16&l?b:y,i[c++]=8&l?b:y,i[c++]=4&l?b:y,i[c++]=2&l?b:y,i[c++]=1&l?b:y;for(;n<r;n++)0===o&&(l=u[d++],o=128),i[c++]=l&o?b:y,o>>=1}for(;c<_;)i[c++]=0;e.putImageData(h,0,g*l)}}else if(t.kind===n.ImageKind.RGBA_32BPP){for(f=0,_=s*l*4,g=0;g<a;g++)p.set(u.subarray(d,d+_)),d+=_,e.putImageData(h,0,f),f+=l;g<o&&(_=s*r*4,p.set(u.subarray(d,d+_)),e.putImageData(h,0,f))}else{if(t.kind!==n.ImageKind.RGB_24BPP)throw new Error(`bad image kind: ${t.kind}`);for(m=l,_=s*m,g=0;g<o;g++){for(g>=a&&(m=r,_=s*m),c=0,f=_;f--;)p[c++]=u[d++],p[c++]=u[d++],p[c++]=u[d++],p[c++]=255;e.putImageData(h,0,g*l)}}}function p(e,t){if(t.bitmap)return void e.drawImage(t.bitmap,0,0);const i=t.height,n=t.width,s=i%l,r=(i-s)/l,o=0===s?r:r+1,h=e.createImageData(n,l);let c=0;const d=t.data,u=h.data;for(let t=0;t<o;t++){const i=t<r?l:s;({srcPos:c}=(0,a.convertBlackAndWhiteToRGBA)({src:d,srcPos:c,dest:u,width:n,height:i,nonBlackColor:0})),e.putImageData(h,0,t*l)}}function g(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]);void 0!==e.setLineDash&&(t.setLineDash(e.getLineDash()),t.lineDashOffset=e.lineDashOffset)}function f(e){if(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",void 0!==e.setLineDash&&(e.setLineDash([]),e.lineDashOffset=0),!n.isNodeJS){const{filter:t}=e;"none"!==t&&""!==t&&(e.filter="none")}}function m(e,t,i,n){const s=e.length;for(let r=3;r<s;r+=4){const s=e[r];if(0===s)e[r-3]=t,e[r-2]=i,e[r-1]=n;else if(s<255){const a=255-s;e[r-3]=e[r-3]*s+t*a>>8,e[r-2]=e[r-2]*s+i*a>>8,e[r-1]=e[r-1]*s+n*a>>8}}}function _(e,t,i){const n=e.length;for(let s=3;s<n;s+=4){const n=i?i[e[s]]:e[s];t[s]=t[s]*n*.00392156862745098|0}}function v(e,t,i){const n=e.length;for(let s=3;s<n;s+=4){const n=77*e[s-3]+152*e[s-2]+28*e[s-1];t[s]=i?t[s]*i[n>>8]>>8:t[s]*n>>16}}function b(e,t,i,n){const s=n[0],r=n[1],a=n[2]-s,o=n[3]-r;0!==a&&0!==o&&(function(e,t,i,n,s,r,a,o,l,h,c){const d=!!r,u=d?r[0]:0,p=d?r[1]:0,g=d?r[2]:0,f="Luminosity"===s?v:_,b=Math.min(n,Math.ceil(1048576/i));for(let s=0;s<n;s+=b){const r=Math.min(b,n-s),_=e.getImageData(o-h,s+(l-c),i,r),v=t.getImageData(o,s+l,i,r);d&&m(_.data,u,p,g),f(_.data,v.data,a),t.putImageData(v,o,s+l)}}(t.context,i,a,o,t.subtype,t.backdrop,t.transferMap,s,r,t.offsetX,t.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(i.canvas,0,0),e.restore())}function y(e,t){const i=n.Util.singularValueDecompose2dScale(e);i[0]=Math.fround(i[0]),i[1]=Math.fround(i[1]);const r=Math.fround((globalThis.devicePixelRatio||1)*s.PixelsPerInch.PDF_TO_CSS_UNITS);return void 0!==t?t:i[0]<=r||i[1]<=r}const S=["butt","round","square"],P=["miter","round","bevel"],A={},w={};class E{constructor(e,t,i,n,s,{optionalContentConfig:r,markedContentStack:a=null},o,l){this.ctx=e,this.current=new d(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=s,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=a||[],this.optionalContentConfig=r,this.cachedCanvases=new h(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=o,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=l,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(e,t=null){return"string"==typeof e?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}beginDrawing({transform:e,viewport:t,transparency:i=!1,background:n=null}){const r=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=n||"#ffffff",this.ctx.fillRect(0,0,r,a),this.ctx.fillStyle=o,i){const e=this.cachedCanvases.getCanvas("transparent",r,a);this.compositeCtx=this.ctx,this.transparentCanvas=e.canvas,this.ctx=e.context,this.ctx.save(),this.ctx.transform(...(0,s.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),f(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=(0,s.getCurrentTransform)(this.ctx)}executeOperatorList(e,t,i,s){const r=e.argsArray,a=e.fnArray;let o=t||0;const l=r.length;if(l===o)return o;const h=l-o>10&&"function"==typeof i,c=h?Date.now()+15:0;let d=0;const u=this.commonObjs,p=this.objs;let g;for(;;){if(void 0!==s&&o===s.nextBreakPoint)return s.breakIt(o,i),o;if(g=a[o],g!==n.OPS.dependency)this[g].apply(this,r[o]);else for(const e of r[o]){const t=e.startsWith("g_")?u:p;if(!t.has(e))return t.get(e,i),o}if(o++,o===l)return o;if(h&&++d>10){if(Date.now()>c)return i(),o;d=0}}}#ht(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.ctx.restore(),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.#ht(),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.#ct()}#ct(){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 s,r,a=Math.max(Math.hypot(t[0],t[1]),1),o=Math.max(Math.hypot(t[2],t[3]),1),l=i,h=n,c="prescale1";for(;a>2&&l>1||o>2&&h>1;){let t=l,i=h;a>2&&l>1&&(t=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2),a/=l/t),o>2&&h>1&&(i=h>=16384?Math.floor(h/2)-1||1:Math.ceil(h)/2,o/=h/i),s=this.cachedCanvases.getCanvas(c,t,i),r=s.context,r.clearRect(0,0,t,i),r.drawImage(e,0,0,l,h,0,0,t,i),e=s.canvas,l=t,h=i,c="prescale1"===c?"prescale2":"prescale1"}return{img:e,paintWidth:l,paintHeight:h}}_createMaskCanvas(e){const t=this.ctx,{width:i,height:a}=e,o=this.current.fillColor,l=this.current.patternFill,h=(0,s.getCurrentTransform)(t);let d,u,g,f;if((e.bitmap||e.data)&&e.count>1){const t=e.bitmap||e.data.buffer;u=JSON.stringify(l?h:[h.slice(0,4),o]),d=this._cachedBitmapsMap.get(t),d||(d=new Map,this._cachedBitmapsMap.set(t,d));const i=d.get(u);if(i&&!l)return{canvas:i,offsetX:Math.round(Math.min(h[0],h[2])+h[4]),offsetY:Math.round(Math.min(h[1],h[3])+h[5])};g=i}g||(f=this.cachedCanvases.getCanvas("maskCanvas",i,a),p(f.context,e));let m=n.Util.transform(h,[1/i,0,0,-1/a,0,0]);m=n.Util.transform(m,[1,0,0,1,0,-a]);const _=n.Util.applyTransform([0,0],m),v=n.Util.applyTransform([i,a],m),b=n.Util.normalizeRect([_[0],_[1],v[0],v[1]]),S=Math.round(b[2]-b[0])||1,P=Math.round(b[3]-b[1])||1,A=this.cachedCanvases.getCanvas("fillCanvas",S,P),w=A.context,E=Math.min(_[0],v[0]),x=Math.min(_[1],v[1]);w.translate(-E,-x),w.transform(...m),g||(g=this._scaleImage(f.canvas,(0,s.getCurrentTransformInverse)(w)),g=g.img,d&&l&&d.set(u,g)),w.imageSmoothingEnabled=y((0,s.getCurrentTransform)(w),e.interpolate),c(w,g,0,0,g.width,g.height,0,0,i,a),w.globalCompositeOperation="source-in";const C=n.Util.transform((0,s.getCurrentTransformInverse)(w),[1,0,0,1,-E,-x]);return w.fillStyle=l?o.getPattern(t,this,C,r.PathType.FILL):o,w.fillRect(0,0,i,a),d&&!l&&(this.cachedCanvases.delete("fillCanvas"),d.set(u,A.canvas)),{canvas:A.canvas,offsetX:Math.round(E),offsetY:Math.round(x)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=S[e]}setLineJoin(e){this.ctx.lineJoin=P[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,t){const i=this.ctx;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 r=this.ctx;r.setTransform(...(0,s.getCurrentTransform)(this.suspendedCtx)),g(this.suspendedCtx,r),function(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(){t.save(),this.__originalSave()},e.restore=function(){t.restore(),this.__originalRestore()},e.translate=function(e,i){t.translate(e,i),this.__originalTranslate(e,i)},e.scale=function(e,i){t.scale(e,i),this.__originalScale(e,i)},e.transform=function(e,i,n,s,r,a){t.transform(e,i,n,s,r,a),this.__originalTransform(e,i,n,s,r,a)},e.setTransform=function(e,i,n,s,r,a){t.setTransform(e,i,n,s,r,a),this.__originalSetTransform(e,i,n,s,r,a)},e.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},e.rotate=function(e){t.rotate(e),this.__originalRotate(e)},e.clip=function(e){t.clip(e),this.__originalClip(e)},e.moveTo=function(e,i){t.moveTo(e,i),this.__originalMoveTo(e,i)},e.lineTo=function(e,i){t.lineTo(e,i),this.__originalLineTo(e,i)},e.bezierCurveTo=function(e,i,n,s,r,a){t.bezierCurveTo(e,i,n,s,r,a),this.__originalBezierCurveTo(e,i,n,s,r,a)},e.rect=function(e,i,n,s){t.rect(e,i,n,s),this.__originalRect(e,i,n,s)},e.closePath=function(){t.closePath(),this.__originalClosePath()},e.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}(r,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),g(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;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])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const t=this.current.activeSMask;b(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(){this.inSMaskMode?(g(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),g(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(e,t,i,n,s,r){this.ctx.transform(e,t,i,n,s,r),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,t,i){const r=this.ctx,a=this.current;let o,l,h=a.x,c=a.y;const d=(0,s.getCurrentTransform)(r),u=0===d[0]&&0===d[3]||0===d[1]&&0===d[2],p=u?i.slice(0):null;for(let i=0,s=0,g=e.length;i<g;i++)switch(0|e[i]){case n.OPS.rectangle:h=t[s++],c=t[s++];const e=t[s++],i=t[s++],g=h+e,f=c+i;r.moveTo(h,c),0===e||0===i?r.lineTo(g,f):(r.lineTo(g,c),r.lineTo(g,f),r.lineTo(h,f)),u||a.updateRectMinMax(d,[h,c,g,f]),r.closePath();break;case n.OPS.moveTo:h=t[s++],c=t[s++],r.moveTo(h,c),u||a.updatePathMinMax(d,h,c);break;case n.OPS.lineTo:h=t[s++],c=t[s++],r.lineTo(h,c),u||a.updatePathMinMax(d,h,c);break;case n.OPS.curveTo:o=h,l=c,h=t[s+4],c=t[s+5],r.bezierCurveTo(t[s],t[s+1],t[s+2],t[s+3],h,c),a.updateCurvePathMinMax(d,o,l,t[s],t[s+1],t[s+2],t[s+3],h,c,p),s+=6;break;case n.OPS.curveTo2:o=h,l=c,r.bezierCurveTo(h,c,t[s],t[s+1],t[s+2],t[s+3]),a.updateCurvePathMinMax(d,o,l,h,c,t[s],t[s+1],t[s+2],t[s+3],p),h=t[s+2],c=t[s+3],s+=4;break;case n.OPS.curveTo3:o=h,l=c,h=t[s+2],c=t[s+3],r.bezierCurveTo(t[s],t[s+1],h,c,h,c),a.updateCurvePathMinMax(d,o,l,t[s],t[s+1],h,c,h,c,p),s+=4;break;case n.OPS.closePath:r.closePath()}u&&a.updateScalingPathMinMax(d,p),a.setCurrentPoint(h,c)}closePath(){this.ctx.closePath()}stroke(e=!0){const t=this.ctx,i=this.current.strokeColor;t.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"==typeof i&&i?.getPattern?(t.save(),t.strokeStyle=i.getPattern(t,this,(0,s.getCurrentTransformInverse)(t),r.PathType.STROKE),this.rescaleAndStroke(!1),t.restore()):this.rescaleAndStroke(!0)),e&&this.consumePath(this.current.getClippedPathBoundingBox()),t.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(e=!0){const t=this.ctx,i=this.current.fillColor;let n=!1;this.current.patternFill&&(t.save(),t.fillStyle=i.getPattern(t,this,(0,s.getCurrentTransformInverse)(t),r.PathType.FILL),n=!0);const a=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==a&&(this.pendingEOFill?(t.fill("evenodd"),this.pendingEOFill=!1):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=A}eoClip(){this.pendingClip=w}beginText(){this.current.textMatrix=n.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const e=this.pendingTextPaths,t=this.ctx;if(void 0!==e){t.save(),t.beginPath();for(const i of e)t.setTransform(...i.transform),t.translate(i.x,i.y),i.addToPath(t,i.fontSize);t.restore(),t.clip(),t.beginPath(),delete this.pendingTextPaths}else t.beginPath()}setCharSpacing(e){this.current.charSpacing=e}setWordSpacing(e){this.current.wordSpacing=e}setHScale(e){this.current.textHScale=e/100}setLeading(e){this.current.leading=-e}setFont(e,t){const i=this.commonObjs.get(e),s=this.current;if(!i)throw new Error(`Can't find font for ${e}`);if(s.fontMatrix=i.fontMatrix||n.FONT_IDENTITY_MATRIX,0!==s.fontMatrix[0]&&0!==s.fontMatrix[3]||(0,n.warn)("Invalid font matrix for font "+e),t<0?(t=-t,s.fontDirection=-1):s.fontDirection=1,this.current.font=i,this.current.fontSize=t,i.isType3Font)return;const r=i.loadedName||"sans-serif",a=i.systemFontInfo?.css||`"${r}", ${i.fallbackName}`;let o="normal";i.black?o="900":i.bold&&(o="bold");const l=i.italic?"italic":"normal";let h=t;t<16?h=16:t>100&&(h=100),this.current.fontSizeScale=t/h,this.ctx.font=`${l} ${o} ${h}px ${a}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,t){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=t}setLeadingMoveText(e,t){this.setLeading(-t),this.moveText(e,t)}setTextMatrix(e,t,i,n,s,r){this.current.textMatrix=[e,t,i,n,s,r],this.current.textMatrixScale=Math.hypot(e,t),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(e,t,i,r){const a=this.ctx,o=this.current,l=o.font,h=o.textRenderingMode,c=o.fontSize/o.fontSizeScale,d=h&n.TextRenderingMode.FILL_STROKE_MASK,u=!!(h&n.TextRenderingMode.ADD_TO_PATH_FLAG),p=o.patternFill&&!l.missingFile;let g;(l.disableFontFace||u||p)&&(g=l.getPathGenerator(this.commonObjs,e)),l.disableFontFace||p?(a.save(),a.translate(t,i),a.beginPath(),g(a,c),r&&a.setTransform(...r),d!==n.TextRenderingMode.FILL&&d!==n.TextRenderingMode.FILL_STROKE||a.fill(),d!==n.TextRenderingMode.STROKE&&d!==n.TextRenderingMode.FILL_STROKE||a.stroke(),a.restore()):(d!==n.TextRenderingMode.FILL&&d!==n.TextRenderingMode.FILL_STROKE||a.fillText(e,t,i),d!==n.TextRenderingMode.STROKE&&d!==n.TextRenderingMode.FILL_STROKE||a.strokeText(e,t,i)),u&&(this.pendingTextPaths||=[]).push({transform:(0,s.getCurrentTransform)(a),x:t,y:i,fontSize:c,addToPath:g})}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const t=e.getImageData(0,0,10,10).data;let i=!1;for(let e=3;e<t.length;e+=4)if(t[e]>0&&t[e]<255){i=!0;break}return(0,n.shadow)(this,"isFontSubpixelAAEnabled",i)}showText(e){const t=this.current,i=t.font;if(i.isType3Font)return this.showType3Text(e);const a=t.fontSize;if(0===a)return;const o=this.ctx,l=t.fontSizeScale,h=t.charSpacing,c=t.wordSpacing,d=t.fontDirection,u=t.textHScale*d,p=e.length,g=i.vertical,f=g?1:-1,m=i.defaultVMetrics,_=a*t.fontMatrix[0],v=t.textRenderingMode===n.TextRenderingMode.FILL&&!i.disableFontFace&&!t.patternFill;let b;if(o.save(),o.transform(...t.textMatrix),o.translate(t.x,t.y+t.textRise),d>0?o.scale(u,-1):o.scale(u,1),t.patternFill){o.save();const e=t.fillColor.getPattern(o,this,(0,s.getCurrentTransformInverse)(o),r.PathType.FILL);b=(0,s.getCurrentTransform)(o),o.restore(),o.fillStyle=e}let y=t.lineWidth;const S=t.textMatrixScale;if(0===S||0===y){const e=t.textRenderingMode&n.TextRenderingMode.FILL_STROKE_MASK;e!==n.TextRenderingMode.STROKE&&e!==n.TextRenderingMode.FILL_STROKE||(y=this.getSinglePixelWidth())}else y/=S;if(1!==l&&(o.scale(l,l),y/=l),o.lineWidth=y,i.isInvalidPDFjsFont){const i=[];let n=0;for(const t of e)i.push(t.unicode),n+=t.width;return o.fillText(i.join(""),0,0),t.x+=n*_*u,o.restore(),void this.compose()}let P,A=0;for(P=0;P<p;++P){const t=e[P];if("number"==typeof t){A+=f*t*a/1e3;continue}let n=!1;const s=(t.isSpace?c:0)+h,r=t.fontChar,u=t.accent;let p,y,S=t.width;if(g){const e=t.vmetric||m,i=-(t.vmetric?e[1]:.5*S)*_,n=e[2]*_;S=e?-e[0]:S,p=i/l,y=(A+n)/l}else p=A/l,y=0;if(i.remeasure&&S>0){const e=1e3*o.measureText(r).width/a*l;if(S<e&&this.isFontSubpixelAAEnabled){const t=S/e;n=!0,o.save(),o.scale(t,1),p/=t}else S!==e&&(p+=(S-e)/2e3*a/l)}if(this.contentVisible&&(t.isInFont||i.missingFile))if(v&&!u)o.fillText(r,p,y);else if(this.paintChar(r,p,y,b),u){const e=p+a*u.offset.x/l,t=y-a*u.offset.y/l;this.paintChar(u.fontChar,e,t,b)}A+=g?S*_-s*d:S*_+s*d,n&&o.restore()}g?t.y-=A:t.x+=A*u,o.restore(),this.compose()}showType3Text(e){const t=this.ctx,i=this.current,s=i.font,r=i.fontSize,a=i.fontDirection,o=s.vertical?1:-1,l=i.charSpacing,h=i.wordSpacing,c=i.textHScale*a,d=i.fontMatrix||n.FONT_IDENTITY_MATRIX,u=e.length;let p,g,f,m;if(i.textRenderingMode!==n.TextRenderingMode.INVISIBLE&&0!==r){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,t.save(),t.transform(...i.textMatrix),t.translate(i.x,i.y),t.scale(c,a),p=0;p<u;++p){if(g=e[p],"number"==typeof g){m=o*g*r/1e3,this.ctx.translate(m,0),i.x+=m*c;continue}const a=(g.isSpace?h:0)+l,u=s.charProcOperatorList[g.operatorListId];u?(this.contentVisible&&(this.processingType3=g,this.save(),t.scale(r,r),t.transform(...d),this.executeOperatorList(u),this.restore()),f=n.Util.applyTransform([g.width,0],d)[0]*r+a,t.translate(f,0),i.x+=f*c):(0,n.warn)(`Type3 character "${g.operatorListId}" is not available.`)}t.restore(),this.processingType3=null}}setCharWidth(e,t){}setCharWidthAndBounds(e,t,i,n,s,r){this.ctx.rect(i,n,s-i,r-n),this.ctx.clip(),this.endPath()}getColorN_Pattern(e){let t;if("TilingPattern"===e[0]){const i=e[1],n=this.baseTransform||(0,s.getCurrentTransform)(this.ctx),a={createCanvasGraphics:e=>new E(e,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};t=new r.TilingPattern(e,i,this.ctx,a,n)}else t=this._getPattern(e[1],e[2]);return t}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(e,t,i){const s=n.Util.makeHexColor(e,t,i);this.ctx.strokeStyle=s,this.current.strokeColor=s}setFillRGBColor(e,t,i){const s=n.Util.makeHexColor(e,t,i);this.ctx.fillStyle=s,this.current.fillColor=s,this.current.patternFill=!1}_getPattern(e,t=null){let i;return this.cachedPatterns.has(e)?i=this.cachedPatterns.get(e):(i=(0,r.getShadingPattern)(this.getObject(e)),this.cachedPatterns.set(e,i)),t&&(i.matrix=t),i}shadingFill(e){if(!this.contentVisible)return;const t=this.ctx;this.save();const i=this._getPattern(e);t.fillStyle=i.getPattern(t,this,(0,s.getCurrentTransformInverse)(t),r.PathType.SHADING);const a=(0,s.getCurrentTransformInverse)(t);if(a){const{width:e,height:i}=t.canvas,[s,r,o,l]=n.Util.getAxialAlignedBoundingBox([0,0,e,i],a);this.ctx.fillRect(s,r,o-s,l-r)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){(0,n.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,n.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(e,t){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(e)&&6===e.length&&this.transform(...e),this.baseTransform=(0,s.getCurrentTransform)(this.ctx),t)){const e=t[2]-t[0],i=t[3]-t[1];this.ctx.rect(t[0],t[1],e,i),this.current.updateRectMinMax((0,s.getCurrentTransform)(this.ctx),t),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const t=this.ctx;e.isolated||(0,n.info)("TODO: Support non-isolated groups."),e.knockout&&(0,n.warn)("Knockout groups not supported.");const i=(0,s.getCurrentTransform)(t);if(e.matrix&&t.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let r=n.Util.getAxialAlignedBoundingBox(e.bbox,(0,s.getCurrentTransform)(t));const a=[0,0,t.canvas.width,t.canvas.height];r=n.Util.intersect(r,a)||[0,0,0,0];const l=Math.floor(r[0]),h=Math.floor(r[1]);let c=Math.max(Math.ceil(r[2])-l,1),d=Math.max(Math.ceil(r[3])-h,1),u=1,p=1;c>o&&(u=c/o,c=o),d>o&&(p=d/o,d=o),this.current.startNewPathAndClipBox([0,0,c,d]);let f="groupAt"+this.groupLevel;e.smask&&(f+="_smask_"+this.smaskCounter++%2);const m=this.cachedCanvases.getCanvas(f,c,d),_=m.context;_.scale(1/u,1/p),_.translate(-l,-h),_.transform(...i),e.smask?this.smaskStack.push({canvas:m.canvas,context:_,offsetX:l,offsetY:h,scaleX:u,scaleY:p,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(l,h),t.scale(u,p),t.save()),g(t,_),this.ctx=_,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();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const e=(0,s.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...e);const i=n.Util.getAxialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],e);this.ctx.drawImage(t.canvas,0,0),this.ctx.restore(),this.compose(i)}}beginAnnotation(e,t,i,r,a){if(this.#ht(),f(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(t)&&4===t.length){const r=t[2]-t[0],o=t[3]-t[1];if(a&&this.annotationCanvasMap){(i=i.slice())[4]-=t[0],i[5]-=t[1],(t=t.slice())[0]=t[1]=0,t[2]=r,t[3]=o;const[a,l]=n.Util.singularValueDecompose2dScale((0,s.getCurrentTransform)(this.ctx)),{viewportScale:h}=this,c=Math.ceil(r*this.outputScaleX*h),d=Math.ceil(o*this.outputScaleY*h);this.annotationCanvas=this.canvasFactory.create(c,d);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),f(this.ctx)}else f(this.ctx),this.ctx.rect(t[0],t[1],r,o),this.ctx.clip(),this.endPath()}this.current=new d(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),this.transform(...r)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#ct(),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(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]),s=t+1;let r,a,o,l=new Uint8Array(s*(i+1));const h=t+7&-8;let c=new Uint8Array(h*i),d=0;for(const t of e.data){let e=128;for(;e>0;)c[d++]=t&e?0:255,e>>=1}let u=0;for(d=0,0!==c[d]&&(l[0]=1,++u),a=1;a<t;a++)c[d]!==c[d+1]&&(l[a]=c[d]?2:1,++u),d++;for(0!==c[d]&&(l[a]=2,++u),r=1;r<i;r++){d=r*h,o=r*s,c[d-h]!==c[d]&&(l[o]=c[d]?1:8,++u);let e=(c[d]?4:0)+(c[d-h]?8:0);for(a=1;a<t;a++)e=(e>>2)+(c[d+1]?4:0)+(c[d-h+1]?8:0),n[e]&&(l[o+a]=n[e],++u),d++;if(c[d-h]!==c[d]&&(l[o+a]=c[d]?2:4,++u),u>1e3)return null}for(d=h*(i-1),o=r*s,0!==c[d]&&(l[o]=8,++u),a=1;a<t;a++)c[d]!==c[d+1]&&(l[o+a]=c[d]?4:8,++u),d++;if(0!==c[d]&&(l[o+a]=4,++u),u>1e3)return null;const p=new Int32Array([0,s,-1,0,-s,0,0,0,1]),g=new Path2D;for(r=0;u&&r<=i;r++){let e=r*s;const i=e+t;for(;e<i&&!l[e];)e++;if(e===i)continue;g.moveTo(e%s,r);const n=e;let a=l[e];do{const t=p[a];do{e+=t}while(!l[e]);const i=l[e];5!==i&&10!==i?(a=i,l[e]=0):(a=i&51*a>>4,l[e]&=a>>2|a<<2),g.lineTo(e%s,e/s|0),l[e]||--u}while(n!==e);--r}return c=null,l=null,function(e){e.save(),e.scale(1/t,-1/i),e.translate(0,-i),e.fill(g),e.beginPath(),e.restore()}}(e)),n.compiled))return void n.compiled(i);const s=this._createMaskCanvas(e),r=s.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(r,s.offsetX,s.offsetY),i.restore(),this.compose()}paintImageMaskXObjectRepeat(e,t,i=0,r=0,a,o){if(!this.contentVisible)return;e=this.getObject(e.data,e);const l=this.ctx;l.save();const h=(0,s.getCurrentTransform)(l);l.transform(t,i,r,a,0,0);const c=this._createMaskCanvas(e);l.setTransform(1,0,0,1,c.offsetX-h[4],c.offsetY-h[5]);for(let e=0,s=o.length;e<s;e+=2){const s=n.Util.transform(h,[t,i,r,a,o[e],o[e+1]]),[d,u]=n.Util.applyTransform([0,0],s);l.drawImage(c.canvas,d,u)}l.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const t=this.ctx,i=this.current.fillColor,n=this.current.patternFill;for(const a of e){const{data:e,width:o,height:l,transform:h}=a,d=this.cachedCanvases.getCanvas("maskCanvas",o,l),u=d.context;u.save(),p(u,this.getObject(e,a)),u.globalCompositeOperation="source-in",u.fillStyle=n?i.getPattern(u,this,(0,s.getCurrentTransformInverse)(t),r.PathType.FILL):i,u.fillRect(0,0,o,l),u.restore(),t.save(),t.transform(...h),t.scale(1,-1),c(t,d.canvas,0,0,o,l,0,-1,1,1),t.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;const t=this.getObject(e);t?this.paintInlineImageXObject(t):(0,n.warn)("Dependent image isn't ready yet")}paintImageXObjectRepeat(e,t,i,s){if(!this.contentVisible)return;const r=this.getObject(e);if(!r)return void(0,n.warn)("Dependent image isn't ready yet");const a=r.width,o=r.height,l=[];for(let e=0,n=s.length;e<n;e+=2)l.push({transform:[t,0,0,i,s[e],s[e+1]],x:0,y:0,w:a,h:o});this.paintInlineImageXObjectGroup(r,l)}applyTransferMapsToCanvas(e){return"none"!==this.current.transferMaps&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none"),e.canvas}applyTransferMapsToBitmap(e){if("none"===this.current.transferMaps)return e.bitmap;const{bitmap:t,width:i,height:n}=e,s=this.cachedCanvases.getCanvas("inlineImage",i,n),r=s.context;return r.filter=this.current.transferMaps,r.drawImage(t,0,0),r.filter="none",s.canvas}paintInlineImageXObject(e){if(!this.contentVisible)return;const t=e.width,i=e.height,r=this.ctx;if(this.save(),!n.isNodeJS){const{filter:e}=r;"none"!==e&&""!==e&&(r.filter="none")}let a;if(r.scale(1/t,-1/i),e.bitmap)a=this.applyTransferMapsToBitmap(e);else if("function"==typeof HTMLElement&&e instanceof HTMLElement||!e.data)a=e;else{const n=this.cachedCanvases.getCanvas("inlineImage",t,i).context;u(n,e),a=this.applyTransferMapsToCanvas(n)}const o=this._scaleImage(a,(0,s.getCurrentTransformInverse)(r));r.imageSmoothingEnabled=y((0,s.getCurrentTransform)(r),e.interpolate),c(r,o.img,0,0,o.paintWidth,o.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,s=this.cachedCanvases.getCanvas("inlineImage",t,i).context;u(s,e),n=this.applyTransferMapsToCanvas(s)}for(const e of t)i.save(),i.transform(...e.transform),i.scale(1,-1),c(i,n,e.x,e.y,e.w,e.h,0,-1,1,1),i.restore();this.compose()}paintSolidColorImageMask(){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;this.pendingClip&&(t||(this.pendingClip===w?i.clip("evenodd"):i.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),i.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=(0,s.getCurrentTransform)(this.ctx);if(0===e[1]&&0===e[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const t=Math.abs(e[0]*e[3]-e[2]*e[1]),i=Math.hypot(e[0],e[2]),n=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(i,n)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){const{lineWidth:e}=this.current,{a:t,b:i,c:n,d:s}=this.ctx.getTransform();let r,a;if(0===i&&0===n){const i=Math.abs(t),n=Math.abs(s);if(i===n)if(0===e)r=a=1/i;else{const t=i*e;r=a=t<1?1/t:1}else if(0===e)r=1/i,a=1/n;else{const t=i*e,s=n*e;r=t<1?1/t:1,a=s<1?1/s:1}}else{const o=Math.abs(t*s-i*n),l=Math.hypot(t,i),h=Math.hypot(n,s);if(0===e)r=h/o,a=l/o;else{const t=e*o;r=h>t?h/t:1,a=l>t?l/t:1}}this._cachedScaleForStroking[0]=r,this._cachedScaleForStroking[1]=a}return this._cachedScaleForStroking}rescaleAndStroke(e){const{ctx:t}=this,{lineWidth:i}=this.current,[n,s]=this.getScaleForStroking();if(t.lineWidth=i||1,1===n&&1===s)return void t.stroke();const r=t.getLineDash();if(e&&t.save(),t.scale(n,s),r.length>0){const e=Math.max(n,s);t.setLineDash(r.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=E;for(const e in n.OPS)void 0!==E.prototype[e]&&(E.prototype[n.OPS[e]]=E.prototype[e])},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TilingPattern=t.PathType=void 0,t.getShadingPattern=function(e){switch(e[0]){case"RadialAxial":return new l(e);case"Mesh":return new d(e);case"Dummy":return new u}throw new Error(`Unknown IR type: ${e[0]}`)};var n=i(1),s=i(6);const r={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function a(e,t){if(!t)return;const i=t[2]-t[0],n=t[3]-t[1],s=new Path2D;s.rect(t[0],t[1],i,n),e.clip(s)}t.PathType=r;class o{constructor(){this.constructor===o&&(0,n.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,n.unreachable)("Abstract method `getPattern` called.")}}class l extends o{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,o){let l;if(o===r.STROKE||o===r.FILL){const r=t.current.getClippedPathBoundingBox(o,(0,s.getCurrentTransform)(e))||[0,0,0,0],h=Math.ceil(r[2]-r[0])||1,c=Math.ceil(r[3]-r[1])||1,d=t.cachedCanvases.getCanvas("pattern",h,c,!0),u=d.context;u.clearRect(0,0,u.canvas.width,u.canvas.height),u.beginPath(),u.rect(0,0,u.canvas.width,u.canvas.height),u.translate(-r[0],-r[1]),i=n.Util.transform(i,[1,0,0,1,r[0],r[1]]),u.transform(...t.baseTransform),this.matrix&&u.transform(...this.matrix),a(u,this._bbox),u.fillStyle=this._createGradient(u),u.fill(),l=e.createPattern(d.canvas,"no-repeat");const p=new DOMMatrix(i);l.setTransform(p)}else a(e,this._bbox),l=this._createGradient(e);return l}}function h(e,t,i,n,s,r,a,o){const l=t.coords,h=t.colors,c=e.data,d=4*e.width;let u;l[i+1]>l[n+1]&&(u=i,i=n,n=u,u=r,r=a,a=u),l[n+1]>l[s+1]&&(u=n,n=s,s=u,u=a,a=o,o=u),l[i+1]>l[n+1]&&(u=i,i=n,n=u,u=r,r=a,a=u);const p=(l[i]+t.offsetX)*t.scaleX,g=(l[i+1]+t.offsetY)*t.scaleY,f=(l[n]+t.offsetX)*t.scaleX,m=(l[n+1]+t.offsetY)*t.scaleY,_=(l[s]+t.offsetX)*t.scaleX,v=(l[s+1]+t.offsetY)*t.scaleY;if(g>=v)return;const b=h[r],y=h[r+1],S=h[r+2],P=h[a],A=h[a+1],w=h[a+2],E=h[o],x=h[o+1],C=h[o+2],M=Math.round(g),T=Math.round(v);let D,F,L,k,R,I,O,N;for(let e=M;e<=T;e++){if(e<m){const t=e<g?0:(g-e)/(g-m);D=p-(p-f)*t,F=b-(b-P)*t,L=y-(y-A)*t,k=S-(S-w)*t}else{let t;t=e>v?1:m===v?0:(m-e)/(m-v),D=f-(f-_)*t,F=P-(P-E)*t,L=A-(A-x)*t,k=w-(w-C)*t}let t;t=e<g?0:e>v?1:(g-e)/(g-v),R=p-(p-_)*t,I=b-(b-E)*t,O=y-(y-x)*t,N=S-(S-C)*t;const i=Math.round(Math.min(D,R)),n=Math.round(Math.max(D,R));let s=d*e+4*i;for(let e=i;e<=n;e++)t=(D-e)/(D-R),t<0?t=0:t>1&&(t=1),c[s++]=F-(F-I)*t|0,c[s++]=L-(L-O)*t|0,c[s++]=k-(k-N)*t|0,c[s++]=255}}function c(e,t,i){const n=t.coords,s=t.colors;let r,a;switch(t.type){case"lattice":const o=t.verticesPerRow,l=Math.floor(n.length/o)-1,c=o-1;for(r=0;r<l;r++){let t=r*o;for(let r=0;r<c;r++,t++)h(e,i,n[t],n[t+1],n[t+o],s[t],s[t+1],s[t+o]),h(e,i,n[t+o+1],n[t+1],n[t+o],s[t+o+1],s[t+1],s[t+o])}break;case"triangles":for(r=0,a=n.length;r<a;r+=3)h(e,i,n[r],n[r+1],n[r+2],s[r],s[r+1],s[r+2]);break;default:throw new Error("illegal figure")}}class d extends o{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[7],this._background=e[8],this.matrix=null}_createMeshCanvas(e,t,i){const n=Math.floor(this._bounds[0]),s=Math.floor(this._bounds[1]),r=Math.ceil(this._bounds[2])-n,a=Math.ceil(this._bounds[3])-s,o=Math.min(Math.ceil(Math.abs(r*e[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(a*e[1]*1.1)),3e3),h=r/o,d=a/l,u={coords:this._coords,colors:this._colors,offsetX:-n,offsetY:-s,scaleX:1/h,scaleY:1/d},p=o+4,g=l+4,f=i.getCanvas("mesh",p,g,!1),m=f.context,_=m.createImageData(o,l);if(t){const e=_.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)c(_,e,u);return m.putImageData(_,2,2),{canvas:f.canvas,offsetX:n-2*h,offsetY:s-2*d,scaleX:h,scaleY:d}}getPattern(e,t,i,o){let l;if(a(e,this._bbox),o===r.SHADING)l=n.Util.singularValueDecompose2dScale((0,s.getCurrentTransform)(e));else if(l=n.Util.singularValueDecompose2dScale(t.baseTransform),this.matrix){const e=n.Util.singularValueDecompose2dScale(this.matrix);l=[l[0]*e[0],l[1]*e[1]]}const h=this._createMeshCanvas(l,o===r.SHADING?null:this._background,t.cachedCanvases);return o!==r.SHADING&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(h.offsetX,h.offsetY),e.scale(h.scaleX,h.scaleY),e.createPattern(h.canvas,"no-repeat")}}class u extends o{getPattern(){return"hotpink"}}const p=1,g=2;class f{static MAX_PATTERN_SIZE=3e3;constructor(e,t,i,n,s){this.operatorList=e[2],this.matrix=e[3]||[1,0,0,1,0,0],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.color=t,this.ctx=i,this.canvasGraphicsFactory=n,this.baseTransform=s}createPatternCanvas(e){const t=this.operatorList,i=this.bbox,r=this.xstep,a=this.ystep,o=this.paintType,l=this.tilingType,h=this.color,c=this.canvasGraphicsFactory;(0,n.info)("TilingType: "+l);const d=i[0],u=i[1],p=i[2],g=i[3],f=n.Util.singularValueDecompose2dScale(this.matrix),m=n.Util.singularValueDecompose2dScale(this.baseTransform),_=[f[0]*m[0],f[1]*m[1]],v=this.getSizeAndScale(r,this.ctx.canvas.width,_[0]),b=this.getSizeAndScale(a,this.ctx.canvas.height,_[1]),y=e.cachedCanvases.getCanvas("pattern",v.size,b.size,!0),S=y.context,P=c.createCanvasGraphics(S);P.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(P,o,h);let A=d,w=u,E=p,x=g;return d<0&&(A=0,E+=Math.abs(d)),u<0&&(w=0,x+=Math.abs(u)),S.translate(-v.scale*A,-b.scale*w),P.transform(v.scale,0,0,b.scale,0,0),S.save(),this.clipBbox(P,A,w,E,x),P.baseTransform=(0,s.getCurrentTransform)(P.ctx),P.executeOperatorList(t),P.endDrawing(),{canvas:y.canvas,scaleX:v.scale,scaleY:b.scale,offsetX:A,offsetY:w}}getSizeAndScale(e,t,i){e=Math.abs(e);const n=Math.max(f.MAX_PATTERN_SIZE,t);let s=Math.ceil(e*i);return s>=n?s=n:i=s/e,{scale:i,size:s}}clipBbox(e,t,i,n,r){const a=n-t,o=r-i;e.ctx.rect(t,i,a,o),e.current.updateRectMinMax((0,s.getCurrentTransform)(e.ctx),[t,i,n,r]),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,t,i){const s=e.ctx,r=e.current;switch(t){case p:const e=this.ctx;s.fillStyle=e.fillStyle,s.strokeStyle=e.strokeStyle,r.fillColor=e.fillStyle,r.strokeColor=e.strokeStyle;break;case g:const a=n.Util.makeHexColor(i[0],i[1],i[2]);s.fillStyle=a,s.strokeStyle=a,r.fillColor=a,r.strokeColor=a;break;default:throw new n.FormatError(`Unsupported paint type: ${t}`)}}getPattern(e,t,i,s){let a=i;s!==r.SHADING&&(a=n.Util.transform(a,t.baseTransform),this.matrix&&(a=n.Util.transform(a,this.matrix)));const o=this.createPatternCanvas(t);let l=new DOMMatrix(a);l=l.translate(o.offsetX,o.offsetY),l=l.scale(1/o.scaleX,1/o.scaleY);const h=e.createPattern(o.canvas,"repeat");return h.setTransform(l),h}}t.TilingPattern=f},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertBlackAndWhiteToRGBA=s,t.convertToRGBA=function(e){switch(e.kind){case n.ImageKind.GRAYSCALE_1BPP:return s(e);case n.ImageKind.RGB_24BPP:return function({src:e,srcPos:t=0,dest:i,destPos:s=0,width:r,height:a}){let o=0;const l=e.length>>2,h=new Uint32Array(e.buffer,t,l);if(n.FeatureTest.isLittleEndian){for(;o<l-2;o+=3,s+=4){const e=h[o],t=h[o+1],n=h[o+2];i[s]=4278190080|e,i[s+1]=e>>>24|t<<8|4278190080,i[s+2]=t>>>16|n<<16|4278190080,i[s+3]=n>>>8|4278190080}for(let t=4*o,n=e.length;t<n;t+=3)i[s++]=e[t]|e[t+1]<<8|e[t+2]<<16|4278190080}else{for(;o<l-2;o+=3,s+=4){const e=h[o],t=h[o+1],n=h[o+2];i[s]=255|e,i[s+1]=e<<24|t>>>8|255,i[s+2]=t<<16|n>>>16|255,i[s+3]=n<<8|255}for(let t=4*o,n=e.length;t<n;t+=3)i[s++]=e[t]<<24|e[t+1]<<16|e[t+2]<<8|255}return{srcPos:t,destPos:s}}(e)}return null},t.grayToRGBA=function(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 s({src:e,srcPos:t=0,dest:i,width:s,height:r,nonBlackColor:a=4294967295,inverseDecode:o=!1}){const l=n.FeatureTest.isLittleEndian?4278190080:255,[h,c]=o?[a,l]:[l,a],d=s>>3,u=7&s,p=e.length;i=new Uint32Array(i.buffer);let g=0;for(let n=0;n<r;n++){for(const n=t+d;t<n;t++){const n=t<p?e[t]:255;i[g++]=128&n?c:h,i[g++]=64&n?c:h,i[g++]=32&n?c:h,i[g++]=16&n?c:h,i[g++]=8&n?c:h,i[g++]=4&n?c:h,i[g++]=2&n?c:h,i[g++]=1&n?c:h}if(0===u)continue;const n=t<p?e[t++]:255;for(let e=0;e<u;e++)i[g++]=n&1<<7-e?c:h}return{srcPos:t,destPos:g}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalWorkerOptions=void 0;const i=Object.create(null);t.GlobalWorkerOptions=i,i.workerPort=null,i.workerSrc=""},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MessageHandler=void 0;var n=i(1);const s=1,r=2,a=1,o=2,l=3,h=4,c=5,d=6,u=7,p=8;function g(e){switch(e instanceof Error||"object"==typeof e&&null!==e||(0,n.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),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{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)return void this.#dt(t);if(t.callback){const e=t.callbackId,i=this.callbackCapabilities[e];if(!i)throw new Error(`Cannot resolve callback ${e}`);if(delete this.callbackCapabilities[e],t.callback===s)i.resolve(t.data);else{if(t.callback!==r)throw new Error("Unexpected callback case");i.reject(g(t.reason))}return}const n=this.actionHandler[t.action];if(!n)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){const e=this.sourceName,a=t.sourceName;new Promise((function(e){e(n(t.data))})).then((function(n){i.postMessage({sourceName:e,targetName:a,callback:s,callbackId:t.callbackId,data:n})}),(function(n){i.postMessage({sourceName:e,targetName:a,callback:r,callbackId:t.callbackId,reason:g(n)})}))}else t.streamId?this.#ut(t):n(t.data)},i.addEventListener("message",this._onComObjOnMessage)}on(e,t){const i=this.actionHandler;if(i[e])throw new Error(`There is already an actionName called "${e}"`);i[e]=t}send(e,t,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},i)}sendWithPromise(e,t,i){const s=this.callbackId++,r=new n.PromiseCapability;this.callbackCapabilities[s]=r;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:s,data:t},i)}catch(e){r.reject(e)}return r.promise}sendWithStream(e,t,i,s){const r=this.streamId++,o=this.sourceName,l=this.targetName,h=this.comObj;return new ReadableStream({start:i=>{const a=new n.PromiseCapability;return this.streamControllers[r]={controller:i,startCall:a,pullCall:null,cancelCall:null,isClosed:!1},h.postMessage({sourceName:o,targetName:l,action:e,streamId:r,data:t,desiredSize:i.desiredSize},s),a.promise},pull:e=>{const t=new n.PromiseCapability;return this.streamControllers[r].pullCall=t,h.postMessage({sourceName:o,targetName:l,stream:d,streamId:r,desiredSize:e.desiredSize}),t.promise},cancel:e=>{(0,n.assert)(e instanceof Error,"cancel must have a valid reason");const t=new n.PromiseCapability;return this.streamControllers[r].cancelCall=t,this.streamControllers[r].isClosed=!0,h.postMessage({sourceName:o,targetName:l,stream:a,streamId:r,reason:g(e)}),t.promise}},i)}#ut(e){const t=e.streamId,i=this.sourceName,s=e.sourceName,r=this.comObj,a=this,o=this.actionHandler[e.action],d={enqueue(e,a=1,o){if(this.isCancelled)return;const l=this.desiredSize;this.desiredSize-=a,l>0&&this.desiredSize<=0&&(this.sinkCapability=new n.PromiseCapability,this.ready=this.sinkCapability.promise),r.postMessage({sourceName:i,targetName:s,stream:h,streamId:t,chunk:e},o)},close(){this.isCancelled||(this.isCancelled=!0,r.postMessage({sourceName:i,targetName:s,stream:l,streamId:t}),delete a.streamSinks[t])},error(e){(0,n.assert)(e instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,r.postMessage({sourceName:i,targetName:s,stream:c,streamId:t,reason:g(e)}))},sinkCapability:new n.PromiseCapability,onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};d.sinkCapability.resolve(),d.ready=d.sinkCapability.promise,this.streamSinks[t]=d,new Promise((function(t){t(o(e.data,d))})).then((function(){r.postMessage({sourceName:i,targetName:s,stream:p,streamId:t,success:!0})}),(function(e){r.postMessage({sourceName:i,targetName:s,stream:p,streamId:t,reason:g(e)})}))}#dt(e){const t=e.streamId,i=this.sourceName,s=e.sourceName,r=this.comObj,f=this.streamControllers[t],m=this.streamSinks[t];switch(e.stream){case p:e.success?f.startCall.resolve():f.startCall.reject(g(e.reason));break;case u:e.success?f.pullCall.resolve():f.pullCall.reject(g(e.reason));break;case d:if(!m){r.postMessage({sourceName:i,targetName:s,stream:u,streamId:t,success:!0});break}m.desiredSize<=0&&e.desiredSize>0&&m.sinkCapability.resolve(),m.desiredSize=e.desiredSize,new Promise((function(e){e(m.onPull?.())})).then((function(){r.postMessage({sourceName:i,targetName:s,stream:u,streamId:t,success:!0})}),(function(e){r.postMessage({sourceName:i,targetName:s,stream:u,streamId:t,reason:g(e)})}));break;case h:if((0,n.assert)(f,"enqueue should have stream controller"),f.isClosed)break;f.controller.enqueue(e.chunk);break;case l:if((0,n.assert)(f,"close should have stream controller"),f.isClosed)break;f.isClosed=!0,f.controller.close(),this.#pt(f,t);break;case c:(0,n.assert)(f,"error should have stream controller"),f.controller.error(g(e.reason)),this.#pt(f,t);break;case o:e.success?f.cancelCall.resolve():f.cancelCall.reject(g(e.reason)),this.#pt(f,t);break;case a:if(!m)break;new Promise((function(t){t(m.onCancel?.(g(e.reason)))})).then((function(){r.postMessage({sourceName:i,targetName:s,stream:o,streamId:t,success:!0})}),(function(e){r.postMessage({sourceName:i,targetName:s,stream:o,streamId:t,reason:g(e)})})),m.sinkCapability.reject(g(e.reason)),m.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}async#pt(e,t){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]),delete this.streamControllers[t]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Metadata=void 0;var n=i(1);t.Metadata=class{#gt;#ft;constructor({parsedData:e,rawData:t}){this.#gt=e,this.#ft=t}getRaw(){return this.#ft}get(e){return this.#gt.get(e)??null}getAll(){return(0,n.objectFromMap)(this.#gt)}has(e){return this.#gt.has(e)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionalContentConfig=void 0;var n=i(1),s=i(8);const r=Symbol("INTERNAL");class a{#mt=!0;constructor(e,t){this.name=e,this.intent=t}get visible(){return this.#mt}_setVisible(e,t){e!==r&&(0,n.unreachable)("Internal method `_setVisible` called."),this.#mt=t}}t.OptionalContentConfig=class{#_t=null;#vt=new Map;#bt=null;#yt=null;constructor(e){if(this.name=null,this.creator=null,null!==e){this.name=e.name,this.creator=e.creator,this.#yt=e.order;for(const t of e.groups)this.#vt.set(t.id,new a(t.name,t.intent));if("OFF"===e.baseState)for(const e of this.#vt.values())e._setVisible(r,!1);for(const t of e.on)this.#vt.get(t)._setVisible(r,!0);for(const t of e.off)this.#vt.get(t)._setVisible(r,!1);this.#bt=this.getHash()}}#St(e){const t=e.length;if(t<2)return!0;const i=e[0];for(let s=1;s<t;s++){const t=e[s];let r;if(Array.isArray(t))r=this.#St(t);else{if(!this.#vt.has(t))return(0,n.warn)(`Optional content group not found: ${t}`),!0;r=this.#vt.get(t).visible}switch(i){case"And":if(!r)return!1;break;case"Or":if(r)return!0;break;case"Not":return!r;default:return!0}}return"And"===i}isVisible(e){if(0===this.#vt.size)return!0;if(!e)return(0,n.warn)("Optional content group not defined."),!0;if("OCG"===e.type)return this.#vt.has(e.id)?this.#vt.get(e.id).visible:((0,n.warn)(`Optional content group not found: ${e.id}`),!0);if("OCMD"===e.type){if(e.expression)return this.#St(e.expression);if(!e.policy||"AnyOn"===e.policy){for(const t of e.ids){if(!this.#vt.has(t))return(0,n.warn)(`Optional content group not found: ${t}`),!0;if(this.#vt.get(t).visible)return!0}return!1}if("AllOn"===e.policy){for(const t of e.ids){if(!this.#vt.has(t))return(0,n.warn)(`Optional content group not found: ${t}`),!0;if(!this.#vt.get(t).visible)return!1}return!0}if("AnyOff"===e.policy){for(const t of e.ids){if(!this.#vt.has(t))return(0,n.warn)(`Optional content group not found: ${t}`),!0;if(!this.#vt.get(t).visible)return!0}return!1}if("AllOff"===e.policy){for(const t of e.ids){if(!this.#vt.has(t))return(0,n.warn)(`Optional content group not found: ${t}`),!0;if(this.#vt.get(t).visible)return!1}return!0}return(0,n.warn)(`Unknown optional content policy ${e.policy}.`),!0}return(0,n.warn)(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0){this.#vt.has(e)?(this.#vt.get(e)._setVisible(r,!!t),this.#_t=null):(0,n.warn)(`Optional content group not found: ${e}`)}get hasInitialVisibility(){return null===this.#bt||this.getHash()===this.#bt}getOrder(){return this.#vt.size?this.#yt?this.#yt.slice():[...this.#vt.keys()]:null}getGroups(){return this.#vt.size>0?(0,n.objectFromMap)(this.#vt):null}getGroup(e){return this.#vt.get(e)||null}getHash(){if(null!==this.#_t)return this.#_t;const e=new s.MurmurHash3_64;for(const[t,i]of this.#vt)e.update(`${t}:${i.visible}`);return this.#_t=e.hexdigest()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFDataTransportStream=void 0;var n=i(1),s=i(6);t.PDFDataTransportStream=class{constructor({length:e,initialData:t,progressiveDone:i=!1,contentDispositionFilename:s=null,disableRange:r=!1,disableStream:a=!1},o){if((0,n.assert)(o,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'),this._queuedChunks=[],this._progressiveDone=i,this._contentDispositionFilename=s,t?.length>0){const e=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;this._queuedChunks.push(e)}this._pdfDataRangeTransport=o,this._isStreamingSupported=!a,this._isRangeSupported=!r,this._contentLength=e,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener(((e,t)=>{this._onReceiveData({begin:e,chunk:t})})),this._pdfDataRangeTransport.addProgressListener(((e,t)=>{this._onProgress({loaded:e,total:t})})),this._pdfDataRangeTransport.addProgressiveReadListener((e=>{this._onReceiveData({chunk:e})})),this._pdfDataRangeTransport.addProgressiveDoneListener((()=>{this._onProgressiveDone()})),this._pdfDataRangeTransport.transportReady()}_onReceiveData({begin:e,chunk:t}){const i=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;if(void 0===e)this._fullRequestReader?this._fullRequestReader._enqueue(i):this._queuedChunks.push(i);else{const t=this._rangeReaders.some((function(t){return t._begin===e&&(t._enqueue(i),!0)}));(0,n.assert)(t,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(e){void 0===e.total?this._rangeReaders[0]?.onProgress?.({loaded:e.loaded}):this._fullRequestReader?.onProgress?.({loaded:e.loaded,total:e.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){(0,n.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new r(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const i=new a(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(i),i}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeReaders.slice(0))t.cancel(e);this._pdfDataRangeTransport.abort()}};class r{constructor(e,t,i=!1,n=null){this._stream=e,this._done=i||!1,this._filename=(0,s.isPdfFile)(n)?n:null,this._queuedChunks=t||[],this._loaded=0;for(const e of this._queuedChunks)this._loaded+=e.byteLength;this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):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;return this._requests.push(e),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 a{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;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=new n.PromiseCapability;return this._requests.push(e),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,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFFetchStream=void 0;var n=i(1),s=i(20);function r(e,t,i){return{method:"GET",headers:e,signal:i.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function a(e){const t=new Headers;for(const i in e){const n=e[i];void 0!==n&&t.append(i,n)}return t}function o(e){return e instanceof Uint8Array?e.buffer:e instanceof ArrayBuffer?e:((0,n.warn)(`getArrayBuffer - unexpected data format: ${e}`),new Uint8Array(e).buffer)}t.PDFFetchStream=class{constructor(e){this.source=e,this.isHttp=/^https?:/i.test(e.url),this.httpHeaders=this.isHttp&&e.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,n.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new l(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const i=new h(this,e,t);return this._rangeRequestReaders.push(i),i}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}};class l{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=a(this._stream.httpHeaders);const i=t.url;fetch(i,r(this._headers,this._withCredentials,this._abortController)).then((e=>{if(!(0,s.validateResponseStatus)(e.status))throw(0,s.createResponseStatusError)(e.status,i);this._reader=e.body.getReader(),this._headersCapability.resolve();const t=t=>e.headers.get(t),{allowRangeRequests:r,suggestedLength:a}=(0,s.validateRangeRequestCapabilities)({getResponseHeader:t,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=r,this._contentLength=a||this._contentLength,this._filename=(0,s.extractFilenameFromHeader)(t),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new n.AbortException("Streaming is disabled."))})).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:o(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}class h{constructor(e,t,i){this._stream=e,this._reader=null,this._loaded=0;const o=e.source;this._withCredentials=o.withCredentials||!1,this._readCapability=new n.PromiseCapability,this._isStreamingSupported=!o.disableStream,this._abortController=new AbortController,this._headers=a(this._stream.httpHeaders),this._headers.append("Range",`bytes=${t}-${i-1}`);const l=o.url;fetch(l,r(this._headers,this._withCredentials,this._abortController)).then((e=>{if(!(0,s.validateResponseStatus)(e.status))throw(0,s.createResponseStatusError)(e.status,l);this._readCapability.resolve(),this._reader=e.body.getReader()})).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded}),{value:o(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createResponseStatusError=function(e,t){return 404===e||0===e&&t.startsWith("file:")?new n.MissingPDFException('Missing PDF "'+t+'".'):new n.UnexpectedResponseException(`Unexpected server response (${e}) while retrieving PDF "${t}".`,e)},t.extractFilenameFromHeader=function(e){const t=e("Content-Disposition");if(t){let e=(0,s.getFilenameFromContentDispositionHeader)(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if((0,r.isPdfFile)(e))return e}return null},t.validateRangeRequestCapabilities=function({getResponseHeader:e,isHttp:t,rangeChunkSize:i,disableRange:n}){const s={allowRangeRequests:!1,suggestedLength:void 0},r=parseInt(e("Content-Length"),10);return Number.isInteger(r)?(s.suggestedLength=r,r<=2*i||n||!t||"bytes"!==e("Accept-Ranges")||"identity"!==(e("Content-Encoding")||"identity")||(s.allowRangeRequests=!0),s):s},t.validateResponseStatus=function(e){return 200===e||206===e};var n=i(1),s=i(21),r=i(6)},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getFilenameFromContentDispositionHeader=function(e){let t=!0,i=s("filename\\*","i").exec(e);if(i){i=i[1];let e=o(i);return e=unescape(e),e=l(e),e=h(e),a(e)}if(i=function(e){const t=[];let i;const n=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(i=n.exec(e));){let[,e,n,s]=i;if(e=parseInt(e,10),e in t){if(0===e)break}else t[e]=[n,s]}const r=[];for(let e=0;e<t.length&&e in t;++e){let[i,n]=t[e];n=o(n),i&&(n=unescape(n),0===e&&(n=l(n))),r.push(n)}return r.join("")}(e),i)return a(h(i));if(i=s("filename","i").exec(e),i){i=i[1];let e=o(i);return e=h(e),a(e)}function s(e,t){return new RegExp("(?:^|;)\\s*"+e+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',t)}function r(e,i){if(e){if(!/^[\x00-\xFF]+$/.test(i))return i;try{const s=new TextDecoder(e,{fatal:!0}),r=(0,n.stringToBytes)(i);i=s.decode(r),t=!1}catch{}}return i}function a(e){return t&&/[\x80-\xff]/.test(e)&&(e=r("utf-8",e),t&&(e=r("iso-8859-1",e))),e}function o(e){if(e.startsWith('"')){const t=e.slice(1).split('\\"');for(let e=0;e<t.length;++e){const i=t[e].indexOf('"');-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 l(e){const t=e.indexOf("'");return-1===t?e:r(e.slice(0,t),e.slice(t+1).replace(/^[^']*'/,""))}function h(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 r(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{}return r(t,n)}))}return""};var n=i(1)},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFNetworkStream=void 0;var n=i(1),s=i(20);class r{constructor(e,t={}){this.url=e,this.isHttp=/^https?:/i.test(e),this.httpHeaders=this.isHttp&&t.httpHeaders||Object.create(null),this.withCredentials=t.withCredentials||!1,this.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)}return this.isHttp&&"begin"in e&&"end"in e?(t.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),n.expectedStatus=206):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),i}onProgress(e,t){const i=this.pendingRequests[e];i&&i.onProgress?.(t)}onStateChange(e,t){const i=this.pendingRequests[e];if(!i)return;const s=i.xhr;if(s.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),4!==s.readyState)return;if(!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],0===s.status&&this.isHttp)return void i.onError?.(s.status);const r=s.status||200;if((200!==r||206!==i.expectedStatus)&&r!==i.expectedStatus)return void i.onError?.(s.status);const a=function(e){const t=e.response;return"string"!=typeof t?t:(0,n.stringToBytes)(t).buffer}(s);if(206===r){const e=s.getResponseHeader("Content-Range"),t=/bytes (\d+)-(\d+)\/(\d+)/.exec(e);i.onDone({begin:parseInt(t[1],10),chunk:a})}else a?i.onDone({begin:0,chunk:a}):i.onError?.(s.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}}t.PDFNetworkStream=class{constructor(e){this._source=e,this._manager=new r(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(){return(0,n.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new a(this._manager,this._source),this._fullRequestReader}getRangeReader(e,t){const i=new o(this._manager,e,t);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}};class a{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),i=e=>t.getResponseHeader(e),{allowRangeRequests:n,suggestedLength:r}=(0,s.validateRangeRequestCapabilities)({getResponseHeader:i,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});n&&(this._isRangeSupported=!0),this._contentLength=r||this._contentLength,this._filename=(0,s.extractFilenameFromHeader)(i),this._isRangeSupported&&this._manager.abortRequest(e),this._headersReceivedCapability.resolve()}_onDone(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=(0,s.createResponseStatusError)(e,this._url),this._headersReceivedCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=new n.PromiseCapability;return this._requests.push(e),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 o{constructor(e,t,i){this._manager=e;const n={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._requestId=e.requestRange(t,i,n),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(e){const t=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError=(0,s.createResponseStatusError)(e,this._url);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){this.isStreamingSupported||this.onProgress?.({loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=new n.PromiseCapability;return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFNodeStream=void 0;var n=i(1),s=i(20);const r=/^file:\/\/\/[a-zA-Z]:\//;t.PDFNodeStream=class{constructor(e){this.source=e,this.url=function(e){const t=require$$5,i=t.parse(e);return"file:"===i.protocol||i.host?i:/^[a-z]:[/\\]/i.test(e)?t.parse(`file:///${e}`):(i.host||(i.protocol="file:"),i)}(e.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.httpHeaders=this.isHttp&&e.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,n.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new d(this):new h(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const i=this.isFsUrl?new u(this,e,t):new c(this,e,t);return this._rangeRequestReaders.push(i),i}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}};class a{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(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return null===e?(this._readCapability=new n.PromiseCapability,this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",(()=>{this._readCapability.resolve()})),e.on("end",(()=>{e.destroy(),this._done=!0,this._readCapability.resolve()})),e.on("error",(e=>{this._error(e)})),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new n.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class o{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(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return null===e?(this._readCapability=new n.PromiseCapability,this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",(()=>{this._readCapability.resolve()})),e.on("end",(()=>{e.destroy(),this._done=!0,this._readCapability.resolve()})),e.on("error",(e=>{this._error(e)})),this._storedError&&this._readableStream.destroy(this._storedError)}}function l(e,t){return{protocol:e.protocol,auth:e.auth,host:e.hostname,port:e.port,path:e.path,method:"GET",headers:t}}class h extends a{constructor(e){super(e);const t=t=>{if(404===t.statusCode){const e=new n.MissingPDFException(`Missing PDF "${this._url}".`);return this._storedError=e,void this._headersCapability.reject(e)}this._headersCapability.resolve(),this._setReadableStream(t);const i=e=>this._readableStream.headers[e.toLowerCase()],{allowRangeRequests:r,suggestedLength:a}=(0,s.validateRangeRequestCapabilities)({getResponseHeader:i,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=r,this._contentLength=a||this._contentLength,this._filename=(0,s.extractFilenameFromHeader)(i)};if(this._request=null,"http:"===this._url.protocol){const i=require$$5;this._request=i.request(l(this._url,e.httpHeaders),t)}else{const i=require$$5;this._request=i.request(l(this._url,e.httpHeaders),t)}this._request.on("error",(e=>{this._storedError=e,this._headersCapability.reject(e)})),this._request.end()}}class c extends o{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 s=e=>{if(404!==e.statusCode)this._setReadableStream(e);else{const e=new n.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=e}};if(this._request=null,"http:"===this._url.protocol){const e=require$$5;this._request=e.request(l(this._url,this._httpHeaders),s)}else{const e=require$$5;this._request=e.request(l(this._url,this._httpHeaders),s)}this._request.on("error",(e=>{this._storedError=e})),this._request.end()}}class d extends a{constructor(e){super(e);let t=decodeURIComponent(this._url.path);r.test(this._url.href)&&(t=t.replace(/^\//,""));const i=require$$5;i.lstat(t,((e,s)=>{if(e)return"ENOENT"===e.code&&(e=new n.MissingPDFException(`Missing PDF "${t}".`)),this._storedError=e,void this._headersCapability.reject(e);this._contentLength=s.size,this._setReadableStream(i.createReadStream(t)),this._headersCapability.resolve()}))}}class u extends o{constructor(e,t,i){super(e);let n=decodeURIComponent(this._url.path);r.test(this._url.href)&&(n=n.replace(/^\//,""));const s=require$$5;this._setReadableStream(s.createReadStream(n,{start:t,end:i-1}))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SVGGraphics=void 0;var n=i(6),s=i(1);const r="normal",a="normal",o="#000000",l=["butt","round","square"],h=["miter","round","bevel"],c=function(e,t="",i=!1){if(URL.createObjectURL&&"undefined"!=typeof Blob&&!i)return URL.createObjectURL(new Blob([e],{type:t}));const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let s=`data:${t};base64,`;for(let t=0,i=e.length;t<i;t+=3){const r=255&e[t],a=255&e[t+1],o=255&e[t+2];s+=n[r>>2]+n[(3&r)<<4|a>>4]+n[t+1<i?(15&a)<<2|o>>6:64]+n[t+2<i?63&o:64]}return s},d=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 i(e,i,n,s){let r=s;const a=i.length;n[r]=a>>24&255,n[r+1]=a>>16&255,n[r+2]=a>>8&255,n[r+3]=255&a,r+=4,n[r]=255&e.charCodeAt(0),n[r+1]=255&e.charCodeAt(1),n[r+2]=255&e.charCodeAt(2),n[r+3]=255&e.charCodeAt(3),r+=4,n.set(i,r),r+=i.length;const o=function(e,i,n){let s=-1;for(let r=i;r<n;r++){const i=255&(s^e[r]);s=s>>>8^t[i]}return-1^s}(n,s+4,r);n[r]=o>>24&255,n[r+1]=o>>16&255,n[r+2]=o>>8&255,n[r+3]=255&o}function n(e){let t=e.length;const i=65535,n=Math.ceil(t/i),s=new Uint8Array(2+t+5*n+4);let r=0;s[r++]=120,s[r++]=156;let a=0;for(;t>i;)s[r++]=0,s[r++]=255,s[r++]=255,s[r++]=0,s[r++]=0,s.set(e.subarray(a,a+i),r),r+=i,a+=i,t-=i;s[r++]=1,s[r++]=255&t,s[r++]=t>>8&255,s[r++]=255&~t,s[r++]=(65535&~t)>>8&255,s.set(e.subarray(a),r),r+=e.length-a;const o=function(e,t,i){let n=1,s=0;for(let r=t;r<i;++r)n=(n+(255&e[r]))%65521,s=(s+n)%65521;return s<<16|n}(e,0,e.length);return s[r++]=o>>24&255,s[r++]=o>>16&255,s[r++]=o>>8&255,s[r++]=255&o,s}function r(t,r,a,o){const l=t.width,h=t.height;let d,u,p;const g=t.data;switch(r){case s.ImageKind.GRAYSCALE_1BPP:u=0,d=1,p=l+7>>3;break;case s.ImageKind.RGB_24BPP:u=2,d=8,p=3*l;break;case s.ImageKind.RGBA_32BPP:u=6,d=8,p=4*l;break;default:throw new Error("invalid format")}const f=new Uint8Array((1+p)*h);let m=0,_=0;for(let e=0;e<h;++e)f[m++]=0,f.set(g.subarray(_,_+p),m),_+=p,m+=p;if(r===s.ImageKind.GRAYSCALE_1BPP&&o){m=0;for(let e=0;e<h;e++){m++;for(let e=0;e<p;e++)f[m++]^=255}}const v=new Uint8Array([l>>24&255,l>>16&255,l>>8&255,255&l,h>>24&255,h>>16&255,h>>8&255,255&h,d,u,0,0,0]),b=function(e){if(!s.isNodeJS)return n(e);try{const t=parseInt(process.versions.node)>=8?e:Buffer.from(e),i=require$$5.deflateSync(t,{level:9});return i instanceof Uint8Array?i:new Uint8Array(i)}catch(e){(0,s.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+e)}return n(e)}(f),y=e.length+36+v.length+b.length,S=new Uint8Array(y);let P=0;return S.set(e,P),P+=e.length,i("IHDR",v,S,P),P+=12+v.length,i("IDATA",b,S,P),P+=12+b.length,i("IEND",new Uint8Array(0),S,P),c(S,"image/png",a)}return function(e,t,i){return r(e,void 0===e.kind?s.ImageKind.GRAYSCALE_1BPP:e.kind,t,i)}}();class u{constructor(){this.fontSizeScale=1,this.fontWeight=a,this.fontSize=0,this.textMatrix=s.IDENTITY_MATRIX,this.fontMatrix=s.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=s.TextRenderingMode.FILL,this.textMatrixScale=1,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRise=0,this.fillColor=o,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 p(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 g(e){if(0===e[4]&&0===e[5]){if(0===e[1]&&0===e[2])return 1===e[0]&&1===e[3]?"":`scale(${p(e[0])} ${p(e[3])})`;if(e[0]===e[3]&&e[1]===-e[2])return`rotate(${p(180*Math.acos(e[0])/Math.PI)})`}else if(1===e[0]&&0===e[1]&&0===e[2]&&1===e[3])return`translate(${p(e[4])} ${p(e[5])})`;return`matrix(${p(e[0])} ${p(e[1])} ${p(e[2])} ${p(e[3])} ${p(e[4])} ${p(e[5])})`}let f=0,m=0,_=0;t.SVGGraphics=class{constructor(e,t,i=!1){(0,n.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future."),this.svgFactory=new n.DOMSVGFactory,this.current=new u,this.transformMatrix=s.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=e,this.objs=t,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!i,this._operatorIdMapping=[];for(const e in s.OPS)this._operatorIdMapping[s.OPS[e]]=e}getObject(e,t=null){return"string"==typeof e?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}save(){this.transformStack.push(this.transformMatrix);const e=this.current;this.extraStack.push(e),this.current=e.clone()}restore(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}group(e){this.save(),this.executeOpTree(e),this.restore()}loadDependencies(e){const t=e.fnArray,i=e.argsArray;for(let e=0,n=t.length;e<n;e++)if(t[e]===s.OPS.dependency)for(const t of i[e]){const e=t.startsWith("g_")?this.commonObjs:this.objs,i=new Promise((i=>{e.get(t,i)}));this.current.dependencies.push(i)}return Promise.all(this.current.dependencies)}transform(e,t,i,n,r,a){const o=[e,t,i,n,r,a];this.transformMatrix=s.Util.transform(this.transformMatrix,o),this.tgrp=null}getSVG(e,t){this.viewport=t;const i=this._initialize(t);return this.loadDependencies(e).then((()=>(this.transformMatrix=s.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(e)),i)))}convertOpList(e){const t=this._operatorIdMapping,i=e.argsArray,n=e.fnArray,s=[];for(let e=0,r=n.length;e<r;e++){const r=n[e];s.push({fnId:r,fn:t[r],args:i[e]})}return function(e){let t=[];const i=[];for(const n of e)"save"!==n.fn?"restore"===n.fn?t=i.pop():t.push(n):(t.push({fnId:92,fn:"group",items:[]}),i.push(t),t=t.at(-1).items);return t}(s)}executeOpTree(e){for(const t of e){const e=t.fn,i=t.fnId,n=t.args;switch(0|i){case s.OPS.beginText:this.beginText();break;case s.OPS.dependency:break;case s.OPS.setLeading:this.setLeading(n);break;case s.OPS.setLeadingMoveText:this.setLeadingMoveText(n[0],n[1]);break;case s.OPS.setFont:this.setFont(n);break;case s.OPS.showText:case s.OPS.showSpacedText:this.showText(n[0]);break;case s.OPS.endText:this.endText();break;case s.OPS.moveText:this.moveText(n[0],n[1]);break;case s.OPS.setCharSpacing:this.setCharSpacing(n[0]);break;case s.OPS.setWordSpacing:this.setWordSpacing(n[0]);break;case s.OPS.setHScale:this.setHScale(n[0]);break;case s.OPS.setTextMatrix:this.setTextMatrix(n[0],n[1],n[2],n[3],n[4],n[5]);break;case s.OPS.setTextRise:this.setTextRise(n[0]);break;case s.OPS.setTextRenderingMode:this.setTextRenderingMode(n[0]);break;case s.OPS.setLineWidth:this.setLineWidth(n[0]);break;case s.OPS.setLineJoin:this.setLineJoin(n[0]);break;case s.OPS.setLineCap:this.setLineCap(n[0]);break;case s.OPS.setMiterLimit:this.setMiterLimit(n[0]);break;case s.OPS.setFillRGBColor:this.setFillRGBColor(n[0],n[1],n[2]);break;case s.OPS.setStrokeRGBColor:this.setStrokeRGBColor(n[0],n[1],n[2]);break;case s.OPS.setStrokeColorN:this.setStrokeColorN(n);break;case s.OPS.setFillColorN:this.setFillColorN(n);break;case s.OPS.shadingFill:this.shadingFill(n[0]);break;case s.OPS.setDash:this.setDash(n[0],n[1]);break;case s.OPS.setRenderingIntent:this.setRenderingIntent(n[0]);break;case s.OPS.setFlatness:this.setFlatness(n[0]);break;case s.OPS.setGState:this.setGState(n[0]);break;case s.OPS.fill:this.fill();break;case s.OPS.eoFill:this.eoFill();break;case s.OPS.stroke:this.stroke();break;case s.OPS.fillStroke:this.fillStroke();break;case s.OPS.eoFillStroke:this.eoFillStroke();break;case s.OPS.clip:this.clip("nonzero");break;case s.OPS.eoClip:this.clip("evenodd");break;case s.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case s.OPS.paintImageXObject:this.paintImageXObject(n[0]);break;case s.OPS.paintInlineImageXObject:this.paintInlineImageXObject(n[0]);break;case s.OPS.paintImageMaskXObject:this.paintImageMaskXObject(n[0]);break;case s.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(n[0],n[1]);break;case s.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case s.OPS.closePath:this.closePath();break;case s.OPS.closeStroke:this.closeStroke();break;case s.OPS.closeFillStroke:this.closeFillStroke();break;case s.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case s.OPS.nextLine:this.nextLine();break;case s.OPS.transform:this.transform(n[0],n[1],n[2],n[3],n[4],n[5]);break;case s.OPS.constructPath:this.constructPath(n[0],n[1]);break;case s.OPS.endPath:this.endPath();break;case 92:this.group(t.items);break;default:(0,s.warn)(`Unimplemented operator ${e}`)}}}setWordSpacing(e){this.current.wordSpacing=e}setCharSpacing(e){this.current.charSpacing=e}nextLine(){this.moveText(0,this.current.leading)}setTextMatrix(e,t,i,n,s,r){const a=this.current;a.textMatrix=a.lineMatrix=[e,t,i,n,s,r],a.textMatrixScale=Math.hypot(e,t),a.x=a.lineX=0,a.y=a.lineY=0,a.xcoords=[],a.ycoords=[],a.tspan=this.svgFactory.createElement("svg:tspan"),a.tspan.setAttributeNS(null,"font-family",a.fontFamily),a.tspan.setAttributeNS(null,"font-size",`${p(a.fontSize)}px`),a.tspan.setAttributeNS(null,"y",p(-a.y)),a.txtElement=this.svgFactory.createElement("svg:text"),a.txtElement.append(a.tspan)}beginText(){const e=this.current;e.x=e.lineX=0,e.y=e.lineY=0,e.textMatrix=s.IDENTITY_MATRIX,e.lineMatrix=s.IDENTITY_MATRIX,e.textMatrixScale=1,e.tspan=this.svgFactory.createElement("svg:tspan"),e.txtElement=this.svgFactory.createElement("svg:text"),e.txtgrp=this.svgFactory.createElement("svg:g"),e.xcoords=[],e.ycoords=[]}moveText(e,t){const i=this.current;i.x=i.lineX+=e,i.y=i.lineY+=t,i.xcoords=[],i.ycoords=[],i.tspan=this.svgFactory.createElement("svg:tspan"),i.tspan.setAttributeNS(null,"font-family",i.fontFamily),i.tspan.setAttributeNS(null,"font-size",`${p(i.fontSize)}px`),i.tspan.setAttributeNS(null,"y",p(-i.y))}showText(e){const t=this.current,i=t.font,n=t.fontSize;if(0===n)return;const l=t.fontSizeScale,h=t.charSpacing,c=t.wordSpacing,d=t.fontDirection,u=t.textHScale*d,f=i.vertical,m=f?1:-1,_=i.defaultVMetrics,v=n*t.fontMatrix[0];let b=0;for(const s of e){if(null===s){b+=d*c;continue}if("number"==typeof s){b+=m*s*n/1e3;continue}const e=(s.isSpace?c:0)+h,r=s.fontChar;let a,o,u=s.width;if(f){let e;const t=s.vmetric||_;e=s.vmetric?t[1]:.5*u,e=-e*v;const i=t[2]*v;u=t?-t[0]:u,a=e/l,o=(b+i)/l}else a=b/l,o=0;(s.isInFont||i.missingFile)&&(t.xcoords.push(t.x+a),f&&t.ycoords.push(-t.y+o),t.tspan.textContent+=r),b+=f?u*v-e*d:u*v+e*d}t.tspan.setAttributeNS(null,"x",t.xcoords.map(p).join(" ")),f?t.tspan.setAttributeNS(null,"y",t.ycoords.map(p).join(" ")):t.tspan.setAttributeNS(null,"y",p(-t.y)),f?t.y-=b:t.x+=b*u,t.tspan.setAttributeNS(null,"font-family",t.fontFamily),t.tspan.setAttributeNS(null,"font-size",`${p(t.fontSize)}px`),t.fontStyle!==r&&t.tspan.setAttributeNS(null,"font-style",t.fontStyle),t.fontWeight!==a&&t.tspan.setAttributeNS(null,"font-weight",t.fontWeight);const y=t.textRenderingMode&s.TextRenderingMode.FILL_STROKE_MASK;if(y===s.TextRenderingMode.FILL||y===s.TextRenderingMode.FILL_STROKE?(t.fillColor!==o&&t.tspan.setAttributeNS(null,"fill",t.fillColor),t.fillAlpha<1&&t.tspan.setAttributeNS(null,"fill-opacity",t.fillAlpha)):t.textRenderingMode===s.TextRenderingMode.ADD_TO_PATH?t.tspan.setAttributeNS(null,"fill","transparent"):t.tspan.setAttributeNS(null,"fill","none"),y===s.TextRenderingMode.STROKE||y===s.TextRenderingMode.FILL_STROKE){const e=1/(t.textMatrixScale||1);this._setStrokeAttributes(t.tspan,e)}let S=t.textMatrix;0!==t.textRise&&(S=S.slice(),S[5]+=t.textRise),t.txtElement.setAttributeNS(null,"transform",`${g(S)} scale(${p(u)}, -1)`),t.txtElement.setAttributeNS("http://www.w3.org/XML/1998/namespace","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.');this.cssStyle||(this.cssStyle=this.svgFactory.createElement("svg:style"),this.cssStyle.setAttributeNS(null,"type","text/css"),this.defs.append(this.cssStyle));const t=c(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,!this.embedFonts||i.missingFile||this.embeddedFonts[i.loadedName]||(this.addFontStyle(i),this.embeddedFonts[i.loadedName]=i),t.fontMatrix=i.fontMatrix||s.FONT_IDENTITY_MATRIX;let r="normal";i.black?r="900":i.bold&&(r="bold");const a=i.italic?"italic":"normal";n<0?(n=-n,t.fontDirection=-1):t.fontDirection=1,t.fontSize=n,t.fontFamily=i.loadedName,t.fontWeight=r,t.fontStyle=a,t.tspan=this.svgFactory.createElement("svg:tspan"),t.tspan.setAttributeNS(null,"y",p(-t.y)),t.xcoords=[],t.ycoords=[]}endText(){const e=this.current;e.textRenderingMode&s.TextRenderingMode.ADD_TO_PATH_FLAG&&e.txtElement?.hasChildNodes()&&(e.element=e.txtElement,this.clip("nonzero"),this.endPath())}setLineWidth(e){e>0&&(this.current.lineWidth=e)}setLineCap(e){this.current.lineCap=l[e]}setLineJoin(e){this.current.lineJoin=h[e]}setMiterLimit(e){this.current.miterLimit=e}setStrokeAlpha(e){this.current.strokeAlpha=e}setStrokeRGBColor(e,t,i){this.current.strokeColor=s.Util.makeHexColor(e,t,i)}setFillAlpha(e){this.current.fillAlpha=e}setFillRGBColor(e,t,i){this.current.fillColor=s.Util.makeHexColor(e,t,i),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(e){this.current.strokeColor=this._makeColorN_Pattern(e)}setFillColorN(e){this.current.fillColor=this._makeColorN_Pattern(e)}shadingFill(e){const{width:t,height:i}=this.viewport,n=s.Util.inverseTransform(this.transformMatrix),[r,a,o,l]=s.Util.getAxialAlignedBoundingBox([0,0,t,i],n),h=this.svgFactory.createElement("svg:rect");h.setAttributeNS(null,"x",r),h.setAttributeNS(null,"y",a),h.setAttributeNS(null,"width",o-r),h.setAttributeNS(null,"height",l-a),h.setAttributeNS(null,"fill",this._makeShadingPattern(e)),this.current.fillAlpha<1&&h.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(h)}_makeColorN_Pattern(e){return"TilingPattern"===e[0]?this._makeTilingPattern(e):this._makeShadingPattern(e)}_makeTilingPattern(e){const t=e[1],i=e[2],n=e[3]||s.IDENTITY_MATRIX,[r,a,o,l]=e[4],h=e[5],c=e[6],d=e[7],u="shading"+_++,[p,g,f,m]=s.Util.normalizeRect([...s.Util.applyTransform([r,a],n),...s.Util.applyTransform([o,l],n)]),[v,b]=s.Util.singularValueDecompose2dScale(n),y=h*v,S=c*b,P=this.svgFactory.createElement("svg:pattern");P.setAttributeNS(null,"id",u),P.setAttributeNS(null,"patternUnits","userSpaceOnUse"),P.setAttributeNS(null,"width",y),P.setAttributeNS(null,"height",S),P.setAttributeNS(null,"x",`${p}`),P.setAttributeNS(null,"y",`${g}`);const A=this.svg,w=this.transformMatrix,E=this.current.fillColor,x=this.current.strokeColor,C=this.svgFactory.create(f-p,m-g);if(this.svg=C,this.transformMatrix=n,2===d){const e=s.Util.makeHexColor(...t);this.current.fillColor=e,this.current.strokeColor=e}return this.executeOpTree(this.convertOpList(i)),this.svg=A,this.transformMatrix=w,this.current.fillColor=E,this.current.strokeColor=x,P.append(C.childNodes[0]),this.defs.append(P),`url(#${u})`}_makeShadingPattern(e){switch("string"==typeof e&&(e=this.objs.get(e)),e[0]){case"RadialAxial":const t="shading"+_++,i=e[3];let n;switch(e[1]){case"axial":const i=e[4],s=e[5];n=this.svgFactory.createElement("svg:linearGradient"),n.setAttributeNS(null,"id",t),n.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),n.setAttributeNS(null,"x1",i[0]),n.setAttributeNS(null,"y1",i[1]),n.setAttributeNS(null,"x2",s[0]),n.setAttributeNS(null,"y2",s[1]);break;case"radial":const r=e[4],a=e[5],o=e[6],l=e[7];n=this.svgFactory.createElement("svg:radialGradient"),n.setAttributeNS(null,"id",t),n.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),n.setAttributeNS(null,"cx",a[0]),n.setAttributeNS(null,"cy",a[1]),n.setAttributeNS(null,"r",l),n.setAttributeNS(null,"fx",r[0]),n.setAttributeNS(null,"fy",r[1]),n.setAttributeNS(null,"fr",o);break;default:throw new Error(`Unknown RadialAxial type: ${e[1]}`)}for(const e of i){const t=this.svgFactory.createElement("svg:stop");t.setAttributeNS(null,"offset",e[0]),t.setAttributeNS(null,"stop-color",e[1]),n.append(t)}return this.defs.append(n),`url(#${t})`;case"Mesh":return(0,s.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw new Error(`Unknown IR type: ${e[0]}`)}}setDash(e,t){this.current.dashArray=e,this.current.dashPhase=t}constructPath(e,t){const i=this.current;let n=i.x,r=i.y,a=[],o=0;for(const i of e)switch(0|i){case s.OPS.rectangle:n=t[o++],r=t[o++];const e=n+t[o++],i=r+t[o++];a.push("M",p(n),p(r),"L",p(e),p(r),"L",p(e),p(i),"L",p(n),p(i),"Z");break;case s.OPS.moveTo:n=t[o++],r=t[o++],a.push("M",p(n),p(r));break;case s.OPS.lineTo:n=t[o++],r=t[o++],a.push("L",p(n),p(r));break;case s.OPS.curveTo:n=t[o+4],r=t[o+5],a.push("C",p(t[o]),p(t[o+1]),p(t[o+2]),p(t[o+3]),p(n),p(r)),o+=6;break;case s.OPS.curveTo2:a.push("C",p(n),p(r),p(t[o]),p(t[o+1]),p(t[o+2]),p(t[o+3])),n=t[o+2],r=t[o+3],o+=4;break;case s.OPS.curveTo3:n=t[o+2],r=t[o+3],a.push("C",p(t[o]),p(t[o+1]),p(n),p(r),p(n),p(r)),o+=4;break;case s.OPS.closePath:a.push("Z")}a=a.join(" "),i.path&&e.length>0&&e[0]!==s.OPS.rectangle&&e[0]!==s.OPS.moveTo?a=i.path.getAttributeNS(null,"d")+a:(i.path=this.svgFactory.createElement("svg:path"),this._ensureTransformGroup().append(i.path)),i.path.setAttributeNS(null,"d",a),i.path.setAttributeNS(null,"fill","none"),i.element=i.path,i.setCurrentPoint(n,r)}endPath(){const e=this.current;if(e.path=null,!this.pendingClip)return;if(!e.element)return void(this.pendingClip=null);const t="clippath"+f++,i=this.svgFactory.createElement("svg:clipPath");i.setAttributeNS(null,"id",t),i.setAttributeNS(null,"transform",g(this.transformMatrix));const n=e.element.cloneNode(!0);if("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),e.activeClipUrl){e.clipGroup=null;for(const e of this.extraStack)e.clipGroup=null;i.setAttributeNS(null,"clip-path",e.activeClipUrl)}e.activeClipUrl=`url(#${t})`,this.tgrp=null}clip(e){this.pendingClip=e}closePath(){const e=this.current;if(e.path){const t=`${e.path.getAttributeNS(null,"d")}Z`;e.path.setAttributeNS(null,"d",t)}}setLeading(e){this.current.leading=-e}setTextRise(e){this.current.textRise=e}setTextRenderingMode(e){this.current.textRenderingMode=e}setHScale(e){this.current.textHScale=e/100}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[t,i]of e)switch(t){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i);break;case"CA":this.setStrokeAlpha(i);break;case"ca":this.setFillAlpha(i);break;default:(0,s.warn)(`Unimplemented graphic state operator ${t}`)}}fill(){const e=this.current;e.element&&(e.element.setAttributeNS(null,"fill",e.fillColor),e.element.setAttributeNS(null,"fill-opacity",e.fillAlpha),this.endPath())}stroke(){const e=this.current;e.element&&(this._setStrokeAttributes(e.element),e.element.setAttributeNS(null,"fill","none"),this.endPath())}_setStrokeAttributes(e,t=1){const i=this.current;let n=i.dashArray;1!==t&&n.length>0&&(n=n.map((function(e){return t*e}))),e.setAttributeNS(null,"stroke",i.strokeColor),e.setAttributeNS(null,"stroke-opacity",i.strokeAlpha),e.setAttributeNS(null,"stroke-miterlimit",p(i.miterLimit)),e.setAttributeNS(null,"stroke-linecap",i.lineCap),e.setAttributeNS(null,"stroke-linejoin",i.lineJoin),e.setAttributeNS(null,"stroke-width",p(t*i.lineWidth)+"px"),e.setAttributeNS(null,"stroke-dasharray",n.map(p).join(" ")),e.setAttributeNS(null,"stroke-dashoffset",p(t*i.dashPhase)+"px")}eoFill(){this.current.element?.setAttributeNS(null,"fill-rule","evenodd"),this.fill()}fillStroke(){this.stroke(),this.fill()}eoFillStroke(){this.current.element?.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()}closeStroke(){this.closePath(),this.stroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.closePath(),this.eoFillStroke()}paintSolidColorImageMask(){const e=this.svgFactory.createElement("svg:rect");e.setAttributeNS(null,"x","0"),e.setAttributeNS(null,"y","0"),e.setAttributeNS(null,"width","1px"),e.setAttributeNS(null,"height","1px"),e.setAttributeNS(null,"fill",this.current.fillColor),this._ensureTransformGroup().append(e)}paintImageXObject(e){const t=this.getObject(e);t?this.paintInlineImageXObject(t):(0,s.warn)(`Dependent image with object ID ${e} is not ready yet`)}paintInlineImageXObject(e,t){const i=e.width,n=e.height,s=d(e,this.forceDataSchema,!!t),r=this.svgFactory.createElement("svg:rect");r.setAttributeNS(null,"x","0"),r.setAttributeNS(null,"y","0"),r.setAttributeNS(null,"width",p(i)),r.setAttributeNS(null,"height",p(n)),this.current.element=r,this.clip("nonzero");const a=this.svgFactory.createElement("svg:image");a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s),a.setAttributeNS(null,"x","0"),a.setAttributeNS(null,"y",p(-n)),a.setAttributeNS(null,"width",p(i)+"px"),a.setAttributeNS(null,"height",p(n)+"px"),a.setAttributeNS(null,"transform",`scale(${p(1/i)} ${p(-1/n)})`),t?t.append(a):this._ensureTransformGroup().append(a)}paintImageMaskXObject(e){const t=this.getObject(e.data,e);if(t.bitmap)return void(0,s.warn)("paintImageMaskXObject: ImageBitmap support is not implemented, ensure that the `isOffscreenCanvasSupported` API parameter is disabled.");const i=this.current,n=t.width,r=t.height,a=i.fillColor;i.maskId="mask"+m++;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",p(n)),l.setAttributeNS(null,"height",p(r)),l.setAttributeNS(null,"fill",a),l.setAttributeNS(null,"mask",`url(#${i.maskId})`),this.defs.append(o),this._ensureTransformGroup().append(l),this.paintInlineImageXObject(t,o)}paintFormXObjectBegin(e,t){if(Array.isArray(e)&&6===e.length&&this.transform(e[0],e[1],e[2],e[3],e[4],e[5]),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",p(e)),n.setAttributeNS(null,"height",p(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");return n.setAttributeNS(null,"transform",g(e.transform)),t.append(n),this.svg=n,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(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",g(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.XfaText=void 0;class i{static textContent(e){const t=[],n={items:t,styles:Object.create(null)};return function e(n){if(!n)return;let s=null;const r=n.name;if("#text"===r)s=n.value;else{if(!i.shouldBuildText(r))return;n?.attributes?.textContent?s=n.attributes.textContent:n.value&&(s=n.value)}if(null!==s&&t.push({str:s}),n.children)for(const t of n.children)e(t)}(e),n}static shouldBuildText(e){return!("textarea"===e||"input"===e||"option"===e||"select"===e)}}t.XfaText=i},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextLayerRenderTask=void 0,t.renderTextLayer=function(e){e.textContentSource||!e.textContent&&!e.textContentStream||((0,s.deprecated)("The TextLayerRender `textContent`/`textContentStream` parameters will be removed in the future, please use `textContentSource` instead."),e.textContentSource=e.textContent||e.textContentStream);const{container:t,viewport:i}=e,n=getComputedStyle(t),r=n.getPropertyValue("visibility"),a=parseFloat(n.getPropertyValue("--scale-factor"));"visible"===r&&(!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 d(e);return o._render(),o},t.updateTextLayer=function({container:e,viewport:t,textDivs:i,textDivProperties:n,isOffscreenCanvasSupported:r,mustRotate:a=!0,mustRescale:o=!0}){if(a&&(0,s.setLayerDimensions)(e,{rotation:t.rotation}),o){const e=l(0,r),s={prevFontSize:null,prevFontFamily:null,div:null,scale:t.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:e};for(const e of i)s.properties=n.get(e),s.div=e,c(s)}};var n=i(1),s=i(6);const r=30,a=.8,o=new Map;function l(e,t){let i;if(t&&n.FeatureTest.isOffscreenCanvasSupported)i=new OffscreenCanvas(e,e).getContext("2d",{alpha:!1});else{const t=document.createElement("canvas");t.width=t.height=e,i=t.getContext("2d",{alpha:!1})}return i}function h(e,t,i){const s=document.createElement("span"),h={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};e._textDivs.push(s);const c=n.Util.transform(e._transform,t.transform);let d=Math.atan2(c[1],c[0]);const u=i[t.fontName];u.vertical&&(d+=Math.PI/2);const p=Math.hypot(c[2],c[3]),g=p*function(e,t){const i=o.get(e);if(i)return i;const n=l(r,t);n.font=`${r}px ${e}`;const s=n.measureText("");let h=s.fontBoundingBoxAscent,c=Math.abs(s.fontBoundingBoxDescent);if(h){const t=h/(h+c);return o.set(e,t),n.canvas.width=n.canvas.height=0,t}n.strokeStyle="red",n.clearRect(0,0,r,r),n.strokeText("g",0,0);let d=n.getImageData(0,0,r,r).data;c=0;for(let e=d.length-1-3;e>=0;e-=4)if(d[e]>0){c=Math.ceil(e/4/r);break}n.clearRect(0,0,r,r),n.strokeText("A",0,r),d=n.getImageData(0,0,r,r).data,h=0;for(let e=0,t=d.length;e<t;e+=4)if(d[e]>0){h=r-Math.floor(e/4/r);break}if(n.canvas.width=n.canvas.height=0,h){const t=h/(h+c);return o.set(e,t),t}return o.set(e,a),a}(u.fontFamily,e._isOffscreenCanvasSupported);let f,m;0===d?(f=c[4],m=c[5]-g):(f=c[4]+g*Math.sin(d),m=c[5]-g*Math.cos(d));const _="calc(var(--scale-factor)*",v=s.style;e._container===e._rootContainer?(v.left=`${(100*f/e._pageWidth).toFixed(2)}%`,v.top=`${(100*m/e._pageHeight).toFixed(2)}%`):(v.left=`${_}${f.toFixed(2)}px)`,v.top=`${_}${m.toFixed(2)}px)`),v.fontSize=`${_}${p.toFixed(2)}px)`,v.fontFamily=u.fontFamily,h.fontSize=p,s.setAttribute("role","presentation"),s.textContent=t.str,s.dir=t.dir,e._fontInspectorEnabled&&(s.dataset.fontName=t.fontName),0!==d&&(h.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&&(h.canvasWidth=u.vertical?t.height:t.width),e._textDivProperties.set(s,h),e._isReadableStream&&e._layoutText(s)}function c(e){const{div:t,scale:i,properties:n,ctx:s,prevFontSize:r,prevFontFamily:a}=e,{style:o}=t;let l="";if(0!==n.canvasWidth&&n.hasText){const{fontFamily:h}=o,{canvasWidth:c,fontSize:d}=n;r===d&&a===h||(s.font=`${d*i}px ${h}`,e.prevFontSize=d,e.prevFontFamily=h);const{width:u}=s.measureText(t.textContent);u>0&&(l=`scaleX(${c*i/u})`)}0!==n.angle&&(l=`rotate(${n.angle}deg) ${l}`),l.length>0&&(o.transform=l)}class d{constructor({textContentSource:e,container:t,viewport:i,textDivs:r,textDivProperties:a,textContentItemsStr:o,isOffscreenCanvasSupported:h}){this._textContentSource=e,this._isReadableStream=e instanceof ReadableStream,this._container=this._rootContainer=t,this._textDivs=r||[],this._textContentItemsStr=o||[],this._isOffscreenCanvasSupported=h,this._fontInspectorEnabled=!!globalThis.FontInspector?.enabled,this._reader=null,this._textDivProperties=a||new WeakMap,this._canceled=!1,this._capability=new n.PromiseCapability,this._layoutTextParams={prevFontSize:null,prevFontFamily:null,div:null,scale:i.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:l(0,h)};const{pageWidth:c,pageHeight:d,pageX:u,pageY:p}=i.rawDims;this._transform=[1,0,0,-1,-u,p+d],this._pageWidth=c,this._pageHeight=d,(0,s.setLayerDimensions)(t,i),this._capability.promise.finally((()=>{this._layoutTextParams=null})).catch((()=>{}))}get promise(){return this._capability.promise}cancel(){this._canceled=!0,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),h(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);if(this._layoutTextParams.div=e,c(this._layoutTextParams),t.hasText&&this._container.append(e),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 i=()=>{this._reader.read().then((({value:n,done:s})=>{s?e.resolve():(Object.assign(t,n.styles),this._processItems(n.items,t),i())}),e.reject)};this._reader=this._textContentSource.getReader(),i()}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(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=d},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationEditorLayer=void 0;var n=i(1),s=i(4),r=i(28),a=i(33),o=i(6),l=i(34);class h{#Pt;#At=!1;#wt=null;#Et=this.pointerup.bind(this);#xt=this.pointerdown.bind(this);#Ct=new Map;#Mt=!1;#Tt=!1;#Dt=!1;#Ft;static _initialized=!1;constructor({uiManager:e,pageIndex:t,div:i,accessibilityManager:n,annotationLayer:s,viewport:o,l10n:c}){const d=[r.FreeTextEditor,a.InkEditor,l.StampEditor];if(!h._initialized){h._initialized=!0;for(const e of d)e.initialize(c)}e.registerEditorTypes(d),this.#Ft=e,this.pageIndex=t,this.div=i,this.#Pt=n,this.#wt=s,this.viewport=o,this.#Ft.addLayer(this)}get isEmpty(){return 0===this.#Ct.size}updateToolbar(e){this.#Ft.updateToolbar(e)}updateMode(e=this.#Ft.getMode()){this.#Lt(),e===n.AnnotationEditorType.INK?(this.addInkEditorIfNeeded(!1),this.disableClick()):this.enableClick(),e!==n.AnnotationEditorType.NONE&&(this.div.classList.toggle("freeTextEditing",e===n.AnnotationEditorType.FREETEXT),this.div.classList.toggle("inkEditing",e===n.AnnotationEditorType.INK),this.div.classList.toggle("stampEditing",e===n.AnnotationEditorType.STAMP),this.div.hidden=!1)}addInkEditorIfNeeded(e){if(e||this.#Ft.getMode()===n.AnnotationEditorType.INK){if(!e)for(const e of this.#Ct.values())if(e.isEmpty())return void e.setInBackground();this.#kt({offsetX:0,offsetY:0},!1).setInBackground()}}setEditingState(e){this.#Ft.setEditingState(e)}addCommands(e){this.#Ft.addCommands(e)}enable(){this.div.style.pointerEvents="auto";const e=new Set;for(const t of this.#Ct.values())t.enableEditing(),t.annotationElementId&&e.add(t.annotationElementId);if(!this.#wt)return;const t=this.#wt.getEditableAnnotations();for(const i of t){if(i.hide(),this.#Ft.isDeletedAnnotationElement(i.data.id))continue;if(e.has(i.data.id))continue;const t=this.deserialize(i);t&&(this.addOrRebuild(t),t.enableEditing())}}disable(){this.#Dt=!0,this.div.style.pointerEvents="none";const e=new Set;for(const t of this.#Ct.values())t.disableEditing(),t.annotationElementId&&null===t.serialize()?(this.getEditableAnnotation(t.annotationElementId)?.show(),t.remove()):e.add(t.annotationElementId);if(this.#wt){const t=this.#wt.getEditableAnnotations();for(const i of t){const{id:t}=i.data;e.has(t)||this.#Ft.isDeletedAnnotationElement(t)||i.show()}}this.#Lt(),this.isEmpty&&(this.div.hidden=!0),this.#Dt=!1}getEditableAnnotation(e){return this.#wt?.getEditableAnnotation(e)||null}setActiveEditor(e){this.#Ft.getActive()!==e&&this.#Ft.setActiveEditor(e)}enableClick(){this.div.addEventListener("pointerdown",this.#xt),this.div.addEventListener("pointerup",this.#Et)}disableClick(){this.div.removeEventListener("pointerdown",this.#xt),this.div.removeEventListener("pointerup",this.#Et)}attach(e){this.#Ct.set(e.id,e);const{annotationElementId:t}=e;t&&this.#Ft.isDeletedAnnotationElement(t)&&this.#Ft.removeDeletedAnnotationElement(e)}detach(e){this.#Ct.delete(e.id),this.#Pt?.removePointerInTextLayer(e.contentDiv),!this.#Dt&&e.annotationElementId&&this.#Ft.addDeletedAnnotationElement(e)}remove(e){this.detach(e),this.#Ft.removeEditor(e),e.div.contains(document.activeElement)&&setTimeout((()=>{this.#Ft.focusMainContainer()}),0),e.div.remove(),e.isAttachedToDOM=!1,this.#Tt||this.addInkEditorIfNeeded(!1)}changeParent(e){e.parent!==this&&(e.annotationElementId&&(this.#Ft.addDeletedAnnotationElement(e.annotationElementId),s.AnnotationEditor.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),e.parent?.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(this.changeParent(e),this.#Ft.addEditor(e),this.attach(e),!e.isAttachedToDOM){const t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(),this.#Ft.addToAnnotationStorage(e)}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;const{activeElement:t}=document;e.div.contains(t)&&(e._focusEventsAllowed=!1,setTimeout((()=>{e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",(()=>{e._focusEventsAllowed=!0}),{once:!0}),t.focus())}),0)),e._structTreeParentId=this.#Pt?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?e.rebuild():this.add(e)}addUndoableEditor(e){this.addCommands({cmd:()=>e._uiManager.rebuild(e),undo:()=>{e.remove()},mustExec:!1})}getNextId(){return this.#Ft.getId()}#Rt(e){switch(this.#Ft.getMode()){case n.AnnotationEditorType.FREETEXT:return new r.FreeTextEditor(e);case n.AnnotationEditorType.INK:return new a.InkEditor(e);case n.AnnotationEditorType.STAMP:return new l.StampEditor(e)}return null}pasteEditor(e,t){this.#Ft.updateToolbar(e),this.#Ft.updateMode(e);const{offsetX:i,offsetY:n}=this.#It(),s=this.getNextId(),r=this.#Rt({parent:this,id:s,x:i,y:n,uiManager:this.#Ft,isCentered:!0,...t});r&&this.add(r)}deserialize(e){switch(e.annotationType??e.annotationEditorType){case n.AnnotationEditorType.FREETEXT:return r.FreeTextEditor.deserialize(e,this,this.#Ft);case n.AnnotationEditorType.INK:return a.InkEditor.deserialize(e,this,this.#Ft);case n.AnnotationEditorType.STAMP:return l.StampEditor.deserialize(e,this,this.#Ft)}return null}#kt(e,t){const i=this.getNextId(),n=this.#Rt({parent:this,id:i,x:e.offsetX,y:e.offsetY,uiManager:this.#Ft,isCentered:t});return n&&this.add(n),n}#It(){const{x:e,y:t,width:i,height:n}=this.div.getBoundingClientRect(),s=Math.max(0,e),r=Math.max(0,t),a=(s+Math.min(window.innerWidth,e+i))/2-e,o=(r+Math.min(window.innerHeight,t+n))/2-t,[l,h]=this.viewport.rotation%180==0?[a,o]:[o,a];return{offsetX:l,offsetY:h}}addNewEditor(){this.#kt(this.#It(),!0)}setSelected(e){this.#Ft.setSelected(e)}toggleSelected(e){this.#Ft.toggleSelected(e)}isSelected(e){return this.#Ft.isSelected(e)}unselect(e){this.#Ft.unselect(e)}pointerup(e){const{isMac:t}=n.FeatureTest.platform;0!==e.button||e.ctrlKey&&t||e.target===this.div&&this.#Mt&&(this.#Mt=!1,this.#At?this.#Ft.getMode()!==n.AnnotationEditorType.STAMP?this.#kt(e,!1):this.#Ft.unselectAll():this.#At=!0)}pointerdown(e){if(this.#Mt)return void(this.#Mt=!1);const{isMac:t}=n.FeatureTest.platform;if(0!==e.button||e.ctrlKey&&t)return;if(e.target!==this.div)return;this.#Mt=!0;const i=this.#Ft.getActive();this.#At=!i||i.isEmpty()}findNewParent(e,t,i){const n=this.#Ft.findParent(t,i);return null!==n&&n!==this&&(n.changeParent(e),!0)}destroy(){this.#Ft.getActive()?.parent===this&&(this.#Ft.commitOrRemove(),this.#Ft.setActiveEditor(null));for(const e of this.#Ct.values())this.#Pt?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#Ct.clear(),this.#Ft.removeLayer(this)}#Lt(){this.#Tt=!0;for(const e of this.#Ct.values())e.isEmpty()&&e.remove();this.#Tt=!1}render({viewport:e}){this.viewport=e,(0,o.setLayerDimensions)(this.div,e);for(const e of this.#Ft.getEditors(this.pageIndex))this.add(e);this.updateMode()}update({viewport:e}){this.#Ft.commitOrRemove(),this.viewport=e,(0,o.setLayerDimensions)(this.div,{rotation:e.rotation}),this.updateMode()}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}}t.AnnotationEditorLayer=h},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FreeTextEditor=void 0;var n=i(1),s=i(5),r=i(4),a=i(29);class o extends r.AnnotationEditor{#Ot=this.editorDivBlur.bind(this);#Nt=this.editorDivFocus.bind(this);#Bt=this.editorDivInput.bind(this);#Vt=this.editorDivKeydown.bind(this);#Ut;#jt="";#Ht=`${this.id}-editor`;#Wt;#zt=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){const e=o.prototype,t=e=>e.isEmpty(),i=s.AnnotationEditorUIManager.TRANSLATE_SMALL,r=s.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,n.shadow)(this,"_keyboardManager",new s.KeyboardManager([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],e.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],e._translateEmpty,{args:[-i,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-r,0],checker:t}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[i,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[r,0],checker:t}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-i],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-r],checker:t}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,i],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,r],checker:t}]]))}static _type="freetext";constructor(e){super({...e,name:"freeTextEditor"}),this.#Ut=e.color||o._defaultColor||r.AnnotationEditor._defaultLineColor,this.#Wt=e.fontSize||o._defaultFontSize}static initialize(e){r.AnnotationEditor.initialize(e,{strings:["free_text2_default_content","editor_free_text2_aria_label"]});const t=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(t.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,t){switch(e){case n.AnnotationEditorParamsType.FREETEXT_SIZE:o._defaultFontSize=t;break;case n.AnnotationEditorParamsType.FREETEXT_COLOR:o._defaultColor=t}}updateParams(e,t){switch(e){case n.AnnotationEditorParamsType.FREETEXT_SIZE:this.#Gt(t);break;case n.AnnotationEditorParamsType.FREETEXT_COLOR:this.#$t(t)}}static get defaultPropertiesToUpdate(){return[[n.AnnotationEditorParamsType.FREETEXT_SIZE,o._defaultFontSize],[n.AnnotationEditorParamsType.FREETEXT_COLOR,o._defaultColor||r.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[n.AnnotationEditorParamsType.FREETEXT_SIZE,this.#Wt],[n.AnnotationEditorParamsType.FREETEXT_COLOR,this.#Ut]]}#Gt(e){const t=e=>{this.editorDiv.style.fontSize=`calc(${e}px * var(--scale-factor))`,this.translate(0,-(e-this.#Wt)*this.parentScale),this.#Wt=e,this.#qt()},i=this.#Wt;this.addCommands({cmd:()=>{t(e)},undo:()=>{t(i)},mustExec:!0,type:n.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#$t(e){const t=this.#Ut;this.addCommands({cmd:()=>{this.#Ut=this.editorDiv.style.color=e},undo:()=>{this.#Ut=this.editorDiv.style.color=t},mustExec:!0,type:n.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(e,t){this._uiManager.translateSelectedEditors(e,t,!0)}getInitialTranslation(){const e=this.parentScale;return[-o._internalPadding*e,-(o._internalPadding+this.#Wt)*e]}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(n.AnnotationEditorType.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.editorDiv.addEventListener("keydown",this.#Vt),this.editorDiv.addEventListener("focus",this.#Nt),this.editorDiv.addEventListener("blur",this.#Ot),this.editorDiv.addEventListener("input",this.#Bt))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#Ht),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",this.#Vt),this.editorDiv.removeEventListener("focus",this.#Nt),this.editorDiv.removeEventListener("blur",this.#Ot),this.editorDiv.removeEventListener("input",this.#Bt),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freeTextEditing"))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){this.width?this.#Xt():(this.enableEditMode(),this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freeTextEditing")),super.remove()}#Kt(){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")}#qt(){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.rotation%180==this.parentRotation%180?(this.width=i.width/e,this.height=i.height/t):(this.width=i.height/e,this.height=i.width/t),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const e=this.#jt,t=this.#jt=this.#Kt().trimEnd();if(e===t)return;const i=e=>{this.#jt=e,e?(this.#Yt(),this._uiManager.rebuild(this),this.#qt()):this.remove()};this.addCommands({cmd:()=>{i(t)},undo:()=>{i(e)},mustExec:!1}),this.#qt()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(e){this.enterInEditMode()}keydown(e){e.target===this.div&&"Enter"===e.key&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){o._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;this.width&&(e=this.x,t=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#Ht),this.enableEditing(),r.AnnotationEditor._l10nPromise.get("editor_free_text2_aria_label").then((e=>this.editorDiv?.setAttribute("aria-label",e))),r.AnnotationEditor._l10nPromise.get("free_text2_default_content").then((e=>this.editorDiv?.setAttribute("default-content",e))),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize=`calc(${this.#Wt}px * var(--scale-factor))`,i.color=this.#Ut,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),(0,s.bindEvents)(this,this.div,["dblclick","keydown"]),this.width){const[i,n]=this.parentDimensions;if(this.annotationElementId){const{position:s}=this.#zt;let[r,a]=this.getInitialTranslation();[r,a]=this.pageTranslationToScreen(r,a);const[o,l]=this.pageDimensions,[h,c]=this.pageTranslation;let d,u;switch(this.rotation){case 0:d=e+(s[0]-h)/o,u=t+this.height-(s[1]-c)/l;break;case 90:d=e+(s[0]-h)/o,u=t-(s[1]-c)/l,[r,a]=[a,-r];break;case 180:d=e-this.width+(s[0]-h)/o,u=t-(s[1]-c)/l,[r,a]=[-r,-a];break;case 270:d=e+(s[0]-h-this.height*l)/o,u=t+(s[1]-c-this.width*o)/l,[r,a]=[-a,r]}this.setAt(d*i,u*n,r,a)}else this.setAt(e*i,t*n,this.width*i,this.height*n);this.#Yt(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}#Yt(){if(this.editorDiv.replaceChildren(),this.#jt)for(const e of this.#jt.split("\n")){const t=document.createElement("div");t.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(t)}}get contentDiv(){return this.editorDiv}static deserialize(e,t,i){let s=null;if(e instanceof a.FreeTextAnnotationElement){const{data:{defaultAppearanceData:{fontSize:t,fontColor:i},rect:r,rotation:a,id:o},textContent:l,textPosition:h,parent:{page:{pageNumber:c}}}=e;if(!l||0===l.length)return null;s=e={annotationType:n.AnnotationEditorType.FREETEXT,color:Array.from(i),fontSize:t,value:l.join("\n"),position:h,pageIndex:c-1,rect:r,rotation:a,id:o,deleted:!1}}const r=super.deserialize(e,t,i);return r.#Wt=e.fontSize,r.#Ut=n.Util.makeHexColor(...e.color),r.#jt=e.value,r.annotationElementId=e.id||null,r.#zt=s,r}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0};const t=o._internalPadding*this.parentScale,i=this.getRect(t,t),s=r.AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#Ut),a={annotationType:n.AnnotationEditorType.FREETEXT,color:s,fontSize:this.#Wt,value:this.#jt,pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?a:this.annotationElementId&&!this.#Qt(a)?null:(a.id=this.annotationElementId,a)}#Qt(e){const{value:t,fontSize:i,color:n,rect:s,pageIndex:r}=this.#zt;return e.value!==t||e.fontSize!==i||e.rect.some(((e,t)=>Math.abs(e-s[t])>=1))||e.color.some(((e,t)=>e!==n[t]))||e.pageIndex!==r}#Xt(e=!1){if(!this.annotationElementId)return;if(this.#qt(),!e&&(0===this.width||0===this.height))return void setTimeout((()=>this.#Xt(!0)),0);const t=o._internalPadding*this.parentScale;this.#zt.rect=this.getRect(t,t)}}t.FreeTextEditor=o},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StampAnnotationElement=t.InkAnnotationElement=t.FreeTextAnnotationElement=t.AnnotationLayer=void 0;var n=i(1),s=i(6),r=i(3),a=i(30),o=i(31),l=i(32);const h=1e3,c=new WeakSet;function d(e){return{width:e[2]-e[0],height:e[3]-e[1]}}class u{static create(e){switch(e.data.annotationType){case n.AnnotationType.LINK:return new g(e);case n.AnnotationType.TEXT:return new f(e);case n.AnnotationType.WIDGET:switch(e.data.fieldType){case"Tx":return new _(e);case"Btn":return e.data.radioButton?new y(e):e.data.checkBox?new b(e):new S(e);case"Ch":return new P(e);case"Sig":return new v(e)}return new m(e);case n.AnnotationType.POPUP:return new A(e);case n.AnnotationType.FREETEXT:return new E(e);case n.AnnotationType.LINE:return new x(e);case n.AnnotationType.SQUARE:return new C(e);case n.AnnotationType.CIRCLE:return new M(e);case n.AnnotationType.POLYLINE:return new T(e);case n.AnnotationType.CARET:return new F(e);case n.AnnotationType.INK:return new L(e);case n.AnnotationType.POLYGON:return new D(e);case n.AnnotationType.HIGHLIGHT:return new k(e);case n.AnnotationType.UNDERLINE:return new R(e);case n.AnnotationType.SQUIGGLY:return new I(e);case n.AnnotationType.STRIKEOUT:return new O(e);case n.AnnotationType.STAMP:return new N(e);case n.AnnotationType.FILEATTACHMENT:return new B(e);default:return new p(e)}}}class p{#Jt=!1;constructor(e,{isRenderable:t=!1,ignoreBorder:i=!1,createQuadrilaterals:n=!1}={}){this.isRenderable=t,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,t&&(this.container=this._createContainer(i)),n&&this._createQuadrilaterals()}static _hasPopupData({titleObj:e,contentsObj:t,richText:i}){return!!(e?.str||t?.str||i?.str)}get hasPopupData(){return p._hasPopupData(this.data)}_createContainer(e){const{data:t,parent:{page:i,viewport:s}}=this,r=document.createElement("section");r.setAttribute("data-annotation-id",t.id),this instanceof m||(r.tabIndex=h),r.style.zIndex=this.parent.zIndex++,this.data.popupRef&&r.setAttribute("aria-haspopup","dialog"),t.noRotate&&r.classList.add("norotate");const{pageWidth:a,pageHeight:o,pageX:l,pageY:c}=s.rawDims;if(!t.rect||this instanceof A){const{rotation:e}=t;return t.hasOwnCanvas||0===e||this.setRotation(e,r),r}const{width:u,height:p}=d(t.rect),g=n.Util.normalizeRect([t.rect[0],i.view[3]-t.rect[1]+i.view[1],t.rect[2],i.view[3]-t.rect[3]+i.view[1]]);if(!e&&t.borderStyle.width>0){r.style.borderWidth=`${t.borderStyle.width}px`;const e=t.borderStyle.horizontalCornerRadius,i=t.borderStyle.verticalCornerRadius;if(e>0||i>0){const t=`calc(${e}px * var(--scale-factor)) / calc(${i}px * var(--scale-factor))`;r.style.borderRadius=t}else if(this instanceof y){const e=`calc(${u}px * var(--scale-factor)) / calc(${p}px * var(--scale-factor))`;r.style.borderRadius=e}switch(t.borderStyle.style){case n.AnnotationBorderStyleType.SOLID:r.style.borderStyle="solid";break;case n.AnnotationBorderStyleType.DASHED:r.style.borderStyle="dashed";break;case n.AnnotationBorderStyleType.BEVELED:(0,n.warn)("Unimplemented border style: beveled");break;case n.AnnotationBorderStyleType.INSET:(0,n.warn)("Unimplemented border style: inset");break;case n.AnnotationBorderStyleType.UNDERLINE:r.style.borderBottomStyle="solid"}const s=t.borderColor||null;s?(this.#Jt=!0,r.style.borderColor=n.Util.makeHexColor(0|s[0],0|s[1],0|s[2])):r.style.borderWidth=0}r.style.left=100*(g[0]-l)/a+"%",r.style.top=100*(g[1]-c)/o+"%";const{rotation:f}=t;return t.hasOwnCanvas||0===f?(r.style.width=100*u/a+"%",r.style.height=100*p/o+"%"):this.setRotation(f,r),r}setRotation(e,t=this.container){if(!this.data.rect)return;const{pageWidth:i,pageHeight:n}=this.parent.viewport.rawDims,{width:s,height:r}=d(this.data.rect);let a,o;e%180==0?(a=100*s/i,o=100*r/n):(a=100*r/i,o=100*s/n),t.style.width=`${a}%`,t.style.height=`${o}%`,t.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(e,t,i)=>{const n=i.detail[e],s=n[0],r=n.slice(1);i.target.style[t]=a.ColorConverters[`${s}_HTML`](r),this.annotationStorage.setValue(this.data.id,{[t]:a.ColorConverters[`${s}_rgb`](r)})};return(0,n.shadow)(this,"_commonActions",{display:e=>{const{display:t}=e.detail,i=t%2==1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:1===t||2===t})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{const{hidden:t}=e.detail;this.container.style.visibility=t?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:t,noView:t})},focus:e=>{setTimeout((()=>e.target.focus({preventScroll:!1})),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:t=>{e("bgColor","backgroundColor",t)},fillColor:t=>{e("fillColor","backgroundColor",t)},fgColor:t=>{e("fgColor","color",t)},textColor:t=>{e("textColor","color",t)},borderColor:t=>{e("borderColor","borderColor",t)},strokeColor:t=>{e("strokeColor","borderColor",t)},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 s=e[n]||i[n];s?.(t)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;const i=this._commonActions;for(const[n,s]of Object.entries(t)){const r=i[n];r&&(r({detail:{[n]:s},target:e}),delete t[n])}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[t,i,n,s]=this.data.rect;if(1===e.length){const[,{x:r,y:a},{x:o,y:l}]=e[0];if(n===r&&s===a&&t===o&&i===l)return}const{style:r}=this.container;let a;if(this.#Jt){const{borderColor:e,borderWidth:t}=r;r.borderWidth=0,a=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${e}" stroke-width="${t}">`],this.container.classList.add("hasBorder")}const o=n-t,l=s-i,{svgFactory:h}=this,c=h.createElement("svg");c.classList.add("quadrilateralsContainer"),c.setAttribute("width",0),c.setAttribute("height",0);const d=h.createElement("defs");c.append(d);const u=h.createElement("clipPath"),p=`clippath_${this.data.id}`;u.setAttribute("id",p),u.setAttribute("clipPathUnits","objectBoundingBox"),d.append(u);for(const[,{x:i,y:n},{x:r,y:c}]of e){const e=h.createElement("rect"),d=(r-t)/o,p=(s-n)/l,g=(i-r)/o,f=(n-c)/l;e.setAttribute("x",d),e.setAttribute("y",p),e.setAttribute("width",g),e.setAttribute("height",f),u.append(e),a?.push(`<rect vector-effect="non-scaling-stroke" x="${d}" y="${p}" width="${g}" height="${f}"/>`)}this.#Jt&&(a.push("</g></svg>')"),r.backgroundImage=a.join("")),this.container.append(c),this.container.style.clipPath=`url(#${p})`}_createPopup(){const{container:e,data:t}=this;e.setAttribute("aria-haspopup","dialog");const i=new A({data:{color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,richText:t.richText,parentRect:t.rect,borderStyle:0,id:`popup_${t.id}`,rotation:t.rotation},parent:this.parent,elements:[this]});this.parent.div.append(i.render())}render(){(0,n.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){const i=[];if(this._fieldObjects){const s=this._fieldObjects[e];if(s)for(const{page:e,id:r,exportValues:a}of s){if(-1===e)continue;if(r===t)continue;const s="string"==typeof a?a:null,o=document.querySelector(`[data-element-id="${r}"]`);!o||c.has(o)?i.push({id:r,exportValue:s,domElement:o}):(0,n.warn)(`_getElementsByName - element not allowed: ${r}`)}return i}for(const n of document.getElementsByName(e)){const{exportValue:e}=n,s=n.getAttribute("data-element-id");s!==t&&c.has(n)&&i.push({id:s,exportValue:e,domElement:n})}return i}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(const t of e)t.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){const{annotationEditorType:e,data:{id:t}}=this;this.container.addEventListener("dblclick",(()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:e,editId:t})}))}}class g extends p{constructor(e,t=null){super(e,{isRenderable:!0,ignoreBorder:!!t?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:t}=this,i=document.createElement("a");i.setAttribute("data-element-id",e.id);let n=!1;return e.url?(t.addLinkAttributes(i,e.url,e.newWindow),n=!0):e.action?(this._bindNamedAction(i,e.action),n=!0):e.attachment?(this._bindAttachment(i,e.attachment),n=!0):e.setOCGState?(this.#Zt(i,e.setOCGState),n=!0):e.dest?(this._bindLink(i,e.dest),n=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,e),n=!0),e.resetForm?(this._bindResetFormAction(i,e.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(i,""),n=!0)),this.container.classList.add("linkAnnotation"),n&&this.container.append(i),this.container}#ei(){this.container.setAttribute("data-internal-link","")}_bindLink(e,t){e.href=this.linkService.getDestinationHash(t),e.onclick=()=>(t&&this.linkService.goToDestination(t),!1),(t||""===t)&&this.#ei()}_bindNamedAction(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(t),!1),this.#ei()}_bindAttachment(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.downloadManager?.openOrDownloadData(this.container,t.content,t.filename),!1),this.#ei()}#Zt(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(t),!1),this.#ei()}_bindJSAction(e,t){e.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(t.actions)){const s=i.get(n);s&&(e[s]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t.id,name:n}}),!1))}e.onclick||(e.onclick=()=>!1),this.#ei()}_bindResetFormAction(e,t){const i=e.onclick;if(i||(e.href=this.linkService.getAnchorUrl("")),this.#ei(),!this._fieldObjects)return(0,n.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),void(i||(e.onclick=()=>!1));e.onclick=()=>{i?.();const{fields:e,refs:s,include:r}=t,a=[];if(0!==e.length||0!==s.length){const t=new Set(s);for(const i of e){const e=this._fieldObjects[i]||[];for(const{id:i}of e)t.add(i)}for(const e of Object.values(this._fieldObjects))for(const i of e)t.has(i.id)===r&&a.push(i)}else for(const e of Object.values(this._fieldObjects))a.push(...e);const o=this.annotationStorage,l=[];for(const e of a){const{id:t}=e;switch(l.push(t),e.type){case"text":{const i=e.defaultValue||"";o.setValue(t,{value:i});break}case"checkbox":case"radiobutton":{const i=e.defaultValue===e.exportValues;o.setValue(t,{value:i});break}case"combobox":case"listbox":{const i=e.defaultValue||"";o.setValue(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}`))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:l,name:"ResetForm"}}),!1}}}class f extends p{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const e=document.createElement("img");return 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.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(e),this.container}}class m extends p{render(){return this.data.alternativeText&&(this.container.title=this.data.alternativeText),this.container}showElementAndHideCanvas(e){this.data.hasOwnCanvas&&("CANVAS"===e.previousSibling?.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,s){i.includes("mouse")?e.addEventListener(i,(e=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:s(e),shift:e.shiftKey,modifier:this._getKeyModifier(e)}})})):e.addEventListener(i,(e=>{if("blur"===i){if(!t.focused||!e.relatedTarget)return;t.focused=!1}else if("focus"===i){if(t.focused)return;t.focused=!0}s&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:s(e)}})}))}_setEventListeners(e,t,i,n){for(const[s,r]of i)("Action"===r||this.data.actions?.[r])&&("Focus"!==r&&"Blur"!==r||(t||={focused:!1}),this._setEventListener(e,t,s,r,n),"Focus"!==r||this.data.actions?.Blur?"Blur"!==r||this.data.actions?.Focus||this._setEventListener(e,t,"focus","Focus",null):this._setEventListener(e,t,"blur","Blur",null))}_setBackgroundColor(e){const t=this.data.backgroundColor||null;e.style.backgroundColor=null===t?"transparent":n.Util.makeHexColor(t[0],t[1],t[2])}_setTextStyle(e){const t=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,s=this.data.defaultAppearanceData.fontSize||9,r=e.style;let a;const o=e=>Math.round(10*e)/10;if(this.data.multiLine){const e=Math.abs(this.data.rect[3]-this.data.rect[1]-2),t=e/(Math.round(e/(n.LINE_FACTOR*s))||1);a=Math.min(s,o(t/n.LINE_FACTOR))}else{const e=Math.abs(this.data.rect[3]-this.data.rect[1]-2);a=Math.min(s,o(e/n.LINE_FACTOR))}r.fontSize=`calc(${a}px * var(--scale-factor))`,r.color=n.Util.makeHexColor(i[0],i[1],i[2]),null!==this.data.textAlignment&&(r.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",t)}}class _ extends m{constructor(e){super(e,{isRenderable:e.renderForms||!e.data.hasAppearance&&!!e.data.fieldValue})}setPropertyOnSiblings(e,t,i,n){const s=this.annotationStorage;for(const r of this._getElementsByName(e.name,e.id))r.domElement&&(r.domElement[t]=i),s.setValue(r.id,{[n]:i})}render(){const e=this.annotationStorage,t=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){const n=e.getValue(t,{value:this.data.fieldValue});let s=n.value||"";const r=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;r&&s.length>r&&(s=s.slice(0,r));let a=n.formattedValue||this.data.textContent?.join("\n")||null;a&&this.data.comb&&(a=a.replaceAll(/\s+/g,""));const o={userValue:s,formattedValue:a,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(i=document.createElement("textarea"),i.textContent=a??s,this.data.doNotScroll&&(i.style.overflowY="hidden")):(i=document.createElement("input"),i.type="text",i.setAttribute("value",a??s),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=h,this._setRequired(i,this.data.required),r&&(i.maxLength=r),i.addEventListener("input",(n=>{e.setValue(t,{value:n.target.value}),this.setPropertyOnSiblings(i,"value",n.target.value,"value"),o.formattedValue=null})),i.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue??"";i.value=o.userValue=t,o.formattedValue=null}));let l=e=>{const{formattedValue:t}=o;null!=t&&(e.target.value=t),e.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",(e=>{if(o.focused)return;const{target:t}=e;o.userValue&&(t.value=o.userValue),o.lastCommittedValue=t.value,o.commitKey=1,o.focused=!0})),i.addEventListener("updatefromsandbox",(i=>{this.showElementAndHideCanvas(i.target);const n={value(i){o.userValue=i.detail.value??"",e.setValue(t,{value:o.userValue.toString()}),i.target.value=o.userValue},formattedValue(i){const{formattedValue:n}=i.detail;o.formattedValue=n,null!=n&&i.target!==document.activeElement&&(i.target.value=n),e.setValue(t,{formattedValue:n})},selRange(e){e.target.setSelectionRange(...e.detail.selRange)},charLimit:i=>{const{charLimit:n}=i.detail,{target:s}=i;if(0===n)return void s.removeAttribute("maxLength");s.setAttribute("maxLength",n);let r=o.userValue;!r||r.length<=n||(r=r.slice(0,n),s.value=o.userValue=r,e.setValue(t,{value:r}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:r,willCommit:!0,commitKey:1,selStart:s.selectionStart,selEnd:s.selectionEnd}}))}};this._dispatchEventFromSandbox(n,i)})),i.addEventListener("keydown",(e=>{o.commitKey=1;let i=-1;if("Escape"===e.key?i=0:"Enter"!==e.key||this.data.multiLine?"Tab"===e.key&&(o.commitKey=3):i=2,-1===i)return;const{value:n}=e.target;o.lastCommittedValue!==n&&(o.lastCommittedValue=n,o.userValue=n,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:n,willCommit:!0,commitKey:i,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}))}));const n=l;l=null,i.addEventListener("blur",(e=>{if(!o.focused||!e.relatedTarget)return;o.focused=!1;const{value:i}=e.target;o.userValue=i,o.lastCommittedValue!==i&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:i,willCommit:!0,commitKey:o.commitKey,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}),n(e)})),this.data.actions?.Keystroke&&i.addEventListener("beforeinput",(e=>{o.lastCommittedValue=null;const{data:i,target:n}=e,{value:s,selectionStart:r,selectionEnd:a}=n;let l=r,h=a;switch(e.inputType){case"deleteWordBackward":{const e=s.substring(0,r).match(/\w*[^\w]*$/);e&&(l-=e[0].length);break}case"deleteWordForward":{const e=s.substring(r).match(/^[^\w]*\w*/);e&&(h+=e[0].length);break}case"deleteContentBackward":r===a&&(l-=1);break;case"deleteContentForward":r===a&&(h+=1)}e.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:s,change:i||"",willCommit:!1,selStart:l,selEnd:h}})})),this._setEventListeners(i,o,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.value))}if(l&&i.addEventListener("blur",l),this.data.comb){const e=(this.data.rect[2]-this.data.rect[0])/r;i.classList.add("comb"),i.style.letterSpacing=`calc(${e}px * var(--scale-factor) - 1ch)`}}else i=document.createElement("div"),i.textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell";return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class v extends m{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class b extends m{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,t=this.data,i=t.id;let n=e.getValue(i,{value:t.exportValue===t.fieldValue}).value;"string"==typeof n&&(n="Off"!==n,e.setValue(i,{value:n})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const s=document.createElement("input");return c.add(s),s.setAttribute("data-element-id",i),s.disabled=t.readOnly,this._setRequired(s,this.data.required),s.type="checkbox",s.name=t.fieldName,n&&s.setAttribute("checked",!0),s.setAttribute("exportValue",t.exportValue),s.tabIndex=h,s.addEventListener("change",(n=>{const{name:s,checked:r}=n.target;for(const n of this._getElementsByName(s,i)){const i=r&&n.exportValue===t.exportValue;n.domElement&&(n.domElement.checked=i),e.setValue(n.id,{value:i})}e.setValue(i,{value:r})})),s.addEventListener("resetform",(e=>{const i=t.defaultFieldValue||"Off";e.target.checked=i===t.exportValue})),this.enableScripting&&this.hasJSActions&&(s.addEventListener("updatefromsandbox",(t=>{const n={value(t){t.target.checked="Off"!==t.detail.value,e.setValue(i,{value:t.target.checked})}};this._dispatchEventFromSandbox(n,t)})),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.checked))),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class y extends m{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=e.getValue(i,{value:t.fieldValue===t.buttonValue}).value;"string"==typeof n&&(n=n!==t.buttonValue,e.setValue(i,{value:n}));const s=document.createElement("input");if(c.add(s),s.setAttribute("data-element-id",i),s.disabled=t.readOnly,this._setRequired(s,this.data.required),s.type="radio",s.name=t.fieldName,n&&s.setAttribute("checked",!0),s.tabIndex=h,s.addEventListener("change",(t=>{const{name:n,checked:s}=t.target;for(const t of this._getElementsByName(n,i))e.setValue(t.id,{value:!1});e.setValue(i,{value:s})})),s.addEventListener("resetform",(e=>{const i=t.defaultFieldValue;e.target.checked=null!=i&&i===t.buttonValue})),this.enableScripting&&this.hasJSActions){const n=t.buttonValue;s.addEventListener("updatefromsandbox",(t=>{const s={value:t=>{const s=n===t.detail.value;for(const n of this._getElementsByName(t.target.name)){const t=s&&n.id===i;n.domElement&&(n.domElement.checked=t),e.setValue(n.id,{value:t})}}};this._dispatchEventFromSandbox(s,t)})),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.checked))}return this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class S extends g{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;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener("updatefromsandbox",(e=>{this._dispatchEventFromSandbox({},e)}))),e}}class P extends m{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,t=this.data.id,i=e.getValue(t,{value:this.data.fieldValue}),n=document.createElement("select");c.add(n),n.setAttribute("data-element-id",t),n.disabled=this.data.readOnly,this._setRequired(n,this.data.required),n.name=this.data.fieldName,n.tabIndex=h;let s=this.data.combo&&this.data.options.length>0;this.data.combo||(n.size=this.data.options.length,this.data.multiSelect&&(n.multiple=!0)),n.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue;for(const e of n.options)e.selected=e.value===t}));for(const e of this.data.options){const t=document.createElement("option");t.textContent=e.displayValue,t.value=e.exportValue,i.value.includes(e.exportValue)&&(t.setAttribute("selected",!0),s=!1),n.append(t)}let r=null;if(s){const e=document.createElement("option");e.value=" ",e.setAttribute("hidden",!0),e.setAttribute("selected",!0),n.prepend(e),r=()=>{e.remove(),n.removeEventListener("input",r),r=null},n.addEventListener("input",r)}const a=e=>{const t=e?"value":"textContent",{options:i,multiple:s}=n;return s?Array.prototype.filter.call(i,(e=>e.selected)).map((e=>e[t])):-1===i.selectedIndex?null:i[i.selectedIndex][t]};let o=a(!1);const l=e=>{const t=e.target.options;return Array.prototype.map.call(t,(e=>({displayValue:e.textContent,exportValue:e.value})))};return this.enableScripting&&this.hasJSActions?(n.addEventListener("updatefromsandbox",(i=>{const s={value(i){r?.();const s=i.detail.value,l=new Set(Array.isArray(s)?s:[s]);for(const e of n.options)e.selected=l.has(e.value);e.setValue(t,{value:a(!0)}),o=a(!1)},multipleSelection(e){n.multiple=!0},remove(i){const s=n.options,r=i.detail.remove;s[r].selected=!1,n.remove(r),s.length>0&&-1===Array.prototype.findIndex.call(s,(e=>e.selected))&&(s[0].selected=!0),e.setValue(t,{value:a(!0),items:l(i)}),o=a(!1)},clear(i){for(;0!==n.length;)n.remove(0);e.setValue(t,{value:null,items:[]}),o=a(!1)},insert(i){const{index:s,displayValue:r,exportValue:h}=i.detail.insert,c=n.children[s],d=document.createElement("option");d.textContent=r,d.value=h,c?c.before(d):n.append(d),e.setValue(t,{value:a(!0),items:l(i)}),o=a(!1)},items(i){const{items:s}=i.detail;for(;0!==n.length;)n.remove(0);for(const e of s){const{displayValue:t,exportValue:i}=e,s=document.createElement("option");s.textContent=t,s.value=i,n.append(s)}n.options.length>0&&(n.options[0].selected=!0),e.setValue(t,{value:a(!0),items:l(i)}),o=a(!1)},indices(i){const n=new Set(i.detail.indices);for(const e of i.target.options)e.selected=n.has(e.index);e.setValue(t,{value:a(!0)}),o=a(!1)},editable(e){e.target.disabled=!e.detail.editable}};this._dispatchEventFromSandbox(s,i)})),n.addEventListener("input",(i=>{const n=a(!0);e.setValue(t,{value:n}),i.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:o,changeEx:n,willCommit:!1,commitKey:1,keyDown:!1}})})),this._setEventListeners(n,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],(e=>e.target.value))):n.addEventListener("input",(function(i){e.setValue(t,{value:a(!0)})})),this.data.combo&&this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class A extends p{constructor(e){const{data:t,elements:i}=e;super(e,{isRenderable:p._hasPopupData(t)}),this.elements=i}render(){this.container.classList.add("popupAnnotation");const e=new w({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),t=[];for(const i of this.elements)i.popup=e,t.push(i.data.id),i.addHighlightArea();return this.container.setAttribute("aria-controls",t.map((e=>`${n.AnnotationPrefix}${e}`)).join(",")),this.container}}class w{#ti=null;#ii=this.#ni.bind(this);#si=this.#ri.bind(this);#ai=this.#oi.bind(this);#li=this.#hi.bind(this);#Ut=null;#Le=null;#ci=null;#di=null;#ui=null;#pi=null;#gi=!1;#fi=null;#mi=null;#_i=null;#vi=null;#bi=!1;constructor({container:e,color:t,elements:i,titleObj:n,modificationDate:r,contentsObj:a,richText:o,parent:l,rect:h,parentRect:c,open:d}){this.#Le=e,this.#vi=n,this.#ci=a,this.#_i=o,this.#ui=l,this.#Ut=t,this.#mi=h,this.#pi=c,this.#di=i;const u=s.PDFDateString.toDateObject(r);u&&(this.#ti=l.l10n.get("annotation_date_string",{date:u.toLocaleDateString(),time:u.toLocaleTimeString()})),this.trigger=i.flatMap((e=>e.getElementsToTriggerPopup()));for(const e of this.trigger)e.addEventListener("click",this.#li),e.addEventListener("mouseenter",this.#ai),e.addEventListener("mouseleave",this.#si),e.classList.add("popupTriggerArea");for(const e of i)e.container?.addEventListener("keydown",this.#ii);this.#Le.hidden=!0,d&&this.#hi()}render(){if(this.#fi)return;const{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:i,pageX:s,pageY:r}}}=this.#ui,a=this.#fi=document.createElement("div");if(a.className="popup",this.#Ut){const e=a.style.outlineColor=n.Util.makeHexColor(...this.#Ut);if(CSS.supports("background-color","color-mix(in srgb, red 30%, white)"))a.style.backgroundColor=`color-mix(in srgb, ${e} 30%, white)`;else{const e=.7;a.style.backgroundColor=n.Util.makeHexColor(...this.#Ut.map((t=>Math.floor(e*(255-t)+t))))}}const o=document.createElement("span");o.className="header";const h=document.createElement("h1");if(o.append(h),({dir:h.dir,str:h.textContent}=this.#vi),a.append(o),this.#ti){const e=document.createElement("span");e.classList.add("popupDate"),this.#ti.then((t=>{e.textContent=t})),o.append(e)}const c=this.#ci,d=this.#_i;if(!d?.str||c?.str&&c.str!==d.str){const e=this._formatContents(c);a.append(e)}else l.XfaLayer.render({xfaHtml:d.html,intent:"richText",div:a}),a.lastChild.classList.add("richText","popupContent");let u=!!this.#pi,p=u?this.#pi:this.#mi;for(const e of this.#di)if(!p||null!==n.Util.intersect(e.data.rect,p)){p=e.data.rect,u=!0;break}const g=n.Util.normalizeRect([p[0],e[3]-p[1]+e[1],p[2],e[3]-p[3]+e[1]]),f=u?p[2]-p[0]+5:0,m=g[0]+f,_=g[1],{style:v}=this.#Le;v.left=100*(m-s)/t+"%",v.top=100*(_-r)/i+"%",this.#Le.append(a)}_formatContents({str:e,dir:t}){const i=document.createElement("p");i.classList.add("popupContent"),i.dir=t;const n=e.split(/(?:\r\n?|\n)/);for(let e=0,t=n.length;e<t;++e){const s=n[e];i.append(document.createTextNode(s)),e<t-1&&i.append(document.createElement("br"))}return i}#ni(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||("Enter"===e.key||"Escape"===e.key&&this.#gi)&&this.#hi()}#hi(){this.#gi=!this.#gi,this.#gi?(this.#oi(),this.#Le.addEventListener("click",this.#li),this.#Le.addEventListener("keydown",this.#ii)):(this.#ri(),this.#Le.removeEventListener("click",this.#li),this.#Le.removeEventListener("keydown",this.#ii))}#oi(){this.#fi||this.render(),this.isVisible?this.#gi&&this.#Le.classList.add("focused"):(this.#Le.hidden=!1,this.#Le.style.zIndex=parseInt(this.#Le.style.zIndex)+1e3)}#ri(){this.#Le.classList.remove("focused"),!this.#gi&&this.isVisible&&(this.#Le.hidden=!0,this.#Le.style.zIndex=parseInt(this.#Le.style.zIndex)-1e3)}forceHide(){this.#bi=this.isVisible,this.#bi&&(this.#Le.hidden=!0)}maybeShow(){this.#bi&&(this.#bi=!1,this.#Le.hidden=!1)}get isVisible(){return!1===this.#Le.hidden}}class E extends p{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=n.AnnotationEditorType.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),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)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}t.FreeTextAnnotationElement=E;class x extends p{#yi=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");const e=this.data,{width:t,height:i}=d(e.rect),n=this.svgFactory.create(t,i,!0),s=this.#yi=this.svgFactory.createElement("svg:line");return s.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),s.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),s.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),s.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),s.setAttribute("stroke-width",e.borderStyle.width||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),n.append(s),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#yi}addHighlightArea(){this.container.classList.add("highlightArea")}}class C extends p{#Si=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");const e=this.data,{width:t,height:i}=d(e.rect),n=this.svgFactory.create(t,i,!0),s=e.borderStyle.width,r=this.#Si=this.svgFactory.createElement("svg:rect");return r.setAttribute("x",s/2),r.setAttribute("y",s/2),r.setAttribute("width",t-s),r.setAttribute("height",i-s),r.setAttribute("stroke-width",s||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#Si}addHighlightArea(){this.container.classList.add("highlightArea")}}class M extends p{#Pi=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");const e=this.data,{width:t,height:i}=d(e.rect),n=this.svgFactory.create(t,i,!0),s=e.borderStyle.width,r=this.#Pi=this.svgFactory.createElement("svg:ellipse");return r.setAttribute("cx",t/2),r.setAttribute("cy",i/2),r.setAttribute("rx",t/2-s/2),r.setAttribute("ry",i/2-s/2),r.setAttribute("stroke-width",s||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#Pi}addHighlightArea(){this.container.classList.add("highlightArea")}}class T extends p{#Ai=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const e=this.data,{width:t,height:i}=d(e.rect),n=this.svgFactory.create(t,i,!0);let s=[];for(const t of e.vertices){const i=t.x-e.rect[0],n=e.rect[3]-t.y;s.push(i+","+n)}s=s.join(" ");const r=this.#Ai=this.svgFactory.createElement(this.svgElementName);return r.setAttribute("points",s),r.setAttribute("stroke-width",e.borderStyle.width||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#Ai}addHighlightArea(){this.container.classList.add("highlightArea")}}class D extends T{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class F extends p{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class L extends p{#wi=[];constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=n.AnnotationEditorType.INK}render(){this.container.classList.add(this.containerClassName);const e=this.data,{width:t,height:i}=d(e.rect),n=this.svgFactory.create(t,i,!0);for(const t of e.inkLists){let i=[];for(const n of t){const t=n.x-e.rect[0],s=e.rect[3]-n.y;i.push(`${t},${s}`)}i=i.join(" ");const s=this.svgFactory.createElement(this.svgElementName);this.#wi.push(s),s.setAttribute("points",i),s.setAttribute("stroke-width",e.borderStyle.width||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),!e.popupRef&&this.hasPopupData&&this._createPopup(),n.append(s)}return this.container.append(n),this.container}getElementsToTriggerPopup(){return this.#wi}addHighlightArea(){this.container.classList.add("highlightArea")}}t.InkAnnotationElement=L;class k extends p{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this.container}}class R extends p{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class I extends p{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class O extends p{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class N extends p{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("stampAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}t.StampAnnotationElement=N;class B extends p{#Ei=null;constructor(e){super(e,{isRenderable:!0});const{filename:t,content:i}=this.data.file;this.filename=(0,s.getFilenameFromUrl)(t,!0),this.content=i,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,filename:t,content:i})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:e,data:t}=this;let i;t.hasAppearance||0===t.fillAlpha?i=document.createElement("div"):(i=document.createElement("img"),i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(t.name)?"paperclip":"pushpin"}.svg`,t.fillAlpha&&t.fillAlpha<1&&(i.style=`filter: opacity(${Math.round(100*t.fillAlpha)}%);`)),i.addEventListener("dblclick",this.#xi.bind(this)),this.#Ei=i;const{isMac:s}=n.FeatureTest.platform;return e.addEventListener("keydown",(e=>{"Enter"===e.key&&(s?e.metaKey:e.ctrlKey)&&this.#xi()})),!t.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),e.append(i),e}getElementsToTriggerPopup(){return this.#Ei}addHighlightArea(){this.container.classList.add("highlightArea")}#xi(){this.downloadManager?.openOrDownloadData(this.container,this.content,this.filename)}}t.AnnotationLayer=class{#Pt=null;#Ci=null;#Mi=new Map;constructor({div:e,accessibilityManager:t,annotationCanvasMap:i,l10n:n,page:s,viewport:r}){this.div=e,this.#Pt=t,this.#Ci=i,this.l10n=n,this.page=s,this.viewport=r,this.zIndex=0,this.l10n||=o.NullL10n}#Ti(e,t){const i=e.firstChild||e;i.id=`${n.AnnotationPrefix}${t}`,this.div.append(e),this.#Pt?.moveElementInDOM(this.div,e,i,!1)}async render(e){const{annotations:t}=e,i=this.div;(0,s.setLayerDimensions)(i,this.viewport);const a=new Map,o={data:null,layer:i,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:!1!==e.renderForms,svgFactory:new s.DOMSVGFactory,annotationStorage:e.annotationStorage||new r.AnnotationStorage,enableScripting:!0===e.enableScripting,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const e of t){if(e.noHTML)continue;const t=e.annotationType===n.AnnotationType.POPUP;if(t){const t=a.get(e.id);if(!t)continue;o.elements=t}else{const{width:t,height:i}=d(e.rect);if(t<=0||i<=0)continue}o.data=e;const i=u.create(o);if(!i.isRenderable)continue;if(!t&&e.popupRef){const t=a.get(e.popupRef);t?t.push(i):a.set(e.popupRef,[i])}i.annotationEditorType>0&&this.#Mi.set(i.data.id,i);const s=i.render();e.hidden&&(s.style.visibility="hidden"),this.#Ti(s,e.id)}this.#Di(),await this.l10n.translate(i)}update({viewport:e}){const t=this.div;this.viewport=e,(0,s.setLayerDimensions)(t,{rotation:e.rotation}),this.#Di(),t.hidden=!1}#Di(){if(!this.#Ci)return;const e=this.div;for(const[t,i]of this.#Ci){const n=e.querySelector(`[data-annotation-id="${t}"]`);if(!n)continue;const{firstChild:s}=n;s?"CANVAS"===s.nodeName?s.replaceWith(i):s.before(i):n.append(i)}this.#Ci.clear()}getEditableAnnotations(){return Array.from(this.#Mi.values())}getEditableAnnotation(e){return this.#Mi.get(e)}}},(e,t)=>{function i(e){return Math.floor(255*Math.max(0,Math.min(1,e))).toString(16).padStart(2,"0")}function n(e){return Math.max(0,Math.min(255,255*e))}Object.defineProperty(t,"__esModule",{value:!0}),t.ColorConverters=void 0,t.ColorConverters=class{static CMYK_G([e,t,i,n]){return["G",1-Math.min(1,.3*e+.59*i+.11*t+n)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_rgb([e]){return[e=n(e),e,e]}static G_HTML([e]){const t=i(e);return`#${t}${t}${t}`}static RGB_G([e,t,i]){return["G",.3*e+.59*t+.11*i]}static RGB_rgb(e){return e.map(n)}static RGB_HTML(e){return`#${e.map(i).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,t,i,n]){return["RGB",1-Math.min(1,e+n),1-Math.min(1,i+n),1-Math.min(1,t+n)]}static CMYK_rgb([e,t,i,s]){return[n(1-Math.min(1,e+s)),n(1-Math.min(1,i+s)),n(1-Math.min(1,t+s))]}static CMYK_HTML(e){const t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,i]){const n=1-e,s=1-t,r=1-i;return["CMYK",n,s,r,Math.min(n,s,r)]}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NullL10n=void 0,t.getL10nFallback=n;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.",annotation_date_string:"{{date}}, {{time}}",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",editor_alt_text_button_label:"Alt text",editor_alt_text_edit_button_label:"Edit alt text",editor_alt_text_decorative_tooltip:"Marked as decorative"};function n(e,t){switch(e){case"find_match_count":e=`find_match_count[${1===t.total?"one":"other"}]`;break;case"find_match_count_limit":e=`find_match_count_limit[${1===t.limit?"one":"other"}]`}return i[e]||""}i.print_progress_percent="{{progress}}%";const s={getLanguage:async()=>"en-us",getDirection:async()=>"ltr",get:async(e,t=null,i=n(e,t))=>function(e,t){return t?e.replaceAll(/\{\{\s*(\w+)\s*\}\}/g,((e,i)=>i in t?t[i]:"{{"+i+"}}")):e}(i,t),async translate(e){}};t.NullL10n=s},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.XfaLayer=void 0;var n=i(25);t.XfaLayer=class{static setupStorage(e,t,i,n,s){const r=n.getValue(t,{value:null});switch(i.name){case"textarea":if(null!==r.value&&(e.textContent=r.value),"print"===s)break;e.addEventListener("input",(e=>{n.setValue(t,{value:e.target.value})}));break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){if(r.value===i.attributes.xfaOn?e.setAttribute("checked",!0):r.value===i.attributes.xfaOff&&e.removeAttribute("checked"),"print"===s)break;e.addEventListener("change",(e=>{n.setValue(t,{value:e.target.checked?e.target.getAttribute("xfaOn"):e.target.getAttribute("xfaOff")})}))}else{if(null!==r.value&&e.setAttribute("value",r.value),"print"===s)break;e.addEventListener("input",(e=>{n.setValue(t,{value:e.target.value})}))}break;case"select":if(null!==r.value){e.setAttribute("value",r.value);for(const e of i.children)e.attributes.value===r.value?e.attributes.selected=!0:e.attributes.hasOwnProperty("selected")&&delete e.attributes.selected}e.addEventListener("input",(e=>{const i=e.target.options,s=-1===i.selectedIndex?"":i[i.selectedIndex].value;n.setValue(t,{value:s})}))}}static setAttributes({html:e,element:t,storage:i=null,intent:n,linkService:s}){const{attributes:r}=t,a=e instanceof HTMLAnchorElement;"radio"===r.type&&(r.name=`${r.name}-${n}`);for(const[t,i]of Object.entries(r))if(null!=i)switch(t){case"class":i.length&&e.setAttribute(t,i.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",i);break;case"style":Object.assign(e.style,i);break;case"textContent":e.textContent=i;break;default:(!a||"href"!==t&&"newWindow"!==t)&&e.setAttribute(t,i)}a&&s.addLinkAttributes(e,r.href,r.newWindow),i&&r.dataId&&this.setupStorage(e,r.dataId,t,i)}static render(e){const t=e.annotationStorage,i=e.linkService,s=e.xfaHtml,r=e.intent||"display",a=document.createElement(s.name);s.attributes&&this.setAttributes({html:a,element:s,intent:r,linkService:i});const o=[[s,-1,a]],l=e.div;if(l.append(a),e.viewport){const t=`matrix(${e.viewport.transform.join(",")})`;l.style.transform=t}"richText"!==r&&l.setAttribute("class","xfaLayer xfaFont");const h=[];for(;o.length>0;){const[e,s,a]=o.at(-1);if(s+1===e.children.length){o.pop();continue}const l=e.children[++o.at(-1)[1]];if(null===l)continue;const{name:c}=l;if("#text"===c){const e=document.createTextNode(l.value);h.push(e),a.append(e);continue}const d=l?.attributes?.xmlns?document.createElementNS(l.attributes.xmlns,c):document.createElement(c);if(a.append(d),l.attributes&&this.setAttributes({html:d,element:l,storage:t,intent:r,linkService:i}),l.children&&l.children.length>0)o.push([l,-1,d]);else if(l.value){const e=document.createTextNode(l.value);n.XfaText.shouldBuildText(c)&&h.push(e),d.append(e)}}for(const e of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))e.setAttribute("readOnly",!0);return{textDivs:h}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t,e.div.hidden=!1}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InkEditor=void 0;var n=i(1),s=i(4),r=i(29),a=i(6),o=i(5);class l extends s.AnnotationEditor{#Fi=0;#Li=0;#ki=this.canvasPointermove.bind(this);#Ri=this.canvasPointerleave.bind(this);#Ii=this.canvasPointerup.bind(this);#Oi=this.canvasPointerdown.bind(this);#Ni=new Path2D;#Bi=!1;#Vi=!1;#Ui=!1;#ji=null;#Hi=0;#Wi=0;#zi=null;static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=1;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,this._willKeepAspectRatio=!0}static initialize(e){s.AnnotationEditor.initialize(e,{strings:["editor_ink_canvas_aria_label","editor_ink2_aria_label"]})}static updateDefaultParams(e,t){switch(e){case n.AnnotationEditorParamsType.INK_THICKNESS:l._defaultThickness=t;break;case n.AnnotationEditorParamsType.INK_COLOR:l._defaultColor=t;break;case n.AnnotationEditorParamsType.INK_OPACITY:l._defaultOpacity=t/100}}updateParams(e,t){switch(e){case n.AnnotationEditorParamsType.INK_THICKNESS:this.#Gi(t);break;case n.AnnotationEditorParamsType.INK_COLOR:this.#$t(t);break;case n.AnnotationEditorParamsType.INK_OPACITY:this.#$i(t)}}static get defaultPropertiesToUpdate(){return[[n.AnnotationEditorParamsType.INK_THICKNESS,l._defaultThickness],[n.AnnotationEditorParamsType.INK_COLOR,l._defaultColor||s.AnnotationEditor._defaultLineColor],[n.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*l._defaultOpacity)]]}get propertiesToUpdate(){return[[n.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||l._defaultThickness],[n.AnnotationEditorParamsType.INK_COLOR,this.color||l._defaultColor||s.AnnotationEditor._defaultLineColor],[n.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??l._defaultOpacity))]]}#Gi(e){const t=this.thickness;this.addCommands({cmd:()=>{this.thickness=e,this.#qi()},undo:()=>{this.thickness=t,this.#qi()},mustExec:!0,type:n.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#$t(e){const t=this.color;this.addCommands({cmd:()=>{this.color=e,this.#Xi()},undo:()=>{this.color=t,this.#Xi()},mustExec:!0,type:n.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#$i(e){e/=100;const t=this.opacity;this.addCommands({cmd:()=>{this.opacity=e,this.#Xi()},undo:()=>{this.opacity=t,this.#Xi()},mustExec:!0,type:n.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.canvas||(this.#Ki(),this.#Yi()),this.isAttachedToDOM||(this.parent.add(this),this.#Qi()),this.#qi()))}remove(){null!==this.canvas&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.#ji.disconnect(),this.#ji=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(){this.#Bi||null===this.canvas||(super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener("pointerdown",this.#Oi))}disableEditMode(){this.isInEditMode()&&null!==this.canvas&&(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",this.#Oi))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}#Ji(){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]}}#Zi(){const{ctx:e,color:t,opacity:i,thickness:n,parentScale:s,scaleFactor:r}=this;e.lineWidth=n*s/r,e.lineCap="round",e.lineJoin="round",e.miterLimit=10,e.strokeStyle=`${t}${(0,o.opacityToHex)(i)}`}#en(e,t){this.canvas.addEventListener("contextmenu",a.noContextMenu),this.canvas.addEventListener("pointerleave",this.#Ri),this.canvas.addEventListener("pointermove",this.#ki),this.canvas.addEventListener("pointerup",this.#Ii),this.canvas.removeEventListener("pointerdown",this.#Oi),this.isEditing=!0,this.#Ui||(this.#Ui=!0,this.#Qi(),this.thickness||=l._defaultThickness,this.color||=l._defaultColor||s.AnnotationEditor._defaultLineColor,this.opacity??=l._defaultOpacity),this.currentPath.push([e,t]),this.#Vi=!1,this.#Zi(),this.#zi=()=>{this.#tn(),this.#zi&&window.requestAnimationFrame(this.#zi)},window.requestAnimationFrame(this.#zi)}#in(e,t){const[i,n]=this.currentPath.at(-1);if(this.currentPath.length>1&&e===i&&t===n)return;const s=this.currentPath;let r=this.#Ni;if(s.push([e,t]),this.#Vi=!0,s.length<=2)return r.moveTo(...s[0]),void r.lineTo(e,t);3===s.length&&(this.#Ni=r=new Path2D,r.moveTo(...s[0])),this.#nn(r,...s.at(-3),...s.at(-2),e,t)}#sn(){if(0===this.currentPath.length)return;const e=this.currentPath.at(-1);this.#Ni.lineTo(...e)}#rn(e,t){let i;if(this.#zi=null,e=Math.min(Math.max(e,0),this.canvas.width),t=Math.min(Math.max(t,0),this.canvas.height),this.#in(e,t),this.#sn(),1!==this.currentPath.length)i=this.#an();else{const n=[e,t];i=[[n,n.slice(),n.slice(),n]]}const n=this.#Ni,s=this.currentPath;this.currentPath=[],this.#Ni=new Path2D,this.addCommands({cmd:()=>{this.allRawPaths.push(s),this.paths.push(i),this.bezierPath2D.push(n),this.rebuild()},undo:()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),0===this.paths.length?this.remove():(this.canvas||(this.#Ki(),this.#Yi()),this.#qi())},mustExec:!0})}#tn(){if(!this.#Vi)return;this.#Vi=!1,Math.ceil(this.thickness*this.parentScale);const e=this.currentPath.slice(-3),t=e.map((e=>e[0])),i=e.map((e=>e[1]));Math.min(...t),Math.max(...t),Math.min(...i),Math.max(...i);const{ctx:n}=this;n.save(),n.clearRect(0,0,this.canvas.width,this.canvas.height);for(const e of this.bezierPath2D)n.stroke(e);n.stroke(this.#Ni),n.restore()}#nn(e,t,i,n,s,r,a){const o=(t+n)/2,l=(i+s)/2,h=(n+r)/2,c=(s+a)/2;e.bezierCurveTo(o+2*(n-o)/3,l+2*(s-l)/3,h+2*(n-h)/3,c+2*(s-c)/3,h,c)}#an(){const e=this.currentPath;if(e.length<=2)return[[e[0],e[0],e.at(-1),e.at(-1)]];const t=[];let i,[n,s]=e[0];for(i=1;i<e.length-2;i++){const[r,a]=e[i],[o,l]=e[i+1],h=(r+o)/2,c=(a+l)/2,d=[n+2*(r-n)/3,s+2*(a-s)/3],u=[h+2*(r-h)/3,c+2*(a-c)/3];t.push([[n,s],d,u,[h,c]]),[n,s]=[h,c]}const[r,a]=e[i],[o,l]=e[i+1],h=[n+2*(r-n)/3,s+2*(a-s)/3],c=[o+2*(r-o)/3,l+2*(a-l)/3];return t.push([[n,s],h,c,[o,l]]),t}#Xi(){if(this.isEmpty())return void this.#on();this.#Zi();const{canvas:e,ctx:t}=this;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.width,e.height),this.#on();for(const e of this.bezierPath2D)t.stroke(e)}commit(){this.#Bi||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),this.#Bi=!0,this.div.classList.add("disabled"),this.#qi(!0),this.makeResizable(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),this.enableEditMode())}canvasPointerdown(e){0===e.button&&this.isInEditMode()&&!this.#Bi&&(this.setInForeground(),e.preventDefault(),"mouse"!==e.type&&this.div.focus(),this.#en(e.offsetX,e.offsetY))}canvasPointermove(e){e.preventDefault(),this.#in(e.offsetX,e.offsetY)}canvasPointerup(e){e.preventDefault(),this.#ln(e)}canvasPointerleave(e){this.#ln(e)}#ln(e){this.canvas.removeEventListener("pointerleave",this.#Ri),this.canvas.removeEventListener("pointermove",this.#ki),this.canvas.removeEventListener("pointerup",this.#Ii),this.canvas.addEventListener("pointerdown",this.#Oi),setTimeout((()=>{this.canvas.removeEventListener("contextmenu",a.noContextMenu)}),10),this.#rn(e.offsetX,e.offsetY),this.addToAnnotationStorage(),this.setInBackground()}#Ki(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",s.AnnotationEditor._l10nPromise.get("editor_ink_canvas_aria_label").then((e=>this.canvas?.setAttribute("aria-label",e))),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")}#Yi(){this.#ji=new ResizeObserver((e=>{const t=e[0].contentRect;t.width&&t.height&&this.setDimensions(t.width,t.height)})),this.#ji.observe(this.div)}get isResizable(){return!this.isEmpty()&&this.#Bi}render(){if(this.div)return this.div;let e,t;this.width&&(e=this.x,t=this.y),super.render(),s.AnnotationEditor._l10nPromise.get("editor_ink2_aria_label").then((e=>this.div?.setAttribute("aria-label",e)));const[i,n,r,a]=this.#Ji();if(this.setAt(i,n,0,0),this.setDims(r,a),this.#Ki(),this.width){const[i,n]=this.parentDimensions;this.setAspectRatio(this.width*i,this.height*n),this.setAt(e*i,t*n,this.width*i,this.height*n),this.#Ui=!0,this.#Qi(),this.setDims(this.width*i,this.height*n),this.#Xi(),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return this.#Yi(),this.div}#Qi(){if(!this.#Ui)return;const[e,t]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*e),this.canvas.height=Math.ceil(this.height*t),this.#on()}setDimensions(e,t){const i=Math.round(e),n=Math.round(t);if(this.#Hi===i&&this.#Wi===n)return;this.#Hi=i,this.#Wi=n,this.canvas.style.visibility="hidden";const[s,r]=this.parentDimensions;this.width=e/s,this.height=t/r,this.fixAndSetPosition(),this.#Bi&&this.#hn(e,t),this.#Qi(),this.#Xi(),this.canvas.style.visibility="visible",this.fixDims()}#hn(e,t){const i=this.#cn(),n=(e-i)/this.#Li,s=(t-i)/this.#Fi;this.scaleFactor=Math.min(n,s)}#on(){const e=this.#cn()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+e,this.translationY*this.scaleFactor+e)}static#dn(e){const t=new Path2D;for(let i=0,n=e.length;i<n;i++){const[n,s,r,a]=e[i];0===i&&t.moveTo(...n),t.bezierCurveTo(s[0],s[1],r[0],r[1],a[0],a[1])}return t}static#un(e,t,i){const[n,s,r,a]=t;switch(i){case 0:for(let t=0,i=e.length;t<i;t+=2)e[t]+=n,e[t+1]=a-e[t+1];break;case 90:for(let t=0,i=e.length;t<i;t+=2){const i=e[t];e[t]=e[t+1]+n,e[t+1]=i+s}break;case 180:for(let t=0,i=e.length;t<i;t+=2)e[t]=r-e[t],e[t+1]+=s;break;case 270:for(let t=0,i=e.length;t<i;t+=2){const i=e[t];e[t]=r-e[t+1],e[t+1]=a-i}break;default:throw new Error("Invalid rotation")}return e}static#pn(e,t,i){const[n,s,r,a]=t;switch(i){case 0:for(let t=0,i=e.length;t<i;t+=2)e[t]-=n,e[t+1]=a-e[t+1];break;case 90:for(let t=0,i=e.length;t<i;t+=2){const i=e[t];e[t]=e[t+1]-s,e[t+1]=i-n}break;case 180:for(let t=0,i=e.length;t<i;t+=2)e[t]=r-e[t],e[t+1]-=s;break;case 270:for(let t=0,i=e.length;t<i;t+=2){const i=e[t];e[t]=a-e[t+1],e[t+1]=r-i}break;default:throw new Error("Invalid rotation")}return e}#gn(e,t,i,n){const s=[],r=this.thickness/2,a=e*t+r,o=e*i+r;for(const t of this.paths){const i=[],r=[];for(let n=0,s=t.length;n<s;n++){const[l,h,c,d]=t[n],u=e*l[0]+a,p=e*l[1]+o,g=e*h[0]+a,f=e*h[1]+o,m=e*c[0]+a,_=e*c[1]+o,v=e*d[0]+a,b=e*d[1]+o;0===n&&(i.push(u,p),r.push(u,p)),i.push(g,f,m,_,v,b),r.push(g,f),n===s-1&&r.push(v,b)}s.push({bezier:l.#un(i,n,this.rotation),points:l.#un(r,n,this.rotation)})}return s}#fn(){let e=1/0,t=-1/0,i=1/0,s=-1/0;for(const r of this.paths)for(const[a,o,l,h]of r){const r=n.Util.bezierBoundingBox(...a,...o,...l,...h);e=Math.min(e,r[0]),i=Math.min(i,r[1]),t=Math.max(t,r[2]),s=Math.max(s,r[3])}return[e,i,t,s]}#cn(){return this.#Bi?Math.ceil(this.thickness*this.parentScale):0}#qi(e=!1){if(this.isEmpty())return;if(!this.#Bi)return void this.#Xi();const t=this.#fn(),i=this.#cn();this.#Li=Math.max(s.AnnotationEditor.MIN_SIZE,t[2]-t[0]),this.#Fi=Math.max(s.AnnotationEditor.MIN_SIZE,t[3]-t[1]);const n=Math.ceil(i+this.#Li*this.scaleFactor),r=Math.ceil(i+this.#Fi*this.scaleFactor),[a,o]=this.parentDimensions;this.width=n/a,this.height=r/o,this.setAspectRatio(n,r);const l=this.translationX,h=this.translationY;this.translationX=-t[0],this.translationY=-t[1],this.#Qi(),this.#Xi(),this.#Hi=n,this.#Wi=r,this.setDims(n,r);const c=e?i/this.scaleFactor/2:0;this.translate(l-this.translationX-c,h-this.translationY-c)}static deserialize(e,t,i){if(e instanceof r.InkAnnotationElement)return null;const a=super.deserialize(e,t,i);a.thickness=e.thickness,a.color=n.Util.makeHexColor(...e.color),a.opacity=e.opacity;const[o,h]=a.pageDimensions,c=a.width*o,d=a.height*h,u=a.parentScale,p=e.thickness/2;a.#Bi=!0,a.#Hi=Math.round(c),a.#Wi=Math.round(d);const{paths:g,rect:f,rotation:m}=e;for(let{bezier:e}of g){e=l.#pn(e,f,m);const t=[];a.paths.push(t);let i=u*(e[0]-p),n=u*(e[1]-p);for(let s=2,r=e.length;s<r;s+=6){const r=u*(e[s]-p),a=u*(e[s+1]-p),o=u*(e[s+2]-p),l=u*(e[s+3]-p),h=u*(e[s+4]-p),c=u*(e[s+5]-p);t.push([[i,n],[r,a],[o,l],[h,c]]),i=h,n=c}const s=this.#dn(t);a.bezierPath2D.push(s)}const _=a.#fn();return a.#Li=Math.max(s.AnnotationEditor.MIN_SIZE,_[2]-_[0]),a.#Fi=Math.max(s.AnnotationEditor.MIN_SIZE,_[3]-_[1]),a.#hn(c,d),a}serialize(){if(this.isEmpty())return null;const e=this.getRect(0,0),t=s.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:n.AnnotationEditorType.INK,color:t,thickness:this.thickness,opacity:this.opacity,paths:this.#gn(this.scaleFactor/this.parentScale,this.translationX,this.translationY,e),pageIndex:this.pageIndex,rect:e,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}}t.InkEditor=l},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StampEditor=void 0;var n=i(1),s=i(4),r=i(6),a=i(29);class o extends s.AnnotationEditor{#mn=null;#_n=null;#vn=null;#bn=null;#yn=null;#Sn=null;#ji=null;#Pn=null;#An=!1;#wn=!1;static _type="stamp";constructor(e){super({...e,name:"stampEditor"}),this.#bn=e.bitmapUrl,this.#yn=e.bitmapFile}static initialize(e){s.AnnotationEditor.initialize(e)}static get supportedTypes(){return(0,n.shadow)(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map((e=>`image/${e}`)))}static get supportedTypesStr(){return(0,n.shadow)(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(e){return this.supportedTypes.includes(e)}static paste(e,t){t.pasteEditor(n.AnnotationEditorType.STAMP,{bitmapFile:e.getAsFile()})}#En(e,t=!1){e?(this.#mn=e.bitmap,t||(this.#_n=e.id,this.#An=e.isSvg),this.#Ki()):this.remove()}#xn(){this.#vn=null,this._uiManager.enableWaiting(!1),this.#Sn&&this.div.focus()}#Cn(){if(this.#_n)return this._uiManager.enableWaiting(!0),void this._uiManager.imageManager.getFromId(this.#_n).then((e=>this.#En(e,!0))).finally((()=>this.#xn()));if(this.#bn){const e=this.#bn;return this.#bn=null,this._uiManager.enableWaiting(!0),void(this.#vn=this._uiManager.imageManager.getFromUrl(e).then((e=>this.#En(e))).finally((()=>this.#xn())))}if(this.#yn){const e=this.#yn;return this.#yn=null,this._uiManager.enableWaiting(!0),void(this.#vn=this._uiManager.imageManager.getFromFile(e).then((e=>this.#En(e))).finally((()=>this.#xn())))}const e=document.createElement("input");e.type="file",e.accept=o.supportedTypesStr,this.#vn=new Promise((t=>{e.addEventListener("change",(async()=>{if(e.files&&0!==e.files.length){this._uiManager.enableWaiting(!0);const t=await this._uiManager.imageManager.getFromFile(e.files[0]);this.#En(t)}else this.remove();t()})),e.addEventListener("cancel",(()=>{this.remove(),t()}))})).finally((()=>this.#xn())),e.click()}remove(){this.#_n&&(this.#mn=null,this._uiManager.imageManager.deleteId(this.#_n),this.#Sn?.remove(),this.#Sn=null,this.#ji?.disconnect(),this.#ji=null),super.remove()}rebuild(){this.parent?(super.rebuild(),null!==this.div&&(this.#_n&&this.#Cn(),this.isAttachedToDOM||this.parent.add(this))):this.#_n&&this.#Cn()}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(this.#vn||this.#mn||this.#bn||this.#yn)}get isResizable(){return!0}render(){if(this.div)return this.div;let e,t;if(this.width&&(e=this.x,t=this.y),super.render(),this.div.hidden=!0,this.#mn?this.#Ki():this.#Cn(),this.width){const[i,n]=this.parentDimensions;this.setAt(e*i,t*n,this.width*i,this.height*n)}return this.div}#Ki(){const{div:e}=this;let{width:t,height:i}=this.#mn;const[n,s]=this.pageDimensions,r=.75;if(this.width)t=this.width*n,i=this.height*s;else if(t>r*n||i>r*s){const e=Math.min(r*n/t,r*s/i);t*=e,i*=e}const[a,o]=this.parentDimensions;this.setDims(t*a/n,i*o/s),this._uiManager.enableWaiting(!1);const l=this.#Sn=document.createElement("canvas");e.append(l),e.hidden=!1,this.#Mn(t,i),this.#Yi(),this.#wn||(this.parent.addUndoableEditor(this),this.#wn=!0),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",subtype:this.editorType,data:{action:"inserted_image"}}}),this.addAltTextButton()}#Tn(e,t){const[i,n]=this.parentDimensions;this.width=e/i,this.height=t/n,this.setDims(e,t),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,null!==this.#Pn&&clearTimeout(this.#Pn),this.#Pn=setTimeout((()=>{this.#Pn=null,this.#Mn(e,t)}),200)}#Dn(e,t){const{width:i,height:n}=this.#mn;let s=i,r=n,a=this.#mn;for(;s>2*e||r>2*t;){const i=s,n=r;s>2*e&&(s=s>=16384?Math.floor(s/2)-1:Math.ceil(s/2)),r>2*t&&(r=r>=16384?Math.floor(r/2)-1:Math.ceil(r/2));const o=new OffscreenCanvas(s,r);o.getContext("2d").drawImage(a,0,0,i,n,0,0,s,r),a=o.transferToImageBitmap()}return a}#Mn(e,t){e=Math.ceil(e),t=Math.ceil(t);const i=this.#Sn;if(!i||i.width===e&&i.height===t)return;i.width=e,i.height=t;const n=this.#An?this.#mn:this.#Dn(e,t),s=i.getContext("2d");s.filter=this._uiManager.hcmFilter,s.drawImage(n,0,0,n.width,n.height,0,0,e,t)}#Fn(e){if(e){if(this.#An){const e=this._uiManager.imageManager.getSvgUrl(this.#_n);if(e)return e}const e=document.createElement("canvas");return({width:e.width,height:e.height}=this.#mn),e.getContext("2d").drawImage(this.#mn,0,0),e.toDataURL()}if(this.#An){const[e,t]=this.pageDimensions,i=Math.round(this.width*e*r.PixelsPerInch.PDF_TO_CSS_UNITS),n=Math.round(this.height*t*r.PixelsPerInch.PDF_TO_CSS_UNITS),s=new OffscreenCanvas(i,n);return s.getContext("2d").drawImage(this.#mn,0,0,this.#mn.width,this.#mn.height,0,0,i,n),s.transferToImageBitmap()}return structuredClone(this.#mn)}#Yi(){this.#ji=new ResizeObserver((e=>{const t=e[0].contentRect;t.width&&t.height&&this.#Tn(t.width,t.height)})),this.#ji.observe(this.div)}static deserialize(e,t,i){if(e instanceof a.StampAnnotationElement)return null;const n=super.deserialize(e,t,i),{rect:s,bitmapUrl:r,bitmapId:o,isSvg:l,accessibilityData:h}=e;o&&i.imageManager.isValidId(o)?n.#_n=o:n.#bn=r,n.#An=l;const[c,d]=n.pageDimensions;return n.width=(s[2]-s[0])/c,n.height=(s[3]-s[1])/d,h&&(n.altTextData=h),n}serialize(e=!1,t=null){if(this.isEmpty())return null;const i={annotationType:n.AnnotationEditorType.STAMP,bitmapId:this.#_n,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#An,structTreeParentId:this._structTreeParentId};if(e)return i.bitmapUrl=this.#Fn(!0),i.accessibilityData=this.altTextData,i;const{decorative:s,altText:r}=this.altTextData;if(!s&&r&&(i.accessibilityData={type:"Figure",alt:r}),null===t)return i;t.stamps||=new Map;const a=this.#An?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(t.stamps.has(this.#_n)){if(this.#An){const e=t.stamps.get(this.#_n);a>e.area&&(e.area=a,e.serialized.bitmap.close(),e.serialized.bitmap=this.#Fn(!1))}}else t.stamps.set(this.#_n,{area:a,serialized:i}),i.bitmap=this.#Fn(!1);return i}}t.StampEditor=o}],__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:{}};return __webpack_modules__[e](i,i.exports,__w_pdfjs_require__),i.exports}var __webpack_exports__={};return(()=>{var e=__webpack_exports__;Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"AbortException",{enumerable:!0,get:function(){return t.AbortException}}),Object.defineProperty(e,"AnnotationEditorLayer",{enumerable:!0,get:function(){return r.AnnotationEditorLayer}}),Object.defineProperty(e,"AnnotationEditorParamsType",{enumerable:!0,get:function(){return t.AnnotationEditorParamsType}}),Object.defineProperty(e,"AnnotationEditorType",{enumerable:!0,get:function(){return t.AnnotationEditorType}}),Object.defineProperty(e,"AnnotationEditorUIManager",{enumerable:!0,get:function(){return a.AnnotationEditorUIManager}}),Object.defineProperty(e,"AnnotationLayer",{enumerable:!0,get:function(){return o.AnnotationLayer}}),Object.defineProperty(e,"AnnotationMode",{enumerable:!0,get:function(){return t.AnnotationMode}}),Object.defineProperty(e,"CMapCompressionType",{enumerable:!0,get:function(){return t.CMapCompressionType}}),Object.defineProperty(e,"DOMSVGFactory",{enumerable:!0,get:function(){return n.DOMSVGFactory}}),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,"ImageKind",{enumerable:!0,get:function(){return t.ImageKind}}),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 i.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 h.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,"noContextMenu",{enumerable:!0,get:function(){return n.noContextMenu}}),Object.defineProperty(e,"normalizeUnicode",{enumerable:!0,get:function(){return t.normalizeUnicode}}),Object.defineProperty(e,"renderTextLayer",{enumerable:!0,get:function(){return s.renderTextLayer}}),Object.defineProperty(e,"setLayerDimensions",{enumerable:!0,get:function(){return n.setLayerDimensions}}),Object.defineProperty(e,"shadow",{enumerable:!0,get:function(){return t.shadow}}),Object.defineProperty(e,"updateTextLayer",{enumerable:!0,get:function(){return s.updateTextLayer}}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return i.version}});var t=__w_pdfjs_require__(1),i=__w_pdfjs_require__(2),n=__w_pdfjs_require__(6),s=__w_pdfjs_require__(26),r=__w_pdfjs_require__(27),a=__w_pdfjs_require__(5),o=__w_pdfjs_require__(29),l=__w_pdfjs_require__(14),h=__w_pdfjs_require__(32)})(),__webpack_exports__})(),module.exports=root.pdfjsLib=factory()})(pdf);var pdfExports=pdf.exports,pdf_viewer={exports:{}};
32
+ (function(module,exports){var root,factory;root=globalThis,factory=()=>(()=>{var __webpack_modules__=[,(e,t)=>{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.AnnotationReplyType=t.AnnotationPrefix=t.AnnotationMode=t.AnnotationFlag=t.AnnotationFieldFlag=t.AnnotationEditorType=t.AnnotationEditorPrefix=t.AnnotationEditorParamsType=t.AnnotationBorderStyleType=t.AnnotationActionEventType=t.AbortException=void 0,t.assert=function(e,t){e||a(t)},t.bytesToString=h,t.createValidAbsoluteUrl=function(e,t=null,i=null){if(!e)return null;try{if(i&&"string"==typeof e){if(i.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\./g);t?.length>=2&&(e=`http://${e}`)}if(i.tryConvertEncoding)try{e=p(e)}catch{}}const n=t?new URL(e,t):new URL(e);if(function(e){switch(e?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(n))return n}catch{}return null},t.getModificationDate=function(e=new Date){return[e.getUTCFullYear().toString(),(e.getUTCMonth()+1).toString().padStart(2,"0"),e.getUTCDate().toString().padStart(2,"0"),e.getUTCHours().toString().padStart(2,"0"),e.getUTCMinutes().toString().padStart(2,"0"),e.getUTCSeconds().toString().padStart(2,"0")].join("")},t.getUuid=function(){if("undefined"!=typeof crypto&&"function"==typeof crypto?.randomUUID)return crypto.randomUUID();const e=new Uint8Array(32);if("undefined"!=typeof crypto&&"function"==typeof crypto?.getRandomValues)crypto.getRandomValues(e);else for(let t=0;t<32;t++)e[t]=Math.floor(255*Math.random());return h(e)},t.getVerbosityLevel=function(){return s},t.info=function(e){s>=n.INFOS&&console.log(`Info: ${e}`)},t.isArrayBuffer=function(e){return"object"==typeof e&&void 0!==e?.byteLength},t.isArrayEqual=function(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.isNodeJS=void 0,t.normalizeUnicode=function(e){return g||(g=/([\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,f=new Map([["ſt","ſt"]])),e.replaceAll(g,((e,t,i)=>t?t.normalize("NFKC"):f.get(i)))},t.objectFromMap=function(e){const t=Object.create(null);for(const[i,n]of e)t[i]=n;return t},t.objectSize=function(e){return Object.keys(e).length},t.setVerbosityLevel=function(e){Number.isInteger(e)&&(s=e)},t.shadow=o,t.string32=function(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)},t.stringToBytes=c,t.stringToPDFString=function(e){if(e[0]>="ï"){let t;if("þ"===e[0]&&"ÿ"===e[1]?t="utf-16be":"ÿ"===e[0]&&"þ"===e[1]?t="utf-16le":"ï"===e[0]&&"»"===e[1]&&"¿"===e[2]&&(t="utf-8"),t)try{const i=new TextDecoder(t,{fatal:!0}),n=c(e);return i.decode(n)}catch(e){r(`stringToPDFString: "${e}".`)}}const t=[];for(let i=0,n=e.length;i<n;i++){const n=u[e.charCodeAt(i)];t.push(n?String.fromCharCode(n):e.charAt(i))}return t.join("")},t.stringToUTF8String=p,t.unreachable=a,t.utf8StringToString=function(e){return unescape(encodeURIComponent(e))},t.warn=r;const i=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type);t.isNodeJS=i,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,STAMP:13,INK:15},t.AnnotationEditorParamsType={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23},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.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 s=n.WARNINGS;function r(e){s>=n.WARNINGS&&console.log(`Warning: ${e}`)}function a(e){throw new Error(e)}function o(e,t,i,n=!1){return Object.defineProperty(e,t,{value:i,enumerable:!n,configurable:!0,writable:!1}),i}const l=function(){function e(t,i){this.constructor===e&&a("Cannot initialize BaseException."),this.message=t,this.name=i}return e.prototype=new Error,e.constructor=e,e}();function h(e){"object"==typeof e&&void 0!==e?.length||a("Invalid argument for bytesToString");const t=e.length,i=8192;if(t<i)return String.fromCharCode.apply(null,e);const n=[];for(let s=0;s<t;s+=i){const r=Math.min(s+i,t),a=e.subarray(s,r);n.push(String.fromCharCode.apply(null,a))}return n.join("")}function c(e){"string"!=typeof e&&a("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.BaseException=l,t.PasswordException=class extends l{constructor(e,t){super(e,"PasswordException"),this.code=t}},t.UnknownErrorException=class extends l{constructor(e,t){super(e,"UnknownErrorException"),this.details=t}},t.InvalidPDFException=class extends l{constructor(e){super(e,"InvalidPDFException")}},t.MissingPDFException=class extends l{constructor(e){super(e,"MissingPDFException")}},t.UnexpectedResponseException=class extends l{constructor(e,t){super(e,"UnexpectedResponseException"),this.status=t}},t.FormatError=class extends l{constructor(e){super(e,"FormatError")}},t.AbortException=class extends l{constructor(e){super(e,"AbortException")}},t.FeatureTest=class{static get isLittleEndian(){return o(this,"isLittleEndian",function(){const e=new Uint8Array(4);return e[0]=1,1===new Uint32Array(e.buffer,0,1)[0]}())}static get isEvalSupported(){return o(this,"isEvalSupported",function(){try{return new Function(""),!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return o(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get platform(){return"undefined"==typeof navigator?o(this,"platform",{isWin:!1,isMac:!1}):o(this,"platform",{isWin:navigator.platform.includes("Win"),isMac:navigator.platform.includes("Mac")})}static get isCSSRoundSupported(){return o(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}};const d=[...Array(256).keys()].map((e=>e.toString(16).padStart(2,"0")));t.Util=class{static makeHexColor(e,t,i){return`#${d[e]}${d[t]}${d[i]}`}static scaleMinMax(e,t){let i;e[0]?(e[0]<0&&(i=t[0],t[0]=t[1],t[1]=i),t[0]*=e[0],t[1]*=e[0],e[3]<0&&(i=t[2],t[2]=t[3],t[3]=i),t[2]*=e[3],t[3]*=e[3]):(i=t[0],t[0]=t[2],t[2]=i,i=t[1],t[1]=t[3],t[3]=i,e[1]<0&&(i=t[2],t[2]=t[3],t[3]=i),t[2]*=e[1],t[3]*=e[1],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=this.applyTransform(e,t),n=this.applyTransform(e.slice(2,4),t),s=this.applyTransform([e[0],e[3]],t),r=this.applyTransform([e[2],e[1]],t);return[Math.min(i[0],n[0],s[0],r[0]),Math.min(i[1],n[1],s[1],r[1]),Math.max(i[0],n[0],s[0],r[0]),Math.max(i[1],n[1],s[1],r[1])]}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e){const t=[e[0],e[2],e[1],e[3]],i=e[0]*t[0]+e[1]*t[2],n=e[0]*t[1]+e[1]*t[3],s=e[2]*t[0]+e[3]*t[2],r=e[2]*t[1]+e[3]*t[3],a=(i+r)/2,o=Math.sqrt((i+r)**2-4*(i*r-s*n))/2,l=a+o||1,h=a-o||1;return[Math.sqrt(l),Math.sqrt(h)]}static normalizeRect(e){const t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){const i=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),n=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(i>n)return null;const s=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),r=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return s>r?null:[i,s,n,r]}static bezierBoundingBox(e,t,i,n,s,r,a,o){const l=[],h=[[],[]];let c,d,u,p,g,f,m,_;for(let h=0;h<2;++h)if(0===h?(d=6*e-12*i+6*s,c=-3*e+9*i-9*s+3*a,u=3*i-3*e):(d=6*t-12*n+6*r,c=-3*t+9*n-9*r+3*o,u=3*n-3*t),Math.abs(c)<1e-12){if(Math.abs(d)<1e-12)continue;p=-u/d,0<p&&p<1&&l.push(p)}else m=d*d-4*u*c,_=Math.sqrt(m),m<0||(g=(-d+_)/(2*c),0<g&&g<1&&l.push(g),f=(-d-_)/(2*c),0<f&&f<1&&l.push(f));let v,b=l.length;const y=b;for(;b--;)p=l[b],v=1-p,h[0][b]=v*v*v*e+3*v*v*p*i+3*v*p*p*s+p*p*p*a,h[1][b]=v*v*v*t+3*v*v*p*n+3*v*p*p*r+p*p*p*o;return h[0][y]=e,h[1][y]=t,h[0][y+1]=a,h[1][y+1]=o,h[0].length=h[1].length=y+2,[Math.min(...h[0]),Math.min(...h[1]),Math.max(...h[0]),Math.max(...h[1])]}};const u=[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 p(e){return decodeURIComponent(escape(e))}t.PromiseCapability=class{#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 g=null,f=null;t.AnnotationPrefix="pdfjs_internal_id_"},(__unused_webpack_module,exports,__w_pdfjs_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),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,Object.defineProperty(exports,"SVGGraphics",{enumerable:!0,get:function(){return _displaySvg.SVGGraphics}}),exports.build=void 0,exports.getDocument=getDocument,exports.version=void 0;var _util=__w_pdfjs_require__(1),_annotation_storage=__w_pdfjs_require__(3),_display_utils=__w_pdfjs_require__(6),_font_loader=__w_pdfjs_require__(9),_displayNode_utils=__w_pdfjs_require__(10),_canvas=__w_pdfjs_require__(11),_worker_options=__w_pdfjs_require__(14),_message_handler=__w_pdfjs_require__(15),_metadata=__w_pdfjs_require__(16),_optional_content_config=__w_pdfjs_require__(17),_transport_stream=__w_pdfjs_require__(18),_displayFetch_stream=__w_pdfjs_require__(19),_displayNetwork=__w_pdfjs_require__(22),_displayNode_stream=__w_pdfjs_require__(23),_displaySvg=__w_pdfjs_require__(24),_xfa_text=__w_pdfjs_require__(25);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100,DELAYED_CLEANUP_TIMEOUT=5e3,DefaultCanvasFactory=_util.isNodeJS?_displayNode_utils.NodeCanvasFactory:_display_utils.DOMCanvasFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory;const DefaultCMapReaderFactory=_util.isNodeJS?_displayNode_utils.NodeCMapReaderFactory:_display_utils.DOMCMapReaderFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory;const DefaultFilterFactory=_util.isNodeJS?_displayNode_utils.NodeFilterFactory:_display_utils.DOMFilterFactory;exports.DefaultFilterFactory=DefaultFilterFactory;const DefaultStandardFontDataFactory=_util.isNodeJS?_displayNode_utils.NodeStandardFontDataFactory:_display_utils.DOMStandardFontDataFactory;function getDocument(e){if("string"==typeof e||e instanceof URL?e={url:e}:(0,_util.isArrayBuffer)(e)&&(e={data:e}),"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):null,s=e.data?getDataProp(e.data):null,r=e.httpHeaders||null,a=!0===e.withCredentials,o=e.password??null,l=e.range instanceof PDFDataRangeTransport?e.range:null,h=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:DEFAULT_RANGE_CHUNK_SIZE;let c=e.worker instanceof PDFWorker?e.worker:null;const d=e.verbosity,u="string"!=typeof e.docBaseUrl||(0,_display_utils.isDataScheme)(e.docBaseUrl)?null:e.docBaseUrl,p="string"==typeof e.cMapUrl?e.cMapUrl:null,g=!1!==e.cMapPacked,f=e.CMapReaderFactory||DefaultCMapReaderFactory,m="string"==typeof e.standardFontDataUrl?e.standardFontDataUrl:null,_=e.StandardFontDataFactory||DefaultStandardFontDataFactory,v=!0!==e.stopAtErrors,b=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,y=!1!==e.isEvalSupported,S="boolean"==typeof e.isOffscreenCanvasSupported?e.isOffscreenCanvasSupported:!_util.isNodeJS,P=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,A="boolean"==typeof e.disableFontFace?e.disableFontFace:_util.isNodeJS,w=!0===e.fontExtraProperties,E=!0===e.enableXfa,x=e.ownerDocument||globalThis.document,C=!0===e.disableRange,M=!0===e.disableStream,T=!0===e.disableAutoFetch,D=!0===e.pdfBug,F=l?l.length:e.length??NaN,k="boolean"==typeof e.useSystemFonts?e.useSystemFonts:!_util.isNodeJS&&!A,L="boolean"==typeof e.useWorkerFetch?e.useWorkerFetch:f===_display_utils.DOMCMapReaderFactory&&_===_display_utils.DOMStandardFontDataFactory&&p&&m&&(0,_display_utils.isValidFetchUrl)(p,document.baseURI)&&(0,_display_utils.isValidFetchUrl)(m,document.baseURI),R=e.canvasFactory||new DefaultCanvasFactory({ownerDocument:x}),I=e.filterFactory||new DefaultFilterFactory({docId:i,ownerDocument:x});(0,_util.setVerbosityLevel)(d);const O={canvasFactory:R,filterFactory:I};if(L||(O.cMapReaderFactory=new f({baseUrl:p,isCompressed:g}),O.standardFontDataFactory=new _({baseUrl:m})),!c){const e={verbosity:d,port:_worker_options.GlobalWorkerOptions.workerPort};c=e.port?PDFWorker.fromPort(e):new PDFWorker(e),t._worker=c}const N={docId:i,apiVersion:"3.11.174",data:s,password:o,disableAutoFetch:T,rangeChunkSize:h,length:F,docBaseUrl:u,enableXfa:E,evaluatorOptions:{maxImageSize:b,disableFontFace:A,ignoreErrors:v,isEvalSupported:y,isOffscreenCanvasSupported:S,canvasMaxAreaInBytes:P,fontExtraProperties:w,useSystemFonts:k,cMapUrl:L?p:null,standardFontDataUrl:L?m:null}},B={ignoreErrors:v,isEvalSupported:y,disableFontFace:A,fontExtraProperties:w,enableXfa:E,ownerDocument:x,disableAutoFetch:T,pdfBug:D,styleElement:null};return c.promise.then((function(){if(t.destroyed)throw new Error("Loading aborted");const e=_fetchDocument(c,N),o=new Promise((function(e){let t;var i;l?t=new _transport_stream.PDFDataTransportStream({length:F,initialData:l.initialData,progressiveDone:l.progressiveDone,contentDispositionFilename:l.contentDispositionFilename,disableRange:C,disableStream:M},l):s||(i={url:n,length:F,httpHeaders:r,withCredentials:a,rangeChunkSize:h,disableRange:C,disableStream:M},t=_util.isNodeJS?new _displayNode_stream.PDFNodeStream(i):(0,_display_utils.isValidFetchUrl)(i.url)?new _displayFetch_stream.PDFFetchStream(i):new _displayNetwork.PDFNetworkStream(i)),e(t)}));return Promise.all([e,o]).then((function([e,n]){if(t.destroyed)throw new Error("Loading aborted");const s=new _message_handler.MessageHandler(i,e,c.port),r=new WorkerTransport(s,t,n,B,O);t._transport=r,s.send("Ready",null)}))})).catch(t._capability.reject),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){if(e instanceof URL)return e.href;try{return new URL(e,window.location).href}catch{if(_util.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(_util.isNodeJS&&"undefined"!=typeof Buffer&&e instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if("string"==typeof e)return(0,_util.stringToBytes)(e);if("object"==typeof e&&!isNaN(e?.length)||(0,_util.isArrayBuffer)(e))return new Uint8Array(e);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory;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(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await(this._transport?.destroy())}catch(e){throw this._worker?.port&&delete this._worker._pendingDestroy,e}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}exports.PDFDocumentLoadingTask=PDFDocumentLoadingTask;class PDFDataRangeTransport{constructor(e,t,i=!1,n=null){this.length=e,this.initialData=t,this.progressiveDone=i,this.contentDispositionFilename=n,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=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,Object.defineProperty(this,"getJavaScript",{value:()=>((0,_display_utils.deprecated)("`PDFDocumentProxy.getJavaScript`, please use `PDFDocumentProxy.getJSActions` instead."),this.getJSActions().then((e=>{if(!e)return e;const t=[];for(const i in e)t.push(...e[i]);return 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()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){return this._transport.getOptionalContentConfig()}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}exports.PDFDocumentProxy=PDFDocumentProxy;class PDFPageProxy{#i=null;#n=!1;constructor(e,t,i,n=!1){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({scale:e,rotation:t=this.rotate,offsetX:i=0,offsetY:n=0,dontFlip:s=!1}={}){return new _display_utils.PageViewport({viewBox:this.view,scale:e,rotation:t,offsetX:i,offsetY:n,dontFlip:s})}getAnnotations({intent:e="display"}={}){const t=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,t.renderingIntent)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return(0,_util.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:e,viewport:t,intent:i="display",annotationMode:n=_util.AnnotationMode.ENABLE,transform:s=null,background:r=null,optionalContentConfigPromise:a=null,annotationCanvasMap:o=null,pageColors:l=null,printAnnotationStorage:h=null}){this._stats?.time("Overall");const c=this._transport.getRenderingIntent(i,n,h);this.#n=!1,this.#s(),a||(a=this._transport.getOptionalContentConfig());let d=this._intentStates.get(c.cacheKey);d||(d=Object.create(null),this._intentStates.set(c.cacheKey,d)),d.streamReaderCancelTimeout&&(clearTimeout(d.streamReaderCancelTimeout),d.streamReaderCancelTimeout=null);const u=!!(c.renderingIntent&_util.RenderingIntentFlag.PRINT);d.displayReadyCapability||(d.displayReadyCapability=new _util.PromiseCapability,d.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(c));const p=e=>{d.renderTasks.delete(g),(this._maybeCleanupAfterRender||u)&&(this.#n=!0),this.#r(!u),e?(g.capability.reject(e),this._abortOperatorList({intentState:d,reason:e instanceof Error?e:new Error(e)})):g.capability.resolve(),this._stats?.timeEnd("Rendering"),this._stats?.timeEnd("Overall")},g=new InternalRenderTask({callback:p,params:{canvasContext:e,viewport:t,transform:s,background:r},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:o,operatorList:d.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!u,pdfBug:this._pdfBug,pageColors:l});(d.renderTasks||=new Set).add(g);const f=g.task;return Promise.all([d.displayReadyCapability.promise,a]).then((([e,t])=>{this.destroyed?p():(this._stats?.time("Rendering"),g.initializeGraphics({transparency:e,optionalContentConfig:t}),g.operatorListChanged())})).catch(p),f}getOperatorList({intent:e="display",annotationMode:t=_util.AnnotationMode.ENABLE,printAnnotationStorage:i=null}={}){const n=this._transport.getRenderingIntent(e,t,i,!0);let s,r=this._intentStates.get(n.cacheKey);return r||(r=Object.create(null),this._intentStates.set(n.cacheKey,r)),r.opListReadCapability||(s=Object.create(null),s.operatorListChanged=function(){r.operatorList.lastChunk&&(r.opListReadCapability.resolve(r.operatorList),r.renderTasks.delete(s))},r.opListReadCapability=new _util.PromiseCapability,(r.renderTasks||=new Set).add(s),r.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(n)),r.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===e,disableNormalization:!0===t},{highWaterMark:100,size:e=>e.items.length})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then((e=>_xfa_text.XfaText.textContent(e)));const t=this.streamTextContent(e);return new Promise((function(e,i){const n=t.getReader(),s={items:[],styles:Object.create(null)};!function t(){n.read().then((function({value:i,done:n}){n?e(s):(Object.assign(s.styles,i.styles),s.items.push(...i.items),t())}),i)}()}))}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0}),!t.opListReadCapability)for(const i of t.renderTasks)e.push(i.completed),i.cancel();return this.objs.clear(),this.#n=!1,this.#s(),Promise.all(e)}cleanup(e=!1){this.#n=!0;const t=this.#r(!1);return e&&t&&(this._stats&&=new _display_utils.StatTimer),t}#r(e=!1){if(this.#s(),!this.#n||this.destroyed)return!1;if(e)return this.#i=setTimeout((()=>{this.#i=null,this.#r(!1)}),DELAYED_CLEANUP_TIMEOUT),!1;for(const{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#n=!1,!0}#s(){this.#i&&(clearTimeout(this.#i),this.#i=null)}_startRenderPage(e,t){const i=this._intentStates.get(t);i&&(this._stats?.timeEnd("Page Request"),i.displayReadyCapability?.resolve(e))}_renderPageChunk(e,t){for(let i=0,n=e.length;i<n;i++)t.operatorList.fnArray.push(e.fnArray[i]),t.operatorList.argsArray.push(e.argsArray[i]);t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots;for(const e of t.renderTasks)e.operatorListChanged();e.lastChunk&&this.#r(!0)}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageSerializable:i}){const{map:n,transfers:s}=i,r=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:n},s).getReader(),a=this._intentStates.get(t);a.streamReader=r;const o=()=>{r.read().then((({value:e,done:t})=>{t?a.streamReader=null:this._transport.destroyed||(this._renderPageChunk(e,a),o())}),(e=>{if(a.streamReader=null,!this._transport.destroyed){if(a.operatorList){a.operatorList.lastChunk=!0;for(const e of a.renderTasks)e.operatorListChanged();this.#r(!0)}if(a.displayReadyCapability)a.displayReadyCapability.reject(e);else{if(!a.opListReadCapability)throw e;a.opListReadCapability.reject(e)}}}))};o()}_abortOperatorList({intentState:e,reason:t,force:i=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!i){if(e.renderTasks.size>0)return;if(t instanceof _display_utils.RenderingCancelledException){let i=RENDERING_CANCELLED_TIMEOUT;return t.extraDelay>0&&t.extraDelay<1e3&&(i+=t.extraDelay),void(e.streamReaderCancelTimeout=setTimeout((()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:t,force:!0})}),i))}}if(e.streamReader.cancel(new _util.AbortException(t.message)).catch((()=>{})),e.streamReader=null,!this._transport.destroyed){for(const[t,i]of this._intentStates)if(i===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}}exports.PDFPageProxy=PDFPageProxy;class LoopbackPort{#a=new Set;#o=Promise.resolve();postMessage(e,t){const i={data:structuredClone(e,t?{transfer:t}: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};if(exports.PDFWorkerUtil=PDFWorkerUtil,_util.isNodeJS&&"function"==typeof commonjsRequire)PDFWorkerUtil.isWorkerDisabled=!0,PDFWorkerUtil.fallbackWorkerSrc="./pdf.worker.js";else if("object"==typeof document){const e=document?.currentScript?.src;e&&(PDFWorkerUtil.fallbackWorkerSrc=e.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}PDFWorkerUtil.isSameOrigin=function(e,t){let i;try{if(i=new URL(e),!i.origin||"null"===i.origin)return!1}catch{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;constructor({name:e=null,port:t=null,verbosity:i=(0,_util.getVerbosityLevel)()}={}){if(this.name=e,this.destroyed=!1,this.verbosity=i,this._readyCapability=new _util.PromiseCapability,this._port=null,this._webWorker=null,this._messageHandler=null,t){if(PDFWorker.#l?.has(t))throw new Error("Cannot use more than one PDFWorker per port.");return(PDFWorker.#l||=new WeakMap).set(t,this),void this._initializeFromPort(t)}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})}_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(e),i=new _message_handler.MessageHandler("main","worker",t),n=()=>{t.removeEventListener("error",s),i.destroy(),t.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},s=()=>{this._webWorker||n()};t.addEventListener("error",s),i.on("test",(e=>{t.removeEventListener("error",s),this.destroyed?n():e?(this._messageHandler=i,this._port=t,this._webWorker=t,this._readyCapability.resolve(),i.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),i.destroy(),t.terminate())})),i.on("ready",(e=>{if(t.removeEventListener("error",s),this.destroyed)n();else try{r()}catch{this._setupFakeWorker()}}));const r=()=>{const e=new Uint8Array;i.send("test",e,[e.buffer])};return void r()}catch{(0,_util.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){PDFWorkerUtil.isWorkerDisabled||((0,_util.warn)("Setting up fake worker."),PDFWorkerUtil.isWorkerDisabled=!0),PDFWorker._setupFakeWorkerGlobal.then((e=>{if(this.destroyed)return void this._readyCapability.reject(new Error("Worker was destroyed"));const t=new LoopbackPort;this._port=t;const i="fake"+PDFWorkerUtil.fakeWorkerId++,n=new _message_handler.MessageHandler(i+"_worker",i,t);e.setup(n,t);const s=new _message_handler.MessageHandler(i,i+"_worker",t);this._messageHandler=s,this._readyCapability.resolve(),s.send("configure",{verbosity:this.verbosity})})).catch((e=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${e.message}".`))}))}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),PDFWorker.#l?.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(e){if(!e?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");const t=this.#l?.get(e.port);if(t){if(t._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return t}return new PDFWorker(e)}static get workerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(null!==PDFWorkerUtil.fallbackWorkerSrc)return _util.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'),PDFWorkerUtil.fallbackWorkerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _mainThreadWorkerMessageHandler(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){const loader=async()=>{const mainWorkerMessageHandler=this._mainThreadWorkerMessageHandler;if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_util.isNodeJS&&"function"==typeof commonjsRequire){const worker=eval("require")(this.workerSrc);return worker.WorkerMessageHandler}return await(0,_display_utils.loadScript)(this.workerSrc),window.pdfjsWorker.WorkerMessageHandler};return(0,_util.shadow)(this,"_setupFakeWorkerGlobal",loader())}}exports.PDFWorker=PDFWorker;class WorkerTransport{#h=new Map;#c=new Map;#d=new Map;#u=null;constructor(e,t,i,n,s){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=s.canvasFactory,this.filterFactory=s.filterFactory,this.cMapReaderFactory=s.cMapReaderFactory,this.standardFontDataFactory=s.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=new _util.PromiseCapability,this.setupMessageHandler()}#p(e,t=null){const i=this.#h.get(e);if(i)return i;const n=this.messageHandler.sendWithPromise(e,t);return this.#h.set(e,n),n}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}getRenderingIntent(e,t=_util.AnnotationMode.ENABLE,i=null,n=!1){let s=_util.RenderingIntentFlag.DISPLAY,r=_annotation_storage.SerializableEmpty;switch(e){case"any":s=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":s=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${e}`)}switch(t){case _util.AnnotationMode.DISABLE:s+=_util.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case _util.AnnotationMode.ENABLE:break;case _util.AnnotationMode.ENABLE_FORMS:s+=_util.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case _util.AnnotationMode.ENABLE_STORAGE:s+=_util.RenderingIntentFlag.ANNOTATIONS_STORAGE,r=(s&_util.RenderingIntentFlag.PRINT&&i instanceof _annotation_storage.PrintAnnotationStorage?i:this.annotationStorage).serializable;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${t}`)}return n&&(s+=_util.RenderingIntentFlag.OPLIST),{renderingIntent:s,cacheKey:`${s}_${r.hash}`,annotationStorageSerializable:r}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=new _util.PromiseCapability,this.#u?.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const t of this.#c.values())e.push(t._destroy());this.#c.clear(),this.#d.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const t=this.messageHandler.sendWithPromise("Terminate",null);return e.push(t),Promise.all(e).then((()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#h.clear(),this.filterFactory.destroy(),this._networkStream?.cancelAllRequests(new _util.AbortException("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()}),this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:t}=this;e.on("GetReader",((e,t)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=e=>{this._lastProgress={loaded:e.loaded,total:e.total}},t.onPull=()=>{this._fullReader.read().then((function({value:e,done:i}){i?t.close():((0,_util.assert)(e instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),t.enqueue(new Uint8Array(e),1,[e]))})).catch((e=>{t.error(e)}))},t.onCancel=e=>{this._fullReader.cancel(e),t.ready.catch((e=>{if(!this.destroyed)throw e}))}})),e.on("ReaderHeadersReady",(e=>{const i=new _util.PromiseCapability,n=this._fullReader;return n.headersReady.then((()=>{n.isStreamingSupported&&n.isRangeSupported||(this._lastProgress&&t.onProgress?.(this._lastProgress),n.onProgress=e=>{t.onProgress?.({loaded:e.loaded,total:e.total})}),i.resolve({isStreamingSupported:n.isStreamingSupported,isRangeSupported:n.isRangeSupported,contentLength:n.contentLength})}),i.reject),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);i?(t.onPull=()=>{i.read().then((function({value:e,done:i}){i?t.close():((0,_util.assert)(e instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),t.enqueue(new Uint8Array(e),1,[e]))})).catch((e=>{t.error(e)}))},t.onCancel=e=>{i.cancel(e),t.ready.catch((e=>{if(!this.destroyed)throw e}))}):t.close()})),e.on("GetDoc",(({pdfInfo:e})=>{this._numPages=e.numPages,this._htmlForXfa=e.htmlForXfa,delete e.htmlForXfa,t._capability.resolve(new PDFDocumentProxy(e,this))})),e.on("DocException",(function(e){let i;switch(e.name){case"PasswordException":i=new _util.PasswordException(e.message,e.code);break;case"InvalidPDFException":i=new _util.InvalidPDFException(e.message);break;case"MissingPDFException":i=new _util.MissingPDFException(e.message);break;case"UnexpectedResponseException":i=new _util.UnexpectedResponseException(e.message,e.status);break;case"UnknownErrorException":i=new _util.UnknownErrorException(e.message,e.details);break;default:(0,_util.unreachable)("DocException - expected a valid Error.")}t._capability.reject(i)})),e.on("PasswordRequest",(e=>{if(this.#u=new _util.PromiseCapability,t.onPassword){const i=e=>{e instanceof Error?this.#u.reject(e):this.#u.resolve({password:e})};try{t.onPassword(i,e.code)}catch(e){this.#u.reject(e)}}else this.#u.reject(new _util.PasswordException(e.message,e.code));return this.#u.promise})),e.on("DataLoaded",(e=>{t.onProgress?.({loaded:e.length,total:e.length}),this.downloadInfoCapability.resolve(e)})),e.on("StartRenderPage",(e=>{this.destroyed||this.#c.get(e.pageIndex)._startRenderPage(e.transparency,e.cacheKey)})),e.on("commonobj",(([t,i,n])=>{if(!this.destroyed&&!this.commonObjs.has(t))switch(i){case"Font":const s=this._params;if("error"in n){const e=n.error;(0,_util.warn)(`Error during font loading: ${e}`),this.commonObjs.resolve(t,e);break}const r=s.pdfBug&&globalThis.FontInspector?.enabled?(e,t)=>globalThis.FontInspector.fontAdded(e,t):null,a=new _font_loader.FontFaceObject(n,{isEvalSupported:s.isEvalSupported,disableFontFace:s.disableFontFace,ignoreErrors:s.ignoreErrors,inspectFont:r});this.fontLoader.bind(a).catch((i=>e.sendWithPromise("FontFallback",{id:t}))).finally((()=>{!s.fontExtraProperties&&a.data&&(a.data=null),this.commonObjs.resolve(t,a)}));break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(t,n);break;default:throw new Error(`Got unknown common object type ${i}`)}})),e.on("obj",(([e,t,i,n])=>{if(this.destroyed)return;const s=this.#c.get(t);if(!s.objs.has(e))switch(i){case"Image":if(s.objs.resolve(e,n),n){let e;if(n.bitmap){const{width:t,height:i}=n;e=t*i*4}else e=n.data?.length||0;e>_util.MAX_IMAGE_SIZE_TO_CACHE&&(s._maybeCleanupAfterRender=!0)}break;case"Pattern":s.objs.resolve(e,n);break;default:throw new Error(`Got unknown object type ${i}`)}})),e.on("DocProgress",(e=>{this.destroyed||t.onProgress?.({loaded:e.loaded,total:e.total})})),e.on("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(){this.annotationStorage.size<=0&&(0,_util.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfers:t}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:this._fullReader?.filename??null},t).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.#d.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);return this.#c.set(t,i),i}));return this.#d.set(t,n),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)}getDocJSActions(){return this.#p("GetDocJSActions")}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.#h.get(e);if(t)return t;const i=this.messageHandler.sendWithPromise(e,null).then((e=>({info:e[0],metadata:e[1]?new _metadata.Metadata(e[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null})));return this.#h.set(e,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const e of this.#c.values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),this.#h.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){return this.#g[e]||={capability:new _util.PromiseCapability,data:null}}get(e,t=null){if(t){const i=this.#f(e);return i.capability.promise.then((()=>t(i.data))),null}const i=this.#g[e];if(!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 t?.capability.settled||!1}resolve(e,t=null){const i=this.#f(e);i.data=t,i.capability.resolve()}clear(){for(const e in this.#g){const{data:t}=this.#g[e];t?.bitmap?.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(e=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&&t?.size>0}}exports.RenderTask=RenderTask;class InternalRenderTask{static#_=new WeakSet;constructor({callback:e,params:t,objs:i,commonObjs:n,annotationCanvasMap:s,operatorList:r,pageIndex:a,canvasFactory:o,filterFactory:l,useRequestAnimationFrame:h=!1,pdfBug:c=!1,pageColors:d=null}){this.callback=e,this.params=t,this.objs=i,this.commonObjs=n,this.annotationCanvasMap=s,this.operatorListIdx=null,this.operatorList=r,this._pageIndex=a,this.canvasFactory=o,this.filterFactory=l,this._pdfBug=c,this.pageColors=d,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===h&&"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=t.canvasContext.canvas}get completed(){return this.capability.promise.catch((function(){}))}initializeGraphics({transparency:e=!1,optionalContentConfig:t}){if(this.cancelled)return;if(this._canvas){if(InternalRenderTask.#_.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.#_.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:i,viewport:n,transform:s,background:r}=this.params;this.gfx=new _canvas.CanvasGraphics(i,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:t},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:s,viewport:n,transparency:e,background:r}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(e=null,t=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),InternalRenderTask.#_.delete(this._canvas),this.callback(e||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,t))}operatorListChanged(){this.graphicsReady?(this.stepper?.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||=this._continueBound}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?window.requestAnimationFrame((()=>{this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),InternalRenderTask.#_.delete(this._canvas),this.callback())))}}const version="3.11.174";exports.version=version;const build="ce8716743";exports.build=build},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SerializableEmpty=t.PrintAnnotationStorage=t.AnnotationStorage=void 0;var n=i(1),s=i(4),r=i(8);const a=Object.freeze({map:null,hash:"",transfers:void 0});t.SerializableEmpty=a;class o{#v=!1;#b=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,t){const i=this.#b.get(e);return void 0===i?t:Object.assign(t,i)}getRawValue(e){return this.#b.get(e)}remove(e){if(this.#b.delete(e),0===this.#b.size&&this.resetModified(),"function"==typeof this.onAnnotationEditor){for(const e of this.#b.values())if(e instanceof s.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(e,t){const i=this.#b.get(e);let n=!1;if(void 0!==i)for(const[e,s]of Object.entries(t))i[e]!==s&&(n=!0,i[e]=s);else n=!0,this.#b.set(e,t);n&&this.#y(),t instanceof s.AnnotationEditor&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(t.constructor._type)}has(e){return this.#b.has(e)}getAll(){return this.#b.size>0?(0,n.objectFromMap)(this.#b):null}setAll(e){for(const[t,i]of Object.entries(e))this.setValue(t,i)}get size(){return this.#b.size}#y(){this.#v||(this.#v=!0,"function"==typeof this.onSetModified&&this.onSetModified())}resetModified(){this.#v&&(this.#v=!1,"function"==typeof this.onResetModified&&this.onResetModified())}get print(){return new l(this)}get serializable(){if(0===this.#b.size)return a;const e=new Map,t=new r.MurmurHash3_64,i=[],n=Object.create(null);let o=!1;for(const[i,r]of this.#b){const a=r instanceof s.AnnotationEditor?r.serialize(!1,n):r;a&&(e.set(i,a),t.update(`${i}:${JSON.stringify(a)}`),o||=!!a.bitmap)}if(o)for(const t of e.values())t.bitmap&&i.push(t.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfers:i}:a}}t.AnnotationStorage=o;class l extends o{#S;constructor(e){super();const{map:t,hash:i,transfers:n}=e.serializable,s=structuredClone(t,n?{transfer:n}:null);this.#S={map:s,hash:i,transfers:n}}get print(){(0,n.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#S}}t.PrintAnnotationStorage=l},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationEditor=void 0;var n=i(5),s=i(1),r=i(6);class a{#P="";#A=!1;#w=null;#E=null;#x=null;#C=!1;#M=null;#T=this.focusin.bind(this);#D=this.focusout.bind(this);#F=!1;#k=!1;#L=!1;_initialOptions=Object.create(null);_uiManager=null;_focusEventsAllowed=!0;_l10nPromise=null;#R=!1;#I=a._zIndex++;static _borderLineWidth=-1;static _colorManager=new n.ColorManager;static _zIndex=1;static SMALL_EDITOR_SIZE=0;constructor(e){this.constructor===a&&(0,s.unreachable)("Cannot initialize AnnotationEditor."),this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null;const{rotation:t,rawDims:{pageWidth:i,pageHeight:n,pageX:r,pageY:o}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,n],this.pageTranslation=[r,o];const[l,h]=this.parentDimensions;this.x=e.x/l,this.y=e.y/h,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return(0,s.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const t=new o({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(e,t=null){if(a._l10nPromise||=new Map(["editor_alt_text_button_label","editor_alt_text_edit_button_label","editor_alt_text_decorative_tooltip"].map((t=>[t,e.get(t)]))),t?.strings)for(const i of t.strings)a._l10nPromise.set(i,e.get(i));if(-1!==a._borderLineWidth)return;const i=getComputedStyle(document.documentElement);a._borderLineWidth=parseFloat(i.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){(0,s.unreachable)("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#R}set _isDraggable(e){this.#R=e,this.div?.classList.toggle("draggable",e)}center(){const[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(2*e),this.y+=this.width*e/(2*t);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(2*e),this.y-=this.width*e/(2*t);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#I}setParent(e){null!==e&&(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions),this.parent=e}focusin(e){this._focusEventsAllowed&&(this.#F?this.#F=!1:this.parent.setSelected(this))}focusout(e){if(!this._focusEventsAllowed)return;if(!this.isAttachedToDOM)return;const t=e.relatedTarget;t?.closest(`#${this.id}`)||(e.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,i,n){const[s,r]=this.parentDimensions;[i,n]=this.screenToPageTranslation(i,n),this.x=(e+i)/s,this.y=(t+n)/r,this.fixAndSetPosition()}#O([e,t],i,n){[i,n]=this.screenToPageTranslation(i,n),this.x+=i/e,this.y+=n/t,this.fixAndSetPosition()}translate(e,t){this.#O(this.parentDimensions,e,t)}translateInPage(e,t){this.#O(this.pageDimensions,e,t),this.div.scrollIntoView({block:"nearest"})}drag(e,t){const[i,n]=this.parentDimensions;if(this.x+=e/i,this.y+=t/n,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:e,y:t}=this.div.getBoundingClientRect();this.parent.findNewParent(this,e,t)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:s,y:r}=this;const[a,o]=this.#N();s+=a,r+=o,this.div.style.left=`${(100*s).toFixed(2)}%`,this.div.style.top=`${(100*r).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}#N(){const[e,t]=this.parentDimensions,{_borderLineWidth:i}=a,n=i/e,s=i/t;switch(this.rotation){case 90:return[-n,s];case 180:return[n,s];case 270:return[n,-s];default:return[-n,-s]}}fixAndSetPosition(){const[e,t]=this.pageDimensions;let{x:i,y:n,width:s,height:r}=this;switch(s*=e,r*=t,i*=e,n*=t,this.rotation){case 0:i=Math.max(0,Math.min(e-s,i)),n=Math.max(0,Math.min(t-r,n));break;case 90:i=Math.max(0,Math.min(e-r,i)),n=Math.min(t,Math.max(s,n));break;case 180:i=Math.min(e,Math.max(s,i)),n=Math.min(t,Math.max(r,n));break;case 270:i=Math.min(e,Math.max(r,i)),n=Math.max(0,Math.min(t-s,n))}this.x=i/=e,this.y=n/=t;const[a,o]=this.#N();i+=a,n+=o;const{style:l}=this.div;l.left=`${(100*i).toFixed(2)}%`,l.top=`${(100*n).toFixed(2)}%`,this.moveInDOM()}static#B(e,t,i){switch(i){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}}screenToPageTranslation(e,t){return a.#B(e,t,this.parentRotation)}pageTranslationToScreen(e,t){return a.#B(e,t,360-this.parentRotation)}#V(e){switch(e){case 90:{const[e,t]=this.pageDimensions;return[0,-e/t,t/e,0]}case 180:return[-1,0,0,-1];case 270:{const[e,t]=this.pageDimensions;return[0,e/t,-t/e,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:e,pageDimensions:[t,i]}=this,n=t*e,r=i*e;return s.FeatureTest.isCSSRoundSupported?[Math.round(n),Math.round(r)]:[n,r]}setDims(e,t){const[i,n]=this.parentDimensions;this.div.style.width=`${(100*e/i).toFixed(2)}%`,this.#C||(this.div.style.height=`${(100*t/n).toFixed(2)}%`),this.#w?.classList.toggle("small",e<a.SMALL_EDITOR_SIZE||t<a.SMALL_EDITOR_SIZE)}fixDims(){const{style:e}=this.div,{height:t,width:i}=e,n=i.endsWith("%"),s=!this.#C&&t.endsWith("%");if(n&&s)return;const[r,a]=this.parentDimensions;n||(e.width=`${(100*parseFloat(i)/r).toFixed(2)}%`),this.#C||s||(e.height=`${(100*parseFloat(t)/a).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#U(){if(this.#M)return;this.#M=document.createElement("div"),this.#M.classList.add("resizers");const e=["topLeft","topRight","bottomRight","bottomLeft"];this._willKeepAspectRatio||e.push("topMiddle","middleRight","bottomMiddle","middleLeft");for(const t of e){const e=document.createElement("div");this.#M.append(e),e.classList.add("resizer",t),e.addEventListener("pointerdown",this.#j.bind(this,t)),e.addEventListener("contextmenu",r.noContextMenu)}this.div.prepend(this.#M)}#j(e,t){t.preventDefault();const{isMac:i}=s.FeatureTest.platform;if(0!==t.button||t.ctrlKey&&i)return;const n=this.#H.bind(this,e),r=this._isDraggable;this._isDraggable=!1;const a={passive:!0,capture:!0};window.addEventListener("pointermove",n,a);const o=this.x,l=this.y,h=this.width,c=this.height,d=this.parent.div.style.cursor,u=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;const p=()=>{this._isDraggable=r,window.removeEventListener("pointerup",p),window.removeEventListener("blur",p),window.removeEventListener("pointermove",n,a),this.parent.div.style.cursor=d,this.div.style.cursor=u;const e=this.x,t=this.y,i=this.width,s=this.height;e===o&&t===l&&i===h&&s===c||this.addCommands({cmd:()=>{this.width=i,this.height=s,this.x=e,this.y=t;const[n,r]=this.parentDimensions;this.setDims(n*i,r*s),this.fixAndSetPosition()},undo:()=>{this.width=h,this.height=c,this.x=o,this.y=l;const[e,t]=this.parentDimensions;this.setDims(e*h,t*c),this.fixAndSetPosition()},mustExec:!0})};window.addEventListener("pointerup",p),window.addEventListener("blur",p)}#H(e,t){const[i,n]=this.parentDimensions,s=this.x,r=this.y,o=this.width,l=this.height,h=a.MIN_SIZE/i,c=a.MIN_SIZE/n,d=e=>Math.round(1e4*e)/1e4,u=this.#V(this.rotation),p=(e,t)=>[u[0]*e+u[2]*t,u[1]*e+u[3]*t],g=this.#V(360-this.rotation);let f,m,_=!1,v=!1;switch(e){case"topLeft":_=!0,f=(e,t)=>[0,0],m=(e,t)=>[e,t];break;case"topMiddle":f=(e,t)=>[e/2,0],m=(e,t)=>[e/2,t];break;case"topRight":_=!0,f=(e,t)=>[e,0],m=(e,t)=>[0,t];break;case"middleRight":v=!0,f=(e,t)=>[e,t/2],m=(e,t)=>[0,t/2];break;case"bottomRight":_=!0,f=(e,t)=>[e,t],m=(e,t)=>[0,0];break;case"bottomMiddle":f=(e,t)=>[e/2,t],m=(e,t)=>[e/2,0];break;case"bottomLeft":_=!0,f=(e,t)=>[0,t],m=(e,t)=>[e,0];break;case"middleLeft":v=!0,f=(e,t)=>[0,t/2],m=(e,t)=>[e,t/2]}const b=f(o,l),y=m(o,l);let S=p(...y);const P=d(s+S[0]),A=d(r+S[1]);let w=1,E=1,[x,C]=this.screenToPageTranslation(t.movementX,t.movementY);var M,T;if([x,C]=(M=x/i,T=C/n,[g[0]*M+g[2]*T,g[1]*M+g[3]*T]),_){const e=Math.hypot(o,l);w=E=Math.max(Math.min(Math.hypot(y[0]-b[0]-x,y[1]-b[1]-C)/e,1/o,1/l),h/o,c/l)}else v?w=Math.max(h,Math.min(1,Math.abs(y[0]-b[0]-x)))/o:E=Math.max(c,Math.min(1,Math.abs(y[1]-b[1]-C)))/l;const D=d(o*w),F=d(l*E);S=p(...m(D,F));const k=P-S[0],L=A-S[1];this.width=D,this.height=F,this.x=k,this.y=L,this.setDims(i*D,n*F),this.fixAndSetPosition()}async addAltTextButton(){if(this.#w)return;const e=this.#w=document.createElement("button");e.className="altText";const t=await a._l10nPromise.get("editor_alt_text_button_label");if(e.textContent=t,e.setAttribute("aria-label",t),e.tabIndex="0",e.addEventListener("contextmenu",r.noContextMenu),e.addEventListener("pointerdown",(e=>e.stopPropagation())),e.addEventListener("click",(e=>{e.preventDefault(),this._uiManager.editAltText(this)}),{capture:!0}),e.addEventListener("keydown",(t=>{t.target===e&&"Enter"===t.key&&(t.preventDefault(),this._uiManager.editAltText(this))})),this.#W(),this.div.append(e),!a.SMALL_EDITOR_SIZE){const t=40;a.SMALL_EDITOR_SIZE=Math.min(128,Math.round(e.getBoundingClientRect().width*(1+t/100)))}}async#W(){const e=this.#w;if(!e)return;if(!this.#P&&!this.#A)return e.classList.remove("done"),void this.#E?.remove();a._l10nPromise.get("editor_alt_text_edit_button_label").then((t=>{e.setAttribute("aria-label",t)}));let t=this.#E;if(!t){this.#E=t=document.createElement("span"),t.className="tooltip",t.setAttribute("role","tooltip");const i=t.id=`alt-text-tooltip-${this.id}`;e.setAttribute("aria-describedby",i);const n=100;e.addEventListener("mouseenter",(()=>{this.#x=setTimeout((()=>{this.#x=null,this.#E.classList.add("show"),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",subtype:this.editorType,data:{action:"alt_text_tooltip"}}})}),n)})),e.addEventListener("mouseleave",(()=>{clearTimeout(this.#x),this.#x=null,this.#E?.classList.remove("show")}))}e.classList.add("done"),t.innerText=this.#A?await a._l10nPromise.get("editor_alt_text_decorative_tooltip"):this.#P,t.parentNode||e.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}get altTextData(){return{altText:this.#P,decorative:this.#A}}set altTextData({altText:e,decorative:t}){this.#P===e&&this.#A===t||(this.#P=e,this.#A=t,this.#W())}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.#T),this.div.addEventListener("focusout",this.#D);const[e,t]=this.parentDimensions;this.parentRotation%180!=0&&(this.div.style.maxWidth=`${(100*t/e).toFixed(2)}%`,this.div.style.maxHeight=`${(100*e/t).toFixed(2)}%`);const[i,s]=this.getInitialTranslation();return this.translate(i,s),(0,n.bindEvents)(this,this.div,["pointerdown"]),this.div}pointerdown(e){const{isMac:t}=s.FeatureTest.platform;0!==e.button||e.ctrlKey&&t?e.preventDefault():(this.#F=!0,this.#z(e))}#z(e){if(!this._isDraggable)return;const t=this._uiManager.isSelected(this);let i,n;this._uiManager.setUpDragSession(),t&&(i={passive:!0,capture:!0},n=e=>{const[t,i]=this.screenToPageTranslation(e.movementX,e.movementY);this._uiManager.dragSelectedEditors(t,i)},window.addEventListener("pointermove",n,i));const r=()=>{if(window.removeEventListener("pointerup",r),window.removeEventListener("blur",r),t&&window.removeEventListener("pointermove",n,i),this.#F=!1,!this._uiManager.endDragSession()){const{isMac:t}=s.FeatureTest.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)}};window.addEventListener("pointerup",r),window.addEventListener("blur",r)}moveInDOM(){this.parent?.moveEditorInDOM(this)}_setParentAndPosition(e,t,i){e.changeParent(this),this.x=t,this.y=i,this.fixAndSetPosition()}getRect(e,t){const i=this.parentScale,[n,s]=this.pageDimensions,[r,a]=this.pageTranslation,o=e/i,l=t/i,h=this.x*n,c=this.y*s,d=this.width*n,u=this.height*s;switch(this.rotation){case 0:return[h+o+r,s-c-l-u+a,h+o+d+r,s-c-l+a];case 90:return[h+l+r,s-c+o+a,h+l+u+r,s-c+o+d+a];case 180:return[h-o-d+r,s-c+l+a,h-o+r,s-c+l+u+a];case 270:return[h-l-u+r,s-c-o-d+a,h-l+r,s-c-o+a];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,t){const[i,n,s,r]=e,a=s-i,o=r-n;switch(this.rotation){case 0:return[i,t-r,a,o];case 90:return[i,t-n,o,a];case 180:return[s,t-n,a,o];case 270:return[s,t-r,o,a];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#L=!0}disableEditMode(){this.#L=!1}isInEditMode(){return this.#L}shouldGetKeyboardEvents(){return!1}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){this.div?.addEventListener("focusin",this.#T),this.div?.addEventListener("focusout",this.#D)}serialize(e=!1,t=null){(0,s.unreachable)("An editor must be serializable")}static deserialize(e,t,i){const n=new this.prototype.constructor({parent:t,id:t.getNextId(),uiManager:i});n.rotation=e.rotation;const[s,r]=n.pageDimensions,[a,o,l,h]=n.getRectInCurrentCoords(e.rect,r);return n.x=a/s,n.y=o/r,n.width=l/s,n.height=h/r,n}remove(){this.div.removeEventListener("focusin",this.#T),this.div.removeEventListener("focusout",this.#D),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#w?.remove(),this.#w=null,this.#E=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#U(),this.#M.classList.remove("hidden"))}select(){this.makeResizable(),this.div?.classList.add("selectedEditor")}unselect(){this.#M?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus()}updateParams(e,t){}disableEditing(){this.#w&&(this.#w.hidden=!0)}enableEditing(){this.#w&&(this.#w.hidden=!1)}enterInEditMode(){}get contentDiv(){return this.div}get isEditing(){return this.#k}set isEditing(e){this.#k=e,this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(e,t){this.#C=!0;const i=e/t,{style:n}=this.div;n.aspectRatio=i,n.height="auto"}static get MIN_SIZE(){return 16}}t.AnnotationEditor=a;class o extends a{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.KeyboardManager=t.CommandManager=t.ColorManager=t.AnnotationEditorUIManager=void 0,t.bindEvents=function(e,t,i){for(const n of i)t.addEventListener(n,e[n].bind(e))},t.opacityToHex=function(e){return Math.round(Math.min(255,Math.max(1,255*e))).toString(16).padStart(2,"0")};var n=i(1),s=i(6);class r{#G=0;getId(){return`${n.AnnotationEditorPrefix}${this.#G++}`}}class a{#$=(0,n.getUuid)();#G=0;#q=null;static get _isSVGFittingCanvas(){const e=new OffscreenCanvas(1,3).getContext("2d"),t=new Image;t.src='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>';const i=t.decode().then((()=>(e.drawImage(t,0,0,1,1,0,0,1,3),0===new Uint32Array(e.getImageData(0,0,1,1).data.buffer)[0])));return(0,n.shadow)(this,"_isSVGFittingCanvas",i)}async#X(e,t){this.#q||=new Map;let i=this.#q.get(e);if(null===i)return null;if(i?.bitmap)return i.refCounter+=1,i;try{let e;if(i||={bitmap:null,id:`image_${this.#$}_${this.#G++}`,refCounter:0,isSvg:!1},"string"==typeof t){i.url=t;const n=await fetch(t);if(!n.ok)throw new Error(n.statusText);e=await n.blob()}else e=i.file=t;if("image/svg+xml"===e.type){const t=a._isSVGFittingCanvas,n=new FileReader,s=new Image,r=new Promise(((e,r)=>{s.onload=()=>{i.bitmap=s,i.isSvg=!0,e()},n.onload=async()=>{const e=i.svgUrl=n.result;s.src=await t?`${e}#svgView(preserveAspectRatio(none))`:e},s.onerror=n.onerror=r}));n.readAsDataURL(e),await r}else i.bitmap=await createImageBitmap(e);i.refCounter=1}catch(e){console.error(e),i=null}return this.#q.set(e,i),i&&this.#q.set(i.id,i),i}async getFromFile(e){const{lastModified:t,name:i,size:n,type:s}=e;return this.#X(`${t}_${i}_${n}_${s}`,e)}async getFromUrl(e){return this.#X(e,e)}async getFromId(e){this.#q||=new Map;const t=this.#q.get(e);return t?t.bitmap?(t.refCounter+=1,t):t.file?this.getFromFile(t.file):this.getFromUrl(t.url):null}getSvgUrl(e){const t=this.#q.get(e);return t?.isSvg?t.svgUrl:null}deleteId(e){this.#q||=new Map;const t=this.#q.get(e);t&&(t.refCounter-=1,0===t.refCounter&&(t.bitmap=null))}isValidId(e){return e.startsWith(`image_${this.#$}_`)}}class o{#K=[];#Y=!1;#Q;#J=-1;constructor(e=128){this.#Q=e}add({cmd:e,undo:t,mustExec:i,type:n=NaN,overwriteIfSameType:s=!1,keepUndo:r=!1}){if(i&&e(),this.#Y)return;const a={cmd:e,undo:t,type:n};if(-1===this.#J)return this.#K.length>0&&(this.#K.length=0),this.#J=0,void this.#K.push(a);if(s&&this.#K[this.#J].type===n)return r&&(a.undo=this.#K[this.#J].undo),void(this.#K[this.#J]=a);const o=this.#J+1;o===this.#Q?this.#K.splice(0,1):(this.#J=o,o<this.#K.length&&this.#K.splice(o)),this.#K.push(a)}undo(){-1!==this.#J&&(this.#Y=!0,this.#K[this.#J].undo(),this.#Y=!1,this.#J-=1)}redo(){this.#J<this.#K.length-1&&(this.#J+=1,this.#Y=!0,this.#K[this.#J].cmd(),this.#Y=!1)}hasSomethingToUndo(){return-1!==this.#J}hasSomethingToRedo(){return this.#J<this.#K.length-1}destroy(){this.#K=null}}t.CommandManager=o;class l{constructor(e){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:t}=n.FeatureTest.platform;for(const[i,n,s={}]of e)for(const e of i){const i=e.startsWith("mac+");t&&i?(this.callbacks.set(e.slice(4),{callback:n,options:s}),this.allKeys.add(e.split("+").at(-1))):t||i||(this.callbacks.set(e,{callback:n,options:s}),this.allKeys.add(e.split("+").at(-1)))}}#Z(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("+");return this.buffer.length=0,t}exec(e,t){if(!this.allKeys.has(t.key))return;const i=this.callbacks.get(this.#Z(t));if(!i)return;const{callback:n,options:{bubbles:s=!1,args:r=[],checker:a=null}}=i;a&&!a(e,t)||(n.bind(e,...r)(),s||(t.stopPropagation(),t.preventDefault()))}}t.KeyboardManager=l;class h{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return(0,s.getColorValues)(e),(0,n.shadow)(this,"_colors",e)}convert(e){const t=(0,s.getRGB)(e);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[e,i]of this._colors)if(i.every(((e,i)=>e===t[i])))return h._colorsMapping.get(e);return t}getHexCode(e){const t=this._colors.get(e);return t?n.Util.makeHexColor(...t):e}}t.ColorManager=h;class c{#ee=null;#te=new Map;#ie=new Map;#ne=null;#se=null;#re=new o;#ae=0;#oe=new Set;#le=null;#he=null;#ce=new Set;#de=null;#ue=new r;#pe=!1;#ge=!1;#fe=null;#me=n.AnnotationEditorType.NONE;#_e=new Set;#ve=null;#be=this.blur.bind(this);#ye=this.focus.bind(this);#Se=this.copy.bind(this);#Pe=this.cut.bind(this);#Ae=this.paste.bind(this);#we=this.keydown.bind(this);#Ee=this.onEditingAction.bind(this);#xe=this.onPageChanging.bind(this);#Ce=this.onScaleChanging.bind(this);#Me=this.onRotationChanging.bind(this);#Te={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1};#De=[0,0];#Fe=null;#ke=null;#Le=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const e=c.prototype,t=e=>{const{activeElement:t}=document;return t&&e.#ke.contains(t)&&e.hasSomethingToControl()},i=this.TRANSLATE_SMALL,s=this.TRANSLATE_BIG;return(0,n.shadow)(this,"_keyboardManager",new l([[["ctrl+a","mac+meta+a"],e.selectAll],[["ctrl+z","mac+meta+z"],e.undo],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-i,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-s,0],checker:t}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[i,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[s,0],checker:t}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-i],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-s],checker:t}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,i],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,s],checker:t}]]))}constructor(e,t,i,n,r,a){this.#ke=e,this.#Le=t,this.#ne=i,this._eventBus=n,this._eventBus._on("editingaction",this.#Ee),this._eventBus._on("pagechanging",this.#xe),this._eventBus._on("scalechanging",this.#Ce),this._eventBus._on("rotationchanging",this.#Me),this.#se=r.annotationStorage,this.#de=r.filterFactory,this.#ve=a,this.viewParameters={realScale:s.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0}}destroy(){this.#Re(),this.#Ie(),this._eventBus._off("editingaction",this.#Ee),this._eventBus._off("pagechanging",this.#xe),this._eventBus._off("scalechanging",this.#Ce),this._eventBus._off("rotationchanging",this.#Me);for(const e of this.#ie.values())e.destroy();this.#ie.clear(),this.#te.clear(),this.#ce.clear(),this.#ee=null,this.#_e.clear(),this.#re.destroy(),this.#ne.destroy()}get hcmFilter(){return(0,n.shadow)(this,"hcmFilter",this.#ve?this.#de.addHCMFilter(this.#ve.foreground,this.#ve.background):"none")}get direction(){return(0,n.shadow)(this,"direction",getComputedStyle(this.#ke).direction)}editAltText(e){this.#ne?.editAltText(this,e)}onPageChanging({pageNumber:e}){this.#ae=e-1}focusMainContainer(){this.#ke.focus()}findParent(e,t){for(const i of this.#ie.values()){const{x:n,y:s,width:r,height:a}=i.div.getBoundingClientRect();if(e>=n&&e<=n+r&&t>=s&&t<=s+a)return i}return null}disableUserSelect(e=!1){this.#Le.classList.toggle("noUserSelect",e)}addShouldRescale(e){this.#ce.add(e)}removeShouldRescale(e){this.#ce.delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*s.PixelsPerInch.PDF_TO_CSS_UNITS;for(const e of this.#ce)e.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}addToAnnotationStorage(e){e.isEmpty()||!this.#se||this.#se.has(e.id)||this.#se.setValue(e.id,e)}#Oe(){window.addEventListener("focus",this.#ye),window.addEventListener("blur",this.#be)}#Ie(){window.removeEventListener("focus",this.#ye),window.removeEventListener("blur",this.#be)}blur(){if(!this.hasSelection)return;const{activeElement:e}=document;for(const t of this.#_e)if(t.div.contains(e)){this.#fe=[t,e],t._focusEventsAllowed=!1;break}}focus(){if(!this.#fe)return;const[e,t]=this.#fe;this.#fe=null,t.addEventListener("focusin",(()=>{e._focusEventsAllowed=!0}),{once:!0}),t.focus()}#Ne(){window.addEventListener("keydown",this.#we,{capture:!0})}#Re(){window.removeEventListener("keydown",this.#we,{capture:!0})}#Be(){document.addEventListener("copy",this.#Se),document.addEventListener("cut",this.#Pe),document.addEventListener("paste",this.#Ae)}#Ve(){document.removeEventListener("copy",this.#Se),document.removeEventListener("cut",this.#Pe),document.removeEventListener("paste",this.#Ae)}addEditListeners(){this.#Ne(),this.#Be()}removeEditListeners(){this.#Re(),this.#Ve()}copy(e){if(e.preventDefault(),this.#ee?.commitOrRemove(),!this.hasSelection)return;const t=[];for(const e of this.#_e){const i=e.serialize(!0);i&&t.push(i)}0!==t.length&&e.clipboardData.setData("application/pdfjs",JSON.stringify(t))}cut(e){this.copy(e),this.delete()}paste(e){e.preventDefault();const{clipboardData:t}=e;for(const e of t.items)for(const t of this.#he)if(t.isHandlingMimeForPasting(e.type))return void t.paste(e,this.currentLayer);let i=t.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(e){return void(0,n.warn)(`paste: "${e.message}".`)}if(!Array.isArray(i))return;this.unselectAll();const s=this.currentLayer;try{const e=[];for(const t of i){const i=s.deserialize(t);if(!i)return;e.push(i)}const t=()=>{for(const t of e)this.#Ue(t);this.#je(e)},n=()=>{for(const t of e)t.remove()};this.addCommands({cmd:t,undo:n,mustExec:!0})}catch(e){(0,n.warn)(`paste: "${e.message}".`)}}keydown(e){this.getActive()?.shouldGetKeyboardEvents()||c._keyboardManager.exec(this,e)}onEditingAction(e){["undo","redo","delete","selectAll"].includes(e.name)&&this[e.name]()}#He(e){Object.entries(e).some((([e,t])=>this.#Te[e]!==t))&&this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#Te,e)})}#We(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})}setEditingState(e){e?(this.#Oe(),this.#Ne(),this.#Be(),this.#He({isEditing:this.#me!==n.AnnotationEditorType.NONE,isEmpty:this.#ze(),hasSomethingToUndo:this.#re.hasSomethingToUndo(),hasSomethingToRedo:this.#re.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#Ie(),this.#Re(),this.#Ve(),this.#He({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!this.#he){this.#he=e;for(const e of this.#he)this.#We(e.defaultPropertiesToUpdate)}}getId(){return this.#ue.getId()}get currentLayer(){return this.#ie.get(this.#ae)}getLayer(e){return this.#ie.get(e)}get currentPageIndex(){return this.#ae}addLayer(e){this.#ie.set(e.pageIndex,e),this.#pe?e.enable():e.disable()}removeLayer(e){this.#ie.delete(e.pageIndex)}updateMode(e,t=null){if(this.#me!==e){if(this.#me=e,e===n.AnnotationEditorType.NONE)return this.setEditingState(!1),void this.#Ge();this.setEditingState(!0),this.#$e(),this.unselectAll();for(const t of this.#ie.values())t.updateMode(e);if(t)for(const e of this.#te.values())if(e.annotationElementId===t){this.setSelected(e),e.enterInEditMode();break}}}updateToolbar(e){e!==this.#me&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:e})}updateParams(e,t){if(this.#he)if(e!==n.AnnotationEditorParamsType.CREATE){for(const i of this.#_e)i.updateParams(e,t);for(const i of this.#he)i.updateDefaultParams(e,t)}else this.currentLayer.addNewEditor(e)}enableWaiting(e=!1){if(this.#ge!==e){this.#ge=e;for(const t of this.#ie.values())e?t.disableClick():t.enableClick(),t.div.classList.toggle("waiting",e)}}#$e(){if(!this.#pe){this.#pe=!0;for(const e of this.#ie.values())e.enable()}}#Ge(){if(this.unselectAll(),this.#pe){this.#pe=!1;for(const e of this.#ie.values())e.disable()}}getEditors(e){const t=[];for(const i of this.#te.values())i.pageIndex===e&&t.push(i);return t}getEditor(e){return this.#te.get(e)}addEditor(e){this.#te.set(e.id,e)}removeEditor(e){this.#te.delete(e.id),this.unselect(e),e.annotationElementId&&this.#oe.has(e.annotationElementId)||this.#se?.remove(e.id)}addDeletedAnnotationElement(e){this.#oe.add(e.annotationElementId),e.deleted=!0}isDeletedAnnotationElement(e){return this.#oe.has(e)}removeDeletedAnnotationElement(e){this.#oe.delete(e.annotationElementId),e.deleted=!1}#Ue(e){const t=this.#ie.get(e.pageIndex);t?t.addOrRebuild(e):this.addEditor(e)}setActiveEditor(e){this.#ee!==e&&(this.#ee=e,e&&this.#We(e.propertiesToUpdate))}toggleSelected(e){if(this.#_e.has(e))return this.#_e.delete(e),e.unselect(),void this.#He({hasSelectedEditor:this.hasSelection});this.#_e.add(e),e.select(),this.#We(e.propertiesToUpdate),this.#He({hasSelectedEditor:!0})}setSelected(e){for(const t of this.#_e)t!==e&&t.unselect();this.#_e.clear(),this.#_e.add(e),e.select(),this.#We(e.propertiesToUpdate),this.#He({hasSelectedEditor:!0})}isSelected(e){return this.#_e.has(e)}unselect(e){e.unselect(),this.#_e.delete(e),this.#He({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#_e.size}undo(){this.#re.undo(),this.#He({hasSomethingToUndo:this.#re.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#ze()})}redo(){this.#re.redo(),this.#He({hasSomethingToUndo:!0,hasSomethingToRedo:this.#re.hasSomethingToRedo(),isEmpty:this.#ze()})}addCommands(e){this.#re.add(e),this.#He({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#ze()})}#ze(){if(0===this.#te.size)return!0;if(1===this.#te.size)for(const e of this.#te.values())return e.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const e=[...this.#_e];this.addCommands({cmd:()=>{for(const t of e)t.remove()},undo:()=>{for(const t of e)this.#Ue(t)},mustExec:!0})}commitOrRemove(){this.#ee?.commitOrRemove()}hasSomethingToControl(){return this.#ee||this.hasSelection}#je(e){this.#_e.clear();for(const t of e)t.isEmpty()||(this.#_e.add(t),t.select());this.#He({hasSelectedEditor:!0})}selectAll(){for(const e of this.#_e)e.commit();this.#je(this.#te.values())}unselectAll(){if(this.#ee)this.#ee.commitOrRemove();else if(this.hasSelection){for(const e of this.#_e)e.unselect();this.#_e.clear(),this.#He({hasSelectedEditor:!1})}}translateSelectedEditors(e,t,i=!1){if(i||this.commitOrRemove(),!this.hasSelection)return;this.#De[0]+=e,this.#De[1]+=t;const[n,s]=this.#De,r=[...this.#_e];this.#Fe&&clearTimeout(this.#Fe),this.#Fe=setTimeout((()=>{this.#Fe=null,this.#De[0]=this.#De[1]=0,this.addCommands({cmd:()=>{for(const e of r)this.#te.has(e.id)&&e.translateInPage(n,s)},undo:()=>{for(const e of r)this.#te.has(e.id)&&e.translateInPage(-n,-s)},mustExec:!1})}),1e3);for(const i of r)i.translateInPage(e,t)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#le=new Map;for(const e of this.#_e)this.#le.set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#le)return!1;this.disableUserSelect(!1);const e=this.#le;this.#le=null;let t=!1;for(const[{x:i,y:n,pageIndex:s},r]of e)r.newX=i,r.newY=n,r.newPageIndex=s,t||=i!==r.savedX||n!==r.savedY||s!==r.savedPageIndex;if(!t)return!1;const i=(e,t,i,n)=>{if(this.#te.has(e.id)){const s=this.#ie.get(n);s?e._setParentAndPosition(s,t,i):(e.pageIndex=n,e.x=t,e.y=i)}};return this.addCommands({cmd:()=>{for(const[t,{newX:n,newY:s,newPageIndex:r}]of e)i(t,n,s,r)},undo:()=>{for(const[t,{savedX:n,savedY:s,savedPageIndex:r}]of e)i(t,n,s,r)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(this.#le)for(const i of this.#le.keys())i.drag(e,t)}rebuild(e){if(null===e.parent){const t=this.getLayer(e.pageIndex);t?(t.changeParent(e),t.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}isActive(e){return this.#ee===e}getActive(){return this.#ee}getMode(){return this.#me}get imageManager(){return(0,n.shadow)(this,"imageManager",new a)}}t.AnnotationEditorUIManager=c},(e,t,i)=>{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=void 0,t.deprecated=function(e){console.log("Deprecated API usage: "+e)},t.getColorValues=function(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,v(n))}t.remove()},t.getCurrentTransform=function(e){const{a:t,b:i,c:n,d:s,e:r,f:a}=e.getTransform();return[t,i,n,s,r,a]},t.getCurrentTransformInverse=function(e){const{a:t,b:i,c:n,d:s,e:r,f:a}=e.getTransform().invertSelf();return[t,i,n,s,r,a]},t.getFilenameFromUrl=function(e,t=!1){return t||([e]=e.split(/[#?]/,1)),e.substring(e.lastIndexOf("/")+1)},t.getPdfFilenameFromUrl=function(e,t="document.pdf"){if("string"!=typeof e)return t;if(f(e))return(0,s.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const i=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,n=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(e);let r=i.exec(n[1])||i.exec(n[2])||i.exec(n[3]);if(r&&(r=r[0],r.includes("%")))try{r=i.exec(decodeURIComponent(r))[0]}catch{}return r||t},t.getRGB=v,t.getXfaPageViewport=function(e,{scale:t=1,rotation:i=0}){const{width:n,height:s}=e.attributes.style,r=[0,0,parseInt(n),parseInt(s)];return new p({viewBox:r,scale:t,rotation:i})},t.isDataScheme=f,t.isPdfFile=function(e){return"string"==typeof e&&/\.pdf$/i.test(e)},t.isValidFetchUrl=m,t.loadScript=function(e,t=!1){return new Promise(((i,n)=>{const s=document.createElement("script");s.src=e,s.onload=function(e){t&&s.remove(),i(e)},s.onerror=function(){n(new Error(`Cannot load script at: ${s.src}`))},(document.head||document.documentElement).append(s)}))},t.noContextMenu=function(e){e.preventDefault()},t.setLayerDimensions=function(e,t,i=!1,n=!0){if(t instanceof p){const{pageWidth:n,pageHeight:r}=t.rawDims,{style:a}=e,o=s.FeatureTest.isCSSRoundSupported,l=`var(--scale-factor) * ${n}px`,h=`var(--scale-factor) * ${r}px`,c=o?`round(${l}, 1px)`:`calc(${l})`,d=o?`round(${h}, 1px)`:`calc(${h})`;i&&t.rotation%180!=0?(a.width=d,a.height=c):(a.width=c,a.height=d)}n&&e.setAttribute("data-main-rotation",t.rotation)};var n=i(7),s=i(1);const r="http://www.w3.org/2000/svg";class a{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}t.PixelsPerInch=a;class o extends n.BaseFilterFactory{#qe;#Xe;#t;#Ke;#Ye;#Qe;#Je;#Ze;#et;#tt;#G=0;constructor({docId:e,ownerDocument:t=globalThis.document}={}){super(),this.#t=e,this.#Ke=t}get#q(){return this.#qe||=new Map}get#it(){if(!this.#Xe){const e=this.#Ke.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.#Ke.createElementNS(r,"svg");i.setAttribute("width",0),i.setAttribute("height",0),this.#Xe=this.#Ke.createElementNS(r,"defs"),e.append(i),i.append(this.#Xe),this.#Ke.body.append(e)}return this.#Xe}addFilter(e){if(!e)return"none";let t,i,n,s,r=this.#q.get(e);if(r)return r;if(1===e.length){const r=e[0],a=new Array(256);for(let e=0;e<256;e++)a[e]=r[e]/255;s=t=i=n=a.join(",")}else{const[r,a,o]=e,l=new Array(256),h=new Array(256),c=new Array(256);for(let e=0;e<256;e++)l[e]=r[e]/255,h[e]=a[e]/255,c[e]=o[e]/255;t=l.join(","),i=h.join(","),n=c.join(","),s=`${t}${i}${n}`}if(r=this.#q.get(s),r)return this.#q.set(e,r),r;const a=`g_${this.#t}_transfer_map_${this.#G++}`,o=`url(#${a})`;this.#q.set(e,o),this.#q.set(s,o);const l=this.#nt(a);return this.#st(t,i,n,l),o}addHCMFilter(e,t){const i=`${e}-${t}`;if(this.#Qe===i)return this.#Je;if(this.#Qe=i,this.#Je="none",this.#Ye?.remove(),!e||!t)return this.#Je;const n=this.#rt(e);e=s.Util.makeHexColor(...n);const r=this.#rt(t);if(t=s.Util.makeHexColor(...r),this.#it.style.color="","#000000"===e&&"#ffffff"===t||e===t)return this.#Je;const a=new Array(256);for(let e=0;e<=255;e++){const t=e/255;a[e]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}const o=a.join(","),l=`g_${this.#t}_hcm_filter`,h=this.#Ze=this.#nt(l);this.#st(o,o,o,h),this.#at(h);const c=(e,t)=>{const i=n[e]/255,s=r[e]/255,a=new Array(t+1);for(let e=0;e<=t;e++)a[e]=i+e/t*(s-i);return a.join(",")};return this.#st(c(0,5),c(1,5),c(2,5),h),this.#Je=`url(#${l})`,this.#Je}addHighlightHCMFilter(e,t,i,n){const s=`${e}-${t}-${i}-${n}`;if(this.#et===s)return this.#tt;if(this.#et=s,this.#tt="none",this.#Ze?.remove(),!e||!t)return this.#tt;const[r,a]=[e,t].map(this.#rt.bind(this));let o=Math.round(.2126*r[0]+.7152*r[1]+.0722*r[2]),l=Math.round(.2126*a[0]+.7152*a[1]+.0722*a[2]),[h,c]=[i,n].map(this.#rt.bind(this));l<o&&([o,l,h,c]=[l,o,c,h]),this.#it.style.color="";const d=(e,t,i)=>{const n=new Array(256),s=(l-o)/i,r=e/255,a=(t-e)/(255*i);let h=0;for(let e=0;e<=i;e++){const t=Math.round(o+e*s),i=r+e*a;for(let e=h;e<=t;e++)n[e]=i;h=t+1}for(let e=h;e<256;e++)n[e]=n[h-1];return n.join(",")},u=`g_${this.#t}_hcm_highlight_filter`,p=this.#Ze=this.#nt(u);return this.#at(p),this.#st(d(h[0],c[0],5),d(h[1],c[1],5),d(h[2],c[2],5),p),this.#tt=`url(#${u})`,this.#tt}destroy(e=!1){e&&(this.#Je||this.#tt)||(this.#Xe&&(this.#Xe.parentNode.parentNode.remove(),this.#Xe=null),this.#qe&&(this.#qe.clear(),this.#qe=null),this.#G=0)}#at(e){const t=this.#Ke.createElementNS(r,"feColorMatrix");t.setAttribute("type","matrix"),t.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"),e.append(t)}#nt(e){const t=this.#Ke.createElementNS(r,"filter");return t.setAttribute("color-interpolation-filters","sRGB"),t.setAttribute("id",e),this.#it.append(t),t}#ot(e,t,i){const n=this.#Ke.createElementNS(r,t);n.setAttribute("type","discrete"),n.setAttribute("tableValues",i),e.append(n)}#st(e,t,i,n){const s=this.#Ke.createElementNS(r,"feComponentTransfer");n.append(s),this.#ot(s,"feFuncR",e),this.#ot(s,"feFuncG",t),this.#ot(s,"feFuncB",i)}#rt(e){return this.#it.style.color=e,v(getComputedStyle(this.#it).getPropertyValue("color"))}}t.DOMFilterFactory=o;class l extends n.BaseCanvasFactory{constructor({ownerDocument:e=globalThis.document}={}){super(),this._document=e}_createCanvas(e,t){const i=this._document.createElement("canvas");return i.width=e,i.height=t,i}}async function h(e,t=!1){if(m(e,document.baseURI)){const i=await fetch(e);if(!i.ok)throw new Error(i.statusText);return t?new Uint8Array(await i.arrayBuffer()):(0,s.stringToBytes)(await i.text())}return new Promise(((i,n)=>{const r=new XMLHttpRequest;r.open("GET",e,!0),t&&(r.responseType="arraybuffer"),r.onreadystatechange=()=>{if(r.readyState===XMLHttpRequest.DONE){if(200===r.status||0===r.status){let e;if(t&&r.response?e=new Uint8Array(r.response):!t&&r.responseText&&(e=(0,s.stringToBytes)(r.responseText)),e)return void i(e)}n(new Error(r.statusText))}},r.send(null)}))}t.DOMCanvasFactory=l;class c extends n.BaseCMapReaderFactory{_fetchData(e,t){return h(e,this.isCompressed).then((e=>({cMapData:e,compressionType:t})))}}t.DOMCMapReaderFactory=c;class d extends n.BaseStandardFontDataFactory{_fetchData(e){return h(e,!0)}}t.DOMStandardFontDataFactory=d;class u extends n.BaseSVGFactory{_createSVG(e){return document.createElementNS(r,e)}}t.DOMSVGFactory=u;class p{constructor({viewBox:e,scale:t,rotation:i,offsetX:n=0,offsetY:s=0,dontFlip:r=!1}){this.viewBox=e,this.scale=t,this.rotation=i,this.offsetX=n,this.offsetY=s;const a=(e[2]+e[0])/2,o=(e[3]+e[1])/2;let l,h,c,d,u,p,g,f;switch((i%=360)<0&&(i+=360),i){case 180:l=-1,h=0,c=0,d=1;break;case 90:l=0,h=1,c=1,d=0;break;case 270:l=0,h=-1,c=-1,d=0;break;case 0:l=1,h=0,c=0,d=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}r&&(c=-c,d=-d),0===l?(u=Math.abs(o-e[1])*t+n,p=Math.abs(a-e[0])*t+s,g=(e[3]-e[1])*t,f=(e[2]-e[0])*t):(u=Math.abs(a-e[0])*t+n,p=Math.abs(o-e[1])*t+s,g=(e[2]-e[0])*t,f=(e[3]-e[1])*t),this.transform=[l*t,h*t,c*t,d*t,u-l*t*a-c*t*o,p-h*t*a-d*t*o],this.width=g,this.height=f}get rawDims(){const{viewBox:e}=this;return(0,s.shadow)(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:i=this.offsetX,offsetY:n=this.offsetY,dontFlip:s=!1}={}){return new p({viewBox:this.viewBox.slice(),scale:e,rotation:t,offsetX:i,offsetY:n,dontFlip:s})}convertToViewportPoint(e,t){return s.Util.applyTransform([e,t],this.transform)}convertToViewportRectangle(e){const t=s.Util.applyTransform([e[0],e[1]],this.transform),i=s.Util.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],i[0],i[1]]}convertToPdfPoint(e,t){return s.Util.applyInverseTransform([e,t],this.transform)}}t.PageViewport=p;class g extends s.BaseException{constructor(e,t=0){super(e,"RenderingCancelledException"),this.extraDelay=t}}function f(e){const t=e.length;let i=0;for(;i<t&&""===e[i].trim();)i++;return"data:"===e.substring(i,i+5).toLowerCase()}function m(e,t){try{const{protocol:i}=t?new URL(e,t):new URL(e);return"http:"===i||"https:"===i}catch{return!1}}let _;function v(e){if(e.startsWith("#")){const t=parseInt(e.slice(1),16);return[(16711680&t)>>16,(65280&t)>>8,255&t]}return e.startsWith("rgb(")?e.slice(4,-1).split(",").map((e=>parseInt(e))):e.startsWith("rgba(")?e.slice(5,-1).split(",").map((e=>parseInt(e))).slice(0,3):((0,s.warn)(`Not a valid color format: "${e}"`),[0,0,0])}t.RenderingCancelledException=g,t.StatTimer=class{started=Object.create(null);times=[];time(e){e in this.started&&(0,s.warn)(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||(0,s.warn)(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){const e=[];let t=0;for(const{name:e}of this.times)t=Math.max(e.length,t);for(const{name:i,start:n,end:s}of this.times)e.push(`${i.padEnd(t)} ${s-n}ms\n`);return e.join("")}},t.PDFDateString=class{static toDateObject(e){if(!e||"string"!=typeof e)return null;_||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const t=_.exec(e);if(!t)return null;const i=parseInt(t[1],10);let n=parseInt(t[2],10);n=n>=1&&n<=12?n-1:0;let s=parseInt(t[3],10);s=s>=1&&s<=31?s:1;let r=parseInt(t[4],10);r=r>=0&&r<=23?r:0;let a=parseInt(t[5],10);a=a>=0&&a<=59?a:0;let o=parseInt(t[6],10);o=o>=0&&o<=59?o:0;const l=t[7]||"Z";let h=parseInt(t[8],10);h=h>=0&&h<=23?h:0;let c=parseInt(t[9],10)||0;return c=c>=0&&c<=59?c:0,"-"===l?(r+=h,a+=c):"+"===l&&(r-=h,a-=c),new Date(Date.UTC(i,n,s,r,a,o))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseStandardFontDataFactory=t.BaseSVGFactory=t.BaseFilterFactory=t.BaseCanvasFactory=t.BaseCMapReaderFactory=void 0;var n=i(1);class s{constructor(){this.constructor===s&&(0,n.unreachable)("Cannot initialize BaseFilterFactory.")}addFilter(e){return"none"}addHCMFilter(e,t){return"none"}addHighlightHCMFilter(e,t,i,n){return"none"}destroy(e=!1){}}t.BaseFilterFactory=s;class r{constructor(){this.constructor===r&&(0,n.unreachable)("Cannot initialize BaseCanvasFactory.")}create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const i=this._createCanvas(e,t);return{canvas:i,context:i.getContext("2d")}}reset(e,t,i){if(!e.canvas)throw new Error("Canvas is not specified");if(t<=0||i<=0)throw new Error("Invalid canvas size");e.canvas.width=t,e.canvas.height=i}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){(0,n.unreachable)("Abstract method `_createCanvas` called.")}}t.BaseCanvasFactory=r;class a{constructor({baseUrl:e=null,isCompressed:t=!0}){this.constructor===a&&(0,n.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=e,this.isCompressed=t}async fetch({name:e}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!e)throw new Error("CMap name must be specified.");const t=this.baseUrl+e+(this.isCompressed?".bcmap":""),i=this.isCompressed?n.CMapCompressionType.BINARY:n.CMapCompressionType.NONE;return this._fetchData(t,i).catch((e=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${t}`)}))}_fetchData(e,t){(0,n.unreachable)("Abstract method `_fetchData` called.")}}t.BaseCMapReaderFactory=a;class o{constructor({baseUrl:e=null}){this.constructor===o&&(0,n.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!e)throw new Error("Font filename must be specified.");const t=`${this.baseUrl}${e}`;return this._fetchData(t).catch((e=>{throw new Error(`Unable to load font data at: ${t}`)}))}_fetchData(e){(0,n.unreachable)("Abstract method `_fetchData` called.")}}t.BaseStandardFontDataFactory=o;class l{constructor(){this.constructor===l&&(0,n.unreachable)("Cannot initialize BaseSVGFactory.")}create(e,t,i=!1){if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");const n=this._createSVG("svg:svg");return n.setAttribute("version","1.1"),i||(n.setAttribute("width",`${e}px`),n.setAttribute("height",`${t}px`)),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("viewBox",`0 0 ${e} ${t}`),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=l},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MurmurHash3_64=void 0;var n=i(1);const s=3285377520,r=4294901760,a=65535;t.MurmurHash3_64=class{constructor(e){this.h1=e?4294967295&e:s,this.h2=e?4294967295&e:s}update(e){let t,i;if("string"==typeof e){t=new Uint8Array(2*e.length),i=0;for(let n=0,s=e.length;n<s;n++){const s=e.charCodeAt(n);s<=255?t[i++]=s:(t[i++]=s>>>8,t[i++]=255&s)}}else{if(!(0,n.isArrayBuffer)(e))throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");t=e.slice(),i=t.byteLength}const s=i>>2,o=i-4*s,l=new Uint32Array(t.buffer,0,s);let h=0,c=0,d=this.h1,u=this.h2;const p=3432918353,g=461845907,f=11601,m=13715;for(let e=0;e<s;e++)1&e?(h=l[e],h=h*p&r|h*f&a,h=h<<15|h>>>17,h=h*g&r|h*m&a,d^=h,d=d<<13|d>>>19,d=5*d+3864292196):(c=l[e],c=c*p&r|c*f&a,c=c<<15|c>>>17,c=c*g&r|c*m&a,u^=c,u=u<<13|u>>>19,u=5*u+3864292196);switch(h=0,o){case 3:h^=t[4*s+2]<<16;case 2:h^=t[4*s+1]<<8;case 1:h^=t[4*s],h=h*p&r|h*f&a,h=h<<15|h>>>17,h=h*g&r|h*m&a,1&s?d^=h:u^=h}this.h1=d,this.h2=u}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=3981806797*e&r|36045*e&a,t=4283543511*t&r|(2950163797*(t<<16|e>>>16)&r)>>>16,e^=t>>>1,e=444984403*e&r|60499*e&a,t=3301882366*t&r|(3120437893*(t<<16|e>>>16)&r)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FontLoader=t.FontFaceObject=void 0;var n=i(1);t.FontLoader=class{#lt=new Set;constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){this._document=e,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){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.#lt.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont(e){if(e&&!this.#lt.has(e.loadedName))if((0,n.assert)(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:t,src:i,style:s}=e,r=new FontFace(t,i,s);this.addNativeFontFace(r);try{await r.load(),this.#lt.add(t)}catch{(0,n.warn)(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(r)}}else(0,n.unreachable)("Not implemented: loadSystemFont without the Font Loading API.")}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo)return void await this.loadSystemFont(e.systemFontInfo);if(this.isFontLoadingAPISupported){const t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(i){throw(0,n.warn)(`Failed to load font '${t.family}': '${i}'.`),e.disableFontFace=!0,i}}return}const t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise((t=>{const i=this._queueLoadingCallback(t);this._prepareFontLoadEvent(e,i)}))}}get isFontLoadingAPISupported(){const e=!!this._document?.fonts;return(0,n.shadow)(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){let e=!1;return(n.isNodeJS||"undefined"!=typeof navigator&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(e=!0),(0,n.shadow)(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(e){const{loadingRequests:t}=this,i={done:!1,complete:function(){for((0,n.assert)(!i.done,"completeRequest() cannot be called twice."),i.done=!0;t.length>0&&t[0].done;){const e=t.shift();setTimeout(e.callback,0)}},callback:e};return t.push(i),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 i(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|255&e.charCodeAt(t+3)}function s(e,t,i,n){return e.substring(0,t)+n+e.substring(t+i)}let r,a;const o=this._document.createElement("canvas");o.width=1,o.height=1;const l=o.getContext("2d");let h=0;const c=`lt${Date.now()}${this.loadTestFontId++}`;let d=this._loadTestFont;d=s(d,976,c.length,c);const u=1482184792;let p=i(d,16);for(r=0,a=c.length-3;r<a;r+=4)p=p-u+i(c,r)|0;r<c.length&&(p=p-u+i(c+"XXX",r)|0),d=s(d,16,4,(0,n.string32)(p));const g=`@font-face {font-family:"${c}";src:url(data:font/opentype;base64,${btoa(d)});}`;this.insertRule(g);const f=this._document.createElement("div");f.style.visibility="hidden",f.style.width=f.style.height="10px",f.style.position="absolute",f.style.top=f.style.left="0px";for(const t of[e.loadedName,c]){const e=this._document.createElement("span");e.textContent="Hi",e.style.fontFamily=t,f.append(e)}this._document.body.append(f),function e(t,i){if(++h>30)return(0,n.warn)("Load test font never loaded."),void i();l.font="30px "+t,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0?i():setTimeout(e.bind(null,t,i))}(c,(()=>{f.remove(),t.complete()}))}},t.FontFaceObject=class{constructor(e,{isEvalSupported:t=!0,disableFontFace:i=!1,ignoreErrors:n=!1,inspectFont:s=null}){this.compiledGlyphs=Object.create(null);for(const t in e)this[t]=e[t];this.isEvalSupported=!1!==t,this.disableFontFace=!0===i,this.ignoreErrors=!0===n,this._inspectFont=s}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(this.cssFontInfo){const t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}else e=new FontFace(this.loadedName,this.data,{});return this._inspectFont?.(this),e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const e=(0,n.bytesToString)(this.data),t=`url(data:${this.mimetype};base64,${btoa(e)});`;let i;if(this.cssFontInfo){let e=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(e+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),i=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${e}src:${t}}`}else i=`@font-face {font-family:"${this.loadedName}";src:${t}}`;return this._inspectFont?.(this,t),i}getPathGenerator(e,t){if(void 0!==this.compiledGlyphs[t])return this.compiledGlyphs[t];let i;try{i=e.get(this.loadedName+"_path_"+t)}catch(e){if(!this.ignoreErrors)throw e;return(0,n.warn)(`getPathGenerator - ignoring character: "${e}".`),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,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NodeStandardFontDataFactory=t.NodeFilterFactory=t.NodeCanvasFactory=t.NodeCMapReaderFactory=void 0;var n=i(7);i(1);const s=function(e){return new Promise(((t,i)=>{require$$5.readFile(e,((e,n)=>{!e&&n?t(new Uint8Array(n)):i(new Error(e))}))}))};class r extends n.BaseFilterFactory{}t.NodeFilterFactory=r;class a extends n.BaseCanvasFactory{_createCanvas(e,t){return require$$5.createCanvas(e,t)}}t.NodeCanvasFactory=a;class o extends n.BaseCMapReaderFactory{_fetchData(e,t){return s(e).then((e=>({cMapData:e,compressionType:t})))}}t.NodeCMapReaderFactory=o;class l extends n.BaseStandardFontDataFactory{_fetchData(e){return s(e)}}t.NodeStandardFontDataFactory=l},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CanvasGraphics=void 0;var n=i(1),s=i(6),r=i(12),a=i(13);const o=4096,l=16;class h{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,t,i){let n;return void 0!==this.cache[e]?(n=this.cache[e],this.canvasFactory.reset(n,t,i)):(n=this.canvasFactory.create(t,i),this.cache[e]=n),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 c(e,t,i,n,r,a,o,l,h,c){const[d,u,p,g,f,m]=(0,s.getCurrentTransform)(e);if(0===u&&0===p){const s=o*d+f,_=Math.round(s),v=l*g+m,b=Math.round(v),y=(o+h)*d+f,S=Math.abs(Math.round(y)-_)||1,P=(l+c)*g+m,A=Math.abs(Math.round(P)-b)||1;return e.setTransform(Math.sign(d),0,0,Math.sign(g),_,b),e.drawImage(t,i,n,r,a,0,0,S,A),e.setTransform(d,u,p,g,f,m),[S,A]}if(0===d&&0===g){const s=l*p+f,_=Math.round(s),v=o*u+m,b=Math.round(v),y=(l+c)*p+f,S=Math.abs(Math.round(y)-_)||1,P=(o+h)*u+m,A=Math.abs(Math.round(P)-b)||1;return e.setTransform(0,Math.sign(u),Math.sign(p),0,_,b),e.drawImage(t,i,n,r,a,0,0,A,S),e.setTransform(d,u,p,g,f,m),[A,S]}return e.drawImage(t,i,n,r,a,o,l,h,c),[Math.hypot(d,u)*h,Math.hypot(p,g)*c]}class d{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);return e.clipBox=this.clipBox.slice(),e}setCurrentPoint(e,t){this.x=e,this.y=t}updatePathMinMax(e,t,i){[t,i]=n.Util.applyTransform([t,i],e),this.minX=Math.min(this.minX,t),this.minY=Math.min(this.minY,i),this.maxX=Math.max(this.maxX,t),this.maxY=Math.max(this.maxY,i)}updateRectMinMax(e,t){const i=n.Util.applyTransform(t,e),s=n.Util.applyTransform(t.slice(2),e);this.minX=Math.min(this.minX,i[0],s[0]),this.minY=Math.min(this.minY,i[1],s[1]),this.maxX=Math.max(this.maxX,i[0],s[0]),this.maxY=Math.max(this.maxY,i[1],s[1])}updateScalingPathMinMax(e,t){n.Util.scaleMinMax(e,t),this.minX=Math.min(this.minX,t[0]),this.maxX=Math.max(this.maxX,t[1]),this.minY=Math.min(this.minY,t[2]),this.maxY=Math.max(this.maxY,t[3])}updateCurvePathMinMax(e,t,i,s,r,a,o,l,h,c){const d=n.Util.bezierBoundingBox(t,i,s,r,a,o,l,h);if(c)return c[0]=Math.min(c[0],d[0],d[2]),c[1]=Math.max(c[1],d[0],d[2]),c[2]=Math.min(c[2],d[1],d[3]),void(c[3]=Math.max(c[3],d[1],d[3]));this.updateRectMinMax(e,d)}getPathBoundingBox(e=r.PathType.FILL,t=null){const i=[this.minX,this.minY,this.maxX,this.maxY];if(e===r.PathType.STROKE){t||(0,n.unreachable)("Stroke bounding box must include transform.");const e=n.Util.singularValueDecompose2dScale(t),s=e[0]*this.lineWidth/2,r=e[1]*this.lineWidth/2;i[0]-=s,i[1]-=r,i[2]+=s,i[3]+=r}return i}updateClipFromPath(){const e=n.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(e){this.clipBox=e,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(e=r.PathType.FILL,t=null){return n.Util.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function u(e,t){if("undefined"!=typeof ImageData&&t instanceof ImageData)return void e.putImageData(t,0,0);const i=t.height,s=t.width,r=i%l,a=(i-r)/l,o=0===r?a:a+1,h=e.createImageData(s,l);let c,d=0;const u=t.data,p=h.data;let g,f,m,_;if(t.kind===n.ImageKind.GRAYSCALE_1BPP){const t=u.byteLength,i=new Uint32Array(p.buffer,0,p.byteLength>>2),_=i.length,v=s+7>>3,b=4294967295,y=n.FeatureTest.isLittleEndian?4278190080:255;for(g=0;g<o;g++){for(m=g<a?l:r,c=0,f=0;f<m;f++){const e=t-d;let n=0;const r=e>v?s:8*e-7,a=-8&r;let o=0,l=0;for(;n<a;n+=8)l=u[d++],i[c++]=128&l?b:y,i[c++]=64&l?b:y,i[c++]=32&l?b:y,i[c++]=16&l?b:y,i[c++]=8&l?b:y,i[c++]=4&l?b:y,i[c++]=2&l?b:y,i[c++]=1&l?b:y;for(;n<r;n++)0===o&&(l=u[d++],o=128),i[c++]=l&o?b:y,o>>=1}for(;c<_;)i[c++]=0;e.putImageData(h,0,g*l)}}else if(t.kind===n.ImageKind.RGBA_32BPP){for(f=0,_=s*l*4,g=0;g<a;g++)p.set(u.subarray(d,d+_)),d+=_,e.putImageData(h,0,f),f+=l;g<o&&(_=s*r*4,p.set(u.subarray(d,d+_)),e.putImageData(h,0,f))}else{if(t.kind!==n.ImageKind.RGB_24BPP)throw new Error(`bad image kind: ${t.kind}`);for(m=l,_=s*m,g=0;g<o;g++){for(g>=a&&(m=r,_=s*m),c=0,f=_;f--;)p[c++]=u[d++],p[c++]=u[d++],p[c++]=u[d++],p[c++]=255;e.putImageData(h,0,g*l)}}}function p(e,t){if(t.bitmap)return void e.drawImage(t.bitmap,0,0);const i=t.height,n=t.width,s=i%l,r=(i-s)/l,o=0===s?r:r+1,h=e.createImageData(n,l);let c=0;const d=t.data,u=h.data;for(let t=0;t<o;t++){const i=t<r?l:s;({srcPos:c}=(0,a.convertBlackAndWhiteToRGBA)({src:d,srcPos:c,dest:u,width:n,height:i,nonBlackColor:0})),e.putImageData(h,0,t*l)}}function g(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]);void 0!==e.setLineDash&&(t.setLineDash(e.getLineDash()),t.lineDashOffset=e.lineDashOffset)}function f(e){if(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",void 0!==e.setLineDash&&(e.setLineDash([]),e.lineDashOffset=0),!n.isNodeJS){const{filter:t}=e;"none"!==t&&""!==t&&(e.filter="none")}}function m(e,t,i,n){const s=e.length;for(let r=3;r<s;r+=4){const s=e[r];if(0===s)e[r-3]=t,e[r-2]=i,e[r-1]=n;else if(s<255){const a=255-s;e[r-3]=e[r-3]*s+t*a>>8,e[r-2]=e[r-2]*s+i*a>>8,e[r-1]=e[r-1]*s+n*a>>8}}}function _(e,t,i){const n=e.length;for(let s=3;s<n;s+=4){const n=i?i[e[s]]:e[s];t[s]=t[s]*n*.00392156862745098|0}}function v(e,t,i){const n=e.length;for(let s=3;s<n;s+=4){const n=77*e[s-3]+152*e[s-2]+28*e[s-1];t[s]=i?t[s]*i[n>>8]>>8:t[s]*n>>16}}function b(e,t,i,n){const s=n[0],r=n[1],a=n[2]-s,o=n[3]-r;0!==a&&0!==o&&(function(e,t,i,n,s,r,a,o,l,h,c){const d=!!r,u=d?r[0]:0,p=d?r[1]:0,g=d?r[2]:0,f="Luminosity"===s?v:_,b=Math.min(n,Math.ceil(1048576/i));for(let s=0;s<n;s+=b){const r=Math.min(b,n-s),_=e.getImageData(o-h,s+(l-c),i,r),v=t.getImageData(o,s+l,i,r);d&&m(_.data,u,p,g),f(_.data,v.data,a),t.putImageData(v,o,s+l)}}(t.context,i,a,o,t.subtype,t.backdrop,t.transferMap,s,r,t.offsetX,t.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(i.canvas,0,0),e.restore())}function y(e,t){const i=n.Util.singularValueDecompose2dScale(e);i[0]=Math.fround(i[0]),i[1]=Math.fround(i[1]);const r=Math.fround((globalThis.devicePixelRatio||1)*s.PixelsPerInch.PDF_TO_CSS_UNITS);return void 0!==t?t:i[0]<=r||i[1]<=r}const S=["butt","round","square"],P=["miter","round","bevel"],A={},w={};class E{constructor(e,t,i,n,s,{optionalContentConfig:r,markedContentStack:a=null},o,l){this.ctx=e,this.current=new d(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=s,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=a||[],this.optionalContentConfig=r,this.cachedCanvases=new h(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=o,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=l,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(e,t=null){return"string"==typeof e?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}beginDrawing({transform:e,viewport:t,transparency:i=!1,background:n=null}){const r=this.ctx.canvas.width,a=this.ctx.canvas.height,o=this.ctx.fillStyle;if(this.ctx.fillStyle=n||"#ffffff",this.ctx.fillRect(0,0,r,a),this.ctx.fillStyle=o,i){const e=this.cachedCanvases.getCanvas("transparent",r,a);this.compositeCtx=this.ctx,this.transparentCanvas=e.canvas,this.ctx=e.context,this.ctx.save(),this.ctx.transform(...(0,s.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),f(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=(0,s.getCurrentTransform)(this.ctx)}executeOperatorList(e,t,i,s){const r=e.argsArray,a=e.fnArray;let o=t||0;const l=r.length;if(l===o)return o;const h=l-o>10&&"function"==typeof i,c=h?Date.now()+15:0;let d=0;const u=this.commonObjs,p=this.objs;let g;for(;;){if(void 0!==s&&o===s.nextBreakPoint)return s.breakIt(o,i),o;if(g=a[o],g!==n.OPS.dependency)this[g].apply(this,r[o]);else for(const e of r[o]){const t=e.startsWith("g_")?u:p;if(!t.has(e))return t.get(e,i),o}if(o++,o===l)return o;if(h&&++d>10){if(Date.now()>c)return i(),o;d=0}}}#ht(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.ctx.restore(),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.#ht(),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.#ct()}#ct(){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 s,r,a=Math.max(Math.hypot(t[0],t[1]),1),o=Math.max(Math.hypot(t[2],t[3]),1),l=i,h=n,c="prescale1";for(;a>2&&l>1||o>2&&h>1;){let t=l,i=h;a>2&&l>1&&(t=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l/2),a/=l/t),o>2&&h>1&&(i=h>=16384?Math.floor(h/2)-1||1:Math.ceil(h)/2,o/=h/i),s=this.cachedCanvases.getCanvas(c,t,i),r=s.context,r.clearRect(0,0,t,i),r.drawImage(e,0,0,l,h,0,0,t,i),e=s.canvas,l=t,h=i,c="prescale1"===c?"prescale2":"prescale1"}return{img:e,paintWidth:l,paintHeight:h}}_createMaskCanvas(e){const t=this.ctx,{width:i,height:a}=e,o=this.current.fillColor,l=this.current.patternFill,h=(0,s.getCurrentTransform)(t);let d,u,g,f;if((e.bitmap||e.data)&&e.count>1){const t=e.bitmap||e.data.buffer;u=JSON.stringify(l?h:[h.slice(0,4),o]),d=this._cachedBitmapsMap.get(t),d||(d=new Map,this._cachedBitmapsMap.set(t,d));const i=d.get(u);if(i&&!l)return{canvas:i,offsetX:Math.round(Math.min(h[0],h[2])+h[4]),offsetY:Math.round(Math.min(h[1],h[3])+h[5])};g=i}g||(f=this.cachedCanvases.getCanvas("maskCanvas",i,a),p(f.context,e));let m=n.Util.transform(h,[1/i,0,0,-1/a,0,0]);m=n.Util.transform(m,[1,0,0,1,0,-a]);const _=n.Util.applyTransform([0,0],m),v=n.Util.applyTransform([i,a],m),b=n.Util.normalizeRect([_[0],_[1],v[0],v[1]]),S=Math.round(b[2]-b[0])||1,P=Math.round(b[3]-b[1])||1,A=this.cachedCanvases.getCanvas("fillCanvas",S,P),w=A.context,E=Math.min(_[0],v[0]),x=Math.min(_[1],v[1]);w.translate(-E,-x),w.transform(...m),g||(g=this._scaleImage(f.canvas,(0,s.getCurrentTransformInverse)(w)),g=g.img,d&&l&&d.set(u,g)),w.imageSmoothingEnabled=y((0,s.getCurrentTransform)(w),e.interpolate),c(w,g,0,0,g.width,g.height,0,0,i,a),w.globalCompositeOperation="source-in";const C=n.Util.transform((0,s.getCurrentTransformInverse)(w),[1,0,0,1,-E,-x]);return w.fillStyle=l?o.getPattern(t,this,C,r.PathType.FILL):o,w.fillRect(0,0,i,a),d&&!l&&(this.cachedCanvases.delete("fillCanvas"),d.set(u,A.canvas)),{canvas:A.canvas,offsetX:Math.round(E),offsetY:Math.round(x)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=S[e]}setLineJoin(e){this.ctx.lineJoin=P[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,t){const i=this.ctx;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 r=this.ctx;r.setTransform(...(0,s.getCurrentTransform)(this.suspendedCtx)),g(this.suspendedCtx,r),function(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(){t.save(),this.__originalSave()},e.restore=function(){t.restore(),this.__originalRestore()},e.translate=function(e,i){t.translate(e,i),this.__originalTranslate(e,i)},e.scale=function(e,i){t.scale(e,i),this.__originalScale(e,i)},e.transform=function(e,i,n,s,r,a){t.transform(e,i,n,s,r,a),this.__originalTransform(e,i,n,s,r,a)},e.setTransform=function(e,i,n,s,r,a){t.setTransform(e,i,n,s,r,a),this.__originalSetTransform(e,i,n,s,r,a)},e.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},e.rotate=function(e){t.rotate(e),this.__originalRotate(e)},e.clip=function(e){t.clip(e),this.__originalClip(e)},e.moveTo=function(e,i){t.moveTo(e,i),this.__originalMoveTo(e,i)},e.lineTo=function(e,i){t.lineTo(e,i),this.__originalLineTo(e,i)},e.bezierCurveTo=function(e,i,n,s,r,a){t.bezierCurveTo(e,i,n,s,r,a),this.__originalBezierCurveTo(e,i,n,s,r,a)},e.rect=function(e,i,n,s){t.rect(e,i,n,s),this.__originalRect(e,i,n,s)},e.closePath=function(){t.closePath(),this.__originalClosePath()},e.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}(r,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),g(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;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])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const t=this.current.activeSMask;b(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(){this.inSMaskMode?(g(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),g(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(e,t,i,n,s,r){this.ctx.transform(e,t,i,n,s,r),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,t,i){const r=this.ctx,a=this.current;let o,l,h=a.x,c=a.y;const d=(0,s.getCurrentTransform)(r),u=0===d[0]&&0===d[3]||0===d[1]&&0===d[2],p=u?i.slice(0):null;for(let i=0,s=0,g=e.length;i<g;i++)switch(0|e[i]){case n.OPS.rectangle:h=t[s++],c=t[s++];const e=t[s++],i=t[s++],g=h+e,f=c+i;r.moveTo(h,c),0===e||0===i?r.lineTo(g,f):(r.lineTo(g,c),r.lineTo(g,f),r.lineTo(h,f)),u||a.updateRectMinMax(d,[h,c,g,f]),r.closePath();break;case n.OPS.moveTo:h=t[s++],c=t[s++],r.moveTo(h,c),u||a.updatePathMinMax(d,h,c);break;case n.OPS.lineTo:h=t[s++],c=t[s++],r.lineTo(h,c),u||a.updatePathMinMax(d,h,c);break;case n.OPS.curveTo:o=h,l=c,h=t[s+4],c=t[s+5],r.bezierCurveTo(t[s],t[s+1],t[s+2],t[s+3],h,c),a.updateCurvePathMinMax(d,o,l,t[s],t[s+1],t[s+2],t[s+3],h,c,p),s+=6;break;case n.OPS.curveTo2:o=h,l=c,r.bezierCurveTo(h,c,t[s],t[s+1],t[s+2],t[s+3]),a.updateCurvePathMinMax(d,o,l,h,c,t[s],t[s+1],t[s+2],t[s+3],p),h=t[s+2],c=t[s+3],s+=4;break;case n.OPS.curveTo3:o=h,l=c,h=t[s+2],c=t[s+3],r.bezierCurveTo(t[s],t[s+1],h,c,h,c),a.updateCurvePathMinMax(d,o,l,t[s],t[s+1],h,c,h,c,p),s+=4;break;case n.OPS.closePath:r.closePath()}u&&a.updateScalingPathMinMax(d,p),a.setCurrentPoint(h,c)}closePath(){this.ctx.closePath()}stroke(e=!0){const t=this.ctx,i=this.current.strokeColor;t.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"==typeof i&&i?.getPattern?(t.save(),t.strokeStyle=i.getPattern(t,this,(0,s.getCurrentTransformInverse)(t),r.PathType.STROKE),this.rescaleAndStroke(!1),t.restore()):this.rescaleAndStroke(!0)),e&&this.consumePath(this.current.getClippedPathBoundingBox()),t.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(e=!0){const t=this.ctx,i=this.current.fillColor;let n=!1;this.current.patternFill&&(t.save(),t.fillStyle=i.getPattern(t,this,(0,s.getCurrentTransformInverse)(t),r.PathType.FILL),n=!0);const a=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==a&&(this.pendingEOFill?(t.fill("evenodd"),this.pendingEOFill=!1):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=A}eoClip(){this.pendingClip=w}beginText(){this.current.textMatrix=n.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const e=this.pendingTextPaths,t=this.ctx;if(void 0!==e){t.save(),t.beginPath();for(const i of e)t.setTransform(...i.transform),t.translate(i.x,i.y),i.addToPath(t,i.fontSize);t.restore(),t.clip(),t.beginPath(),delete this.pendingTextPaths}else t.beginPath()}setCharSpacing(e){this.current.charSpacing=e}setWordSpacing(e){this.current.wordSpacing=e}setHScale(e){this.current.textHScale=e/100}setLeading(e){this.current.leading=-e}setFont(e,t){const i=this.commonObjs.get(e),s=this.current;if(!i)throw new Error(`Can't find font for ${e}`);if(s.fontMatrix=i.fontMatrix||n.FONT_IDENTITY_MATRIX,0!==s.fontMatrix[0]&&0!==s.fontMatrix[3]||(0,n.warn)("Invalid font matrix for font "+e),t<0?(t=-t,s.fontDirection=-1):s.fontDirection=1,this.current.font=i,this.current.fontSize=t,i.isType3Font)return;const r=i.loadedName||"sans-serif",a=i.systemFontInfo?.css||`"${r}", ${i.fallbackName}`;let o="normal";i.black?o="900":i.bold&&(o="bold");const l=i.italic?"italic":"normal";let h=t;t<16?h=16:t>100&&(h=100),this.current.fontSizeScale=t/h,this.ctx.font=`${l} ${o} ${h}px ${a}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,t){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=t}setLeadingMoveText(e,t){this.setLeading(-t),this.moveText(e,t)}setTextMatrix(e,t,i,n,s,r){this.current.textMatrix=[e,t,i,n,s,r],this.current.textMatrixScale=Math.hypot(e,t),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(e,t,i,r){const a=this.ctx,o=this.current,l=o.font,h=o.textRenderingMode,c=o.fontSize/o.fontSizeScale,d=h&n.TextRenderingMode.FILL_STROKE_MASK,u=!!(h&n.TextRenderingMode.ADD_TO_PATH_FLAG),p=o.patternFill&&!l.missingFile;let g;(l.disableFontFace||u||p)&&(g=l.getPathGenerator(this.commonObjs,e)),l.disableFontFace||p?(a.save(),a.translate(t,i),a.beginPath(),g(a,c),r&&a.setTransform(...r),d!==n.TextRenderingMode.FILL&&d!==n.TextRenderingMode.FILL_STROKE||a.fill(),d!==n.TextRenderingMode.STROKE&&d!==n.TextRenderingMode.FILL_STROKE||a.stroke(),a.restore()):(d!==n.TextRenderingMode.FILL&&d!==n.TextRenderingMode.FILL_STROKE||a.fillText(e,t,i),d!==n.TextRenderingMode.STROKE&&d!==n.TextRenderingMode.FILL_STROKE||a.strokeText(e,t,i)),u&&(this.pendingTextPaths||=[]).push({transform:(0,s.getCurrentTransform)(a),x:t,y:i,fontSize:c,addToPath:g})}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const t=e.getImageData(0,0,10,10).data;let i=!1;for(let e=3;e<t.length;e+=4)if(t[e]>0&&t[e]<255){i=!0;break}return(0,n.shadow)(this,"isFontSubpixelAAEnabled",i)}showText(e){const t=this.current,i=t.font;if(i.isType3Font)return this.showType3Text(e);const a=t.fontSize;if(0===a)return;const o=this.ctx,l=t.fontSizeScale,h=t.charSpacing,c=t.wordSpacing,d=t.fontDirection,u=t.textHScale*d,p=e.length,g=i.vertical,f=g?1:-1,m=i.defaultVMetrics,_=a*t.fontMatrix[0],v=t.textRenderingMode===n.TextRenderingMode.FILL&&!i.disableFontFace&&!t.patternFill;let b;if(o.save(),o.transform(...t.textMatrix),o.translate(t.x,t.y+t.textRise),d>0?o.scale(u,-1):o.scale(u,1),t.patternFill){o.save();const e=t.fillColor.getPattern(o,this,(0,s.getCurrentTransformInverse)(o),r.PathType.FILL);b=(0,s.getCurrentTransform)(o),o.restore(),o.fillStyle=e}let y=t.lineWidth;const S=t.textMatrixScale;if(0===S||0===y){const e=t.textRenderingMode&n.TextRenderingMode.FILL_STROKE_MASK;e!==n.TextRenderingMode.STROKE&&e!==n.TextRenderingMode.FILL_STROKE||(y=this.getSinglePixelWidth())}else y/=S;if(1!==l&&(o.scale(l,l),y/=l),o.lineWidth=y,i.isInvalidPDFjsFont){const i=[];let n=0;for(const t of e)i.push(t.unicode),n+=t.width;return o.fillText(i.join(""),0,0),t.x+=n*_*u,o.restore(),void this.compose()}let P,A=0;for(P=0;P<p;++P){const t=e[P];if("number"==typeof t){A+=f*t*a/1e3;continue}let n=!1;const s=(t.isSpace?c:0)+h,r=t.fontChar,u=t.accent;let p,y,S=t.width;if(g){const e=t.vmetric||m,i=-(t.vmetric?e[1]:.5*S)*_,n=e[2]*_;S=e?-e[0]:S,p=i/l,y=(A+n)/l}else p=A/l,y=0;if(i.remeasure&&S>0){const e=1e3*o.measureText(r).width/a*l;if(S<e&&this.isFontSubpixelAAEnabled){const t=S/e;n=!0,o.save(),o.scale(t,1),p/=t}else S!==e&&(p+=(S-e)/2e3*a/l)}if(this.contentVisible&&(t.isInFont||i.missingFile))if(v&&!u)o.fillText(r,p,y);else if(this.paintChar(r,p,y,b),u){const e=p+a*u.offset.x/l,t=y-a*u.offset.y/l;this.paintChar(u.fontChar,e,t,b)}A+=g?S*_-s*d:S*_+s*d,n&&o.restore()}g?t.y-=A:t.x+=A*u,o.restore(),this.compose()}showType3Text(e){const t=this.ctx,i=this.current,s=i.font,r=i.fontSize,a=i.fontDirection,o=s.vertical?1:-1,l=i.charSpacing,h=i.wordSpacing,c=i.textHScale*a,d=i.fontMatrix||n.FONT_IDENTITY_MATRIX,u=e.length;let p,g,f,m;if(i.textRenderingMode!==n.TextRenderingMode.INVISIBLE&&0!==r){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,t.save(),t.transform(...i.textMatrix),t.translate(i.x,i.y),t.scale(c,a),p=0;p<u;++p){if(g=e[p],"number"==typeof g){m=o*g*r/1e3,this.ctx.translate(m,0),i.x+=m*c;continue}const a=(g.isSpace?h:0)+l,u=s.charProcOperatorList[g.operatorListId];u?(this.contentVisible&&(this.processingType3=g,this.save(),t.scale(r,r),t.transform(...d),this.executeOperatorList(u),this.restore()),f=n.Util.applyTransform([g.width,0],d)[0]*r+a,t.translate(f,0),i.x+=f*c):(0,n.warn)(`Type3 character "${g.operatorListId}" is not available.`)}t.restore(),this.processingType3=null}}setCharWidth(e,t){}setCharWidthAndBounds(e,t,i,n,s,r){this.ctx.rect(i,n,s-i,r-n),this.ctx.clip(),this.endPath()}getColorN_Pattern(e){let t;if("TilingPattern"===e[0]){const i=e[1],n=this.baseTransform||(0,s.getCurrentTransform)(this.ctx),a={createCanvasGraphics:e=>new E(e,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};t=new r.TilingPattern(e,i,this.ctx,a,n)}else t=this._getPattern(e[1],e[2]);return t}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(e,t,i){const s=n.Util.makeHexColor(e,t,i);this.ctx.strokeStyle=s,this.current.strokeColor=s}setFillRGBColor(e,t,i){const s=n.Util.makeHexColor(e,t,i);this.ctx.fillStyle=s,this.current.fillColor=s,this.current.patternFill=!1}_getPattern(e,t=null){let i;return this.cachedPatterns.has(e)?i=this.cachedPatterns.get(e):(i=(0,r.getShadingPattern)(this.getObject(e)),this.cachedPatterns.set(e,i)),t&&(i.matrix=t),i}shadingFill(e){if(!this.contentVisible)return;const t=this.ctx;this.save();const i=this._getPattern(e);t.fillStyle=i.getPattern(t,this,(0,s.getCurrentTransformInverse)(t),r.PathType.SHADING);const a=(0,s.getCurrentTransformInverse)(t);if(a){const{width:e,height:i}=t.canvas,[s,r,o,l]=n.Util.getAxialAlignedBoundingBox([0,0,e,i],a);this.ctx.fillRect(s,r,o-s,l-r)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){(0,n.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,n.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(e,t){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(e)&&6===e.length&&this.transform(...e),this.baseTransform=(0,s.getCurrentTransform)(this.ctx),t)){const e=t[2]-t[0],i=t[3]-t[1];this.ctx.rect(t[0],t[1],e,i),this.current.updateRectMinMax((0,s.getCurrentTransform)(this.ctx),t),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const t=this.ctx;e.isolated||(0,n.info)("TODO: Support non-isolated groups."),e.knockout&&(0,n.warn)("Knockout groups not supported.");const i=(0,s.getCurrentTransform)(t);if(e.matrix&&t.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let r=n.Util.getAxialAlignedBoundingBox(e.bbox,(0,s.getCurrentTransform)(t));const a=[0,0,t.canvas.width,t.canvas.height];r=n.Util.intersect(r,a)||[0,0,0,0];const l=Math.floor(r[0]),h=Math.floor(r[1]);let c=Math.max(Math.ceil(r[2])-l,1),d=Math.max(Math.ceil(r[3])-h,1),u=1,p=1;c>o&&(u=c/o,c=o),d>o&&(p=d/o,d=o),this.current.startNewPathAndClipBox([0,0,c,d]);let f="groupAt"+this.groupLevel;e.smask&&(f+="_smask_"+this.smaskCounter++%2);const m=this.cachedCanvases.getCanvas(f,c,d),_=m.context;_.scale(1/u,1/p),_.translate(-l,-h),_.transform(...i),e.smask?this.smaskStack.push({canvas:m.canvas,context:_,offsetX:l,offsetY:h,scaleX:u,scaleY:p,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(l,h),t.scale(u,p),t.save()),g(t,_),this.ctx=_,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();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const e=(0,s.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...e);const i=n.Util.getAxialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],e);this.ctx.drawImage(t.canvas,0,0),this.ctx.restore(),this.compose(i)}}beginAnnotation(e,t,i,r,a){if(this.#ht(),f(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(t)&&4===t.length){const r=t[2]-t[0],o=t[3]-t[1];if(a&&this.annotationCanvasMap){(i=i.slice())[4]-=t[0],i[5]-=t[1],(t=t.slice())[0]=t[1]=0,t[2]=r,t[3]=o;const[a,l]=n.Util.singularValueDecompose2dScale((0,s.getCurrentTransform)(this.ctx)),{viewportScale:h}=this,c=Math.ceil(r*this.outputScaleX*h),d=Math.ceil(o*this.outputScaleY*h);this.annotationCanvas=this.canvasFactory.create(c,d);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),f(this.ctx)}else f(this.ctx),this.ctx.rect(t[0],t[1],r,o),this.ctx.clip(),this.endPath()}this.current=new d(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),this.transform(...r)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#ct(),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(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]),s=t+1;let r,a,o,l=new Uint8Array(s*(i+1));const h=t+7&-8;let c=new Uint8Array(h*i),d=0;for(const t of e.data){let e=128;for(;e>0;)c[d++]=t&e?0:255,e>>=1}let u=0;for(d=0,0!==c[d]&&(l[0]=1,++u),a=1;a<t;a++)c[d]!==c[d+1]&&(l[a]=c[d]?2:1,++u),d++;for(0!==c[d]&&(l[a]=2,++u),r=1;r<i;r++){d=r*h,o=r*s,c[d-h]!==c[d]&&(l[o]=c[d]?1:8,++u);let e=(c[d]?4:0)+(c[d-h]?8:0);for(a=1;a<t;a++)e=(e>>2)+(c[d+1]?4:0)+(c[d-h+1]?8:0),n[e]&&(l[o+a]=n[e],++u),d++;if(c[d-h]!==c[d]&&(l[o+a]=c[d]?2:4,++u),u>1e3)return null}for(d=h*(i-1),o=r*s,0!==c[d]&&(l[o]=8,++u),a=1;a<t;a++)c[d]!==c[d+1]&&(l[o+a]=c[d]?4:8,++u),d++;if(0!==c[d]&&(l[o+a]=4,++u),u>1e3)return null;const p=new Int32Array([0,s,-1,0,-s,0,0,0,1]),g=new Path2D;for(r=0;u&&r<=i;r++){let e=r*s;const i=e+t;for(;e<i&&!l[e];)e++;if(e===i)continue;g.moveTo(e%s,r);const n=e;let a=l[e];do{const t=p[a];do{e+=t}while(!l[e]);const i=l[e];5!==i&&10!==i?(a=i,l[e]=0):(a=i&51*a>>4,l[e]&=a>>2|a<<2),g.lineTo(e%s,e/s|0),l[e]||--u}while(n!==e);--r}return c=null,l=null,function(e){e.save(),e.scale(1/t,-1/i),e.translate(0,-i),e.fill(g),e.beginPath(),e.restore()}}(e)),n.compiled))return void n.compiled(i);const s=this._createMaskCanvas(e),r=s.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(r,s.offsetX,s.offsetY),i.restore(),this.compose()}paintImageMaskXObjectRepeat(e,t,i=0,r=0,a,o){if(!this.contentVisible)return;e=this.getObject(e.data,e);const l=this.ctx;l.save();const h=(0,s.getCurrentTransform)(l);l.transform(t,i,r,a,0,0);const c=this._createMaskCanvas(e);l.setTransform(1,0,0,1,c.offsetX-h[4],c.offsetY-h[5]);for(let e=0,s=o.length;e<s;e+=2){const s=n.Util.transform(h,[t,i,r,a,o[e],o[e+1]]),[d,u]=n.Util.applyTransform([0,0],s);l.drawImage(c.canvas,d,u)}l.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const t=this.ctx,i=this.current.fillColor,n=this.current.patternFill;for(const a of e){const{data:e,width:o,height:l,transform:h}=a,d=this.cachedCanvases.getCanvas("maskCanvas",o,l),u=d.context;u.save(),p(u,this.getObject(e,a)),u.globalCompositeOperation="source-in",u.fillStyle=n?i.getPattern(u,this,(0,s.getCurrentTransformInverse)(t),r.PathType.FILL):i,u.fillRect(0,0,o,l),u.restore(),t.save(),t.transform(...h),t.scale(1,-1),c(t,d.canvas,0,0,o,l,0,-1,1,1),t.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;const t=this.getObject(e);t?this.paintInlineImageXObject(t):(0,n.warn)("Dependent image isn't ready yet")}paintImageXObjectRepeat(e,t,i,s){if(!this.contentVisible)return;const r=this.getObject(e);if(!r)return void(0,n.warn)("Dependent image isn't ready yet");const a=r.width,o=r.height,l=[];for(let e=0,n=s.length;e<n;e+=2)l.push({transform:[t,0,0,i,s[e],s[e+1]],x:0,y:0,w:a,h:o});this.paintInlineImageXObjectGroup(r,l)}applyTransferMapsToCanvas(e){return"none"!==this.current.transferMaps&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none"),e.canvas}applyTransferMapsToBitmap(e){if("none"===this.current.transferMaps)return e.bitmap;const{bitmap:t,width:i,height:n}=e,s=this.cachedCanvases.getCanvas("inlineImage",i,n),r=s.context;return r.filter=this.current.transferMaps,r.drawImage(t,0,0),r.filter="none",s.canvas}paintInlineImageXObject(e){if(!this.contentVisible)return;const t=e.width,i=e.height,r=this.ctx;if(this.save(),!n.isNodeJS){const{filter:e}=r;"none"!==e&&""!==e&&(r.filter="none")}let a;if(r.scale(1/t,-1/i),e.bitmap)a=this.applyTransferMapsToBitmap(e);else if("function"==typeof HTMLElement&&e instanceof HTMLElement||!e.data)a=e;else{const n=this.cachedCanvases.getCanvas("inlineImage",t,i).context;u(n,e),a=this.applyTransferMapsToCanvas(n)}const o=this._scaleImage(a,(0,s.getCurrentTransformInverse)(r));r.imageSmoothingEnabled=y((0,s.getCurrentTransform)(r),e.interpolate),c(r,o.img,0,0,o.paintWidth,o.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,s=this.cachedCanvases.getCanvas("inlineImage",t,i).context;u(s,e),n=this.applyTransferMapsToCanvas(s)}for(const e of t)i.save(),i.transform(...e.transform),i.scale(1,-1),c(i,n,e.x,e.y,e.w,e.h,0,-1,1,1),i.restore();this.compose()}paintSolidColorImageMask(){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;this.pendingClip&&(t||(this.pendingClip===w?i.clip("evenodd"):i.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),i.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=(0,s.getCurrentTransform)(this.ctx);if(0===e[1]&&0===e[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const t=Math.abs(e[0]*e[3]-e[2]*e[1]),i=Math.hypot(e[0],e[2]),n=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(i,n)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){const{lineWidth:e}=this.current,{a:t,b:i,c:n,d:s}=this.ctx.getTransform();let r,a;if(0===i&&0===n){const i=Math.abs(t),n=Math.abs(s);if(i===n)if(0===e)r=a=1/i;else{const t=i*e;r=a=t<1?1/t:1}else if(0===e)r=1/i,a=1/n;else{const t=i*e,s=n*e;r=t<1?1/t:1,a=s<1?1/s:1}}else{const o=Math.abs(t*s-i*n),l=Math.hypot(t,i),h=Math.hypot(n,s);if(0===e)r=h/o,a=l/o;else{const t=e*o;r=h>t?h/t:1,a=l>t?l/t:1}}this._cachedScaleForStroking[0]=r,this._cachedScaleForStroking[1]=a}return this._cachedScaleForStroking}rescaleAndStroke(e){const{ctx:t}=this,{lineWidth:i}=this.current,[n,s]=this.getScaleForStroking();if(t.lineWidth=i||1,1===n&&1===s)return void t.stroke();const r=t.getLineDash();if(e&&t.save(),t.scale(n,s),r.length>0){const e=Math.max(n,s);t.setLineDash(r.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=E;for(const e in n.OPS)void 0!==E.prototype[e]&&(E.prototype[n.OPS[e]]=E.prototype[e])},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TilingPattern=t.PathType=void 0,t.getShadingPattern=function(e){switch(e[0]){case"RadialAxial":return new l(e);case"Mesh":return new d(e);case"Dummy":return new u}throw new Error(`Unknown IR type: ${e[0]}`)};var n=i(1),s=i(6);const r={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function a(e,t){if(!t)return;const i=t[2]-t[0],n=t[3]-t[1],s=new Path2D;s.rect(t[0],t[1],i,n),e.clip(s)}t.PathType=r;class o{constructor(){this.constructor===o&&(0,n.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,n.unreachable)("Abstract method `getPattern` called.")}}class l extends o{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,o){let l;if(o===r.STROKE||o===r.FILL){const r=t.current.getClippedPathBoundingBox(o,(0,s.getCurrentTransform)(e))||[0,0,0,0],h=Math.ceil(r[2]-r[0])||1,c=Math.ceil(r[3]-r[1])||1,d=t.cachedCanvases.getCanvas("pattern",h,c,!0),u=d.context;u.clearRect(0,0,u.canvas.width,u.canvas.height),u.beginPath(),u.rect(0,0,u.canvas.width,u.canvas.height),u.translate(-r[0],-r[1]),i=n.Util.transform(i,[1,0,0,1,r[0],r[1]]),u.transform(...t.baseTransform),this.matrix&&u.transform(...this.matrix),a(u,this._bbox),u.fillStyle=this._createGradient(u),u.fill(),l=e.createPattern(d.canvas,"no-repeat");const p=new DOMMatrix(i);l.setTransform(p)}else a(e,this._bbox),l=this._createGradient(e);return l}}function h(e,t,i,n,s,r,a,o){const l=t.coords,h=t.colors,c=e.data,d=4*e.width;let u;l[i+1]>l[n+1]&&(u=i,i=n,n=u,u=r,r=a,a=u),l[n+1]>l[s+1]&&(u=n,n=s,s=u,u=a,a=o,o=u),l[i+1]>l[n+1]&&(u=i,i=n,n=u,u=r,r=a,a=u);const p=(l[i]+t.offsetX)*t.scaleX,g=(l[i+1]+t.offsetY)*t.scaleY,f=(l[n]+t.offsetX)*t.scaleX,m=(l[n+1]+t.offsetY)*t.scaleY,_=(l[s]+t.offsetX)*t.scaleX,v=(l[s+1]+t.offsetY)*t.scaleY;if(g>=v)return;const b=h[r],y=h[r+1],S=h[r+2],P=h[a],A=h[a+1],w=h[a+2],E=h[o],x=h[o+1],C=h[o+2],M=Math.round(g),T=Math.round(v);let D,F,k,L,R,I,O,N;for(let e=M;e<=T;e++){if(e<m){const t=e<g?0:(g-e)/(g-m);D=p-(p-f)*t,F=b-(b-P)*t,k=y-(y-A)*t,L=S-(S-w)*t}else{let t;t=e>v?1:m===v?0:(m-e)/(m-v),D=f-(f-_)*t,F=P-(P-E)*t,k=A-(A-x)*t,L=w-(w-C)*t}let t;t=e<g?0:e>v?1:(g-e)/(g-v),R=p-(p-_)*t,I=b-(b-E)*t,O=y-(y-x)*t,N=S-(S-C)*t;const i=Math.round(Math.min(D,R)),n=Math.round(Math.max(D,R));let s=d*e+4*i;for(let e=i;e<=n;e++)t=(D-e)/(D-R),t<0?t=0:t>1&&(t=1),c[s++]=F-(F-I)*t|0,c[s++]=k-(k-O)*t|0,c[s++]=L-(L-N)*t|0,c[s++]=255}}function c(e,t,i){const n=t.coords,s=t.colors;let r,a;switch(t.type){case"lattice":const o=t.verticesPerRow,l=Math.floor(n.length/o)-1,c=o-1;for(r=0;r<l;r++){let t=r*o;for(let r=0;r<c;r++,t++)h(e,i,n[t],n[t+1],n[t+o],s[t],s[t+1],s[t+o]),h(e,i,n[t+o+1],n[t+1],n[t+o],s[t+o+1],s[t+1],s[t+o])}break;case"triangles":for(r=0,a=n.length;r<a;r+=3)h(e,i,n[r],n[r+1],n[r+2],s[r],s[r+1],s[r+2]);break;default:throw new Error("illegal figure")}}class d extends o{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[7],this._background=e[8],this.matrix=null}_createMeshCanvas(e,t,i){const n=Math.floor(this._bounds[0]),s=Math.floor(this._bounds[1]),r=Math.ceil(this._bounds[2])-n,a=Math.ceil(this._bounds[3])-s,o=Math.min(Math.ceil(Math.abs(r*e[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(a*e[1]*1.1)),3e3),h=r/o,d=a/l,u={coords:this._coords,colors:this._colors,offsetX:-n,offsetY:-s,scaleX:1/h,scaleY:1/d},p=o+4,g=l+4,f=i.getCanvas("mesh",p,g,!1),m=f.context,_=m.createImageData(o,l);if(t){const e=_.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)c(_,e,u);return m.putImageData(_,2,2),{canvas:f.canvas,offsetX:n-2*h,offsetY:s-2*d,scaleX:h,scaleY:d}}getPattern(e,t,i,o){let l;if(a(e,this._bbox),o===r.SHADING)l=n.Util.singularValueDecompose2dScale((0,s.getCurrentTransform)(e));else if(l=n.Util.singularValueDecompose2dScale(t.baseTransform),this.matrix){const e=n.Util.singularValueDecompose2dScale(this.matrix);l=[l[0]*e[0],l[1]*e[1]]}const h=this._createMeshCanvas(l,o===r.SHADING?null:this._background,t.cachedCanvases);return o!==r.SHADING&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(h.offsetX,h.offsetY),e.scale(h.scaleX,h.scaleY),e.createPattern(h.canvas,"no-repeat")}}class u extends o{getPattern(){return"hotpink"}}const p=1,g=2;class f{static MAX_PATTERN_SIZE=3e3;constructor(e,t,i,n,s){this.operatorList=e[2],this.matrix=e[3]||[1,0,0,1,0,0],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.color=t,this.ctx=i,this.canvasGraphicsFactory=n,this.baseTransform=s}createPatternCanvas(e){const t=this.operatorList,i=this.bbox,r=this.xstep,a=this.ystep,o=this.paintType,l=this.tilingType,h=this.color,c=this.canvasGraphicsFactory;(0,n.info)("TilingType: "+l);const d=i[0],u=i[1],p=i[2],g=i[3],f=n.Util.singularValueDecompose2dScale(this.matrix),m=n.Util.singularValueDecompose2dScale(this.baseTransform),_=[f[0]*m[0],f[1]*m[1]],v=this.getSizeAndScale(r,this.ctx.canvas.width,_[0]),b=this.getSizeAndScale(a,this.ctx.canvas.height,_[1]),y=e.cachedCanvases.getCanvas("pattern",v.size,b.size,!0),S=y.context,P=c.createCanvasGraphics(S);P.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(P,o,h);let A=d,w=u,E=p,x=g;return d<0&&(A=0,E+=Math.abs(d)),u<0&&(w=0,x+=Math.abs(u)),S.translate(-v.scale*A,-b.scale*w),P.transform(v.scale,0,0,b.scale,0,0),S.save(),this.clipBbox(P,A,w,E,x),P.baseTransform=(0,s.getCurrentTransform)(P.ctx),P.executeOperatorList(t),P.endDrawing(),{canvas:y.canvas,scaleX:v.scale,scaleY:b.scale,offsetX:A,offsetY:w}}getSizeAndScale(e,t,i){e=Math.abs(e);const n=Math.max(f.MAX_PATTERN_SIZE,t);let s=Math.ceil(e*i);return s>=n?s=n:i=s/e,{scale:i,size:s}}clipBbox(e,t,i,n,r){const a=n-t,o=r-i;e.ctx.rect(t,i,a,o),e.current.updateRectMinMax((0,s.getCurrentTransform)(e.ctx),[t,i,n,r]),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,t,i){const s=e.ctx,r=e.current;switch(t){case p:const e=this.ctx;s.fillStyle=e.fillStyle,s.strokeStyle=e.strokeStyle,r.fillColor=e.fillStyle,r.strokeColor=e.strokeStyle;break;case g:const a=n.Util.makeHexColor(i[0],i[1],i[2]);s.fillStyle=a,s.strokeStyle=a,r.fillColor=a,r.strokeColor=a;break;default:throw new n.FormatError(`Unsupported paint type: ${t}`)}}getPattern(e,t,i,s){let a=i;s!==r.SHADING&&(a=n.Util.transform(a,t.baseTransform),this.matrix&&(a=n.Util.transform(a,this.matrix)));const o=this.createPatternCanvas(t);let l=new DOMMatrix(a);l=l.translate(o.offsetX,o.offsetY),l=l.scale(1/o.scaleX,1/o.scaleY);const h=e.createPattern(o.canvas,"repeat");return h.setTransform(l),h}}t.TilingPattern=f},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertBlackAndWhiteToRGBA=s,t.convertToRGBA=function(e){switch(e.kind){case n.ImageKind.GRAYSCALE_1BPP:return s(e);case n.ImageKind.RGB_24BPP:return function({src:e,srcPos:t=0,dest:i,destPos:s=0,width:r,height:a}){let o=0;const l=e.length>>2,h=new Uint32Array(e.buffer,t,l);if(n.FeatureTest.isLittleEndian){for(;o<l-2;o+=3,s+=4){const e=h[o],t=h[o+1],n=h[o+2];i[s]=4278190080|e,i[s+1]=e>>>24|t<<8|4278190080,i[s+2]=t>>>16|n<<16|4278190080,i[s+3]=n>>>8|4278190080}for(let t=4*o,n=e.length;t<n;t+=3)i[s++]=e[t]|e[t+1]<<8|e[t+2]<<16|4278190080}else{for(;o<l-2;o+=3,s+=4){const e=h[o],t=h[o+1],n=h[o+2];i[s]=255|e,i[s+1]=e<<24|t>>>8|255,i[s+2]=t<<16|n>>>16|255,i[s+3]=n<<8|255}for(let t=4*o,n=e.length;t<n;t+=3)i[s++]=e[t]<<24|e[t+1]<<16|e[t+2]<<8|255}return{srcPos:t,destPos:s}}(e)}return null},t.grayToRGBA=function(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 s({src:e,srcPos:t=0,dest:i,width:s,height:r,nonBlackColor:a=4294967295,inverseDecode:o=!1}){const l=n.FeatureTest.isLittleEndian?4278190080:255,[h,c]=o?[a,l]:[l,a],d=s>>3,u=7&s,p=e.length;i=new Uint32Array(i.buffer);let g=0;for(let n=0;n<r;n++){for(const n=t+d;t<n;t++){const n=t<p?e[t]:255;i[g++]=128&n?c:h,i[g++]=64&n?c:h,i[g++]=32&n?c:h,i[g++]=16&n?c:h,i[g++]=8&n?c:h,i[g++]=4&n?c:h,i[g++]=2&n?c:h,i[g++]=1&n?c:h}if(0===u)continue;const n=t<p?e[t++]:255;for(let e=0;e<u;e++)i[g++]=n&1<<7-e?c:h}return{srcPos:t,destPos:g}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalWorkerOptions=void 0;const i=Object.create(null);t.GlobalWorkerOptions=i,i.workerPort=null,i.workerSrc=""},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MessageHandler=void 0;var n=i(1);const s=1,r=2,a=1,o=2,l=3,h=4,c=5,d=6,u=7,p=8;function g(e){switch(e instanceof Error||"object"==typeof e&&null!==e||(0,n.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),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{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)return void this.#dt(t);if(t.callback){const e=t.callbackId,i=this.callbackCapabilities[e];if(!i)throw new Error(`Cannot resolve callback ${e}`);if(delete this.callbackCapabilities[e],t.callback===s)i.resolve(t.data);else{if(t.callback!==r)throw new Error("Unexpected callback case");i.reject(g(t.reason))}return}const n=this.actionHandler[t.action];if(!n)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){const e=this.sourceName,a=t.sourceName;new Promise((function(e){e(n(t.data))})).then((function(n){i.postMessage({sourceName:e,targetName:a,callback:s,callbackId:t.callbackId,data:n})}),(function(n){i.postMessage({sourceName:e,targetName:a,callback:r,callbackId:t.callbackId,reason:g(n)})}))}else t.streamId?this.#ut(t):n(t.data)},i.addEventListener("message",this._onComObjOnMessage)}on(e,t){const i=this.actionHandler;if(i[e])throw new Error(`There is already an actionName called "${e}"`);i[e]=t}send(e,t,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},i)}sendWithPromise(e,t,i){const s=this.callbackId++,r=new n.PromiseCapability;this.callbackCapabilities[s]=r;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:s,data:t},i)}catch(e){r.reject(e)}return r.promise}sendWithStream(e,t,i,s){const r=this.streamId++,o=this.sourceName,l=this.targetName,h=this.comObj;return new ReadableStream({start:i=>{const a=new n.PromiseCapability;return this.streamControllers[r]={controller:i,startCall:a,pullCall:null,cancelCall:null,isClosed:!1},h.postMessage({sourceName:o,targetName:l,action:e,streamId:r,data:t,desiredSize:i.desiredSize},s),a.promise},pull:e=>{const t=new n.PromiseCapability;return this.streamControllers[r].pullCall=t,h.postMessage({sourceName:o,targetName:l,stream:d,streamId:r,desiredSize:e.desiredSize}),t.promise},cancel:e=>{(0,n.assert)(e instanceof Error,"cancel must have a valid reason");const t=new n.PromiseCapability;return this.streamControllers[r].cancelCall=t,this.streamControllers[r].isClosed=!0,h.postMessage({sourceName:o,targetName:l,stream:a,streamId:r,reason:g(e)}),t.promise}},i)}#ut(e){const t=e.streamId,i=this.sourceName,s=e.sourceName,r=this.comObj,a=this,o=this.actionHandler[e.action],d={enqueue(e,a=1,o){if(this.isCancelled)return;const l=this.desiredSize;this.desiredSize-=a,l>0&&this.desiredSize<=0&&(this.sinkCapability=new n.PromiseCapability,this.ready=this.sinkCapability.promise),r.postMessage({sourceName:i,targetName:s,stream:h,streamId:t,chunk:e},o)},close(){this.isCancelled||(this.isCancelled=!0,r.postMessage({sourceName:i,targetName:s,stream:l,streamId:t}),delete a.streamSinks[t])},error(e){(0,n.assert)(e instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,r.postMessage({sourceName:i,targetName:s,stream:c,streamId:t,reason:g(e)}))},sinkCapability:new n.PromiseCapability,onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};d.sinkCapability.resolve(),d.ready=d.sinkCapability.promise,this.streamSinks[t]=d,new Promise((function(t){t(o(e.data,d))})).then((function(){r.postMessage({sourceName:i,targetName:s,stream:p,streamId:t,success:!0})}),(function(e){r.postMessage({sourceName:i,targetName:s,stream:p,streamId:t,reason:g(e)})}))}#dt(e){const t=e.streamId,i=this.sourceName,s=e.sourceName,r=this.comObj,f=this.streamControllers[t],m=this.streamSinks[t];switch(e.stream){case p:e.success?f.startCall.resolve():f.startCall.reject(g(e.reason));break;case u:e.success?f.pullCall.resolve():f.pullCall.reject(g(e.reason));break;case d:if(!m){r.postMessage({sourceName:i,targetName:s,stream:u,streamId:t,success:!0});break}m.desiredSize<=0&&e.desiredSize>0&&m.sinkCapability.resolve(),m.desiredSize=e.desiredSize,new Promise((function(e){e(m.onPull?.())})).then((function(){r.postMessage({sourceName:i,targetName:s,stream:u,streamId:t,success:!0})}),(function(e){r.postMessage({sourceName:i,targetName:s,stream:u,streamId:t,reason:g(e)})}));break;case h:if((0,n.assert)(f,"enqueue should have stream controller"),f.isClosed)break;f.controller.enqueue(e.chunk);break;case l:if((0,n.assert)(f,"close should have stream controller"),f.isClosed)break;f.isClosed=!0,f.controller.close(),this.#pt(f,t);break;case c:(0,n.assert)(f,"error should have stream controller"),f.controller.error(g(e.reason)),this.#pt(f,t);break;case o:e.success?f.cancelCall.resolve():f.cancelCall.reject(g(e.reason)),this.#pt(f,t);break;case a:if(!m)break;new Promise((function(t){t(m.onCancel?.(g(e.reason)))})).then((function(){r.postMessage({sourceName:i,targetName:s,stream:o,streamId:t,success:!0})}),(function(e){r.postMessage({sourceName:i,targetName:s,stream:o,streamId:t,reason:g(e)})})),m.sinkCapability.reject(g(e.reason)),m.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}async#pt(e,t){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]),delete this.streamControllers[t]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Metadata=void 0;var n=i(1);t.Metadata=class{#gt;#ft;constructor({parsedData:e,rawData:t}){this.#gt=e,this.#ft=t}getRaw(){return this.#ft}get(e){return this.#gt.get(e)??null}getAll(){return(0,n.objectFromMap)(this.#gt)}has(e){return this.#gt.has(e)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionalContentConfig=void 0;var n=i(1),s=i(8);const r=Symbol("INTERNAL");class a{#mt=!0;constructor(e,t){this.name=e,this.intent=t}get visible(){return this.#mt}_setVisible(e,t){e!==r&&(0,n.unreachable)("Internal method `_setVisible` called."),this.#mt=t}}t.OptionalContentConfig=class{#_t=null;#vt=new Map;#bt=null;#yt=null;constructor(e){if(this.name=null,this.creator=null,null!==e){this.name=e.name,this.creator=e.creator,this.#yt=e.order;for(const t of e.groups)this.#vt.set(t.id,new a(t.name,t.intent));if("OFF"===e.baseState)for(const e of this.#vt.values())e._setVisible(r,!1);for(const t of e.on)this.#vt.get(t)._setVisible(r,!0);for(const t of e.off)this.#vt.get(t)._setVisible(r,!1);this.#bt=this.getHash()}}#St(e){const t=e.length;if(t<2)return!0;const i=e[0];for(let s=1;s<t;s++){const t=e[s];let r;if(Array.isArray(t))r=this.#St(t);else{if(!this.#vt.has(t))return(0,n.warn)(`Optional content group not found: ${t}`),!0;r=this.#vt.get(t).visible}switch(i){case"And":if(!r)return!1;break;case"Or":if(r)return!0;break;case"Not":return!r;default:return!0}}return"And"===i}isVisible(e){if(0===this.#vt.size)return!0;if(!e)return(0,n.warn)("Optional content group not defined."),!0;if("OCG"===e.type)return this.#vt.has(e.id)?this.#vt.get(e.id).visible:((0,n.warn)(`Optional content group not found: ${e.id}`),!0);if("OCMD"===e.type){if(e.expression)return this.#St(e.expression);if(!e.policy||"AnyOn"===e.policy){for(const t of e.ids){if(!this.#vt.has(t))return(0,n.warn)(`Optional content group not found: ${t}`),!0;if(this.#vt.get(t).visible)return!0}return!1}if("AllOn"===e.policy){for(const t of e.ids){if(!this.#vt.has(t))return(0,n.warn)(`Optional content group not found: ${t}`),!0;if(!this.#vt.get(t).visible)return!1}return!0}if("AnyOff"===e.policy){for(const t of e.ids){if(!this.#vt.has(t))return(0,n.warn)(`Optional content group not found: ${t}`),!0;if(!this.#vt.get(t).visible)return!0}return!1}if("AllOff"===e.policy){for(const t of e.ids){if(!this.#vt.has(t))return(0,n.warn)(`Optional content group not found: ${t}`),!0;if(this.#vt.get(t).visible)return!1}return!0}return(0,n.warn)(`Unknown optional content policy ${e.policy}.`),!0}return(0,n.warn)(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0){this.#vt.has(e)?(this.#vt.get(e)._setVisible(r,!!t),this.#_t=null):(0,n.warn)(`Optional content group not found: ${e}`)}get hasInitialVisibility(){return null===this.#bt||this.getHash()===this.#bt}getOrder(){return this.#vt.size?this.#yt?this.#yt.slice():[...this.#vt.keys()]:null}getGroups(){return this.#vt.size>0?(0,n.objectFromMap)(this.#vt):null}getGroup(e){return this.#vt.get(e)||null}getHash(){if(null!==this.#_t)return this.#_t;const e=new s.MurmurHash3_64;for(const[t,i]of this.#vt)e.update(`${t}:${i.visible}`);return this.#_t=e.hexdigest()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFDataTransportStream=void 0;var n=i(1),s=i(6);t.PDFDataTransportStream=class{constructor({length:e,initialData:t,progressiveDone:i=!1,contentDispositionFilename:s=null,disableRange:r=!1,disableStream:a=!1},o){if((0,n.assert)(o,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'),this._queuedChunks=[],this._progressiveDone=i,this._contentDispositionFilename=s,t?.length>0){const e=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;this._queuedChunks.push(e)}this._pdfDataRangeTransport=o,this._isStreamingSupported=!a,this._isRangeSupported=!r,this._contentLength=e,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener(((e,t)=>{this._onReceiveData({begin:e,chunk:t})})),this._pdfDataRangeTransport.addProgressListener(((e,t)=>{this._onProgress({loaded:e,total:t})})),this._pdfDataRangeTransport.addProgressiveReadListener((e=>{this._onReceiveData({chunk:e})})),this._pdfDataRangeTransport.addProgressiveDoneListener((()=>{this._onProgressiveDone()})),this._pdfDataRangeTransport.transportReady()}_onReceiveData({begin:e,chunk:t}){const i=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;if(void 0===e)this._fullRequestReader?this._fullRequestReader._enqueue(i):this._queuedChunks.push(i);else{const t=this._rangeReaders.some((function(t){return t._begin===e&&(t._enqueue(i),!0)}));(0,n.assert)(t,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(e){void 0===e.total?this._rangeReaders[0]?.onProgress?.({loaded:e.loaded}):this._fullRequestReader?.onProgress?.({loaded:e.loaded,total:e.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){(0,n.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new r(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const i=new a(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(i),i}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeReaders.slice(0))t.cancel(e);this._pdfDataRangeTransport.abort()}};class r{constructor(e,t,i=!1,n=null){this._stream=e,this._done=i||!1,this._filename=(0,s.isPdfFile)(n)?n:null,this._queuedChunks=t||[],this._loaded=0;for(const e of this._queuedChunks)this._loaded+=e.byteLength;this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):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;return this._requests.push(e),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 a{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;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=new n.PromiseCapability;return this._requests.push(e),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,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFFetchStream=void 0;var n=i(1),s=i(20);function r(e,t,i){return{method:"GET",headers:e,signal:i.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function a(e){const t=new Headers;for(const i in e){const n=e[i];void 0!==n&&t.append(i,n)}return t}function o(e){return e instanceof Uint8Array?e.buffer:e instanceof ArrayBuffer?e:((0,n.warn)(`getArrayBuffer - unexpected data format: ${e}`),new Uint8Array(e).buffer)}t.PDFFetchStream=class{constructor(e){this.source=e,this.isHttp=/^https?:/i.test(e.url),this.httpHeaders=this.isHttp&&e.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,n.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new l(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const i=new h(this,e,t);return this._rangeRequestReaders.push(i),i}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}};class l{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=a(this._stream.httpHeaders);const i=t.url;fetch(i,r(this._headers,this._withCredentials,this._abortController)).then((e=>{if(!(0,s.validateResponseStatus)(e.status))throw(0,s.createResponseStatusError)(e.status,i);this._reader=e.body.getReader(),this._headersCapability.resolve();const t=t=>e.headers.get(t),{allowRangeRequests:r,suggestedLength:a}=(0,s.validateRangeRequestCapabilities)({getResponseHeader:t,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=r,this._contentLength=a||this._contentLength,this._filename=(0,s.extractFilenameFromHeader)(t),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new n.AbortException("Streaming is disabled."))})).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:o(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}class h{constructor(e,t,i){this._stream=e,this._reader=null,this._loaded=0;const o=e.source;this._withCredentials=o.withCredentials||!1,this._readCapability=new n.PromiseCapability,this._isStreamingSupported=!o.disableStream,this._abortController=new AbortController,this._headers=a(this._stream.httpHeaders),this._headers.append("Range",`bytes=${t}-${i-1}`);const l=o.url;fetch(l,r(this._headers,this._withCredentials,this._abortController)).then((e=>{if(!(0,s.validateResponseStatus)(e.status))throw(0,s.createResponseStatusError)(e.status,l);this._readCapability.resolve(),this._reader=e.body.getReader()})).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded}),{value:o(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createResponseStatusError=function(e,t){return 404===e||0===e&&t.startsWith("file:")?new n.MissingPDFException('Missing PDF "'+t+'".'):new n.UnexpectedResponseException(`Unexpected server response (${e}) while retrieving PDF "${t}".`,e)},t.extractFilenameFromHeader=function(e){const t=e("Content-Disposition");if(t){let e=(0,s.getFilenameFromContentDispositionHeader)(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if((0,r.isPdfFile)(e))return e}return null},t.validateRangeRequestCapabilities=function({getResponseHeader:e,isHttp:t,rangeChunkSize:i,disableRange:n}){const s={allowRangeRequests:!1,suggestedLength:void 0},r=parseInt(e("Content-Length"),10);return Number.isInteger(r)?(s.suggestedLength=r,r<=2*i||n||!t||"bytes"!==e("Accept-Ranges")||"identity"!==(e("Content-Encoding")||"identity")||(s.allowRangeRequests=!0),s):s},t.validateResponseStatus=function(e){return 200===e||206===e};var n=i(1),s=i(21),r=i(6)},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getFilenameFromContentDispositionHeader=function(e){let t=!0,i=s("filename\\*","i").exec(e);if(i){i=i[1];let e=o(i);return e=unescape(e),e=l(e),e=h(e),a(e)}if(i=function(e){const t=[];let i;const n=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(i=n.exec(e));){let[,e,n,s]=i;if(e=parseInt(e,10),e in t){if(0===e)break}else t[e]=[n,s]}const r=[];for(let e=0;e<t.length&&e in t;++e){let[i,n]=t[e];n=o(n),i&&(n=unescape(n),0===e&&(n=l(n))),r.push(n)}return r.join("")}(e),i)return a(h(i));if(i=s("filename","i").exec(e),i){i=i[1];let e=o(i);return e=h(e),a(e)}function s(e,t){return new RegExp("(?:^|;)\\s*"+e+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',t)}function r(e,i){if(e){if(!/^[\x00-\xFF]+$/.test(i))return i;try{const s=new TextDecoder(e,{fatal:!0}),r=(0,n.stringToBytes)(i);i=s.decode(r),t=!1}catch{}}return i}function a(e){return t&&/[\x80-\xff]/.test(e)&&(e=r("utf-8",e),t&&(e=r("iso-8859-1",e))),e}function o(e){if(e.startsWith('"')){const t=e.slice(1).split('\\"');for(let e=0;e<t.length;++e){const i=t[e].indexOf('"');-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 l(e){const t=e.indexOf("'");return-1===t?e:r(e.slice(0,t),e.slice(t+1).replace(/^[^']*'/,""))}function h(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 r(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{}return r(t,n)}))}return""};var n=i(1)},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFNetworkStream=void 0;var n=i(1),s=i(20);class r{constructor(e,t={}){this.url=e,this.isHttp=/^https?:/i.test(e),this.httpHeaders=this.isHttp&&t.httpHeaders||Object.create(null),this.withCredentials=t.withCredentials||!1,this.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)}return this.isHttp&&"begin"in e&&"end"in e?(t.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),n.expectedStatus=206):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),i}onProgress(e,t){const i=this.pendingRequests[e];i&&i.onProgress?.(t)}onStateChange(e,t){const i=this.pendingRequests[e];if(!i)return;const s=i.xhr;if(s.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),4!==s.readyState)return;if(!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],0===s.status&&this.isHttp)return void i.onError?.(s.status);const r=s.status||200;if((200!==r||206!==i.expectedStatus)&&r!==i.expectedStatus)return void i.onError?.(s.status);const a=function(e){const t=e.response;return"string"!=typeof t?t:(0,n.stringToBytes)(t).buffer}(s);if(206===r){const e=s.getResponseHeader("Content-Range"),t=/bytes (\d+)-(\d+)\/(\d+)/.exec(e);i.onDone({begin:parseInt(t[1],10),chunk:a})}else a?i.onDone({begin:0,chunk:a}):i.onError?.(s.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}}t.PDFNetworkStream=class{constructor(e){this._source=e,this._manager=new r(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(){return(0,n.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new a(this._manager,this._source),this._fullRequestReader}getRangeReader(e,t){const i=new o(this._manager,e,t);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}};class a{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),i=e=>t.getResponseHeader(e),{allowRangeRequests:n,suggestedLength:r}=(0,s.validateRangeRequestCapabilities)({getResponseHeader:i,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});n&&(this._isRangeSupported=!0),this._contentLength=r||this._contentLength,this._filename=(0,s.extractFilenameFromHeader)(i),this._isRangeSupported&&this._manager.abortRequest(e),this._headersReceivedCapability.resolve()}_onDone(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=(0,s.createResponseStatusError)(e,this._url),this._headersReceivedCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=new n.PromiseCapability;return this._requests.push(e),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 o{constructor(e,t,i){this._manager=e;const n={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._requestId=e.requestRange(t,i,n),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(e){const t=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError=(0,s.createResponseStatusError)(e,this._url);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){this.isStreamingSupported||this.onProgress?.({loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=new n.PromiseCapability;return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFNodeStream=void 0;var n=i(1),s=i(20);const r=/^file:\/\/\/[a-zA-Z]:\//;t.PDFNodeStream=class{constructor(e){this.source=e,this.url=function(e){const t=require$$5,i=t.parse(e);return"file:"===i.protocol||i.host?i:/^[a-z]:[/\\]/i.test(e)?t.parse(`file:///${e}`):(i.host||(i.protocol="file:"),i)}(e.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.httpHeaders=this.isHttp&&e.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,n.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new d(this):new h(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const i=this.isFsUrl?new u(this,e,t):new c(this,e,t);return this._rangeRequestReaders.push(i),i}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}};class a{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(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return null===e?(this._readCapability=new n.PromiseCapability,this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",(()=>{this._readCapability.resolve()})),e.on("end",(()=>{e.destroy(),this._done=!0,this._readCapability.resolve()})),e.on("error",(e=>{this._error(e)})),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new n.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class o{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(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return null===e?(this._readCapability=new n.PromiseCapability,this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",(()=>{this._readCapability.resolve()})),e.on("end",(()=>{e.destroy(),this._done=!0,this._readCapability.resolve()})),e.on("error",(e=>{this._error(e)})),this._storedError&&this._readableStream.destroy(this._storedError)}}function l(e,t){return{protocol:e.protocol,auth:e.auth,host:e.hostname,port:e.port,path:e.path,method:"GET",headers:t}}class h extends a{constructor(e){super(e);const t=t=>{if(404===t.statusCode){const e=new n.MissingPDFException(`Missing PDF "${this._url}".`);return this._storedError=e,void this._headersCapability.reject(e)}this._headersCapability.resolve(),this._setReadableStream(t);const i=e=>this._readableStream.headers[e.toLowerCase()],{allowRangeRequests:r,suggestedLength:a}=(0,s.validateRangeRequestCapabilities)({getResponseHeader:i,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=r,this._contentLength=a||this._contentLength,this._filename=(0,s.extractFilenameFromHeader)(i)};if(this._request=null,"http:"===this._url.protocol){const i=require$$5;this._request=i.request(l(this._url,e.httpHeaders),t)}else{const i=require$$5;this._request=i.request(l(this._url,e.httpHeaders),t)}this._request.on("error",(e=>{this._storedError=e,this._headersCapability.reject(e)})),this._request.end()}}class c extends o{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 s=e=>{if(404!==e.statusCode)this._setReadableStream(e);else{const e=new n.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=e}};if(this._request=null,"http:"===this._url.protocol){const e=require$$5;this._request=e.request(l(this._url,this._httpHeaders),s)}else{const e=require$$5;this._request=e.request(l(this._url,this._httpHeaders),s)}this._request.on("error",(e=>{this._storedError=e})),this._request.end()}}class d extends a{constructor(e){super(e);let t=decodeURIComponent(this._url.path);r.test(this._url.href)&&(t=t.replace(/^\//,""));const i=require$$5;i.lstat(t,((e,s)=>{if(e)return"ENOENT"===e.code&&(e=new n.MissingPDFException(`Missing PDF "${t}".`)),this._storedError=e,void this._headersCapability.reject(e);this._contentLength=s.size,this._setReadableStream(i.createReadStream(t)),this._headersCapability.resolve()}))}}class u extends o{constructor(e,t,i){super(e);let n=decodeURIComponent(this._url.path);r.test(this._url.href)&&(n=n.replace(/^\//,""));const s=require$$5;this._setReadableStream(s.createReadStream(n,{start:t,end:i-1}))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SVGGraphics=void 0;var n=i(6),s=i(1);const r="normal",a="normal",o="#000000",l=["butt","round","square"],h=["miter","round","bevel"],c=function(e,t="",i=!1){if(URL.createObjectURL&&"undefined"!=typeof Blob&&!i)return URL.createObjectURL(new Blob([e],{type:t}));const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let s=`data:${t};base64,`;for(let t=0,i=e.length;t<i;t+=3){const r=255&e[t],a=255&e[t+1],o=255&e[t+2];s+=n[r>>2]+n[(3&r)<<4|a>>4]+n[t+1<i?(15&a)<<2|o>>6:64]+n[t+2<i?63&o:64]}return s},d=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 i(e,i,n,s){let r=s;const a=i.length;n[r]=a>>24&255,n[r+1]=a>>16&255,n[r+2]=a>>8&255,n[r+3]=255&a,r+=4,n[r]=255&e.charCodeAt(0),n[r+1]=255&e.charCodeAt(1),n[r+2]=255&e.charCodeAt(2),n[r+3]=255&e.charCodeAt(3),r+=4,n.set(i,r),r+=i.length;const o=function(e,i,n){let s=-1;for(let r=i;r<n;r++){const i=255&(s^e[r]);s=s>>>8^t[i]}return-1^s}(n,s+4,r);n[r]=o>>24&255,n[r+1]=o>>16&255,n[r+2]=o>>8&255,n[r+3]=255&o}function n(e){let t=e.length;const i=65535,n=Math.ceil(t/i),s=new Uint8Array(2+t+5*n+4);let r=0;s[r++]=120,s[r++]=156;let a=0;for(;t>i;)s[r++]=0,s[r++]=255,s[r++]=255,s[r++]=0,s[r++]=0,s.set(e.subarray(a,a+i),r),r+=i,a+=i,t-=i;s[r++]=1,s[r++]=255&t,s[r++]=t>>8&255,s[r++]=255&~t,s[r++]=(65535&~t)>>8&255,s.set(e.subarray(a),r),r+=e.length-a;const o=function(e,t,i){let n=1,s=0;for(let r=t;r<i;++r)n=(n+(255&e[r]))%65521,s=(s+n)%65521;return s<<16|n}(e,0,e.length);return s[r++]=o>>24&255,s[r++]=o>>16&255,s[r++]=o>>8&255,s[r++]=255&o,s}function r(t,r,a,o){const l=t.width,h=t.height;let d,u,p;const g=t.data;switch(r){case s.ImageKind.GRAYSCALE_1BPP:u=0,d=1,p=l+7>>3;break;case s.ImageKind.RGB_24BPP:u=2,d=8,p=3*l;break;case s.ImageKind.RGBA_32BPP:u=6,d=8,p=4*l;break;default:throw new Error("invalid format")}const f=new Uint8Array((1+p)*h);let m=0,_=0;for(let e=0;e<h;++e)f[m++]=0,f.set(g.subarray(_,_+p),m),_+=p,m+=p;if(r===s.ImageKind.GRAYSCALE_1BPP&&o){m=0;for(let e=0;e<h;e++){m++;for(let e=0;e<p;e++)f[m++]^=255}}const v=new Uint8Array([l>>24&255,l>>16&255,l>>8&255,255&l,h>>24&255,h>>16&255,h>>8&255,255&h,d,u,0,0,0]),b=function(e){if(!s.isNodeJS)return n(e);try{const t=parseInt(process.versions.node)>=8?e:Buffer.from(e),i=require$$5.deflateSync(t,{level:9});return i instanceof Uint8Array?i:new Uint8Array(i)}catch(e){(0,s.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+e)}return n(e)}(f),y=e.length+36+v.length+b.length,S=new Uint8Array(y);let P=0;return S.set(e,P),P+=e.length,i("IHDR",v,S,P),P+=12+v.length,i("IDATA",b,S,P),P+=12+b.length,i("IEND",new Uint8Array(0),S,P),c(S,"image/png",a)}return function(e,t,i){return r(e,void 0===e.kind?s.ImageKind.GRAYSCALE_1BPP:e.kind,t,i)}}();class u{constructor(){this.fontSizeScale=1,this.fontWeight=a,this.fontSize=0,this.textMatrix=s.IDENTITY_MATRIX,this.fontMatrix=s.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=s.TextRenderingMode.FILL,this.textMatrixScale=1,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRise=0,this.fillColor=o,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 p(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 g(e){if(0===e[4]&&0===e[5]){if(0===e[1]&&0===e[2])return 1===e[0]&&1===e[3]?"":`scale(${p(e[0])} ${p(e[3])})`;if(e[0]===e[3]&&e[1]===-e[2])return`rotate(${p(180*Math.acos(e[0])/Math.PI)})`}else if(1===e[0]&&0===e[1]&&0===e[2]&&1===e[3])return`translate(${p(e[4])} ${p(e[5])})`;return`matrix(${p(e[0])} ${p(e[1])} ${p(e[2])} ${p(e[3])} ${p(e[4])} ${p(e[5])})`}let f=0,m=0,_=0;t.SVGGraphics=class{constructor(e,t,i=!1){(0,n.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future."),this.svgFactory=new n.DOMSVGFactory,this.current=new u,this.transformMatrix=s.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=e,this.objs=t,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!i,this._operatorIdMapping=[];for(const e in s.OPS)this._operatorIdMapping[s.OPS[e]]=e}getObject(e,t=null){return"string"==typeof e?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}save(){this.transformStack.push(this.transformMatrix);const e=this.current;this.extraStack.push(e),this.current=e.clone()}restore(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}group(e){this.save(),this.executeOpTree(e),this.restore()}loadDependencies(e){const t=e.fnArray,i=e.argsArray;for(let e=0,n=t.length;e<n;e++)if(t[e]===s.OPS.dependency)for(const t of i[e]){const e=t.startsWith("g_")?this.commonObjs:this.objs,i=new Promise((i=>{e.get(t,i)}));this.current.dependencies.push(i)}return Promise.all(this.current.dependencies)}transform(e,t,i,n,r,a){const o=[e,t,i,n,r,a];this.transformMatrix=s.Util.transform(this.transformMatrix,o),this.tgrp=null}getSVG(e,t){this.viewport=t;const i=this._initialize(t);return this.loadDependencies(e).then((()=>(this.transformMatrix=s.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(e)),i)))}convertOpList(e){const t=this._operatorIdMapping,i=e.argsArray,n=e.fnArray,s=[];for(let e=0,r=n.length;e<r;e++){const r=n[e];s.push({fnId:r,fn:t[r],args:i[e]})}return function(e){let t=[];const i=[];for(const n of e)"save"!==n.fn?"restore"===n.fn?t=i.pop():t.push(n):(t.push({fnId:92,fn:"group",items:[]}),i.push(t),t=t.at(-1).items);return t}(s)}executeOpTree(e){for(const t of e){const e=t.fn,i=t.fnId,n=t.args;switch(0|i){case s.OPS.beginText:this.beginText();break;case s.OPS.dependency:break;case s.OPS.setLeading:this.setLeading(n);break;case s.OPS.setLeadingMoveText:this.setLeadingMoveText(n[0],n[1]);break;case s.OPS.setFont:this.setFont(n);break;case s.OPS.showText:case s.OPS.showSpacedText:this.showText(n[0]);break;case s.OPS.endText:this.endText();break;case s.OPS.moveText:this.moveText(n[0],n[1]);break;case s.OPS.setCharSpacing:this.setCharSpacing(n[0]);break;case s.OPS.setWordSpacing:this.setWordSpacing(n[0]);break;case s.OPS.setHScale:this.setHScale(n[0]);break;case s.OPS.setTextMatrix:this.setTextMatrix(n[0],n[1],n[2],n[3],n[4],n[5]);break;case s.OPS.setTextRise:this.setTextRise(n[0]);break;case s.OPS.setTextRenderingMode:this.setTextRenderingMode(n[0]);break;case s.OPS.setLineWidth:this.setLineWidth(n[0]);break;case s.OPS.setLineJoin:this.setLineJoin(n[0]);break;case s.OPS.setLineCap:this.setLineCap(n[0]);break;case s.OPS.setMiterLimit:this.setMiterLimit(n[0]);break;case s.OPS.setFillRGBColor:this.setFillRGBColor(n[0],n[1],n[2]);break;case s.OPS.setStrokeRGBColor:this.setStrokeRGBColor(n[0],n[1],n[2]);break;case s.OPS.setStrokeColorN:this.setStrokeColorN(n);break;case s.OPS.setFillColorN:this.setFillColorN(n);break;case s.OPS.shadingFill:this.shadingFill(n[0]);break;case s.OPS.setDash:this.setDash(n[0],n[1]);break;case s.OPS.setRenderingIntent:this.setRenderingIntent(n[0]);break;case s.OPS.setFlatness:this.setFlatness(n[0]);break;case s.OPS.setGState:this.setGState(n[0]);break;case s.OPS.fill:this.fill();break;case s.OPS.eoFill:this.eoFill();break;case s.OPS.stroke:this.stroke();break;case s.OPS.fillStroke:this.fillStroke();break;case s.OPS.eoFillStroke:this.eoFillStroke();break;case s.OPS.clip:this.clip("nonzero");break;case s.OPS.eoClip:this.clip("evenodd");break;case s.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case s.OPS.paintImageXObject:this.paintImageXObject(n[0]);break;case s.OPS.paintInlineImageXObject:this.paintInlineImageXObject(n[0]);break;case s.OPS.paintImageMaskXObject:this.paintImageMaskXObject(n[0]);break;case s.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(n[0],n[1]);break;case s.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case s.OPS.closePath:this.closePath();break;case s.OPS.closeStroke:this.closeStroke();break;case s.OPS.closeFillStroke:this.closeFillStroke();break;case s.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case s.OPS.nextLine:this.nextLine();break;case s.OPS.transform:this.transform(n[0],n[1],n[2],n[3],n[4],n[5]);break;case s.OPS.constructPath:this.constructPath(n[0],n[1]);break;case s.OPS.endPath:this.endPath();break;case 92:this.group(t.items);break;default:(0,s.warn)(`Unimplemented operator ${e}`)}}}setWordSpacing(e){this.current.wordSpacing=e}setCharSpacing(e){this.current.charSpacing=e}nextLine(){this.moveText(0,this.current.leading)}setTextMatrix(e,t,i,n,s,r){const a=this.current;a.textMatrix=a.lineMatrix=[e,t,i,n,s,r],a.textMatrixScale=Math.hypot(e,t),a.x=a.lineX=0,a.y=a.lineY=0,a.xcoords=[],a.ycoords=[],a.tspan=this.svgFactory.createElement("svg:tspan"),a.tspan.setAttributeNS(null,"font-family",a.fontFamily),a.tspan.setAttributeNS(null,"font-size",`${p(a.fontSize)}px`),a.tspan.setAttributeNS(null,"y",p(-a.y)),a.txtElement=this.svgFactory.createElement("svg:text"),a.txtElement.append(a.tspan)}beginText(){const e=this.current;e.x=e.lineX=0,e.y=e.lineY=0,e.textMatrix=s.IDENTITY_MATRIX,e.lineMatrix=s.IDENTITY_MATRIX,e.textMatrixScale=1,e.tspan=this.svgFactory.createElement("svg:tspan"),e.txtElement=this.svgFactory.createElement("svg:text"),e.txtgrp=this.svgFactory.createElement("svg:g"),e.xcoords=[],e.ycoords=[]}moveText(e,t){const i=this.current;i.x=i.lineX+=e,i.y=i.lineY+=t,i.xcoords=[],i.ycoords=[],i.tspan=this.svgFactory.createElement("svg:tspan"),i.tspan.setAttributeNS(null,"font-family",i.fontFamily),i.tspan.setAttributeNS(null,"font-size",`${p(i.fontSize)}px`),i.tspan.setAttributeNS(null,"y",p(-i.y))}showText(e){const t=this.current,i=t.font,n=t.fontSize;if(0===n)return;const l=t.fontSizeScale,h=t.charSpacing,c=t.wordSpacing,d=t.fontDirection,u=t.textHScale*d,f=i.vertical,m=f?1:-1,_=i.defaultVMetrics,v=n*t.fontMatrix[0];let b=0;for(const s of e){if(null===s){b+=d*c;continue}if("number"==typeof s){b+=m*s*n/1e3;continue}const e=(s.isSpace?c:0)+h,r=s.fontChar;let a,o,u=s.width;if(f){let e;const t=s.vmetric||_;e=s.vmetric?t[1]:.5*u,e=-e*v;const i=t[2]*v;u=t?-t[0]:u,a=e/l,o=(b+i)/l}else a=b/l,o=0;(s.isInFont||i.missingFile)&&(t.xcoords.push(t.x+a),f&&t.ycoords.push(-t.y+o),t.tspan.textContent+=r),b+=f?u*v-e*d:u*v+e*d}t.tspan.setAttributeNS(null,"x",t.xcoords.map(p).join(" ")),f?t.tspan.setAttributeNS(null,"y",t.ycoords.map(p).join(" ")):t.tspan.setAttributeNS(null,"y",p(-t.y)),f?t.y-=b:t.x+=b*u,t.tspan.setAttributeNS(null,"font-family",t.fontFamily),t.tspan.setAttributeNS(null,"font-size",`${p(t.fontSize)}px`),t.fontStyle!==r&&t.tspan.setAttributeNS(null,"font-style",t.fontStyle),t.fontWeight!==a&&t.tspan.setAttributeNS(null,"font-weight",t.fontWeight);const y=t.textRenderingMode&s.TextRenderingMode.FILL_STROKE_MASK;if(y===s.TextRenderingMode.FILL||y===s.TextRenderingMode.FILL_STROKE?(t.fillColor!==o&&t.tspan.setAttributeNS(null,"fill",t.fillColor),t.fillAlpha<1&&t.tspan.setAttributeNS(null,"fill-opacity",t.fillAlpha)):t.textRenderingMode===s.TextRenderingMode.ADD_TO_PATH?t.tspan.setAttributeNS(null,"fill","transparent"):t.tspan.setAttributeNS(null,"fill","none"),y===s.TextRenderingMode.STROKE||y===s.TextRenderingMode.FILL_STROKE){const e=1/(t.textMatrixScale||1);this._setStrokeAttributes(t.tspan,e)}let S=t.textMatrix;0!==t.textRise&&(S=S.slice(),S[5]+=t.textRise),t.txtElement.setAttributeNS(null,"transform",`${g(S)} scale(${p(u)}, -1)`),t.txtElement.setAttributeNS("http://www.w3.org/XML/1998/namespace","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.');this.cssStyle||(this.cssStyle=this.svgFactory.createElement("svg:style"),this.cssStyle.setAttributeNS(null,"type","text/css"),this.defs.append(this.cssStyle));const t=c(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,!this.embedFonts||i.missingFile||this.embeddedFonts[i.loadedName]||(this.addFontStyle(i),this.embeddedFonts[i.loadedName]=i),t.fontMatrix=i.fontMatrix||s.FONT_IDENTITY_MATRIX;let r="normal";i.black?r="900":i.bold&&(r="bold");const a=i.italic?"italic":"normal";n<0?(n=-n,t.fontDirection=-1):t.fontDirection=1,t.fontSize=n,t.fontFamily=i.loadedName,t.fontWeight=r,t.fontStyle=a,t.tspan=this.svgFactory.createElement("svg:tspan"),t.tspan.setAttributeNS(null,"y",p(-t.y)),t.xcoords=[],t.ycoords=[]}endText(){const e=this.current;e.textRenderingMode&s.TextRenderingMode.ADD_TO_PATH_FLAG&&e.txtElement?.hasChildNodes()&&(e.element=e.txtElement,this.clip("nonzero"),this.endPath())}setLineWidth(e){e>0&&(this.current.lineWidth=e)}setLineCap(e){this.current.lineCap=l[e]}setLineJoin(e){this.current.lineJoin=h[e]}setMiterLimit(e){this.current.miterLimit=e}setStrokeAlpha(e){this.current.strokeAlpha=e}setStrokeRGBColor(e,t,i){this.current.strokeColor=s.Util.makeHexColor(e,t,i)}setFillAlpha(e){this.current.fillAlpha=e}setFillRGBColor(e,t,i){this.current.fillColor=s.Util.makeHexColor(e,t,i),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(e){this.current.strokeColor=this._makeColorN_Pattern(e)}setFillColorN(e){this.current.fillColor=this._makeColorN_Pattern(e)}shadingFill(e){const{width:t,height:i}=this.viewport,n=s.Util.inverseTransform(this.transformMatrix),[r,a,o,l]=s.Util.getAxialAlignedBoundingBox([0,0,t,i],n),h=this.svgFactory.createElement("svg:rect");h.setAttributeNS(null,"x",r),h.setAttributeNS(null,"y",a),h.setAttributeNS(null,"width",o-r),h.setAttributeNS(null,"height",l-a),h.setAttributeNS(null,"fill",this._makeShadingPattern(e)),this.current.fillAlpha<1&&h.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(h)}_makeColorN_Pattern(e){return"TilingPattern"===e[0]?this._makeTilingPattern(e):this._makeShadingPattern(e)}_makeTilingPattern(e){const t=e[1],i=e[2],n=e[3]||s.IDENTITY_MATRIX,[r,a,o,l]=e[4],h=e[5],c=e[6],d=e[7],u="shading"+_++,[p,g,f,m]=s.Util.normalizeRect([...s.Util.applyTransform([r,a],n),...s.Util.applyTransform([o,l],n)]),[v,b]=s.Util.singularValueDecompose2dScale(n),y=h*v,S=c*b,P=this.svgFactory.createElement("svg:pattern");P.setAttributeNS(null,"id",u),P.setAttributeNS(null,"patternUnits","userSpaceOnUse"),P.setAttributeNS(null,"width",y),P.setAttributeNS(null,"height",S),P.setAttributeNS(null,"x",`${p}`),P.setAttributeNS(null,"y",`${g}`);const A=this.svg,w=this.transformMatrix,E=this.current.fillColor,x=this.current.strokeColor,C=this.svgFactory.create(f-p,m-g);if(this.svg=C,this.transformMatrix=n,2===d){const e=s.Util.makeHexColor(...t);this.current.fillColor=e,this.current.strokeColor=e}return this.executeOpTree(this.convertOpList(i)),this.svg=A,this.transformMatrix=w,this.current.fillColor=E,this.current.strokeColor=x,P.append(C.childNodes[0]),this.defs.append(P),`url(#${u})`}_makeShadingPattern(e){switch("string"==typeof e&&(e=this.objs.get(e)),e[0]){case"RadialAxial":const t="shading"+_++,i=e[3];let n;switch(e[1]){case"axial":const i=e[4],s=e[5];n=this.svgFactory.createElement("svg:linearGradient"),n.setAttributeNS(null,"id",t),n.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),n.setAttributeNS(null,"x1",i[0]),n.setAttributeNS(null,"y1",i[1]),n.setAttributeNS(null,"x2",s[0]),n.setAttributeNS(null,"y2",s[1]);break;case"radial":const r=e[4],a=e[5],o=e[6],l=e[7];n=this.svgFactory.createElement("svg:radialGradient"),n.setAttributeNS(null,"id",t),n.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),n.setAttributeNS(null,"cx",a[0]),n.setAttributeNS(null,"cy",a[1]),n.setAttributeNS(null,"r",l),n.setAttributeNS(null,"fx",r[0]),n.setAttributeNS(null,"fy",r[1]),n.setAttributeNS(null,"fr",o);break;default:throw new Error(`Unknown RadialAxial type: ${e[1]}`)}for(const e of i){const t=this.svgFactory.createElement("svg:stop");t.setAttributeNS(null,"offset",e[0]),t.setAttributeNS(null,"stop-color",e[1]),n.append(t)}return this.defs.append(n),`url(#${t})`;case"Mesh":return(0,s.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw new Error(`Unknown IR type: ${e[0]}`)}}setDash(e,t){this.current.dashArray=e,this.current.dashPhase=t}constructPath(e,t){const i=this.current;let n=i.x,r=i.y,a=[],o=0;for(const i of e)switch(0|i){case s.OPS.rectangle:n=t[o++],r=t[o++];const e=n+t[o++],i=r+t[o++];a.push("M",p(n),p(r),"L",p(e),p(r),"L",p(e),p(i),"L",p(n),p(i),"Z");break;case s.OPS.moveTo:n=t[o++],r=t[o++],a.push("M",p(n),p(r));break;case s.OPS.lineTo:n=t[o++],r=t[o++],a.push("L",p(n),p(r));break;case s.OPS.curveTo:n=t[o+4],r=t[o+5],a.push("C",p(t[o]),p(t[o+1]),p(t[o+2]),p(t[o+3]),p(n),p(r)),o+=6;break;case s.OPS.curveTo2:a.push("C",p(n),p(r),p(t[o]),p(t[o+1]),p(t[o+2]),p(t[o+3])),n=t[o+2],r=t[o+3],o+=4;break;case s.OPS.curveTo3:n=t[o+2],r=t[o+3],a.push("C",p(t[o]),p(t[o+1]),p(n),p(r),p(n),p(r)),o+=4;break;case s.OPS.closePath:a.push("Z")}a=a.join(" "),i.path&&e.length>0&&e[0]!==s.OPS.rectangle&&e[0]!==s.OPS.moveTo?a=i.path.getAttributeNS(null,"d")+a:(i.path=this.svgFactory.createElement("svg:path"),this._ensureTransformGroup().append(i.path)),i.path.setAttributeNS(null,"d",a),i.path.setAttributeNS(null,"fill","none"),i.element=i.path,i.setCurrentPoint(n,r)}endPath(){const e=this.current;if(e.path=null,!this.pendingClip)return;if(!e.element)return void(this.pendingClip=null);const t="clippath"+f++,i=this.svgFactory.createElement("svg:clipPath");i.setAttributeNS(null,"id",t),i.setAttributeNS(null,"transform",g(this.transformMatrix));const n=e.element.cloneNode(!0);if("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),e.activeClipUrl){e.clipGroup=null;for(const e of this.extraStack)e.clipGroup=null;i.setAttributeNS(null,"clip-path",e.activeClipUrl)}e.activeClipUrl=`url(#${t})`,this.tgrp=null}clip(e){this.pendingClip=e}closePath(){const e=this.current;if(e.path){const t=`${e.path.getAttributeNS(null,"d")}Z`;e.path.setAttributeNS(null,"d",t)}}setLeading(e){this.current.leading=-e}setTextRise(e){this.current.textRise=e}setTextRenderingMode(e){this.current.textRenderingMode=e}setHScale(e){this.current.textHScale=e/100}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[t,i]of e)switch(t){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i);break;case"CA":this.setStrokeAlpha(i);break;case"ca":this.setFillAlpha(i);break;default:(0,s.warn)(`Unimplemented graphic state operator ${t}`)}}fill(){const e=this.current;e.element&&(e.element.setAttributeNS(null,"fill",e.fillColor),e.element.setAttributeNS(null,"fill-opacity",e.fillAlpha),this.endPath())}stroke(){const e=this.current;e.element&&(this._setStrokeAttributes(e.element),e.element.setAttributeNS(null,"fill","none"),this.endPath())}_setStrokeAttributes(e,t=1){const i=this.current;let n=i.dashArray;1!==t&&n.length>0&&(n=n.map((function(e){return t*e}))),e.setAttributeNS(null,"stroke",i.strokeColor),e.setAttributeNS(null,"stroke-opacity",i.strokeAlpha),e.setAttributeNS(null,"stroke-miterlimit",p(i.miterLimit)),e.setAttributeNS(null,"stroke-linecap",i.lineCap),e.setAttributeNS(null,"stroke-linejoin",i.lineJoin),e.setAttributeNS(null,"stroke-width",p(t*i.lineWidth)+"px"),e.setAttributeNS(null,"stroke-dasharray",n.map(p).join(" ")),e.setAttributeNS(null,"stroke-dashoffset",p(t*i.dashPhase)+"px")}eoFill(){this.current.element?.setAttributeNS(null,"fill-rule","evenodd"),this.fill()}fillStroke(){this.stroke(),this.fill()}eoFillStroke(){this.current.element?.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()}closeStroke(){this.closePath(),this.stroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.closePath(),this.eoFillStroke()}paintSolidColorImageMask(){const e=this.svgFactory.createElement("svg:rect");e.setAttributeNS(null,"x","0"),e.setAttributeNS(null,"y","0"),e.setAttributeNS(null,"width","1px"),e.setAttributeNS(null,"height","1px"),e.setAttributeNS(null,"fill",this.current.fillColor),this._ensureTransformGroup().append(e)}paintImageXObject(e){const t=this.getObject(e);t?this.paintInlineImageXObject(t):(0,s.warn)(`Dependent image with object ID ${e} is not ready yet`)}paintInlineImageXObject(e,t){const i=e.width,n=e.height,s=d(e,this.forceDataSchema,!!t),r=this.svgFactory.createElement("svg:rect");r.setAttributeNS(null,"x","0"),r.setAttributeNS(null,"y","0"),r.setAttributeNS(null,"width",p(i)),r.setAttributeNS(null,"height",p(n)),this.current.element=r,this.clip("nonzero");const a=this.svgFactory.createElement("svg:image");a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s),a.setAttributeNS(null,"x","0"),a.setAttributeNS(null,"y",p(-n)),a.setAttributeNS(null,"width",p(i)+"px"),a.setAttributeNS(null,"height",p(n)+"px"),a.setAttributeNS(null,"transform",`scale(${p(1/i)} ${p(-1/n)})`),t?t.append(a):this._ensureTransformGroup().append(a)}paintImageMaskXObject(e){const t=this.getObject(e.data,e);if(t.bitmap)return void(0,s.warn)("paintImageMaskXObject: ImageBitmap support is not implemented, ensure that the `isOffscreenCanvasSupported` API parameter is disabled.");const i=this.current,n=t.width,r=t.height,a=i.fillColor;i.maskId="mask"+m++;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",p(n)),l.setAttributeNS(null,"height",p(r)),l.setAttributeNS(null,"fill",a),l.setAttributeNS(null,"mask",`url(#${i.maskId})`),this.defs.append(o),this._ensureTransformGroup().append(l),this.paintInlineImageXObject(t,o)}paintFormXObjectBegin(e,t){if(Array.isArray(e)&&6===e.length&&this.transform(e[0],e[1],e[2],e[3],e[4],e[5]),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",p(e)),n.setAttributeNS(null,"height",p(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");return n.setAttributeNS(null,"transform",g(e.transform)),t.append(n),this.svg=n,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(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",g(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.XfaText=void 0;class i{static textContent(e){const t=[],n={items:t,styles:Object.create(null)};return function e(n){if(!n)return;let s=null;const r=n.name;if("#text"===r)s=n.value;else{if(!i.shouldBuildText(r))return;n?.attributes?.textContent?s=n.attributes.textContent:n.value&&(s=n.value)}if(null!==s&&t.push({str:s}),n.children)for(const t of n.children)e(t)}(e),n}static shouldBuildText(e){return!("textarea"===e||"input"===e||"option"===e||"select"===e)}}t.XfaText=i},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextLayerRenderTask=void 0,t.renderTextLayer=function(e){e.textContentSource||!e.textContent&&!e.textContentStream||((0,s.deprecated)("The TextLayerRender `textContent`/`textContentStream` parameters will be removed in the future, please use `textContentSource` instead."),e.textContentSource=e.textContent||e.textContentStream);const{container:t,viewport:i}=e,n=getComputedStyle(t),r=n.getPropertyValue("visibility"),a=parseFloat(n.getPropertyValue("--scale-factor"));"visible"===r&&(!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 d(e);return o._render(),o},t.updateTextLayer=function({container:e,viewport:t,textDivs:i,textDivProperties:n,isOffscreenCanvasSupported:r,mustRotate:a=!0,mustRescale:o=!0}){if(a&&(0,s.setLayerDimensions)(e,{rotation:t.rotation}),o){const e=l(0,r),s={prevFontSize:null,prevFontFamily:null,div:null,scale:t.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:e};for(const e of i)s.properties=n.get(e),s.div=e,c(s)}};var n=i(1),s=i(6);const r=30,a=.8,o=new Map;function l(e,t){let i;if(t&&n.FeatureTest.isOffscreenCanvasSupported)i=new OffscreenCanvas(e,e).getContext("2d",{alpha:!1});else{const t=document.createElement("canvas");t.width=t.height=e,i=t.getContext("2d",{alpha:!1})}return i}function h(e,t,i){const s=document.createElement("span"),h={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};e._textDivs.push(s);const c=n.Util.transform(e._transform,t.transform);let d=Math.atan2(c[1],c[0]);const u=i[t.fontName];u.vertical&&(d+=Math.PI/2);const p=Math.hypot(c[2],c[3]),g=p*function(e,t){const i=o.get(e);if(i)return i;const n=l(r,t);n.font=`${r}px ${e}`;const s=n.measureText("");let h=s.fontBoundingBoxAscent,c=Math.abs(s.fontBoundingBoxDescent);if(h){const t=h/(h+c);return o.set(e,t),n.canvas.width=n.canvas.height=0,t}n.strokeStyle="red",n.clearRect(0,0,r,r),n.strokeText("g",0,0);let d=n.getImageData(0,0,r,r).data;c=0;for(let e=d.length-1-3;e>=0;e-=4)if(d[e]>0){c=Math.ceil(e/4/r);break}n.clearRect(0,0,r,r),n.strokeText("A",0,r),d=n.getImageData(0,0,r,r).data,h=0;for(let e=0,t=d.length;e<t;e+=4)if(d[e]>0){h=r-Math.floor(e/4/r);break}if(n.canvas.width=n.canvas.height=0,h){const t=h/(h+c);return o.set(e,t),t}return o.set(e,a),a}(u.fontFamily,e._isOffscreenCanvasSupported);let f,m;0===d?(f=c[4],m=c[5]-g):(f=c[4]+g*Math.sin(d),m=c[5]-g*Math.cos(d));const _="calc(var(--scale-factor)*",v=s.style;e._container===e._rootContainer?(v.left=`${(100*f/e._pageWidth).toFixed(2)}%`,v.top=`${(100*m/e._pageHeight).toFixed(2)}%`):(v.left=`${_}${f.toFixed(2)}px)`,v.top=`${_}${m.toFixed(2)}px)`),v.fontSize=`${_}${p.toFixed(2)}px)`,v.fontFamily=u.fontFamily,h.fontSize=p,s.setAttribute("role","presentation"),s.textContent=t.str,s.dir=t.dir,e._fontInspectorEnabled&&(s.dataset.fontName=t.fontName),0!==d&&(h.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&&(h.canvasWidth=u.vertical?t.height:t.width),e._textDivProperties.set(s,h),e._isReadableStream&&e._layoutText(s)}function c(e){const{div:t,scale:i,properties:n,ctx:s,prevFontSize:r,prevFontFamily:a}=e,{style:o}=t;let l="";if(0!==n.canvasWidth&&n.hasText){const{fontFamily:h}=o,{canvasWidth:c,fontSize:d}=n;r===d&&a===h||(s.font=`${d*i}px ${h}`,e.prevFontSize=d,e.prevFontFamily=h);const{width:u}=s.measureText(t.textContent);u>0&&(l=`scaleX(${c*i/u})`)}0!==n.angle&&(l=`rotate(${n.angle}deg) ${l}`),l.length>0&&(o.transform=l)}class d{constructor({textContentSource:e,container:t,viewport:i,textDivs:r,textDivProperties:a,textContentItemsStr:o,isOffscreenCanvasSupported:h}){this._textContentSource=e,this._isReadableStream=e instanceof ReadableStream,this._container=this._rootContainer=t,this._textDivs=r||[],this._textContentItemsStr=o||[],this._isOffscreenCanvasSupported=h,this._fontInspectorEnabled=!!globalThis.FontInspector?.enabled,this._reader=null,this._textDivProperties=a||new WeakMap,this._canceled=!1,this._capability=new n.PromiseCapability,this._layoutTextParams={prevFontSize:null,prevFontFamily:null,div:null,scale:i.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:l(0,h)};const{pageWidth:c,pageHeight:d,pageX:u,pageY:p}=i.rawDims;this._transform=[1,0,0,-1,-u,p+d],this._pageWidth=c,this._pageHeight=d,(0,s.setLayerDimensions)(t,i),this._capability.promise.finally((()=>{this._layoutTextParams=null})).catch((()=>{}))}get promise(){return this._capability.promise}cancel(){this._canceled=!0,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),h(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);if(this._layoutTextParams.div=e,c(this._layoutTextParams),t.hasText&&this._container.append(e),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 i=()=>{this._reader.read().then((({value:n,done:s})=>{s?e.resolve():(Object.assign(t,n.styles),this._processItems(n.items,t),i())}),e.reject)};this._reader=this._textContentSource.getReader(),i()}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(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=d},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationEditorLayer=void 0;var n=i(1),s=i(4),r=i(28),a=i(33),o=i(6),l=i(34);class h{#Pt;#At=!1;#wt=null;#Et=this.pointerup.bind(this);#xt=this.pointerdown.bind(this);#Ct=new Map;#Mt=!1;#Tt=!1;#Dt=!1;#Ft;static _initialized=!1;constructor({uiManager:e,pageIndex:t,div:i,accessibilityManager:n,annotationLayer:s,viewport:o,l10n:c}){const d=[r.FreeTextEditor,a.InkEditor,l.StampEditor];if(!h._initialized){h._initialized=!0;for(const e of d)e.initialize(c)}e.registerEditorTypes(d),this.#Ft=e,this.pageIndex=t,this.div=i,this.#Pt=n,this.#wt=s,this.viewport=o,this.#Ft.addLayer(this)}get isEmpty(){return 0===this.#Ct.size}updateToolbar(e){this.#Ft.updateToolbar(e)}updateMode(e=this.#Ft.getMode()){this.#kt(),e===n.AnnotationEditorType.INK?(this.addInkEditorIfNeeded(!1),this.disableClick()):this.enableClick(),e!==n.AnnotationEditorType.NONE&&(this.div.classList.toggle("freeTextEditing",e===n.AnnotationEditorType.FREETEXT),this.div.classList.toggle("inkEditing",e===n.AnnotationEditorType.INK),this.div.classList.toggle("stampEditing",e===n.AnnotationEditorType.STAMP),this.div.hidden=!1)}addInkEditorIfNeeded(e){if(e||this.#Ft.getMode()===n.AnnotationEditorType.INK){if(!e)for(const e of this.#Ct.values())if(e.isEmpty())return void e.setInBackground();this.#Lt({offsetX:0,offsetY:0},!1).setInBackground()}}setEditingState(e){this.#Ft.setEditingState(e)}addCommands(e){this.#Ft.addCommands(e)}enable(){this.div.style.pointerEvents="auto";const e=new Set;for(const t of this.#Ct.values())t.enableEditing(),t.annotationElementId&&e.add(t.annotationElementId);if(!this.#wt)return;const t=this.#wt.getEditableAnnotations();for(const i of t){if(i.hide(),this.#Ft.isDeletedAnnotationElement(i.data.id))continue;if(e.has(i.data.id))continue;const t=this.deserialize(i);t&&(this.addOrRebuild(t),t.enableEditing())}}disable(){this.#Dt=!0,this.div.style.pointerEvents="none";const e=new Set;for(const t of this.#Ct.values())t.disableEditing(),t.annotationElementId&&null===t.serialize()?(this.getEditableAnnotation(t.annotationElementId)?.show(),t.remove()):e.add(t.annotationElementId);if(this.#wt){const t=this.#wt.getEditableAnnotations();for(const i of t){const{id:t}=i.data;e.has(t)||this.#Ft.isDeletedAnnotationElement(t)||i.show()}}this.#kt(),this.isEmpty&&(this.div.hidden=!0),this.#Dt=!1}getEditableAnnotation(e){return this.#wt?.getEditableAnnotation(e)||null}setActiveEditor(e){this.#Ft.getActive()!==e&&this.#Ft.setActiveEditor(e)}enableClick(){this.div.addEventListener("pointerdown",this.#xt),this.div.addEventListener("pointerup",this.#Et)}disableClick(){this.div.removeEventListener("pointerdown",this.#xt),this.div.removeEventListener("pointerup",this.#Et)}attach(e){this.#Ct.set(e.id,e);const{annotationElementId:t}=e;t&&this.#Ft.isDeletedAnnotationElement(t)&&this.#Ft.removeDeletedAnnotationElement(e)}detach(e){this.#Ct.delete(e.id),this.#Pt?.removePointerInTextLayer(e.contentDiv),!this.#Dt&&e.annotationElementId&&this.#Ft.addDeletedAnnotationElement(e)}remove(e){this.detach(e),this.#Ft.removeEditor(e),e.div.contains(document.activeElement)&&setTimeout((()=>{this.#Ft.focusMainContainer()}),0),e.div.remove(),e.isAttachedToDOM=!1,this.#Tt||this.addInkEditorIfNeeded(!1)}changeParent(e){e.parent!==this&&(e.annotationElementId&&(this.#Ft.addDeletedAnnotationElement(e.annotationElementId),s.AnnotationEditor.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),e.parent?.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(this.changeParent(e),this.#Ft.addEditor(e),this.attach(e),!e.isAttachedToDOM){const t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(),this.#Ft.addToAnnotationStorage(e)}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;const{activeElement:t}=document;e.div.contains(t)&&(e._focusEventsAllowed=!1,setTimeout((()=>{e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",(()=>{e._focusEventsAllowed=!0}),{once:!0}),t.focus())}),0)),e._structTreeParentId=this.#Pt?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?e.rebuild():this.add(e)}addUndoableEditor(e){this.addCommands({cmd:()=>e._uiManager.rebuild(e),undo:()=>{e.remove()},mustExec:!1})}getNextId(){return this.#Ft.getId()}#Rt(e){switch(this.#Ft.getMode()){case n.AnnotationEditorType.FREETEXT:return new r.FreeTextEditor(e);case n.AnnotationEditorType.INK:return new a.InkEditor(e);case n.AnnotationEditorType.STAMP:return new l.StampEditor(e)}return null}pasteEditor(e,t){this.#Ft.updateToolbar(e),this.#Ft.updateMode(e);const{offsetX:i,offsetY:n}=this.#It(),s=this.getNextId(),r=this.#Rt({parent:this,id:s,x:i,y:n,uiManager:this.#Ft,isCentered:!0,...t});r&&this.add(r)}deserialize(e){switch(e.annotationType??e.annotationEditorType){case n.AnnotationEditorType.FREETEXT:return r.FreeTextEditor.deserialize(e,this,this.#Ft);case n.AnnotationEditorType.INK:return a.InkEditor.deserialize(e,this,this.#Ft);case n.AnnotationEditorType.STAMP:return l.StampEditor.deserialize(e,this,this.#Ft)}return null}#Lt(e,t){const i=this.getNextId(),n=this.#Rt({parent:this,id:i,x:e.offsetX,y:e.offsetY,uiManager:this.#Ft,isCentered:t});return n&&this.add(n),n}#It(){const{x:e,y:t,width:i,height:n}=this.div.getBoundingClientRect(),s=Math.max(0,e),r=Math.max(0,t),a=(s+Math.min(window.innerWidth,e+i))/2-e,o=(r+Math.min(window.innerHeight,t+n))/2-t,[l,h]=this.viewport.rotation%180==0?[a,o]:[o,a];return{offsetX:l,offsetY:h}}addNewEditor(){this.#Lt(this.#It(),!0)}setSelected(e){this.#Ft.setSelected(e)}toggleSelected(e){this.#Ft.toggleSelected(e)}isSelected(e){return this.#Ft.isSelected(e)}unselect(e){this.#Ft.unselect(e)}pointerup(e){const{isMac:t}=n.FeatureTest.platform;0!==e.button||e.ctrlKey&&t||e.target===this.div&&this.#Mt&&(this.#Mt=!1,this.#At?this.#Ft.getMode()!==n.AnnotationEditorType.STAMP?this.#Lt(e,!1):this.#Ft.unselectAll():this.#At=!0)}pointerdown(e){if(this.#Mt)return void(this.#Mt=!1);const{isMac:t}=n.FeatureTest.platform;if(0!==e.button||e.ctrlKey&&t)return;if(e.target!==this.div)return;this.#Mt=!0;const i=this.#Ft.getActive();this.#At=!i||i.isEmpty()}findNewParent(e,t,i){const n=this.#Ft.findParent(t,i);return null!==n&&n!==this&&(n.changeParent(e),!0)}destroy(){this.#Ft.getActive()?.parent===this&&(this.#Ft.commitOrRemove(),this.#Ft.setActiveEditor(null));for(const e of this.#Ct.values())this.#Pt?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#Ct.clear(),this.#Ft.removeLayer(this)}#kt(){this.#Tt=!0;for(const e of this.#Ct.values())e.isEmpty()&&e.remove();this.#Tt=!1}render({viewport:e}){this.viewport=e,(0,o.setLayerDimensions)(this.div,e);for(const e of this.#Ft.getEditors(this.pageIndex))this.add(e);this.updateMode()}update({viewport:e}){this.#Ft.commitOrRemove(),this.viewport=e,(0,o.setLayerDimensions)(this.div,{rotation:e.rotation}),this.updateMode()}get pageDimensions(){const{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}}t.AnnotationEditorLayer=h},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FreeTextEditor=void 0;var n=i(1),s=i(5),r=i(4),a=i(29);class o extends r.AnnotationEditor{#Ot=this.editorDivBlur.bind(this);#Nt=this.editorDivFocus.bind(this);#Bt=this.editorDivInput.bind(this);#Vt=this.editorDivKeydown.bind(this);#Ut;#jt="";#Ht=`${this.id}-editor`;#Wt;#zt=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){const e=o.prototype,t=e=>e.isEmpty(),i=s.AnnotationEditorUIManager.TRANSLATE_SMALL,r=s.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,n.shadow)(this,"_keyboardManager",new s.KeyboardManager([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],e.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],e.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],e._translateEmpty,{args:[-i,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e._translateEmpty,{args:[-r,0],checker:t}],[["ArrowRight","mac+ArrowRight"],e._translateEmpty,{args:[i,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e._translateEmpty,{args:[r,0],checker:t}],[["ArrowUp","mac+ArrowUp"],e._translateEmpty,{args:[0,-i],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e._translateEmpty,{args:[0,-r],checker:t}],[["ArrowDown","mac+ArrowDown"],e._translateEmpty,{args:[0,i],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e._translateEmpty,{args:[0,r],checker:t}]]))}static _type="freetext";constructor(e){super({...e,name:"freeTextEditor"}),this.#Ut=e.color||o._defaultColor||r.AnnotationEditor._defaultLineColor,this.#Wt=e.fontSize||o._defaultFontSize}static initialize(e){r.AnnotationEditor.initialize(e,{strings:["free_text2_default_content","editor_free_text2_aria_label"]});const t=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(t.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,t){switch(e){case n.AnnotationEditorParamsType.FREETEXT_SIZE:o._defaultFontSize=t;break;case n.AnnotationEditorParamsType.FREETEXT_COLOR:o._defaultColor=t}}updateParams(e,t){switch(e){case n.AnnotationEditorParamsType.FREETEXT_SIZE:this.#Gt(t);break;case n.AnnotationEditorParamsType.FREETEXT_COLOR:this.#$t(t)}}static get defaultPropertiesToUpdate(){return[[n.AnnotationEditorParamsType.FREETEXT_SIZE,o._defaultFontSize],[n.AnnotationEditorParamsType.FREETEXT_COLOR,o._defaultColor||r.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[n.AnnotationEditorParamsType.FREETEXT_SIZE,this.#Wt],[n.AnnotationEditorParamsType.FREETEXT_COLOR,this.#Ut]]}#Gt(e){const t=e=>{this.editorDiv.style.fontSize=`calc(${e}px * var(--scale-factor))`,this.translate(0,-(e-this.#Wt)*this.parentScale),this.#Wt=e,this.#qt()},i=this.#Wt;this.addCommands({cmd:()=>{t(e)},undo:()=>{t(i)},mustExec:!0,type:n.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#$t(e){const t=this.#Ut;this.addCommands({cmd:()=>{this.#Ut=this.editorDiv.style.color=e},undo:()=>{this.#Ut=this.editorDiv.style.color=t},mustExec:!0,type:n.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(e,t){this._uiManager.translateSelectedEditors(e,t,!0)}getInitialTranslation(){const e=this.parentScale;return[-o._internalPadding*e,-(o._internalPadding+this.#Wt)*e]}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(n.AnnotationEditorType.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.editorDiv.addEventListener("keydown",this.#Vt),this.editorDiv.addEventListener("focus",this.#Nt),this.editorDiv.addEventListener("blur",this.#Ot),this.editorDiv.addEventListener("input",this.#Bt))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#Ht),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",this.#Vt),this.editorDiv.removeEventListener("focus",this.#Nt),this.editorDiv.removeEventListener("blur",this.#Ot),this.editorDiv.removeEventListener("input",this.#Bt),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freeTextEditing"))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){this.width?this.#Xt():(this.enableEditMode(),this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freeTextEditing")),super.remove()}#Kt(){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")}#qt(){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.rotation%180==this.parentRotation%180?(this.width=i.width/e,this.height=i.height/t):(this.width=i.height/e,this.height=i.width/t),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const e=this.#jt,t=this.#jt=this.#Kt().trimEnd();if(e===t)return;const i=e=>{this.#jt=e,e?(this.#Yt(),this._uiManager.rebuild(this),this.#qt()):this.remove()};this.addCommands({cmd:()=>{i(t)},undo:()=>{i(e)},mustExec:!1}),this.#qt()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(e){this.enterInEditMode()}keydown(e){e.target===this.div&&"Enter"===e.key&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){o._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;this.width&&(e=this.x,t=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#Ht),this.enableEditing(),r.AnnotationEditor._l10nPromise.get("editor_free_text2_aria_label").then((e=>this.editorDiv?.setAttribute("aria-label",e))),r.AnnotationEditor._l10nPromise.get("free_text2_default_content").then((e=>this.editorDiv?.setAttribute("default-content",e))),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize=`calc(${this.#Wt}px * var(--scale-factor))`,i.color=this.#Ut,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),(0,s.bindEvents)(this,this.div,["dblclick","keydown"]),this.width){const[i,n]=this.parentDimensions;if(this.annotationElementId){const{position:s}=this.#zt;let[r,a]=this.getInitialTranslation();[r,a]=this.pageTranslationToScreen(r,a);const[o,l]=this.pageDimensions,[h,c]=this.pageTranslation;let d,u;switch(this.rotation){case 0:d=e+(s[0]-h)/o,u=t+this.height-(s[1]-c)/l;break;case 90:d=e+(s[0]-h)/o,u=t-(s[1]-c)/l,[r,a]=[a,-r];break;case 180:d=e-this.width+(s[0]-h)/o,u=t-(s[1]-c)/l,[r,a]=[-r,-a];break;case 270:d=e+(s[0]-h-this.height*l)/o,u=t+(s[1]-c-this.width*o)/l,[r,a]=[-a,r]}this.setAt(d*i,u*n,r,a)}else this.setAt(e*i,t*n,this.width*i,this.height*n);this.#Yt(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}#Yt(){if(this.editorDiv.replaceChildren(),this.#jt)for(const e of this.#jt.split("\n")){const t=document.createElement("div");t.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(t)}}get contentDiv(){return this.editorDiv}static deserialize(e,t,i){let s=null;if(e instanceof a.FreeTextAnnotationElement){const{data:{defaultAppearanceData:{fontSize:t,fontColor:i},rect:r,rotation:a,id:o},textContent:l,textPosition:h,parent:{page:{pageNumber:c}}}=e;if(!l||0===l.length)return null;s=e={annotationType:n.AnnotationEditorType.FREETEXT,color:Array.from(i),fontSize:t,value:l.join("\n"),position:h,pageIndex:c-1,rect:r,rotation:a,id:o,deleted:!1}}const r=super.deserialize(e,t,i);return r.#Wt=e.fontSize,r.#Ut=n.Util.makeHexColor(...e.color),r.#jt=e.value,r.annotationElementId=e.id||null,r.#zt=s,r}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0};const t=o._internalPadding*this.parentScale,i=this.getRect(t,t),s=r.AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#Ut),a={annotationType:n.AnnotationEditorType.FREETEXT,color:s,fontSize:this.#Wt,value:this.#jt,pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?a:this.annotationElementId&&!this.#Qt(a)?null:(a.id=this.annotationElementId,a)}#Qt(e){const{value:t,fontSize:i,color:n,rect:s,pageIndex:r}=this.#zt;return e.value!==t||e.fontSize!==i||e.rect.some(((e,t)=>Math.abs(e-s[t])>=1))||e.color.some(((e,t)=>e!==n[t]))||e.pageIndex!==r}#Xt(e=!1){if(!this.annotationElementId)return;if(this.#qt(),!e&&(0===this.width||0===this.height))return void setTimeout((()=>this.#Xt(!0)),0);const t=o._internalPadding*this.parentScale;this.#zt.rect=this.getRect(t,t)}}t.FreeTextEditor=o},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StampAnnotationElement=t.InkAnnotationElement=t.FreeTextAnnotationElement=t.AnnotationLayer=void 0;var n=i(1),s=i(6),r=i(3),a=i(30),o=i(31),l=i(32);const h=1e3,c=new WeakSet;function d(e){return{width:e[2]-e[0],height:e[3]-e[1]}}class u{static create(e){switch(e.data.annotationType){case n.AnnotationType.LINK:return new g(e);case n.AnnotationType.TEXT:return new f(e);case n.AnnotationType.WIDGET:switch(e.data.fieldType){case"Tx":return new _(e);case"Btn":return e.data.radioButton?new y(e):e.data.checkBox?new b(e):new S(e);case"Ch":return new P(e);case"Sig":return new v(e)}return new m(e);case n.AnnotationType.POPUP:return new A(e);case n.AnnotationType.FREETEXT:return new E(e);case n.AnnotationType.LINE:return new x(e);case n.AnnotationType.SQUARE:return new C(e);case n.AnnotationType.CIRCLE:return new M(e);case n.AnnotationType.POLYLINE:return new T(e);case n.AnnotationType.CARET:return new F(e);case n.AnnotationType.INK:return new k(e);case n.AnnotationType.POLYGON:return new D(e);case n.AnnotationType.HIGHLIGHT:return new L(e);case n.AnnotationType.UNDERLINE:return new R(e);case n.AnnotationType.SQUIGGLY:return new I(e);case n.AnnotationType.STRIKEOUT:return new O(e);case n.AnnotationType.STAMP:return new N(e);case n.AnnotationType.FILEATTACHMENT:return new B(e);default:return new p(e)}}}class p{#Jt=!1;constructor(e,{isRenderable:t=!1,ignoreBorder:i=!1,createQuadrilaterals:n=!1}={}){this.isRenderable=t,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,t&&(this.container=this._createContainer(i)),n&&this._createQuadrilaterals()}static _hasPopupData({titleObj:e,contentsObj:t,richText:i}){return!!(e?.str||t?.str||i?.str)}get hasPopupData(){return p._hasPopupData(this.data)}_createContainer(e){const{data:t,parent:{page:i,viewport:s}}=this,r=document.createElement("section");r.setAttribute("data-annotation-id",t.id),this instanceof m||(r.tabIndex=h),r.style.zIndex=this.parent.zIndex++,this.data.popupRef&&r.setAttribute("aria-haspopup","dialog"),t.noRotate&&r.classList.add("norotate");const{pageWidth:a,pageHeight:o,pageX:l,pageY:c}=s.rawDims;if(!t.rect||this instanceof A){const{rotation:e}=t;return t.hasOwnCanvas||0===e||this.setRotation(e,r),r}const{width:u,height:p}=d(t.rect),g=n.Util.normalizeRect([t.rect[0],i.view[3]-t.rect[1]+i.view[1],t.rect[2],i.view[3]-t.rect[3]+i.view[1]]);if(!e&&t.borderStyle.width>0){r.style.borderWidth=`${t.borderStyle.width}px`;const e=t.borderStyle.horizontalCornerRadius,i=t.borderStyle.verticalCornerRadius;if(e>0||i>0){const t=`calc(${e}px * var(--scale-factor)) / calc(${i}px * var(--scale-factor))`;r.style.borderRadius=t}else if(this instanceof y){const e=`calc(${u}px * var(--scale-factor)) / calc(${p}px * var(--scale-factor))`;r.style.borderRadius=e}switch(t.borderStyle.style){case n.AnnotationBorderStyleType.SOLID:r.style.borderStyle="solid";break;case n.AnnotationBorderStyleType.DASHED:r.style.borderStyle="dashed";break;case n.AnnotationBorderStyleType.BEVELED:(0,n.warn)("Unimplemented border style: beveled");break;case n.AnnotationBorderStyleType.INSET:(0,n.warn)("Unimplemented border style: inset");break;case n.AnnotationBorderStyleType.UNDERLINE:r.style.borderBottomStyle="solid"}const s=t.borderColor||null;s?(this.#Jt=!0,r.style.borderColor=n.Util.makeHexColor(0|s[0],0|s[1],0|s[2])):r.style.borderWidth=0}r.style.left=100*(g[0]-l)/a+"%",r.style.top=100*(g[1]-c)/o+"%";const{rotation:f}=t;return t.hasOwnCanvas||0===f?(r.style.width=100*u/a+"%",r.style.height=100*p/o+"%"):this.setRotation(f,r),r}setRotation(e,t=this.container){if(!this.data.rect)return;const{pageWidth:i,pageHeight:n}=this.parent.viewport.rawDims,{width:s,height:r}=d(this.data.rect);let a,o;e%180==0?(a=100*s/i,o=100*r/n):(a=100*r/i,o=100*s/n),t.style.width=`${a}%`,t.style.height=`${o}%`,t.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(e,t,i)=>{const n=i.detail[e],s=n[0],r=n.slice(1);i.target.style[t]=a.ColorConverters[`${s}_HTML`](r),this.annotationStorage.setValue(this.data.id,{[t]:a.ColorConverters[`${s}_rgb`](r)})};return(0,n.shadow)(this,"_commonActions",{display:e=>{const{display:t}=e.detail,i=t%2==1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:1===t||2===t})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{const{hidden:t}=e.detail;this.container.style.visibility=t?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:t,noView:t})},focus:e=>{setTimeout((()=>e.target.focus({preventScroll:!1})),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:t=>{e("bgColor","backgroundColor",t)},fillColor:t=>{e("fillColor","backgroundColor",t)},fgColor:t=>{e("fgColor","color",t)},textColor:t=>{e("textColor","color",t)},borderColor:t=>{e("borderColor","borderColor",t)},strokeColor:t=>{e("strokeColor","borderColor",t)},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 s=e[n]||i[n];s?.(t)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;const i=this._commonActions;for(const[n,s]of Object.entries(t)){const r=i[n];r&&(r({detail:{[n]:s},target:e}),delete t[n])}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[t,i,n,s]=this.data.rect;if(1===e.length){const[,{x:r,y:a},{x:o,y:l}]=e[0];if(n===r&&s===a&&t===o&&i===l)return}const{style:r}=this.container;let a;if(this.#Jt){const{borderColor:e,borderWidth:t}=r;r.borderWidth=0,a=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${e}" stroke-width="${t}">`],this.container.classList.add("hasBorder")}const o=n-t,l=s-i,{svgFactory:h}=this,c=h.createElement("svg");c.classList.add("quadrilateralsContainer"),c.setAttribute("width",0),c.setAttribute("height",0);const d=h.createElement("defs");c.append(d);const u=h.createElement("clipPath"),p=`clippath_${this.data.id}`;u.setAttribute("id",p),u.setAttribute("clipPathUnits","objectBoundingBox"),d.append(u);for(const[,{x:i,y:n},{x:r,y:c}]of e){const e=h.createElement("rect"),d=(r-t)/o,p=(s-n)/l,g=(i-r)/o,f=(n-c)/l;e.setAttribute("x",d),e.setAttribute("y",p),e.setAttribute("width",g),e.setAttribute("height",f),u.append(e),a?.push(`<rect vector-effect="non-scaling-stroke" x="${d}" y="${p}" width="${g}" height="${f}"/>`)}this.#Jt&&(a.push("</g></svg>')"),r.backgroundImage=a.join("")),this.container.append(c),this.container.style.clipPath=`url(#${p})`}_createPopup(){const{container:e,data:t}=this;e.setAttribute("aria-haspopup","dialog");const i=new A({data:{color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,richText:t.richText,parentRect:t.rect,borderStyle:0,id:`popup_${t.id}`,rotation:t.rotation},parent:this.parent,elements:[this]});this.parent.div.append(i.render())}render(){(0,n.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){const i=[];if(this._fieldObjects){const s=this._fieldObjects[e];if(s)for(const{page:e,id:r,exportValues:a}of s){if(-1===e)continue;if(r===t)continue;const s="string"==typeof a?a:null,o=document.querySelector(`[data-element-id="${r}"]`);!o||c.has(o)?i.push({id:r,exportValue:s,domElement:o}):(0,n.warn)(`_getElementsByName - element not allowed: ${r}`)}return i}for(const n of document.getElementsByName(e)){const{exportValue:e}=n,s=n.getAttribute("data-element-id");s!==t&&c.has(n)&&i.push({id:s,exportValue:e,domElement:n})}return i}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(const t of e)t.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){const{annotationEditorType:e,data:{id:t}}=this;this.container.addEventListener("dblclick",(()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:e,editId:t})}))}}class g extends p{constructor(e,t=null){super(e,{isRenderable:!0,ignoreBorder:!!t?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:t}=this,i=document.createElement("a");i.setAttribute("data-element-id",e.id);let n=!1;return e.url?(t.addLinkAttributes(i,e.url,e.newWindow),n=!0):e.action?(this._bindNamedAction(i,e.action),n=!0):e.attachment?(this._bindAttachment(i,e.attachment),n=!0):e.setOCGState?(this.#Zt(i,e.setOCGState),n=!0):e.dest?(this._bindLink(i,e.dest),n=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,e),n=!0),e.resetForm?(this._bindResetFormAction(i,e.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(i,""),n=!0)),this.container.classList.add("linkAnnotation"),n&&this.container.append(i),this.container}#ei(){this.container.setAttribute("data-internal-link","")}_bindLink(e,t){e.href=this.linkService.getDestinationHash(t),e.onclick=()=>(t&&this.linkService.goToDestination(t),!1),(t||""===t)&&this.#ei()}_bindNamedAction(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(t),!1),this.#ei()}_bindAttachment(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.downloadManager?.openOrDownloadData(this.container,t.content,t.filename),!1),this.#ei()}#Zt(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(t),!1),this.#ei()}_bindJSAction(e,t){e.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(t.actions)){const s=i.get(n);s&&(e[s]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t.id,name:n}}),!1))}e.onclick||(e.onclick=()=>!1),this.#ei()}_bindResetFormAction(e,t){const i=e.onclick;if(i||(e.href=this.linkService.getAnchorUrl("")),this.#ei(),!this._fieldObjects)return(0,n.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),void(i||(e.onclick=()=>!1));e.onclick=()=>{i?.();const{fields:e,refs:s,include:r}=t,a=[];if(0!==e.length||0!==s.length){const t=new Set(s);for(const i of e){const e=this._fieldObjects[i]||[];for(const{id:i}of e)t.add(i)}for(const e of Object.values(this._fieldObjects))for(const i of e)t.has(i.id)===r&&a.push(i)}else for(const e of Object.values(this._fieldObjects))a.push(...e);const o=this.annotationStorage,l=[];for(const e of a){const{id:t}=e;switch(l.push(t),e.type){case"text":{const i=e.defaultValue||"";o.setValue(t,{value:i});break}case"checkbox":case"radiobutton":{const i=e.defaultValue===e.exportValues;o.setValue(t,{value:i});break}case"combobox":case"listbox":{const i=e.defaultValue||"";o.setValue(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}`))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:l,name:"ResetForm"}}),!1}}}class f extends p{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const e=document.createElement("img");return 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.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(e),this.container}}class m extends p{render(){return this.data.alternativeText&&(this.container.title=this.data.alternativeText),this.container}showElementAndHideCanvas(e){this.data.hasOwnCanvas&&("CANVAS"===e.previousSibling?.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,s){i.includes("mouse")?e.addEventListener(i,(e=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:s(e),shift:e.shiftKey,modifier:this._getKeyModifier(e)}})})):e.addEventListener(i,(e=>{if("blur"===i){if(!t.focused||!e.relatedTarget)return;t.focused=!1}else if("focus"===i){if(t.focused)return;t.focused=!0}s&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:s(e)}})}))}_setEventListeners(e,t,i,n){for(const[s,r]of i)("Action"===r||this.data.actions?.[r])&&("Focus"!==r&&"Blur"!==r||(t||={focused:!1}),this._setEventListener(e,t,s,r,n),"Focus"!==r||this.data.actions?.Blur?"Blur"!==r||this.data.actions?.Focus||this._setEventListener(e,t,"focus","Focus",null):this._setEventListener(e,t,"blur","Blur",null))}_setBackgroundColor(e){const t=this.data.backgroundColor||null;e.style.backgroundColor=null===t?"transparent":n.Util.makeHexColor(t[0],t[1],t[2])}_setTextStyle(e){const t=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,s=this.data.defaultAppearanceData.fontSize||9,r=e.style;let a;const o=e=>Math.round(10*e)/10;if(this.data.multiLine){const e=Math.abs(this.data.rect[3]-this.data.rect[1]-2),t=e/(Math.round(e/(n.LINE_FACTOR*s))||1);a=Math.min(s,o(t/n.LINE_FACTOR))}else{const e=Math.abs(this.data.rect[3]-this.data.rect[1]-2);a=Math.min(s,o(e/n.LINE_FACTOR))}r.fontSize=`calc(${a}px * var(--scale-factor))`,r.color=n.Util.makeHexColor(i[0],i[1],i[2]),null!==this.data.textAlignment&&(r.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",t)}}class _ extends m{constructor(e){super(e,{isRenderable:e.renderForms||!e.data.hasAppearance&&!!e.data.fieldValue})}setPropertyOnSiblings(e,t,i,n){const s=this.annotationStorage;for(const r of this._getElementsByName(e.name,e.id))r.domElement&&(r.domElement[t]=i),s.setValue(r.id,{[n]:i})}render(){const e=this.annotationStorage,t=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){const n=e.getValue(t,{value:this.data.fieldValue});let s=n.value||"";const r=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;r&&s.length>r&&(s=s.slice(0,r));let a=n.formattedValue||this.data.textContent?.join("\n")||null;a&&this.data.comb&&(a=a.replaceAll(/\s+/g,""));const o={userValue:s,formattedValue:a,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(i=document.createElement("textarea"),i.textContent=a??s,this.data.doNotScroll&&(i.style.overflowY="hidden")):(i=document.createElement("input"),i.type="text",i.setAttribute("value",a??s),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=h,this._setRequired(i,this.data.required),r&&(i.maxLength=r),i.addEventListener("input",(n=>{e.setValue(t,{value:n.target.value}),this.setPropertyOnSiblings(i,"value",n.target.value,"value"),o.formattedValue=null})),i.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue??"";i.value=o.userValue=t,o.formattedValue=null}));let l=e=>{const{formattedValue:t}=o;null!=t&&(e.target.value=t),e.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",(e=>{if(o.focused)return;const{target:t}=e;o.userValue&&(t.value=o.userValue),o.lastCommittedValue=t.value,o.commitKey=1,o.focused=!0})),i.addEventListener("updatefromsandbox",(i=>{this.showElementAndHideCanvas(i.target);const n={value(i){o.userValue=i.detail.value??"",e.setValue(t,{value:o.userValue.toString()}),i.target.value=o.userValue},formattedValue(i){const{formattedValue:n}=i.detail;o.formattedValue=n,null!=n&&i.target!==document.activeElement&&(i.target.value=n),e.setValue(t,{formattedValue:n})},selRange(e){e.target.setSelectionRange(...e.detail.selRange)},charLimit:i=>{const{charLimit:n}=i.detail,{target:s}=i;if(0===n)return void s.removeAttribute("maxLength");s.setAttribute("maxLength",n);let r=o.userValue;!r||r.length<=n||(r=r.slice(0,n),s.value=o.userValue=r,e.setValue(t,{value:r}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:r,willCommit:!0,commitKey:1,selStart:s.selectionStart,selEnd:s.selectionEnd}}))}};this._dispatchEventFromSandbox(n,i)})),i.addEventListener("keydown",(e=>{o.commitKey=1;let i=-1;if("Escape"===e.key?i=0:"Enter"!==e.key||this.data.multiLine?"Tab"===e.key&&(o.commitKey=3):i=2,-1===i)return;const{value:n}=e.target;o.lastCommittedValue!==n&&(o.lastCommittedValue=n,o.userValue=n,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:n,willCommit:!0,commitKey:i,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}))}));const n=l;l=null,i.addEventListener("blur",(e=>{if(!o.focused||!e.relatedTarget)return;o.focused=!1;const{value:i}=e.target;o.userValue=i,o.lastCommittedValue!==i&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:i,willCommit:!0,commitKey:o.commitKey,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}),n(e)})),this.data.actions?.Keystroke&&i.addEventListener("beforeinput",(e=>{o.lastCommittedValue=null;const{data:i,target:n}=e,{value:s,selectionStart:r,selectionEnd:a}=n;let l=r,h=a;switch(e.inputType){case"deleteWordBackward":{const e=s.substring(0,r).match(/\w*[^\w]*$/);e&&(l-=e[0].length);break}case"deleteWordForward":{const e=s.substring(r).match(/^[^\w]*\w*/);e&&(h+=e[0].length);break}case"deleteContentBackward":r===a&&(l-=1);break;case"deleteContentForward":r===a&&(h+=1)}e.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:s,change:i||"",willCommit:!1,selStart:l,selEnd:h}})})),this._setEventListeners(i,o,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.value))}if(l&&i.addEventListener("blur",l),this.data.comb){const e=(this.data.rect[2]-this.data.rect[0])/r;i.classList.add("comb"),i.style.letterSpacing=`calc(${e}px * var(--scale-factor) - 1ch)`}}else i=document.createElement("div"),i.textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell";return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class v extends m{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class b extends m{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,t=this.data,i=t.id;let n=e.getValue(i,{value:t.exportValue===t.fieldValue}).value;"string"==typeof n&&(n="Off"!==n,e.setValue(i,{value:n})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const s=document.createElement("input");return c.add(s),s.setAttribute("data-element-id",i),s.disabled=t.readOnly,this._setRequired(s,this.data.required),s.type="checkbox",s.name=t.fieldName,n&&s.setAttribute("checked",!0),s.setAttribute("exportValue",t.exportValue),s.tabIndex=h,s.addEventListener("change",(n=>{const{name:s,checked:r}=n.target;for(const n of this._getElementsByName(s,i)){const i=r&&n.exportValue===t.exportValue;n.domElement&&(n.domElement.checked=i),e.setValue(n.id,{value:i})}e.setValue(i,{value:r})})),s.addEventListener("resetform",(e=>{const i=t.defaultFieldValue||"Off";e.target.checked=i===t.exportValue})),this.enableScripting&&this.hasJSActions&&(s.addEventListener("updatefromsandbox",(t=>{const n={value(t){t.target.checked="Off"!==t.detail.value,e.setValue(i,{value:t.target.checked})}};this._dispatchEventFromSandbox(n,t)})),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.checked))),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class y extends m{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=e.getValue(i,{value:t.fieldValue===t.buttonValue}).value;"string"==typeof n&&(n=n!==t.buttonValue,e.setValue(i,{value:n}));const s=document.createElement("input");if(c.add(s),s.setAttribute("data-element-id",i),s.disabled=t.readOnly,this._setRequired(s,this.data.required),s.type="radio",s.name=t.fieldName,n&&s.setAttribute("checked",!0),s.tabIndex=h,s.addEventListener("change",(t=>{const{name:n,checked:s}=t.target;for(const t of this._getElementsByName(n,i))e.setValue(t.id,{value:!1});e.setValue(i,{value:s})})),s.addEventListener("resetform",(e=>{const i=t.defaultFieldValue;e.target.checked=null!=i&&i===t.buttonValue})),this.enableScripting&&this.hasJSActions){const n=t.buttonValue;s.addEventListener("updatefromsandbox",(t=>{const s={value:t=>{const s=n===t.detail.value;for(const n of this._getElementsByName(t.target.name)){const t=s&&n.id===i;n.domElement&&(n.domElement.checked=t),e.setValue(n.id,{value:t})}}};this._dispatchEventFromSandbox(s,t)})),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.checked))}return this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class S extends g{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;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener("updatefromsandbox",(e=>{this._dispatchEventFromSandbox({},e)}))),e}}class P extends m{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,t=this.data.id,i=e.getValue(t,{value:this.data.fieldValue}),n=document.createElement("select");c.add(n),n.setAttribute("data-element-id",t),n.disabled=this.data.readOnly,this._setRequired(n,this.data.required),n.name=this.data.fieldName,n.tabIndex=h;let s=this.data.combo&&this.data.options.length>0;this.data.combo||(n.size=this.data.options.length,this.data.multiSelect&&(n.multiple=!0)),n.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue;for(const e of n.options)e.selected=e.value===t}));for(const e of this.data.options){const t=document.createElement("option");t.textContent=e.displayValue,t.value=e.exportValue,i.value.includes(e.exportValue)&&(t.setAttribute("selected",!0),s=!1),n.append(t)}let r=null;if(s){const e=document.createElement("option");e.value=" ",e.setAttribute("hidden",!0),e.setAttribute("selected",!0),n.prepend(e),r=()=>{e.remove(),n.removeEventListener("input",r),r=null},n.addEventListener("input",r)}const a=e=>{const t=e?"value":"textContent",{options:i,multiple:s}=n;return s?Array.prototype.filter.call(i,(e=>e.selected)).map((e=>e[t])):-1===i.selectedIndex?null:i[i.selectedIndex][t]};let o=a(!1);const l=e=>{const t=e.target.options;return Array.prototype.map.call(t,(e=>({displayValue:e.textContent,exportValue:e.value})))};return this.enableScripting&&this.hasJSActions?(n.addEventListener("updatefromsandbox",(i=>{const s={value(i){r?.();const s=i.detail.value,l=new Set(Array.isArray(s)?s:[s]);for(const e of n.options)e.selected=l.has(e.value);e.setValue(t,{value:a(!0)}),o=a(!1)},multipleSelection(e){n.multiple=!0},remove(i){const s=n.options,r=i.detail.remove;s[r].selected=!1,n.remove(r),s.length>0&&-1===Array.prototype.findIndex.call(s,(e=>e.selected))&&(s[0].selected=!0),e.setValue(t,{value:a(!0),items:l(i)}),o=a(!1)},clear(i){for(;0!==n.length;)n.remove(0);e.setValue(t,{value:null,items:[]}),o=a(!1)},insert(i){const{index:s,displayValue:r,exportValue:h}=i.detail.insert,c=n.children[s],d=document.createElement("option");d.textContent=r,d.value=h,c?c.before(d):n.append(d),e.setValue(t,{value:a(!0),items:l(i)}),o=a(!1)},items(i){const{items:s}=i.detail;for(;0!==n.length;)n.remove(0);for(const e of s){const{displayValue:t,exportValue:i}=e,s=document.createElement("option");s.textContent=t,s.value=i,n.append(s)}n.options.length>0&&(n.options[0].selected=!0),e.setValue(t,{value:a(!0),items:l(i)}),o=a(!1)},indices(i){const n=new Set(i.detail.indices);for(const e of i.target.options)e.selected=n.has(e.index);e.setValue(t,{value:a(!0)}),o=a(!1)},editable(e){e.target.disabled=!e.detail.editable}};this._dispatchEventFromSandbox(s,i)})),n.addEventListener("input",(i=>{const n=a(!0);e.setValue(t,{value:n}),i.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:o,changeEx:n,willCommit:!1,commitKey:1,keyDown:!1}})})),this._setEventListeners(n,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],(e=>e.target.value))):n.addEventListener("input",(function(i){e.setValue(t,{value:a(!0)})})),this.data.combo&&this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class A extends p{constructor(e){const{data:t,elements:i}=e;super(e,{isRenderable:p._hasPopupData(t)}),this.elements=i}render(){this.container.classList.add("popupAnnotation");const e=new w({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),t=[];for(const i of this.elements)i.popup=e,t.push(i.data.id),i.addHighlightArea();return this.container.setAttribute("aria-controls",t.map((e=>`${n.AnnotationPrefix}${e}`)).join(",")),this.container}}class w{#ti=null;#ii=this.#ni.bind(this);#si=this.#ri.bind(this);#ai=this.#oi.bind(this);#li=this.#hi.bind(this);#Ut=null;#ke=null;#ci=null;#di=null;#ui=null;#pi=null;#gi=!1;#fi=null;#mi=null;#_i=null;#vi=null;#bi=!1;constructor({container:e,color:t,elements:i,titleObj:n,modificationDate:r,contentsObj:a,richText:o,parent:l,rect:h,parentRect:c,open:d}){this.#ke=e,this.#vi=n,this.#ci=a,this.#_i=o,this.#ui=l,this.#Ut=t,this.#mi=h,this.#pi=c,this.#di=i;const u=s.PDFDateString.toDateObject(r);u&&(this.#ti=l.l10n.get("annotation_date_string",{date:u.toLocaleDateString(),time:u.toLocaleTimeString()})),this.trigger=i.flatMap((e=>e.getElementsToTriggerPopup()));for(const e of this.trigger)e.addEventListener("click",this.#li),e.addEventListener("mouseenter",this.#ai),e.addEventListener("mouseleave",this.#si),e.classList.add("popupTriggerArea");for(const e of i)e.container?.addEventListener("keydown",this.#ii);this.#ke.hidden=!0,d&&this.#hi()}render(){if(this.#fi)return;const{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:i,pageX:s,pageY:r}}}=this.#ui,a=this.#fi=document.createElement("div");if(a.className="popup",this.#Ut){const e=a.style.outlineColor=n.Util.makeHexColor(...this.#Ut);if(CSS.supports("background-color","color-mix(in srgb, red 30%, white)"))a.style.backgroundColor=`color-mix(in srgb, ${e} 30%, white)`;else{const e=.7;a.style.backgroundColor=n.Util.makeHexColor(...this.#Ut.map((t=>Math.floor(e*(255-t)+t))))}}const o=document.createElement("span");o.className="header";const h=document.createElement("h1");if(o.append(h),({dir:h.dir,str:h.textContent}=this.#vi),a.append(o),this.#ti){const e=document.createElement("span");e.classList.add("popupDate"),this.#ti.then((t=>{e.textContent=t})),o.append(e)}const c=this.#ci,d=this.#_i;if(!d?.str||c?.str&&c.str!==d.str){const e=this._formatContents(c);a.append(e)}else l.XfaLayer.render({xfaHtml:d.html,intent:"richText",div:a}),a.lastChild.classList.add("richText","popupContent");let u=!!this.#pi,p=u?this.#pi:this.#mi;for(const e of this.#di)if(!p||null!==n.Util.intersect(e.data.rect,p)){p=e.data.rect,u=!0;break}const g=n.Util.normalizeRect([p[0],e[3]-p[1]+e[1],p[2],e[3]-p[3]+e[1]]),f=u?p[2]-p[0]+5:0,m=g[0]+f,_=g[1],{style:v}=this.#ke;v.left=100*(m-s)/t+"%",v.top=100*(_-r)/i+"%",this.#ke.append(a)}_formatContents({str:e,dir:t}){const i=document.createElement("p");i.classList.add("popupContent"),i.dir=t;const n=e.split(/(?:\r\n?|\n)/);for(let e=0,t=n.length;e<t;++e){const s=n[e];i.append(document.createTextNode(s)),e<t-1&&i.append(document.createElement("br"))}return i}#ni(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||("Enter"===e.key||"Escape"===e.key&&this.#gi)&&this.#hi()}#hi(){this.#gi=!this.#gi,this.#gi?(this.#oi(),this.#ke.addEventListener("click",this.#li),this.#ke.addEventListener("keydown",this.#ii)):(this.#ri(),this.#ke.removeEventListener("click",this.#li),this.#ke.removeEventListener("keydown",this.#ii))}#oi(){this.#fi||this.render(),this.isVisible?this.#gi&&this.#ke.classList.add("focused"):(this.#ke.hidden=!1,this.#ke.style.zIndex=parseInt(this.#ke.style.zIndex)+1e3)}#ri(){this.#ke.classList.remove("focused"),!this.#gi&&this.isVisible&&(this.#ke.hidden=!0,this.#ke.style.zIndex=parseInt(this.#ke.style.zIndex)-1e3)}forceHide(){this.#bi=this.isVisible,this.#bi&&(this.#ke.hidden=!0)}maybeShow(){this.#bi&&(this.#bi=!1,this.#ke.hidden=!1)}get isVisible(){return!1===this.#ke.hidden}}class E extends p{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=n.AnnotationEditorType.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),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)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}t.FreeTextAnnotationElement=E;class x extends p{#yi=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");const e=this.data,{width:t,height:i}=d(e.rect),n=this.svgFactory.create(t,i,!0),s=this.#yi=this.svgFactory.createElement("svg:line");return s.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),s.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),s.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),s.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),s.setAttribute("stroke-width",e.borderStyle.width||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),n.append(s),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#yi}addHighlightArea(){this.container.classList.add("highlightArea")}}class C extends p{#Si=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");const e=this.data,{width:t,height:i}=d(e.rect),n=this.svgFactory.create(t,i,!0),s=e.borderStyle.width,r=this.#Si=this.svgFactory.createElement("svg:rect");return r.setAttribute("x",s/2),r.setAttribute("y",s/2),r.setAttribute("width",t-s),r.setAttribute("height",i-s),r.setAttribute("stroke-width",s||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#Si}addHighlightArea(){this.container.classList.add("highlightArea")}}class M extends p{#Pi=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");const e=this.data,{width:t,height:i}=d(e.rect),n=this.svgFactory.create(t,i,!0),s=e.borderStyle.width,r=this.#Pi=this.svgFactory.createElement("svg:ellipse");return r.setAttribute("cx",t/2),r.setAttribute("cy",i/2),r.setAttribute("rx",t/2-s/2),r.setAttribute("ry",i/2-s/2),r.setAttribute("stroke-width",s||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#Pi}addHighlightArea(){this.container.classList.add("highlightArea")}}class T extends p{#Ai=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const e=this.data,{width:t,height:i}=d(e.rect),n=this.svgFactory.create(t,i,!0);let s=[];for(const t of e.vertices){const i=t.x-e.rect[0],n=e.rect[3]-t.y;s.push(i+","+n)}s=s.join(" ");const r=this.#Ai=this.svgFactory.createElement(this.svgElementName);return r.setAttribute("points",s),r.setAttribute("stroke-width",e.borderStyle.width||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#Ai}addHighlightArea(){this.container.classList.add("highlightArea")}}class D extends T{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class F extends p{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class k extends p{#wi=[];constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=n.AnnotationEditorType.INK}render(){this.container.classList.add(this.containerClassName);const e=this.data,{width:t,height:i}=d(e.rect),n=this.svgFactory.create(t,i,!0);for(const t of e.inkLists){let i=[];for(const n of t){const t=n.x-e.rect[0],s=e.rect[3]-n.y;i.push(`${t},${s}`)}i=i.join(" ");const s=this.svgFactory.createElement(this.svgElementName);this.#wi.push(s),s.setAttribute("points",i),s.setAttribute("stroke-width",e.borderStyle.width||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),!e.popupRef&&this.hasPopupData&&this._createPopup(),n.append(s)}return this.container.append(n),this.container}getElementsToTriggerPopup(){return this.#wi}addHighlightArea(){this.container.classList.add("highlightArea")}}t.InkAnnotationElement=k;class L extends p{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this.container}}class R extends p{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class I extends p{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class O extends p{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class N extends p{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("stampAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}t.StampAnnotationElement=N;class B extends p{#Ei=null;constructor(e){super(e,{isRenderable:!0});const{filename:t,content:i}=this.data.file;this.filename=(0,s.getFilenameFromUrl)(t,!0),this.content=i,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,filename:t,content:i})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:e,data:t}=this;let i;t.hasAppearance||0===t.fillAlpha?i=document.createElement("div"):(i=document.createElement("img"),i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(t.name)?"paperclip":"pushpin"}.svg`,t.fillAlpha&&t.fillAlpha<1&&(i.style=`filter: opacity(${Math.round(100*t.fillAlpha)}%);`)),i.addEventListener("dblclick",this.#xi.bind(this)),this.#Ei=i;const{isMac:s}=n.FeatureTest.platform;return e.addEventListener("keydown",(e=>{"Enter"===e.key&&(s?e.metaKey:e.ctrlKey)&&this.#xi()})),!t.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),e.append(i),e}getElementsToTriggerPopup(){return this.#Ei}addHighlightArea(){this.container.classList.add("highlightArea")}#xi(){this.downloadManager?.openOrDownloadData(this.container,this.content,this.filename)}}t.AnnotationLayer=class{#Pt=null;#Ci=null;#Mi=new Map;constructor({div:e,accessibilityManager:t,annotationCanvasMap:i,l10n:n,page:s,viewport:r}){this.div=e,this.#Pt=t,this.#Ci=i,this.l10n=n,this.page=s,this.viewport=r,this.zIndex=0,this.l10n||=o.NullL10n}#Ti(e,t){const i=e.firstChild||e;i.id=`${n.AnnotationPrefix}${t}`,this.div.append(e),this.#Pt?.moveElementInDOM(this.div,e,i,!1)}async render(e){const{annotations:t}=e,i=this.div;(0,s.setLayerDimensions)(i,this.viewport);const a=new Map,o={data:null,layer:i,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:!1!==e.renderForms,svgFactory:new s.DOMSVGFactory,annotationStorage:e.annotationStorage||new r.AnnotationStorage,enableScripting:!0===e.enableScripting,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(const e of t){if(e.noHTML)continue;const t=e.annotationType===n.AnnotationType.POPUP;if(t){const t=a.get(e.id);if(!t)continue;o.elements=t}else{const{width:t,height:i}=d(e.rect);if(t<=0||i<=0)continue}o.data=e;const i=u.create(o);if(!i.isRenderable)continue;if(!t&&e.popupRef){const t=a.get(e.popupRef);t?t.push(i):a.set(e.popupRef,[i])}i.annotationEditorType>0&&this.#Mi.set(i.data.id,i);const s=i.render();e.hidden&&(s.style.visibility="hidden"),this.#Ti(s,e.id)}this.#Di(),await this.l10n.translate(i)}update({viewport:e}){const t=this.div;this.viewport=e,(0,s.setLayerDimensions)(t,{rotation:e.rotation}),this.#Di(),t.hidden=!1}#Di(){if(!this.#Ci)return;const e=this.div;for(const[t,i]of this.#Ci){const n=e.querySelector(`[data-annotation-id="${t}"]`);if(!n)continue;const{firstChild:s}=n;s?"CANVAS"===s.nodeName?s.replaceWith(i):s.before(i):n.append(i)}this.#Ci.clear()}getEditableAnnotations(){return Array.from(this.#Mi.values())}getEditableAnnotation(e){return this.#Mi.get(e)}}},(e,t)=>{function i(e){return Math.floor(255*Math.max(0,Math.min(1,e))).toString(16).padStart(2,"0")}function n(e){return Math.max(0,Math.min(255,255*e))}Object.defineProperty(t,"__esModule",{value:!0}),t.ColorConverters=void 0,t.ColorConverters=class{static CMYK_G([e,t,i,n]){return["G",1-Math.min(1,.3*e+.59*i+.11*t+n)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_rgb([e]){return[e=n(e),e,e]}static G_HTML([e]){const t=i(e);return`#${t}${t}${t}`}static RGB_G([e,t,i]){return["G",.3*e+.59*t+.11*i]}static RGB_rgb(e){return e.map(n)}static RGB_HTML(e){return`#${e.map(i).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,t,i,n]){return["RGB",1-Math.min(1,e+n),1-Math.min(1,i+n),1-Math.min(1,t+n)]}static CMYK_rgb([e,t,i,s]){return[n(1-Math.min(1,e+s)),n(1-Math.min(1,i+s)),n(1-Math.min(1,t+s))]}static CMYK_HTML(e){const t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,i]){const n=1-e,s=1-t,r=1-i;return["CMYK",n,s,r,Math.min(n,s,r)]}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NullL10n=void 0,t.getL10nFallback=n;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.",annotation_date_string:"{{date}}, {{time}}",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",editor_alt_text_button_label:"Alt text",editor_alt_text_edit_button_label:"Edit alt text",editor_alt_text_decorative_tooltip:"Marked as decorative"};function n(e,t){switch(e){case"find_match_count":e=`find_match_count[${1===t.total?"one":"other"}]`;break;case"find_match_count_limit":e=`find_match_count_limit[${1===t.limit?"one":"other"}]`}return i[e]||""}i.print_progress_percent="{{progress}}%";const s={getLanguage:async()=>"en-us",getDirection:async()=>"ltr",get:async(e,t=null,i=n(e,t))=>function(e,t){return t?e.replaceAll(/\{\{\s*(\w+)\s*\}\}/g,((e,i)=>i in t?t[i]:"{{"+i+"}}")):e}(i,t),async translate(e){}};t.NullL10n=s},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.XfaLayer=void 0;var n=i(25);t.XfaLayer=class{static setupStorage(e,t,i,n,s){const r=n.getValue(t,{value:null});switch(i.name){case"textarea":if(null!==r.value&&(e.textContent=r.value),"print"===s)break;e.addEventListener("input",(e=>{n.setValue(t,{value:e.target.value})}));break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){if(r.value===i.attributes.xfaOn?e.setAttribute("checked",!0):r.value===i.attributes.xfaOff&&e.removeAttribute("checked"),"print"===s)break;e.addEventListener("change",(e=>{n.setValue(t,{value:e.target.checked?e.target.getAttribute("xfaOn"):e.target.getAttribute("xfaOff")})}))}else{if(null!==r.value&&e.setAttribute("value",r.value),"print"===s)break;e.addEventListener("input",(e=>{n.setValue(t,{value:e.target.value})}))}break;case"select":if(null!==r.value){e.setAttribute("value",r.value);for(const e of i.children)e.attributes.value===r.value?e.attributes.selected=!0:e.attributes.hasOwnProperty("selected")&&delete e.attributes.selected}e.addEventListener("input",(e=>{const i=e.target.options,s=-1===i.selectedIndex?"":i[i.selectedIndex].value;n.setValue(t,{value:s})}))}}static setAttributes({html:e,element:t,storage:i=null,intent:n,linkService:s}){const{attributes:r}=t,a=e instanceof HTMLAnchorElement;"radio"===r.type&&(r.name=`${r.name}-${n}`);for(const[t,i]of Object.entries(r))if(null!=i)switch(t){case"class":i.length&&e.setAttribute(t,i.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",i);break;case"style":Object.assign(e.style,i);break;case"textContent":e.textContent=i;break;default:(!a||"href"!==t&&"newWindow"!==t)&&e.setAttribute(t,i)}a&&s.addLinkAttributes(e,r.href,r.newWindow),i&&r.dataId&&this.setupStorage(e,r.dataId,t,i)}static render(e){const t=e.annotationStorage,i=e.linkService,s=e.xfaHtml,r=e.intent||"display",a=document.createElement(s.name);s.attributes&&this.setAttributes({html:a,element:s,intent:r,linkService:i});const o=[[s,-1,a]],l=e.div;if(l.append(a),e.viewport){const t=`matrix(${e.viewport.transform.join(",")})`;l.style.transform=t}"richText"!==r&&l.setAttribute("class","xfaLayer xfaFont");const h=[];for(;o.length>0;){const[e,s,a]=o.at(-1);if(s+1===e.children.length){o.pop();continue}const l=e.children[++o.at(-1)[1]];if(null===l)continue;const{name:c}=l;if("#text"===c){const e=document.createTextNode(l.value);h.push(e),a.append(e);continue}const d=l?.attributes?.xmlns?document.createElementNS(l.attributes.xmlns,c):document.createElement(c);if(a.append(d),l.attributes&&this.setAttributes({html:d,element:l,storage:t,intent:r,linkService:i}),l.children&&l.children.length>0)o.push([l,-1,d]);else if(l.value){const e=document.createTextNode(l.value);n.XfaText.shouldBuildText(c)&&h.push(e),d.append(e)}}for(const e of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))e.setAttribute("readOnly",!0);return{textDivs:h}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t,e.div.hidden=!1}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InkEditor=void 0;var n=i(1),s=i(4),r=i(29),a=i(6),o=i(5);class l extends s.AnnotationEditor{#Fi=0;#ki=0;#Li=this.canvasPointermove.bind(this);#Ri=this.canvasPointerleave.bind(this);#Ii=this.canvasPointerup.bind(this);#Oi=this.canvasPointerdown.bind(this);#Ni=new Path2D;#Bi=!1;#Vi=!1;#Ui=!1;#ji=null;#Hi=0;#Wi=0;#zi=null;static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=1;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,this._willKeepAspectRatio=!0}static initialize(e){s.AnnotationEditor.initialize(e,{strings:["editor_ink_canvas_aria_label","editor_ink2_aria_label"]})}static updateDefaultParams(e,t){switch(e){case n.AnnotationEditorParamsType.INK_THICKNESS:l._defaultThickness=t;break;case n.AnnotationEditorParamsType.INK_COLOR:l._defaultColor=t;break;case n.AnnotationEditorParamsType.INK_OPACITY:l._defaultOpacity=t/100}}updateParams(e,t){switch(e){case n.AnnotationEditorParamsType.INK_THICKNESS:this.#Gi(t);break;case n.AnnotationEditorParamsType.INK_COLOR:this.#$t(t);break;case n.AnnotationEditorParamsType.INK_OPACITY:this.#$i(t)}}static get defaultPropertiesToUpdate(){return[[n.AnnotationEditorParamsType.INK_THICKNESS,l._defaultThickness],[n.AnnotationEditorParamsType.INK_COLOR,l._defaultColor||s.AnnotationEditor._defaultLineColor],[n.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*l._defaultOpacity)]]}get propertiesToUpdate(){return[[n.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||l._defaultThickness],[n.AnnotationEditorParamsType.INK_COLOR,this.color||l._defaultColor||s.AnnotationEditor._defaultLineColor],[n.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??l._defaultOpacity))]]}#Gi(e){const t=this.thickness;this.addCommands({cmd:()=>{this.thickness=e,this.#qi()},undo:()=>{this.thickness=t,this.#qi()},mustExec:!0,type:n.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#$t(e){const t=this.color;this.addCommands({cmd:()=>{this.color=e,this.#Xi()},undo:()=>{this.color=t,this.#Xi()},mustExec:!0,type:n.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#$i(e){e/=100;const t=this.opacity;this.addCommands({cmd:()=>{this.opacity=e,this.#Xi()},undo:()=>{this.opacity=t,this.#Xi()},mustExec:!0,type:n.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.canvas||(this.#Ki(),this.#Yi()),this.isAttachedToDOM||(this.parent.add(this),this.#Qi()),this.#qi()))}remove(){null!==this.canvas&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.#ji.disconnect(),this.#ji=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(){this.#Bi||null===this.canvas||(super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener("pointerdown",this.#Oi))}disableEditMode(){this.isInEditMode()&&null!==this.canvas&&(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",this.#Oi))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}#Ji(){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]}}#Zi(){const{ctx:e,color:t,opacity:i,thickness:n,parentScale:s,scaleFactor:r}=this;e.lineWidth=n*s/r,e.lineCap="round",e.lineJoin="round",e.miterLimit=10,e.strokeStyle=`${t}${(0,o.opacityToHex)(i)}`}#en(e,t){this.canvas.addEventListener("contextmenu",a.noContextMenu),this.canvas.addEventListener("pointerleave",this.#Ri),this.canvas.addEventListener("pointermove",this.#Li),this.canvas.addEventListener("pointerup",this.#Ii),this.canvas.removeEventListener("pointerdown",this.#Oi),this.isEditing=!0,this.#Ui||(this.#Ui=!0,this.#Qi(),this.thickness||=l._defaultThickness,this.color||=l._defaultColor||s.AnnotationEditor._defaultLineColor,this.opacity??=l._defaultOpacity),this.currentPath.push([e,t]),this.#Vi=!1,this.#Zi(),this.#zi=()=>{this.#tn(),this.#zi&&window.requestAnimationFrame(this.#zi)},window.requestAnimationFrame(this.#zi)}#in(e,t){const[i,n]=this.currentPath.at(-1);if(this.currentPath.length>1&&e===i&&t===n)return;const s=this.currentPath;let r=this.#Ni;if(s.push([e,t]),this.#Vi=!0,s.length<=2)return r.moveTo(...s[0]),void r.lineTo(e,t);3===s.length&&(this.#Ni=r=new Path2D,r.moveTo(...s[0])),this.#nn(r,...s.at(-3),...s.at(-2),e,t)}#sn(){if(0===this.currentPath.length)return;const e=this.currentPath.at(-1);this.#Ni.lineTo(...e)}#rn(e,t){let i;if(this.#zi=null,e=Math.min(Math.max(e,0),this.canvas.width),t=Math.min(Math.max(t,0),this.canvas.height),this.#in(e,t),this.#sn(),1!==this.currentPath.length)i=this.#an();else{const n=[e,t];i=[[n,n.slice(),n.slice(),n]]}const n=this.#Ni,s=this.currentPath;this.currentPath=[],this.#Ni=new Path2D,this.addCommands({cmd:()=>{this.allRawPaths.push(s),this.paths.push(i),this.bezierPath2D.push(n),this.rebuild()},undo:()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),0===this.paths.length?this.remove():(this.canvas||(this.#Ki(),this.#Yi()),this.#qi())},mustExec:!0})}#tn(){if(!this.#Vi)return;this.#Vi=!1,Math.ceil(this.thickness*this.parentScale);const e=this.currentPath.slice(-3),t=e.map((e=>e[0])),i=e.map((e=>e[1]));Math.min(...t),Math.max(...t),Math.min(...i),Math.max(...i);const{ctx:n}=this;n.save(),n.clearRect(0,0,this.canvas.width,this.canvas.height);for(const e of this.bezierPath2D)n.stroke(e);n.stroke(this.#Ni),n.restore()}#nn(e,t,i,n,s,r,a){const o=(t+n)/2,l=(i+s)/2,h=(n+r)/2,c=(s+a)/2;e.bezierCurveTo(o+2*(n-o)/3,l+2*(s-l)/3,h+2*(n-h)/3,c+2*(s-c)/3,h,c)}#an(){const e=this.currentPath;if(e.length<=2)return[[e[0],e[0],e.at(-1),e.at(-1)]];const t=[];let i,[n,s]=e[0];for(i=1;i<e.length-2;i++){const[r,a]=e[i],[o,l]=e[i+1],h=(r+o)/2,c=(a+l)/2,d=[n+2*(r-n)/3,s+2*(a-s)/3],u=[h+2*(r-h)/3,c+2*(a-c)/3];t.push([[n,s],d,u,[h,c]]),[n,s]=[h,c]}const[r,a]=e[i],[o,l]=e[i+1],h=[n+2*(r-n)/3,s+2*(a-s)/3],c=[o+2*(r-o)/3,l+2*(a-l)/3];return t.push([[n,s],h,c,[o,l]]),t}#Xi(){if(this.isEmpty())return void this.#on();this.#Zi();const{canvas:e,ctx:t}=this;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.width,e.height),this.#on();for(const e of this.bezierPath2D)t.stroke(e)}commit(){this.#Bi||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),this.#Bi=!0,this.div.classList.add("disabled"),this.#qi(!0),this.makeResizable(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),this.enableEditMode())}canvasPointerdown(e){0===e.button&&this.isInEditMode()&&!this.#Bi&&(this.setInForeground(),e.preventDefault(),"mouse"!==e.type&&this.div.focus(),this.#en(e.offsetX,e.offsetY))}canvasPointermove(e){e.preventDefault(),this.#in(e.offsetX,e.offsetY)}canvasPointerup(e){e.preventDefault(),this.#ln(e)}canvasPointerleave(e){this.#ln(e)}#ln(e){this.canvas.removeEventListener("pointerleave",this.#Ri),this.canvas.removeEventListener("pointermove",this.#Li),this.canvas.removeEventListener("pointerup",this.#Ii),this.canvas.addEventListener("pointerdown",this.#Oi),setTimeout((()=>{this.canvas.removeEventListener("contextmenu",a.noContextMenu)}),10),this.#rn(e.offsetX,e.offsetY),this.addToAnnotationStorage(),this.setInBackground()}#Ki(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",s.AnnotationEditor._l10nPromise.get("editor_ink_canvas_aria_label").then((e=>this.canvas?.setAttribute("aria-label",e))),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")}#Yi(){this.#ji=new ResizeObserver((e=>{const t=e[0].contentRect;t.width&&t.height&&this.setDimensions(t.width,t.height)})),this.#ji.observe(this.div)}get isResizable(){return!this.isEmpty()&&this.#Bi}render(){if(this.div)return this.div;let e,t;this.width&&(e=this.x,t=this.y),super.render(),s.AnnotationEditor._l10nPromise.get("editor_ink2_aria_label").then((e=>this.div?.setAttribute("aria-label",e)));const[i,n,r,a]=this.#Ji();if(this.setAt(i,n,0,0),this.setDims(r,a),this.#Ki(),this.width){const[i,n]=this.parentDimensions;this.setAspectRatio(this.width*i,this.height*n),this.setAt(e*i,t*n,this.width*i,this.height*n),this.#Ui=!0,this.#Qi(),this.setDims(this.width*i,this.height*n),this.#Xi(),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return this.#Yi(),this.div}#Qi(){if(!this.#Ui)return;const[e,t]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*e),this.canvas.height=Math.ceil(this.height*t),this.#on()}setDimensions(e,t){const i=Math.round(e),n=Math.round(t);if(this.#Hi===i&&this.#Wi===n)return;this.#Hi=i,this.#Wi=n,this.canvas.style.visibility="hidden";const[s,r]=this.parentDimensions;this.width=e/s,this.height=t/r,this.fixAndSetPosition(),this.#Bi&&this.#hn(e,t),this.#Qi(),this.#Xi(),this.canvas.style.visibility="visible",this.fixDims()}#hn(e,t){const i=this.#cn(),n=(e-i)/this.#ki,s=(t-i)/this.#Fi;this.scaleFactor=Math.min(n,s)}#on(){const e=this.#cn()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+e,this.translationY*this.scaleFactor+e)}static#dn(e){const t=new Path2D;for(let i=0,n=e.length;i<n;i++){const[n,s,r,a]=e[i];0===i&&t.moveTo(...n),t.bezierCurveTo(s[0],s[1],r[0],r[1],a[0],a[1])}return t}static#un(e,t,i){const[n,s,r,a]=t;switch(i){case 0:for(let t=0,i=e.length;t<i;t+=2)e[t]+=n,e[t+1]=a-e[t+1];break;case 90:for(let t=0,i=e.length;t<i;t+=2){const i=e[t];e[t]=e[t+1]+n,e[t+1]=i+s}break;case 180:for(let t=0,i=e.length;t<i;t+=2)e[t]=r-e[t],e[t+1]+=s;break;case 270:for(let t=0,i=e.length;t<i;t+=2){const i=e[t];e[t]=r-e[t+1],e[t+1]=a-i}break;default:throw new Error("Invalid rotation")}return e}static#pn(e,t,i){const[n,s,r,a]=t;switch(i){case 0:for(let t=0,i=e.length;t<i;t+=2)e[t]-=n,e[t+1]=a-e[t+1];break;case 90:for(let t=0,i=e.length;t<i;t+=2){const i=e[t];e[t]=e[t+1]-s,e[t+1]=i-n}break;case 180:for(let t=0,i=e.length;t<i;t+=2)e[t]=r-e[t],e[t+1]-=s;break;case 270:for(let t=0,i=e.length;t<i;t+=2){const i=e[t];e[t]=a-e[t+1],e[t+1]=r-i}break;default:throw new Error("Invalid rotation")}return e}#gn(e,t,i,n){const s=[],r=this.thickness/2,a=e*t+r,o=e*i+r;for(const t of this.paths){const i=[],r=[];for(let n=0,s=t.length;n<s;n++){const[l,h,c,d]=t[n],u=e*l[0]+a,p=e*l[1]+o,g=e*h[0]+a,f=e*h[1]+o,m=e*c[0]+a,_=e*c[1]+o,v=e*d[0]+a,b=e*d[1]+o;0===n&&(i.push(u,p),r.push(u,p)),i.push(g,f,m,_,v,b),r.push(g,f),n===s-1&&r.push(v,b)}s.push({bezier:l.#un(i,n,this.rotation),points:l.#un(r,n,this.rotation)})}return s}#fn(){let e=1/0,t=-1/0,i=1/0,s=-1/0;for(const r of this.paths)for(const[a,o,l,h]of r){const r=n.Util.bezierBoundingBox(...a,...o,...l,...h);e=Math.min(e,r[0]),i=Math.min(i,r[1]),t=Math.max(t,r[2]),s=Math.max(s,r[3])}return[e,i,t,s]}#cn(){return this.#Bi?Math.ceil(this.thickness*this.parentScale):0}#qi(e=!1){if(this.isEmpty())return;if(!this.#Bi)return void this.#Xi();const t=this.#fn(),i=this.#cn();this.#ki=Math.max(s.AnnotationEditor.MIN_SIZE,t[2]-t[0]),this.#Fi=Math.max(s.AnnotationEditor.MIN_SIZE,t[3]-t[1]);const n=Math.ceil(i+this.#ki*this.scaleFactor),r=Math.ceil(i+this.#Fi*this.scaleFactor),[a,o]=this.parentDimensions;this.width=n/a,this.height=r/o,this.setAspectRatio(n,r);const l=this.translationX,h=this.translationY;this.translationX=-t[0],this.translationY=-t[1],this.#Qi(),this.#Xi(),this.#Hi=n,this.#Wi=r,this.setDims(n,r);const c=e?i/this.scaleFactor/2:0;this.translate(l-this.translationX-c,h-this.translationY-c)}static deserialize(e,t,i){if(e instanceof r.InkAnnotationElement)return null;const a=super.deserialize(e,t,i);a.thickness=e.thickness,a.color=n.Util.makeHexColor(...e.color),a.opacity=e.opacity;const[o,h]=a.pageDimensions,c=a.width*o,d=a.height*h,u=a.parentScale,p=e.thickness/2;a.#Bi=!0,a.#Hi=Math.round(c),a.#Wi=Math.round(d);const{paths:g,rect:f,rotation:m}=e;for(let{bezier:e}of g){e=l.#pn(e,f,m);const t=[];a.paths.push(t);let i=u*(e[0]-p),n=u*(e[1]-p);for(let s=2,r=e.length;s<r;s+=6){const r=u*(e[s]-p),a=u*(e[s+1]-p),o=u*(e[s+2]-p),l=u*(e[s+3]-p),h=u*(e[s+4]-p),c=u*(e[s+5]-p);t.push([[i,n],[r,a],[o,l],[h,c]]),i=h,n=c}const s=this.#dn(t);a.bezierPath2D.push(s)}const _=a.#fn();return a.#ki=Math.max(s.AnnotationEditor.MIN_SIZE,_[2]-_[0]),a.#Fi=Math.max(s.AnnotationEditor.MIN_SIZE,_[3]-_[1]),a.#hn(c,d),a}serialize(){if(this.isEmpty())return null;const e=this.getRect(0,0),t=s.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:n.AnnotationEditorType.INK,color:t,thickness:this.thickness,opacity:this.opacity,paths:this.#gn(this.scaleFactor/this.parentScale,this.translationX,this.translationY,e),pageIndex:this.pageIndex,rect:e,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}}t.InkEditor=l},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StampEditor=void 0;var n=i(1),s=i(4),r=i(6),a=i(29);class o extends s.AnnotationEditor{#mn=null;#_n=null;#vn=null;#bn=null;#yn=null;#Sn=null;#ji=null;#Pn=null;#An=!1;#wn=!1;static _type="stamp";constructor(e){super({...e,name:"stampEditor"}),this.#bn=e.bitmapUrl,this.#yn=e.bitmapFile}static initialize(e){s.AnnotationEditor.initialize(e)}static get supportedTypes(){return(0,n.shadow)(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map((e=>`image/${e}`)))}static get supportedTypesStr(){return(0,n.shadow)(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(e){return this.supportedTypes.includes(e)}static paste(e,t){t.pasteEditor(n.AnnotationEditorType.STAMP,{bitmapFile:e.getAsFile()})}#En(e,t=!1){e?(this.#mn=e.bitmap,t||(this.#_n=e.id,this.#An=e.isSvg),this.#Ki()):this.remove()}#xn(){this.#vn=null,this._uiManager.enableWaiting(!1),this.#Sn&&this.div.focus()}#Cn(){if(this.#_n)return this._uiManager.enableWaiting(!0),void this._uiManager.imageManager.getFromId(this.#_n).then((e=>this.#En(e,!0))).finally((()=>this.#xn()));if(this.#bn){const e=this.#bn;return this.#bn=null,this._uiManager.enableWaiting(!0),void(this.#vn=this._uiManager.imageManager.getFromUrl(e).then((e=>this.#En(e))).finally((()=>this.#xn())))}if(this.#yn){const e=this.#yn;return this.#yn=null,this._uiManager.enableWaiting(!0),void(this.#vn=this._uiManager.imageManager.getFromFile(e).then((e=>this.#En(e))).finally((()=>this.#xn())))}const e=document.createElement("input");e.type="file",e.accept=o.supportedTypesStr,this.#vn=new Promise((t=>{e.addEventListener("change",(async()=>{if(e.files&&0!==e.files.length){this._uiManager.enableWaiting(!0);const t=await this._uiManager.imageManager.getFromFile(e.files[0]);this.#En(t)}else this.remove();t()})),e.addEventListener("cancel",(()=>{this.remove(),t()}))})).finally((()=>this.#xn())),e.click()}remove(){this.#_n&&(this.#mn=null,this._uiManager.imageManager.deleteId(this.#_n),this.#Sn?.remove(),this.#Sn=null,this.#ji?.disconnect(),this.#ji=null),super.remove()}rebuild(){this.parent?(super.rebuild(),null!==this.div&&(this.#_n&&this.#Cn(),this.isAttachedToDOM||this.parent.add(this))):this.#_n&&this.#Cn()}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(this.#vn||this.#mn||this.#bn||this.#yn)}get isResizable(){return!0}render(){if(this.div)return this.div;let e,t;if(this.width&&(e=this.x,t=this.y),super.render(),this.div.hidden=!0,this.#mn?this.#Ki():this.#Cn(),this.width){const[i,n]=this.parentDimensions;this.setAt(e*i,t*n,this.width*i,this.height*n)}return this.div}#Ki(){const{div:e}=this;let{width:t,height:i}=this.#mn;const[n,s]=this.pageDimensions,r=.75;if(this.width)t=this.width*n,i=this.height*s;else if(t>r*n||i>r*s){const e=Math.min(r*n/t,r*s/i);t*=e,i*=e}const[a,o]=this.parentDimensions;this.setDims(t*a/n,i*o/s),this._uiManager.enableWaiting(!1);const l=this.#Sn=document.createElement("canvas");e.append(l),e.hidden=!1,this.#Mn(t,i),this.#Yi(),this.#wn||(this.parent.addUndoableEditor(this),this.#wn=!0),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",subtype:this.editorType,data:{action:"inserted_image"}}}),this.addAltTextButton()}#Tn(e,t){const[i,n]=this.parentDimensions;this.width=e/i,this.height=t/n,this.setDims(e,t),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,null!==this.#Pn&&clearTimeout(this.#Pn),this.#Pn=setTimeout((()=>{this.#Pn=null,this.#Mn(e,t)}),200)}#Dn(e,t){const{width:i,height:n}=this.#mn;let s=i,r=n,a=this.#mn;for(;s>2*e||r>2*t;){const i=s,n=r;s>2*e&&(s=s>=16384?Math.floor(s/2)-1:Math.ceil(s/2)),r>2*t&&(r=r>=16384?Math.floor(r/2)-1:Math.ceil(r/2));const o=new OffscreenCanvas(s,r);o.getContext("2d").drawImage(a,0,0,i,n,0,0,s,r),a=o.transferToImageBitmap()}return a}#Mn(e,t){e=Math.ceil(e),t=Math.ceil(t);const i=this.#Sn;if(!i||i.width===e&&i.height===t)return;i.width=e,i.height=t;const n=this.#An?this.#mn:this.#Dn(e,t),s=i.getContext("2d");s.filter=this._uiManager.hcmFilter,s.drawImage(n,0,0,n.width,n.height,0,0,e,t)}#Fn(e){if(e){if(this.#An){const e=this._uiManager.imageManager.getSvgUrl(this.#_n);if(e)return e}const e=document.createElement("canvas");return({width:e.width,height:e.height}=this.#mn),e.getContext("2d").drawImage(this.#mn,0,0),e.toDataURL()}if(this.#An){const[e,t]=this.pageDimensions,i=Math.round(this.width*e*r.PixelsPerInch.PDF_TO_CSS_UNITS),n=Math.round(this.height*t*r.PixelsPerInch.PDF_TO_CSS_UNITS),s=new OffscreenCanvas(i,n);return s.getContext("2d").drawImage(this.#mn,0,0,this.#mn.width,this.#mn.height,0,0,i,n),s.transferToImageBitmap()}return structuredClone(this.#mn)}#Yi(){this.#ji=new ResizeObserver((e=>{const t=e[0].contentRect;t.width&&t.height&&this.#Tn(t.width,t.height)})),this.#ji.observe(this.div)}static deserialize(e,t,i){if(e instanceof a.StampAnnotationElement)return null;const n=super.deserialize(e,t,i),{rect:s,bitmapUrl:r,bitmapId:o,isSvg:l,accessibilityData:h}=e;o&&i.imageManager.isValidId(o)?n.#_n=o:n.#bn=r,n.#An=l;const[c,d]=n.pageDimensions;return n.width=(s[2]-s[0])/c,n.height=(s[3]-s[1])/d,h&&(n.altTextData=h),n}serialize(e=!1,t=null){if(this.isEmpty())return null;const i={annotationType:n.AnnotationEditorType.STAMP,bitmapId:this.#_n,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#An,structTreeParentId:this._structTreeParentId};if(e)return i.bitmapUrl=this.#Fn(!0),i.accessibilityData=this.altTextData,i;const{decorative:s,altText:r}=this.altTextData;if(!s&&r&&(i.accessibilityData={type:"Figure",alt:r}),null===t)return i;t.stamps||=new Map;const a=this.#An?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(t.stamps.has(this.#_n)){if(this.#An){const e=t.stamps.get(this.#_n);a>e.area&&(e.area=a,e.serialized.bitmap.close(),e.serialized.bitmap=this.#Fn(!1))}}else t.stamps.set(this.#_n,{area:a,serialized:i}),i.bitmap=this.#Fn(!1);return i}}t.StampEditor=o}],__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:{}};return __webpack_modules__[e](i,i.exports,__w_pdfjs_require__),i.exports}var __webpack_exports__={};return(()=>{var e=__webpack_exports__;Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"AbortException",{enumerable:!0,get:function(){return t.AbortException}}),Object.defineProperty(e,"AnnotationEditorLayer",{enumerable:!0,get:function(){return r.AnnotationEditorLayer}}),Object.defineProperty(e,"AnnotationEditorParamsType",{enumerable:!0,get:function(){return t.AnnotationEditorParamsType}}),Object.defineProperty(e,"AnnotationEditorType",{enumerable:!0,get:function(){return t.AnnotationEditorType}}),Object.defineProperty(e,"AnnotationEditorUIManager",{enumerable:!0,get:function(){return a.AnnotationEditorUIManager}}),Object.defineProperty(e,"AnnotationLayer",{enumerable:!0,get:function(){return o.AnnotationLayer}}),Object.defineProperty(e,"AnnotationMode",{enumerable:!0,get:function(){return t.AnnotationMode}}),Object.defineProperty(e,"CMapCompressionType",{enumerable:!0,get:function(){return t.CMapCompressionType}}),Object.defineProperty(e,"DOMSVGFactory",{enumerable:!0,get:function(){return n.DOMSVGFactory}}),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,"ImageKind",{enumerable:!0,get:function(){return t.ImageKind}}),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 i.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 h.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,"noContextMenu",{enumerable:!0,get:function(){return n.noContextMenu}}),Object.defineProperty(e,"normalizeUnicode",{enumerable:!0,get:function(){return t.normalizeUnicode}}),Object.defineProperty(e,"renderTextLayer",{enumerable:!0,get:function(){return s.renderTextLayer}}),Object.defineProperty(e,"setLayerDimensions",{enumerable:!0,get:function(){return n.setLayerDimensions}}),Object.defineProperty(e,"shadow",{enumerable:!0,get:function(){return t.shadow}}),Object.defineProperty(e,"updateTextLayer",{enumerable:!0,get:function(){return s.updateTextLayer}}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return i.version}});var t=__w_pdfjs_require__(1),i=__w_pdfjs_require__(2),n=__w_pdfjs_require__(6),s=__w_pdfjs_require__(26),r=__w_pdfjs_require__(27),a=__w_pdfjs_require__(5),o=__w_pdfjs_require__(29),l=__w_pdfjs_require__(14),h=__w_pdfjs_require__(32)})(),__webpack_exports__})(),module.exports=root.pdfjsLib=factory()})(pdf);var pdfExports=pdf.exports,pdf_viewer={exports:{}};
33
33
  /**
34
34
  * @licstart The following is the entire license notice for the
35
35
  * JavaScript code in this page
@@ -51,4 +51,4 @@
51
51
  * @licend The above is the entire license notice for the
52
52
  * JavaScript code in this page
53
53
  */
54
- !function(e,t){var i,n;i=globalThis,n=()=>(()=>{var e=[,(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFFindController=t.FindState=void 0;var n=i(2),s=i(3),r=i(4);const a={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3};t.FindState=a;const o={"‐":"-","‘":"'","’":"'","‚":"'","‛":"'","“":'"',"”":'"',"„":'"',"‟":'"',"¼":"1/4","½":"1/2","¾":"3/4"},l=new Set([12441,12442,2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,3642,3770,3972,4153,4154,5908,5940,6098,6752,6980,7082,7083,7154,7155,11647,43014,43052,43204,43347,43456,43766,44013,3158,3953,3954,3962,3963,3964,3965,3968,3956]);let h;const c=/\p{M}+/gu,d=/([.*+?^${}()|[\]\\])|(\p{P})|(\s+)|(\p{M})|(\p{L})/gu,u=/([^\p{M}])\p{M}*$/u,p=/^\p{M}*([^\p{M}])/u,g=/[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g,f=new Map,m=new Map;let _=null,v=null;function b(e){const t=[];let i,n;for(;null!==(i=g.exec(e));){let{index:e}=i;for(const n of i[0]){let i=f.get(n);i||(i=n.normalize("NFD").length,f.set(n,i)),t.push([i,e++])}}if(0===t.length&&_)n=_;else if(t.length>0&&v)n=v;else{const e=`([${Object.keys(o).join("")}])|([${(0,s.getNormalizeWithNFKC)()}])|((?:゙|゚)\\n)|(\\p{M}+(?:-\\n)?)|(\\S-\\n)|((?:\\p{Ideographic}|[぀-ヿ])\\n)|(\\n)`;n=0===t.length?_=new RegExp(e+"|(\\u0000)","gum"):v=new RegExp(e+"|([\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f])","gum")}const r=[];for(;null!==(i=c.exec(e));)r.push([i[0].length,i.index]);let a=e.normalize("NFD");const l=[[0,0]];let h=0,d=0,u=0,p=0,b=0,y=!1;return a=a.replace(n,((e,i,n,s,a,c,g,f,_,v)=>{if(v-=p,i){const e=o[i],t=e.length;for(let e=1;e<t;e++)l.push([v-u+e,u-e]);return u-=t-1,e}if(n){let e=m.get(n);e||(e=n.normalize("NFKC"),m.set(n,e));const t=e.length;for(let e=1;e<t;e++)l.push([v-u+e,u-e]);return u-=t-1,e}if(s)return y=!0,v+b===r[h]?.[1]?++h:(l.push([v-1-u+1,u-1]),u-=1,p+=1),l.push([v-u+1,u]),p+=1,b+=1,s.charAt(0);if(a){const e=a.endsWith("\n"),t=e?a.length-2:a.length;y=!0;let i=t;v+b===r[h]?.[1]&&(i-=r[h][0],++h);for(let e=1;e<=i;e++)l.push([v-1-u+e,u-e]);return u-=i,p+=i,e?(v+=t-1,l.push([v-u+1,1+u]),u+=1,p+=1,b+=1,a.slice(0,t)):a}if(c){const e=c.length-2;return l.push([v-u+e,1+u]),u+=1,p+=1,b+=1,c.slice(0,-2)}if(g){const e=g.length-1;return l.push([v-u+e,u]),p+=1,b+=1,g.slice(0,-1)}if(f)return l.push([v-u+1,u-1]),u-=1,p+=1,b+=1," ";if(v+b===t[d]?.[1]){const e=t[d][0]-1;++d;for(let t=1;t<=e;t++)l.push([v-(u-t),u-t]);u-=e,p+=e}return _})),l.push([a.length,u]),[a,l,y]}function y(e,t,i){if(!e)return[t,i];const s=t,r=t+i-1;let a=(0,n.binarySearchFirstItem)(e,(e=>e[0]>=s));e[a][0]>s&&--a;let o=(0,n.binarySearchFirstItem)(e,(e=>e[0]>=r),a);e[o][0]>r&&--o;const l=s+e[a][1];return[l,r+e[o][1]+1-l]}t.PDFFindController=class{#Ln=null;#kn=!0;#Rn=0;constructor({linkService:e,eventBus:t,updateMatchesCountOnProgress:i=!0}){this._linkService=e,this._eventBus=t,this.#kn=i,this.onIsPageVisible=null,this.#In(),t._on("find",this.#On.bind(this)),t._on("findbarclose",this.#Nn.bind(this))}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return this.#Ln}setDocument(e){this._pdfDocument&&this.#In(),e&&(this._pdfDocument=e,this._firstPageCapability.resolve())}#On(e){if(!e)return;!1===e.phraseSearch&&(console.error("The `phraseSearch`-parameter was removed, please provide an Array of strings in the `query`-parameter instead."),"string"==typeof e.query&&(e.query=e.query.match(/\S+/g)));const t=this._pdfDocument,{type:i}=e;(null===this.#Ln||this.#Bn(e))&&(this._dirtyMatch=!0),this.#Ln=e,"highlightallchange"!==i&&this.#Vn(a.PENDING),this._firstPageCapability.promise.then((()=>{if(!this._pdfDocument||t&&this._pdfDocument!==t)return;this.#Kt();const e=!this._highlightMatches,n=!!this._findTimeout;this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),i?this._dirtyMatch?this.#Un():"again"===i?(this.#Un(),e&&this.#Ln.highlightAll&&this.#jn()):"highlightallchange"===i?(n?this.#Un():this._highlightMatches=!0,this.#jn()):this.#Un():this._findTimeout=setTimeout((()=>{this.#Un(),this._findTimeout=null}),250)}))}scrollMatchIntoView({element:e=null,selectedLeft:t=0,pageIndex:i=-1,matchIndex:s=-1}){if(!this._scrollMatches||!e)return;if(-1===s||s!==this._selected.matchIdx)return;if(-1===i||i!==this._selected.pageIdx)return;this._scrollMatches=!1;const r={top:-50,left:t+-400};(0,n.scrollIntoView)(e,r,!0)}#In(){this._highlightMatches=!1,this._scrollMatches=!1,this._pdfDocument=null,this._pageMatches=[],this._pageMatchesLength=[],this.#Rn=0,this.#Ln=null,this._selected={pageIdx:-1,matchIdx:-1},this._offset={pageIdx:null,matchIdx:null,wrapped:!1},this._extractTextPromises=[],this._pageContents=[],this._pageDiffs=[],this._hasDiacritics=[],this._matchesCountTotal=0,this._pagesToSearch=null,this._pendingFindMatches=new Set,this._resumePageIdx=null,this._dirtyMatch=!1,clearTimeout(this._findTimeout),this._findTimeout=null,this._firstPageCapability=new r.PromiseCapability}get#Hn(){const{query:e}=this.#Ln;return"string"==typeof e?(e!==this._rawQuery&&(this._rawQuery=e,[this._normalizedQuery]=b(e)),this._normalizedQuery):(e||[]).filter((e=>!!e)).map((e=>b(e)[0]))}#Bn(e){const t=e.query,i=this.#Ln.query,n=typeof t;if(n!==typeof i)return!0;if("string"===n){if(t!==i)return!0}else if(JSON.stringify(t)!==JSON.stringify(i))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&&!(this.onIsPageVisible?.(e)??1);case"highlightallchange":return!1}return!0}#Wn(e,t,i){let n=e.slice(0,t).match(u);if(n){const i=e.charCodeAt(t),r=n[1].charCodeAt(0);if((0,s.getCharacterType)(i)===(0,s.getCharacterType)(r))return!1}if(n=e.slice(t+i).match(p),n){const r=e.charCodeAt(t+i-1),a=n[1].charCodeAt(0);if((0,s.getCharacterType)(r)===(0,s.getCharacterType)(a))return!1}return!0}#zn(e,t,i,n){const s=this._pageMatches[i]=[],r=this._pageMatchesLength[i]=[];if(!e)return;const a=this._pageDiffs[i];let o;for(;null!==(o=e.exec(n));){if(t&&!this.#Wn(n,o.index,o[0].length))continue;const[e,i]=y(a,o.index,o[0].length);i&&(s.push(e),r.push(i))}}#Gn(e,t){const{matchDiacritics:i}=this.#Ln;let n=!1;const s="[ ]*";return(e=e.replaceAll(d,((e,s,r,a,o,h)=>s?`[ ]*\\${s}[ ]*`:r?`[ ]*${r}[ ]*`:a?"[ ]+":i?o||h:o?l.has(o.charCodeAt(0))?o:"":t?(n=!0,`${h}\\p{M}*`):h))).endsWith(s)&&(e=e.slice(0,e.length-4)),i&&t&&(h||=String.fromCharCode(...l),n=!0,e=`${e}(?=[${h}]|[^\\p{M}]|$)`),[n,e]}#$n(e){let t=this.#Hn;if(0===t.length)return;const{caseSensitive:i,entireWord:n}=this.#Ln,s=this._pageContents[e],r=this._hasDiacritics[e];let a=!1;"string"==typeof t?[a,t]=this.#Gn(t,r):t=t.sort().reverse().map((e=>{const[t,i]=this.#Gn(e,r);return a||=t,`(${i})`})).join("|"),t=t?new RegExp(t,`g${a?"u":""}${i?"":"i"}`):null,this.#zn(t,n,e,s),this.#Ln.highlightAll&&this.#qn(e),this._resumePageIdx===e&&(this._resumePageIdx=null,this.#Xn());const o=this._pageMatches[e].length;this._matchesCountTotal+=o,this.#kn?o>0&&this.#Kn():++this.#Rn===this._linkService.pagesCount&&this.#Kn()}#Kt(){if(this._extractTextPromises.length>0)return;let e=Promise.resolve();const t={disableNormalization:!0};for(let i=0,n=this._linkService.pagesCount;i<n;i++){const n=new r.PromiseCapability;this._extractTextPromises[i]=n.promise,e=e.then((()=>this._pdfDocument.getPage(i+1).then((e=>e.getTextContent(t))).then((e=>{const t=[];for(const i of e.items)t.push(i.str),i.hasEOL&&t.push("\n");[this._pageContents[i],this._pageDiffs[i],this._hasDiacritics[i]]=b(t.join("")),n.resolve()}),(e=>{console.error(`Unable to get text content for page ${i+1}`,e),this._pageContents[i]="",this._pageDiffs[i]=null,this._hasDiacritics[i]=!1,n.resolve()}))))}}#qn(e){this._scrollMatches&&this._selected.pageIdx===e&&(this._linkService.page=e+1),this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:e})}#jn(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})}#Un(){const e=this.#Ln.findPrevious,t=this._linkService.page-1,i=this._linkService.pagesCount;if(this._highlightMatches=!0,this._dirtyMatch){this._dirtyMatch=!1,this._selected.pageIdx=this._selected.matchIdx=-1,this._offset.pageIdx=t,this._offset.matchIdx=null,this._offset.wrapped=!1,this._resumePageIdx=null,this._pageMatches.length=0,this._pageMatchesLength.length=0,this.#Rn=0,this._matchesCountTotal=0,this.#jn();for(let e=0;e<i;e++)this._pendingFindMatches.has(e)||(this._pendingFindMatches.add(e),this._extractTextPromises[e].then((()=>{this._pendingFindMatches.delete(e),this.#$n(e)})))}if(0===this.#Hn.length)return void this.#Vn(a.FOUND);if(this._resumePageIdx)return;const n=this._offset;if(this._pagesToSearch=i,null!==n.matchIdx){const t=this._pageMatches[n.pageIdx].length;if(!e&&n.matchIdx+1<t||e&&n.matchIdx>0)return n.matchIdx=e?n.matchIdx-1:n.matchIdx+1,void this.#Yn(!0);this.#Qn(e)}this.#Xn()}#Jn(e){const t=this._offset,i=e.length,n=this.#Ln.findPrevious;return i?(t.matchIdx=n?i-1:0,this.#Yn(!0),!0):(this.#Qn(n),!!(t.wrapped&&(t.matchIdx=null,this._pagesToSearch<0))&&(this.#Yn(!1),!0))}#Xn(){null!==this._resumePageIdx&&console.error("There can only be one pending page.");let e=null;do{const t=this._offset.pageIdx;if(e=this._pageMatches[t],!e){this._resumePageIdx=t;break}}while(!this.#Jn(e))}#Qn(e){const t=this._offset,i=this._linkService.pagesCount;t.pageIdx=e?t.pageIdx-1:t.pageIdx+1,t.matchIdx=null,this._pagesToSearch--,(t.pageIdx>=i||t.pageIdx<0)&&(t.pageIdx=e?i-1:0,t.wrapped=!0)}#Yn(e=!1){let t=a.NOT_FOUND;const i=this._offset.wrapped;if(this._offset.wrapped=!1,e){const e=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx,this._selected.matchIdx=this._offset.matchIdx,t=i?a.WRAPPED:a.FOUND,-1!==e&&e!==this._selected.pageIdx&&this.#qn(e)}this.#Vn(t,this.#Ln.findPrevious),-1!==this._selected.pageIdx&&(this._scrollMatches=!0,this.#qn(this._selected.pageIdx))}#Nn(e){const t=this._pdfDocument;this._firstPageCapability.promise.then((()=>{!this._pdfDocument||t&&this._pdfDocument!==t||(this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),this._resumePageIdx&&(this._resumePageIdx=null,this._dirtyMatch=!0),this.#Vn(a.FOUND),this._highlightMatches=!1,this.#jn())}))}#Zn(){const{pageIdx:e,matchIdx:t}=this._selected;let i=0,n=this._matchesCountTotal;if(-1!==t){for(let t=0;t<e;t++)i+=this._pageMatches[t]?.length||0;i+=t+1}return(i<1||i>n)&&(i=n=0),{current:i,total:n}}#Kn(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:this.#Zn()})}#Vn(e,t=!1){(this.#kn||this.#Rn===this._linkService.pagesCount&&e!==a.PENDING)&&this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:e,previous:t,matchesCount:this.#Zn(),rawQuery:this.#Ln?.query??null})}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.animationStarted=t.VERTICAL_PADDING=t.UNKNOWN_SCALE=t.TextLayerMode=t.SpreadMode=t.SidebarView=t.ScrollMode=t.SCROLLBAR_PADDING=t.RenderingStates=t.ProgressBar=t.PresentationModeState=t.OutputScale=t.MIN_SCALE=t.MAX_SCALE=t.MAX_AUTO_SCALE=t.DEFAULT_SCALE_VALUE=t.DEFAULT_SCALE_DELTA=t.DEFAULT_SCALE=t.CursorTool=t.AutoPrintRegExp=void 0,t.apiPageLayoutToViewerModes=function(e){let t=n.VERTICAL,i=s.NONE;switch(e){case"SinglePage":t=n.PAGE;break;case"OneColumn":break;case"TwoPageLeft":t=n.PAGE;case"TwoColumnLeft":i=s.ODD;break;case"TwoPageRight":t=n.PAGE;case"TwoColumnRight":i=s.EVEN}return{scrollMode:t,spreadMode:i}},t.apiPageModeToSidebarView=function(e){switch(e){case"UseNone":return i.NONE;case"UseThumbs":return i.THUMBS;case"UseOutlines":return i.OUTLINE;case"UseAttachments":return i.ATTACHMENTS;case"UseOC":return i.LAYERS}return i.NONE},t.approximateFraction=function(e){if(Math.floor(e)===e)return[e,1];const t=1/e;if(t>8)return[1,8];if(Math.floor(t)===t)return[1,t];const i=e>1?t:e;let n,s=0,r=1,a=1,o=1;for(;;){const e=s+a,t=r+o;if(t>8)break;i<=e/t?(a=e,o=t):(s=e,r=t)}return n=i-s/r<a/o-i?i===e?[s,r]:[r,s]:i===e?[a,o]:[o,a],n},t.backtrackBeforeAllVisibleElements=o,t.binarySearchFirstItem=a,t.docStyle=void 0,t.getActiveOrFocusedElement=function(){let e=document,t=e.activeElement||e.querySelector(":focus");for(;t?.shadowRoot;)e=t.shadowRoot,t=e.activeElement||e.querySelector(":focus");return t},t.getPageSizeInches=function({view:e,userUnit:t,rotate:i}){const[n,s,r,a]=e,o=i%180!=0,l=(r-n)/72*t,h=(a-s)/72*t;return{width:o?h:l,height:o?l:h}},t.getVisibleElements=function({scrollEl:e,views:t,sortByVisibility:i=!1,horizontal:n=!1,rtl:s=!1}){const r=e.scrollTop,l=r+e.clientHeight,h=e.scrollLeft,c=h+e.clientWidth,d=[],u=new Set,p=t.length;let g=a(t,n?function(e){const t=e.div,i=t.offsetLeft+t.clientLeft,n=i+t.clientWidth;return s?i<c:n>h}:function(e){const t=e.div;return t.offsetTop+t.clientTop+t.clientHeight>r});g>0&&g<p&&!n&&(g=o(g,t,r));let f=n?c:-1;for(let e=g;e<p;e++){const i=t[e],s=i.div,a=s.offsetLeft+s.clientLeft,o=s.offsetTop+s.clientTop,p=s.clientWidth,g=s.clientHeight,m=a+p,_=o+g;if(-1===f)_>=l&&(f=_);else if((n?a:o)>f)break;if(_<=r||o>=l||m<=h||a>=c)continue;const v=Math.max(0,r-o)+Math.max(0,_-l),b=(p-(Math.max(0,h-a)+Math.max(0,m-c)))/p,y=(g-v)/g*b*100|0;d.push({id:i.id,x:a,y:o,view:i,percent:y,widthPercent:100*b|0}),u.add(i.id)}const m=d[0],_=d.at(-1);return i&&d.sort((function(e,t){const i=e.percent-t.percent;return Math.abs(i)>.001?-i:e.id-t.id})),{first:m,last:_,views:d,ids:u}},t.isPortraitOrientation=function(e){return e.width<=e.height},t.isValidRotation=function(e){return Number.isInteger(e)&&e%90==0},t.isValidScrollMode=function(e){return Number.isInteger(e)&&Object.values(n).includes(e)&&e!==n.UNKNOWN},t.isValidSpreadMode=function(e){return Number.isInteger(e)&&Object.values(s).includes(e)&&e!==s.UNKNOWN},t.normalizeWheelEventDelta=function(e){const t=e.deltaMode;let i=l(e);return t===WheelEvent.DOM_DELTA_PIXEL?i/=900:t===WheelEvent.DOM_DELTA_LINE&&(i/=30),i},t.normalizeWheelEventDirection=l,t.parseQueryString=function(e){const t=new Map;for(const[i,n]of new URLSearchParams(e))t.set(i.toLowerCase(),n);return t},t.removeNullCharacters=function(e,t=!1){return"string"!=typeof e?(console.error("The argument must be a string."),e):(t&&(e=e.replaceAll(r," ")),e.replaceAll("\0",""))},t.roundToDivide=function(e,t){const i=e%t;return 0===i?e:Math.round(e-i+t)},t.scrollIntoView=function(e,t,i=!1){let n=e.offsetParent;if(!n)return void console.error("offsetParent is not set -- cannot scroll");let s=e.offsetTop+e.clientTop,r=e.offsetLeft+e.clientLeft;for(;n.clientHeight===n.scrollHeight&&n.clientWidth===n.scrollWidth||i&&(n.classList.contains("markedContent")||"hidden"===getComputedStyle(n).overflow);)if(s+=n.offsetTop,r+=n.offsetLeft,n=n.offsetParent,!n)return;t&&(void 0!==t.top&&(s+=t.top),void 0!==t.left&&(r+=t.left,n.scrollLeft=r)),n.scrollTop=s},t.toggleCheckedBtn=function(e,t,i=null){e.classList.toggle("toggled",t),e.setAttribute("aria-checked",t),i?.classList.toggle("hidden",!t)},t.toggleExpandedBtn=function(e,t,i=null){e.classList.toggle("toggled",t),e.setAttribute("aria-expanded",t),i?.classList.toggle("hidden",!t)},t.watchScroll=function(e,t){const i=function(i){s||(s=window.requestAnimationFrame((function(){s=null;const i=e.scrollLeft,r=n.lastX;i!==r&&(n.right=i>r),n.lastX=i;const a=e.scrollTop,o=n.lastY;a!==o&&(n.down=a>o),n.lastY=a,t(n)})))},n={right:!0,down:!0,lastX:e.scrollLeft,lastY:e.scrollTop,_eventHandler:i};let s=null;return e.addEventListener("scroll",i,!0),n},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 s={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2};t.SpreadMode=s,t.CursorTool={SELECT:0,HAND:1,ZOOM:2},t.AutoPrintRegExp=/\bprint\s*\(/,t.OutputScale=class{constructor(){const e=window.devicePixelRatio||1;this.sx=e,this.sy=e}get scaled(){return 1!==this.sx||1!==this.sy}};const r=/[\x01-\x1F]/g;function a(e,t,i=0){let n=i,s=e.length-1;if(s<0||!t(e[s]))return e.length;if(t(e[n]))return n;for(;n<s;){const i=n+s>>1;t(e[i])?s=i:n=i+1}return n}function o(e,t,i){if(e<2)return e;let n=t[e].div,s=n.offsetTop+n.clientTop;s>=i&&(n=t[e-1].div,s=n.offsetTop+n.clientTop);for(let i=e-2;i>=0&&(n=t[i].div,!(n.offsetTop+n.clientTop+n.clientHeight<=s));--i)e=i;return e}function l(e){let t=Math.hypot(e.deltaX,e.deltaY);const i=Math.atan2(e.deltaY,e.deltaX);return-.25*Math.PI<i&&i<.75*Math.PI&&(t=-t),t}const h=new Promise((function(e){window.requestAnimationFrame(e)}));t.animationStarted=h;const c=document.documentElement.style;t.docStyle=c,t.ProgressBar=class{#es=null;#ts=null;#is=0;#ns=null;#mt=!0;constructor(e){this.#es=e.classList,this.#ns=e.style}get percent(){return this.#is}set percent(e){var t,i,n;this.#is=(t=e,i=0,n=100,Math.min(Math.max(t,i),n)),isNaN(e)?this.#es.add("indeterminate"):(this.#es.remove("indeterminate"),this.#ns.setProperty("--progressBar-percent",`${this.#is}%`))}setWidth(e){if(!e)return;const t=e.parentNode.offsetWidth-e.offsetWidth;t>0&&this.#ns.setProperty("--progressBar-end-offset",`${t}px`)}setDisableAutoFetch(e=5e3){isNaN(this.#is)||(this.#ts&&clearTimeout(this.#ts),this.show(),this.#ts=setTimeout((()=>{this.#ts=null,this.hide()}),e))}hide(){this.#mt&&(this.#mt=!1,this.#es.add("hidden"))}show(){this.#mt||(this.#mt=!0,this.#es.remove("hidden"))}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterType=void 0,t.getCharacterType=function(e){return function(e){return e<11904}(e)?function(e){return 0==(65408&e)}(e)?function(e){return 32===e||9===e||13===e||10===e}(e)?i.SPACE:function(e){return e>=97&&e<=122||e>=65&&e<=90}(e)||function(e){return e>=48&&e<=57}(e)||95===e?i.ALPHA_LETTER:i.PUNCT:function(e){return 3584==(65408&e)}(e)?i.THAI_LETTER:160===e?i.SPACE:i.ALPHA_LETTER:function(e){return e>=13312&&e<=40959||e>=63744&&e<=64255}(e)?i.HAN_LETTER:function(e){return e>=12448&&e<=12543}(e)?i.KATAKANA_LETTER:function(e){return e>=12352&&e<=12447}(e)?i.HIRAGANA_LETTER:function(e){return e>=65376&&e<=65439}(e)?i.HALFWIDTH_KATAKANA_LETTER:i.ALPHA_LETTER},t.getNormalizeWithNFKC=function(){return n||=" ¨ª¯²-µ¸-º¼-¾IJ-ijĿ-ŀʼnſDŽ-njDZ-dzʰ-ʸ˘-˝ˠ-ˤʹͺ;΄-΅·ϐ-ϖϰ-ϲϴ-ϵϹևٵ-ٸक़-य़ড়-ঢ়য়ਲ਼ਸ਼ਖ਼-ਜ਼ਫ਼ଡ଼-ଢ଼ำຳໜ-ໝ༌གྷཌྷདྷབྷཛྷཀྵჼᴬ-ᴮᴰ-ᴺᴼ-ᵍᵏ-ᵪᵸᶛ-ᶿẚ-ẛάέήίόύώΆ᾽-῁ΈΉ῍-῏ΐΊ῝-῟ΰΎ῭-`ΌΏ´-῾ - ‑‗․-… ″-‴‶-‷‼‾⁇-⁉⁗ ⁰-ⁱ⁴-₎ₐ-ₜ₨℀-℃℅-ℇ℉-ℓℕ-№ℙ-ℝ℠-™ℤΩℨK-ℭℯ-ℱℳ-ℹ℻-⅀ⅅ-ⅉ⅐-ⅿ↉∬-∭∯-∰〈-〉①-⓪⨌⩴-⩶⫝̸ⱼ-ⱽⵯ⺟⻳⼀-⿕ 〶〸-〺゛-゜ゟヿㄱ-ㆎ㆒-㆟㈀-㈞㈠-㉇㉐-㉾㊀-㏿ꚜ-ꚝꝰꟲ-ꟴꟸ-ꟹꭜ-ꭟꭩ豈-嗀塚晴凞-羽蘒諸逸-都飯-舘並-龎ff-stﬓ-ﬗיִײַ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-﷼︐-︙︰-﹄﹇-﹒﹔-﹦﹨-﹫ﹰ-ﹲﹴﹶ-ﻼ!-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ¢-₩",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};let n;t.CharacterType=i},e=>{e.exports=globalThis.pdfjsLib},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SimpleLinkService=t.PDFLinkService=t.LinkTarget=void 0;var n=i(2);const s={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};function r(e,{url:t,target:i,rel:n,enabled:r=!0}={}){if(!t||"string"!=typeof t)throw new Error('A valid "url" parameter must provided.');r?e.href=e.title=t:(e.href="",e.title=`Disabled: ${t}`,e.onclick=()=>!1);let a="";switch(i){case s.NONE:break;case s.SELF:a="_self";break;case s.BLANK:a="_blank";break;case s.PARENT:a="_parent";break;case s.TOP:a="_top"}e.target=a,e.rel="string"==typeof n?n:"noopener noreferrer nofollow"}t.LinkTarget=s;class a{#ss=new Map;constructor({eventBus:e,externalLinkTarget:t=null,externalLinkRel:i=null,ignoreDestinationZoom:n=!1}={}){this.eventBus=e,this.externalLinkTarget=t,this.externalLinkRel=i,this.externalLinkEnabled=!0,this._ignoreDestinationZoom=n,this.baseUrl=null,this.pdfDocument=null,this.pdfViewer=null,this.pdfHistory=null}setDocument(e,t=null){this.baseUrl=t,this.pdfDocument=e,this.#ss.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}#rs(e,t=null,i){const n=i[0];let s;if("object"==typeof n&&null!==n){if(s=this._cachedPageNumber(n),!s)return void this.pdfDocument.getPageIndex(n).then((s=>{this.cachePageRef(s+1,n),this.#rs(e,t,i)})).catch((()=>{console.error(`PDFLinkService.#goToDestinationHelper: "${n}" is not a valid page reference, for dest="${e}".`)}))}else{if(!Number.isInteger(n))return void console.error(`PDFLinkService.#goToDestinationHelper: "${n}" is not a valid destination reference, for dest="${e}".`);s=n+1}!s||s<1||s>this.pagesCount?console.error(`PDFLinkService.#goToDestinationHelper: "${s}" is not a valid page number, for dest="${e}".`):(this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.push({namedDest:t,explicitDest:i,pageNumber:s})),this.pdfViewer.scrollPageIntoView({pageNumber:s,destArray:i,ignoreDestinationZoom:this._ignoreDestinationZoom}))}async goToDestination(e){if(!this.pdfDocument)return;let t,i;"string"==typeof e?(t=e,i=await this.pdfDocument.getDestination(e)):(t=null,i=await e),Array.isArray(i)?this.#rs(e,t,i):console.error(`PDFLinkService.goToDestination: "${i}" is not a valid destination array, for dest="${e}".`)}goToPage(e){if(!this.pdfDocument)return;const t="string"==typeof e&&this.pdfViewer.pageLabelToPageNumber(e)||0|e;Number.isInteger(t)&&t>0&&t<=this.pagesCount?(this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.pushPage(t)),this.pdfViewer.scrollPageIntoView({pageNumber:t})):console.error(`PDFLinkService.goToPage: "${e}" is not a valid page.`)}addLinkAttributes(e,t,i=!1){r(e,{url:t,target:i?s.BLANK:this.externalLinkTarget,rel:this.externalLinkRel,enabled:this.externalLinkEnabled})}getDestinationHash(e){if("string"==typeof e){if(e.length>0)return this.getAnchorUrl("#"+escape(e))}else if(Array.isArray(e)){const t=JSON.stringify(e);if(t.length>0)return this.getAnchorUrl("#"+escape(t))}return this.getAnchorUrl("")}getAnchorUrl(e){return this.baseUrl?this.baseUrl+e:e}setHash(e){if(!this.pdfDocument)return;let t,i;if(e.includes("=")){const s=(0,n.parseQueryString)(e);if(s.has("search")){const e=s.get("search").replaceAll('"',""),t="true"===s.get("phrase");this.eventBus.dispatch("findfromurlhash",{source:this,query:t?e:e.match(/\S+/g)})}if(s.has("page")&&(t=0|s.get("page")||1),s.has("zoom")){const e=s.get("zoom").split(","),t=e[0],n=parseFloat(t);t.includes("Fit")?"Fit"===t||"FitB"===t?i=[null,{name:t}]:"FitH"===t||"FitBH"===t||"FitV"===t||"FitBV"===t?i=[null,{name:t},e.length>1?0|e[1]:null]:"FitR"===t?5!==e.length?console.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):i=[null,{name:t},0|e[1],0|e[2],0|e[3],0|e[4]]:console.error(`PDFLinkService.setHash: "${t}" is not a valid zoom value.`):i=[null,{name:"XYZ"},e.length>1?0|e[1]:null,e.length>2?0|e[2]:null,n?n/100:t]}i?this.pdfViewer.scrollPageIntoView({pageNumber:t||this.page,destArray:i,allowNegativeOffset:!0}):t&&(this.page=t),s.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:s.get("pagemode")}),s.has("nameddest")&&this.goToDestination(s.get("nameddest"))}else{i=unescape(e);try{i=JSON.parse(i),Array.isArray(i)||(i=i.toString())}catch{}if("string"==typeof i||a.#as(i))return void this.goToDestination(i);console.error(`PDFLinkService.setHash: "${unescape(e)}" is not a valid destination.`)}}executeNamedAction(e){switch(e){case"GoBack":this.pdfHistory?.back();break;case"GoForward":this.pdfHistory?.forward();break;case"NextPage":this.pdfViewer.nextPage();break;case"PrevPage":this.pdfViewer.previousPage();break;case"LastPage":this.page=this.pagesCount;break;case"FirstPage":this.page=1}this.eventBus.dispatch("namedaction",{source:this,action:e})}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.#ss.set(i,e)}_cachedPageNumber(e){if(!e)return null;const t=0===e.gen?`${e.num}R`:`${e.num}R${e.gen}`;return this.#ss.get(t)||null}static#as(e){if(!Array.isArray(e))return!1;const t=e.length;if(t<2)return!1;const i=e[0];if(!("object"==typeof i&&Number.isInteger(i.num)&&Number.isInteger(i.gen)||Number.isInteger(i)&&i>=0))return!1;const n=e[1];if("object"!=typeof n||"string"!=typeof n.name)return!1;let s=!0;switch(n.name){case"XYZ":if(5!==t)return!1;break;case"Fit":case"FitB":return 2===t;case"FitH":case"FitBH":case"FitV":case"FitBV":if(3!==t)return!1;break;case"FitR":if(6!==t)return!1;s=!1;break;default:return!1}for(let i=2;i<t;i++){const t=e[i];if(!("number"==typeof t||s&&null===t))return!1}return!0}}t.PDFLinkService=a,t.SimpleLinkService=class{constructor(){this.externalLinkEnabled=!0}get pagesCount(){return 0}get page(){return 0}set page(e){}get rotation(){return 0}set rotation(e){}get isInPresentationMode(){return!1}async goToDestination(e){}goToPage(e){}addLinkAttributes(e,t,i=!1){r(e,{url:t,enabled:this.externalLinkEnabled})}getDestinationHash(e){return"#"}getAnchorUrl(e){return"#"}setHash(e){}executeNamedAction(e){}executeSetOCGState(e){}cachePageRef(e,t){}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationLayerBuilder=void 0;var n=i(4),s=i(7),r=i(2);t.AnnotationLayerBuilder=class{#os=null;constructor({pageDiv:e,pdfPage:t,linkService:i,downloadManager:n,annotationStorage:r=null,imageResourcesPath:a="",renderForms:o=!0,l10n:l=s.NullL10n,enableScripting:h=!1,hasJSActionsPromise:c=null,fieldObjectsPromise:d=null,annotationCanvasMap:u=null,accessibilityManager:p=null}){this.pageDiv=e,this.pdfPage=t,this.linkService=i,this.downloadManager=n,this.imageResourcesPath=a,this.renderForms=o,this.l10n=l,this.annotationStorage=r,this.enableScripting=h,this._hasJSActionsPromise=c||Promise.resolve(!1),this._fieldObjectsPromise=d||Promise.resolve(null),this._annotationCanvasMap=u,this._accessibilityManager=p,this.annotationLayer=null,this.div=null,this._cancelled=!1,this._eventBus=i.eventBus}async render(e,t="display"){if(this.div){if(this._cancelled||!this.annotationLayer)return;return void this.annotationLayer.update({viewport:e.clone({dontFlip:!0})})}const[i,s,a]=await Promise.all([this.pdfPage.getAnnotations({intent:t}),this._hasJSActionsPromise,this._fieldObjectsPromise]);if(this._cancelled)return;const o=this.div=document.createElement("div");o.className="annotationLayer",this.pageDiv.append(o),0!==i.length?(this.annotationLayer=new n.AnnotationLayer({div:o,accessibilityManager:this._accessibilityManager,annotationCanvasMap:this._annotationCanvasMap,l10n:this.l10n,page:this.pdfPage,viewport:e.clone({dontFlip:!0})}),await this.annotationLayer.render({annotations:i,imageResourcesPath:this.imageResourcesPath,renderForms:this.renderForms,linkService:this.linkService,downloadManager:this.downloadManager,annotationStorage:this.annotationStorage,enableScripting:this.enableScripting,hasJSActions:s,fieldObjects:a}),this.linkService.isInPresentationMode&&this.#ls(r.PresentationModeState.FULLSCREEN),this.#os||(this.#os=e=>{this.#ls(e.state)},this._eventBus?._on("presentationmodechanged",this.#os))):this.hide()}cancel(){this._cancelled=!0,this.#os&&(this._eventBus?._off("presentationmodechanged",this.#os),this.#os=null)}hide(){this.div&&(this.div.hidden=!0)}#ls(e){if(!this.div)return;let t=!1;switch(e){case r.PresentationModeState.FULLSCREEN:t=!0;break;case r.PresentationModeState.NORMAL:break;default:return}for(const e of this.div.childNodes)e.hasAttribute("data-internal-link")||(e.inert=t)}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NullL10n=void 0,t.getL10nFallback=n;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.",annotation_date_string:"{{date}}, {{time}}",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",editor_alt_text_button_label:"Alt text",editor_alt_text_edit_button_label:"Edit alt text",editor_alt_text_decorative_tooltip:"Marked as decorative"};function n(e,t){switch(e){case"find_match_count":e=`find_match_count[${1===t.total?"one":"other"}]`;break;case"find_match_count_limit":e=`find_match_count_limit[${1===t.limit?"one":"other"}]`}return i[e]||""}i.print_progress_percent="{{progress}}%";const s={getLanguage:async()=>"en-us",getDirection:async()=>"ltr",get:async(e,t=null,i=n(e,t))=>function(e,t){return t?e.replaceAll(/\{\{\s*(\w+)\s*\}\}/g,((e,i)=>i in t?t[i]:"{{"+i+"}}")):e}(i,t),async translate(e){}};t.NullL10n=s},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DownloadManager=void 0;var n=i(4);function s(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{#hs=new WeakMap;downloadUrl(e,t,i){(0,n.createValidAbsoluteUrl)(e,"http://example.com")?s(e+"#pdfjs.action=download",t):console.error(`downloadUrl - not a valid URL: ${e}`)}downloadData(e,t,i){s(URL.createObjectURL(new Blob([e],{type:i})),t)}openOrDownloadData(e,t,i){const s=(0,n.isPdfFile)(i)?"application/pdf":"";return this.downloadData(t,i,s),!1}download(e,t,i,n){s(URL.createObjectURL(e),i)}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WaitOnType=t.EventBus=t.AutomationEventBus=void 0,t.waitOnEventOrTimeout=function({target:e,name:t,delay:s=0}){return new Promise((function(r,a){if("object"!=typeof e||!t||"string"!=typeof t||!(Number.isInteger(s)&&s>=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");function o(i){e instanceof n?e._off(t,l):e.removeEventListener(t,l),c&&clearTimeout(c),r(i)}const l=o.bind(null,i.EVENT);e instanceof n?e._on(t,l):e.addEventListener(t,l);const h=o.bind(null,i.TIMEOUT),c=setTimeout(h,s)}))};const i={EVENT:"event",TIMEOUT:"timeout"};t.WaitOnType=i;class n{#a=Object.create(null);on(e,t,i=null){this._on(e,t,{external:!0,once:i?.once})}off(e,t,i=null){this._off(e,t,{external:!0,once:i?.once})}dispatch(e,t){const i=this.#a[e];if(!i||0===i.length)return;let n;for(const{listener:s,external:r,once:a}of i.slice(0))a&&this._off(e,s),r?(n||=[]).push(s):s(t);if(n){for(const e of n)e(t);n=null}}_on(e,t,i=null){(this.#a[e]||=[]).push({listener:t,external:!0===i?.external,once:!0===i?.once})}_off(e,t,i=null){const n=this.#a[e];if(n)for(let e=0,i=n.length;e<i;e++)if(n[e].listener===t)return void n.splice(e,1)}}t.EventBus=n,t.AutomationEventBus=class extends n{dispatch(e,t){throw new Error("Not implemented: AutomationEventBus.dispatch")}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GenericL10n=void 0,i(11);var n=i(7);const s={en:"en-US",es:"es-ES",fy:"fy-NL",ga:"ga-IE",gu:"gu-IN",hi:"hi-IN",hy:"hy-AM",nb:"nb-NO",ne:"ne-NP",nn:"nn-NO",pa:"pa-IN",pt:"pt-PT",sv:"sv-SE",zh:"zh-CN"};t.GenericL10n=class{constructor(e){const{webL10n:t}=document;this._lang=e,this._ready=new Promise(((i,n)=>{var r;t.setLanguage((r=e,s[r?.toLowerCase()]||r),(()=>{i(t)}))}))}async getLanguage(){return(await this._ready).getLanguage()}async getDirection(){return(await this._ready).getDirection()}async get(e,t=null,i=(0,n.getL10nFallback)(e,t)){return(await this._ready).get(e,t,i)}async translate(e){return(await this._ready).translate(e)}}},()=>{document.webL10n=function(e,t){var i={},n="",s="textContent",r="",a={},o="loading",l=!0;function h(e,t,i){t=t||function(e){},i=i||function(){};var n=new XMLHttpRequest;n.open("GET",e,l),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 c(e,t,r,a){var o=e.replace(/[^\/]*$/,"")||"./";function l(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,"'")}h(e,(function(e){n+=e,function(e,i){var n={},s=/^\s*|\s*$/,r=/^\s*#|^\s*$/,a=/^\s*\[(.*)\]\s*$/,c=/^\s*@import\s+url\((.*)\)\s*$/i,d=/^([^=\s]*)\s*=\s*(.+)$/;function u(e,i,h){var u=e.replace(s,"").split(/[\r\n]+/),g="*",f=t.split("-",1)[0],m=!1,_="";!function e(){for(;;){if(!u.length)return void h();var s=u.shift();if(!r.test(s)){if(i){if(_=a.exec(s)){g=_[1].toLowerCase(),m="*"!==g&&g!==t&&g!==f;continue}if(m)continue;if(_=c.exec(s))return void p(o+_[1],e)}var v=s.match(d);v&&3==v.length&&(n[v[1]]=l(v[2]))}}}()}function p(e,t){h(e,(function(e){u(e,!1,t)}),(function(){console.warn(e+" not found."),t()}))}u(e,!0,(function(){i(n)}))}(e,(function(e){for(var t in e){var n,a,o=t.lastIndexOf(".");o>0?(n=t.substring(0,o),a=t.substring(o+1)):(n=t,a=s),i[n]||(i[n]={}),i[n][a]=e[t]}r&&r()}))}),a)}function d(e,s){e&&(e=e.toLowerCase()),s=s||function(){},i={},n="",r="",r=e;var a=t.querySelectorAll('link[type="application/l10n"]'),l=a.length;if(0!==l){var h,d,u=0;d=function(){++u>=l&&(s(),o="complete")};for(var p=0;p<l;p++)new _(a[p]).load(e,d)}else{var g=(h=t.querySelector('script[type="application/l10n"]'))?JSON.parse(h.innerHTML):null;if(g&&g.locales&&g.default_locale){if(console.log("using the embedded JSON directory, early way out"),!(i=g.locales[e])){var f=g.default_locale.toLowerCase();for(var m in g.locales){if((m=m.toLowerCase())===e){i=g.locales[e];break}m===f&&(i=g.locales[f])}}s()}else console.log("no resource to load, early way out");o="complete"}function _(e){var t=e.href;this.load=function(e,i){c(t,e,i,(function(){console.warn(t+" not found."),console.warn('"'+e+'" resource not found'),r="",i()}))}}}function u(e,t,n){var s=i[e];if(!s){if(console.warn("#"+e+" is undefined."),!n)return null;s=n}var r={};for(var a in s){var o=s[a];o=g(o=p(o,t,e,a),t,e),r[a]=o}return r}function p(e,t,n,s){var r=/\{\[\s*([a-zA-Z]+)\(([a-zA-Z]+)\)\s*\]\}/.exec(e);if(!r||!r.length)return e;var o,l=r[1],h=r[2];return t&&h in t?o=t[h]:h in i&&(o=i[h]),l in a&&(e=(0,a[l])(e,o,n,s)),e}function g(e,t,n){return e.replace(/\{\{\s*(.+?)\s*\}\}/g,(function(e,s){return t&&s in t?t[s]:s in i?i[s]:(console.log("argument {{"+s+"}} for #"+n+" is undefined."),e)}))}function f(e){var i=function(e){if(!e)return{};var t=e.getAttribute("data-l10n-id"),i=e.getAttribute("data-l10n-args"),n={};if(i)try{n=JSON.parse(i)}catch(e){console.warn("could not parse arguments for #"+t)}return{id:t,args:n}}(e);if(i.id){var n=u(i.id,i.args);if(n){if(n[s]){if(0===function(e){if(e.children)return e.children.length;if(void 0!==e.childElementCount)return e.childElementCount;for(var t=0,i=0;i<e.childNodes.length;i++)t+=1===e.nodeType?1:0;return t}(e))e[s]=n[s];else{for(var r=e.childNodes,a=!1,o=0,l=r.length;o<l;o++)3===r[o].nodeType&&/\S/.test(r[o].nodeValue)&&(a?r[o].nodeValue="":(r[o].nodeValue=n[s],a=!0));if(!a){var h=t.createTextNode(n[s]);e.prepend(h)}}delete n[s]}for(var c in n)e[c]=n[c]}else console.warn("#"+i.id+" is undefined.")}}return a.plural=function(e,t,n,o){var l=parseFloat(t);if(isNaN(l))return e;if(o!=s)return e;a._pluralRules||(a._pluralRules=function(e){function t(e,t){return-1!==t.indexOf(e)}function i(e,t,i){return t<=e&&e<=i}var n={0:function(e){return"other"},1:function(e){return i(e%100,3,10)?"few":0===e?"zero":i(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 i(e,0,1)?"one":"other"},5:function(e){return i(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 i(e,3,6)?"few":i(e,7,10)?"many":2==e?"two":1==e?"one":"other"},9:function(e){return 0===e||1!=e&&i(e%100,1,19)?"few":1==e?"one":"other"},10:function(e){return i(e%10,2,9)&&!i(e%100,11,19)?"few":e%10!=1||i(e%100,11,19)?"other":"one"},11:function(e){return i(e%10,2,4)&&!i(e%100,12,14)?"few":e%10==0||i(e%10,5,9)||i(e%100,11,14)?"many":e%10==1&&e%100!=11?"one":"other"},12:function(e){return i(e,2,4)?"few":1==e?"one":"other"},13:function(e){return i(e%10,2,4)&&!i(e%100,12,14)?"few":1!=e&&i(e%10,0,1)||i(e%10,5,9)||i(e%100,12,14)?"many":1==e?"one":"other"},14:function(e){return i(e%100,3,4)?"few":e%100==2?"two":e%100==1?"one":"other"},15:function(e){return 0===e||i(e%100,2,10)?"few":i(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":i(e,0,2)&&0!==e&&2!=e?"one":"other"},19:function(e){return i(e,2,10)?"few":i(e,0,1)?"one":"other"},20:function(e){return!i(e%10,3,4)&&e%10!=9||i(e%100,10,19)||i(e%100,70,79)||i(e%100,90,99)?e%1e6==0&&0!==e?"many":e%10!=2||t(e%100,[12,72,92])?e%10!=1||t(e%100,[11,71,91])?"other":"one":"two":"few"},21:function(e){return 0===e?"zero":1==e?"one":"other"},22:function(e){return i(e,0,1)||i(e,11,99)?"one":"other"},23:function(e){return i(e%10,1,2)||e%20==0?"one":"other"},24:function(e){return i(e,3,10)||i(e,13,19)?"few":t(e,[2,12])?"two":t(e,[1,11])?"one":"other"}},s={af:3,ak:4,am:4,ar:1,asa:3,az:0,be:11,bem:3,bez:3,bg:3,bh:4,bm:0,bn:3,bo:0,br:20,brx:3,bs:11,ca:3,cgg:3,chr:3,cs:12,cy:17,da:3,de:3,dv:3,dz:0,ee:3,el:3,en:3,eo:3,es:3,et:3,eu:3,fa:0,ff:5,fi:3,fil:4,fo:3,fr:5,fur:3,fy:3,ga:8,gd:24,gl:3,gsw:3,gu:3,guw:4,gv:23,ha:3,haw:3,he:2,hi:4,hr:11,hu:0,id:0,ig:0,ii:0,is:3,it:3,iu:7,ja:0,jmc:3,jv:0,ka:0,kab:5,kaj:3,kcg:3,kde:0,kea:0,kk:3,kl:3,km:0,kn:0,ko:0,ksb:3,ksh:21,ku:3,kw:7,lag:18,lb:3,lg:3,ln:4,lo:0,lt:10,lv:6,mas:3,mg:4,mk:16,ml:3,mn:3,mo:9,mr:3,ms:0,mt:15,my:0,nah:3,naq:7,nb:3,nd:3,ne:3,nl:3,nn:3,no:3,nr:3,nso:4,ny:3,nyn:3,om:3,or:3,pa:3,pap:3,pl:13,ps:3,pt:3,rm:3,ro:9,rof:3,ru:11,rwk:3,sah:0,saq:3,se:7,seh:3,ses:0,sg:0,sh:11,shi:19,sk:12,sl:14,sma:7,smi:7,smj:7,smn:7,sms:7,sn:3,so:3,sq:3,sr:11,ss:3,ssy:3,st:3,sv:3,sw:3,syr:3,ta:3,te:3,teo:3,th:0,ti:4,tig:3,tk:3,tl:4,tn:3,to:0,tr:0,ts:3,tzm:22,uk:11,ur:3,ve:3,vi:0,vun:3,wa:4,wae:3,wo:0,xh:3,xog:3,yo:0,zh:0,zu:3}[e.replace(/-.*$/,"")];return s in n?n[s]:(console.warn("plural form unknown for ["+e+"]"),function(){return"other"})}(r));var h="["+a._pluralRules(l)+"]";return 0===l&&n+"[zero]"in i?e=i[n+"[zero]"][o]:1==l&&n+"[one]"in i?e=i[n+"[one]"][o]:2==l&&n+"[two]"in i?e=i[n+"[two]"][o]:n+h in i?e=i[n+h][o]:n+"[other]"in i&&(e=i[n+"[other]"][o]),e},{get:function(e,t,i){var n,r=e.lastIndexOf("."),a=s;r>0&&(a=e.substring(r+1),e=e.substring(0,r)),i&&((n={})[a]=i);var o=u(e,t,n);return o&&a in o?o[a]:"{{"+e+"}}"},getData:function(){return i},getText:function(){return n},getLanguage:function(){return r},setLanguage:function(e,t){d(e,(function(){t&&t()}))},getDirection:function(){var e=r.split("-",1)[0];return["ar","he","fa","ps","ur"].indexOf(e)>=0?"rtl":"ltr"},translate:function(e){for(var i=function(e){return e?e.querySelectorAll("*[data-l10n-id]"):[]}(e=e||t.documentElement),n=i.length,s=0;s<n;s++)f(i[s]);f(e)},getReadyState:function(){return o},ready:function(i){i&&("complete"==o||"interactive"==o?e.setTimeout((function(){i()})):t.addEventListener&&t.addEventListener("localized",(function e(){t.removeEventListener("localized",e),i()})))}}}(window,document)},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFHistory=void 0,t.isDestArraysEqual=o,t.isDestHashesEqual=a;var n=i(2),s=i(9);function r(){return document.location.hash}function a(e,t){return"string"==typeof e&&"string"==typeof t&&(e===t||(0,n.parseQueryString)(e).get("nameddest")===t)}function o(e,t){function i(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 n in e)if(!i(e[n],t[n]))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 n=0,s=e.length;n<s;n++)if(!i(e[n],t[n]))return!1;return!0}t.PDFHistory=class{constructor({linkService:e,eventBus:t}){this.linkService=e,this.eventBus=t,this._initialized=!1,this._fingerprint="",this.reset(),this._boundEvents=null,this.eventBus._on("pagesinit",(()=>{this._isPagesLoaded=!1,this.eventBus._on("pagesloaded",(e=>{this._isPagesLoaded=!!e.pagesCount}),{once:!0})}))}initialize({fingerprint:e,resetHistory:t=!1,updateUrl:i=!1}){if(!e||"string"!=typeof e)return void console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');this._initialized&&this.reset();const n=""!==this._fingerprint&&this._fingerprint!==e;this._fingerprint=e,this._updateUrl=!0===i,this._initialized=!0,this._bindEvents();const s=window.history.state;if(this._popStateInProgress=!1,this._blockHashChange=0,this._currentHash=r(),this._numPositionUpdates=0,this._uid=this._maxUid=0,this._destination=null,this._position=null,!this._isValidState(s,!0)||t){const{hash:e,page:i,rotation:s}=this._parseCurrentHash(!0);return!e||n||t?void this._pushOrReplaceState(null,!0):void this._pushOrReplaceState({hash:e,page:i,rotation:s},!0)}const a=s.destination;this._updateInternalState(a,s.uid,!0),void 0!==a.rotation&&(this._initialRotation=a.rotation),a.dest?(this._initialBookmark=JSON.stringify(a.dest),this._destination.page=null):a.hash?this._initialBookmark=a.hash:a.page&&(this._initialBookmark=`page=${a.page}`)}reset(){this._initialized&&(this._pageHide(),this._initialized=!1,this._unbindEvents()),this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._initialBookmark=null,this._initialRotation=null}push({namedDest:e=null,explicitDest:t,pageNumber:i}){if(!this._initialized)return;if(e&&"string"!=typeof e)return void console.error(`PDFHistory.push: "${e}" is not a valid namedDest parameter.`);if(!Array.isArray(t))return void console.error(`PDFHistory.push: "${t}" is not a valid explicitDest parameter.`);if(!this._isValidPage(i)&&(null!==i||this._destination))return void console.error(`PDFHistory.push: "${i}" is not a valid pageNumber parameter.`);const n=e||JSON.stringify(t);if(!n)return;let s=!1;if(this._destination&&(a(this._destination.hash,n)||o(this._destination.dest,t))){if(this._destination.page)return;s=!0}this._popStateInProgress&&!s||(this._pushOrReplaceState({dest:t,hash:n,page:i,rotation:this.linkService.rotation},s),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then((()=>{this._popStateInProgress=!1}))))}pushPage(e){this._initialized&&(this._isValidPage(e)?this._destination?.page!==e&&(this._popStateInProgress||(this._pushOrReplaceState({dest:null,hash:`page=${e}`,page:e,rotation:this.linkService.rotation}),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then((()=>{this._popStateInProgress=!1}))))):console.error(`PDFHistory.pushPage: "${e}" is not a valid page number.`))}pushCurrentPosition(){this._initialized&&!this._popStateInProgress&&this._tryPushCurrentPosition()}back(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;this._isValidState(e)&&e.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;this._isValidState(e)&&e.uid<this._maxUid&&window.history.forward()}get popStateInProgress(){return this._initialized&&(this._popStateInProgress||this._blockHashChange>0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}_pushOrReplaceState(e,t=!1){const i=t||!this._destination,n={fingerprint:this._fingerprint,uid:i?this._uid:this._uid+1,destination:e};let s;if(this._updateInternalState(e,n.uid),this._updateUrl&&e?.hash){const t=document.location.href.split("#")[0];t.startsWith("file://")||(s=`${t}#${e.hash}`)}i?window.history.replaceState(n,"",s):window.history.pushState(n,"",s)}_tryPushCurrentPosition(e=!1){if(!this._position)return;let t=this._position;if(e&&(t=Object.assign(Object.create(null),this._position),t.temporary=!0),!this._destination)return void this._pushOrReplaceState(t);if(this._destination.temporary)return void this._pushOrReplaceState(t,!0);if(this._destination.hash===t.hash)return;if(!this._destination.page&&this._numPositionUpdates<=50)return;let i=!1;if(this._destination.page>=t.first&&this._destination.page<=t.page){if(void 0!==this._destination.dest||!this._destination.first)return;i=!0}this._pushOrReplaceState(t,i)}_isValidPage(e){return Number.isInteger(e)&&e>0&&e<=this.linkService.pagesCount}_isValidState(e,t=!1){if(!e)return!1;if(e.fingerprint!==this._fingerprint){if(!t)return!1;{if("string"!=typeof e.fingerprint||e.fingerprint.length!==this._fingerprint.length)return!1;const[t]=performance.getEntriesByType("navigation");if("reload"!==t?.type)return!1}}return!(!Number.isInteger(e.uid)||e.uid<0)&&null!==e.destination&&"object"==typeof e.destination}_updateInternalState(e,t,i=!1){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),i&&e?.temporary&&delete e.temporary,this._destination=e,this._uid=t,this._maxUid=Math.max(this._maxUid,t),this._numPositionUpdates=0}_parseCurrentHash(e=!1){const t=unescape(r()).substring(1),i=(0,n.parseQueryString)(t),s=i.get("nameddest")||"";let a=0|i.get("page");return(!this._isValidPage(a)||e&&s.length>0)&&(a=null),{hash:t,page:a,rotation:this.linkService.rotation}}_updateViewarea({location:e}){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._position={hash:e.pdfOpenParams.substring(1),page:this.linkService.page,first:e.pageNumber,rotation:e.rotation},this._popStateInProgress||(this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++,this._updateViewareaTimeout=setTimeout((()=>{this._popStateInProgress||this._tryPushCurrentPosition(!0),this._updateViewareaTimeout=null}),1e3))}_popState({state:e}){const t=r(),i=this._currentHash!==t;if(this._currentHash=t,!e){this._uid++;const{hash:e,page:t,rotation:i}=this._parseCurrentHash();return void this._pushOrReplaceState({hash:e,page:t,rotation:i},!0)}if(!this._isValidState(e))return;this._popStateInProgress=!0,i&&(this._blockHashChange++,(0,s.waitOnEventOrTimeout)({target:window,name:"hashchange",delay:1e3}).then((()=>{this._blockHashChange--})));const a=e.destination;this._updateInternalState(a,e.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(){this._boundEvents||(this._boundEvents={updateViewarea:this._updateViewarea.bind(this),popState:this._popState.bind(this),pageHide:this._pageHide.bind(this)},this.eventBus._on("updateviewarea",this._boundEvents.updateViewarea),window.addEventListener("popstate",this._boundEvents.popState),window.addEventListener("pagehide",this._boundEvents.pageHide))}_unbindEvents(){this._boundEvents&&(this.eventBus._off("updateviewarea",this._boundEvents.updateViewarea),window.removeEventListener("popstate",this._boundEvents.popState),window.removeEventListener("pagehide",this._boundEvents.pageHide),this._boundEvents=null)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFPageView=void 0;var n=i(4),s=i(2),r=i(14),a=i(6),o=i(15),l=i(7),h=i(5),c=i(16),d=i(17),u=i(18),p=i(19),g=i(20);const f=o.compatibilityParams.maxCanvasPixels||16777216,m=()=>({annotationEditorUIManager:null,annotationStorage:null,downloadManager:null,enableScripting:!1,fieldObjectsPromise:null,findController:null,hasJSActionsPromise:null,get linkService(){return new h.SimpleLinkService}});t.PDFPageView=class{#cs=n.AnnotationMode.ENABLE_FORMS;#ds=!1;#us=null;#ps=null;#gs=null;#fs=null;#ms=s.RenderingStates.INITIAL;#_s=s.TextLayerMode.ENABLE;#vs={directDrawing:!0,initialOptionalContent:!0,regularAnnotations:!0};#bs=new WeakMap;constructor(e){const t=e.container,i=e.defaultViewport;this.id=e.id,this.renderingId="page"+this.id,this.#us=e.layerProperties||m,this.pdfPage=null,this.pageLabel=null,this.rotation=0,this.scale=e.scale||s.DEFAULT_SCALE,this.viewport=i,this.pdfPageRotate=i.rotation,this._optionalContentConfigPromise=e.optionalContentConfigPromise||null,this.#_s=e.textLayerMode??s.TextLayerMode.ENABLE,this.#cs=e.annotationMode??n.AnnotationMode.ENABLE_FORMS,this.imageResourcesPath=e.imageResourcesPath||"",this.isOffscreenCanvasSupported=e.isOffscreenCanvasSupported??!0,this.maxCanvasPixels=e.maxCanvasPixels??f,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=!this.renderingQueue?.hasViewer(),this._container=t,e.useOnlyCssZoom&&(console.error("useOnlyCssZoom was removed, please use `maxCanvasPixels = 0` instead."),this.maxCanvasPixels=0),this._annotationCanvasMap=null,this.annotationLayer=null,this.annotationEditorLayer=null,this.textLayer=null,this.zoomLayer=null,this.xfaLayer=null,this.structTreeLayer=null;const r=document.createElement("div");if(r.className="page",r.setAttribute("data-page-number",this.id),r.setAttribute("role","region"),this.l10n.get("page_landmark",{page:this.id}).then((e=>{r.setAttribute("aria-label",e)})),this.div=r,this.#Tn(),t?.append(r),this._isStandalone){t?.style.setProperty("--scale-factor",this.scale*n.PixelsPerInch.PDF_TO_CSS_UNITS);const{optionalContentConfigPromise:i}=e;i&&i.then((e=>{i===this._optionalContentConfigPromise&&(this.#vs.initialOptionalContent=e.hasInitialVisibility)}))}}get renderingState(){return this.#ms}set renderingState(e){if(e!==this.#ms)switch(this.#ms=e,this.#ps&&(clearTimeout(this.#ps),this.#ps=null),e){case s.RenderingStates.PAUSED:this.div.classList.remove("loading");break;case s.RenderingStates.RUNNING:this.div.classList.add("loadingIcon"),this.#ps=setTimeout((()=>{this.div.classList.add("loading"),this.#ps=null}),0);break;case s.RenderingStates.INITIAL:case s.RenderingStates.FINISHED:this.div.classList.remove("loadingIcon","loading")}}#Tn(){const{viewport:e}=this;if(this.pdfPage){if(this.#gs===e.rotation)return;this.#gs=e.rotation}(0,n.setLayerDimensions)(this.div,e,!0,!1)}setPdfPage(e){!this._isStandalone||"CanvasText"!==this.pageColors?.foreground&&"Canvas"!==this.pageColors?.background||this._container?.style.setProperty("--hcm-highligh-filter",e.filterFactory.addHighlightHCMFilter("CanvasText","Canvas","HighlightText","Highlight")),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.#Tn(),this.reset()}destroy(){this.reset(),this.pdfPage?.cleanup()}get _textHighlighter(){return(0,n.shadow)(this,"_textHighlighter",new u.TextHighlighter({pageIndex:this.id-1,eventBus:this.eventBus,findController:this.#us().findController}))}async#ys(){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#Ss(){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#Ps(){let e=null;try{const e=await this.xfaLayer.render(this.viewport,"display");e?.textDivs&&this._textHighlighter&&this.#As(e.textDivs)}catch(t){console.error(`#renderXfaLayer: "${t}".`),e=t}finally{this.eventBus.dispatch("xfalayerrendered",{source:this,pageNumber:this.id,error:e})}}async#ws(){const{pdfPage:e,textLayer:t,viewport:i}=this;if(!t)return;let s=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}".`),s=e}this.eventBus.dispatch("textlayerrendered",{source:this,pageNumber:this.id,numTextDivs:t.numTextDivs,error:s}),this.#Es()}async#Es(){if(!this.textLayer)return;this.structTreeLayer||=new c.StructTreeLayerBuilder;const e=await(this.structTreeLayer.renderingDone?null:this.pdfPage.getStructTree()),t=this.structTreeLayer?.render(e);t&&this.canvas?.append(t),this.structTreeLayer?.show()}async#As(e){const t=await this.pdfPage.getTextContent(),i=[];for(const e of t.items)i.push(e.str);this._textHighlighter.setTextMapping(e,i),this._textHighlighter.enable()}_resetZoomLayer(e=!1){if(!this.zoomLayer)return;const t=this.zoomLayer.firstChild;this.#bs.delete(t),t.width=0,t.height=0,e&&this.zoomLayer.remove(),this.zoomLayer=null}reset({keepZoomLayer:e=!1,keepAnnotationLayer:t=!1,keepAnnotationEditorLayer:i=!1,keepXfaLayer:n=!1,keepTextLayer:r=!1}={}){this.cancelRendering({keepAnnotationLayer:t,keepAnnotationEditorLayer:i,keepXfaLayer:n,keepTextLayer:r}),this.renderingState=s.RenderingStates.INITIAL;const a=this.div,o=a.childNodes,l=e&&this.zoomLayer||null,h=t&&this.annotationLayer?.div||null,c=i&&this.annotationEditorLayer?.div||null,d=n&&this.xfaLayer?.div||null,u=r&&this.textLayer?.div||null;for(let e=o.length-1;e>=0;e--){const t=o[e];switch(t){case l:case h:case c:case d:case u:continue}t.remove()}a.removeAttribute("data-loaded"),h&&this.annotationLayer.hide(),c&&this.annotationEditorLayer.hide(),d&&this.xfaLayer.hide(),u&&this.textLayer.hide(),this.structTreeLayer?.hide(),l||(this.canvas&&(this.#bs.delete(this.canvas),this.canvas.width=0,this.canvas.height=0,delete this.canvas),this._resetZoomLayer())}update({scale:e=0,rotation:t=null,optionalContentConfigPromise:i=null,drawingDelay:r=-1}){this.scale=e||this.scale,"number"==typeof t&&(this.rotation=t),i instanceof Promise&&(this._optionalContentConfigPromise=i,i.then((e=>{i===this._optionalContentConfigPromise&&(this.#vs.initialOptionalContent=e.hasInitialVisibility)}))),this.#vs.directDrawing=!0;const a=(this.rotation+this.pdfPageRotate)%360;if(this.viewport=this.viewport.clone({scale:this.scale*n.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:a}),this.#Tn(),this._isStandalone&&this._container?.style.setProperty("--scale-factor",this.viewport.scale),this.canvas){let e=!1;if(this.#ds)if(0===this.maxCanvasPixels)e=!0;else if(this.maxCanvasPixels>0){const{width:t,height:i}=this.viewport,{sx:n,sy:s}=this.outputScale;e=(Math.floor(t)*n|0)*(Math.floor(i)*s|0)>this.maxCanvasPixels}const t=!e&&r>=0&&r<1e3;if(t||e){if(t&&this.renderingState!==s.RenderingStates.FINISHED&&(this.cancelRendering({keepZoomLayer:!0,keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,cancelExtraDelay:r}),this.renderingState=s.RenderingStates.FINISHED,this.#vs.directDrawing=!1),this.cssTransform({target:this.canvas,redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!t,hideTextLayer:t}),t)return;return void this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this.#fs})}this.zoomLayer||this.canvas.hidden||(this.zoomLayer=this.canvas.parentNode,this.zoomLayer.style.position="absolute")}this.zoomLayer&&this.cssTransform({target:this.zoomLayer.firstChild}),this.reset({keepZoomLayer:!0,keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0})}cancelRendering({keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:i=!1,keepTextLayer:n=!1,cancelExtraDelay:s=0}={}){this.renderTask&&(this.renderTask.cancel(s),this.renderTask=null),this.resume=null,!this.textLayer||n&&this.textLayer.div||(this.textLayer.cancel(),this.textLayer=null),this.structTreeLayer&&!this.textLayer&&(this.structTreeLayer=null),!this.annotationLayer||e&&this.annotationLayer.div||(this.annotationLayer.cancel(),this.annotationLayer=null,this._annotationCanvasMap=null),!this.annotationEditorLayer||t&&this.annotationEditorLayer.div||(this.annotationEditorLayer.cancel(),this.annotationEditorLayer=null),!this.xfaLayer||i&&this.xfaLayer.div||(this.xfaLayer.cancel(),this.xfaLayer=null,this._textHighlighter?.disable())}cssTransform({target:e,redrawAnnotationLayer:t=!1,redrawAnnotationEditorLayer:i=!1,redrawXfaLayer:n=!1,redrawTextLayer:s=!1,hideTextLayer:r=!1}){if(!e.hasAttribute("zooming")){e.setAttribute("zooming",!0);const{style:t}=e;t.width=t.height=""}const a=this.#bs.get(e);if(this.viewport!==a){const t=this.viewport.rotation-a.rotation,i=Math.abs(t);let n=1,s=1;if(90===i||270===i){const{width:e,height:t}=this.viewport;n=t/e,s=e/t}e.style.transform=`rotate(${t}deg) scale(${n}, ${s})`}t&&this.annotationLayer&&this.#ys(),i&&this.annotationEditorLayer&&this.#Ss(),n&&this.xfaLayer&&this.#Ps(),this.textLayer&&(r?(this.textLayer.hide(),this.structTreeLayer?.hide()):s&&this.#ws())}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(e,t){return this.viewport.convertToPdfPoint(e,t)}async#xs(e,t=null){if(e===this.renderTask&&(this.renderTask=null),t instanceof n.RenderingCancelledException)this.#fs=null;else if(this.#fs=t,this.renderingState=s.RenderingStates.FINISHED,this._resetZoomLayer(!0),this.#vs.regularAnnotations=!e.separateAnnots,this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!1,timestamp:performance.now(),error:this.#fs}),t)throw t}async draw(){this.renderingState!==s.RenderingStates.INITIAL&&(console.error("Must be in new state before drawing"),this.reset());const{div:e,l10n:t,pageColors:i,pdfPage:o,viewport:l}=this;if(!o)throw this.renderingState=s.RenderingStates.FINISHED,new Error("pdfPage is not loaded");this.renderingState=s.RenderingStates.RUNNING;const h=document.createElement("div");if(h.classList.add("canvasWrapper"),e.append(h),this.textLayer||this.#_s===s.TextLayerMode.DISABLE||o.isPureXfa||(this._accessibilityManager||=new d.TextAccessibilityManager,this.textLayer=new p.TextLayerBuilder({highlighter:this._textHighlighter,accessibilityManager:this._accessibilityManager,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported,enablePermissions:this.#_s===s.TextLayerMode.ENABLE_PERMISSIONS}),e.append(this.textLayer.div)),!this.annotationLayer&&this.#cs!==n.AnnotationMode.DISABLE){const{annotationStorage:i,downloadManager:s,enableScripting:r,fieldObjectsPromise:l,hasJSActionsPromise:h,linkService:c}=this.#us();this._annotationCanvasMap||=new Map,this.annotationLayer=new a.AnnotationLayerBuilder({pageDiv:e,pdfPage:o,annotationStorage:i,imageResourcesPath:this.imageResourcesPath,renderForms:this.#cs===n.AnnotationMode.ENABLE_FORMS,linkService:c,downloadManager:s,l10n:t,enableScripting:r,hasJSActionsPromise:h,fieldObjectsPromise:l,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager})}const{width:c,height:u}=l,f=document.createElement("canvas");f.setAttribute("role","presentation"),f.hidden=!0;const m=!(!i?.background||!i?.foreground);let _=e=>{m&&!e||(f.hidden=!1,_=null)};h.append(f),this.canvas=f;const v=f.getContext("2d",{alpha:!1}),b=this.outputScale=new s.OutputScale;if(0===this.maxCanvasPixels){const e=1/this.scale;b.sx*=e,b.sy*=e,this.#ds=!0}else if(this.maxCanvasPixels>0){const e=c*u,t=Math.sqrt(this.maxCanvasPixels/e);b.sx>t||b.sy>t?(b.sx=t,b.sy=t,this.#ds=!0):this.#ds=!1}const y=(0,s.approximateFraction)(b.sx),S=(0,s.approximateFraction)(b.sy);f.width=(0,s.roundToDivide)(c*b.sx,y[0]),f.height=(0,s.roundToDivide)(u*b.sy,S[0]);const{style:P}=f;P.width=(0,s.roundToDivide)(c,y[1])+"px",P.height=(0,s.roundToDivide)(u,S[1])+"px",this.#bs.set(f,l);const A={canvasContext:v,transform:b.scaled?[b.sx,0,0,b.sy,0,0]:null,viewport:l,annotationMode:this.#cs,optionalContentConfigPromise:this._optionalContentConfigPromise,annotationCanvasMap:this._annotationCanvasMap,pageColors:i},w=this.renderTask=this.pdfPage.render(A);w.onContinue=e=>{if(_?.(!1),this.renderingQueue&&!this.renderingQueue.isHighestPriority(this))return this.renderingState=s.RenderingStates.PAUSED,void(this.resume=()=>{this.renderingState=s.RenderingStates.RUNNING,e()});e()};const E=w.promise.then((async()=>{if(_?.(!0),await this.#xs(w),this.#ws(),this.annotationLayer&&await this.#ys(),!this.annotationEditorLayer){const{annotationEditorUIManager:i}=this.#us();if(!i)return;this.annotationEditorLayer=new r.AnnotationEditorLayerBuilder({uiManager:i,pageDiv:e,pdfPage:o,l10n:t,accessibilityManager:this._accessibilityManager,annotationLayer:this.annotationLayer?.annotationLayer})}this.#Ss()}),(e=>(e instanceof n.RenderingCancelledException||_?.(!0),this.#xs(w,e))));if(o.isPureXfa){if(this.xfaLayer)this.xfaLayer.div&&e.append(this.xfaLayer.div);else{const{annotationStorage:t,linkService:i}=this.#us();this.xfaLayer=new g.XfaLayerBuilder({pageDiv:e,pdfPage:o,annotationStorage:t,linkService:i})}this.#Ps()}return e.setAttribute("data-loaded",!0),this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id}),E}setPageLabel(e){this.pageLabel="string"==typeof e?e:null,null!==this.pageLabel?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}get thumbnailCanvas(){const{directDrawing:e,initialOptionalContent:t,regularAnnotations:i}=this.#vs;return e&&t&&i?this.canvas:null}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationEditorLayerBuilder=void 0;var n=i(4),s=i(7);t.AnnotationEditorLayerBuilder=class{#wt=null;#Ft;constructor(e){this.pageDiv=e.pageDiv,this.pdfPage=e.pdfPage,this.accessibilityManager=e.accessibilityManager,this.l10n=e.l10n||s.NullL10n,this.annotationEditorLayer=null,this.div=null,this._cancelled=!1,this.#Ft=e.uiManager,this.#wt=e.annotationLayer||null}async render(e,t="display"){if("display"!==t)return;if(this._cancelled)return;const i=e.clone({dontFlip:!0});if(this.div)return this.annotationEditorLayer.update({viewport:i}),void this.show();const s=this.div=document.createElement("div");s.className="annotationEditorLayer",s.tabIndex=0,s.hidden=!0,s.dir=this.#Ft.direction,this.pageDiv.append(s),this.annotationEditorLayer=new n.AnnotationEditorLayer({uiManager:this.#Ft,div:s,accessibilityManager:this.accessibilityManager,pageIndex:this.pdfPage.pageNumber-1,l10n:this.l10n,viewport:i,annotationLayer:this.#wt});const r={viewport:i,div:s,annotations:null,intent:t};this.annotationEditorLayer.render(r),this.show()}cancel(){this._cancelled=!0,this.div&&(this.pageDiv=null,this.annotationEditorLayer.destroy(),this.div.remove())}hide(){this.div&&(this.div.hidden=!0)}show(){this.div&&!this.annotationEditorLayer.isEmpty&&(this.div.hidden=!1)}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.compatibilityParams=t.OptionKind=t.AppOptions=void 0;const i=Object.create(null);t.compatibilityParams=i;{const e=navigator.userAgent||"",t=navigator.platform||"",n=navigator.maxTouchPoints||1,s=/Android/.test(e);(/\b(iPad|iPhone|iPod)(?=;)/.test(e)||"MacIntel"===t&&n>1||s)&&(i.maxCanvasPixels=5242880)}const n={VIEWER:2,API:4,WORKER:8,PREFERENCE:128};t.OptionKind=n;const s={annotationEditorMode:{value:0,kind:n.VIEWER+n.PREFERENCE},annotationMode:{value:2,kind:n.VIEWER+n.PREFERENCE},cursorToolOnLoad:{value:0,kind:n.VIEWER+n.PREFERENCE},defaultZoomDelay:{value:400,kind:n.VIEWER+n.PREFERENCE},defaultZoomValue:{value:"",kind:n.VIEWER+n.PREFERENCE},disableHistory:{value:!1,kind:n.VIEWER},disablePageLabels:{value:!1,kind:n.VIEWER+n.PREFERENCE},enablePermissions:{value:!1,kind:n.VIEWER+n.PREFERENCE},enablePrintAutoRotate:{value:!0,kind:n.VIEWER+n.PREFERENCE},enableScripting:{value:!0,kind:n.VIEWER+n.PREFERENCE},enableStampEditor:{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},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},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:"../build/pdf.worker.js",kind:n.WORKER}};s.defaultUrl={value:"compressed.tracemonkey-pldi-09.pdf",kind:n.VIEWER},s.disablePreferences={value:!1,kind:n.VIEWER},s.locale={value:navigator.language||"en-US",kind:n.VIEWER},s.sandboxBundleSrc={value:"../build/pdf.sandbox.js",kind:n.VIEWER};const r=Object.create(null);class a{constructor(){throw new Error("Cannot initialize AppOptions.")}static get(e){const t=r[e];if(void 0!==t)return t;const n=s[e];return void 0!==n?i[e]??n.value:void 0}static getAll(e=null){const t=Object.create(null);for(const a in s){const o=s[a];if(e){if(0==(e&o.kind))continue;if(e===n.PREFERENCE){const e=o.value,i=typeof e;if("boolean"===i||"string"===i||"number"===i&&Number.isInteger(e)){t[a]=e;continue}throw new Error(`Invalid type for preference: ${a}`)}}const l=r[a];t[a]=void 0!==l?l:i[a]??o.value}return t}static set(e,t){r[e]=t}static setAll(e){for(const t in e)r[t]=e[t]}static remove(e){delete r[e]}}t.AppOptions=a,a._hasUserOptions=function(){return Object.keys(r).length>0}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StructTreeLayerBuilder=void 0;var n=i(2);const s={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},r=/^H(\d+)$/;t.StructTreeLayerBuilder=class{#Cs=void 0;get renderingDone(){return void 0!==this.#Cs}render(e){if(void 0!==this.#Cs)return this.#Cs;const t=this.#Ms(e);return t?.classList.add("structTree"),this.#Cs=t}hide(){this.#Cs&&!this.#Cs.hidden&&(this.#Cs.hidden=!0)}show(){this.#Cs?.hidden&&(this.#Cs.hidden=!1)}#Ts(e,t){const{alt:i,id:s,lang:r}=e;void 0!==i&&t.setAttribute("aria-label",(0,n.removeNullCharacters)(i)),void 0!==s&&t.setAttribute("aria-owns",s),void 0!==r&&t.setAttribute("lang",(0,n.removeNullCharacters)(r,!0))}#Ms(e){if(!e)return null;const t=document.createElement("span");if("role"in e){const{role:i}=e,n=i.match(r);n?(t.setAttribute("role","heading"),t.setAttribute("aria-level",n[1])):s[i]&&t.setAttribute("role",s[i])}if(this.#Ts(e,t),e.children)if(1===e.children.length&&"id"in e.children[0])this.#Ts(e.children[0],t);else for(const i of e.children)t.append(this.#Ms(i));return t}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextAccessibilityManager=void 0;var n=i(2);class s{#Ds=!1;#Fs=null;#Ls=new Map;#ks=new Map;setTextMapping(e){this.#Fs=e}static#Rs(e,t){const i=e.getBoundingClientRect(),n=t.getBoundingClientRect();if(0===i.width&&0===i.height)return 1;if(0===n.width&&0===n.height)return-1;const s=i.y,r=i.y+i.height,a=i.y+i.height/2,o=n.y,l=n.y+n.height,h=n.y+n.height/2;return a<=o&&h>=r?-1:h<=s&&a>=l?1:i.x+i.width/2-(n.x+n.width/2)}enable(){if(this.#Ds)throw new Error("TextAccessibilityManager is already enabled.");if(!this.#Fs)throw new Error("Text divs and strings have not been set.");if(this.#Ds=!0,this.#Fs=this.#Fs.slice(),this.#Fs.sort(s.#Rs),this.#Ls.size>0){const e=this.#Fs;for(const[t,i]of this.#Ls)document.getElementById(t)?this.#Is(t,e[i]):this.#Ls.delete(t)}for(const[e,t]of this.#ks)this.addPointerInTextLayer(e,t);this.#ks.clear()}disable(){this.#Ds&&(this.#ks.clear(),this.#Fs=null,this.#Ds=!1)}removePointerInTextLayer(e){if(!this.#Ds)return void this.#ks.delete(e);const t=this.#Fs;if(!t||0===t.length)return;const{id:i}=e,n=this.#Ls.get(i);if(void 0===n)return;const s=t[n];this.#Ls.delete(i);let r=s.getAttribute("aria-owns");r?.includes(i)&&(r=r.split(" ").filter((e=>e!==i)).join(" "),r?s.setAttribute("aria-owns",r):(s.removeAttribute("aria-owns"),s.setAttribute("role","presentation")))}#Is(e,t){const i=t.getAttribute("aria-owns");i?.includes(e)||t.setAttribute("aria-owns",i?`${i} ${e}`:e),t.removeAttribute("role")}addPointerInTextLayer(e,t){const{id:i}=e;if(!i)return null;if(!this.#Ds)return this.#ks.set(e,t),null;t&&this.removePointerInTextLayer(e);const r=this.#Fs;if(!r||0===r.length)return null;const a=(0,n.binarySearchFirstItem)(r,(t=>s.#Rs(e,t)<0)),o=Math.max(0,a-1),l=r[o];this.#Is(i,l),this.#Ls.set(i,o);const h=l.parentNode;return h?.classList.contains("markedContent")?h.id:null}moveElementInDOM(e,t,i,r){const a=this.addPointerInTextLayer(i,r);if(!e.hasChildNodes())return e.append(t),a;const o=Array.from(e.childNodes).filter((e=>e!==t));if(0===o.length)return a;const l=i||t,h=(0,n.binarySearchFirstItem)(o,(e=>s.#Rs(l,e)<0));return 0===h?o[0].before(t):o[h-1].after(t),a}}t.TextAccessibilityManager=s},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextHighlighter=void 0,t.TextHighlighter=class{constructor({findController:e,eventBus:t,pageIndex:i}){this.findController=e,this.matches=[],this.eventBus=t,this.pageIdx=i,this._onUpdateTextLayerMatches=null,this.textDivs=null,this.textContentItemsStr=null,this.enabled=!1}setTextMapping(e,t){this.textDivs=e,this.textContentItemsStr=t}enable(){if(!this.textDivs||!this.textContentItemsStr)throw new Error("Text divs and strings have not been set.");if(this.enabled)throw new Error("TextHighlighter is already enabled.");this.enabled=!0,this._onUpdateTextLayerMatches||(this._onUpdateTextLayerMatches=e=>{e.pageIndex!==this.pageIdx&&-1!==e.pageIndex||this._updateMatches()},this.eventBus._on("updatetextlayermatches",this._onUpdateTextLayerMatches)),this._updateMatches()}disable(){this.enabled&&(this.enabled=!1,this._onUpdateTextLayerMatches&&(this.eventBus._off("updatetextlayermatches",this._onUpdateTextLayerMatches),this._onUpdateTextLayerMatches=null),this._updateMatches(!0))}_convertMatches(e,t){if(!e)return[];const{textContentItemsStr:i}=this;let n=0,s=0;const r=i.length-1,a=[];for(let o=0,l=e.length;o<l;o++){let l=e[o];for(;n!==r&&l>=s+i[n].length;)s+=i[n].length,n++;n===i.length&&console.error("Could not find a matching mapping");const h={begin:{divIdx:n,offset:l-s}};for(l+=t[o];n!==r&&l>s+i[n].length;)s+=i[n].length,n++;h.end={divIdx:n,offset:l-s},a.push(h)}return a}_renderMatches(e){if(0===e.length)return;const{findController:t,pageIdx:i}=this,{textContentItemsStr:n,textDivs:s}=this,r=i===t.selected.pageIdx,a=t.selected.matchIdx;let o=null;const l={divIdx:-1,offset:void 0};function h(e,t){const i=e.divIdx;return s[i].textContent="",c(i,0,e.offset,t)}function c(e,t,i,r){let a=s[e];if(a.nodeType===Node.TEXT_NODE){const t=document.createElement("span");a.before(t),t.append(a),s[e]=t,a=t}const o=n[e].substring(t,i),l=document.createTextNode(o);if(r){const e=document.createElement("span");return e.className=`${r} appended`,e.append(l),a.append(e),r.includes("selected")?e.offsetLeft:0}return a.append(l),0}let d=a,u=d+1;if(t.state.highlightAll)d=0,u=e.length;else if(!r)return;let p=-1,g=-1;for(let n=d;n<u;n++){const d=e[n],u=d.begin;if(u.divIdx===p&&u.offset===g)continue;p=u.divIdx,g=u.offset;const f=d.end,m=r&&n===a,_=m?" selected":"";let v=0;if(o&&u.divIdx===o.divIdx?c(o.divIdx,o.offset,u.offset):(null!==o&&c(o.divIdx,o.offset,l.offset),h(u)),u.divIdx===f.divIdx)v=c(u.divIdx,u.offset,f.offset,"highlight"+_);else{v=c(u.divIdx,u.offset,l.offset,"highlight begin"+_);for(let e=u.divIdx+1,t=f.divIdx;e<t;e++)s[e].className="highlight middle"+_;h(f,"highlight end"+_)}o=f,m&&t.scrollMatchIntoView({element:s[u.divIdx],selectedLeft:v,pageIndex:i,matchIndex:a})}o&&c(o.divIdx,o.offset,l.offset)}_updateMatches(e=!1){if(!this.enabled&&!e)return;const{findController:t,matches:i,pageIdx:n}=this,{textContentItemsStr:s,textDivs:r}=this;let a=-1;for(const e of i){for(let t=Math.max(a,e.begin.divIdx),i=e.end.divIdx;t<=i;t++){const e=r[t];e.textContent=s[t],e.className=""}a=e.end.divIdx+1}if(!t?.highlightMatches||e)return;const o=t.pageMatches[n]||null,l=t.pageMatchesLength[n]||null;this.matches=this._convertMatches(o,l),this._renderMatches(this.matches)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextLayerBuilder=void 0;var n=i(4),s=i(2);t.TextLayerBuilder=class{#Os=!1;#Ns=0;#Bs=0;#Vs=null;constructor({highlighter:e=null,accessibilityManager:t=null,isOffscreenCanvasSupported:i=!0,enablePermissions:n=!1}){this.textContentItemsStr=[],this.renderingDone=!1,this.textDivs=[],this.textDivProperties=new WeakMap,this.textLayerRenderTask=null,this.highlighter=e,this.accessibilityManager=t,this.isOffscreenCanvasSupported=i,this.#Os=!0===n,this.div=document.createElement("div"),this.div.className="textLayer",this.hide()}#Us(){this.renderingDone=!0;const e=document.createElement("div");e.className="endOfContent",this.div.append(e),this.#js()}get numTextDivs(){return this.textDivs.length}async render(e){if(!this.#Vs)throw new Error('No "textContentSource" parameter specified.');const t=e.scale*(globalThis.devicePixelRatio||1),{rotation:i}=e;if(this.renderingDone){const s=i!==this.#Ns,r=t!==this.#Bs;return(s||r)&&(this.hide(),(0,n.updateTextLayer)({container:this.div,viewport:e,textDivs:this.textDivs,textDivProperties:this.textDivProperties,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported,mustRescale:r,mustRotate:s}),this.#Bs=t,this.#Ns=i),void this.show()}this.cancel(),this.highlighter?.setTextMapping(this.textDivs,this.textContentItemsStr),this.accessibilityManager?.setTextMapping(this.textDivs),this.textLayerRenderTask=(0,n.renderTextLayer)({textContentSource:this.#Vs,container:this.div,viewport:e,textDivs:this.textDivs,textDivProperties:this.textDivProperties,textContentItemsStr:this.textContentItemsStr,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported}),await this.textLayerRenderTask.promise,this.#Us(),this.#Bs=t,this.#Ns=i,this.show(),this.accessibilityManager?.enable()}hide(){this.div.hidden||(this.highlighter?.disable(),this.div.hidden=!0)}show(){this.div.hidden&&this.renderingDone&&(this.div.hidden=!1,this.highlighter?.enable())}cancel(){this.textLayerRenderTask&&(this.textLayerRenderTask.cancel(),this.textLayerRenderTask=null),this.highlighter?.disable(),this.accessibilityManager?.disable(),this.textContentItemsStr.length=0,this.textDivs.length=0,this.textDivProperties=new WeakMap}setTextContentSource(e){this.cancel(),this.#Vs=e}#js(){const{div:e}=this;e.addEventListener("mousedown",(t=>{const i=e.querySelector(".endOfContent");if(!i)return;let n=t.target!==e;if(n&&="none"!==getComputedStyle(i).getPropertyValue("-moz-user-select"),n){const n=e.getBoundingClientRect(),s=Math.max(0,(t.pageY-n.top)/n.height);i.style.top=(100*s).toFixed(2)+"%"}i.classList.add("active")})),e.addEventListener("mouseup",(()=>{const t=e.querySelector(".endOfContent");t&&(t.style.top="",t.classList.remove("active"))})),e.addEventListener("copy",(e=>{if(!this.#Os){const t=document.getSelection();e.clipboardData.setData("text/plain",(0,s.removeNullCharacters)((0,n.normalizeUnicode)(t.toString())))}e.preventDefault(),e.stopPropagation()}))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.XfaLayerBuilder=void 0;var n=i(4);t.XfaLayerBuilder=class{constructor({pageDiv:e,pdfPage:t,annotationStorage:i=null,linkService:n,xfaHtml:s=null}){this.pageDiv=e,this.pdfPage=t,this.annotationStorage=i,this.linkService=n,this.xfaHtml=s,this.div=null,this._cancelled=!1}async render(e,t="display"){if("print"===t){const i={viewport:e.clone({dontFlip:!0}),div:this.div,xfaHtml:this.xfaHtml,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t},s=document.createElement("div");return this.pageDiv.append(s),i.div=s,n.XfaLayer.render(i)}const i=await this.pdfPage.getXfa();if(this._cancelled||!i)return{textDivs:[]};const s={viewport:e.clone({dontFlip:!0}),div:this.div,xfaHtml:i,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t};return this.div?n.XfaLayer.update(s):(this.div=document.createElement("div"),this.pageDiv.append(this.div),s.div=this.div,n.XfaLayer.render(s))}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFScriptingManager=void 0;var n=i(22),s=i(23);class r extends s.PDFScriptingManager{constructor(e){e.externalServices||window.addEventListener("updatefromsandbox",(t=>{e.eventBus.dispatch("updatefromsandbox",{source:window,detail:t.detail})})),e.externalServices||={createScripting:({sandboxBundleSrc:e})=>new n.GenericScripting(e)},e.docProperties||=e=>(0,n.docProperties)(e),super(e)}}t.PDFScriptingManager=r},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GenericScripting=void 0,t.docProperties=async function(e){const t="".split("#")[0];let{info:i,metadata:s,contentDispositionFilename:r,contentLength:a}=await e.getMetadata();if(!a){const{length:t}=await e.getDownloadInfo();a=t}return{...i,baseURL:t,filesize:a,filename:r||(0,n.getPdfFilenameFromUrl)(""),metadata:s?.getRaw(),authors:s?.get("dc:creator"),numPages:e.numPages,URL:""}};var n=i(4);t.GenericScripting=class{constructor(e){this._ready=(0,n.loadScript)(e,!0).then((()=>window.pdfjsSandbox.QuickJSSandbox()))}async createSandbox(e){(await this._ready).create(e)}async dispatchEventInSandbox(e){const t=await this._ready;setTimeout((()=>t.dispatchEvent(e)),0)}async destroySandbox(){(await this._ready).nukeSandbox()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFScriptingManager=void 0;var n=i(2),s=i(4);t.PDFScriptingManager=class{#Hs=null;#Ws=null;#zs=null;#Gs=null;#$s=null;#qs=null;#Xs=null;#Ks=!1;#Ys=null;#Qs=null;#Js=null;constructor({eventBus:e,sandboxBundleSrc:t=null,externalServices:i=null,docProperties:n=null}){this.#Gs=e,this.#Ys=t,this.#$s=i,this.#zs=n}setViewer(e){this.#Xs=e}async setDocument(e){if(this.#qs&&await this.#Zs(),this.#qs=e,!e)return;const[t,i,n]=await Promise.all([e.getFieldObjects(),e.getCalculationOrderIds(),e.getJSActions()]);if(t||n){if(e===this.#qs){try{this.#Qs=this.#er()}catch(e){return console.error(`setDocument: "${e.message}".`),void await this.#Zs()}this._internalEvents.set("updatefromsandbox",(e=>{e?.source===window&&this.#tr(e.detail)})),this._internalEvents.set("dispatcheventinsandbox",(e=>{this.#Qs?.dispatchEventInSandbox(e.detail)})),this._internalEvents.set("pagechanging",(({pageNumber:e,previous:t})=>{e!==t&&(this.#ir(t),this.#nr(e))})),this._internalEvents.set("pagerendered",(({pageNumber:e})=>{this._pageOpenPending.has(e)&&e===this.#Xs.currentPageNumber&&this.#nr(e)})),this._internalEvents.set("pagesdestroy",(async()=>{await this.#ir(this.#Xs.currentPageNumber),await(this.#Qs?.dispatchEventInSandbox({id:"doc",name:"WillClose"})),this.#Hs?.resolve()}));for(const[e,t]of this._internalEvents)this.#Gs._on(e,t);try{const s=await this.#zs(e);if(e!==this.#qs)return;await this.#Qs.createSandbox({objects:t,calculationOrder:i,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...s,actions:n}}),this.#Gs.dispatch("sandboxcreated",{source:this})}catch(e){return console.error(`setDocument: "${e.message}".`),void await this.#Zs()}await(this.#Qs?.dispatchEventInSandbox({id:"doc",name:"Open"})),await this.#nr(this.#Xs.currentPageNumber,!0),Promise.resolve().then((()=>{e===this.#qs&&(this.#Ks=!0)}))}}else await this.#Zs()}async dispatchWillSave(){return this.#Qs?.dispatchEventInSandbox({id:"doc",name:"WillSave"})}async dispatchDidSave(){return this.#Qs?.dispatchEventInSandbox({id:"doc",name:"DidSave"})}async dispatchWillPrint(){if(this.#Qs){await(this.#Js?.promise),this.#Js=new s.PromiseCapability;try{await this.#Qs.dispatchEventInSandbox({id:"doc",name:"WillPrint"})}catch(e){throw this.#Js.resolve(),this.#Js=null,e}await this.#Js.promise}}async dispatchDidPrint(){return this.#Qs?.dispatchEventInSandbox({id:"doc",name:"DidPrint"})}get destroyPromise(){return this.#Ws?.promise||null}get ready(){return this.#Ks}get _internalEvents(){return(0,s.shadow)(this,"_internalEvents",new Map)}get _pageOpenPending(){return(0,s.shadow)(this,"_pageOpenPending",new Set)}get _visitedPages(){return(0,s.shadow)(this,"_visitedPages",new Map)}async#tr(e){const t=this.#Xs,i=t.isInPresentationMode||t.isChangingPresentationMode,{id:s,siblings:r,command:a,value:o}=e;if(!s){switch(a){case"clear":console.clear();break;case"error":console.error(o);break;case"layout":if(!i){const e=(0,n.apiPageLayoutToViewerModes)(o);t.spreadMode=e.spreadMode}break;case"page-num":t.currentPageNumber=o+1;break;case"print":await t.pagesPromise,this.#Gs.dispatch("print",{source:this});break;case"println":console.log(o);break;case"zoom":i||(t.currentScaleValue=o);break;case"SaveAs":this.#Gs.dispatch("download",{source:this});break;case"FirstPage":t.currentPageNumber=1;break;case"LastPage":t.currentPageNumber=t.pagesCount;break;case"NextPage":t.nextPage();break;case"PrevPage":t.previousPage();break;case"ZoomViewIn":i||t.increaseScale();break;case"ZoomViewOut":i||t.decreaseScale();break;case"WillPrintFinished":this.#Js?.resolve(),this.#Js=null}return}if(i&&e.focus)return;delete e.id,delete e.siblings;const l=r?[s,...r]:[s];for(const t of l){const i=document.querySelector(`[data-element-id="${t}"]`);i?i.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:e})):this.#qs?.annotationStorage.setValue(t,e)}}async#nr(e,t=!1){const i=this.#qs,r=this._visitedPages;if(t&&(this.#Hs=new s.PromiseCapability),!this.#Hs)return;const a=this.#Xs.getPageView(e-1);if(a?.renderingState!==n.RenderingStates.FINISHED)return void this._pageOpenPending.add(e);this._pageOpenPending.delete(e);const o=(async()=>{const t=await(r.has(e)?null:a.pdfPage?.getJSActions());i===this.#qs&&await(this.#Qs?.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:e,actions:t}))})();r.set(e,o)}async#ir(e){const t=this.#qs,i=this._visitedPages;if(!this.#Hs)return;if(this._pageOpenPending.has(e))return;const n=i.get(e);n&&(i.set(e,null),await n,t===this.#qs&&await(this.#Qs?.dispatchEventInSandbox({id:"page",name:"PageClose",pageNumber:e})))}#er(){if(this.#Ws=new s.PromiseCapability,this.#Qs)throw new Error("#initScripting: Scripting already exists.");return this.#$s.createScripting({sandboxBundleSrc:this.#Ys})}async#Zs(){if(!this.#Qs)return this.#qs=null,void this.#Ws?.resolve();this.#Hs&&(await Promise.race([this.#Hs.promise,new Promise((e=>{setTimeout(e,1e3)}))]).catch((()=>{})),this.#Hs=null),this.#qs=null;try{await this.#Qs.destroySandbox()}catch{}this.#Js?.reject(new Error("Scripting destroyed.")),this.#Js=null;for(const[e,t]of this._internalEvents)this.#Gs._off(e,t);this._internalEvents.clear(),this._pageOpenPending.clear(),this._visitedPages.clear(),this.#Qs=null,this.#Ks=!1,this.#Ws?.resolve()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFSinglePageViewer=void 0;var n=i(2),s=i(25);class r extends s.PDFViewer{_resetView(){super._resetView(),this._scrollMode=n.ScrollMode.PAGE,this._spreadMode=n.SpreadMode.NONE}set scrollMode(e){}_updateScrollMode(){}set spreadMode(e){}_updateSpreadMode(){}}t.PDFSinglePageViewer=r},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PagesCountLimit=t.PDFViewer=t.PDFPageViewBuffer=void 0;var n=i(4),s=i(2),r=i(7),a=i(13),o=i(26),l=i(5);const h={FORCE_SCROLL_MODE_PAGE:15e3,FORCE_LAZY_PAGE_INIT:7500,PAUSE_EAGER_PAGE_INIT:250};function c(e){return Object.values(n.AnnotationEditorType).includes(e)&&e!==n.AnnotationEditorType.DISABLE}t.PagesCountLimit=h;class d{#sr=new Set;#rr=0;constructor(e){this.#rr=e}push(e){const t=this.#sr;t.has(e)&&t.delete(e),t.add(e),t.size>this.#rr&&this.#ar()}resize(e,t=null){this.#rr=e;const i=this.#sr;if(t){const e=i.size;let n=1;for(const s of i)if(t.has(s.id)&&(i.delete(s),i.add(s)),++n>e)break}for(;i.size>this.#rr;)this.#ar()}has(e){return this.#sr.has(e)}[Symbol.iterator](){return this.#sr.keys()}#ar(){const e=this.#sr.keys().next().value;e?.destroy(),this.#sr.delete(e)}}t.PDFPageViewBuffer=d,t.PDFViewer=class{#or=null;#ne=null;#lr=n.AnnotationEditorType.NONE;#hr=null;#cs=n.AnnotationMode.ENABLE_FORMS;#cr=null;#dr=null;#Os=!1;#ur=!1;#pr=null;#gr=!1;#fr=0;#mr=new ResizeObserver(this.#_r.bind(this));#vr=null;#br=null;#yr=null;#_s=s.TextLayerMode.ENABLE;constructor(e){const t="3.11.174";if(n.version!==t)throw new Error(`The API version "${n.version}" does not match the Viewer version "${t}".`);if(this.container=e.container,this.viewer=e.viewer||e.container.firstElementChild,"DIV"!==this.container?.tagName||"DIV"!==this.viewer?.tagName)throw new Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&"absolute"!==getComputedStyle(this.container).position)throw new Error("The `container` must be absolutely positioned.");this.#mr.observe(this.container),this.eventBus=e.eventBus,this.linkService=e.linkService||new l.SimpleLinkService,this.downloadManager=e.downloadManager||null,this.findController=e.findController||null,this.#ne=e.altTextManager||null,this.findController&&(this.findController.onIsPageVisible=e=>this._getVisiblePages().ids.has(e)),this._scriptingManager=e.scriptingManager||null,this.#_s=e.textLayerMode??s.TextLayerMode.ENABLE,this.#cs=e.annotationMode??n.AnnotationMode.ENABLE_FORMS,this.#lr=e.annotationEditorMode??n.AnnotationEditorType.NONE,this.imageResourcesPath=e.imageResourcesPath||"",this.enablePrintAutoRotate=e.enablePrintAutoRotate||!1,this.removePageBorders=e.removePageBorders||!1,e.useOnlyCssZoom&&(console.error("useOnlyCssZoom was removed, please use `maxCanvasPixels = 0` instead."),e.maxCanvasPixels=0),this.isOffscreenCanvasSupported=e.isOffscreenCanvasSupported??!0,this.maxCanvasPixels=e.maxCanvasPixels,this.l10n=e.l10n||r.NullL10n,this.#Os=e.enablePermissions||!1,this.pageColors=e.pageColors||null,this.defaultRenderingQueue=!e.renderingQueue,this.defaultRenderingQueue?(this.renderingQueue=new o.PDFRenderingQueue,this.renderingQueue.setViewer(this)):this.renderingQueue=e.renderingQueue,this.scroll=(0,s.watchScroll)(this.container,this._scrollUpdate.bind(this)),this.presentationModeState=s.PresentationModeState.UNKNOWN,this._onBeforeDraw=this._onAfterDraw=null,this._resetView(),this.removePageBorders&&this.viewer.classList.add("removePageBorders"),this.#Sr(),this.eventBus._on("thumbnailrendered",(({pageNumber:e,pdfPage:t})=>{const i=this._pages[e-1];this.#or.has(i)||t?.cleanup()}))}get pagesCount(){return this._pages.length}getPageView(e){return this._pages[e]}getCachedPageViews(){return new Set(this.#or)}get pageViewsReady(){return this._pagesCapability.settled&&this._pages.every((e=>e?.pdfPage))}get renderForms(){return this.#cs===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.");this.pdfDocument&&(this._setCurrentPageNumber(e,!0)||console.error(`currentPageNumber: "${e}" is not a valid page.`))}_setCurrentPageNumber(e,t=!1){if(this._currentPageNumber===e)return t&&this.#Pr(),!0;if(!(0<e&&e<=this.pagesCount))return!1;const i=this._currentPageNumber;return this._currentPageNumber=e,this.eventBus.dispatch("pagechanging",{source:this,pageNumber:e,pageLabel:this._pageLabels?.[e-1]??null,previous:i}),t&&this.#Pr(),!0}get currentPageLabel(){return this._pageLabels?.[this._currentPageNumber-1]??null}set currentPageLabel(e){if(!this.pdfDocument)return;let t=0|e;if(this._pageLabels){const i=this._pageLabels.indexOf(e);i>=0&&(t=i+1)}this._setCurrentPageNumber(t,!0)||console.error(`currentPageLabel: "${e}" is not a valid page.`)}get currentScale(){return this._currentScale!==s.UNKNOWN_SCALE?this._currentScale:s.DEFAULT_SCALE}set currentScale(e){if(isNaN(e))throw new Error("Invalid numeric scale.");this.pdfDocument&&this.#Ar(e,{noScroll:!1})}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(e){this.pdfDocument&&this.#Ar(e,{noScroll:!1})}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!(0,s.isValidRotation)(e))throw new Error("Invalid pages rotation angle.");if(!this.pdfDocument)return;if((e%=360)<0&&(e+=360),this._pagesRotation===e)return;this._pagesRotation=e;const t=this._currentPageNumber;this.refresh(!0,{rotation:e}),this._currentScaleValue&&this.#Ar(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}#us(){const e=this;return{get annotationEditorUIManager(){return e.#hr},get annotationStorage(){return e.pdfDocument?.annotationStorage},get downloadManager(){return e.downloadManager},get enableScripting(){return!!e._scriptingManager},get fieldObjectsPromise(){return e.pdfDocument?.getFieldObjects()},get findController(){return e.findController},get hasJSActionsPromise(){return e.pdfDocument?.hasJSActions()},get linkService(){return e.linkService}}}#wr(e){const t={annotationEditorMode:this.#lr,annotationMode:this.#cs,textLayerMode:this.#_s};return e?(e.includes(n.PermissionFlag.COPY)||this.#_s!==s.TextLayerMode.ENABLE||(t.textLayerMode=s.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.#cs!==n.AnnotationMode.ENABLE_FORMS||(t.annotationMode=n.AnnotationMode.ENABLE),t):t}#Er(){if("hidden"===document.visibilityState||!this.container.offsetParent||0===this._getVisiblePages().views.length)return Promise.resolve();const e=new Promise((e=>{this.#br=()=>{"hidden"===document.visibilityState&&(e(),document.removeEventListener("visibilitychange",this.#br),this.#br=null)},document.addEventListener("visibilitychange",this.#br)}));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.#gr)return null;t.length=0;const n=await this.pdfDocument.getPage(i),{items:r}=await n.getTextContent();for(const e of r)e.str&&t.push(e.str),e.hasEOL&&t.push("\n");e.push((0,s.removeNullCharacters)(t.join("")))}return e.join("\n")}#xr(e,t){const i=document.getSelection(),{focusNode:n,anchorNode:r}=i;if(r&&n&&i.containsNode(this.#pr)){if(this.#ur||e===s.TextLayerMode.ENABLE_PERMISSIONS)return t.preventDefault(),void t.stopPropagation();this.#ur=!0;const i=this.container.style.cursor;this.container.style.cursor="wait";const n=e=>this.#gr="Escape"===e.key;window.addEventListener("keydown",n),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.#ur=!1,this.#gr=!1,window.removeEventListener("keydown",n),this.container.style.cursor=i})),t.preventDefault(),t.stopPropagation()}}setDocument(e){if(this.pdfDocument&&(this.eventBus.dispatch("pagesdestroy",{source:this}),this._cancelRendering(),this._resetView(),this.findController?.setDocument(null),this._scriptingManager?.setDocument(null),this.#hr&&(this.#hr.destroy(),this.#hr=null)),this.pdfDocument=e,!e)return;const t=e.numPages,i=e.getPage(1),r=e.getOptionalContentConfig(),o=this.#Os?e.getPermissions():Promise.resolve();if(t>h.FORCE_SCROLL_MODE_PAGE){console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");const e=this._scrollMode=s.ScrollMode.PAGE;this.eventBus.dispatch("scrollmodechanged",{source:this,mode:e})}this._pagesCapability.promise.then((()=>{this.eventBus.dispatch("pagesloaded",{source:this,pagesCount:t})}),(()=>{})),this._onBeforeDraw=e=>{const t=this._pages[e.pageNumber-1];t&&this.#or.push(t)},this.eventBus._on("pagerender",this._onBeforeDraw),this._onAfterDraw=e=>{e.cssTransform||this._onePageRenderedCapability.settled||(this._onePageRenderedCapability.resolve({timestamp:e.timestamp}),this.eventBus._off("pagerendered",this._onAfterDraw),this._onAfterDraw=null,this.#br&&(document.removeEventListener("visibilitychange",this.#br),this.#br=null))},this.eventBus._on("pagerendered",this._onAfterDraw),Promise.all([i,o]).then((([i,o])=>{if(e!==this.pdfDocument)return;this._firstPageCapability.resolve(i),this._optionalContentConfigPromise=r;const{annotationEditorMode:l,annotationMode:d,textLayerMode:u}=this.#wr(o);if(u!==s.TextLayerMode.DISABLE){const e=this.#pr=document.createElement("div");e.id="hiddenCopyElement",this.viewer.before(e)}if(l!==n.AnnotationEditorType.DISABLE){const t=l;e.isPureXfa?console.warn("Warning: XFA-editing is not implemented."):c(t)?(this.#hr=new n.AnnotationEditorUIManager(this.container,this.viewer,this.#ne,this.eventBus,e,this.pageColors),t!==n.AnnotationEditorType.NONE&&this.#hr.updateMode(t)):console.error(`Invalid AnnotationEditor mode: ${t}`)}const p=this.#us.bind(this),g=this._scrollMode===s.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),"CanvasText"!==this.pageColors?.foreground&&"Canvas"!==this.pageColors?.background||this.viewer.style.setProperty("--hcm-highligh-filter",e.filterFactory.addHighlightHCMFilter("CanvasText","Canvas","HighlightText","Highlight"));for(let e=1;e<=t;++e){const t=new a.PDFPageView({container:g,eventBus:this.eventBus,id:e,scale:f,defaultViewport:m.clone(),optionalContentConfigPromise:r,renderingQueue:this.renderingQueue,textLayerMode:u,annotationMode:d,imageResourcesPath:this.imageResourcesPath,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported,maxCanvasPixels:this.maxCanvasPixels,pageColors:this.pageColors,l10n:this.l10n,layerProperties:p});this._pages.push(t)}const _=this._pages[0];_&&(_.setPdfPage(i),this.linkService.cachePageRef(1,i.ref)),this._scrollMode===s.ScrollMode.PAGE?this.#Cr():this._spreadMode!==s.SpreadMode.NONE&&this._updateSpreadMode(),this.#Er().then((async()=>{if(this.findController?.setDocument(e),this._scriptingManager?.setDocument(e),this.#pr&&(this.#dr=this.#xr.bind(this,u),document.addEventListener("copy",this.#dr)),this.#hr&&this.eventBus.dispatch("annotationeditormodechanged",{source:this,mode:this.#lr}),e.loadingParams.disableAutoFetch||t>h.FORCE_LAZY_PAGE_INIT)return void this._pagesCapability.resolve();let i=t-1;if(i<=0)this._pagesCapability.resolve();else for(let n=2;n<=t;++n){const t=e.getPage(n).then((e=>{const t=this._pages[n-1];t.pdfPage||t.setPdfPage(e),this.linkService.cachePageRef(n,e.ref),0==--i&&this._pagesCapability.resolve()}),(e=>{console.error(`Unable to get page ${n} to initialize viewer`,e),0==--i&&this._pagesCapability.resolve()}));n%h.PAUSE_EAGER_PAGE_INIT==0&&await t}})),this.eventBus.dispatch("pagesinit",{source:this}),e.getMetadata().then((({info:t})=>{e===this.pdfDocument&&t.Language&&(this.viewer.lang=t.Language)})),this.defaultRenderingQueue&&this.update()})).catch((e=>{console.error("Unable to initialize viewer",e),this._pagesCapability.reject(e)}))}setPageLabels(e){if(this.pdfDocument){e?Array.isArray(e)&&this.pdfDocument.numPages===e.length?this._pageLabels=e:(this._pageLabels=null,console.error("setPageLabels: Invalid page labels.")):this._pageLabels=null;for(let e=0,t=this._pages.length;e<t;e++)this._pages[e].setPageLabel(this._pageLabels?.[e]??null)}}_resetView(){this._pages=[],this._currentPageNumber=1,this._currentScale=s.UNKNOWN_SCALE,this._currentScaleValue=null,this._pageLabels=null,this.#or=new d(10),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=s.ScrollMode.VERTICAL,this._previousScrollMode=s.ScrollMode.UNKNOWN,this._spreadMode=s.SpreadMode.NONE,this.#vr={previousPageNumber:1,scrollDown:!0,pages:[]},this._onBeforeDraw&&(this.eventBus._off("pagerender",this._onBeforeDraw),this._onBeforeDraw=null),this._onAfterDraw&&(this.eventBus._off("pagerendered",this._onAfterDraw),this._onAfterDraw=null),this.#br&&(document.removeEventListener("visibilitychange",this.#br),this.#br=null),this.viewer.textContent="",this._updateScrollMode(),this.viewer.removeAttribute("lang"),this.#pr&&(document.removeEventListener("copy",this.#dr),this.#dr=null,this.#pr.remove(),this.#pr=null)}#Cr(){if(this._scrollMode!==s.ScrollMode.PAGE)throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");const e=this._currentPageNumber,t=this.#vr,i=this.viewer;if(i.textContent="",t.pages.length=0,this._spreadMode!==s.SpreadMode.NONE||this.isInPresentationMode){const n=new Set,s=this._spreadMode-1;-1===s?n.add(e-1):e%2!==s?(n.add(e-1),n.add(e)):(n.add(e-2),n.add(e-1));const r=document.createElement("div");if(r.className="spread",this.isInPresentationMode){const e=document.createElement("div");e.className="dummyPage",r.append(e)}for(const e of n){const i=this._pages[e];i&&(r.append(i.div),t.pages.push(i))}i.append(r)}else{const n=this._pages[e-1];i.append(n.div),t.pages.push(n)}t.scrollDown=e>=t.previousPageNumber,t.previousPageNumber=e}_scrollUpdate(){0!==this.pagesCount&&this.update()}#Mr(e,t=null){const{div:i,id:n}=e;if(this._currentPageNumber!==n&&this._setCurrentPageNumber(n),this._scrollMode===s.ScrollMode.PAGE&&(this.#Cr(),this.update()),!t&&!this.isInPresentationMode){const e=i.offsetLeft+i.clientLeft,n=e+i.clientWidth,{scrollLeft:r,clientWidth:a}=this.container;(this._scrollMode===s.ScrollMode.HORIZONTAL||e<r||n>r+a)&&(t={left:0,top:0})}(0,s.scrollIntoView)(i,t),!this._currentScaleValue&&this._location&&(this._location=null)}#Tr(e){return e===this._currentScale||Math.abs(e-this._currentScale)<1e-15}#Dr(e,t,{noScroll:i=!1,preset:s=!1,drawingDelay:r=-1}){if(this._currentScaleValue=t.toString(),this.#Tr(e))return void(s&&this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:t}));this.viewer.style.setProperty("--scale-factor",e*n.PixelsPerInch.PDF_TO_CSS_UNITS);const a=r>=0&&r<1e3;if(this.refresh(!0,{scale:e,drawingDelay:a?r:-1}),a&&(this.#yr=setTimeout((()=>{this.#yr=null,this.refresh()}),r)),this._currentScale=e,!i){let e,t=this._currentPageNumber;!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}),this.defaultRenderingQueue&&this.update()}get#Fr(){return this._spreadMode!==s.SpreadMode.NONE&&this._scrollMode!==s.ScrollMode.HORIZONTAL?2:1}#Ar(e,t){let i=parseFloat(e);if(i>0)t.preset=!1,this.#Dr(i,e,t);else{const n=this._pages[this._currentPageNumber-1];if(!n)return;let r=s.SCROLLBAR_PADDING,a=s.VERTICAL_PADDING;this.isInPresentationMode?(r=a=4,this._spreadMode!==s.SpreadMode.NONE&&(r*=2)):this.removePageBorders?r=a=0:this._scrollMode===s.ScrollMode.HORIZONTAL&&([r,a]=[a,r]);const o=(this.container.clientWidth-r)/n.width*n.scale/this.#Fr,l=(this.container.clientHeight-a)/n.height*n.scale;switch(e){case"page-actual":i=1;break;case"page-width":i=o;break;case"page-height":i=l;break;case"page-fit":i=Math.min(o,l);break;case"auto":const t=(0,s.isPortraitOrientation)(n)?o:Math.min(l,o);i=Math.min(s.MAX_AUTO_SCALE,t);break;default:return void console.error(`#setScale: "${e}" is an unknown zoom value.`)}t.preset=!0,this.#Dr(i,e,t)}}#Pr(){const e=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&this.#Ar(this._currentScaleValue,{noScroll:!0}),this.#Mr(e)}pageLabelToPageNumber(e){if(!this._pageLabels)return null;const t=this._pageLabels.indexOf(e);return t<0?null:t+1}scrollPageIntoView({pageNumber:e,destArray:t=null,allowNegativeOffset:i=!1,ignoreDestinationZoom:r=!1}){if(!this.pdfDocument)return;const a=Number.isInteger(e)&&this._pages[e-1];if(!a)return void console.error(`scrollPageIntoView: "${e}" is not a valid pageNumber parameter.`);if(this.isInPresentationMode||!t)return void this._setCurrentPageNumber(e,!0);let o,l,h=0,c=0,d=0,u=0;const p=a.rotation%180!=0,g=(p?a.height:a.width)/a.scale/n.PixelsPerInch.PDF_TO_CSS_UNITS,f=(p?a.width:a.height)/a.scale/n.PixelsPerInch.PDF_TO_CSS_UNITS;let m=0;switch(t[1].name){case"XYZ":h=t[2],c=t[3],m=t[4],h=null!==h?h:0,c=null!==c?c:f;break;case"Fit":case"FitB":m="page-fit";break;case"FitH":case"FitBH":c=t[2],m="page-width",null===c&&this._location?(h=this._location.left,c=this._location.top):("number"!=typeof c||c<0)&&(c=f);break;case"FitV":case"FitBV":h=t[2],d=g,u=f,m="page-height";break;case"FitR":h=t[2],c=t[3],d=t[4]-h,u=t[5]-c;let e=s.SCROLLBAR_PADDING,i=s.VERTICAL_PADDING;this.removePageBorders&&(e=i=0),o=(this.container.clientWidth-e)/d/n.PixelsPerInch.PDF_TO_CSS_UNITS,l=(this.container.clientHeight-i)/u/n.PixelsPerInch.PDF_TO_CSS_UNITS,m=Math.min(Math.abs(o),Math.abs(l));break;default:return void console.error(`scrollPageIntoView: "${t[1].name}" is not a valid destination type.`)}if(r||(m&&m!==this._currentScale?this.currentScaleValue=m:this._currentScale===s.UNKNOWN_SCALE&&(this.currentScaleValue=s.DEFAULT_SCALE_VALUE)),"page-fit"===m&&!t[4])return void this.#Mr(a);const _=[a.viewport.convertToViewportPoint(h,c),a.viewport.convertToViewportPoint(h+d,c+u)];let v=Math.min(_[0][0],_[1][0]),b=Math.min(_[0][1],_[1][1]);i||(v=Math.max(v,0),b=Math.max(b,0)),this.#Mr(a,{left:v,top:b})}_updateLocation(e){const t=this._currentScale,i=this._currentScaleValue,n=parseFloat(i)===t?Math.round(1e4*t)/100:i,s=e.id,r=this._pages[s-1],a=this.container,o=r.getPagePoint(a.scrollLeft-e.x,a.scrollTop-e.y),l=Math.round(o[0]),h=Math.round(o[1]);let c=`#page=${s}`;this.isInPresentationMode||(c+=`&zoom=${n},${l},${h}`),this._location={pageNumber:s,scale:n,top:h,left:l,rotation:this._pagesRotation,pdfOpenParams:c}}update(){const e=this._getVisiblePages(),t=e.views,i=t.length;if(0===i)return;const n=Math.max(10,2*i+1);this.#or.resize(n,e.ids),this.renderingQueue.renderHighestPriority(e);const r=this._spreadMode===s.SpreadMode.NONE&&(this._scrollMode===s.ScrollMode.PAGE||this._scrollMode===s.ScrollMode.VERTICAL),a=this._currentPageNumber;let o=!1;for(const e of t){if(e.percent<100)break;if(e.id===a&&r){o=!0;break}}this._setCurrentPageNumber(o?a:t[0].id),this._updateLocation(e.first),this.eventBus.dispatch("updateviewarea",{source:this,location:this._location})}containsElement(e){return this.container.contains(e)}focus(){this.container.focus()}get _isContainerRtl(){return"rtl"===getComputedStyle(this.container).direction}get isInPresentationMode(){return this.presentationModeState===s.PresentationModeState.FULLSCREEN}get isChangingPresentationMode(){return this.presentationModeState===s.PresentationModeState.CHANGING}get isHorizontalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollHeight>this.container.clientHeight}_getVisiblePages(){const e=this._scrollMode===s.ScrollMode.PAGE?this.#vr.pages:this._pages,t=this._scrollMode===s.ScrollMode.HORIZONTAL,i=t&&this._isContainerRtl;return(0,s.getVisibleElements)({scrollEl:this.container,views:e,sortByVisibility:!0,horizontal:t,rtl:i})}cleanup(){for(const e of this._pages)e.renderingState!==s.RenderingStates.FINISHED&&e.reset()}_cancelRendering(){for(const e of this._pages)e.cancelRendering()}async#Lr(e){if(e.pdfPage)return e.pdfPage;try{const t=await this.pdfDocument.getPage(e.id);return e.pdfPage||e.setPdfPage(t),this.linkService._cachedPageNumber?.(t.ref)||this.linkService.cachePageRef(e.id,t.ref),t}catch(e){return console.error("Unable to get page for page view",e),null}}#kr(e){if(1===e.first?.id)return!0;if(e.last?.id===this.pagesCount)return!1;switch(this._scrollMode){case s.ScrollMode.PAGE:return this.#vr.scrollDown;case s.ScrollMode.HORIZONTAL:return this.scroll.right}return this.scroll.down}forceRendering(e){const t=e||this._getVisiblePages(),i=this.#kr(t),n=this._spreadMode!==s.SpreadMode.NONE&&this._scrollMode!==s.ScrollMode.HORIZONTAL,r=this.renderingQueue.getHighestPriority(t,this._pages,i,n);return!!r&&(this.#Lr(r).then((()=>{this.renderingQueue.renderView(r)})),!0)}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,s.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(){return this.pdfDocument?this._optionalContentConfigPromise?this._optionalContentConfigPromise:(console.error("optionalContentConfigPromise: Not initialized yet."),this.pdfDocument.getOptionalContentConfig()):Promise.resolve(null)}set optionalContentConfigPromise(e){if(!(e instanceof Promise))throw new Error(`Invalid optionalContentConfigPromise: ${e}`);this.pdfDocument&&this._optionalContentConfigPromise&&(this._optionalContentConfigPromise=e,this.refresh(!1,{optionalContentConfigPromise:e}),this.eventBus.dispatch("optionalcontentconfigchanged",{source:this,promise:e}))}get scrollMode(){return this._scrollMode}set scrollMode(e){if(this._scrollMode!==e){if(!(0,s.isValidScrollMode)(e))throw new Error(`Invalid scroll mode: ${e}`);this.pagesCount>h.FORCE_SCROLL_MODE_PAGE||(this._previousScrollMode=this._scrollMode,this._scrollMode=e,this.eventBus.dispatch("scrollmodechanged",{source:this,mode:e}),this._updateScrollMode(this._currentPageNumber))}}_updateScrollMode(e=null){const t=this._scrollMode,i=this.viewer;i.classList.toggle("scrollHorizontal",t===s.ScrollMode.HORIZONTAL),i.classList.toggle("scrollWrapped",t===s.ScrollMode.WRAPPED),this.pdfDocument&&e&&(t===s.ScrollMode.PAGE?this.#Cr():this._previousScrollMode===s.ScrollMode.PAGE&&this._updateSpreadMode(),this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#Ar(this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(e,!0),this.update())}get spreadMode(){return this._spreadMode}set spreadMode(e){if(this._spreadMode!==e){if(!(0,s.isValidSpreadMode)(e))throw new Error(`Invalid spread mode: ${e}`);this._spreadMode=e,this.eventBus.dispatch("spreadmodechanged",{source:this,mode:e}),this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(e=null){if(!this.pdfDocument)return;const t=this.viewer,i=this._pages;if(this._scrollMode===s.ScrollMode.PAGE)this.#Cr();else if(t.textContent="",this._spreadMode===s.SpreadMode.NONE)for(const e of this._pages)t.append(e.div);else{const e=this._spreadMode-1;let n=null;for(let s=0,r=i.length;s<r;++s)null===n?(n=document.createElement("div"),n.className="spread",t.append(n)):s%2===e&&(n=n.cloneNode(!1),t.append(n)),n.append(i[s].div)}e&&(this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#Ar(this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(e,!0),this.update())}_getPageAdvance(e,t=!1){switch(this._scrollMode){case s.ScrollMode.WRAPPED:{const{views:i}=this._getVisiblePages(),n=new Map;for(const{id:e,y:t,percent:s,widthPercent:r}of i){if(0===s||r<100)continue;let i=n.get(t);i||n.set(t,i||=[]),i.push(e)}for(const i of n.values()){const n=i.indexOf(e);if(-1===n)continue;const s=i.length;if(1===s)break;if(t)for(let t=n-1,s=0;t>=s;t--){const n=i[t],s=i[t+1]-1;if(n<s)return e-s}else for(let t=n+1,r=s;t<r;t++){const n=i[t],s=i[t-1]+1;if(n>s)return s-e}if(t){const t=i[0];if(t<e)return e-t+1}else{const t=i[s-1];if(t>e)return t-e+1}break}break}case s.ScrollMode.HORIZONTAL:break;case s.ScrollMode.PAGE:case s.ScrollMode.VERTICAL:{if(this._spreadMode===s.SpreadMode.NONE)break;const i=this._spreadMode-1;if(t&&e%2!==i)break;if(!t&&e%2===i)break;const{views:n}=this._getVisiblePages(),r=t?e-1:e+1;for(const{id:e,percent:t,widthPercent:i}of n)if(e===r){if(t>0&&100===i)return 2;break}break}}return 1}nextPage(){const e=this._currentPageNumber,t=this.pagesCount;if(e>=t)return!1;const i=this._getPageAdvance(e,!1)||1;return this.currentPageNumber=Math.min(e+i,t),!0}previousPage(){const e=this._currentPageNumber;if(e<=1)return!1;const t=this._getPageAdvance(e,!0)||1;return this.currentPageNumber=Math.max(e-t,1),!0}increaseScale({drawingDelay:e,scaleFactor:t,steps:i}={}){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*s.DEFAULT_SCALE_DELTA).toFixed(2))/10}while(--i>0&&n<s.MAX_SCALE)}this.#Ar(Math.min(s.MAX_SCALE,n),{noScroll:!1,drawingDelay:e})}decreaseScale({drawingDelay:e,scaleFactor:t,steps:i}={}){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/s.DEFAULT_SCALE_DELTA).toFixed(2))/10}while(--i>0&&n>s.MIN_SCALE)}this.#Ar(Math.max(s.MIN_SCALE,n),{noScroll:!1,drawingDelay:e})}#Sr(e=this.container.clientHeight){e!==this.#fr&&(this.#fr=e,s.docStyle.setProperty("--viewer-container-height",`${e}px`))}#_r(e){for(const t of e)if(t.target===this.container){this.#Sr(Math.floor(t.borderBoxSize[0].blockSize)),this.#cr=null;break}}get containerTopLeft(){return this.#cr||=[this.container.offsetTop,this.container.offsetLeft]}get annotationEditorMode(){return this.#hr?this.#lr:n.AnnotationEditorType.DISABLE}set annotationEditorMode({mode:e,editId:t=null}){if(!this.#hr)throw new Error("The AnnotationEditor is not enabled.");if(this.#lr!==e){if(!c(e))throw new Error(`Invalid AnnotationEditor mode: ${e}`);this.pdfDocument&&(this.#lr=e,this.eventBus.dispatch("annotationeditormodechanged",{source:this,mode:e}),this.#hr.updateMode(e,t))}}set annotationEditorParams({type:e,value:t}){if(!this.#hr)throw new Error("The AnnotationEditor is not enabled.");this.#hr.updateParams(e,t)}refresh(e=!1,t=Object.create(null)){if(this.pdfDocument){for(const e of this._pages)e.update(t);null!==this.#yr&&(clearTimeout(this.#yr),this.#yr=null),e||this.update()}}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFRenderingQueue=void 0;var n=i(4),s=i(2);t.PDFRenderingQueue=class{constructor(){this.pdfViewer=null,this.pdfThumbnailViewer=null,this.onIdle=null,this.highestPriorityPage=null,this.idleTimeout=null,this.printing=!1,this.isThumbnailViewEnabled=!1,Object.defineProperty(this,"hasViewer",{value:()=>!!this.pdfViewer})}setViewer(e){this.pdfViewer=e}setThumbnailViewer(e){this.pdfThumbnailViewer=e}isHighestPriority(e){return this.highestPriorityPage===e.renderingId}renderHighestPriority(e){this.idleTimeout&&(clearTimeout(this.idleTimeout),this.idleTimeout=null),this.pdfViewer.forceRendering(e)||this.isThumbnailViewEnabled&&this.pdfThumbnailViewer?.forceRendering()||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),3e4))}getHighestPriority(e,t,i,n=!1){const s=e.views,r=s.length;if(0===r)return null;for(let e=0;e<r;e++){const t=s[e].view;if(!this.isViewFinished(t))return t}const a=e.first.id,o=e.last.id;if(o-a+1>r){const n=e.ids;for(let e=1,s=o-a;e<s;e++){const s=i?a+e:o-e;if(n.has(s))continue;const r=t[s-1];if(!this.isViewFinished(r))return r}}let l=i?o:a-2,h=t[l];return h&&!this.isViewFinished(h)||n&&(l+=i?1:-1,h=t[l],h&&!this.isViewFinished(h))?h:null}isViewFinished(e){return e.renderingState===s.RenderingStates.FINISHED}renderView(e){switch(e.renderingState){case s.RenderingStates.FINISHED:return!1;case s.RenderingStates.PAUSED:this.highestPriorityPage=e.renderingId,e.resume();break;case s.RenderingStates.RUNNING:this.highestPriorityPage=e.renderingId;break;case s.RenderingStates.INITIAL:this.highestPriorityPage=e.renderingId,e.draw().finally((()=>{this.renderHighestPriority()})).catch((e=>{e instanceof n.RenderingCancelledException||console.error(`renderView: "${e}"`)}))}return!0}}}],t={};function i(n){var s=t[n];if(void 0!==s)return s.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,i),r.exports}var n={};return(()=>{var e=n;Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"AnnotationLayerBuilder",{enumerable:!0,get:function(){return a.AnnotationLayerBuilder}}),Object.defineProperty(e,"DownloadManager",{enumerable:!0,get:function(){return o.DownloadManager}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return l.EventBus}}),Object.defineProperty(e,"FindState",{enumerable:!0,get:function(){return t.FindState}}),Object.defineProperty(e,"GenericL10n",{enumerable:!0,get:function(){return h.GenericL10n}}),Object.defineProperty(e,"LinkTarget",{enumerable:!0,get:function(){return s.LinkTarget}}),Object.defineProperty(e,"NullL10n",{enumerable:!0,get:function(){return c.NullL10n}}),Object.defineProperty(e,"PDFFindController",{enumerable:!0,get:function(){return t.PDFFindController}}),Object.defineProperty(e,"PDFHistory",{enumerable:!0,get:function(){return d.PDFHistory}}),Object.defineProperty(e,"PDFLinkService",{enumerable:!0,get:function(){return s.PDFLinkService}}),Object.defineProperty(e,"PDFPageView",{enumerable:!0,get:function(){return u.PDFPageView}}),Object.defineProperty(e,"PDFScriptingManager",{enumerable:!0,get:function(){return p.PDFScriptingManager}}),Object.defineProperty(e,"PDFSinglePageViewer",{enumerable:!0,get:function(){return g.PDFSinglePageViewer}}),Object.defineProperty(e,"PDFViewer",{enumerable:!0,get:function(){return f.PDFViewer}}),Object.defineProperty(e,"ProgressBar",{enumerable:!0,get:function(){return r.ProgressBar}}),Object.defineProperty(e,"RenderingStates",{enumerable:!0,get:function(){return r.RenderingStates}}),Object.defineProperty(e,"ScrollMode",{enumerable:!0,get:function(){return r.ScrollMode}}),Object.defineProperty(e,"SimpleLinkService",{enumerable:!0,get:function(){return s.SimpleLinkService}}),Object.defineProperty(e,"SpreadMode",{enumerable:!0,get:function(){return r.SpreadMode}}),Object.defineProperty(e,"StructTreeLayerBuilder",{enumerable:!0,get:function(){return m.StructTreeLayerBuilder}}),Object.defineProperty(e,"TextLayerBuilder",{enumerable:!0,get:function(){return _.TextLayerBuilder}}),Object.defineProperty(e,"XfaLayerBuilder",{enumerable:!0,get:function(){return v.XfaLayerBuilder}}),Object.defineProperty(e,"parseQueryString",{enumerable:!0,get:function(){return r.parseQueryString}});var t=i(1),s=i(5),r=i(2),a=i(6),o=i(8),l=i(9),h=i(10),c=i(7),d=i(12),u=i(13),p=i(21),g=i(24),f=i(25),m=i(16),_=i(19),v=i(20)})(),n})(),e.exports=i.pdfjsViewer=n()}(pdf_viewer);var pdf_viewerExports=pdf_viewer.exports,_ProgressBar_classList,_ProgressBar_disableAutoFetchTimeout,_ProgressBar_percent,_ProgressBar_style,_ProgressBar_visible;function __awaiter(e,t,i,n){return new(i||(i=Promise))((function(t,s){function r(e){try{o(n.next(e))}catch(e){s(e)}}function a(e){try{o(n.throw(e))}catch(e){s(e)}}function o(e){var n;e.done?t(e.value):(n=e.value,n instanceof i?n:new i((function(e){e(n)}))).then(r,a)}o((n=n.apply(e,[])).next())}))}function __classPrivateFieldGet(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)}function __classPrivateFieldSet(e,t,i,n,s){if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s?s.value=i:t.set(e,i),i}"function"==typeof SuppressedError&&SuppressedError;const DEFAULT_SCALE_VALUE="auto",DEFAULT_SCALE=1,DEFAULT_SCALE_DELTA=1.1,MIN_SCALE=.1,MAX_SCALE=10,UNKNOWN_SCALE=0,MAX_AUTO_SCALE=1.25,SCROLLBAR_PADDING=40,VERTICAL_PADDING=5,RenderingStates={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},PresentationModeState={UNKNOWN:0,NORMAL:1,CHANGING:2,FULLSCREEN:3},SidebarView={UNKNOWN:-1,NONE:0,THUMBS:1,OUTLINE:2,ATTACHMENTS:3,LAYERS:4},RendererType={CANVAS:"canvas",SVG:"svg"},TextLayerMode={DISABLE:0,ENABLE:1},ScrollMode={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3},SpreadMode={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2},CursorTool={SELECT:0,HAND:1,ZOOM:2},AutoPrintRegExp=/\bprint\s*\(/;class OutputScale{constructor(){const e=window.devicePixelRatio||1;this.sx=e,this.sy=e}get scaled(){return 1!==this.sx||1!==this.sy}}function scrollIntoView(e,t,i=!1){let n=e.offsetParent;if(!n)return void console.error("offsetParent is not set -- cannot scroll");let s=e.offsetTop+e.clientTop,r=e.offsetLeft+e.clientLeft;for(;n.clientHeight===n.scrollHeight&&n.clientWidth===n.scrollWidth||i&&(n.classList.contains("markedContent")||"hidden"===getComputedStyle(n).overflow);)if(s+=n.offsetTop,r+=n.offsetLeft,n=n.offsetParent,!n)return;t&&(void 0!==t.top&&(s+=t.top),void 0!==t.left&&(r+=t.left,n.scrollLeft=r)),n.scrollTop=s,n.scrollLeft=r}function watchScroll(e,t){const i=function(i){s||(s=window.requestAnimationFrame((function(){s=null;const i=e.scrollLeft,r=n.lastX;i!==r&&(n.right=i>r),n.lastX=i;const a=e.scrollTop,o=n.lastY;a!==o&&(n.down=a>o),n.lastY=a,t(n)})))},n={right:!0,down:!0,lastX:e.scrollLeft,lastY:e.scrollTop,_eventHandler:i};let s=null;return e.addEventListener("scroll",i,!0),n}function parseQueryString(e){const t=new Map;for(const[i,n]of new URLSearchParams(e))t.set(i.toLowerCase(),n);return t}const NullCharactersRegExp=/\x00/g,InvisibleCharactersRegExp=/[\x01-\x1F]/g;function removeNullCharacters(e,t=!1){return"string"!=typeof e?(console.error("The argument must be a string."),e):(t&&(e=e.replace(InvisibleCharactersRegExp," ")),e.replace(NullCharactersRegExp,""))}function binarySearchFirstItem(e,t,i=0){let n=i,s=e.length-1;if(s<0||!t(e[s]))return e.length;if(t(e[n]))return n;for(;n<s;){const i=n+s>>1;t(e[i])?s=i:n=i+1}return n}function approximateFraction(e){if(Math.floor(e)===e)return[e,1];const t=1/e;if(t>8)return[1,8];if(Math.floor(t)===t)return[1,t];const i=e>1?t:e;let n,s=0,r=1,a=1,o=1;for(;;){const e=s+a,t=r+o;if(t>8)break;i<=e/t?(a=e,o=t):(s=e,r=t)}return n=i-s/r<a/o-i?i===e?[s,r]:[r,s]:i===e?[a,o]:[o,a],n}function roundToDivide(e,t){const i=e%t;return 0===i?e:Math.round(e-i+t)}function getPageSizeInches({view:e,userUnit:t,rotate:i}){const[n,s,r,a]=e,o=i%180!=0,l=(r-n)/72*t,h=(a-s)/72*t;return{width:o?h:l,height:o?l:h}}function backtrackBeforeAllVisibleElements(e,t,i){if(e<2)return e;let n=t[e].div,s=n.offsetTop+n.clientTop;s>=i&&(n=t[e-1].div,s=n.offsetTop+n.clientTop);for(let i=e-2;i>=0&&(n=t[i].div,!(n.offsetTop+n.clientTop+n.clientHeight<=s));--i)e=i;return e}function getVisibleElements({scrollEl:e,views:t,sortByVisibility:i=!1,horizontal:n=!1,rtl:s=!1}){const r=e.scrollTop,a=r+e.clientHeight,o=e.scrollLeft,l=o+e.clientWidth;const h=[],c=new Set,d=t.length;let u=binarySearchFirstItem(t,n?function(e){const t=e.div,i=t.offsetLeft+t.clientLeft,n=i+t.clientWidth;return s?i<l:n>o}:function(e){const t=e.div;return t.offsetTop+t.clientTop+t.clientHeight>r});u>0&&u<d&&!n&&(u=backtrackBeforeAllVisibleElements(u,t,r));let p=n?l:-1;for(let e=u;e<d;e++){const i=t[e],s=i.div,d=s.offsetLeft+s.clientLeft,u=s.offsetTop+s.clientTop,g=s.clientWidth,f=s.clientHeight,m=d+g,_=u+f;if(-1===p)_>=a&&(p=_);else if((n?d:u)>p)break;if(_<=r||u>=a||m<=o||d>=l)continue;const v=Math.max(0,r-u)+Math.max(0,_-a),b=(g-(Math.max(0,o-d)+Math.max(0,m-l)))/g,y=(f-v)/f*b*100|0;h.push({id:i.id,x:d,y:u,view:i,percent:y,widthPercent:100*b|0}),c.add(i.id)}const g=h[0],f=h.at(-1);return i&&h.sort((function(e,t){const i=e.percent-t.percent;return Math.abs(i)>.001?-i:e.id-t.id})),{first:g,last:f,views:h,ids:c}}function noContextMenuHandler(e){e.preventDefault()}function normalizeWheelEventDirection(e){let t=Math.hypot(e.deltaX,e.deltaY);const i=Math.atan2(e.deltaY,e.deltaX);return-.25*Math.PI<i&&i<.75*Math.PI&&(t=-t),t}function normalizeWheelEventDelta(e){const t=e.deltaMode;let i=normalizeWheelEventDirection(e);return t===WheelEvent.DOM_DELTA_PIXEL?i/=900:t===WheelEvent.DOM_DELTA_LINE&&(i/=30),i}function isValidRotation(e){return Number.isInteger(e)&&e%90==0}function isValidScrollMode(e){return Number.isInteger(e)&&Object.values(ScrollMode).includes(e)&&e!==ScrollMode.UNKNOWN}function isValidSpreadMode(e){return Number.isInteger(e)&&Object.values(SpreadMode).includes(e)&&e!==SpreadMode.UNKNOWN}function isPortraitOrientation(e){return e.width<=e.height}const animationStarted=new Promise((function(e){window.requestAnimationFrame(e)})),docStyle=document.documentElement.style;function clamp(e,t,i){return Math.min(Math.max(e,t),i)}class ProgressBar{constructor(e){_ProgressBar_classList.set(this,null),_ProgressBar_disableAutoFetchTimeout.set(this,null),_ProgressBar_percent.set(this,0),_ProgressBar_style.set(this,null),_ProgressBar_visible.set(this,!0),__classPrivateFieldSet(this,_ProgressBar_classList,e.classList),__classPrivateFieldSet(this,_ProgressBar_style,e.style)}get percent(){return __classPrivateFieldGet(this,_ProgressBar_percent,"f")}set percent(e){var t,i,n;__classPrivateFieldSet(this,_ProgressBar_percent,clamp(e,0,100)),isNaN(e)?null===(t=__classPrivateFieldGet(this,_ProgressBar_classList,"f"))||void 0===t||t.add("indeterminate"):(null===(i=__classPrivateFieldGet(this,_ProgressBar_classList,"f"))||void 0===i||i.remove("indeterminate"),null===(n=__classPrivateFieldGet(this,_ProgressBar_style,"f"))||void 0===n||n.setProperty("--progressBar-percent",`${__classPrivateFieldGet(this,_ProgressBar_percent,"f")}%`))}setWidth(e){var t;if(!e)return;const i=e.parentNode.offsetWidth-e.offsetWidth;i>0&&(null===(t=__classPrivateFieldGet(this,_ProgressBar_style,"f"))||void 0===t||t.setProperty("--progressBar-end-offset",`${i}px`))}setDisableAutoFetch(e=5e3){isNaN(__classPrivateFieldGet(this,_ProgressBar_percent,"f"))||(__classPrivateFieldGet(this,_ProgressBar_disableAutoFetchTimeout,"f")&&clearTimeout(__classPrivateFieldGet(this,_ProgressBar_disableAutoFetchTimeout,"f")),this.show(),__classPrivateFieldSet(this,_ProgressBar_disableAutoFetchTimeout,setTimeout((()=>{__classPrivateFieldSet(this,_ProgressBar_disableAutoFetchTimeout,null,"f"),this.hide()}),e)))}hide(){var e;__classPrivateFieldGet(this,_ProgressBar_visible,"f")&&(__classPrivateFieldSet(this,_ProgressBar_visible,!1),null===(e=__classPrivateFieldGet(this,_ProgressBar_classList,"f"))||void 0===e||e.add("hidden"))}show(){var e;__classPrivateFieldGet(this,_ProgressBar_visible,"f")||(__classPrivateFieldSet(this,_ProgressBar_visible,!0),null===(e=__classPrivateFieldGet(this,_ProgressBar_classList,"f"))||void 0===e||e.remove("hidden"))}}function getActiveOrFocusedElement(){let e=document,t=e.activeElement||e.querySelector(":focus");for(;null==t?void 0:t.shadowRoot;)e=t.shadowRoot,t=e.activeElement||e.querySelector(":focus");return t}function apiPageLayoutToViewerModes(e){let t=ScrollMode.VERTICAL,i=SpreadMode.NONE;switch(e){case"SinglePage":t=ScrollMode.PAGE;break;case"OneColumn":break;case"TwoPageLeft":t=ScrollMode.PAGE;case"TwoColumnLeft":i=SpreadMode.ODD;break;case"TwoPageRight":t=ScrollMode.PAGE;case"TwoColumnRight":i=SpreadMode.EVEN}return{scrollMode:t,spreadMode:i}}function apiPageModeToSidebarView(e){switch(e){case"UseNone":return SidebarView.NONE;case"UseThumbs":return SidebarView.THUMBS;case"UseOutlines":return SidebarView.OUTLINE;case"UseAttachments":return SidebarView.ATTACHMENTS;case"UseOC":return SidebarView.LAYERS}return SidebarView.NONE}_ProgressBar_classList=new WeakMap,_ProgressBar_disableAutoFetchTimeout=new WeakMap,_ProgressBar_percent=new WeakMap,_ProgressBar_style=new WeakMap,_ProgressBar_visible=new WeakMap;const CLEANUP_TIMEOUT=3e4;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,i;this.idleTimeout&&(clearTimeout(this.idleTimeout),this.idleTimeout=null),(null===(t=this.pdfViewer)||void 0===t?void 0:t.forceRendering(e))||this.isThumbnailViewEnabled&&(null===(i=this.pdfThumbnailViewer)||void 0===i?void 0:i.forceRendering())||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),CLEANUP_TIMEOUT))}getHighestPriority(e,t,i,n=!1){const s=e.views,r=s.length;if(0===r)return null;for(let e=0;e<r;e++){const t=s[e].view;if(!this.isViewFinished(t))return t}const a=e.first.id,o=e.last.id;if(o-a+1>r){const n=e.ids;for(let e=1,s=o-a;e<s;e++){const s=i?a+e:o-e;if(n.has(s))continue;const r=t[s-1];if(!this.isViewFinished(r))return r}}let l=i?o:a-2,h=t[l];return h&&!this.isViewFinished(h)||n&&(l+=i?1:-1,h=t[l],h&&!this.isViewFinished(h))?h:null}isViewFinished(e){return e.renderingState===RenderingStates.FINISHED}renderView(e){switch(e.renderingState){case RenderingStates.FINISHED:return!1;case RenderingStates.PAUSED:this.highestPriorityPage=e.renderingId,e.resume();break;case RenderingStates.RUNNING:this.highestPriorityPage=e.renderingId;break;case RenderingStates.INITIAL:this.highestPriorityPage=e.renderingId,e.draw().finally((()=>{this.renderHighestPriority()})).catch((e=>{e instanceof pdfExports.RenderingCancelledException||console.error(`renderView: "${e}"`)}))}return!0}}var _a,_TempImageFactory_tempCanvas;const DRAW_UPSCALE_FACTOR=2,MAX_NUM_SCALING_STEPS=3;class TempImageFactory{static getCanvas(e,t){const i=__classPrivateFieldSet(this,_a,__classPrivateFieldGet(this,_a,"f",_TempImageFactory_tempCanvas)||document.createElement("canvas"),"f",_TempImageFactory_tempCanvas);i.width=e,i.height=t;const n=i.getContext("2d",{alpha:!1});n.save(),n.fillStyle="rgb(255, 255, 255)",n.fillRect(0,0,e,t),n.restore();const s=i.getContext("2d");return[i,s]}static destroyCanvas(){const e=__classPrivateFieldGet(this,_a,"f",_TempImageFactory_tempCanvas);e&&(e.width=0,e.height=0),__classPrivateFieldSet(this,_a,null,"f",_TempImageFactory_tempCanvas)}}_a=TempImageFactory,_TempImageFactory_tempCanvas={value:null};class PDFThumbnailView{constructor({container:e,eventBus:t,id:i,defaultViewport:n,optionalContentConfigPromise:s,linkService:r,renderingQueue:a,l10n:o,pageColors:l,store:h,thumbnailWidth:c}){this.container=e,this.eventBus=t,this.id=i,this.renderingId="thumbnail"+i,this.pageLabel=null,this.store=h,this.loaded=!1,this.pdfPage=null,this.rotation=0,this.viewport=n,this.pdfPageRotate=n.rotation,this._optionalContentConfigPromise=s||null,this.pageColors=l||null,this.linkService=r,this.renderingQueue=a,this.renderTask=null,this.renderingState=RenderingStates.INITIAL,this.resume=null;const d=this.viewport.width,u=d/this.viewport.height;this.canvasWidth=c,this.canvasHeight=this.canvasWidth/u|0,this.scale=this.canvasWidth/d,this.l10n=o,this.canvas=null,this.src=null;const p=document.createElement("div");p.className="thumbnail pdfSlickThumbHolder",p.setAttribute("data-page-number",this.id.toString()),this.div=p,e.append(p)}setPdfPage(e){this.pdfPage=e,this.pdfPageRotate=e.rotate;const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:1,rotation:t}),this.reset()}reset(){this.cancelRendering(),this.renderingState=RenderingStates.INITIAL;const e=this.viewport.width,t=e/this.viewport.height;this.canvasHeight=this.canvasWidth/t|0,this.scale=this.canvasWidth/e,this.div.removeAttribute("data-loaded"),this.loaded=!1,this.canvas&&(this.canvas.width=0,this.canvas.height=0,delete this.canvas)}update({rotation:e=null}){"number"==typeof e&&(this.rotation=e);const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:1,rotation:t}),this.reset()}cancelRendering(){this.renderTask&&(this.renderTask.cancel(),this.renderTask=null),this.resume=null}_getPageDrawContext(e=1){const t=document.createElement("canvas"),i=t.getContext("2d",{alpha:!1}),n=new OutputScale;t.width=e*this.canvasWidth*n.sx|0,t.height=e*this.canvasHeight*n.sy|0;return{ctx:i,canvas:t,transform:n.scaled?[n.sx,0,0,n.sy,0,0]:null}}_convertCanvasToImage(e){if(this.renderingState!==RenderingStates.FINISHED)throw new Error("_convertCanvasToImage: Rendering has not finished.");const t=this._reduceImage(e);this.src=t.toDataURL(),this.div.setAttribute("data-loaded","true"),this.loaded=!0,this.store.getState()._setThumbnailView(this.id,this),t.width=0,t.height=0}draw(){if(this.renderingState!==RenderingStates.INITIAL)return console.error("Must be in new state before drawing"),Promise.resolve();const{pdfPage:e}=this;if(!e)return this.renderingState=RenderingStates.FINISHED,Promise.reject(new Error("pdfPage is not loaded"));this.renderingState=RenderingStates.RUNNING;const t=(e=null)=>__awaiter(this,void 0,void 0,(function*(){if(a===this.renderTask&&(this.renderTask=null),!(e instanceof pdfExports.RenderingCancelledException)&&(this.renderingState=RenderingStates.FINISHED,this._convertCanvasToImage(n),e))throw e})),{ctx:i,canvas:n,transform:s}=this._getPageDrawContext(DRAW_UPSCALE_FACTOR),r={canvasContext:i,transform:s,viewport:this.viewport.clone({scale:DRAW_UPSCALE_FACTOR*this.scale}),optionalContentConfigPromise:this._optionalContentConfigPromise,pageColors:this.pageColors},a=this.renderTask=e.render(r);a.onContinue=e=>{if(!this.renderingQueue.isHighestPriority(this))return this.renderingState=RenderingStates.PAUSED,void(this.resume=()=>{this.renderingState=RenderingStates.RUNNING,e()});e()};const o=a.promise.then((function(){return t(null)}),(function(e){return t(e)}));return o.finally((()=>{n.width=0,n.height=0,this.eventBus.dispatch("thumbnailrendered",{source:this,pageNumber:this.id,pdfPage:this.pdfPage})})),o}setImage(e){if(this.renderingState!==RenderingStates.INITIAL)return;const{thumbnailCanvas:t,pdfPage:i,scale:n}=e;t&&(this.pdfPage||this.setPdfPage(i),n<this.scale||(this.renderingState=RenderingStates.FINISHED,this._convertCanvasToImage(t)))}_reduceImage(e){const{ctx:t,canvas:i}=this._getPageDrawContext();if(e.width<=2*i.width)return t.drawImage(e,0,0,e.width,e.height,0,0,i.width,i.height),i;let n=i.width<<MAX_NUM_SCALING_STEPS,s=i.height<<MAX_NUM_SCALING_STEPS;const[r,a]=TempImageFactory.getCanvas(n,s);for(;n>e.width||s>e.height;)n>>=1,s>>=1;for(a.drawImage(e,0,0,e.width,e.height,0,0,n,s);n>2*i.width;)a.drawImage(r,0,0,n,s,0,0,n>>1,s>>1),n>>=1,s>>=1;return t.drawImage(r,0,0,n,s,0,0,i.width,i.height),i}get _thumbPageTitle(){var e;return this.l10n.get("thumb_page_title",{page:null!==(e=this.pageLabel)&&void 0!==e?e:this.id})}get _thumbPageCanvas(){var e;return this.l10n.get("thumb_page_canvas",{page:null!==(e=this.pageLabel)&&void 0!==e?e:this.id})}setPageLabel(e){this.pageLabel="string"==typeof e?e:null}}var _PDFThumbnailViewer_instances,_PDFThumbnailViewer_ensurePdfPageLoaded,_PDFThumbnailViewer_getScrollAhead;const THUMBNAIL_SCROLL_MARGIN=-19,THUMBNAIL_SELECTED_CLASS="selected";class PDFThumbnailViewer{constructor({container:e,eventBus:t,linkService:i,renderingQueue:n,l10n:s,pageColors:r,store:a,thumbnailWidth:o}){_PDFThumbnailViewer_instances.add(this),this.container=e,this.eventBus=t,this.linkService=i,this.renderingQueue=n,this.l10n=s,this.pageColors=r||null,this._thumbnails=[],this._currentPageNumber=0,this._pagesRotation=0,this._pageLabels=[],this.pdfDocument=null,this.store=a,this.thumbnailWidth=o,!this.pageColors||CSS.supports("color",this.pageColors.background)&&CSS.supports("color",this.pageColors.foreground)||((this.pageColors.background||this.pageColors.foreground)&&console.warn("PDFThumbnailViewer: Ignoring `pageColors`-option, since the browser doesn't support the values used."),this.pageColors=null),this.scroll=watchScroll(this.container,this._scrollUpdated.bind(this)),this._resetView()}_scrollUpdated(){this.renderingQueue.renderHighestPriority()}getThumbnail(e){return this._thumbnails[e]}_getVisibleThumbs(){return getVisibleElements({scrollEl:this.container,views:this._thumbnails})}scrollThumbnailIntoView(e){if(!this.pdfDocument)return;const t=this._thumbnails[e-1];if(!t)return void console.error('scrollThumbnailIntoView: Invalid "pageNumber" parameter.');if(e!==this._currentPageNumber){this._thumbnails[this._currentPageNumber-1].div.classList.remove(THUMBNAIL_SELECTED_CLASS),t.div.classList.add(THUMBNAIL_SELECTED_CLASS)}const i=this._getVisibleThumbs(),{first:n,last:s,views:r}=i;if(r.length>0){let i=!1;if(e<=n.id||e>=(null==s?void 0:s.id))i=!0;else for(const{id:t,percent:n}of r)if(t===e){i=n<100;break}i&&scrollIntoView(t.div,{top:THUMBNAIL_SCROLL_MARGIN})}this._currentPageNumber=e,this.forceRendering()}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!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!==RenderingStates.FINISHED&&e.reset();TempImageFactory.destroyCanvas()}_resetView(){this._thumbnails=[],this._currentPageNumber=1,this._pageLabels=[],this._pagesRotation=0,this.container.textContent=""}setDocument(e){if(this.pdfDocument&&(this._cancelRendering(),this._resetView()),this.pdfDocument=e,!e)return;const t=e.getPage(1),i=e.getOptionalContentConfig();t.then((t=>{var n;const s=e.numPages,r=t.getViewport({scale:1});for(let e=1;e<=s;++e){const t=new PDFThumbnailView({container:this.container,eventBus:this.eventBus,id:e,defaultViewport:r.clone(),optionalContentConfigPromise:i,linkService:this.linkService,renderingQueue:this.renderingQueue,l10n:this.l10n,pageColors:this.pageColors,store:this.store,thumbnailWidth:this.thumbnailWidth});this._thumbnails.push(t)}null===(n=this._thumbnails[0])||void 0===n||n.setPdfPage(t);this._thumbnails[this._currentPageNumber-1].div.classList.add(THUMBNAIL_SELECTED_CLASS),this.store.getState()._setThumbnailsViews(this._thumbnails)})).catch((e=>{console.error("Unable to initialize thumbnail viewer",e)}))}_cancelRendering(){for(const e of this._thumbnails)e.cancelRendering()}setPageLabels(e){var t,i;if(this.pdfDocument){e?Array.isArray(e)&&this.pdfDocument.numPages===e.length?this._pageLabels=e:(this._pageLabels=[],console.error("PDFThumbnailViewer_setPageLabels: Invalid page labels.")):this._pageLabels=[];for(let e=0,n=this._thumbnails.length;e<n;e++)this._thumbnails[e].setPageLabel(null!==(i=null===(t=this._pageLabels)||void 0===t?void 0:t[e])&&void 0!==i?i:null)}}forceRendering(){const e=this._getVisibleThumbs(),t=__classPrivateFieldGet(this,_PDFThumbnailViewer_instances,"m",_PDFThumbnailViewer_getScrollAhead).call(this,e),i=this.renderingQueue.getHighestPriority(e,this._thumbnails,t);return!!i&&(__classPrivateFieldGet(this,_PDFThumbnailViewer_instances,"m",_PDFThumbnailViewer_ensurePdfPageLoaded).call(this,i).then((()=>{this.renderingQueue.renderView(i)})),!0)}}var _OverlayManager_overlays,_OverlayManager_active;_PDFThumbnailViewer_instances=new WeakSet,_PDFThumbnailViewer_ensurePdfPageLoaded=function(e){var t;return __awaiter(this,void 0,void 0,(function*(){if(null==e?void 0:e.pdfPage)return e.pdfPage;try{const i=yield null===(t=this.pdfDocument)||void 0===t?void 0:t.getPage(e.id);return(null==e?void 0:e.pdfPage)||e.setPdfPage(i),i}catch(e){return console.error("Unable to get page for thumb view",e),null}}))},_PDFThumbnailViewer_getScrollAhead=function(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};class OverlayManager{constructor(){_OverlayManager_overlays.set(this,new WeakMap),_OverlayManager_active.set(this,null)}get active(){return __classPrivateFieldGet(this,_OverlayManager_active,"f")}register(e,t=!1){return __awaiter(this,void 0,void 0,(function*(){if("object"!=typeof e)throw new Error("Not enough parameters.");if(__classPrivateFieldGet(this,_OverlayManager_overlays,"f").has(e))throw new Error("The overlay is already registered.");__classPrivateFieldGet(this,_OverlayManager_overlays,"f").set(e,{canForceClose:t}),e.addEventListener("cancel",(()=>{__classPrivateFieldSet(this,_OverlayManager_active,null)}))}))}unregister(e){return __awaiter(this,void 0,void 0,(function*(){if(!__classPrivateFieldGet(this,_OverlayManager_overlays,"f").has(e))throw new Error("The overlay does not exist.");if(__classPrivateFieldGet(this,_OverlayManager_active,"f")===e)throw new Error("The overlay cannot be removed while it is active.");__classPrivateFieldGet(this,_OverlayManager_overlays,"f").delete(e)}))}open(e){return __awaiter(this,void 0,void 0,(function*(){if(!__classPrivateFieldGet(this,_OverlayManager_overlays,"f").has(e))throw new Error("The overlay does not exist.");if(__classPrivateFieldGet(this,_OverlayManager_active,"f")){if(__classPrivateFieldGet(this,_OverlayManager_active,"f")===e)throw new Error("The overlay is already active.");if(!__classPrivateFieldGet(this,_OverlayManager_overlays,"f").get(e).canForceClose)throw new Error("Another overlay is currently active.");yield this.close()}__classPrivateFieldSet(this,_OverlayManager_active,e),e.showModal()}))}close(e=__classPrivateFieldGet(this,_OverlayManager_active,"f")){return __awaiter(this,void 0,void 0,(function*(){if(!e||!__classPrivateFieldGet(this,_OverlayManager_overlays,"f").has(e))throw new Error("The overlay does not exist.");if(!__classPrivateFieldGet(this,_OverlayManager_active,"f"))throw new Error("The overlay is currently not active.");if(__classPrivateFieldGet(this,_OverlayManager_active,"f")!==e)throw new Error("Another overlay is currently active.");e.close(),__classPrivateFieldSet(this,_OverlayManager_active,null)}))}}function getXfaHtmlForPrinting(e,t){const i=t.allXfaHtml,n=new pdf_viewerExports.SimpleLinkService,s=Math.round(100*pdfExports.PixelsPerInch.PDF_TO_CSS_UNITS)/100;for(const r of null==i?void 0:i.children){const i=document.createElement("div");i.className="xfaPrintedPage",e.append(i);const a=new pdf_viewerExports.XfaLayerBuilder({pageDiv:i,pdfPage:null,annotationStorage:t.annotationStorage,linkService:n,xfaHtml:r}),o=pdfExports.getXfaPageViewport(r,{scale:s});a.render(o,"print")}}_OverlayManager_overlays=new WeakMap,_OverlayManager_active=new WeakMap;let activeService=null,dialog=null,overlayManager=new OverlayManager;function renderPage(e,t,i,n,s,r,a){const o=activeService.scratchCanvas,l=s/pdfExports.PixelsPerInch.PDF;o.width=Math.floor(n.width*l),o.height=Math.floor(n.height*l);const h=o.getContext("2d");return h.save(),h.fillStyle="rgb(255, 255, 255)",h.fillRect(0,0,o.width,o.height),h.restore(),Promise.all([t.getPage(i),a]).then((function([e,t]){const i={canvasContext:h,transform:[l,0,0,l,0,0],viewport:e.getViewport({scale:1,rotation:n.rotation}),intent:"print",annotationMode:pdfExports.AnnotationMode.ENABLE_STORAGE,optionalContentConfigPromise:r,printAnnotationStorage:t};return e.render(i).promise}))}class PDFPrintService{constructor(e,t,i,n,s=null,r=null,a){this.pdfDocument=e,this.pagesOverview=t,this.printContainer=i,this._printResolution=n||150,this._optionalContentConfigPromise=s||e.getOptionalContentConfig(),this._printAnnotationStoragePromise=r||Promise.resolve(),this.l10n=a,this.currentPage=-1,this.scratchCanvas=document.createElement("canvas")}layout(){this.throwIfInactive();const e=document.querySelector("body");null==e||e.setAttribute("data-pdfjsprinting","true");this.pagesOverview.every((e=>e.width===this.pagesOverview[0].width&&e.height===this.pagesOverview[0].height),this)||console.warn("Not all pages have the same size. The printed result may be incorrect!"),this.pageStyleSheet=document.createElement("style");const t=this.pagesOverview[0];this.pageStyleSheet.textContent="@page { size: "+t.width+"pt "+t.height+"pt;}",null==e||e.append(this.pageStyleSheet)}destroy(){if(activeService!==this)return;this.printContainer.textContent="";const e=document.querySelector("body");null==e||e.removeAttribute("data-pdfjsprinting"),this.pageStyleSheet&&(this.pageStyleSheet.remove(),this.pageStyleSheet=null),this.scratchCanvas.width=this.scratchCanvas.height=0,this.scratchCanvas=null,activeService=null,ensureOverlay().then((function(){overlayManager.active===dialog&&overlayManager.close(dialog)}))}renderPages(){if(this.pdfDocument.isPureXfa)return getXfaHtmlForPrinting(this.printContainer,this.pdfDocument),Promise.resolve();const e=this.pagesOverview.length,t=(i,n)=>{if(this.throwIfInactive(),++this.currentPage>=e)return renderProgress(e,e,this.l10n),void i();const s=this.currentPage;renderProgress(s,e,this.l10n),renderPage(this,this.pdfDocument,s+1,this.pagesOverview[s],this._printResolution,this._optionalContentConfigPromise,this._printAnnotationStoragePromise).then(this.useRenderedPage.bind(this)).then((function(){t(i,n)}),n)};return new Promise(t)}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");return i.className="printedPage",i.append(e),this.printContainer.append(i),new Promise((function(t,i){e.onload=t,e.onerror=i}))}performPrint(){return this.throwIfInactive(),new Promise((e=>{setTimeout((()=>{this.active?(print.call(window),setTimeout(e,20)):e()}),0)}))}get active(){return this===activeService}throwIfInactive(){if(!this.active)throw new Error("This print request was cancelled or completed.")}}const print=window.print;function dispatchEvent(e){const t=document.createEvent("CustomEvent");t.initCustomEvent(e,!1,!1,"custom"),window.dispatchEvent(t)}function abort(){activeService&&(activeService.destroy(),dispatchEvent("afterprint"))}function renderProgress(e,t,i){dialog||(dialog=document.getElementById("printServiceDialog"));const n=Math.round(100*e/t),s=dialog.querySelector("progress"),r=dialog.querySelector(".relative-progress");s.value=n,i.get("print_progress_percent",{progress:n}).then((e=>{r.textContent=e}))}if(window.print=function(){if(activeService)console.warn("Ignored window.print() because of a pending print job.");else{ensureOverlay().then((function(){activeService&&overlayManager.open(dialog)}));try{dispatchEvent("beforeprint")}finally{if(!activeService)return console.error("Expected print service to be initialized."),void ensureOverlay().then((function(){overlayManager.active===dialog&&overlayManager.close(dialog)}));const e=activeService;activeService.renderPages().then((function(){return e.performPrint()})).catch((function(){})).then((function(){e.active&&abort()}))}}},window.addEventListener("keydown",(function(e){80!==e.keyCode||!e.ctrlKey&&!e.metaKey||e.altKey||e.shiftKey||(window.print(),e.preventDefault(),e.stopImmediatePropagation())}),!0),"onbeforeprint"in window){const e=function(e){"custom"!==e.detail&&e.stopImmediatePropagation()};window.addEventListener("beforeprint",e),window.addEventListener("afterprint",e)}let overlayPromise;function ensureOverlay(){if(!overlayPromise){if(!overlayManager)throw new Error("The overlay manager has not yet been initialized.");dialog||(dialog=document.getElementById("printServiceDialog")),overlayPromise=overlayManager.register(dialog,!0),document.getElementById("printCancel").onclick=abort,dialog.addEventListener("close",abort)}return overlayPromise}const PDFPrintServiceFactory={instance:{supportsPrinting:!0,createPrintService(e,t,i,n,s,r,a){if(activeService)throw new Error("The print service is created and active.");return activeService=new PDFPrintService(e,t,i,n,s,r,a),activeService}}};var _PDFPresentationMode_instances,_PDFPresentationMode_state,_PDFPresentationMode_args,_PDFPresentationMode_mouseWheel,_PDFPresentationMode_notifyStateChange,_PDFPresentationMode_enter,_PDFPresentationMode_exit,_PDFPresentationMode_mouseDown,_PDFPresentationMode_contextMenu,_PDFPresentationMode_showControls,_PDFPresentationMode_hideControls,_PDFPresentationMode_resetMouseScrollState,_PDFPresentationMode_touchSwipe,_PDFPresentationMode_addWindowListeners,_PDFPresentationMode_removeWindowListeners,_PDFPresentationMode_fullscreenChange,_PDFPresentationMode_addFullscreenChangeListeners,_PDFPresentationMode_removeFullscreenChangeListeners;const DELAY_BEFORE_HIDING_CONTROLS=3e3,ACTIVE_SELECTOR="pdfPresentationMode",CONTROLS_SELECTOR="pdfPresentationModeControls",MOUSE_SCROLL_COOLDOWN_TIME=50,PAGE_SWITCH_THRESHOLD=.1,SWIPE_MIN_DISTANCE_THRESHOLD=50,SWIPE_ANGLE_THRESHOLD=Math.PI/6;class PDFPresentationMode{constructor({container:e,pdfViewer:t,eventBus:i}){_PDFPresentationMode_instances.add(this),_PDFPresentationMode_state.set(this,PresentationModeState.UNKNOWN),_PDFPresentationMode_args.set(this,null),this.container=e,this.pdfViewer=t,this.eventBus=i,this.contextMenuOpen=!1,this.mouseScrollTimeStamp=0,this.mouseScrollDelta=0,this.touchSwipeState=null}request(){return __awaiter(this,void 0,void 0,(function*(){const{container:e,pdfViewer:t}=this;if(this.active||!t.pagesCount||!e.requestFullscreen)return!1;__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_addFullscreenChangeListeners).call(this),__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_notifyStateChange).call(this,PresentationModeState.CHANGING);const i=e.requestFullscreen();__classPrivateFieldSet(this,_PDFPresentationMode_args,{pageNumber:t.currentPageNumber,scaleValue:t.currentScaleValue,scrollMode:t.scrollMode,spreadMode:null,annotationEditorMode:null}),t.spreadMode===SpreadMode.NONE||t.pageViewsReady&&t.hasEqualPageSizes||(console.warn("Ignoring Spread modes when entering PresentationMode, since the document may contain varying page sizes."),__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").spreadMode=t.spreadMode),t.annotationEditorMode!==pdfExports.AnnotationEditorType.DISABLE&&(__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").annotationEditorMode=t.annotationEditorMode);try{return yield i,t.focus(),!0}catch(e){__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_removeFullscreenChangeListeners).call(this),__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_notifyStateChange).call(this,PresentationModeState.NORMAL)}return!1}))}get active(){return __classPrivateFieldGet(this,_PDFPresentationMode_state,"f")===PresentationModeState.CHANGING||__classPrivateFieldGet(this,_PDFPresentationMode_state,"f")===PresentationModeState.FULLSCREEN}}_PDFPresentationMode_state=new WeakMap,_PDFPresentationMode_args=new WeakMap,_PDFPresentationMode_instances=new WeakSet,_PDFPresentationMode_mouseWheel=function(e){if(!this.active)return;e.preventDefault();const t=normalizeWheelEventDelta(e),i=Date.now(),n=this.mouseScrollTimeStamp;if(!(i>n&&i-n<MOUSE_SCROLL_COOLDOWN_TIME)&&((this.mouseScrollDelta>0&&t<0||this.mouseScrollDelta<0&&t>0)&&__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_resetMouseScrollState).call(this),this.mouseScrollDelta+=t,Math.abs(this.mouseScrollDelta)>=PAGE_SWITCH_THRESHOLD)){const e=this.mouseScrollDelta;__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_resetMouseScrollState).call(this);(e>0?this.pdfViewer.previousPage():this.pdfViewer.nextPage())&&(this.mouseScrollTimeStamp=i)}},_PDFPresentationMode_notifyStateChange=function(e){__classPrivateFieldSet(this,_PDFPresentationMode_state,e),this.eventBus.dispatch("presentationmodechanged",{source:this,state:e})},_PDFPresentationMode_enter=function(){var e;__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_notifyStateChange).call(this,PresentationModeState.FULLSCREEN),this.container.classList.add(ACTIVE_SELECTOR),setTimeout((()=>{this.pdfViewer.scrollMode=ScrollMode.PAGE,null!==__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").spreadMode&&(this.pdfViewer.spreadMode=SpreadMode.NONE),this.pdfViewer.currentPageNumber=__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").pageNumber,this.pdfViewer.currentScaleValue="page-fit",null!==__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").annotationEditorMode&&(this.pdfViewer.annotationEditorMode=pdfExports.AnnotationEditorType.NONE)}),0),__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_addWindowListeners).call(this),__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_showControls).call(this),this.contextMenuOpen=!1,null===(e=window.getSelection())||void 0===e||e.removeAllRanges()},_PDFPresentationMode_exit=function(){const e=this.pdfViewer.currentPageNumber;this.container.classList.remove(ACTIVE_SELECTOR),setTimeout((()=>{var t;__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_removeFullscreenChangeListeners).call(this),__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_notifyStateChange).call(this,PresentationModeState.NORMAL),this.pdfViewer.scrollMode=__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").scrollMode,null!==(null===(t=__classPrivateFieldGet(this,_PDFPresentationMode_args,"f"))||void 0===t?void 0:t.spreadMode)&&(this.pdfViewer.spreadMode=__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").spreadMode),this.pdfViewer.currentScaleValue=__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").scaleValue,this.pdfViewer.currentPageNumber=e,null!==__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").annotationEditorMode&&(this.pdfViewer.annotationEditorMode=__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").annotationEditorMode),__classPrivateFieldSet(this,_PDFPresentationMode_args,null)}),0),__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_removeWindowListeners).call(this),__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_hideControls).call(this),__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_resetMouseScrollState).call(this),this.contextMenuOpen=!1},_PDFPresentationMode_mouseDown=function(e){var t;if(this.contextMenuOpen)return this.contextMenuOpen=!1,void e.preventDefault();0===e.button&&(e.target.href&&(null===(t=e.target.parentNode)||void 0===t?void 0:t.hasAttribute("data-internal-link"))||(e.preventDefault(),e.shiftKey?this.pdfViewer.previousPage():this.pdfViewer.nextPage()))},_PDFPresentationMode_contextMenu=function(){this.contextMenuOpen=!0},_PDFPresentationMode_showControls=function(){this.controlsTimeout?clearTimeout(this.controlsTimeout):this.container.classList.add(CONTROLS_SELECTOR),this.controlsTimeout=setTimeout((()=>{this.container.classList.remove(CONTROLS_SELECTOR),delete this.controlsTimeout}),DELAY_BEFORE_HIDING_CONTROLS)},_PDFPresentationMode_hideControls=function(){this.controlsTimeout&&(clearTimeout(this.controlsTimeout),this.container.classList.remove(CONTROLS_SELECTOR),delete this.controlsTimeout)},_PDFPresentationMode_resetMouseScrollState=function(){this.mouseScrollTimeStamp=0,this.mouseScrollDelta=0},_PDFPresentationMode_touchSwipe=function(e){if(this.active)if(e.touches.length>1)this.touchSwipeState=null;else switch(e.type){case"touchstart":this.touchSwipeState={startX:e.touches[0].pageX,startY:e.touches[0].pageY,endX:e.touches[0].pageX,endY:e.touches[0].pageY};break;case"touchmove":if(null===this.touchSwipeState)return;this.touchSwipeState.endX=e.touches[0].pageX,this.touchSwipeState.endY=e.touches[0].pageY,e.preventDefault();break;case"touchend":if(null===this.touchSwipeState)return;let t=0;const i=this.touchSwipeState.endX-this.touchSwipeState.startX,n=this.touchSwipeState.endY-this.touchSwipeState.startY,s=Math.abs(Math.atan2(n,i));Math.abs(i)>SWIPE_MIN_DISTANCE_THRESHOLD&&(s<=SWIPE_ANGLE_THRESHOLD||s>=Math.PI-SWIPE_ANGLE_THRESHOLD)?t=i:Math.abs(n)>SWIPE_MIN_DISTANCE_THRESHOLD&&Math.abs(s-Math.PI/2)<=SWIPE_ANGLE_THRESHOLD&&(t=n),t>0?this.pdfViewer.previousPage():t<0&&this.pdfViewer.nextPage()}},_PDFPresentationMode_addWindowListeners=function(){this.showControlsBind=__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_showControls).bind(this),this.mouseDownBind=__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_mouseDown).bind(this),this.mouseWheelBind=__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_mouseWheel).bind(this),this.resetMouseScrollStateBind=__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_resetMouseScrollState).bind(this),this.contextMenuBind=__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_contextMenu).bind(this),this.touchSwipeBind=__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_touchSwipe).bind(this),window.addEventListener("mousemove",this.showControlsBind),window.addEventListener("mousedown",this.mouseDownBind),window.addEventListener("wheel",this.mouseWheelBind,{passive:!1}),window.addEventListener("keydown",this.resetMouseScrollStateBind),window.addEventListener("contextmenu",this.contextMenuBind),window.addEventListener("touchstart",this.touchSwipeBind),window.addEventListener("touchmove",this.touchSwipeBind),window.addEventListener("touchend",this.touchSwipeBind)},_PDFPresentationMode_removeWindowListeners=function(){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},_PDFPresentationMode_fullscreenChange=function(){document.fullscreenElement?__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_enter).call(this):__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_exit).call(this)},_PDFPresentationMode_addFullscreenChangeListeners=function(){this.fullscreenChangeBind=__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_fullscreenChange).bind(this),window.addEventListener("fullscreenchange",this.fullscreenChangeBind)},_PDFPresentationMode_removeFullscreenChangeListeners=function(){window.removeEventListener("fullscreenchange",this.fullscreenChangeBind),delete this.fullscreenChangeBind};const initialState={isDocumentLoaded:!1,pagesReady:!1,url:null,numPages:0,pageNumber:0,scale:0,scaleValue:"auto",pagesRotation:0,spreadMode:SpreadMode.UNKNOWN,scrollMode:ScrollMode.UNKNOWN,documentOutline:null,attachments:new Map,thumbnails:new Map,thumbnailViews:new Map,annotationEditorMode:pdfExports.AnnotationEditorType.NONE,pdfSlick:null},create=()=>createStore$1(((e,t)=>Object.assign(Object.assign({},initialState),{_setThumbnailView:(i,n)=>{const s=new Map(t().thumbnails),r=new Map(t().thumbnailViews),{canvasWidth:a,canvasHeight:o,scale:l,rotation:h,loaded:c,pageLabel:d,src:u=null}=n;r.set(i,n),s.set(i,{pageNumber:i,width:a,height:o,scale:l,rotation:h,loaded:c,pageLabel:d,src:u}),e({thumbnailViews:r,thumbnails:s})},_setThumbnailsViews:t=>{const i=new Map(t.map((e=>[e.id,e]))),n=new Map(t.map((e=>{const{canvasWidth:t,canvasHeight:i,scale:n,rotation:s,loaded:r,pageLabel:a,src:o=null}=e;return[e.id,{pageNumber:e.id,width:t,height:i,scale:n,rotation:s,loaded:r,pageLabel:a,src:o}]})));e({thumbnailViews:i,thumbnails:n})}})));var _PDFSlick_instances,_PDFSlick_renderingQueue,_PDFSlick_container,_PDFSlick_viewerContainer,_PDFSlick_thumbsContainer,_PDFSlick_annotationMode,_PDFSlick_annotationEditorMode,_PDFSlick_initializePageLabels,_PDFSlick_parseDocumentInfo,_PDFSlick_parsePageSize,_PDFSlick_initInternalEventListeners,_PDFSlick_onDocumentReady,_PDFSlick_onRotationChanging,_PDFSlick_onSwitchSpreadMode,_PDFSlick_onSwitchScrollMode,_PDFSlick_onScaleChanging,_PDFSlick_onPageChanging,_PDFSlick_onPageRendered;pdfExports.GlobalWorkerOptions.workerSrc=new URL("pdfjs-dist/build/pdf.worker.js","undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:_documentCurrentScript&&_documentCurrentScript.src||new URL("index.js",document.baseURI).href).toString();const US_PAGE_NAMES={"8.5x11":"Letter","8.5x14":"Legal"},METRIC_PAGE_NAMES={"297x420":"A3","210x297":"A4"};function getPageName(e,t,i){return i[`${t?e.width:e.height}x${t?e.height:e.width}`]}class PDFSlick{constructor({container:e,viewer:t,thumbs:i,store:n=create(),options:s}){var r,a,o,l,h,c,d,u,p,g,f,m,_;_PDFSlick_instances.add(this),_PDFSlick_renderingQueue.set(this,void 0),_PDFSlick_container.set(this,void 0),_PDFSlick_viewerContainer.set(this,void 0),_PDFSlick_thumbsContainer.set(this,void 0),this.downloadManager=null,this.findController=null,this.pdfPresentationMode=null,this.document=null,_PDFSlick_annotationMode.set(this,void 0),_PDFSlick_annotationEditorMode.set(this,void 0),__classPrivateFieldSet(this,_PDFSlick_container,e),__classPrivateFieldSet(this,_PDFSlick_viewerContainer,t),__classPrivateFieldSet(this,_PDFSlick_thumbsContainer,i),this.l10n=null!==(r=null==s?void 0:s.l10n)&&void 0!==r?r:pdf_viewerExports.NullL10n,this.downloadManager=new pdf_viewerExports.DownloadManager,this.textLayerMode=null!==(a=null==s?void 0:s.textLayerMode)&&void 0!==a?a:TextLayerMode.ENABLE,__classPrivateFieldSet(this,_PDFSlick_annotationMode,null!==(o=null==s?void 0:s.annotationMode)&&void 0!==o?o:pdfExports.AnnotationMode.ENABLE_FORMS),__classPrivateFieldSet(this,_PDFSlick_annotationEditorMode,null!==(l=null==s?void 0:s.annotationEditorMode)&&void 0!==l?l:pdfExports.AnnotationEditorType.NONE),this.removePageBorders=null!==(h=null==s?void 0:s.removePageBorders)&&void 0!==h&&h,this.singlePageViewer=null!==(c=null==s?void 0:s.singlePageViewer)&&void 0!==c&&c,this.enablePrintAutoRotate=null!==(d=null==s?void 0:s.enablePrintAutoRotate)&&void 0!==d&&d,this.useOnlyCssZoom=null!==(u=null==s?void 0:s.useOnlyCssZoom)&&void 0!==u&&u,this.pageColors=null!==(p=null==s?void 0:s.pageColors)&&void 0!==p?p:null,this.maxCanvasPixels=null!==(g=null==s?void 0:s.maxCanvasPixels)&&void 0!==g?g:16777216,this.printResolution=null!==(f=null==s?void 0:s.printResolution)&&void 0!==f?f:96,this.thumbnailWidth=null!==(m=null==s?void 0:s.thumbnailWidth)&&void 0!==m?m:125,!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.l10n=pdf_viewerExports.NullL10n,this.store=n;const v=new PDFRenderingQueue;v.onIdle=this._cleanup.bind(this),v.isThumbnailViewEnabled=!0,__classPrivateFieldSet(this,_PDFSlick_renderingQueue,v);const b=new pdf_viewerExports.EventBus,y=new pdf_viewerExports.PDFLinkService({eventBus:b,externalLinkTarget:2,externalLinkRel:"noopener noreferrer nofollow",ignoreDestinationZoom:!1}),S=Object.assign(Object.assign({container:e},t&&{viewer:t}),{eventBus:b,linkService:y,renderingQueue:v,defaultRenderingQueue:!0,textLayerMode:this.textLayerMode,l10n:this.l10n,annotationMode:__classPrivateFieldGet(this,_PDFSlick_annotationMode,"f"),annotationEditorMode:__classPrivateFieldGet(this,_PDFSlick_annotationEditorMode,"f"),removePageBorders:this.removePageBorders,imageResourcesPath:"/images/",useOnlyCssZoom:this.useOnlyCssZoom}),P=this.singlePageViewer?new pdf_viewerExports.PDFSinglePageViewer(S):new pdf_viewerExports.PDFViewer(S);v.setViewer(P),i&&(this.thumbnailViewer=new PDFThumbnailViewer({container:i,eventBus:b,linkService:y,renderingQueue:v,l10n:this.l10n,pageColors:this.pageColors,store:n,thumbnailWidth:this.thumbnailWidth}),v.setThumbnailViewer(this.thumbnailViewer)),document.fullscreenEnabled&&(this.pdfPresentationMode=new PDFPresentationMode({container:e,pdfViewer:P,eventBus:b})),this.eventBus=b,this.linkService=y,this.viewer=P,this.linkService.setViewer(P);const A=null!==(_=null==s?void 0:s.scaleValue)&&void 0!==_?_:"auto";this.store.setState({scaleValue:A})}loadDocument(e,t){var i,n,s,r,a;return __awaiter(this,void 0,void 0,(function*(){if(this.url&&"string"==typeof this.url)try{URL.revokeObjectURL(this.url)}catch(e){}null===(i=this.document)||void 0===i||i.destroy(),null===(n=this.viewer)||void 0===n||n.cleanup(),e instanceof URL?this.url=e.toString():this.url=e;const o=null!==(s=null==t?void 0:t.filename)&&void 0!==s?s:pdfExports.getPdfFilenameFromUrl(null===(r=this.url)||void 0===r?void 0:r.toString());this.filename=o;const l=yield pdfExports.getDocument(e).promise;this.document=l,this.viewer.setDocument(this.document),this.linkService.setDocument(this.document),this.thumbnailViewer&&(null===(a=this.thumbnailViewer)||void 0===a||a.setDocument(l)),__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_initInternalEventListeners).call(this),yield __classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_initializePageLabels).call(this),this.store.setState({filename:o,numPages:l.numPages,pageNumber:1,isDocumentLoaded:!0,url:e.toString()});const h=yield l.getAttachments(),c=new Map(Object.keys(null!=h?h:{}).sort(((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))).map((e=>[e,h[e]])));this.store.setState({attachments:c}),yield __classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_parseDocumentInfo).call(this),this.forceRendering()}))}forceRendering(e=!0){__classPrivateFieldGet(this,_PDFSlick_renderingQueue,"f").printing=!!this.printService,__classPrivateFieldGet(this,_PDFSlick_renderingQueue,"f").isThumbnailViewEnabled=e,__classPrivateFieldGet(this,_PDFSlick_renderingQueue,"f").renderHighestPriority()}gotoPage(e){this.linkService.goToPage(e)}openOrDownloadData(e,t,i){var n;null===(n=this.downloadManager)||void 0===n||n.openOrDownloadData(e,t,i)}download(){var e,t;return __awaiter(this,void 0,void 0,(function*(){const i=this.url,{filename:n}=this;try{const t=yield this.document.getData(),s=new Blob([t],{type:"application/pdf"});yield null===(e=this.downloadManager)||void 0===e?void 0:e.download(s,i,n,{})}catch(e){yield null===(t=this.downloadManager)||void 0===t?void 0:t.downloadUrl(i,n,{})}}))}save(){var e;return __awaiter(this,void 0,void 0,(function*(){const t=this.url,{filename:i}=this;try{const n=yield this.document.saveDocument(),s=new Blob([n],{type:"application/pdf"});yield null===(e=this.downloadManager)||void 0===e?void 0:e.download(s,t,i,{})}catch(e){console.error(`Error when saving the document: ${e.message}`),yield this.download()}}))}downloadOrSave(){var e;const{annotationStorage:t}=null!==(e=this.document)&&void 0!==e?e:{};t&&t.size>0?this.save():this.download()}get supportsPrinting(){return PDFPrintServiceFactory.instance.supportsPrinting}beforePrint(){if(this.printService)return;if(!this.supportsPrinting)return;if(!this.viewer.pageViewsReady)return void this.l10n.get("printing_not_ready").then((e=>{window.alert(e)}));const e=this.viewer.getPagesOverview(),t=document.getElementById("printContainer"),i=this.printResolution,n=this.viewer.optionalContentConfigPromise,s=PDFPrintServiceFactory.instance.createPrintService(this.document,e,t,i,n,null,this.l10n);this.printService=s,this.forceRendering(),s.layout()}afterPrint(){var e;this.printService&&(this.printService.destroy(),this.printService=null,null===(e=this.document)||void 0===e||e.annotationStorage.resetModified()),this.forceRendering()}requestPresentationMode(){var e;null===(e=this.pdfPresentationMode)||void 0===e||e.request()}triggerPrinting(){this.supportsPrinting&&window.print()}_cleanup(){var e;if(this.document)try{this.viewer.cleanup(),null===(e=this.thumbnailViewer)||void 0===e||e.cleanup(),this.document.cleanup()}catch(e){console.error("Unable to perform cleanup",e)}}setAnnotationEditorMode(e){this.viewer.annotationEditorMode={mode:e},this.store.setState({annotationEditorMode:e})}setAnnotationEditorParams(e){const t=Array.isArray(e)?e:[e];for(const e of t)this.viewer.annotationEditorParams=e}setSpreadMode(e){isValidSpreadMode(e)&&(this.viewer.spreadMode=e,this.dispatch("switchspreadmode",{mode:e}))}setScrollMode(e){isValidScrollMode(e)&&(this.viewer.scrollMode=e,this.dispatch("switchscrollmode",{mode:e}))}setRotation(e){isValidRotation(e)&&(this.viewer.pagesRotation=e)}getPagesOverview(){var e,t;try{return null!==(t=null===(e=this.viewer)||void 0===e?void 0:e.getPagesOverview())&&void 0!==t?t:[]}catch(e){return[]}}increaseScale(){this.viewer.increaseScale()}decreaseScale(){this.viewer.decreaseScale()}set currentScaleValue(e){this.viewer.currentScaleValue=e}set currentScale(e){this.viewer.currentScale=e}getPageView(e){return this.viewer.getPageView(e)}on(e,t,i){this.eventBus.on(e,t,i)}off(e,t,i){this.eventBus.off(e,t,i)}dispatch(e,t){this.eventBus.dispatch(e,t)}}_PDFSlick_renderingQueue=new WeakMap,_PDFSlick_container=new WeakMap,_PDFSlick_viewerContainer=new WeakMap,_PDFSlick_thumbsContainer=new WeakMap,_PDFSlick_annotationMode=new WeakMap,_PDFSlick_annotationEditorMode=new WeakMap,_PDFSlick_instances=new WeakSet,_PDFSlick_initializePageLabels=function(){var e;return __awaiter(this,void 0,void 0,(function*(){const t=this.document,i=null!==(e=yield t.getPageLabels())&&void 0!==e?e:[],n=i.length;let s=0,r=0;for(let e=0;e<n;e++){const t=i[e];if(t===(e+1).toString())s++;else{if(""!==t)break;r++}}if(s>=n||r>=n)return;const{viewer:a,thumbnailViewer:o}=this;a.setPageLabels(i),null==o||o.setPageLabels(i)}))},_PDFSlick_parseDocumentInfo=function(){return __awaiter(this,void 0,void 0,(function*(){const{info:e,contentLength:t}=yield this.document.getMetadata(),i=yield this.document.getPage(this.store.getState().pageNumber).then((e=>__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_parsePageSize).call(this,getPageSizeInches(e),0)));this.store.setState({filesize:t,title:e.Title,author:e.Author,subject:e.Subject,keywords:e.Keywords,creator:e.Creator,producer:e.Producer,version:e.PDFFormatVersion,creationDate:pdfExports.PDFDateString.toDateObject(e.CreationDate),modificationDate:pdfExports.PDFDateString.toDateObject(e.ModDate),isLinearized:e.IsLinearized,pageSize:i})}))},_PDFSlick_parsePageSize=function(e,t){return __awaiter(this,void 0,void 0,(function*(){if(!e)return;t%180!=0&&(e={width:e.height,height:e.width});const i=isPortraitOrientation(e);let n={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},r=getPageName(n,i,US_PAGE_NAMES)||getPageName(s,i,METRIC_PAGE_NAMES);if(!(r||Number.isInteger(s.width)&&Number.isInteger(s.height))){const t={width:25.4*e.width,height:25.4*e.height},a={width:Math.round(s.width),height:Math.round(s.height)};Math.abs(t.width-a.width)<.1&&Math.abs(t.height-a.height)<.1&&(r=getPageName(a,i,METRIC_PAGE_NAMES),r&&(n={width:Math.round(a.width/25.4*100)/100,height:Math.round(a.height/25.4*100)/100},s=a))}const[{width:a,height:o},l,h,c]=yield Promise.all([n,this.l10n.get("document_properties_page_size_unit_inches"),r&&this.l10n.get(`document_properties_page_size_name_${r.toLowerCase()}`),this.l10n.get("document_properties_page_size_orientation_"+(i?"portrait":"landscape"))]);return{width:a.toLocaleString(),height:o.toLocaleString(),unit:l,name:h,orientation:c}}))},_PDFSlick_initInternalEventListeners=function(){this.eventBus._on("pagesinit",__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_onDocumentReady).bind(this)),this.eventBus._on("scalechanging",__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_onScaleChanging).bind(this)),this.eventBus._on("pagechanging",__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_onPageChanging).bind(this)),this.eventBus._on("pagerendered",__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_onPageRendered).bind(this)),this.eventBus._on("rotationchanging",__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_onRotationChanging).bind(this)),this.eventBus._on("switchspreadmode",__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_onSwitchSpreadMode).bind(this)),this.eventBus._on("switchscrollmode",__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_onSwitchScrollMode).bind(this)),this.eventBus._on("beforeprint",this.beforePrint.bind(this)),this.eventBus._on("afterprint",this.afterPrint.bind(this)),window.onbeforeprint=e=>{this.eventBus.dispatch("beforeprint",{source:window})},window.onafterprint=e=>{this.eventBus.dispatch("afterprint",{source:window})}},_PDFSlick_onDocumentReady=function({source:e}){var t;return __awaiter(this,void 0,void 0,(function*(){const i=yield null===(t=this.document)||void 0===t?void 0:t.getOutline(),n=this.store.getState().scaleValue;e.currentScale=1,e.currentScaleValue="auto",this.store.setState({documentOutline:i,pageNumber:1,scaleValue:n,pagesReady:!0})}))},_PDFSlick_onRotationChanging=function({pagesRotation:e,pageNumber:t}){this.store.setState({pagesRotation:e}),this.thumbnailViewer&&(this.thumbnailViewer.pagesRotation=e),this.forceRendering(),this.viewer.currentPageNumber=t},_PDFSlick_onSwitchSpreadMode=function({mode:e}){this.store.setState({spreadMode:e})},_PDFSlick_onSwitchScrollMode=function({mode:e}){this.store.setState({scrollMode:e})},_PDFSlick_onScaleChanging=function({scale:e,presetValue:t}){this.store.setState({scale:e,scaleValue:t}),this.viewer.update()},_PDFSlick_onPageChanging=function({pageNumber:e}){var t;null===(t=this.thumbnailViewer)||void 0===t||t.scrollThumbnailIntoView(e),this.store.setState({pageNumber:e})},_PDFSlick_onPageRendered=function({pageNumber:e,error:t}){var i;if(__classPrivateFieldGet(this,_PDFSlick_thumbsContainer,"f")){const t=this.viewer.getPageView(e-1),n=null===(i=this.thumbnailViewer)||void 0===i?void 0:i.getThumbnail(e-1);t&&n&&n.setImage(t)}};var noop=function(){},isBrowser="undefined"!=typeof window,useIsomorphicLayoutEffect=isBrowser?React.useLayoutEffect:React.useEffect;function useTimeoutFn(e,t){var i=React.useRef(!1),n=React.useRef(),s=React.useRef(e),r=React.useCallback((function(){return i.current}),[]),a=React.useCallback((function(){i.current=!1,n.current&&clearTimeout(n.current),n.current=setTimeout((function(){i.current=!0,s.current()}),t)}),[t]),o=React.useCallback((function(){i.current=null,n.current&&clearTimeout(n.current)}),[]);return React.useEffect((function(){s.current=e}),[e]),React.useEffect((function(){return a(),o}),[t]),[r,o,a]}function useDebounce(e,t,i){void 0===i&&(i=[]);var n=useTimeoutFn(e,t),s=n[0],r=n[1],a=n[2];return React.useEffect(a,i),[s,r]}var defaultState={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};function useMeasure(){var e=React.useState(null),t=e[0],i=e[1],n=React.useState(defaultState),s=n[0],r=n[1],a=React.useMemo((function(){return new window.ResizeObserver((function(e){if(e[0]){var t=e[0].contentRect,i=t.x,n=t.y,s=t.width,a=t.height,o=t.top,l=t.left,h=t.bottom,c=t.right;r({x:i,y:n,width:s,height:a,top:o,left:l,bottom:h,right:c})}}))}),[]);return useIsomorphicLayoutEffect((function(){if(t)return a.observe(t),function(){a.disconnect()}}),[t]),[i,s]}var useMeasure$1=isBrowser&&void 0!==window.ResizeObserver?useMeasure:function(){return[noop,defaultState]};function PDFSlickViewer({usePDFSlickStore:e,viewerRef:t,className:i}){const n=e((e=>e.pdfSlick)),s=e((e=>e.scaleValue)),[r,{width:a}]=useMeasure$1();return useDebounce((()=>{a&&(!n||"auto"!==s&&"page-fit"!==s&&"page-width"!==s||(n.viewer.currentScaleValue=s),null==n||n.viewer.update())}),0,[a]),jsxRuntime.jsx("div",Object.assign({ref:e=>{t(e),r(e)},id:"viewerContainer",className:`pdfSlickContainer ${null!=i?i:""}`,style:{position:"absolute",inset:0}},{children:jsxRuntime.jsx("div",{id:"viewer",className:"pdfSlickViewer pdfViewer"})}))}function PDFSlickThumbnails({children:e,thumbsRef:t,usePDFSlickStore:i,className:n}){const s=i((e=>e.thumbnailViews)),r=i((e=>e.pdfSlick)),[a,{width:o}]=useMeasure$1();return useDebounce((()=>{o&&(null==r||r.forceRendering())}),0,[o]),jsxRuntime.jsx("div",Object.assign({ref:e=>{t(e),a(e)}},{className:n},{style:{position:"absolute",overflow:"auto",inset:0}},{children:Array.from(s).map((([t,i])=>{var n;return reactDom.createPortal(e({pageNumber:t,width:i.canvasWidth,height:i.canvasHeight,scale:i.scale,src:null!==(n=null==i?void 0:i.src)&&void 0!==n?n:null,rotation:i.rotation,pageLabel:i.pageLabel,loaded:i.loaded}),i.div)}))}))}function createStore(e){return function(t,i){return useStore(e,t,i)}}const usePDFSlick=(e,t)=>{const[i,n]=React.useState(!1),[s,r]=React.useState(null),[a,o]=React.useState(null),l=React.useMemo((()=>create()),[]),h=React.useMemo((()=>createStore(l)),[]),c=React.useCallback((e=>{null!==e&&r(e)}),[]),d=React.useCallback((e=>{null!==e&&o(e)}),[]);return React.useEffect((()=>{if(e&&s){const i=new PDFSlick({container:s,thumbs:a,store:l,options:t});i.loadDocument(e,t).then((()=>n(!0))),l.setState({pdfSlick:i})}return()=>{}}),[e,s]),{isDocumentLoaded:i,viewerRef:c,thumbsRef:d,usePDFSlickStore:h,store:l,PDFSlickViewer:PDFSlickViewer,PDFSlickThumbnails:PDFSlickThumbnails}};exports.AutoPrintRegExp=AutoPrintRegExp,exports.CursorTool=CursorTool,exports.DEFAULT_SCALE=DEFAULT_SCALE,exports.DEFAULT_SCALE_DELTA=DEFAULT_SCALE_DELTA,exports.DEFAULT_SCALE_VALUE=DEFAULT_SCALE_VALUE,exports.MAX_AUTO_SCALE=MAX_AUTO_SCALE,exports.MAX_SCALE=MAX_SCALE,exports.MIN_SCALE=MIN_SCALE,exports.OutputScale=OutputScale,exports.PDFSlick=PDFSlick,exports.PDFSlickThumbnails=PDFSlickThumbnails,exports.PDFSlickViewer=PDFSlickViewer,exports.PresentationModeState=PresentationModeState,exports.ProgressBar=ProgressBar,exports.RendererType=RendererType,exports.RenderingStates=RenderingStates,exports.SCROLLBAR_PADDING=SCROLLBAR_PADDING,exports.ScrollMode=ScrollMode,exports.SidebarView=SidebarView,exports.SpreadMode=SpreadMode,exports.TextLayerMode=TextLayerMode,exports.UNKNOWN_SCALE=UNKNOWN_SCALE,exports.VERTICAL_PADDING=VERTICAL_PADDING,exports.animationStarted=animationStarted,exports.apiPageLayoutToViewerModes=apiPageLayoutToViewerModes,exports.apiPageModeToSidebarView=apiPageModeToSidebarView,exports.approximateFraction=approximateFraction,exports.backtrackBeforeAllVisibleElements=backtrackBeforeAllVisibleElements,exports.binarySearchFirstItem=binarySearchFirstItem,exports.create=create,exports.createStore=createStore,exports.docStyle=docStyle,exports.getActiveOrFocusedElement=getActiveOrFocusedElement,exports.getPageSizeInches=getPageSizeInches,exports.getVisibleElements=getVisibleElements,exports.initialState=initialState,exports.isPortraitOrientation=isPortraitOrientation,exports.isValidRotation=isValidRotation,exports.isValidScrollMode=isValidScrollMode,exports.isValidSpreadMode=isValidSpreadMode,exports.noContextMenuHandler=noContextMenuHandler,exports.normalizeWheelEventDelta=normalizeWheelEventDelta,exports.normalizeWheelEventDirection=normalizeWheelEventDirection,exports.parseQueryString=parseQueryString,exports.removeNullCharacters=removeNullCharacters,exports.roundToDivide=roundToDivide,exports.scrollIntoView=scrollIntoView,exports.usePDFSlick=usePDFSlick,exports.watchScroll=watchScroll}));
54
+ !function(e,t){var i,n;i=globalThis,n=()=>(()=>{var e=[,(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFFindController=t.FindState=void 0;var n=i(2),s=i(3),r=i(4);const a={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3};t.FindState=a;const o={"‐":"-","‘":"'","’":"'","‚":"'","‛":"'","“":'"',"”":'"',"„":'"',"‟":'"',"¼":"1/4","½":"1/2","¾":"3/4"},l=new Set([12441,12442,2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,3642,3770,3972,4153,4154,5908,5940,6098,6752,6980,7082,7083,7154,7155,11647,43014,43052,43204,43347,43456,43766,44013,3158,3953,3954,3962,3963,3964,3965,3968,3956]);let h;const c=/\p{M}+/gu,d=/([.*+?^${}()|[\]\\])|(\p{P})|(\s+)|(\p{M})|(\p{L})/gu,u=/([^\p{M}])\p{M}*$/u,p=/^\p{M}*([^\p{M}])/u,g=/[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g,f=new Map,m=new Map;let _=null,v=null;function b(e){const t=[];let i,n;for(;null!==(i=g.exec(e));){let{index:e}=i;for(const n of i[0]){let i=f.get(n);i||(i=n.normalize("NFD").length,f.set(n,i)),t.push([i,e++])}}if(0===t.length&&_)n=_;else if(t.length>0&&v)n=v;else{const e=`([${Object.keys(o).join("")}])|([${(0,s.getNormalizeWithNFKC)()}])|((?:゙|゚)\\n)|(\\p{M}+(?:-\\n)?)|(\\S-\\n)|((?:\\p{Ideographic}|[぀-ヿ])\\n)|(\\n)`;n=0===t.length?_=new RegExp(e+"|(\\u0000)","gum"):v=new RegExp(e+"|([\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f])","gum")}const r=[];for(;null!==(i=c.exec(e));)r.push([i[0].length,i.index]);let a=e.normalize("NFD");const l=[[0,0]];let h=0,d=0,u=0,p=0,b=0,y=!1;return a=a.replace(n,((e,i,n,s,a,c,g,f,_,v)=>{if(v-=p,i){const e=o[i],t=e.length;for(let e=1;e<t;e++)l.push([v-u+e,u-e]);return u-=t-1,e}if(n){let e=m.get(n);e||(e=n.normalize("NFKC"),m.set(n,e));const t=e.length;for(let e=1;e<t;e++)l.push([v-u+e,u-e]);return u-=t-1,e}if(s)return y=!0,v+b===r[h]?.[1]?++h:(l.push([v-1-u+1,u-1]),u-=1,p+=1),l.push([v-u+1,u]),p+=1,b+=1,s.charAt(0);if(a){const e=a.endsWith("\n"),t=e?a.length-2:a.length;y=!0;let i=t;v+b===r[h]?.[1]&&(i-=r[h][0],++h);for(let e=1;e<=i;e++)l.push([v-1-u+e,u-e]);return u-=i,p+=i,e?(v+=t-1,l.push([v-u+1,1+u]),u+=1,p+=1,b+=1,a.slice(0,t)):a}if(c){const e=c.length-2;return l.push([v-u+e,1+u]),u+=1,p+=1,b+=1,c.slice(0,-2)}if(g){const e=g.length-1;return l.push([v-u+e,u]),p+=1,b+=1,g.slice(0,-1)}if(f)return l.push([v-u+1,u-1]),u-=1,p+=1,b+=1," ";if(v+b===t[d]?.[1]){const e=t[d][0]-1;++d;for(let t=1;t<=e;t++)l.push([v-(u-t),u-t]);u-=e,p+=e}return _})),l.push([a.length,u]),[a,l,y]}function y(e,t,i){if(!e)return[t,i];const s=t,r=t+i-1;let a=(0,n.binarySearchFirstItem)(e,(e=>e[0]>=s));e[a][0]>s&&--a;let o=(0,n.binarySearchFirstItem)(e,(e=>e[0]>=r),a);e[o][0]>r&&--o;const l=s+e[a][1];return[l,r+e[o][1]+1-l]}t.PDFFindController=class{#kn=null;#Ln=!0;#Rn=0;constructor({linkService:e,eventBus:t,updateMatchesCountOnProgress:i=!0}){this._linkService=e,this._eventBus=t,this.#Ln=i,this.onIsPageVisible=null,this.#In(),t._on("find",this.#On.bind(this)),t._on("findbarclose",this.#Nn.bind(this))}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return this.#kn}setDocument(e){this._pdfDocument&&this.#In(),e&&(this._pdfDocument=e,this._firstPageCapability.resolve())}#On(e){if(!e)return;!1===e.phraseSearch&&(console.error("The `phraseSearch`-parameter was removed, please provide an Array of strings in the `query`-parameter instead."),"string"==typeof e.query&&(e.query=e.query.match(/\S+/g)));const t=this._pdfDocument,{type:i}=e;(null===this.#kn||this.#Bn(e))&&(this._dirtyMatch=!0),this.#kn=e,"highlightallchange"!==i&&this.#Vn(a.PENDING),this._firstPageCapability.promise.then((()=>{if(!this._pdfDocument||t&&this._pdfDocument!==t)return;this.#Kt();const e=!this._highlightMatches,n=!!this._findTimeout;this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),i?this._dirtyMatch?this.#Un():"again"===i?(this.#Un(),e&&this.#kn.highlightAll&&this.#jn()):"highlightallchange"===i?(n?this.#Un():this._highlightMatches=!0,this.#jn()):this.#Un():this._findTimeout=setTimeout((()=>{this.#Un(),this._findTimeout=null}),250)}))}scrollMatchIntoView({element:e=null,selectedLeft:t=0,pageIndex:i=-1,matchIndex:s=-1}){if(!this._scrollMatches||!e)return;if(-1===s||s!==this._selected.matchIdx)return;if(-1===i||i!==this._selected.pageIdx)return;this._scrollMatches=!1;const r={top:-50,left:t+-400};(0,n.scrollIntoView)(e,r,!0)}#In(){this._highlightMatches=!1,this._scrollMatches=!1,this._pdfDocument=null,this._pageMatches=[],this._pageMatchesLength=[],this.#Rn=0,this.#kn=null,this._selected={pageIdx:-1,matchIdx:-1},this._offset={pageIdx:null,matchIdx:null,wrapped:!1},this._extractTextPromises=[],this._pageContents=[],this._pageDiffs=[],this._hasDiacritics=[],this._matchesCountTotal=0,this._pagesToSearch=null,this._pendingFindMatches=new Set,this._resumePageIdx=null,this._dirtyMatch=!1,clearTimeout(this._findTimeout),this._findTimeout=null,this._firstPageCapability=new r.PromiseCapability}get#Hn(){const{query:e}=this.#kn;return"string"==typeof e?(e!==this._rawQuery&&(this._rawQuery=e,[this._normalizedQuery]=b(e)),this._normalizedQuery):(e||[]).filter((e=>!!e)).map((e=>b(e)[0]))}#Bn(e){const t=e.query,i=this.#kn.query,n=typeof t;if(n!==typeof i)return!0;if("string"===n){if(t!==i)return!0}else if(JSON.stringify(t)!==JSON.stringify(i))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&&!(this.onIsPageVisible?.(e)??1);case"highlightallchange":return!1}return!0}#Wn(e,t,i){let n=e.slice(0,t).match(u);if(n){const i=e.charCodeAt(t),r=n[1].charCodeAt(0);if((0,s.getCharacterType)(i)===(0,s.getCharacterType)(r))return!1}if(n=e.slice(t+i).match(p),n){const r=e.charCodeAt(t+i-1),a=n[1].charCodeAt(0);if((0,s.getCharacterType)(r)===(0,s.getCharacterType)(a))return!1}return!0}#zn(e,t,i,n){const s=this._pageMatches[i]=[],r=this._pageMatchesLength[i]=[];if(!e)return;const a=this._pageDiffs[i];let o;for(;null!==(o=e.exec(n));){if(t&&!this.#Wn(n,o.index,o[0].length))continue;const[e,i]=y(a,o.index,o[0].length);i&&(s.push(e),r.push(i))}}#Gn(e,t){const{matchDiacritics:i}=this.#kn;let n=!1;const s="[ ]*";return(e=e.replaceAll(d,((e,s,r,a,o,h)=>s?`[ ]*\\${s}[ ]*`:r?`[ ]*${r}[ ]*`:a?"[ ]+":i?o||h:o?l.has(o.charCodeAt(0))?o:"":t?(n=!0,`${h}\\p{M}*`):h))).endsWith(s)&&(e=e.slice(0,e.length-4)),i&&t&&(h||=String.fromCharCode(...l),n=!0,e=`${e}(?=[${h}]|[^\\p{M}]|$)`),[n,e]}#$n(e){let t=this.#Hn;if(0===t.length)return;const{caseSensitive:i,entireWord:n}=this.#kn,s=this._pageContents[e],r=this._hasDiacritics[e];let a=!1;"string"==typeof t?[a,t]=this.#Gn(t,r):t=t.sort().reverse().map((e=>{const[t,i]=this.#Gn(e,r);return a||=t,`(${i})`})).join("|"),t=t?new RegExp(t,`g${a?"u":""}${i?"":"i"}`):null,this.#zn(t,n,e,s),this.#kn.highlightAll&&this.#qn(e),this._resumePageIdx===e&&(this._resumePageIdx=null,this.#Xn());const o=this._pageMatches[e].length;this._matchesCountTotal+=o,this.#Ln?o>0&&this.#Kn():++this.#Rn===this._linkService.pagesCount&&this.#Kn()}#Kt(){if(this._extractTextPromises.length>0)return;let e=Promise.resolve();const t={disableNormalization:!0};for(let i=0,n=this._linkService.pagesCount;i<n;i++){const n=new r.PromiseCapability;this._extractTextPromises[i]=n.promise,e=e.then((()=>this._pdfDocument.getPage(i+1).then((e=>e.getTextContent(t))).then((e=>{const t=[];for(const i of e.items)t.push(i.str),i.hasEOL&&t.push("\n");[this._pageContents[i],this._pageDiffs[i],this._hasDiacritics[i]]=b(t.join("")),n.resolve()}),(e=>{console.error(`Unable to get text content for page ${i+1}`,e),this._pageContents[i]="",this._pageDiffs[i]=null,this._hasDiacritics[i]=!1,n.resolve()}))))}}#qn(e){this._scrollMatches&&this._selected.pageIdx===e&&(this._linkService.page=e+1),this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:e})}#jn(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})}#Un(){const e=this.#kn.findPrevious,t=this._linkService.page-1,i=this._linkService.pagesCount;if(this._highlightMatches=!0,this._dirtyMatch){this._dirtyMatch=!1,this._selected.pageIdx=this._selected.matchIdx=-1,this._offset.pageIdx=t,this._offset.matchIdx=null,this._offset.wrapped=!1,this._resumePageIdx=null,this._pageMatches.length=0,this._pageMatchesLength.length=0,this.#Rn=0,this._matchesCountTotal=0,this.#jn();for(let e=0;e<i;e++)this._pendingFindMatches.has(e)||(this._pendingFindMatches.add(e),this._extractTextPromises[e].then((()=>{this._pendingFindMatches.delete(e),this.#$n(e)})))}if(0===this.#Hn.length)return void this.#Vn(a.FOUND);if(this._resumePageIdx)return;const n=this._offset;if(this._pagesToSearch=i,null!==n.matchIdx){const t=this._pageMatches[n.pageIdx].length;if(!e&&n.matchIdx+1<t||e&&n.matchIdx>0)return n.matchIdx=e?n.matchIdx-1:n.matchIdx+1,void this.#Yn(!0);this.#Qn(e)}this.#Xn()}#Jn(e){const t=this._offset,i=e.length,n=this.#kn.findPrevious;return i?(t.matchIdx=n?i-1:0,this.#Yn(!0),!0):(this.#Qn(n),!!(t.wrapped&&(t.matchIdx=null,this._pagesToSearch<0))&&(this.#Yn(!1),!0))}#Xn(){null!==this._resumePageIdx&&console.error("There can only be one pending page.");let e=null;do{const t=this._offset.pageIdx;if(e=this._pageMatches[t],!e){this._resumePageIdx=t;break}}while(!this.#Jn(e))}#Qn(e){const t=this._offset,i=this._linkService.pagesCount;t.pageIdx=e?t.pageIdx-1:t.pageIdx+1,t.matchIdx=null,this._pagesToSearch--,(t.pageIdx>=i||t.pageIdx<0)&&(t.pageIdx=e?i-1:0,t.wrapped=!0)}#Yn(e=!1){let t=a.NOT_FOUND;const i=this._offset.wrapped;if(this._offset.wrapped=!1,e){const e=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx,this._selected.matchIdx=this._offset.matchIdx,t=i?a.WRAPPED:a.FOUND,-1!==e&&e!==this._selected.pageIdx&&this.#qn(e)}this.#Vn(t,this.#kn.findPrevious),-1!==this._selected.pageIdx&&(this._scrollMatches=!0,this.#qn(this._selected.pageIdx))}#Nn(e){const t=this._pdfDocument;this._firstPageCapability.promise.then((()=>{!this._pdfDocument||t&&this._pdfDocument!==t||(this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),this._resumePageIdx&&(this._resumePageIdx=null,this._dirtyMatch=!0),this.#Vn(a.FOUND),this._highlightMatches=!1,this.#jn())}))}#Zn(){const{pageIdx:e,matchIdx:t}=this._selected;let i=0,n=this._matchesCountTotal;if(-1!==t){for(let t=0;t<e;t++)i+=this._pageMatches[t]?.length||0;i+=t+1}return(i<1||i>n)&&(i=n=0),{current:i,total:n}}#Kn(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:this.#Zn()})}#Vn(e,t=!1){(this.#Ln||this.#Rn===this._linkService.pagesCount&&e!==a.PENDING)&&this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:e,previous:t,matchesCount:this.#Zn(),rawQuery:this.#kn?.query??null})}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.animationStarted=t.VERTICAL_PADDING=t.UNKNOWN_SCALE=t.TextLayerMode=t.SpreadMode=t.SidebarView=t.ScrollMode=t.SCROLLBAR_PADDING=t.RenderingStates=t.ProgressBar=t.PresentationModeState=t.OutputScale=t.MIN_SCALE=t.MAX_SCALE=t.MAX_AUTO_SCALE=t.DEFAULT_SCALE_VALUE=t.DEFAULT_SCALE_DELTA=t.DEFAULT_SCALE=t.CursorTool=t.AutoPrintRegExp=void 0,t.apiPageLayoutToViewerModes=function(e){let t=n.VERTICAL,i=s.NONE;switch(e){case"SinglePage":t=n.PAGE;break;case"OneColumn":break;case"TwoPageLeft":t=n.PAGE;case"TwoColumnLeft":i=s.ODD;break;case"TwoPageRight":t=n.PAGE;case"TwoColumnRight":i=s.EVEN}return{scrollMode:t,spreadMode:i}},t.apiPageModeToSidebarView=function(e){switch(e){case"UseNone":return i.NONE;case"UseThumbs":return i.THUMBS;case"UseOutlines":return i.OUTLINE;case"UseAttachments":return i.ATTACHMENTS;case"UseOC":return i.LAYERS}return i.NONE},t.approximateFraction=function(e){if(Math.floor(e)===e)return[e,1];const t=1/e;if(t>8)return[1,8];if(Math.floor(t)===t)return[1,t];const i=e>1?t:e;let n,s=0,r=1,a=1,o=1;for(;;){const e=s+a,t=r+o;if(t>8)break;i<=e/t?(a=e,o=t):(s=e,r=t)}return n=i-s/r<a/o-i?i===e?[s,r]:[r,s]:i===e?[a,o]:[o,a],n},t.backtrackBeforeAllVisibleElements=o,t.binarySearchFirstItem=a,t.docStyle=void 0,t.getActiveOrFocusedElement=function(){let e=document,t=e.activeElement||e.querySelector(":focus");for(;t?.shadowRoot;)e=t.shadowRoot,t=e.activeElement||e.querySelector(":focus");return t},t.getPageSizeInches=function({view:e,userUnit:t,rotate:i}){const[n,s,r,a]=e,o=i%180!=0,l=(r-n)/72*t,h=(a-s)/72*t;return{width:o?h:l,height:o?l:h}},t.getVisibleElements=function({scrollEl:e,views:t,sortByVisibility:i=!1,horizontal:n=!1,rtl:s=!1}){const r=e.scrollTop,l=r+e.clientHeight,h=e.scrollLeft,c=h+e.clientWidth,d=[],u=new Set,p=t.length;let g=a(t,n?function(e){const t=e.div,i=t.offsetLeft+t.clientLeft,n=i+t.clientWidth;return s?i<c:n>h}:function(e){const t=e.div;return t.offsetTop+t.clientTop+t.clientHeight>r});g>0&&g<p&&!n&&(g=o(g,t,r));let f=n?c:-1;for(let e=g;e<p;e++){const i=t[e],s=i.div,a=s.offsetLeft+s.clientLeft,o=s.offsetTop+s.clientTop,p=s.clientWidth,g=s.clientHeight,m=a+p,_=o+g;if(-1===f)_>=l&&(f=_);else if((n?a:o)>f)break;if(_<=r||o>=l||m<=h||a>=c)continue;const v=Math.max(0,r-o)+Math.max(0,_-l),b=(p-(Math.max(0,h-a)+Math.max(0,m-c)))/p,y=(g-v)/g*b*100|0;d.push({id:i.id,x:a,y:o,view:i,percent:y,widthPercent:100*b|0}),u.add(i.id)}const m=d[0],_=d.at(-1);return i&&d.sort((function(e,t){const i=e.percent-t.percent;return Math.abs(i)>.001?-i:e.id-t.id})),{first:m,last:_,views:d,ids:u}},t.isPortraitOrientation=function(e){return e.width<=e.height},t.isValidRotation=function(e){return Number.isInteger(e)&&e%90==0},t.isValidScrollMode=function(e){return Number.isInteger(e)&&Object.values(n).includes(e)&&e!==n.UNKNOWN},t.isValidSpreadMode=function(e){return Number.isInteger(e)&&Object.values(s).includes(e)&&e!==s.UNKNOWN},t.normalizeWheelEventDelta=function(e){const t=e.deltaMode;let i=l(e);return t===WheelEvent.DOM_DELTA_PIXEL?i/=900:t===WheelEvent.DOM_DELTA_LINE&&(i/=30),i},t.normalizeWheelEventDirection=l,t.parseQueryString=function(e){const t=new Map;for(const[i,n]of new URLSearchParams(e))t.set(i.toLowerCase(),n);return t},t.removeNullCharacters=function(e,t=!1){return"string"!=typeof e?(console.error("The argument must be a string."),e):(t&&(e=e.replaceAll(r," ")),e.replaceAll("\0",""))},t.roundToDivide=function(e,t){const i=e%t;return 0===i?e:Math.round(e-i+t)},t.scrollIntoView=function(e,t,i=!1){let n=e.offsetParent;if(!n)return void console.error("offsetParent is not set -- cannot scroll");let s=e.offsetTop+e.clientTop,r=e.offsetLeft+e.clientLeft;for(;n.clientHeight===n.scrollHeight&&n.clientWidth===n.scrollWidth||i&&(n.classList.contains("markedContent")||"hidden"===getComputedStyle(n).overflow);)if(s+=n.offsetTop,r+=n.offsetLeft,n=n.offsetParent,!n)return;t&&(void 0!==t.top&&(s+=t.top),void 0!==t.left&&(r+=t.left,n.scrollLeft=r)),n.scrollTop=s},t.toggleCheckedBtn=function(e,t,i=null){e.classList.toggle("toggled",t),e.setAttribute("aria-checked",t),i?.classList.toggle("hidden",!t)},t.toggleExpandedBtn=function(e,t,i=null){e.classList.toggle("toggled",t),e.setAttribute("aria-expanded",t),i?.classList.toggle("hidden",!t)},t.watchScroll=function(e,t){const i=function(i){s||(s=window.requestAnimationFrame((function(){s=null;const i=e.scrollLeft,r=n.lastX;i!==r&&(n.right=i>r),n.lastX=i;const a=e.scrollTop,o=n.lastY;a!==o&&(n.down=a>o),n.lastY=a,t(n)})))},n={right:!0,down:!0,lastX:e.scrollLeft,lastY:e.scrollTop,_eventHandler:i};let s=null;return e.addEventListener("scroll",i,!0),n},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 s={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2};t.SpreadMode=s,t.CursorTool={SELECT:0,HAND:1,ZOOM:2},t.AutoPrintRegExp=/\bprint\s*\(/,t.OutputScale=class{constructor(){const e=window.devicePixelRatio||1;this.sx=e,this.sy=e}get scaled(){return 1!==this.sx||1!==this.sy}};const r=/[\x01-\x1F]/g;function a(e,t,i=0){let n=i,s=e.length-1;if(s<0||!t(e[s]))return e.length;if(t(e[n]))return n;for(;n<s;){const i=n+s>>1;t(e[i])?s=i:n=i+1}return n}function o(e,t,i){if(e<2)return e;let n=t[e].div,s=n.offsetTop+n.clientTop;s>=i&&(n=t[e-1].div,s=n.offsetTop+n.clientTop);for(let i=e-2;i>=0&&(n=t[i].div,!(n.offsetTop+n.clientTop+n.clientHeight<=s));--i)e=i;return e}function l(e){let t=Math.hypot(e.deltaX,e.deltaY);const i=Math.atan2(e.deltaY,e.deltaX);return-.25*Math.PI<i&&i<.75*Math.PI&&(t=-t),t}const h=new Promise((function(e){window.requestAnimationFrame(e)}));t.animationStarted=h;const c=document.documentElement.style;t.docStyle=c,t.ProgressBar=class{#es=null;#ts=null;#is=0;#ns=null;#mt=!0;constructor(e){this.#es=e.classList,this.#ns=e.style}get percent(){return this.#is}set percent(e){var t,i,n;this.#is=(t=e,i=0,n=100,Math.min(Math.max(t,i),n)),isNaN(e)?this.#es.add("indeterminate"):(this.#es.remove("indeterminate"),this.#ns.setProperty("--progressBar-percent",`${this.#is}%`))}setWidth(e){if(!e)return;const t=e.parentNode.offsetWidth-e.offsetWidth;t>0&&this.#ns.setProperty("--progressBar-end-offset",`${t}px`)}setDisableAutoFetch(e=5e3){isNaN(this.#is)||(this.#ts&&clearTimeout(this.#ts),this.show(),this.#ts=setTimeout((()=>{this.#ts=null,this.hide()}),e))}hide(){this.#mt&&(this.#mt=!1,this.#es.add("hidden"))}show(){this.#mt||(this.#mt=!0,this.#es.remove("hidden"))}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterType=void 0,t.getCharacterType=function(e){return function(e){return e<11904}(e)?function(e){return 0==(65408&e)}(e)?function(e){return 32===e||9===e||13===e||10===e}(e)?i.SPACE:function(e){return e>=97&&e<=122||e>=65&&e<=90}(e)||function(e){return e>=48&&e<=57}(e)||95===e?i.ALPHA_LETTER:i.PUNCT:function(e){return 3584==(65408&e)}(e)?i.THAI_LETTER:160===e?i.SPACE:i.ALPHA_LETTER:function(e){return e>=13312&&e<=40959||e>=63744&&e<=64255}(e)?i.HAN_LETTER:function(e){return e>=12448&&e<=12543}(e)?i.KATAKANA_LETTER:function(e){return e>=12352&&e<=12447}(e)?i.HIRAGANA_LETTER:function(e){return e>=65376&&e<=65439}(e)?i.HALFWIDTH_KATAKANA_LETTER:i.ALPHA_LETTER},t.getNormalizeWithNFKC=function(){return n||=" ¨ª¯²-µ¸-º¼-¾IJ-ijĿ-ŀʼnſDŽ-njDZ-dzʰ-ʸ˘-˝ˠ-ˤʹͺ;΄-΅·ϐ-ϖϰ-ϲϴ-ϵϹևٵ-ٸक़-य़ড়-ঢ়য়ਲ਼ਸ਼ਖ਼-ਜ਼ਫ਼ଡ଼-ଢ଼ำຳໜ-ໝ༌གྷཌྷདྷབྷཛྷཀྵჼᴬ-ᴮᴰ-ᴺᴼ-ᵍᵏ-ᵪᵸᶛ-ᶿẚ-ẛάέήίόύώΆ᾽-῁ΈΉ῍-῏ΐΊ῝-῟ΰΎ῭-`ΌΏ´-῾ - ‑‗․-… ″-‴‶-‷‼‾⁇-⁉⁗ ⁰-ⁱ⁴-₎ₐ-ₜ₨℀-℃℅-ℇ℉-ℓℕ-№ℙ-ℝ℠-™ℤΩℨK-ℭℯ-ℱℳ-ℹ℻-⅀ⅅ-ⅉ⅐-ⅿ↉∬-∭∯-∰〈-〉①-⓪⨌⩴-⩶⫝̸ⱼ-ⱽⵯ⺟⻳⼀-⿕ 〶〸-〺゛-゜ゟヿㄱ-ㆎ㆒-㆟㈀-㈞㈠-㉇㉐-㉾㊀-㏿ꚜ-ꚝꝰꟲ-ꟴꟸ-ꟹꭜ-ꭟꭩ豈-嗀塚晴凞-羽蘒諸逸-都飯-舘並-龎ff-stﬓ-ﬗיִײַ-זּטּ-לּמּנּ-סּףּ-פּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-﷼︐-︙︰-﹄﹇-﹒﹔-﹦﹨-﹫ﹰ-ﹲﹴﹶ-ﻼ!-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ¢-₩",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};let n;t.CharacterType=i},e=>{e.exports=globalThis.pdfjsLib},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SimpleLinkService=t.PDFLinkService=t.LinkTarget=void 0;var n=i(2);const s={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};function r(e,{url:t,target:i,rel:n,enabled:r=!0}={}){if(!t||"string"!=typeof t)throw new Error('A valid "url" parameter must provided.');r?e.href=e.title=t:(e.href="",e.title=`Disabled: ${t}`,e.onclick=()=>!1);let a="";switch(i){case s.NONE:break;case s.SELF:a="_self";break;case s.BLANK:a="_blank";break;case s.PARENT:a="_parent";break;case s.TOP:a="_top"}e.target=a,e.rel="string"==typeof n?n:"noopener noreferrer nofollow"}t.LinkTarget=s;class a{#ss=new Map;constructor({eventBus:e,externalLinkTarget:t=null,externalLinkRel:i=null,ignoreDestinationZoom:n=!1}={}){this.eventBus=e,this.externalLinkTarget=t,this.externalLinkRel=i,this.externalLinkEnabled=!0,this._ignoreDestinationZoom=n,this.baseUrl=null,this.pdfDocument=null,this.pdfViewer=null,this.pdfHistory=null}setDocument(e,t=null){this.baseUrl=t,this.pdfDocument=e,this.#ss.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}#rs(e,t=null,i){const n=i[0];let s;if("object"==typeof n&&null!==n){if(s=this._cachedPageNumber(n),!s)return void this.pdfDocument.getPageIndex(n).then((s=>{this.cachePageRef(s+1,n),this.#rs(e,t,i)})).catch((()=>{console.error(`PDFLinkService.#goToDestinationHelper: "${n}" is not a valid page reference, for dest="${e}".`)}))}else{if(!Number.isInteger(n))return void console.error(`PDFLinkService.#goToDestinationHelper: "${n}" is not a valid destination reference, for dest="${e}".`);s=n+1}!s||s<1||s>this.pagesCount?console.error(`PDFLinkService.#goToDestinationHelper: "${s}" is not a valid page number, for dest="${e}".`):(this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.push({namedDest:t,explicitDest:i,pageNumber:s})),this.pdfViewer.scrollPageIntoView({pageNumber:s,destArray:i,ignoreDestinationZoom:this._ignoreDestinationZoom}))}async goToDestination(e){if(!this.pdfDocument)return;let t,i;"string"==typeof e?(t=e,i=await this.pdfDocument.getDestination(e)):(t=null,i=await e),Array.isArray(i)?this.#rs(e,t,i):console.error(`PDFLinkService.goToDestination: "${i}" is not a valid destination array, for dest="${e}".`)}goToPage(e){if(!this.pdfDocument)return;const t="string"==typeof e&&this.pdfViewer.pageLabelToPageNumber(e)||0|e;Number.isInteger(t)&&t>0&&t<=this.pagesCount?(this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.pushPage(t)),this.pdfViewer.scrollPageIntoView({pageNumber:t})):console.error(`PDFLinkService.goToPage: "${e}" is not a valid page.`)}addLinkAttributes(e,t,i=!1){r(e,{url:t,target:i?s.BLANK:this.externalLinkTarget,rel:this.externalLinkRel,enabled:this.externalLinkEnabled})}getDestinationHash(e){if("string"==typeof e){if(e.length>0)return this.getAnchorUrl("#"+escape(e))}else if(Array.isArray(e)){const t=JSON.stringify(e);if(t.length>0)return this.getAnchorUrl("#"+escape(t))}return this.getAnchorUrl("")}getAnchorUrl(e){return this.baseUrl?this.baseUrl+e:e}setHash(e){if(!this.pdfDocument)return;let t,i;if(e.includes("=")){const s=(0,n.parseQueryString)(e);if(s.has("search")){const e=s.get("search").replaceAll('"',""),t="true"===s.get("phrase");this.eventBus.dispatch("findfromurlhash",{source:this,query:t?e:e.match(/\S+/g)})}if(s.has("page")&&(t=0|s.get("page")||1),s.has("zoom")){const e=s.get("zoom").split(","),t=e[0],n=parseFloat(t);t.includes("Fit")?"Fit"===t||"FitB"===t?i=[null,{name:t}]:"FitH"===t||"FitBH"===t||"FitV"===t||"FitBV"===t?i=[null,{name:t},e.length>1?0|e[1]:null]:"FitR"===t?5!==e.length?console.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):i=[null,{name:t},0|e[1],0|e[2],0|e[3],0|e[4]]:console.error(`PDFLinkService.setHash: "${t}" is not a valid zoom value.`):i=[null,{name:"XYZ"},e.length>1?0|e[1]:null,e.length>2?0|e[2]:null,n?n/100:t]}i?this.pdfViewer.scrollPageIntoView({pageNumber:t||this.page,destArray:i,allowNegativeOffset:!0}):t&&(this.page=t),s.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:s.get("pagemode")}),s.has("nameddest")&&this.goToDestination(s.get("nameddest"))}else{i=unescape(e);try{i=JSON.parse(i),Array.isArray(i)||(i=i.toString())}catch{}if("string"==typeof i||a.#as(i))return void this.goToDestination(i);console.error(`PDFLinkService.setHash: "${unescape(e)}" is not a valid destination.`)}}executeNamedAction(e){switch(e){case"GoBack":this.pdfHistory?.back();break;case"GoForward":this.pdfHistory?.forward();break;case"NextPage":this.pdfViewer.nextPage();break;case"PrevPage":this.pdfViewer.previousPage();break;case"LastPage":this.page=this.pagesCount;break;case"FirstPage":this.page=1}this.eventBus.dispatch("namedaction",{source:this,action:e})}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.#ss.set(i,e)}_cachedPageNumber(e){if(!e)return null;const t=0===e.gen?`${e.num}R`:`${e.num}R${e.gen}`;return this.#ss.get(t)||null}static#as(e){if(!Array.isArray(e))return!1;const t=e.length;if(t<2)return!1;const i=e[0];if(!("object"==typeof i&&Number.isInteger(i.num)&&Number.isInteger(i.gen)||Number.isInteger(i)&&i>=0))return!1;const n=e[1];if("object"!=typeof n||"string"!=typeof n.name)return!1;let s=!0;switch(n.name){case"XYZ":if(5!==t)return!1;break;case"Fit":case"FitB":return 2===t;case"FitH":case"FitBH":case"FitV":case"FitBV":if(3!==t)return!1;break;case"FitR":if(6!==t)return!1;s=!1;break;default:return!1}for(let i=2;i<t;i++){const t=e[i];if(!("number"==typeof t||s&&null===t))return!1}return!0}}t.PDFLinkService=a,t.SimpleLinkService=class{constructor(){this.externalLinkEnabled=!0}get pagesCount(){return 0}get page(){return 0}set page(e){}get rotation(){return 0}set rotation(e){}get isInPresentationMode(){return!1}async goToDestination(e){}goToPage(e){}addLinkAttributes(e,t,i=!1){r(e,{url:t,enabled:this.externalLinkEnabled})}getDestinationHash(e){return"#"}getAnchorUrl(e){return"#"}setHash(e){}executeNamedAction(e){}executeSetOCGState(e){}cachePageRef(e,t){}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationLayerBuilder=void 0;var n=i(4),s=i(7),r=i(2);t.AnnotationLayerBuilder=class{#os=null;constructor({pageDiv:e,pdfPage:t,linkService:i,downloadManager:n,annotationStorage:r=null,imageResourcesPath:a="",renderForms:o=!0,l10n:l=s.NullL10n,enableScripting:h=!1,hasJSActionsPromise:c=null,fieldObjectsPromise:d=null,annotationCanvasMap:u=null,accessibilityManager:p=null}){this.pageDiv=e,this.pdfPage=t,this.linkService=i,this.downloadManager=n,this.imageResourcesPath=a,this.renderForms=o,this.l10n=l,this.annotationStorage=r,this.enableScripting=h,this._hasJSActionsPromise=c||Promise.resolve(!1),this._fieldObjectsPromise=d||Promise.resolve(null),this._annotationCanvasMap=u,this._accessibilityManager=p,this.annotationLayer=null,this.div=null,this._cancelled=!1,this._eventBus=i.eventBus}async render(e,t="display"){if(this.div){if(this._cancelled||!this.annotationLayer)return;return void this.annotationLayer.update({viewport:e.clone({dontFlip:!0})})}const[i,s,a]=await Promise.all([this.pdfPage.getAnnotations({intent:t}),this._hasJSActionsPromise,this._fieldObjectsPromise]);if(this._cancelled)return;const o=this.div=document.createElement("div");o.className="annotationLayer",this.pageDiv.append(o),0!==i.length?(this.annotationLayer=new n.AnnotationLayer({div:o,accessibilityManager:this._accessibilityManager,annotationCanvasMap:this._annotationCanvasMap,l10n:this.l10n,page:this.pdfPage,viewport:e.clone({dontFlip:!0})}),await this.annotationLayer.render({annotations:i,imageResourcesPath:this.imageResourcesPath,renderForms:this.renderForms,linkService:this.linkService,downloadManager:this.downloadManager,annotationStorage:this.annotationStorage,enableScripting:this.enableScripting,hasJSActions:s,fieldObjects:a}),this.linkService.isInPresentationMode&&this.#ls(r.PresentationModeState.FULLSCREEN),this.#os||(this.#os=e=>{this.#ls(e.state)},this._eventBus?._on("presentationmodechanged",this.#os))):this.hide()}cancel(){this._cancelled=!0,this.#os&&(this._eventBus?._off("presentationmodechanged",this.#os),this.#os=null)}hide(){this.div&&(this.div.hidden=!0)}#ls(e){if(!this.div)return;let t=!1;switch(e){case r.PresentationModeState.FULLSCREEN:t=!0;break;case r.PresentationModeState.NORMAL:break;default:return}for(const e of this.div.childNodes)e.hasAttribute("data-internal-link")||(e.inert=t)}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NullL10n=void 0,t.getL10nFallback=n;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.",annotation_date_string:"{{date}}, {{time}}",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",editor_alt_text_button_label:"Alt text",editor_alt_text_edit_button_label:"Edit alt text",editor_alt_text_decorative_tooltip:"Marked as decorative"};function n(e,t){switch(e){case"find_match_count":e=`find_match_count[${1===t.total?"one":"other"}]`;break;case"find_match_count_limit":e=`find_match_count_limit[${1===t.limit?"one":"other"}]`}return i[e]||""}i.print_progress_percent="{{progress}}%";const s={getLanguage:async()=>"en-us",getDirection:async()=>"ltr",get:async(e,t=null,i=n(e,t))=>function(e,t){return t?e.replaceAll(/\{\{\s*(\w+)\s*\}\}/g,((e,i)=>i in t?t[i]:"{{"+i+"}}")):e}(i,t),async translate(e){}};t.NullL10n=s},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DownloadManager=void 0;var n=i(4);function s(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{#hs=new WeakMap;downloadUrl(e,t,i){(0,n.createValidAbsoluteUrl)(e,"http://example.com")?s(e+"#pdfjs.action=download",t):console.error(`downloadUrl - not a valid URL: ${e}`)}downloadData(e,t,i){s(URL.createObjectURL(new Blob([e],{type:i})),t)}openOrDownloadData(e,t,i){const s=(0,n.isPdfFile)(i)?"application/pdf":"";return this.downloadData(t,i,s),!1}download(e,t,i,n){s(URL.createObjectURL(e),i)}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WaitOnType=t.EventBus=t.AutomationEventBus=void 0,t.waitOnEventOrTimeout=function({target:e,name:t,delay:s=0}){return new Promise((function(r,a){if("object"!=typeof e||!t||"string"!=typeof t||!(Number.isInteger(s)&&s>=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");function o(i){e instanceof n?e._off(t,l):e.removeEventListener(t,l),c&&clearTimeout(c),r(i)}const l=o.bind(null,i.EVENT);e instanceof n?e._on(t,l):e.addEventListener(t,l);const h=o.bind(null,i.TIMEOUT),c=setTimeout(h,s)}))};const i={EVENT:"event",TIMEOUT:"timeout"};t.WaitOnType=i;class n{#a=Object.create(null);on(e,t,i=null){this._on(e,t,{external:!0,once:i?.once})}off(e,t,i=null){this._off(e,t,{external:!0,once:i?.once})}dispatch(e,t){const i=this.#a[e];if(!i||0===i.length)return;let n;for(const{listener:s,external:r,once:a}of i.slice(0))a&&this._off(e,s),r?(n||=[]).push(s):s(t);if(n){for(const e of n)e(t);n=null}}_on(e,t,i=null){(this.#a[e]||=[]).push({listener:t,external:!0===i?.external,once:!0===i?.once})}_off(e,t,i=null){const n=this.#a[e];if(n)for(let e=0,i=n.length;e<i;e++)if(n[e].listener===t)return void n.splice(e,1)}}t.EventBus=n,t.AutomationEventBus=class extends n{dispatch(e,t){throw new Error("Not implemented: AutomationEventBus.dispatch")}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GenericL10n=void 0,i(11);var n=i(7);const s={en:"en-US",es:"es-ES",fy:"fy-NL",ga:"ga-IE",gu:"gu-IN",hi:"hi-IN",hy:"hy-AM",nb:"nb-NO",ne:"ne-NP",nn:"nn-NO",pa:"pa-IN",pt:"pt-PT",sv:"sv-SE",zh:"zh-CN"};t.GenericL10n=class{constructor(e){const{webL10n:t}=document;this._lang=e,this._ready=new Promise(((i,n)=>{var r;t.setLanguage((r=e,s[r?.toLowerCase()]||r),(()=>{i(t)}))}))}async getLanguage(){return(await this._ready).getLanguage()}async getDirection(){return(await this._ready).getDirection()}async get(e,t=null,i=(0,n.getL10nFallback)(e,t)){return(await this._ready).get(e,t,i)}async translate(e){return(await this._ready).translate(e)}}},()=>{document.webL10n=function(e,t){var i={},n="",s="textContent",r="",a={},o="loading",l=!0;function h(e,t,i){t=t||function(e){},i=i||function(){};var n=new XMLHttpRequest;n.open("GET",e,l),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 c(e,t,r,a){var o=e.replace(/[^\/]*$/,"")||"./";function l(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,"'")}h(e,(function(e){n+=e,function(e,i){var n={},s=/^\s*|\s*$/,r=/^\s*#|^\s*$/,a=/^\s*\[(.*)\]\s*$/,c=/^\s*@import\s+url\((.*)\)\s*$/i,d=/^([^=\s]*)\s*=\s*(.+)$/;function u(e,i,h){var u=e.replace(s,"").split(/[\r\n]+/),g="*",f=t.split("-",1)[0],m=!1,_="";!function e(){for(;;){if(!u.length)return void h();var s=u.shift();if(!r.test(s)){if(i){if(_=a.exec(s)){g=_[1].toLowerCase(),m="*"!==g&&g!==t&&g!==f;continue}if(m)continue;if(_=c.exec(s))return void p(o+_[1],e)}var v=s.match(d);v&&3==v.length&&(n[v[1]]=l(v[2]))}}}()}function p(e,t){h(e,(function(e){u(e,!1,t)}),(function(){console.warn(e+" not found."),t()}))}u(e,!0,(function(){i(n)}))}(e,(function(e){for(var t in e){var n,a,o=t.lastIndexOf(".");o>0?(n=t.substring(0,o),a=t.substring(o+1)):(n=t,a=s),i[n]||(i[n]={}),i[n][a]=e[t]}r&&r()}))}),a)}function d(e,s){e&&(e=e.toLowerCase()),s=s||function(){},i={},n="",r="",r=e;var a=t.querySelectorAll('link[type="application/l10n"]'),l=a.length;if(0!==l){var h,d,u=0;d=function(){++u>=l&&(s(),o="complete")};for(var p=0;p<l;p++)new _(a[p]).load(e,d)}else{var g=(h=t.querySelector('script[type="application/l10n"]'))?JSON.parse(h.innerHTML):null;if(g&&g.locales&&g.default_locale){if(console.log("using the embedded JSON directory, early way out"),!(i=g.locales[e])){var f=g.default_locale.toLowerCase();for(var m in g.locales){if((m=m.toLowerCase())===e){i=g.locales[e];break}m===f&&(i=g.locales[f])}}s()}else console.log("no resource to load, early way out");o="complete"}function _(e){var t=e.href;this.load=function(e,i){c(t,e,i,(function(){console.warn(t+" not found."),console.warn('"'+e+'" resource not found'),r="",i()}))}}}function u(e,t,n){var s=i[e];if(!s){if(console.warn("#"+e+" is undefined."),!n)return null;s=n}var r={};for(var a in s){var o=s[a];o=g(o=p(o,t,e,a),t,e),r[a]=o}return r}function p(e,t,n,s){var r=/\{\[\s*([a-zA-Z]+)\(([a-zA-Z]+)\)\s*\]\}/.exec(e);if(!r||!r.length)return e;var o,l=r[1],h=r[2];return t&&h in t?o=t[h]:h in i&&(o=i[h]),l in a&&(e=(0,a[l])(e,o,n,s)),e}function g(e,t,n){return e.replace(/\{\{\s*(.+?)\s*\}\}/g,(function(e,s){return t&&s in t?t[s]:s in i?i[s]:(console.log("argument {{"+s+"}} for #"+n+" is undefined."),e)}))}function f(e){var i=function(e){if(!e)return{};var t=e.getAttribute("data-l10n-id"),i=e.getAttribute("data-l10n-args"),n={};if(i)try{n=JSON.parse(i)}catch(e){console.warn("could not parse arguments for #"+t)}return{id:t,args:n}}(e);if(i.id){var n=u(i.id,i.args);if(n){if(n[s]){if(0===function(e){if(e.children)return e.children.length;if(void 0!==e.childElementCount)return e.childElementCount;for(var t=0,i=0;i<e.childNodes.length;i++)t+=1===e.nodeType?1:0;return t}(e))e[s]=n[s];else{for(var r=e.childNodes,a=!1,o=0,l=r.length;o<l;o++)3===r[o].nodeType&&/\S/.test(r[o].nodeValue)&&(a?r[o].nodeValue="":(r[o].nodeValue=n[s],a=!0));if(!a){var h=t.createTextNode(n[s]);e.prepend(h)}}delete n[s]}for(var c in n)e[c]=n[c]}else console.warn("#"+i.id+" is undefined.")}}return a.plural=function(e,t,n,o){var l=parseFloat(t);if(isNaN(l))return e;if(o!=s)return e;a._pluralRules||(a._pluralRules=function(e){function t(e,t){return-1!==t.indexOf(e)}function i(e,t,i){return t<=e&&e<=i}var n={0:function(e){return"other"},1:function(e){return i(e%100,3,10)?"few":0===e?"zero":i(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 i(e,0,1)?"one":"other"},5:function(e){return i(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 i(e,3,6)?"few":i(e,7,10)?"many":2==e?"two":1==e?"one":"other"},9:function(e){return 0===e||1!=e&&i(e%100,1,19)?"few":1==e?"one":"other"},10:function(e){return i(e%10,2,9)&&!i(e%100,11,19)?"few":e%10!=1||i(e%100,11,19)?"other":"one"},11:function(e){return i(e%10,2,4)&&!i(e%100,12,14)?"few":e%10==0||i(e%10,5,9)||i(e%100,11,14)?"many":e%10==1&&e%100!=11?"one":"other"},12:function(e){return i(e,2,4)?"few":1==e?"one":"other"},13:function(e){return i(e%10,2,4)&&!i(e%100,12,14)?"few":1!=e&&i(e%10,0,1)||i(e%10,5,9)||i(e%100,12,14)?"many":1==e?"one":"other"},14:function(e){return i(e%100,3,4)?"few":e%100==2?"two":e%100==1?"one":"other"},15:function(e){return 0===e||i(e%100,2,10)?"few":i(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":i(e,0,2)&&0!==e&&2!=e?"one":"other"},19:function(e){return i(e,2,10)?"few":i(e,0,1)?"one":"other"},20:function(e){return!i(e%10,3,4)&&e%10!=9||i(e%100,10,19)||i(e%100,70,79)||i(e%100,90,99)?e%1e6==0&&0!==e?"many":e%10!=2||t(e%100,[12,72,92])?e%10!=1||t(e%100,[11,71,91])?"other":"one":"two":"few"},21:function(e){return 0===e?"zero":1==e?"one":"other"},22:function(e){return i(e,0,1)||i(e,11,99)?"one":"other"},23:function(e){return i(e%10,1,2)||e%20==0?"one":"other"},24:function(e){return i(e,3,10)||i(e,13,19)?"few":t(e,[2,12])?"two":t(e,[1,11])?"one":"other"}},s={af:3,ak:4,am:4,ar:1,asa:3,az:0,be:11,bem:3,bez:3,bg:3,bh:4,bm:0,bn:3,bo:0,br:20,brx:3,bs:11,ca:3,cgg:3,chr:3,cs:12,cy:17,da:3,de:3,dv:3,dz:0,ee:3,el:3,en:3,eo:3,es:3,et:3,eu:3,fa:0,ff:5,fi:3,fil:4,fo:3,fr:5,fur:3,fy:3,ga:8,gd:24,gl:3,gsw:3,gu:3,guw:4,gv:23,ha:3,haw:3,he:2,hi:4,hr:11,hu:0,id:0,ig:0,ii:0,is:3,it:3,iu:7,ja:0,jmc:3,jv:0,ka:0,kab:5,kaj:3,kcg:3,kde:0,kea:0,kk:3,kl:3,km:0,kn:0,ko:0,ksb:3,ksh:21,ku:3,kw:7,lag:18,lb:3,lg:3,ln:4,lo:0,lt:10,lv:6,mas:3,mg:4,mk:16,ml:3,mn:3,mo:9,mr:3,ms:0,mt:15,my:0,nah:3,naq:7,nb:3,nd:3,ne:3,nl:3,nn:3,no:3,nr:3,nso:4,ny:3,nyn:3,om:3,or:3,pa:3,pap:3,pl:13,ps:3,pt:3,rm:3,ro:9,rof:3,ru:11,rwk:3,sah:0,saq:3,se:7,seh:3,ses:0,sg:0,sh:11,shi:19,sk:12,sl:14,sma:7,smi:7,smj:7,smn:7,sms:7,sn:3,so:3,sq:3,sr:11,ss:3,ssy:3,st:3,sv:3,sw:3,syr:3,ta:3,te:3,teo:3,th:0,ti:4,tig:3,tk:3,tl:4,tn:3,to:0,tr:0,ts:3,tzm:22,uk:11,ur:3,ve:3,vi:0,vun:3,wa:4,wae:3,wo:0,xh:3,xog:3,yo:0,zh:0,zu:3}[e.replace(/-.*$/,"")];return s in n?n[s]:(console.warn("plural form unknown for ["+e+"]"),function(){return"other"})}(r));var h="["+a._pluralRules(l)+"]";return 0===l&&n+"[zero]"in i?e=i[n+"[zero]"][o]:1==l&&n+"[one]"in i?e=i[n+"[one]"][o]:2==l&&n+"[two]"in i?e=i[n+"[two]"][o]:n+h in i?e=i[n+h][o]:n+"[other]"in i&&(e=i[n+"[other]"][o]),e},{get:function(e,t,i){var n,r=e.lastIndexOf("."),a=s;r>0&&(a=e.substring(r+1),e=e.substring(0,r)),i&&((n={})[a]=i);var o=u(e,t,n);return o&&a in o?o[a]:"{{"+e+"}}"},getData:function(){return i},getText:function(){return n},getLanguage:function(){return r},setLanguage:function(e,t){d(e,(function(){t&&t()}))},getDirection:function(){var e=r.split("-",1)[0];return["ar","he","fa","ps","ur"].indexOf(e)>=0?"rtl":"ltr"},translate:function(e){for(var i=function(e){return e?e.querySelectorAll("*[data-l10n-id]"):[]}(e=e||t.documentElement),n=i.length,s=0;s<n;s++)f(i[s]);f(e)},getReadyState:function(){return o},ready:function(i){i&&("complete"==o||"interactive"==o?e.setTimeout((function(){i()})):t.addEventListener&&t.addEventListener("localized",(function e(){t.removeEventListener("localized",e),i()})))}}}(window,document)},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFHistory=void 0,t.isDestArraysEqual=o,t.isDestHashesEqual=a;var n=i(2),s=i(9);function r(){return document.location.hash}function a(e,t){return"string"==typeof e&&"string"==typeof t&&(e===t||(0,n.parseQueryString)(e).get("nameddest")===t)}function o(e,t){function i(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 n in e)if(!i(e[n],t[n]))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 n=0,s=e.length;n<s;n++)if(!i(e[n],t[n]))return!1;return!0}t.PDFHistory=class{constructor({linkService:e,eventBus:t}){this.linkService=e,this.eventBus=t,this._initialized=!1,this._fingerprint="",this.reset(),this._boundEvents=null,this.eventBus._on("pagesinit",(()=>{this._isPagesLoaded=!1,this.eventBus._on("pagesloaded",(e=>{this._isPagesLoaded=!!e.pagesCount}),{once:!0})}))}initialize({fingerprint:e,resetHistory:t=!1,updateUrl:i=!1}){if(!e||"string"!=typeof e)return void console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');this._initialized&&this.reset();const n=""!==this._fingerprint&&this._fingerprint!==e;this._fingerprint=e,this._updateUrl=!0===i,this._initialized=!0,this._bindEvents();const s=window.history.state;if(this._popStateInProgress=!1,this._blockHashChange=0,this._currentHash=r(),this._numPositionUpdates=0,this._uid=this._maxUid=0,this._destination=null,this._position=null,!this._isValidState(s,!0)||t){const{hash:e,page:i,rotation:s}=this._parseCurrentHash(!0);return!e||n||t?void this._pushOrReplaceState(null,!0):void this._pushOrReplaceState({hash:e,page:i,rotation:s},!0)}const a=s.destination;this._updateInternalState(a,s.uid,!0),void 0!==a.rotation&&(this._initialRotation=a.rotation),a.dest?(this._initialBookmark=JSON.stringify(a.dest),this._destination.page=null):a.hash?this._initialBookmark=a.hash:a.page&&(this._initialBookmark=`page=${a.page}`)}reset(){this._initialized&&(this._pageHide(),this._initialized=!1,this._unbindEvents()),this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._initialBookmark=null,this._initialRotation=null}push({namedDest:e=null,explicitDest:t,pageNumber:i}){if(!this._initialized)return;if(e&&"string"!=typeof e)return void console.error(`PDFHistory.push: "${e}" is not a valid namedDest parameter.`);if(!Array.isArray(t))return void console.error(`PDFHistory.push: "${t}" is not a valid explicitDest parameter.`);if(!this._isValidPage(i)&&(null!==i||this._destination))return void console.error(`PDFHistory.push: "${i}" is not a valid pageNumber parameter.`);const n=e||JSON.stringify(t);if(!n)return;let s=!1;if(this._destination&&(a(this._destination.hash,n)||o(this._destination.dest,t))){if(this._destination.page)return;s=!0}this._popStateInProgress&&!s||(this._pushOrReplaceState({dest:t,hash:n,page:i,rotation:this.linkService.rotation},s),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then((()=>{this._popStateInProgress=!1}))))}pushPage(e){this._initialized&&(this._isValidPage(e)?this._destination?.page!==e&&(this._popStateInProgress||(this._pushOrReplaceState({dest:null,hash:`page=${e}`,page:e,rotation:this.linkService.rotation}),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then((()=>{this._popStateInProgress=!1}))))):console.error(`PDFHistory.pushPage: "${e}" is not a valid page number.`))}pushCurrentPosition(){this._initialized&&!this._popStateInProgress&&this._tryPushCurrentPosition()}back(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;this._isValidState(e)&&e.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;this._isValidState(e)&&e.uid<this._maxUid&&window.history.forward()}get popStateInProgress(){return this._initialized&&(this._popStateInProgress||this._blockHashChange>0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}_pushOrReplaceState(e,t=!1){const i=t||!this._destination,n={fingerprint:this._fingerprint,uid:i?this._uid:this._uid+1,destination:e};let s;if(this._updateInternalState(e,n.uid),this._updateUrl&&e?.hash){const t=document.location.href.split("#")[0];t.startsWith("file://")||(s=`${t}#${e.hash}`)}i?window.history.replaceState(n,"",s):window.history.pushState(n,"",s)}_tryPushCurrentPosition(e=!1){if(!this._position)return;let t=this._position;if(e&&(t=Object.assign(Object.create(null),this._position),t.temporary=!0),!this._destination)return void this._pushOrReplaceState(t);if(this._destination.temporary)return void this._pushOrReplaceState(t,!0);if(this._destination.hash===t.hash)return;if(!this._destination.page&&this._numPositionUpdates<=50)return;let i=!1;if(this._destination.page>=t.first&&this._destination.page<=t.page){if(void 0!==this._destination.dest||!this._destination.first)return;i=!0}this._pushOrReplaceState(t,i)}_isValidPage(e){return Number.isInteger(e)&&e>0&&e<=this.linkService.pagesCount}_isValidState(e,t=!1){if(!e)return!1;if(e.fingerprint!==this._fingerprint){if(!t)return!1;{if("string"!=typeof e.fingerprint||e.fingerprint.length!==this._fingerprint.length)return!1;const[t]=performance.getEntriesByType("navigation");if("reload"!==t?.type)return!1}}return!(!Number.isInteger(e.uid)||e.uid<0)&&null!==e.destination&&"object"==typeof e.destination}_updateInternalState(e,t,i=!1){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),i&&e?.temporary&&delete e.temporary,this._destination=e,this._uid=t,this._maxUid=Math.max(this._maxUid,t),this._numPositionUpdates=0}_parseCurrentHash(e=!1){const t=unescape(r()).substring(1),i=(0,n.parseQueryString)(t),s=i.get("nameddest")||"";let a=0|i.get("page");return(!this._isValidPage(a)||e&&s.length>0)&&(a=null),{hash:t,page:a,rotation:this.linkService.rotation}}_updateViewarea({location:e}){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._position={hash:e.pdfOpenParams.substring(1),page:this.linkService.page,first:e.pageNumber,rotation:e.rotation},this._popStateInProgress||(this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++,this._updateViewareaTimeout=setTimeout((()=>{this._popStateInProgress||this._tryPushCurrentPosition(!0),this._updateViewareaTimeout=null}),1e3))}_popState({state:e}){const t=r(),i=this._currentHash!==t;if(this._currentHash=t,!e){this._uid++;const{hash:e,page:t,rotation:i}=this._parseCurrentHash();return void this._pushOrReplaceState({hash:e,page:t,rotation:i},!0)}if(!this._isValidState(e))return;this._popStateInProgress=!0,i&&(this._blockHashChange++,(0,s.waitOnEventOrTimeout)({target:window,name:"hashchange",delay:1e3}).then((()=>{this._blockHashChange--})));const a=e.destination;this._updateInternalState(a,e.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(){this._boundEvents||(this._boundEvents={updateViewarea:this._updateViewarea.bind(this),popState:this._popState.bind(this),pageHide:this._pageHide.bind(this)},this.eventBus._on("updateviewarea",this._boundEvents.updateViewarea),window.addEventListener("popstate",this._boundEvents.popState),window.addEventListener("pagehide",this._boundEvents.pageHide))}_unbindEvents(){this._boundEvents&&(this.eventBus._off("updateviewarea",this._boundEvents.updateViewarea),window.removeEventListener("popstate",this._boundEvents.popState),window.removeEventListener("pagehide",this._boundEvents.pageHide),this._boundEvents=null)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFPageView=void 0;var n=i(4),s=i(2),r=i(14),a=i(6),o=i(15),l=i(7),h=i(5),c=i(16),d=i(17),u=i(18),p=i(19),g=i(20);const f=o.compatibilityParams.maxCanvasPixels||16777216,m=()=>({annotationEditorUIManager:null,annotationStorage:null,downloadManager:null,enableScripting:!1,fieldObjectsPromise:null,findController:null,hasJSActionsPromise:null,get linkService(){return new h.SimpleLinkService}});t.PDFPageView=class{#cs=n.AnnotationMode.ENABLE_FORMS;#ds=!1;#us=null;#ps=null;#gs=null;#fs=null;#ms=s.RenderingStates.INITIAL;#_s=s.TextLayerMode.ENABLE;#vs={directDrawing:!0,initialOptionalContent:!0,regularAnnotations:!0};#bs=new WeakMap;constructor(e){const t=e.container,i=e.defaultViewport;this.id=e.id,this.renderingId="page"+this.id,this.#us=e.layerProperties||m,this.pdfPage=null,this.pageLabel=null,this.rotation=0,this.scale=e.scale||s.DEFAULT_SCALE,this.viewport=i,this.pdfPageRotate=i.rotation,this._optionalContentConfigPromise=e.optionalContentConfigPromise||null,this.#_s=e.textLayerMode??s.TextLayerMode.ENABLE,this.#cs=e.annotationMode??n.AnnotationMode.ENABLE_FORMS,this.imageResourcesPath=e.imageResourcesPath||"",this.isOffscreenCanvasSupported=e.isOffscreenCanvasSupported??!0,this.maxCanvasPixels=e.maxCanvasPixels??f,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=!this.renderingQueue?.hasViewer(),this._container=t,e.useOnlyCssZoom&&(console.error("useOnlyCssZoom was removed, please use `maxCanvasPixels = 0` instead."),this.maxCanvasPixels=0),this._annotationCanvasMap=null,this.annotationLayer=null,this.annotationEditorLayer=null,this.textLayer=null,this.zoomLayer=null,this.xfaLayer=null,this.structTreeLayer=null;const r=document.createElement("div");if(r.className="page",r.setAttribute("data-page-number",this.id),r.setAttribute("role","region"),this.l10n.get("page_landmark",{page:this.id}).then((e=>{r.setAttribute("aria-label",e)})),this.div=r,this.#Tn(),t?.append(r),this._isStandalone){t?.style.setProperty("--scale-factor",this.scale*n.PixelsPerInch.PDF_TO_CSS_UNITS);const{optionalContentConfigPromise:i}=e;i&&i.then((e=>{i===this._optionalContentConfigPromise&&(this.#vs.initialOptionalContent=e.hasInitialVisibility)}))}}get renderingState(){return this.#ms}set renderingState(e){if(e!==this.#ms)switch(this.#ms=e,this.#ps&&(clearTimeout(this.#ps),this.#ps=null),e){case s.RenderingStates.PAUSED:this.div.classList.remove("loading");break;case s.RenderingStates.RUNNING:this.div.classList.add("loadingIcon"),this.#ps=setTimeout((()=>{this.div.classList.add("loading"),this.#ps=null}),0);break;case s.RenderingStates.INITIAL:case s.RenderingStates.FINISHED:this.div.classList.remove("loadingIcon","loading")}}#Tn(){const{viewport:e}=this;if(this.pdfPage){if(this.#gs===e.rotation)return;this.#gs=e.rotation}(0,n.setLayerDimensions)(this.div,e,!0,!1)}setPdfPage(e){!this._isStandalone||"CanvasText"!==this.pageColors?.foreground&&"Canvas"!==this.pageColors?.background||this._container?.style.setProperty("--hcm-highligh-filter",e.filterFactory.addHighlightHCMFilter("CanvasText","Canvas","HighlightText","Highlight")),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.#Tn(),this.reset()}destroy(){this.reset(),this.pdfPage?.cleanup()}get _textHighlighter(){return(0,n.shadow)(this,"_textHighlighter",new u.TextHighlighter({pageIndex:this.id-1,eventBus:this.eventBus,findController:this.#us().findController}))}async#ys(){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#Ss(){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#Ps(){let e=null;try{const e=await this.xfaLayer.render(this.viewport,"display");e?.textDivs&&this._textHighlighter&&this.#As(e.textDivs)}catch(t){console.error(`#renderXfaLayer: "${t}".`),e=t}finally{this.eventBus.dispatch("xfalayerrendered",{source:this,pageNumber:this.id,error:e})}}async#ws(){const{pdfPage:e,textLayer:t,viewport:i}=this;if(!t)return;let s=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}".`),s=e}this.eventBus.dispatch("textlayerrendered",{source:this,pageNumber:this.id,numTextDivs:t.numTextDivs,error:s}),this.#Es()}async#Es(){if(!this.textLayer)return;this.structTreeLayer||=new c.StructTreeLayerBuilder;const e=await(this.structTreeLayer.renderingDone?null:this.pdfPage.getStructTree()),t=this.structTreeLayer?.render(e);t&&this.canvas?.append(t),this.structTreeLayer?.show()}async#As(e){const t=await this.pdfPage.getTextContent(),i=[];for(const e of t.items)i.push(e.str);this._textHighlighter.setTextMapping(e,i),this._textHighlighter.enable()}_resetZoomLayer(e=!1){if(!this.zoomLayer)return;const t=this.zoomLayer.firstChild;this.#bs.delete(t),t.width=0,t.height=0,e&&this.zoomLayer.remove(),this.zoomLayer=null}reset({keepZoomLayer:e=!1,keepAnnotationLayer:t=!1,keepAnnotationEditorLayer:i=!1,keepXfaLayer:n=!1,keepTextLayer:r=!1}={}){this.cancelRendering({keepAnnotationLayer:t,keepAnnotationEditorLayer:i,keepXfaLayer:n,keepTextLayer:r}),this.renderingState=s.RenderingStates.INITIAL;const a=this.div,o=a.childNodes,l=e&&this.zoomLayer||null,h=t&&this.annotationLayer?.div||null,c=i&&this.annotationEditorLayer?.div||null,d=n&&this.xfaLayer?.div||null,u=r&&this.textLayer?.div||null;for(let e=o.length-1;e>=0;e--){const t=o[e];switch(t){case l:case h:case c:case d:case u:continue}t.remove()}a.removeAttribute("data-loaded"),h&&this.annotationLayer.hide(),c&&this.annotationEditorLayer.hide(),d&&this.xfaLayer.hide(),u&&this.textLayer.hide(),this.structTreeLayer?.hide(),l||(this.canvas&&(this.#bs.delete(this.canvas),this.canvas.width=0,this.canvas.height=0,delete this.canvas),this._resetZoomLayer())}update({scale:e=0,rotation:t=null,optionalContentConfigPromise:i=null,drawingDelay:r=-1}){this.scale=e||this.scale,"number"==typeof t&&(this.rotation=t),i instanceof Promise&&(this._optionalContentConfigPromise=i,i.then((e=>{i===this._optionalContentConfigPromise&&(this.#vs.initialOptionalContent=e.hasInitialVisibility)}))),this.#vs.directDrawing=!0;const a=(this.rotation+this.pdfPageRotate)%360;if(this.viewport=this.viewport.clone({scale:this.scale*n.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:a}),this.#Tn(),this._isStandalone&&this._container?.style.setProperty("--scale-factor",this.viewport.scale),this.canvas){let e=!1;if(this.#ds)if(0===this.maxCanvasPixels)e=!0;else if(this.maxCanvasPixels>0){const{width:t,height:i}=this.viewport,{sx:n,sy:s}=this.outputScale;e=(Math.floor(t)*n|0)*(Math.floor(i)*s|0)>this.maxCanvasPixels}const t=!e&&r>=0&&r<1e3;if(t||e){if(t&&this.renderingState!==s.RenderingStates.FINISHED&&(this.cancelRendering({keepZoomLayer:!0,keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,cancelExtraDelay:r}),this.renderingState=s.RenderingStates.FINISHED,this.#vs.directDrawing=!1),this.cssTransform({target:this.canvas,redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!t,hideTextLayer:t}),t)return;return void this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this.#fs})}this.zoomLayer||this.canvas.hidden||(this.zoomLayer=this.canvas.parentNode,this.zoomLayer.style.position="absolute")}this.zoomLayer&&this.cssTransform({target:this.zoomLayer.firstChild}),this.reset({keepZoomLayer:!0,keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0})}cancelRendering({keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:i=!1,keepTextLayer:n=!1,cancelExtraDelay:s=0}={}){this.renderTask&&(this.renderTask.cancel(s),this.renderTask=null),this.resume=null,!this.textLayer||n&&this.textLayer.div||(this.textLayer.cancel(),this.textLayer=null),this.structTreeLayer&&!this.textLayer&&(this.structTreeLayer=null),!this.annotationLayer||e&&this.annotationLayer.div||(this.annotationLayer.cancel(),this.annotationLayer=null,this._annotationCanvasMap=null),!this.annotationEditorLayer||t&&this.annotationEditorLayer.div||(this.annotationEditorLayer.cancel(),this.annotationEditorLayer=null),!this.xfaLayer||i&&this.xfaLayer.div||(this.xfaLayer.cancel(),this.xfaLayer=null,this._textHighlighter?.disable())}cssTransform({target:e,redrawAnnotationLayer:t=!1,redrawAnnotationEditorLayer:i=!1,redrawXfaLayer:n=!1,redrawTextLayer:s=!1,hideTextLayer:r=!1}){if(!e.hasAttribute("zooming")){e.setAttribute("zooming",!0);const{style:t}=e;t.width=t.height=""}const a=this.#bs.get(e);if(this.viewport!==a){const t=this.viewport.rotation-a.rotation,i=Math.abs(t);let n=1,s=1;if(90===i||270===i){const{width:e,height:t}=this.viewport;n=t/e,s=e/t}e.style.transform=`rotate(${t}deg) scale(${n}, ${s})`}t&&this.annotationLayer&&this.#ys(),i&&this.annotationEditorLayer&&this.#Ss(),n&&this.xfaLayer&&this.#Ps(),this.textLayer&&(r?(this.textLayer.hide(),this.structTreeLayer?.hide()):s&&this.#ws())}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(e,t){return this.viewport.convertToPdfPoint(e,t)}async#xs(e,t=null){if(e===this.renderTask&&(this.renderTask=null),t instanceof n.RenderingCancelledException)this.#fs=null;else if(this.#fs=t,this.renderingState=s.RenderingStates.FINISHED,this._resetZoomLayer(!0),this.#vs.regularAnnotations=!e.separateAnnots,this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!1,timestamp:performance.now(),error:this.#fs}),t)throw t}async draw(){this.renderingState!==s.RenderingStates.INITIAL&&(console.error("Must be in new state before drawing"),this.reset());const{div:e,l10n:t,pageColors:i,pdfPage:o,viewport:l}=this;if(!o)throw this.renderingState=s.RenderingStates.FINISHED,new Error("pdfPage is not loaded");this.renderingState=s.RenderingStates.RUNNING;const h=document.createElement("div");if(h.classList.add("canvasWrapper"),e.append(h),this.textLayer||this.#_s===s.TextLayerMode.DISABLE||o.isPureXfa||(this._accessibilityManager||=new d.TextAccessibilityManager,this.textLayer=new p.TextLayerBuilder({highlighter:this._textHighlighter,accessibilityManager:this._accessibilityManager,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported,enablePermissions:this.#_s===s.TextLayerMode.ENABLE_PERMISSIONS}),e.append(this.textLayer.div)),!this.annotationLayer&&this.#cs!==n.AnnotationMode.DISABLE){const{annotationStorage:i,downloadManager:s,enableScripting:r,fieldObjectsPromise:l,hasJSActionsPromise:h,linkService:c}=this.#us();this._annotationCanvasMap||=new Map,this.annotationLayer=new a.AnnotationLayerBuilder({pageDiv:e,pdfPage:o,annotationStorage:i,imageResourcesPath:this.imageResourcesPath,renderForms:this.#cs===n.AnnotationMode.ENABLE_FORMS,linkService:c,downloadManager:s,l10n:t,enableScripting:r,hasJSActionsPromise:h,fieldObjectsPromise:l,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager})}const{width:c,height:u}=l,f=document.createElement("canvas");f.setAttribute("role","presentation"),f.hidden=!0;const m=!(!i?.background||!i?.foreground);let _=e=>{m&&!e||(f.hidden=!1,_=null)};h.append(f),this.canvas=f;const v=f.getContext("2d",{alpha:!1}),b=this.outputScale=new s.OutputScale;if(0===this.maxCanvasPixels){const e=1/this.scale;b.sx*=e,b.sy*=e,this.#ds=!0}else if(this.maxCanvasPixels>0){const e=c*u,t=Math.sqrt(this.maxCanvasPixels/e);b.sx>t||b.sy>t?(b.sx=t,b.sy=t,this.#ds=!0):this.#ds=!1}const y=(0,s.approximateFraction)(b.sx),S=(0,s.approximateFraction)(b.sy);f.width=(0,s.roundToDivide)(c*b.sx,y[0]),f.height=(0,s.roundToDivide)(u*b.sy,S[0]);const{style:P}=f;P.width=(0,s.roundToDivide)(c,y[1])+"px",P.height=(0,s.roundToDivide)(u,S[1])+"px",this.#bs.set(f,l);const A={canvasContext:v,transform:b.scaled?[b.sx,0,0,b.sy,0,0]:null,viewport:l,annotationMode:this.#cs,optionalContentConfigPromise:this._optionalContentConfigPromise,annotationCanvasMap:this._annotationCanvasMap,pageColors:i},w=this.renderTask=this.pdfPage.render(A);w.onContinue=e=>{if(_?.(!1),this.renderingQueue&&!this.renderingQueue.isHighestPriority(this))return this.renderingState=s.RenderingStates.PAUSED,void(this.resume=()=>{this.renderingState=s.RenderingStates.RUNNING,e()});e()};const E=w.promise.then((async()=>{if(_?.(!0),await this.#xs(w),this.#ws(),this.annotationLayer&&await this.#ys(),!this.annotationEditorLayer){const{annotationEditorUIManager:i}=this.#us();if(!i)return;this.annotationEditorLayer=new r.AnnotationEditorLayerBuilder({uiManager:i,pageDiv:e,pdfPage:o,l10n:t,accessibilityManager:this._accessibilityManager,annotationLayer:this.annotationLayer?.annotationLayer})}this.#Ss()}),(e=>(e instanceof n.RenderingCancelledException||_?.(!0),this.#xs(w,e))));if(o.isPureXfa){if(this.xfaLayer)this.xfaLayer.div&&e.append(this.xfaLayer.div);else{const{annotationStorage:t,linkService:i}=this.#us();this.xfaLayer=new g.XfaLayerBuilder({pageDiv:e,pdfPage:o,annotationStorage:t,linkService:i})}this.#Ps()}return e.setAttribute("data-loaded",!0),this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id}),E}setPageLabel(e){this.pageLabel="string"==typeof e?e:null,null!==this.pageLabel?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}get thumbnailCanvas(){const{directDrawing:e,initialOptionalContent:t,regularAnnotations:i}=this.#vs;return e&&t&&i?this.canvas:null}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationEditorLayerBuilder=void 0;var n=i(4),s=i(7);t.AnnotationEditorLayerBuilder=class{#wt=null;#Ft;constructor(e){this.pageDiv=e.pageDiv,this.pdfPage=e.pdfPage,this.accessibilityManager=e.accessibilityManager,this.l10n=e.l10n||s.NullL10n,this.annotationEditorLayer=null,this.div=null,this._cancelled=!1,this.#Ft=e.uiManager,this.#wt=e.annotationLayer||null}async render(e,t="display"){if("display"!==t)return;if(this._cancelled)return;const i=e.clone({dontFlip:!0});if(this.div)return this.annotationEditorLayer.update({viewport:i}),void this.show();const s=this.div=document.createElement("div");s.className="annotationEditorLayer",s.tabIndex=0,s.hidden=!0,s.dir=this.#Ft.direction,this.pageDiv.append(s),this.annotationEditorLayer=new n.AnnotationEditorLayer({uiManager:this.#Ft,div:s,accessibilityManager:this.accessibilityManager,pageIndex:this.pdfPage.pageNumber-1,l10n:this.l10n,viewport:i,annotationLayer:this.#wt});const r={viewport:i,div:s,annotations:null,intent:t};this.annotationEditorLayer.render(r),this.show()}cancel(){this._cancelled=!0,this.div&&(this.pageDiv=null,this.annotationEditorLayer.destroy(),this.div.remove())}hide(){this.div&&(this.div.hidden=!0)}show(){this.div&&!this.annotationEditorLayer.isEmpty&&(this.div.hidden=!1)}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.compatibilityParams=t.OptionKind=t.AppOptions=void 0;const i=Object.create(null);t.compatibilityParams=i;{const e=navigator.userAgent||"",t=navigator.platform||"",n=navigator.maxTouchPoints||1,s=/Android/.test(e);(/\b(iPad|iPhone|iPod)(?=;)/.test(e)||"MacIntel"===t&&n>1||s)&&(i.maxCanvasPixels=5242880)}const n={VIEWER:2,API:4,WORKER:8,PREFERENCE:128};t.OptionKind=n;const s={annotationEditorMode:{value:0,kind:n.VIEWER+n.PREFERENCE},annotationMode:{value:2,kind:n.VIEWER+n.PREFERENCE},cursorToolOnLoad:{value:0,kind:n.VIEWER+n.PREFERENCE},defaultZoomDelay:{value:400,kind:n.VIEWER+n.PREFERENCE},defaultZoomValue:{value:"",kind:n.VIEWER+n.PREFERENCE},disableHistory:{value:!1,kind:n.VIEWER},disablePageLabels:{value:!1,kind:n.VIEWER+n.PREFERENCE},enablePermissions:{value:!1,kind:n.VIEWER+n.PREFERENCE},enablePrintAutoRotate:{value:!0,kind:n.VIEWER+n.PREFERENCE},enableScripting:{value:!0,kind:n.VIEWER+n.PREFERENCE},enableStampEditor:{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},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},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:"../build/pdf.worker.js",kind:n.WORKER}};s.defaultUrl={value:"compressed.tracemonkey-pldi-09.pdf",kind:n.VIEWER},s.disablePreferences={value:!1,kind:n.VIEWER},s.locale={value:navigator.language||"en-US",kind:n.VIEWER},s.sandboxBundleSrc={value:"../build/pdf.sandbox.js",kind:n.VIEWER};const r=Object.create(null);class a{constructor(){throw new Error("Cannot initialize AppOptions.")}static get(e){const t=r[e];if(void 0!==t)return t;const n=s[e];return void 0!==n?i[e]??n.value:void 0}static getAll(e=null){const t=Object.create(null);for(const a in s){const o=s[a];if(e){if(0==(e&o.kind))continue;if(e===n.PREFERENCE){const e=o.value,i=typeof e;if("boolean"===i||"string"===i||"number"===i&&Number.isInteger(e)){t[a]=e;continue}throw new Error(`Invalid type for preference: ${a}`)}}const l=r[a];t[a]=void 0!==l?l:i[a]??o.value}return t}static set(e,t){r[e]=t}static setAll(e){for(const t in e)r[t]=e[t]}static remove(e){delete r[e]}}t.AppOptions=a,a._hasUserOptions=function(){return Object.keys(r).length>0}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StructTreeLayerBuilder=void 0;var n=i(2);const s={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},r=/^H(\d+)$/;t.StructTreeLayerBuilder=class{#Cs=void 0;get renderingDone(){return void 0!==this.#Cs}render(e){if(void 0!==this.#Cs)return this.#Cs;const t=this.#Ms(e);return t?.classList.add("structTree"),this.#Cs=t}hide(){this.#Cs&&!this.#Cs.hidden&&(this.#Cs.hidden=!0)}show(){this.#Cs?.hidden&&(this.#Cs.hidden=!1)}#Ts(e,t){const{alt:i,id:s,lang:r}=e;void 0!==i&&t.setAttribute("aria-label",(0,n.removeNullCharacters)(i)),void 0!==s&&t.setAttribute("aria-owns",s),void 0!==r&&t.setAttribute("lang",(0,n.removeNullCharacters)(r,!0))}#Ms(e){if(!e)return null;const t=document.createElement("span");if("role"in e){const{role:i}=e,n=i.match(r);n?(t.setAttribute("role","heading"),t.setAttribute("aria-level",n[1])):s[i]&&t.setAttribute("role",s[i])}if(this.#Ts(e,t),e.children)if(1===e.children.length&&"id"in e.children[0])this.#Ts(e.children[0],t);else for(const i of e.children)t.append(this.#Ms(i));return t}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextAccessibilityManager=void 0;var n=i(2);class s{#Ds=!1;#Fs=null;#ks=new Map;#Ls=new Map;setTextMapping(e){this.#Fs=e}static#Rs(e,t){const i=e.getBoundingClientRect(),n=t.getBoundingClientRect();if(0===i.width&&0===i.height)return 1;if(0===n.width&&0===n.height)return-1;const s=i.y,r=i.y+i.height,a=i.y+i.height/2,o=n.y,l=n.y+n.height,h=n.y+n.height/2;return a<=o&&h>=r?-1:h<=s&&a>=l?1:i.x+i.width/2-(n.x+n.width/2)}enable(){if(this.#Ds)throw new Error("TextAccessibilityManager is already enabled.");if(!this.#Fs)throw new Error("Text divs and strings have not been set.");if(this.#Ds=!0,this.#Fs=this.#Fs.slice(),this.#Fs.sort(s.#Rs),this.#ks.size>0){const e=this.#Fs;for(const[t,i]of this.#ks)document.getElementById(t)?this.#Is(t,e[i]):this.#ks.delete(t)}for(const[e,t]of this.#Ls)this.addPointerInTextLayer(e,t);this.#Ls.clear()}disable(){this.#Ds&&(this.#Ls.clear(),this.#Fs=null,this.#Ds=!1)}removePointerInTextLayer(e){if(!this.#Ds)return void this.#Ls.delete(e);const t=this.#Fs;if(!t||0===t.length)return;const{id:i}=e,n=this.#ks.get(i);if(void 0===n)return;const s=t[n];this.#ks.delete(i);let r=s.getAttribute("aria-owns");r?.includes(i)&&(r=r.split(" ").filter((e=>e!==i)).join(" "),r?s.setAttribute("aria-owns",r):(s.removeAttribute("aria-owns"),s.setAttribute("role","presentation")))}#Is(e,t){const i=t.getAttribute("aria-owns");i?.includes(e)||t.setAttribute("aria-owns",i?`${i} ${e}`:e),t.removeAttribute("role")}addPointerInTextLayer(e,t){const{id:i}=e;if(!i)return null;if(!this.#Ds)return this.#Ls.set(e,t),null;t&&this.removePointerInTextLayer(e);const r=this.#Fs;if(!r||0===r.length)return null;const a=(0,n.binarySearchFirstItem)(r,(t=>s.#Rs(e,t)<0)),o=Math.max(0,a-1),l=r[o];this.#Is(i,l),this.#ks.set(i,o);const h=l.parentNode;return h?.classList.contains("markedContent")?h.id:null}moveElementInDOM(e,t,i,r){const a=this.addPointerInTextLayer(i,r);if(!e.hasChildNodes())return e.append(t),a;const o=Array.from(e.childNodes).filter((e=>e!==t));if(0===o.length)return a;const l=i||t,h=(0,n.binarySearchFirstItem)(o,(e=>s.#Rs(l,e)<0));return 0===h?o[0].before(t):o[h-1].after(t),a}}t.TextAccessibilityManager=s},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextHighlighter=void 0,t.TextHighlighter=class{constructor({findController:e,eventBus:t,pageIndex:i}){this.findController=e,this.matches=[],this.eventBus=t,this.pageIdx=i,this._onUpdateTextLayerMatches=null,this.textDivs=null,this.textContentItemsStr=null,this.enabled=!1}setTextMapping(e,t){this.textDivs=e,this.textContentItemsStr=t}enable(){if(!this.textDivs||!this.textContentItemsStr)throw new Error("Text divs and strings have not been set.");if(this.enabled)throw new Error("TextHighlighter is already enabled.");this.enabled=!0,this._onUpdateTextLayerMatches||(this._onUpdateTextLayerMatches=e=>{e.pageIndex!==this.pageIdx&&-1!==e.pageIndex||this._updateMatches()},this.eventBus._on("updatetextlayermatches",this._onUpdateTextLayerMatches)),this._updateMatches()}disable(){this.enabled&&(this.enabled=!1,this._onUpdateTextLayerMatches&&(this.eventBus._off("updatetextlayermatches",this._onUpdateTextLayerMatches),this._onUpdateTextLayerMatches=null),this._updateMatches(!0))}_convertMatches(e,t){if(!e)return[];const{textContentItemsStr:i}=this;let n=0,s=0;const r=i.length-1,a=[];for(let o=0,l=e.length;o<l;o++){let l=e[o];for(;n!==r&&l>=s+i[n].length;)s+=i[n].length,n++;n===i.length&&console.error("Could not find a matching mapping");const h={begin:{divIdx:n,offset:l-s}};for(l+=t[o];n!==r&&l>s+i[n].length;)s+=i[n].length,n++;h.end={divIdx:n,offset:l-s},a.push(h)}return a}_renderMatches(e){if(0===e.length)return;const{findController:t,pageIdx:i}=this,{textContentItemsStr:n,textDivs:s}=this,r=i===t.selected.pageIdx,a=t.selected.matchIdx;let o=null;const l={divIdx:-1,offset:void 0};function h(e,t){const i=e.divIdx;return s[i].textContent="",c(i,0,e.offset,t)}function c(e,t,i,r){let a=s[e];if(a.nodeType===Node.TEXT_NODE){const t=document.createElement("span");a.before(t),t.append(a),s[e]=t,a=t}const o=n[e].substring(t,i),l=document.createTextNode(o);if(r){const e=document.createElement("span");return e.className=`${r} appended`,e.append(l),a.append(e),r.includes("selected")?e.offsetLeft:0}return a.append(l),0}let d=a,u=d+1;if(t.state.highlightAll)d=0,u=e.length;else if(!r)return;let p=-1,g=-1;for(let n=d;n<u;n++){const d=e[n],u=d.begin;if(u.divIdx===p&&u.offset===g)continue;p=u.divIdx,g=u.offset;const f=d.end,m=r&&n===a,_=m?" selected":"";let v=0;if(o&&u.divIdx===o.divIdx?c(o.divIdx,o.offset,u.offset):(null!==o&&c(o.divIdx,o.offset,l.offset),h(u)),u.divIdx===f.divIdx)v=c(u.divIdx,u.offset,f.offset,"highlight"+_);else{v=c(u.divIdx,u.offset,l.offset,"highlight begin"+_);for(let e=u.divIdx+1,t=f.divIdx;e<t;e++)s[e].className="highlight middle"+_;h(f,"highlight end"+_)}o=f,m&&t.scrollMatchIntoView({element:s[u.divIdx],selectedLeft:v,pageIndex:i,matchIndex:a})}o&&c(o.divIdx,o.offset,l.offset)}_updateMatches(e=!1){if(!this.enabled&&!e)return;const{findController:t,matches:i,pageIdx:n}=this,{textContentItemsStr:s,textDivs:r}=this;let a=-1;for(const e of i){for(let t=Math.max(a,e.begin.divIdx),i=e.end.divIdx;t<=i;t++){const e=r[t];e.textContent=s[t],e.className=""}a=e.end.divIdx+1}if(!t?.highlightMatches||e)return;const o=t.pageMatches[n]||null,l=t.pageMatchesLength[n]||null;this.matches=this._convertMatches(o,l),this._renderMatches(this.matches)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextLayerBuilder=void 0;var n=i(4),s=i(2);t.TextLayerBuilder=class{#Os=!1;#Ns=0;#Bs=0;#Vs=null;constructor({highlighter:e=null,accessibilityManager:t=null,isOffscreenCanvasSupported:i=!0,enablePermissions:n=!1}){this.textContentItemsStr=[],this.renderingDone=!1,this.textDivs=[],this.textDivProperties=new WeakMap,this.textLayerRenderTask=null,this.highlighter=e,this.accessibilityManager=t,this.isOffscreenCanvasSupported=i,this.#Os=!0===n,this.div=document.createElement("div"),this.div.className="textLayer",this.hide()}#Us(){this.renderingDone=!0;const e=document.createElement("div");e.className="endOfContent",this.div.append(e),this.#js()}get numTextDivs(){return this.textDivs.length}async render(e){if(!this.#Vs)throw new Error('No "textContentSource" parameter specified.');const t=e.scale*(globalThis.devicePixelRatio||1),{rotation:i}=e;if(this.renderingDone){const s=i!==this.#Ns,r=t!==this.#Bs;return(s||r)&&(this.hide(),(0,n.updateTextLayer)({container:this.div,viewport:e,textDivs:this.textDivs,textDivProperties:this.textDivProperties,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported,mustRescale:r,mustRotate:s}),this.#Bs=t,this.#Ns=i),void this.show()}this.cancel(),this.highlighter?.setTextMapping(this.textDivs,this.textContentItemsStr),this.accessibilityManager?.setTextMapping(this.textDivs),this.textLayerRenderTask=(0,n.renderTextLayer)({textContentSource:this.#Vs,container:this.div,viewport:e,textDivs:this.textDivs,textDivProperties:this.textDivProperties,textContentItemsStr:this.textContentItemsStr,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported}),await this.textLayerRenderTask.promise,this.#Us(),this.#Bs=t,this.#Ns=i,this.show(),this.accessibilityManager?.enable()}hide(){this.div.hidden||(this.highlighter?.disable(),this.div.hidden=!0)}show(){this.div.hidden&&this.renderingDone&&(this.div.hidden=!1,this.highlighter?.enable())}cancel(){this.textLayerRenderTask&&(this.textLayerRenderTask.cancel(),this.textLayerRenderTask=null),this.highlighter?.disable(),this.accessibilityManager?.disable(),this.textContentItemsStr.length=0,this.textDivs.length=0,this.textDivProperties=new WeakMap}setTextContentSource(e){this.cancel(),this.#Vs=e}#js(){const{div:e}=this;e.addEventListener("mousedown",(t=>{const i=e.querySelector(".endOfContent");if(!i)return;let n=t.target!==e;if(n&&="none"!==getComputedStyle(i).getPropertyValue("-moz-user-select"),n){const n=e.getBoundingClientRect(),s=Math.max(0,(t.pageY-n.top)/n.height);i.style.top=(100*s).toFixed(2)+"%"}i.classList.add("active")})),e.addEventListener("mouseup",(()=>{const t=e.querySelector(".endOfContent");t&&(t.style.top="",t.classList.remove("active"))})),e.addEventListener("copy",(e=>{if(!this.#Os){const t=document.getSelection();e.clipboardData.setData("text/plain",(0,s.removeNullCharacters)((0,n.normalizeUnicode)(t.toString())))}e.preventDefault(),e.stopPropagation()}))}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.XfaLayerBuilder=void 0;var n=i(4);t.XfaLayerBuilder=class{constructor({pageDiv:e,pdfPage:t,annotationStorage:i=null,linkService:n,xfaHtml:s=null}){this.pageDiv=e,this.pdfPage=t,this.annotationStorage=i,this.linkService=n,this.xfaHtml=s,this.div=null,this._cancelled=!1}async render(e,t="display"){if("print"===t){const i={viewport:e.clone({dontFlip:!0}),div:this.div,xfaHtml:this.xfaHtml,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t},s=document.createElement("div");return this.pageDiv.append(s),i.div=s,n.XfaLayer.render(i)}const i=await this.pdfPage.getXfa();if(this._cancelled||!i)return{textDivs:[]};const s={viewport:e.clone({dontFlip:!0}),div:this.div,xfaHtml:i,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t};return this.div?n.XfaLayer.update(s):(this.div=document.createElement("div"),this.pageDiv.append(this.div),s.div=this.div,n.XfaLayer.render(s))}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFScriptingManager=void 0;var n=i(22),s=i(23);class r extends s.PDFScriptingManager{constructor(e){e.externalServices||window.addEventListener("updatefromsandbox",(t=>{e.eventBus.dispatch("updatefromsandbox",{source:window,detail:t.detail})})),e.externalServices||={createScripting:({sandboxBundleSrc:e})=>new n.GenericScripting(e)},e.docProperties||=e=>(0,n.docProperties)(e),super(e)}}t.PDFScriptingManager=r},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GenericScripting=void 0,t.docProperties=async function(e){const t="".split("#")[0];let{info:i,metadata:s,contentDispositionFilename:r,contentLength:a}=await e.getMetadata();if(!a){const{length:t}=await e.getDownloadInfo();a=t}return{...i,baseURL:t,filesize:a,filename:r||(0,n.getPdfFilenameFromUrl)(""),metadata:s?.getRaw(),authors:s?.get("dc:creator"),numPages:e.numPages,URL:""}};var n=i(4);t.GenericScripting=class{constructor(e){this._ready=(0,n.loadScript)(e,!0).then((()=>window.pdfjsSandbox.QuickJSSandbox()))}async createSandbox(e){(await this._ready).create(e)}async dispatchEventInSandbox(e){const t=await this._ready;setTimeout((()=>t.dispatchEvent(e)),0)}async destroySandbox(){(await this._ready).nukeSandbox()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFScriptingManager=void 0;var n=i(2),s=i(4);t.PDFScriptingManager=class{#Hs=null;#Ws=null;#zs=null;#Gs=null;#$s=null;#qs=null;#Xs=null;#Ks=!1;#Ys=null;#Qs=null;#Js=null;constructor({eventBus:e,sandboxBundleSrc:t=null,externalServices:i=null,docProperties:n=null}){this.#Gs=e,this.#Ys=t,this.#$s=i,this.#zs=n}setViewer(e){this.#Xs=e}async setDocument(e){if(this.#qs&&await this.#Zs(),this.#qs=e,!e)return;const[t,i,n]=await Promise.all([e.getFieldObjects(),e.getCalculationOrderIds(),e.getJSActions()]);if(t||n){if(e===this.#qs){try{this.#Qs=this.#er()}catch(e){return console.error(`setDocument: "${e.message}".`),void await this.#Zs()}this._internalEvents.set("updatefromsandbox",(e=>{e?.source===window&&this.#tr(e.detail)})),this._internalEvents.set("dispatcheventinsandbox",(e=>{this.#Qs?.dispatchEventInSandbox(e.detail)})),this._internalEvents.set("pagechanging",(({pageNumber:e,previous:t})=>{e!==t&&(this.#ir(t),this.#nr(e))})),this._internalEvents.set("pagerendered",(({pageNumber:e})=>{this._pageOpenPending.has(e)&&e===this.#Xs.currentPageNumber&&this.#nr(e)})),this._internalEvents.set("pagesdestroy",(async()=>{await this.#ir(this.#Xs.currentPageNumber),await(this.#Qs?.dispatchEventInSandbox({id:"doc",name:"WillClose"})),this.#Hs?.resolve()}));for(const[e,t]of this._internalEvents)this.#Gs._on(e,t);try{const s=await this.#zs(e);if(e!==this.#qs)return;await this.#Qs.createSandbox({objects:t,calculationOrder:i,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...s,actions:n}}),this.#Gs.dispatch("sandboxcreated",{source:this})}catch(e){return console.error(`setDocument: "${e.message}".`),void await this.#Zs()}await(this.#Qs?.dispatchEventInSandbox({id:"doc",name:"Open"})),await this.#nr(this.#Xs.currentPageNumber,!0),Promise.resolve().then((()=>{e===this.#qs&&(this.#Ks=!0)}))}}else await this.#Zs()}async dispatchWillSave(){return this.#Qs?.dispatchEventInSandbox({id:"doc",name:"WillSave"})}async dispatchDidSave(){return this.#Qs?.dispatchEventInSandbox({id:"doc",name:"DidSave"})}async dispatchWillPrint(){if(this.#Qs){await(this.#Js?.promise),this.#Js=new s.PromiseCapability;try{await this.#Qs.dispatchEventInSandbox({id:"doc",name:"WillPrint"})}catch(e){throw this.#Js.resolve(),this.#Js=null,e}await this.#Js.promise}}async dispatchDidPrint(){return this.#Qs?.dispatchEventInSandbox({id:"doc",name:"DidPrint"})}get destroyPromise(){return this.#Ws?.promise||null}get ready(){return this.#Ks}get _internalEvents(){return(0,s.shadow)(this,"_internalEvents",new Map)}get _pageOpenPending(){return(0,s.shadow)(this,"_pageOpenPending",new Set)}get _visitedPages(){return(0,s.shadow)(this,"_visitedPages",new Map)}async#tr(e){const t=this.#Xs,i=t.isInPresentationMode||t.isChangingPresentationMode,{id:s,siblings:r,command:a,value:o}=e;if(!s){switch(a){case"clear":console.clear();break;case"error":console.error(o);break;case"layout":if(!i){const e=(0,n.apiPageLayoutToViewerModes)(o);t.spreadMode=e.spreadMode}break;case"page-num":t.currentPageNumber=o+1;break;case"print":await t.pagesPromise,this.#Gs.dispatch("print",{source:this});break;case"println":console.log(o);break;case"zoom":i||(t.currentScaleValue=o);break;case"SaveAs":this.#Gs.dispatch("download",{source:this});break;case"FirstPage":t.currentPageNumber=1;break;case"LastPage":t.currentPageNumber=t.pagesCount;break;case"NextPage":t.nextPage();break;case"PrevPage":t.previousPage();break;case"ZoomViewIn":i||t.increaseScale();break;case"ZoomViewOut":i||t.decreaseScale();break;case"WillPrintFinished":this.#Js?.resolve(),this.#Js=null}return}if(i&&e.focus)return;delete e.id,delete e.siblings;const l=r?[s,...r]:[s];for(const t of l){const i=document.querySelector(`[data-element-id="${t}"]`);i?i.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:e})):this.#qs?.annotationStorage.setValue(t,e)}}async#nr(e,t=!1){const i=this.#qs,r=this._visitedPages;if(t&&(this.#Hs=new s.PromiseCapability),!this.#Hs)return;const a=this.#Xs.getPageView(e-1);if(a?.renderingState!==n.RenderingStates.FINISHED)return void this._pageOpenPending.add(e);this._pageOpenPending.delete(e);const o=(async()=>{const t=await(r.has(e)?null:a.pdfPage?.getJSActions());i===this.#qs&&await(this.#Qs?.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:e,actions:t}))})();r.set(e,o)}async#ir(e){const t=this.#qs,i=this._visitedPages;if(!this.#Hs)return;if(this._pageOpenPending.has(e))return;const n=i.get(e);n&&(i.set(e,null),await n,t===this.#qs&&await(this.#Qs?.dispatchEventInSandbox({id:"page",name:"PageClose",pageNumber:e})))}#er(){if(this.#Ws=new s.PromiseCapability,this.#Qs)throw new Error("#initScripting: Scripting already exists.");return this.#$s.createScripting({sandboxBundleSrc:this.#Ys})}async#Zs(){if(!this.#Qs)return this.#qs=null,void this.#Ws?.resolve();this.#Hs&&(await Promise.race([this.#Hs.promise,new Promise((e=>{setTimeout(e,1e3)}))]).catch((()=>{})),this.#Hs=null),this.#qs=null;try{await this.#Qs.destroySandbox()}catch{}this.#Js?.reject(new Error("Scripting destroyed.")),this.#Js=null;for(const[e,t]of this._internalEvents)this.#Gs._off(e,t);this._internalEvents.clear(),this._pageOpenPending.clear(),this._visitedPages.clear(),this.#Qs=null,this.#Ks=!1,this.#Ws?.resolve()}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFSinglePageViewer=void 0;var n=i(2),s=i(25);class r extends s.PDFViewer{_resetView(){super._resetView(),this._scrollMode=n.ScrollMode.PAGE,this._spreadMode=n.SpreadMode.NONE}set scrollMode(e){}_updateScrollMode(){}set spreadMode(e){}_updateSpreadMode(){}}t.PDFSinglePageViewer=r},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PagesCountLimit=t.PDFViewer=t.PDFPageViewBuffer=void 0;var n=i(4),s=i(2),r=i(7),a=i(13),o=i(26),l=i(5);const h={FORCE_SCROLL_MODE_PAGE:15e3,FORCE_LAZY_PAGE_INIT:7500,PAUSE_EAGER_PAGE_INIT:250};function c(e){return Object.values(n.AnnotationEditorType).includes(e)&&e!==n.AnnotationEditorType.DISABLE}t.PagesCountLimit=h;class d{#sr=new Set;#rr=0;constructor(e){this.#rr=e}push(e){const t=this.#sr;t.has(e)&&t.delete(e),t.add(e),t.size>this.#rr&&this.#ar()}resize(e,t=null){this.#rr=e;const i=this.#sr;if(t){const e=i.size;let n=1;for(const s of i)if(t.has(s.id)&&(i.delete(s),i.add(s)),++n>e)break}for(;i.size>this.#rr;)this.#ar()}has(e){return this.#sr.has(e)}[Symbol.iterator](){return this.#sr.keys()}#ar(){const e=this.#sr.keys().next().value;e?.destroy(),this.#sr.delete(e)}}t.PDFPageViewBuffer=d,t.PDFViewer=class{#or=null;#ne=null;#lr=n.AnnotationEditorType.NONE;#hr=null;#cs=n.AnnotationMode.ENABLE_FORMS;#cr=null;#dr=null;#Os=!1;#ur=!1;#pr=null;#gr=!1;#fr=0;#mr=new ResizeObserver(this.#_r.bind(this));#vr=null;#br=null;#yr=null;#_s=s.TextLayerMode.ENABLE;constructor(e){const t="3.11.174";if(n.version!==t)throw new Error(`The API version "${n.version}" does not match the Viewer version "${t}".`);if(this.container=e.container,this.viewer=e.viewer||e.container.firstElementChild,"DIV"!==this.container?.tagName||"DIV"!==this.viewer?.tagName)throw new Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&"absolute"!==getComputedStyle(this.container).position)throw new Error("The `container` must be absolutely positioned.");this.#mr.observe(this.container),this.eventBus=e.eventBus,this.linkService=e.linkService||new l.SimpleLinkService,this.downloadManager=e.downloadManager||null,this.findController=e.findController||null,this.#ne=e.altTextManager||null,this.findController&&(this.findController.onIsPageVisible=e=>this._getVisiblePages().ids.has(e)),this._scriptingManager=e.scriptingManager||null,this.#_s=e.textLayerMode??s.TextLayerMode.ENABLE,this.#cs=e.annotationMode??n.AnnotationMode.ENABLE_FORMS,this.#lr=e.annotationEditorMode??n.AnnotationEditorType.NONE,this.imageResourcesPath=e.imageResourcesPath||"",this.enablePrintAutoRotate=e.enablePrintAutoRotate||!1,this.removePageBorders=e.removePageBorders||!1,e.useOnlyCssZoom&&(console.error("useOnlyCssZoom was removed, please use `maxCanvasPixels = 0` instead."),e.maxCanvasPixels=0),this.isOffscreenCanvasSupported=e.isOffscreenCanvasSupported??!0,this.maxCanvasPixels=e.maxCanvasPixels,this.l10n=e.l10n||r.NullL10n,this.#Os=e.enablePermissions||!1,this.pageColors=e.pageColors||null,this.defaultRenderingQueue=!e.renderingQueue,this.defaultRenderingQueue?(this.renderingQueue=new o.PDFRenderingQueue,this.renderingQueue.setViewer(this)):this.renderingQueue=e.renderingQueue,this.scroll=(0,s.watchScroll)(this.container,this._scrollUpdate.bind(this)),this.presentationModeState=s.PresentationModeState.UNKNOWN,this._onBeforeDraw=this._onAfterDraw=null,this._resetView(),this.removePageBorders&&this.viewer.classList.add("removePageBorders"),this.#Sr(),this.eventBus._on("thumbnailrendered",(({pageNumber:e,pdfPage:t})=>{const i=this._pages[e-1];this.#or.has(i)||t?.cleanup()}))}get pagesCount(){return this._pages.length}getPageView(e){return this._pages[e]}getCachedPageViews(){return new Set(this.#or)}get pageViewsReady(){return this._pagesCapability.settled&&this._pages.every((e=>e?.pdfPage))}get renderForms(){return this.#cs===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.");this.pdfDocument&&(this._setCurrentPageNumber(e,!0)||console.error(`currentPageNumber: "${e}" is not a valid page.`))}_setCurrentPageNumber(e,t=!1){if(this._currentPageNumber===e)return t&&this.#Pr(),!0;if(!(0<e&&e<=this.pagesCount))return!1;const i=this._currentPageNumber;return this._currentPageNumber=e,this.eventBus.dispatch("pagechanging",{source:this,pageNumber:e,pageLabel:this._pageLabels?.[e-1]??null,previous:i}),t&&this.#Pr(),!0}get currentPageLabel(){return this._pageLabels?.[this._currentPageNumber-1]??null}set currentPageLabel(e){if(!this.pdfDocument)return;let t=0|e;if(this._pageLabels){const i=this._pageLabels.indexOf(e);i>=0&&(t=i+1)}this._setCurrentPageNumber(t,!0)||console.error(`currentPageLabel: "${e}" is not a valid page.`)}get currentScale(){return this._currentScale!==s.UNKNOWN_SCALE?this._currentScale:s.DEFAULT_SCALE}set currentScale(e){if(isNaN(e))throw new Error("Invalid numeric scale.");this.pdfDocument&&this.#Ar(e,{noScroll:!1})}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(e){this.pdfDocument&&this.#Ar(e,{noScroll:!1})}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!(0,s.isValidRotation)(e))throw new Error("Invalid pages rotation angle.");if(!this.pdfDocument)return;if((e%=360)<0&&(e+=360),this._pagesRotation===e)return;this._pagesRotation=e;const t=this._currentPageNumber;this.refresh(!0,{rotation:e}),this._currentScaleValue&&this.#Ar(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}#us(){const e=this;return{get annotationEditorUIManager(){return e.#hr},get annotationStorage(){return e.pdfDocument?.annotationStorage},get downloadManager(){return e.downloadManager},get enableScripting(){return!!e._scriptingManager},get fieldObjectsPromise(){return e.pdfDocument?.getFieldObjects()},get findController(){return e.findController},get hasJSActionsPromise(){return e.pdfDocument?.hasJSActions()},get linkService(){return e.linkService}}}#wr(e){const t={annotationEditorMode:this.#lr,annotationMode:this.#cs,textLayerMode:this.#_s};return e?(e.includes(n.PermissionFlag.COPY)||this.#_s!==s.TextLayerMode.ENABLE||(t.textLayerMode=s.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.#cs!==n.AnnotationMode.ENABLE_FORMS||(t.annotationMode=n.AnnotationMode.ENABLE),t):t}#Er(){if("hidden"===document.visibilityState||!this.container.offsetParent||0===this._getVisiblePages().views.length)return Promise.resolve();const e=new Promise((e=>{this.#br=()=>{"hidden"===document.visibilityState&&(e(),document.removeEventListener("visibilitychange",this.#br),this.#br=null)},document.addEventListener("visibilitychange",this.#br)}));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.#gr)return null;t.length=0;const n=await this.pdfDocument.getPage(i),{items:r}=await n.getTextContent();for(const e of r)e.str&&t.push(e.str),e.hasEOL&&t.push("\n");e.push((0,s.removeNullCharacters)(t.join("")))}return e.join("\n")}#xr(e,t){const i=document.getSelection(),{focusNode:n,anchorNode:r}=i;if(r&&n&&i.containsNode(this.#pr)){if(this.#ur||e===s.TextLayerMode.ENABLE_PERMISSIONS)return t.preventDefault(),void t.stopPropagation();this.#ur=!0;const i=this.container.style.cursor;this.container.style.cursor="wait";const n=e=>this.#gr="Escape"===e.key;window.addEventListener("keydown",n),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.#ur=!1,this.#gr=!1,window.removeEventListener("keydown",n),this.container.style.cursor=i})),t.preventDefault(),t.stopPropagation()}}setDocument(e){if(this.pdfDocument&&(this.eventBus.dispatch("pagesdestroy",{source:this}),this._cancelRendering(),this._resetView(),this.findController?.setDocument(null),this._scriptingManager?.setDocument(null),this.#hr&&(this.#hr.destroy(),this.#hr=null)),this.pdfDocument=e,!e)return;const t=e.numPages,i=e.getPage(1),r=e.getOptionalContentConfig(),o=this.#Os?e.getPermissions():Promise.resolve();if(t>h.FORCE_SCROLL_MODE_PAGE){console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");const e=this._scrollMode=s.ScrollMode.PAGE;this.eventBus.dispatch("scrollmodechanged",{source:this,mode:e})}this._pagesCapability.promise.then((()=>{this.eventBus.dispatch("pagesloaded",{source:this,pagesCount:t})}),(()=>{})),this._onBeforeDraw=e=>{const t=this._pages[e.pageNumber-1];t&&this.#or.push(t)},this.eventBus._on("pagerender",this._onBeforeDraw),this._onAfterDraw=e=>{e.cssTransform||this._onePageRenderedCapability.settled||(this._onePageRenderedCapability.resolve({timestamp:e.timestamp}),this.eventBus._off("pagerendered",this._onAfterDraw),this._onAfterDraw=null,this.#br&&(document.removeEventListener("visibilitychange",this.#br),this.#br=null))},this.eventBus._on("pagerendered",this._onAfterDraw),Promise.all([i,o]).then((([i,o])=>{if(e!==this.pdfDocument)return;this._firstPageCapability.resolve(i),this._optionalContentConfigPromise=r;const{annotationEditorMode:l,annotationMode:d,textLayerMode:u}=this.#wr(o);if(u!==s.TextLayerMode.DISABLE){const e=this.#pr=document.createElement("div");e.id="hiddenCopyElement",this.viewer.before(e)}if(l!==n.AnnotationEditorType.DISABLE){const t=l;e.isPureXfa?console.warn("Warning: XFA-editing is not implemented."):c(t)?(this.#hr=new n.AnnotationEditorUIManager(this.container,this.viewer,this.#ne,this.eventBus,e,this.pageColors),t!==n.AnnotationEditorType.NONE&&this.#hr.updateMode(t)):console.error(`Invalid AnnotationEditor mode: ${t}`)}const p=this.#us.bind(this),g=this._scrollMode===s.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),"CanvasText"!==this.pageColors?.foreground&&"Canvas"!==this.pageColors?.background||this.viewer.style.setProperty("--hcm-highligh-filter",e.filterFactory.addHighlightHCMFilter("CanvasText","Canvas","HighlightText","Highlight"));for(let e=1;e<=t;++e){const t=new a.PDFPageView({container:g,eventBus:this.eventBus,id:e,scale:f,defaultViewport:m.clone(),optionalContentConfigPromise:r,renderingQueue:this.renderingQueue,textLayerMode:u,annotationMode:d,imageResourcesPath:this.imageResourcesPath,isOffscreenCanvasSupported:this.isOffscreenCanvasSupported,maxCanvasPixels:this.maxCanvasPixels,pageColors:this.pageColors,l10n:this.l10n,layerProperties:p});this._pages.push(t)}const _=this._pages[0];_&&(_.setPdfPage(i),this.linkService.cachePageRef(1,i.ref)),this._scrollMode===s.ScrollMode.PAGE?this.#Cr():this._spreadMode!==s.SpreadMode.NONE&&this._updateSpreadMode(),this.#Er().then((async()=>{if(this.findController?.setDocument(e),this._scriptingManager?.setDocument(e),this.#pr&&(this.#dr=this.#xr.bind(this,u),document.addEventListener("copy",this.#dr)),this.#hr&&this.eventBus.dispatch("annotationeditormodechanged",{source:this,mode:this.#lr}),e.loadingParams.disableAutoFetch||t>h.FORCE_LAZY_PAGE_INIT)return void this._pagesCapability.resolve();let i=t-1;if(i<=0)this._pagesCapability.resolve();else for(let n=2;n<=t;++n){const t=e.getPage(n).then((e=>{const t=this._pages[n-1];t.pdfPage||t.setPdfPage(e),this.linkService.cachePageRef(n,e.ref),0==--i&&this._pagesCapability.resolve()}),(e=>{console.error(`Unable to get page ${n} to initialize viewer`,e),0==--i&&this._pagesCapability.resolve()}));n%h.PAUSE_EAGER_PAGE_INIT==0&&await t}})),this.eventBus.dispatch("pagesinit",{source:this}),e.getMetadata().then((({info:t})=>{e===this.pdfDocument&&t.Language&&(this.viewer.lang=t.Language)})),this.defaultRenderingQueue&&this.update()})).catch((e=>{console.error("Unable to initialize viewer",e),this._pagesCapability.reject(e)}))}setPageLabels(e){if(this.pdfDocument){e?Array.isArray(e)&&this.pdfDocument.numPages===e.length?this._pageLabels=e:(this._pageLabels=null,console.error("setPageLabels: Invalid page labels.")):this._pageLabels=null;for(let e=0,t=this._pages.length;e<t;e++)this._pages[e].setPageLabel(this._pageLabels?.[e]??null)}}_resetView(){this._pages=[],this._currentPageNumber=1,this._currentScale=s.UNKNOWN_SCALE,this._currentScaleValue=null,this._pageLabels=null,this.#or=new d(10),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=s.ScrollMode.VERTICAL,this._previousScrollMode=s.ScrollMode.UNKNOWN,this._spreadMode=s.SpreadMode.NONE,this.#vr={previousPageNumber:1,scrollDown:!0,pages:[]},this._onBeforeDraw&&(this.eventBus._off("pagerender",this._onBeforeDraw),this._onBeforeDraw=null),this._onAfterDraw&&(this.eventBus._off("pagerendered",this._onAfterDraw),this._onAfterDraw=null),this.#br&&(document.removeEventListener("visibilitychange",this.#br),this.#br=null),this.viewer.textContent="",this._updateScrollMode(),this.viewer.removeAttribute("lang"),this.#pr&&(document.removeEventListener("copy",this.#dr),this.#dr=null,this.#pr.remove(),this.#pr=null)}#Cr(){if(this._scrollMode!==s.ScrollMode.PAGE)throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");const e=this._currentPageNumber,t=this.#vr,i=this.viewer;if(i.textContent="",t.pages.length=0,this._spreadMode!==s.SpreadMode.NONE||this.isInPresentationMode){const n=new Set,s=this._spreadMode-1;-1===s?n.add(e-1):e%2!==s?(n.add(e-1),n.add(e)):(n.add(e-2),n.add(e-1));const r=document.createElement("div");if(r.className="spread",this.isInPresentationMode){const e=document.createElement("div");e.className="dummyPage",r.append(e)}for(const e of n){const i=this._pages[e];i&&(r.append(i.div),t.pages.push(i))}i.append(r)}else{const n=this._pages[e-1];i.append(n.div),t.pages.push(n)}t.scrollDown=e>=t.previousPageNumber,t.previousPageNumber=e}_scrollUpdate(){0!==this.pagesCount&&this.update()}#Mr(e,t=null){const{div:i,id:n}=e;if(this._currentPageNumber!==n&&this._setCurrentPageNumber(n),this._scrollMode===s.ScrollMode.PAGE&&(this.#Cr(),this.update()),!t&&!this.isInPresentationMode){const e=i.offsetLeft+i.clientLeft,n=e+i.clientWidth,{scrollLeft:r,clientWidth:a}=this.container;(this._scrollMode===s.ScrollMode.HORIZONTAL||e<r||n>r+a)&&(t={left:0,top:0})}(0,s.scrollIntoView)(i,t),!this._currentScaleValue&&this._location&&(this._location=null)}#Tr(e){return e===this._currentScale||Math.abs(e-this._currentScale)<1e-15}#Dr(e,t,{noScroll:i=!1,preset:s=!1,drawingDelay:r=-1}){if(this._currentScaleValue=t.toString(),this.#Tr(e))return void(s&&this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:t}));this.viewer.style.setProperty("--scale-factor",e*n.PixelsPerInch.PDF_TO_CSS_UNITS);const a=r>=0&&r<1e3;if(this.refresh(!0,{scale:e,drawingDelay:a?r:-1}),a&&(this.#yr=setTimeout((()=>{this.#yr=null,this.refresh()}),r)),this._currentScale=e,!i){let e,t=this._currentPageNumber;!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}),this.defaultRenderingQueue&&this.update()}get#Fr(){return this._spreadMode!==s.SpreadMode.NONE&&this._scrollMode!==s.ScrollMode.HORIZONTAL?2:1}#Ar(e,t){let i=parseFloat(e);if(i>0)t.preset=!1,this.#Dr(i,e,t);else{const n=this._pages[this._currentPageNumber-1];if(!n)return;let r=s.SCROLLBAR_PADDING,a=s.VERTICAL_PADDING;this.isInPresentationMode?(r=a=4,this._spreadMode!==s.SpreadMode.NONE&&(r*=2)):this.removePageBorders?r=a=0:this._scrollMode===s.ScrollMode.HORIZONTAL&&([r,a]=[a,r]);const o=(this.container.clientWidth-r)/n.width*n.scale/this.#Fr,l=(this.container.clientHeight-a)/n.height*n.scale;switch(e){case"page-actual":i=1;break;case"page-width":i=o;break;case"page-height":i=l;break;case"page-fit":i=Math.min(o,l);break;case"auto":const t=(0,s.isPortraitOrientation)(n)?o:Math.min(l,o);i=Math.min(s.MAX_AUTO_SCALE,t);break;default:return void console.error(`#setScale: "${e}" is an unknown zoom value.`)}t.preset=!0,this.#Dr(i,e,t)}}#Pr(){const e=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&this.#Ar(this._currentScaleValue,{noScroll:!0}),this.#Mr(e)}pageLabelToPageNumber(e){if(!this._pageLabels)return null;const t=this._pageLabels.indexOf(e);return t<0?null:t+1}scrollPageIntoView({pageNumber:e,destArray:t=null,allowNegativeOffset:i=!1,ignoreDestinationZoom:r=!1}){if(!this.pdfDocument)return;const a=Number.isInteger(e)&&this._pages[e-1];if(!a)return void console.error(`scrollPageIntoView: "${e}" is not a valid pageNumber parameter.`);if(this.isInPresentationMode||!t)return void this._setCurrentPageNumber(e,!0);let o,l,h=0,c=0,d=0,u=0;const p=a.rotation%180!=0,g=(p?a.height:a.width)/a.scale/n.PixelsPerInch.PDF_TO_CSS_UNITS,f=(p?a.width:a.height)/a.scale/n.PixelsPerInch.PDF_TO_CSS_UNITS;let m=0;switch(t[1].name){case"XYZ":h=t[2],c=t[3],m=t[4],h=null!==h?h:0,c=null!==c?c:f;break;case"Fit":case"FitB":m="page-fit";break;case"FitH":case"FitBH":c=t[2],m="page-width",null===c&&this._location?(h=this._location.left,c=this._location.top):("number"!=typeof c||c<0)&&(c=f);break;case"FitV":case"FitBV":h=t[2],d=g,u=f,m="page-height";break;case"FitR":h=t[2],c=t[3],d=t[4]-h,u=t[5]-c;let e=s.SCROLLBAR_PADDING,i=s.VERTICAL_PADDING;this.removePageBorders&&(e=i=0),o=(this.container.clientWidth-e)/d/n.PixelsPerInch.PDF_TO_CSS_UNITS,l=(this.container.clientHeight-i)/u/n.PixelsPerInch.PDF_TO_CSS_UNITS,m=Math.min(Math.abs(o),Math.abs(l));break;default:return void console.error(`scrollPageIntoView: "${t[1].name}" is not a valid destination type.`)}if(r||(m&&m!==this._currentScale?this.currentScaleValue=m:this._currentScale===s.UNKNOWN_SCALE&&(this.currentScaleValue=s.DEFAULT_SCALE_VALUE)),"page-fit"===m&&!t[4])return void this.#Mr(a);const _=[a.viewport.convertToViewportPoint(h,c),a.viewport.convertToViewportPoint(h+d,c+u)];let v=Math.min(_[0][0],_[1][0]),b=Math.min(_[0][1],_[1][1]);i||(v=Math.max(v,0),b=Math.max(b,0)),this.#Mr(a,{left:v,top:b})}_updateLocation(e){const t=this._currentScale,i=this._currentScaleValue,n=parseFloat(i)===t?Math.round(1e4*t)/100:i,s=e.id,r=this._pages[s-1],a=this.container,o=r.getPagePoint(a.scrollLeft-e.x,a.scrollTop-e.y),l=Math.round(o[0]),h=Math.round(o[1]);let c=`#page=${s}`;this.isInPresentationMode||(c+=`&zoom=${n},${l},${h}`),this._location={pageNumber:s,scale:n,top:h,left:l,rotation:this._pagesRotation,pdfOpenParams:c}}update(){const e=this._getVisiblePages(),t=e.views,i=t.length;if(0===i)return;const n=Math.max(10,2*i+1);this.#or.resize(n,e.ids),this.renderingQueue.renderHighestPriority(e);const r=this._spreadMode===s.SpreadMode.NONE&&(this._scrollMode===s.ScrollMode.PAGE||this._scrollMode===s.ScrollMode.VERTICAL),a=this._currentPageNumber;let o=!1;for(const e of t){if(e.percent<100)break;if(e.id===a&&r){o=!0;break}}this._setCurrentPageNumber(o?a:t[0].id),this._updateLocation(e.first),this.eventBus.dispatch("updateviewarea",{source:this,location:this._location})}containsElement(e){return this.container.contains(e)}focus(){this.container.focus()}get _isContainerRtl(){return"rtl"===getComputedStyle(this.container).direction}get isInPresentationMode(){return this.presentationModeState===s.PresentationModeState.FULLSCREEN}get isChangingPresentationMode(){return this.presentationModeState===s.PresentationModeState.CHANGING}get isHorizontalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollHeight>this.container.clientHeight}_getVisiblePages(){const e=this._scrollMode===s.ScrollMode.PAGE?this.#vr.pages:this._pages,t=this._scrollMode===s.ScrollMode.HORIZONTAL,i=t&&this._isContainerRtl;return(0,s.getVisibleElements)({scrollEl:this.container,views:e,sortByVisibility:!0,horizontal:t,rtl:i})}cleanup(){for(const e of this._pages)e.renderingState!==s.RenderingStates.FINISHED&&e.reset()}_cancelRendering(){for(const e of this._pages)e.cancelRendering()}async#kr(e){if(e.pdfPage)return e.pdfPage;try{const t=await this.pdfDocument.getPage(e.id);return e.pdfPage||e.setPdfPage(t),this.linkService._cachedPageNumber?.(t.ref)||this.linkService.cachePageRef(e.id,t.ref),t}catch(e){return console.error("Unable to get page for page view",e),null}}#Lr(e){if(1===e.first?.id)return!0;if(e.last?.id===this.pagesCount)return!1;switch(this._scrollMode){case s.ScrollMode.PAGE:return this.#vr.scrollDown;case s.ScrollMode.HORIZONTAL:return this.scroll.right}return this.scroll.down}forceRendering(e){const t=e||this._getVisiblePages(),i=this.#Lr(t),n=this._spreadMode!==s.SpreadMode.NONE&&this._scrollMode!==s.ScrollMode.HORIZONTAL,r=this.renderingQueue.getHighestPriority(t,this._pages,i,n);return!!r&&(this.#kr(r).then((()=>{this.renderingQueue.renderView(r)})),!0)}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,s.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(){return this.pdfDocument?this._optionalContentConfigPromise?this._optionalContentConfigPromise:(console.error("optionalContentConfigPromise: Not initialized yet."),this.pdfDocument.getOptionalContentConfig()):Promise.resolve(null)}set optionalContentConfigPromise(e){if(!(e instanceof Promise))throw new Error(`Invalid optionalContentConfigPromise: ${e}`);this.pdfDocument&&this._optionalContentConfigPromise&&(this._optionalContentConfigPromise=e,this.refresh(!1,{optionalContentConfigPromise:e}),this.eventBus.dispatch("optionalcontentconfigchanged",{source:this,promise:e}))}get scrollMode(){return this._scrollMode}set scrollMode(e){if(this._scrollMode!==e){if(!(0,s.isValidScrollMode)(e))throw new Error(`Invalid scroll mode: ${e}`);this.pagesCount>h.FORCE_SCROLL_MODE_PAGE||(this._previousScrollMode=this._scrollMode,this._scrollMode=e,this.eventBus.dispatch("scrollmodechanged",{source:this,mode:e}),this._updateScrollMode(this._currentPageNumber))}}_updateScrollMode(e=null){const t=this._scrollMode,i=this.viewer;i.classList.toggle("scrollHorizontal",t===s.ScrollMode.HORIZONTAL),i.classList.toggle("scrollWrapped",t===s.ScrollMode.WRAPPED),this.pdfDocument&&e&&(t===s.ScrollMode.PAGE?this.#Cr():this._previousScrollMode===s.ScrollMode.PAGE&&this._updateSpreadMode(),this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#Ar(this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(e,!0),this.update())}get spreadMode(){return this._spreadMode}set spreadMode(e){if(this._spreadMode!==e){if(!(0,s.isValidSpreadMode)(e))throw new Error(`Invalid spread mode: ${e}`);this._spreadMode=e,this.eventBus.dispatch("spreadmodechanged",{source:this,mode:e}),this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(e=null){if(!this.pdfDocument)return;const t=this.viewer,i=this._pages;if(this._scrollMode===s.ScrollMode.PAGE)this.#Cr();else if(t.textContent="",this._spreadMode===s.SpreadMode.NONE)for(const e of this._pages)t.append(e.div);else{const e=this._spreadMode-1;let n=null;for(let s=0,r=i.length;s<r;++s)null===n?(n=document.createElement("div"),n.className="spread",t.append(n)):s%2===e&&(n=n.cloneNode(!1),t.append(n)),n.append(i[s].div)}e&&(this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#Ar(this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(e,!0),this.update())}_getPageAdvance(e,t=!1){switch(this._scrollMode){case s.ScrollMode.WRAPPED:{const{views:i}=this._getVisiblePages(),n=new Map;for(const{id:e,y:t,percent:s,widthPercent:r}of i){if(0===s||r<100)continue;let i=n.get(t);i||n.set(t,i||=[]),i.push(e)}for(const i of n.values()){const n=i.indexOf(e);if(-1===n)continue;const s=i.length;if(1===s)break;if(t)for(let t=n-1,s=0;t>=s;t--){const n=i[t],s=i[t+1]-1;if(n<s)return e-s}else for(let t=n+1,r=s;t<r;t++){const n=i[t],s=i[t-1]+1;if(n>s)return s-e}if(t){const t=i[0];if(t<e)return e-t+1}else{const t=i[s-1];if(t>e)return t-e+1}break}break}case s.ScrollMode.HORIZONTAL:break;case s.ScrollMode.PAGE:case s.ScrollMode.VERTICAL:{if(this._spreadMode===s.SpreadMode.NONE)break;const i=this._spreadMode-1;if(t&&e%2!==i)break;if(!t&&e%2===i)break;const{views:n}=this._getVisiblePages(),r=t?e-1:e+1;for(const{id:e,percent:t,widthPercent:i}of n)if(e===r){if(t>0&&100===i)return 2;break}break}}return 1}nextPage(){const e=this._currentPageNumber,t=this.pagesCount;if(e>=t)return!1;const i=this._getPageAdvance(e,!1)||1;return this.currentPageNumber=Math.min(e+i,t),!0}previousPage(){const e=this._currentPageNumber;if(e<=1)return!1;const t=this._getPageAdvance(e,!0)||1;return this.currentPageNumber=Math.max(e-t,1),!0}increaseScale({drawingDelay:e,scaleFactor:t,steps:i}={}){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*s.DEFAULT_SCALE_DELTA).toFixed(2))/10}while(--i>0&&n<s.MAX_SCALE)}this.#Ar(Math.min(s.MAX_SCALE,n),{noScroll:!1,drawingDelay:e})}decreaseScale({drawingDelay:e,scaleFactor:t,steps:i}={}){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/s.DEFAULT_SCALE_DELTA).toFixed(2))/10}while(--i>0&&n>s.MIN_SCALE)}this.#Ar(Math.max(s.MIN_SCALE,n),{noScroll:!1,drawingDelay:e})}#Sr(e=this.container.clientHeight){e!==this.#fr&&(this.#fr=e,s.docStyle.setProperty("--viewer-container-height",`${e}px`))}#_r(e){for(const t of e)if(t.target===this.container){this.#Sr(Math.floor(t.borderBoxSize[0].blockSize)),this.#cr=null;break}}get containerTopLeft(){return this.#cr||=[this.container.offsetTop,this.container.offsetLeft]}get annotationEditorMode(){return this.#hr?this.#lr:n.AnnotationEditorType.DISABLE}set annotationEditorMode({mode:e,editId:t=null}){if(!this.#hr)throw new Error("The AnnotationEditor is not enabled.");if(this.#lr!==e){if(!c(e))throw new Error(`Invalid AnnotationEditor mode: ${e}`);this.pdfDocument&&(this.#lr=e,this.eventBus.dispatch("annotationeditormodechanged",{source:this,mode:e}),this.#hr.updateMode(e,t))}}set annotationEditorParams({type:e,value:t}){if(!this.#hr)throw new Error("The AnnotationEditor is not enabled.");this.#hr.updateParams(e,t)}refresh(e=!1,t=Object.create(null)){if(this.pdfDocument){for(const e of this._pages)e.update(t);null!==this.#yr&&(clearTimeout(this.#yr),this.#yr=null),e||this.update()}}}},(e,t,i)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFRenderingQueue=void 0;var n=i(4),s=i(2);t.PDFRenderingQueue=class{constructor(){this.pdfViewer=null,this.pdfThumbnailViewer=null,this.onIdle=null,this.highestPriorityPage=null,this.idleTimeout=null,this.printing=!1,this.isThumbnailViewEnabled=!1,Object.defineProperty(this,"hasViewer",{value:()=>!!this.pdfViewer})}setViewer(e){this.pdfViewer=e}setThumbnailViewer(e){this.pdfThumbnailViewer=e}isHighestPriority(e){return this.highestPriorityPage===e.renderingId}renderHighestPriority(e){this.idleTimeout&&(clearTimeout(this.idleTimeout),this.idleTimeout=null),this.pdfViewer.forceRendering(e)||this.isThumbnailViewEnabled&&this.pdfThumbnailViewer?.forceRendering()||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),3e4))}getHighestPriority(e,t,i,n=!1){const s=e.views,r=s.length;if(0===r)return null;for(let e=0;e<r;e++){const t=s[e].view;if(!this.isViewFinished(t))return t}const a=e.first.id,o=e.last.id;if(o-a+1>r){const n=e.ids;for(let e=1,s=o-a;e<s;e++){const s=i?a+e:o-e;if(n.has(s))continue;const r=t[s-1];if(!this.isViewFinished(r))return r}}let l=i?o:a-2,h=t[l];return h&&!this.isViewFinished(h)||n&&(l+=i?1:-1,h=t[l],h&&!this.isViewFinished(h))?h:null}isViewFinished(e){return e.renderingState===s.RenderingStates.FINISHED}renderView(e){switch(e.renderingState){case s.RenderingStates.FINISHED:return!1;case s.RenderingStates.PAUSED:this.highestPriorityPage=e.renderingId,e.resume();break;case s.RenderingStates.RUNNING:this.highestPriorityPage=e.renderingId;break;case s.RenderingStates.INITIAL:this.highestPriorityPage=e.renderingId,e.draw().finally((()=>{this.renderHighestPriority()})).catch((e=>{e instanceof n.RenderingCancelledException||console.error(`renderView: "${e}"`)}))}return!0}}}],t={};function i(n){var s=t[n];if(void 0!==s)return s.exports;var r=t[n]={exports:{}};return e[n](r,r.exports,i),r.exports}var n={};return(()=>{var e=n;Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"AnnotationLayerBuilder",{enumerable:!0,get:function(){return a.AnnotationLayerBuilder}}),Object.defineProperty(e,"DownloadManager",{enumerable:!0,get:function(){return o.DownloadManager}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return l.EventBus}}),Object.defineProperty(e,"FindState",{enumerable:!0,get:function(){return t.FindState}}),Object.defineProperty(e,"GenericL10n",{enumerable:!0,get:function(){return h.GenericL10n}}),Object.defineProperty(e,"LinkTarget",{enumerable:!0,get:function(){return s.LinkTarget}}),Object.defineProperty(e,"NullL10n",{enumerable:!0,get:function(){return c.NullL10n}}),Object.defineProperty(e,"PDFFindController",{enumerable:!0,get:function(){return t.PDFFindController}}),Object.defineProperty(e,"PDFHistory",{enumerable:!0,get:function(){return d.PDFHistory}}),Object.defineProperty(e,"PDFLinkService",{enumerable:!0,get:function(){return s.PDFLinkService}}),Object.defineProperty(e,"PDFPageView",{enumerable:!0,get:function(){return u.PDFPageView}}),Object.defineProperty(e,"PDFScriptingManager",{enumerable:!0,get:function(){return p.PDFScriptingManager}}),Object.defineProperty(e,"PDFSinglePageViewer",{enumerable:!0,get:function(){return g.PDFSinglePageViewer}}),Object.defineProperty(e,"PDFViewer",{enumerable:!0,get:function(){return f.PDFViewer}}),Object.defineProperty(e,"ProgressBar",{enumerable:!0,get:function(){return r.ProgressBar}}),Object.defineProperty(e,"RenderingStates",{enumerable:!0,get:function(){return r.RenderingStates}}),Object.defineProperty(e,"ScrollMode",{enumerable:!0,get:function(){return r.ScrollMode}}),Object.defineProperty(e,"SimpleLinkService",{enumerable:!0,get:function(){return s.SimpleLinkService}}),Object.defineProperty(e,"SpreadMode",{enumerable:!0,get:function(){return r.SpreadMode}}),Object.defineProperty(e,"StructTreeLayerBuilder",{enumerable:!0,get:function(){return m.StructTreeLayerBuilder}}),Object.defineProperty(e,"TextLayerBuilder",{enumerable:!0,get:function(){return _.TextLayerBuilder}}),Object.defineProperty(e,"XfaLayerBuilder",{enumerable:!0,get:function(){return v.XfaLayerBuilder}}),Object.defineProperty(e,"parseQueryString",{enumerable:!0,get:function(){return r.parseQueryString}});var t=i(1),s=i(5),r=i(2),a=i(6),o=i(8),l=i(9),h=i(10),c=i(7),d=i(12),u=i(13),p=i(21),g=i(24),f=i(25),m=i(16),_=i(19),v=i(20)})(),n})(),e.exports=i.pdfjsViewer=n()}(pdf_viewer);var pdf_viewerExports=pdf_viewer.exports,_ProgressBar_classList,_ProgressBar_disableAutoFetchTimeout,_ProgressBar_percent,_ProgressBar_style,_ProgressBar_visible;function __awaiter(e,t,i,n){return new(i||(i=Promise))((function(t,s){function r(e){try{o(n.next(e))}catch(e){s(e)}}function a(e){try{o(n.throw(e))}catch(e){s(e)}}function o(e){var n;e.done?t(e.value):(n=e.value,n instanceof i?n:new i((function(e){e(n)}))).then(r,a)}o((n=n.apply(e,[])).next())}))}function __classPrivateFieldGet(e,t,i,n){if("a"===i&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===i?n:"a"===i?n.call(e):n?n.value:t.get(e)}function __classPrivateFieldSet(e,t,i,n,s){if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return s?s.value=i:t.set(e,i),i}"function"==typeof SuppressedError&&SuppressedError;const DEFAULT_SCALE_VALUE="auto",DEFAULT_SCALE=1,DEFAULT_SCALE_DELTA=1.1,MIN_SCALE=.1,MAX_SCALE=10,UNKNOWN_SCALE=0,MAX_AUTO_SCALE=1.25,SCROLLBAR_PADDING=40,VERTICAL_PADDING=5,RenderingStates={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},PresentationModeState={UNKNOWN:0,NORMAL:1,CHANGING:2,FULLSCREEN:3},SidebarView={UNKNOWN:-1,NONE:0,THUMBS:1,OUTLINE:2,ATTACHMENTS:3,LAYERS:4},RendererType={CANVAS:"canvas",SVG:"svg"},TextLayerMode={DISABLE:0,ENABLE:1},ScrollMode={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3},SpreadMode={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2},CursorTool={SELECT:0,HAND:1,ZOOM:2},AutoPrintRegExp=/\bprint\s*\(/;class OutputScale{constructor(){const e=window.devicePixelRatio||1;this.sx=e,this.sy=e}get scaled(){return 1!==this.sx||1!==this.sy}}function scrollIntoView(e,t,i=!1){let n=e.offsetParent;if(!n)return void console.error("offsetParent is not set -- cannot scroll");let s=e.offsetTop+e.clientTop,r=e.offsetLeft+e.clientLeft;for(;n.clientHeight===n.scrollHeight&&n.clientWidth===n.scrollWidth||i&&(n.classList.contains("markedContent")||"hidden"===getComputedStyle(n).overflow);)if(s+=n.offsetTop,r+=n.offsetLeft,n=n.offsetParent,!n)return;t&&(void 0!==t.top&&(s+=t.top),void 0!==t.left&&(r+=t.left,n.scrollLeft=r)),n.scrollTop=s,n.scrollLeft=r}function watchScroll(e,t){const i=function(i){s||(s=window.requestAnimationFrame((function(){s=null;const i=e.scrollLeft,r=n.lastX;i!==r&&(n.right=i>r),n.lastX=i;const a=e.scrollTop,o=n.lastY;a!==o&&(n.down=a>o),n.lastY=a,t(n)})))},n={right:!0,down:!0,lastX:e.scrollLeft,lastY:e.scrollTop,_eventHandler:i};let s=null;return e.addEventListener("scroll",i,!0),n}function parseQueryString(e){const t=new Map;for(const[i,n]of new URLSearchParams(e))t.set(i.toLowerCase(),n);return t}const NullCharactersRegExp=/\x00/g,InvisibleCharactersRegExp=/[\x01-\x1F]/g;function removeNullCharacters(e,t=!1){return"string"!=typeof e?(console.error("The argument must be a string."),e):(t&&(e=e.replace(InvisibleCharactersRegExp," ")),e.replace(NullCharactersRegExp,""))}function binarySearchFirstItem(e,t,i=0){let n=i,s=e.length-1;if(s<0||!t(e[s]))return e.length;if(t(e[n]))return n;for(;n<s;){const i=n+s>>1;t(e[i])?s=i:n=i+1}return n}function approximateFraction(e){if(Math.floor(e)===e)return[e,1];const t=1/e;if(t>8)return[1,8];if(Math.floor(t)===t)return[1,t];const i=e>1?t:e;let n,s=0,r=1,a=1,o=1;for(;;){const e=s+a,t=r+o;if(t>8)break;i<=e/t?(a=e,o=t):(s=e,r=t)}return n=i-s/r<a/o-i?i===e?[s,r]:[r,s]:i===e?[a,o]:[o,a],n}function roundToDivide(e,t){const i=e%t;return 0===i?e:Math.round(e-i+t)}function getPageSizeInches({view:e,userUnit:t,rotate:i}){const[n,s,r,a]=e,o=i%180!=0,l=(r-n)/72*t,h=(a-s)/72*t;return{width:o?h:l,height:o?l:h}}function backtrackBeforeAllVisibleElements(e,t,i){if(e<2)return e;let n=t[e].div,s=n.offsetTop+n.clientTop;s>=i&&(n=t[e-1].div,s=n.offsetTop+n.clientTop);for(let i=e-2;i>=0&&(n=t[i].div,!(n.offsetTop+n.clientTop+n.clientHeight<=s));--i)e=i;return e}function getVisibleElements({scrollEl:e,views:t,sortByVisibility:i=!1,horizontal:n=!1,rtl:s=!1}){const r=e.scrollTop,a=r+e.clientHeight,o=e.scrollLeft,l=o+e.clientWidth;const h=[],c=new Set,d=t.length;let u=binarySearchFirstItem(t,n?function(e){const t=e.div,i=t.offsetLeft+t.clientLeft,n=i+t.clientWidth;return s?i<l:n>o}:function(e){const t=e.div;return t.offsetTop+t.clientTop+t.clientHeight>r});u>0&&u<d&&!n&&(u=backtrackBeforeAllVisibleElements(u,t,r));let p=n?l:-1;for(let e=u;e<d;e++){const i=t[e],s=i.div,d=s.offsetLeft+s.clientLeft,u=s.offsetTop+s.clientTop,g=s.clientWidth,f=s.clientHeight,m=d+g,_=u+f;if(-1===p)_>=a&&(p=_);else if((n?d:u)>p)break;if(_<=r||u>=a||m<=o||d>=l)continue;const v=Math.max(0,r-u)+Math.max(0,_-a),b=(g-(Math.max(0,o-d)+Math.max(0,m-l)))/g,y=(f-v)/f*b*100|0;h.push({id:i.id,x:d,y:u,view:i,percent:y,widthPercent:100*b|0}),c.add(i.id)}const g=h[0],f=h.at(-1);return i&&h.sort((function(e,t){const i=e.percent-t.percent;return Math.abs(i)>.001?-i:e.id-t.id})),{first:g,last:f,views:h,ids:c}}function noContextMenuHandler(e){e.preventDefault()}function normalizeWheelEventDirection(e){let t=Math.hypot(e.deltaX,e.deltaY);const i=Math.atan2(e.deltaY,e.deltaX);return-.25*Math.PI<i&&i<.75*Math.PI&&(t=-t),t}function normalizeWheelEventDelta(e){const t=e.deltaMode;let i=normalizeWheelEventDirection(e);return t===WheelEvent.DOM_DELTA_PIXEL?i/=900:t===WheelEvent.DOM_DELTA_LINE&&(i/=30),i}function isValidRotation(e){return Number.isInteger(e)&&e%90==0}function isValidScrollMode(e){return Number.isInteger(e)&&Object.values(ScrollMode).includes(e)&&e!==ScrollMode.UNKNOWN}function isValidSpreadMode(e){return Number.isInteger(e)&&Object.values(SpreadMode).includes(e)&&e!==SpreadMode.UNKNOWN}function isPortraitOrientation(e){return e.width<=e.height}const animationStarted=new Promise((function(e){window.requestAnimationFrame(e)})),docStyle=document.documentElement.style;function clamp(e,t,i){return Math.min(Math.max(e,t),i)}class ProgressBar{constructor(e){_ProgressBar_classList.set(this,null),_ProgressBar_disableAutoFetchTimeout.set(this,null),_ProgressBar_percent.set(this,0),_ProgressBar_style.set(this,null),_ProgressBar_visible.set(this,!0),__classPrivateFieldSet(this,_ProgressBar_classList,e.classList),__classPrivateFieldSet(this,_ProgressBar_style,e.style)}get percent(){return __classPrivateFieldGet(this,_ProgressBar_percent,"f")}set percent(e){var t,i,n;__classPrivateFieldSet(this,_ProgressBar_percent,clamp(e,0,100)),isNaN(e)?null===(t=__classPrivateFieldGet(this,_ProgressBar_classList,"f"))||void 0===t||t.add("indeterminate"):(null===(i=__classPrivateFieldGet(this,_ProgressBar_classList,"f"))||void 0===i||i.remove("indeterminate"),null===(n=__classPrivateFieldGet(this,_ProgressBar_style,"f"))||void 0===n||n.setProperty("--progressBar-percent",`${__classPrivateFieldGet(this,_ProgressBar_percent,"f")}%`))}setWidth(e){var t;if(!e)return;const i=e.parentNode.offsetWidth-e.offsetWidth;i>0&&(null===(t=__classPrivateFieldGet(this,_ProgressBar_style,"f"))||void 0===t||t.setProperty("--progressBar-end-offset",`${i}px`))}setDisableAutoFetch(e=5e3){isNaN(__classPrivateFieldGet(this,_ProgressBar_percent,"f"))||(__classPrivateFieldGet(this,_ProgressBar_disableAutoFetchTimeout,"f")&&clearTimeout(__classPrivateFieldGet(this,_ProgressBar_disableAutoFetchTimeout,"f")),this.show(),__classPrivateFieldSet(this,_ProgressBar_disableAutoFetchTimeout,setTimeout((()=>{__classPrivateFieldSet(this,_ProgressBar_disableAutoFetchTimeout,null,"f"),this.hide()}),e)))}hide(){var e;__classPrivateFieldGet(this,_ProgressBar_visible,"f")&&(__classPrivateFieldSet(this,_ProgressBar_visible,!1),null===(e=__classPrivateFieldGet(this,_ProgressBar_classList,"f"))||void 0===e||e.add("hidden"))}show(){var e;__classPrivateFieldGet(this,_ProgressBar_visible,"f")||(__classPrivateFieldSet(this,_ProgressBar_visible,!0),null===(e=__classPrivateFieldGet(this,_ProgressBar_classList,"f"))||void 0===e||e.remove("hidden"))}}function getActiveOrFocusedElement(){let e=document,t=e.activeElement||e.querySelector(":focus");for(;null==t?void 0:t.shadowRoot;)e=t.shadowRoot,t=e.activeElement||e.querySelector(":focus");return t}function apiPageLayoutToViewerModes(e){let t=ScrollMode.VERTICAL,i=SpreadMode.NONE;switch(e){case"SinglePage":t=ScrollMode.PAGE;break;case"OneColumn":break;case"TwoPageLeft":t=ScrollMode.PAGE;case"TwoColumnLeft":i=SpreadMode.ODD;break;case"TwoPageRight":t=ScrollMode.PAGE;case"TwoColumnRight":i=SpreadMode.EVEN}return{scrollMode:t,spreadMode:i}}function apiPageModeToSidebarView(e){switch(e){case"UseNone":return SidebarView.NONE;case"UseThumbs":return SidebarView.THUMBS;case"UseOutlines":return SidebarView.OUTLINE;case"UseAttachments":return SidebarView.ATTACHMENTS;case"UseOC":return SidebarView.LAYERS}return SidebarView.NONE}_ProgressBar_classList=new WeakMap,_ProgressBar_disableAutoFetchTimeout=new WeakMap,_ProgressBar_percent=new WeakMap,_ProgressBar_style=new WeakMap,_ProgressBar_visible=new WeakMap;const CLEANUP_TIMEOUT=3e4;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,i;this.idleTimeout&&(clearTimeout(this.idleTimeout),this.idleTimeout=null),(null===(t=this.pdfViewer)||void 0===t?void 0:t.forceRendering(e))||this.isThumbnailViewEnabled&&(null===(i=this.pdfThumbnailViewer)||void 0===i?void 0:i.forceRendering())||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),CLEANUP_TIMEOUT))}getHighestPriority(e,t,i,n=!1){const s=e.views,r=s.length;if(0===r)return null;for(let e=0;e<r;e++){const t=s[e].view;if(!this.isViewFinished(t))return t}const a=e.first.id,o=e.last.id;if(o-a+1>r){const n=e.ids;for(let e=1,s=o-a;e<s;e++){const s=i?a+e:o-e;if(n.has(s))continue;const r=t[s-1];if(!this.isViewFinished(r))return r}}let l=i?o:a-2,h=t[l];return h&&!this.isViewFinished(h)||n&&(l+=i?1:-1,h=t[l],h&&!this.isViewFinished(h))?h:null}isViewFinished(e){return e.renderingState===RenderingStates.FINISHED}renderView(e){switch(e.renderingState){case RenderingStates.FINISHED:return!1;case RenderingStates.PAUSED:this.highestPriorityPage=e.renderingId,e.resume();break;case RenderingStates.RUNNING:this.highestPriorityPage=e.renderingId;break;case RenderingStates.INITIAL:this.highestPriorityPage=e.renderingId,e.draw().finally((()=>{this.renderHighestPriority()})).catch((e=>{e instanceof pdfExports.RenderingCancelledException||console.error(`renderView: "${e}"`)}))}return!0}}var _a,_TempImageFactory_tempCanvas;const DRAW_UPSCALE_FACTOR=2,MAX_NUM_SCALING_STEPS=3;class TempImageFactory{static getCanvas(e,t){const i=__classPrivateFieldSet(this,_a,__classPrivateFieldGet(this,_a,"f",_TempImageFactory_tempCanvas)||document.createElement("canvas"),"f",_TempImageFactory_tempCanvas);i.width=e,i.height=t;const n=i.getContext("2d",{alpha:!1});n.save(),n.fillStyle="rgb(255, 255, 255)",n.fillRect(0,0,e,t),n.restore();const s=i.getContext("2d");return[i,s]}static destroyCanvas(){const e=__classPrivateFieldGet(this,_a,"f",_TempImageFactory_tempCanvas);e&&(e.width=0,e.height=0),__classPrivateFieldSet(this,_a,null,"f",_TempImageFactory_tempCanvas)}}_a=TempImageFactory,_TempImageFactory_tempCanvas={value:null};class PDFThumbnailView{constructor({container:e,eventBus:t,id:i,defaultViewport:n,optionalContentConfigPromise:s,linkService:r,renderingQueue:a,l10n:o,pageColors:l,store:h,thumbnailWidth:c}){this.container=e,this.eventBus=t,this.id=i,this.renderingId="thumbnail"+i,this.pageLabel=null,this.store=h,this.loaded=!1,this.pdfPage=null,this.rotation=0,this.viewport=n,this.pdfPageRotate=n.rotation,this._optionalContentConfigPromise=s||null,this.pageColors=l||null,this.linkService=r,this.renderingQueue=a,this.renderTask=null,this.renderingState=RenderingStates.INITIAL,this.resume=null;const d=this.viewport.width,u=d/this.viewport.height;this.canvasWidth=c,this.canvasHeight=this.canvasWidth/u|0,this.scale=this.canvasWidth/d,this.l10n=o,this.canvas=null,this.src=null;const p=document.createElement("div");p.className="thumbnail pdfSlickThumbHolder",p.setAttribute("data-page-number",this.id.toString()),this.div=p,e.append(p)}setPdfPage(e){this.pdfPage=e,this.pdfPageRotate=e.rotate;const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:1,rotation:t}),this.reset()}reset(){this.cancelRendering(),this.renderingState=RenderingStates.INITIAL;const e=this.viewport.width,t=e/this.viewport.height;this.canvasHeight=this.canvasWidth/t|0,this.scale=this.canvasWidth/e,this.div.removeAttribute("data-loaded"),this.loaded=!1,this.canvas&&(this.canvas.width=0,this.canvas.height=0,delete this.canvas)}update({rotation:e=null}){"number"==typeof e&&(this.rotation=e);const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=this.viewport.clone({scale:1,rotation:t}),this.reset()}cancelRendering(){this.renderTask&&(this.renderTask.cancel(),this.renderTask=null),this.resume=null}_getPageDrawContext(e=1){const t=document.createElement("canvas"),i=t.getContext("2d",{alpha:!1}),n=new OutputScale;t.width=e*this.canvasWidth*n.sx|0,t.height=e*this.canvasHeight*n.sy|0;return{ctx:i,canvas:t,transform:n.scaled?[n.sx,0,0,n.sy,0,0]:null}}_convertCanvasToImage(e){if(this.renderingState!==RenderingStates.FINISHED)throw new Error("_convertCanvasToImage: Rendering has not finished.");const t=this._reduceImage(e);this.src=t.toDataURL(),this.div.setAttribute("data-loaded","true"),this.loaded=!0,this.store.getState()._setThumbnailView(this.id,this),t.width=0,t.height=0}draw(){if(this.renderingState!==RenderingStates.INITIAL)return console.error("Must be in new state before drawing"),Promise.resolve();const{pdfPage:e}=this;if(!e)return this.renderingState=RenderingStates.FINISHED,Promise.reject(new Error("pdfPage is not loaded"));this.renderingState=RenderingStates.RUNNING;const t=(e=null)=>__awaiter(this,void 0,void 0,(function*(){if(a===this.renderTask&&(this.renderTask=null),!(e instanceof pdfExports.RenderingCancelledException)&&(this.renderingState=RenderingStates.FINISHED,this._convertCanvasToImage(n),e))throw e})),{ctx:i,canvas:n,transform:s}=this._getPageDrawContext(DRAW_UPSCALE_FACTOR),r={canvasContext:i,transform:s,viewport:this.viewport.clone({scale:DRAW_UPSCALE_FACTOR*this.scale}),optionalContentConfigPromise:this._optionalContentConfigPromise,pageColors:this.pageColors},a=this.renderTask=e.render(r);a.onContinue=e=>{if(!this.renderingQueue.isHighestPriority(this))return this.renderingState=RenderingStates.PAUSED,void(this.resume=()=>{this.renderingState=RenderingStates.RUNNING,e()});e()};const o=a.promise.then((function(){return t(null)}),(function(e){return t(e)}));return o.finally((()=>{n.width=0,n.height=0,this.eventBus.dispatch("thumbnailrendered",{source:this,pageNumber:this.id,pdfPage:this.pdfPage})})),o}setImage(e){if(this.renderingState!==RenderingStates.INITIAL)return;const{thumbnailCanvas:t,pdfPage:i,scale:n}=e;t&&(this.pdfPage||this.setPdfPage(i),n<this.scale||(this.renderingState=RenderingStates.FINISHED,this._convertCanvasToImage(t)))}_reduceImage(e){const{ctx:t,canvas:i}=this._getPageDrawContext();if(e.width<=2*i.width)return t.drawImage(e,0,0,e.width,e.height,0,0,i.width,i.height),i;let n=i.width<<MAX_NUM_SCALING_STEPS,s=i.height<<MAX_NUM_SCALING_STEPS;const[r,a]=TempImageFactory.getCanvas(n,s);for(;n>e.width||s>e.height;)n>>=1,s>>=1;for(a.drawImage(e,0,0,e.width,e.height,0,0,n,s);n>2*i.width;)a.drawImage(r,0,0,n,s,0,0,n>>1,s>>1),n>>=1,s>>=1;return t.drawImage(r,0,0,n,s,0,0,i.width,i.height),i}get _thumbPageTitle(){var e;return this.l10n.get("thumb_page_title",{page:null!==(e=this.pageLabel)&&void 0!==e?e:this.id})}get _thumbPageCanvas(){var e;return this.l10n.get("thumb_page_canvas",{page:null!==(e=this.pageLabel)&&void 0!==e?e:this.id})}setPageLabel(e){this.pageLabel="string"==typeof e?e:null}}var _PDFThumbnailViewer_instances,_PDFThumbnailViewer_ensurePdfPageLoaded,_PDFThumbnailViewer_getScrollAhead;const THUMBNAIL_SCROLL_MARGIN=-19,THUMBNAIL_SELECTED_CLASS="selected";class PDFThumbnailViewer{constructor({container:e,eventBus:t,linkService:i,renderingQueue:n,l10n:s,pageColors:r,store:a,thumbnailWidth:o}){_PDFThumbnailViewer_instances.add(this),this.container=e,this.eventBus=t,this.linkService=i,this.renderingQueue=n,this.l10n=s,this.pageColors=r||null,this._thumbnails=[],this._currentPageNumber=0,this._pagesRotation=0,this._pageLabels=[],this.pdfDocument=null,this.store=a,this.thumbnailWidth=o,!this.pageColors||CSS.supports("color",this.pageColors.background)&&CSS.supports("color",this.pageColors.foreground)||((this.pageColors.background||this.pageColors.foreground)&&console.warn("PDFThumbnailViewer: Ignoring `pageColors`-option, since the browser doesn't support the values used."),this.pageColors=null),this.scroll=watchScroll(this.container,this._scrollUpdated.bind(this)),this._resetView()}_scrollUpdated(){this.renderingQueue.renderHighestPriority()}getThumbnail(e){return this._thumbnails[e]}_getVisibleThumbs(){return getVisibleElements({scrollEl:this.container,views:this._thumbnails})}scrollThumbnailIntoView(e){if(!this.pdfDocument)return;const t=this._thumbnails[e-1];if(!t)return void console.error('scrollThumbnailIntoView: Invalid "pageNumber" parameter.');if(e!==this._currentPageNumber){this._thumbnails[this._currentPageNumber-1].div.classList.remove(THUMBNAIL_SELECTED_CLASS),t.div.classList.add(THUMBNAIL_SELECTED_CLASS)}const i=this._getVisibleThumbs(),{first:n,last:s,views:r}=i;if(r.length>0){let i=!1;if(e<=n.id||e>=(null==s?void 0:s.id))i=!0;else for(const{id:t,percent:n}of r)if(t===e){i=n<100;break}i&&scrollIntoView(t.div,{top:THUMBNAIL_SCROLL_MARGIN})}this._currentPageNumber=e,this.forceRendering()}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!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!==RenderingStates.FINISHED&&e.reset();TempImageFactory.destroyCanvas()}_resetView(){this._thumbnails=[],this._currentPageNumber=1,this._pageLabels=[],this._pagesRotation=0,this.container.textContent=""}setDocument(e){if(this.pdfDocument&&(this._cancelRendering(),this._resetView()),this.pdfDocument=e,!e)return;const t=e.getPage(1),i=e.getOptionalContentConfig();t.then((t=>{var n;const s=e.numPages,r=t.getViewport({scale:1});for(let e=1;e<=s;++e){const t=new PDFThumbnailView({container:this.container,eventBus:this.eventBus,id:e,defaultViewport:r.clone(),optionalContentConfigPromise:i,linkService:this.linkService,renderingQueue:this.renderingQueue,l10n:this.l10n,pageColors:this.pageColors,store:this.store,thumbnailWidth:this.thumbnailWidth});this._thumbnails.push(t)}null===(n=this._thumbnails[0])||void 0===n||n.setPdfPage(t);this._thumbnails[this._currentPageNumber-1].div.classList.add(THUMBNAIL_SELECTED_CLASS),this.store.getState()._setThumbnailsViews(this._thumbnails)})).catch((e=>{console.error("Unable to initialize thumbnail viewer",e)}))}_cancelRendering(){for(const e of this._thumbnails)e.cancelRendering()}setPageLabels(e){var t,i;if(this.pdfDocument){e?Array.isArray(e)&&this.pdfDocument.numPages===e.length?this._pageLabels=e:(this._pageLabels=[],console.error("PDFThumbnailViewer_setPageLabels: Invalid page labels.")):this._pageLabels=[];for(let e=0,n=this._thumbnails.length;e<n;e++)this._thumbnails[e].setPageLabel(null!==(i=null===(t=this._pageLabels)||void 0===t?void 0:t[e])&&void 0!==i?i:null)}}forceRendering(){const e=this._getVisibleThumbs(),t=__classPrivateFieldGet(this,_PDFThumbnailViewer_instances,"m",_PDFThumbnailViewer_getScrollAhead).call(this,e),i=this.renderingQueue.getHighestPriority(e,this._thumbnails,t);return!!i&&(__classPrivateFieldGet(this,_PDFThumbnailViewer_instances,"m",_PDFThumbnailViewer_ensurePdfPageLoaded).call(this,i).then((()=>{this.renderingQueue.renderView(i)})),!0)}}var _OverlayManager_overlays,_OverlayManager_active;_PDFThumbnailViewer_instances=new WeakSet,_PDFThumbnailViewer_ensurePdfPageLoaded=function(e){var t;return __awaiter(this,void 0,void 0,(function*(){if(null==e?void 0:e.pdfPage)return e.pdfPage;try{const i=yield null===(t=this.pdfDocument)||void 0===t?void 0:t.getPage(e.id);return(null==e?void 0:e.pdfPage)||e.setPdfPage(i),i}catch(e){return console.error("Unable to get page for thumb view",e),null}}))},_PDFThumbnailViewer_getScrollAhead=function(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};class OverlayManager{constructor(){_OverlayManager_overlays.set(this,new WeakMap),_OverlayManager_active.set(this,null)}get active(){return __classPrivateFieldGet(this,_OverlayManager_active,"f")}register(e,t=!1){return __awaiter(this,void 0,void 0,(function*(){if("object"!=typeof e)throw new Error("Not enough parameters.");if(__classPrivateFieldGet(this,_OverlayManager_overlays,"f").has(e))throw new Error("The overlay is already registered.");__classPrivateFieldGet(this,_OverlayManager_overlays,"f").set(e,{canForceClose:t}),e.addEventListener("cancel",(()=>{__classPrivateFieldSet(this,_OverlayManager_active,null)}))}))}unregister(e){return __awaiter(this,void 0,void 0,(function*(){if(!__classPrivateFieldGet(this,_OverlayManager_overlays,"f").has(e))throw new Error("The overlay does not exist.");if(__classPrivateFieldGet(this,_OverlayManager_active,"f")===e)throw new Error("The overlay cannot be removed while it is active.");__classPrivateFieldGet(this,_OverlayManager_overlays,"f").delete(e)}))}open(e){return __awaiter(this,void 0,void 0,(function*(){if(!__classPrivateFieldGet(this,_OverlayManager_overlays,"f").has(e))throw new Error("The overlay does not exist.");if(__classPrivateFieldGet(this,_OverlayManager_active,"f")){if(__classPrivateFieldGet(this,_OverlayManager_active,"f")===e)throw new Error("The overlay is already active.");if(!__classPrivateFieldGet(this,_OverlayManager_overlays,"f").get(e).canForceClose)throw new Error("Another overlay is currently active.");yield this.close()}__classPrivateFieldSet(this,_OverlayManager_active,e),e.showModal()}))}close(e=__classPrivateFieldGet(this,_OverlayManager_active,"f")){return __awaiter(this,void 0,void 0,(function*(){if(!e||!__classPrivateFieldGet(this,_OverlayManager_overlays,"f").has(e))throw new Error("The overlay does not exist.");if(!__classPrivateFieldGet(this,_OverlayManager_active,"f"))throw new Error("The overlay is currently not active.");if(__classPrivateFieldGet(this,_OverlayManager_active,"f")!==e)throw new Error("Another overlay is currently active.");e.close(),__classPrivateFieldSet(this,_OverlayManager_active,null)}))}}function getXfaHtmlForPrinting(e,t){const i=t.allXfaHtml,n=new pdf_viewerExports.SimpleLinkService,s=Math.round(100*pdfExports.PixelsPerInch.PDF_TO_CSS_UNITS)/100;for(const r of null==i?void 0:i.children){const i=document.createElement("div");i.className="xfaPrintedPage",e.append(i);const a=new pdf_viewerExports.XfaLayerBuilder({pageDiv:i,pdfPage:null,annotationStorage:t.annotationStorage,linkService:n,xfaHtml:r}),o=pdfExports.getXfaPageViewport(r,{scale:s});a.render(o,"print")}}_OverlayManager_overlays=new WeakMap,_OverlayManager_active=new WeakMap;let activeService=null,dialog=null,overlayManager=new OverlayManager;function renderPage(e,t,i,n,s,r,a){const o=activeService.scratchCanvas,l=s/pdfExports.PixelsPerInch.PDF;o.width=Math.floor(n.width*l),o.height=Math.floor(n.height*l);const h=o.getContext("2d");return h.save(),h.fillStyle="rgb(255, 255, 255)",h.fillRect(0,0,o.width,o.height),h.restore(),Promise.all([t.getPage(i),a]).then((function([e,t]){const i={canvasContext:h,transform:[l,0,0,l,0,0],viewport:e.getViewport({scale:1,rotation:n.rotation}),intent:"print",annotationMode:pdfExports.AnnotationMode.ENABLE_STORAGE,optionalContentConfigPromise:r,printAnnotationStorage:t};return e.render(i).promise}))}class PDFPrintService{constructor(e,t,i,n,s=null,r=null,a){this.pdfDocument=e,this.pagesOverview=t,this.printContainer=i,this._printResolution=n||150,this._optionalContentConfigPromise=s||e.getOptionalContentConfig(),this._printAnnotationStoragePromise=r||Promise.resolve(),this.l10n=a,this.currentPage=-1,this.scratchCanvas=document.createElement("canvas")}layout(){this.throwIfInactive();const e=document.querySelector("body");null==e||e.setAttribute("data-pdfjsprinting","true");this.pagesOverview.every((e=>e.width===this.pagesOverview[0].width&&e.height===this.pagesOverview[0].height),this)||console.warn("Not all pages have the same size. The printed result may be incorrect!"),this.pageStyleSheet=document.createElement("style");const t=this.pagesOverview[0];this.pageStyleSheet.textContent="@page { size: "+t.width+"pt "+t.height+"pt;}",null==e||e.append(this.pageStyleSheet)}destroy(){if(activeService!==this)return;this.printContainer.textContent="";const e=document.querySelector("body");null==e||e.removeAttribute("data-pdfjsprinting"),this.pageStyleSheet&&(this.pageStyleSheet.remove(),this.pageStyleSheet=null),this.scratchCanvas.width=this.scratchCanvas.height=0,this.scratchCanvas=null,activeService=null,ensureOverlay().then((function(){overlayManager.active===dialog&&overlayManager.close(dialog)}))}renderPages(){if(this.pdfDocument.isPureXfa)return getXfaHtmlForPrinting(this.printContainer,this.pdfDocument),Promise.resolve();const e=this.pagesOverview.length,t=(i,n)=>{if(this.throwIfInactive(),++this.currentPage>=e)return renderProgress(e,e,this.l10n),void i();const s=this.currentPage;renderProgress(s,e,this.l10n),renderPage(this,this.pdfDocument,s+1,this.pagesOverview[s],this._printResolution,this._optionalContentConfigPromise,this._printAnnotationStoragePromise).then(this.useRenderedPage.bind(this)).then((function(){t(i,n)}),n)};return new Promise(t)}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");return i.className="printedPage",i.append(e),this.printContainer.append(i),new Promise((function(t,i){e.onload=t,e.onerror=i}))}performPrint(){return this.throwIfInactive(),new Promise((e=>{setTimeout((()=>{this.active?(print.call(window),setTimeout(e,20)):e()}),0)}))}get active(){return this===activeService}throwIfInactive(){if(!this.active)throw new Error("This print request was cancelled or completed.")}}const print=window.print;function dispatchEvent(e){const t=document.createEvent("CustomEvent");t.initCustomEvent(e,!1,!1,"custom"),window.dispatchEvent(t)}function abort(){activeService&&(activeService.destroy(),dispatchEvent("afterprint"))}function renderProgress(e,t,i){dialog||(dialog=document.getElementById("printServiceDialog"));const n=Math.round(100*e/t),s=dialog.querySelector("progress"),r=dialog.querySelector(".relative-progress");s.value=n,i.get("print_progress_percent",{progress:n}).then((e=>{r.textContent=e}))}if(window.print=function(){if(activeService)console.warn("Ignored window.print() because of a pending print job.");else{ensureOverlay().then((function(){activeService&&overlayManager.open(dialog)}));try{dispatchEvent("beforeprint")}finally{if(!activeService)return console.error("Expected print service to be initialized."),void ensureOverlay().then((function(){overlayManager.active===dialog&&overlayManager.close(dialog)}));const e=activeService;activeService.renderPages().then((function(){return e.performPrint()})).catch((function(){})).then((function(){e.active&&abort()}))}}},window.addEventListener("keydown",(function(e){80!==e.keyCode||!e.ctrlKey&&!e.metaKey||e.altKey||e.shiftKey||(window.print(),e.preventDefault(),e.stopImmediatePropagation())}),!0),"onbeforeprint"in window){const e=function(e){"custom"!==e.detail&&e.stopImmediatePropagation()};window.addEventListener("beforeprint",e),window.addEventListener("afterprint",e)}let overlayPromise;function ensureOverlay(){if(!overlayPromise){if(!overlayManager)throw new Error("The overlay manager has not yet been initialized.");dialog||(dialog=document.getElementById("printServiceDialog")),overlayPromise=overlayManager.register(dialog,!0),document.getElementById("printCancel").onclick=abort,dialog.addEventListener("close",abort)}return overlayPromise}const PDFPrintServiceFactory={instance:{supportsPrinting:!0,createPrintService(e,t,i,n,s,r,a){if(activeService)throw new Error("The print service is created and active.");return activeService=new PDFPrintService(e,t,i,n,s,r,a),activeService}}};var _PDFPresentationMode_instances,_PDFPresentationMode_state,_PDFPresentationMode_args,_PDFPresentationMode_mouseWheel,_PDFPresentationMode_notifyStateChange,_PDFPresentationMode_enter,_PDFPresentationMode_exit,_PDFPresentationMode_mouseDown,_PDFPresentationMode_contextMenu,_PDFPresentationMode_showControls,_PDFPresentationMode_hideControls,_PDFPresentationMode_resetMouseScrollState,_PDFPresentationMode_touchSwipe,_PDFPresentationMode_addWindowListeners,_PDFPresentationMode_removeWindowListeners,_PDFPresentationMode_fullscreenChange,_PDFPresentationMode_addFullscreenChangeListeners,_PDFPresentationMode_removeFullscreenChangeListeners;const DELAY_BEFORE_HIDING_CONTROLS=3e3,ACTIVE_SELECTOR="pdfPresentationMode",CONTROLS_SELECTOR="pdfPresentationModeControls",MOUSE_SCROLL_COOLDOWN_TIME=50,PAGE_SWITCH_THRESHOLD=.1,SWIPE_MIN_DISTANCE_THRESHOLD=50,SWIPE_ANGLE_THRESHOLD=Math.PI/6;class PDFPresentationMode{constructor({container:e,pdfViewer:t,eventBus:i}){_PDFPresentationMode_instances.add(this),_PDFPresentationMode_state.set(this,PresentationModeState.UNKNOWN),_PDFPresentationMode_args.set(this,null),this.container=e,this.pdfViewer=t,this.eventBus=i,this.contextMenuOpen=!1,this.mouseScrollTimeStamp=0,this.mouseScrollDelta=0,this.touchSwipeState=null}request(){return __awaiter(this,void 0,void 0,(function*(){const{container:e,pdfViewer:t}=this;if(this.active||!t.pagesCount||!e.requestFullscreen)return!1;__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_addFullscreenChangeListeners).call(this),__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_notifyStateChange).call(this,PresentationModeState.CHANGING);const i=e.requestFullscreen();__classPrivateFieldSet(this,_PDFPresentationMode_args,{pageNumber:t.currentPageNumber,scaleValue:t.currentScaleValue,scrollMode:t.scrollMode,spreadMode:null,annotationEditorMode:null}),t.spreadMode===SpreadMode.NONE||t.pageViewsReady&&t.hasEqualPageSizes||(console.warn("Ignoring Spread modes when entering PresentationMode, since the document may contain varying page sizes."),__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").spreadMode=t.spreadMode),t.annotationEditorMode!==pdfExports.AnnotationEditorType.DISABLE&&(__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").annotationEditorMode=t.annotationEditorMode);try{return yield i,t.focus(),!0}catch(e){__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_removeFullscreenChangeListeners).call(this),__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_notifyStateChange).call(this,PresentationModeState.NORMAL)}return!1}))}get active(){return __classPrivateFieldGet(this,_PDFPresentationMode_state,"f")===PresentationModeState.CHANGING||__classPrivateFieldGet(this,_PDFPresentationMode_state,"f")===PresentationModeState.FULLSCREEN}}_PDFPresentationMode_state=new WeakMap,_PDFPresentationMode_args=new WeakMap,_PDFPresentationMode_instances=new WeakSet,_PDFPresentationMode_mouseWheel=function(e){if(!this.active)return;e.preventDefault();const t=normalizeWheelEventDelta(e),i=Date.now(),n=this.mouseScrollTimeStamp;if(!(i>n&&i-n<MOUSE_SCROLL_COOLDOWN_TIME)&&((this.mouseScrollDelta>0&&t<0||this.mouseScrollDelta<0&&t>0)&&__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_resetMouseScrollState).call(this),this.mouseScrollDelta+=t,Math.abs(this.mouseScrollDelta)>=PAGE_SWITCH_THRESHOLD)){const e=this.mouseScrollDelta;__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_resetMouseScrollState).call(this);(e>0?this.pdfViewer.previousPage():this.pdfViewer.nextPage())&&(this.mouseScrollTimeStamp=i)}},_PDFPresentationMode_notifyStateChange=function(e){__classPrivateFieldSet(this,_PDFPresentationMode_state,e),this.eventBus.dispatch("presentationmodechanged",{source:this,state:e})},_PDFPresentationMode_enter=function(){var e;__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_notifyStateChange).call(this,PresentationModeState.FULLSCREEN),this.container.classList.add(ACTIVE_SELECTOR),setTimeout((()=>{this.pdfViewer.scrollMode=ScrollMode.PAGE,null!==__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").spreadMode&&(this.pdfViewer.spreadMode=SpreadMode.NONE),this.pdfViewer.currentPageNumber=__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").pageNumber,this.pdfViewer.currentScaleValue="page-fit",null!==__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").annotationEditorMode&&(this.pdfViewer.annotationEditorMode=pdfExports.AnnotationEditorType.NONE)}),0),__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_addWindowListeners).call(this),__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_showControls).call(this),this.contextMenuOpen=!1,null===(e=window.getSelection())||void 0===e||e.removeAllRanges()},_PDFPresentationMode_exit=function(){const e=this.pdfViewer.currentPageNumber;this.container.classList.remove(ACTIVE_SELECTOR),setTimeout((()=>{var t;__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_removeFullscreenChangeListeners).call(this),__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_notifyStateChange).call(this,PresentationModeState.NORMAL),this.pdfViewer.scrollMode=__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").scrollMode,null!==(null===(t=__classPrivateFieldGet(this,_PDFPresentationMode_args,"f"))||void 0===t?void 0:t.spreadMode)&&(this.pdfViewer.spreadMode=__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").spreadMode),this.pdfViewer.currentScaleValue=__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").scaleValue,this.pdfViewer.currentPageNumber=e,null!==__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").annotationEditorMode&&(this.pdfViewer.annotationEditorMode=__classPrivateFieldGet(this,_PDFPresentationMode_args,"f").annotationEditorMode),__classPrivateFieldSet(this,_PDFPresentationMode_args,null)}),0),__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_removeWindowListeners).call(this),__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_hideControls).call(this),__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_resetMouseScrollState).call(this),this.contextMenuOpen=!1},_PDFPresentationMode_mouseDown=function(e){var t;if(this.contextMenuOpen)return this.contextMenuOpen=!1,void e.preventDefault();0===e.button&&(e.target.href&&(null===(t=e.target.parentNode)||void 0===t?void 0:t.hasAttribute("data-internal-link"))||(e.preventDefault(),e.shiftKey?this.pdfViewer.previousPage():this.pdfViewer.nextPage()))},_PDFPresentationMode_contextMenu=function(){this.contextMenuOpen=!0},_PDFPresentationMode_showControls=function(){this.controlsTimeout?clearTimeout(this.controlsTimeout):this.container.classList.add(CONTROLS_SELECTOR),this.controlsTimeout=setTimeout((()=>{this.container.classList.remove(CONTROLS_SELECTOR),delete this.controlsTimeout}),DELAY_BEFORE_HIDING_CONTROLS)},_PDFPresentationMode_hideControls=function(){this.controlsTimeout&&(clearTimeout(this.controlsTimeout),this.container.classList.remove(CONTROLS_SELECTOR),delete this.controlsTimeout)},_PDFPresentationMode_resetMouseScrollState=function(){this.mouseScrollTimeStamp=0,this.mouseScrollDelta=0},_PDFPresentationMode_touchSwipe=function(e){if(this.active)if(e.touches.length>1)this.touchSwipeState=null;else switch(e.type){case"touchstart":this.touchSwipeState={startX:e.touches[0].pageX,startY:e.touches[0].pageY,endX:e.touches[0].pageX,endY:e.touches[0].pageY};break;case"touchmove":if(null===this.touchSwipeState)return;this.touchSwipeState.endX=e.touches[0].pageX,this.touchSwipeState.endY=e.touches[0].pageY,e.preventDefault();break;case"touchend":if(null===this.touchSwipeState)return;let t=0;const i=this.touchSwipeState.endX-this.touchSwipeState.startX,n=this.touchSwipeState.endY-this.touchSwipeState.startY,s=Math.abs(Math.atan2(n,i));Math.abs(i)>SWIPE_MIN_DISTANCE_THRESHOLD&&(s<=SWIPE_ANGLE_THRESHOLD||s>=Math.PI-SWIPE_ANGLE_THRESHOLD)?t=i:Math.abs(n)>SWIPE_MIN_DISTANCE_THRESHOLD&&Math.abs(s-Math.PI/2)<=SWIPE_ANGLE_THRESHOLD&&(t=n),t>0?this.pdfViewer.previousPage():t<0&&this.pdfViewer.nextPage()}},_PDFPresentationMode_addWindowListeners=function(){this.showControlsBind=__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_showControls).bind(this),this.mouseDownBind=__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_mouseDown).bind(this),this.mouseWheelBind=__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_mouseWheel).bind(this),this.resetMouseScrollStateBind=__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_resetMouseScrollState).bind(this),this.contextMenuBind=__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_contextMenu).bind(this),this.touchSwipeBind=__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_touchSwipe).bind(this),window.addEventListener("mousemove",this.showControlsBind),window.addEventListener("mousedown",this.mouseDownBind),window.addEventListener("wheel",this.mouseWheelBind,{passive:!1}),window.addEventListener("keydown",this.resetMouseScrollStateBind),window.addEventListener("contextmenu",this.contextMenuBind),window.addEventListener("touchstart",this.touchSwipeBind),window.addEventListener("touchmove",this.touchSwipeBind),window.addEventListener("touchend",this.touchSwipeBind)},_PDFPresentationMode_removeWindowListeners=function(){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},_PDFPresentationMode_fullscreenChange=function(){document.fullscreenElement?__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_enter).call(this):__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_exit).call(this)},_PDFPresentationMode_addFullscreenChangeListeners=function(){this.fullscreenChangeBind=__classPrivateFieldGet(this,_PDFPresentationMode_instances,"m",_PDFPresentationMode_fullscreenChange).bind(this),window.addEventListener("fullscreenchange",this.fullscreenChangeBind)},_PDFPresentationMode_removeFullscreenChangeListeners=function(){window.removeEventListener("fullscreenchange",this.fullscreenChangeBind),delete this.fullscreenChangeBind};const initialState={isDocumentLoaded:!1,pagesReady:!1,url:null,numPages:0,pageNumber:0,scale:0,scaleValue:"auto",pagesRotation:0,spreadMode:SpreadMode.UNKNOWN,scrollMode:ScrollMode.UNKNOWN,documentOutline:null,attachments:new Map,thumbnails:new Map,thumbnailViews:new Map,annotationEditorMode:pdfExports.AnnotationEditorType.NONE,pdfSlick:null},create=()=>createStore$1(((e,t)=>Object.assign(Object.assign({},initialState),{_setThumbnailView:(i,n)=>{const s=new Map(t().thumbnails),r=new Map(t().thumbnailViews),{canvasWidth:a,canvasHeight:o,scale:l,rotation:h,loaded:c,pageLabel:d,src:u=null}=n;r.set(i,n),s.set(i,{pageNumber:i,width:a,height:o,scale:l,rotation:h,loaded:c,pageLabel:d,src:u}),e({thumbnailViews:r,thumbnails:s})},_setThumbnailsViews:t=>{const i=new Map(t.map((e=>[e.id,e]))),n=new Map(t.map((e=>{const{canvasWidth:t,canvasHeight:i,scale:n,rotation:s,loaded:r,pageLabel:a,src:o=null}=e;return[e.id,{pageNumber:e.id,width:t,height:i,scale:n,rotation:s,loaded:r,pageLabel:a,src:o}]})));e({thumbnailViews:i,thumbnails:n})}})));var _PDFSlick_instances,_PDFSlick_renderingQueue,_PDFSlick_container,_PDFSlick_viewerContainer,_PDFSlick_thumbsContainer,_PDFSlick_annotationMode,_PDFSlick_annotationEditorMode,_PDFSlick_onError,_PDFSlick_initializePageLabels,_PDFSlick_parseDocumentInfo,_PDFSlick_parsePageSize,_PDFSlick_initInternalEventListeners,_PDFSlick_onDocumentReady,_PDFSlick_onRotationChanging,_PDFSlick_onSwitchSpreadMode,_PDFSlick_onSwitchScrollMode,_PDFSlick_onScaleChanging,_PDFSlick_onPageChanging,_PDFSlick_onPageRendered;pdfExports.GlobalWorkerOptions.workerSrc=new URL("pdfjs-dist/build/pdf.worker.js","undefined"==typeof document&&"undefined"==typeof location?require("url").pathToFileURL(__filename).href:"undefined"==typeof document?location.href:_documentCurrentScript&&_documentCurrentScript.src||new URL("index.js",document.baseURI).href).toString();const US_PAGE_NAMES={"8.5x11":"Letter","8.5x14":"Legal"},METRIC_PAGE_NAMES={"297x420":"A3","210x297":"A4"};function getPageName(e,t,i){return i[`${t?e.width:e.height}x${t?e.height:e.width}`]}class PDFSlick{constructor({container:e,viewer:t,thumbs:i,store:n=create(),options:s,onError:r}){var a,o,l,h,c,d,u,p,g,f,m,_,v;_PDFSlick_instances.add(this),_PDFSlick_renderingQueue.set(this,void 0),_PDFSlick_container.set(this,void 0),_PDFSlick_viewerContainer.set(this,void 0),_PDFSlick_thumbsContainer.set(this,void 0),this.downloadManager=null,this.findController=null,this.pdfPresentationMode=null,this.document=null,_PDFSlick_annotationMode.set(this,void 0),_PDFSlick_annotationEditorMode.set(this,void 0),_PDFSlick_onError.set(this,void 0),__classPrivateFieldSet(this,_PDFSlick_container,e),__classPrivateFieldSet(this,_PDFSlick_viewerContainer,t),__classPrivateFieldSet(this,_PDFSlick_thumbsContainer,i),__classPrivateFieldSet(this,_PDFSlick_onError,r),this.l10n=null!==(a=null==s?void 0:s.l10n)&&void 0!==a?a:pdf_viewerExports.NullL10n,this.downloadManager=new pdf_viewerExports.DownloadManager,this.textLayerMode=null!==(o=null==s?void 0:s.textLayerMode)&&void 0!==o?o:TextLayerMode.ENABLE,__classPrivateFieldSet(this,_PDFSlick_annotationMode,null!==(l=null==s?void 0:s.annotationMode)&&void 0!==l?l:pdfExports.AnnotationMode.ENABLE_FORMS),__classPrivateFieldSet(this,_PDFSlick_annotationEditorMode,null!==(h=null==s?void 0:s.annotationEditorMode)&&void 0!==h?h:pdfExports.AnnotationEditorType.NONE),this.removePageBorders=null!==(c=null==s?void 0:s.removePageBorders)&&void 0!==c&&c,this.singlePageViewer=null!==(d=null==s?void 0:s.singlePageViewer)&&void 0!==d&&d,this.enablePrintAutoRotate=null!==(u=null==s?void 0:s.enablePrintAutoRotate)&&void 0!==u&&u,this.useOnlyCssZoom=null!==(p=null==s?void 0:s.useOnlyCssZoom)&&void 0!==p&&p,this.pageColors=null!==(g=null==s?void 0:s.pageColors)&&void 0!==g?g:null,this.maxCanvasPixels=null!==(f=null==s?void 0:s.maxCanvasPixels)&&void 0!==f?f:16777216,this.printResolution=null!==(m=null==s?void 0:s.printResolution)&&void 0!==m?m:96,this.thumbnailWidth=null!==(_=null==s?void 0:s.thumbnailWidth)&&void 0!==_?_:125,!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.l10n=pdf_viewerExports.NullL10n,this.store=n;const b=new PDFRenderingQueue;b.onIdle=this._cleanup.bind(this),b.isThumbnailViewEnabled=!0,__classPrivateFieldSet(this,_PDFSlick_renderingQueue,b);const y=new pdf_viewerExports.EventBus,S=new pdf_viewerExports.PDFLinkService({eventBus:y,externalLinkTarget:2,externalLinkRel:"noopener noreferrer nofollow",ignoreDestinationZoom:!1}),P=Object.assign(Object.assign({container:e},t&&{viewer:t}),{eventBus:y,linkService:S,renderingQueue:b,defaultRenderingQueue:!0,textLayerMode:this.textLayerMode,l10n:this.l10n,annotationMode:__classPrivateFieldGet(this,_PDFSlick_annotationMode,"f"),annotationEditorMode:__classPrivateFieldGet(this,_PDFSlick_annotationEditorMode,"f"),removePageBorders:this.removePageBorders,imageResourcesPath:"/images/",useOnlyCssZoom:this.useOnlyCssZoom}),A=this.singlePageViewer?new pdf_viewerExports.PDFSinglePageViewer(P):new pdf_viewerExports.PDFViewer(P);b.setViewer(A),i&&(this.thumbnailViewer=new PDFThumbnailViewer({container:i,eventBus:y,linkService:S,renderingQueue:b,l10n:this.l10n,pageColors:this.pageColors,store:n,thumbnailWidth:this.thumbnailWidth}),b.setThumbnailViewer(this.thumbnailViewer)),document.fullscreenEnabled&&(this.pdfPresentationMode=new PDFPresentationMode({container:e,pdfViewer:A,eventBus:y})),this.eventBus=y,this.linkService=S,this.viewer=A,this.linkService.setViewer(A);const w=null!==(v=null==s?void 0:s.scaleValue)&&void 0!==v?v:"auto";this.store.setState({scaleValue:w})}loadDocument(e,t){var i,n,s,r,a;return __awaiter(this,void 0,void 0,(function*(){if(this.url&&"string"==typeof this.url)try{URL.revokeObjectURL(this.url)}catch(e){}try{null===(i=this.document)||void 0===i||i.destroy(),null===(n=this.viewer)||void 0===n||n.cleanup(),e instanceof URL?this.url=e.toString():this.url=e;const o=null!==(s=null==t?void 0:t.filename)&&void 0!==s?s:pdfExports.getPdfFilenameFromUrl(null===(r=this.url)||void 0===r?void 0:r.toString());this.filename=o;const l=yield pdfExports.getDocument(e).promise;this.document=l,this.viewer.setDocument(this.document),this.linkService.setDocument(this.document),this.thumbnailViewer&&(null===(a=this.thumbnailViewer)||void 0===a||a.setDocument(l)),__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_initInternalEventListeners).call(this),yield __classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_initializePageLabels).call(this),this.store.setState({filename:o,numPages:l.numPages,pageNumber:1,isDocumentLoaded:!0,url:e.toString()});const h=yield l.getAttachments(),c=new Map(Object.keys(null!=h?h:{}).sort(((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))).map((e=>[e,h[e]])));this.store.setState({attachments:c}),yield __classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_parseDocumentInfo).call(this),this.forceRendering()}catch(e){__classPrivateFieldGet(this,_PDFSlick_onError,"f")&&__classPrivateFieldGet(this,_PDFSlick_onError,"f").call(this,e)}}))}forceRendering(e=!0){__classPrivateFieldGet(this,_PDFSlick_renderingQueue,"f").printing=!!this.printService,__classPrivateFieldGet(this,_PDFSlick_renderingQueue,"f").isThumbnailViewEnabled=e,__classPrivateFieldGet(this,_PDFSlick_renderingQueue,"f").renderHighestPriority()}gotoPage(e){this.linkService.goToPage(e)}openOrDownloadData(e,t,i){var n;null===(n=this.downloadManager)||void 0===n||n.openOrDownloadData(e,t,i)}download(){var e,t;return __awaiter(this,void 0,void 0,(function*(){const i=this.url,{filename:n}=this;try{const t=yield this.document.getData(),s=new Blob([t],{type:"application/pdf"});yield null===(e=this.downloadManager)||void 0===e?void 0:e.download(s,i,n,{})}catch(e){yield null===(t=this.downloadManager)||void 0===t?void 0:t.downloadUrl(i,n,{})}}))}save(){var e;return __awaiter(this,void 0,void 0,(function*(){const t=this.url,{filename:i}=this;try{const n=yield this.document.saveDocument(),s=new Blob([n],{type:"application/pdf"});yield null===(e=this.downloadManager)||void 0===e?void 0:e.download(s,t,i,{})}catch(e){console.error(`Error when saving the document: ${e.message}`),yield this.download()}}))}downloadOrSave(){var e;const{annotationStorage:t}=null!==(e=this.document)&&void 0!==e?e:{};t&&t.size>0?this.save():this.download()}get supportsPrinting(){return PDFPrintServiceFactory.instance.supportsPrinting}beforePrint(){if(this.printService)return;if(!this.supportsPrinting)return;if(!this.viewer.pageViewsReady)return void this.l10n.get("printing_not_ready").then((e=>{window.alert(e)}));const e=this.viewer.getPagesOverview(),t=document.getElementById("printContainer"),i=this.printResolution,n=this.viewer.optionalContentConfigPromise,s=PDFPrintServiceFactory.instance.createPrintService(this.document,e,t,i,n,null,this.l10n);this.printService=s,this.forceRendering(),s.layout()}afterPrint(){var e;this.printService&&(this.printService.destroy(),this.printService=null,null===(e=this.document)||void 0===e||e.annotationStorage.resetModified()),this.forceRendering()}requestPresentationMode(){var e;null===(e=this.pdfPresentationMode)||void 0===e||e.request()}triggerPrinting(){this.supportsPrinting&&window.print()}_cleanup(){var e;if(this.document)try{this.viewer.cleanup(),null===(e=this.thumbnailViewer)||void 0===e||e.cleanup(),this.document.cleanup()}catch(e){console.error("Unable to perform cleanup",e)}}setAnnotationEditorMode(e){this.viewer.annotationEditorMode={mode:e},this.store.setState({annotationEditorMode:e})}setAnnotationEditorParams(e){const t=Array.isArray(e)?e:[e];for(const e of t)this.viewer.annotationEditorParams=e}setSpreadMode(e){isValidSpreadMode(e)&&(this.viewer.spreadMode=e,this.dispatch("switchspreadmode",{mode:e}))}setScrollMode(e){isValidScrollMode(e)&&(this.viewer.scrollMode=e,this.dispatch("switchscrollmode",{mode:e}))}setRotation(e){isValidRotation(e)&&(this.viewer.pagesRotation=e)}getPagesOverview(){var e,t;try{return null!==(t=null===(e=this.viewer)||void 0===e?void 0:e.getPagesOverview())&&void 0!==t?t:[]}catch(e){return[]}}increaseScale(){this.viewer.increaseScale()}decreaseScale(){this.viewer.decreaseScale()}set currentScaleValue(e){this.viewer.currentScaleValue=e}set currentScale(e){this.viewer.currentScale=e}getPageView(e){return this.viewer.getPageView(e)}on(e,t,i){this.eventBus.on(e,t,i)}off(e,t,i){this.eventBus.off(e,t,i)}dispatch(e,t){this.eventBus.dispatch(e,t)}}_PDFSlick_renderingQueue=new WeakMap,_PDFSlick_container=new WeakMap,_PDFSlick_viewerContainer=new WeakMap,_PDFSlick_thumbsContainer=new WeakMap,_PDFSlick_annotationMode=new WeakMap,_PDFSlick_annotationEditorMode=new WeakMap,_PDFSlick_onError=new WeakMap,_PDFSlick_instances=new WeakSet,_PDFSlick_initializePageLabels=function(){var e;return __awaiter(this,void 0,void 0,(function*(){const t=this.document,i=null!==(e=yield t.getPageLabels())&&void 0!==e?e:[],n=i.length;let s=0,r=0;for(let e=0;e<n;e++){const t=i[e];if(t===(e+1).toString())s++;else{if(""!==t)break;r++}}if(s>=n||r>=n)return;const{viewer:a,thumbnailViewer:o}=this;a.setPageLabels(i),null==o||o.setPageLabels(i)}))},_PDFSlick_parseDocumentInfo=function(){return __awaiter(this,void 0,void 0,(function*(){const{info:e,contentLength:t}=yield this.document.getMetadata(),i=yield this.document.getPage(this.store.getState().pageNumber).then((e=>__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_parsePageSize).call(this,getPageSizeInches(e),0)));this.store.setState({filesize:t,title:e.Title,author:e.Author,subject:e.Subject,keywords:e.Keywords,creator:e.Creator,producer:e.Producer,version:e.PDFFormatVersion,creationDate:pdfExports.PDFDateString.toDateObject(e.CreationDate),modificationDate:pdfExports.PDFDateString.toDateObject(e.ModDate),isLinearized:e.IsLinearized,pageSize:i})}))},_PDFSlick_parsePageSize=function(e,t){return __awaiter(this,void 0,void 0,(function*(){if(!e)return;t%180!=0&&(e={width:e.height,height:e.width});const i=isPortraitOrientation(e);let n={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},r=getPageName(n,i,US_PAGE_NAMES)||getPageName(s,i,METRIC_PAGE_NAMES);if(!(r||Number.isInteger(s.width)&&Number.isInteger(s.height))){const t={width:25.4*e.width,height:25.4*e.height},a={width:Math.round(s.width),height:Math.round(s.height)};Math.abs(t.width-a.width)<.1&&Math.abs(t.height-a.height)<.1&&(r=getPageName(a,i,METRIC_PAGE_NAMES),r&&(n={width:Math.round(a.width/25.4*100)/100,height:Math.round(a.height/25.4*100)/100},s=a))}const[{width:a,height:o},l,h,c]=yield Promise.all([n,this.l10n.get("document_properties_page_size_unit_inches"),r&&this.l10n.get(`document_properties_page_size_name_${r.toLowerCase()}`),this.l10n.get("document_properties_page_size_orientation_"+(i?"portrait":"landscape"))]);return{width:a.toLocaleString(),height:o.toLocaleString(),unit:l,name:h,orientation:c}}))},_PDFSlick_initInternalEventListeners=function(){this.eventBus._on("pagesinit",__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_onDocumentReady).bind(this)),this.eventBus._on("scalechanging",__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_onScaleChanging).bind(this)),this.eventBus._on("pagechanging",__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_onPageChanging).bind(this)),this.eventBus._on("pagerendered",__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_onPageRendered).bind(this)),this.eventBus._on("rotationchanging",__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_onRotationChanging).bind(this)),this.eventBus._on("switchspreadmode",__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_onSwitchSpreadMode).bind(this)),this.eventBus._on("switchscrollmode",__classPrivateFieldGet(this,_PDFSlick_instances,"m",_PDFSlick_onSwitchScrollMode).bind(this)),this.eventBus._on("beforeprint",this.beforePrint.bind(this)),this.eventBus._on("afterprint",this.afterPrint.bind(this)),window.onbeforeprint=e=>{this.eventBus.dispatch("beforeprint",{source:window})},window.onafterprint=e=>{this.eventBus.dispatch("afterprint",{source:window})}},_PDFSlick_onDocumentReady=function({source:e}){var t;return __awaiter(this,void 0,void 0,(function*(){const i=yield null===(t=this.document)||void 0===t?void 0:t.getOutline(),n=this.store.getState().scaleValue;e.currentScale=1,e.currentScaleValue="auto",this.store.setState({documentOutline:i,pageNumber:1,scaleValue:n,pagesReady:!0})}))},_PDFSlick_onRotationChanging=function({pagesRotation:e,pageNumber:t}){this.store.setState({pagesRotation:e}),this.thumbnailViewer&&(this.thumbnailViewer.pagesRotation=e),this.forceRendering(),this.viewer.currentPageNumber=t},_PDFSlick_onSwitchSpreadMode=function({mode:e}){this.store.setState({spreadMode:e})},_PDFSlick_onSwitchScrollMode=function({mode:e}){this.store.setState({scrollMode:e})},_PDFSlick_onScaleChanging=function({scale:e,presetValue:t}){this.store.setState({scale:e,scaleValue:t}),this.viewer.update()},_PDFSlick_onPageChanging=function({pageNumber:e}){var t;null===(t=this.thumbnailViewer)||void 0===t||t.scrollThumbnailIntoView(e),this.store.setState({pageNumber:e})},_PDFSlick_onPageRendered=function({pageNumber:e,error:t}){var i;if(__classPrivateFieldGet(this,_PDFSlick_thumbsContainer,"f")){const t=this.viewer.getPageView(e-1),n=null===(i=this.thumbnailViewer)||void 0===i?void 0:i.getThumbnail(e-1);t&&n&&n.setImage(t)}};var noop=function(){},isBrowser="undefined"!=typeof window,useIsomorphicLayoutEffect=isBrowser?React.useLayoutEffect:React.useEffect;function useTimeoutFn(e,t){var i=React.useRef(!1),n=React.useRef(),s=React.useRef(e),r=React.useCallback((function(){return i.current}),[]),a=React.useCallback((function(){i.current=!1,n.current&&clearTimeout(n.current),n.current=setTimeout((function(){i.current=!0,s.current()}),t)}),[t]),o=React.useCallback((function(){i.current=null,n.current&&clearTimeout(n.current)}),[]);return React.useEffect((function(){s.current=e}),[e]),React.useEffect((function(){return a(),o}),[t]),[r,o,a]}function useDebounce(e,t,i){void 0===i&&(i=[]);var n=useTimeoutFn(e,t),s=n[0],r=n[1],a=n[2];return React.useEffect(a,i),[s,r]}var defaultState={x:0,y:0,width:0,height:0,top:0,left:0,bottom:0,right:0};function useMeasure(){var e=React.useState(null),t=e[0],i=e[1],n=React.useState(defaultState),s=n[0],r=n[1],a=React.useMemo((function(){return new window.ResizeObserver((function(e){if(e[0]){var t=e[0].contentRect,i=t.x,n=t.y,s=t.width,a=t.height,o=t.top,l=t.left,h=t.bottom,c=t.right;r({x:i,y:n,width:s,height:a,top:o,left:l,bottom:h,right:c})}}))}),[]);return useIsomorphicLayoutEffect((function(){if(t)return a.observe(t),function(){a.disconnect()}}),[t]),[i,s]}var useMeasure$1=isBrowser&&void 0!==window.ResizeObserver?useMeasure:function(){return[noop,defaultState]};function PDFSlickViewer({usePDFSlickStore:e,viewerRef:t,className:i}){const n=e((e=>e.pdfSlick)),s=e((e=>e.scaleValue)),[r,{width:a}]=useMeasure$1();return useDebounce((()=>{a&&(!n||"auto"!==s&&"page-fit"!==s&&"page-width"!==s||(n.viewer.currentScaleValue=s),null==n||n.viewer.update())}),0,[a]),jsxRuntime.jsx("div",Object.assign({ref:e=>{t(e),r(e)},id:"viewerContainer",className:`pdfSlickContainer ${null!=i?i:""}`,style:{position:"absolute",inset:0}},{children:jsxRuntime.jsx("div",{id:"viewer",className:"pdfSlickViewer pdfViewer"})}))}function PDFSlickThumbnails({children:e,thumbsRef:t,usePDFSlickStore:i,className:n}){const s=i((e=>e.thumbnailViews)),r=i((e=>e.pdfSlick)),[a,{width:o}]=useMeasure$1();return useDebounce((()=>{o&&(null==r||r.forceRendering())}),0,[o]),jsxRuntime.jsx("div",Object.assign({ref:e=>{t(e),a(e)}},{className:n},{style:{position:"absolute",overflow:"auto",inset:0}},{children:Array.from(s).map((([t,i])=>{var n;return reactDom.createPortal(e({pageNumber:t,width:i.canvasWidth,height:i.canvasHeight,scale:i.scale,src:null!==(n=null==i?void 0:i.src)&&void 0!==n?n:null,rotation:i.rotation,pageLabel:i.pageLabel,loaded:i.loaded}),i.div)}))}))}function createStore(e){return function(t,i){return useStore(e,t,i)}}const usePDFSlick=(e,t)=>{const[i,n]=React.useState(!1),[s,r]=React.useState(null),[a,o]=React.useState(null),[l,h]=React.useState(null),c=React.useMemo((()=>create()),[]),d=React.useMemo((()=>createStore(c)),[]),u=React.useCallback((e=>{null!==e&&r(e)}),[]),p=React.useCallback((e=>{null!==e&&o(e)}),[]);return React.useEffect((()=>{if(e&&s){const i=new PDFSlick({container:s,thumbs:a,store:c,options:t,onError:e=>h(e)});i.loadDocument(e,t).then((()=>{n(!0)})),c.setState({pdfSlick:i})}return()=>{}}),[e,s]),{isDocumentLoaded:i,viewerRef:u,thumbsRef:p,usePDFSlickStore:d,store:c,PDFSlickViewer:PDFSlickViewer,PDFSlickThumbnails:PDFSlickThumbnails,error:l}};exports.AutoPrintRegExp=AutoPrintRegExp,exports.CursorTool=CursorTool,exports.DEFAULT_SCALE=DEFAULT_SCALE,exports.DEFAULT_SCALE_DELTA=DEFAULT_SCALE_DELTA,exports.DEFAULT_SCALE_VALUE=DEFAULT_SCALE_VALUE,exports.MAX_AUTO_SCALE=MAX_AUTO_SCALE,exports.MAX_SCALE=MAX_SCALE,exports.MIN_SCALE=MIN_SCALE,exports.OutputScale=OutputScale,exports.PDFSlick=PDFSlick,exports.PDFSlickThumbnails=PDFSlickThumbnails,exports.PDFSlickViewer=PDFSlickViewer,exports.PresentationModeState=PresentationModeState,exports.ProgressBar=ProgressBar,exports.RendererType=RendererType,exports.RenderingStates=RenderingStates,exports.SCROLLBAR_PADDING=SCROLLBAR_PADDING,exports.ScrollMode=ScrollMode,exports.SidebarView=SidebarView,exports.SpreadMode=SpreadMode,exports.TextLayerMode=TextLayerMode,exports.UNKNOWN_SCALE=UNKNOWN_SCALE,exports.VERTICAL_PADDING=VERTICAL_PADDING,exports.animationStarted=animationStarted,exports.apiPageLayoutToViewerModes=apiPageLayoutToViewerModes,exports.apiPageModeToSidebarView=apiPageModeToSidebarView,exports.approximateFraction=approximateFraction,exports.backtrackBeforeAllVisibleElements=backtrackBeforeAllVisibleElements,exports.binarySearchFirstItem=binarySearchFirstItem,exports.create=create,exports.createStore=createStore,exports.docStyle=docStyle,exports.getActiveOrFocusedElement=getActiveOrFocusedElement,exports.getPageSizeInches=getPageSizeInches,exports.getVisibleElements=getVisibleElements,exports.initialState=initialState,exports.isPortraitOrientation=isPortraitOrientation,exports.isValidRotation=isValidRotation,exports.isValidScrollMode=isValidScrollMode,exports.isValidSpreadMode=isValidSpreadMode,exports.noContextMenuHandler=noContextMenuHandler,exports.normalizeWheelEventDelta=normalizeWheelEventDelta,exports.normalizeWheelEventDirection=normalizeWheelEventDirection,exports.parseQueryString=parseQueryString,exports.removeNullCharacters=removeNullCharacters,exports.roundToDivide=roundToDivide,exports.scrollIntoView=scrollIntoView,exports.usePDFSlick=usePDFSlick,exports.watchScroll=watchScroll}));