1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4577],{99299:function(module,__unused_webpack_exports,__webpack_require__){var process=__webpack_require__(83454),Buffer=__webpack_require__(21876).Buffer;/** 2 * @licstart The following is the entire license notice for the 3 * JavaScript code in this page 4 * 5 * Copyright 2023 Mozilla Foundation 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 * 19 * @licend The above is the entire license notice for the 20 * JavaScript code in this page 21 */!function(o,l){module.exports=o.pdfjsLib=l()}(globalThis,()=>(()=>{"use strict";var __webpack_modules__=[,(o,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.VerbosityLevel=l.Util=l.UnknownErrorException=l.UnexpectedResponseException=l.TextRenderingMode=l.RenderingIntentFlag=l.PromiseCapability=l.PermissionFlag=l.PasswordResponses=l.PasswordException=l.PageActionEventType=l.OPS=l.MissingPDFException=l.MAX_IMAGE_SIZE_TO_CACHE=l.LINE_FACTOR=l.LINE_DESCENT_FACTOR=l.InvalidPDFException=l.ImageKind=l.IDENTITY_MATRIX=l.FormatError=l.FeatureTest=l.FONT_IDENTITY_MATRIX=l.DocumentActionEventType=l.CMapCompressionType=l.BaseException=l.BASELINE_FACTOR=l.AnnotationType=l.AnnotationReplyType=l.AnnotationPrefix=l.AnnotationMode=l.AnnotationFlag=l.AnnotationFieldFlag=l.AnnotationEditorType=l.AnnotationEditorPrefix=l.AnnotationEditorParamsType=l.AnnotationBorderStyleType=l.AnnotationActionEventType=l.AbortException=void 0,l.assert=assert,l.bytesToString=bytesToString,l.createValidAbsoluteUrl=createValidAbsoluteUrl,l.getModificationDate=getModificationDate,l.getUuid=getUuid,l.getVerbosityLevel=getVerbosityLevel,l.info=info,l.isArrayBuffer=isArrayBuffer,l.isArrayEqual=isArrayEqual,l.isNodeJS=void 0,l.normalizeUnicode=normalizeUnicode,l.objectFromMap=objectFromMap,l.objectSize=objectSize,l.setVerbosityLevel=setVerbosityLevel,l.shadow=shadow,l.string32=string32,l.stringToBytes=stringToBytes,l.stringToPDFString=stringToPDFString,l.stringToUTF8String=stringToUTF8String,l.unreachable=unreachable,l.utf8StringToString=utf8StringToString,l.warn=warn;let u="object"==typeof process&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&"browser"!==process.type);l.isNodeJS=u;let A=[1,0,0,1,0,0];l.IDENTITY_MATRIX=A;let S=[.001,0,0,.001,0,0];l.FONT_IDENTITY_MATRIX=S;let E=1e7;l.MAX_IMAGE_SIZE_TO_CACHE=E;let C=1.35;l.LINE_FACTOR=C;let T=.35;l.LINE_DESCENT_FACTOR=T;let P=T/C;l.BASELINE_FACTOR=P;let M={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};l.RenderingIntentFlag=M;let F={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};l.AnnotationMode=F;let R="pdfjs_internal_editor_";l.AnnotationEditorPrefix=R;let D={DISABLE:-1,NONE:0,FREETEXT:3,STAMP:13,INK:15};l.AnnotationEditorType=D;let I={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23};l.AnnotationEditorParamsType=I;let L={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};l.PermissionFlag=L;let O={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};l.TextRenderingMode=O;let N={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};l.ImageKind=N;let B={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};l.AnnotationType=B;let U={GROUP:"Group",REPLY:"R"};l.AnnotationReplyType=U;let H={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};l.AnnotationFlag=H;let z={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};l.AnnotationFieldFlag=z;let V={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};l.AnnotationBorderStyleType=V;let W={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"};l.AnnotationActionEventType=W;let $={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};l.DocumentActionEventType=$;let X={O:"PageOpen",C:"PageClose"};l.PageActionEventType=X;let K={ERRORS:0,WARNINGS:1,INFOS:5};l.VerbosityLevel=K;let Y={NONE:0,BINARY:1};l.CMapCompressionType=Y;let J={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};l.OPS=J;let Q={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};l.PasswordResponses=Q;let Z=K.WARNINGS;function setVerbosityLevel(o){Number.isInteger(o)&&(Z=o)}function getVerbosityLevel(){return Z}function info(o){Z>=K.INFOS&&console.log(`Info: ${o}`)}function warn(o){Z>=K.WARNINGS&&console.log(`Warning: ${o}`)}function unreachable(o){throw Error(o)}function assert(o,l){o||unreachable(l)}function _isValidProtocol(o){switch(o?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function createValidAbsoluteUrl(o,l=null,u=null){if(!o)return null;try{if(u&&"string"==typeof o){if(u.addDefaultProtocol&&o.startsWith("www.")){let l=o.match(/\./g);l?.length>=2&&(o=`http://${o}`)}if(u.tryConvertEncoding)try{o=stringToUTF8String(o)}catch{}}let A=l?new URL(o,l):new URL(o);if(_isValidProtocol(A))return A}catch{}return null}function shadow(o,l,u,A=!1){return Object.defineProperty(o,l,{value:u,enumerable:!A,configurable:!0,writable:!1}),u}
21let tt=function(){function BaseException(o,l){this.constructor===BaseException&&unreachable("Cannot initialize BaseException."),this.message=o,this.name=l}return BaseException.prototype=Error(),BaseException.constructor=BaseException,BaseException}();l.BaseException=tt;let PasswordException=class PasswordException extends tt{constructor(o,l){super(o,"PasswordException"),this.code=l}};l.PasswordException=PasswordException;let UnknownErrorException=class UnknownErrorException extends tt{constructor(o,l){super(o,"UnknownErrorException"),this.details=l}};l.UnknownErrorException=UnknownErrorException;let InvalidPDFException=class InvalidPDFException extends tt{constructor(o){super(o,"InvalidPDFException")}};l.InvalidPDFException=InvalidPDFException;let MissingPDFException=class MissingPDFException extends tt{constructor(o){super(o,"MissingPDFException")}};l.MissingPDFException=MissingPDFException;let UnexpectedResponseException=class UnexpectedResponseException extends tt{constructor(o,l){super(o,"UnexpectedResponseException"),this.status=l}};l.UnexpectedResponseException=UnexpectedResponseException;let FormatError=class FormatError extends tt{constructor(o){super(o,"FormatError")}};l.FormatError=FormatError;let AbortException=class AbortException extends tt{constructor(o){super(o,"AbortException")}};function bytesToString(o){("object"!=typeof o||o?.length===void 0)&&unreachable("Invalid argument for bytesToString");let l=o.length,u=8192;if(l<u)return String.fromCharCode.apply(null,o);let A=[];for(let S=0;S<l;S+=u){let E=Math.min(S+u,l),C=o.subarray(S,E);A.push(String.fromCharCode.apply(null,C))}return A.join("")}function stringToBytes(o){"string"!=typeof o&&unreachable("Invalid argument for stringToBytes");let l=o.length,u=new Uint8Array(l);for(let A=0;A<l;++A)u[A]=255&o.charCodeAt(A);return u}function string32(o){return String.fromCharCode(o>>24&255,o>>16&255,o>>8&255,255&o)}function objectSize(o){return Object.keys(o).length}function objectFromMap(o){let l=Object.create(null);for(let[u,A]of o)l[u]=A;return l}function isLittleEndian(){let o=new Uint8Array(4);o[0]=1;let l=new Uint32Array(o.buffer,0,1);return 1===l[0]}function isEvalSupported(){try{return Function(""),!0}catch{return!1}}l.AbortException=AbortException;let FeatureTest=class FeatureTest{static get isLittleEndian(){return shadow(this,"isLittleEndian",isLittleEndian())}static get isEvalSupported(){return shadow(this,"isEvalSupported",isEvalSupported())}static get isOffscreenCanvasSupported(){return shadow(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get platform(){return"undefined"==typeof navigator?shadow(this,"platform",{isWin:!1,isMac:!1}):shadow(this,"platform",{isWin:navigator.platform.includes("Win"),isMac:navigator.platform.includes("Mac")})}static get isCSSRoundSupported(){return shadow(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}};l.FeatureTest=FeatureTest;let te=[...Array(256).keys()].map(o=>o.toString(16).padStart(2,"0"));let Util=class Util{static makeHexColor(o,l,u){return`#${te[o]}${te[l]}${te[u]}`}static scaleMinMax(o,l){let u;o[0]?(o[0]<0&&(u=l[0],l[0]=l[1],l[1]=u),l[0]*=o[0],l[1]*=o[0],o[3]<0&&(u=l[2],l[2]=l[3],l[3]=u),l[2]*=o[3],l[3]*=o[3]):(u=l[0],l[0]=l[2],l[2]=u,u=l[1],l[1]=l[3],l[3]=u,o[1]<0&&(u=l[2],l[2]=l[3],l[3]=u),l[2]*=o[1],l[3]*=o[1],o[2]<0&&(u=l[0],l[0]=l[1],l[1]=u),l[0]*=o[2],l[1]*=o[2]),l[0]+=o[4],l[1]+=o[4],l[2]+=o[5],l[3]+=o[5]}static transform(o,l){return[o[0]*l[0]+o[2]*l[1],o[1]*l[0]+o[3]*l[1],o[0]*l[2]+o[2]*l[3],o[1]*l[2]+o[3]*l[3],o[0]*l[4]+o[2]*l[5]+o[4],o[1]*l[4]+o[3]*l[5]+o[5]]}static applyTransform(o,l){let u=o[0]*l[0]+o[1]*l[2]+l[4],A=o[0]*l[1]+o[1]*l[3]+l[5];return[u,A]}static applyInverseTransform(o,l){let u=l[0]*l[3]-l[1]*l[2],A=(o[0]*l[3]-o[1]*l[2]+l[2]*l[5]-l[4]*l[3])/u,S=(-o[0]*l[1]+o[1]*l[0]+l[4]*l[1]-l[5]*l[0])/u;return[A,S]}static getAxialAlignedBoundingBox(o,l){let u=this.applyTransform(o,l),A=this.applyTransform(o.slice(2,4),l),S=this.applyTransform([o[0],o[3]],l),E=this.applyTransform([o[2],o[1]],l);return[Math.min(u[0],A[0],S[0],E[0]),Math.min(u[1],A[1],S[1],E[1]),Math.max(u[0],A[0],S[0],E[0]),Math.max(u[1],A[1],S[1],E[1])]}static inverseTransform(o){let l=o[0]*o[3]-o[1]*o[2];return[o[3]/l,-o[1]/l,-o[2]/l,o[0]/l,(o[2]*o[5]-o[4]*o[3])/l,(o[4]*o[1]-o[5]*o[0])/l]}static singularValueDecompose2dScale(o){let l=[o[0],o[2],o[1],o[3]],u=o[0]*l[0]+o[1]*l[2],A=o[0]*l[1]+o[1]*l[3],S=o[2]*l[0]+o[3]*l[2],E=o[2]*l[1]+o[3]*l[3],C=(u+E)/2,T=Math.sqrt((u+E)**2-4*(u*E-S*A))/2,P=C+T||1,M=C-T||1;return[Math.sqrt(P),Math.sqrt(M)]}static normalizeRect(o){let l=o.slice(0);return o[0]>o[2]&&(l[0]=o[2],l[2]=o[0]),o[1]>o[3]&&(l[1]=o[3],l[3]=o[1]),l}static intersect(o,l){let u=Math.max(Math.min(o[0],o[2]),Math.min(l[0],l[2])),A=Math.min(Math.max(o[0],o[2]),Math.max(l[0],l[2]));if(u>A)return null;let S=Math.max(Math.min(o[1],o[3]),Math.min(l[1],l[3])),E=Math.min(Math.max(o[1],o[3]),Math.max(l[1],l[3]));return S>E?null:[u,S,A,E]}static bezierBoundingBox(o,l,u,A,S,E,C,T){let P,M,F,R,D,I,L,O;let N=[],B=[[],[]];for(let B=0;B<2;
21++B){if(0===B?(M=6*o-12*u+6*S,P=-3*o+9*u-9*S+3*C,F=3*u-3*o):(M=6*l-12*A+6*E,P=-3*l+9*A-9*E+3*T,F=3*A-3*l),1e-12>Math.abs(P)){if(1e-12>Math.abs(M))continue;0<(R=-F/M)&&R<1&&N.push(R);continue}O=Math.sqrt(L=M*M-4*F*P),!(L<0)&&(0<(D=(-M+O)/(2*P))&&D<1&&N.push(D),0<(I=(-M-O)/(2*P))&&I<1&&N.push(I))}let U=N.length,H,z=U;for(;U--;)H=1-(R=N[U]),B[0][U]=H*H*H*o+3*H*H*R*u+3*H*R*R*S+R*R*R*C,B[1][U]=H*H*H*l+3*H*H*R*A+3*H*R*R*E+R*R*R*T;return B[0][z]=o,B[1][z]=l,B[0][z+1]=C,B[1][z+1]=T,B[0].length=B[1].length=z+2,[Math.min(...B[0]),Math.min(...B[1]),Math.max(...B[0]),Math.max(...B[1])]}};l.Util=Util;let ti=[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 stringToPDFString(o){if(o[0]>="\xef"){let l;if("\xfe"===o[0]&&"\xff"===o[1]?l="utf-16be":"\xff"===o[0]&&"\xfe"===o[1]?l="utf-16le":"\xef"===o[0]&&"\xbb"===o[1]&&"\xbf"===o[2]&&(l="utf-8"),l)try{let u=new TextDecoder(l,{fatal:!0}),A=stringToBytes(o);return u.decode(A)}catch(o){warn(`stringToPDFString: "${o}".`)}}let l=[];for(let u=0,A=o.length;u<A;u++){let A=ti[o.charCodeAt(u)];l.push(A?String.fromCharCode(A):o.charAt(u))}return l.join("")}function stringToUTF8String(o){return decodeURIComponent(escape(o))}function utf8StringToString(o){return unescape(encodeURIComponent(o))}function isArrayBuffer(o){return"object"==typeof o&&o?.byteLength!==void 0}function isArrayEqual(o,l){if(o.length!==l.length)return!1;for(let u=0,A=o.length;u<A;u++)if(o[u]!==l[u])return!1;return!0}function getModificationDate(o=new Date){let l=[o.getUTCFullYear().toString(),(o.getUTCMonth()+1).toString().padStart(2,"0"),o.getUTCDate().toString().padStart(2,"0"),o.getUTCHours().toString().padStart(2,"0"),o.getUTCMinutes().toString().padStart(2,"0"),o.getUTCSeconds().toString().padStart(2,"0")];return l.join("")}let PromiseCapability=class PromiseCapability{#t=!1;constructor(){this.promise=new Promise((o,l)=>{this.resolve=l=>{this.#t=!0,o(l)},this.reject=o=>{this.#t=!0,l(o)}})}get settled(){return this.#t}};l.PromiseCapability=PromiseCapability;let ts=null,tr=null;function normalizeUnicode(o){return ts||(ts=/([\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,tr=new Map([["ï¬
","ſt"]])),o.replaceAll(ts,(o,l,u)=>l?l.normalize("NFKC"):tr.get(u))}function getUuid(){if("undefined"!=typeof crypto&&"function"==typeof crypto?.randomUUID)return crypto.randomUUID();let o=new Uint8Array(32);if("undefined"!=typeof crypto&&"function"==typeof crypto?.getRandomValues)crypto.getRandomValues(o);else for(let l=0;l<32;l++)o[l]=Math.floor(255*Math.random());return bytesToString(o)}let ta="pdfjs_internal_id_";l.AnnotationPrefix=ta},(__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);let 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;let DefaultCMapReaderFactory=_util.isNodeJS?_displayNode_utils.NodeCMapReaderFactory:_display_utils.DOMCMapReaderFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory;let DefaultFilterFactory=_util.isNodeJS?_displayNode_utils.NodeFilterFactory:_display_utils.DOMFilterFactory;exports.DefaultFilterFactory=DefaultFilterFactory;let DefaultStandardFontDataFactory=_util.isNodeJS?_displayNode_utils.NodeStandardFontDataFactory:_display_utils.DOMStandardFontDataFactory;function getDocument(o){if("string"==typeof o||o instanceof URL?o={url:o}:(0,_util.isArrayBuffer)(o)&&(o={data:o}),"object"!=typeof o)throw Error("Invalid parameter in getDocument, need parameter object.");if(!o.url&&!o.data&&!o.range)throw Error("Invalid parameter object: need either .data, .range or .url");let l=new PDFDocumentLoadingTask,{docId:u}=l,A=o.url?getUrlProp(o.url):null,S=o.data?getDataProp(o.data):null,E=o.httpHeaders||null,C=!0===o.withCredentials,T=o.password??null,P=o.range instanceof PDFDataRangeTransport?o.range:null,M=Number.isInteger(o.rangeChunkSize)&&o.rangeChunkSize>0?o.rangeChunkSize:DEFAULT_RANGE_CHUNK_SIZE,F=o.worker instanceof PDFWorker?o.worker:null,R=o.verbosity,D="string"!=typeof o.docBaseUrl||(0,_display_utils.isDataScheme)(o.docBaseUrl)?null:o.docBaseUrl,I="str
21ing"==typeof o.cMapUrl?o.cMapUrl:null,L=!1!==o.cMapPacked,O=o.CMapReaderFactory||DefaultCMapReaderFactory,N="string"==typeof o.standardFontDataUrl?o.standardFontDataUrl:null,B=o.StandardFontDataFactory||DefaultStandardFontDataFactory,U=!0!==o.stopAtErrors,H=Number.isInteger(o.maxImageSize)&&o.maxImageSize>-1?o.maxImageSize:-1,z=!1!==o.isEvalSupported,V="boolean"==typeof o.isOffscreenCanvasSupported?o.isOffscreenCanvasSupported:!_util.isNodeJS,W=Number.isInteger(o.canvasMaxAreaInBytes)?o.canvasMaxAreaInBytes:-1,$="boolean"==typeof o.disableFontFace?o.disableFontFace:_util.isNodeJS,X=!0===o.fontExtraProperties,K=!0===o.enableXfa,Y=o.ownerDocument||globalThis.document,J=!0===o.disableRange,Q=!0===o.disableStream,Z=!0===o.disableAutoFetch,tt=!0===o.pdfBug,te=P?P.length:o.length??NaN,ti="boolean"==typeof o.useSystemFonts?o.useSystemFonts:!_util.isNodeJS&&!$,ts="boolean"==typeof o.useWorkerFetch?o.useWorkerFetch:O===_display_utils.DOMCMapReaderFactory&&B===_display_utils.DOMStandardFontDataFactory&&I&&N&&(0,_display_utils.isValidFetchUrl)(I,document.baseURI)&&(0,_display_utils.isValidFetchUrl)(N,document.baseURI),tr=o.canvasFactory||new DefaultCanvasFactory({ownerDocument:Y}),ta=o.filterFactory||new DefaultFilterFactory({docId:u,ownerDocument:Y}),tn=null;(0,_util.setVerbosityLevel)(R);let to={canvasFactory:tr,filterFactory:ta};if(ts||(to.cMapReaderFactory=new O({baseUrl:I,isCompressed:L}),to.standardFontDataFactory=new B({baseUrl:N})),!F){let o={verbosity:R,port:_worker_options.GlobalWorkerOptions.workerPort};F=o.port?PDFWorker.fromPort(o):new PDFWorker(o),l._worker=F}let tl={docId:u,apiVersion:"3.11.174",data:S,password:T,disableAutoFetch:Z,rangeChunkSize:M,length:te,docBaseUrl:D,enableXfa:K,evaluatorOptions:{maxImageSize:H,disableFontFace:$,ignoreErrors:U,isEvalSupported:z,isOffscreenCanvasSupported:V,canvasMaxAreaInBytes:W,fontExtraProperties:X,useSystemFonts:ti,cMapUrl:ts?I:null,standardFontDataUrl:ts?N:null}},th={ignoreErrors:U,isEvalSupported:z,disableFontFace:$,fontExtraProperties:X,enableXfa:K,ownerDocument:Y,disableAutoFetch:Z,pdfBug:tt,styleElement:tn};return F.promise.then(function(){if(l.destroyed)throw Error("Loading aborted");let o=_fetchDocument(F,tl),T=new Promise(function(o){let l;if(P)l=new _transport_stream.PDFDataTransportStream({length:te,initialData:P.initialData,progressiveDone:P.progressiveDone,contentDispositionFilename:P.contentDispositionFilename,disableRange:J,disableStream:Q},P);else if(!S){let createPDFNetworkStream=o=>_util.isNodeJS?new _displayNode_stream.PDFNodeStream(o):(0,_display_utils.isValidFetchUrl)(o.url)?new _displayFetch_stream.PDFFetchStream(o):new _displayNetwork.PDFNetworkStream(o);l=createPDFNetworkStream({url:A,length:te,httpHeaders:E,withCredentials:C,rangeChunkSize:M,disableRange:J,disableStream:Q})}o(l)});return Promise.all([o,T]).then(function([o,A]){if(l.destroyed)throw Error("Loading aborted");let S=new _message_handler.MessageHandler(u,o,F.port),E=new WorkerTransport(S,l,A,th,to);l._transport=E,S.send("Ready",null)})}).catch(l._capability.reject),l}async function _fetchDocument(o,l){if(o.destroyed)throw Error("Worker was destroyed");let u=await o.messageHandler.sendWithPromise("GetDocRequest",l,l.data?[l.data.buffer]:null);if(o.destroyed)throw Error("Worker was destroyed");return u}function getUrlProp(o){if(o instanceof URL)return o.href;try{return new URL(o,window.location).href}catch{if(_util.isNodeJS&&"string"==typeof o)return o}throw Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function getDataProp(o){if(_util.isNodeJS&&void 0!==Buffer&&o instanceof Buffer)throw Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(o instanceof Uint8Array&&o.byteLength===o.buffer.byteLength)return o;if("string"==typeof o)return(0,_util.stringToBytes)(o);if("object"==typeof o&&!isNaN(o?.length)||(0,_util.isArrayBuffer)(o))return new Uint8Array(o);throw Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory;let PDFDocumentLoadingTask=class PDFDocumentLoadingTask{static #e=0;constructor(){this._capability=new _util.PromiseCapability,this._transport=null,this._worker=null,this.docId=`d${PDFDocumentLoadingTask.#e++}`,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(o){throw this._worker?.port&&delete this._worker._pendingDestroy,o}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}};exports.PDFDocumentLoadingTask=PDFDocumentLoadingTask;let PDFDataRangeTransport=class PDFDataRangeTransport{constructor(o,l,u=!1,A=null){this.length=o,this.initialData=l,this.progressiveDone=u,this.contentDispositionFilename=A,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=new _util.PromiseCapability}addRangeListener(o){this._rangeListeners.push(o)}addProgressListener(o){this._progressListeners.push(o)}addProgressiveReadListener(o){this._progressiveReadListeners.push(o)}addProgressiveDoneListener(o){this._progressiveDoneListeners.push(o)}onDataRange(o,l){for(let u of this._rangeListeners)u(o,l)}onDataProgress(o,l){this._readyCapability.promise.then(()=>{for(let u of this._progressListeners)u(o,l)})}onDataProgressiveRead(o){this._readyCapability.promise.then(()=>{for(let l of this._progressiveReadListeners)l(o)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(let o of this._progressiveDoneListeners)o()})}transportReady(){this._readyCapability.resolve()}requestDataRange(o,l){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}};exports.PDFDataRangeTransport=PDFDataRangeTransport;let PDFDocumentProxy=class PDFDocumentProxy{constructor(o,l){this._pdfInfo=o,this._transport=l,Object.defineProperty(this,"getJavaScript",{value:()=>((0,_display_utils.deprecated)("`PDFDocumentProxy.getJavaScript`, please use `PDFDocumentProxy.getJSActions` instead."),this.getJSActions().then(o=>{if(!o)return o;let l=[];for(let u in o)l.push(...o[u]);return l}))})}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(o){return this._transport.getPage(o)}getPageIndex(o){return this._transport.getPageIndex(o)}getDestinations(){return this._transport.getDestinations()}getDestination(o){return this._transport.getDestination(o)}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(o=!1){return this._transport.startCleanup(o||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;let PDFPageProxy=class PDFPageProxy{#i=null;#s=!1;constructor(o,l,u,A=!1){this._pageIndex=o,this._pageInfo=l,this._transport=u,this._stats=A?new _display_utils.StatTimer:null,this._pdfBug=A,this.commonObjs=u.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:o,rotation:l=this.rotate,offsetX:u=0,offsetY:A=0,dontFlip:S=!1}
21={}){return new _display_utils.PageViewport({viewBox:this.view,scale:o,rotation:l,offsetX:u,offsetY:A,dontFlip:S})}getAnnotations({intent:o="display"}={}){let l=this._transport.getRenderingIntent(o);return this._transport.getAnnotations(this._pageIndex,l.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:o,viewport:l,intent:u="display",annotationMode:A=_util.AnnotationMode.ENABLE,transform:S=null,background:E=null,optionalContentConfigPromise:C=null,annotationCanvasMap:T=null,pageColors:P=null,printAnnotationStorage:M=null}){this._stats?.time("Overall");let F=this._transport.getRenderingIntent(u,A,M);this.#s=!1,this.#r(),C||(C=this._transport.getOptionalContentConfig());let R=this._intentStates.get(F.cacheKey);R||(R=Object.create(null),this._intentStates.set(F.cacheKey,R)),R.streamReaderCancelTimeout&&(clearTimeout(R.streamReaderCancelTimeout),R.streamReaderCancelTimeout=null);let D=!!(F.renderingIntent&_util.RenderingIntentFlag.PRINT);R.displayReadyCapability||(R.displayReadyCapability=new _util.PromiseCapability,R.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(F));let complete=o=>{R.renderTasks.delete(I),(this._maybeCleanupAfterRender||D)&&(this.#s=!0),this.#a(!D),o?(I.capability.reject(o),this._abortOperatorList({intentState:R,reason:o instanceof Error?o:Error(o)})):I.capability.resolve(),this._stats?.timeEnd("Rendering"),this._stats?.timeEnd("Overall")},I=new InternalRenderTask({callback:complete,params:{canvasContext:o,viewport:l,transform:S,background:E},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:T,operatorList:R.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!D,pdfBug:this._pdfBug,pageColors:P});(R.renderTasks||=new Set).add(I);let L=I.task;return Promise.all([R.displayReadyCapability.promise,C]).then(([o,l])=>{if(this.destroyed){complete();return}this._stats?.time("Rendering"),I.initializeGraphics({transparency:o,optionalContentConfig:l}),I.operatorListChanged()}).catch(complete),L}getOperatorList({intent:o="display",annotationMode:l=_util.AnnotationMode.ENABLE,printAnnotationStorage:u=null}={}){let A;function operatorListChanged(){E.operatorList.lastChunk&&(E.opListReadCapability.resolve(E.operatorList),E.renderTasks.delete(A))}let S=this._transport.getRenderingIntent(o,l,u,!0),E=this._intentStates.get(S.cacheKey);return E||(E=Object.create(null),this._intentStates.set(S.cacheKey,E)),E.opListReadCapability||((A=Object.create(null)).operatorListChanged=operatorListChanged,E.opListReadCapability=new _util.PromiseCapability,(E.renderTasks||=new Set).add(A),E.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(S)),E.opListReadCapability.promise}streamTextContent({includeMarkedContent:o=!1,disableNormalization:l=!1}={}){let u=100;return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===o,disableNormalization:!0===l},{highWaterMark:u,size:o=>o.items.length})}getTextContent(o={}){if(this._transport._htmlForXfa)return this.getXfa().then(o=>_xfa_text.XfaText.textContent(o));let l=this.streamTextContent(o);return new Promise(function(o,u){function pump(){A.read().then(function({value:l,done:u}){if(u){o(S);return}Object.assign(S.styles,l.styles),S.items.push(...l.items),pump()},u)}let A=l.getReader(),S={items:[],styles:Object.create(null)};pump()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let o=[];for(let l of this._intentStates.values())if(this._abortOperatorList({intentState:l,reason:Error("Page was destroyed."),force:!0}),!l.opListReadCapability)for(let u of l.renderTasks)o.push(u.completed),u.cancel();return this.objs.clear(),this.#s=!1,this.#r(),Promise.all(o)}cleanup(o=!1){this.#s=!0;let l=this.#a(!1);
21return o&&l&&(this._stats&&=new _display_utils.StatTimer),l}#a(o=!1){if(this.#r(),!this.#s||this.destroyed)return!1;if(o)return this.#i=setTimeout(()=>{this.#i=null,this.#a(!1)},DELAYED_CLEANUP_TIMEOUT),!1;for(let{renderTasks:o,operatorList:l}of this._intentStates.values())if(o.size>0||!l.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#s=!1,!0}#r(){this.#i&&(clearTimeout(this.#i),this.#i=null)}_startRenderPage(o,l){let u=this._intentStates.get(l);u&&(this._stats?.timeEnd("Page Request"),u.displayReadyCapability?.resolve(o))}_renderPageChunk(o,l){for(let u=0,A=o.length;u<A;u++)l.operatorList.fnArray.push(o.fnArray[u]),l.operatorList.argsArray.push(o.argsArray[u]);for(let u of(l.operatorList.lastChunk=o.lastChunk,l.operatorList.separateAnnots=o.separateAnnots,l.renderTasks))u.operatorListChanged();o.lastChunk&&this.#a(!0)}_pumpOperatorList({renderingIntent:o,cacheKey:l,annotationStorageSerializable:u}){let{map:A,transfers:S}=u,E=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:o,cacheKey:l,annotationStorage:A},S),C=E.getReader(),T=this._intentStates.get(l);T.streamReader=C;let pump=()=>{C.read().then(({value:o,done:l})=>{if(l){T.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(o,T),pump())},o=>{if(T.streamReader=null,!this._transport.destroyed){if(T.operatorList){for(let o of(T.operatorList.lastChunk=!0,T.renderTasks))o.operatorListChanged();this.#a(!0)}if(T.displayReadyCapability)T.displayReadyCapability.reject(o);else if(T.opListReadCapability)T.opListReadCapability.reject(o);else throw o}})};pump()}_abortOperatorList({intentState:o,reason:l,force:u=!1}){if(o.streamReader){if(o.streamReaderCancelTimeout&&(clearTimeout(o.streamReaderCancelTimeout),o.streamReaderCancelTimeout=null),!u){if(o.renderTasks.size>0)return;if(l instanceof _display_utils.RenderingCancelledException){let u=RENDERING_CANCELLED_TIMEOUT;l.extraDelay>0&&l.extraDelay<1e3&&(u+=l.extraDelay),o.streamReaderCancelTimeout=setTimeout(()=>{o.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:o,reason:l,force:!0})},u);return}}if(o.streamReader.cancel(new _util.AbortException(l.message)).catch(()=>{}),o.streamReader=null,!this._transport.destroyed){for(let[l,u]of this._intentStates)if(u===o){this._intentStates.delete(l);break}this.cleanup()}}}get stats(){return this._stats}};exports.PDFPageProxy=PDFPageProxy;let LoopbackPort=class LoopbackPort{#n=new Set;#o=Promise.resolve();postMessage(o,l){let u={data:structuredClone(o,l?{transfer:l}:null)};this.#o.then(()=>{for(let o of this.#n)o.call(this,u)})}addEventListener(o,l){this.#n.add(l)}removeEventListener(o,l){this.#n.delete(l)}terminate(){this.#n.clear()}};exports.LoopbackPort=LoopbackPort;let PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};if(exports.PDFWorkerUtil=PDFWorkerUtil,_util.isNodeJS)PDFWorkerUtil.isWorkerDisabled=!0,PDFWorkerUtil.fallbackWorkerSrc="./pdf.worker.js";else if("object"==typeof document){let pdfjsFilePath=document?.currentScript?.src;pdfjsFilePath&&(PDFWorkerUtil.fallbackWorkerSrc=pdfjsFilePath.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}PDFWorkerUtil.isSameOrigin=function(o,l){let u;try{if(!(u=new URL(o)).origin||"null"===u.origin)return!1}catch{return!1}let A=new URL(l,u);return u.origin===A.origin},PDFWorkerUtil.createCDNWrapper=function(o){let l=`importScripts("${o}");`;return URL.createObjectURL(new Blob([l]))};let PDFWorker=class PDFWorker{static #l;constructor({name:o=null,port:l=null,verbosity:u=(0,_util.getVerbosityLevel)()}={}){if(this.name=o,this.destroyed=!1,this.verbosity=u,this._readyCapability=new _util.PromiseCapability,this._port=null,this._webWorker=null,this._messageHandler=null,l){if(PDFWorker.#l?.has(l))throw Error("Cannot use more than one PDFWorker per port.");(PDFWorker.#l||=new WeakMap).set(l,this),this._initializeFromPort(l);return}this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(o){this._port=o,this._messageHandler=new _message_handler.MessageHandler("main","worker",o),this._messageHandler.on("ready",function(){}),this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}_initialize(){if(!PDFWorkerUtil.isWorkerDisabled&&!PDFWorker._mainThreadWorkerMessageHandler){let{workerSrc:o}=PDFWorker;try{PDFWorkerUtil.isSameOrigin(window.location.href,o)||(o=PDFWorkerUtil.createCDNWrapper(new URL(o,window.location).href));let l=new Worker(o),u=new _message_handler.MessageHandler("main","worker",l),terminateEarly=()=>{l.removeEventListener("error",onWorkerError),u.destroy(),l.terminate(),this.destroyed?this._readyCapability.reject(Error("Worker was destroyed")):this._setupFakeWorker()},onWorkerError=()=>{this._webWorker||terminateEarly()};l.addEventListener("error",onWorkerError),u.on("test",o=>{if(l.removeEventListener("error",onWorkerError),this.destroyed){terminateEarly();return}o?(this._messageHandler=u,this._port=l,this._webWorker=l,this._readyCapability.resolve(),u.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),u.destroy(),l.terminate())}),u.on("ready",o=>{if(l.removeEventListener("error",onWorkerError),this.destroyed){terminateEarly();return}try{sendTest()}catch{this._setupFakeWorker()}});let sendTest=()=>{let o=new Uint8Array;u.send("test",o,[o.buffer])};sendTest();return}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(o=>{if(this.destroyed){this._readyCapability.reject(Error("Worker was destroyed"));return}let l=new LoopbackPort;this._port=l;let u=`fake${PDFWorkerUtil.fakeWorkerId++}`,A=new _message_handler.MessageHandler(u+"_worker",u,l);o.setup(A,l);let S=new _message_handler.MessageHandler(u,u+"_worker",l);this._messageHandler=S,this._readyCapability.resolve(),S.send("configure",{verbosity:this.verbosity})}).catch(o=>{this._readyCapability.reject(Error(`Setting up fake worker failed: "${o.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(o){if(!o?.port)throw Error("PDFWorker.fromPort - invalid method signature.");let l=this.#l?.get(o.port);
21if(l){if(l._pendingDestroy)throw Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return l}return new PDFWorker(o)}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 Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _mainThreadWorkerMessageHandler(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){let loader=async()=>{let mainWorkerMessageHandler=this._mainThreadWorkerMessageHandler;if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_util.isNodeJS){let 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;let WorkerTransport=class WorkerTransport{#h=new Map;#d=new Map;#c=new Map;#u=null;constructor(o,l,u,A,S){this.messageHandler=o,this.loadingTask=l,this.commonObjs=new PDFObjects,this.fontLoader=new _font_loader.FontLoader({ownerDocument:A.ownerDocument,styleElement:A.styleElement}),this._params=A,this.canvasFactory=S.canvasFactory,this.filterFactory=S.filterFactory,this.cMapReaderFactory=S.cMapReaderFactory,this.standardFontDataFactory=S.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=u,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=new _util.PromiseCapability,this.setupMessageHandler()}#p(o,l=null){let u=this.#h.get(o);if(u)return u;let A=this.messageHandler.sendWithPromise(o,l);return this.#h.set(o,A),A}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}getRenderingIntent(o,l=_util.AnnotationMode.ENABLE,u=null,A=!1){let S=_util.RenderingIntentFlag.DISPLAY,E=_annotation_storage.SerializableEmpty;switch(o){case"any":S=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":S=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${o}`)}switch(l){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;let C=S&_util.RenderingIntentFlag.PRINT&&u instanceof _annotation_storage.PrintAnnotationStorage?u:this.annotationStorage;E=C.serializable;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${l}`)}return A&&(S+=_util.RenderingIntentFlag.OPLIST),{renderingIntent:S,cacheKey:`${S}_${E.hash}`,annotationStorageSerializable:E}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=new _util.PromiseCapability,this.#u?.reject(Error("Worker was destroyed during onPassword callback"));let o=[];for(let l of this.#d.values())o.push(l._destroy());this.#d.clear(),this.#c.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();let l=this.messageHandler.sendWithPromise("Terminate",null);return o.push(l),Promise.all(o).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(){let{messageHandler:o,loadingTask:l}=this;o.on("GetReader",(o,l)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=o=>{this._lastProgress={loaded:o.loaded,total:o.total}},l.onPull=()=>{this._fullReader.read().then(function({value:o,done:u}){if(u){l.close();return}(0,_util.assert)(o instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),l.enqueue(new Uint8Array(o),1,[o])}).catch(o=>{l.error(o)})},l.onCancel=o=>{this._fullReader.cancel(o),l.ready.catch(o=>{if(!this.destroyed)throw o})}}),o.on("ReaderHeadersReady",o=>
21{let u=new _util.PromiseCapability,A=this._fullReader;return A.headersReady.then(()=>{A.isStreamingSupported&&A.isRangeSupported||(this._lastProgress&&l.onProgress?.(this._lastProgress),A.onProgress=o=>{l.onProgress?.({loaded:o.loaded,total:o.total})}),u.resolve({isStreamingSupported:A.isStreamingSupported,isRangeSupported:A.isRangeSupported,contentLength:A.contentLength})},u.reject),u.promise}),o.on("GetRangeReader",(o,l)=>{(0,_util.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");let u=this._networkStream.getRangeReader(o.begin,o.end);if(!u){l.close();return}l.onPull=()=>{u.read().then(function({value:o,done:u}){if(u){l.close();return}(0,_util.assert)(o instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),l.enqueue(new Uint8Array(o),1,[o])}).catch(o=>{l.error(o)})},l.onCancel=o=>{u.cancel(o),l.ready.catch(o=>{if(!this.destroyed)throw o})}}),o.on("GetDoc",({pdfInfo:o})=>{this._numPages=o.numPages,this._htmlForXfa=o.htmlForXfa,delete o.htmlForXfa,l._capability.resolve(new PDFDocumentProxy(o,this))}),o.on("DocException",function(o){let u;switch(o.name){case"PasswordException":u=new _util.PasswordException(o.message,o.code);break;case"InvalidPDFException":u=new _util.InvalidPDFException(o.message);break;case"MissingPDFException":u=new _util.MissingPDFException(o.message);break;case"UnexpectedResponseException":u=new _util.UnexpectedResponseException(o.message,o.status);break;case"UnknownErrorException":u=new _util.UnknownErrorException(o.message,o.details);break;default:(0,_util.unreachable)("DocException - expected a valid Error.")}l._capability.reject(u)}),o.on("PasswordRequest",o=>{if(this.#u=new _util.PromiseCapability,l.onPassword){let updatePassword=o=>{o instanceof Error?this.#u.reject(o):this.#u.resolve({password:o})};try{l.onPassword(updatePassword,o.code)}catch(o){this.#u.reject(o)}}else this.#u.reject(new _util.PasswordException(o.message,o.code));return this.#u.promise}),o.on("DataLoaded",o=>{l.onProgress?.({loaded:o.length,total:o.length}),this.downloadInfoCapability.resolve(o)}),o.on("StartRenderPage",o=>{if(this.destroyed)return;let l=this.#d.get(o.pageIndex);l._startRenderPage(o.transparency,o.cacheKey)}),o.on("commonobj",([l,u,A])=>{if(!(this.destroyed||this.commonObjs.has(l)))switch(u){case"Font":let S=this._params;if("error"in A){let o=A.error;(0,_util.warn)(`Error during font loading: ${o}`),this.commonObjs.resolve(l,o);break}let E=S.pdfBug&&globalThis.FontInspector?.enabled?(o,l)=>globalThis.FontInspector.fontAdded(o,l):null,C=new _font_loader.FontFaceObject(A,{isEvalSupported:S.isEvalSupported,disableFontFace:S.disableFontFace,ignoreErrors:S.ignoreErrors,inspectFont:E});this.fontLoader.bind(C).catch(u=>o.sendWithPromise("FontFallback",{id:l})).finally(()=>{!S.fontExtraProperties&&C.data&&(C.data=null),this.commonObjs.resolve(l,C)});break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(l,A);break;default:throw Error(`Got unknown common object type ${u}`)}}),o.on("obj",([o,l,u,A])=>{if(this.destroyed)return;let S=this.#d.get(l);if(!S.objs.has(o))switch(u){case"Image":if(S.objs.resolve(o,A),A){let o;if(A.bitmap){let{width:l,height:u}=A;o=l*u*4}else o=A.data?.length||0;o>_util.MAX_IMAGE_SIZE_TO_CACHE&&(S._maybeCleanupAfterRender=!0)}break;case"Pattern":S.objs.resolve(o,A);break;default:throw Error(`Got unknown object type ${u}`)}}),o.on("DocProgress",o=>{this.destroyed||l.onProgress?.({loaded:o.loaded,total:o.total})}),o.on("FetchBuiltInCMap",o=>this.destroyed?Promise.reject(Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(o):Promise.reject(Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),o.on("FetchStandardFontData",o=>this.destroyed?Promise.reject(Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(o):Promise.reject(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.");let{map:o,transfers:l}=this.annotationStorage.serializable;
21return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:o,filename:this._fullReader?.filename??null},l).finally(()=>{this.annotationStorage.resetModified()})}getPage(o){if(!Number.isInteger(o)||o<=0||o>this._numPages)return Promise.reject(Error("Invalid page request."));let l=o-1,u=this.#c.get(l);if(u)return u;let A=this.messageHandler.sendWithPromise("GetPage",{pageIndex:l}).then(o=>{if(this.destroyed)throw Error("Transport destroyed");let u=new PDFPageProxy(l,o,this,this._params.pdfBug);return this.#d.set(l,u),u});return this.#c.set(l,A),A}getPageIndex(o){return"object"!=typeof o||null===o||!Number.isInteger(o.num)||o.num<0||!Number.isInteger(o.gen)||o.gen<0?Promise.reject(Error("Invalid pageIndex request.")):this.messageHandler.sendWithPromise("GetPageIndex",{num:o.num,gen:o.gen})}getAnnotations(o,l){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:o,intent:l})}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(o){return"string"!=typeof o?Promise.reject(Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:o})}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(o){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:o})}getStructTree(o){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:o})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then(o=>new _optional_content_config.OptionalContentConfig(o))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){let o="GetMetadata",l=this.#h.get(o);if(l)return l;let u=this.messageHandler.sendWithPromise(o,null).then(o=>({info:o[0],metadata:o[1]?new _metadata.Metadata(o[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#h.set(o,u),u}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(o=!1){if(!this.destroyed){for(let o of(await this.messageHandler.sendWithPromise("Cleanup",null),this.#d.values())){let l=o.cleanup();if(!l)throw Error(`startCleanup: Page ${o.pageNumber} is currently rendering.`)}this.commonObjs.clear(),o||this.fontLoader.clear(),this.#h.clear(),this.filterFactory.destroy(!0)}}get loadingParams(){let{disableAutoFetch:o,enableXfa:l}=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:o,enableXfa:l})}};let PDFObjects=class PDFObjects{#g=Object.create(null);#m(o){return this.#g[o]||={capability:new _util.PromiseCapability,data:null}}get(o,l=null){if(l){let u=this.#m(o);return u.capability.promise.then(()=>l(u.data)),null}let u=this.#g[o];if(!u?.capability.settled)throw Error(`Requesting object that isn't resolved yet ${o}.`);return u.data}has(o){let l=this.#g[o];return l?.capability.settled||!1}resolve(o,l=null){let u=this.#m(o);u.data=l,u.capability.resolve()}clear(){for(let o in this.#g){let{data:l}=this.#g[o];l?.bitmap?.close()}this.#g=Object.create(null)}};let RenderTask=class RenderTask{#f=null;constructor(o){this.#f=o,this.onContinue=null}get promise(){return this.#f.capability.promise}cancel(o=0){this.#f.cancel(null,o)}get separateAnnots(){let{separateAnnots:o}=this.#f.operatorList;if(!o)return!1;let{annotationCanvasMap:l}=this.#f;return o.form||o.canvas&&l?.size>0}};exports.RenderTask=RenderTask;let InternalRenderTask=class InternalRenderTask{static #b=new WeakSet;constructor({callback:o,params:l,objs:u,commonObjs:A,annotationCanvasMap:S,operatorList:E,pageIndex:C,canvasFactory:T,filterFactory:P,useRequestAnimationFrame:M=!1,pdfBug:F=!1,pageColors:R=null}){this.callback=o,this.params=l,this.objs=u,this.commonObjs=A,this.annotationCanvasMap=S,this.operatorListIdx=null,this.operatorList=E,this._pageIndex=C,this.canvasFactory=T,this.filterFactory=P,this._pdfBug=F,this.pageColors=R,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===M&&"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=l.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:o=!1,optionalContentConfig:l}){if(this.cancelled)return;
21if(this._canvas){if(InternalRenderTask.#b.has(this._canvas))throw Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");InternalRenderTask.#b.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());let{canvasContext:u,viewport:A,transform:S,background:E}=this.params;this.gfx=new _canvas.CanvasGraphics(u,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:l},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:S,viewport:A,transparency:o,background:E}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(o=null,l=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),InternalRenderTask.#b.delete(this._canvas),this.callback(o||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,l))}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}this.stepper?.updateOperatorList(this.operatorList),this.running||this._continue()}_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.#b.delete(this._canvas),this.callback())))}};let version="3.11.174";exports.version=version;let build="ce8716743";exports.build=build},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SerializableEmpty=l.PrintAnnotationStorage=l.AnnotationStorage=void 0;var A=u(1),S=u(4),E=u(8);let C=Object.freeze({map:null,hash:"",transfers:void 0});l.SerializableEmpty=C;let AnnotationStorage=class AnnotationStorage{#A=!1;#v=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(o,l){let u=this.#v.get(o);return void 0===u?l:Object.assign(l,u)}getRawValue(o){return this.#v.get(o)}remove(o){if(this.#v.delete(o),0===this.#v.size&&this.resetModified(),"function"==typeof this.onAnnotationEditor){for(let o of this.#v.values())if(o instanceof S.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(o,l){let u=this.#v.get(o),A=!1;if(void 0!==u)for(let[o,S]of Object.entries(l))u[o]!==S&&(A=!0,u[o]=S);else A=!0,this.#v.set(o,l);A&&this.#y(),l instanceof S.AnnotationEditor&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(l.constructor._type)}has(o){return this.#v.has(o)}getAll(){return this.#v.size>0?(0,A.objectFromMap)(this.#v):null}setAll(o){for(let[l,u]of Object.entries(o))this.setValue(l,u)}get size(){return this.#v.size}#y(){this.#A||(this.#A=!0,"function"==typeof this.onSetModified&&this.onSetModified())}resetModified(){this.#A&&(this.#A=!1,"function"==typeof this.onResetModified&&this.onResetModified())}get print(){return new PrintAnnotationStorage(this)}get serializable(){if(0===this.#v.size)return C;let o=new Map,l=new E.MurmurHash3_64,u=[],A=Object.create(null),T=!1;for(let[u,E]of this.#v){let C=E instanceof S.AnnotationEditor?E.serialize(!1,A):E;C&&(o.set(u,C),l.update(`${u}:${JSON.stringify(C)}`),T||=!!C.bitmap)}if(T)for(let l of o.values())l.bitmap&&u.push(l.bitmap);return o.size>0?{map:o,hash:l.hexdigest(),transfers:u}:C}};l.AnnotationStorage=AnnotationStorage;let PrintAnnotationStorage=class PrintAnnotationStorage extends AnnotationStorage{#_;constructor(o){super();let{map:l,hash:u,transfers:A}=o.serializable,S=structuredClone(l,A?{transfer:A}:null);this.#_={map:S,hash:u,transfers:A}}get print(){(0,A.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#_}};l.PrintAnnotationStorage=PrintAnnotationStorage},(o,l,u)=>
21{Object.defineProperty(l,"__esModule",{value:!0}),l.AnnotationEditor=void 0;var A=u(5),S=u(1),E=u(6);let AnnotationEditor=class AnnotationEditor{#S="";#E=!1;#x=null;#C=null;#T=null;#w=!1;#P=null;#M=this.focusin.bind(this);#k=this.focusout.bind(this);#F=!1;#R=!1;#D=!1;_initialOptions=Object.create(null);_uiManager=null;_focusEventsAllowed=!0;_l10nPromise=null;#I=!1;#L=AnnotationEditor._zIndex++;static _borderLineWidth=-1;static _colorManager=new A.ColorManager;static _zIndex=1;static SMALL_EDITOR_SIZE=0;constructor(o){this.constructor===AnnotationEditor&&(0,S.unreachable)("Cannot initialize AnnotationEditor."),this.parent=o.parent,this.id=o.id,this.width=this.height=null,this.pageIndex=o.parent.pageIndex,this.name=o.name,this.div=null,this._uiManager=o.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=o.isCentered,this._structTreeParentId=null;let{rotation:l,rawDims:{pageWidth:u,pageHeight:A,pageX:E,pageY:C}}=this.parent.viewport;this.rotation=l,this.pageRotation=(360+l-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[u,A],this.pageTranslation=[E,C];let[T,P]=this.parentDimensions;this.x=o.x/T,this.y=o.y/P,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(o){let l=new FakeEditor({id:o.parent.getNextId(),parent:o.parent,uiManager:o._uiManager});l.annotationElementId=o.annotationElementId,l.deleted=!0,l._uiManager.addToAnnotationStorage(l)}static initialize(o,l=null){if(AnnotationEditor._l10nPromise||=new Map(["editor_alt_text_button_label","editor_alt_text_edit_button_label","editor_alt_text_decorative_tooltip"].map(l=>[l,o.get(l)])),l?.strings)for(let u of l.strings)AnnotationEditor._l10nPromise.set(u,o.get(u));if(-1!==AnnotationEditor._borderLineWidth)return;let u=getComputedStyle(document.documentElement);AnnotationEditor._borderLineWidth=parseFloat(u.getPropertyValue("--outline-width"))||0}static updateDefaultParams(o,l){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(o){return!1}static paste(o,l){(0,S.unreachable)("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#I}set _isDraggable(o){this.#I=o,this.div?.classList.toggle("draggable",o)}center(){let[o,l]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*l/(2*o),this.y+=this.width*o/(2*l);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*l/(2*o),this.y-=this.width*o/(2*l);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(o){this._uiManager.addCommands(o)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#L}setParent(o){null!==o&&(this.pageIndex=o.pageIndex,this.pageDimensions=o.pageDimensions),this.parent=o}focusin(o){this._focusEventsAllowed&&(this.#F?this.#F=!1:this.parent.setSelected(this))}focusout(o){if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;let l=o.relatedTarget;!l?.closest(`#${this.id}`)&&(o.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(o,l,u,A){let[S,E]=this.parentDimensions;[u,A]=this.screenToPageTranslation(u,A),this.x=(o+u)/S,this.y=(l+A)/E,this.fixAndSetPosition()}#O([o,l],u,A){[u,A]=this.screenToPageTranslation(u,A),this.x+=u/o,this.y+=A/l,this.fixAndSetPosition()}translate(o,l){this.#O(this.parentDimensions,o,l)}translateInPage(o,l){this.#O(this.pageDimensions,o,l),this.div.scrollIntoView({block:"nearest"})}drag(o,l){let[u,A]=this.parentDimensions;if(this.x+=o/u,this.y+=l/A,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:o,y:l}=this.div.getBoundingClientRect();this.parent.findNewParent(this,o,l)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:S,y:E}=this,[C,T]=this.#N();S+=C,E+=T,this.div.style.left=`${(100*S).toFixed(2)}%`,this.div.style.top=`${(100*E).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}#N(){let[o,l]=this.parentDimensions,{_borderLineWidth:u}=AnnotationEditor,A=u/o,S=u/l;switch(this.rotation){case 90:return[-A,S];case 180:return[A,S];case 270:return[A,-S];default:return[-A,-S]}}fixAndSetPosition(){let[o,l]=this.pageDimensions,{x:u,y:A,width:S,height:E}=this;switch(S*=o,E*=l,u*=o,A*=l,this.rotation){case 0:u=Math.max(0,Math.min(o-S,u)),A=
21Math.max(0,Math.min(l-E,A));break;case 90:u=Math.max(0,Math.min(o-E,u)),A=Math.min(l,Math.max(S,A));break;case 180:u=Math.min(o,Math.max(S,u)),A=Math.min(l,Math.max(E,A));break;case 270:u=Math.min(o,Math.max(E,u)),A=Math.max(0,Math.min(l-S,A))}this.x=u/=o,this.y=A/=l;let[C,T]=this.#N();u+=C,A+=T;let{style:P}=this.div;P.left=`${(100*u).toFixed(2)}%`,P.top=`${(100*A).toFixed(2)}%`,this.moveInDOM()}static #B(o,l,u){switch(u){case 90:return[l,-o];case 180:return[-o,-l];case 270:return[-l,o];default:return[o,l]}}screenToPageTranslation(o,l){return AnnotationEditor.#B(o,l,this.parentRotation)}pageTranslationToScreen(o,l){return AnnotationEditor.#B(o,l,360-this.parentRotation)}#U(o){switch(o){case 90:{let[o,l]=this.pageDimensions;return[0,-o/l,l/o,0]}case 180:return[-1,0,0,-1];case 270:{let[o,l]=this.pageDimensions;return[0,o/l,-l/o,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(){let{parentScale:o,pageDimensions:[l,u]}=this,A=l*o,E=u*o;return S.FeatureTest.isCSSRoundSupported?[Math.round(A),Math.round(E)]:[A,E]}setDims(o,l){let[u,A]=this.parentDimensions;this.div.style.width=`${(100*o/u).toFixed(2)}%`,this.#w||(this.div.style.height=`${(100*l/A).toFixed(2)}%`),this.#x?.classList.toggle("small",o<AnnotationEditor.SMALL_EDITOR_SIZE||l<AnnotationEditor.SMALL_EDITOR_SIZE)}fixDims(){let{style:o}=this.div,{height:l,width:u}=o,A=u.endsWith("%"),S=!this.#w&&l.endsWith("%");if(A&&S)return;let[E,C]=this.parentDimensions;A||(o.width=`${(100*parseFloat(u)/E).toFixed(2)}%`),this.#w||S||(o.height=`${(100*parseFloat(l)/C).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#j(){if(this.#P)return;this.#P=document.createElement("div"),this.#P.classList.add("resizers");let o=["topLeft","topRight","bottomRight","bottomLeft"];for(let l of(this._willKeepAspectRatio||o.push("topMiddle","middleRight","bottomMiddle","middleLeft"),o)){let o=document.createElement("div");this.#P.append(o),o.classList.add("resizer",l),o.addEventListener("pointerdown",this.#H.bind(this,l)),o.addEventListener("contextmenu",E.noContextMenu)}this.div.prepend(this.#P)}#H(o,l){l.preventDefault();let{isMac:u}=S.FeatureTest.platform;if(0!==l.button||l.ctrlKey&&u)return;let A=this.#G.bind(this,o),E=this._isDraggable;this._isDraggable=!1;let C={passive:!0,capture:!0};window.addEventListener("pointermove",A,C);let T=this.x,P=this.y,M=this.width,F=this.height,R=this.parent.div.style.cursor,D=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(l.target).cursor;let pointerUpCallback=()=>{this._isDraggable=E,window.removeEventListener("pointerup",pointerUpCallback),window.removeEventListener("blur",pointerUpCallback),window.removeEventListener("pointermove",A,C),this.parent.div.style.cursor=R,this.div.style.cursor=D;let o=this.x,l=this.y,u=this.width,S=this.height;(o!==T||l!==P||u!==M||S!==F)&&this.addCommands({cmd:()=>{this.width=u,this.height=S,this.x=o,this.y=l;let[A,E]=this.parentDimensions;this.setDims(A*u,E*S),this.fixAndSetPosition()},undo:()=>{this.width=M,this.height=F,this.x=T,this.y=P;let[o,l]=this.parentDimensions;this.setDims(o*M,l*F),this.fixAndSetPosition()},mustExec:!0})};window.addEventListener("pointerup",pointerUpCallback),window.addEventListener("blur",pointerUpCallback)}#G(o,l){let u,A;let[S,E]=this.parentDimensions,C=this.x,T=this.y,P=this.width,M=this.height,F=AnnotationEditor.MIN_SIZE/S,R=AnnotationEditor.MIN_SIZE/E,round=o=>Math.round(1e4*o)/1e4,D=this.#U(this.rotation),transf=(o,l)=>[D[0]*o+D[2]*l,D[1]*o+D[3]*l],I=this.#U(360-this.rotation),invTransf=(o,l)=>[I[0]*o+I[2]*l,I[1]*o+I[3]*l],L=!1,O=!1;switch(o){case"topLeft":L=!0,u=(o,l)=>[0,0],A=(o,l)=>[o,l];break;case"topMiddle":u=(o,l)=>[o/2,0],A=(o,l)=>[o/2,l];break;case"topRight":L=!0,u=(o,l)=>[o,0],A=(o,l)=>[0,l];break;case"middleRight":O=!0,u=(o,l)=>[o,l/2],A=(o,l)=>[0,l/2];break;case"bottomRight":L=!0,u=(o,l)=>[o,l],A=(o,l)=>[0,0];break;case"bottomMiddle":u=(o,l)=>[o/2,l],A=(o,l)=>[o/2,0];break;case"bottomLeft":L=!0,u=(o,l)=>[0,l],A=(o,l)=>[o,0];break;case"middleLeft":O=!0,u=(o,l)=>[0,l/2],A=(o,l)=>[o,l/2]}
21let N=u(P,M),B=A(P,M),U=transf(...B),H=round(C+U[0]),z=round(T+U[1]),V=1,W=1,[$,X]=this.screenToPageTranslation(l.movementX,l.movementY);if([$,X]=invTransf($/S,X/E),L){let o=Math.hypot(P,M);V=W=Math.max(Math.min(Math.hypot(B[0]-N[0]-$,B[1]-N[1]-X)/o,1/P,1/M),F/P,R/M)}else O?V=Math.max(F,Math.min(1,Math.abs(B[0]-N[0]-$)))/P:W=Math.max(R,Math.min(1,Math.abs(B[1]-N[1]-X)))/M;let K=round(P*V),Y=round(M*W);U=transf(...A(K,Y));let J=H-U[0],Q=z-U[1];this.width=K,this.height=Y,this.x=J,this.y=Q,this.setDims(S*K,E*Y),this.fixAndSetPosition()}async addAltTextButton(){if(this.#x)return;let o=this.#x=document.createElement("button");o.className="altText";let l=await AnnotationEditor._l10nPromise.get("editor_alt_text_button_label");if(o.textContent=l,o.setAttribute("aria-label",l),o.tabIndex="0",o.addEventListener("contextmenu",E.noContextMenu),o.addEventListener("pointerdown",o=>o.stopPropagation()),o.addEventListener("click",o=>{o.preventDefault(),this._uiManager.editAltText(this)},{capture:!0}),o.addEventListener("keydown",l=>{l.target===o&&"Enter"===l.key&&(l.preventDefault(),this._uiManager.editAltText(this))}),this.#z(),this.div.append(o),!AnnotationEditor.SMALL_EDITOR_SIZE){let l=40;AnnotationEditor.SMALL_EDITOR_SIZE=Math.min(128,Math.round(o.getBoundingClientRect().width*(1+l/100)))}}async #z(){let o=this.#x;if(!o)return;if(!this.#S&&!this.#E){o.classList.remove("done"),this.#C?.remove();return}AnnotationEditor._l10nPromise.get("editor_alt_text_edit_button_label").then(l=>{o.setAttribute("aria-label",l)});let l=this.#C;if(!l){this.#C=l=document.createElement("span"),l.className="tooltip",l.setAttribute("role","tooltip");let u=l.id=`alt-text-tooltip-${this.id}`;o.setAttribute("aria-describedby",u);let A=100;o.addEventListener("mouseenter",()=>{this.#T=setTimeout(()=>{this.#T=null,this.#C.classList.add("show"),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",subtype:this.editorType,data:{action:"alt_text_tooltip"}}})},A)}),o.addEventListener("mouseleave",()=>{clearTimeout(this.#T),this.#T=null,this.#C?.classList.remove("show")})}o.classList.add("done"),l.innerText=this.#E?await AnnotationEditor._l10nPromise.get("editor_alt_text_decorative_tooltip"):this.#S,l.parentNode||o.append(l)}getClientDimensions(){return this.div.getBoundingClientRect()}get altTextData(){return{altText:this.#S,decorative:this.#E}}set altTextData({altText:o,decorative:l}){(this.#S!==o||this.#E!==l)&&(this.#S=o,this.#E=l,this.#z())}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.#M),this.div.addEventListener("focusout",this.#k);let[o,l]=this.parentDimensions;this.parentRotation%180!=0&&(this.div.style.maxWidth=`${(100*l/o).toFixed(2)}%`,this.div.style.maxHeight=`${(100*o/l).toFixed(2)}%`);let[u,S]=this.getInitialTranslation();return this.translate(u,S),(0,A.bindEvents)(this,this.div,["pointerdown"]),this.div}pointerdown(o){let{isMac:l}=S.FeatureTest.platform;if(0!==o.button||o.ctrlKey&&l){o.preventDefault();return}this.#F=!0,this.#V(o)}#V(o){let l,u;if(!this._isDraggable)return;let A=this._uiManager.isSelected(this);this._uiManager.setUpDragSession(),A&&(l={passive:!0,capture:!0},u=o=>{let[l,u]=this.screenToPageTranslation(o.movementX,o.movementY);this._uiManager.dragSelectedEditors(l,u)},window.addEventListener("pointermove",u,l));let pointerUpCallback=()=>{if(window.removeEventListener("pointerup",pointerUpCallback),window.removeEventListener("blur",pointerUpCallback),A&&window.removeEventListener("pointermove",u,l),this.#F=!1,!this._uiManager.endDragSession()){let{isMac:l}=S.FeatureTest.platform;o.ctrlKey&&!l||o.shiftKey||o.metaKey&&l?this.parent.toggleSelected(this):this.parent.setSelected(this)}};window.addEventListener("pointerup",pointerUpCallback),window.addEventListener("blur",pointerUpCallback)}moveInDOM(){this.parent?.moveEditorInDOM(this)}_setParentAndPosition(o,l,u){o.changeParent(this),this.x=l,this.y=u,this.fixAndSetPosition()}getRect(o,l){let u=this.parentScale,[A,S]=this.pageDimensions,[E,C]=this.pageTranslation,T=o/u,P=l/u,M=this.x*A,F=this.y*S,R=this.width*A,D=this.height*S;switch(this.rotation){case 0:return[M+T+E,S-F-P-D+C,M+T+R+E,S-F-P+C];case 90:return[M+P+E,S-F+T+C,M+P+D+E,S-F+T+R+C];case 180:return[M-T-R+E,S-F+P+C,M-T+E,S-F+P+D+C];case 270:return[M-P-D+E,S-F-T-R+C,M-P+E,S-F-T+C];default:throw Error("Invalid rotation")}}getRectInCurrentCoords(o,l){let[u,A,S,E]=o,C=S-u,T=E-A;switch(this.rotation){case 0:return[u,l-E,C,T];case 90:return[u,l-A,T,C];case 180:return[S,l-A,C,T];case 270:return[S,l-E,T,C];default:throw Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#D=!0}disableEditMode(){this.#D=!1}isInEditMode(){return this.#D}shouldGetKeyboardEvents(){return!1}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){this.div?.addEventListener("focusin",this.#M),this.div?.addEventListener("focusout",this.#k)}serialize(o=!1,l=null){(0,S.unreachable)("An editor must be serializable")}static deserialize(o,l,u){let A=new this.prototype.constructor({parent:l,id:l.getNextId(),uiManager:u});A.rotation=o.rotation;let[S,E]=A.pageDimensions,[C,T,P,M]=A.getRectInCurrentCoords(o.rect,E);return A.x=C/S,A.y=T/E,A.width=P/S,A.height=M/E,A}remove(){this.div.removeEventListener("focusin",this.#M),this.div.removeEventListener("focusout",this.#k),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#x?.remove(),this.#x=null,this.#C=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#j(),this.#P.classList.remove("hidden"))}select(){this.makeResizable(),this.div?.classList.add("selectedEditor")}unselect(){this.#P?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus()}updateParams(o,l){}disableEditing(){this.#x&&(this.#x.hidden=!0)}enableEditing(){this.#x&&(this.#x.hidden=!1)}enterInEditMode(){}get contentDiv(){return this.div}get isEditing(){return this.#R}set isEditing(o){this.#R=o,this.parent&&(o?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(o,l){this.#w=!0;let u=o/l,{style:A}=this.div;A.aspectRatio=u,A.height="auto"}static get MIN_SIZE(){return 16}};l.AnnotationEditor=AnnotationEditor;let FakeEditor=class FakeEditor extends AnnotationEditor{constructor(o){super(o),this.annotationElementId=o.annotationElementId,this.deleted=!0}
21serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.KeyboardManager=l.CommandManager=l.ColorManager=l.AnnotationEditorUIManager=void 0,l.bindEvents=bindEvents,l.opacityToHex=opacityToHex;var A=u(1),S=u(6);function bindEvents(o,l,u){for(let A of u)l.addEventListener(A,o[A].bind(o))}function opacityToHex(o){return Math.round(Math.min(255,Math.max(1,255*o))).toString(16).padStart(2,"0")}let IdManager=class IdManager{#W=0;getId(){return`${A.AnnotationEditorPrefix}${this.#W++}`}};let ImageManager=class ImageManager{#q=(0,A.getUuid)();#W=0;#$=null;static get _isSVGFittingCanvas(){let o='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>',l=new OffscreenCanvas(1,3),u=l.getContext("2d"),S=new Image;S.src=o;let E=S.decode().then(()=>(u.drawImage(S,0,0,1,1,0,0,1,3),0===new Uint32Array(u.getImageData(0,0,1,1).data.buffer)[0]));return(0,A.shadow)(this,"_isSVGFittingCanvas",E)}async #X(o,l){this.#$||=new Map;let u=this.#$.get(o);if(null===u)return null;if(u?.bitmap)return u.refCounter+=1,u;try{let o;if(u||={bitmap:null,id:`image_${this.#q}_${this.#W++}`,refCounter:0,isSvg:!1},"string"==typeof l){u.url=l;let A=await fetch(l);if(!A.ok)throw Error(A.statusText);o=await A.blob()}else o=u.file=l;if("image/svg+xml"===o.type){let l=ImageManager._isSVGFittingCanvas,A=new FileReader,S=new Image,E=new Promise((o,E)=>{S.onload=()=>{u.bitmap=S,u.isSvg=!0,o()},A.onload=async()=>{let o=u.svgUrl=A.result;S.src=await l?`${o}#svgView(preserveAspectRatio(none))`:o},S.onerror=A.onerror=E});A.readAsDataURL(o),await E}else u.bitmap=await createImageBitmap(o);u.refCounter=1}catch(o){console.error(o),u=null}return this.#$.set(o,u),u&&this.#$.set(u.id,u),u}async getFromFile(o){let{lastModified:l,name:u,size:A,type:S}=o;return this.#X(`${l}_${u}_${A}_${S}`,o)}async getFromUrl(o){return this.#X(o,o)}async getFromId(o){this.#$||=new Map;let l=this.#$.get(o);return l?l.bitmap?(l.refCounter+=1,l):l.file?this.getFromFile(l.file):this.getFromUrl(l.url):null}getSvgUrl(o){let l=this.#$.get(o);return l?.isSvg?l.svgUrl:null}deleteId(o){this.#$||=new Map;let l=this.#$.get(o);l&&(l.refCounter-=1,0===l.refCounter&&(l.bitmap=null))}isValidId(o){return o.startsWith(`image_${this.#q}_`)}};let CommandManager=class CommandManager{#K=[];#Y=!1;#J;#Q=-1;constructor(o=128){this.#J=o}add({cmd:o,undo:l,mustExec:u,type:A=NaN,overwriteIfSameType:S=!1,keepUndo:E=!1}){if(u&&o(),this.#Y)return;let C={cmd:o,undo:l,type:A};if(-1===this.#Q){this.#K.length>0&&(this.#K.length=0),this.#Q=0,this.#K.push(C);return}if(S&&this.#K[this.#Q].type===A){E&&(C.undo=this.#K[this.#Q].undo),this.#K[this.#Q]=C;return}let T=this.#Q+1;T===this.#J?this.#K.splice(0,1):(this.#Q=T,T<this.#K.length&&this.#K.splice(T)),this.#K.push(C)}undo(){-1!==this.#Q&&(this.#Y=!0,this.#K[this.#Q].undo(),this.#Y=!1,this.#Q-=1)}redo(){this.#Q<this.#K.length-1&&(this.#Q+=1,this.#Y=!0,this.#K[this.#Q].cmd(),this.#Y=!1)}hasSomethingToUndo(){return -1!==this.#Q}hasSomethingToRedo(){return this.#Q<this.#K.length-1}destroy(){this.#K=null}};l.CommandManager=CommandManager;let KeyboardManager=class KeyboardManager{constructor(o){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;let{isMac:l}=A.FeatureTest.platform;for(let[u,A,S={}]of o)for(let o of u){let u=o.startsWith("mac+");l&&u?(this.callbacks.set(o.slice(4),{callback:A,options:S}),this.allKeys.add(o.split("+").at(-1))):l||u||(this.callbacks.set(o,{callback:A,options:S}),this.allKeys.add(o.split("+").at(-1)))}}#Z(o){o.altKey&&this.buffer.push("alt"),o.ctrlKey&&this.buffer.push("ctrl"),o.metaKey&&this.buffer.push("meta"),o.shiftKey&&this.buffer.push("shift"),this.buffer.push(o.key);let l=this.buffer.join("+");return this.buffer.length=0,l}exec(o,l){if(!this.allKeys.has(l.key))return;let u=this.callbacks.get(this.#Z(l));if(!u)return;let{callback:A,options:{bubbles:S=!1,args:E=[],checker:C=null}}=u;(!C||C(o,l))&&(A.bind(o,...E)(),S||(l.stopPropagation(),l.preventDefault()))}};l.KeyboardManager=KeyboardManager;let ColorManager=class ColorManager{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){let o=new Map([["CanvasText",null],["Canvas",null]]);return(0,S.getColorValues)(o),(0,A.shadow)(this,"_colors",o)}convert(o){let l=(0,S.getRGB)(o);if(!window.matchMedia("(forced-colors: active)").matches)return l;for(let[o,u]of this._colors)if(u.every((o,u)=>o===l[u]))return ColorManager._colorsMapping.get(o);return l}getHexCode(o){let l=this._colors.get(o);return l?A.Util.makeHexColor(...l):o}};l.ColorManager=ColorManager;let AnnotationEditorUIManager=class AnnotationEditorUIManager{#tt=null;#te=new Map;#ti=new Map;#ts=null;#tr=null;#ta=new CommandManager;#tn=0;#to=new Set;#tl=null;#th=null;#td=new Set;#tc=null;#tu=new IdManager;#tp=!1;#tg=!1;#tm=null;#tf=A.AnnotationEditorType.NONE;#tb=new Set;#tA=null;#tv=this.blur.bind(this);#ty=this.focus.bind(this);#t_=this.copy.bind(this);#tS=this.cut.bind(this);#tE=this.paste.bind(this);#tx=this.keydown.bind(this);#tC=this.onEditingAction.bind(this);#tT=this.onPageChanging.bind(this);#tw=this.onScaleChanging.bind(this);#tP=this.onRotationChanging.bind(this);#tM={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1};#tk=[0,0];#tF=null;#tR=null;#tD=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){let o=AnnotationEditorUIManager.prototype,arrowChecker=o=>{let{activeElement:l}=document;return l&&o.#tR.contains(l)&&o.hasSomethingToControl()},l=this.TRANSLATE_SMALL,u=this.TRANSLATE_BIG;return(0,A.shadow)(this,"_keyboardManager",new KeyboardManager([[["ctrl+a","mac+meta+a"],o.selectAll],[["ctrl+z","mac+meta+z"],o.undo],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],o.redo],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],o.delete],[["Escape","mac+Escape"],o.unselectAll],[["ArrowLeft","mac+ArrowLeft"],o.translateSelectedEditors,{args:[-l,0],checker:arrowChecker}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],o.translateSelectedEditors,{args:[-u,0],checker:arrowChecker}],[["ArrowRight","mac+ArrowRight"],o.translateSelectedEditors,{args:[l,0],checker:arrowChecker}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],o.translateSelectedEditors,{args:[u,0],checker:arrowChecker}],[["ArrowUp","mac+ArrowUp"],o.translateSelectedEditors,{args:[0,-l],checker:arrowChecker}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],o.translateSelectedEditors,{args:[0,-u],checker:arrowChecker}],[["ArrowDown","mac+ArrowDown"],o.translateSelectedEditors,{args:[0,l],checker:arrowChecker}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],o.translateSelectedEditors,{args:[0,u],checker:arrowChecker}]]))}constructor(o,l,u,A,E,C){this.#tR=o,this.#tD=l,this.#ts=u,this._eventBus=A,this._eventBus._on("editingaction",this.#tC),this._eventBus._on("pagechanging",this.#tT),this._eventBus._on("scalechanging",this.#t
21w),this._eventBus._on("rotationchanging",this.#tP),this.#tr=E.annotationStorage,this.#tc=E.filterFactory,this.#tA=C,this.viewParameters={realScale:S.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0}}destroy(){for(let o of(this.#tI(),this.#tL(),this._eventBus._off("editingaction",this.#tC),this._eventBus._off("pagechanging",this.#tT),this._eventBus._off("scalechanging",this.#tw),this._eventBus._off("rotationchanging",this.#tP),this.#ti.values()))o.destroy();this.#ti.clear(),this.#te.clear(),this.#td.clear(),this.#tt=null,this.#tb.clear(),this.#ta.destroy(),this.#ts.destroy()}get hcmFilter(){return(0,A.shadow)(this,"hcmFilter",this.#tA?this.#tc.addHCMFilter(this.#tA.foreground,this.#tA.background):"none")}get direction(){return(0,A.shadow)(this,"direction",getComputedStyle(this.#tR).direction)}editAltText(o){this.#ts?.editAltText(this,o)}onPageChanging({pageNumber:o}){this.#tn=o-1}focusMainContainer(){this.#tR.focus()}findParent(o,l){for(let u of this.#ti.values()){let{x:A,y:S,width:E,height:C}=u.div.getBoundingClientRect();if(o>=A&&o<=A+E&&l>=S&&l<=S+C)return u}return null}disableUserSelect(o=!1){this.#tD.classList.toggle("noUserSelect",o)}addShouldRescale(o){this.#td.add(o)}removeShouldRescale(o){this.#td.delete(o)}onScaleChanging({scale:o}){for(let l of(this.commitOrRemove(),this.viewParameters.realScale=o*S.PixelsPerInch.PDF_TO_CSS_UNITS,this.#td))l.onScaleChanging()}onRotationChanging({pagesRotation:o}){this.commitOrRemove(),this.viewParameters.rotation=o}addToAnnotationStorage(o){o.isEmpty()||!this.#tr||this.#tr.has(o.id)||this.#tr.setValue(o.id,o)}#tO(){window.addEventListener("focus",this.#ty),window.addEventListener("blur",this.#tv)}#tL(){window.removeEventListener("focus",this.#ty),window.removeEventListener("blur",this.#tv)}blur(){if(!this.hasSelection)return;let{activeElement:o}=document;for(let l of this.#tb)if(l.div.contains(o)){this.#tm=[l,o],l._focusEventsAllowed=!1;break}}focus(){if(!this.#tm)return;let[o,l]=this.#tm;this.#tm=null,l.addEventListener("focusin",()=>{o._focusEventsAllowed=!0},{once:!0}),l.focus()}#tN(){window.addEventListener("keydown",this.#tx,{capture:!0})}#tI(){window.removeEventListener("keydown",this.#tx,{capture:!0})}#tB(){document.addEventListener("copy",this.#t_),document.addEventListener("cut",this.#tS),document.addEventListener("paste",this.#tE)}#tU(){document.removeEventListener("copy",this.#t_),document.removeEventListener("cut",this.#tS),document.removeEventListener("paste",this.#tE)}addEditListeners(){this.#tN(),this.#tB()}removeEditListeners(){this.#tI(),this.#tU()}copy(o){if(o.preventDefault(),this.#tt?.commitOrRemove(),!this.hasSelection)return;let l=[];for(let o of this.#tb){let u=o.serialize(!0);u&&l.push(u)}0!==l.length&&o.clipboardData.setData("application/pdfjs",JSON.stringify(l))}cut(o){this.copy(o),this.delete()}paste(o){o.preventDefault();let{clipboardData:l}=o;for(let o of l.items)for(let l of this.#th)if(l.isHandlingMimeForPasting(o.type)){l.paste(o,this.currentLayer);return}let u=l.getData("application/pdfjs");if(!u)return;try{u=JSON.parse(u)}catch(o){(0,A.warn)(`paste: "${o.message}".`);return}if(!Array.isArray(u))return;this.unselectAll();let S=this.currentLayer;try{let o=[];for(let l of u){let u=S.deserialize(l);if(!u)return;o.push(u)}let cmd=()=>{for(let l of o)this.#tj(l);this.#tH(o)},undo=()=>{for(let l of o)l.remove()};this.addCommands({cmd,undo,mustExec:!0})}catch(o){(0,A.warn)(`paste: "${o.message}".`)}}keydown(o){this.getActive()?.shouldGetKeyboardEvents()||AnnotationEditorUIManager._keyboardManager.exec(this,o)}onEditingAction(o){["undo","redo","delete","selectAll"].includes(o.name)&&this[o.name]()}#tG(o){let l=Object.entries(o).some(([o,l])=>this.#tM[o]!==l);l&&this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#tM,o)})}#tz(o){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:o})}setEditingState(o){o?(this.#tO(),this.#tN(),this.#tB(),this.#tG({isEditing:this.#tf!==A.AnnotationEditorType.NONE,isEmpty:this.#tV(),hasSomethingToUndo:this.#ta.hasSomethingToUndo(),hasSomethingToRedo:this.#ta.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#tL(),this.#tI(),this.#tU(),this.#tG({isEditing:!1}),this.disableUserSelect(!1))}
21registerEditorTypes(o){if(!this.#th)for(let l of(this.#th=o,this.#th))this.#tz(l.defaultPropertiesToUpdate)}getId(){return this.#tu.getId()}get currentLayer(){return this.#ti.get(this.#tn)}getLayer(o){return this.#ti.get(o)}get currentPageIndex(){return this.#tn}addLayer(o){this.#ti.set(o.pageIndex,o),this.#tp?o.enable():o.disable()}removeLayer(o){this.#ti.delete(o.pageIndex)}updateMode(o,l=null){if(this.#tf!==o){if(this.#tf=o,o===A.AnnotationEditorType.NONE){this.setEditingState(!1),this.#tW();return}for(let l of(this.setEditingState(!0),this.#tq(),this.unselectAll(),this.#ti.values()))l.updateMode(o);if(l){for(let o of this.#te.values())if(o.annotationElementId===l){this.setSelected(o),o.enterInEditMode();break}}}}updateToolbar(o){o!==this.#tf&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:o})}updateParams(o,l){if(this.#th){if(o===A.AnnotationEditorParamsType.CREATE){this.currentLayer.addNewEditor(o);return}for(let u of this.#tb)u.updateParams(o,l);for(let u of this.#th)u.updateDefaultParams(o,l)}}enableWaiting(o=!1){if(this.#tg!==o)for(let l of(this.#tg=o,this.#ti.values()))o?l.disableClick():l.enableClick(),l.div.classList.toggle("waiting",o)}#tq(){if(!this.#tp)for(let o of(this.#tp=!0,this.#ti.values()))o.enable()}#tW(){if(this.unselectAll(),this.#tp)for(let o of(this.#tp=!1,this.#ti.values()))o.disable()}getEditors(o){let l=[];for(let u of this.#te.values())u.pageIndex===o&&l.push(u);return l}getEditor(o){return this.#te.get(o)}addEditor(o){this.#te.set(o.id,o)}removeEditor(o){this.#te.delete(o.id),this.unselect(o),o.annotationElementId&&this.#to.has(o.annotationElementId)||this.#tr?.remove(o.id)}addDeletedAnnotationElement(o){this.#to.add(o.annotationElementId),o.deleted=!0}isDeletedAnnotationElement(o){return this.#to.has(o)}removeDeletedAnnotationElement(o){this.#to.delete(o.annotationElementId),o.deleted=!1}#tj(o){let l=this.#ti.get(o.pageIndex);l?l.addOrRebuild(o):this.addEditor(o)}setActiveEditor(o){this.#tt!==o&&(this.#tt=o,o&&this.#tz(o.propertiesToUpdate))}toggleSelected(o){if(this.#tb.has(o)){this.#tb.delete(o),o.unselect(),this.#tG({hasSelectedEditor:this.hasSelection});return}this.#tb.add(o),o.select(),this.#tz(o.propertiesToUpdate),this.#tG({hasSelectedEditor:!0})}setSelected(o){for(let l of this.#tb)l!==o&&l.unselect();this.#tb.clear(),this.#tb.add(o),o.select(),this.#tz(o.propertiesToUpdate),this.#tG({hasSelectedEditor:!0})}isSelected(o){return this.#tb.has(o)}unselect(o){o.unselect(),this.#tb.delete(o),this.#tG({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#tb.size}undo(){this.#ta.undo(),this.#tG({hasSomethingToUndo:this.#ta.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#tV()})}redo(){this.#ta.redo(),this.#tG({hasSomethingToUndo:!0,hasSomethingToRedo:this.#ta.hasSomethingToRedo(),isEmpty:this.#tV()})}addCommands(o){this.#ta.add(o),this.#tG({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#tV()})}#tV(){if(0===this.#te.size)return!0;if(1===this.#te.size)for(let o of this.#te.values())return o.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;let o=[...this.#tb],cmd=()=>{for(let l of o)l.remove()},undo=()=>{for(let l of o)this.#tj(l)};this.addCommands({cmd,undo,mustExec:!0})}commitOrRemove(){this.#tt?.commitOrRemove()}hasSomethingToControl(){return this.#tt||this.hasSelection}#tH(o){for(let l of(this.#tb.clear(),o))l.isEmpty()||(this.#tb.add(l),l.select());this.#tG({hasSelectedEditor:!0})}selectAll(){for(let o of this.#tb)o.commit();this.#tH(this.#te.values())}unselectAll(){if(this.#tt){this.#tt.commitOrRemove();return}if(this.hasSelection){for(let o of this.#tb)o.unselect();this.#tb.clear(),this.#tG({hasSelectedEditor:!1})}}translateSelectedEditors(o,l,u=!1){if(u||this.commitOrRemove(),!this.hasSelection)return;this.#tk[0]+=o,this.#tk[1]+=l;let[A,S]=this.#tk,E=[...this.#tb],C=1e3;for(let u of(this.#tF&&clearTimeout(this.#tF),this.#tF=setTimeout(()=>{this.#tF=null,this.#tk[0]=this.#tk[1]=0,this.addCommands({cmd:()=>{for(let o of E)this.#te.has(o.id)&&o.translateInPage(A,S)},undo:()=>{for(let o of E)this.#te.has(o.id)&&o.translateInPage(-A,-S)},mustExec:!1})},C),E))u.translateInPage(o,l)}setUpDragSession(){if(this.hasSelection)for(let o of(this.disableUserSelect(!0),this.#tl=new Map,this.#tb))this.#tl.set(o,{savedX:o.x,savedY:o.y,savedPageIndex:o.pageIndex,newX:0,newY:0,newPageIndex:-1})}endDragSession(){if(!this.#tl)return!1;this.disableUserSelect(!1);let o=this.#tl;this.#tl=null;let l=!1;for(let[{x:u,y:A,pageIndex:S},E]of o)E.newX=u,E.newY=A,E.newPageIndex=S,l||=u!==E.savedX||A!==E.savedY||S!==E.savedPageIndex;if(!l)return!1;let move=(o,l,u,A)=>{if(this.#te.has(o.id)){let S=this.#ti.get(A);S?o._setParentAndPosition(S,l,u):(o.pageIndex=A,o.x=l,o.y=u)}};return this.addCommands({cmd:()=>{for(let[l,{newX:u,newY:A,newPageIndex:S}]of o)move(l,u,A,S)},undo:()=>{for(let[l,{savedX:u,savedY:A,savedPageIndex:S}]of o)move(l,u,A,S)},mustExec:!0}),!0}dragSelectedEditors(o,l){if(this.#tl)for(let u of this.#tl.keys())u.drag(o,l)}rebuild(o){if(null===o.parent){let l=this.getLayer(o.pageIndex);l?(l.changeParent(o),l.addOrRebuild(o)):(this.addEditor(o),this.addToAnnotationStorage(o),o.rebuild())}else o.parent.addOrRebuild(o)}isActive(o){return this.#tt===o}getActive(){return this.#tt}getMode(){return this.#tf}get imageManager(){return(0,A.shadow)(this,"imageManager",new ImageManager)}};l.AnnotationEditorUIManager=AnnotationEditorUIManager},(o,l,u)=>{let A;
21Object.defineProperty(l,"__esModule",{value:!0}),l.StatTimer=l.RenderingCancelledException=l.PixelsPerInch=l.PageViewport=l.PDFDateString=l.DOMStandardFontDataFactory=l.DOMSVGFactory=l.DOMFilterFactory=l.DOMCanvasFactory=l.DOMCMapReaderFactory=void 0,l.deprecated=deprecated,l.getColorValues=getColorValues,l.getCurrentTransform=getCurrentTransform,l.getCurrentTransformInverse=getCurrentTransformInverse,l.getFilenameFromUrl=getFilenameFromUrl,l.getPdfFilenameFromUrl=getPdfFilenameFromUrl,l.getRGB=getRGB,l.getXfaPageViewport=getXfaPageViewport,l.isDataScheme=isDataScheme,l.isPdfFile=isPdfFile,l.isValidFetchUrl=isValidFetchUrl,l.loadScript=loadScript,l.noContextMenu=noContextMenu,l.setLayerDimensions=setLayerDimensions;var S=u(7),E=u(1);let C="http://www.w3.org/2000/svg";let PixelsPerInch=class PixelsPerInch{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF};l.PixelsPerInch=PixelsPerInch;let DOMFilterFactory=class DOMFilterFactory extends S.BaseFilterFactory{#t$;#tX;#e;#tK;#tY;#tJ;#tQ;#tZ;#t0;#t1;#W=0;constructor({docId:o,ownerDocument:l=globalThis.document}={}){super(),this.#e=o,this.#tK=l}get #$(){return this.#t$||=new Map}get #t2(){if(!this.#tX){let o=this.#tK.createElement("div"),{style:l}=o;l.visibility="hidden",l.contain="strict",l.width=l.height=0,l.position="absolute",l.top=l.left=0,l.zIndex=-1;let u=this.#tK.createElementNS(C,"svg");u.setAttribute("width",0),u.setAttribute("height",0),this.#tX=this.#tK.createElementNS(C,"defs"),o.append(u),u.append(this.#tX),this.#tK.body.append(o)}return this.#tX}addFilter(o){let l,u,A,S;if(!o)return"none";let E=this.#$.get(o);if(E)return E;if(1===o.length){let E=o[0],C=Array(256);for(let o=0;o<256;o++)C[o]=E[o]/255;S=l=u=A=C.join(",")}else{let[E,C,T]=o,P=Array(256),M=Array(256),F=Array(256);for(let o=0;o<256;o++)P[o]=E[o]/255,M[o]=C[o]/255,F[o]=T[o]/255;l=P.join(","),u=M.join(","),A=F.join(","),S=`${l}${u}${A}`}if(E=this.#$.get(S))return this.#$.set(o,E),E;let C=`g_${this.#e}_transfer_map_${this.#W++}`,T=`url(#${C})`;this.#$.set(o,T),this.#$.set(S,T);let P=this.#t3(C);return this.#t5(l,u,A,P),T}addHCMFilter(o,l){let u=`${o}-${l}`;if(this.#tJ===u||(this.#tJ=u,this.#tQ="none",this.#tY?.remove(),!o||!l))return this.#tQ;let A=this.#t4(o);o=E.Util.makeHexColor(...A);let S=this.#t4(l);if(l=E.Util.makeHexColor(...S),this.#t2.style.color="","#000000"===o&&"#ffffff"===l||o===l)return this.#tQ;let C=Array(256);for(let o=0;o<=255;o++){let l=o/255;C[o]=l<=.03928?l/12.92:((l+.055)/1.055)**2.4}let T=C.join(","),P=`g_${this.#e}_hcm_filter`,M=this.#tZ=this.#t3(P);this.#t5(T,T,T,M),this.#t8(M);let getSteps=(o,l)=>{let u=A[o]/255,E=S[o]/255,C=Array(l+1);for(let o=0;o<=l;o++)C[o]=u+o/l*(E-u);return C.join(",")};return this.#t5(getSteps(0,5),getSteps(1,5),getSteps(2,5),M),this.#tQ=`url(#${P})`,this.#tQ}addHighlightHCMFilter(o,l,u,A){let S=`${o}-${l}-${u}-${A}`;if(this.#t0===S||(this.#t0=S,this.#t1="none",this.#tZ?.remove(),!o||!l))return this.#t1;let[E,C]=[o,l].map(this.#t4.bind(this)),T=Math.round(.2126*E[0]+.7152*E[1]+.0722*E[2]),P=Math.round(.2126*C[0]+.7152*C[1]+.0722*C[2]),[M,F]=[u,A].map(this.#t4.bind(this));P<T&&([T,P,M,F]=[P,T,F,M]),this.#t2.style.color="";let getSteps=(o,l,u)=>{let A=Array(256),S=(P-T)/u,E=o/255,C=(l-o)/(255*u),M=0;for(let o=0;o<=u;o++){let l=Math.round(T+o*S),u=E+o*C;for(let o=M;o<=l;o++)A[o]=u;M=l+1}for(let o=M;o<256;o++)A[o]=A[M-1];return A.join(",")},R=`g_${this.#e}_hcm_highlight_filter`,D=this.#tZ=this.#t3(R);return this.#t8(D),this.#t5(getSteps(M[0],F[0],5),getSteps(M[1],F[1],5),getSteps(M[2],F[2],5),D),this.#t1=`url(#${R})`,this.#t1}destroy(o=!1){o&&(this.#tQ||this.#t1)||(this.#tX&&(this.#tX.parentNode.parentNode.remove(),this.#tX=null),this.#t$&&(this.#t$.clear(),this.#t$=null),this.#W=0)}#t8(o){let l=this.#tK.createElementNS(C,"feColorMatrix");l.setAttribute("type","matrix"),l.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"),o.append(l)}#t3(o){let l=this.#tK.createElementNS(C,"filter");return l.setAttribute("color-interpolation-filters","sRGB"),l.setAttribute("id",o),this.#t2.append(l),l}#t6(o,l,u){let A=this.#tK.createElementNS(C,l);A.setAttribute("type","discrete"),A.setAttribute("tableValues",u),o.append(A)}#t5(o,l,u,A){let S=this.#tK.createElementNS(C,"feComponentTransfer");A.append(S),this.#t6(S,"feFuncR",o),this.#t6(S,"feFuncG",l),this.#t6(S,"feFuncB",u)}
21#t4(o){return this.#t2.style.color=o,getRGB(getComputedStyle(this.#t2).getPropertyValue("color"))}};l.DOMFilterFactory=DOMFilterFactory;let DOMCanvasFactory=class DOMCanvasFactory extends S.BaseCanvasFactory{constructor({ownerDocument:o=globalThis.document}={}){super(),this._document=o}_createCanvas(o,l){let u=this._document.createElement("canvas");return u.width=o,u.height=l,u}};async function fetchData(o,l=!1){if(isValidFetchUrl(o,document.baseURI)){let u=await fetch(o);if(!u.ok)throw Error(u.statusText);return l?new Uint8Array(await u.arrayBuffer()):(0,E.stringToBytes)(await u.text())}return new Promise((u,A)=>{let S=new XMLHttpRequest;S.open("GET",o,!0),l&&(S.responseType="arraybuffer"),S.onreadystatechange=()=>{if(S.readyState===XMLHttpRequest.DONE){if(200===S.status||0===S.status){let o;if(l&&S.response?o=new Uint8Array(S.response):!l&&S.responseText&&(o=(0,E.stringToBytes)(S.responseText)),o){u(o);return}}A(Error(S.statusText))}},S.send(null)})}l.DOMCanvasFactory=DOMCanvasFactory;let DOMCMapReaderFactory=class DOMCMapReaderFactory extends S.BaseCMapReaderFactory{_fetchData(o,l){return fetchData(o,this.isCompressed).then(o=>({cMapData:o,compressionType:l}))}};l.DOMCMapReaderFactory=DOMCMapReaderFactory;let DOMStandardFontDataFactory=class DOMStandardFontDataFactory extends S.BaseStandardFontDataFactory{_fetchData(o){return fetchData(o,!0)}};l.DOMStandardFontDataFactory=DOMStandardFontDataFactory;let DOMSVGFactory=class DOMSVGFactory extends S.BaseSVGFactory{_createSVG(o){return document.createElementNS(C,o)}};l.DOMSVGFactory=DOMSVGFactory;let PageViewport=class PageViewport{constructor({viewBox:o,scale:l,rotation:u,offsetX:A=0,offsetY:S=0,dontFlip:E=!1}){let C,T,P,M,F,R,D,I;this.viewBox=o,this.scale=l,this.rotation=u,this.offsetX=A,this.offsetY=S;let L=(o[2]+o[0])/2,O=(o[3]+o[1])/2;switch((u%=360)<0&&(u+=360),u){case 180:C=-1,T=0,P=0,M=1;break;case 90:C=0,T=1,P=1,M=0;break;case 270:C=0,T=-1,P=-1,M=0;break;case 0:C=1,T=0,P=0,M=-1;break;default:throw Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}E&&(P=-P,M=-M),0===C?(F=Math.abs(O-o[1])*l+A,R=Math.abs(L-o[0])*l+S,D=(o[3]-o[1])*l,I=(o[2]-o[0])*l):(F=Math.abs(L-o[0])*l+A,R=Math.abs(O-o[1])*l+S,D=(o[2]-o[0])*l,I=(o[3]-o[1])*l),this.transform=[C*l,T*l,P*l,M*l,F-C*l*L-P*l*O,R-T*l*L-M*l*O],this.width=D,this.height=I}get rawDims(){let{viewBox:o}=this;return(0,E.shadow)(this,"rawDims",{pageWidth:o[2]-o[0],pageHeight:o[3]-o[1],pageX:o[0],pageY:o[1]})}clone({scale:o=this.scale,rotation:l=this.rotation,offsetX:u=this.offsetX,offsetY:A=this.offsetY,dontFlip:S=!1}={}){return new PageViewport({viewBox:this.viewBox.slice(),scale:o,rotation:l,offsetX:u,offsetY:A,dontFlip:S})}convertToViewportPoint(o,l){return E.Util.applyTransform([o,l],this.transform)}convertToViewportRectangle(o){let l=E.Util.applyTransform([o[0],o[1]],this.transform),u=E.Util.applyTransform([o[2],o[3]],this.transform);return[l[0],l[1],u[0],u[1]]}convertToPdfPoint(o,l){return E.Util.applyInverseTransform([o,l],this.transform)}};l.PageViewport=PageViewport;let RenderingCancelledException=class RenderingCancelledException extends
21E.BaseException{constructor(o,l=0){super(o,"RenderingCancelledException"),this.extraDelay=l}};function isDataScheme(o){let l=o.length,u=0;for(;u<l&&""===o[u].trim();)u++;return"data:"===o.substring(u,u+5).toLowerCase()}function isPdfFile(o){return"string"==typeof o&&/\.pdf$/i.test(o)}function getFilenameFromUrl(o,l=!1){return l||([o]=o.split(/[#?]/,1)),o.substring(o.lastIndexOf("/")+1)}function getPdfFilenameFromUrl(o,l="document.pdf"){if("string"!=typeof o)return l;if(isDataScheme(o))return(0,E.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),l;let u=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,A=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,S=u.exec(o),C=A.exec(S[1])||A.exec(S[2])||A.exec(S[3]);if(C&&(C=C[0]).includes("%"))try{C=A.exec(decodeURIComponent(C))[0]}catch{}return C||l}l.RenderingCancelledException=RenderingCancelledException;let StatTimer=class StatTimer{started=Object.create(null);times=[];time(o){o in this.started&&(0,E.warn)(`Timer is already running for ${o}`),this.started[o]=Date.now()}timeEnd(o){o in this.started||(0,E.warn)(`Timer has not been started for ${o}`),this.times.push({name:o,start:this.started[o],end:Date.now()}),delete this.started[o]}toString(){let o=[],l=0;for(let{name:o}of this.times)l=Math.max(o.length,l);for(let{name:u,start:A,end:S}of this.times)o.push(`${u.padEnd(l)} ${S-A}ms 22`);return o.join("")}};function isValidFetchUrl(o,l){try{let{protocol:u}=l?new URL(o,l):new URL(o);return"http:"===u||"https:"===u}catch{return!1}}function noContextMenu(o){o.preventDefault()}function loadScript(o,l=!1){return new Promise((u,A)=>{let S=document.createElement("script");S.src=o,S.onload=function(o){l&&S.remove(),u(o)},S.onerror=function(){A(Error(`Cannot load script at: ${S.src}`))},(document.head||document.documentElement).append(S)})}function deprecated(o){console.log("Deprecated API usage: "+o)}l.StatTimer=StatTimer;let PDFDateString=class PDFDateString{static toDateObject(o){if(!o||"string"!=typeof o)return null;A||=RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");let l=A.exec(o);if(!l)return null;let u=parseInt(l[1],10),S=parseInt(l[2],10);S=S>=1&&S<=12?S-1:0;let E=parseInt(l[3],10);E=E>=1&&E<=31?E:1;let C=parseInt(l[4],10);C=C>=0&&C<=23?C:0;let T=parseInt(l[5],10);T=T>=0&&T<=59?T:0;let P=parseInt(l[6],10);P=P>=0&&P<=59?P:0;let M=l[7]||"Z",F=parseInt(l[8],10);F=F>=0&&F<=23?F:0;let R=parseInt(l[9],10)||0;return R=R>=0&&R<=59?R:0,"-"===M?(C+=F,T+=R):"+"===M&&(C-=F,T-=R),new Date(Date.UTC(u,S,E,C,T,P))}};function getXfaPageViewport(o,{scale:l=1,rotation:u=0}){let{width:A,height:S}=o.attributes.style,E=[0,0,parseInt(A),parseInt(S)];return new PageViewport({viewBox:E,scale:l,rotation:u})}function getRGB(o){if(o.startsWith("#")){let l=parseInt(o.slice(1),16);return[(16711680&l)>>16,(65280&l)>>8,255&l]}return o.startsWith("rgb(")?o.slice(4,-1).split(",").map(o=>parseInt(o)):o.startsWith("rgba(")?o.slice(5,-1).split(",").map(o=>parseInt(o)).slice(0,3):((0,E.warn)(`Not a valid color format: "${o}"`),[0,0,0])}function getColorValues(o){let l=document.createElement("span");for(let u of(l.style.visibility="hidden",document.body.append(l),o.keys())){l.style.color=u;let A=window.getComputedStyle(l).color;o.set(u,getRGB(A))}l.remove()}function getCurrentTransform(o){let{a:l,b:u,c:A,d:S,e:E,f:C}=o.getTransform();return[l,u,A,S,E,C]}function getCurrentTransformInverse(o){let{a:l,b:u,c:A,d:S,e:E,f:C}=o.getTransform().invertSelf();return[l,u,A,S,E,C]}function setLayerDimensions(o,l,u=!1,A=!0){if(l instanceof PageViewport){let{pageWidth:A,pageHeight:S}=l.rawDims,{style:C}=o,T=E.FeatureTest.isCSSRoundSupported,P=`var(--scale-factor) * ${A}px`,M=`var(--scale-factor) * ${S}px`,F=T?`round(${P}, 1px)`:`calc(${P})`,R=T?`round(${M}, 1px)`:`calc(${M})`;u&&l.rotation%180!=0?(C.width=R,C.height=F):(C.width=F,C.height=R)}A&&o.setAttribute("data-main-rotation",l.rotation)}l.PDFDateString=PDFDateString},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BaseStandardFontDataFactory=l.BaseSVGFactory=l.BaseFilterFactory=l.BaseCanvasFactory=l.BaseCMapReaderFactory=void 0;var A=u(1);let BaseFilterFactory=class BaseFilterFactory{constructor(){this.constructor===BaseFilterFactory&&(0,A.unreachable)("Cannot initialize BaseFilterFactory.")}addFilter(o){return"none"}addHCMFilter(o,l){return"none"}addHighlightHCMFilter(o,l,u,A){return"none"}destroy(o=!1){}};l.BaseFilterFactory=BaseFilterFactory;let BaseCanvasFactory=class BaseCanvasFactory{constructor(){this.constructor===BaseCanvasFactory&&(0,A.unreachable)("Cannot initialize BaseCanvasFactory.")}create(o,l){if(o<=0||l<=0)throw Error("Invalid canvas size");let u=this._createCanvas(o,l);return{canvas:u,context:u.getContext("2d")}}reset(o,l,u){if(!o.canvas)throw Error("Canvas is not specified");if(l<=0||u<=0)throw Error("Invalid canvas size");o.canvas.width=l,o.canvas.height=u}destroy(o){if(!o.canvas)throw Error("Canvas is not specified");o.canvas.width=0,o.canvas.height=0,o.canvas=null,o.context=null}_createCanvas(o,l){(0,A.unreachable)("Abstract method `_createCanvas` called.")}};l.BaseCanvasFactory=BaseCanvasFactory;let BaseCMapReaderFactory=class BaseCMapReaderFactory{constructor({baseUrl:o=null,isCompressed:l=!0}){this.constructor===BaseCMapReaderFactory&&(0,A.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=o,this.isCompressed=l}async fetch({name:o}){if(!this.baseUrl)throw Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!o)throw Error("CMap name must be specified.");let l=this.baseUrl+o+(this.isCompressed?".bcmap":""),u=this.isCompressed?A.CMapCompressionType.BINARY:A.CMapCompressionType.NONE;return this._fetchData(l,u).catch(o=>{throw Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${l}`)})}_fetchData(o,l){(0,A.unreachable)("Abstract method `_fetchData` called.")}};l.BaseCMapReaderFactory=BaseCMapReaderFactory;let BaseStandardFontDataFactory=class BaseStandardFontDataFactory{constructor({baseUrl:o=null}){this.constructor===BaseStandardFontDataFactory&&(0,A.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=o}async fetch({filename:o}){if(!this.baseUrl)throw Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!o)throw Error("Font filename must be specified.");let l=`${this.baseUrl}${o}`;return this._fetchData(l).catch(o=>{throw Error(`Unable to load font data at: ${l}`)})}_fetchData(o){(0,A.unreachable)("Abstract method `_fetchData` called.")}};l.BaseStandardFontDataFactory=BaseStandardFontDataFactory;let BaseSVGFactory=class BaseSVGFactory{constructor(){this.constructor===BaseSVGFactory&&(0,A.unreachable)("Cannot initialize BaseSVGFactory.")}create(o,l,u=!1){if(o<=0||l<=0)throw Error("Invalid SVG dimensions");let A=this._createSVG("svg:svg");
22return A.setAttribute("version","1.1"),u||(A.setAttribute("width",`${o}px`),A.setAttribute("height",`${l}px`)),A.setAttribute("preserveAspectRatio","none"),A.setAttribute("viewBox",`0 0 ${o} ${l}`),A}createElement(o){if("string"!=typeof o)throw Error("Invalid SVG element type");return this._createSVG(o)}_createSVG(o){(0,A.unreachable)("Abstract method `_createSVG` called.")}};l.BaseSVGFactory=BaseSVGFactory},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.MurmurHash3_64=void 0;var A=u(1);let S=3285377520,E=4294901760,C=65535;let MurmurHash3_64=class MurmurHash3_64{constructor(o){this.h1=o?4294967295&o:S,this.h2=o?4294967295&o:S}update(o){let l,u;if("string"==typeof o){l=new Uint8Array(2*o.length),u=0;for(let A=0,S=o.length;A<S;A++){let S=o.charCodeAt(A);S<=255?l[u++]=S:(l[u++]=S>>>8,l[u++]=255&S)}}else if((0,A.isArrayBuffer)(o))u=(l=o.slice()).byteLength;else throw Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");let S=u>>2,T=u-4*S,P=new Uint32Array(l.buffer,0,S),M=0,F=0,R=this.h1,D=this.h2,I=3432918353,L=461845907,O=I&C,N=L&C;for(let o=0;o<S;o++)1&o?(R^=M=(M=(M=(M=P[o])*I&E|M*O&C)<<15|M>>>17)*L&E|M*N&C,R=5*(R=R<<13|R>>>19)+3864292196):(D^=F=(F=(F=(F=P[o])*I&E|F*O&C)<<15|F>>>17)*L&E|F*N&C,D=5*(D=D<<13|D>>>19)+3864292196);switch(M=0,T){case 3:M^=l[4*S+2]<<16;case 2:M^=l[4*S+1]<<8;case 1:M^=l[4*S],M=(M=(M=M*I&E|M*O&C)<<15|M>>>17)*L&E|M*N&C,1&S?R^=M:D^=M}this.h1=R,this.h2=D}hexdigest(){let o=this.h1,l=this.h2;return o^=l>>>1,o=3981806797*o&E|36045*o&C,l=4283543511*l&E|((l<<16|o>>>16)*2950163797&E)>>>16,o^=l>>>1,o=444984403*o&E|60499*o&C,l=3301882366*l&E|((l<<16|o>>>16)*3120437893&E)>>>16,((o^=l>>>1)>>>0).toString(16).padStart(8,"0")+(l>>>0).toString(16).padStart(8,"0")}};l.MurmurHash3_64=MurmurHash3_64},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.FontLoader=l.FontFaceObject=void 0;var A=u(1);let FontLoader=class FontLoader{#t7=new Set;constructor({ownerDocument:o=globalThis.document,styleElement:l=null}){this._document=o,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(o){this.nativeFontFaces.add(o),this._document.fonts.add(o)}removeNativeFontFace(o){this.nativeFontFaces.delete(o),this._document.fonts.delete(o)}insertRule(o){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));let l=this.styleElement.sheet;l.insertRule(o,l.cssRules.length)}clear(){for(let o of this.nativeFontFaces)this._document.fonts.delete(o);this.nativeFontFaces.clear(),this.#t7.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont(o){if(!(!o||this.#t7.has(o.loadedName))){if((0,A.assert)(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:l,src:u,style:S}=o,E=new FontFace(l,u,S);this.addNativeFontFace(E);try{await E.load(),this.#t7.add(l)}catch{(0,A.warn)(`Cannot load system font: ${o.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(E)}return}(0,A.unreachable)("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(o){if(o.attached||o.missingFile&&!o.systemFontInfo)return;if(o.attached=!0,o.systemFontInfo){await this.loadSystemFont(o.systemFontInfo);return}if(this.isFontLoadingAPISupported){let l=o.createNativeFontFace();if(l){this.addNativeFontFace(l);try{await l.loaded}catch(u){throw(0,A.warn)(`Failed to load font '${l.family}': '${u}'.`),o.disableFontFace=!0,u}}return}let l=o.createFontFaceRule();if(l){if(this.insertRule(l),this.isSyncFontLoadingSupported)return;await new Promise(l=>{let u=this._queueLoadingCallback(l);this._prepareFontLoadEvent(o,u)})}}get isFontLoadingAPISupported(){let o=!!this._document?.fonts;return(0,A.shadow)(this,"isFontLoadingAPISupported",o)}get isSyncFontLoadingSupported(){let o=!1;return A.isNodeJS?o=!0:"undefined"!=typeof navigator&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent)&&(o=!0),(0,A.shadow)(this,"isSyncFontLoadingSupported",o)}_queueLoadingCallback(o){function completeRequest(){for((0,A.assert)(!u.done,"completeRequest() cannot be called twice."),u.done=!0;l.length>0&&l[0].done;){let o=l.shift();setTimeout(o.callback,0)}}let{loadingRequests:l}=this,u={done:!1,complete:completeRequest,callback:o};return l.push(u),u}get _loadTestFont(){let o=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return(0,A.shadow)(this,"_loadTestFont",o)}_prepareFontLoadEvent(o,l){let u,S;function int32(o,l){return o.charCodeAt(l)<<24|o.charCodeAt(l+1)<<16|o.charCodeAt(l+2)<<8|255&o.charCodeAt(l+3)}function spliceString(o,l,u,A){let S=o.substring(0,l),E=o.substring(l+u);return S+A+E}let E=this._document.createElement("canvas");E.width=1,E.height=1;let C=E.getContext("2d"),T=0;function isFontReady(o,l){if(++T>30){(0,A.warn)("Load test font never loaded."),l();return}C.font="30px "+o,C.fillText(".",0,20);let u=C.getImageData(0,0,1,1);if(u.data[3]>0){l();return}setTimeout(isFontReady.bind(null,o,l))}let P=`lt${Date.now()}${this.loadTestFontId++}`,M=this._loadTestFont,F=976;M=spliceString(M,F,P.length,P);let R=16,D=1482184792,I=int32(M,R);for(u=0,S=P.length-3;u<S;u+=4)I=I-D+int32(P,u)|0;u<P.length&&(I=I-D+int32(P+"XXX",u)|0),M=spliceString(M,R,4,(0,A.string32)(I));let L=`url(data:font/opentype;base64,${btoa(M)});`,O=`@font-face {font-family:"${P}";src:${L}}`;this.insertRule(O);let N=this._document.createElement("div");for(let l of(N.style.visibility="hidden",N.style.width=N.style.height="10px",N.style.position="absolute",N.style.top=N.style.left="0px",[o.loadedName,P])){let o=this._document.createElement("span");o.textContent="Hi",o.style.fontFamily=l,N.append(o)}this._document.body.append(N),isFontReady(P,()=>{N.remove(),l.complete()})}};l.FontLoader=FontLoader;let FontFaceObject=class FontFaceObject{constructor(o,{isEvalSupported:l=!0,disableFontFace:u=!1,ignoreErrors:A=!1,inspectFont:S=null}){for(let l in this.compiledGlyphs=Object.create(null),o)this[l]=o[l];this.isEvalSupported=!1!==l,this.disableFontFace=!0===u,this.ignoreErrors=!0===A,this._inspectFont=S}createNativeFontFace(){let o;if(!this.data||this.disableFontFace)return null;if(this.cssFontInfo){let l={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(l.style=`oblique ${this.cssFontInfo.italicAngle}deg`),o=new FontFace(this.cssFontInfo.fontFamily,this.data,l)}else o=new FontFace(this.loadedName,this.data,{});return this._inspectFont?.(this),o}createFontFaceRule(){let o;if(!this.data||this.disableFontFace)return null;let l=(0,A.bytesToString)(this.data),u=`url(data:${this.mimetype};base64,${btoa(l)});`;if(this.cssFontInfo){let l=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(l+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),o=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${l}src:${u}}`}else o=`@font-face {font-family:"${this.loadedName}";src:${u}}`;return this._inspectFont?.(this,u),o}getPathGenerator(o,l){let u;if(void 0!==this.compiledGlyphs[l])return this.compiledGlyphs[l];try{u=o.get(this.loadedName+"_path_"+l)}catch(o){if(!this.ignoreErrors)throw o;
22return(0,A.warn)(`getPathGenerator - ignoring character: "${o}".`),this.compiledGlyphs[l]=function(o,l){}}if(this.isEvalSupported&&A.FeatureTest.isEvalSupported){let o=[];for(let l of u){let u=void 0!==l.args?l.args.join(","):"";o.push("c.",l.cmd,"(",u,");\n")}return this.compiledGlyphs[l]=Function("c","size",o.join(""))}return this.compiledGlyphs[l]=function(o,l){for(let A of u)"scale"===A.cmd&&(A.args=[l,-l]),o[A.cmd].apply(o,A.args)}}};l.FontFaceObject=FontFaceObject},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.NodeStandardFontDataFactory=l.NodeFilterFactory=l.NodeCanvasFactory=l.NodeCMapReaderFactory=void 0;var A=u(7);u(1);let fetchData=function(o){return new Promise((l,u)=>{let A=__webpack_require__(70172);A.readFile(o,(o,A)=>{if(o||!A){u(Error(o));return}l(new Uint8Array(A))})})};let NodeFilterFactory=class NodeFilterFactory extends A.BaseFilterFactory{};l.NodeFilterFactory=NodeFilterFactory;let NodeCanvasFactory=class NodeCanvasFactory extends A.BaseCanvasFactory{_createCanvas(o,l){let u=__webpack_require__(93414);return u.createCanvas(o,l)}};l.NodeCanvasFactory=NodeCanvasFactory;let NodeCMapReaderFactory=class NodeCMapReaderFactory extends A.BaseCMapReaderFactory{_fetchData(o,l){return fetchData(o).then(o=>({cMapData:o,compressionType:l}))}};l.NodeCMapReaderFactory=NodeCMapReaderFactory;let NodeStandardFontDataFactory=class NodeStandardFontDataFactory extends A.BaseStandardFontDataFactory{_fetchData(o){return fetchData(o)}};l.NodeStandardFontDataFactory=NodeStandardFontDataFactory},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CanvasGraphics=void 0;var A=u(1),S=u(6),E=u(12),C=u(13);let T=16,P=100,M=4096,F=15,R=10,D=1e3,I=16;function mirrorContextOperations(o,l){if(o._removeMirroring)throw Error("Context is already forwarding operations.");o.__originalSave=o.save,o.__originalRestore=o.restore,o.__originalRotate=o.rotate,o.__originalScale=o.scale,o.__originalTranslate=o.translate,o.__originalTransform=o.transform,o.__originalSetTransform=o.setTransform,o.__originalResetTransform=o.resetTransform,o.__originalClip=o.clip,o.__originalMoveTo=o.moveTo,o.__originalLineTo=o.lineTo,o.__originalBezierCurveTo=o.bezierCurveTo,o.__originalRect=o.rect,o.__originalClosePath=o.closePath,o.__originalBeginPath=o.beginPath,o._removeMirroring=()=>{o.save=o.__originalSave,o.restore=o.__originalRestore,o.rotate=o.__originalRotate,o.scale=o.__originalScale,o.translate=o.__originalTranslate,o.transform=o.__originalTransform,o.setTransform=o.__originalSetTransform,o.resetTransform=o.__originalResetTransform,o.clip=o.__originalClip,o.moveTo=o.__originalMoveTo,o.lineTo=o.__originalLineTo,o.bezierCurveTo=o.__originalBezierCurveTo,o.rect=o.__originalRect,o.closePath=o.__originalClosePath,o.beginPath=o.__originalBeginPath,delete o._removeMirroring},o.save=function(){l.save(),this.__originalSave()},o.restore=function(){l.restore(),this.__originalRestore()},o.translate=function(o,u){l.translate(o,u),this.__originalTranslate(o,u)},o.scale=function(o,u){l.scale(o,u),this.__originalScale(o,u)},o.transform=function(o,u,A,S,E,C){l.transform(o,u,A,S,E,C),this.__originalTransform(o,u,A,S,E,C)},o.setTransform=function(o,u,A,S,E,C){l.setTransform(o,u,A,S,E,C),this.__originalSetTransform(o,u,A,S,E,C)},o.resetTransform=function(){l.resetTransform(),this.__originalResetTransform()},o.rotate=function(o){l.rotate(o),this.__originalRotate(o)},o.clip=function(o){l.clip(o),this.__originalClip(o)},o.moveTo=function(o,u){l.moveTo(o,u),this.__originalMoveTo(o,u)},o.lineTo=function(o,u){l.lineTo(o,u),this.__originalLineTo(o,u)},o.bezierCurveTo=function(o,u,A,S,E,C){l.bezierCurveTo(o,u,A,S,E,C),this.__originalBezierCurveTo(o,u,A,S,E,C)},o.rect=function(o,u,A,S){l.rect(o,u,A,S),this.__originalRect(o,u,A,S)},o.closePath=function(){l.closePath(),this.__originalClosePath()},o.beginPath=function(){l.beginPath(),this.__originalBeginPath()}}let CachedCanvases=class CachedCanvases{constructor(o){this.canvasFactory=o,this.cache=Object.create(null)}getCanvas(o,l,u){let A;return void 0!==this.cache[o]?(A=this.cache[o],this.canvasFactory.reset(A,l,u)):(A=this.canvasFactory.create(l,u),this.cache[o]=A),A}delete(o){delete this.cache[o]}clear(){for(let o in this.cache){let l=this.cache[o];this.canvasFactory.destroy(l),delete this.cache[o]}}};function drawImageAtIntegerCoords(o,l,u,A,E,C,T,P,M,F){let[R,D,I,L,O,N]=(0,S.getCurrentTransform)(o);if(0===D&&0===I){let S=T*R+O,B=Math.round(S),U=P*L+N,H=Math.round(U),z=(T+M)*R+O,V=Math.abs(Math.round(z)-B)||1,W=(P+F)*L+N,$=Math.abs(Math.round(W)-H)||1;return o.setTransform(Math.sign(R),0,0,Math.sign(L),B,H),o.drawImage(l,u,A,E,C,0,0,V,$),o.setTransform(R,D,I,L,O,N),[V,$]}if(0===R&&0===L){let S=P*I+O,B=Math.round(S),U=T*D+N,H=Math.round(U),z=(P+F)*I+O,V=Math.abs(Math.round(z)-B)||1,W=(T+M)*D+N,$=Math.abs(Math.round(W)-H)||1;return o.setTransform(0,Math.sign(D),Math.sign(I),0,B,H),o.drawImage(l,u,A,E,C,0,0,$,V),o.setTransform(R,D,I,L,O,N),[$,V]}o.drawImage(l,u,A,E,C,T,P,M,F);let B=Math.hypot(R,D),U=Math.hypot(I,L);return[B*M,U*F]}function compileType3Glyph(o){let l,u,A;let{width:S,height:E}=o;if(S>D||E>D)return null;let C=1e3,T=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),P=S+1,M=new Uint8Array(P*(E+1)),F=S+7&-8,R=new Uint8Array(F*E),I=0;for(let l of o.data){let o=128;for(;o>0;)R[I++]=l&o?0:255,o>>=1}let L=0;for(0!==R[I=0]&&(M[0]=1,++L),u=1;u<S;u++)R[I]!==R[I+1]&&(M[u]=R[I]?2:1,++L),I++;for(0!==R[I]&&(M[u]=2,++L),l=1;l<E;l++){I=l*F,A=l*P,R[I-F]!==R[I]&&(M[A]=R[I]?1:8,++L);let o=(R[I]?4:0)+(R[I-F]?8:0);for(u=1;u<S;u++)T[o=(o>>2)+(R[I+1]?4:0)+(R[I-F+1]?8:0)]&&(M[A+u]=T[o],++L),I++;if(R[I-F]!==R[I]&&(M[A+u]=R[I]?2:4,++L),L>C)return null}for(I=F*(E-1),A=l*P,0!==R[I]&&(M[A]=8,++L),u=1;u<S;u++)R[I]!==R[I+1]&&(M[A+u]=R[I]?4:8,++L),I++;if(0!==R[I]&&(M[A+u]=4,++L),L>C)return null;let O=new Int32Array([0,P,-1,0,-P,0,0,0,1]),N=new Path2D;for(l=0;L&&l<=E;l++){let o=l*P,u=o+S;for(;o<u&&!M[o];)o++;if(o===u)continue;N.moveTo(o%P,l);let A=o,E=M[o];do{let l=O[E];do o+=l;while(!M[o]);let u=M[o];5!==u&&10!==u?(E=u,M[o]=0):(E=u&51*E>>4,M[o]&=E>>2|E<<2),N.lineTo(o%P,o/P|0),!M[o]&&--L}while(A!==o);--l}R=null,M=null;let drawOutline=function(o){o.save(),o.scale(1/S,-1/E),o.translate(0,-E),o.fill(N),o.beginPath(),o.restore(
22)};return drawOutline}let CanvasExtraState=class CanvasExtraState{constructor(o,l){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=A.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=A.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=A.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,o,l])}clone(){let o=Object.create(this);return o.clipBox=this.clipBox.slice(),o}setCurrentPoint(o,l){this.x=o,this.y=l}updatePathMinMax(o,l,u){[l,u]=A.Util.applyTransform([l,u],o),this.minX=Math.min(this.minX,l),this.minY=Math.min(this.minY,u),this.maxX=Math.max(this.maxX,l),this.maxY=Math.max(this.maxY,u)}updateRectMinMax(o,l){let u=A.Util.applyTransform(l,o),S=A.Util.applyTransform(l.slice(2),o);this.minX=Math.min(this.minX,u[0],S[0]),this.minY=Math.min(this.minY,u[1],S[1]),this.maxX=Math.max(this.maxX,u[0],S[0]),this.maxY=Math.max(this.maxY,u[1],S[1])}updateScalingPathMinMax(o,l){A.Util.scaleMinMax(o,l),this.minX=Math.min(this.minX,l[0]),this.maxX=Math.max(this.maxX,l[1]),this.minY=Math.min(this.minY,l[2]),this.maxY=Math.max(this.maxY,l[3])}updateCurvePathMinMax(o,l,u,S,E,C,T,P,M,F){let R=A.Util.bezierBoundingBox(l,u,S,E,C,T,P,M);if(F){F[0]=Math.min(F[0],R[0],R[2]),F[1]=Math.max(F[1],R[0],R[2]),F[2]=Math.min(F[2],R[1],R[3]),F[3]=Math.max(F[3],R[1],R[3]);return}this.updateRectMinMax(o,R)}getPathBoundingBox(o=E.PathType.FILL,l=null){let u=[this.minX,this.minY,this.maxX,this.maxY];if(o===E.PathType.STROKE){l||(0,A.unreachable)("Stroke bounding box must include transform.");let o=A.Util.singularValueDecompose2dScale(l),S=o[0]*this.lineWidth/2,E=o[1]*this.lineWidth/2;u[0]-=S,u[1]-=E,u[2]+=S,u[3]+=E}return u}updateClipFromPath(){let o=A.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(o||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(o){this.clipBox=o,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(o=E.PathType.FILL,l=null){return A.Util.intersect(this.clipBox,this.getPathBoundingBox(o,l))}};function putBinaryImageData(o,l){let u,S,E,C;if("undefined"!=typeof ImageData&&l instanceof ImageData){o.putImageData(l,0,0);return}let T=l.height,P=l.width,M=T%I,F=(T-M)/I,R=0===M?F:F+1,D=o.createImageData(P,I),L=0,O,N=l.data,B=D.data;if(l.kind===A.ImageKind.GRAYSCALE_1BPP){let l=N.byteLength,C=new Uint32Array(B.buffer,0,B.byteLength>>2),T=C.length,U=P+7>>3,H=4294967295,z=A.FeatureTest.isLittleEndian?4278190080:255;for(u=0;u<R;u++){for(S=0,E=u<F?I:M,O=0;S<E;S++){let o=l-L,u=0,A=o>U?P:8*o-7,S=-8&A,E=0,T=0;for(;u<S;u+=8)T=N[L++],C[O++]=128&T?H:z,C[O++]=64&T?H:z,C[O++]=32&T?H:z,C[O++]=16&T?H:z,C[O++]=8&T?H:z,C[O++]=4&T?H:z,C[O++]=2&T?H:z,C[O++]=1&T?H:z;for(;u<A;u++)0===E&&(T=N[L++],E=128),C[O++]=T&E?H:z,E>>=1}for(;O<T;)C[O++]=0;o.putImageData(D,0,u*I)}}else if(l.kind===A.ImageKind.RGBA_32BPP){for(u=0,S=0,C=P*I*4;u<F;u++)B.set(N.subarray(L,L+C)),L+=C,o.putImageData(D,0,S),S+=I;u<R&&(C=P*M*4,B.set(N.subarray(L,L+C)),o.putImageData(D,0,S))}else if(l.kind===A.ImageKind.RGB_24BPP)for(u=0,C=P*(E=I);u<R;u++){for(u>=F&&(C=P*(E=M)),O=0,S=C;S--;)B[O++]=N[L++],B[O++]=N[L++],B[O++]=N[L++],B[O++]=255;o.putImageData(D,0,u*I)}else throw Error(`bad image kind: ${l.kind}`)}function putBinaryImageMask(o,l){if(l.bitmap){o.drawImage(l.bitmap,0,0);return}let u=l.height,A=l.width,S=u%I,E=(u-S)/I,T=0===S?E:E+1,P=o.createImageData(A,I),M=0,F=l.data,R=P.data;for(let l=0;l<T;l++){let u=l<E?I:S;({srcPos:M}=(0,C.convertBlackAndWhiteToRGBA)({src:F,srcPos:M,dest:R,width:A,height:u,nonBlackColor:0})),o.putImageData(P,0,l*I)}}function copyCtxState(o,l){let u=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(let A of u)void 0!==o[A]&&(l[A]=o[A]);void 0!==o.setLineDash&&(l.setLineDash(o.getLineDash()),l.lineDashOffset=o.lineDashOffset)}function resetCtxToDefault(o){if(o.strokeStyle=o.fillStyle="#000000",o.fillRule="nonzero",o.globalAlpha=1,o.lineWidth=1,o.lineCap="butt",o.lineJoin="miter",o.miterLimit=10,o.globalCompositeOperation="source-over",o.font="10px sans-serif",void 0!==o.setLineDash&&(o.setLineDash([]),o.lineDashOffset=0),!A.isNodeJS){let{filter:l}=o;"none"!==l&&""!==l&&(o.filter="none")}}function composeSMaskBackdrop(o,l,u,A){let S=o.length;for(let E=3;E<S;E+=4){let S=o[E];if(0===S)o[E-3]=l,o[E-2]=u,o[E-1]=A;else if(S<255){let C=255-S;o[E-3]=o[E-3]*S+l*C>>8,o[E-2]=o[E-2]*S+u*C>>8,o[E-1]=o[E-1]*S+A*C>>8}}}function composeSMaskAlpha(o,l,u){let A=o.length,S=1/255;for(let E=3;E<A;E+=4){let A=u?u[o[E]]:o[E];l[E]=l[E]*A*S|0}}function composeSMaskLuminosity(o,l,u){let A=o.length;for(let S=3;S<A;S+=4){let A=77*o[S-3]+152*o[S-2]+28*o[S-1];l[S]=u?l[S]*u[A>>8]>>8:l[S]*A>>16}}function genericComposeSMask(o,l,u,A,S,E,C,T,P,M,F){let R=!!E,D=R?E[0]:0,I=R?E[1]:0,L=R?E[2]:0,O="Luminosity"===S?composeSMaskLuminosity:composeSMaskAlpha,N=1048576,B=Math.min(A,Math.ceil(N/u));for(let S=0;S<A;S+=B){let E=Math.min(B,A-S),N=o.getImageData(T-M,S+(P-F),u,E),U=l.getImageData(T,S+P,u,E);R&&composeSMaskBackdrop(N.data,D,I,L),O(N.data,U.data,C),l.putImageData(U,T,S+P)}}function composeSMask(o,l,u,A){let S=A[0],E=A[1],C=A[2]-S,T=A[3]-E;0!==C&&0!==T&&(genericComposeSMask(l.context,u,C,T,l.subtype,l.backdrop,l.transferMap,S,E,l.offsetX,l.offsetY),o.save(),o.globalAlpha=1,o.globalCompositeOperation="source-over",o.setTransform(1,0,0,1,0,0),o.drawImage(u.canvas,0,0),o.restore(
22))}function getImageSmoothingEnabled(o,l){let u=A.Util.singularValueDecompose2dScale(o);u[0]=Math.fround(u[0]),u[1]=Math.fround(u[1]);let E=Math.fround((globalThis.devicePixelRatio||1)*S.PixelsPerInch.PDF_TO_CSS_UNITS);return void 0!==l?l:u[0]<=E||u[1]<=E}let L=["butt","round","square"],O=["miter","round","bevel"],N={},B={};let CanvasGraphics=class CanvasGraphics{constructor(o,l,u,A,S,{optionalContentConfig:E,markedContentStack:C=null},T,P){this.ctx=o,this.current=new CanvasExtraState(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=l,this.objs=u,this.canvasFactory=A,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=C||[],this.optionalContentConfig=E,this.cachedCanvases=new CachedCanvases(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=T,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=P,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(o,l=null){return"string"==typeof o?o.startsWith("g_")?this.commonObjs.get(o):this.objs.get(o):l}beginDrawing({transform:o,viewport:l,transparency:u=!1,background:A=null}){let E=this.ctx.canvas.width,C=this.ctx.canvas.height,T=this.ctx.fillStyle;if(this.ctx.fillStyle=A||"#ffffff",this.ctx.fillRect(0,0,E,C),this.ctx.fillStyle=T,u){let o=this.cachedCanvases.getCanvas("transparent",E,C);this.compositeCtx=this.ctx,this.transparentCanvas=o.canvas,this.ctx=o.context,this.ctx.save(),this.ctx.transform(...(0,S.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),resetCtxToDefault(this.ctx),o&&(this.ctx.transform(...o),this.outputScaleX=o[0],this.outputScaleY=o[0]),this.ctx.transform(...l.transform),this.viewportScale=l.scale,this.baseTransform=(0,S.getCurrentTransform)(this.ctx)}executeOperatorList(o,l,u,S){let E;let C=o.argsArray,T=o.fnArray,P=l||0,M=C.length;if(M===P)return P;let D=M-P>R&&"function"==typeof u,I=D?Date.now()+F:0,L=0,O=this.commonObjs,N=this.objs;for(;;){if(void 0!==S&&P===S.nextBreakPoint)return S.breakIt(P,u),P;if((E=T[P])!==A.OPS.dependency)this[E].apply(this,C[P]);else for(let o of C[P]){let l=o.startsWith("g_")?O:N;if(!l.has(o))return l.get(o,u),P}if(++P===M)return P;if(D&&++L>R){if(Date.now()>I)return u(),P;L=0}}}#t9(){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(){for(let o of(this.#t9(),this.cachedCanvases.clear(),this.cachedPatterns.clear(),this._cachedBitmapsMap.values())){for(let l of o.values())"undefined"!=typeof HTMLCanvasElement&&l instanceof HTMLCanvasElement&&(l.width=l.height=0);o.clear()}this._cachedBitmapsMap.clear(),this.#et()}#et(){if(this.pageColors){let o=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==o){let l=this.ctx.filter;this.ctx.filter=o,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=l}}}_scaleImage(o,l){let u,A;let S=o.width,E=o.height,C=Math.max(Math.hypot(l[0],l[1]),1),T=Math.max(Math.hypot(l[2],l[3]),1),P=S,M=E,F="prescale1";for(;C>2&&P>1||T>2&&M>1;){let l=P,S=M;C>2&&P>1&&(l=P>=16384?Math.floor(P/2)-1||1:Math.ceil(P/2),C/=P/l),T>2&&M>1&&(S=M>=16384?Math.floor(M/2)-1||1:Math.ceil(M)/2,T/=M/S),(A=(u=this.cachedCanvases.getCanvas(F,l,S)).context).clearRect(0,0,l,S),A.drawImage(o,0,0,P,M,0,0,l,S),o=u.canvas,P=l,M=S,F="prescale1"===F?"prescale2":"prescale1"}return{img:o,paintWidth:P,paintHeight:M}}_createMaskCanvas(o){let l,u,C,T;let P=this.ctx,{width:M,height:F}=o,R=this.current.fillColor,D=this.current.patternFill,I=(0,S.getCurrentTransform)(P);if((o.bitmap||o.data)&&o.count>1){let A=o.bitmap||o.data.buffer;u=JSON.stringify(D?I:[I.slice(0,4),R]),(l=this._cachedBitmapsMap.get(A))||(l=new Map,this._cachedBitmapsMap.set(A,l));let S=l.get(u);if(S&&!D){let o=Math.round(Math.min(I[0],I[2])+I[4]),l=Math.round(Math.min(I[1],I[3])+I[5]);return{canvas:S,offsetX:o,offsetY:l}}C=S}C||putBinaryImageMask((T=this.cachedCanvases.getCanvas("maskCanvas",M,F)).context,o);let L=A.Util.transform(I,[1/M,0,0,-1/F,0,0]);L=A.Util.transform(L,[1,0,0,1,0,-F]);let O=A.Util.applyTransform([0,0],L),N=A.Util.applyTransform([M,F],L),B=A.Util.normalizeRect([O[0],O[1],N[0],N[1]]),U=Math.round(B[2]-B[0])||1,H=Math.round(B[3]-B[1])||1,z=this.cachedCanvases.getCanvas("fillCanvas",U,H),V=z.context,W=Math.min(O[0],N[0]),$=Math.min(O[1],N[1]);V.translate(-W,-$),V.transform(...L),!C&&(C=(C=this._scaleImage(T.canvas,(0,S.getCurrentTransformInverse)(V))).img,l&&D&&l.set(u,C)),V.imageSmoothingEnabled=getImageSmoothingEnabled((0,S.getCurrentTransform)(V),o.interpolate),drawImageAtIntegerCoords(V,C,0,0,C.width,C.height,0,0,M,F),V.globalCompositeOperation="source-in";let X=A.Util.transform((0,S.getCurrentTransformInverse)(V),[1,0,0,1,-W,-$]);return V.fillStyle=D?R.getPattern(P,this,X,E.PathType.FILL):R,V.fillRect(0,0,M,F),l&&!D&&(this.cachedCanvases.delete("fillCanvas"),l.set(u,z.canvas)),{canvas:z.canvas,offsetX:Math.round(W),offsetY:Math.round($)}}setLineWidth(o){o!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=o,this.ctx.lineWidth=o}setLineCap(o){this.ctx.lineCap=L[o]}setLineJoin(o){this.ctx.lineJoin=O[o]}setMiterLimit(o){this.ctx.miterLimit=o}setDash(o,l){let u=this.ctx;void 0!==u.setLineDash&&(u.setLineDash(o),u.lineDashOffset=l)}
22setRenderingIntent(o){}setFlatness(o){}setGState(o){for(let[l,u]of o)switch(l){case"LW":this.setLineWidth(u);break;case"LC":this.setLineCap(u);break;case"LJ":this.setLineJoin(u);break;case"ML":this.setMiterLimit(u);break;case"D":this.setDash(u[0],u[1]);break;case"RI":this.setRenderingIntent(u);break;case"FL":this.setFlatness(u);break;case"Font":this.setFont(u[0],u[1]);break;case"CA":this.current.strokeAlpha=u;break;case"ca":this.current.fillAlpha=u,this.ctx.globalAlpha=u;break;case"BM":this.ctx.globalCompositeOperation=u;break;case"SMask":this.current.activeSMask=u?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(u)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){let o=this.inSMaskMode;this.current.activeSMask&&!o?this.beginSMaskMode():!this.current.activeSMask&&o&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw Error("beginSMaskMode called while already in smask mode");let o=this.ctx.canvas.width,l=this.ctx.canvas.height,u="smaskGroupAt"+this.groupLevel,A=this.cachedCanvases.getCanvas(u,o,l);this.suspendedCtx=this.ctx,this.ctx=A.context;let E=this.ctx;E.setTransform(...(0,S.getCurrentTransform)(this.suspendedCtx)),copyCtxState(this.suspendedCtx,E),mirrorContextOperations(E,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),copyCtxState(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(o){if(!this.current.activeSMask)return;o?(o[0]=Math.floor(o[0]),o[1]=Math.floor(o[1]),o[2]=Math.ceil(o[2]),o[3]=Math.ceil(o[3])):o=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let l=this.current.activeSMask,u=this.suspendedCtx;composeSMask(u,l,this.ctx,o),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?(copyCtxState(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();let o=this.current;this.stateStack.push(o),this.current=o.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),copyCtxState(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(o,l,u,A,S,E){this.ctx.transform(o,l,u,A,S,E),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(o,l,u){let E,C;let T=this.ctx,P=this.current,M=P.x,F=P.y,R=(0,S.getCurrentTransform)(T),D=0===R[0]&&0===R[3]||0===R[1]&&0===R[2],I=D?u.slice(0):null;for(let u=0,S=0,L=o.length;u<L;u++)switch(0|o[u]){case A.OPS.rectangle:M=l[S++],F=l[S++];let L=l[S++],O=l[S++],N=M+L,B=F+O;T.moveTo(M,F),0===L||0===O?T.lineTo(N,B):(T.lineTo(N,F),T.lineTo(N,B),T.lineTo(M,B)),D||P.updateRectMinMax(R,[M,F,N,B]),T.closePath();break;case A.OPS.moveTo:M=l[S++],F=l[S++],T.moveTo(M,F),D||P.updatePathMinMax(R,M,F);break;case A.OPS.lineTo:M=l[S++],F=l[S++],T.lineTo(M,F),D||P.updatePathMinMax(R,M,F);break;case A.OPS.curveTo:E=M,C=F,M=l[S+4],F=l[S+5],T.bezierCurveTo(l[S],l[S+1],l[S+2],l[S+3],M,F),P.updateCurvePathMinMax(R,E,C,l[S],l[S+1],l[S+2],l[S+3],M,F,I),S+=6;break;case A.OPS.curveTo2:E=M,C=F,T.bezierCurveTo(M,F,l[S],l[S+1],l[S+2],l[S+3]),P.updateCurvePathMinMax(R,E,C,M,F,l[S],l[S+1],l[S+2],l[S+3],I),M=l[S+2],F=l[S+3],S+=4;break;case A.OPS.curveTo3:E=M,C=F,M=l[S+2],F=l[S+3],T.bezierCurveTo(l[S],l[S+1],M,F,M,F),P.updateCurvePathMinMax(R,E,C,l[S],l[S+1],M,F,M,F,I),S+=4;break;case A.OPS.closePath:T.closePath()}D&&P.updateScalingPathMinMax(R,I),P.setCurrentPoint(M,F)}closePath(){this.ctx.closePath()}stroke(o=!0){let l=this.ctx,u=this.current.strokeColor;l.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"==typeof u&&u?.getPattern?(l.save(),l.strokeStyle=u.getPattern(l,this,(0,S.getCurrentTransformInverse)(l),E.PathType.STROKE),this.rescaleAndStroke(!1),l.restore(
22)):this.rescaleAndStroke(!0)),o&&this.consumePath(this.current.getClippedPathBoundingBox()),l.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(o=!0){let l=this.ctx,u=this.current.fillColor,A=this.current.patternFill,C=!1;A&&(l.save(),l.fillStyle=u.getPattern(l,this,(0,S.getCurrentTransformInverse)(l),E.PathType.FILL),C=!0);let T=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==T&&(this.pendingEOFill?(l.fill("evenodd"),this.pendingEOFill=!1):l.fill()),C&&l.restore(),o&&this.consumePath(T)}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=N}eoClip(){this.pendingClip=B}beginText(){this.current.textMatrix=A.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){let o=this.pendingTextPaths,l=this.ctx;if(void 0===o){l.beginPath();return}for(let u of(l.save(),l.beginPath(),o))l.setTransform(...u.transform),l.translate(u.x,u.y),u.addToPath(l,u.fontSize);l.restore(),l.clip(),l.beginPath(),delete this.pendingTextPaths}setCharSpacing(o){this.current.charSpacing=o}setWordSpacing(o){this.current.wordSpacing=o}setHScale(o){this.current.textHScale=o/100}setLeading(o){this.current.leading=-o}setFont(o,l){let u=this.commonObjs.get(o),S=this.current;if(!u)throw Error(`Can't find font for ${o}`);if(S.fontMatrix=u.fontMatrix||A.FONT_IDENTITY_MATRIX,(0===S.fontMatrix[0]||0===S.fontMatrix[3])&&(0,A.warn)("Invalid font matrix for font "+o),l<0?(l=-l,S.fontDirection=-1):S.fontDirection=1,this.current.font=u,this.current.fontSize=l,u.isType3Font)return;let E=u.loadedName||"sans-serif",C=u.systemFontInfo?.css||`"${E}", ${u.fallbackName}`,M="normal";u.black?M="900":u.bold&&(M="bold");let F=u.italic?"italic":"normal",R=l;l<T?R=T:l>P&&(R=P),this.current.fontSizeScale=l/R,this.ctx.font=`${F} ${M} ${R}px ${C}`}setTextRenderingMode(o){this.current.textRenderingMode=o}setTextRise(o){this.current.textRise=o}moveText(o,l){this.current.x=this.current.lineX+=o,this.current.y=this.current.lineY+=l}setLeadingMoveText(o,l){this.setLeading(-l),this.moveText(o,l)}setTextMatrix(o,l,u,A,S,E){this.current.textMatrix=[o,l,u,A,S,E],this.current.textMatrixScale=Math.hypot(o,l),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(o,l,u,E){let C;let T=this.ctx,P=this.current,M=P.font,F=P.textRenderingMode,R=P.fontSize/P.fontSizeScale,D=F&A.TextRenderingMode.FILL_STROKE_MASK,I=!!(F&A.TextRenderingMode.ADD_TO_PATH_FLAG),L=P.patternFill&&!M.missingFile;if((M.disableFontFace||I||L)&&(C=M.getPathGenerator(this.commonObjs,o)),M.disableFontFace||L?(T.save(),T.translate(l,u),T.beginPath(),C(T,R),E&&T.setTransform(...E),(D===A.TextRenderingMode.FILL||D===A.TextRenderingMode.FILL_STROKE)&&T.fill(),(D===A.TextRenderingMode.STROKE||D===A.TextRenderingMode.FILL_STROKE)&&T.stroke(),T.restore()):((D===A.TextRenderingMode.FILL||D===A.TextRenderingMode.FILL_STROKE)&&T.fillText(o,l,u),(D===A.TextRenderingMode.STROKE||D===A.TextRenderingMode.FILL_STROKE)&&T.strokeText(o,l,u)),I){let o=this.pendingTextPaths||=[];o.push({transform:(0,S.getCurrentTransform)(T),x:l,y:u,fontSize:R,addToPath:C})}}get isFontSubpixelAAEnabled(){let{context:o}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);o.scale(1.5,1),o.fillText("I",0,10);let l=o.getImageData(0,0,10,10).data,u=!1;for(let o=3;o<l.length;o+=4)if(l[o]>0&&l[o]<255){u=!0;break}return(0,A.shadow)(this,"isFontSubpixelAAEnabled",u)}showText(o){let l;let u=this.current,C=u.font;if(C.isType3Font)return this.showType3Text(o);let T=u.fontSize;if(0===T)return;let P=this.ctx,M=u.fontSizeScale,F=u.charSpacing,R=u.wordSpacing,D=u.fontDirection,I=u.textHScale*D,L=o.length,O=C.vertical,N=O?1:-1,B=C.defaultVMetrics,U=T*u.fontMatrix[0],H=u.textRenderingMode===A.TextRenderingMode.FILL&&!C.disableFontFace&&!u.patternFill;if(P.save(),P.transform(...u.textMatrix),P.translate(u.x,u.y+u.textRise),D>0?P.scale(I,-1):P.scale(I,1),u.patternFill){P.save();let o=u.fillColor.getPattern(P,this,(0,S.getCurrentTransformInverse)(P),E.PathType.FILL);
22l=(0,S.getCurrentTransform)(P),P.restore(),P.fillStyle=o}let z=u.lineWidth,V=u.textMatrixScale;if(0===V||0===z){let o=u.textRenderingMode&A.TextRenderingMode.FILL_STROKE_MASK;(o===A.TextRenderingMode.STROKE||o===A.TextRenderingMode.FILL_STROKE)&&(z=this.getSinglePixelWidth())}else z/=V;if(1!==M&&(P.scale(M,M),z/=M),P.lineWidth=z,C.isInvalidPDFjsFont){let l=[],A=0;for(let u of o)l.push(u.unicode),A+=u.width;P.fillText(l.join(""),0,0),u.x+=A*U*I,P.restore(),this.compose();return}let W=0,$;for($=0;$<L;++$){let u,A;let S=o[$];if("number"==typeof S){W+=N*S*T/1e3;continue}let E=!1,I=(S.isSpace?R:0)+F,L=S.fontChar,z=S.accent,V=S.width;if(O){let o=S.vmetric||B,l=-(S.vmetric?o[1]:.5*V)*U,E=o[2]*U;V=o?-o[0]:V,u=l/M,A=(W+E)/M}else u=W/M,A=0;if(C.remeasure&&V>0){let o=1e3*P.measureText(L).width/T*M;if(V<o&&this.isFontSubpixelAAEnabled){let l=V/o;E=!0,P.save(),P.scale(l,1),u/=l}else V!==o&&(u+=(V-o)/2e3*T/M)}if(this.contentVisible&&(S.isInFont||C.missingFile)){if(H&&!z)P.fillText(L,u,A);else if(this.paintChar(L,u,A,l),z){let o=u+T*z.offset.x/M,S=A-T*z.offset.y/M;this.paintChar(z.fontChar,o,S,l)}}let X=O?V*U-I*D:V*U+I*D;W+=X,E&&P.restore()}O?u.y-=W:u.x+=W*I,P.restore(),this.compose()}showType3Text(o){let l,u,S,E;let C=this.ctx,T=this.current,P=T.font,M=T.fontSize,F=T.fontDirection,R=P.vertical?1:-1,D=T.charSpacing,I=T.wordSpacing,L=T.textHScale*F,O=T.fontMatrix||A.FONT_IDENTITY_MATRIX,N=o.length,B=T.textRenderingMode===A.TextRenderingMode.INVISIBLE;if(!B&&0!==M){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,C.save(),C.transform(...T.textMatrix),C.translate(T.x,T.y),C.scale(L,F),l=0;l<N;++l){if("number"==typeof(u=o[l])){E=R*u*M/1e3,this.ctx.translate(E,0),T.x+=E*L;continue}let F=(u.isSpace?I:0)+D,N=P.charProcOperatorList[u.operatorListId];if(!N){(0,A.warn)(`Type3 character "${u.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=u,this.save(),C.scale(M,M),C.transform(...O),this.executeOperatorList(N),this.restore());let B=A.Util.applyTransform([u.width,0],O);S=B[0]*M+F,C.translate(S,0),T.x+=S*L}
22C.restore(),this.processingType3=null}}setCharWidth(o,l){}setCharWidthAndBounds(o,l,u,A,S,E){this.ctx.rect(u,A,S-u,E-A),this.ctx.clip(),this.endPath()}getColorN_Pattern(o){let l;if("TilingPattern"===o[0]){let u=o[1],A=this.baseTransform||(0,S.getCurrentTransform)(this.ctx),C={createCanvasGraphics:o=>new CanvasGraphics(o,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};l=new E.TilingPattern(o,u,this.ctx,C,A)}else l=this._getPattern(o[1],o[2]);return l}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(o,l,u){let S=A.Util.makeHexColor(o,l,u);this.ctx.strokeStyle=S,this.current.strokeColor=S}setFillRGBColor(o,l,u){let S=A.Util.makeHexColor(o,l,u);this.ctx.fillStyle=S,this.current.fillColor=S,this.current.patternFill=!1}_getPattern(o,l=null){let u;return this.cachedPatterns.has(o)?u=this.cachedPatterns.get(o):(u=(0,E.getShadingPattern)(this.getObject(o)),this.cachedPatterns.set(o,u)),l&&(u.matrix=l),u}shadingFill(o){if(!this.contentVisible)return;let l=this.ctx;this.save();let u=this._getPattern(o);l.fillStyle=u.getPattern(l,this,(0,S.getCurrentTransformInverse)(l),E.PathType.SHADING);let C=(0,S.getCurrentTransformInverse)(l);if(C){let{width:o,height:u}=l.canvas,[S,E,T,P]=A.Util.getAxialAlignedBoundingBox([0,0,o,u],C);this.ctx.fillRect(S,E,T-S,P-E)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){(0,A.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,A.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(o,l){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(o)&&6===o.length&&this.transform(...o),this.baseTransform=(0,S.getCurrentTransform)(this.ctx),l)){let o=l[2]-l[0],u=l[3]-l[1];this.ctx.rect(l[0],l[1],o,u),this.current.updateRectMinMax((0,S.getCurrentTransform)(this.ctx),l),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(o){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);let l=this.ctx;o.isolated||(0,A.info)("TODO: Support non-isolated groups."),o.knockout&&(0,A.warn)("Knockout groups not supported.");let u=(0,S.getCurrentTransform)(l);if(o.matrix&&l.transform(...o.matrix),!o.bbox)throw Error("Bounding box is required.");let E=A.Util.getAxialAlignedBoundingBox(o.bbox,(0,S.getCurrentTransform)(l)),C=[0,0,l.canvas.width,l.canvas.height];E=A.Util.intersect(E,C)||[0,0,0,0];let T=Math.floor(E[0]),P=Math.floor(E[1]),F=Math.max(Math.ceil(E[2])-T,1),R=Math.max(Math.ceil(E[3])-P,1),D=1,I=1;F>M&&(D=F/M,F=M),R>M&&(I=R/M,R=M),this.current.startNewPathAndClipBox([0,0,F,R]);let L="groupAt"+this.groupLevel;o.smask&&(L+="_smask_"+this.smaskCounter++%2);let O=this.cachedCanvases.getCanvas(L,F,R),N=O.context;N.scale(1/D,1/I),N.translate(-T,-P),N.transform(...u),o.smask?this.smaskStack.push({canvas:O.canvas,context:N,offsetX:T,offsetY:P,scaleX:D,scaleY:I,subtype:o.smask.subtype,backdrop:o.smask.backdrop,transferMap:o.smask.transferMap||null,startTransformInverse:null}):(l.setTransform(1,0,0,1,0,0),l.translate(T,P),l.scale(D,I),l.save()),copyCtxState(l,N),this.ctx=N,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(l),this.groupLevel++}endGroup(o){if(!this.contentVisible)return;this.groupLevel--;let l=this.ctx,u=this.groupStack.pop();if(this.ctx=u,this.ctx.imageSmoothingEnabled=!1,o.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();let o=(0,S.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...o);let u=A.Util.getAxialAlignedBoundingBox([0,0,l.canvas.width,l.canvas.height],o);this.ctx.drawImage(l.canvas,0,0),this.ctx.restore(),this.compose(u)}}beginAnnotation(o,l,u,E,C){if(this.#t9(),resetCtxToDefault(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(l)&&4===l.length){let E=l[2]-l[0],T=l[3]-l[1];if(C&&this.annotationCanvasMap){u=u.slice(),u[4]-=l[0],u[5]-=l[1],(l=l.slice())[0]=l[1]=0,l[2]=E,l[3]=T;let[C,P]=A.Util.singularValueDecompose2dScale((0,S.getCurrentTransform)(this.ctx)),{viewportScale:M}=this,F=Math.ceil(E*this.outputScaleX*M),R=Math.ceil(T*this.outputScaleY*M);this.annotationCanvas=this.canvasFactory.create(F,R);let{canvas:D,context:I}=this.annotationCanvas;this.annotationCanvasMap.set(o,D),this.annotationCanvas.savedCtx=this.ctx,this.ctx=I,this.ctx.save(),this.ctx.setTransform(C,0,0,-P,0,T*P),resetCtxToDefault(this.ctx)}else resetCtxToDefault(this.ctx),this.ctx.rect(l[0],l[1],E,T),this.ctx.clip(),this.endPath()}
22this.current=new CanvasExtraState(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...u),this.transform(...E)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#et(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(o){if(!this.contentVisible)return;let l=o.count;(o=this.getObject(o.data,o)).count=l;let u=this.ctx,A=this.processingType3;if(A&&(void 0===A.compiled&&(A.compiled=compileType3Glyph(o)),A.compiled)){A.compiled(u);return}let S=this._createMaskCanvas(o),E=S.canvas;u.save(),u.setTransform(1,0,0,1,0,0),u.drawImage(E,S.offsetX,S.offsetY),u.restore(),this.compose()}paintImageMaskXObjectRepeat(o,l,u=0,E=0,C,T){if(!this.contentVisible)return;o=this.getObject(o.data,o);let P=this.ctx;P.save();let M=(0,S.getCurrentTransform)(P);P.transform(l,u,E,C,0,0);let F=this._createMaskCanvas(o);P.setTransform(1,0,0,1,F.offsetX-M[4],F.offsetY-M[5]);for(let o=0,S=T.length;o<S;o+=2){let S=A.Util.transform(M,[l,u,E,C,T[o],T[o+1]]),[R,D]=A.Util.applyTransform([0,0],S);P.drawImage(F.canvas,R,D)}P.restore(),this.compose()}paintImageMaskXObjectGroup(o){if(!this.contentVisible)return;let l=this.ctx,u=this.current.fillColor,A=this.current.patternFill;for(let C of o){let{data:o,width:T,height:P,transform:M}=C,F=this.cachedCanvases.getCanvas("maskCanvas",T,P),R=F.context;R.save();let D=this.getObject(o,C);putBinaryImageMask(R,D),R.globalCompositeOperation="source-in",R.fillStyle=A?u.getPattern(R,this,(0,S.getCurrentTransformInverse)(l),E.PathType.FILL):u,R.fillRect(0,0,T,P),R.restore(),l.save(),l.transform(...M),l.scale(1,-1),drawImageAtIntegerCoords(l,F.canvas,0,0,T,P,0,-1,1,1),l.restore()}this.compose()}paintImageXObject(o){if(!this.contentVisible)return;let l=this.getObject(o);if(!l){(0,A.warn)("Dependent image isn't ready yet");return}this.paintInlineImageXObject(l)}paintImageXObjectRepeat(o,l,u,S){if(!this.contentVisible)return;let E=this.getObject(o);if(!E){(0,A.warn)("Dependent image isn't ready yet");return}let C=E.width,T=E.height,P=[];for(let o=0,A=S.length;o<A;o+=2)P.push({transform:[l,0,0,u,S[o],S[o+1]],x:0,y:0,w:C,h:T});this.paintInlineImageXObjectGroup(E,P)}applyTransferMapsToCanvas(o){return"none"!==this.current.transferMaps&&(o.filter=this.current.transferMaps,o.drawImage(o.canvas,0,0),o.filter="none"),o.canvas}applyTransferMapsToBitmap(o){if("none"===this.current.transferMaps)return o.bitmap;let{bitmap:l,width:u,height:A}=o,S=this.cachedCanvases.getCanvas("inlineImage",u,A),E=S.context;return E.filter=this.current.transferMaps,E.drawImage(l,0,0),E.filter="none",S.canvas}paintInlineImageXObject(o){let l;if(!this.contentVisible)return;let u=o.width,E=o.height,C=this.ctx;if(this.save(),!A.isNodeJS){let{filter:o}=C;"none"!==o&&""!==o&&(C.filter="none")}if(C.scale(1/u,-1/E),o.bitmap)l=this.applyTransferMapsToBitmap(o);else if("function"==typeof HTMLElement&&o instanceof HTMLElement||!o.data)l=o;else{let A=this.cachedCanvases.getCanvas("inlineImage",u,E),S=A.context;putBinaryImageData(S,o),l=this.applyTransferMapsToCanvas(S)}let T=this._scaleImage(l,(0,S.getCurrentTransformInverse)(C));C.imageSmoothingEnabled=getImageSmoothingEnabled((0,S.getCurrentTransform)(C),o.interpolate),drawImageAtIntegerCoords(C,T.img,0,0,T.paintWidth,T.paintHeight,0,-E,u,E),this.compose(),this.restore()}paintInlineImageXObjectGroup(o,l){let u;if(!this.contentVisible)return;let A=this.ctx;if(o.bitmap)u=o.bitmap;else{let l=o.width,A=o.height,S=this.cachedCanvases.getCanvas("inlineImage",l,A),E=S.context;putBinaryImageData(E,o),u=this.applyTransferMapsToCanvas(E)}for(let o of l)A.save(),A.transform(...o.transform),A.scale(1,-1),drawImageAtIntegerCoords(A,u,o.x,o.y,o.w,o.h,0,-1,1,1),A.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(o){}markPointProps(o,l){}beginMarkedContent(o){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(o,l){"OC"===o?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(l)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(o){let l=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(o);let u=this.ctx;this.pendingClip&&(l||(this.pendingClip===B?u.clip("evenodd"):u.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),u.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let o=(0,S.getCurrentTransform)(this.ctx);if(0===o[1]&&0===o[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(o[0]),Math.abs(o[3]));
22else{let l=Math.abs(o[0]*o[3]-o[2]*o[1]),u=Math.hypot(o[0],o[2]),A=Math.hypot(o[1],o[3]);this._cachedGetSinglePixelWidth=Math.max(u,A)/l}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){let o,l;let{lineWidth:u}=this.current,{a:A,b:S,c:E,d:C}=this.ctx.getTransform();if(0===S&&0===E){let S=Math.abs(A),E=Math.abs(C);if(S===E){if(0===u)o=l=1/S;else{let A=S*u;o=l=A<1?1/A:1}}else if(0===u)o=1/S,l=1/E;else{let A=S*u,C=E*u;o=A<1?1/A:1,l=C<1?1/C:1}}else{let T=Math.abs(A*C-S*E),P=Math.hypot(A,S),M=Math.hypot(E,C);if(0===u)o=M/T,l=P/T;else{let A=u*T;o=M>A?M/A:1,l=P>A?P/A:1}}this._cachedScaleForStroking[0]=o,this._cachedScaleForStroking[1]=l}return this._cachedScaleForStroking}rescaleAndStroke(o){let{ctx:l}=this,{lineWidth:u}=this.current,[A,S]=this.getScaleForStroking();if(l.lineWidth=u||1,1===A&&1===S){l.stroke();return}let E=l.getLineDash();if(o&&l.save(),l.scale(A,S),E.length>0){let o=Math.max(A,S);l.setLineDash(E.map(l=>l/o)),l.lineDashOffset/=o}l.stroke(),o&&l.restore()}isContentVisible(){for(let o=this.markedContentStack.length-1;o>=0;o--)if(!this.markedContentStack[o].visible)return!1;return!0}};for(let o in l.CanvasGraphics=CanvasGraphics,A.OPS)void 0!==CanvasGraphics.prototype[o]&&(CanvasGraphics.prototype[A.OPS[o]]=CanvasGraphics.prototype[o])},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TilingPattern=l.PathType=void 0,l.getShadingPattern=getShadingPattern;var A=u(1),S=u(6);let E={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function applyBoundingBox(o,l){if(!l)return;let u=l[2]-l[0],A=l[3]-l[1],S=new Path2D;S.rect(l[0],l[1],u,A),o.clip(S)}l.PathType=E;let BaseShadingPattern=class BaseShadingPattern{constructor(){this.constructor===BaseShadingPattern&&(0,A.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,A.unreachable)("Abstract method `getPattern` called.")}};let RadialAxialShadingPattern=class RadialAxialShadingPattern extends BaseShadingPattern{constructor(o){super(),this._type=o[1],this._bbox=o[2],this._colorStops=o[3],this._p0=o[4],this._p1=o[5],this._r0=o[6],this._r1=o[7],this.matrix=null}_createGradient(o){let l;for(let u of("axial"===this._type?l=o.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(l=o.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1)),this._colorStops))l.addColorStop(u[0],u[1]);return l}getPattern(o,l,u,C){let T;if(C===E.STROKE||C===E.FILL){let E=l.current.getClippedPathBoundingBox(C,(0,S.getCurrentTransform)(o))||[0,0,0,0],P=Math.ceil(E[2]-E[0])||1,M=Math.ceil(E[3]-E[1])||1,F=l.cachedCanvases.getCanvas("pattern",P,M,!0),R=F.context;R.clearRect(0,0,R.canvas.width,R.canvas.height),R.beginPath(),R.rect(0,0,R.canvas.width,R.canvas.height),R.translate(-E[0],-E[1]),u=A.Util.transform(u,[1,0,0,1,E[0],E[1]]),R.transform(...l.baseTransform),this.matrix&&R.transform(...this.matrix),applyBoundingBox(R,this._bbox),R.fillStyle=this._createGradient(R),R.fill(),T=o.createPattern(F.canvas,"no-repeat");let D=new DOMMatrix(u);T.setTransform(D)}else applyBoundingBox(o,this._bbox),T=this._createGradient(o);return T}};function drawTriangle(o,l,u,A,S,E,C,T){let P,M,F,R,D,I,L,O,N;let B=l.coords,U=l.colors,H=o.data,z=4*o.width;B[u+1]>B[A+1]&&(P=u,u=A,A=P,P=E,E=C,C=P),B[A+1]>B[S+1]&&(P=A,A=S,S=P,P=C,C=T,T=P),B[u+1]>B[A+1]&&(P=u,u=A,A=P,P=E,E=C,C=P);let V=(B[u]+l.offsetX)*l.scaleX,W=(B[u+1]+l.offsetY)*l.scaleY,$=(B[A]+l.offsetX)*l.scaleX,X=(B[A+1]+l.offsetY)*l.scaleY,K=(B[S]+l.offsetX)*l.scaleX,Y=(B[S+1]+l.offsetY)*l.scaleY;if(W>=Y)return;let J=U[E],Q=U[E+1],Z=U[E+2],tt=U[C],te=U[C+1],ti=U[C+2],ts=U[T],tr=U[T+1],ta=U[T+2],tn=Math.round(W),to=Math.round(Y);for(let o=tn;o<=to;o++){let l;if(o<X){let l=o<W?0:(W-o)/(W-X);M=V-(V-$)*l,F=J-(J-tt)*l,R=Q-(Q-te)*l,D=Z-(Z-ti)*l}else{let l;M=$-($-K)*(l=o>Y?1:X===Y?0:(X-o)/(X-Y)),F=tt-(tt-ts)*l,R=te-(te-tr)*l,D=ti-(ti-ta)*l}I=V-(V-K)*(l=o<W?0:o>Y?1:(W-o)/(W-Y)),L=J-(J-ts)*l,O=Q-(Q-tr)*l,N=Z-(Z-ta)*l;let u=Math.round(Math.min(M,I)),A=Math.round(Math.max(M,I)),S=z*o+4*u;for(let o=u;o<=A;o++)(l=(M-o)/(M-I))<0?l=0:l>1&&(l=1),H[S++]=F-(F-L)*l|0,H[S++]=R-(R-O)*l|0,H[S++]=D-(D-N)*l|0,H[S++]=255}}function drawFigure(o,l,u){let A,S;let E=l.coords,C=l.colors;switch(l.type){case"lattice":let T=l.verticesPerRow,P=Math.floor(E.length/T)-1,M=T-1;for(A=0;A<P;A++){let l=A*T;for(let A=0;A<M;A++,l++)drawTriangle(o,u,E[l],E[l+1],E[l+T],C[l],C[l+1],C[l+T]),drawTriangle(o,u,E[l+T+1],E[l+1],E[l+T],C[l+T+1],C[l+1],C[l+T])}break;case"triangles":for(A=0,S=E.length;A<S;A+=3)drawTriangle(o,u,E[A],E[A+1],E[A+2],C[A],C[A+1],C[A+2]);break;default:throw Error("illegal figure")}}let MeshShadingPattern=class MeshShadingPattern extends BaseShadingPattern{constructor(o){super(),this._coords=o[2],this._colors=o[3],this._figures=o[4],this._bounds=o[5],this._bbox=o[7],this._background=o[8],this.matrix=null}_createMeshCanvas(o,l,u){let A=1.1,S=3e3,E=2,C=Math.floor(this._bounds[0]),T=Math.floor(this._bounds[1]),P=Math.ceil(this._bounds[2])-C,M=Math.ceil(this._bounds[3])-T,F=Math.min(Math.ceil(Math.abs(P*o[0]*A)),S),R=Math.min(Math.ceil(Math.abs(M*o[1]*A)),S),D=P/F,I=M/R,L={co
22ords:this._coords,colors:this._colors,offsetX:-C,offsetY:-T,scaleX:1/D,scaleY:1/I},O=F+2*E,N=R+2*E,B=u.getCanvas("mesh",O,N,!1),U=B.context,H=U.createImageData(F,R);if(l){let o=H.data;for(let u=0,A=o.length;u<A;u+=4)o[u]=l[0],o[u+1]=l[1],o[u+2]=l[2],o[u+3]=255}for(let o of this._figures)drawFigure(H,o,L);U.putImageData(H,E,E);let z=B.canvas;return{canvas:z,offsetX:C-E*D,offsetY:T-E*I,scaleX:D,scaleY:I}}getPattern(o,l,u,C){let T;if(applyBoundingBox(o,this._bbox),C===E.SHADING)T=A.Util.singularValueDecompose2dScale((0,S.getCurrentTransform)(o));else if(T=A.Util.singularValueDecompose2dScale(l.baseTransform),this.matrix){let o=A.Util.singularValueDecompose2dScale(this.matrix);T=[T[0]*o[0],T[1]*o[1]]}let P=this._createMeshCanvas(T,C===E.SHADING?null:this._background,l.cachedCanvases);return C!==E.SHADING&&(o.setTransform(...l.baseTransform),this.matrix&&o.transform(...this.matrix)),o.translate(P.offsetX,P.offsetY),o.scale(P.scaleX,P.scaleY),o.createPattern(P.canvas,"no-repeat")}};let DummyShadingPattern=class DummyShadingPattern extends BaseShadingPattern{getPattern(){return"hotpink"}};function getShadingPattern(o){switch(o[0]){case"RadialAxial":return new RadialAxialShadingPattern(o);case"Mesh":return new MeshShadingPattern(o);case"Dummy":return new DummyShadingPattern}throw Error(`Unknown IR type: ${o[0]}`)}let C={COLORED:1,UNCOLORED:2};let TilingPattern=class TilingPattern{static MAX_PATTERN_SIZE=3e3;constructor(o,l,u,A,S){this.operatorList=o[2],this.matrix=o[3]||[1,0,0,1,0,0],this.bbox=o[4],this.xstep=o[5],this.ystep=o[6],this.paintType=o[7],this.tilingType=o[8],this.color=l,this.ctx=u,this.canvasGraphicsFactory=A,this.baseTransform=S}createPatternCanvas(o){let l=this.operatorList,u=this.bbox,E=this.xstep,C=this.ystep,T=this.paintType,P=this.tilingType,M=this.color,F=this.canvasGraphicsFactory;(0,A.info)("TilingType: "+P);let R=u[0],D=u[1],I=u[2],L=u[3],O=A.Util.singularValueDecompose2dScale(this.matrix),N=A.Util.singularValueDecompose2dScale(this.baseTransform),B=[O[0]*N[0],O[1]*N[1]],U=this.getSizeAndScale(E,this.ctx.canvas.width,B[0]),H=this.getSizeAndScale(C,this.ctx.canvas.height,B[1]),z=o.cachedCanvases.getCanvas("pattern",U.size,H.size,!0),V=z.context,W=F.createCanvasGraphics(V);W.groupLevel=o.groupLevel,this.setFillAndStrokeStyleToContext(W,T,M);let $=R,X=D,K=I,Y=L;return R<0&&($=0,K+=Math.abs(R)),D<0&&(X=0,Y+=Math.abs(D)),V.translate(-(U.scale*$),-(H.scale*X)),W.transform(U.scale,0,0,H.scale,0,0),V.save(),this.clipBbox(W,$,X,K,Y),W.baseTransform=(0,S.getCurrentTransform)(W.ctx),W.executeOperatorList(l),W.endDrawing(),{canvas:z.canvas,scaleX:U.scale,scaleY:H.scale,offsetX:$,offsetY:X}}getSizeAndScale(o,l,u){o=Math.abs(o);let A=Math.max(TilingPattern.MAX_PATTERN_SIZE,l),S=Math.ceil(o*u);return S>=A?S=A:u=S/o,{scale:u,size:S}}clipBbox(o,l,u,A,E){let C=A-l,T=E-u;o.ctx.rect(l,u,C,T),o.current.updateRectMinMax((0,S.getCurrentTransform)(o.ctx),[l,u,A,E]),o.clip(),o.endPath()}setFillAndStrokeStyleToContext(o,l,u){let S=o.ctx,E=o.current;switch(l){case C.COLORED:let T=this.ctx;S.fillStyle=T.fillStyle,S.strokeStyle=T.strokeStyle,E.fillColor=T.fillStyle,E.strokeColor=T.strokeStyle;break;case C.UNCOLORED:let P=A.Util.makeHexColor(u[0],u[1],u[2]);S.fillStyle=P,S.strokeStyle=P,E.fillColor=P,E.strokeColor=P;break;default:throw new A.FormatError(`Unsupported paint type: ${l}`)}}getPattern(o,l,u,S){let C=u;S!==E.SHADING&&(C=A.Util.transform(C,l.baseTransform),this.matrix&&(C=A.Util.transform(C,this.matrix)));let T=this.createPatternCanvas(l),P=new DOMMatrix(C);P=(P=P.translate(T.offsetX,T.offsetY)).scale(1/T.scaleX,1/T.scaleY);let M=o.createPattern(T.canvas,"repeat");return M.setTransform(P),M}};l.TilingPattern=TilingPattern},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.convertBlackAndWhiteToRGBA=convertBlackAndWhiteToRGBA,l.convertToRGBA=convertToRGBA,l.grayToRGBA=grayToRGBA;var A=u(1);function convertToRGBA(o){switch(o.kind){case A.ImageKind.GRAYSCALE_1BPP:return convertBlackAndWhiteToRGBA(o);case A.ImageKind.RGB_24BPP:return convertRGBToRGBA(o)}return null}function convertBlackAndWhiteToRGBA({src:o,srcPos:l=0,dest:u,width:S,height:E,nonBlackColor:C=4294967295,inverseDecode:T=!1}){let P=A.FeatureTest.isLittleEndian?4278190080:255,[M,F]=T?[C,P]:[P,C],R=S>>3,D=7&S,I=o.length;u=new Uint32Array(u.buffer);let L=0;for(let A=0;A<E;A++){for(let A=l+R;l<A;l++){let A=l<I?o[l]:255;u[L++]=128&A?F:M,u[L++]=64&A?F:M,u[L++]=32&A?F:M,u[L++]=16&A?F:M,u[L++]=8&A?F:M,u[L++]=4&A?F:M,u[L++]=2&A?F:M,u[L++]=1&A?F:M}if(0===D)continue;let A=l<I?o[l++]:255;for(let o=0;o<D;o++)u[L++]=A&1<<7-o?F:M}return{srcPos:l,destPos:L}}function convertRGBToRGBA({src:o,srcPos:l=0,dest:u,destPos:S=0,width:E,height:C}){let T=0,P=o.length>>2,M=new Uint32Array(o.buffer,l,P);if(A.FeatureTest.isLittleEndian){for(;T<P-2;T+=3,S+=4){let o=M[T],l=M[T+1],A=M[T+2];u[S]=4278190080|o,u[S+1]=o>>>24|l<<8|4278190080,u[S+2]=l>>>16|A<<16|4278190080,u[S+3]=A>>>8|4278190080}for(let l=4*T,A=o.length;l<A;l+=3)u[S++]=o[l]|o[l+1]<<8|o[l+2]<<16|4278190080}else{for(;T<P-2;T+=3,S+=4){let o=M[T],l=M[T+1],A=M[T+2];u[S]=255|o,u[S+1]=o<<24|l>>>8|255,u[S+2]=l<<16|A>>>16|255,u[S+3]=A<<8|255}for(let l=4*T,A=o.length;l<A;l+=3)u[S++]=o[l]<<24|o[l+1]<<16|o[l+2]<<8|255}return{srcPos:l,destPos:S}}function grayToRGBA(o,l){if(A.FeatureTest.isLittleEndian)for(let u=0,A=o.length;u<A;u++)l[u]=65793*o[u]|4278190080;else for(let u=0,A=o.length;u<A;u++)l[u]=16843008*o[u]|255}}
22,(o,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.GlobalWorkerOptions=void 0;let u=Object.create(null);l.GlobalWorkerOptions=u,u.workerPort=null,u.workerSrc=""},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.MessageHandler=void 0;var A=u(1);let S={DATA:1,ERROR:2},E={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function wrapReason(o){switch(o instanceof Error||"object"==typeof o&&null!==o||(0,A.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),o.name){case"AbortException":return new A.AbortException(o.message);case"MissingPDFException":return new A.MissingPDFException(o.message);case"PasswordException":return new A.PasswordException(o.message,o.code);case"UnexpectedResponseException":return new A.UnexpectedResponseException(o.message,o.status);case"UnknownErrorException":return new A.UnknownErrorException(o.message,o.details);default:return new A.UnknownErrorException(o.message,o.toString())}}let MessageHandler=class MessageHandler{constructor(o,l,u){this.sourceName=o,this.targetName=l,this.comObj=u,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=o=>{let l=o.data;if(l.targetName!==this.sourceName)return;if(l.stream){this.#ee(l);return}if(l.callback){let o=l.callbackId,u=this.callbackCapabilities[o];if(!u)throw Error(`Cannot resolve callback ${o}`);if(delete this.callbackCapabilities[o],l.callback===S.DATA)u.resolve(l.data);else if(l.callback===S.ERROR)u.reject(wrapReason(l.reason));else throw Error("Unexpected callback case");return}let A=this.actionHandler[l.action];if(!A)throw Error(`Unknown action from worker: ${l.action}`);if(l.callbackId){let o=this.sourceName,E=l.sourceName;new Promise(function(o){o(A(l.data))}).then(function(A){u.postMessage({sourceName:o,targetName:E,callback:S.DATA,callbackId:l.callbackId,data:A})},function(A){u.postMessage({sourceName:o,targetName:E,callback:S.ERROR,callbackId:l.callbackId,reason:wrapReason(A)})});return}if(l.streamId){this.#ei(l);return}A(l.data)},u.addEventListener("message",this._onComObjOnMessage)}on(o,l){let u=this.actionHandler;if(u[o])throw Error(`There is already an actionName called "${o}"`);u[o]=l}send(o,l,u){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:o,data:l},u)}sendWithPromise(o,l,u){let S=this.callbackId++,E=new A.PromiseCapability;this.callbackCapabilities[S]=E;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:o,callbackId:S,data:l},u)}catch(o){E.reject(o)}return E.promise}sendWithStream(o,l,u,S){let C=this.streamId++,T=this.sourceName,P=this.targetName,M=this.comObj;return new ReadableStream({start:u=>{let E=new A.PromiseCapability;return this.streamControllers[C]={controller:u,startCall:E,pullCall:null,cancelCall:null,isClosed:!1},M.postMessage({sourceName:T,targetName:P,action:o,streamId:C,data:l,desiredSize:u.desiredSize},S),E.promise},pull:o=>{let l=new A.PromiseCapability;return this.streamControllers[C].pullCall=l,M.postMessage({sourceName:T,targetName:P,stream:E.PULL,streamId:C,desiredSize:o.desiredSize}),l.promise},cancel:o=>{(0,A.assert)(o instanceof Error,"cancel must have a valid reason");let l=new A.PromiseCapability;return this.streamControllers[C].cancelCall=l,this.streamControllers[C].isClosed=!0,M.postMessage({sourceName:T,targetName:P,stream:E.CANCEL,streamId:C,reason:wrapReason(o)}),l.promise}},u)}#ei(o){let l=o.streamId,u=this.sourceName,S=o.sourceName,C=this.comObj,T=this,P=this.actionHandler[o.action],M={enqueue(o,T=1,P){if(this.isCancelled)return;let M=this.desiredSize;this.desiredSize-=T,M>0&&this.desiredSize<=0&&(this.sinkCapability=new A.PromiseCapability,this.ready=this.sinkCapability.promise),C.postMessage({sourceName:u,targetName:S,stream:E.ENQUEUE,streamId:l,chunk:o},P)},close(){this.isCancelled||(this.isCancelled=!0,C.postMessage({sourceName:u,targetName:S,stream:E.CLOSE,streamId:l}),delete T.streamSinks[l])},error(o){(0,A.assert)(o instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,C.postMessage({sourceName:u,targetName:S,stream:E.ERROR,streamId:l,reason:wrapReason(o)}))},sinkCapability:new A.PromiseCapability,onPull:null,onCancel:null,isCancelled:!1,desiredSize:o.desiredSize,ready:null};M.sinkCapability.resolve(),M.ready=M.sinkCapability.promise,this.streamSinks[l]=M,new Promise(function(l){l(P(o.data,M))}).then(function(){C.postMessage({sourceName:u,targetName:S,stream:E.START_COMPLETE,streamId:l,success:!0})},function(o){C.postMessage({sourceName:u,targetName:S,stream:E.START_COMPLETE,streamId:l,reason:wrapReason(o)})})}#ee(o){let l=o.streamId,u=this.sourceName,S=o.sourceName,C=this.comObj,T=this.streamControllers[l],P=this.streamSinks[l];
22switch(o.stream){case E.START_COMPLETE:o.success?T.startCall.resolve():T.startCall.reject(wrapReason(o.reason));break;case E.PULL_COMPLETE:o.success?T.pullCall.resolve():T.pullCall.reject(wrapReason(o.reason));break;case E.PULL:if(!P){C.postMessage({sourceName:u,targetName:S,stream:E.PULL_COMPLETE,streamId:l,success:!0});break}P.desiredSize<=0&&o.desiredSize>0&&P.sinkCapability.resolve(),P.desiredSize=o.desiredSize,new Promise(function(o){o(P.onPull?.())}).then(function(){C.postMessage({sourceName:u,targetName:S,stream:E.PULL_COMPLETE,streamId:l,success:!0})},function(o){C.postMessage({sourceName:u,targetName:S,stream:E.PULL_COMPLETE,streamId:l,reason:wrapReason(o)})});break;case E.ENQUEUE:if((0,A.assert)(T,"enqueue should have stream controller"),T.isClosed)break;T.controller.enqueue(o.chunk);break;case E.CLOSE:if((0,A.assert)(T,"close should have stream controller"),T.isClosed)break;T.isClosed=!0,T.controller.close(),this.#es(T,l);break;case E.ERROR:(0,A.assert)(T,"error should have stream controller"),T.controller.error(wrapReason(o.reason)),this.#es(T,l);break;case E.CANCEL_COMPLETE:o.success?T.cancelCall.resolve():T.cancelCall.reject(wrapReason(o.reason)),this.#es(T,l);break;case E.CANCEL:if(!P)break;new Promise(function(l){l(P.onCancel?.(wrapReason(o.reason)))}).then(function(){C.postMessage({sourceName:u,targetName:S,stream:E.CANCEL_COMPLETE,streamId:l,success:!0})},function(o){C.postMessage({sourceName:u,targetName:S,stream:E.CANCEL_COMPLETE,streamId:l,reason:wrapReason(o)})}),P.sinkCapability.reject(wrapReason(o.reason)),P.isCancelled=!0,delete this.streamSinks[l];break;default:throw Error("Unexpected stream case")}}async #es(o,l){await Promise.allSettled([o.startCall?.promise,o.pullCall?.promise,o.cancelCall?.promise]),delete this.streamControllers[l]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}};l.MessageHandler=MessageHandler},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Metadata=void 0;var A=u(1);let Metadata=class Metadata{#er;#ea;constructor({parsedData:o,rawData:l}){this.#er=o,this.#ea=l}getRaw(){return this.#ea}get(o){return this.#er.get(o)??null}getAll(){return(0,A.objectFromMap)(this.#er)}has(o){return this.#er.has(o)}};l.Metadata=Metadata},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OptionalContentConfig=void 0;var A=u(1),S=u(8);let E=Symbol("INTERNAL");let OptionalContentGroup=class OptionalContentGroup{#en=!0;constructor(o,l){this.name=o,this.intent=l}get visible(){return this.#en}_setVisible(o,l){o!==E&&(0,A.unreachable)("Internal method `_setVisible` called."),this.#en=l}};let OptionalContentConfig=class OptionalContentConfig{#eo=null;#el=new Map;#eh=null;#ed=null;constructor(o){if(this.name=null,this.creator=null,null===o)return;for(let l of(this.name=o.name,this.creator=o.creator,this.#ed=o.order,o.groups))this.#el.set(l.id,new OptionalContentGroup(l.name,l.intent));if("OFF"===o.baseState)for(let o of this.#el.values())o._setVisible(E,!1);for(let l of o.on)this.#el.get(l)._setVisible(E,!0);for(let l of o.off)this.#el.get(l)._setVisible(E,!1);this.#eh=this.getHash()}#ec(o){let l=o.length;if(l<2)return!0;let u=o[0];for(let S=1;S<l;S++){let l;let E=o[S];if(Array.isArray(E))l=this.#ec(E);else{if(!this.#el.has(E))return(0,A.warn)(`Optional content group not found: ${E}`),!0;l=this.#el.get(E).visible}switch(u){case"And":if(!l)return!1;break;case"Or":if(l)return!0;break;case"Not":return!l;default:return!0}}return"And"===u}isVisible(o){if(0===this.#el.size)return!0;if(!o)return(0,A.warn)("Optional content group not defined."),!0;if("OCG"===o.type)return this.#el.has(o.id)?this.#el.get(o.id).visible:((0,A.warn)(`Optional content group not found: ${o.id}`),!0);if("OCMD"===o.type){if(o.expression)return this.#ec(o.expression);if(o.policy&&"AnyOn"!==o.policy){if("AllOn"===o.policy){for(let l of o.ids){if(!this.#el.has(l)){(0,A.warn)(`Optional content group not found: ${l}`);break}if(!this.#el.get(l).visible)return!1}return!0}if("AnyOff"===o.policy){for(let l of o.ids){if(!this.#el.has(l))return(0,A.warn)(`Optional content group not found: ${l}`),!0;if(!this.#el.get(l).visible)return!0}return!1}if("AllOff"===o.policy){for(let l of o.ids){if(!this.#el.has(l)){(0,A.warn)(`Optional content group not found: ${l}`);break}if(this.#el.get(l).visible)return!1}return!0}}
22else{for(let l of o.ids){if(!this.#el.has(l))return(0,A.warn)(`Optional content group not found: ${l}`),!0;if(this.#el.get(l).visible)return!0}return!1}return(0,A.warn)(`Unknown optional content policy ${o.policy}.`),!0}return(0,A.warn)(`Unknown group type ${o.type}.`),!0}setVisibility(o,l=!0){if(!this.#el.has(o)){(0,A.warn)(`Optional content group not found: ${o}`);return}this.#el.get(o)._setVisible(E,!!l),this.#eo=null}get hasInitialVisibility(){return null===this.#eh||this.getHash()===this.#eh}getOrder(){return this.#el.size?this.#ed?this.#ed.slice():[...this.#el.keys()]:null}getGroups(){return this.#el.size>0?(0,A.objectFromMap)(this.#el):null}getGroup(o){return this.#el.get(o)||null}getHash(){if(null!==this.#eo)return this.#eo;let o=new S.MurmurHash3_64;for(let[l,u]of this.#el)o.update(`${l}:${u.visible}`);return this.#eo=o.hexdigest()}};l.OptionalContentConfig=OptionalContentConfig},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.PDFDataTransportStream=void 0;var A=u(1),S=u(6);let PDFDataTransportStream=class PDFDataTransportStream{constructor({length:o,initialData:l,progressiveDone:u=!1,contentDispositionFilename:S=null,disableRange:E=!1,disableStream:C=!1},T){if((0,A.assert)(T,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'),this._queuedChunks=[],this._progressiveDone=u,this._contentDispositionFilename=S,l?.length>0){let o=l instanceof Uint8Array&&l.byteLength===l.buffer.byteLength?l.buffer:new Uint8Array(l).buffer;this._queuedChunks.push(o)}this._pdfDataRangeTransport=T,this._isStreamingSupported=!C,this._isRangeSupported=!E,this._contentLength=o,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener((o,l)=>{this._onReceiveData({begin:o,chunk:l})}),this._pdfDataRangeTransport.addProgressListener((o,l)=>{this._onProgress({loaded:o,total:l})}),this._pdfDataRangeTransport.addProgressiveReadListener(o=>{this._onReceiveData({chunk:o})}),this._pdfDataRangeTransport.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),this._pdfDataRangeTransport.transportReady()}_onReceiveData({begin:o,chunk:l}){let u=l instanceof Uint8Array&&l.byteLength===l.buffer.byteLength?l.buffer:new Uint8Array(l).buffer;if(void 0===o)this._fullRequestReader?this._fullRequestReader._enqueue(u):this._queuedChunks.push(u);else{let l=this._rangeReaders.some(function(l){return l._begin===o&&(l._enqueue(u),!0)});(0,A.assert)(l,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(o){void 0===o.total?this._rangeReaders[0]?.onProgress?.({loaded:o.loaded}):this._fullRequestReader?.onProgress?.({loaded:o.loaded,total:o.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(o){let l=this._rangeReaders.indexOf(o);l>=0&&this._rangeReaders.splice(l,1)}getFullReader(){(0,A.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");let o=this._queuedChunks;return this._queuedChunks=null,new PDFDataTransportStreamReader(this,o,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(o,l){if(l<=this._progressiveDataLength)return null;let u=new PDFDataTransportStreamRangeReader(this,o,l);return this._pdfDataRangeTransport.requestDataRange(o,l),this._rangeReaders.push(u),u}cancelAllRequests(o){for(let l of(this._fullRequestReader?.cancel(o),this._rangeReaders.slice(0)))l.cancel(o);this._pdfDataRangeTransport.abort()}};l.PDFDataTransportStream=PDFDataTransportStream;let PDFDataTransportStreamReader=class PDFDataTransportStreamReader{constructor(o,l,u=!1,A=null){for(let E of(this._stream=o,this._done=u||!1,this._filename=(0,S.isPdfFile)(A)?A:null,this._queuedChunks=l||[],this._loaded=0,this._queuedChunks))this._loaded+=E.byteLength;this._requests=[],this._headersReady=Promise.resolve(),o._fullRequestReader=this,this.onProgress=null}_enqueue(o){if(!this._done){if(this._requests.length>0){let l=this._requests.shift();l.resolve({value:o,done:!1})}else this._queuedChunks.push(o);this._loaded+=o.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){let o=this._queuedChunks.shift();return{value:o,done:!1}}if(this._done)return{value:void 0,done:!0};let o=new A.PromiseCapability;return this._requests.push(o),o.promise}cancel(o){for(let o of(this._done=!0,this._requests))o.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}};let PDFDataTransportStreamRangeReader=class PDFDataTransportStreamRangeReader{constructor(o,l,u){this._stream=o,this._begin=l,this._end=u,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(o){if(!this._done){if(0===this._requests.length)this._queuedChunk=o;else{let l=this._requests.shift();for(let u of(l.resolve({value:o,done:!1}),this._requests))u.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){let o=this._queuedChunk;return this._queuedChunk=null,{value:o,done:!1}}if(this._done)return{value:void 0,done:!0};let o=new A.PromiseCapability;return this._requests.push(o),o.promise}cancel(o){for(let o of(this._done=!0,this._requests))o.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}},(o,l,u)=>
22{Object.defineProperty(l,"__esModule",{value:!0}),l.PDFFetchStream=void 0;var A=u(1),S=u(20);function createFetchOptions(o,l,u){return{method:"GET",headers:o,signal:u.signal,mode:"cors",credentials:l?"include":"same-origin",redirect:"follow"}}function createHeaders(o){let l=new Headers;for(let u in o){let A=o[u];void 0!==A&&l.append(u,A)}return l}function getArrayBuffer(o){return o instanceof Uint8Array?o.buffer:o instanceof ArrayBuffer?o:((0,A.warn)(`getArrayBuffer - unexpected data format: ${o}`),new Uint8Array(o).buffer)}let PDFFetchStream=class PDFFetchStream{constructor(o){this.source=o,this.isHttp=/^https?:/i.test(o.url),this.httpHeaders=this.isHttp&&o.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,A.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new PDFFetchStreamReader(this),this._fullRequestReader}getRangeReader(o,l){if(l<=this._progressiveDataLength)return null;let u=new PDFFetchStreamRangeReader(this,o,l);return this._rangeRequestReaders.push(u),u}cancelAllRequests(o){for(let l of(this._fullRequestReader?.cancel(o),this._rangeRequestReaders.slice(0)))l.cancel(o)}};l.PDFFetchStream=PDFFetchStream;let PDFFetchStreamReader=class PDFFetchStreamReader{constructor(o){this._stream=o,this._reader=null,this._loaded=0,this._filename=null;let l=o.source;this._withCredentials=l.withCredentials||!1,this._contentLength=l.length,this._headersCapability=new A.PromiseCapability,this._disableRange=l.disableRange||!1,this._rangeChunkSize=l.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!l.disableStream,this._isRangeSupported=!l.disableRange,this._headers=createHeaders(this._stream.httpHeaders);let u=l.url;fetch(u,createFetchOptions(this._headers,this._withCredentials,this._abortController)).then(o=>{if(!(0,S.validateResponseStatus)(o.status))throw(0,S.createResponseStatusError)(o.status,u);this._reader=o.body.getReader(),this._headersCapability.resolve();let getResponseHeader=l=>o.headers.get(l),{allowRangeRequests:l,suggestedLength:E}=(0,S.validateRangeRequestCapabilities)({getResponseHeader,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=l,this._contentLength=E||this._contentLength,this._filename=(0,S.extractFilenameFromHeader)(getResponseHeader),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new A.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;let{value:o,done:l}=await this._reader.read();return l?{value:o,done:l}:(this._loaded+=o.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:getArrayBuffer(o),done:!1})}cancel(o){this._reader?.cancel(o),this._abortController.abort()}};let PDFFetchStreamRangeReader=class PDFFetchStreamRangeReader{constructor(o,l,u){this._stream=o,this._reader=null,this._loaded=0;let E=o.source;this._withCredentials=E.withCredentials||!1,this._readCapability=new A.PromiseCapability,this._isStreamingSupported=!E.disableStream,this._abortController=new AbortController,this._headers=createHeaders(this._stream.httpHeaders),this._headers.append("Range",`bytes=${l}-${u-1}`);let C=E.url;fetch(C,createFetchOptions(this._headers,this._withCredentials,this._abortController)).then(o=>{if(!(0,S.validateResponseStatus)(o.status))throw(0,S.createResponseStatusError)(o.status,C);this._readCapability.resolve(),this._reader=o.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;let{value:o,done:l}=await this._reader.read();return l?{value:o,done:l}:(this._loaded+=o.byteLength,this.onProgress?.({loaded:this._loaded}),{value:getArrayBuffer(o),done:!1})}cancel(o){this._reader?.cancel(o),this._abortController.abort()}}},(o,l,u)=>
22{Object.defineProperty(l,"__esModule",{value:!0}),l.createResponseStatusError=createResponseStatusError,l.extractFilenameFromHeader=extractFilenameFromHeader,l.validateRangeRequestCapabilities=validateRangeRequestCapabilities,l.validateResponseStatus=validateResponseStatus;var A=u(1),S=u(21),E=u(6);function validateRangeRequestCapabilities({getResponseHeader:o,isHttp:l,rangeChunkSize:u,disableRange:A}){let S={allowRangeRequests:!1,suggestedLength:void 0},E=parseInt(o("Content-Length"),10);if(!Number.isInteger(E)||(S.suggestedLength=E,E<=2*u||A||!l||"bytes"!==o("Accept-Ranges")))return S;let C=o("Content-Encoding")||"identity";return"identity"!==C||(S.allowRangeRequests=!0),S}function extractFilenameFromHeader(o){let l=o("Content-Disposition");if(l){let o=(0,S.getFilenameFromContentDispositionHeader)(l);if(o.includes("%"))try{o=decodeURIComponent(o)}catch{}if((0,E.isPdfFile)(o))return o}return null}function createResponseStatusError(o,l){return 404===o||0===o&&l.startsWith("file:")?new A.MissingPDFException('Missing PDF "'+l+'".'):new A.UnexpectedResponseException(`Unexpected server response (${o}) while retrieving PDF "${l}".`,o)}function validateResponseStatus(o){return 200===o||206===o}},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.getFilenameFromContentDispositionHeader=getFilenameFromContentDispositionHeader;var A=u(1);function getFilenameFromContentDispositionHeader(o){let l=!0,u=toParamRegExp("filename\\*","i").exec(o);if(u){let o=rfc2616unquote(u=u[1]);return fixupEncoding(o=rfc2047decode(o=rfc5987decode(o=unescape(o))))}if(u=rfc2231getparam(o)){let o=rfc2047decode(u);return fixupEncoding(o)}if(u=toParamRegExp("filename","i").exec(o)){let o=rfc2616unquote(u=u[1]);return fixupEncoding(o=rfc2047decode(o))}function toParamRegExp(o,l){return RegExp("(?:^|;)\\s*"+o+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',l)}function textdecode(o,u){if(o){if(!/^[\x00-\xFF]+$/.test(u))return u;try{let S=new TextDecoder(o,{fatal:!0}),E=(0,A.stringToBytes)(u);u=S.decode(E),l=!1}catch{}}return u}function fixupEncoding(o){return l&&/[\x80-\xff]/.test(o)&&(o=textdecode("utf-8",o),l&&(o=textdecode("iso-8859-1",o))),o}function rfc2231getparam(o){let l;let u=[],A=toParamRegExp("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(l=A.exec(o));){let[,o,A,S]=l;if((o=parseInt(o,10))in u){if(0===o)break;continue}u[o]=[A,S]}let S=[];for(let o=0;o<u.length&&(o in u);++o){let[l,A]=u[o];A=rfc2616unquote(A),l&&(A=unescape(A),0===o&&(A=rfc5987decode(A))),S.push(A)}return S.join("")}function rfc2616unquote(o){if(o.startsWith('"')){let l=o.slice(1).split('\\"');for(let o=0;o<l.length;++o){let u=l[o].indexOf('"');-1!==u&&(l[o]=l[o].slice(0,u),l.length=o+1),l[o]=l[o].replaceAll(/\\(.)/g,"$1")}o=l.join('"')}return o}function rfc5987decode(o){let l=o.indexOf("'");if(-1===l)return o;let u=o.slice(0,l),A=o.slice(l+1),S=A.replace(/^[^']*'/,"");return textdecode(u,S)}function rfc2047decode(o){return!o.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(o)?o:o.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(o,l,u,A){if("q"===u||"Q"===u)return textdecode(l,A=(A=A.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,function(o,l){return String.fromCharCode(parseInt(l,16))}));try{A=atob(A)}catch{}return textdecode(l,A)})}return""}},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.PDFNetworkStream=void 0;var A=u(1),S=u(20);let E=200,C=206;function getArrayBuffer(o){let l=o.response;return"string"!=typeof l?l:(0,A.stringToBytes)(l).buffer}let NetworkManager=class NetworkManager{constructor(o,l={}){this.url=o,this.isHttp=/^https?:/i.test(o),this.httpHeaders=this.isHttp&&l.httpHeaders||Object.create(null),this.withCredentials=l.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(o,l,u){let A={begin:o,end:l};for(let o in u)A[o]=u[o];return this.request(A)}requestFull(o){return this.request(o)}request(o){let l=new XMLHttpRequest,u=this.currXhrId++,A=this.pendingRequests[u]={xhr:l};for(let o in l.open("GET",this.url),l.withCredentials=this.withCredentials,this.httpHeaders){let u=this.httpHeaders[o];void 0!==u&&l.setRequestHeader(o,u)}return this.isHttp&&"begin"in o&&"end"in o?(l.setRequestHeader("Range",`bytes=${o.begin}-${o.end-1}`),A.expectedStatus=C):A.expectedStatus=E,l.responseType="arraybuffer",o.onError&&(l.onerror=function(u){o.onError(l.status)}),l.onreadystatechange=this.onStateChange.bind(this,u),l.onprogress=this.onProgress.bind(this,u),A.onHeadersReceived=o.onHeadersReceived,A.onDone=o.onDone,A.onError=o.onError,A.onProgress=o.onProgress,l.send(null),u}onProgress(o,l){let u=this.pendingRequests[o];u&&u.onProgress?.(l)}onStateChange(o,l){let u=this.pendingRequests[o];if(!u)return;let A=u.xhr;if(A.readyState>=2&&u.onHeadersReceived&&(u.onHeadersReceived(),delete u.onHeadersReceived),4!==A.readyState||!(o in this.pendingRequests))return;if(delete this.pendingRequests[o],0===A.status&&this.isHttp){u.onError?.(A.status);return}let S=A.status||E,T=S===E&&u.expectedStatus===C;if(!T&&S!==u.expectedStatus){u.onError?.(A.status);return}let P=getArrayBuffer(A);
22if(S===C){let o=A.getResponseHeader("Content-Range"),l=/bytes (\d+)-(\d+)\/(\d+)/.exec(o);u.onDone({begin:parseInt(l[1],10),chunk:P})}else P?u.onDone({begin:0,chunk:P}):u.onError?.(A.status)}getRequestXhr(o){return this.pendingRequests[o].xhr}isPendingRequest(o){return o in this.pendingRequests}abortRequest(o){let l=this.pendingRequests[o].xhr;delete this.pendingRequests[o],l.abort()}};let PDFNetworkStream=class PDFNetworkStream{constructor(o){this._source=o,this._manager=new NetworkManager(o.url,{httpHeaders:o.httpHeaders,withCredentials:o.withCredentials}),this._rangeChunkSize=o.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(o){let l=this._rangeRequestReaders.indexOf(o);l>=0&&this._rangeRequestReaders.splice(l,1)}getFullReader(){return(0,A.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new PDFNetworkStreamFullRequestReader(this._manager,this._source),this._fullRequestReader}getRangeReader(o,l){let u=new PDFNetworkStreamRangeRequestReader(this._manager,o,l);return u.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(u),u}cancelAllRequests(o){for(let l of(this._fullRequestReader?.cancel(o),this._rangeRequestReaders.slice(0)))l.cancel(o)}};l.PDFNetworkStream=PDFNetworkStream;let PDFNetworkStreamFullRequestReader=class PDFNetworkStreamFullRequestReader{constructor(o,l){this._manager=o;let u={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=l.url,this._fullRequestId=o.requestFull(u),this._headersReceivedCapability=new A.PromiseCapability,this._disableRange=l.disableRange||!1,this._contentLength=l.length,this._rangeChunkSize=l.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(){let o=this._fullRequestId,l=this._manager.getRequestXhr(o),getResponseHeader=o=>l.getResponseHeader(o),{allowRangeRequests:u,suggestedLength:A}=(0,S.validateRangeRequestCapabilities)({getResponseHeader,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});u&&(this._isRangeSupported=!0),this._contentLength=A||this._contentLength,this._filename=(0,S.extractFilenameFromHeader)(getResponseHeader),this._isRangeSupported&&this._manager.abortRequest(o),this._headersReceivedCapability.resolve()}_onDone(o){if(o){if(this._requests.length>0){let l=this._requests.shift();l.resolve({value:o.chunk,done:!1})}else this._cachedChunks.push(o.chunk)}if(this._done=!0,!(this._cachedChunks.length>0)){for(let o of this._requests)o.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(o){for(let l of(this._storedError=(0,S.createResponseStatusError)(o,this._url),this._headersReceivedCapability.reject(this._storedError),this._requests))l.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(o){this.onProgress?.({loaded:o.loaded,total:o.lengthComputable?o.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){let o=this._cachedChunks.shift();return{value:o,done:!1}}if(this._done)return{value:void 0,done:!0};let o=new A.PromiseCapability;return this._requests.push(o),o.promise}cancel(o){for(let l of(this._done=!0,this._headersReceivedCapability.reject(o),this._requests))l.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}};let PDFNetworkStreamRangeRequestReader=class PDFNetworkStreamRangeRequestReader{constructor(o,l,u){this._manager=o;let A={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=o.url,this._requestId=o.requestRange(l,u,A),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(o){let l=o.chunk;
22if(this._requests.length>0){let o=this._requests.shift();o.resolve({value:l,done:!1})}else this._queuedChunk=l;for(let o of(this._done=!0,this._requests))o.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(o){for(let l of(this._storedError=(0,S.createResponseStatusError)(o,this._url),this._requests))l.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(o){this.isStreamingSupported||this.onProgress?.({loaded:o.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){let o=this._queuedChunk;return this._queuedChunk=null,{value:o,done:!1}}if(this._done)return{value:void 0,done:!0};let o=new A.PromiseCapability;return this._requests.push(o),o.promise}cancel(o){for(let o of(this._done=!0,this._requests))o.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.PDFNodeStream=void 0;var A=u(1),S=u(20);let E=/^file:\/\/\/[a-zA-Z]:\//;function parseUrl(o){let l=__webpack_require__(11987),u=l.parse(o);return"file:"===u.protocol||u.host?u:/^[a-z]:[/\\]/i.test(o)?l.parse(`file:///${o}`):(u.host||(u.protocol="file:"),u)}let PDFNodeStream=class PDFNodeStream{constructor(o){this.source=o,this.url=parseUrl(o.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.httpHeaders=this.isHttp&&o.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,A.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new PDFNodeStreamFsFullReader(this):new PDFNodeStreamFullReader(this),this._fullRequestReader}getRangeReader(o,l){if(l<=this._progressiveDataLength)return null;let u=this.isFsUrl?new PDFNodeStreamFsRangeReader(this,o,l):new PDFNodeStreamRangeReader(this,o,l);return this._rangeRequestReaders.push(u),u}cancelAllRequests(o){for(let l of(this._fullRequestReader?.cancel(o),this._rangeRequestReaders.slice(0)))l.cancel(o)}};l.PDFNodeStream=PDFNodeStream;let BaseFullReader=class BaseFullReader{constructor(o){this._url=o.url,this._done=!1,this._storedError=null,this.onProgress=null;let l=o.source;this._contentLength=l.length,this._loaded=0,this._filename=null,this._disableRange=l.disableRange||!1,this._rangeChunkSize=l.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!l.disableStream,this._isRangeSupported=!l.disableRange,this._readableStream=null,this._readCapability=new A.PromiseCapability,this._headersCapability=new A.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;let o=this._readableStream.read();if(null===o)return this._readCapability=new A.PromiseCapability,this.read();this._loaded+=o.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength});let l=new Uint8Array(o).buffer;return{value:l,done:!1}}cancel(o){if(!this._readableStream){this._error(o);return}this._readableStream.destroy(o)}_error(o){this._storedError=o,this._readCapability.resolve()}_setReadableStream(o){this._readableStream=o,o.on("readable",()=>{this._readCapability.resolve()}),o.on("end",()=>{o.destroy(),this._done=!0,this._readCapability.resolve()}),o.on("error",o=>{this._error(o)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new A.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}};let BaseRangeReader=class BaseRangeReader{constructor(o){this._url=o.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=new A.PromiseCapability;let l=o.source;this._isStreamingSupported=!l.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;let o=this._readableStream.read();if(null===o)return this._readCapability=new A.PromiseCapability,this.read();this._loaded+=o.length,this.onProgress?.({loaded:this._loaded});let l=new Uint8Array(o).buffer;return{value:l,done:!1}}cancel(o){if(!this._readableStream){this._error(o);return}this._readableStream.destroy(o)}_error(o){this._storedError=o,this._readCapability.resolve()}_setReadableStream(o){this._readableStream=o,o.on("readable",()=>{this._readCapability.resolve()}),o.on("end",()=>{o.destroy(),this._done=!0,this._readCapability.resolve()}),o.on("error",o=>{this._error(o)}),this._storedError&&this._readableStream.destroy(this._storedError)}};function createRequestOptions(o,l){return{protocol:o.protocol,auth:o.auth,host:o.hostname,port:o.port,path:o.path,method:"GET",headers:l}}let PDFNodeStreamFullReader=class PDFNodeStreamFullReader extends BaseFullReader{constructor(o){super(o);let handleResponse=l=>{if(404===l.statusCode){let o=new A.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=o,this._headersCapability.reject(o);return}this._headersCapability.resolve(),this._setReadableStream(l);let getResponseHeader=o=>this._readableStream.headers[o.toLowerCase()],{allowRangeRequests:u,suggestedLength:E}=(0,S.validateRangeRequestCapabilities)({getResponseHeader,isHttp:o.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=u,this._contentLength=E||this._contentLength,this._filename=(0,S.extractFilenameFromHeader)(getResponseHeader)};if(this._request=null,"http:"===this._url.protocol){let l=__webpack_require__(2001);this._request=l.request(createRequestOptions(this._url,o.httpHeaders),handleResponse)}else{let l=__webpack_require__(33779);this._request=l.request(createRequestOptions(this._url,o.httpHeaders),handleResponse)}this._request.on("error",o=>{this._storedError=o,this._headersCapability.reject(o)}),this._request.end()}};let PDFNodeStreamRangeReader=class PDFNodeStreamRangeReader extends BaseRangeReader{constructor(o,l,u){for(let l in super(o),this._httpHeaders={},o.httpHeaders){let u=o.httpHeaders[l];void 0!==u&&(this._httpHeaders[l]=u)}this._httpHeaders.Range=`bytes=${l}-${u-1}`;let handleResponse=o=>{if(404===o.statusCode){let o=new A.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=o;return}this._setReadableStream(o)};if(this._request=null,"http:"===this._url.protocol){let o=__webpack_require__(2001);this._request=o.request(createRequestOptions(this._url,this._httpHeaders),handleResponse)}else{let o=__webpack_require__(33779);this._request=o.request(createRequestOptions(this._url,this._httpHeaders),handleResponse)}this._request.on("error",o=>{this._storedError=o}),this._request.end()}};let PDFNodeStreamFsFullReader=class PDFNodeStreamFsFullReader extends BaseFullReader{constructor(o){super(o);let l=decodeURIComponent(this._url.path);E.test(this._url.href)&&(l=l.replace(/^\//,""));let u=__webpack_require__(70172);u.lstat(l,(o,S)=>{if(o){"ENOENT"===o.code&&(o=new A.MissingPDFException(`Missing PDF "${l}".`)),this._storedError=o,this._headersCapability.reject(o);return}this._contentLength=S.size,this._setReadableStream(u.createReadStream(l)),this._headersCapability.resolve()})}};let PDFNodeStreamFsRangeReader=class PDFNodeStreamFsRangeReader extends BaseRangeReader{constructor(o,l,u){super(o);let A=decodeURIComponent(this._url.path);E.test(this._url.href)&&(A=A.replace(/^\//,""));let S=__webpack_require__(70172);this._setReadableStream(S.createReadStream(A,{start:l,end:u-1}))}}},(o,l,u)=>
22{Object.defineProperty(l,"__esModule",{value:!0}),l.SVGGraphics=void 0;var A=u(6),S=u(1);let E={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},C="http://www.w3.org/XML/1998/namespace",T="http://www.w3.org/1999/xlink",P=["butt","round","square"],M=["miter","round","bevel"],createObjectURL=function(o,l="",u=!1){if(URL.createObjectURL&&"undefined"!=typeof Blob&&!u)return URL.createObjectURL(new Blob([o],{type:l}));let A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",S=`data:${l};base64,`;for(let l=0,u=o.length;l<u;l+=3){let E=255&o[l],C=255&o[l+1],T=255&o[l+2],P=E>>2,M=(3&E)<<4|C>>4,F=l+1<u?(15&C)<<2|T>>6:64,R=l+2<u?63&T:64;S+=A[P]+A[M]+A[F]+A[R]}return S},F=function(){let o=new Uint8Array([137,80,78,71,13,10,26,10]),l=12,u=new Int32Array(256);for(let o=0;o<256;o++){let l=o;for(let o=0;o<8;o++)l=1&l?3988292384^l>>1&2147483647:l>>1&2147483647;u[o]=l}function crc32(o,l,A){let S=-1;for(let E=l;E<A;E++){let l=(S^o[E])&255,A=u[l];S=S>>>8^A}return -1^S}function writePngChunk(o,l,u,A){let S=A,E=l.length;u[S]=E>>24&255,u[S+1]=E>>16&255,u[S+2]=E>>8&255,u[S+3]=255&E,u[S+=4]=255&o.charCodeAt(0),u[S+1]=255&o.charCodeAt(1),u[S+2]=255&o.charCodeAt(2),u[S+3]=255&o.charCodeAt(3),S+=4,u.set(l,S),S+=l.length;let C=crc32(u,A+4,S);u[S]=C>>24&255,u[S+1]=C>>16&255,u[S+2]=C>>8&255,u[S+3]=255&C}function adler32(o,l,u){let A=1,S=0;for(let E=l;E<u;++E)S=(S+(A=(A+(255&o[E]))%65521))%65521;return S<<16|A}function deflateSync(o){if(!S.isNodeJS)return deflateSyncUncompressed(o);try{let l=parseInt(process.versions.node)>=8?o:Buffer.from(o),u=__webpack_require__(82258).deflateSync(l,{level:9});return u instanceof Uint8Array?u:new Uint8Array(u)}catch(o){(0,S.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+o)}return deflateSyncUncompressed(o)}function deflateSyncUncompressed(o){let l=o.length,u=65535,A=Math.ceil(l/u),S=new Uint8Array(2+l+5*A+4),E=0;S[E++]=120,S[E++]=156;let C=0;for(;l>u;)S[E++]=0,S[E++]=255,S[E++]=255,S[E++]=0,S[E++]=0,S.set(o.subarray(C,C+u),E),E+=u,C+=u,l-=u;S[E++]=1,S[E++]=255&l,S[E++]=l>>8&255,S[E++]=255&~l,S[E++]=(65535&~l)>>8&255,S.set(o.subarray(C),E),E+=o.length-C;let T=adler32(o,0,o.length);return S[E++]=T>>24&255,S[E++]=T>>16&255,S[E++]=T>>8&255,S[E++]=255&T,S}function encode(u,A,E,C){let T,P,M;let F=u.width,R=u.height,D=u.data;switch(A){case S.ImageKind.GRAYSCALE_1BPP:P=0,T=1,M=F+7>>3;break;case S.ImageKind.RGB_24BPP:P=2,T=8,M=3*F;break;case S.ImageKind.RGBA_32BPP:P=6,T=8,M=4*F;break;default:throw Error("invalid format")}let I=new Uint8Array((1+M)*R),L=0,O=0;for(let o=0;o<R;++o)I[L++]=0,I.set(D.subarray(O,O+M),L),O+=M,L+=M;if(A===S.ImageKind.GRAYSCALE_1BPP&&C){L=0;for(let o=0;o<R;o++){L++;for(let o=0;o<M;o++)I[L++]^=255}}let N=new Uint8Array([F>>24&255,F>>16&255,F>>8&255,255&F,R>>24&255,R>>16&255,R>>8&255,255&R,T,P,0,0,0]),B=deflateSync(I),U=o.length+3*l+N.length+B.length,H=new Uint8Array(U),z=0;return H.set(o,z),writePngChunk("IHDR",N,H,z+=o.length),writePngChunk("IDATA",B,H,z+=l+N.length),z+=l+B.length,writePngChunk("IEND",new Uint8Array(0),H,z),createObjectURL(H,"image/png",E)}return function(o,l,u){let A=void 0===o.kind?S.ImageKind.GRAYSCALE_1BPP:o.kind;return encode(o,A,l,u)}}();let SVGExtraState=class SVGExtraState{constructor(){this.fontSizeScale=1,this.fontWeight=E.fontWeight,this.fontSize=0,this.textMatrix=S.IDENTITY_MATRIX,this.fontMatrix=S.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=S.TextRenderingMode.FILL,this.textMatrixScale=1,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRise=0,this.fillColor=E.fillColor,this.strokeColor="#000000",this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.lineJoin="",this.lineCap="",this.miterLimit=0,this.dashArray=[],this.dashPhase=0,this.dependencies=[],this.activeClipUrl=null,this.clipGroup=null,this.maskId=""}clone(){return Object.create(this)}setCurrentPoint(o,l){this.x=o,this.y=l}};function opListToTree(o){let l=[],u=[];for(let A of o){if("save"===A.fn){l.push({fnId:92,fn:"group",items:[]}),u.push(l),l=l.at(-1).items;continue}"restore"===A.fn?l=u.pop():l.push(A)}return l}function pf(o){if(Number.isInteger(o))return o.toString();let l=o.toFixed(10),u=l.length-1;if("0"!==l[u])return l;do u--;while("0"===l[u]);return l.substring(0,"."===l[u]?u:u+1)}function pm(o){if(0===o[4]&&0===o[5]){if(0===o[1]&&0===o[2])return 1===o[0]&&1===o[3]?"":`scale(${pf(o[0])} ${pf(o[3])})`;if(o[0]===o[3]&&o[1]===-o[2]){let l=180*Math.acos(o[0])/Math.PI;return`rotate(${pf(l)})`}}
22else if(1===o[0]&&0===o[1]&&0===o[2]&&1===o[3])return`translate(${pf(o[4])} ${pf(o[5])})`;return`matrix(${pf(o[0])} ${pf(o[1])} ${pf(o[2])} ${pf(o[3])} ${pf(o[4])} ${pf(o[5])})`}let R=0,D=0,I=0;let SVGGraphics=class SVGGraphics{constructor(o,l,u=!1){for(let E in(0,A.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future."),this.svgFactory=new A.DOMSVGFactory,this.current=new SVGExtraState,this.transformMatrix=S.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=o,this.objs=l,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!u,this._operatorIdMapping=[],S.OPS)this._operatorIdMapping[S.OPS[E]]=E}getObject(o,l=null){return"string"==typeof o?o.startsWith("g_")?this.commonObjs.get(o):this.objs.get(o):l}save(){this.transformStack.push(this.transformMatrix);let o=this.current;this.extraStack.push(o),this.current=o.clone()}restore(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}group(o){this.save(),this.executeOpTree(o),this.restore()}loadDependencies(o){let l=o.fnArray,u=o.argsArray;for(let o=0,A=l.length;o<A;o++)if(l[o]===S.OPS.dependency)for(let l of u[o]){let o=l.startsWith("g_")?this.commonObjs:this.objs,u=new Promise(u=>{o.get(l,u)});this.current.dependencies.push(u)}return Promise.all(this.current.dependencies)}transform(o,l,u,A,E,C){let T=[o,l,u,A,E,C];this.transformMatrix=S.Util.transform(this.transformMatrix,T),this.tgrp=null}getSVG(o,l){this.viewport=l;let u=this._initialize(l);return this.loadDependencies(o).then(()=>(this.transformMatrix=S.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(o)),u))}convertOpList(o){let l=this._operatorIdMapping,u=o.argsArray,A=o.fnArray,S=[];for(let o=0,E=A.length;o<E;o++){let E=A[o];S.push({fnId:E,fn:l[E],args:u[o]})}return opListToTree(S)}executeOpTree(o){for(let l of o){let o=l.fn,u=l.fnId,A=l.args;switch(0|u){case S.OPS.beginText:this.beginText();break;case S.OPS.dependency:break;case S.OPS.setLeading:this.setLeading(A);break;case S.OPS.setLeadingMoveText:this.setLeadingMoveText(A[0],A[1]);break;case S.OPS.setFont:this.setFont(A);break;case S.OPS.showText:case S.OPS.showSpacedText:this.showText(A[0]);break;case S.OPS.endText:this.endText();break;case S.OPS.moveText:this.moveText(A[0],A[1]);break;case S.OPS.setCharSpacing:this.setCharSpacing(A[0]);break;case S.OPS.setWordSpacing:this.setWordSpacing(A[0]);break;case S.OPS.setHScale:this.setHScale(A[0]);break;case S.OPS.setTextMatrix:this.setTextMatrix(A[0],A[1],A[2],A[3],A[4],A[5]);break;case S.OPS.setTextRise:this.setTextRise(A[0]);break;case S.OPS.setTextRenderingMode:this.setTextRenderingMode(A[0]);break;case S.OPS.setLineWidth:this.setLineWidth(A[0]);break;case S.OPS.setLineJoin:this.setLineJoin(A[0]);break;case S.OPS.setLineCap:this.setLineCap(A[0]);break;case S.OPS.setMiterLimit:this.setMiterLimit(A[0]);break;case S.OPS.setFillRGBColor:this.setFillRGBColor(A[0],A[1],A[2]);break;case S.OPS.setStrokeRGBColor:this.setStrokeRGBColor(A[0],A[1],A[2]);break;case S.OPS.setStrokeColorN:this.setStrokeColorN(A);break;case S.OPS.setFillColorN:this.setFillColorN(A);break;case S.OPS.shadingFill:this.shadingFill(A[0]);break;case S.OPS.setDash:this.setDash(A[0],A[1]);break;case S.OPS.setRenderingIntent:this.setRenderingIntent(A[0]);break;case S.OPS.setFlatness:this.setFlatness(A[0]);break;case S.OPS.setGState:this.setGState(A[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(A[0]);break;case S.OPS.paintInlineImageXObject:this.paintInlineImageXObject(A[0]);break;case S.OPS.paintImageMaskXObject:this.paintImageMaskXObject(A[0]);break;case S.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(A[0],A[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(A[0],A[1],A[2],A[3],A[4],A[5]);break;case S.OPS.constructPath:this.constructPath(A[0],A[1]);break;case S.OPS.endPath:this.endPath();break;case 92:this.group(l.items);break;default:(0,S.warn)(`Unimplemented operator ${o}`)}}}setWordSpacing(o){this.current.wordSpacing=o}setCharSpacing(o){this.current.charSpacing=o}nextLine(){this.moveText(0,this.current.leading)}setTextMatrix(o,l,u,A,S,E){let C=this.current;C.textMatrix=C.lineMatrix=[o,l,u,A,S,E],C.textMatrixScale=Math.hypot(o,l),C.x=C.lineX=0,C.y=C.lineY=0,C.xcoords=[],C.ycoords=[],C.tspan=this.svgFactory.createElement("svg:tspan"),C.tspan.setAttributeNS(null,"font-family",C.fontFamily),C.tspan.setAttributeNS(null,"font-size",`${pf(C.fontSize)}px`),C.tspan.setAttributeNS(null,"y",pf(-C.y)),C.txtElement=this.svgFactory.createElement("svg:text"),C.txtElement.append(C.tspan)}beginText(){let o=this.current;o.x=o.lineX=0,o.y=o.lineY=0,o.textMatrix=S.IDENTITY_MATRIX,o.lineMatrix=S.IDENTITY_MATRIX,o.textMatrixScale=1,o.tspan=this.svgFactory.createElement("svg:tspan"),o.txtElement=this.svgFactory.createElement("svg:text"),o.txtgrp=this.svgFactory.createElement("svg:g"),o.xcoords=[],o.ycoords=[]}moveText(o,l){let u=this.current;u.x=u.lineX+=o,u.y=u.lineY+=l,u.xcoords=[],u.ycoords=[],u.tspan=this.svgFactory.createElement("svg:tspan"),u.tspan.setAttributeNS(null,"font-family",u.fontFamily),u.tspan.setAttributeNS(null,"font-size",`${pf(u.fontSize)}px`),u.tspan.setAttributeNS(null,"y",pf(-u.y))}showText(o){let l=this.current,u=l.font,A=l.fontSize;if(0===A)return;let T=l.fontSizeScale,P=l.charSpacing,M=l.wordSpacing,F=l.fontDirection,R=l.textHScale*F,D=u.vertical,I=D?1:-1,L=u.defaultVMetrics,O=A*l.fontMatrix[0],N=0;for(let S of o){let o,E;if(null===S){N+=F*M;continue}if("number"==typeof S){N+=I*S*A/1e3;continue}let C=(S.isSpace?M:0)+P,R=S.fontChar,B=S.width;if(D){let l;let u=S.vmetric||L;l=-(l=S.vmetric?u[1]:.5*B)*O;let A=u[2]*O;B=u?-u[0]:B,o=l/T,E=(N+A)/T}else o=N/T,E=0;(S.isInFont||u.missingFile)&&(l.xcoords.push(l.x+o),D&&l.ycoords.push(-l.y+E),l.tspan.textContent+=R);let U=D?B*O-C*F:B*O+C*F;N+=U}l.tspan.setAttributeNS(null,"x",l.xcoords.map(pf).join(" ")),D?l.tspan.setAttributeNS(null,"y",l.ycoords.map(pf).join(" ")):l.tspan.setAttributeNS(null,"y",pf(-l.y)),D?l.y-=N:l.x+=N*R,l.tspan.setAttributeNS(null,"font-family",l.fontFamily),l.tspan.setAttributeNS(null,"font-size",`${pf(l.fontSize)}px`),l.fontStyle!==E.fontStyle&&l.tspan.setAttributeNS(null,"font-style",l.fontStyle),l.fontWeight!==E.fontWeight&&l.tspan.setAttributeNS(null,"font-weight",l.fontWeight);let B=l.textRenderingMode&S.TextRenderingMode.FILL_STROKE_MASK;if(B===S.TextRenderingMode.FILL||B===S.TextRenderingMode.FILL_STROKE?(l.fillColor!==E.fillColor&&l.tspan.setAttributeNS(null,"fill",l.fillColor),l.fillAlpha<1&&l.tspan.setAttributeNS(null,"fill-opacity",l.fillAlpha)):l.textRenderingMode===S.TextRenderingMode.ADD_TO_PATH?l.tspan.setAttributeNS(null,"fill","transparent"):l.tspan.setAttributeNS(null,"fill","none"),B===S.TextRenderingMode.STROKE||B===S.TextRenderingMode.FILL_STROKE){let o=1/(l.textMatrixScale||1);this._setStrokeAttributes(l.tspan,o)}let U=l.textMatrix;0!==l.textRise&&(U=U.slice(),U[5]+=l.textRise),l.txtElement.setAttributeNS(null,"transform",`${pm(U)} scale(${pf(R)}, -1)`),l.txtElement.setAttributeNS(C,"xml:space","preserve"),l.txtElement.append(l.tspan),l.txtgrp.append(l.txtElement),this._ensureTransformGroup().append(l.txtElement)}setLeadingMoveText(o,l){this.setLeading(-l),this.moveText(o,l)}addFontStyle(o){if(!o.data)throw 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));let l=createObjectURL(o.data,o.mimetype,this.forceDataSchema);this.cssStyle.textContent+=`@font-face { font-family: "${o.loadedName}"; src: url(${l}); } 23`}setFont(o){let l=this.current,u=this.commonObjs.get(o[0]),A=o[1];l.font=u,!this.embedFonts||u.missingFile||this.embeddedFonts[u.loadedName]||(this.addFontStyle(u),this.embeddedFonts[u.loadedName]=u),l.fontMatrix=u.fontMatrix||S.FONT_IDENTITY_MATRIX;let E="normal";u.black?E="900":u.bold&&(E="bold");let C=u.italic?"italic":"normal";A<0?(A=-A,l.fontDirection=-1):l.fontDirection=1,l.fontSize=A,l.fontFamily=u.loadedName,l.fontWeight=E,l.fontStyle=C,l.tspan=this.svgFactory.createElement("svg:tspan"),l.tspan.setAttributeNS(null,"y",pf(-l.y)),l.xcoords=[],l.ycoords=[]}endText(){let o=this.current;o.textRenderingMode&S.TextRenderingMode.ADD_TO_PATH_FLAG&&o.txtElement?.hasChildNodes()&&(o.element=o.txtElement,this.clip("nonzero"),this.endPath())}setLineWidth(o){o>0&&(this.current.lineWidth=o)}setLineCap(o){this.current.lineCap=P[o]}setLineJoin(o){this.current.lineJoin=M[o]}setMiterLimit(o){this.current.miterLimit=o}setStrokeAlpha(o){this.current.strokeAlpha=o}setStrokeRGBColor(o,l,u){this.current.strokeColor=S.Util.makeHexColor(o,l,u)}setFillAlpha(o){this.current.fillAlpha=o}setFillRGBColor(o,l,u){this.current.fillColor=S.Util.makeHexColor(o,l,u),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(o){this.current.strokeColor=this._makeColorN_Pattern(o)}setFillColorN(o){this.current.fillColor=this._makeColorN_Pattern(o)}shadingFill(o){let{width:l,height:u}=this.viewport,A=S.Util.inverseTransform(this.transformMatrix),[E,C,T,P]=S.Util.getAxialAlignedBoundingBox([0,0,l,u],A),M=this.svgFactory.createElement("svg:rect");M.setAttributeNS(null,"x",E),M.setAttributeNS(null,"y",C),M.setAttributeNS(null,"width",T-E),M.setAttributeNS(null,"height",P-C),M.setAttributeNS(null,"fill",this._makeShadingPattern(o)),this.current.fillAlpha<1&&M.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(M)}_makeColorN_Pattern(o){return"TilingPattern"===o[0]?this._makeTilingPattern(o):this._makeShadingPattern(o)}_makeTilingPattern(o){let l=o[1],u=o[2],A=o[3]||S.IDENTITY_MATRIX,[E,C,T,P]=o[4],M=o[5],F=o[6],R=o[7],D=`
23shading${I++}`,[L,O,N,B]=S.Util.normalizeRect([...S.Util.applyTransform([E,C],A),...S.Util.applyTransform([T,P],A)]),[U,H]=S.Util.singularValueDecompose2dScale(A),z=M*U,V=F*H,W=this.svgFactory.createElement("svg:pattern");W.setAttributeNS(null,"id",D),W.setAttributeNS(null,"patternUnits","userSpaceOnUse"),W.setAttributeNS(null,"width",z),W.setAttributeNS(null,"height",V),W.setAttributeNS(null,"x",`${L}`),W.setAttributeNS(null,"y",`${O}`);let $=this.svg,X=this.transformMatrix,K=this.current.fillColor,Y=this.current.strokeColor,J=this.svgFactory.create(N-L,B-O);if(this.svg=J,this.transformMatrix=A,2===R){let o=S.Util.makeHexColor(...l);this.current.fillColor=o,this.current.strokeColor=o}return this.executeOpTree(this.convertOpList(u)),this.svg=$,this.transformMatrix=X,this.current.fillColor=K,this.current.strokeColor=Y,W.append(J.childNodes[0]),this.defs.append(W),`url(#${D})`}_makeShadingPattern(o){switch("string"==typeof o&&(o=this.objs.get(o)),o[0]){case"RadialAxial":let l;let u=`shading${I++}`,A=o[3];switch(o[1]){case"axial":let E=o[4],C=o[5];(l=this.svgFactory.createElement("svg:linearGradient")).setAttributeNS(null,"id",u),l.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),l.setAttributeNS(null,"x1",E[0]),l.setAttributeNS(null,"y1",E[1]),l.setAttributeNS(null,"x2",C[0]),l.setAttributeNS(null,"y2",C[1]);break;case"radial":let T=o[4],P=o[5],M=o[6],F=o[7];(l=this.svgFactory.createElement("svg:radialGradient")).setAttributeNS(null,"id",u),l.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),l.setAttributeNS(null,"cx",P[0]),l.setAttributeNS(null,"cy",P[1]),l.setAttributeNS(null,"r",F),l.setAttributeNS(null,"fx",T[0]),l.setAttributeNS(null,"fy",T[1]),l.setAttributeNS(null,"fr",M);break;default:throw Error(`Unknown RadialAxial type: ${o[1]}`)}for(let o of A){let u=this.svgFactory.createElement("svg:stop");u.setAttributeNS(null,"offset",o[0]),u.setAttributeNS(null,"stop-color",o[1]),l.append(u)}return this.defs.append(l),`url(#${u})`;case"Mesh":return(0,S.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw Error(`Unknown IR type: ${o[0]}`)}}setDash(o,l){this.current.dashArray=o,this.current.dashPhase=l}constructPath(o,l){let u=this.current,A=u.x,E=u.y,C=[],T=0;for(let u of o)switch(0|u){case S.OPS.rectangle:A=l[T++],E=l[T++];let o=l[T++],P=l[T++],M=A+o,F=E+P;C.push("M",pf(A),pf(E),"L",pf(M),pf(E),"L",pf(M),pf(F),"L",pf(A),pf(F),"Z");break;case S.OPS.moveTo:A=l[T++],E=l[T++],C.push("M",pf(A),pf(E));break;case S.OPS.lineTo:A=l[T++],E=l[T++],C.push("L",pf(A),pf(E));break;case S.OPS.curveTo:A=l[T+4],E=l[T+5],C.push("C",pf(l[T]),pf(l[T+1]),pf(l[T+2]),pf(l[T+3]),pf(A),pf(E)),T+=6;break;case S.OPS.curveTo2:C.push("C",pf(A),pf(E),pf(l[T]),pf(l[T+1]),pf(l[T+2]),pf(l[T+3])),A=l[T+2],E=l[T+3],T+=4;break;case S.OPS.curveTo3:A=l[T+2],E=l[T+3],C.push("C",pf(l[T]),pf(l[T+1]),pf(A),pf(E),pf(A),pf(E)),T+=4;break;case S.OPS.closePath:C.push("Z")}C=C.join(" "),u.path&&o.length>0&&o[0]!==S.OPS.rectangle&&o[0]!==S.OPS.moveTo?C=u.path.getAttributeNS(null,"d")+C:(u.path=this.svgFactory.createElement("svg:path"),this._ensureTransformGroup().append(u.path)),u.path.setAttributeNS(null,"d",C),u.path.setAttributeNS(null,"fill","none"),u.element=u.path,u.setCurrentPoint(A,E)}endPath(){let o=this.current;if(o.path=null,!this.pendingClip)return;if(!o.element){this.pendingClip=null;return}let l=`clippath${R++}`,u=this.svgFactory.createElement("svg:clipPath");u.setAttributeNS(null,"id",l),u.setAttributeNS(null,"transform",pm(this.transformMatrix));let A=o.element.cloneNode(!0);if("evenodd"===this.pendingClip?A.setAttributeNS(null,"clip-rule","evenodd"):A.setAttributeNS(null,"clip-rule","nonzero"),this.pendingClip=null,u.append(A),this.defs.append(u),o.activeClipUrl){for(let l of(o.clipGroup=null,this.extraStack))l.clipGroup=null;u.setAttributeNS(null,"clip-path",o.activeClipUrl)}o.activeClipUrl=`url(#${l})`,this.tgrp=null}clip(o){this.pendingClip=o}closePath(){let o=this.current;if(o.path){let l=`${o.path.getAttributeNS(null,"d")}Z`;o.path.setAttributeNS(null,"d",l)}}setLeading(o){this.current.leading=-o}setTextRise(o){this.current.textRise=o}setTextRenderingMode(o){this.current.textRenderingMode=o}setHScale(o){this.current.textHScale=o/100}
23setRenderingIntent(o){}setFlatness(o){}setGState(o){for(let[l,u]of o)switch(l){case"LW":this.setLineWidth(u);break;case"LC":this.setLineCap(u);break;case"LJ":this.setLineJoin(u);break;case"ML":this.setMiterLimit(u);break;case"D":this.setDash(u[0],u[1]);break;case"RI":this.setRenderingIntent(u);break;case"FL":this.setFlatness(u);break;case"Font":this.setFont(u);break;case"CA":this.setStrokeAlpha(u);break;case"ca":this.setFillAlpha(u);break;default:(0,S.warn)(`Unimplemented graphic state operator ${l}`)}}fill(){let o=this.current;o.element&&(o.element.setAttributeNS(null,"fill",o.fillColor),o.element.setAttributeNS(null,"fill-opacity",o.fillAlpha),this.endPath())}stroke(){let o=this.current;o.element&&(this._setStrokeAttributes(o.element),o.element.setAttributeNS(null,"fill","none"),this.endPath())}_setStrokeAttributes(o,l=1){let u=this.current,A=u.dashArray;1!==l&&A.length>0&&(A=A.map(function(o){return l*o})),o.setAttributeNS(null,"stroke",u.strokeColor),o.setAttributeNS(null,"stroke-opacity",u.strokeAlpha),o.setAttributeNS(null,"stroke-miterlimit",pf(u.miterLimit)),o.setAttributeNS(null,"stroke-linecap",u.lineCap),o.setAttributeNS(null,"stroke-linejoin",u.lineJoin),o.setAttributeNS(null,"stroke-width",pf(l*u.lineWidth)+"px"),o.setAttributeNS(null,"stroke-dasharray",A.map(pf).join(" ")),o.setAttributeNS(null,"stroke-dashoffset",pf(l*u.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(){let o=this.svgFactory.createElement("svg:rect");o.setAttributeNS(null,"x","0"),o.setAttributeNS(null,"y","0"),o.setAttributeNS(null,"width","1px"),o.setAttributeNS(null,"height","1px"),o.setAttributeNS(null,"fill",this.current.fillColor),this._ensureTransformGroup().append(o)}paintImageXObject(o){let l=this.getObject(o);if(!l){(0,S.warn)(`Dependent image with object ID ${o} is not ready yet`);return}this.paintInlineImageXObject(l)}paintInlineImageXObject(o,l){let u=o.width,A=o.height,S=F(o,this.forceDataSchema,!!l),E=this.svgFactory.createElement("svg:rect");E.setAttributeNS(null,"x","0"),E.setAttributeNS(null,"y","0"),E.setAttributeNS(null,"width",pf(u)),E.setAttributeNS(null,"height",pf(A)),this.current.element=E,this.clip("nonzero");let C=this.svgFactory.createElement("svg:image");C.setAttributeNS(T,"xlink:href",S),C.setAttributeNS(null,"x","0"),C.setAttributeNS(null,"y",pf(-A)),C.setAttributeNS(null,"width",pf(u)+"px"),C.setAttributeNS(null,"height",pf(A)+"px"),C.setAttributeNS(null,"transform",`scale(${pf(1/u)} ${pf(-1/A)})`),l?l.append(C):this._ensureTransformGroup().append(C)}paintImageMaskXObject(o){let l=this.getObject(o.data,o);if(l.bitmap){(0,S.warn)("paintImageMaskXObject: ImageBitmap support is not implemented, ensure that the `isOffscreenCanvasSupported` API parameter is disabled.");return}let u=this.current,A=l.width,E=l.height,C=u.fillColor;u.maskId=`mask${D++}`;let T=this.svgFactory.createElement("svg:mask");T.setAttributeNS(null,"id",u.maskId);let P=this.svgFactory.createElement("svg:rect");P.setAttributeNS(null,"x","0"),P.setAttributeNS(null,"y","0"),P.setAttributeNS(null,"width",pf(A)),P.setAttributeNS(null,"height",pf(E)),P.setAttributeNS(null,"fill",C),P.setAttributeNS(null,"mask",`url(#${u.maskId})`),this.defs.append(T),this._ensureTransformGroup().append(P),this.paintInlineImageXObject(l,T)}paintFormXObjectBegin(o,l){if(Array.isArray(o)&&6===o.length&&this.transform(o[0],o[1],o[2],o[3],o[4],o[5]),l){let o=l[2]-l[0],u=l[3]-l[1],A=this.svgFactory.createElement("svg:rect");A.setAttributeNS(null,"x",l[0]),A.setAttributeNS(null,"y",l[1]),A.setAttributeNS(null,"width",pf(o)),A.setAttributeNS(null,"height",pf(u)),this.current.element=A,this.clip("nonzero"),this.endPath()}}paintFormXObjectEnd(){}_initialize(o){let l=this.svgFactory.create(o.width,o.height),u=this.svgFactory.createElement("svg:defs");l.append(u),this.defs=u;let A=this.svgFactory.createElement("svg:g");
23return A.setAttributeNS(null,"transform",pm(o.transform)),l.append(A),this.svg=A,l}_ensureClipGroup(){if(!this.current.clipGroup){let o=this.svgFactory.createElement("svg:g");o.setAttributeNS(null,"clip-path",this.current.activeClipUrl),this.svg.append(o),this.current.clipGroup=o}return this.current.clipGroup}_ensureTransformGroup(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",pm(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}};l.SVGGraphics=SVGGraphics},(o,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.XfaText=void 0;let XfaText=class XfaText{static textContent(o){let l=[],u={items:l,styles:Object.create(null)};function walk(o){if(!o)return;let u=null,A=o.name;if("#text"===A)u=o.value;else{if(!XfaText.shouldBuildText(A))return;o?.attributes?.textContent?u=o.attributes.textContent:o.value&&(u=o.value)}if(null!==u&&l.push({str:u}),o.children)for(let l of o.children)walk(l)}return walk(o),u}static shouldBuildText(o){return!("textarea"===o||"input"===o||"option"===o||"select"===o)}};l.XfaText=XfaText},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TextLayerRenderTask=void 0,l.renderTextLayer=renderTextLayer,l.updateTextLayer=updateTextLayer;var A=u(1),S=u(6);let E=1e5,C=30,T=.8,P=new Map;function getCtx(o,l){let u;if(l&&A.FeatureTest.isOffscreenCanvasSupported)u=new OffscreenCanvas(o,o).getContext("2d",{alpha:!1});else{let l=document.createElement("canvas");l.width=l.height=o,u=l.getContext("2d",{alpha:!1})}return u}function getAscent(o,l){let u=P.get(o);if(u)return u;let A=getCtx(C,l);A.font=`${C}px ${o}`;let S=A.measureText(""),E=S.fontBoundingBoxAscent,M=Math.abs(S.fontBoundingBoxDescent);if(E){let l=E/(E+M);return P.set(o,l),A.canvas.width=A.canvas.height=0,l}A.strokeStyle="red",A.clearRect(0,0,C,C),A.strokeText("g",0,0);let F=A.getImageData(0,0,C,C).data;M=0;for(let o=F.length-1-3;o>=0;o-=4)if(F[o]>0){M=Math.ceil(o/4/C);break}A.clearRect(0,0,C,C),A.strokeText("A",0,C),F=A.getImageData(0,0,C,C).data,E=0;for(let o=0,l=F.length;o<l;o+=4)if(F[o]>0){E=C-Math.floor(o/4/C);break}if(A.canvas.width=A.canvas.height=0,E){let l=E/(E+M);return P.set(o,l),l}return P.set(o,T),T}function appendText(o,l,u){let S,E;let C=document.createElement("span"),T={angle:0,canvasWidth:0,hasText:""!==l.str,hasEOL:l.hasEOL,fontSize:0};o._textDivs.push(C);let P=A.Util.transform(o._transform,l.transform),M=Math.atan2(P[1],P[0]),F=u[l.fontName];F.vertical&&(M+=Math.PI/2);let R=Math.hypot(P[2],P[3]),D=R*getAscent(F.fontFamily,o._isOffscreenCanvasSupported);0===M?(S=P[4],E=P[5]-D):(S=P[4]+D*Math.sin(M),E=P[5]-D*Math.cos(M));let I="calc(var(--scale-factor)*",L=C.style;o._container===o._rootContainer?(L.left=`${(100*S/o._pageWidth).toFixed(2)}%`,L.top=`${(100*E/o._pageHeight).toFixed(2)}%`):(L.left=`${I}${S.toFixed(2)}px)`,L.top=`${I}${E.toFixed(2)}px)`),L.fontSize=`${I}${R.toFixed(2)}px)`,L.fontFamily=F.fontFamily,T.fontSize=R,C.setAttribute("role","presentation"),C.textContent=l.str,C.dir=l.dir,o._fontInspectorEnabled&&(C.dataset.fontName=l.fontName),0!==M&&(T.angle=M*(180/Math.PI));let O=!1;if(l.str.length>1)O=!0;else if(" "!==l.str&&l.transform[0]!==l.transform[3]){let o=Math.abs(l.transform[0]),u=Math.abs(l.transform[3]);o!==u&&Math.max(o,u)/Math.min(o,u)>1.5&&(O=!0)}O&&(T.canvasWidth=F.vertical?l.height:l.width),o._textDivProperties.set(C,T),o._isReadableStream&&o._layoutText(C)}function layout(o){let{div:l,scale:u,properties:A,ctx:S,prevFontSize:E,prevFontFamily:C}=o,{style:T}=l,P="";if(0!==A.canvasWidth&&A.hasText){let{fontFamily:M}=T,{canvasWidth:F,fontSize:R}=A;(E!==R||C!==M)&&(S.font=`${R*u}px ${M}`,o.prevFontSize=R,o.prevFontFamily=M);let{width:D}=S.measureText(l.textContent);D>0&&(P=`scaleX(${F*u/D})`)}0!==A.angle&&(P=`rotate(${A.angle}deg) ${P}`),P.length>0&&(T.transform=P)}function render(o){if(o._canceled)return;let l=o._textDivs,u=o._capability,A=l.length;if(A>E){u.resolve();return}if(!o._isReadableStream)for(let u of l)o._layoutText(u);u.resolve()}let TextLayerRenderTask=class TextLayerRenderTask{constructor({textContentSource:o,container:l,viewport:u,textDivs:E,textDivProperties:C,textContentItemsStr:T,isOffscreenCanvasSupported:P}){this._textContentSource=o,this._isReadableStream=o instanceof ReadableStream,this._container=this._rootContainer=l,this._textDivs=E||[],this._textContentItemsStr=T||[],this._isOffscreenCanvasSupported=P,this._fontInspectorEnabled=!!globalThis.FontInspector?.enabled,this._reader=null,this._textDivProperties=C||new WeakMap,this._canceled=!1,this._capability=new A.PromiseCapability,this._layoutTextParams={prevFontSize:null,prevFontFamily:null,div:null,scale:u.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:getCtx(0,P)};let{pageWidth:M,pageHeight:F,pageX:R,pageY:D}=u.rawDims;this._transform=[1,0,0,-1,-R,D+F],this._pageWidth=M,this._pageHeight=F,(0,S.setLayerDimensions)(l,u),this._capability.promise.finally(()=>{this._layoutTextParams=null}).catch(()=>{})}get promise(){return this._capability.promise}cancel(){this._canceled=!0,this._reader&&(this._reader.cancel(new A.AbortException("TextLayer task cancelled.")).catch(()=>{}),this._reader=null),this._capability.reject(new A.AbortException("TextLayer task cancelled."))}_processItems(o,l){for(let u of o){if(void 0===u.str){if("beginMarkedContentProps"===u.type||"beginMarkedContent"===u.type){let o=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),null!==u.id&&this._container.setAttribute("id",`${u.id}`),o.append(this._container)}else"endMarkedContent"===u.type&&(this._container=this._container.parentNode);continue}this._textContentItemsStr.push(u.str),appendText(this,u,l)}}_layoutText(o){let l=this._layoutTextParams.properties=this._textDivProperties.get(o);if(this._layoutTextParams.div=o,layout(this._layoutTextParams),l.hasText&&this._container.append(o),l.hasEOL){let o=document.createElement("br");o.setAttribute("role","presentation"),this._container.append(o)}}_render(){let o=new A.PromiseCapability,l=Object.create(null);if(this._isReadableStream){let pump=()=>{this._reader.read().then(({value:u,done:A})=>
23{if(A){o.resolve();return}Object.assign(l,u.styles),this._processItems(u.items,l),pump()},o.reject)};this._reader=this._textContentSource.getReader(),pump()}else if(this._textContentSource){let{items:l,styles:u}=this._textContentSource;this._processItems(l,u),o.resolve()}else throw Error('No "textContentSource" parameter specified.');o.promise.then(()=>{l=null,render(this)},this._capability.reject)}};function renderTextLayer(o){!o.textContentSource&&(o.textContent||o.textContentStream)&&((0,S.deprecated)("The TextLayerRender `textContent`/`textContentStream` parameters will be removed in the future, please use `textContentSource` instead."),o.textContentSource=o.textContent||o.textContentStream);let{container:l,viewport:u}=o,A=getComputedStyle(l),E=A.getPropertyValue("visibility"),C=parseFloat(A.getPropertyValue("--scale-factor"));"visible"===E&&(!C||Math.abs(C-u.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.");let T=new TextLayerRenderTask(o);return T._render(),T}function updateTextLayer({container:o,viewport:l,textDivs:u,textDivProperties:A,isOffscreenCanvasSupported:E,mustRotate:C=!0,mustRescale:T=!0}){if(C&&(0,S.setLayerDimensions)(o,{rotation:l.rotation}),T){let o=getCtx(0,E),S=l.scale*(globalThis.devicePixelRatio||1),C={prevFontSize:null,prevFontFamily:null,div:null,scale:S,properties:null,ctx:o};for(let o of u)C.properties=A.get(o),C.div=o,layout(C)}}l.TextLayerRenderTask=TextLayerRenderTask},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.AnnotationEditorLayer=void 0;var A=u(1),S=u(4),E=u(28),C=u(33),T=u(6),P=u(34);let AnnotationEditorLayer=class AnnotationEditorLayer{#eu;#ep=!1;#eg=null;#em=this.pointerup.bind(this);#ef=this.pointerdown.bind(this);#eb=new Map;#eA=!1;#ev=!1;#ey=!1;#e_;static _initialized=!1;constructor({uiManager:o,pageIndex:l,div:u,accessibilityManager:A,annotationLayer:S,viewport:T,l10n:M}){let F=[E.FreeTextEditor,C.InkEditor,P.StampEditor];if(!AnnotationEditorLayer._initialized)for(let o of(AnnotationEditorLayer._initialized=!0,F))o.initialize(M);
23o.registerEditorTypes(F),this.#e_=o,this.pageIndex=l,this.div=u,this.#eu=A,this.#eg=S,this.viewport=T,this.#e_.addLayer(this)}get isEmpty(){return 0===this.#eb.size}updateToolbar(o){this.#e_.updateToolbar(o)}updateMode(o=this.#e_.getMode()){this.#eS(),o===A.AnnotationEditorType.INK?(this.addInkEditorIfNeeded(!1),this.disableClick()):this.enableClick(),o!==A.AnnotationEditorType.NONE&&(this.div.classList.toggle("freeTextEditing",o===A.AnnotationEditorType.FREETEXT),this.div.classList.toggle("inkEditing",o===A.AnnotationEditorType.INK),this.div.classList.toggle("stampEditing",o===A.AnnotationEditorType.STAMP),this.div.hidden=!1)}addInkEditorIfNeeded(o){if(!o&&this.#e_.getMode()!==A.AnnotationEditorType.INK)return;if(!o){for(let o of this.#eb.values())if(o.isEmpty()){o.setInBackground();return}}let l=this.#eE({offsetX:0,offsetY:0},!1);l.setInBackground()}setEditingState(o){this.#e_.setEditingState(o)}addCommands(o){this.#e_.addCommands(o)}enable(){this.div.style.pointerEvents="auto";let o=new Set;for(let l of this.#eb.values())l.enableEditing(),l.annotationElementId&&o.add(l.annotationElementId);if(!this.#eg)return;let l=this.#eg.getEditableAnnotations();for(let u of l){if(u.hide(),this.#e_.isDeletedAnnotationElement(u.data.id)||o.has(u.data.id))continue;let l=this.deserialize(u);l&&(this.addOrRebuild(l),l.enableEditing())}}disable(){this.#ey=!0,this.div.style.pointerEvents="none";let o=new Set;for(let l of this.#eb.values()){if(l.disableEditing(),!l.annotationElementId||null!==l.serialize()){o.add(l.annotationElementId);continue}this.getEditableAnnotation(l.annotationElementId)?.show(),l.remove()}if(this.#eg){let l=this.#eg.getEditableAnnotations();for(let u of l){let{id:l}=u.data;o.has(l)||this.#e_.isDeletedAnnotationElement(l)||u.show()}}this.#eS(),this.isEmpty&&(this.div.hidden=!0),this.#ey=!1}getEditableAnnotation(o){return this.#eg?.getEditableAnnotation(o)||null}setActiveEditor(o){let l=this.#e_.getActive();l!==o&&this.#e_.setActiveEditor(o)}enableClick(){this.div.addEventListener("pointerdown",this.#ef),this.div.addEventListener("pointerup",this.#em)}disableClick(){this.div.removeEventListener("pointerdown",this.#ef),this.div.removeEventListener("pointerup",this.#em)}attach(o){this.#eb.set(o.id,o);let{annotationElementId:l}=o;l&&this.#e_.isDeletedAnnotationElement(l)&&this.#e_.removeDeletedAnnotationElement(o)}detach(o){this.#eb.delete(o.id),this.#eu?.removePointerInTextLayer(o.contentDiv),!this.#ey&&o.annotationElementId&&this.#e_.addDeletedAnnotationElement(o)}remove(o){this.detach(o),this.#e_.removeEditor(o),o.div.contains(document.activeElement)&&setTimeout(()=>{this.#e_.focusMainContainer()},0),o.div.remove(),o.isAttachedToDOM=!1,this.#ev||this.addInkEditorIfNeeded(!1)}changeParent(o){o.parent!==this&&(o.annotationElementId&&(this.#e_.addDeletedAnnotationElement(o.annotationElementId),S.AnnotationEditor.deleteAnnotationElement(o),o.annotationElementId=null),this.attach(o),o.parent?.detach(o),o.setParent(this),o.div&&o.isAttachedToDOM&&(o.div.remove(),this.div.append(o.div)))}add(o){if(this.changeParent(o),this.#e_.addEditor(o),this.attach(o),!o.isAttachedToDOM){let l=o.render();this.div.append(l),o.isAttachedToDOM=!0}o.fixAndSetPosition(),o.onceAdded(),this.#e_.addToAnnotationStorage(o)}moveEditorInDOM(o){if(!o.isAttachedToDOM)return;let{activeElement:l}=document;o.div.contains(l)&&(o._focusEventsAllowed=!1,setTimeout(()=>{o.div.contains(document.activeElement)?o._focusEventsAllowed=!0:(o.div.addEventListener("focusin",()=>{o._focusEventsAllowed=!0},{once:!0}),l.focus())},0)),o._structTreeParentId=this.#eu?.moveElementInDOM(this.div,o.div,o.contentDiv,!0)}addOrRebuild(o){o.needsToBeRebuilt()?o.rebuild():this.add(o)}addUndoableEditor(o){let cmd=()=>o._uiManager.rebuild(o),undo=()=>{o.remove()};this.addCommands({cmd,undo,mustExec:!1})}getNextId(){return this.#e_.getId()}#ex(o){switch(this.#e_.getMode()){case A.AnnotationEditorType.FREETEXT:return new E.FreeTextEditor(o);case A.AnnotationEditorType.INK:return new C.InkEditor(o);case A.AnnotationEditorType.STAMP:return new P.StampEditor(o)}return null}pasteEditor(o,l){this.#e_.updateToolbar(o),this.#e_.updateMode(o);let{offsetX:u,offsetY:A}=this.#eC(),S=this.getNextId(),E=this.#ex({parent:this,id:S,x:u,y:A,uiManager:this.#e_,isCentered:!0,...l});E&&this.add(E)}deserialize(o){switch(o.annotationType??o.annotationEditorType){case A.AnnotationEditorType.FREETEXT:return E.FreeTextEditor.deserialize(o,this,this.#e_);case A.AnnotationEditorType.INK:return C.InkEditor.deserialize(o,this,this.#e_);
23case A.AnnotationEditorType.STAMP:return P.StampEditor.deserialize(o,this,this.#e_)}return null}#eE(o,l){let u=this.getNextId(),A=this.#ex({parent:this,id:u,x:o.offsetX,y:o.offsetY,uiManager:this.#e_,isCentered:l});return A&&this.add(A),A}#eC(){let{x:o,y:l,width:u,height:A}=this.div.getBoundingClientRect(),S=Math.max(0,o),E=Math.max(0,l),C=Math.min(window.innerWidth,o+u),T=Math.min(window.innerHeight,l+A),P=(S+C)/2-o,M=(E+T)/2-l,[F,R]=this.viewport.rotation%180==0?[P,M]:[M,P];return{offsetX:F,offsetY:R}}addNewEditor(){this.#eE(this.#eC(),!0)}setSelected(o){this.#e_.setSelected(o)}toggleSelected(o){this.#e_.toggleSelected(o)}isSelected(o){return this.#e_.isSelected(o)}unselect(o){this.#e_.unselect(o)}pointerup(o){let{isMac:l}=A.FeatureTest.platform;if(0===o.button&&(!o.ctrlKey||!l)&&o.target===this.div&&this.#eA){if(this.#eA=!1,!this.#ep){this.#ep=!0;return}if(this.#e_.getMode()===A.AnnotationEditorType.STAMP){this.#e_.unselectAll();return}this.#eE(o,!1)}}pointerdown(o){if(this.#eA){this.#eA=!1;return}let{isMac:l}=A.FeatureTest.platform;if(0!==o.button||o.ctrlKey&&l||o.target!==this.div)return;this.#eA=!0;let u=this.#e_.getActive();this.#ep=!u||u.isEmpty()}findNewParent(o,l,u){let A=this.#e_.findParent(l,u);return null!==A&&A!==this&&(A.changeParent(o),!0)}destroy(){for(let o of(this.#e_.getActive()?.parent===this&&(this.#e_.commitOrRemove(),this.#e_.setActiveEditor(null)),this.#eb.values()))this.#eu?.removePointerInTextLayer(o.contentDiv),o.setParent(null),o.isAttachedToDOM=!1,o.div.remove();this.div=null,this.#eb.clear(),this.#e_.removeLayer(this)}#eS(){for(let o of(this.#ev=!0,this.#eb.values()))o.isEmpty()&&o.remove();this.#ev=!1}render({viewport:o}){for(let l of(this.viewport=o,(0,T.setLayerDimensions)(this.div,o),this.#e_.getEditors(this.pageIndex)))this.add(l);this.updateMode()}update({viewport:o}){this.#e_.commitOrRemove(),this.viewport=o,(0,T.setLayerDimensions)(this.div,{rotation:o.rotation}),this.updateMode()}get pageDimensions(){let{pageWidth:o,pageHeight:l}=this.viewport.rawDims;return[o,l]}};l.AnnotationEditorLayer=AnnotationEditorLayer},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.FreeTextEditor=void 0;var A=u(1),S=u(5),E=u(4),C=u(29);let FreeTextEditor=class FreeTextEditor extends E.AnnotationEditor{#eT=this.editorDivBlur.bind(this);#ew=this.editorDivFocus.bind(this);#eP=this.editorDivInput.bind(this);#eM=this.editorDivKeydown.bind(this);#ek;#eF="";#eR=`${this.id}-editor`;#eD;#eI=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){let o=FreeTextEditor.prototype,arrowChecker=o=>o.isEmpty(),l=S.AnnotationEditorUIManager.TRANSLATE_SMALL,u=S.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,A.shadow)(this,"_keyboardManager",new S.KeyboardManager([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],o.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],o.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],o._translateEmpty,{args:[-l,0],checker:arrowChecker}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],o._translateEmpty,{args:[-u,0],checker:arrowChecker}],[["ArrowRight","mac+ArrowRight"],o._translateEmpty,{args:[l,0],checker:arrowChecker}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],o._translateEmpty,{args:[u,0],checker:arrowChecker}],[["ArrowUp","mac+ArrowUp"],o._translateEmpty,{args:[0,-l],checker:arrowChecker}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],o._translateEmpty,{args:[0,-u],checker:arrowChecker}],[["ArrowDown","mac+ArrowDown"],o._translateEmpty,{args:[0,l],checker:arrowChecker}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],o._translateEmpty,{args:[0,u],checker:arrowChecker}]]))}static _type="freetext";constructor(o){super({...o,name:"freeTextEditor"}),this.#ek=o.color||FreeTextEditor._defaultColor||E.AnnotationEditor._defaultLineColor,this.#eD=o.fontSize||FreeTextEditor._defaultFontSize}static initialize(o){E.AnnotationEditor.initialize(o,{strings:["free_text2_default_content","editor_free_text2_aria_label"]});let l=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(l.getPropertyValue("--freetext-padding"))}static updateDefaultParams(o,l){switch(o){case A.AnnotationEditorParamsType.FREETEXT_S
23IZE:FreeTextEditor._defaultFontSize=l;break;case A.AnnotationEditorParamsType.FREETEXT_COLOR:FreeTextEditor._defaultColor=l}}updateParams(o,l){switch(o){case A.AnnotationEditorParamsType.FREETEXT_SIZE:this.#eL(l);break;case A.AnnotationEditorParamsType.FREETEXT_COLOR:this.#eO(l)}}static get defaultPropertiesToUpdate(){return[[A.AnnotationEditorParamsType.FREETEXT_SIZE,FreeTextEditor._defaultFontSize],[A.AnnotationEditorParamsType.FREETEXT_COLOR,FreeTextEditor._defaultColor||E.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[A.AnnotationEditorParamsType.FREETEXT_SIZE,this.#eD],[A.AnnotationEditorParamsType.FREETEXT_COLOR,this.#ek]]}#eL(o){let setFontsize=o=>{this.editorDiv.style.fontSize=`calc(${o}px * var(--scale-factor))`,this.translate(0,-(o-this.#eD)*this.parentScale),this.#eD=o,this.#eN()},l=this.#eD;this.addCommands({cmd:()=>{setFontsize(o)},undo:()=>{setFontsize(l)},mustExec:!0,type:A.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#eO(o){let l=this.#ek;this.addCommands({cmd:()=>{this.#ek=this.editorDiv.style.color=o},undo:()=>{this.#ek=this.editorDiv.style.color=l},mustExec:!0,type:A.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(o,l){this._uiManager.translateSelectedEditors(o,l,!0)}getInitialTranslation(){let o=this.parentScale;return[-FreeTextEditor._internalPadding*o,-(FreeTextEditor._internalPadding+this.#eD)*o]}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(A.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.#eM),this.editorDiv.addEventListener("focus",this.#ew),this.editorDiv.addEventListener("blur",this.#eT),this.editorDiv.addEventListener("input",this.#eP))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#eR),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",this.#eM),this.editorDiv.removeEventListener("focus",this.#ew),this.editorDiv.removeEventListener("blur",this.#eT),this.editorDiv.removeEventListener("input",this.#eP),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freeTextEditing"))}focusin(o){this._focusEventsAllowed&&(super.focusin(o),o.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){if(this.width){this.#eB();return}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()}#eU(){let o=this.editorDiv.getElementsByTagName("div");if(0===o.length)return this.editorDiv.innerText;let l=[];for(let u of o)l.push(u.innerText.replace(/\r\n?|\n/,""));return l.join("\n")}#eN(){let o;let[l,u]=this.parentDimensions;if(this.isAttachedToDOM)o=this.div.getBoundingClientRect();else{let{currentLayer:l,div:u}=this,A=u.style.display;u.style.display="hidden",l.div.append(this.div),o=u.getBoundingClientRect(),u.remove(),u.style.display=A}this.rotation%180==this.parentRotation%180?(this.width=o.width/l,this.height=o.height/u):(this.width=o.height/l,this.height=o.width/u),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();let o=this.#eF,l=this.#eF=this.#eU().trimEnd();if(o===l)return;let setText=o=>{if(this.#eF=o,!o){this.remove();return}this.#ej(),this._uiManager.rebuild(this),this.#eN()};this.addCommands({cmd:()=>{setText(l)},undo:()=>{setText(o)},mustExec:!1}),this.#eN()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(o){this.enterInEditMode()}keydown(o){o.target===this.div&&"Enter"===o.key&&(this.enterInEditMode(),o.preventDefault())}editorDivKeydown(o){FreeTextEditor._keyboardManager.exec(this,o)}editorDivFocus(o){this.isEditing=!0}editorDivBlur(o){this.isEditing=!1}editorDivInput(o){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(){let o,l;if(this.div)return this.div;this.width&&(o=this.x,l=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#eR),this.enableEditing(),E.AnnotationEditor._l10nPromise.get("editor_free_text2_aria_label").then(o=>this.editorDiv?.setAttribute("aria-label",o)),E.AnnotationEditor._l10nPromise.get("free_text2_default_content").then(o=>this.editorDiv?.setAttribute("default-content",o)),this.editorDiv.contentEditable=!0;let{style:u}=this.editorDiv;if(u.fontSize=`calc(${this.#eD}px * var(--scale-factor))`,u.color=this.#ek,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){let[u,A]=this.parentDimensions;
23if(this.annotationElementId){let S,E;let{position:C}=this.#eI,[T,P]=this.getInitialTranslation();[T,P]=this.pageTranslationToScreen(T,P);let[M,F]=this.pageDimensions,[R,D]=this.pageTranslation;switch(this.rotation){case 0:S=o+(C[0]-R)/M,E=l+this.height-(C[1]-D)/F;break;case 90:S=o+(C[0]-R)/M,E=l-(C[1]-D)/F,[T,P]=[P,-T];break;case 180:S=o-this.width+(C[0]-R)/M,E=l-(C[1]-D)/F,[T,P]=[-T,-P];break;case 270:S=o+(C[0]-R-this.height*F)/M,E=l+(C[1]-D-this.width*M)/F,[T,P]=[-P,T]}this.setAt(S*u,E*A,T,P)}else this.setAt(o*u,l*A,this.width*u,this.height*A);this.#ej(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}#ej(){if(this.editorDiv.replaceChildren(),this.#eF)for(let o of this.#eF.split("\n")){let l=document.createElement("div");l.append(o?document.createTextNode(o):document.createElement("br")),this.editorDiv.append(l)}}get contentDiv(){return this.editorDiv}static deserialize(o,l,u){let S=null;if(o instanceof C.FreeTextAnnotationElement){let{data:{defaultAppearanceData:{fontSize:l,fontColor:u},rect:E,rotation:C,id:T},textContent:P,textPosition:M,parent:{page:{pageNumber:F}}}=o;if(!P||0===P.length)return null;S=o={annotationType:A.AnnotationEditorType.FREETEXT,color:Array.from(u),fontSize:l,value:P.join("\n"),position:M,pageIndex:F-1,rect:E,rotation:C,id:T,deleted:!1}}let E=super.deserialize(o,l,u);return E.#eD=o.fontSize,E.#ek=A.Util.makeHexColor(...o.color),E.#eF=o.value,E.annotationElementId=o.id||null,E.#eI=S,E}serialize(o=!1){if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0};let l=FreeTextEditor._internalPadding*this.parentScale,u=this.getRect(l,l),S=E.AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#ek),C={annotationType:A.AnnotationEditorType.FREETEXT,color:S,fontSize:this.#eD,value:this.#eF,pageIndex:this.pageIndex,rect:u,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return o?C:this.annotationElementId&&!this.#eH(C)?null:(C.id=this.annotationElementId,C)}#eH(o){let{value:l,fontSize:u,color:A,rect:S,pageIndex:E}=this.#eI;return o.value!==l||o.fontSize!==u||o.rect.some((o,l)=>Math.abs(o-S[l])>=1)||o.color.some((o,l)=>o!==A[l])||o.pageIndex!==E}#eB(o=!1){if(!this.annotationElementId)return;if(this.#eN(),!o&&(0===this.width||0===this.height)){setTimeout(()=>this.#eB(!0),0);return}let l=FreeTextEditor._internalPadding*this.parentScale;this.#eI.rect=this.getRect(l,l)}};l.FreeTextEditor=FreeTextEditor},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.StampAnnotationElement=l.InkAnnotationElement=l.FreeTextAnnotationElement=l.AnnotationLayer=void 0;var A=u(1),S=u(6),E=u(3),C=u(30),T=u(31),P=u(32);let M=1e3,F=9,R=new WeakSet;function getRectDims(o){return{width:o[2]-o[0],height:o[3]-o[1]}}let AnnotationElementFactory=class AnnotationElementFactory{static create(o){let l=o.data.annotationType;switch(l){case A.AnnotationType.LINK:return new LinkAnnotationElement(o);case A.AnnotationType.TEXT:return new TextAnnotationElement(o);case A.AnnotationType.WIDGET:let u=o.data.fieldType;switch(u){case"Tx":return new TextWidgetAnnotationElement(o);case"Btn":if(o.data.radioButton)return new RadioButtonWidgetAnnotationElement(o);if(o.data.checkBox)return new CheckboxWidgetAnnotationElement(o);return new PushButtonWidgetAnnotationElement(o);case"Ch":return new ChoiceWidgetAnnotationElement(o);case"Sig":return new SignatureWidgetAnnotationElement(o)}return new WidgetAnnotationElement(o);case A.AnnotationType.POPUP:return new PopupAnnotationElement(o);case A.AnnotationType.FREETEXT:return new FreeTextAnnotationElement(o);case A.AnnotationType.LINE:return new LineAnnotationElement(o);case A.AnnotationType.SQUARE:return new SquareAnnotationElement(o);case A.AnnotationType.CIRCLE:return new CircleAnnotationElement(o);case A.AnnotationType.POLYLINE:return new PolylineAnnotationElement(o);case A.AnnotationType.CARET:return new CaretAnnotationElement(o);case A.AnnotationType.INK:return new InkAnnotationElement(o);case A.AnnotationType.POLYGON:return new PolygonAnnotationElement(o);case A.AnnotationType.HIGHLIGHT:return new HighlightAnnotationElement(o);case A.AnnotationType.UNDERLINE:return new UnderlineAnnotationElement(o);case A.AnnotationType.SQUIGGLY:return new SquigglyAnnotationElement(o);case A.AnnotationType.STRIKEOUT:return new StrikeOutAnnotationElement(o);case A.AnnotationType.STAMP:return new StampAnnotationElement(o);case A.AnnotationType.FILEATTACHMENT:return new FileAttachmentAnnotationElement(o);default:return new AnnotationElement(o)}}};let AnnotationElement=class AnnotationElement{#eG=!1;constructor(o,{isRenderable:l=!1,ignoreBorder:u=!1,createQuadrilaterals:A=!1}={}){this.isRenderable=l,this.data=o.data,this.layer=o.layer,this.linkService=o.linkService,this.downloadManager=o.downloadManager,this.imageResourcesPath=o.imageResourcesPath,this.renderForms=o.renderForms,this.svgFactory=o.svgFactory,this.annotationStorage=o.annotationStorage,this.enableScripting=o.enableScripting,this.hasJSActions=o.hasJSActions,this._fieldObjects=o.fieldObjects,this.parent=o.parent,l&&(this.container=this._createContainer(u)),A&&this._createQuadrilaterals()}static _hasPopupData({titleObj:o,contentsObj:l,richText:u}){return!!(o?.str||l?.str||u?.str)}get hasPopupData(){return AnnotationElement._hasPopupData(this.data)}_createContainer(o){let{data:l,parent:{page:u,viewport:S}}=this,E=document.createElement("section");E.setAttribute("data-annotation-id",l.id),this instanceof WidgetAnnotationElement||(E.tabIndex=M),E.style.zIndex=this.parent.zIndex++,this.data.popupRef&&E.setAttribute("aria-haspopup","dialog"),l.noRotate&&E.classList.add("norotate");let{pageWidth:C,pageHeight:T,pageX:P,pageY:F}=S.rawDims;if(!l.rect||this instanceof PopupAnnotationElement){let{rotation:o}=l;return l.hasOwnCanvas||0===o||this.setRotation(o,E),E}let{width:R,height:D}=getRectDims(l.rect),I=A.Util.normalizeRect([l.rect[0],u.view[3]-l.rect[1]+u.view[
231],l.rect[2],u.view[3]-l.rect[3]+u.view[1]]);if(!o&&l.borderStyle.width>0){E.style.borderWidth=`${l.borderStyle.width}px`;let o=l.borderStyle.horizontalCornerRadius,u=l.borderStyle.verticalCornerRadius;if(o>0||u>0){let l=`calc(${o}px * var(--scale-factor)) / calc(${u}px * var(--scale-factor))`;E.style.borderRadius=l}else if(this instanceof RadioButtonWidgetAnnotationElement){let o=`calc(${R}px * var(--scale-factor)) / calc(${D}px * var(--scale-factor))`;E.style.borderRadius=o}switch(l.borderStyle.style){case A.AnnotationBorderStyleType.SOLID:E.style.borderStyle="solid";break;case A.AnnotationBorderStyleType.DASHED:E.style.borderStyle="dashed";break;case A.AnnotationBorderStyleType.BEVELED:(0,A.warn)("Unimplemented border style: beveled");break;case A.AnnotationBorderStyleType.INSET:(0,A.warn)("Unimplemented border style: inset");break;case A.AnnotationBorderStyleType.UNDERLINE:E.style.borderBottomStyle="solid"}let S=l.borderColor||null;S?(this.#eG=!0,E.style.borderColor=A.Util.makeHexColor(0|S[0],0|S[1],0|S[2])):E.style.borderWidth=0}E.style.left=`${100*(I[0]-P)/C}%`,E.style.top=`${100*(I[1]-F)/T}%`;let{rotation:L}=l;return l.hasOwnCanvas||0===L?(E.style.width=`${100*R/C}%`,E.style.height=`${100*D/T}%`):this.setRotation(L,E),E}setRotation(o,l=this.container){let u,A;if(!this.data.rect)return;let{pageWidth:S,pageHeight:E}=this.parent.viewport.rawDims,{width:C,height:T}=getRectDims(this.data.rect);o%180==0?(u=100*C/S,A=100*T/E):(u=100*T/S,A=100*C/E),l.style.width=`${u}%`,l.style.height=`${A}%`,l.setAttribute("data-main-rotation",(360-o)%360)}get _commonActions(){let setColor=(o,l,u)=>{let A=u.detail[o],S=A[0],E=A.slice(1);u.target.style[l]=C.ColorConverters[`${S}_HTML`](E),this.annotationStorage.setValue(this.data.id,{[l]:C.ColorConverters[`${S}_rgb`](E)})};return(0,A.shadow)(this,"_commonActions",{display:o=>{let{display:l}=o.detail,u=l%2==1;this.container.style.visibility=u?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:u,noPrint:1===l||2===l})},print:o=>{this.annotationStorage.setValue(this.data.id,{noPrint:!o.detail.print})},hidden:o=>{let{hidden:l}=o.detail;this.container.style.visibility=l?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:l,noView:l})},focus:o=>{setTimeout(()=>o.target.focus({preventScroll:!1}),0)},userName:o=>{o.target.title=o.detail.userName},readonly:o=>{o.target.disabled=o.detail.readonly},required:o=>{this._setRequired(o.target,o.detail.required)},bgColor:o=>{setColor("bgColor","backgroundColor",o)},fillColor:o=>{setColor("fillColor","backgroundColor",o)},fgColor:o=>{setColor("fgColor","color",o)},textColor:o=>{setColor("textColor","color",o)},borderColor:o=>{setColor("borderColor","borderColor",o)},strokeColor:o=>{setColor("strokeColor","borderColor",o)},rotation:o=>{let l=o.detail.rotation;this.setRotation(l),this.annotationStorage.setValue(this.data.id,{rotation:l})}})}_dispatchEventFromSandbox(o,l){let u=this._commonActions;for(let A of Object.keys(l.detail)){let S=o[A]||u[A];S?.(l)}}_setDefaultPropertiesFromJS(o){if(!this.enableScripting)return;let l=this.annotationStorage.getRawValue(this.data.id);if(!l)return;let u=this._commonActions;for(let[A,S]of Object.entries(l)){let E=u[A];
23if(E){let u={detail:{[A]:S},target:o};E(u),delete l[A]}}}_createQuadrilaterals(){let o;if(!this.container)return;let{quadPoints:l}=this.data;if(!l)return;let[u,A,S,E]=this.data.rect;if(1===l.length){let[,{x:o,y:C},{x:T,y:P}]=l[0];if(S===o&&E===C&&u===T&&A===P)return}let{style:C}=this.container;if(this.#eG){let{borderColor:l,borderWidth:u}=C;C.borderWidth=0,o=["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="${l}" stroke-width="${u}">`],this.container.classList.add("hasBorder")}let T=S-u,P=E-A,{svgFactory:M}=this,F=M.createElement("svg");F.classList.add("quadrilateralsContainer"),F.setAttribute("width",0),F.setAttribute("height",0);let R=M.createElement("defs");F.append(R);let D=M.createElement("clipPath"),I=`clippath_${this.data.id}`;for(let[,{x:A,y:S},{x:C,y:F}]of(D.setAttribute("id",I),D.setAttribute("clipPathUnits","objectBoundingBox"),R.append(D),l)){let l=M.createElement("rect"),R=(C-u)/T,I=(E-S)/P,L=(A-C)/T,O=(S-F)/P;l.setAttribute("x",R),l.setAttribute("y",I),l.setAttribute("width",L),l.setAttribute("height",O),D.append(l),o?.push(`<rect vector-effect="non-scaling-stroke" x="${R}" y="${I}" width="${L}" height="${O}"/>`)}this.#eG&&(o.push("</g></svg>')"),C.backgroundImage=o.join("")),this.container.append(F),this.container.style.clipPath=`url(#${I})`}_createPopup(){let{container:o,data:l}=this;o.setAttribute("aria-haspopup","dialog");let u=new PopupAnnotationElement({data:{color:l.color,titleObj:l.titleObj,modificationDate:l.modificationDate,contentsObj:l.contentsObj,richText:l.richText,parentRect:l.rect,borderStyle:0,id:`popup_${l.id}`,rotation:l.rotation},parent:this.parent,elements:[this]});this.parent.div.append(u.render())}render(){(0,A.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(o,l=null){let u=[];if(this._fieldObjects){let S=this._fieldObjects[o];if(S)for(let{page:o,id:E,exportValues:C}of S){if(-1===o||E===l)continue;let S="string"==typeof C?C:null,T=document.querySelector(`[data-element-id="${E}"]`);if(T&&!R.has(T)){(0,A.warn)(`_getElementsByName - element not allowed: ${E}`);continue}u.push({id:E,exportValue:S,domElement:T})}return u}for(let A of document.getElementsByName(o)){let{exportValue:o}=A,S=A.getAttribute("data-element-id");S!==l&&R.has(A)&&u.push({id:S,exportValue:o,domElement:A})}return u}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(){let o=this.getElementsToTriggerPopup();if(Array.isArray(o))for(let l of o)l.classList.add("highlightArea");else o.classList.add("highlightArea")}_editOnDoubleClick(){let{annotationEditorType:o,data:{id:l}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:o,editId:l})})}};let LinkAnnotationElement=class LinkAnnotationElement extends AnnotationElement{constructor(o,l=null){super(o,{isRenderable:!0,ignoreBorder:!!l?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=o.data.isTooltipOnly}render(){let{data:o,linkService:l}=this,u=document.createElement("a");u.setAttribute("data-element-id",o.id);let A=!1;return o.url?(l.addLinkAttributes(u,o.url,o.newWindow),A=!0):o.action?(this._bindNamedAction(u,o.action),A=!0):o.attachment?(this._bindAttachment(u,o.attachment),A=!0):o.setOCGState?(this.#ez(u,o.setOCGState),A=!0):o.dest?(this._bindLink(u,o.dest),A=!0):(o.actions&&(o.actions.Action||o.actions["Mouse Up"]||o.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(u,o),A=!0),o.resetForm?(this._bindResetFormAction(u,o.resetForm),A=!0):this.isTooltipOnly&&!A&&(this._bindLink(u,""),A=!0)),this.container.classList.add("linkAnnotation"),A&&this.container.append(u),this.container}#eV(){this.container.setAttribute("data-internal-link","")}_bindLink(o,l){o.href=this.linkService.getDestinationHash(l),o.onclick=()=>(l&&this.linkService.goToDestination(l),!1),(l||""===l)&&this.#eV()}_bindNamedAction(o,l){o.href=this.linkService.getAnchorUrl(""),o.onclick=()=>(this.linkService.executeNamedAction(l),!1),this.#eV()}_bindAttachment(o,l){o.href=this.linkService.getAnchorUrl(""),o.onclick=()=>(this.downloadManager?.openOrDownloadData(this.container,l.content,l.filename),!1),this.#eV()}#ez(o,l){o.href=this.linkService.getAnchorUrl(""),o.onclick=()=>(this.linkService.executeSetOCGState(l),!1),this.#eV()}_bindJSAction(o,l){o.href=this.linkService.getAnchorUrl("");let u=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(let A of Object.keys(l.actions)){let S=u.get(A);S&&(o[S]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:l.id,name:A}}),!1))}o.onclick||(o.onclick=()=>!1),this.#eV()}_bindResetFormAction(o,l){let u=o.onclick;if(u||(o.href=this.linkService.getAnchorUrl("")),this.#eV(),!this._fieldObjects){(0,A.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),u||(o.onclick=()=>!1);return}o.onclick=()=>{u?.();let{fields:o,refs:S,include:E}=l,C=[];if(0!==o.length||0!==S.length){let l=new Set(S);for(let u of o){let o=this._fieldObjects[u]||[];for(let{id:u}of o)l.add(u)}for(let o of Object.values(this._fieldObjects))for(let u of o)l.has(u.id)===E&&C.push(u)}else for(let o of Object.values(this._fieldObjects))C.push(...o);let T=this.annotationStorage,P=[];for(let o of C){let{id:l}=o;switch(P.push(l),o.type){case"text":{let u=o.defaultValue||"";T.setValue(l,{value:u});break}case"checkbox":case"radiobutton":{let u=o.defaultValue===o.exportValues;T.setValue(l,{value:u});break}case"combobox":case"listbox":{let u=o.defaultValue||"";T.setValue(l,{value:u});break}default:continue}let u=document.querySelector(`[data-element-id="${l}"]`);if(u){if(!R.has(u)){(0,A.warn)(`_bindResetFormAction - element not allowed: ${l}`);continue}u.dispatchEvent(new Event("resetform"))}}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:P,name:"ResetForm"}}),!1}}};let TextAnnotationElement=class TextAnnotationElement extends AnnotationElement{constructor(o){super(o,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");let o=document.createElement("img");return o.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",o.alt="[{{type}} Annotation]",o.dataset.l10nId="text_annotation_type",o.dataset.l10nArgs=JSON.stringify({type:this.data.name}),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(o),this.container}}
23;let WidgetAnnotationElement=class WidgetAnnotationElement extends AnnotationElement{render(){return this.data.alternativeText&&(this.container.title=this.data.alternativeText),this.container}showElementAndHideCanvas(o){this.data.hasOwnCanvas&&(o.previousSibling?.nodeName==="CANVAS"&&(o.previousSibling.hidden=!0),o.hidden=!1)}_getKeyModifier(o){let{isWin:l,isMac:u}=A.FeatureTest.platform;return l&&o.ctrlKey||u&&o.metaKey}_setEventListener(o,l,u,A,S){u.includes("mouse")?o.addEventListener(u,o=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:A,value:S(o),shift:o.shiftKey,modifier:this._getKeyModifier(o)}})}):o.addEventListener(u,o=>{if("blur"===u){if(!l.focused||!o.relatedTarget)return;l.focused=!1}else if("focus"===u){if(l.focused)return;l.focused=!0}S&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:A,value:S(o)}})})}_setEventListeners(o,l,u,A){for(let[S,E]of u)("Action"===E||this.data.actions?.[E])&&(("Focus"===E||"Blur"===E)&&(l||={focused:!1}),this._setEventListener(o,l,S,E,A),"Focus"!==E||this.data.actions?.Blur?"Blur"!==E||this.data.actions?.Focus||this._setEventListener(o,l,"focus","Focus",null):this._setEventListener(o,l,"blur","Blur",null))}_setBackgroundColor(o){let l=this.data.backgroundColor||null;o.style.backgroundColor=null===l?"transparent":A.Util.makeHexColor(l[0],l[1],l[2])}_setTextStyle(o){let l;let u=["left","center","right"],{fontColor:S}=this.data.defaultAppearanceData,E=this.data.defaultAppearanceData.fontSize||F,C=o.style,T=2,roundToOneDecimal=o=>
23Math.round(10*o)/10;if(this.data.multiLine){let o=Math.abs(this.data.rect[3]-this.data.rect[1]-T),u=Math.round(o/(A.LINE_FACTOR*E))||1,S=o/u;l=Math.min(E,roundToOneDecimal(S/A.LINE_FACTOR))}else{let o=Math.abs(this.data.rect[3]-this.data.rect[1]-T);l=Math.min(E,roundToOneDecimal(o/A.LINE_FACTOR))}C.fontSize=`calc(${l}px * var(--scale-factor))`,C.color=A.Util.makeHexColor(S[0],S[1],S[2]),null!==this.data.textAlignment&&(C.textAlign=u[this.data.textAlignment])}_setRequired(o,l){l?o.setAttribute("required",!0):o.removeAttribute("required"),o.setAttribute("aria-required",l)}};let TextWidgetAnnotationElement=class TextWidgetAnnotationElement extends WidgetAnnotationElement{constructor(o){let l=o.renderForms||!o.data.hasAppearance&&!!o.data.fieldValue;super(o,{isRenderable:l})}setPropertyOnSiblings(o,l,u,A){let S=this.annotationStorage;for(let E of this._getElementsByName(o.name,o.id))E.domElement&&(E.domElement[l]=u),S.setValue(E.id,{[A]:u})}render(){let o=this.annotationStorage,l=this.data.id;this.container.classList.add("textWidgetAnnotation");let u=null;if(this.renderForms){let A=o.getValue(l,{value:this.data.fieldValue}),S=A.value||"",E=o.getValue(l,{charLimit:this.data.maxLen}).charLimit;E&&S.length>E&&(S=S.slice(0,E));let C=A.formattedValue||this.data.textContent?.join("\n")||null;C&&this.data.comb&&(C=C.replaceAll(/\s+/g,""));let T={userValue:S,formattedValue:C,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?((u=document.createElement("textarea")).textContent=C??S,this.data.doNotScroll&&(u.style.overflowY="hidden")):((u=document.createElement("input")).type="text",u.setAttribute("value",C??S),this.data.doNotScroll&&(u.style.overflowX="hidden")),this.data.hasOwnCanvas&&(u.hidden=!0),R.add(u),u.setAttribute("data-element-id",l),u.disabled=this.data.readOnly,u.name=this.data.fieldName,u.tabIndex=M,this._setRequired(u,this.data.required),E&&(u.maxLength=E),u.addEventListener("input",A=>{o.setValue(l,{value:A.target.value}),this.setPropertyOnSiblings(u,"value",A.target.value,"value"),T.formattedValue=null}),u.addEventListener("resetform",o=>{let l=this.data.defaultFieldValue??"";u.value=T.userValue=l,T.formattedValue=null});let blurListener=o=>{let{formattedValue:l}=T;null!=l&&(o.target.value=l),o.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){u.addEventListener("focus",o=>{if(T.focused)return;let{target:l}=o;T.userValue&&(l.value=T.userValue),T.lastCommittedValue=l.value,T.commitKey=1,T.focused=!0}),u.addEventListener("updatefromsandbox",u=>{this.showElementAndHideCanvas(u.target);let A={value(u){T.userValue=u.detail.value??"",o.setValue(l,{value:T.userValue.toString()}),u.target.value=T.userValue},formattedValue(u){let{formattedValue:A}=u.detail;T.formattedValue=A,null!=A&&u.target!==document.activeElement&&(u.target.value=A),o.setValue(l,{formattedValue:A})},selRange(o){o.target.setSelectionRange(...o.detail.selRange)},charLimit:u=>{let{charLimit:A}=u.detail,{target:S}=u;if(0===A){S.removeAttribute("maxLength");return}S.setAttribute("maxLength",A);let E=T.userValue;E&&!(E.length<=A)&&(E=E.slice(0,A),S.value=T.userValue=E,o.setValue(l,{value:E}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:l,name:"Keystroke",value:E,willCommit:!0,commitKey:1,selStart:S.selectionStart,selEnd:S.selectionEnd}}))}};this._dispatchEventFromSandbox(A,u)}),u.addEventListener("keydown",o=>{T.commitKey=1;let u=-1;if("Escape"===o.key?u=0:"Enter"!==o.key||this.data.multiLine?"Tab"===o.key&&(T.commitKey=3):u=2,-1===u)return;let{value:A}=o.target;T.lastCommittedValue!==A&&(T.lastCommittedValue=A,T.userValue=A,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:l,name:"Keystroke",value:A,willCommit:!0,commitKey:u,selStart:o.target.selectionStart,selEnd:o.target.selectionEnd}}))});let A=blurListener;blurListener=null,u.addEventListener("blur",o=>{if(!T.focused||!o.relatedTarget)return;T.focused=!1;let{value:u}=o.target;T.userValue=u,T.lastCommittedValue!==u&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:l,name:"Keystroke",value:u,willCommit:!0,
23commitKey:T.commitKey,selStart:o.target.selectionStart,selEnd:o.target.selectionEnd}}),A(o)}),this.data.actions?.Keystroke&&u.addEventListener("beforeinput",o=>{T.lastCommittedValue=null;let{data:u,target:A}=o,{value:S,selectionStart:E,selectionEnd:C}=A,P=E,M=C;switch(o.inputType){case"deleteWordBackward":{let o=S.substring(0,E).match(/\w*[^\w]*$/);o&&(P-=o[0].length);break}case"deleteWordForward":{let o=S.substring(E).match(/^[^\w]*\w*/);o&&(M+=o[0].length);break}case"deleteContentBackward":E===C&&(P-=1);break;case"deleteContentForward":E===C&&(M+=1)}o.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:l,name:"Keystroke",value:S,change:u||"",willCommit:!1,selStart:P,selEnd:M}})}),this._setEventListeners(u,T,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.value)}if(blurListener&&u.addEventListener("blur",blurListener),this.data.comb){let o=this.data.rect[2]-this.data.rect[0],l=o/E;u.classList.add("comb"),u.style.letterSpacing=`calc(${l}px * var(--scale-factor) - 1ch)`}}else(u=document.createElement("div")).textContent=this.data.fieldValue,u.style.verticalAlign="middle",u.style.display="table-cell";return this._setTextStyle(u),this._setBackgroundColor(u),this._setDefaultPropertiesFromJS(u),this.container.append(u),this.container}};let SignatureWidgetAnnotationElement=class SignatureWidgetAnnotationElement extends WidgetAnnotationElement{constructor(o){super(o,{isRenderable:!!o.data.hasOwnCanvas})}};let CheckboxWidgetAnnotationElement=class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement{constructor(o){super(o,{isRenderable:o.renderForms})}render(){let o=this.annotationStorage,l=this.data,u=l.id,A=o.getValue(u,{value:l.exportValue===l.fieldValue}).value;"string"==typeof A&&(A="Off"!==A,o.setValue(u,{value:A})),this.container.classList.add("buttonWidgetAnnotation","checkBox");let S=document.createElement("input");return R.add(S),S.setAttribute("data-element-id",u),S.disabled=l.readOnly,this._setRequired(S,this.data.required),S.type="checkbox",S.name=l.fieldName,A&&S.setAttribute("checked",!0),S.setAttribute("exportValue",l.exportValue),S.tabIndex=M,S.addEventListener("change",A=>{let{name:S,checked:E}=A.target;for(let A of this._getElementsByName(S,u)){let u=E&&A.exportValue===l.exportValue;A.domElement&&(A.domElement.checked=u),o.setValue(A.id,{value:u})}o.setValue(u,{value:E})}),S.addEventListener("resetform",o=>{let u=l.defaultFieldValue||"Off";o.target.checked=u===l.exportValue}),this.enableScripting&&this.hasJSActions&&(S.addEventListener("updatefromsandbox",l=>{let A={value(l){l.target.checked="Off"!==l.detail.value,o.setValue(u,{value:l.target.checked})}};this._dispatchEventFromSandbox(A,l)}),this._setEventListeners(S,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.checked)),this._setBackgroundColor(S),this._setDefaultPropertiesFromJS(S),this.container.append(S),this.container}};let RadioButtonWidgetAnnotationElement=class RadioButtonWidgetAnnotationElement extends WidgetAnnotationElement{constructor(o){super(o,{isRenderable:o.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");let o=this.annotationStorage,l=this.data,u=l.id,A=o.getValue(u,{value:l.fieldValue===l.buttonValue}).value;"string"==typeof A&&(A=A!==l.buttonValue,o.setValue(u,{value:A}));let S=document.createElement("input");if(R.add(S),S.setAttribute("data-element-id",u),S.disabled=l.readOnly,this._setRequired(S,this.data.required),S.type="radio",S.name=l.fieldName,A&&S.setAttribute("checked",!0),S.tabIndex=M,S.addEventListener("change",l=>{let{name:A,checked:S}=l.target;for(let l of this._getElementsByName(A,u))o.setValue(l.id,{value:!1});o.setValue(u,{value:S})}),S.addEventListener("resetform",o=>{let u=l.defaultFieldValue;o.target.checked=null!=u&&u===l.buttonValue}),this.enableScripting&&this.hasJSActions){let A=l.buttonValue;S.addEventListener("updatefromsandbox",l=>{let S={value:l=>{let S=A===l.detail.value;for(let A of this._getElementsByName(l.target.name)){let l=S&&A.id===u;A.domElement&&(A.domElement.checked=l),o.setValue(A.id,{value:l})}}};this._dispatchEventFromSandbox(S,l)}),this._setEventListeners(S,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.checked)}
23return this._setBackgroundColor(S),this._setDefaultPropertiesFromJS(S),this.container.append(S),this.container}};let PushButtonWidgetAnnotationElement=class PushButtonWidgetAnnotationElement extends LinkAnnotationElement{constructor(o){super(o,{ignoreBorder:o.data.hasAppearance})}render(){let o=super.render();o.classList.add("buttonWidgetAnnotation","pushButton"),this.data.alternativeText&&(o.title=this.data.alternativeText);let l=o.lastChild;return this.enableScripting&&this.hasJSActions&&l&&(this._setDefaultPropertiesFromJS(l),l.addEventListener("updatefromsandbox",o=>{this._dispatchEventFromSandbox({},o)})),o}};let ChoiceWidgetAnnotationElement=class ChoiceWidgetAnnotationElement extends WidgetAnnotationElement{constructor(o){super(o,{isRenderable:o.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");let o=this.annotationStorage,l=this.data.id,u=o.getValue(l,{value:this.data.fieldValue}),A=document.createElement("select");R.add(A),A.setAttribute("data-element-id",l),A.disabled=this.data.readOnly,this._setRequired(A,this.data.required),A.name=this.data.fieldName,A.tabIndex=M;let S=this.data.combo&&this.data.options.length>0;for(let o of(!this.data.combo&&(A.size=this.data.options.length,this.data.multiSelect&&(A.multiple=!0)),A.addEventListener("resetform",o=>{let l=this.data.defaultFieldValue;for(let o of A.options)o.selected=o.value===l}),this.data.options)){let l=document.createElement("option");l.textContent=o.displayValue,l.value=o.exportValue,u.value.includes(o.exportValue)&&(l.setAttribute("selected",!0),S=!1),A.append(l)}let E=null;if(S){let o=document.createElement("option");o.value=" ",o.setAttribute("hidden",!0),o.setAttribute("selected",!0),A.prepend(o),E=()=>{o.remove(),A.removeEventListener("input",E),E=null},A.addEventListener("input",E)}let getValue=o=>{let l=o?"value":"textContent",{options:u,multiple:S}=A;return S?Array.prototype.filter.call(u,o=>o.selected).map(o=>o[l]):-1===u.selectedIndex?null:u[u.selectedIndex][l]},C=getValue(!1),getItems=o=>{let l=o.target.options;return Array.prototype.map.call(l,o=>({displayValue:o.textContent,exportValue:o.value}))};return this.enableScripting&&this.hasJSActions?(A.addEventListener("updatefromsandbox",u=>{let S={value(u){E?.();let S=u.detail.value,T=new Set(Array.isArray(S)?S:[S]);for(let o of A.options)o.selected=T.has(o.value);o.setValue(l,{value:getValue(!0)}),C=getValue(!1)},multipleSelection(o){A.multiple=!0},remove(u){let S=A.options,E=u.detail.remove;if(S[E].selected=!1,A.remove(E),S.length>0){let o=Array.prototype.findIndex.call(S,o=>o.selected);-1===o&&(S[0].selected=!0)}o.setValue(l,{value:getValue(!0),items:getItems(u)}),C=getValue(!1)},clear(u){for(;0!==A.length;)A.remove(0);o.setValue(l,{value:null,items:[]}),C=getValue(!1)},insert(u){let{index:S,displayValue:E,exportValue:T}=u.detail.insert,P=A.children[S],M=document.createElement("option");M.textContent=E,M.value=T,P?P.before(M):A.append(M),o.setValue(l,{value:getValue(!0),items:getItems(u)}),C=getValue(!1)},items(u){let{items:S}=u.detail;for(;0!==A.length;)A.remove(0);for(let o of S){let{displayValue:l,exportValue:u}=o,S=document.createElement("option");S.textContent=l,S.value=u,A.append(S)}A.options.length>0&&(A.options[0].selected=!0),o.setValue(l,{value:getValue(!0),items:getItems(u)}),C=getValue(!1)},indices(u){let A=new Set(u.detail.indices);for(let o of u.target.options)o.selected=A.has(o.index);o.setValue(l,{value:getValue(!0)}),C=getValue(!1)},editable(o){o.target.disabled=!o.detail.editable}};this._dispatchEventFromSandbox(S,u)}),A.addEventListener("input",u=>{let A=getValue(!0);o.setValue(l,{value:A}),u.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:l,name:"Keystroke",value:C,changeEx:A,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(A,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],o=>o.target.value)):A.addEventListener("input",function(u){o.setValue(l,{value:getValue(!0)})}
23),this.data.combo&&this._setTextStyle(A),this._setBackgroundColor(A),this._setDefaultPropertiesFromJS(A),this.container.append(A),this.container}};let PopupAnnotationElement=class PopupAnnotationElement extends AnnotationElement{constructor(o){let{data:l,elements:u}=o;super(o,{isRenderable:AnnotationElement._hasPopupData(l)}),this.elements=u}render(){this.container.classList.add("popupAnnotation");let o=new PopupElement({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}),l=[];for(let u of this.elements)u.popup=o,l.push(u.data.id),u.addHighlightArea();return this.container.setAttribute("aria-controls",l.map(o=>`${A.AnnotationPrefix}${o}`).join(",")),this.container}};let PopupElement=class PopupElement{#eW=null;#eq=this.#e$.bind(this);#eX=this.#eK.bind(this);#eY=this.#eJ.bind(this);#eQ=this.#eZ.bind(this);#ek=null;#tR=null;#e0=null;#e1=null;#e2=null;#e3=null;#e5=!1;#e4=null;#e8=null;#e6=null;#e7=null;#e9=!1;constructor({container:o,color:l,elements:u,titleObj:A,modificationDate:E,contentsObj:C,richText:T,parent:P,rect:M,parentRect:F,open:R}){this.#tR=o,this.#e7=A,this.#e0=C,this.#e6=T,this.#e2=P,this.#ek=l,this.#e8=M,this.#e3=F,this.#e1=u;let D=S.PDFDateString.toDateObject(E);for(let o of(D&&(this.#eW=P.l10n.get("annotation_date_string",{date:D.toLocaleDateString(),time:D.toLocaleTimeString()})),this.trigger=u.flatMap(o=>o.getElementsToTriggerPopup()),this.trigger))o.addEventListener("click",this.#eQ),o.addEventListener("mouseenter",this.#eY),o.addEventListener("mouseleave",this.#eX),o.classList.add("popupTriggerArea");for(let o of u)o.container?.addEventListener("keydown",this.#eq);this.#tR.hidden=!0,R&&this.#eZ()}render(){if(this.#e4)return;let{page:{view:o},viewport:{rawDims:{pageWidth:l,pageHeight:u,pageX:S,pageY:E}}}=this.#e2,C=this.#e4=document.createElement("div");if(C.className="popup",this.#ek){let o=C.style.outlineColor=A.Util.makeHexColor(...this.#ek);if(CSS.supports("background-color","color-mix(in srgb, red 30%, white)"))C.style.backgroundColor=`color-mix(in srgb, ${o} 30%, white)`;else{let o=.7;C.style.backgroundColor=A.Util.makeHexColor(...this.#ek.map(l=>Math.floor(o*(255-l)+l)))}}let T=document.createElement("span");T.className="header";let M=document.createElement("h1");if(T.append(M),{dir:M.dir,str:M.textContent}=this.#e7,C.append(T),this.#eW){let o=document.createElement("span");o.classList.add("popupDate"),this.#eW.then(l=>{o.textContent=l}),T.append(o)}let F=this.#e0,R=this.#e6;if(R?.str&&(!F?.str||F.str===R.str))P.XfaLayer.render({xfaHtml:R.html,intent:"richText",div:C}),C.lastChild.classList.add("richText","popupContent");else{let o=this._formatContents(F);C.append(o)}let D=!!this.#e3,I=D?this.#e3:this.#e8;for(let o of this.#e1)if(!I||null!==A.Util.intersect(o.data.rect,I)){I=o.data.rect,D=!0;break}let L=A.Util.normalizeRect([I[0],o[3]-I[1]+o[1],I[2],o[3]-I[3]+o[1]]),O=5,N=D?I[2]-I[0]+O:0,B=L[0]+N,U=L[1],{style:H}=this.#tR;H.left=`${100*(B-S)/l}%`,H.top=`${100*(U-E)/u}%`,this.#tR.append(C)}_formatContents({str:o,dir:l}){let u=document.createElement("p");u.classList.add("popupContent"),u.dir=l;let A=o.split(/(?:\r\n?|\n)/);for(let o=0,l=A.length;o<l;++o){let S=A[o];u.append(document.createTextNode(S)),o<l-1&&u.append(document.createElement("br"))}return u}#e$(o){o.altKey||o.shiftKey||o.ctrlKey||o.metaKey||"Enter"!==o.key&&("Escape"!==o.key||!this.#e5)||this.#eZ()}#eZ(){this.#e5=!this.#e5,this.#e5?(this.#eJ(),this.#tR.addEventListener("click",this.#eQ),this.#tR.addEventListener("keydown",this.#eq)):(this.#eK(),this.#tR.removeEventListener("click",this.#eQ),this.#tR.removeEventListener("keydown",this.#eq))}#eJ(){this.#e4||this.render(),this.isVisible?this.#e5&&this.#tR.classList.add("focused"):(this.#tR.hidden=!1,this.#tR.style.zIndex=parseInt(this.#tR.style.zIndex)+1e3)}#eK(){this.#tR.classList.remove("focused"),!this.#e5&&this.isVisible&&(this.#tR.hidden=!0,this.#tR.style.zIndex=parseInt(this.#tR.style.zIndex)-1e3)}forceHide(){this.#e9=this.isVisible,this.#e9&&(this.#tR.hidden=!0)}maybeShow(){this.#e9&&(this.#e9=!1,this.#tR.hidden=!1)}get isVisible(){return!1===this.#tR.hidden}};let FreeTextAnnotationElement=class FreeTextAnnotationElement extends AnnotationElement{constructor(o){super(o,{isRenderable:!0,ignoreBorder:!0}),this.textContent=o.data.textContent,this.textPosition=o.data.textPosition,this.annotationEditorType=A.AnnotationEditorType.FREETEXT}
23render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){let o=document.createElement("div");for(let l of(o.classList.add("annotationTextContent"),o.setAttribute("role","comment"),this.textContent)){let u=document.createElement("span");u.textContent=l,o.append(u)}this.container.append(o)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}};l.FreeTextAnnotationElement=FreeTextAnnotationElement;let LineAnnotationElement=class LineAnnotationElement extends AnnotationElement{#it=null;constructor(o){super(o,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");let o=this.data,{width:l,height:u}=getRectDims(o.rect),A=this.svgFactory.create(l,u,!0),S=this.#it=this.svgFactory.createElement("svg:line");return S.setAttribute("x1",o.rect[2]-o.lineCoordinates[0]),S.setAttribute("y1",o.rect[3]-o.lineCoordinates[1]),S.setAttribute("x2",o.rect[2]-o.lineCoordinates[2]),S.setAttribute("y2",o.rect[3]-o.lineCoordinates[3]),S.setAttribute("stroke-width",o.borderStyle.width||1),S.setAttribute("stroke","transparent"),S.setAttribute("fill","transparent"),A.append(S),this.container.append(A),!o.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#it}addHighlightArea(){this.container.classList.add("highlightArea")}};let SquareAnnotationElement=class SquareAnnotationElement extends AnnotationElement{#ie=null;constructor(o){super(o,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");let o=this.data,{width:l,height:u}=getRectDims(o.rect),A=this.svgFactory.create(l,u,!0),S=o.borderStyle.width,E=this.#ie=this.svgFactory.createElement("svg:rect");return E.setAttribute("x",S/2),E.setAttribute("y",S/2),E.setAttribute("width",l-S),E.setAttribute("height",u-S),E.setAttribute("stroke-width",S||1),E.setAttribute("stroke","transparent"),E.setAttribute("fill","transparent"),A.append(E),this.container.append(A),!o.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#ie}addHighlightArea(){this.container.classList.add("highlightArea")}};let CircleAnnotationElement=class CircleAnnotationElement extends AnnotationElement{#ii=null;constructor(o){super(o,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");let o=this.data,{width:l,height:u}=getRectDims(o.rect),A=this.svgFactory.create(l,u,!0),S=o.borderStyle.width,E=this.#ii=this.svgFactory.createElement("svg:ellipse");return E.setAttribute("cx",l/2),E.setAttribute("cy",u/2),E.setAttribute("rx",l/2-S/2),E.setAttribute("ry",u/2-S/2),E.setAttribute("stroke-width",S||1),E.setAttribute("stroke","transparent"),E.setAttribute("fill","transparent"),A.append(E),this.container.append(A),!o.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#ii}addHighlightArea(){this.container.classList.add("highlightArea")}};let PolylineAnnotationElement=class PolylineAnnotationElement extends AnnotationElement{#is=null;constructor(o){super(o,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);let o=this.data,{width:l,height:u}=getRectDims(o.rect),A=this.svgFactory.create(l,u,!0),S=[];for(let l of o.vertices){let u=l.x-o.rect[0],A=o.rect[3]-l.y;S.push(u+","+A)}S=S.join(" ");let E=this.#is=this.svgFactory.createElement(this.svgElementName);return E.setAttribute("points",S),E.setAttribute("stroke-width",o.borderStyle.width||1),E.setAttribute("stroke","transparent"),E.setAttribute("fill","transparent"),A.append(E),this.container.append(A),!o.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#is}addHighlightArea(){this.container.classList.add("highlightArea")}};let PolygonAnnotationElement=class PolygonAnnotationElement extends PolylineAnnotationElement{constructor(o){super(o),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}};let CaretAnnotationElement=class CaretAnnotationElement extends AnnotationElement{constructor(o){super(o,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}
23;let InkAnnotationElement=class InkAnnotationElement extends AnnotationElement{#ir=[];constructor(o){super(o,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=A.AnnotationEditorType.INK}render(){this.container.classList.add(this.containerClassName);let o=this.data,{width:l,height:u}=getRectDims(o.rect),A=this.svgFactory.create(l,u,!0);for(let l of o.inkLists){let u=[];for(let A of l){let l=A.x-o.rect[0],S=o.rect[3]-A.y;u.push(`${l},${S}`)}u=u.join(" ");let S=this.svgFactory.createElement(this.svgElementName);this.#ir.push(S),S.setAttribute("points",u),S.setAttribute("stroke-width",o.borderStyle.width||1),S.setAttribute("stroke","transparent"),S.setAttribute("fill","transparent"),!o.popupRef&&this.hasPopupData&&this._createPopup(),A.append(S)}return this.container.append(A),this.container}getElementsToTriggerPopup(){return this.#ir}addHighlightArea(){this.container.classList.add("highlightArea")}};l.InkAnnotationElement=InkAnnotationElement;let HighlightAnnotationElement=class HighlightAnnotationElement extends AnnotationElement{constructor(o){super(o,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this.container}};let UnderlineAnnotationElement=class UnderlineAnnotationElement extends AnnotationElement{constructor(o){super(o,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}};let SquigglyAnnotationElement=class SquigglyAnnotationElement extends AnnotationElement{constructor(o){super(o,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}};let StrikeOutAnnotationElement=class StrikeOutAnnotationElement extends AnnotationElement{constructor(o){super(o,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}};let StampAnnotationElement=class StampAnnotationElement extends AnnotationElement{constructor(o){super(o,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("stampAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}};l.StampAnnotationElement=StampAnnotationElement;let FileAttachmentAnnotationElement=class FileAttachmentAnnotationElement extends AnnotationElement{#ia=null;constructor(o){super(o,{isRenderable:!0});let{filename:l,content:u}=this.data.file;this.filename=(0,S.getFilenameFromUrl)(l,!0),this.content=u,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,filename:l,content:u})}render(){let o;this.container.classList.add("fileAttachmentAnnotation");let{container:l,data:u}=this;u.hasAppearance||0===u.fillAlpha?o=document.createElement("div"):((o=document.createElement("img")).src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(u.name)?"paperclip":"pushpin"}.svg`,u.fillAlpha&&u.fillAlpha<1&&(o.style=`filter: opacity(${Math.round(100*u.fillAlpha)}%);`)),o.addEventListener("dblclick",this.#io.bind(this)),this.#ia=o;let{isMac:S}=A.FeatureTest.platform;return l.addEventListener("keydown",o=>{"Enter"===o.key&&(S?o.metaKey:o.ctrlKey)&&this.#io()}),!u.popupRef&&this.hasPopupData?this._createPopup():o.classList.add("popupTriggerArea"),l.append(o),l}getElementsToTriggerPopup(){return this.#ia}addHighlightArea(){this.container.classList.add("highlightArea")}#io(){this.downloadManager?.openOrDownloadData(this.container,this.content,this.filename)}};let AnnotationLayer=class AnnotationLayer{#eu=null;#il=null;#ih=new Map;constructor({div:o,accessibilityManager:l,annotationCanvasMap:u,l10n:A,page:S,viewport:E}){this.div=o,this.#eu=l,this.#il=u,this.l10n=A,this.page=S,this.viewport=E,this.zIndex=0,this.l10n||=T.NullL10n}#id(o,l){let u=o.firstChild||o;u.id=`${A.AnnotationPrefix}${l}`,this.div.append(o),this.#eu?.moveElementInDOM(this.div,o,u,!1)}async render(o){let{annotations:l}=o,u=this.div;(0,S.setLayerDimensions)(u,this.viewport);let C=new Map,T={data:null,layer:u,linkService:o.linkService,downloadManager:o.downloadManager,imageResourcesPath:o.imageResourcesPath||"",renderForms:!1!==o.renderForms,svgFactory:new S.DOMSVGFactory,annotationStorage:o.annotationStorage||new E.AnnotationStorage,enableScripting:!0===o.enableScripting,hasJSActions:o.hasJSActions,fieldObjects:o.fieldObjects,parent:this,elements:null};for(let o of l){if(o.noHTML)continue;let l=o.annotationType===A.AnnotationType.POPUP;if(l){let l=C.get(o.id);if(!l)continue;T.elements=l}else{let{width:l,height:u}=getRectDims(o.rect);if(l<=0||u<=0)continue}T.data=o;let u=AnnotationElementFactory.create(T);if(!u.isRenderable)continue;if(!l&&o.popupRef){let l=C.get(o.popupRef);l?l.push(u):C.set(o.popupRef,[u])}u.annotationEditorType>0&&this.#ih.set(u.data.id,u);let S=u.render();o.hidden&&(S.style.visibility="hidden"),this.#id(S,o.id)}this.#ic(),await this.l10n.translate(u)}update({viewport:o}){let l=this.div;this.viewport=o,(0,S.setLayerDimensions)(l,{rotation:o.rotation}),this.#ic(),l.hidden=!1}#ic(){if(!this.#il)return;let o=this.div;for(let[l,u]of this.#il){let A=o.querySelector(`[data-annotation-id="${l}"]`);if(!A)continue;let{firstChild:S}=A;S?"CANVAS"===S.nodeName?S.replaceWith(u):S.before(u):A.append(u)}this.#il.clear()}getEditableAnnotations(){return Array.from(this.#ih.values())}getEditableAnnotation(o){return this.#ih.get(o)}};l.AnnotationLayer=AnnotationLayer},(o,l)=>{function makeColorComp(o){return Math.floor(255*Math.max(0,Math.min(1,o))).toString(16).padStart(2,"0")}function scaleAndClamp(o){return Math.max(0,Math.min(255,255*o))}
23Object.defineProperty(l,"__esModule",{value:!0}),l.ColorConverters=void 0;let ColorConverters=class ColorConverters{static CMYK_G([o,l,u,A]){return["G",1-Math.min(1,.3*o+.59*u+.11*l+A)]}static G_CMYK([o]){return["CMYK",0,0,0,1-o]}static G_RGB([o]){return["RGB",o,o,o]}static G_rgb([o]){return[o=scaleAndClamp(o),o,o]}static G_HTML([o]){let l=makeColorComp(o);return`#${l}${l}${l}`}static RGB_G([o,l,u]){return["G",.3*o+.59*l+.11*u]}static RGB_rgb(o){return o.map(scaleAndClamp)}static RGB_HTML(o){return`#${o.map(makeColorComp).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([o,l,u,A]){return["RGB",1-Math.min(1,o+A),1-Math.min(1,u+A),1-Math.min(1,l+A)]}static CMYK_rgb([o,l,u,A]){return[scaleAndClamp(1-Math.min(1,o+A)),scaleAndClamp(1-Math.min(1,u+A)),scaleAndClamp(1-Math.min(1,l+A))]}static CMYK_HTML(o){let l=this.CMYK_RGB(o).slice(1);return this.RGB_HTML(l)}static RGB_CMYK([o,l,u]){let A=1-o,S=1-l,E=1-u,C=Math.min(A,S,E);return["CMYK",A,S,E,C]}};l.ColorConverters=ColorConverters},(o,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.NullL10n=void 0,l.getL10nFallback=getL10nFallback;let u={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}} \xd7 {{height}} {{unit}} ({{orientation}})",document_properties_page_size_dimension_name_string:"{{width}} \xd7 {{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 getL10nFallback(o,l){switch(o){case"find_match_count":o=`find_match_count[${1===l.total?"one":"other"}]`;break;case"find_match_count_limit":o=`find_match_count_limit[${1===l.limit?"one":"other"}]`}return u[o]||""}function formatL10nValue(o,l){return l?o.replaceAll(/\{\{\s*(\w+)\s*\}\}/g,(o,u)=>u in l?l[u]:"{{"+u+"}}"):o}u.print_progress_percent="{{progress}}%";let A={getLanguage:async()=>"en-us",getDirection:async()=>"ltr",get:async(o,l=null,u=getL10nFallback(o,l))=>formatL10nValue(u,l),async translate(o){}};l.NullL10n=A},(o,l,u)=>
23{Object.defineProperty(l,"__esModule",{value:!0}),l.XfaLayer=void 0;var A=u(25);let XfaLayer=class XfaLayer{static setupStorage(o,l,u,A,S){let E=A.getValue(l,{value:null});switch(u.name){case"textarea":if(null!==E.value&&(o.textContent=E.value),"print"===S)break;o.addEventListener("input",o=>{A.setValue(l,{value:o.target.value})});break;case"input":if("radio"===u.attributes.type||"checkbox"===u.attributes.type){if(E.value===u.attributes.xfaOn?o.setAttribute("checked",!0):E.value===u.attributes.xfaOff&&o.removeAttribute("checked"),"print"===S)break;o.addEventListener("change",o=>{A.setValue(l,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(null!==E.value&&o.setAttribute("value",E.value),"print"===S)break;o.addEventListener("input",o=>{A.setValue(l,{value:o.target.value})})}break;case"select":if(null!==E.value)for(let l of(o.setAttribute("value",E.value),u.children))l.attributes.value===E.value?l.attributes.selected=!0:l.attributes.hasOwnProperty("selected")&&delete l.attributes.selected;o.addEventListener("input",o=>{let u=o.target.options,S=-1===u.selectedIndex?"":u[u.selectedIndex].value;A.setValue(l,{value:S})})}}static setAttributes({html:o,element:l,storage:u=null,intent:A,linkService:S}){let{attributes:E}=l,C=o instanceof HTMLAnchorElement;for(let[l,u]of("radio"===E.type&&(E.name=`${E.name}-${A}`),Object.entries(E)))if(null!=u)switch(l){case"class":u.length&&o.setAttribute(l,u.join(" "));break;case"dataId":break;case"id":o.setAttribute("data-element-id",u);break;case"style":Object.assign(o.style,u);break;case"textContent":o.textContent=u;break;default:C&&("href"===l||"newWindow"===l)||o.setAttribute(l,u)}C&&S.addLinkAttributes(o,E.href,E.newWindow),u&&E.dataId&&this.setupStorage(o,E.dataId,l,u)}static render(o){let l=o.annotationStorage,u=o.linkService,S=o.xfaHtml,E=o.intent||"display",C=document.createElement(S.name);S.attributes&&this.setAttributes({html:C,element:S,intent:E,linkService:u});let T=[[S,-1,C]],P=o.div;if(P.append(C),o.viewport){let l=`matrix(${o.viewport.transform.join(",")})`;P.style.transform=l}"richText"!==E&&P.setAttribute("class","xfaLayer xfaFont");let M=[];for(;T.length>0;){let[o,S,C]=T.at(-1);if(S+1===o.children.length){T.pop();continue}let P=o.children[++T.at(-1)[1]];if(null===P)continue;let{name:F}=P;if("#text"===F){let o=document.createTextNode(P.value);M.push(o),C.append(o);continue}let R=P?.attributes?.xmlns?document.createElementNS(P.attributes.xmlns,F):document.createElement(F);if(C.append(R),P.attributes&&this.setAttributes({html:R,element:P,storage:l,intent:E,linkService:u}),P.children&&P.children.length>0)T.push([P,-1,R]);else if(P.value){let o=document.createTextNode(P.value);A.XfaText.shouldBuildText(F)&&M.push(o),R.append(o)}}for(let o of P.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))o.setAttribute("readOnly",!0);return{textDivs:M}}static update(o){let l=`matrix(${o.viewport.transform.join(",")})`;o.div.style.transform=l,o.div.hidden=!1}};l.XfaLayer=XfaLayer},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.InkEditor=void 0;var A=u(1),S=u(4),E=u(29),C=u(6),T=u(5);let InkEditor=class InkEditor extends S.AnnotationEditor{#iu=0;#ip=0;#ig=this.canvasPointermove.bind(this);#im=this.canvasPointerleave.bind(this);#ib=this.canvasPointerup.bind(this);#iA=this.canvasPointerdown.bind(this);#iv=new Path2D;#iy=!1;#i_=!1;#iS=!1;#iE=null;#ix=0;#iC=0;#iT=null;static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=1;static _type="ink";constructor(o){super({...o,name:"inkEditor"}),this.color=o.color||null,this.thickness=o.thickness||null,this.opacity=o.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(o){S.AnnotationEditor.initialize(o,{strings:["editor_ink_canvas_aria_label","editor_ink2_aria_label"]})}static updateDefaultParams(o,l){switch(o){case A.AnnotationEditorParamsType.INK_THICKNESS:InkEditor._defaultThickness=l;break;case A.AnnotationEditorParamsType.INK_COLOR:InkEditor._defaultColor=l;break;case A.AnnotationEditorParamsType.INK_OPACITY:InkEditor._defaultOpacity=l/100}}updateParams(o,l){switch(o){case A.AnnotationEditorParamsType.INK_THICKNESS:this.#iw(l);break;case A.AnnotationEditorParamsType.INK_COLOR:this.#eO(l);break;case A.AnnotationEditorParamsType.INK_OPACITY:this.#iP(l)}}static get defaultPropertiesToUpdate(){return[[A.AnnotationEditorParamsType.INK_THICKNESS,InkEditor._defaultThickness],[A.AnnotationEditorParamsType.INK_COLOR,InkEditor._defaultColor||S.AnnotationEditor._defaultLineColor],[A.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*InkEditor._defaultOpacity)]]}get propertiesToUpdate(){return[[A.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||InkEditor._defaultThickness],[A.AnnotationEditorParamsType.INK_COLOR,this.color||InkEditor._defaultColor||S.AnnotationEditor._defaultLineColor],[A.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??InkEditor._defaultOpacity))]]}#iw(o){let l=this.thickness;this.addCommands({cmd:()=>{this.thickness=o,this.#iM()},undo:()=>{this.thickness=l,this.#iM()},mustExec:!0,type:A.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#eO(o){let l=this.color;this.addCommands({cmd:()=>{this.color=o,this.#ik()},undo:()=>{this.color=l,this.#ik()},mustExec:!0,type:A.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#iP(o){o/=100;let l=this.opacity;this.addCommands({cmd:()=>{this.opacity=o,this.#ik()},undo:()=>{this.opacity=l,this.#ik()},mustExec:!0,type:A.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.canvas||(this.#iF(),this.#iR()),this.isAttachedToDOM||(this.parent.add(this),this.#iD()),this.#iM()))}remove(){null!==this.canvas&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.#iE.disconnect(),this.#iE=null,super.remove())}setParent(o){!this.parent&&o?this._uiManager.removeShouldRescale(this):this.parent&&null===o&&this._uiManager.addShouldRescale(this),super.setParent(o)}onScaleChanging(){let[o,l]=this.parentDimensions,u=this.width*o,A=this.height*l;this.setDimensions(u,A)}enableEditMode(){this.#iy||null===this.canvas||(super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener("pointerdown",this.#iA))}disableEditMode(){this.isInEditMode()&&null!==this.canvas&&(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",this.#iA))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}#iI(){let{parentRotation:o,parentDimensions:[l,u]}=this;switch(o){case 90:return[0,u,u,l];case 180:return[l,u,l,u];case 270:return[l,0,u,l];default:return[0,0,l,u]}}#iL(){let{ctx:o,color:l,opacity:u,thickness:A,parentScale:S,scaleFactor:E}=this;o.lineWidth=A*S/E,o.lineCap="round",o.lineJoin="round",o.miterLimit=10,o.strokeStyle=`${l}${(0,T.opacityToHex)(u)}`}#iO(o,l){this.canvas.addEventListener("contextmenu",C.noContextMenu),this.canvas.addEventListener("pointerleave",this.#im),this.canvas.addEventListener("pointermove",this.#ig),this.canvas.addEventListener("pointerup",this.#ib),this.canvas.removeEventListener("pointerdown",this.#iA),this.isEditing=!0,this.#iS||(this.#iS=!0,this.#iD(),this.thickness||=InkEditor._defaultThickness,this.color||=InkEditor._defaultColor||S.AnnotationEditor._defaultLineColor,this.opacity??=InkEditor._defaultOpacity),this.currentPath.push([o,l]),this.#i_=!1,this.#iL(),this.#iT=()=>{this.#iN(),this.#iT&&window.requestAnimationFrame(this.#iT)},window.requestAnimationFrame(this.#iT)}#iB(o,l){let[u,A]=this.currentPath.at(-1);if(this.currentPath.length>1&&o===u&&l===A)return;let S=this.currentPath,E=this.#iv;
23if(S.push([o,l]),this.#i_=!0,S.length<=2){E.moveTo(...S[0]),E.lineTo(o,l);return}3===S.length&&(this.#iv=E=new Path2D,E.moveTo(...S[0])),this.#iU(E,...S.at(-3),...S.at(-2),o,l)}#ij(){if(0===this.currentPath.length)return;let o=this.currentPath.at(-1);this.#iv.lineTo(...o)}#iH(o,l){let u;if(this.#iT=null,o=Math.min(Math.max(o,0),this.canvas.width),l=Math.min(Math.max(l,0),this.canvas.height),this.#iB(o,l),this.#ij(),1!==this.currentPath.length)u=this.#iG();else{let A=[o,l];u=[[A,A.slice(),A.slice(),A]]}let A=this.#iv,S=this.currentPath;this.currentPath=[],this.#iv=new Path2D;let cmd=()=>{this.allRawPaths.push(S),this.paths.push(u),this.bezierPath2D.push(A),this.rebuild()},undo=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),0===this.paths.length?this.remove():(this.canvas||(this.#iF(),this.#iR()),this.#iM())};this.addCommands({cmd,undo,mustExec:!0})}#iN(){if(!this.#i_)return;this.#i_=!1,this.thickness,this.parentScale;let o=this.currentPath.slice(-3),{ctx:l}=(o.map(o=>o[0]),o.map(o=>o[1]),this);for(let o of(l.save(),l.clearRect(0,0,this.canvas.width,this.canvas.height),this.bezierPath2D))l.stroke(o);l.stroke(this.#iv),l.restore()}#iU(o,l,u,A,S,E,C){let T=(l+A)/2,P=(u+S)/2,M=(A+E)/2,F=(S+C)/2;o.bezierCurveTo(T+2*(A-T)/3,P+2*(S-P)/3,M+2*(A-M)/3,F+2*(S-F)/3,M,F)}#iG(){let o;let l=this.currentPath;if(l.length<=2)return[[l[0],l[0],l.at(-1),l.at(-1)]];let u=[],[A,S]=l[0];for(o=1;o<l.length-2;o++){let[E,C]=l[o],[T,P]=l[o+1],M=(E+T)/2,F=(C+P)/2,R=[A+2*(E-A)/3,S+2*(C-S)/3],D=[M+2*(E-M)/3,F+2*(C-F)/3];u.push([[A,S],R,D,[M,F]]),[A,S]=[M,F]}let[E,C]=l[o],[T,P]=l[o+1],M=[A+2*(E-A)/3,S+2*(C-S)/3],F=[T+2*(E-T)/3,P+2*(C-P)/3];return u.push([[A,S],M,F,[T,P]]),u}#ik(){if(this.isEmpty()){this.#iz();return}this.#iL();let{canvas:o,ctx:l}=this;for(let u of(l.setTransform(1,0,0,1,0,0),l.clearRect(0,0,o.width,o.height),this.#iz(),this.bezierPath2D))l.stroke(u)}commit(){this.#iy||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),this.#iy=!0,this.div.classList.add("disabled"),this.#iM(!0),this.makeResizable(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(o){this._focusEventsAllowed&&(super.focusin(o),this.enableEditMode())}canvasPointerdown(o){0===o.button&&this.isInEditMode()&&!this.#iy&&(this.setInForeground(),o.preventDefault(),"mouse"!==o.type&&this.div.focus(),this.#iO(o.offsetX,o.offsetY))}canvasPointermove(o){o.preventDefault(),this.#iB(o.offsetX,o.offsetY)}canvasPointerup(o){o.preventDefault(),this.#iV(o)}canvasPointerleave(o){this.#iV(o)}#iV(o){this.canvas.removeEventListener("pointerleave",this.#im),this.canvas.removeEventListener("pointermove",this.#ig),this.canvas.removeEventListener("pointerup",this.#ib),this.canvas.addEventListener("pointerdown",this.#iA),setTimeout(()=>{this.canvas.removeEventListener("contextmenu",C.noContextMenu)},10),this.#iH(o.offsetX,o.offsetY),this.addToAnnotationStorage(),this.setInBackground()}#iF(){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(o=>this.canvas?.setAttribute("aria-label",o)),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")}#iR(){this.#iE=new ResizeObserver(o=>
23{let l=o[0].contentRect;l.width&&l.height&&this.setDimensions(l.width,l.height)}),this.#iE.observe(this.div)}get isResizable(){return!this.isEmpty()&&this.#iy}render(){let o,l;if(this.div)return this.div;this.width&&(o=this.x,l=this.y),super.render(),S.AnnotationEditor._l10nPromise.get("editor_ink2_aria_label").then(o=>this.div?.setAttribute("aria-label",o));let[u,A,E,C]=this.#iI();if(this.setAt(u,A,0,0),this.setDims(E,C),this.#iF(),this.width){let[u,A]=this.parentDimensions;this.setAspectRatio(this.width*u,this.height*A),this.setAt(o*u,l*A,this.width*u,this.height*A),this.#iS=!0,this.#iD(),this.setDims(this.width*u,this.height*A),this.#ik(),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return this.#iR(),this.div}#iD(){if(!this.#iS)return;let[o,l]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*o),this.canvas.height=Math.ceil(this.height*l),this.#iz()}setDimensions(o,l){let u=Math.round(o),A=Math.round(l);if(this.#ix===u&&this.#iC===A)return;this.#ix=u,this.#iC=A,this.canvas.style.visibility="hidden";let[S,E]=this.parentDimensions;this.width=o/S,this.height=l/E,this.fixAndSetPosition(),this.#iy&&this.#iW(o,l),this.#iD(),this.#ik(),this.canvas.style.visibility="visible",this.fixDims()}#iW(o,l){let u=this.#iq(),A=(o-u)/this.#ip,S=(l-u)/this.#iu;this.scaleFactor=Math.min(A,S)}#iz(){let o=this.#iq()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+o,this.translationY*this.scaleFactor+o)}static #i$(o){let l=new Path2D;for(let u=0,A=o.length;u<A;u++){let[A,S,E,C]=o[u];0===u&&l.moveTo(...A),l.bezierCurveTo(S[0],S[1],E[0],E[1],C[0],C[1])}return l}static #iX(o,l,u){let[A,S,E,C]=l;switch(u){case 0:for(let l=0,u=o.length;l<u;l+=2)o[l]+=A,o[l+1]=C-o[l+1];break;case 90:for(let l=0,u=o.length;l<u;l+=2){let u=o[l];o[l]=o[l+1]+A,o[l+1]=u+S}break;case 180:for(let l=0,u=o.length;l<u;l+=2)o[l]=E-o[l],o[l+1]+=S;break;case 270:for(let l=0,u=o.length;l<u;l+=2){let u=o[l];o[l]=E-o[l+1],o[l+1]=C-u}break;default:throw Error("Invalid rotation")}return o}static #iK(o,l,u){let[A,S,E,C]=l;switch(u){case 0:for(let l=0,u=o.length;l<u;l+=2)o[l]-=A,o[l+1]=C-o[l+1];break;case 90:for(let l=0,u=o.length;l<u;l+=2){let u=o[l];o[l]=o[l+1]-S,o[l+1]=u-A}break;case 180:for(let l=0,u=o.length;l<u;l+=2)o[l]=E-o[l],o[l+1]-=S;break;case 270:for(let l=0,u=o.length;l<u;l+=2){let u=o[l];o[l]=C-o[l+1],o[l+1]=E-u}break;default:throw Error("Invalid rotation")}return o}#iY(o,l,u,A){let S=[],E=this.thickness/2,C=o*l+E,T=o*u+E;for(let l of this.paths){let u=[],E=[];for(let A=0,S=l.length;A<S;A++){let[P,M,F,R]=l[A],D=o*P[0]+C,I=o*P[1]+T,L=o*M[0]+C,O=o*M[1]+T,N=o*F[0]+C,B=o*F[1]+T,U=o*R[0]+C,H=o*R[1]+T;0===A&&(u.push(D,I),E.push(D,I)),u.push(L,O,N,B,U,H),E.push(L,O),A===S-1&&E.push(U,H)}S.push({bezier:InkEditor.#iX(u,A,this.rotation),points:InkEditor.#iX(E,A,this.rotation)})}return S}#iJ(){let o=1/0,l=-1/0,u=1/0,S=-1/0;for(let E of this.paths)for(let[C,T,P,M]of E){let E=A.Util.bezierBoundingBox(...C,...T,...P,...M);o=Math.min(o,E[0]),u=Math.min(u,E[1]),l=Math.max(l,E[2]),S=Math.max(S,E[3])}return[o,u,l,S]}#iq(){return this.#iy?Math.ceil(this.thickness*this.parentScale):0}#iM(o=!1){if(this.isEmpty())return;if(!this.#iy){this.#ik();return}let l=this.#iJ(),u=this.#iq();this.#ip=Math.max(S.AnnotationEditor.MIN_SIZE,l[2]-l[0]),this.#iu=Math.max(S.AnnotationEditor.MIN_SIZE,l[3]-l[1]);let A=Math.ceil(u+this.#ip*this.scaleFactor),E=Math.ceil(u+this.#iu*this.scaleFactor),[C,T]=this.parentDimensions;this.width=A/C,this.height=E/T,this.setAspectRatio(A,E);let P=this.translationX,M=this.translationY;this.translationX=-l[0],this.translationY=-l[1],this.#iD(),this.#ik(),this.#ix=A,this.#iC=E,this.setDims(A,E);let F=o?u/this.scaleFactor/2:0;this.translate(P-this.translationX-F,M-this.translationY-F)}static deserialize(o,l,u){if(o instanceof E.InkAnnotationElement)return null;let C=super.deserialize(o,l,u);C.thickness=o.thickness,C.color=A.Util.makeHexColor(...o.color),C.opacity=o.opacity;let[T,P]=C.pageDimensions,M=C.width*T,F=C.height*P,R=C.parentScale,D=o.thickness/2;C.#iy=!0,C.#ix=Math.round(M),C.#iC=Math.round(F);let{paths:I,rect:L,rotation:O}=o;for(let{bezier:o}of I){o=InkEditor.#iK(o,L,O);let l=[];C.paths.push(l);let u=R*(o[0]-D),A=R*(o[1]-D);for(let S=2,E=o.length;S<E;
23S+=6){let E=R*(o[S]-D),C=R*(o[S+1]-D),T=R*(o[S+2]-D),P=R*(o[S+3]-D),M=R*(o[S+4]-D),F=R*(o[S+5]-D);l.push([[u,A],[E,C],[T,P],[M,F]]),u=M,A=F}let S=this.#i$(l);C.bezierPath2D.push(S)}let N=C.#iJ();return C.#ip=Math.max(S.AnnotationEditor.MIN_SIZE,N[2]-N[0]),C.#iu=Math.max(S.AnnotationEditor.MIN_SIZE,N[3]-N[1]),C.#iW(M,F),C}serialize(){if(this.isEmpty())return null;let o=this.getRect(0,0),l=S.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:A.AnnotationEditorType.INK,color:l,thickness:this.thickness,opacity:this.opacity,paths:this.#iY(this.scaleFactor/this.parentScale,this.translationX,this.translationY,o),pageIndex:this.pageIndex,rect:o,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}};l.InkEditor=InkEditor},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.StampEditor=void 0;var A=u(1),S=u(4),E=u(6),C=u(29);let StampEditor=class StampEditor extends S.AnnotationEditor{#iQ=null;#iZ=null;#i0=null;#i1=null;#i2=null;#i3=null;#iE=null;#i5=null;#i4=!1;#i8=!1;static _type="stamp";constructor(o){super({...o,name:"stampEditor"}),this.#i1=o.bitmapUrl,this.#i2=o.bitmapFile}static initialize(o){S.AnnotationEditor.initialize(o)}static get supportedTypes(){let o=["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"];return(0,A.shadow)(this,"supportedTypes",o.map(o=>`image/${o}`))}static get supportedTypesStr(){return(0,A.shadow)(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(o){return this.supportedTypes.includes(o)}static paste(o,l){l.pasteEditor(A.AnnotationEditorType.STAMP,{bitmapFile:o.getAsFile()})}#i6(o,l=!1){if(!o){this.remove();return}this.#iQ=o.bitmap,l||(this.#iZ=o.id,this.#i4=o.isSvg),this.#iF()}#i7(){this.#i0=null,this._uiManager.enableWaiting(!1),this.#i3&&this.div.focus()}#i9(){if(this.#iZ){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#iZ).then(o=>this.#i6(o,!0)).finally(()=>this.#i7());return}if(this.#i1){let o=this.#i1;this.#i1=null,this._uiManager.enableWaiting(!0),this.#i0=this._uiManager.imageManager.getFromUrl(o).then(o=>this.#i6(o)).finally(()=>this.#i7());return}if(this.#i2){let o=this.#i2;this.#i2=null,this._uiManager.enableWaiting(!0),this.#i0=this._uiManager.imageManager.getFromFile(o).then(o=>this.#i6(o)).finally(()=>this.#i7());return}let o=document.createElement("input");o.type="file",o.accept=StampEditor.supportedTypesStr,this.#i0=new Promise(l=>{o.addEventListener("change",async()=>{if(o.files&&0!==o.files.length){this._uiManager.enableWaiting(!0);let l=await this._uiManager.imageManager.getFromFile(o.files[0]);this.#i6(l)}else this.remove();l()}),o.addEventListener("cancel",()=>{this.remove(),l()})}).finally(()=>this.#i7()),o.click()}remove(){this.#iZ&&(this.#iQ=null,this._uiManager.imageManager.deleteId(this.#iZ),this.#i3?.remove(),this.#i3=null,this.#iE?.disconnect(),this.#iE=null),super.remove()}rebuild(){if(!this.parent){this.#iZ&&this.#i9();return}super.rebuild(),null!==this.div&&(this.#iZ&&this.#i9(),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(this.#i0||this.#iQ||this.#i1||this.#i2)}get isResizable(){return!0}render(){let o,l;if(this.div)return this.div;if(this.width&&(o=this.x,l=this.y),super.render(),this.div.hidden=!0,this.#iQ?this.#iF():this.#i9(),this.width){let[u,A]=this.parentDimensions;this.setAt(o*u,l*A,this.width*u,this.height*A)}return this.div}#iF(){let{div:o}=this,{width:l,height:u}=this.#iQ,[A,S]=this.pageDimensions,E=.75;if(this.width)l=this.width*A,u=this.height*S;else if(l>E*A||u>E*S){let o=Math.min(E*A/l,E*S/u);l*=o,u*=o}let[C,T]=this.parentDimensions;this.setDims(l*C/A,u*T/S),this._uiManager.enableWaiting(!1);let P=this.#i3=document.createElement("canvas");o.append(P),o.hidden=!1,this.#st(l,u),this.#iR(),this.#i8||(this.parent.addUndoableEditor(this),this.#i8=!0),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",subtype:this.editorType,data:{action:"inserted_image"}}}),this.addAltTextButton()}#se(o,l){let[u,A]=this.parentDimensions;this.width=o/u,this.height=l/A,this.setDims(o,l),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,null!==this.#i5&&clearTimeout(this.#i5);let S=200;this.#i5=setTimeout(()=>{this.#i5=null,this.#st(o,l)},S)}#si(o,l){let{width:u,height:A}=this.#iQ,S=u,E=A,C=this.#iQ;for(;S>2*o||E>2*l;){let u=S,A=E;S>2*o&&(S=S>=16384?Math.floor(S/2)-1:Math.ceil(S/2)),E>2*l&&(E=E>=16384?Math.floor(E/2)-1:Math.ceil(E/2));let T=new OffscreenCanvas(S,E),P=T.getContext("2d");P.drawImage(C,0,0,u,A,0,0,S,E),C=T.transferToImageBitmap()}return C}#st(o,l){o=Math.ceil(o),l=Math.ceil(l);let u=this.#i3;if(!u||u.width===o&&u.height===l)return;u.width=o,u.height=l;let A=this.#i4?this.#iQ:this.#si(o,l),S=u.getContext("2d");S.filter=this._uiManager.hcmFilter,S.drawImage(A,0,0,A.width,A.height,0,0,o,l)}
23#ss(o){if(o){if(this.#i4){let o=this._uiManager.imageManager.getSvgUrl(this.#iZ);if(o)return o}let o=document.createElement("canvas");({width:o.width,height:o.height}=this.#iQ);let l=o.getContext("2d");return l.drawImage(this.#iQ,0,0),o.toDataURL()}if(this.#i4){let[o,l]=this.pageDimensions,u=Math.round(this.width*o*E.PixelsPerInch.PDF_TO_CSS_UNITS),A=Math.round(this.height*l*E.PixelsPerInch.PDF_TO_CSS_UNITS),S=new OffscreenCanvas(u,A),C=S.getContext("2d");return C.drawImage(this.#iQ,0,0,this.#iQ.width,this.#iQ.height,0,0,u,A),S.transferToImageBitmap()}return structuredClone(this.#iQ)}#iR(){this.#iE=new ResizeObserver(o=>{let l=o[0].contentRect;l.width&&l.height&&this.#se(l.width,l.height)}),this.#iE.observe(this.div)}static deserialize(o,l,u){if(o instanceof C.StampAnnotationElement)return null;let A=super.deserialize(o,l,u),{rect:S,bitmapUrl:E,bitmapId:T,isSvg:P,accessibilityData:M}=o;T&&u.imageManager.isValidId(T)?A.#iZ=T:A.#i1=E,A.#i4=P;let[F,R]=A.pageDimensions;return A.width=(S[2]-S[0])/F,A.height=(S[3]-S[1])/R,M&&(A.altTextData=M),A}serialize(o=!1,l=null){if(this.isEmpty())return null;let u={annotationType:A.AnnotationEditorType.STAMP,bitmapId:this.#iZ,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#i4,structTreeParentId:this._structTreeParentId};if(o)return u.bitmapUrl=this.#ss(!0),u.accessibilityData=this.altTextData,u;let{decorative:S,altText:E}=this.altTextData;if(!S&&E&&(u.accessibilityData={type:"Figure",alt:E}),null===l)return u;l.stamps||=new Map;let C=this.#i4?(u.rect[2]-u.rect[0])*(u.rect[3]-u.rect[1]):null;if(l.stamps.has(this.#iZ)){if(this.#i4){let o=l.stamps.get(this.#iZ);C>o.area&&(o.area=C,o.serialized.bitmap.close(),o.serialized.bitmap=this.#ss(!1))}}else l.stamps.set(this.#iZ,{area:C,serialized:u}),u.bitmap=this.#ss(!1);return u}};l.StampEditor=StampEditor}],__webpack_module_cache__={};function __w_pdfjs_require__(o){var l=__webpack_module_cache__[o];if(void 0!==l)return l.exports;var u=__webpack_module_cache__[o]={exports:{}};return __webpack_modules__[o](u,u.exports,__w_pdfjs_require__),u.exports}var __nested_webpack_exports__={};return(()=>{var o=__nested_webpack_exports__;Object.defineProperty(o,"__esModule",{value:!0}),Object.defineProperty(o,"AbortException",{enumerable:!0,get:function(){return l.AbortException}}),Object.defineProperty(o,"AnnotationEditorLayer",{enumerable:!0,get:function(){return E.AnnotationEditorLayer}}),Object.defineProperty(o,"AnnotationEditorParamsType",{enumerable:!0,get:function(){return l.AnnotationEditorParamsType}}),Object.defineProperty(o,"AnnotationEditorType",{enumerable:!0,get:function(){return l.AnnotationEditorType}}),Object.defineProperty(o,"AnnotationEditorUIManager",{enumerable:!0,get:function(){return C.AnnotationEditorUIManager}}),Object.defineProperty(o,"AnnotationLayer",{enumerable:!0,get:function(){return T.AnnotationLayer}}),Object.defineProperty(o,"AnnotationMode",{enumerable:!0,get:function(){return l.AnnotationMode}}),Object.defineProperty(o,"CMapCompressionType",{enumerable:!0,get:function(){return l.CMapCompressionType}}),Object.defineProperty(o,"DOMSVGFactory",{enumerable:!0,get:function(){return A.DOMSVGFactory}}),Object.defineProperty(o,"FeatureTest",{enumerable:!0,get:function(){return l.FeatureTest}}),Object.defineProperty(o,"GlobalWorkerOptions",{enumerable:!0,get:function(){return P.GlobalWorkerOptions}}),Object.defineProperty(o,"ImageKind",{enumerable:!0,get:function(){return l.ImageKind}}),Object.defineProperty(o,"InvalidPDFException",{enumerable:!0,get:function(){return l.InvalidPDFException}}),Object.defineProperty(o,"MissingPDFException",{enumerable:!0,get:function(){return l.MissingPDFException}}),Object.defineProperty(o,"OPS",{enumerable:!0,get:function(){return l.OPS}}),Object.defineProperty(o,"PDFDataRangeTransport",{enumerable:!0,get:function(){return u.PDFDataRangeTransport}}),Object.defineProperty(o,"PDFDateString",{enumerable:!0,get:function(){return A.PDFDateString}}),Object.defineProperty(o,"PDFWorker",{enumerable:!0,get:function(){return u.PDFWorker}}),Object.defineProperty(o,"PasswordResponses",{enumerable:!0,get:function(){return l.PasswordResponses}}),Object.defineProperty(o,"PermissionFlag",{enumerable:!0,get:function(){return l.PermissionFlag}}),Object.defineProperty(o,"PixelsPerInch",{enumerable:!0,get:function(){return A.PixelsPerInch}}),Object.defineProperty(o,"PromiseCapability",{enumerable:!0,get:function(){return l.PromiseCapability}}),Object.defineProperty(o,"RenderingCancelledException",{enumerable:!0,get:function(){return A.RenderingCancelledException}}),Object.defineProperty(o,"SVGGraphics",{enumerable:!0,get:function(){return u.SVGGraphics}}),Object.defineProperty(o,"UnexpectedResponseException",{enumerable:!0,get:function(){return l.UnexpectedResponseException}}),Object.defineProperty(o,"Util",{enumerable:!0,get:function(){return l.Util}}),Object.defineProperty(o,"VerbosityLevel",{enumerable:!0,get:function(){return l.VerbosityLevel}}
23),Object.defineProperty(o,"XfaLayer",{enumerable:!0,get:function(){return M.XfaLayer}}),Object.defineProperty(o,"build",{enumerable:!0,get:function(){return u.build}}),Object.defineProperty(o,"createValidAbsoluteUrl",{enumerable:!0,get:function(){return l.createValidAbsoluteUrl}}),Object.defineProperty(o,"getDocument",{enumerable:!0,get:function(){return u.getDocument}}),Object.defineProperty(o,"getFilenameFromUrl",{enumerable:!0,get:function(){return A.getFilenameFromUrl}}),Object.defineProperty(o,"getPdfFilenameFromUrl",{enumerable:!0,get:function(){return A.getPdfFilenameFromUrl}}),Object.defineProperty(o,"getXfaPageViewport",{enumerable:!0,get:function(){return A.getXfaPageViewport}}),Object.defineProperty(o,"isDataScheme",{enumerable:!0,get:function(){return A.isDataScheme}}),Object.defineProperty(o,"isPdfFile",{enumerable:!0,get:function(){return A.isPdfFile}}),Object.defineProperty(o,"loadScript",{enumerable:!0,get:function(){return A.loadScript}}),Object.defineProperty(o,"noContextMenu",{enumerable:!0,get:function(){return A.noContextMenu}}),Object.defineProperty(o,"normalizeUnicode",{enumerable:!0,get:function(){return l.normalizeUnicode}}),Object.defineProperty(o,"renderTextLayer",{enumerable:!0,get:function(){return S.renderTextLayer}}),Object.defineProperty(o,"setLayerDimensions",{enumerable:!0,get:function(){return A.setLayerDimensions}}),Object.defineProperty(o,"shadow",{enumerable:!0,get:function(){return l.shadow}}),Object.defineProperty(o,"updateTextLayer",{enumerable:!0,get:function(){return S.updateTextLayer}}),Object.defineProperty(o,"version",{enumerable:!0,get:function(){return u.version}});var l=__w_pdfjs_require__(1),u=__w_pdfjs_require__(2),A=__w_pdfjs_require__(6),S=__w_pdfjs_require__(26),E=__w_pdfjs_require__(27),C=__w_pdfjs_require__(5),T=__w_pdfjs_require__(29),P=__w_pdfjs_require__(14),M=__w_pdfjs_require__(32)})(),__nested_webpack_exports__})())}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.