@fundly.ai/payment-sdk 1.4.0-beta.8 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-Byk5pSDI.cjs → index-6wVCaTBh.cjs} +1 -1
- package/dist/{index-Cq5QBVwp.cjs → index-BLhMaxVO.cjs} +1 -1
- package/dist/{index-CREEoAJa.js → index-CXu6Jk-h.js} +4 -4
- package/dist/{index-DmCrqrmZ.cjs → index-DFYYnvsg.cjs} +1 -1
- package/dist/{index-g8Lr9sIz.js → index-DVYB4ihW.js} +2 -2
- package/dist/{index-CEzdQXZE.js → index-DoadyuNK.js} +1 -1
- package/dist/{index-SA0sJUwl.cjs → index-OaLaderQ.cjs} +2 -2
- package/dist/{index-oFC_vl02.js → index-tiQvZXgI.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const require$$1=require("react"),index=require("./index-SA0sJUwl.cjs");var lib={exports:{}},core_min={};function commonjsRequire(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var pdf={exports:{}},hasRequiredPdf;function requirePdf(){return hasRequiredPdf||(hasRequiredPdf=1,(function(module,exports){(function(c,q){module.exports=c.pdfjsLib=q()})(globalThis,()=>(()=>{var __webpack_modules__=[,((r,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.VerbosityLevel=c.Util=c.UnknownErrorException=c.UnexpectedResponseException=c.TextRenderingMode=c.RenderingIntentFlag=c.PromiseCapability=c.PermissionFlag=c.PasswordResponses=c.PasswordException=c.PageActionEventType=c.OPS=c.MissingPDFException=c.MAX_IMAGE_SIZE_TO_CACHE=c.LINE_FACTOR=c.LINE_DESCENT_FACTOR=c.InvalidPDFException=c.ImageKind=c.IDENTITY_MATRIX=c.FormatError=c.FeatureTest=c.FONT_IDENTITY_MATRIX=c.DocumentActionEventType=c.CMapCompressionType=c.BaseException=c.BASELINE_FACTOR=c.AnnotationType=c.AnnotationReplyType=c.AnnotationPrefix=c.AnnotationMode=c.AnnotationFlag=c.AnnotationFieldFlag=c.AnnotationEditorType=c.AnnotationEditorPrefix=c.AnnotationEditorParamsType=c.AnnotationBorderStyleType=c.AnnotationActionEventType=c.AbortException=void 0,c.assert=m,c.bytesToString=Z,c.createValidAbsoluteUrl=C,c.getModificationDate=hn,c.getUuid=lr,c.getVerbosityLevel=Ve,c.info=Ee,c.isArrayBuffer=Ft,c.isArrayEqual=vn,c.isNodeJS=void 0,c.normalizeUnicode=Kn,c.objectFromMap=ve,c.objectSize=We,c.setVerbosityLevel=Oe,c.shadow=V,c.string32=me,c.stringToBytes=re,c.stringToPDFString=lt,c.stringToUTF8String=vt,c.unreachable=A,c.utf8StringToString=bt,c.warn=G;const q=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser");c.isNodeJS=q;const p=[1,0,0,1,0,0];c.IDENTITY_MATRIX=p;const e=[.001,0,0,.001,0,0];c.FONT_IDENTITY_MATRIX=e;const s=1e7;c.MAX_IMAGE_SIZE_TO_CACHE=s;const N=1.35;c.LINE_FACTOR=N;const ee=.35;c.LINE_DESCENT_FACTOR=ee;const U=ee/N;c.BASELINE_FACTOR=U;const o={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};c.RenderingIntentFlag=o;const t={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};c.AnnotationMode=t;const a="pdfjs_internal_editor_";c.AnnotationEditorPrefix=a;const g={DISABLE:-1,NONE:0,FREETEXT:3,STAMP:13,INK:15};c.AnnotationEditorType=g;const d={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23};c.AnnotationEditorParamsType=d;const i={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};c.PermissionFlag=i;const b={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};c.TextRenderingMode=b;const y={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};c.ImageKind=y;const f={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};c.AnnotationType=f;const T={GROUP:"Group",REPLY:"R"};c.AnnotationReplyType=T;const H={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};c.AnnotationFlag=H;const I={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};c.AnnotationFieldFlag=I;const _={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};c.AnnotationBorderStyleType=_;const M={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"};c.AnnotationActionEventType=M;const te={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};c.DocumentActionEventType=te;const ie={O:"PageOpen",C:"PageClose"};c.PageActionEventType=ie;const Y={ERRORS:0,WARNINGS:1,INFOS:5};c.VerbosityLevel=Y;const he={NONE:0,BINARY:1};c.CMapCompressionType=he;const ge={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};c.OPS=ge;const Ne={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};c.PasswordResponses=Ne;let ke=Y.WARNINGS;function Oe(De){Number.isInteger(De)&&(ke=De)}function Ve(){return ke}function Ee(De){ke>=Y.INFOS&&console.log(`Info: ${De}`)}function G(De){ke>=Y.WARNINGS&&console.log(`Warning: ${De}`)}function A(De){throw new Error(De)}function m(De,fe){De||A(fe)}function v(De){switch(De?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function C(De,fe=null,ue=null){if(!De)return null;try{if(ue&&typeof De=="string"&&(ue.addDefaultProtocol&&De.startsWith("www.")&&De.match(/\./g)?.length>=2&&(De=`http://${De}`),ue.tryConvertEncoding))try{De=vt(De)}catch{}const He=fe?new URL(De,fe):new URL(De);if(v(He))return He}catch{}return null}function V(De,fe,ue,He=!1){return Object.defineProperty(De,fe,{value:ue,enumerable:!He,configurable:!0,writable:!1}),ue}const W=(function(){function fe(ue,He){this.constructor===fe&&A("Cannot initialize BaseException."),this.message=ue,this.name=He}return fe.prototype=new Error,fe.constructor=fe,fe})();c.BaseException=W;class K extends W{constructor(fe,ue){super(fe,"PasswordException"),this.code=ue}}c.PasswordException=K;class L extends W{constructor(fe,ue){super(fe,"UnknownErrorException"),this.details=ue}}c.UnknownErrorException=L;class l extends W{constructor(fe){super(fe,"InvalidPDFException")}}c.InvalidPDFException=l;class S extends W{constructor(fe){super(fe,"MissingPDFException")}}c.MissingPDFException=S;class R extends W{constructor(fe,ue){super(fe,"UnexpectedResponseException"),this.status=ue}}c.UnexpectedResponseException=R;class O extends W{constructor(fe){super(fe,"FormatError")}}c.FormatError=O;class B extends W{constructor(fe){super(fe,"AbortException")}}c.AbortException=B;function Z(De){(typeof De!="object"||De?.length===void 0)&&A("Invalid argument for bytesToString");const fe=De.length,ue=8192;if(fe<ue)return String.fromCharCode.apply(null,De);const He=[];for(let Dt=0;Dt<fe;Dt+=ue){const pt=Math.min(Dt+ue,fe),kt=De.subarray(Dt,pt);He.push(String.fromCharCode.apply(null,kt))}return He.join("")}function re(De){typeof De!="string"&&A("Invalid argument for stringToBytes");const fe=De.length,ue=new Uint8Array(fe);for(let He=0;He<fe;++He)ue[He]=De.charCodeAt(He)&255;return ue}function me(De){return String.fromCharCode(De>>24&255,De>>16&255,De>>8&255,De&255)}function We(De){return Object.keys(De).length}function ve(De){const fe=Object.create(null);for(const[ue,He]of De)fe[ue]=He;return fe}function ye(){const De=new Uint8Array(4);return De[0]=1,new Uint32Array(De.buffer,0,1)[0]===1}function Ce(){try{return new Function(""),!0}catch{return!1}}class Re{static get isLittleEndian(){return V(this,"isLittleEndian",ye())}static get isEvalSupported(){return V(this,"isEvalSupported",Ce())}static get isOffscreenCanvasSupported(){return V(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator>"u"?V(this,"platform",{isWin:!1,isMac:!1}):V(this,"platform",{isWin:navigator.platform.includes("Win"),isMac:navigator.platform.includes("Mac")})}static get isCSSRoundSupported(){return V(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}c.FeatureTest=Re;const xe=[...Array(256).keys()].map(De=>De.toString(16).padStart(2,"0"));class qe{static makeHexColor(fe,ue,He){return`#${xe[fe]}${xe[ue]}${xe[He]}`}static scaleMinMax(fe,ue){let He;fe[0]?(fe[0]<0&&(He=ue[0],ue[0]=ue[1],ue[1]=He),ue[0]*=fe[0],ue[1]*=fe[0],fe[3]<0&&(He=ue[2],ue[2]=ue[3],ue[3]=He),ue[2]*=fe[3],ue[3]*=fe[3]):(He=ue[0],ue[0]=ue[2],ue[2]=He,He=ue[1],ue[1]=ue[3],ue[3]=He,fe[1]<0&&(He=ue[2],ue[2]=ue[3],ue[3]=He),ue[2]*=fe[1],ue[3]*=fe[1],fe[2]<0&&(He=ue[0],ue[0]=ue[1],ue[1]=He),ue[0]*=fe[2],ue[1]*=fe[2]),ue[0]+=fe[4],ue[1]+=fe[4],ue[2]+=fe[5],ue[3]+=fe[5]}static transform(fe,ue){return[fe[0]*ue[0]+fe[2]*ue[1],fe[1]*ue[0]+fe[3]*ue[1],fe[0]*ue[2]+fe[2]*ue[3],fe[1]*ue[2]+fe[3]*ue[3],fe[0]*ue[4]+fe[2]*ue[5]+fe[4],fe[1]*ue[4]+fe[3]*ue[5]+fe[5]]}static applyTransform(fe,ue){const He=fe[0]*ue[0]+fe[1]*ue[2]+ue[4],Dt=fe[0]*ue[1]+fe[1]*ue[3]+ue[5];return[He,Dt]}static applyInverseTransform(fe,ue){const He=ue[0]*ue[3]-ue[1]*ue[2],Dt=(fe[0]*ue[3]-fe[1]*ue[2]+ue[2]*ue[5]-ue[4]*ue[3])/He,pt=(-fe[0]*ue[1]+fe[1]*ue[0]+ue[4]*ue[1]-ue[5]*ue[0])/He;return[Dt,pt]}static getAxialAlignedBoundingBox(fe,ue){const He=this.applyTransform(fe,ue),Dt=this.applyTransform(fe.slice(2,4),ue),pt=this.applyTransform([fe[0],fe[3]],ue),kt=this.applyTransform([fe[2],fe[1]],ue);return[Math.min(He[0],Dt[0],pt[0],kt[0]),Math.min(He[1],Dt[1],pt[1],kt[1]),Math.max(He[0],Dt[0],pt[0],kt[0]),Math.max(He[1],Dt[1],pt[1],kt[1])]}static inverseTransform(fe){const ue=fe[0]*fe[3]-fe[1]*fe[2];return[fe[3]/ue,-fe[1]/ue,-fe[2]/ue,fe[0]/ue,(fe[2]*fe[5]-fe[4]*fe[3])/ue,(fe[4]*fe[1]-fe[5]*fe[0])/ue]}static singularValueDecompose2dScale(fe){const ue=[fe[0],fe[2],fe[1],fe[3]],He=fe[0]*ue[0]+fe[1]*ue[2],Dt=fe[0]*ue[1]+fe[1]*ue[3],pt=fe[2]*ue[0]+fe[3]*ue[2],kt=fe[2]*ue[1]+fe[3]*ue[3],Jn=(He+kt)/2,Bn=Math.sqrt((He+kt)**2-4*(He*kt-pt*Dt))/2,Hn=Jn+Bn||1,yn=Jn-Bn||1;return[Math.sqrt(Hn),Math.sqrt(yn)]}static normalizeRect(fe){const ue=fe.slice(0);return fe[0]>fe[2]&&(ue[0]=fe[2],ue[2]=fe[0]),fe[1]>fe[3]&&(ue[1]=fe[3],ue[3]=fe[1]),ue}static intersect(fe,ue){const He=Math.max(Math.min(fe[0],fe[2]),Math.min(ue[0],ue[2])),Dt=Math.min(Math.max(fe[0],fe[2]),Math.max(ue[0],ue[2]));if(He>Dt)return null;const pt=Math.max(Math.min(fe[1],fe[3]),Math.min(ue[1],ue[3])),kt=Math.min(Math.max(fe[1],fe[3]),Math.max(ue[1],ue[3]));return pt>kt?null:[He,pt,Dt,kt]}static bezierBoundingBox(fe,ue,He,Dt,pt,kt,Jn,Bn){const Hn=[],yn=[[],[]];let Un,mn,nr,Xt,rr,an,ln,ir;for(let cr=0;cr<2;++cr){if(cr===0?(mn=6*fe-12*He+6*pt,Un=-3*fe+9*He-9*pt+3*Jn,nr=3*He-3*fe):(mn=6*ue-12*Dt+6*kt,Un=-3*ue+9*Dt-9*kt+3*Bn,nr=3*Dt-3*ue),Math.abs(Un)<1e-12){if(Math.abs(mn)<1e-12)continue;Xt=-nr/mn,0<Xt&&Xt<1&&Hn.push(Xt);continue}ln=mn*mn-4*nr*Un,ir=Math.sqrt(ln),!(ln<0)&&(rr=(-mn+ir)/(2*Un),0<rr&&rr<1&&Hn.push(rr),an=(-mn-ir)/(2*Un),0<an&&an<1&&Hn.push(an))}let An=Hn.length,Pn;const tn=An;for(;An--;)Xt=Hn[An],Pn=1-Xt,yn[0][An]=Pn*Pn*Pn*fe+3*Pn*Pn*Xt*He+3*Pn*Xt*Xt*pt+Xt*Xt*Xt*Jn,yn[1][An]=Pn*Pn*Pn*ue+3*Pn*Pn*Xt*Dt+3*Pn*Xt*Xt*kt+Xt*Xt*Xt*Bn;return yn[0][tn]=fe,yn[1][tn]=ue,yn[0][tn+1]=Jn,yn[1][tn+1]=Bn,yn[0].length=yn[1].length=tn+2,[Math.min(...yn[0]),Math.min(...yn[1]),Math.max(...yn[0]),Math.max(...yn[1])]}}c.Util=qe;const tt=[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 lt(De){if(De[0]>="ï"){let ue;if(De[0]==="þ"&&De[1]==="ÿ"?ue="utf-16be":De[0]==="ÿ"&&De[1]==="þ"?ue="utf-16le":De[0]==="ï"&&De[1]==="»"&&De[2]==="¿"&&(ue="utf-8"),ue)try{const He=new TextDecoder(ue,{fatal:!0}),Dt=re(De);return He.decode(Dt)}catch(He){G(`stringToPDFString: "${He}".`)}}const fe=[];for(let ue=0,He=De.length;ue<He;ue++){const Dt=tt[De.charCodeAt(ue)];fe.push(Dt?String.fromCharCode(Dt):De.charAt(ue))}return fe.join("")}function vt(De){return decodeURIComponent(escape(De))}function bt(De){return unescape(encodeURIComponent(De))}function Ft(De){return typeof De=="object"&&De?.byteLength!==void 0}function vn(De,fe){if(De.length!==fe.length)return!1;for(let ue=0,He=De.length;ue<He;ue++)if(De[ue]!==fe[ue])return!1;return!0}function hn(De=new Date){return[De.getUTCFullYear().toString(),(De.getUTCMonth()+1).toString().padStart(2,"0"),De.getUTCDate().toString().padStart(2,"0"),De.getUTCHours().toString().padStart(2,"0"),De.getUTCMinutes().toString().padStart(2,"0"),De.getUTCSeconds().toString().padStart(2,"0")].join("")}class jn{#e=!1;constructor(){this.promise=new Promise((fe,ue)=>{this.resolve=He=>{this.#e=!0,fe(He)},this.reject=He=>{this.#e=!0,ue(He)}})}get settled(){return this.#e}}c.PromiseCapability=jn;let gn=null,Fn=null;function Kn(De){return gn||(gn=/([\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,Fn=new Map([["ſt","ſt"]])),De.replaceAll(gn,(fe,ue,He)=>ue?ue.normalize("NFKC"):Fn.get(He))}function lr(){if(typeof crypto<"u"&&typeof crypto?.randomUUID=="function")return crypto.randomUUID();const De=new Uint8Array(32);if(typeof crypto<"u"&&typeof crypto?.getRandomValues=="function")crypto.getRandomValues(De);else for(let fe=0;fe<32;fe++)De[fe]=Math.floor(Math.random()*255);return Z(De)}const _n="pdfjs_internal_id_";c.AnnotationPrefix=_n}),((__unused_webpack_module,exports,__w_pdfjs_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.RenderTask=exports.PDFWorkerUtil=exports.PDFWorker=exports.PDFPageProxy=exports.PDFDocumentProxy=exports.PDFDocumentLoadingTask=exports.PDFDataRangeTransport=exports.LoopbackPort=exports.DefaultStandardFontDataFactory=exports.DefaultFilterFactory=exports.DefaultCanvasFactory=exports.DefaultCMapReaderFactory=void 0,Object.defineProperty(exports,"SVGGraphics",{enumerable:!0,get:function(){return _displaySvg.SVGGraphics}}),exports.build=void 0,exports.getDocument=getDocument,exports.version=void 0;var _util=__w_pdfjs_require__(1),_annotation_storage=__w_pdfjs_require__(3),_display_utils=__w_pdfjs_require__(6),_font_loader=__w_pdfjs_require__(9),_displayNode_utils=__w_pdfjs_require__(10),_canvas=__w_pdfjs_require__(11),_worker_options=__w_pdfjs_require__(14),_message_handler=__w_pdfjs_require__(15),_metadata=__w_pdfjs_require__(16),_optional_content_config=__w_pdfjs_require__(17),_transport_stream=__w_pdfjs_require__(18),_displayFetch_stream=__w_pdfjs_require__(19),_displayNetwork=__w_pdfjs_require__(22),_displayNode_stream=__w_pdfjs_require__(23),_displaySvg=__w_pdfjs_require__(24),_xfa_text=__w_pdfjs_require__(25);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100,DELAYED_CLEANUP_TIMEOUT=5e3,DefaultCanvasFactory=_util.isNodeJS?_displayNode_utils.NodeCanvasFactory:_display_utils.DOMCanvasFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory;const DefaultCMapReaderFactory=_util.isNodeJS?_displayNode_utils.NodeCMapReaderFactory:_display_utils.DOMCMapReaderFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory;const DefaultFilterFactory=_util.isNodeJS?_displayNode_utils.NodeFilterFactory:_display_utils.DOMFilterFactory;exports.DefaultFilterFactory=DefaultFilterFactory;const DefaultStandardFontDataFactory=_util.isNodeJS?_displayNode_utils.NodeStandardFontDataFactory:_display_utils.DOMStandardFontDataFactory;exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory;function getDocument(r){if(typeof r=="string"||r instanceof URL?r={url:r}:(0,_util.isArrayBuffer)(r)&&(r={data:r}),typeof r!="object")throw new Error("Invalid parameter in getDocument, need parameter object.");if(!r.url&&!r.data&&!r.range)throw new Error("Invalid parameter object: need either .data, .range or .url");const c=new PDFDocumentLoadingTask,{docId:q}=c,p=r.url?getUrlProp(r.url):null,e=r.data?getDataProp(r.data):null,s=r.httpHeaders||null,N=r.withCredentials===!0,ee=r.password??null,U=r.range instanceof PDFDataRangeTransport?r.range:null,o=Number.isInteger(r.rangeChunkSize)&&r.rangeChunkSize>0?r.rangeChunkSize:DEFAULT_RANGE_CHUNK_SIZE;let t=r.worker instanceof PDFWorker?r.worker:null;const a=r.verbosity,g=typeof r.docBaseUrl=="string"&&!(0,_display_utils.isDataScheme)(r.docBaseUrl)?r.docBaseUrl:null,d=typeof r.cMapUrl=="string"?r.cMapUrl:null,i=r.cMapPacked!==!1,b=r.CMapReaderFactory||DefaultCMapReaderFactory,y=typeof r.standardFontDataUrl=="string"?r.standardFontDataUrl:null,f=r.StandardFontDataFactory||DefaultStandardFontDataFactory,T=r.stopAtErrors!==!0,H=Number.isInteger(r.maxImageSize)&&r.maxImageSize>-1?r.maxImageSize:-1,I=r.isEvalSupported!==!1,_=typeof r.isOffscreenCanvasSupported=="boolean"?r.isOffscreenCanvasSupported:!_util.isNodeJS,M=Number.isInteger(r.canvasMaxAreaInBytes)?r.canvasMaxAreaInBytes:-1,te=typeof r.disableFontFace=="boolean"?r.disableFontFace:_util.isNodeJS,ie=r.fontExtraProperties===!0,Y=r.enableXfa===!0,he=r.ownerDocument||globalThis.document,ge=r.disableRange===!0,Ne=r.disableStream===!0,ke=r.disableAutoFetch===!0,Oe=r.pdfBug===!0,Ve=U?U.length:r.length??NaN,Ee=typeof r.useSystemFonts=="boolean"?r.useSystemFonts:!_util.isNodeJS&&!te,G=typeof r.useWorkerFetch=="boolean"?r.useWorkerFetch:b===_display_utils.DOMCMapReaderFactory&&f===_display_utils.DOMStandardFontDataFactory&&d&&y&&(0,_display_utils.isValidFetchUrl)(d,document.baseURI)&&(0,_display_utils.isValidFetchUrl)(y,document.baseURI),A=r.canvasFactory||new DefaultCanvasFactory({ownerDocument:he}),m=r.filterFactory||new DefaultFilterFactory({docId:q,ownerDocument:he}),v=null;(0,_util.setVerbosityLevel)(a);const C={canvasFactory:A,filterFactory:m};if(G||(C.cMapReaderFactory=new b({baseUrl:d,isCompressed:i}),C.standardFontDataFactory=new f({baseUrl:y})),!t){const K={verbosity:a,port:_worker_options.GlobalWorkerOptions.workerPort};t=K.port?PDFWorker.fromPort(K):new PDFWorker(K),c._worker=t}const V={docId:q,apiVersion:"3.11.174",data:e,password:ee,disableAutoFetch:ke,rangeChunkSize:o,length:Ve,docBaseUrl:g,enableXfa:Y,evaluatorOptions:{maxImageSize:H,disableFontFace:te,ignoreErrors:T,isEvalSupported:I,isOffscreenCanvasSupported:_,canvasMaxAreaInBytes:M,fontExtraProperties:ie,useSystemFonts:Ee,cMapUrl:G?d:null,standardFontDataUrl:G?y:null}},W={ignoreErrors:T,isEvalSupported:I,disableFontFace:te,fontExtraProperties:ie,enableXfa:Y,ownerDocument:he,disableAutoFetch:ke,pdfBug:Oe,styleElement:v};return t.promise.then(function(){if(c.destroyed)throw new Error("Loading aborted");const K=_fetchDocument(t,V),L=new Promise(function(l){let S;U?S=new _transport_stream.PDFDataTransportStream({length:Ve,initialData:U.initialData,progressiveDone:U.progressiveDone,contentDispositionFilename:U.contentDispositionFilename,disableRange:ge,disableStream:Ne},U):e||(S=(O=>_util.isNodeJS?new _displayNode_stream.PDFNodeStream(O):(0,_display_utils.isValidFetchUrl)(O.url)?new _displayFetch_stream.PDFFetchStream(O):new _displayNetwork.PDFNetworkStream(O))({url:p,length:Ve,httpHeaders:s,withCredentials:N,rangeChunkSize:o,disableRange:ge,disableStream:Ne})),l(S)});return Promise.all([K,L]).then(function([l,S]){if(c.destroyed)throw new Error("Loading aborted");const R=new _message_handler.MessageHandler(q,l,t.port),O=new WorkerTransport(R,c,S,W,C);c._transport=O,R.send("Ready",null)})}).catch(c._capability.reject),c}async function _fetchDocument(r,c){if(r.destroyed)throw new Error("Worker was destroyed");const q=await r.messageHandler.sendWithPromise("GetDocRequest",c,c.data?[c.data.buffer]:null);if(r.destroyed)throw new Error("Worker was destroyed");return q}function getUrlProp(r){if(r instanceof URL)return r.href;try{return new URL(r,window.location).href}catch{if(_util.isNodeJS&&typeof r=="string")return r}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function getDataProp(r){if(_util.isNodeJS&&typeof Buffer<"u"&&r instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength)return r;if(typeof r=="string")return(0,_util.stringToBytes)(r);if(typeof r=="object"&&!isNaN(r?.length)||(0,_util.isArrayBuffer)(r))return new Uint8Array(r);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}class PDFDocumentLoadingTask{static#e=0;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(c){throw this._worker?.port&&delete this._worker._pendingDestroy,c}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}exports.PDFDocumentLoadingTask=PDFDocumentLoadingTask;class PDFDataRangeTransport{constructor(c,q,p=!1,e=null){this.length=c,this.initialData=q,this.progressiveDone=p,this.contentDispositionFilename=e,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=new _util.PromiseCapability}addRangeListener(c){this._rangeListeners.push(c)}addProgressListener(c){this._progressListeners.push(c)}addProgressiveReadListener(c){this._progressiveReadListeners.push(c)}addProgressiveDoneListener(c){this._progressiveDoneListeners.push(c)}onDataRange(c,q){for(const p of this._rangeListeners)p(c,q)}onDataProgress(c,q){this._readyCapability.promise.then(()=>{for(const p of this._progressListeners)p(c,q)})}onDataProgressiveRead(c){this._readyCapability.promise.then(()=>{for(const q of this._progressiveReadListeners)q(c)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const c of this._progressiveDoneListeners)c()})}transportReady(){this._readyCapability.resolve()}requestDataRange(c,q){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}exports.PDFDataRangeTransport=PDFDataRangeTransport;class PDFDocumentProxy{constructor(c,q){this._pdfInfo=c,this._transport=q,Object.defineProperty(this,"getJavaScript",{value:()=>((0,_display_utils.deprecated)("`PDFDocumentProxy.getJavaScript`, please use `PDFDocumentProxy.getJSActions` instead."),this.getJSActions().then(p=>{if(!p)return p;const e=[];for(const s in p)e.push(...p[s]);return e}))})}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(c){return this._transport.getPage(c)}getPageIndex(c){return this._transport.getPageIndex(c)}getDestinations(){return this._transport.getDestinations()}getDestination(c){return this._transport.getDestination(c)}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(c=!1){return this._transport.startCleanup(c||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}exports.PDFDocumentProxy=PDFDocumentProxy;class PDFPageProxy{#e=null;#t=!1;constructor(c,q,p,e=!1){this._pageIndex=c,this._pageInfo=q,this._transport=p,this._stats=e?new _display_utils.StatTimer:null,this._pdfBug=e,this.commonObjs=p.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:c,rotation:q=this.rotate,offsetX:p=0,offsetY:e=0,dontFlip:s=!1}={}){return new _display_utils.PageViewport({viewBox:this.view,scale:c,rotation:q,offsetX:p,offsetY:e,dontFlip:s})}getAnnotations({intent:c="display"}={}){const q=this._transport.getRenderingIntent(c);return this._transport.getAnnotations(this._pageIndex,q.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:c,viewport:q,intent:p="display",annotationMode:e=_util.AnnotationMode.ENABLE,transform:s=null,background:N=null,optionalContentConfigPromise:ee=null,annotationCanvasMap:U=null,pageColors:o=null,printAnnotationStorage:t=null}){this._stats?.time("Overall");const a=this._transport.getRenderingIntent(p,e,t);this.#t=!1,this.#r(),ee||(ee=this._transport.getOptionalContentConfig());let g=this._intentStates.get(a.cacheKey);g||(g=Object.create(null),this._intentStates.set(a.cacheKey,g)),g.streamReaderCancelTimeout&&(clearTimeout(g.streamReaderCancelTimeout),g.streamReaderCancelTimeout=null);const d=!!(a.renderingIntent&_util.RenderingIntentFlag.PRINT);g.displayReadyCapability||(g.displayReadyCapability=new _util.PromiseCapability,g.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(a));const i=f=>{g.renderTasks.delete(b),(this._maybeCleanupAfterRender||d)&&(this.#t=!0),this.#n(!d),f?(b.capability.reject(f),this._abortOperatorList({intentState:g,reason:f instanceof Error?f:new Error(f)})):b.capability.resolve(),this._stats?.timeEnd("Rendering"),this._stats?.timeEnd("Overall")},b=new InternalRenderTask({callback:i,params:{canvasContext:c,viewport:q,transform:s,background:N},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:U,operatorList:g.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!d,pdfBug:this._pdfBug,pageColors:o});(g.renderTasks||=new Set).add(b);const y=b.task;return Promise.all([g.displayReadyCapability.promise,ee]).then(([f,T])=>{if(this.destroyed){i();return}this._stats?.time("Rendering"),b.initializeGraphics({transparency:f,optionalContentConfig:T}),b.operatorListChanged()}).catch(i),y}getOperatorList({intent:c="display",annotationMode:q=_util.AnnotationMode.ENABLE,printAnnotationStorage:p=null}={}){function e(){N.operatorList.lastChunk&&(N.opListReadCapability.resolve(N.operatorList),N.renderTasks.delete(ee))}const s=this._transport.getRenderingIntent(c,q,p,!0);let N=this._intentStates.get(s.cacheKey);N||(N=Object.create(null),this._intentStates.set(s.cacheKey,N));let ee;return N.opListReadCapability||(ee=Object.create(null),ee.operatorListChanged=e,N.opListReadCapability=new _util.PromiseCapability,(N.renderTasks||=new Set).add(ee),N.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(s)),N.opListReadCapability.promise}streamTextContent({includeMarkedContent:c=!1,disableNormalization:q=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:c===!0,disableNormalization:q===!0},{highWaterMark:100,size(e){return e.items.length}})}getTextContent(c={}){if(this._transport._htmlForXfa)return this.getXfa().then(p=>_xfa_text.XfaText.textContent(p));const q=this.streamTextContent(c);return new Promise(function(p,e){function s(){N.read().then(function({value:U,done:o}){if(o){p(ee);return}Object.assign(ee.styles,U.styles),ee.items.push(...U.items),s()},e)}const N=q.getReader(),ee={items:[],styles:Object.create(null)};s()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const c=[];for(const q of this._intentStates.values())if(this._abortOperatorList({intentState:q,reason:new Error("Page was destroyed."),force:!0}),!q.opListReadCapability)for(const p of q.renderTasks)c.push(p.completed),p.cancel();return this.objs.clear(),this.#t=!1,this.#r(),Promise.all(c)}cleanup(c=!1){this.#t=!0;const q=this.#n(!1);return c&&q&&(this._stats&&=new _display_utils.StatTimer),q}#n(c=!1){if(this.#r(),!this.#t||this.destroyed)return!1;if(c)return this.#e=setTimeout(()=>{this.#e=null,this.#n(!1)},DELAYED_CLEANUP_TIMEOUT),!1;for(const{renderTasks:q,operatorList:p}of this._intentStates.values())if(q.size>0||!p.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#t=!1,!0}#r(){this.#e&&(clearTimeout(this.#e),this.#e=null)}_startRenderPage(c,q){const p=this._intentStates.get(q);p&&(this._stats?.timeEnd("Page Request"),p.displayReadyCapability?.resolve(c))}_renderPageChunk(c,q){for(let p=0,e=c.length;p<e;p++)q.operatorList.fnArray.push(c.fnArray[p]),q.operatorList.argsArray.push(c.argsArray[p]);q.operatorList.lastChunk=c.lastChunk,q.operatorList.separateAnnots=c.separateAnnots;for(const p of q.renderTasks)p.operatorListChanged();c.lastChunk&&this.#n(!0)}_pumpOperatorList({renderingIntent:c,cacheKey:q,annotationStorageSerializable:p}){const{map:e,transfers:s}=p,ee=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:c,cacheKey:q,annotationStorage:e},s).getReader(),U=this._intentStates.get(q);U.streamReader=ee;const o=()=>{ee.read().then(({value:t,done:a})=>{if(a){U.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(t,U),o())},t=>{if(U.streamReader=null,!this._transport.destroyed){if(U.operatorList){U.operatorList.lastChunk=!0;for(const a of U.renderTasks)a.operatorListChanged();this.#n(!0)}if(U.displayReadyCapability)U.displayReadyCapability.reject(t);else if(U.opListReadCapability)U.opListReadCapability.reject(t);else throw t}})};o()}_abortOperatorList({intentState:c,reason:q,force:p=!1}){if(c.streamReader){if(c.streamReaderCancelTimeout&&(clearTimeout(c.streamReaderCancelTimeout),c.streamReaderCancelTimeout=null),!p){if(c.renderTasks.size>0)return;if(q instanceof _display_utils.RenderingCancelledException){let e=RENDERING_CANCELLED_TIMEOUT;q.extraDelay>0&&q.extraDelay<1e3&&(e+=q.extraDelay),c.streamReaderCancelTimeout=setTimeout(()=>{c.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:c,reason:q,force:!0})},e);return}}if(c.streamReader.cancel(new _util.AbortException(q.message)).catch(()=>{}),c.streamReader=null,!this._transport.destroyed){for(const[e,s]of this._intentStates)if(s===c){this._intentStates.delete(e);break}this.cleanup()}}}get stats(){return this._stats}}exports.PDFPageProxy=PDFPageProxy;class LoopbackPort{#e=new Set;#t=Promise.resolve();postMessage(c,q){const p={data:structuredClone(c,q?{transfer:q}:null)};this.#t.then(()=>{for(const e of this.#e)e.call(this,p)})}addEventListener(c,q){this.#e.add(q)}removeEventListener(c,q){this.#e.delete(q)}terminate(){this.#e.clear()}}exports.LoopbackPort=LoopbackPort;const PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};exports.PDFWorkerUtil=PDFWorkerUtil;{if(_util.isNodeJS&&typeof commonjsRequire=="function")PDFWorkerUtil.isWorkerDisabled=!0,PDFWorkerUtil.fallbackWorkerSrc="./pdf.worker.js";else if(typeof document=="object"){const r=document?.currentScript?.src;r&&(PDFWorkerUtil.fallbackWorkerSrc=r.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}PDFWorkerUtil.isSameOrigin=function(r,c){let q;try{if(q=new URL(r),!q.origin||q.origin==="null")return!1}catch{return!1}const p=new URL(c,q);return q.origin===p.origin},PDFWorkerUtil.createCDNWrapper=function(r){const c=`importScripts("${r}");`;return URL.createObjectURL(new Blob([c]))}}class PDFWorker{static#workerPorts;constructor({name:r=null,port:c=null,verbosity:q=(0,_util.getVerbosityLevel)()}={}){if(this.name=r,this.destroyed=!1,this.verbosity=q,this._readyCapability=new _util.PromiseCapability,this._port=null,this._webWorker=null,this._messageHandler=null,c){if(PDFWorker.#workerPorts?.has(c))throw new Error("Cannot use more than one PDFWorker per port.");(PDFWorker.#workerPorts||=new WeakMap).set(c,this),this._initializeFromPort(c);return}this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(r){this._port=r,this._messageHandler=new _message_handler.MessageHandler("main","worker",r),this._messageHandler.on("ready",function(){}),this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}_initialize(){if(!PDFWorkerUtil.isWorkerDisabled&&!PDFWorker._mainThreadWorkerMessageHandler){let{workerSrc:r}=PDFWorker;try{PDFWorkerUtil.isSameOrigin(window.location.href,r)||(r=PDFWorkerUtil.createCDNWrapper(new URL(r,window.location).href));const c=new Worker(r),q=new _message_handler.MessageHandler("main","worker",c),p=()=>{c.removeEventListener("error",e),q.destroy(),c.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},e=()=>{this._webWorker||p()};c.addEventListener("error",e),q.on("test",N=>{if(c.removeEventListener("error",e),this.destroyed){p();return}N?(this._messageHandler=q,this._port=c,this._webWorker=c,this._readyCapability.resolve(),q.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),q.destroy(),c.terminate())}),q.on("ready",N=>{if(c.removeEventListener("error",e),this.destroyed){p();return}try{s()}catch{this._setupFakeWorker()}});const s=()=>{const N=new Uint8Array;q.send("test",N,[N.buffer])};s();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(r=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const c=new LoopbackPort;this._port=c;const q=`fake${PDFWorkerUtil.fakeWorkerId++}`,p=new _message_handler.MessageHandler(q+"_worker",q,c);r.setup(p,c);const e=new _message_handler.MessageHandler(q,q+"_worker",c);this._messageHandler=e,this._readyCapability.resolve(),e.send("configure",{verbosity:this.verbosity})}).catch(r=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${r.message}".`))})}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),PDFWorker.#workerPorts?.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(r){if(!r?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");const c=this.#workerPorts?.get(r.port);if(c){if(c._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return c}return new PDFWorker(r)}static get workerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(PDFWorkerUtil.fallbackWorkerSrc!==null)return _util.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'),PDFWorkerUtil.fallbackWorkerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _mainThreadWorkerMessageHandler(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){const loader=async()=>{const mainWorkerMessageHandler=this._mainThreadWorkerMessageHandler;if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_util.isNodeJS&&typeof commonjsRequire=="function"){const worker=eval("require")(this.workerSrc);return worker.WorkerMessageHandler}return await(0,_display_utils.loadScript)(this.workerSrc),window.pdfjsWorker.WorkerMessageHandler};return(0,_util.shadow)(this,"_setupFakeWorkerGlobal",loader())}}exports.PDFWorker=PDFWorker;class WorkerTransport{#e=new Map;#t=new Map;#n=new Map;#r=null;constructor(c,q,p,e,s){this.messageHandler=c,this.loadingTask=q,this.commonObjs=new PDFObjects,this.fontLoader=new _font_loader.FontLoader({ownerDocument:e.ownerDocument,styleElement:e.styleElement}),this._params=e,this.canvasFactory=s.canvasFactory,this.filterFactory=s.filterFactory,this.cMapReaderFactory=s.cMapReaderFactory,this.standardFontDataFactory=s.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=p,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=new _util.PromiseCapability,this.setupMessageHandler()}#o(c,q=null){const p=this.#e.get(c);if(p)return p;const e=this.messageHandler.sendWithPromise(c,q);return this.#e.set(c,e),e}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}getRenderingIntent(c,q=_util.AnnotationMode.ENABLE,p=null,e=!1){let s=_util.RenderingIntentFlag.DISPLAY,N=_annotation_storage.SerializableEmpty;switch(c){case"any":s=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":s=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${c}`)}switch(q){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,N=(s&_util.RenderingIntentFlag.PRINT&&p instanceof _annotation_storage.PrintAnnotationStorage?p:this.annotationStorage).serializable;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${q}`)}return e&&(s+=_util.RenderingIntentFlag.OPLIST),{renderingIntent:s,cacheKey:`${s}_${N.hash}`,annotationStorageSerializable:N}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=new _util.PromiseCapability,this.#r?.reject(new Error("Worker was destroyed during onPassword callback"));const c=[];for(const p of this.#t.values())c.push(p._destroy());this.#t.clear(),this.#n.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const q=this.messageHandler.sendWithPromise("Terminate",null);return c.push(q),Promise.all(c).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(),this._networkStream?.cancelAllRequests(new _util.AbortException("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:c,loadingTask:q}=this;c.on("GetReader",(p,e)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=s=>{this._lastProgress={loaded:s.loaded,total:s.total}},e.onPull=()=>{this._fullReader.read().then(function({value:s,done:N}){if(N){e.close();return}(0,_util.assert)(s instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(s),1,[s])}).catch(s=>{e.error(s)})},e.onCancel=s=>{this._fullReader.cancel(s),e.ready.catch(N=>{if(!this.destroyed)throw N})}}),c.on("ReaderHeadersReady",p=>{const e=new _util.PromiseCapability,s=this._fullReader;return s.headersReady.then(()=>{(!s.isStreamingSupported||!s.isRangeSupported)&&(this._lastProgress&&q.onProgress?.(this._lastProgress),s.onProgress=N=>{q.onProgress?.({loaded:N.loaded,total:N.total})}),e.resolve({isStreamingSupported:s.isStreamingSupported,isRangeSupported:s.isRangeSupported,contentLength:s.contentLength})},e.reject),e.promise}),c.on("GetRangeReader",(p,e)=>{(0,_util.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const s=this._networkStream.getRangeReader(p.begin,p.end);if(!s){e.close();return}e.onPull=()=>{s.read().then(function({value:N,done:ee}){if(ee){e.close();return}(0,_util.assert)(N instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(N),1,[N])}).catch(N=>{e.error(N)})},e.onCancel=N=>{s.cancel(N),e.ready.catch(ee=>{if(!this.destroyed)throw ee})}}),c.on("GetDoc",({pdfInfo:p})=>{this._numPages=p.numPages,this._htmlForXfa=p.htmlForXfa,delete p.htmlForXfa,q._capability.resolve(new PDFDocumentProxy(p,this))}),c.on("DocException",function(p){let e;switch(p.name){case"PasswordException":e=new _util.PasswordException(p.message,p.code);break;case"InvalidPDFException":e=new _util.InvalidPDFException(p.message);break;case"MissingPDFException":e=new _util.MissingPDFException(p.message);break;case"UnexpectedResponseException":e=new _util.UnexpectedResponseException(p.message,p.status);break;case"UnknownErrorException":e=new _util.UnknownErrorException(p.message,p.details);break;default:(0,_util.unreachable)("DocException - expected a valid Error.")}q._capability.reject(e)}),c.on("PasswordRequest",p=>{if(this.#r=new _util.PromiseCapability,q.onPassword){const e=s=>{s instanceof Error?this.#r.reject(s):this.#r.resolve({password:s})};try{q.onPassword(e,p.code)}catch(s){this.#r.reject(s)}}else this.#r.reject(new _util.PasswordException(p.message,p.code));return this.#r.promise}),c.on("DataLoaded",p=>{q.onProgress?.({loaded:p.length,total:p.length}),this.downloadInfoCapability.resolve(p)}),c.on("StartRenderPage",p=>{if(this.destroyed)return;this.#t.get(p.pageIndex)._startRenderPage(p.transparency,p.cacheKey)}),c.on("commonobj",([p,e,s])=>{if(!this.destroyed&&!this.commonObjs.has(p))switch(e){case"Font":const N=this._params;if("error"in s){const o=s.error;(0,_util.warn)(`Error during font loading: ${o}`),this.commonObjs.resolve(p,o);break}const ee=N.pdfBug&&globalThis.FontInspector?.enabled?(o,t)=>globalThis.FontInspector.fontAdded(o,t):null,U=new _font_loader.FontFaceObject(s,{isEvalSupported:N.isEvalSupported,disableFontFace:N.disableFontFace,ignoreErrors:N.ignoreErrors,inspectFont:ee});this.fontLoader.bind(U).catch(o=>c.sendWithPromise("FontFallback",{id:p})).finally(()=>{!N.fontExtraProperties&&U.data&&(U.data=null),this.commonObjs.resolve(p,U)});break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(p,s);break;default:throw new Error(`Got unknown common object type ${e}`)}}),c.on("obj",([p,e,s,N])=>{if(this.destroyed)return;const ee=this.#t.get(e);if(!ee.objs.has(p))switch(s){case"Image":if(ee.objs.resolve(p,N),N){let U;if(N.bitmap){const{width:o,height:t}=N;U=o*t*4}else U=N.data?.length||0;U>_util.MAX_IMAGE_SIZE_TO_CACHE&&(ee._maybeCleanupAfterRender=!0)}break;case"Pattern":ee.objs.resolve(p,N);break;default:throw new Error(`Got unknown object type ${s}`)}}),c.on("DocProgress",p=>{this.destroyed||q.onProgress?.({loaded:p.loaded,total:p.total})}),c.on("FetchBuiltInCMap",p=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(p):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),c.on("FetchStandardFontData",p=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(p):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&(0,_util.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:c,transfers:q}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:c,filename:this._fullReader?.filename??null},q).finally(()=>{this.annotationStorage.resetModified()})}getPage(c){if(!Number.isInteger(c)||c<=0||c>this._numPages)return Promise.reject(new Error("Invalid page request."));const q=c-1,p=this.#n.get(q);if(p)return p;const e=this.messageHandler.sendWithPromise("GetPage",{pageIndex:q}).then(s=>{if(this.destroyed)throw new Error("Transport destroyed");const N=new PDFPageProxy(q,s,this,this._params.pdfBug);return this.#t.set(q,N),N});return this.#n.set(q,e),e}getPageIndex(c){return typeof c!="object"||c===null||!Number.isInteger(c.num)||c.num<0||!Number.isInteger(c.gen)||c.gen<0?Promise.reject(new Error("Invalid pageIndex request.")):this.messageHandler.sendWithPromise("GetPageIndex",{num:c.num,gen:c.gen})}getAnnotations(c,q){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:c,intent:q})}getFieldObjects(){return this.#o("GetFieldObjects")}hasJSActions(){return this.#o("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(c){return typeof c!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:c})}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.#o("GetDocJSActions")}getPageJSActions(c){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:c})}getStructTree(c){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:c})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then(c=>new _optional_content_config.OptionalContentConfig(c))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const c="GetMetadata",q=this.#e.get(c);if(q)return q;const p=this.messageHandler.sendWithPromise(c,null).then(e=>({info:e[0],metadata:e[1]?new _metadata.Metadata(e[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#e.set(c,p),p}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(c=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const q of this.#t.values())if(!q.cleanup())throw new Error(`startCleanup: Page ${q.pageNumber} is currently rendering.`);this.commonObjs.clear(),c||this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(!0)}}get loadingParams(){const{disableAutoFetch:c,enableXfa:q}=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:c,enableXfa:q})}}class PDFObjects{#e=Object.create(null);#t(c){return this.#e[c]||={capability:new _util.PromiseCapability,data:null}}get(c,q=null){if(q){const e=this.#t(c);return e.capability.promise.then(()=>q(e.data)),null}const p=this.#e[c];if(!p?.capability.settled)throw new Error(`Requesting object that isn't resolved yet ${c}.`);return p.data}has(c){return this.#e[c]?.capability.settled||!1}resolve(c,q=null){const p=this.#t(c);p.data=q,p.capability.resolve()}clear(){for(const c in this.#e){const{data:q}=this.#e[c];q?.bitmap?.close()}this.#e=Object.create(null)}}class RenderTask{#e=null;constructor(c){this.#e=c,this.onContinue=null}get promise(){return this.#e.capability.promise}cancel(c=0){this.#e.cancel(null,c)}get separateAnnots(){const{separateAnnots:c}=this.#e.operatorList;if(!c)return!1;const{annotationCanvasMap:q}=this.#e;return c.form||c.canvas&&q?.size>0}}exports.RenderTask=RenderTask;class InternalRenderTask{static#e=new WeakSet;constructor({callback:c,params:q,objs:p,commonObjs:e,annotationCanvasMap:s,operatorList:N,pageIndex:ee,canvasFactory:U,filterFactory:o,useRequestAnimationFrame:t=!1,pdfBug:a=!1,pageColors:g=null}){this.callback=c,this.params=q,this.objs=p,this.commonObjs=e,this.annotationCanvasMap=s,this.operatorListIdx=null,this.operatorList=N,this._pageIndex=ee,this.canvasFactory=U,this.filterFactory=o,this._pdfBug=a,this.pageColors=g,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=t===!0&&typeof window<"u",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=q.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:c=!1,optionalContentConfig:q}){if(this.cancelled)return;if(this._canvas){if(InternalRenderTask.#e.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");InternalRenderTask.#e.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:p,viewport:e,transform:s,background:N}=this.params;this.gfx=new _canvas.CanvasGraphics(p,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:q},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:s,viewport:e,transparency:c,background:N}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(c=null,q=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),InternalRenderTask.#e.delete(this._canvas),this.callback(c||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,q))}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.#e.delete(this._canvas),this.callback())))}}const version="3.11.174";exports.version=version;const build="ce8716743";exports.build=build}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.SerializableEmpty=c.PrintAnnotationStorage=c.AnnotationStorage=void 0;var p=q(1),e=q(4),s=q(8);const N=Object.freeze({map:null,hash:"",transfers:void 0});c.SerializableEmpty=N;class ee{#e=!1;#t=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,a){const g=this.#t.get(t);return g===void 0?a:Object.assign(a,g)}getRawValue(t){return this.#t.get(t)}remove(t){if(this.#t.delete(t),this.#t.size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const a of this.#t.values())if(a instanceof e.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(t,a){const g=this.#t.get(t);let d=!1;if(g!==void 0)for(const[i,b]of Object.entries(a))g[i]!==b&&(d=!0,g[i]=b);else d=!0,this.#t.set(t,a);d&&this.#n(),a instanceof e.AnnotationEditor&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(a.constructor._type)}has(t){return this.#t.has(t)}getAll(){return this.#t.size>0?(0,p.objectFromMap)(this.#t):null}setAll(t){for(const[a,g]of Object.entries(t))this.setValue(a,g)}get size(){return this.#t.size}#n(){this.#e||(this.#e=!0,typeof this.onSetModified=="function"&&this.onSetModified())}resetModified(){this.#e&&(this.#e=!1,typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new U(this)}get serializable(){if(this.#t.size===0)return N;const t=new Map,a=new s.MurmurHash3_64,g=[],d=Object.create(null);let i=!1;for(const[b,y]of this.#t){const f=y instanceof e.AnnotationEditor?y.serialize(!1,d):y;f&&(t.set(b,f),a.update(`${b}:${JSON.stringify(f)}`),i||=!!f.bitmap)}if(i)for(const b of t.values())b.bitmap&&g.push(b.bitmap);return t.size>0?{map:t,hash:a.hexdigest(),transfers:g}:N}}c.AnnotationStorage=ee;class U extends ee{#e;constructor(t){super();const{map:a,hash:g,transfers:d}=t.serializable,i=structuredClone(a,d?{transfer:d}:null);this.#e={map:i,hash:g,transfers:d}}get print(){(0,p.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#e}}c.PrintAnnotationStorage=U}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.AnnotationEditor=void 0;var p=q(5),e=q(1),s=q(6);class N{#e="";#t=!1;#n=null;#r=null;#o=null;#s=!1;#a=null;#l=this.focusin.bind(this);#c=this.focusout.bind(this);#i=!1;#f=!1;#d=!1;_initialOptions=Object.create(null);_uiManager=null;_focusEventsAllowed=!0;_l10nPromise=null;#h=!1;#p=N._zIndex++;static _borderLineWidth=-1;static _colorManager=new p.ColorManager;static _zIndex=1;static SMALL_EDITOR_SIZE=0;constructor(o){this.constructor===N&&(0,e.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;const{rotation:t,rawDims:{pageWidth:a,pageHeight:g,pageX:d,pageY:i}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[a,g],this.pageTranslation=[d,i];const[b,y]=this.parentDimensions;this.x=o.x/b,this.y=o.y/y,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return(0,e.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(o){const t=new ee({id:o.parent.getNextId(),parent:o.parent,uiManager:o._uiManager});t.annotationElementId=o.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(o,t=null){if(N._l10nPromise||=new Map(["editor_alt_text_button_label","editor_alt_text_edit_button_label","editor_alt_text_decorative_tooltip"].map(g=>[g,o.get(g)])),t?.strings)for(const g of t.strings)N._l10nPromise.set(g,o.get(g));if(N._borderLineWidth!==-1)return;const a=getComputedStyle(document.documentElement);N._borderLineWidth=parseFloat(a.getPropertyValue("--outline-width"))||0}static updateDefaultParams(o,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(o){return!1}static paste(o,t){(0,e.unreachable)("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#h}set _isDraggable(o){this.#h=o,this.div?.classList.toggle("draggable",o)}center(){const[o,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(o*2),this.y+=this.width*o/(t*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(o*2),this.y-=this.width*o/(t*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}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.#p}setParent(o){o!==null&&(this.pageIndex=o.pageIndex,this.pageDimensions=o.pageDimensions),this.parent=o}focusin(o){this._focusEventsAllowed&&(this.#i?this.#i=!1:this.parent.setSelected(this))}focusout(o){!this._focusEventsAllowed||!this.isAttachedToDOM||o.relatedTarget?.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,t,a,g){const[d,i]=this.parentDimensions;[a,g]=this.screenToPageTranslation(a,g),this.x=(o+a)/d,this.y=(t+g)/i,this.fixAndSetPosition()}#v([o,t],a,g){[a,g]=this.screenToPageTranslation(a,g),this.x+=a/o,this.y+=g/t,this.fixAndSetPosition()}translate(o,t){this.#v(this.parentDimensions,o,t)}translateInPage(o,t){this.#v(this.pageDimensions,o,t),this.div.scrollIntoView({block:"nearest"})}drag(o,t){const[a,g]=this.parentDimensions;if(this.x+=o/a,this.y+=t/g,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:f,y:T}=this.div.getBoundingClientRect();this.parent.findNewParent(this,f,T)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:d,y:i}=this;const[b,y]=this.#m();d+=b,i+=y,this.div.style.left=`${(100*d).toFixed(2)}%`,this.div.style.top=`${(100*i).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}#m(){const[o,t]=this.parentDimensions,{_borderLineWidth:a}=N,g=a/o,d=a/t;switch(this.rotation){case 90:return[-g,d];case 180:return[g,d];case 270:return[g,-d];default:return[-g,-d]}}fixAndSetPosition(){const[o,t]=this.pageDimensions;let{x:a,y:g,width:d,height:i}=this;switch(d*=o,i*=t,a*=o,g*=t,this.rotation){case 0:a=Math.max(0,Math.min(o-d,a)),g=Math.max(0,Math.min(t-i,g));break;case 90:a=Math.max(0,Math.min(o-i,a)),g=Math.min(t,Math.max(d,g));break;case 180:a=Math.min(o,Math.max(d,a)),g=Math.min(t,Math.max(i,g));break;case 270:a=Math.min(o,Math.max(i,a)),g=Math.max(0,Math.min(t-d,g));break}this.x=a/=o,this.y=g/=t;const[b,y]=this.#m();a+=b,g+=y;const{style:f}=this.div;f.left=`${(100*a).toFixed(2)}%`,f.top=`${(100*g).toFixed(2)}%`,this.moveInDOM()}static#g(o,t,a){switch(a){case 90:return[t,-o];case 180:return[-o,-t];case 270:return[-t,o];default:return[o,t]}}screenToPageTranslation(o,t){return N.#g(o,t,this.parentRotation)}pageTranslationToScreen(o,t){return N.#g(o,t,360-this.parentRotation)}#u(o){switch(o){case 90:{const[t,a]=this.pageDimensions;return[0,-t/a,a/t,0]}case 180:return[-1,0,0,-1];case 270:{const[t,a]=this.pageDimensions;return[0,t/a,-a/t,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:o,pageDimensions:[t,a]}=this,g=t*o,d=a*o;return e.FeatureTest.isCSSRoundSupported?[Math.round(g),Math.round(d)]:[g,d]}setDims(o,t){const[a,g]=this.parentDimensions;this.div.style.width=`${(100*o/a).toFixed(2)}%`,this.#s||(this.div.style.height=`${(100*t/g).toFixed(2)}%`),this.#n?.classList.toggle("small",o<N.SMALL_EDITOR_SIZE||t<N.SMALL_EDITOR_SIZE)}fixDims(){const{style:o}=this.div,{height:t,width:a}=o,g=a.endsWith("%"),d=!this.#s&&t.endsWith("%");if(g&&d)return;const[i,b]=this.parentDimensions;g||(o.width=`${(100*parseFloat(a)/i).toFixed(2)}%`),!this.#s&&!d&&(o.height=`${(100*parseFloat(t)/b).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#b(){if(this.#a)return;this.#a=document.createElement("div"),this.#a.classList.add("resizers");const o=["topLeft","topRight","bottomRight","bottomLeft"];this._willKeepAspectRatio||o.push("topMiddle","middleRight","bottomMiddle","middleLeft");for(const t of o){const a=document.createElement("div");this.#a.append(a),a.classList.add("resizer",t),a.addEventListener("pointerdown",this.#E.bind(this,t)),a.addEventListener("contextmenu",s.noContextMenu)}this.div.prepend(this.#a)}#E(o,t){t.preventDefault();const{isMac:a}=e.FeatureTest.platform;if(t.button!==0||t.ctrlKey&&a)return;const g=this.#w.bind(this,o),d=this._isDraggable;this._isDraggable=!1;const i={passive:!0,capture:!0};window.addEventListener("pointermove",g,i);const b=this.x,y=this.y,f=this.width,T=this.height,H=this.parent.div.style.cursor,I=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;const _=()=>{this._isDraggable=d,window.removeEventListener("pointerup",_),window.removeEventListener("blur",_),window.removeEventListener("pointermove",g,i),this.parent.div.style.cursor=H,this.div.style.cursor=I;const M=this.x,te=this.y,ie=this.width,Y=this.height;M===b&&te===y&&ie===f&&Y===T||this.addCommands({cmd:()=>{this.width=ie,this.height=Y,this.x=M,this.y=te;const[he,ge]=this.parentDimensions;this.setDims(he*ie,ge*Y),this.fixAndSetPosition()},undo:()=>{this.width=f,this.height=T,this.x=b,this.y=y;const[he,ge]=this.parentDimensions;this.setDims(he*f,ge*T),this.fixAndSetPosition()},mustExec:!0})};window.addEventListener("pointerup",_),window.addEventListener("blur",_)}#w(o,t){const[a,g]=this.parentDimensions,d=this.x,i=this.y,b=this.width,y=this.height,f=N.MIN_SIZE/a,T=N.MIN_SIZE/g,H=L=>Math.round(L*1e4)/1e4,I=this.#u(this.rotation),_=(L,l)=>[I[0]*L+I[2]*l,I[1]*L+I[3]*l],M=this.#u(360-this.rotation),te=(L,l)=>[M[0]*L+M[2]*l,M[1]*L+M[3]*l];let ie,Y,he=!1,ge=!1;switch(o){case"topLeft":he=!0,ie=(L,l)=>[0,0],Y=(L,l)=>[L,l];break;case"topMiddle":ie=(L,l)=>[L/2,0],Y=(L,l)=>[L/2,l];break;case"topRight":he=!0,ie=(L,l)=>[L,0],Y=(L,l)=>[0,l];break;case"middleRight":ge=!0,ie=(L,l)=>[L,l/2],Y=(L,l)=>[0,l/2];break;case"bottomRight":he=!0,ie=(L,l)=>[L,l],Y=(L,l)=>[0,0];break;case"bottomMiddle":ie=(L,l)=>[L/2,l],Y=(L,l)=>[L/2,0];break;case"bottomLeft":he=!0,ie=(L,l)=>[0,l],Y=(L,l)=>[L,0];break;case"middleLeft":ge=!0,ie=(L,l)=>[0,l/2],Y=(L,l)=>[L,l/2];break}const Ne=ie(b,y),ke=Y(b,y);let Oe=_(...ke);const Ve=H(d+Oe[0]),Ee=H(i+Oe[1]);let G=1,A=1,[m,v]=this.screenToPageTranslation(t.movementX,t.movementY);if([m,v]=te(m/a,v/g),he){const L=Math.hypot(b,y);G=A=Math.max(Math.min(Math.hypot(ke[0]-Ne[0]-m,ke[1]-Ne[1]-v)/L,1/b,1/y),f/b,T/y)}else ge?G=Math.max(f,Math.min(1,Math.abs(ke[0]-Ne[0]-m)))/b:A=Math.max(T,Math.min(1,Math.abs(ke[1]-Ne[1]-v)))/y;const C=H(b*G),V=H(y*A);Oe=_(...Y(C,V));const W=Ve-Oe[0],K=Ee-Oe[1];this.width=C,this.height=V,this.x=W,this.y=K,this.setDims(a*C,g*V),this.fixAndSetPosition()}async addAltTextButton(){if(this.#n)return;const o=this.#n=document.createElement("button");o.className="altText";const t=await N._l10nPromise.get("editor_alt_text_button_label");o.textContent=t,o.setAttribute("aria-label",t),o.tabIndex="0",o.addEventListener("contextmenu",s.noContextMenu),o.addEventListener("pointerdown",a=>a.stopPropagation()),o.addEventListener("click",a=>{a.preventDefault(),this._uiManager.editAltText(this)},{capture:!0}),o.addEventListener("keydown",a=>{a.target===o&&a.key==="Enter"&&(a.preventDefault(),this._uiManager.editAltText(this))}),this.#C(),this.div.append(o),N.SMALL_EDITOR_SIZE||(N.SMALL_EDITOR_SIZE=Math.min(128,Math.round(o.getBoundingClientRect().width*1.4)))}async#C(){const o=this.#n;if(!o)return;if(!this.#e&&!this.#t){o.classList.remove("done"),this.#r?.remove();return}N._l10nPromise.get("editor_alt_text_edit_button_label").then(a=>{o.setAttribute("aria-label",a)});let t=this.#r;if(!t){this.#r=t=document.createElement("span"),t.className="tooltip",t.setAttribute("role","tooltip");const a=t.id=`alt-text-tooltip-${this.id}`;o.setAttribute("aria-describedby",a);const g=100;o.addEventListener("mouseenter",()=>{this.#o=setTimeout(()=>{this.#o=null,this.#r.classList.add("show"),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",subtype:this.editorType,data:{action:"alt_text_tooltip"}}})},g)}),o.addEventListener("mouseleave",()=>{clearTimeout(this.#o),this.#o=null,this.#r?.classList.remove("show")})}o.classList.add("done"),t.innerText=this.#t?await N._l10nPromise.get("editor_alt_text_decorative_tooltip"):this.#e,t.parentNode||o.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}get altTextData(){return{altText:this.#e,decorative:this.#t}}set altTextData({altText:o,decorative:t}){this.#e===o&&this.#t===t||(this.#e=o,this.#t=t,this.#C())}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.#l),this.div.addEventListener("focusout",this.#c);const[o,t]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*t/o).toFixed(2)}%`,this.div.style.maxHeight=`${(100*o/t).toFixed(2)}%`);const[a,g]=this.getInitialTranslation();return this.translate(a,g),(0,p.bindEvents)(this,this.div,["pointerdown"]),this.div}pointerdown(o){const{isMac:t}=e.FeatureTest.platform;if(o.button!==0||o.ctrlKey&&t){o.preventDefault();return}this.#i=!0,this.#T(o)}#T(o){if(!this._isDraggable)return;const t=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let a,g;t&&(a={passive:!0,capture:!0},g=i=>{const[b,y]=this.screenToPageTranslation(i.movementX,i.movementY);this._uiManager.dragSelectedEditors(b,y)},window.addEventListener("pointermove",g,a));const d=()=>{if(window.removeEventListener("pointerup",d),window.removeEventListener("blur",d),t&&window.removeEventListener("pointermove",g,a),this.#i=!1,!this._uiManager.endDragSession()){const{isMac:i}=e.FeatureTest.platform;o.ctrlKey&&!i||o.shiftKey||o.metaKey&&i?this.parent.toggleSelected(this):this.parent.setSelected(this)}};window.addEventListener("pointerup",d),window.addEventListener("blur",d)}moveInDOM(){this.parent?.moveEditorInDOM(this)}_setParentAndPosition(o,t,a){o.changeParent(this),this.x=t,this.y=a,this.fixAndSetPosition()}getRect(o,t){const a=this.parentScale,[g,d]=this.pageDimensions,[i,b]=this.pageTranslation,y=o/a,f=t/a,T=this.x*g,H=this.y*d,I=this.width*g,_=this.height*d;switch(this.rotation){case 0:return[T+y+i,d-H-f-_+b,T+y+I+i,d-H-f+b];case 90:return[T+f+i,d-H+y+b,T+f+_+i,d-H+y+I+b];case 180:return[T-y-I+i,d-H+f+b,T-y+i,d-H+f+_+b];case 270:return[T-f-_+i,d-H-y-I+b,T-f+i,d-H-y+b];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(o,t){const[a,g,d,i]=o,b=d-a,y=i-g;switch(this.rotation){case 0:return[a,t-i,b,y];case 90:return[a,t-g,y,b];case 180:return[d,t-g,b,y];case 270:return[d,t-i,y,b];default:throw new 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.#l),this.div?.addEventListener("focusout",this.#c)}serialize(o=!1,t=null){(0,e.unreachable)("An editor must be serializable")}static deserialize(o,t,a){const g=new this.prototype.constructor({parent:t,id:t.getNextId(),uiManager:a});g.rotation=o.rotation;const[d,i]=g.pageDimensions,[b,y,f,T]=g.getRectInCurrentCoords(o.rect,i);return g.x=b/d,g.y=y/i,g.width=f/d,g.height=T/i,g}remove(){this.div.removeEventListener("focusin",this.#l),this.div.removeEventListener("focusout",this.#c),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#n?.remove(),this.#n=null,this.#r=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#b(),this.#a.classList.remove("hidden"))}select(){this.makeResizable(),this.div?.classList.add("selectedEditor")}unselect(){this.#a?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus()}updateParams(o,t){}disableEditing(){this.#n&&(this.#n.hidden=!0)}enableEditing(){this.#n&&(this.#n.hidden=!1)}enterInEditMode(){}get contentDiv(){return this.div}get isEditing(){return this.#f}set isEditing(o){this.#f=o,this.parent&&(o?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(o,t){this.#s=!0;const a=o/t,{style:g}=this.div;g.aspectRatio=a,g.height="auto"}static get MIN_SIZE(){return 16}}c.AnnotationEditor=N;class ee extends N{constructor(o){super(o),this.annotationElementId=o.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.KeyboardManager=c.CommandManager=c.ColorManager=c.AnnotationEditorUIManager=void 0,c.bindEvents=s,c.opacityToHex=N;var p=q(1),e=q(6);function s(d,i,b){for(const y of b)i.addEventListener(y,d[y].bind(d))}function N(d){return Math.round(Math.min(255,Math.max(1,255*d))).toString(16).padStart(2,"0")}class ee{#e=0;getId(){return`${p.AnnotationEditorPrefix}${this.#e++}`}}class U{#e=(0,p.getUuid)();#t=0;#n=null;static get _isSVGFittingCanvas(){const i='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>',y=new OffscreenCanvas(1,3).getContext("2d"),f=new Image;f.src=i;const T=f.decode().then(()=>(y.drawImage(f,0,0,1,1,0,0,1,3),new Uint32Array(y.getImageData(0,0,1,1).data.buffer)[0]===0));return(0,p.shadow)(this,"_isSVGFittingCanvas",T)}async#r(i,b){this.#n||=new Map;let y=this.#n.get(i);if(y===null)return null;if(y?.bitmap)return y.refCounter+=1,y;try{y||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let f;if(typeof b=="string"){y.url=b;const T=await fetch(b);if(!T.ok)throw new Error(T.statusText);f=await T.blob()}else f=y.file=b;if(f.type==="image/svg+xml"){const T=U._isSVGFittingCanvas,H=new FileReader,I=new Image,_=new Promise((M,te)=>{I.onload=()=>{y.bitmap=I,y.isSvg=!0,M()},H.onload=async()=>{const ie=y.svgUrl=H.result;I.src=await T?`${ie}#svgView(preserveAspectRatio(none))`:ie},I.onerror=H.onerror=te});H.readAsDataURL(f),await _}else y.bitmap=await createImageBitmap(f);y.refCounter=1}catch(f){console.error(f),y=null}return this.#n.set(i,y),y&&this.#n.set(y.id,y),y}async getFromFile(i){const{lastModified:b,name:y,size:f,type:T}=i;return this.#r(`${b}_${y}_${f}_${T}`,i)}async getFromUrl(i){return this.#r(i,i)}async getFromId(i){this.#n||=new Map;const b=this.#n.get(i);return b?b.bitmap?(b.refCounter+=1,b):b.file?this.getFromFile(b.file):this.getFromUrl(b.url):null}getSvgUrl(i){const b=this.#n.get(i);return b?.isSvg?b.svgUrl:null}deleteId(i){this.#n||=new Map;const b=this.#n.get(i);b&&(b.refCounter-=1,b.refCounter===0&&(b.bitmap=null))}isValidId(i){return i.startsWith(`image_${this.#e}_`)}}class o{#e=[];#t=!1;#n;#r=-1;constructor(i=128){this.#n=i}add({cmd:i,undo:b,mustExec:y,type:f=NaN,overwriteIfSameType:T=!1,keepUndo:H=!1}){if(y&&i(),this.#t)return;const I={cmd:i,undo:b,type:f};if(this.#r===-1){this.#e.length>0&&(this.#e.length=0),this.#r=0,this.#e.push(I);return}if(T&&this.#e[this.#r].type===f){H&&(I.undo=this.#e[this.#r].undo),this.#e[this.#r]=I;return}const _=this.#r+1;_===this.#n?this.#e.splice(0,1):(this.#r=_,_<this.#e.length&&this.#e.splice(_)),this.#e.push(I)}undo(){this.#r!==-1&&(this.#t=!0,this.#e[this.#r].undo(),this.#t=!1,this.#r-=1)}redo(){this.#r<this.#e.length-1&&(this.#r+=1,this.#t=!0,this.#e[this.#r].cmd(),this.#t=!1)}hasSomethingToUndo(){return this.#r!==-1}hasSomethingToRedo(){return this.#r<this.#e.length-1}destroy(){this.#e=null}}c.CommandManager=o;class t{constructor(i){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:b}=p.FeatureTest.platform;for(const[y,f,T={}]of i)for(const H of y){const I=H.startsWith("mac+");b&&I?(this.callbacks.set(H.slice(4),{callback:f,options:T}),this.allKeys.add(H.split("+").at(-1))):!b&&!I&&(this.callbacks.set(H,{callback:f,options:T}),this.allKeys.add(H.split("+").at(-1)))}}#e(i){i.altKey&&this.buffer.push("alt"),i.ctrlKey&&this.buffer.push("ctrl"),i.metaKey&&this.buffer.push("meta"),i.shiftKey&&this.buffer.push("shift"),this.buffer.push(i.key);const b=this.buffer.join("+");return this.buffer.length=0,b}exec(i,b){if(!this.allKeys.has(b.key))return;const y=this.callbacks.get(this.#e(b));if(!y)return;const{callback:f,options:{bubbles:T=!1,args:H=[],checker:I=null}}=y;I&&!I(i,b)||(f.bind(i,...H)(),T||(b.stopPropagation(),b.preventDefault()))}}c.KeyboardManager=t;class a{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const i=new Map([["CanvasText",null],["Canvas",null]]);return(0,e.getColorValues)(i),(0,p.shadow)(this,"_colors",i)}convert(i){const b=(0,e.getRGB)(i);if(!window.matchMedia("(forced-colors: active)").matches)return b;for(const[y,f]of this._colors)if(f.every((T,H)=>T===b[H]))return a._colorsMapping.get(y);return b}getHexCode(i){const b=this._colors.get(i);return b?p.Util.makeHexColor(...b):i}}c.ColorManager=a;class g{#e=null;#t=new Map;#n=new Map;#r=null;#o=null;#s=new o;#a=0;#l=new Set;#c=null;#i=null;#f=new Set;#d=null;#h=new ee;#p=!1;#v=!1;#m=null;#g=p.AnnotationEditorType.NONE;#u=new Set;#b=null;#E=this.blur.bind(this);#w=this.focus.bind(this);#C=this.copy.bind(this);#T=this.cut.bind(this);#O=this.paste.bind(this);#D=this.keydown.bind(this);#I=this.onEditingAction.bind(this);#_=this.onPageChanging.bind(this);#L=this.onScaleChanging.bind(this);#k=this.onRotationChanging.bind(this);#M={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1};#y=[0,0];#R=null;#A=null;#N=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const i=g.prototype,b=T=>{const{activeElement:H}=document;return H&&T.#A.contains(H)&&T.hasSomethingToControl()},y=this.TRANSLATE_SMALL,f=this.TRANSLATE_BIG;return(0,p.shadow)(this,"_keyboardManager",new t([[["ctrl+a","mac+meta+a"],i.selectAll],[["ctrl+z","mac+meta+z"],i.undo],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],i.redo],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],i.delete],[["Escape","mac+Escape"],i.unselectAll],[["ArrowLeft","mac+ArrowLeft"],i.translateSelectedEditors,{args:[-y,0],checker:b}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],i.translateSelectedEditors,{args:[-f,0],checker:b}],[["ArrowRight","mac+ArrowRight"],i.translateSelectedEditors,{args:[y,0],checker:b}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],i.translateSelectedEditors,{args:[f,0],checker:b}],[["ArrowUp","mac+ArrowUp"],i.translateSelectedEditors,{args:[0,-y],checker:b}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],i.translateSelectedEditors,{args:[0,-f],checker:b}],[["ArrowDown","mac+ArrowDown"],i.translateSelectedEditors,{args:[0,y],checker:b}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],i.translateSelectedEditors,{args:[0,f],checker:b}]]))}constructor(i,b,y,f,T,H){this.#A=i,this.#N=b,this.#r=y,this._eventBus=f,this._eventBus._on("editingaction",this.#I),this._eventBus._on("pagechanging",this.#_),this._eventBus._on("scalechanging",this.#L),this._eventBus._on("rotationchanging",this.#k),this.#o=T.annotationStorage,this.#d=T.filterFactory,this.#b=H,this.viewParameters={realScale:e.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0}}destroy(){this.#x(),this.#H(),this._eventBus._off("editingaction",this.#I),this._eventBus._off("pagechanging",this.#_),this._eventBus._off("scalechanging",this.#L),this._eventBus._off("rotationchanging",this.#k);for(const i of this.#n.values())i.destroy();this.#n.clear(),this.#t.clear(),this.#f.clear(),this.#e=null,this.#u.clear(),this.#s.destroy(),this.#r.destroy()}get hcmFilter(){return(0,p.shadow)(this,"hcmFilter",this.#b?this.#d.addHCMFilter(this.#b.foreground,this.#b.background):"none")}get direction(){return(0,p.shadow)(this,"direction",getComputedStyle(this.#A).direction)}editAltText(i){this.#r?.editAltText(this,i)}onPageChanging({pageNumber:i}){this.#a=i-1}focusMainContainer(){this.#A.focus()}findParent(i,b){for(const y of this.#n.values()){const{x:f,y:T,width:H,height:I}=y.div.getBoundingClientRect();if(i>=f&&i<=f+H&&b>=T&&b<=T+I)return y}return null}disableUserSelect(i=!1){this.#N.classList.toggle("noUserSelect",i)}addShouldRescale(i){this.#f.add(i)}removeShouldRescale(i){this.#f.delete(i)}onScaleChanging({scale:i}){this.commitOrRemove(),this.viewParameters.realScale=i*e.PixelsPerInch.PDF_TO_CSS_UNITS;for(const b of this.#f)b.onScaleChanging()}onRotationChanging({pagesRotation:i}){this.commitOrRemove(),this.viewParameters.rotation=i}addToAnnotationStorage(i){!i.isEmpty()&&this.#o&&!this.#o.has(i.id)&&this.#o.setValue(i.id,i)}#B(){window.addEventListener("focus",this.#w),window.addEventListener("blur",this.#E)}#H(){window.removeEventListener("focus",this.#w),window.removeEventListener("blur",this.#E)}blur(){if(!this.hasSelection)return;const{activeElement:i}=document;for(const b of this.#u)if(b.div.contains(i)){this.#m=[b,i],b._focusEventsAllowed=!1;break}}focus(){if(!this.#m)return;const[i,b]=this.#m;this.#m=null,b.addEventListener("focusin",()=>{i._focusEventsAllowed=!0},{once:!0}),b.focus()}#V(){window.addEventListener("keydown",this.#D,{capture:!0})}#x(){window.removeEventListener("keydown",this.#D,{capture:!0})}#F(){document.addEventListener("copy",this.#C),document.addEventListener("cut",this.#T),document.addEventListener("paste",this.#O)}#P(){document.removeEventListener("copy",this.#C),document.removeEventListener("cut",this.#T),document.removeEventListener("paste",this.#O)}addEditListeners(){this.#V(),this.#F()}removeEditListeners(){this.#x(),this.#P()}copy(i){if(i.preventDefault(),this.#e?.commitOrRemove(),!this.hasSelection)return;const b=[];for(const y of this.#u){const f=y.serialize(!0);f&&b.push(f)}b.length!==0&&i.clipboardData.setData("application/pdfjs",JSON.stringify(b))}cut(i){this.copy(i),this.delete()}paste(i){i.preventDefault();const{clipboardData:b}=i;for(const T of b.items)for(const H of this.#i)if(H.isHandlingMimeForPasting(T.type)){H.paste(T,this.currentLayer);return}let y=b.getData("application/pdfjs");if(!y)return;try{y=JSON.parse(y)}catch(T){(0,p.warn)(`paste: "${T.message}".`);return}if(!Array.isArray(y))return;this.unselectAll();const f=this.currentLayer;try{const T=[];for(const _ of y){const M=f.deserialize(_);if(!M)return;T.push(M)}const H=()=>{for(const _ of T)this.#U(_);this.#z(T)},I=()=>{for(const _ of T)_.remove()};this.addCommands({cmd:H,undo:I,mustExec:!0})}catch(T){(0,p.warn)(`paste: "${T.message}".`)}}keydown(i){this.getActive()?.shouldGetKeyboardEvents()||g._keyboardManager.exec(this,i)}onEditingAction(i){["undo","redo","delete","selectAll"].includes(i.name)&&this[i.name]()}#S(i){Object.entries(i).some(([y,f])=>this.#M[y]!==f)&&this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#M,i)})}#W(i){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:i})}setEditingState(i){i?(this.#B(),this.#V(),this.#F(),this.#S({isEditing:this.#g!==p.AnnotationEditorType.NONE,isEmpty:this.#j(),hasSomethingToUndo:this.#s.hasSomethingToUndo(),hasSomethingToRedo:this.#s.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#H(),this.#x(),this.#P(),this.#S({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(i){if(!this.#i){this.#i=i;for(const b of this.#i)this.#W(b.defaultPropertiesToUpdate)}}getId(){return this.#h.getId()}get currentLayer(){return this.#n.get(this.#a)}getLayer(i){return this.#n.get(i)}get currentPageIndex(){return this.#a}addLayer(i){this.#n.set(i.pageIndex,i),this.#p?i.enable():i.disable()}removeLayer(i){this.#n.delete(i.pageIndex)}updateMode(i,b=null){if(this.#g!==i){if(this.#g=i,i===p.AnnotationEditorType.NONE){this.setEditingState(!1),this.#G();return}this.setEditingState(!0),this.#q(),this.unselectAll();for(const y of this.#n.values())y.updateMode(i);if(b){for(const y of this.#t.values())if(y.annotationElementId===b){this.setSelected(y),y.enterInEditMode();break}}}}updateToolbar(i){i!==this.#g&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:i})}updateParams(i,b){if(this.#i){if(i===p.AnnotationEditorParamsType.CREATE){this.currentLayer.addNewEditor(i);return}for(const y of this.#u)y.updateParams(i,b);for(const y of this.#i)y.updateDefaultParams(i,b)}}enableWaiting(i=!1){if(this.#v!==i){this.#v=i;for(const b of this.#n.values())i?b.disableClick():b.enableClick(),b.div.classList.toggle("waiting",i)}}#q(){if(!this.#p){this.#p=!0;for(const i of this.#n.values())i.enable()}}#G(){if(this.unselectAll(),this.#p){this.#p=!1;for(const i of this.#n.values())i.disable()}}getEditors(i){const b=[];for(const y of this.#t.values())y.pageIndex===i&&b.push(y);return b}getEditor(i){return this.#t.get(i)}addEditor(i){this.#t.set(i.id,i)}removeEditor(i){this.#t.delete(i.id),this.unselect(i),(!i.annotationElementId||!this.#l.has(i.annotationElementId))&&this.#o?.remove(i.id)}addDeletedAnnotationElement(i){this.#l.add(i.annotationElementId),i.deleted=!0}isDeletedAnnotationElement(i){return this.#l.has(i)}removeDeletedAnnotationElement(i){this.#l.delete(i.annotationElementId),i.deleted=!1}#U(i){const b=this.#n.get(i.pageIndex);b?b.addOrRebuild(i):this.addEditor(i)}setActiveEditor(i){this.#e!==i&&(this.#e=i,i&&this.#W(i.propertiesToUpdate))}toggleSelected(i){if(this.#u.has(i)){this.#u.delete(i),i.unselect(),this.#S({hasSelectedEditor:this.hasSelection});return}this.#u.add(i),i.select(),this.#W(i.propertiesToUpdate),this.#S({hasSelectedEditor:!0})}setSelected(i){for(const b of this.#u)b!==i&&b.unselect();this.#u.clear(),this.#u.add(i),i.select(),this.#W(i.propertiesToUpdate),this.#S({hasSelectedEditor:!0})}isSelected(i){return this.#u.has(i)}unselect(i){i.unselect(),this.#u.delete(i),this.#S({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#u.size!==0}undo(){this.#s.undo(),this.#S({hasSomethingToUndo:this.#s.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#j()})}redo(){this.#s.redo(),this.#S({hasSomethingToUndo:!0,hasSomethingToRedo:this.#s.hasSomethingToRedo(),isEmpty:this.#j()})}addCommands(i){this.#s.add(i),this.#S({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#j()})}#j(){if(this.#t.size===0)return!0;if(this.#t.size===1)for(const i of this.#t.values())return i.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const i=[...this.#u],b=()=>{for(const f of i)f.remove()},y=()=>{for(const f of i)this.#U(f)};this.addCommands({cmd:b,undo:y,mustExec:!0})}commitOrRemove(){this.#e?.commitOrRemove()}hasSomethingToControl(){return this.#e||this.hasSelection}#z(i){this.#u.clear();for(const b of i)b.isEmpty()||(this.#u.add(b),b.select());this.#S({hasSelectedEditor:!0})}selectAll(){for(const i of this.#u)i.commit();this.#z(this.#t.values())}unselectAll(){if(this.#e){this.#e.commitOrRemove();return}if(this.hasSelection){for(const i of this.#u)i.unselect();this.#u.clear(),this.#S({hasSelectedEditor:!1})}}translateSelectedEditors(i,b,y=!1){if(y||this.commitOrRemove(),!this.hasSelection)return;this.#y[0]+=i,this.#y[1]+=b;const[f,T]=this.#y,H=[...this.#u],I=1e3;this.#R&&clearTimeout(this.#R),this.#R=setTimeout(()=>{this.#R=null,this.#y[0]=this.#y[1]=0,this.addCommands({cmd:()=>{for(const _ of H)this.#t.has(_.id)&&_.translateInPage(f,T)},undo:()=>{for(const _ of H)this.#t.has(_.id)&&_.translateInPage(-f,-T)},mustExec:!1})},I);for(const _ of H)_.translateInPage(i,b)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#c=new Map;for(const i of this.#u)this.#c.set(i,{savedX:i.x,savedY:i.y,savedPageIndex:i.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#c)return!1;this.disableUserSelect(!1);const i=this.#c;this.#c=null;let b=!1;for(const[{x:f,y:T,pageIndex:H},I]of i)I.newX=f,I.newY=T,I.newPageIndex=H,b||=f!==I.savedX||T!==I.savedY||H!==I.savedPageIndex;if(!b)return!1;const y=(f,T,H,I)=>{if(this.#t.has(f.id)){const _=this.#n.get(I);_?f._setParentAndPosition(_,T,H):(f.pageIndex=I,f.x=T,f.y=H)}};return this.addCommands({cmd:()=>{for(const[f,{newX:T,newY:H,newPageIndex:I}]of i)y(f,T,H,I)},undo:()=>{for(const[f,{savedX:T,savedY:H,savedPageIndex:I}]of i)y(f,T,H,I)},mustExec:!0}),!0}dragSelectedEditors(i,b){if(this.#c)for(const y of this.#c.keys())y.drag(i,b)}rebuild(i){if(i.parent===null){const b=this.getLayer(i.pageIndex);b?(b.changeParent(i),b.addOrRebuild(i)):(this.addEditor(i),this.addToAnnotationStorage(i),i.rebuild())}else i.parent.addOrRebuild(i)}isActive(i){return this.#e===i}getActive(){return this.#e}getMode(){return this.#g}get imageManager(){return(0,p.shadow)(this,"imageManager",new U)}}c.AnnotationEditorUIManager=g}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.StatTimer=c.RenderingCancelledException=c.PixelsPerInch=c.PageViewport=c.PDFDateString=c.DOMStandardFontDataFactory=c.DOMSVGFactory=c.DOMFilterFactory=c.DOMCanvasFactory=c.DOMCMapReaderFactory=void 0,c.deprecated=te,c.getColorValues=Ne,c.getCurrentTransform=ke,c.getCurrentTransformInverse=Oe,c.getFilenameFromUrl=f,c.getPdfFilenameFromUrl=T,c.getRGB=ge,c.getXfaPageViewport=he,c.isDataScheme=b,c.isPdfFile=y,c.isValidFetchUrl=I,c.loadScript=M,c.noContextMenu=_,c.setLayerDimensions=Ve;var p=q(7),e=q(1);const s="http://www.w3.org/2000/svg";class N{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}c.PixelsPerInch=N;class ee extends p.BaseFilterFactory{#e;#t;#n;#r;#o;#s;#a;#l;#c;#i;#f=0;constructor({docId:G,ownerDocument:A=globalThis.document}={}){super(),this.#n=G,this.#r=A}get#d(){return this.#e||=new Map}get#h(){if(!this.#t){const G=this.#r.createElement("div"),{style:A}=G;A.visibility="hidden",A.contain="strict",A.width=A.height=0,A.position="absolute",A.top=A.left=0,A.zIndex=-1;const m=this.#r.createElementNS(s,"svg");m.setAttribute("width",0),m.setAttribute("height",0),this.#t=this.#r.createElementNS(s,"defs"),G.append(m),m.append(this.#t),this.#r.body.append(G)}return this.#t}addFilter(G){if(!G)return"none";let A=this.#d.get(G);if(A)return A;let m,v,C,V;if(G.length===1){const l=G[0],S=new Array(256);for(let R=0;R<256;R++)S[R]=l[R]/255;V=m=v=C=S.join(",")}else{const[l,S,R]=G,O=new Array(256),B=new Array(256),Z=new Array(256);for(let re=0;re<256;re++)O[re]=l[re]/255,B[re]=S[re]/255,Z[re]=R[re]/255;m=O.join(","),v=B.join(","),C=Z.join(","),V=`${m}${v}${C}`}if(A=this.#d.get(V),A)return this.#d.set(G,A),A;const W=`g_${this.#n}_transfer_map_${this.#f++}`,K=`url(#${W})`;this.#d.set(G,K),this.#d.set(V,K);const L=this.#v(W);return this.#g(m,v,C,L),K}addHCMFilter(G,A){const m=`${G}-${A}`;if(this.#s===m)return this.#a;if(this.#s=m,this.#a="none",this.#o?.remove(),!G||!A)return this.#a;const v=this.#u(G);G=e.Util.makeHexColor(...v);const C=this.#u(A);if(A=e.Util.makeHexColor(...C),this.#h.style.color="",G==="#000000"&&A==="#ffffff"||G===A)return this.#a;const V=new Array(256);for(let S=0;S<=255;S++){const R=S/255;V[S]=R<=.03928?R/12.92:((R+.055)/1.055)**2.4}const W=V.join(","),K=`g_${this.#n}_hcm_filter`,L=this.#l=this.#v(K);this.#g(W,W,W,L),this.#p(L);const l=(S,R)=>{const O=v[S]/255,B=C[S]/255,Z=new Array(R+1);for(let re=0;re<=R;re++)Z[re]=O+re/R*(B-O);return Z.join(",")};return this.#g(l(0,5),l(1,5),l(2,5),L),this.#a=`url(#${K})`,this.#a}addHighlightHCMFilter(G,A,m,v){const C=`${G}-${A}-${m}-${v}`;if(this.#c===C)return this.#i;if(this.#c=C,this.#i="none",this.#l?.remove(),!G||!A)return this.#i;const[V,W]=[G,A].map(this.#u.bind(this));let K=Math.round(.2126*V[0]+.7152*V[1]+.0722*V[2]),L=Math.round(.2126*W[0]+.7152*W[1]+.0722*W[2]),[l,S]=[m,v].map(this.#u.bind(this));L<K&&([K,L,l,S]=[L,K,S,l]),this.#h.style.color="";const R=(Z,re,me)=>{const We=new Array(256),ve=(L-K)/me,ye=Z/255,Ce=(re-Z)/(255*me);let Re=0;for(let xe=0;xe<=me;xe++){const qe=Math.round(K+xe*ve),tt=ye+xe*Ce;for(let lt=Re;lt<=qe;lt++)We[lt]=tt;Re=qe+1}for(let xe=Re;xe<256;xe++)We[xe]=We[Re-1];return We.join(",")},O=`g_${this.#n}_hcm_highlight_filter`,B=this.#l=this.#v(O);return this.#p(B),this.#g(R(l[0],S[0],5),R(l[1],S[1],5),R(l[2],S[2],5),B),this.#i=`url(#${O})`,this.#i}destroy(G=!1){G&&(this.#a||this.#i)||(this.#t&&(this.#t.parentNode.parentNode.remove(),this.#t=null),this.#e&&(this.#e.clear(),this.#e=null),this.#f=0)}#p(G){const A=this.#r.createElementNS(s,"feColorMatrix");A.setAttribute("type","matrix"),A.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"),G.append(A)}#v(G){const A=this.#r.createElementNS(s,"filter");return A.setAttribute("color-interpolation-filters","sRGB"),A.setAttribute("id",G),this.#h.append(A),A}#m(G,A,m){const v=this.#r.createElementNS(s,A);v.setAttribute("type","discrete"),v.setAttribute("tableValues",m),G.append(v)}#g(G,A,m,v){const C=this.#r.createElementNS(s,"feComponentTransfer");v.append(C),this.#m(C,"feFuncR",G),this.#m(C,"feFuncG",A),this.#m(C,"feFuncB",m)}#u(G){return this.#h.style.color=G,ge(getComputedStyle(this.#h).getPropertyValue("color"))}}c.DOMFilterFactory=ee;class U extends p.BaseCanvasFactory{constructor({ownerDocument:G=globalThis.document}={}){super(),this._document=G}_createCanvas(G,A){const m=this._document.createElement("canvas");return m.width=G,m.height=A,m}}c.DOMCanvasFactory=U;async function o(Ee,G=!1){if(I(Ee,document.baseURI)){const A=await fetch(Ee);if(!A.ok)throw new Error(A.statusText);return G?new Uint8Array(await A.arrayBuffer()):(0,e.stringToBytes)(await A.text())}return new Promise((A,m)=>{const v=new XMLHttpRequest;v.open("GET",Ee,!0),G&&(v.responseType="arraybuffer"),v.onreadystatechange=()=>{if(v.readyState===XMLHttpRequest.DONE){if(v.status===200||v.status===0){let C;if(G&&v.response?C=new Uint8Array(v.response):!G&&v.responseText&&(C=(0,e.stringToBytes)(v.responseText)),C){A(C);return}}m(new Error(v.statusText))}},v.send(null)})}class t extends p.BaseCMapReaderFactory{_fetchData(G,A){return o(G,this.isCompressed).then(m=>({cMapData:m,compressionType:A}))}}c.DOMCMapReaderFactory=t;class a extends p.BaseStandardFontDataFactory{_fetchData(G){return o(G,!0)}}c.DOMStandardFontDataFactory=a;class g extends p.BaseSVGFactory{_createSVG(G){return document.createElementNS(s,G)}}c.DOMSVGFactory=g;class d{constructor({viewBox:G,scale:A,rotation:m,offsetX:v=0,offsetY:C=0,dontFlip:V=!1}){this.viewBox=G,this.scale=A,this.rotation=m,this.offsetX=v,this.offsetY=C;const W=(G[2]+G[0])/2,K=(G[3]+G[1])/2;let L,l,S,R;switch(m%=360,m<0&&(m+=360),m){case 180:L=-1,l=0,S=0,R=1;break;case 90:L=0,l=1,S=1,R=0;break;case 270:L=0,l=-1,S=-1,R=0;break;case 0:L=1,l=0,S=0,R=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}V&&(S=-S,R=-R);let O,B,Z,re;L===0?(O=Math.abs(K-G[1])*A+v,B=Math.abs(W-G[0])*A+C,Z=(G[3]-G[1])*A,re=(G[2]-G[0])*A):(O=Math.abs(W-G[0])*A+v,B=Math.abs(K-G[1])*A+C,Z=(G[2]-G[0])*A,re=(G[3]-G[1])*A),this.transform=[L*A,l*A,S*A,R*A,O-L*A*W-S*A*K,B-l*A*W-R*A*K],this.width=Z,this.height=re}get rawDims(){const{viewBox:G}=this;return(0,e.shadow)(this,"rawDims",{pageWidth:G[2]-G[0],pageHeight:G[3]-G[1],pageX:G[0],pageY:G[1]})}clone({scale:G=this.scale,rotation:A=this.rotation,offsetX:m=this.offsetX,offsetY:v=this.offsetY,dontFlip:C=!1}={}){return new d({viewBox:this.viewBox.slice(),scale:G,rotation:A,offsetX:m,offsetY:v,dontFlip:C})}convertToViewportPoint(G,A){return e.Util.applyTransform([G,A],this.transform)}convertToViewportRectangle(G){const A=e.Util.applyTransform([G[0],G[1]],this.transform),m=e.Util.applyTransform([G[2],G[3]],this.transform);return[A[0],A[1],m[0],m[1]]}convertToPdfPoint(G,A){return e.Util.applyInverseTransform([G,A],this.transform)}}c.PageViewport=d;class i extends e.BaseException{constructor(G,A=0){super(G,"RenderingCancelledException"),this.extraDelay=A}}c.RenderingCancelledException=i;function b(Ee){const G=Ee.length;let A=0;for(;A<G&&Ee[A].trim()==="";)A++;return Ee.substring(A,A+5).toLowerCase()==="data:"}function y(Ee){return typeof Ee=="string"&&/\.pdf$/i.test(Ee)}function f(Ee,G=!1){return G||([Ee]=Ee.split(/[#?]/,1)),Ee.substring(Ee.lastIndexOf("/")+1)}function T(Ee,G="document.pdf"){if(typeof Ee!="string")return G;if(b(Ee))return(0,e.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),G;const A=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,m=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,v=A.exec(Ee);let C=m.exec(v[1])||m.exec(v[2])||m.exec(v[3]);if(C&&(C=C[0],C.includes("%")))try{C=m.exec(decodeURIComponent(C))[0]}catch{}return C||G}class H{started=Object.create(null);times=[];time(G){G in this.started&&(0,e.warn)(`Timer is already running for ${G}`),this.started[G]=Date.now()}timeEnd(G){G in this.started||(0,e.warn)(`Timer has not been started for ${G}`),this.times.push({name:G,start:this.started[G],end:Date.now()}),delete this.started[G]}toString(){const G=[];let A=0;for(const{name:m}of this.times)A=Math.max(m.length,A);for(const{name:m,start:v,end:C}of this.times)G.push(`${m.padEnd(A)} ${C-v}ms
|
|
1
|
+
"use strict";const require$$1=require("react"),index=require("./index-OaLaderQ.cjs");var lib={exports:{}},core_min={};function commonjsRequire(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var pdf={exports:{}},hasRequiredPdf;function requirePdf(){return hasRequiredPdf||(hasRequiredPdf=1,(function(module,exports){(function(c,q){module.exports=c.pdfjsLib=q()})(globalThis,()=>(()=>{var __webpack_modules__=[,((r,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.VerbosityLevel=c.Util=c.UnknownErrorException=c.UnexpectedResponseException=c.TextRenderingMode=c.RenderingIntentFlag=c.PromiseCapability=c.PermissionFlag=c.PasswordResponses=c.PasswordException=c.PageActionEventType=c.OPS=c.MissingPDFException=c.MAX_IMAGE_SIZE_TO_CACHE=c.LINE_FACTOR=c.LINE_DESCENT_FACTOR=c.InvalidPDFException=c.ImageKind=c.IDENTITY_MATRIX=c.FormatError=c.FeatureTest=c.FONT_IDENTITY_MATRIX=c.DocumentActionEventType=c.CMapCompressionType=c.BaseException=c.BASELINE_FACTOR=c.AnnotationType=c.AnnotationReplyType=c.AnnotationPrefix=c.AnnotationMode=c.AnnotationFlag=c.AnnotationFieldFlag=c.AnnotationEditorType=c.AnnotationEditorPrefix=c.AnnotationEditorParamsType=c.AnnotationBorderStyleType=c.AnnotationActionEventType=c.AbortException=void 0,c.assert=m,c.bytesToString=Z,c.createValidAbsoluteUrl=C,c.getModificationDate=hn,c.getUuid=lr,c.getVerbosityLevel=Ve,c.info=Ee,c.isArrayBuffer=Ft,c.isArrayEqual=vn,c.isNodeJS=void 0,c.normalizeUnicode=Kn,c.objectFromMap=ve,c.objectSize=We,c.setVerbosityLevel=Oe,c.shadow=V,c.string32=me,c.stringToBytes=re,c.stringToPDFString=lt,c.stringToUTF8String=vt,c.unreachable=A,c.utf8StringToString=bt,c.warn=G;const q=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser");c.isNodeJS=q;const p=[1,0,0,1,0,0];c.IDENTITY_MATRIX=p;const e=[.001,0,0,.001,0,0];c.FONT_IDENTITY_MATRIX=e;const s=1e7;c.MAX_IMAGE_SIZE_TO_CACHE=s;const N=1.35;c.LINE_FACTOR=N;const ee=.35;c.LINE_DESCENT_FACTOR=ee;const U=ee/N;c.BASELINE_FACTOR=U;const o={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};c.RenderingIntentFlag=o;const t={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};c.AnnotationMode=t;const a="pdfjs_internal_editor_";c.AnnotationEditorPrefix=a;const g={DISABLE:-1,NONE:0,FREETEXT:3,STAMP:13,INK:15};c.AnnotationEditorType=g;const d={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23};c.AnnotationEditorParamsType=d;const i={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};c.PermissionFlag=i;const b={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};c.TextRenderingMode=b;const y={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};c.ImageKind=y;const f={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};c.AnnotationType=f;const T={GROUP:"Group",REPLY:"R"};c.AnnotationReplyType=T;const H={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};c.AnnotationFlag=H;const I={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};c.AnnotationFieldFlag=I;const _={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};c.AnnotationBorderStyleType=_;const M={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"};c.AnnotationActionEventType=M;const te={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};c.DocumentActionEventType=te;const ie={O:"PageOpen",C:"PageClose"};c.PageActionEventType=ie;const Y={ERRORS:0,WARNINGS:1,INFOS:5};c.VerbosityLevel=Y;const he={NONE:0,BINARY:1};c.CMapCompressionType=he;const ge={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};c.OPS=ge;const Ne={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};c.PasswordResponses=Ne;let ke=Y.WARNINGS;function Oe(De){Number.isInteger(De)&&(ke=De)}function Ve(){return ke}function Ee(De){ke>=Y.INFOS&&console.log(`Info: ${De}`)}function G(De){ke>=Y.WARNINGS&&console.log(`Warning: ${De}`)}function A(De){throw new Error(De)}function m(De,fe){De||A(fe)}function v(De){switch(De?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function C(De,fe=null,ue=null){if(!De)return null;try{if(ue&&typeof De=="string"&&(ue.addDefaultProtocol&&De.startsWith("www.")&&De.match(/\./g)?.length>=2&&(De=`http://${De}`),ue.tryConvertEncoding))try{De=vt(De)}catch{}const He=fe?new URL(De,fe):new URL(De);if(v(He))return He}catch{}return null}function V(De,fe,ue,He=!1){return Object.defineProperty(De,fe,{value:ue,enumerable:!He,configurable:!0,writable:!1}),ue}const W=(function(){function fe(ue,He){this.constructor===fe&&A("Cannot initialize BaseException."),this.message=ue,this.name=He}return fe.prototype=new Error,fe.constructor=fe,fe})();c.BaseException=W;class K extends W{constructor(fe,ue){super(fe,"PasswordException"),this.code=ue}}c.PasswordException=K;class L extends W{constructor(fe,ue){super(fe,"UnknownErrorException"),this.details=ue}}c.UnknownErrorException=L;class l extends W{constructor(fe){super(fe,"InvalidPDFException")}}c.InvalidPDFException=l;class S extends W{constructor(fe){super(fe,"MissingPDFException")}}c.MissingPDFException=S;class R extends W{constructor(fe,ue){super(fe,"UnexpectedResponseException"),this.status=ue}}c.UnexpectedResponseException=R;class O extends W{constructor(fe){super(fe,"FormatError")}}c.FormatError=O;class B extends W{constructor(fe){super(fe,"AbortException")}}c.AbortException=B;function Z(De){(typeof De!="object"||De?.length===void 0)&&A("Invalid argument for bytesToString");const fe=De.length,ue=8192;if(fe<ue)return String.fromCharCode.apply(null,De);const He=[];for(let Dt=0;Dt<fe;Dt+=ue){const pt=Math.min(Dt+ue,fe),kt=De.subarray(Dt,pt);He.push(String.fromCharCode.apply(null,kt))}return He.join("")}function re(De){typeof De!="string"&&A("Invalid argument for stringToBytes");const fe=De.length,ue=new Uint8Array(fe);for(let He=0;He<fe;++He)ue[He]=De.charCodeAt(He)&255;return ue}function me(De){return String.fromCharCode(De>>24&255,De>>16&255,De>>8&255,De&255)}function We(De){return Object.keys(De).length}function ve(De){const fe=Object.create(null);for(const[ue,He]of De)fe[ue]=He;return fe}function ye(){const De=new Uint8Array(4);return De[0]=1,new Uint32Array(De.buffer,0,1)[0]===1}function Ce(){try{return new Function(""),!0}catch{return!1}}class Re{static get isLittleEndian(){return V(this,"isLittleEndian",ye())}static get isEvalSupported(){return V(this,"isEvalSupported",Ce())}static get isOffscreenCanvasSupported(){return V(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator>"u"?V(this,"platform",{isWin:!1,isMac:!1}):V(this,"platform",{isWin:navigator.platform.includes("Win"),isMac:navigator.platform.includes("Mac")})}static get isCSSRoundSupported(){return V(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}c.FeatureTest=Re;const xe=[...Array(256).keys()].map(De=>De.toString(16).padStart(2,"0"));class qe{static makeHexColor(fe,ue,He){return`#${xe[fe]}${xe[ue]}${xe[He]}`}static scaleMinMax(fe,ue){let He;fe[0]?(fe[0]<0&&(He=ue[0],ue[0]=ue[1],ue[1]=He),ue[0]*=fe[0],ue[1]*=fe[0],fe[3]<0&&(He=ue[2],ue[2]=ue[3],ue[3]=He),ue[2]*=fe[3],ue[3]*=fe[3]):(He=ue[0],ue[0]=ue[2],ue[2]=He,He=ue[1],ue[1]=ue[3],ue[3]=He,fe[1]<0&&(He=ue[2],ue[2]=ue[3],ue[3]=He),ue[2]*=fe[1],ue[3]*=fe[1],fe[2]<0&&(He=ue[0],ue[0]=ue[1],ue[1]=He),ue[0]*=fe[2],ue[1]*=fe[2]),ue[0]+=fe[4],ue[1]+=fe[4],ue[2]+=fe[5],ue[3]+=fe[5]}static transform(fe,ue){return[fe[0]*ue[0]+fe[2]*ue[1],fe[1]*ue[0]+fe[3]*ue[1],fe[0]*ue[2]+fe[2]*ue[3],fe[1]*ue[2]+fe[3]*ue[3],fe[0]*ue[4]+fe[2]*ue[5]+fe[4],fe[1]*ue[4]+fe[3]*ue[5]+fe[5]]}static applyTransform(fe,ue){const He=fe[0]*ue[0]+fe[1]*ue[2]+ue[4],Dt=fe[0]*ue[1]+fe[1]*ue[3]+ue[5];return[He,Dt]}static applyInverseTransform(fe,ue){const He=ue[0]*ue[3]-ue[1]*ue[2],Dt=(fe[0]*ue[3]-fe[1]*ue[2]+ue[2]*ue[5]-ue[4]*ue[3])/He,pt=(-fe[0]*ue[1]+fe[1]*ue[0]+ue[4]*ue[1]-ue[5]*ue[0])/He;return[Dt,pt]}static getAxialAlignedBoundingBox(fe,ue){const He=this.applyTransform(fe,ue),Dt=this.applyTransform(fe.slice(2,4),ue),pt=this.applyTransform([fe[0],fe[3]],ue),kt=this.applyTransform([fe[2],fe[1]],ue);return[Math.min(He[0],Dt[0],pt[0],kt[0]),Math.min(He[1],Dt[1],pt[1],kt[1]),Math.max(He[0],Dt[0],pt[0],kt[0]),Math.max(He[1],Dt[1],pt[1],kt[1])]}static inverseTransform(fe){const ue=fe[0]*fe[3]-fe[1]*fe[2];return[fe[3]/ue,-fe[1]/ue,-fe[2]/ue,fe[0]/ue,(fe[2]*fe[5]-fe[4]*fe[3])/ue,(fe[4]*fe[1]-fe[5]*fe[0])/ue]}static singularValueDecompose2dScale(fe){const ue=[fe[0],fe[2],fe[1],fe[3]],He=fe[0]*ue[0]+fe[1]*ue[2],Dt=fe[0]*ue[1]+fe[1]*ue[3],pt=fe[2]*ue[0]+fe[3]*ue[2],kt=fe[2]*ue[1]+fe[3]*ue[3],Jn=(He+kt)/2,Bn=Math.sqrt((He+kt)**2-4*(He*kt-pt*Dt))/2,Hn=Jn+Bn||1,yn=Jn-Bn||1;return[Math.sqrt(Hn),Math.sqrt(yn)]}static normalizeRect(fe){const ue=fe.slice(0);return fe[0]>fe[2]&&(ue[0]=fe[2],ue[2]=fe[0]),fe[1]>fe[3]&&(ue[1]=fe[3],ue[3]=fe[1]),ue}static intersect(fe,ue){const He=Math.max(Math.min(fe[0],fe[2]),Math.min(ue[0],ue[2])),Dt=Math.min(Math.max(fe[0],fe[2]),Math.max(ue[0],ue[2]));if(He>Dt)return null;const pt=Math.max(Math.min(fe[1],fe[3]),Math.min(ue[1],ue[3])),kt=Math.min(Math.max(fe[1],fe[3]),Math.max(ue[1],ue[3]));return pt>kt?null:[He,pt,Dt,kt]}static bezierBoundingBox(fe,ue,He,Dt,pt,kt,Jn,Bn){const Hn=[],yn=[[],[]];let Un,mn,nr,Xt,rr,an,ln,ir;for(let cr=0;cr<2;++cr){if(cr===0?(mn=6*fe-12*He+6*pt,Un=-3*fe+9*He-9*pt+3*Jn,nr=3*He-3*fe):(mn=6*ue-12*Dt+6*kt,Un=-3*ue+9*Dt-9*kt+3*Bn,nr=3*Dt-3*ue),Math.abs(Un)<1e-12){if(Math.abs(mn)<1e-12)continue;Xt=-nr/mn,0<Xt&&Xt<1&&Hn.push(Xt);continue}ln=mn*mn-4*nr*Un,ir=Math.sqrt(ln),!(ln<0)&&(rr=(-mn+ir)/(2*Un),0<rr&&rr<1&&Hn.push(rr),an=(-mn-ir)/(2*Un),0<an&&an<1&&Hn.push(an))}let An=Hn.length,Pn;const tn=An;for(;An--;)Xt=Hn[An],Pn=1-Xt,yn[0][An]=Pn*Pn*Pn*fe+3*Pn*Pn*Xt*He+3*Pn*Xt*Xt*pt+Xt*Xt*Xt*Jn,yn[1][An]=Pn*Pn*Pn*ue+3*Pn*Pn*Xt*Dt+3*Pn*Xt*Xt*kt+Xt*Xt*Xt*Bn;return yn[0][tn]=fe,yn[1][tn]=ue,yn[0][tn+1]=Jn,yn[1][tn+1]=Bn,yn[0].length=yn[1].length=tn+2,[Math.min(...yn[0]),Math.min(...yn[1]),Math.max(...yn[0]),Math.max(...yn[1])]}}c.Util=qe;const tt=[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 lt(De){if(De[0]>="ï"){let ue;if(De[0]==="þ"&&De[1]==="ÿ"?ue="utf-16be":De[0]==="ÿ"&&De[1]==="þ"?ue="utf-16le":De[0]==="ï"&&De[1]==="»"&&De[2]==="¿"&&(ue="utf-8"),ue)try{const He=new TextDecoder(ue,{fatal:!0}),Dt=re(De);return He.decode(Dt)}catch(He){G(`stringToPDFString: "${He}".`)}}const fe=[];for(let ue=0,He=De.length;ue<He;ue++){const Dt=tt[De.charCodeAt(ue)];fe.push(Dt?String.fromCharCode(Dt):De.charAt(ue))}return fe.join("")}function vt(De){return decodeURIComponent(escape(De))}function bt(De){return unescape(encodeURIComponent(De))}function Ft(De){return typeof De=="object"&&De?.byteLength!==void 0}function vn(De,fe){if(De.length!==fe.length)return!1;for(let ue=0,He=De.length;ue<He;ue++)if(De[ue]!==fe[ue])return!1;return!0}function hn(De=new Date){return[De.getUTCFullYear().toString(),(De.getUTCMonth()+1).toString().padStart(2,"0"),De.getUTCDate().toString().padStart(2,"0"),De.getUTCHours().toString().padStart(2,"0"),De.getUTCMinutes().toString().padStart(2,"0"),De.getUTCSeconds().toString().padStart(2,"0")].join("")}class jn{#e=!1;constructor(){this.promise=new Promise((fe,ue)=>{this.resolve=He=>{this.#e=!0,fe(He)},this.reject=He=>{this.#e=!0,ue(He)}})}get settled(){return this.#e}}c.PromiseCapability=jn;let gn=null,Fn=null;function Kn(De){return gn||(gn=/([\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,Fn=new Map([["ſt","ſt"]])),De.replaceAll(gn,(fe,ue,He)=>ue?ue.normalize("NFKC"):Fn.get(He))}function lr(){if(typeof crypto<"u"&&typeof crypto?.randomUUID=="function")return crypto.randomUUID();const De=new Uint8Array(32);if(typeof crypto<"u"&&typeof crypto?.getRandomValues=="function")crypto.getRandomValues(De);else for(let fe=0;fe<32;fe++)De[fe]=Math.floor(Math.random()*255);return Z(De)}const _n="pdfjs_internal_id_";c.AnnotationPrefix=_n}),((__unused_webpack_module,exports,__w_pdfjs_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.RenderTask=exports.PDFWorkerUtil=exports.PDFWorker=exports.PDFPageProxy=exports.PDFDocumentProxy=exports.PDFDocumentLoadingTask=exports.PDFDataRangeTransport=exports.LoopbackPort=exports.DefaultStandardFontDataFactory=exports.DefaultFilterFactory=exports.DefaultCanvasFactory=exports.DefaultCMapReaderFactory=void 0,Object.defineProperty(exports,"SVGGraphics",{enumerable:!0,get:function(){return _displaySvg.SVGGraphics}}),exports.build=void 0,exports.getDocument=getDocument,exports.version=void 0;var _util=__w_pdfjs_require__(1),_annotation_storage=__w_pdfjs_require__(3),_display_utils=__w_pdfjs_require__(6),_font_loader=__w_pdfjs_require__(9),_displayNode_utils=__w_pdfjs_require__(10),_canvas=__w_pdfjs_require__(11),_worker_options=__w_pdfjs_require__(14),_message_handler=__w_pdfjs_require__(15),_metadata=__w_pdfjs_require__(16),_optional_content_config=__w_pdfjs_require__(17),_transport_stream=__w_pdfjs_require__(18),_displayFetch_stream=__w_pdfjs_require__(19),_displayNetwork=__w_pdfjs_require__(22),_displayNode_stream=__w_pdfjs_require__(23),_displaySvg=__w_pdfjs_require__(24),_xfa_text=__w_pdfjs_require__(25);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100,DELAYED_CLEANUP_TIMEOUT=5e3,DefaultCanvasFactory=_util.isNodeJS?_displayNode_utils.NodeCanvasFactory:_display_utils.DOMCanvasFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory;const DefaultCMapReaderFactory=_util.isNodeJS?_displayNode_utils.NodeCMapReaderFactory:_display_utils.DOMCMapReaderFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory;const DefaultFilterFactory=_util.isNodeJS?_displayNode_utils.NodeFilterFactory:_display_utils.DOMFilterFactory;exports.DefaultFilterFactory=DefaultFilterFactory;const DefaultStandardFontDataFactory=_util.isNodeJS?_displayNode_utils.NodeStandardFontDataFactory:_display_utils.DOMStandardFontDataFactory;exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory;function getDocument(r){if(typeof r=="string"||r instanceof URL?r={url:r}:(0,_util.isArrayBuffer)(r)&&(r={data:r}),typeof r!="object")throw new Error("Invalid parameter in getDocument, need parameter object.");if(!r.url&&!r.data&&!r.range)throw new Error("Invalid parameter object: need either .data, .range or .url");const c=new PDFDocumentLoadingTask,{docId:q}=c,p=r.url?getUrlProp(r.url):null,e=r.data?getDataProp(r.data):null,s=r.httpHeaders||null,N=r.withCredentials===!0,ee=r.password??null,U=r.range instanceof PDFDataRangeTransport?r.range:null,o=Number.isInteger(r.rangeChunkSize)&&r.rangeChunkSize>0?r.rangeChunkSize:DEFAULT_RANGE_CHUNK_SIZE;let t=r.worker instanceof PDFWorker?r.worker:null;const a=r.verbosity,g=typeof r.docBaseUrl=="string"&&!(0,_display_utils.isDataScheme)(r.docBaseUrl)?r.docBaseUrl:null,d=typeof r.cMapUrl=="string"?r.cMapUrl:null,i=r.cMapPacked!==!1,b=r.CMapReaderFactory||DefaultCMapReaderFactory,y=typeof r.standardFontDataUrl=="string"?r.standardFontDataUrl:null,f=r.StandardFontDataFactory||DefaultStandardFontDataFactory,T=r.stopAtErrors!==!0,H=Number.isInteger(r.maxImageSize)&&r.maxImageSize>-1?r.maxImageSize:-1,I=r.isEvalSupported!==!1,_=typeof r.isOffscreenCanvasSupported=="boolean"?r.isOffscreenCanvasSupported:!_util.isNodeJS,M=Number.isInteger(r.canvasMaxAreaInBytes)?r.canvasMaxAreaInBytes:-1,te=typeof r.disableFontFace=="boolean"?r.disableFontFace:_util.isNodeJS,ie=r.fontExtraProperties===!0,Y=r.enableXfa===!0,he=r.ownerDocument||globalThis.document,ge=r.disableRange===!0,Ne=r.disableStream===!0,ke=r.disableAutoFetch===!0,Oe=r.pdfBug===!0,Ve=U?U.length:r.length??NaN,Ee=typeof r.useSystemFonts=="boolean"?r.useSystemFonts:!_util.isNodeJS&&!te,G=typeof r.useWorkerFetch=="boolean"?r.useWorkerFetch:b===_display_utils.DOMCMapReaderFactory&&f===_display_utils.DOMStandardFontDataFactory&&d&&y&&(0,_display_utils.isValidFetchUrl)(d,document.baseURI)&&(0,_display_utils.isValidFetchUrl)(y,document.baseURI),A=r.canvasFactory||new DefaultCanvasFactory({ownerDocument:he}),m=r.filterFactory||new DefaultFilterFactory({docId:q,ownerDocument:he}),v=null;(0,_util.setVerbosityLevel)(a);const C={canvasFactory:A,filterFactory:m};if(G||(C.cMapReaderFactory=new b({baseUrl:d,isCompressed:i}),C.standardFontDataFactory=new f({baseUrl:y})),!t){const K={verbosity:a,port:_worker_options.GlobalWorkerOptions.workerPort};t=K.port?PDFWorker.fromPort(K):new PDFWorker(K),c._worker=t}const V={docId:q,apiVersion:"3.11.174",data:e,password:ee,disableAutoFetch:ke,rangeChunkSize:o,length:Ve,docBaseUrl:g,enableXfa:Y,evaluatorOptions:{maxImageSize:H,disableFontFace:te,ignoreErrors:T,isEvalSupported:I,isOffscreenCanvasSupported:_,canvasMaxAreaInBytes:M,fontExtraProperties:ie,useSystemFonts:Ee,cMapUrl:G?d:null,standardFontDataUrl:G?y:null}},W={ignoreErrors:T,isEvalSupported:I,disableFontFace:te,fontExtraProperties:ie,enableXfa:Y,ownerDocument:he,disableAutoFetch:ke,pdfBug:Oe,styleElement:v};return t.promise.then(function(){if(c.destroyed)throw new Error("Loading aborted");const K=_fetchDocument(t,V),L=new Promise(function(l){let S;U?S=new _transport_stream.PDFDataTransportStream({length:Ve,initialData:U.initialData,progressiveDone:U.progressiveDone,contentDispositionFilename:U.contentDispositionFilename,disableRange:ge,disableStream:Ne},U):e||(S=(O=>_util.isNodeJS?new _displayNode_stream.PDFNodeStream(O):(0,_display_utils.isValidFetchUrl)(O.url)?new _displayFetch_stream.PDFFetchStream(O):new _displayNetwork.PDFNetworkStream(O))({url:p,length:Ve,httpHeaders:s,withCredentials:N,rangeChunkSize:o,disableRange:ge,disableStream:Ne})),l(S)});return Promise.all([K,L]).then(function([l,S]){if(c.destroyed)throw new Error("Loading aborted");const R=new _message_handler.MessageHandler(q,l,t.port),O=new WorkerTransport(R,c,S,W,C);c._transport=O,R.send("Ready",null)})}).catch(c._capability.reject),c}async function _fetchDocument(r,c){if(r.destroyed)throw new Error("Worker was destroyed");const q=await r.messageHandler.sendWithPromise("GetDocRequest",c,c.data?[c.data.buffer]:null);if(r.destroyed)throw new Error("Worker was destroyed");return q}function getUrlProp(r){if(r instanceof URL)return r.href;try{return new URL(r,window.location).href}catch{if(_util.isNodeJS&&typeof r=="string")return r}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function getDataProp(r){if(_util.isNodeJS&&typeof Buffer<"u"&&r instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(r instanceof Uint8Array&&r.byteLength===r.buffer.byteLength)return r;if(typeof r=="string")return(0,_util.stringToBytes)(r);if(typeof r=="object"&&!isNaN(r?.length)||(0,_util.isArrayBuffer)(r))return new Uint8Array(r);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}class PDFDocumentLoadingTask{static#e=0;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(c){throw this._worker?.port&&delete this._worker._pendingDestroy,c}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}exports.PDFDocumentLoadingTask=PDFDocumentLoadingTask;class PDFDataRangeTransport{constructor(c,q,p=!1,e=null){this.length=c,this.initialData=q,this.progressiveDone=p,this.contentDispositionFilename=e,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=new _util.PromiseCapability}addRangeListener(c){this._rangeListeners.push(c)}addProgressListener(c){this._progressListeners.push(c)}addProgressiveReadListener(c){this._progressiveReadListeners.push(c)}addProgressiveDoneListener(c){this._progressiveDoneListeners.push(c)}onDataRange(c,q){for(const p of this._rangeListeners)p(c,q)}onDataProgress(c,q){this._readyCapability.promise.then(()=>{for(const p of this._progressListeners)p(c,q)})}onDataProgressiveRead(c){this._readyCapability.promise.then(()=>{for(const q of this._progressiveReadListeners)q(c)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const c of this._progressiveDoneListeners)c()})}transportReady(){this._readyCapability.resolve()}requestDataRange(c,q){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}exports.PDFDataRangeTransport=PDFDataRangeTransport;class PDFDocumentProxy{constructor(c,q){this._pdfInfo=c,this._transport=q,Object.defineProperty(this,"getJavaScript",{value:()=>((0,_display_utils.deprecated)("`PDFDocumentProxy.getJavaScript`, please use `PDFDocumentProxy.getJSActions` instead."),this.getJSActions().then(p=>{if(!p)return p;const e=[];for(const s in p)e.push(...p[s]);return e}))})}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(c){return this._transport.getPage(c)}getPageIndex(c){return this._transport.getPageIndex(c)}getDestinations(){return this._transport.getDestinations()}getDestination(c){return this._transport.getDestination(c)}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(c=!1){return this._transport.startCleanup(c||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}exports.PDFDocumentProxy=PDFDocumentProxy;class PDFPageProxy{#e=null;#t=!1;constructor(c,q,p,e=!1){this._pageIndex=c,this._pageInfo=q,this._transport=p,this._stats=e?new _display_utils.StatTimer:null,this._pdfBug=e,this.commonObjs=p.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:c,rotation:q=this.rotate,offsetX:p=0,offsetY:e=0,dontFlip:s=!1}={}){return new _display_utils.PageViewport({viewBox:this.view,scale:c,rotation:q,offsetX:p,offsetY:e,dontFlip:s})}getAnnotations({intent:c="display"}={}){const q=this._transport.getRenderingIntent(c);return this._transport.getAnnotations(this._pageIndex,q.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:c,viewport:q,intent:p="display",annotationMode:e=_util.AnnotationMode.ENABLE,transform:s=null,background:N=null,optionalContentConfigPromise:ee=null,annotationCanvasMap:U=null,pageColors:o=null,printAnnotationStorage:t=null}){this._stats?.time("Overall");const a=this._transport.getRenderingIntent(p,e,t);this.#t=!1,this.#r(),ee||(ee=this._transport.getOptionalContentConfig());let g=this._intentStates.get(a.cacheKey);g||(g=Object.create(null),this._intentStates.set(a.cacheKey,g)),g.streamReaderCancelTimeout&&(clearTimeout(g.streamReaderCancelTimeout),g.streamReaderCancelTimeout=null);const d=!!(a.renderingIntent&_util.RenderingIntentFlag.PRINT);g.displayReadyCapability||(g.displayReadyCapability=new _util.PromiseCapability,g.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(a));const i=f=>{g.renderTasks.delete(b),(this._maybeCleanupAfterRender||d)&&(this.#t=!0),this.#n(!d),f?(b.capability.reject(f),this._abortOperatorList({intentState:g,reason:f instanceof Error?f:new Error(f)})):b.capability.resolve(),this._stats?.timeEnd("Rendering"),this._stats?.timeEnd("Overall")},b=new InternalRenderTask({callback:i,params:{canvasContext:c,viewport:q,transform:s,background:N},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:U,operatorList:g.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!d,pdfBug:this._pdfBug,pageColors:o});(g.renderTasks||=new Set).add(b);const y=b.task;return Promise.all([g.displayReadyCapability.promise,ee]).then(([f,T])=>{if(this.destroyed){i();return}this._stats?.time("Rendering"),b.initializeGraphics({transparency:f,optionalContentConfig:T}),b.operatorListChanged()}).catch(i),y}getOperatorList({intent:c="display",annotationMode:q=_util.AnnotationMode.ENABLE,printAnnotationStorage:p=null}={}){function e(){N.operatorList.lastChunk&&(N.opListReadCapability.resolve(N.operatorList),N.renderTasks.delete(ee))}const s=this._transport.getRenderingIntent(c,q,p,!0);let N=this._intentStates.get(s.cacheKey);N||(N=Object.create(null),this._intentStates.set(s.cacheKey,N));let ee;return N.opListReadCapability||(ee=Object.create(null),ee.operatorListChanged=e,N.opListReadCapability=new _util.PromiseCapability,(N.renderTasks||=new Set).add(ee),N.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(s)),N.opListReadCapability.promise}streamTextContent({includeMarkedContent:c=!1,disableNormalization:q=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:c===!0,disableNormalization:q===!0},{highWaterMark:100,size(e){return e.items.length}})}getTextContent(c={}){if(this._transport._htmlForXfa)return this.getXfa().then(p=>_xfa_text.XfaText.textContent(p));const q=this.streamTextContent(c);return new Promise(function(p,e){function s(){N.read().then(function({value:U,done:o}){if(o){p(ee);return}Object.assign(ee.styles,U.styles),ee.items.push(...U.items),s()},e)}const N=q.getReader(),ee={items:[],styles:Object.create(null)};s()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const c=[];for(const q of this._intentStates.values())if(this._abortOperatorList({intentState:q,reason:new Error("Page was destroyed."),force:!0}),!q.opListReadCapability)for(const p of q.renderTasks)c.push(p.completed),p.cancel();return this.objs.clear(),this.#t=!1,this.#r(),Promise.all(c)}cleanup(c=!1){this.#t=!0;const q=this.#n(!1);return c&&q&&(this._stats&&=new _display_utils.StatTimer),q}#n(c=!1){if(this.#r(),!this.#t||this.destroyed)return!1;if(c)return this.#e=setTimeout(()=>{this.#e=null,this.#n(!1)},DELAYED_CLEANUP_TIMEOUT),!1;for(const{renderTasks:q,operatorList:p}of this._intentStates.values())if(q.size>0||!p.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#t=!1,!0}#r(){this.#e&&(clearTimeout(this.#e),this.#e=null)}_startRenderPage(c,q){const p=this._intentStates.get(q);p&&(this._stats?.timeEnd("Page Request"),p.displayReadyCapability?.resolve(c))}_renderPageChunk(c,q){for(let p=0,e=c.length;p<e;p++)q.operatorList.fnArray.push(c.fnArray[p]),q.operatorList.argsArray.push(c.argsArray[p]);q.operatorList.lastChunk=c.lastChunk,q.operatorList.separateAnnots=c.separateAnnots;for(const p of q.renderTasks)p.operatorListChanged();c.lastChunk&&this.#n(!0)}_pumpOperatorList({renderingIntent:c,cacheKey:q,annotationStorageSerializable:p}){const{map:e,transfers:s}=p,ee=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:c,cacheKey:q,annotationStorage:e},s).getReader(),U=this._intentStates.get(q);U.streamReader=ee;const o=()=>{ee.read().then(({value:t,done:a})=>{if(a){U.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(t,U),o())},t=>{if(U.streamReader=null,!this._transport.destroyed){if(U.operatorList){U.operatorList.lastChunk=!0;for(const a of U.renderTasks)a.operatorListChanged();this.#n(!0)}if(U.displayReadyCapability)U.displayReadyCapability.reject(t);else if(U.opListReadCapability)U.opListReadCapability.reject(t);else throw t}})};o()}_abortOperatorList({intentState:c,reason:q,force:p=!1}){if(c.streamReader){if(c.streamReaderCancelTimeout&&(clearTimeout(c.streamReaderCancelTimeout),c.streamReaderCancelTimeout=null),!p){if(c.renderTasks.size>0)return;if(q instanceof _display_utils.RenderingCancelledException){let e=RENDERING_CANCELLED_TIMEOUT;q.extraDelay>0&&q.extraDelay<1e3&&(e+=q.extraDelay),c.streamReaderCancelTimeout=setTimeout(()=>{c.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:c,reason:q,force:!0})},e);return}}if(c.streamReader.cancel(new _util.AbortException(q.message)).catch(()=>{}),c.streamReader=null,!this._transport.destroyed){for(const[e,s]of this._intentStates)if(s===c){this._intentStates.delete(e);break}this.cleanup()}}}get stats(){return this._stats}}exports.PDFPageProxy=PDFPageProxy;class LoopbackPort{#e=new Set;#t=Promise.resolve();postMessage(c,q){const p={data:structuredClone(c,q?{transfer:q}:null)};this.#t.then(()=>{for(const e of this.#e)e.call(this,p)})}addEventListener(c,q){this.#e.add(q)}removeEventListener(c,q){this.#e.delete(q)}terminate(){this.#e.clear()}}exports.LoopbackPort=LoopbackPort;const PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};exports.PDFWorkerUtil=PDFWorkerUtil;{if(_util.isNodeJS&&typeof commonjsRequire=="function")PDFWorkerUtil.isWorkerDisabled=!0,PDFWorkerUtil.fallbackWorkerSrc="./pdf.worker.js";else if(typeof document=="object"){const r=document?.currentScript?.src;r&&(PDFWorkerUtil.fallbackWorkerSrc=r.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}PDFWorkerUtil.isSameOrigin=function(r,c){let q;try{if(q=new URL(r),!q.origin||q.origin==="null")return!1}catch{return!1}const p=new URL(c,q);return q.origin===p.origin},PDFWorkerUtil.createCDNWrapper=function(r){const c=`importScripts("${r}");`;return URL.createObjectURL(new Blob([c]))}}class PDFWorker{static#workerPorts;constructor({name:r=null,port:c=null,verbosity:q=(0,_util.getVerbosityLevel)()}={}){if(this.name=r,this.destroyed=!1,this.verbosity=q,this._readyCapability=new _util.PromiseCapability,this._port=null,this._webWorker=null,this._messageHandler=null,c){if(PDFWorker.#workerPorts?.has(c))throw new Error("Cannot use more than one PDFWorker per port.");(PDFWorker.#workerPorts||=new WeakMap).set(c,this),this._initializeFromPort(c);return}this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(r){this._port=r,this._messageHandler=new _message_handler.MessageHandler("main","worker",r),this._messageHandler.on("ready",function(){}),this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}_initialize(){if(!PDFWorkerUtil.isWorkerDisabled&&!PDFWorker._mainThreadWorkerMessageHandler){let{workerSrc:r}=PDFWorker;try{PDFWorkerUtil.isSameOrigin(window.location.href,r)||(r=PDFWorkerUtil.createCDNWrapper(new URL(r,window.location).href));const c=new Worker(r),q=new _message_handler.MessageHandler("main","worker",c),p=()=>{c.removeEventListener("error",e),q.destroy(),c.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},e=()=>{this._webWorker||p()};c.addEventListener("error",e),q.on("test",N=>{if(c.removeEventListener("error",e),this.destroyed){p();return}N?(this._messageHandler=q,this._port=c,this._webWorker=c,this._readyCapability.resolve(),q.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),q.destroy(),c.terminate())}),q.on("ready",N=>{if(c.removeEventListener("error",e),this.destroyed){p();return}try{s()}catch{this._setupFakeWorker()}});const s=()=>{const N=new Uint8Array;q.send("test",N,[N.buffer])};s();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(r=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const c=new LoopbackPort;this._port=c;const q=`fake${PDFWorkerUtil.fakeWorkerId++}`,p=new _message_handler.MessageHandler(q+"_worker",q,c);r.setup(p,c);const e=new _message_handler.MessageHandler(q,q+"_worker",c);this._messageHandler=e,this._readyCapability.resolve(),e.send("configure",{verbosity:this.verbosity})}).catch(r=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${r.message}".`))})}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),PDFWorker.#workerPorts?.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(r){if(!r?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");const c=this.#workerPorts?.get(r.port);if(c){if(c._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return c}return new PDFWorker(r)}static get workerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(PDFWorkerUtil.fallbackWorkerSrc!==null)return _util.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'),PDFWorkerUtil.fallbackWorkerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _mainThreadWorkerMessageHandler(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){const loader=async()=>{const mainWorkerMessageHandler=this._mainThreadWorkerMessageHandler;if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_util.isNodeJS&&typeof commonjsRequire=="function"){const worker=eval("require")(this.workerSrc);return worker.WorkerMessageHandler}return await(0,_display_utils.loadScript)(this.workerSrc),window.pdfjsWorker.WorkerMessageHandler};return(0,_util.shadow)(this,"_setupFakeWorkerGlobal",loader())}}exports.PDFWorker=PDFWorker;class WorkerTransport{#e=new Map;#t=new Map;#n=new Map;#r=null;constructor(c,q,p,e,s){this.messageHandler=c,this.loadingTask=q,this.commonObjs=new PDFObjects,this.fontLoader=new _font_loader.FontLoader({ownerDocument:e.ownerDocument,styleElement:e.styleElement}),this._params=e,this.canvasFactory=s.canvasFactory,this.filterFactory=s.filterFactory,this.cMapReaderFactory=s.cMapReaderFactory,this.standardFontDataFactory=s.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=p,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=new _util.PromiseCapability,this.setupMessageHandler()}#o(c,q=null){const p=this.#e.get(c);if(p)return p;const e=this.messageHandler.sendWithPromise(c,q);return this.#e.set(c,e),e}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}getRenderingIntent(c,q=_util.AnnotationMode.ENABLE,p=null,e=!1){let s=_util.RenderingIntentFlag.DISPLAY,N=_annotation_storage.SerializableEmpty;switch(c){case"any":s=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":s=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${c}`)}switch(q){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,N=(s&_util.RenderingIntentFlag.PRINT&&p instanceof _annotation_storage.PrintAnnotationStorage?p:this.annotationStorage).serializable;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${q}`)}return e&&(s+=_util.RenderingIntentFlag.OPLIST),{renderingIntent:s,cacheKey:`${s}_${N.hash}`,annotationStorageSerializable:N}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=new _util.PromiseCapability,this.#r?.reject(new Error("Worker was destroyed during onPassword callback"));const c=[];for(const p of this.#t.values())c.push(p._destroy());this.#t.clear(),this.#n.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const q=this.messageHandler.sendWithPromise("Terminate",null);return c.push(q),Promise.all(c).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(),this._networkStream?.cancelAllRequests(new _util.AbortException("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:c,loadingTask:q}=this;c.on("GetReader",(p,e)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=s=>{this._lastProgress={loaded:s.loaded,total:s.total}},e.onPull=()=>{this._fullReader.read().then(function({value:s,done:N}){if(N){e.close();return}(0,_util.assert)(s instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(s),1,[s])}).catch(s=>{e.error(s)})},e.onCancel=s=>{this._fullReader.cancel(s),e.ready.catch(N=>{if(!this.destroyed)throw N})}}),c.on("ReaderHeadersReady",p=>{const e=new _util.PromiseCapability,s=this._fullReader;return s.headersReady.then(()=>{(!s.isStreamingSupported||!s.isRangeSupported)&&(this._lastProgress&&q.onProgress?.(this._lastProgress),s.onProgress=N=>{q.onProgress?.({loaded:N.loaded,total:N.total})}),e.resolve({isStreamingSupported:s.isStreamingSupported,isRangeSupported:s.isRangeSupported,contentLength:s.contentLength})},e.reject),e.promise}),c.on("GetRangeReader",(p,e)=>{(0,_util.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const s=this._networkStream.getRangeReader(p.begin,p.end);if(!s){e.close();return}e.onPull=()=>{s.read().then(function({value:N,done:ee}){if(ee){e.close();return}(0,_util.assert)(N instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(N),1,[N])}).catch(N=>{e.error(N)})},e.onCancel=N=>{s.cancel(N),e.ready.catch(ee=>{if(!this.destroyed)throw ee})}}),c.on("GetDoc",({pdfInfo:p})=>{this._numPages=p.numPages,this._htmlForXfa=p.htmlForXfa,delete p.htmlForXfa,q._capability.resolve(new PDFDocumentProxy(p,this))}),c.on("DocException",function(p){let e;switch(p.name){case"PasswordException":e=new _util.PasswordException(p.message,p.code);break;case"InvalidPDFException":e=new _util.InvalidPDFException(p.message);break;case"MissingPDFException":e=new _util.MissingPDFException(p.message);break;case"UnexpectedResponseException":e=new _util.UnexpectedResponseException(p.message,p.status);break;case"UnknownErrorException":e=new _util.UnknownErrorException(p.message,p.details);break;default:(0,_util.unreachable)("DocException - expected a valid Error.")}q._capability.reject(e)}),c.on("PasswordRequest",p=>{if(this.#r=new _util.PromiseCapability,q.onPassword){const e=s=>{s instanceof Error?this.#r.reject(s):this.#r.resolve({password:s})};try{q.onPassword(e,p.code)}catch(s){this.#r.reject(s)}}else this.#r.reject(new _util.PasswordException(p.message,p.code));return this.#r.promise}),c.on("DataLoaded",p=>{q.onProgress?.({loaded:p.length,total:p.length}),this.downloadInfoCapability.resolve(p)}),c.on("StartRenderPage",p=>{if(this.destroyed)return;this.#t.get(p.pageIndex)._startRenderPage(p.transparency,p.cacheKey)}),c.on("commonobj",([p,e,s])=>{if(!this.destroyed&&!this.commonObjs.has(p))switch(e){case"Font":const N=this._params;if("error"in s){const o=s.error;(0,_util.warn)(`Error during font loading: ${o}`),this.commonObjs.resolve(p,o);break}const ee=N.pdfBug&&globalThis.FontInspector?.enabled?(o,t)=>globalThis.FontInspector.fontAdded(o,t):null,U=new _font_loader.FontFaceObject(s,{isEvalSupported:N.isEvalSupported,disableFontFace:N.disableFontFace,ignoreErrors:N.ignoreErrors,inspectFont:ee});this.fontLoader.bind(U).catch(o=>c.sendWithPromise("FontFallback",{id:p})).finally(()=>{!N.fontExtraProperties&&U.data&&(U.data=null),this.commonObjs.resolve(p,U)});break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(p,s);break;default:throw new Error(`Got unknown common object type ${e}`)}}),c.on("obj",([p,e,s,N])=>{if(this.destroyed)return;const ee=this.#t.get(e);if(!ee.objs.has(p))switch(s){case"Image":if(ee.objs.resolve(p,N),N){let U;if(N.bitmap){const{width:o,height:t}=N;U=o*t*4}else U=N.data?.length||0;U>_util.MAX_IMAGE_SIZE_TO_CACHE&&(ee._maybeCleanupAfterRender=!0)}break;case"Pattern":ee.objs.resolve(p,N);break;default:throw new Error(`Got unknown object type ${s}`)}}),c.on("DocProgress",p=>{this.destroyed||q.onProgress?.({loaded:p.loaded,total:p.total})}),c.on("FetchBuiltInCMap",p=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(p):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),c.on("FetchStandardFontData",p=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(p):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&(0,_util.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:c,transfers:q}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:c,filename:this._fullReader?.filename??null},q).finally(()=>{this.annotationStorage.resetModified()})}getPage(c){if(!Number.isInteger(c)||c<=0||c>this._numPages)return Promise.reject(new Error("Invalid page request."));const q=c-1,p=this.#n.get(q);if(p)return p;const e=this.messageHandler.sendWithPromise("GetPage",{pageIndex:q}).then(s=>{if(this.destroyed)throw new Error("Transport destroyed");const N=new PDFPageProxy(q,s,this,this._params.pdfBug);return this.#t.set(q,N),N});return this.#n.set(q,e),e}getPageIndex(c){return typeof c!="object"||c===null||!Number.isInteger(c.num)||c.num<0||!Number.isInteger(c.gen)||c.gen<0?Promise.reject(new Error("Invalid pageIndex request.")):this.messageHandler.sendWithPromise("GetPageIndex",{num:c.num,gen:c.gen})}getAnnotations(c,q){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:c,intent:q})}getFieldObjects(){return this.#o("GetFieldObjects")}hasJSActions(){return this.#o("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(c){return typeof c!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:c})}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.#o("GetDocJSActions")}getPageJSActions(c){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:c})}getStructTree(c){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:c})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then(c=>new _optional_content_config.OptionalContentConfig(c))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const c="GetMetadata",q=this.#e.get(c);if(q)return q;const p=this.messageHandler.sendWithPromise(c,null).then(e=>({info:e[0],metadata:e[1]?new _metadata.Metadata(e[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#e.set(c,p),p}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(c=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const q of this.#t.values())if(!q.cleanup())throw new Error(`startCleanup: Page ${q.pageNumber} is currently rendering.`);this.commonObjs.clear(),c||this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(!0)}}get loadingParams(){const{disableAutoFetch:c,enableXfa:q}=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:c,enableXfa:q})}}class PDFObjects{#e=Object.create(null);#t(c){return this.#e[c]||={capability:new _util.PromiseCapability,data:null}}get(c,q=null){if(q){const e=this.#t(c);return e.capability.promise.then(()=>q(e.data)),null}const p=this.#e[c];if(!p?.capability.settled)throw new Error(`Requesting object that isn't resolved yet ${c}.`);return p.data}has(c){return this.#e[c]?.capability.settled||!1}resolve(c,q=null){const p=this.#t(c);p.data=q,p.capability.resolve()}clear(){for(const c in this.#e){const{data:q}=this.#e[c];q?.bitmap?.close()}this.#e=Object.create(null)}}class RenderTask{#e=null;constructor(c){this.#e=c,this.onContinue=null}get promise(){return this.#e.capability.promise}cancel(c=0){this.#e.cancel(null,c)}get separateAnnots(){const{separateAnnots:c}=this.#e.operatorList;if(!c)return!1;const{annotationCanvasMap:q}=this.#e;return c.form||c.canvas&&q?.size>0}}exports.RenderTask=RenderTask;class InternalRenderTask{static#e=new WeakSet;constructor({callback:c,params:q,objs:p,commonObjs:e,annotationCanvasMap:s,operatorList:N,pageIndex:ee,canvasFactory:U,filterFactory:o,useRequestAnimationFrame:t=!1,pdfBug:a=!1,pageColors:g=null}){this.callback=c,this.params=q,this.objs=p,this.commonObjs=e,this.annotationCanvasMap=s,this.operatorListIdx=null,this.operatorList=N,this._pageIndex=ee,this.canvasFactory=U,this.filterFactory=o,this._pdfBug=a,this.pageColors=g,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=t===!0&&typeof window<"u",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=q.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:c=!1,optionalContentConfig:q}){if(this.cancelled)return;if(this._canvas){if(InternalRenderTask.#e.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");InternalRenderTask.#e.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:p,viewport:e,transform:s,background:N}=this.params;this.gfx=new _canvas.CanvasGraphics(p,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:q},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:s,viewport:e,transparency:c,background:N}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(c=null,q=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),InternalRenderTask.#e.delete(this._canvas),this.callback(c||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,q))}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.#e.delete(this._canvas),this.callback())))}}const version="3.11.174";exports.version=version;const build="ce8716743";exports.build=build}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.SerializableEmpty=c.PrintAnnotationStorage=c.AnnotationStorage=void 0;var p=q(1),e=q(4),s=q(8);const N=Object.freeze({map:null,hash:"",transfers:void 0});c.SerializableEmpty=N;class ee{#e=!1;#t=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,a){const g=this.#t.get(t);return g===void 0?a:Object.assign(a,g)}getRawValue(t){return this.#t.get(t)}remove(t){if(this.#t.delete(t),this.#t.size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const a of this.#t.values())if(a instanceof e.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(t,a){const g=this.#t.get(t);let d=!1;if(g!==void 0)for(const[i,b]of Object.entries(a))g[i]!==b&&(d=!0,g[i]=b);else d=!0,this.#t.set(t,a);d&&this.#n(),a instanceof e.AnnotationEditor&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(a.constructor._type)}has(t){return this.#t.has(t)}getAll(){return this.#t.size>0?(0,p.objectFromMap)(this.#t):null}setAll(t){for(const[a,g]of Object.entries(t))this.setValue(a,g)}get size(){return this.#t.size}#n(){this.#e||(this.#e=!0,typeof this.onSetModified=="function"&&this.onSetModified())}resetModified(){this.#e&&(this.#e=!1,typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new U(this)}get serializable(){if(this.#t.size===0)return N;const t=new Map,a=new s.MurmurHash3_64,g=[],d=Object.create(null);let i=!1;for(const[b,y]of this.#t){const f=y instanceof e.AnnotationEditor?y.serialize(!1,d):y;f&&(t.set(b,f),a.update(`${b}:${JSON.stringify(f)}`),i||=!!f.bitmap)}if(i)for(const b of t.values())b.bitmap&&g.push(b.bitmap);return t.size>0?{map:t,hash:a.hexdigest(),transfers:g}:N}}c.AnnotationStorage=ee;class U extends ee{#e;constructor(t){super();const{map:a,hash:g,transfers:d}=t.serializable,i=structuredClone(a,d?{transfer:d}:null);this.#e={map:i,hash:g,transfers:d}}get print(){(0,p.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#e}}c.PrintAnnotationStorage=U}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.AnnotationEditor=void 0;var p=q(5),e=q(1),s=q(6);class N{#e="";#t=!1;#n=null;#r=null;#o=null;#s=!1;#a=null;#l=this.focusin.bind(this);#c=this.focusout.bind(this);#i=!1;#f=!1;#d=!1;_initialOptions=Object.create(null);_uiManager=null;_focusEventsAllowed=!0;_l10nPromise=null;#h=!1;#p=N._zIndex++;static _borderLineWidth=-1;static _colorManager=new p.ColorManager;static _zIndex=1;static SMALL_EDITOR_SIZE=0;constructor(o){this.constructor===N&&(0,e.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;const{rotation:t,rawDims:{pageWidth:a,pageHeight:g,pageX:d,pageY:i}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[a,g],this.pageTranslation=[d,i];const[b,y]=this.parentDimensions;this.x=o.x/b,this.y=o.y/y,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return(0,e.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(o){const t=new ee({id:o.parent.getNextId(),parent:o.parent,uiManager:o._uiManager});t.annotationElementId=o.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(o,t=null){if(N._l10nPromise||=new Map(["editor_alt_text_button_label","editor_alt_text_edit_button_label","editor_alt_text_decorative_tooltip"].map(g=>[g,o.get(g)])),t?.strings)for(const g of t.strings)N._l10nPromise.set(g,o.get(g));if(N._borderLineWidth!==-1)return;const a=getComputedStyle(document.documentElement);N._borderLineWidth=parseFloat(a.getPropertyValue("--outline-width"))||0}static updateDefaultParams(o,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(o){return!1}static paste(o,t){(0,e.unreachable)("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#h}set _isDraggable(o){this.#h=o,this.div?.classList.toggle("draggable",o)}center(){const[o,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(o*2),this.y+=this.width*o/(t*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(o*2),this.y-=this.width*o/(t*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}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.#p}setParent(o){o!==null&&(this.pageIndex=o.pageIndex,this.pageDimensions=o.pageDimensions),this.parent=o}focusin(o){this._focusEventsAllowed&&(this.#i?this.#i=!1:this.parent.setSelected(this))}focusout(o){!this._focusEventsAllowed||!this.isAttachedToDOM||o.relatedTarget?.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,t,a,g){const[d,i]=this.parentDimensions;[a,g]=this.screenToPageTranslation(a,g),this.x=(o+a)/d,this.y=(t+g)/i,this.fixAndSetPosition()}#v([o,t],a,g){[a,g]=this.screenToPageTranslation(a,g),this.x+=a/o,this.y+=g/t,this.fixAndSetPosition()}translate(o,t){this.#v(this.parentDimensions,o,t)}translateInPage(o,t){this.#v(this.pageDimensions,o,t),this.div.scrollIntoView({block:"nearest"})}drag(o,t){const[a,g]=this.parentDimensions;if(this.x+=o/a,this.y+=t/g,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:f,y:T}=this.div.getBoundingClientRect();this.parent.findNewParent(this,f,T)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:d,y:i}=this;const[b,y]=this.#m();d+=b,i+=y,this.div.style.left=`${(100*d).toFixed(2)}%`,this.div.style.top=`${(100*i).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}#m(){const[o,t]=this.parentDimensions,{_borderLineWidth:a}=N,g=a/o,d=a/t;switch(this.rotation){case 90:return[-g,d];case 180:return[g,d];case 270:return[g,-d];default:return[-g,-d]}}fixAndSetPosition(){const[o,t]=this.pageDimensions;let{x:a,y:g,width:d,height:i}=this;switch(d*=o,i*=t,a*=o,g*=t,this.rotation){case 0:a=Math.max(0,Math.min(o-d,a)),g=Math.max(0,Math.min(t-i,g));break;case 90:a=Math.max(0,Math.min(o-i,a)),g=Math.min(t,Math.max(d,g));break;case 180:a=Math.min(o,Math.max(d,a)),g=Math.min(t,Math.max(i,g));break;case 270:a=Math.min(o,Math.max(i,a)),g=Math.max(0,Math.min(t-d,g));break}this.x=a/=o,this.y=g/=t;const[b,y]=this.#m();a+=b,g+=y;const{style:f}=this.div;f.left=`${(100*a).toFixed(2)}%`,f.top=`${(100*g).toFixed(2)}%`,this.moveInDOM()}static#g(o,t,a){switch(a){case 90:return[t,-o];case 180:return[-o,-t];case 270:return[-t,o];default:return[o,t]}}screenToPageTranslation(o,t){return N.#g(o,t,this.parentRotation)}pageTranslationToScreen(o,t){return N.#g(o,t,360-this.parentRotation)}#u(o){switch(o){case 90:{const[t,a]=this.pageDimensions;return[0,-t/a,a/t,0]}case 180:return[-1,0,0,-1];case 270:{const[t,a]=this.pageDimensions;return[0,t/a,-a/t,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:o,pageDimensions:[t,a]}=this,g=t*o,d=a*o;return e.FeatureTest.isCSSRoundSupported?[Math.round(g),Math.round(d)]:[g,d]}setDims(o,t){const[a,g]=this.parentDimensions;this.div.style.width=`${(100*o/a).toFixed(2)}%`,this.#s||(this.div.style.height=`${(100*t/g).toFixed(2)}%`),this.#n?.classList.toggle("small",o<N.SMALL_EDITOR_SIZE||t<N.SMALL_EDITOR_SIZE)}fixDims(){const{style:o}=this.div,{height:t,width:a}=o,g=a.endsWith("%"),d=!this.#s&&t.endsWith("%");if(g&&d)return;const[i,b]=this.parentDimensions;g||(o.width=`${(100*parseFloat(a)/i).toFixed(2)}%`),!this.#s&&!d&&(o.height=`${(100*parseFloat(t)/b).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#b(){if(this.#a)return;this.#a=document.createElement("div"),this.#a.classList.add("resizers");const o=["topLeft","topRight","bottomRight","bottomLeft"];this._willKeepAspectRatio||o.push("topMiddle","middleRight","bottomMiddle","middleLeft");for(const t of o){const a=document.createElement("div");this.#a.append(a),a.classList.add("resizer",t),a.addEventListener("pointerdown",this.#E.bind(this,t)),a.addEventListener("contextmenu",s.noContextMenu)}this.div.prepend(this.#a)}#E(o,t){t.preventDefault();const{isMac:a}=e.FeatureTest.platform;if(t.button!==0||t.ctrlKey&&a)return;const g=this.#w.bind(this,o),d=this._isDraggable;this._isDraggable=!1;const i={passive:!0,capture:!0};window.addEventListener("pointermove",g,i);const b=this.x,y=this.y,f=this.width,T=this.height,H=this.parent.div.style.cursor,I=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;const _=()=>{this._isDraggable=d,window.removeEventListener("pointerup",_),window.removeEventListener("blur",_),window.removeEventListener("pointermove",g,i),this.parent.div.style.cursor=H,this.div.style.cursor=I;const M=this.x,te=this.y,ie=this.width,Y=this.height;M===b&&te===y&&ie===f&&Y===T||this.addCommands({cmd:()=>{this.width=ie,this.height=Y,this.x=M,this.y=te;const[he,ge]=this.parentDimensions;this.setDims(he*ie,ge*Y),this.fixAndSetPosition()},undo:()=>{this.width=f,this.height=T,this.x=b,this.y=y;const[he,ge]=this.parentDimensions;this.setDims(he*f,ge*T),this.fixAndSetPosition()},mustExec:!0})};window.addEventListener("pointerup",_),window.addEventListener("blur",_)}#w(o,t){const[a,g]=this.parentDimensions,d=this.x,i=this.y,b=this.width,y=this.height,f=N.MIN_SIZE/a,T=N.MIN_SIZE/g,H=L=>Math.round(L*1e4)/1e4,I=this.#u(this.rotation),_=(L,l)=>[I[0]*L+I[2]*l,I[1]*L+I[3]*l],M=this.#u(360-this.rotation),te=(L,l)=>[M[0]*L+M[2]*l,M[1]*L+M[3]*l];let ie,Y,he=!1,ge=!1;switch(o){case"topLeft":he=!0,ie=(L,l)=>[0,0],Y=(L,l)=>[L,l];break;case"topMiddle":ie=(L,l)=>[L/2,0],Y=(L,l)=>[L/2,l];break;case"topRight":he=!0,ie=(L,l)=>[L,0],Y=(L,l)=>[0,l];break;case"middleRight":ge=!0,ie=(L,l)=>[L,l/2],Y=(L,l)=>[0,l/2];break;case"bottomRight":he=!0,ie=(L,l)=>[L,l],Y=(L,l)=>[0,0];break;case"bottomMiddle":ie=(L,l)=>[L/2,l],Y=(L,l)=>[L/2,0];break;case"bottomLeft":he=!0,ie=(L,l)=>[0,l],Y=(L,l)=>[L,0];break;case"middleLeft":ge=!0,ie=(L,l)=>[0,l/2],Y=(L,l)=>[L,l/2];break}const Ne=ie(b,y),ke=Y(b,y);let Oe=_(...ke);const Ve=H(d+Oe[0]),Ee=H(i+Oe[1]);let G=1,A=1,[m,v]=this.screenToPageTranslation(t.movementX,t.movementY);if([m,v]=te(m/a,v/g),he){const L=Math.hypot(b,y);G=A=Math.max(Math.min(Math.hypot(ke[0]-Ne[0]-m,ke[1]-Ne[1]-v)/L,1/b,1/y),f/b,T/y)}else ge?G=Math.max(f,Math.min(1,Math.abs(ke[0]-Ne[0]-m)))/b:A=Math.max(T,Math.min(1,Math.abs(ke[1]-Ne[1]-v)))/y;const C=H(b*G),V=H(y*A);Oe=_(...Y(C,V));const W=Ve-Oe[0],K=Ee-Oe[1];this.width=C,this.height=V,this.x=W,this.y=K,this.setDims(a*C,g*V),this.fixAndSetPosition()}async addAltTextButton(){if(this.#n)return;const o=this.#n=document.createElement("button");o.className="altText";const t=await N._l10nPromise.get("editor_alt_text_button_label");o.textContent=t,o.setAttribute("aria-label",t),o.tabIndex="0",o.addEventListener("contextmenu",s.noContextMenu),o.addEventListener("pointerdown",a=>a.stopPropagation()),o.addEventListener("click",a=>{a.preventDefault(),this._uiManager.editAltText(this)},{capture:!0}),o.addEventListener("keydown",a=>{a.target===o&&a.key==="Enter"&&(a.preventDefault(),this._uiManager.editAltText(this))}),this.#C(),this.div.append(o),N.SMALL_EDITOR_SIZE||(N.SMALL_EDITOR_SIZE=Math.min(128,Math.round(o.getBoundingClientRect().width*1.4)))}async#C(){const o=this.#n;if(!o)return;if(!this.#e&&!this.#t){o.classList.remove("done"),this.#r?.remove();return}N._l10nPromise.get("editor_alt_text_edit_button_label").then(a=>{o.setAttribute("aria-label",a)});let t=this.#r;if(!t){this.#r=t=document.createElement("span"),t.className="tooltip",t.setAttribute("role","tooltip");const a=t.id=`alt-text-tooltip-${this.id}`;o.setAttribute("aria-describedby",a);const g=100;o.addEventListener("mouseenter",()=>{this.#o=setTimeout(()=>{this.#o=null,this.#r.classList.add("show"),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",subtype:this.editorType,data:{action:"alt_text_tooltip"}}})},g)}),o.addEventListener("mouseleave",()=>{clearTimeout(this.#o),this.#o=null,this.#r?.classList.remove("show")})}o.classList.add("done"),t.innerText=this.#t?await N._l10nPromise.get("editor_alt_text_decorative_tooltip"):this.#e,t.parentNode||o.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}get altTextData(){return{altText:this.#e,decorative:this.#t}}set altTextData({altText:o,decorative:t}){this.#e===o&&this.#t===t||(this.#e=o,this.#t=t,this.#C())}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.#l),this.div.addEventListener("focusout",this.#c);const[o,t]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*t/o).toFixed(2)}%`,this.div.style.maxHeight=`${(100*o/t).toFixed(2)}%`);const[a,g]=this.getInitialTranslation();return this.translate(a,g),(0,p.bindEvents)(this,this.div,["pointerdown"]),this.div}pointerdown(o){const{isMac:t}=e.FeatureTest.platform;if(o.button!==0||o.ctrlKey&&t){o.preventDefault();return}this.#i=!0,this.#T(o)}#T(o){if(!this._isDraggable)return;const t=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let a,g;t&&(a={passive:!0,capture:!0},g=i=>{const[b,y]=this.screenToPageTranslation(i.movementX,i.movementY);this._uiManager.dragSelectedEditors(b,y)},window.addEventListener("pointermove",g,a));const d=()=>{if(window.removeEventListener("pointerup",d),window.removeEventListener("blur",d),t&&window.removeEventListener("pointermove",g,a),this.#i=!1,!this._uiManager.endDragSession()){const{isMac:i}=e.FeatureTest.platform;o.ctrlKey&&!i||o.shiftKey||o.metaKey&&i?this.parent.toggleSelected(this):this.parent.setSelected(this)}};window.addEventListener("pointerup",d),window.addEventListener("blur",d)}moveInDOM(){this.parent?.moveEditorInDOM(this)}_setParentAndPosition(o,t,a){o.changeParent(this),this.x=t,this.y=a,this.fixAndSetPosition()}getRect(o,t){const a=this.parentScale,[g,d]=this.pageDimensions,[i,b]=this.pageTranslation,y=o/a,f=t/a,T=this.x*g,H=this.y*d,I=this.width*g,_=this.height*d;switch(this.rotation){case 0:return[T+y+i,d-H-f-_+b,T+y+I+i,d-H-f+b];case 90:return[T+f+i,d-H+y+b,T+f+_+i,d-H+y+I+b];case 180:return[T-y-I+i,d-H+f+b,T-y+i,d-H+f+_+b];case 270:return[T-f-_+i,d-H-y-I+b,T-f+i,d-H-y+b];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(o,t){const[a,g,d,i]=o,b=d-a,y=i-g;switch(this.rotation){case 0:return[a,t-i,b,y];case 90:return[a,t-g,y,b];case 180:return[d,t-g,b,y];case 270:return[d,t-i,y,b];default:throw new 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.#l),this.div?.addEventListener("focusout",this.#c)}serialize(o=!1,t=null){(0,e.unreachable)("An editor must be serializable")}static deserialize(o,t,a){const g=new this.prototype.constructor({parent:t,id:t.getNextId(),uiManager:a});g.rotation=o.rotation;const[d,i]=g.pageDimensions,[b,y,f,T]=g.getRectInCurrentCoords(o.rect,i);return g.x=b/d,g.y=y/i,g.width=f/d,g.height=T/i,g}remove(){this.div.removeEventListener("focusin",this.#l),this.div.removeEventListener("focusout",this.#c),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#n?.remove(),this.#n=null,this.#r=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#b(),this.#a.classList.remove("hidden"))}select(){this.makeResizable(),this.div?.classList.add("selectedEditor")}unselect(){this.#a?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus()}updateParams(o,t){}disableEditing(){this.#n&&(this.#n.hidden=!0)}enableEditing(){this.#n&&(this.#n.hidden=!1)}enterInEditMode(){}get contentDiv(){return this.div}get isEditing(){return this.#f}set isEditing(o){this.#f=o,this.parent&&(o?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(o,t){this.#s=!0;const a=o/t,{style:g}=this.div;g.aspectRatio=a,g.height="auto"}static get MIN_SIZE(){return 16}}c.AnnotationEditor=N;class ee extends N{constructor(o){super(o),this.annotationElementId=o.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.KeyboardManager=c.CommandManager=c.ColorManager=c.AnnotationEditorUIManager=void 0,c.bindEvents=s,c.opacityToHex=N;var p=q(1),e=q(6);function s(d,i,b){for(const y of b)i.addEventListener(y,d[y].bind(d))}function N(d){return Math.round(Math.min(255,Math.max(1,255*d))).toString(16).padStart(2,"0")}class ee{#e=0;getId(){return`${p.AnnotationEditorPrefix}${this.#e++}`}}class U{#e=(0,p.getUuid)();#t=0;#n=null;static get _isSVGFittingCanvas(){const i='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>',y=new OffscreenCanvas(1,3).getContext("2d"),f=new Image;f.src=i;const T=f.decode().then(()=>(y.drawImage(f,0,0,1,1,0,0,1,3),new Uint32Array(y.getImageData(0,0,1,1).data.buffer)[0]===0));return(0,p.shadow)(this,"_isSVGFittingCanvas",T)}async#r(i,b){this.#n||=new Map;let y=this.#n.get(i);if(y===null)return null;if(y?.bitmap)return y.refCounter+=1,y;try{y||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let f;if(typeof b=="string"){y.url=b;const T=await fetch(b);if(!T.ok)throw new Error(T.statusText);f=await T.blob()}else f=y.file=b;if(f.type==="image/svg+xml"){const T=U._isSVGFittingCanvas,H=new FileReader,I=new Image,_=new Promise((M,te)=>{I.onload=()=>{y.bitmap=I,y.isSvg=!0,M()},H.onload=async()=>{const ie=y.svgUrl=H.result;I.src=await T?`${ie}#svgView(preserveAspectRatio(none))`:ie},I.onerror=H.onerror=te});H.readAsDataURL(f),await _}else y.bitmap=await createImageBitmap(f);y.refCounter=1}catch(f){console.error(f),y=null}return this.#n.set(i,y),y&&this.#n.set(y.id,y),y}async getFromFile(i){const{lastModified:b,name:y,size:f,type:T}=i;return this.#r(`${b}_${y}_${f}_${T}`,i)}async getFromUrl(i){return this.#r(i,i)}async getFromId(i){this.#n||=new Map;const b=this.#n.get(i);return b?b.bitmap?(b.refCounter+=1,b):b.file?this.getFromFile(b.file):this.getFromUrl(b.url):null}getSvgUrl(i){const b=this.#n.get(i);return b?.isSvg?b.svgUrl:null}deleteId(i){this.#n||=new Map;const b=this.#n.get(i);b&&(b.refCounter-=1,b.refCounter===0&&(b.bitmap=null))}isValidId(i){return i.startsWith(`image_${this.#e}_`)}}class o{#e=[];#t=!1;#n;#r=-1;constructor(i=128){this.#n=i}add({cmd:i,undo:b,mustExec:y,type:f=NaN,overwriteIfSameType:T=!1,keepUndo:H=!1}){if(y&&i(),this.#t)return;const I={cmd:i,undo:b,type:f};if(this.#r===-1){this.#e.length>0&&(this.#e.length=0),this.#r=0,this.#e.push(I);return}if(T&&this.#e[this.#r].type===f){H&&(I.undo=this.#e[this.#r].undo),this.#e[this.#r]=I;return}const _=this.#r+1;_===this.#n?this.#e.splice(0,1):(this.#r=_,_<this.#e.length&&this.#e.splice(_)),this.#e.push(I)}undo(){this.#r!==-1&&(this.#t=!0,this.#e[this.#r].undo(),this.#t=!1,this.#r-=1)}redo(){this.#r<this.#e.length-1&&(this.#r+=1,this.#t=!0,this.#e[this.#r].cmd(),this.#t=!1)}hasSomethingToUndo(){return this.#r!==-1}hasSomethingToRedo(){return this.#r<this.#e.length-1}destroy(){this.#e=null}}c.CommandManager=o;class t{constructor(i){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:b}=p.FeatureTest.platform;for(const[y,f,T={}]of i)for(const H of y){const I=H.startsWith("mac+");b&&I?(this.callbacks.set(H.slice(4),{callback:f,options:T}),this.allKeys.add(H.split("+").at(-1))):!b&&!I&&(this.callbacks.set(H,{callback:f,options:T}),this.allKeys.add(H.split("+").at(-1)))}}#e(i){i.altKey&&this.buffer.push("alt"),i.ctrlKey&&this.buffer.push("ctrl"),i.metaKey&&this.buffer.push("meta"),i.shiftKey&&this.buffer.push("shift"),this.buffer.push(i.key);const b=this.buffer.join("+");return this.buffer.length=0,b}exec(i,b){if(!this.allKeys.has(b.key))return;const y=this.callbacks.get(this.#e(b));if(!y)return;const{callback:f,options:{bubbles:T=!1,args:H=[],checker:I=null}}=y;I&&!I(i,b)||(f.bind(i,...H)(),T||(b.stopPropagation(),b.preventDefault()))}}c.KeyboardManager=t;class a{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const i=new Map([["CanvasText",null],["Canvas",null]]);return(0,e.getColorValues)(i),(0,p.shadow)(this,"_colors",i)}convert(i){const b=(0,e.getRGB)(i);if(!window.matchMedia("(forced-colors: active)").matches)return b;for(const[y,f]of this._colors)if(f.every((T,H)=>T===b[H]))return a._colorsMapping.get(y);return b}getHexCode(i){const b=this._colors.get(i);return b?p.Util.makeHexColor(...b):i}}c.ColorManager=a;class g{#e=null;#t=new Map;#n=new Map;#r=null;#o=null;#s=new o;#a=0;#l=new Set;#c=null;#i=null;#f=new Set;#d=null;#h=new ee;#p=!1;#v=!1;#m=null;#g=p.AnnotationEditorType.NONE;#u=new Set;#b=null;#E=this.blur.bind(this);#w=this.focus.bind(this);#C=this.copy.bind(this);#T=this.cut.bind(this);#O=this.paste.bind(this);#D=this.keydown.bind(this);#I=this.onEditingAction.bind(this);#_=this.onPageChanging.bind(this);#L=this.onScaleChanging.bind(this);#k=this.onRotationChanging.bind(this);#M={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1};#y=[0,0];#R=null;#A=null;#N=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const i=g.prototype,b=T=>{const{activeElement:H}=document;return H&&T.#A.contains(H)&&T.hasSomethingToControl()},y=this.TRANSLATE_SMALL,f=this.TRANSLATE_BIG;return(0,p.shadow)(this,"_keyboardManager",new t([[["ctrl+a","mac+meta+a"],i.selectAll],[["ctrl+z","mac+meta+z"],i.undo],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],i.redo],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],i.delete],[["Escape","mac+Escape"],i.unselectAll],[["ArrowLeft","mac+ArrowLeft"],i.translateSelectedEditors,{args:[-y,0],checker:b}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],i.translateSelectedEditors,{args:[-f,0],checker:b}],[["ArrowRight","mac+ArrowRight"],i.translateSelectedEditors,{args:[y,0],checker:b}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],i.translateSelectedEditors,{args:[f,0],checker:b}],[["ArrowUp","mac+ArrowUp"],i.translateSelectedEditors,{args:[0,-y],checker:b}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],i.translateSelectedEditors,{args:[0,-f],checker:b}],[["ArrowDown","mac+ArrowDown"],i.translateSelectedEditors,{args:[0,y],checker:b}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],i.translateSelectedEditors,{args:[0,f],checker:b}]]))}constructor(i,b,y,f,T,H){this.#A=i,this.#N=b,this.#r=y,this._eventBus=f,this._eventBus._on("editingaction",this.#I),this._eventBus._on("pagechanging",this.#_),this._eventBus._on("scalechanging",this.#L),this._eventBus._on("rotationchanging",this.#k),this.#o=T.annotationStorage,this.#d=T.filterFactory,this.#b=H,this.viewParameters={realScale:e.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0}}destroy(){this.#x(),this.#H(),this._eventBus._off("editingaction",this.#I),this._eventBus._off("pagechanging",this.#_),this._eventBus._off("scalechanging",this.#L),this._eventBus._off("rotationchanging",this.#k);for(const i of this.#n.values())i.destroy();this.#n.clear(),this.#t.clear(),this.#f.clear(),this.#e=null,this.#u.clear(),this.#s.destroy(),this.#r.destroy()}get hcmFilter(){return(0,p.shadow)(this,"hcmFilter",this.#b?this.#d.addHCMFilter(this.#b.foreground,this.#b.background):"none")}get direction(){return(0,p.shadow)(this,"direction",getComputedStyle(this.#A).direction)}editAltText(i){this.#r?.editAltText(this,i)}onPageChanging({pageNumber:i}){this.#a=i-1}focusMainContainer(){this.#A.focus()}findParent(i,b){for(const y of this.#n.values()){const{x:f,y:T,width:H,height:I}=y.div.getBoundingClientRect();if(i>=f&&i<=f+H&&b>=T&&b<=T+I)return y}return null}disableUserSelect(i=!1){this.#N.classList.toggle("noUserSelect",i)}addShouldRescale(i){this.#f.add(i)}removeShouldRescale(i){this.#f.delete(i)}onScaleChanging({scale:i}){this.commitOrRemove(),this.viewParameters.realScale=i*e.PixelsPerInch.PDF_TO_CSS_UNITS;for(const b of this.#f)b.onScaleChanging()}onRotationChanging({pagesRotation:i}){this.commitOrRemove(),this.viewParameters.rotation=i}addToAnnotationStorage(i){!i.isEmpty()&&this.#o&&!this.#o.has(i.id)&&this.#o.setValue(i.id,i)}#B(){window.addEventListener("focus",this.#w),window.addEventListener("blur",this.#E)}#H(){window.removeEventListener("focus",this.#w),window.removeEventListener("blur",this.#E)}blur(){if(!this.hasSelection)return;const{activeElement:i}=document;for(const b of this.#u)if(b.div.contains(i)){this.#m=[b,i],b._focusEventsAllowed=!1;break}}focus(){if(!this.#m)return;const[i,b]=this.#m;this.#m=null,b.addEventListener("focusin",()=>{i._focusEventsAllowed=!0},{once:!0}),b.focus()}#V(){window.addEventListener("keydown",this.#D,{capture:!0})}#x(){window.removeEventListener("keydown",this.#D,{capture:!0})}#F(){document.addEventListener("copy",this.#C),document.addEventListener("cut",this.#T),document.addEventListener("paste",this.#O)}#P(){document.removeEventListener("copy",this.#C),document.removeEventListener("cut",this.#T),document.removeEventListener("paste",this.#O)}addEditListeners(){this.#V(),this.#F()}removeEditListeners(){this.#x(),this.#P()}copy(i){if(i.preventDefault(),this.#e?.commitOrRemove(),!this.hasSelection)return;const b=[];for(const y of this.#u){const f=y.serialize(!0);f&&b.push(f)}b.length!==0&&i.clipboardData.setData("application/pdfjs",JSON.stringify(b))}cut(i){this.copy(i),this.delete()}paste(i){i.preventDefault();const{clipboardData:b}=i;for(const T of b.items)for(const H of this.#i)if(H.isHandlingMimeForPasting(T.type)){H.paste(T,this.currentLayer);return}let y=b.getData("application/pdfjs");if(!y)return;try{y=JSON.parse(y)}catch(T){(0,p.warn)(`paste: "${T.message}".`);return}if(!Array.isArray(y))return;this.unselectAll();const f=this.currentLayer;try{const T=[];for(const _ of y){const M=f.deserialize(_);if(!M)return;T.push(M)}const H=()=>{for(const _ of T)this.#U(_);this.#z(T)},I=()=>{for(const _ of T)_.remove()};this.addCommands({cmd:H,undo:I,mustExec:!0})}catch(T){(0,p.warn)(`paste: "${T.message}".`)}}keydown(i){this.getActive()?.shouldGetKeyboardEvents()||g._keyboardManager.exec(this,i)}onEditingAction(i){["undo","redo","delete","selectAll"].includes(i.name)&&this[i.name]()}#S(i){Object.entries(i).some(([y,f])=>this.#M[y]!==f)&&this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#M,i)})}#W(i){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:i})}setEditingState(i){i?(this.#B(),this.#V(),this.#F(),this.#S({isEditing:this.#g!==p.AnnotationEditorType.NONE,isEmpty:this.#j(),hasSomethingToUndo:this.#s.hasSomethingToUndo(),hasSomethingToRedo:this.#s.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#H(),this.#x(),this.#P(),this.#S({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(i){if(!this.#i){this.#i=i;for(const b of this.#i)this.#W(b.defaultPropertiesToUpdate)}}getId(){return this.#h.getId()}get currentLayer(){return this.#n.get(this.#a)}getLayer(i){return this.#n.get(i)}get currentPageIndex(){return this.#a}addLayer(i){this.#n.set(i.pageIndex,i),this.#p?i.enable():i.disable()}removeLayer(i){this.#n.delete(i.pageIndex)}updateMode(i,b=null){if(this.#g!==i){if(this.#g=i,i===p.AnnotationEditorType.NONE){this.setEditingState(!1),this.#G();return}this.setEditingState(!0),this.#q(),this.unselectAll();for(const y of this.#n.values())y.updateMode(i);if(b){for(const y of this.#t.values())if(y.annotationElementId===b){this.setSelected(y),y.enterInEditMode();break}}}}updateToolbar(i){i!==this.#g&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:i})}updateParams(i,b){if(this.#i){if(i===p.AnnotationEditorParamsType.CREATE){this.currentLayer.addNewEditor(i);return}for(const y of this.#u)y.updateParams(i,b);for(const y of this.#i)y.updateDefaultParams(i,b)}}enableWaiting(i=!1){if(this.#v!==i){this.#v=i;for(const b of this.#n.values())i?b.disableClick():b.enableClick(),b.div.classList.toggle("waiting",i)}}#q(){if(!this.#p){this.#p=!0;for(const i of this.#n.values())i.enable()}}#G(){if(this.unselectAll(),this.#p){this.#p=!1;for(const i of this.#n.values())i.disable()}}getEditors(i){const b=[];for(const y of this.#t.values())y.pageIndex===i&&b.push(y);return b}getEditor(i){return this.#t.get(i)}addEditor(i){this.#t.set(i.id,i)}removeEditor(i){this.#t.delete(i.id),this.unselect(i),(!i.annotationElementId||!this.#l.has(i.annotationElementId))&&this.#o?.remove(i.id)}addDeletedAnnotationElement(i){this.#l.add(i.annotationElementId),i.deleted=!0}isDeletedAnnotationElement(i){return this.#l.has(i)}removeDeletedAnnotationElement(i){this.#l.delete(i.annotationElementId),i.deleted=!1}#U(i){const b=this.#n.get(i.pageIndex);b?b.addOrRebuild(i):this.addEditor(i)}setActiveEditor(i){this.#e!==i&&(this.#e=i,i&&this.#W(i.propertiesToUpdate))}toggleSelected(i){if(this.#u.has(i)){this.#u.delete(i),i.unselect(),this.#S({hasSelectedEditor:this.hasSelection});return}this.#u.add(i),i.select(),this.#W(i.propertiesToUpdate),this.#S({hasSelectedEditor:!0})}setSelected(i){for(const b of this.#u)b!==i&&b.unselect();this.#u.clear(),this.#u.add(i),i.select(),this.#W(i.propertiesToUpdate),this.#S({hasSelectedEditor:!0})}isSelected(i){return this.#u.has(i)}unselect(i){i.unselect(),this.#u.delete(i),this.#S({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#u.size!==0}undo(){this.#s.undo(),this.#S({hasSomethingToUndo:this.#s.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#j()})}redo(){this.#s.redo(),this.#S({hasSomethingToUndo:!0,hasSomethingToRedo:this.#s.hasSomethingToRedo(),isEmpty:this.#j()})}addCommands(i){this.#s.add(i),this.#S({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#j()})}#j(){if(this.#t.size===0)return!0;if(this.#t.size===1)for(const i of this.#t.values())return i.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const i=[...this.#u],b=()=>{for(const f of i)f.remove()},y=()=>{for(const f of i)this.#U(f)};this.addCommands({cmd:b,undo:y,mustExec:!0})}commitOrRemove(){this.#e?.commitOrRemove()}hasSomethingToControl(){return this.#e||this.hasSelection}#z(i){this.#u.clear();for(const b of i)b.isEmpty()||(this.#u.add(b),b.select());this.#S({hasSelectedEditor:!0})}selectAll(){for(const i of this.#u)i.commit();this.#z(this.#t.values())}unselectAll(){if(this.#e){this.#e.commitOrRemove();return}if(this.hasSelection){for(const i of this.#u)i.unselect();this.#u.clear(),this.#S({hasSelectedEditor:!1})}}translateSelectedEditors(i,b,y=!1){if(y||this.commitOrRemove(),!this.hasSelection)return;this.#y[0]+=i,this.#y[1]+=b;const[f,T]=this.#y,H=[...this.#u],I=1e3;this.#R&&clearTimeout(this.#R),this.#R=setTimeout(()=>{this.#R=null,this.#y[0]=this.#y[1]=0,this.addCommands({cmd:()=>{for(const _ of H)this.#t.has(_.id)&&_.translateInPage(f,T)},undo:()=>{for(const _ of H)this.#t.has(_.id)&&_.translateInPage(-f,-T)},mustExec:!1})},I);for(const _ of H)_.translateInPage(i,b)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#c=new Map;for(const i of this.#u)this.#c.set(i,{savedX:i.x,savedY:i.y,savedPageIndex:i.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#c)return!1;this.disableUserSelect(!1);const i=this.#c;this.#c=null;let b=!1;for(const[{x:f,y:T,pageIndex:H},I]of i)I.newX=f,I.newY=T,I.newPageIndex=H,b||=f!==I.savedX||T!==I.savedY||H!==I.savedPageIndex;if(!b)return!1;const y=(f,T,H,I)=>{if(this.#t.has(f.id)){const _=this.#n.get(I);_?f._setParentAndPosition(_,T,H):(f.pageIndex=I,f.x=T,f.y=H)}};return this.addCommands({cmd:()=>{for(const[f,{newX:T,newY:H,newPageIndex:I}]of i)y(f,T,H,I)},undo:()=>{for(const[f,{savedX:T,savedY:H,savedPageIndex:I}]of i)y(f,T,H,I)},mustExec:!0}),!0}dragSelectedEditors(i,b){if(this.#c)for(const y of this.#c.keys())y.drag(i,b)}rebuild(i){if(i.parent===null){const b=this.getLayer(i.pageIndex);b?(b.changeParent(i),b.addOrRebuild(i)):(this.addEditor(i),this.addToAnnotationStorage(i),i.rebuild())}else i.parent.addOrRebuild(i)}isActive(i){return this.#e===i}getActive(){return this.#e}getMode(){return this.#g}get imageManager(){return(0,p.shadow)(this,"imageManager",new U)}}c.AnnotationEditorUIManager=g}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.StatTimer=c.RenderingCancelledException=c.PixelsPerInch=c.PageViewport=c.PDFDateString=c.DOMStandardFontDataFactory=c.DOMSVGFactory=c.DOMFilterFactory=c.DOMCanvasFactory=c.DOMCMapReaderFactory=void 0,c.deprecated=te,c.getColorValues=Ne,c.getCurrentTransform=ke,c.getCurrentTransformInverse=Oe,c.getFilenameFromUrl=f,c.getPdfFilenameFromUrl=T,c.getRGB=ge,c.getXfaPageViewport=he,c.isDataScheme=b,c.isPdfFile=y,c.isValidFetchUrl=I,c.loadScript=M,c.noContextMenu=_,c.setLayerDimensions=Ve;var p=q(7),e=q(1);const s="http://www.w3.org/2000/svg";class N{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}c.PixelsPerInch=N;class ee extends p.BaseFilterFactory{#e;#t;#n;#r;#o;#s;#a;#l;#c;#i;#f=0;constructor({docId:G,ownerDocument:A=globalThis.document}={}){super(),this.#n=G,this.#r=A}get#d(){return this.#e||=new Map}get#h(){if(!this.#t){const G=this.#r.createElement("div"),{style:A}=G;A.visibility="hidden",A.contain="strict",A.width=A.height=0,A.position="absolute",A.top=A.left=0,A.zIndex=-1;const m=this.#r.createElementNS(s,"svg");m.setAttribute("width",0),m.setAttribute("height",0),this.#t=this.#r.createElementNS(s,"defs"),G.append(m),m.append(this.#t),this.#r.body.append(G)}return this.#t}addFilter(G){if(!G)return"none";let A=this.#d.get(G);if(A)return A;let m,v,C,V;if(G.length===1){const l=G[0],S=new Array(256);for(let R=0;R<256;R++)S[R]=l[R]/255;V=m=v=C=S.join(",")}else{const[l,S,R]=G,O=new Array(256),B=new Array(256),Z=new Array(256);for(let re=0;re<256;re++)O[re]=l[re]/255,B[re]=S[re]/255,Z[re]=R[re]/255;m=O.join(","),v=B.join(","),C=Z.join(","),V=`${m}${v}${C}`}if(A=this.#d.get(V),A)return this.#d.set(G,A),A;const W=`g_${this.#n}_transfer_map_${this.#f++}`,K=`url(#${W})`;this.#d.set(G,K),this.#d.set(V,K);const L=this.#v(W);return this.#g(m,v,C,L),K}addHCMFilter(G,A){const m=`${G}-${A}`;if(this.#s===m)return this.#a;if(this.#s=m,this.#a="none",this.#o?.remove(),!G||!A)return this.#a;const v=this.#u(G);G=e.Util.makeHexColor(...v);const C=this.#u(A);if(A=e.Util.makeHexColor(...C),this.#h.style.color="",G==="#000000"&&A==="#ffffff"||G===A)return this.#a;const V=new Array(256);for(let S=0;S<=255;S++){const R=S/255;V[S]=R<=.03928?R/12.92:((R+.055)/1.055)**2.4}const W=V.join(","),K=`g_${this.#n}_hcm_filter`,L=this.#l=this.#v(K);this.#g(W,W,W,L),this.#p(L);const l=(S,R)=>{const O=v[S]/255,B=C[S]/255,Z=new Array(R+1);for(let re=0;re<=R;re++)Z[re]=O+re/R*(B-O);return Z.join(",")};return this.#g(l(0,5),l(1,5),l(2,5),L),this.#a=`url(#${K})`,this.#a}addHighlightHCMFilter(G,A,m,v){const C=`${G}-${A}-${m}-${v}`;if(this.#c===C)return this.#i;if(this.#c=C,this.#i="none",this.#l?.remove(),!G||!A)return this.#i;const[V,W]=[G,A].map(this.#u.bind(this));let K=Math.round(.2126*V[0]+.7152*V[1]+.0722*V[2]),L=Math.round(.2126*W[0]+.7152*W[1]+.0722*W[2]),[l,S]=[m,v].map(this.#u.bind(this));L<K&&([K,L,l,S]=[L,K,S,l]),this.#h.style.color="";const R=(Z,re,me)=>{const We=new Array(256),ve=(L-K)/me,ye=Z/255,Ce=(re-Z)/(255*me);let Re=0;for(let xe=0;xe<=me;xe++){const qe=Math.round(K+xe*ve),tt=ye+xe*Ce;for(let lt=Re;lt<=qe;lt++)We[lt]=tt;Re=qe+1}for(let xe=Re;xe<256;xe++)We[xe]=We[Re-1];return We.join(",")},O=`g_${this.#n}_hcm_highlight_filter`,B=this.#l=this.#v(O);return this.#p(B),this.#g(R(l[0],S[0],5),R(l[1],S[1],5),R(l[2],S[2],5),B),this.#i=`url(#${O})`,this.#i}destroy(G=!1){G&&(this.#a||this.#i)||(this.#t&&(this.#t.parentNode.parentNode.remove(),this.#t=null),this.#e&&(this.#e.clear(),this.#e=null),this.#f=0)}#p(G){const A=this.#r.createElementNS(s,"feColorMatrix");A.setAttribute("type","matrix"),A.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"),G.append(A)}#v(G){const A=this.#r.createElementNS(s,"filter");return A.setAttribute("color-interpolation-filters","sRGB"),A.setAttribute("id",G),this.#h.append(A),A}#m(G,A,m){const v=this.#r.createElementNS(s,A);v.setAttribute("type","discrete"),v.setAttribute("tableValues",m),G.append(v)}#g(G,A,m,v){const C=this.#r.createElementNS(s,"feComponentTransfer");v.append(C),this.#m(C,"feFuncR",G),this.#m(C,"feFuncG",A),this.#m(C,"feFuncB",m)}#u(G){return this.#h.style.color=G,ge(getComputedStyle(this.#h).getPropertyValue("color"))}}c.DOMFilterFactory=ee;class U extends p.BaseCanvasFactory{constructor({ownerDocument:G=globalThis.document}={}){super(),this._document=G}_createCanvas(G,A){const m=this._document.createElement("canvas");return m.width=G,m.height=A,m}}c.DOMCanvasFactory=U;async function o(Ee,G=!1){if(I(Ee,document.baseURI)){const A=await fetch(Ee);if(!A.ok)throw new Error(A.statusText);return G?new Uint8Array(await A.arrayBuffer()):(0,e.stringToBytes)(await A.text())}return new Promise((A,m)=>{const v=new XMLHttpRequest;v.open("GET",Ee,!0),G&&(v.responseType="arraybuffer"),v.onreadystatechange=()=>{if(v.readyState===XMLHttpRequest.DONE){if(v.status===200||v.status===0){let C;if(G&&v.response?C=new Uint8Array(v.response):!G&&v.responseText&&(C=(0,e.stringToBytes)(v.responseText)),C){A(C);return}}m(new Error(v.statusText))}},v.send(null)})}class t extends p.BaseCMapReaderFactory{_fetchData(G,A){return o(G,this.isCompressed).then(m=>({cMapData:m,compressionType:A}))}}c.DOMCMapReaderFactory=t;class a extends p.BaseStandardFontDataFactory{_fetchData(G){return o(G,!0)}}c.DOMStandardFontDataFactory=a;class g extends p.BaseSVGFactory{_createSVG(G){return document.createElementNS(s,G)}}c.DOMSVGFactory=g;class d{constructor({viewBox:G,scale:A,rotation:m,offsetX:v=0,offsetY:C=0,dontFlip:V=!1}){this.viewBox=G,this.scale=A,this.rotation=m,this.offsetX=v,this.offsetY=C;const W=(G[2]+G[0])/2,K=(G[3]+G[1])/2;let L,l,S,R;switch(m%=360,m<0&&(m+=360),m){case 180:L=-1,l=0,S=0,R=1;break;case 90:L=0,l=1,S=1,R=0;break;case 270:L=0,l=-1,S=-1,R=0;break;case 0:L=1,l=0,S=0,R=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}V&&(S=-S,R=-R);let O,B,Z,re;L===0?(O=Math.abs(K-G[1])*A+v,B=Math.abs(W-G[0])*A+C,Z=(G[3]-G[1])*A,re=(G[2]-G[0])*A):(O=Math.abs(W-G[0])*A+v,B=Math.abs(K-G[1])*A+C,Z=(G[2]-G[0])*A,re=(G[3]-G[1])*A),this.transform=[L*A,l*A,S*A,R*A,O-L*A*W-S*A*K,B-l*A*W-R*A*K],this.width=Z,this.height=re}get rawDims(){const{viewBox:G}=this;return(0,e.shadow)(this,"rawDims",{pageWidth:G[2]-G[0],pageHeight:G[3]-G[1],pageX:G[0],pageY:G[1]})}clone({scale:G=this.scale,rotation:A=this.rotation,offsetX:m=this.offsetX,offsetY:v=this.offsetY,dontFlip:C=!1}={}){return new d({viewBox:this.viewBox.slice(),scale:G,rotation:A,offsetX:m,offsetY:v,dontFlip:C})}convertToViewportPoint(G,A){return e.Util.applyTransform([G,A],this.transform)}convertToViewportRectangle(G){const A=e.Util.applyTransform([G[0],G[1]],this.transform),m=e.Util.applyTransform([G[2],G[3]],this.transform);return[A[0],A[1],m[0],m[1]]}convertToPdfPoint(G,A){return e.Util.applyInverseTransform([G,A],this.transform)}}c.PageViewport=d;class i extends e.BaseException{constructor(G,A=0){super(G,"RenderingCancelledException"),this.extraDelay=A}}c.RenderingCancelledException=i;function b(Ee){const G=Ee.length;let A=0;for(;A<G&&Ee[A].trim()==="";)A++;return Ee.substring(A,A+5).toLowerCase()==="data:"}function y(Ee){return typeof Ee=="string"&&/\.pdf$/i.test(Ee)}function f(Ee,G=!1){return G||([Ee]=Ee.split(/[#?]/,1)),Ee.substring(Ee.lastIndexOf("/")+1)}function T(Ee,G="document.pdf"){if(typeof Ee!="string")return G;if(b(Ee))return(0,e.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),G;const A=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,m=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,v=A.exec(Ee);let C=m.exec(v[1])||m.exec(v[2])||m.exec(v[3]);if(C&&(C=C[0],C.includes("%")))try{C=m.exec(decodeURIComponent(C))[0]}catch{}return C||G}class H{started=Object.create(null);times=[];time(G){G in this.started&&(0,e.warn)(`Timer is already running for ${G}`),this.started[G]=Date.now()}timeEnd(G){G in this.started||(0,e.warn)(`Timer has not been started for ${G}`),this.times.push({name:G,start:this.started[G],end:Date.now()}),delete this.started[G]}toString(){const G=[];let A=0;for(const{name:m}of this.times)A=Math.max(m.length,A);for(const{name:m,start:v,end:C}of this.times)G.push(`${m.padEnd(A)} ${C-v}ms
|
|
2
2
|
`);return G.join("")}}c.StatTimer=H;function I(Ee,G){try{const{protocol:A}=G?new URL(Ee,G):new URL(Ee);return A==="http:"||A==="https:"}catch{return!1}}function _(Ee){Ee.preventDefault()}function M(Ee,G=!1){return new Promise((A,m)=>{const v=document.createElement("script");v.src=Ee,v.onload=function(C){G&&v.remove(),A(C)},v.onerror=function(){m(new Error(`Cannot load script at: ${v.src}`))},(document.head||document.documentElement).append(v)})}function te(Ee){console.log("Deprecated API usage: "+Ee)}let ie;class Y{static toDateObject(G){if(!G||typeof G!="string")return null;ie||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const A=ie.exec(G);if(!A)return null;const m=parseInt(A[1],10);let v=parseInt(A[2],10);v=v>=1&&v<=12?v-1:0;let C=parseInt(A[3],10);C=C>=1&&C<=31?C:1;let V=parseInt(A[4],10);V=V>=0&&V<=23?V:0;let W=parseInt(A[5],10);W=W>=0&&W<=59?W:0;let K=parseInt(A[6],10);K=K>=0&&K<=59?K:0;const L=A[7]||"Z";let l=parseInt(A[8],10);l=l>=0&&l<=23?l:0;let S=parseInt(A[9],10)||0;return S=S>=0&&S<=59?S:0,L==="-"?(V+=l,W+=S):L==="+"&&(V-=l,W-=S),new Date(Date.UTC(m,v,C,V,W,K))}}c.PDFDateString=Y;function he(Ee,{scale:G=1,rotation:A=0}){const{width:m,height:v}=Ee.attributes.style,C=[0,0,parseInt(m),parseInt(v)];return new d({viewBox:C,scale:G,rotation:A})}function ge(Ee){if(Ee.startsWith("#")){const G=parseInt(Ee.slice(1),16);return[(G&16711680)>>16,(G&65280)>>8,G&255]}return Ee.startsWith("rgb(")?Ee.slice(4,-1).split(",").map(G=>parseInt(G)):Ee.startsWith("rgba(")?Ee.slice(5,-1).split(",").map(G=>parseInt(G)).slice(0,3):((0,e.warn)(`Not a valid color format: "${Ee}"`),[0,0,0])}function Ne(Ee){const G=document.createElement("span");G.style.visibility="hidden",document.body.append(G);for(const A of Ee.keys()){G.style.color=A;const m=window.getComputedStyle(G).color;Ee.set(A,ge(m))}G.remove()}function ke(Ee){const{a:G,b:A,c:m,d:v,e:C,f:V}=Ee.getTransform();return[G,A,m,v,C,V]}function Oe(Ee){const{a:G,b:A,c:m,d:v,e:C,f:V}=Ee.getTransform().invertSelf();return[G,A,m,v,C,V]}function Ve(Ee,G,A=!1,m=!0){if(G instanceof d){const{pageWidth:v,pageHeight:C}=G.rawDims,{style:V}=Ee,W=e.FeatureTest.isCSSRoundSupported,K=`var(--scale-factor) * ${v}px`,L=`var(--scale-factor) * ${C}px`,l=W?`round(${K}, 1px)`:`calc(${K})`,S=W?`round(${L}, 1px)`:`calc(${L})`;!A||G.rotation%180===0?(V.width=l,V.height=S):(V.width=S,V.height=l)}m&&Ee.setAttribute("data-main-rotation",G.rotation)}}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BaseStandardFontDataFactory=c.BaseSVGFactory=c.BaseFilterFactory=c.BaseCanvasFactory=c.BaseCMapReaderFactory=void 0;var p=q(1);class e{constructor(){this.constructor===e&&(0,p.unreachable)("Cannot initialize BaseFilterFactory.")}addFilter(t){return"none"}addHCMFilter(t,a){return"none"}addHighlightHCMFilter(t,a,g,d){return"none"}destroy(t=!1){}}c.BaseFilterFactory=e;class s{constructor(){this.constructor===s&&(0,p.unreachable)("Cannot initialize BaseCanvasFactory.")}create(t,a){if(t<=0||a<=0)throw new Error("Invalid canvas size");const g=this._createCanvas(t,a);return{canvas:g,context:g.getContext("2d")}}reset(t,a,g){if(!t.canvas)throw new Error("Canvas is not specified");if(a<=0||g<=0)throw new Error("Invalid canvas size");t.canvas.width=a,t.canvas.height=g}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,a){(0,p.unreachable)("Abstract method `_createCanvas` called.")}}c.BaseCanvasFactory=s;class N{constructor({baseUrl:t=null,isCompressed:a=!0}){this.constructor===N&&(0,p.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=t,this.isCompressed=a}async fetch({name:t}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!t)throw new Error("CMap name must be specified.");const a=this.baseUrl+t+(this.isCompressed?".bcmap":""),g=this.isCompressed?p.CMapCompressionType.BINARY:p.CMapCompressionType.NONE;return this._fetchData(a,g).catch(d=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${a}`)})}_fetchData(t,a){(0,p.unreachable)("Abstract method `_fetchData` called.")}}c.BaseCMapReaderFactory=N;class ee{constructor({baseUrl:t=null}){this.constructor===ee&&(0,p.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!t)throw new Error("Font filename must be specified.");const a=`${this.baseUrl}${t}`;return this._fetchData(a).catch(g=>{throw new Error(`Unable to load font data at: ${a}`)})}_fetchData(t){(0,p.unreachable)("Abstract method `_fetchData` called.")}}c.BaseStandardFontDataFactory=ee;class U{constructor(){this.constructor===U&&(0,p.unreachable)("Cannot initialize BaseSVGFactory.")}create(t,a,g=!1){if(t<=0||a<=0)throw new Error("Invalid SVG dimensions");const d=this._createSVG("svg:svg");return d.setAttribute("version","1.1"),g||(d.setAttribute("width",`${t}px`),d.setAttribute("height",`${a}px`)),d.setAttribute("preserveAspectRatio","none"),d.setAttribute("viewBox",`0 0 ${t} ${a}`),d}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){(0,p.unreachable)("Abstract method `_createSVG` called.")}}c.BaseSVGFactory=U}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.MurmurHash3_64=void 0;var p=q(1);const e=3285377520,s=4294901760,N=65535;class ee{constructor(o){this.h1=o?o&4294967295:e,this.h2=o?o&4294967295:e}update(o){let t,a;if(typeof o=="string"){t=new Uint8Array(o.length*2),a=0;for(let te=0,ie=o.length;te<ie;te++){const Y=o.charCodeAt(te);Y<=255?t[a++]=Y:(t[a++]=Y>>>8,t[a++]=Y&255)}}else if((0,p.isArrayBuffer)(o))t=o.slice(),a=t.byteLength;else throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");const g=a>>2,d=a-g*4,i=new Uint32Array(t.buffer,0,g);let b=0,y=0,f=this.h1,T=this.h2;const H=3432918353,I=461845907,_=H&N,M=I&N;for(let te=0;te<g;te++)te&1?(b=i[te],b=b*H&s|b*_&N,b=b<<15|b>>>17,b=b*I&s|b*M&N,f^=b,f=f<<13|f>>>19,f=f*5+3864292196):(y=i[te],y=y*H&s|y*_&N,y=y<<15|y>>>17,y=y*I&s|y*M&N,T^=y,T=T<<13|T>>>19,T=T*5+3864292196);switch(b=0,d){case 3:b^=t[g*4+2]<<16;case 2:b^=t[g*4+1]<<8;case 1:b^=t[g*4],b=b*H&s|b*_&N,b=b<<15|b>>>17,b=b*I&s|b*M&N,g&1?f^=b:T^=b}this.h1=f,this.h2=T}hexdigest(){let o=this.h1,t=this.h2;return o^=t>>>1,o=o*3981806797&s|o*36045&N,t=t*4283543511&s|((t<<16|o>>>16)*2950163797&s)>>>16,o^=t>>>1,o=o*444984403&s|o*60499&N,t=t*3301882366&s|((t<<16|o>>>16)*3120437893&s)>>>16,o^=t>>>1,(o>>>0).toString(16).padStart(8,"0")+(t>>>0).toString(16).padStart(8,"0")}}c.MurmurHash3_64=ee}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.FontLoader=c.FontFaceObject=void 0;var p=q(1);class e{#e=new Set;constructor({ownerDocument:ee=globalThis.document,styleElement:U=null}){this._document=ee,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(ee){this.nativeFontFaces.add(ee),this._document.fonts.add(ee)}removeNativeFontFace(ee){this.nativeFontFaces.delete(ee),this._document.fonts.delete(ee)}insertRule(ee){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const U=this.styleElement.sheet;U.insertRule(ee,U.cssRules.length)}clear(){for(const ee of this.nativeFontFaces)this._document.fonts.delete(ee);this.nativeFontFaces.clear(),this.#e.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont(ee){if(!(!ee||this.#e.has(ee.loadedName))){if((0,p.assert)(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:U,src:o,style:t}=ee,a=new FontFace(U,o,t);this.addNativeFontFace(a);try{await a.load(),this.#e.add(U)}catch{(0,p.warn)(`Cannot load system font: ${ee.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(a)}return}(0,p.unreachable)("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(ee){if(ee.attached||ee.missingFile&&!ee.systemFontInfo)return;if(ee.attached=!0,ee.systemFontInfo){await this.loadSystemFont(ee.systemFontInfo);return}if(this.isFontLoadingAPISupported){const o=ee.createNativeFontFace();if(o){this.addNativeFontFace(o);try{await o.loaded}catch(t){throw(0,p.warn)(`Failed to load font '${o.family}': '${t}'.`),ee.disableFontFace=!0,t}}return}const U=ee.createFontFaceRule();if(U){if(this.insertRule(U),this.isSyncFontLoadingSupported)return;await new Promise(o=>{const t=this._queueLoadingCallback(o);this._prepareFontLoadEvent(ee,t)})}}get isFontLoadingAPISupported(){const ee=!!this._document?.fonts;return(0,p.shadow)(this,"isFontLoadingAPISupported",ee)}get isSyncFontLoadingSupported(){let ee=!1;return(p.isNodeJS||typeof navigator<"u"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(ee=!0),(0,p.shadow)(this,"isSyncFontLoadingSupported",ee)}_queueLoadingCallback(ee){function U(){for((0,p.assert)(!t.done,"completeRequest() cannot be called twice."),t.done=!0;o.length>0&&o[0].done;){const a=o.shift();setTimeout(a.callback,0)}}const{loadingRequests:o}=this,t={done:!1,complete:U,callback:ee};return o.push(t),t}get _loadTestFont(){const ee=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return(0,p.shadow)(this,"_loadTestFont",ee)}_prepareFontLoadEvent(ee,U){function o(he,ge){return he.charCodeAt(ge)<<24|he.charCodeAt(ge+1)<<16|he.charCodeAt(ge+2)<<8|he.charCodeAt(ge+3)&255}function t(he,ge,Ne,ke){const Oe=he.substring(0,ge),Ve=he.substring(ge+Ne);return Oe+ke+Ve}let a,g;const d=this._document.createElement("canvas");d.width=1,d.height=1;const i=d.getContext("2d");let b=0;function y(he,ge){if(++b>30){(0,p.warn)("Load test font never loaded."),ge();return}if(i.font="30px "+he,i.fillText(".",0,20),i.getImageData(0,0,1,1).data[3]>0){ge();return}setTimeout(y.bind(null,he,ge))}const f=`lt${Date.now()}${this.loadTestFontId++}`;let T=this._loadTestFont;T=t(T,976,f.length,f);const I=16,_=1482184792;let M=o(T,I);for(a=0,g=f.length-3;a<g;a+=4)M=M-_+o(f,a)|0;a<f.length&&(M=M-_+o(f+"XXX",a)|0),T=t(T,I,4,(0,p.string32)(M));const te=`url(data:font/opentype;base64,${btoa(T)});`,ie=`@font-face {font-family:"${f}";src:${te}}`;this.insertRule(ie);const Y=this._document.createElement("div");Y.style.visibility="hidden",Y.style.width=Y.style.height="10px",Y.style.position="absolute",Y.style.top=Y.style.left="0px";for(const he of[ee.loadedName,f]){const ge=this._document.createElement("span");ge.textContent="Hi",ge.style.fontFamily=he,Y.append(ge)}this._document.body.append(Y),y(f,()=>{Y.remove(),U.complete()})}}c.FontLoader=e;class s{constructor(ee,{isEvalSupported:U=!0,disableFontFace:o=!1,ignoreErrors:t=!1,inspectFont:a=null}){this.compiledGlyphs=Object.create(null);for(const g in ee)this[g]=ee[g];this.isEvalSupported=U!==!1,this.disableFontFace=o===!0,this.ignoreErrors=t===!0,this._inspectFont=a}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let ee;if(!this.cssFontInfo)ee=new FontFace(this.loadedName,this.data,{});else{const U={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(U.style=`oblique ${this.cssFontInfo.italicAngle}deg`),ee=new FontFace(this.cssFontInfo.fontFamily,this.data,U)}return this._inspectFont?.(this),ee}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const ee=(0,p.bytesToString)(this.data),U=`url(data:${this.mimetype};base64,${btoa(ee)});`;let o;if(!this.cssFontInfo)o=`@font-face {font-family:"${this.loadedName}";src:${U}}`;else{let t=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(t+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),o=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${t}src:${U}}`}return this._inspectFont?.(this,U),o}getPathGenerator(ee,U){if(this.compiledGlyphs[U]!==void 0)return this.compiledGlyphs[U];let o;try{o=ee.get(this.loadedName+"_path_"+U)}catch(t){if(!this.ignoreErrors)throw t;return(0,p.warn)(`getPathGenerator - ignoring character: "${t}".`),this.compiledGlyphs[U]=function(a,g){}}if(this.isEvalSupported&&p.FeatureTest.isEvalSupported){const t=[];for(const a of o){const g=a.args!==void 0?a.args.join(","):"";t.push("c.",a.cmd,"(",g,`);
|
|
3
3
|
`)}return this.compiledGlyphs[U]=new Function("c","size",t.join(""))}return this.compiledGlyphs[U]=function(t,a){for(const g of o)g.cmd==="scale"&&(g.args=[a,-a]),t[g.cmd].apply(t,g.args)}}}c.FontFaceObject=s}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.NodeStandardFontDataFactory=c.NodeFilterFactory=c.NodeCanvasFactory=c.NodeCMapReaderFactory=void 0;var p=q(7);q(1);const e=function(o){return new Promise((t,a)=>{index.require$$5.readFile(o,(d,i)=>{if(d||!i){a(new Error(d));return}t(new Uint8Array(i))})})};class s extends p.BaseFilterFactory{}c.NodeFilterFactory=s;class N extends p.BaseCanvasFactory{_createCanvas(t,a){return index.require$$5.createCanvas(t,a)}}c.NodeCanvasFactory=N;class ee extends p.BaseCMapReaderFactory{_fetchData(t,a){return e(t).then(g=>({cMapData:g,compressionType:a}))}}c.NodeCMapReaderFactory=ee;class U extends p.BaseStandardFontDataFactory{_fetchData(t){return e(t)}}c.NodeStandardFontDataFactory=U}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.CanvasGraphics=void 0;var p=q(1),e=q(6),s=q(12),N=q(13);const ee=16,U=100,o=4096,t=15,a=10,g=1e3,d=16;function i(A,m){if(A._removeMirroring)throw new Error("Context is already forwarding operations.");A.__originalSave=A.save,A.__originalRestore=A.restore,A.__originalRotate=A.rotate,A.__originalScale=A.scale,A.__originalTranslate=A.translate,A.__originalTransform=A.transform,A.__originalSetTransform=A.setTransform,A.__originalResetTransform=A.resetTransform,A.__originalClip=A.clip,A.__originalMoveTo=A.moveTo,A.__originalLineTo=A.lineTo,A.__originalBezierCurveTo=A.bezierCurveTo,A.__originalRect=A.rect,A.__originalClosePath=A.closePath,A.__originalBeginPath=A.beginPath,A._removeMirroring=()=>{A.save=A.__originalSave,A.restore=A.__originalRestore,A.rotate=A.__originalRotate,A.scale=A.__originalScale,A.translate=A.__originalTranslate,A.transform=A.__originalTransform,A.setTransform=A.__originalSetTransform,A.resetTransform=A.__originalResetTransform,A.clip=A.__originalClip,A.moveTo=A.__originalMoveTo,A.lineTo=A.__originalLineTo,A.bezierCurveTo=A.__originalBezierCurveTo,A.rect=A.__originalRect,A.closePath=A.__originalClosePath,A.beginPath=A.__originalBeginPath,delete A._removeMirroring},A.save=function(){m.save(),this.__originalSave()},A.restore=function(){m.restore(),this.__originalRestore()},A.translate=function(C,V){m.translate(C,V),this.__originalTranslate(C,V)},A.scale=function(C,V){m.scale(C,V),this.__originalScale(C,V)},A.transform=function(C,V,W,K,L,l){m.transform(C,V,W,K,L,l),this.__originalTransform(C,V,W,K,L,l)},A.setTransform=function(C,V,W,K,L,l){m.setTransform(C,V,W,K,L,l),this.__originalSetTransform(C,V,W,K,L,l)},A.resetTransform=function(){m.resetTransform(),this.__originalResetTransform()},A.rotate=function(C){m.rotate(C),this.__originalRotate(C)},A.clip=function(C){m.clip(C),this.__originalClip(C)},A.moveTo=function(v,C){m.moveTo(v,C),this.__originalMoveTo(v,C)},A.lineTo=function(v,C){m.lineTo(v,C),this.__originalLineTo(v,C)},A.bezierCurveTo=function(v,C,V,W,K,L){m.bezierCurveTo(v,C,V,W,K,L),this.__originalBezierCurveTo(v,C,V,W,K,L)},A.rect=function(v,C,V,W){m.rect(v,C,V,W),this.__originalRect(v,C,V,W)},A.closePath=function(){m.closePath(),this.__originalClosePath()},A.beginPath=function(){m.beginPath(),this.__originalBeginPath()}}class b{constructor(m){this.canvasFactory=m,this.cache=Object.create(null)}getCanvas(m,v,C){let V;return this.cache[m]!==void 0?(V=this.cache[m],this.canvasFactory.reset(V,v,C)):(V=this.canvasFactory.create(v,C),this.cache[m]=V),V}delete(m){delete this.cache[m]}clear(){for(const m in this.cache){const v=this.cache[m];this.canvasFactory.destroy(v),delete this.cache[m]}}}function y(A,m,v,C,V,W,K,L,l,S){const[R,O,B,Z,re,me]=(0,e.getCurrentTransform)(A);if(O===0&&B===0){const ye=K*R+re,Ce=Math.round(ye),Re=L*Z+me,xe=Math.round(Re),qe=(K+l)*R+re,tt=Math.abs(Math.round(qe)-Ce)||1,lt=(L+S)*Z+me,vt=Math.abs(Math.round(lt)-xe)||1;return A.setTransform(Math.sign(R),0,0,Math.sign(Z),Ce,xe),A.drawImage(m,v,C,V,W,0,0,tt,vt),A.setTransform(R,O,B,Z,re,me),[tt,vt]}if(R===0&&Z===0){const ye=L*B+re,Ce=Math.round(ye),Re=K*O+me,xe=Math.round(Re),qe=(L+S)*B+re,tt=Math.abs(Math.round(qe)-Ce)||1,lt=(K+l)*O+me,vt=Math.abs(Math.round(lt)-xe)||1;return A.setTransform(0,Math.sign(O),Math.sign(B),0,Ce,xe),A.drawImage(m,v,C,V,W,0,0,vt,tt),A.setTransform(R,O,B,Z,re,me),[vt,tt]}A.drawImage(m,v,C,V,W,K,L,l,S);const We=Math.hypot(R,O),ve=Math.hypot(B,Z);return[We*l,ve*S]}function f(A){const{width:m,height:v}=A;if(m>g||v>g)return null;const C=1e3,V=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),W=m+1;let K=new Uint8Array(W*(v+1)),L,l,S;const R=m+7&-8;let O=new Uint8Array(R*v),B=0;for(const ve of A.data){let ye=128;for(;ye>0;)O[B++]=ve&ye?0:255,ye>>=1}let Z=0;for(B=0,O[B]!==0&&(K[0]=1,++Z),l=1;l<m;l++)O[B]!==O[B+1]&&(K[l]=O[B]?2:1,++Z),B++;for(O[B]!==0&&(K[l]=2,++Z),L=1;L<v;L++){B=L*R,S=L*W,O[B-R]!==O[B]&&(K[S]=O[B]?1:8,++Z);let ve=(O[B]?4:0)+(O[B-R]?8:0);for(l=1;l<m;l++)ve=(ve>>2)+(O[B+1]?4:0)+(O[B-R+1]?8:0),V[ve]&&(K[S+l]=V[ve],++Z),B++;if(O[B-R]!==O[B]&&(K[S+l]=O[B]?2:4,++Z),Z>C)return null}for(B=R*(v-1),S=L*W,O[B]!==0&&(K[S]=8,++Z),l=1;l<m;l++)O[B]!==O[B+1]&&(K[S+l]=O[B]?4:8,++Z),B++;if(O[B]!==0&&(K[S+l]=4,++Z),Z>C)return null;const re=new Int32Array([0,W,-1,0,-W,0,0,0,1]),me=new Path2D;for(L=0;Z&&L<=v;L++){let ve=L*W;const ye=ve+m;for(;ve<ye&&!K[ve];)ve++;if(ve===ye)continue;me.moveTo(ve%W,L);const Ce=ve;let Re=K[ve];do{const xe=re[Re];do ve+=xe;while(!K[ve]);const qe=K[ve];qe!==5&&qe!==10?(Re=qe,K[ve]=0):(Re=qe&51*Re>>4,K[ve]&=Re>>2|Re<<2),me.lineTo(ve%W,ve/W|0),K[ve]||--Z}while(Ce!==ve);--L}return O=null,K=null,function(ve){ve.save(),ve.scale(1/m,-1/v),ve.translate(0,-v),ve.fill(me),ve.beginPath(),ve.restore()}}class T{constructor(m,v){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=p.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=p.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=p.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,m,v])}clone(){const m=Object.create(this);return m.clipBox=this.clipBox.slice(),m}setCurrentPoint(m,v){this.x=m,this.y=v}updatePathMinMax(m,v,C){[v,C]=p.Util.applyTransform([v,C],m),this.minX=Math.min(this.minX,v),this.minY=Math.min(this.minY,C),this.maxX=Math.max(this.maxX,v),this.maxY=Math.max(this.maxY,C)}updateRectMinMax(m,v){const C=p.Util.applyTransform(v,m),V=p.Util.applyTransform(v.slice(2),m);this.minX=Math.min(this.minX,C[0],V[0]),this.minY=Math.min(this.minY,C[1],V[1]),this.maxX=Math.max(this.maxX,C[0],V[0]),this.maxY=Math.max(this.maxY,C[1],V[1])}updateScalingPathMinMax(m,v){p.Util.scaleMinMax(m,v),this.minX=Math.min(this.minX,v[0]),this.maxX=Math.max(this.maxX,v[1]),this.minY=Math.min(this.minY,v[2]),this.maxY=Math.max(this.maxY,v[3])}updateCurvePathMinMax(m,v,C,V,W,K,L,l,S,R){const O=p.Util.bezierBoundingBox(v,C,V,W,K,L,l,S);if(R){R[0]=Math.min(R[0],O[0],O[2]),R[1]=Math.max(R[1],O[0],O[2]),R[2]=Math.min(R[2],O[1],O[3]),R[3]=Math.max(R[3],O[1],O[3]);return}this.updateRectMinMax(m,O)}getPathBoundingBox(m=s.PathType.FILL,v=null){const C=[this.minX,this.minY,this.maxX,this.maxY];if(m===s.PathType.STROKE){v||(0,p.unreachable)("Stroke bounding box must include transform.");const V=p.Util.singularValueDecompose2dScale(v),W=V[0]*this.lineWidth/2,K=V[1]*this.lineWidth/2;C[0]-=W,C[1]-=K,C[2]+=W,C[3]+=K}return C}updateClipFromPath(){const m=p.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(m||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(m){this.clipBox=m,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(m=s.PathType.FILL,v=null){return p.Util.intersect(this.clipBox,this.getPathBoundingBox(m,v))}}function H(A,m){if(typeof ImageData<"u"&&m instanceof ImageData){A.putImageData(m,0,0);return}const v=m.height,C=m.width,V=v%d,W=(v-V)/d,K=V===0?W:W+1,L=A.createImageData(C,d);let l=0,S;const R=m.data,O=L.data;let B,Z,re,me;if(m.kind===p.ImageKind.GRAYSCALE_1BPP){const We=R.byteLength,ve=new Uint32Array(O.buffer,0,O.byteLength>>2),ye=ve.length,Ce=C+7>>3,Re=4294967295,xe=p.FeatureTest.isLittleEndian?4278190080:255;for(B=0;B<K;B++){for(re=B<W?d:V,S=0,Z=0;Z<re;Z++){const qe=We-l;let tt=0;const lt=qe>Ce?C:qe*8-7,vt=lt&-8;let bt=0,Ft=0;for(;tt<vt;tt+=8)Ft=R[l++],ve[S++]=Ft&128?Re:xe,ve[S++]=Ft&64?Re:xe,ve[S++]=Ft&32?Re:xe,ve[S++]=Ft&16?Re:xe,ve[S++]=Ft&8?Re:xe,ve[S++]=Ft&4?Re:xe,ve[S++]=Ft&2?Re:xe,ve[S++]=Ft&1?Re:xe;for(;tt<lt;tt++)bt===0&&(Ft=R[l++],bt=128),ve[S++]=Ft&bt?Re:xe,bt>>=1}for(;S<ye;)ve[S++]=0;A.putImageData(L,0,B*d)}}else if(m.kind===p.ImageKind.RGBA_32BPP){for(Z=0,me=C*d*4,B=0;B<W;B++)O.set(R.subarray(l,l+me)),l+=me,A.putImageData(L,0,Z),Z+=d;B<K&&(me=C*V*4,O.set(R.subarray(l,l+me)),A.putImageData(L,0,Z))}else if(m.kind===p.ImageKind.RGB_24BPP)for(re=d,me=C*re,B=0;B<K;B++){for(B>=W&&(re=V,me=C*re),S=0,Z=me;Z--;)O[S++]=R[l++],O[S++]=R[l++],O[S++]=R[l++],O[S++]=255;A.putImageData(L,0,B*d)}else throw new Error(`bad image kind: ${m.kind}`)}function I(A,m){if(m.bitmap){A.drawImage(m.bitmap,0,0);return}const v=m.height,C=m.width,V=v%d,W=(v-V)/d,K=V===0?W:W+1,L=A.createImageData(C,d);let l=0;const S=m.data,R=L.data;for(let O=0;O<K;O++){const B=O<W?d:V;({srcPos:l}=(0,N.convertBlackAndWhiteToRGBA)({src:S,srcPos:l,dest:R,width:C,height:B,nonBlackColor:0})),A.putImageData(L,0,O*d)}}function _(A,m){const v=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const C of v)A[C]!==void 0&&(m[C]=A[C]);A.setLineDash!==void 0&&(m.setLineDash(A.getLineDash()),m.lineDashOffset=A.lineDashOffset)}function M(A){if(A.strokeStyle=A.fillStyle="#000000",A.fillRule="nonzero",A.globalAlpha=1,A.lineWidth=1,A.lineCap="butt",A.lineJoin="miter",A.miterLimit=10,A.globalCompositeOperation="source-over",A.font="10px sans-serif",A.setLineDash!==void 0&&(A.setLineDash([]),A.lineDashOffset=0),!p.isNodeJS){const{filter:m}=A;m!=="none"&&m!==""&&(A.filter="none")}}function te(A,m,v,C){const V=A.length;for(let W=3;W<V;W+=4){const K=A[W];if(K===0)A[W-3]=m,A[W-2]=v,A[W-1]=C;else if(K<255){const L=255-K;A[W-3]=A[W-3]*K+m*L>>8,A[W-2]=A[W-2]*K+v*L>>8,A[W-1]=A[W-1]*K+C*L>>8}}}function ie(A,m,v){const C=A.length,V=1/255;for(let W=3;W<C;W+=4){const K=v?v[A[W]]:A[W];m[W]=m[W]*K*V|0}}function Y(A,m,v){const C=A.length;for(let V=3;V<C;V+=4){const W=A[V-3]*77+A[V-2]*152+A[V-1]*28;m[V]=v?m[V]*v[W>>8]>>8:m[V]*W>>16}}function he(A,m,v,C,V,W,K,L,l,S,R){const O=!!W,B=O?W[0]:0,Z=O?W[1]:0,re=O?W[2]:0,me=V==="Luminosity"?Y:ie,ve=Math.min(C,Math.ceil(1048576/v));for(let ye=0;ye<C;ye+=ve){const Ce=Math.min(ve,C-ye),Re=A.getImageData(L-S,ye+(l-R),v,Ce),xe=m.getImageData(L,ye+l,v,Ce);O&&te(Re.data,B,Z,re),me(Re.data,xe.data,K),m.putImageData(xe,L,ye+l)}}function ge(A,m,v,C){const V=C[0],W=C[1],K=C[2]-V,L=C[3]-W;K===0||L===0||(he(m.context,v,K,L,m.subtype,m.backdrop,m.transferMap,V,W,m.offsetX,m.offsetY),A.save(),A.globalAlpha=1,A.globalCompositeOperation="source-over",A.setTransform(1,0,0,1,0,0),A.drawImage(v.canvas,0,0),A.restore())}function Ne(A,m){const v=p.Util.singularValueDecompose2dScale(A);v[0]=Math.fround(v[0]),v[1]=Math.fround(v[1]);const C=Math.fround((globalThis.devicePixelRatio||1)*e.PixelsPerInch.PDF_TO_CSS_UNITS);return m!==void 0?m:v[0]<=C||v[1]<=C}const ke=["butt","round","square"],Oe=["miter","round","bevel"],Ve={},Ee={};class G{constructor(m,v,C,V,W,{optionalContentConfig:K,markedContentStack:L=null},l,S){this.ctx=m,this.current=new T(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=v,this.objs=C,this.canvasFactory=V,this.filterFactory=W,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=L||[],this.optionalContentConfig=K,this.cachedCanvases=new b(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=l,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=S,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(m,v=null){return typeof m=="string"?m.startsWith("g_")?this.commonObjs.get(m):this.objs.get(m):v}beginDrawing({transform:m,viewport:v,transparency:C=!1,background:V=null}){const W=this.ctx.canvas.width,K=this.ctx.canvas.height,L=this.ctx.fillStyle;if(this.ctx.fillStyle=V||"#ffffff",this.ctx.fillRect(0,0,W,K),this.ctx.fillStyle=L,C){const l=this.cachedCanvases.getCanvas("transparent",W,K);this.compositeCtx=this.ctx,this.transparentCanvas=l.canvas,this.ctx=l.context,this.ctx.save(),this.ctx.transform(...(0,e.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),M(this.ctx),m&&(this.ctx.transform(...m),this.outputScaleX=m[0],this.outputScaleY=m[0]),this.ctx.transform(...v.transform),this.viewportScale=v.scale,this.baseTransform=(0,e.getCurrentTransform)(this.ctx)}executeOperatorList(m,v,C,V){const W=m.argsArray,K=m.fnArray;let L=v||0;const l=W.length;if(l===L)return L;const S=l-L>a&&typeof C=="function",R=S?Date.now()+t:0;let O=0;const B=this.commonObjs,Z=this.objs;let re;for(;;){if(V!==void 0&&L===V.nextBreakPoint)return V.breakIt(L,C),L;if(re=K[L],re!==p.OPS.dependency)this[re].apply(this,W[L]);else for(const me of W[L]){const We=me.startsWith("g_")?B:Z;if(!We.has(me))return We.get(me,C),L}if(L++,L===l)return L;if(S&&++O>a){if(Date.now()>R)return C(),L;O=0}}}#e(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}endDrawing(){this.#e(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const m of this._cachedBitmapsMap.values()){for(const v of m.values())typeof HTMLCanvasElement<"u"&&v instanceof HTMLCanvasElement&&(v.width=v.height=0);m.clear()}this._cachedBitmapsMap.clear(),this.#t()}#t(){if(this.pageColors){const m=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(m!=="none"){const v=this.ctx.filter;this.ctx.filter=m,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=v}}}_scaleImage(m,v){const C=m.width,V=m.height;let W=Math.max(Math.hypot(v[0],v[1]),1),K=Math.max(Math.hypot(v[2],v[3]),1),L=C,l=V,S="prescale1",R,O;for(;W>2&&L>1||K>2&&l>1;){let B=L,Z=l;W>2&&L>1&&(B=L>=16384?Math.floor(L/2)-1||1:Math.ceil(L/2),W/=L/B),K>2&&l>1&&(Z=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l)/2,K/=l/Z),R=this.cachedCanvases.getCanvas(S,B,Z),O=R.context,O.clearRect(0,0,B,Z),O.drawImage(m,0,0,L,l,0,0,B,Z),m=R.canvas,L=B,l=Z,S=S==="prescale1"?"prescale2":"prescale1"}return{img:m,paintWidth:L,paintHeight:l}}_createMaskCanvas(m){const v=this.ctx,{width:C,height:V}=m,W=this.current.fillColor,K=this.current.patternFill,L=(0,e.getCurrentTransform)(v);let l,S,R,O;if((m.bitmap||m.data)&&m.count>1){const tt=m.bitmap||m.data.buffer;S=JSON.stringify(K?L:[L.slice(0,4),W]),l=this._cachedBitmapsMap.get(tt),l||(l=new Map,this._cachedBitmapsMap.set(tt,l));const lt=l.get(S);if(lt&&!K){const vt=Math.round(Math.min(L[0],L[2])+L[4]),bt=Math.round(Math.min(L[1],L[3])+L[5]);return{canvas:lt,offsetX:vt,offsetY:bt}}R=lt}R||(O=this.cachedCanvases.getCanvas("maskCanvas",C,V),I(O.context,m));let B=p.Util.transform(L,[1/C,0,0,-1/V,0,0]);B=p.Util.transform(B,[1,0,0,1,0,-V]);const Z=p.Util.applyTransform([0,0],B),re=p.Util.applyTransform([C,V],B),me=p.Util.normalizeRect([Z[0],Z[1],re[0],re[1]]),We=Math.round(me[2]-me[0])||1,ve=Math.round(me[3]-me[1])||1,ye=this.cachedCanvases.getCanvas("fillCanvas",We,ve),Ce=ye.context,Re=Math.min(Z[0],re[0]),xe=Math.min(Z[1],re[1]);Ce.translate(-Re,-xe),Ce.transform(...B),R||(R=this._scaleImage(O.canvas,(0,e.getCurrentTransformInverse)(Ce)),R=R.img,l&&K&&l.set(S,R)),Ce.imageSmoothingEnabled=Ne((0,e.getCurrentTransform)(Ce),m.interpolate),y(Ce,R,0,0,R.width,R.height,0,0,C,V),Ce.globalCompositeOperation="source-in";const qe=p.Util.transform((0,e.getCurrentTransformInverse)(Ce),[1,0,0,1,-Re,-xe]);return Ce.fillStyle=K?W.getPattern(v,this,qe,s.PathType.FILL):W,Ce.fillRect(0,0,C,V),l&&!K&&(this.cachedCanvases.delete("fillCanvas"),l.set(S,ye.canvas)),{canvas:ye.canvas,offsetX:Math.round(Re),offsetY:Math.round(xe)}}setLineWidth(m){m!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=m,this.ctx.lineWidth=m}setLineCap(m){this.ctx.lineCap=ke[m]}setLineJoin(m){this.ctx.lineJoin=Oe[m]}setMiterLimit(m){this.ctx.miterLimit=m}setDash(m,v){const C=this.ctx;C.setLineDash!==void 0&&(C.setLineDash(m),C.lineDashOffset=v)}setRenderingIntent(m){}setFlatness(m){}setGState(m){for(const[v,C]of m)switch(v){case"LW":this.setLineWidth(C);break;case"LC":this.setLineCap(C);break;case"LJ":this.setLineJoin(C);break;case"ML":this.setMiterLimit(C);break;case"D":this.setDash(C[0],C[1]);break;case"RI":this.setRenderingIntent(C);break;case"FL":this.setFlatness(C);break;case"Font":this.setFont(C[0],C[1]);break;case"CA":this.current.strokeAlpha=C;break;case"ca":this.current.fillAlpha=C,this.ctx.globalAlpha=C;break;case"BM":this.ctx.globalCompositeOperation=C;break;case"SMask":this.current.activeSMask=C?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(C);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const m=this.inSMaskMode;this.current.activeSMask&&!m?this.beginSMaskMode():!this.current.activeSMask&&m&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const m=this.ctx.canvas.width,v=this.ctx.canvas.height,C="smaskGroupAt"+this.groupLevel,V=this.cachedCanvases.getCanvas(C,m,v);this.suspendedCtx=this.ctx,this.ctx=V.context;const W=this.ctx;W.setTransform(...(0,e.getCurrentTransform)(this.suspendedCtx)),_(this.suspendedCtx,W),i(W,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),_(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(m){if(!this.current.activeSMask)return;m?(m[0]=Math.floor(m[0]),m[1]=Math.floor(m[1]),m[2]=Math.ceil(m[2]),m[3]=Math.ceil(m[3])):m=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const v=this.current.activeSMask,C=this.suspendedCtx;ge(C,v,this.ctx,m),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?(_(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const m=this.current;this.stateStack.push(m),this.current=m.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),_(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(m,v,C,V,W,K){this.ctx.transform(m,v,C,V,W,K),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(m,v,C){const V=this.ctx,W=this.current;let K=W.x,L=W.y,l,S;const R=(0,e.getCurrentTransform)(V),O=R[0]===0&&R[3]===0||R[1]===0&&R[2]===0,B=O?C.slice(0):null;for(let Z=0,re=0,me=m.length;Z<me;Z++)switch(m[Z]|0){case p.OPS.rectangle:K=v[re++],L=v[re++];const We=v[re++],ve=v[re++],ye=K+We,Ce=L+ve;V.moveTo(K,L),We===0||ve===0?V.lineTo(ye,Ce):(V.lineTo(ye,L),V.lineTo(ye,Ce),V.lineTo(K,Ce)),O||W.updateRectMinMax(R,[K,L,ye,Ce]),V.closePath();break;case p.OPS.moveTo:K=v[re++],L=v[re++],V.moveTo(K,L),O||W.updatePathMinMax(R,K,L);break;case p.OPS.lineTo:K=v[re++],L=v[re++],V.lineTo(K,L),O||W.updatePathMinMax(R,K,L);break;case p.OPS.curveTo:l=K,S=L,K=v[re+4],L=v[re+5],V.bezierCurveTo(v[re],v[re+1],v[re+2],v[re+3],K,L),W.updateCurvePathMinMax(R,l,S,v[re],v[re+1],v[re+2],v[re+3],K,L,B),re+=6;break;case p.OPS.curveTo2:l=K,S=L,V.bezierCurveTo(K,L,v[re],v[re+1],v[re+2],v[re+3]),W.updateCurvePathMinMax(R,l,S,K,L,v[re],v[re+1],v[re+2],v[re+3],B),K=v[re+2],L=v[re+3],re+=4;break;case p.OPS.curveTo3:l=K,S=L,K=v[re+2],L=v[re+3],V.bezierCurveTo(v[re],v[re+1],K,L,K,L),W.updateCurvePathMinMax(R,l,S,v[re],v[re+1],K,L,K,L,B),re+=4;break;case p.OPS.closePath:V.closePath();break}O&&W.updateScalingPathMinMax(R,B),W.setCurrentPoint(K,L)}closePath(){this.ctx.closePath()}stroke(m=!0){const v=this.ctx,C=this.current.strokeColor;v.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof C=="object"&&C?.getPattern?(v.save(),v.strokeStyle=C.getPattern(v,this,(0,e.getCurrentTransformInverse)(v),s.PathType.STROKE),this.rescaleAndStroke(!1),v.restore()):this.rescaleAndStroke(!0)),m&&this.consumePath(this.current.getClippedPathBoundingBox()),v.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(m=!0){const v=this.ctx,C=this.current.fillColor,V=this.current.patternFill;let W=!1;V&&(v.save(),v.fillStyle=C.getPattern(v,this,(0,e.getCurrentTransformInverse)(v),s.PathType.FILL),W=!0);const K=this.current.getClippedPathBoundingBox();this.contentVisible&&K!==null&&(this.pendingEOFill?(v.fill("evenodd"),this.pendingEOFill=!1):v.fill()),W&&v.restore(),m&&this.consumePath(K)}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=Ve}eoClip(){this.pendingClip=Ee}beginText(){this.current.textMatrix=p.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const m=this.pendingTextPaths,v=this.ctx;if(m===void 0){v.beginPath();return}v.save(),v.beginPath();for(const C of m)v.setTransform(...C.transform),v.translate(C.x,C.y),C.addToPath(v,C.fontSize);v.restore(),v.clip(),v.beginPath(),delete this.pendingTextPaths}setCharSpacing(m){this.current.charSpacing=m}setWordSpacing(m){this.current.wordSpacing=m}setHScale(m){this.current.textHScale=m/100}setLeading(m){this.current.leading=-m}setFont(m,v){const C=this.commonObjs.get(m),V=this.current;if(!C)throw new Error(`Can't find font for ${m}`);if(V.fontMatrix=C.fontMatrix||p.FONT_IDENTITY_MATRIX,(V.fontMatrix[0]===0||V.fontMatrix[3]===0)&&(0,p.warn)("Invalid font matrix for font "+m),v<0?(v=-v,V.fontDirection=-1):V.fontDirection=1,this.current.font=C,this.current.fontSize=v,C.isType3Font)return;const W=C.loadedName||"sans-serif",K=C.systemFontInfo?.css||`"${W}", ${C.fallbackName}`;let L="normal";C.black?L="900":C.bold&&(L="bold");const l=C.italic?"italic":"normal";let S=v;v<ee?S=ee:v>U&&(S=U),this.current.fontSizeScale=v/S,this.ctx.font=`${l} ${L} ${S}px ${K}`}setTextRenderingMode(m){this.current.textRenderingMode=m}setTextRise(m){this.current.textRise=m}moveText(m,v){this.current.x=this.current.lineX+=m,this.current.y=this.current.lineY+=v}setLeadingMoveText(m,v){this.setLeading(-v),this.moveText(m,v)}setTextMatrix(m,v,C,V,W,K){this.current.textMatrix=[m,v,C,V,W,K],this.current.textMatrixScale=Math.hypot(m,v),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(m,v,C,V){const W=this.ctx,K=this.current,L=K.font,l=K.textRenderingMode,S=K.fontSize/K.fontSizeScale,R=l&p.TextRenderingMode.FILL_STROKE_MASK,O=!!(l&p.TextRenderingMode.ADD_TO_PATH_FLAG),B=K.patternFill&&!L.missingFile;let Z;(L.disableFontFace||O||B)&&(Z=L.getPathGenerator(this.commonObjs,m)),L.disableFontFace||B?(W.save(),W.translate(v,C),W.beginPath(),Z(W,S),V&&W.setTransform(...V),(R===p.TextRenderingMode.FILL||R===p.TextRenderingMode.FILL_STROKE)&&W.fill(),(R===p.TextRenderingMode.STROKE||R===p.TextRenderingMode.FILL_STROKE)&&W.stroke(),W.restore()):((R===p.TextRenderingMode.FILL||R===p.TextRenderingMode.FILL_STROKE)&&W.fillText(m,v,C),(R===p.TextRenderingMode.STROKE||R===p.TextRenderingMode.FILL_STROKE)&&W.strokeText(m,v,C)),O&&(this.pendingTextPaths||=[]).push({transform:(0,e.getCurrentTransform)(W),x:v,y:C,fontSize:S,addToPath:Z})}get isFontSubpixelAAEnabled(){const{context:m}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);m.scale(1.5,1),m.fillText("I",0,10);const v=m.getImageData(0,0,10,10).data;let C=!1;for(let V=3;V<v.length;V+=4)if(v[V]>0&&v[V]<255){C=!0;break}return(0,p.shadow)(this,"isFontSubpixelAAEnabled",C)}showText(m){const v=this.current,C=v.font;if(C.isType3Font)return this.showType3Text(m);const V=v.fontSize;if(V===0)return;const W=this.ctx,K=v.fontSizeScale,L=v.charSpacing,l=v.wordSpacing,S=v.fontDirection,R=v.textHScale*S,O=m.length,B=C.vertical,Z=B?1:-1,re=C.defaultVMetrics,me=V*v.fontMatrix[0],We=v.textRenderingMode===p.TextRenderingMode.FILL&&!C.disableFontFace&&!v.patternFill;W.save(),W.transform(...v.textMatrix),W.translate(v.x,v.y+v.textRise),S>0?W.scale(R,-1):W.scale(R,1);let ve;if(v.patternFill){W.save();const qe=v.fillColor.getPattern(W,this,(0,e.getCurrentTransformInverse)(W),s.PathType.FILL);ve=(0,e.getCurrentTransform)(W),W.restore(),W.fillStyle=qe}let ye=v.lineWidth;const Ce=v.textMatrixScale;if(Ce===0||ye===0){const qe=v.textRenderingMode&p.TextRenderingMode.FILL_STROKE_MASK;(qe===p.TextRenderingMode.STROKE||qe===p.TextRenderingMode.FILL_STROKE)&&(ye=this.getSinglePixelWidth())}else ye/=Ce;if(K!==1&&(W.scale(K,K),ye/=K),W.lineWidth=ye,C.isInvalidPDFjsFont){const qe=[];let tt=0;for(const lt of m)qe.push(lt.unicode),tt+=lt.width;W.fillText(qe.join(""),0,0),v.x+=tt*me*R,W.restore(),this.compose();return}let Re=0,xe;for(xe=0;xe<O;++xe){const qe=m[xe];if(typeof qe=="number"){Re+=Z*qe*V/1e3;continue}let tt=!1;const lt=(qe.isSpace?l:0)+L,vt=qe.fontChar,bt=qe.accent;let Ft,vn,hn=qe.width;if(B){const gn=qe.vmetric||re,Fn=-(qe.vmetric?gn[1]:hn*.5)*me,Kn=gn[2]*me;hn=gn?-gn[0]:hn,Ft=Fn/K,vn=(Re+Kn)/K}else Ft=Re/K,vn=0;if(C.remeasure&&hn>0){const gn=W.measureText(vt).width*1e3/V*K;if(hn<gn&&this.isFontSubpixelAAEnabled){const Fn=hn/gn;tt=!0,W.save(),W.scale(Fn,1),Ft/=Fn}else hn!==gn&&(Ft+=(hn-gn)/2e3*V/K)}if(this.contentVisible&&(qe.isInFont||C.missingFile)){if(We&&!bt)W.fillText(vt,Ft,vn);else if(this.paintChar(vt,Ft,vn,ve),bt){const gn=Ft+V*bt.offset.x/K,Fn=vn-V*bt.offset.y/K;this.paintChar(bt.fontChar,gn,Fn,ve)}}const jn=B?hn*me-lt*S:hn*me+lt*S;Re+=jn,tt&&W.restore()}B?v.y-=Re:v.x+=Re*R,W.restore(),this.compose()}showType3Text(m){const v=this.ctx,C=this.current,V=C.font,W=C.fontSize,K=C.fontDirection,L=V.vertical?1:-1,l=C.charSpacing,S=C.wordSpacing,R=C.textHScale*K,O=C.fontMatrix||p.FONT_IDENTITY_MATRIX,B=m.length,Z=C.textRenderingMode===p.TextRenderingMode.INVISIBLE;let re,me,We,ve;if(!(Z||W===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,v.save(),v.transform(...C.textMatrix),v.translate(C.x,C.y),v.scale(R,K),re=0;re<B;++re){if(me=m[re],typeof me=="number"){ve=L*me*W/1e3,this.ctx.translate(ve,0),C.x+=ve*R;continue}const ye=(me.isSpace?S:0)+l,Ce=V.charProcOperatorList[me.operatorListId];if(!Ce){(0,p.warn)(`Type3 character "${me.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=me,this.save(),v.scale(W,W),v.transform(...O),this.executeOperatorList(Ce),this.restore()),We=p.Util.applyTransform([me.width,0],O)[0]*W+ye,v.translate(We,0),C.x+=We*R}v.restore(),this.processingType3=null}}setCharWidth(m,v){}setCharWidthAndBounds(m,v,C,V,W,K){this.ctx.rect(C,V,W-C,K-V),this.ctx.clip(),this.endPath()}getColorN_Pattern(m){let v;if(m[0]==="TilingPattern"){const C=m[1],V=this.baseTransform||(0,e.getCurrentTransform)(this.ctx),W={createCanvasGraphics:K=>new G(K,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};v=new s.TilingPattern(m,C,this.ctx,W,V)}else v=this._getPattern(m[1],m[2]);return v}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(m,v,C){const V=p.Util.makeHexColor(m,v,C);this.ctx.strokeStyle=V,this.current.strokeColor=V}setFillRGBColor(m,v,C){const V=p.Util.makeHexColor(m,v,C);this.ctx.fillStyle=V,this.current.fillColor=V,this.current.patternFill=!1}_getPattern(m,v=null){let C;return this.cachedPatterns.has(m)?C=this.cachedPatterns.get(m):(C=(0,s.getShadingPattern)(this.getObject(m)),this.cachedPatterns.set(m,C)),v&&(C.matrix=v),C}shadingFill(m){if(!this.contentVisible)return;const v=this.ctx;this.save();const C=this._getPattern(m);v.fillStyle=C.getPattern(v,this,(0,e.getCurrentTransformInverse)(v),s.PathType.SHADING);const V=(0,e.getCurrentTransformInverse)(v);if(V){const{width:W,height:K}=v.canvas,[L,l,S,R]=p.Util.getAxialAlignedBoundingBox([0,0,W,K],V);this.ctx.fillRect(L,l,S-L,R-l)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){(0,p.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,p.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(m,v){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(m)&&m.length===6&&this.transform(...m),this.baseTransform=(0,e.getCurrentTransform)(this.ctx),v)){const C=v[2]-v[0],V=v[3]-v[1];this.ctx.rect(v[0],v[1],C,V),this.current.updateRectMinMax((0,e.getCurrentTransform)(this.ctx),v),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(m){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const v=this.ctx;m.isolated||(0,p.info)("TODO: Support non-isolated groups."),m.knockout&&(0,p.warn)("Knockout groups not supported.");const C=(0,e.getCurrentTransform)(v);if(m.matrix&&v.transform(...m.matrix),!m.bbox)throw new Error("Bounding box is required.");let V=p.Util.getAxialAlignedBoundingBox(m.bbox,(0,e.getCurrentTransform)(v));const W=[0,0,v.canvas.width,v.canvas.height];V=p.Util.intersect(V,W)||[0,0,0,0];const K=Math.floor(V[0]),L=Math.floor(V[1]);let l=Math.max(Math.ceil(V[2])-K,1),S=Math.max(Math.ceil(V[3])-L,1),R=1,O=1;l>o&&(R=l/o,l=o),S>o&&(O=S/o,S=o),this.current.startNewPathAndClipBox([0,0,l,S]);let B="groupAt"+this.groupLevel;m.smask&&(B+="_smask_"+this.smaskCounter++%2);const Z=this.cachedCanvases.getCanvas(B,l,S),re=Z.context;re.scale(1/R,1/O),re.translate(-K,-L),re.transform(...C),m.smask?this.smaskStack.push({canvas:Z.canvas,context:re,offsetX:K,offsetY:L,scaleX:R,scaleY:O,subtype:m.smask.subtype,backdrop:m.smask.backdrop,transferMap:m.smask.transferMap||null,startTransformInverse:null}):(v.setTransform(1,0,0,1,0,0),v.translate(K,L),v.scale(R,O),v.save()),_(v,re),this.ctx=re,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(v),this.groupLevel++}endGroup(m){if(!this.contentVisible)return;this.groupLevel--;const v=this.ctx,C=this.groupStack.pop();if(this.ctx=C,this.ctx.imageSmoothingEnabled=!1,m.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const V=(0,e.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...V);const W=p.Util.getAxialAlignedBoundingBox([0,0,v.canvas.width,v.canvas.height],V);this.ctx.drawImage(v.canvas,0,0),this.ctx.restore(),this.compose(W)}}beginAnnotation(m,v,C,V,W){if(this.#e(),M(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(v)&&v.length===4){const K=v[2]-v[0],L=v[3]-v[1];if(W&&this.annotationCanvasMap){C=C.slice(),C[4]-=v[0],C[5]-=v[1],v=v.slice(),v[0]=v[1]=0,v[2]=K,v[3]=L;const[l,S]=p.Util.singularValueDecompose2dScale((0,e.getCurrentTransform)(this.ctx)),{viewportScale:R}=this,O=Math.ceil(K*this.outputScaleX*R),B=Math.ceil(L*this.outputScaleY*R);this.annotationCanvas=this.canvasFactory.create(O,B);const{canvas:Z,context:re}=this.annotationCanvas;this.annotationCanvasMap.set(m,Z),this.annotationCanvas.savedCtx=this.ctx,this.ctx=re,this.ctx.save(),this.ctx.setTransform(l,0,0,-S,0,L*S),M(this.ctx)}else M(this.ctx),this.ctx.rect(v[0],v[1],K,L),this.ctx.clip(),this.endPath()}this.current=new T(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...C),this.transform(...V)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#t(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(m){if(!this.contentVisible)return;const v=m.count;m=this.getObject(m.data,m),m.count=v;const C=this.ctx,V=this.processingType3;if(V&&(V.compiled===void 0&&(V.compiled=f(m)),V.compiled)){V.compiled(C);return}const W=this._createMaskCanvas(m),K=W.canvas;C.save(),C.setTransform(1,0,0,1,0,0),C.drawImage(K,W.offsetX,W.offsetY),C.restore(),this.compose()}paintImageMaskXObjectRepeat(m,v,C=0,V=0,W,K){if(!this.contentVisible)return;m=this.getObject(m.data,m);const L=this.ctx;L.save();const l=(0,e.getCurrentTransform)(L);L.transform(v,C,V,W,0,0);const S=this._createMaskCanvas(m);L.setTransform(1,0,0,1,S.offsetX-l[4],S.offsetY-l[5]);for(let R=0,O=K.length;R<O;R+=2){const B=p.Util.transform(l,[v,C,V,W,K[R],K[R+1]]),[Z,re]=p.Util.applyTransform([0,0],B);L.drawImage(S.canvas,Z,re)}L.restore(),this.compose()}paintImageMaskXObjectGroup(m){if(!this.contentVisible)return;const v=this.ctx,C=this.current.fillColor,V=this.current.patternFill;for(const W of m){const{data:K,width:L,height:l,transform:S}=W,R=this.cachedCanvases.getCanvas("maskCanvas",L,l),O=R.context;O.save();const B=this.getObject(K,W);I(O,B),O.globalCompositeOperation="source-in",O.fillStyle=V?C.getPattern(O,this,(0,e.getCurrentTransformInverse)(v),s.PathType.FILL):C,O.fillRect(0,0,L,l),O.restore(),v.save(),v.transform(...S),v.scale(1,-1),y(v,R.canvas,0,0,L,l,0,-1,1,1),v.restore()}this.compose()}paintImageXObject(m){if(!this.contentVisible)return;const v=this.getObject(m);if(!v){(0,p.warn)("Dependent image isn't ready yet");return}this.paintInlineImageXObject(v)}paintImageXObjectRepeat(m,v,C,V){if(!this.contentVisible)return;const W=this.getObject(m);if(!W){(0,p.warn)("Dependent image isn't ready yet");return}const K=W.width,L=W.height,l=[];for(let S=0,R=V.length;S<R;S+=2)l.push({transform:[v,0,0,C,V[S],V[S+1]],x:0,y:0,w:K,h:L});this.paintInlineImageXObjectGroup(W,l)}applyTransferMapsToCanvas(m){return this.current.transferMaps!=="none"&&(m.filter=this.current.transferMaps,m.drawImage(m.canvas,0,0),m.filter="none"),m.canvas}applyTransferMapsToBitmap(m){if(this.current.transferMaps==="none")return m.bitmap;const{bitmap:v,width:C,height:V}=m,W=this.cachedCanvases.getCanvas("inlineImage",C,V),K=W.context;return K.filter=this.current.transferMaps,K.drawImage(v,0,0),K.filter="none",W.canvas}paintInlineImageXObject(m){if(!this.contentVisible)return;const v=m.width,C=m.height,V=this.ctx;if(this.save(),!p.isNodeJS){const{filter:L}=V;L!=="none"&&L!==""&&(V.filter="none")}V.scale(1/v,-1/C);let W;if(m.bitmap)W=this.applyTransferMapsToBitmap(m);else if(typeof HTMLElement=="function"&&m instanceof HTMLElement||!m.data)W=m;else{const l=this.cachedCanvases.getCanvas("inlineImage",v,C).context;H(l,m),W=this.applyTransferMapsToCanvas(l)}const K=this._scaleImage(W,(0,e.getCurrentTransformInverse)(V));V.imageSmoothingEnabled=Ne((0,e.getCurrentTransform)(V),m.interpolate),y(V,K.img,0,0,K.paintWidth,K.paintHeight,0,-C,v,C),this.compose(),this.restore()}paintInlineImageXObjectGroup(m,v){if(!this.contentVisible)return;const C=this.ctx;let V;if(m.bitmap)V=m.bitmap;else{const W=m.width,K=m.height,l=this.cachedCanvases.getCanvas("inlineImage",W,K).context;H(l,m),V=this.applyTransferMapsToCanvas(l)}for(const W of v)C.save(),C.transform(...W.transform),C.scale(1,-1),y(C,V,W.x,W.y,W.w,W.h,0,-1,1,1),C.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(m){}markPointProps(m,v){}beginMarkedContent(m){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(m,v){m==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(v)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(m){const v=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(m);const C=this.ctx;this.pendingClip&&(v||(this.pendingClip===Ee?C.clip("evenodd"):C.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),C.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const m=(0,e.getCurrentTransform)(this.ctx);if(m[1]===0&&m[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(m[0]),Math.abs(m[3]));else{const v=Math.abs(m[0]*m[3]-m[2]*m[1]),C=Math.hypot(m[0],m[2]),V=Math.hypot(m[1],m[3]);this._cachedGetSinglePixelWidth=Math.max(C,V)/v}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:m}=this.current,{a:v,b:C,c:V,d:W}=this.ctx.getTransform();let K,L;if(C===0&&V===0){const l=Math.abs(v),S=Math.abs(W);if(l===S)if(m===0)K=L=1/l;else{const R=l*m;K=L=R<1?1/R:1}else if(m===0)K=1/l,L=1/S;else{const R=l*m,O=S*m;K=R<1?1/R:1,L=O<1?1/O:1}}else{const l=Math.abs(v*W-C*V),S=Math.hypot(v,C),R=Math.hypot(V,W);if(m===0)K=R/l,L=S/l;else{const O=m*l;K=R>O?R/O:1,L=S>O?S/O:1}}this._cachedScaleForStroking[0]=K,this._cachedScaleForStroking[1]=L}return this._cachedScaleForStroking}rescaleAndStroke(m){const{ctx:v}=this,{lineWidth:C}=this.current,[V,W]=this.getScaleForStroking();if(v.lineWidth=C||1,V===1&&W===1){v.stroke();return}const K=v.getLineDash();if(m&&v.save(),v.scale(V,W),K.length>0){const L=Math.max(V,W);v.setLineDash(K.map(l=>l/L)),v.lineDashOffset/=L}v.stroke(),m&&v.restore()}isContentVisible(){for(let m=this.markedContentStack.length-1;m>=0;m--)if(!this.markedContentStack[m].visible)return!1;return!0}}c.CanvasGraphics=G;for(const A in p.OPS)G.prototype[A]!==void 0&&(G.prototype[p.OPS[A]]=G.prototype[A])}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TilingPattern=c.PathType=void 0,c.getShadingPattern=d;var p=q(1),e=q(6);const s={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};c.PathType=s;function N(y,f){if(!f)return;const T=f[2]-f[0],H=f[3]-f[1],I=new Path2D;I.rect(f[0],f[1],T,H),y.clip(I)}class ee{constructor(){this.constructor===ee&&(0,p.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,p.unreachable)("Abstract method `getPattern` called.")}}class U extends ee{constructor(f){super(),this._type=f[1],this._bbox=f[2],this._colorStops=f[3],this._p0=f[4],this._p1=f[5],this._r0=f[6],this._r1=f[7],this.matrix=null}_createGradient(f){let T;this._type==="axial"?T=f.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(T=f.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const H of this._colorStops)T.addColorStop(H[0],H[1]);return T}getPattern(f,T,H,I){let _;if(I===s.STROKE||I===s.FILL){const M=T.current.getClippedPathBoundingBox(I,(0,e.getCurrentTransform)(f))||[0,0,0,0],te=Math.ceil(M[2]-M[0])||1,ie=Math.ceil(M[3]-M[1])||1,Y=T.cachedCanvases.getCanvas("pattern",te,ie,!0),he=Y.context;he.clearRect(0,0,he.canvas.width,he.canvas.height),he.beginPath(),he.rect(0,0,he.canvas.width,he.canvas.height),he.translate(-M[0],-M[1]),H=p.Util.transform(H,[1,0,0,1,M[0],M[1]]),he.transform(...T.baseTransform),this.matrix&&he.transform(...this.matrix),N(he,this._bbox),he.fillStyle=this._createGradient(he),he.fill(),_=f.createPattern(Y.canvas,"no-repeat");const ge=new DOMMatrix(H);_.setTransform(ge)}else N(f,this._bbox),_=this._createGradient(f);return _}}function o(y,f,T,H,I,_,M,te){const ie=f.coords,Y=f.colors,he=y.data,ge=y.width*4;let Ne;ie[T+1]>ie[H+1]&&(Ne=T,T=H,H=Ne,Ne=_,_=M,M=Ne),ie[H+1]>ie[I+1]&&(Ne=H,H=I,I=Ne,Ne=M,M=te,te=Ne),ie[T+1]>ie[H+1]&&(Ne=T,T=H,H=Ne,Ne=_,_=M,M=Ne);const ke=(ie[T]+f.offsetX)*f.scaleX,Oe=(ie[T+1]+f.offsetY)*f.scaleY,Ve=(ie[H]+f.offsetX)*f.scaleX,Ee=(ie[H+1]+f.offsetY)*f.scaleY,G=(ie[I]+f.offsetX)*f.scaleX,A=(ie[I+1]+f.offsetY)*f.scaleY;if(Oe>=A)return;const m=Y[_],v=Y[_+1],C=Y[_+2],V=Y[M],W=Y[M+1],K=Y[M+2],L=Y[te],l=Y[te+1],S=Y[te+2],R=Math.round(Oe),O=Math.round(A);let B,Z,re,me,We,ve,ye,Ce;for(let Re=R;Re<=O;Re++){if(Re<Ee){const vt=Re<Oe?0:(Oe-Re)/(Oe-Ee);B=ke-(ke-Ve)*vt,Z=m-(m-V)*vt,re=v-(v-W)*vt,me=C-(C-K)*vt}else{let vt;Re>A?vt=1:Ee===A?vt=0:vt=(Ee-Re)/(Ee-A),B=Ve-(Ve-G)*vt,Z=V-(V-L)*vt,re=W-(W-l)*vt,me=K-(K-S)*vt}let xe;Re<Oe?xe=0:Re>A?xe=1:xe=(Oe-Re)/(Oe-A),We=ke-(ke-G)*xe,ve=m-(m-L)*xe,ye=v-(v-l)*xe,Ce=C-(C-S)*xe;const qe=Math.round(Math.min(B,We)),tt=Math.round(Math.max(B,We));let lt=ge*Re+qe*4;for(let vt=qe;vt<=tt;vt++)xe=(B-vt)/(B-We),xe<0?xe=0:xe>1&&(xe=1),he[lt++]=Z-(Z-ve)*xe|0,he[lt++]=re-(re-ye)*xe|0,he[lt++]=me-(me-Ce)*xe|0,he[lt++]=255}}function t(y,f,T){const H=f.coords,I=f.colors;let _,M;switch(f.type){case"lattice":const te=f.verticesPerRow,ie=Math.floor(H.length/te)-1,Y=te-1;for(_=0;_<ie;_++){let he=_*te;for(let ge=0;ge<Y;ge++,he++)o(y,T,H[he],H[he+1],H[he+te],I[he],I[he+1],I[he+te]),o(y,T,H[he+te+1],H[he+1],H[he+te],I[he+te+1],I[he+1],I[he+te])}break;case"triangles":for(_=0,M=H.length;_<M;_+=3)o(y,T,H[_],H[_+1],H[_+2],I[_],I[_+1],I[_+2]);break;default:throw new Error("illegal figure")}}class a extends ee{constructor(f){super(),this._coords=f[2],this._colors=f[3],this._figures=f[4],this._bounds=f[5],this._bbox=f[7],this._background=f[8],this.matrix=null}_createMeshCanvas(f,T,H){const te=Math.floor(this._bounds[0]),ie=Math.floor(this._bounds[1]),Y=Math.ceil(this._bounds[2])-te,he=Math.ceil(this._bounds[3])-ie,ge=Math.min(Math.ceil(Math.abs(Y*f[0]*1.1)),3e3),Ne=Math.min(Math.ceil(Math.abs(he*f[1]*1.1)),3e3),ke=Y/ge,Oe=he/Ne,Ve={coords:this._coords,colors:this._colors,offsetX:-te,offsetY:-ie,scaleX:1/ke,scaleY:1/Oe},Ee=ge+4,G=Ne+4,A=H.getCanvas("mesh",Ee,G,!1),m=A.context,v=m.createImageData(ge,Ne);if(T){const V=v.data;for(let W=0,K=V.length;W<K;W+=4)V[W]=T[0],V[W+1]=T[1],V[W+2]=T[2],V[W+3]=255}for(const V of this._figures)t(v,V,Ve);return m.putImageData(v,2,2),{canvas:A.canvas,offsetX:te-2*ke,offsetY:ie-2*Oe,scaleX:ke,scaleY:Oe}}getPattern(f,T,H,I){N(f,this._bbox);let _;if(I===s.SHADING)_=p.Util.singularValueDecompose2dScale((0,e.getCurrentTransform)(f));else if(_=p.Util.singularValueDecompose2dScale(T.baseTransform),this.matrix){const te=p.Util.singularValueDecompose2dScale(this.matrix);_=[_[0]*te[0],_[1]*te[1]]}const M=this._createMeshCanvas(_,I===s.SHADING?null:this._background,T.cachedCanvases);return I!==s.SHADING&&(f.setTransform(...T.baseTransform),this.matrix&&f.transform(...this.matrix)),f.translate(M.offsetX,M.offsetY),f.scale(M.scaleX,M.scaleY),f.createPattern(M.canvas,"no-repeat")}}class g extends ee{getPattern(){return"hotpink"}}function d(y){switch(y[0]){case"RadialAxial":return new U(y);case"Mesh":return new a(y);case"Dummy":return new g}throw new Error(`Unknown IR type: ${y[0]}`)}const i={COLORED:1,UNCOLORED:2};class b{static MAX_PATTERN_SIZE=3e3;constructor(f,T,H,I,_){this.operatorList=f[2],this.matrix=f[3]||[1,0,0,1,0,0],this.bbox=f[4],this.xstep=f[5],this.ystep=f[6],this.paintType=f[7],this.tilingType=f[8],this.color=T,this.ctx=H,this.canvasGraphicsFactory=I,this.baseTransform=_}createPatternCanvas(f){const T=this.operatorList,H=this.bbox,I=this.xstep,_=this.ystep,M=this.paintType,te=this.tilingType,ie=this.color,Y=this.canvasGraphicsFactory;(0,p.info)("TilingType: "+te);const he=H[0],ge=H[1],Ne=H[2],ke=H[3],Oe=p.Util.singularValueDecompose2dScale(this.matrix),Ve=p.Util.singularValueDecompose2dScale(this.baseTransform),Ee=[Oe[0]*Ve[0],Oe[1]*Ve[1]],G=this.getSizeAndScale(I,this.ctx.canvas.width,Ee[0]),A=this.getSizeAndScale(_,this.ctx.canvas.height,Ee[1]),m=f.cachedCanvases.getCanvas("pattern",G.size,A.size,!0),v=m.context,C=Y.createCanvasGraphics(v);C.groupLevel=f.groupLevel,this.setFillAndStrokeStyleToContext(C,M,ie);let V=he,W=ge,K=Ne,L=ke;return he<0&&(V=0,K+=Math.abs(he)),ge<0&&(W=0,L+=Math.abs(ge)),v.translate(-(G.scale*V),-(A.scale*W)),C.transform(G.scale,0,0,A.scale,0,0),v.save(),this.clipBbox(C,V,W,K,L),C.baseTransform=(0,e.getCurrentTransform)(C.ctx),C.executeOperatorList(T),C.endDrawing(),{canvas:m.canvas,scaleX:G.scale,scaleY:A.scale,offsetX:V,offsetY:W}}getSizeAndScale(f,T,H){f=Math.abs(f);const I=Math.max(b.MAX_PATTERN_SIZE,T);let _=Math.ceil(f*H);return _>=I?_=I:H=_/f,{scale:H,size:_}}clipBbox(f,T,H,I,_){const M=I-T,te=_-H;f.ctx.rect(T,H,M,te),f.current.updateRectMinMax((0,e.getCurrentTransform)(f.ctx),[T,H,I,_]),f.clip(),f.endPath()}setFillAndStrokeStyleToContext(f,T,H){const I=f.ctx,_=f.current;switch(T){case i.COLORED:const M=this.ctx;I.fillStyle=M.fillStyle,I.strokeStyle=M.strokeStyle,_.fillColor=M.fillStyle,_.strokeColor=M.strokeStyle;break;case i.UNCOLORED:const te=p.Util.makeHexColor(H[0],H[1],H[2]);I.fillStyle=te,I.strokeStyle=te,_.fillColor=te,_.strokeColor=te;break;default:throw new p.FormatError(`Unsupported paint type: ${T}`)}}getPattern(f,T,H,I){let _=H;I!==s.SHADING&&(_=p.Util.transform(_,T.baseTransform),this.matrix&&(_=p.Util.transform(_,this.matrix)));const M=this.createPatternCanvas(T);let te=new DOMMatrix(_);te=te.translate(M.offsetX,M.offsetY),te=te.scale(1/M.scaleX,1/M.scaleY);const ie=f.createPattern(M.canvas,"repeat");return ie.setTransform(te),ie}}c.TilingPattern=b}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.convertBlackAndWhiteToRGBA=s,c.convertToRGBA=e,c.grayToRGBA=ee;var p=q(1);function e(U){switch(U.kind){case p.ImageKind.GRAYSCALE_1BPP:return s(U);case p.ImageKind.RGB_24BPP:return N(U)}return null}function s({src:U,srcPos:o=0,dest:t,width:a,height:g,nonBlackColor:d=4294967295,inverseDecode:i=!1}){const b=p.FeatureTest.isLittleEndian?4278190080:255,[y,f]=i?[d,b]:[b,d],T=a>>3,H=a&7,I=U.length;t=new Uint32Array(t.buffer);let _=0;for(let M=0;M<g;M++){for(const ie=o+T;o<ie;o++){const Y=o<I?U[o]:255;t[_++]=Y&128?f:y,t[_++]=Y&64?f:y,t[_++]=Y&32?f:y,t[_++]=Y&16?f:y,t[_++]=Y&8?f:y,t[_++]=Y&4?f:y,t[_++]=Y&2?f:y,t[_++]=Y&1?f:y}if(H===0)continue;const te=o<I?U[o++]:255;for(let ie=0;ie<H;ie++)t[_++]=te&1<<7-ie?f:y}return{srcPos:o,destPos:_}}function N({src:U,srcPos:o=0,dest:t,destPos:a=0,width:g,height:d}){let i=0;const b=U.length>>2,y=new Uint32Array(U.buffer,o,b);if(p.FeatureTest.isLittleEndian){for(;i<b-2;i+=3,a+=4){const f=y[i],T=y[i+1],H=y[i+2];t[a]=f|4278190080,t[a+1]=f>>>24|T<<8|4278190080,t[a+2]=T>>>16|H<<16|4278190080,t[a+3]=H>>>8|4278190080}for(let f=i*4,T=U.length;f<T;f+=3)t[a++]=U[f]|U[f+1]<<8|U[f+2]<<16|4278190080}else{for(;i<b-2;i+=3,a+=4){const f=y[i],T=y[i+1],H=y[i+2];t[a]=f|255,t[a+1]=f<<24|T>>>8|255,t[a+2]=T<<16|H>>>16|255,t[a+3]=H<<8|255}for(let f=i*4,T=U.length;f<T;f+=3)t[a++]=U[f]<<24|U[f+1]<<16|U[f+2]<<8|255}return{srcPos:o,destPos:a}}function ee(U,o){if(p.FeatureTest.isLittleEndian)for(let t=0,a=U.length;t<a;t++)o[t]=U[t]*65793|4278190080;else for(let t=0,a=U.length;t<a;t++)o[t]=U[t]*16843008|255}}),((r,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.GlobalWorkerOptions=void 0;const q=Object.create(null);c.GlobalWorkerOptions=q,q.workerPort=null,q.workerSrc=""}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.MessageHandler=void 0;var p=q(1);const e={DATA:1,ERROR:2},s={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function N(U){switch(U instanceof Error||typeof U=="object"&&U!==null||(0,p.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),U.name){case"AbortException":return new p.AbortException(U.message);case"MissingPDFException":return new p.MissingPDFException(U.message);case"PasswordException":return new p.PasswordException(U.message,U.code);case"UnexpectedResponseException":return new p.UnexpectedResponseException(U.message,U.status);case"UnknownErrorException":return new p.UnknownErrorException(U.message,U.details);default:return new p.UnknownErrorException(U.message,U.toString())}}class ee{constructor(o,t,a){this.sourceName=o,this.targetName=t,this.comObj=a,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=g=>{const d=g.data;if(d.targetName!==this.sourceName)return;if(d.stream){this.#t(d);return}if(d.callback){const b=d.callbackId,y=this.callbackCapabilities[b];if(!y)throw new Error(`Cannot resolve callback ${b}`);if(delete this.callbackCapabilities[b],d.callback===e.DATA)y.resolve(d.data);else if(d.callback===e.ERROR)y.reject(N(d.reason));else throw new Error("Unexpected callback case");return}const i=this.actionHandler[d.action];if(!i)throw new Error(`Unknown action from worker: ${d.action}`);if(d.callbackId){const b=this.sourceName,y=d.sourceName;new Promise(function(f){f(i(d.data))}).then(function(f){a.postMessage({sourceName:b,targetName:y,callback:e.DATA,callbackId:d.callbackId,data:f})},function(f){a.postMessage({sourceName:b,targetName:y,callback:e.ERROR,callbackId:d.callbackId,reason:N(f)})});return}if(d.streamId){this.#e(d);return}i(d.data)},a.addEventListener("message",this._onComObjOnMessage)}on(o,t){const a=this.actionHandler;if(a[o])throw new Error(`There is already an actionName called "${o}"`);a[o]=t}send(o,t,a){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:o,data:t},a)}sendWithPromise(o,t,a){const g=this.callbackId++,d=new p.PromiseCapability;this.callbackCapabilities[g]=d;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:o,callbackId:g,data:t},a)}catch(i){d.reject(i)}return d.promise}sendWithStream(o,t,a,g){const d=this.streamId++,i=this.sourceName,b=this.targetName,y=this.comObj;return new ReadableStream({start:f=>{const T=new p.PromiseCapability;return this.streamControllers[d]={controller:f,startCall:T,pullCall:null,cancelCall:null,isClosed:!1},y.postMessage({sourceName:i,targetName:b,action:o,streamId:d,data:t,desiredSize:f.desiredSize},g),T.promise},pull:f=>{const T=new p.PromiseCapability;return this.streamControllers[d].pullCall=T,y.postMessage({sourceName:i,targetName:b,stream:s.PULL,streamId:d,desiredSize:f.desiredSize}),T.promise},cancel:f=>{(0,p.assert)(f instanceof Error,"cancel must have a valid reason");const T=new p.PromiseCapability;return this.streamControllers[d].cancelCall=T,this.streamControllers[d].isClosed=!0,y.postMessage({sourceName:i,targetName:b,stream:s.CANCEL,streamId:d,reason:N(f)}),T.promise}},a)}#e(o){const t=o.streamId,a=this.sourceName,g=o.sourceName,d=this.comObj,i=this,b=this.actionHandler[o.action],y={enqueue(f,T=1,H){if(this.isCancelled)return;const I=this.desiredSize;this.desiredSize-=T,I>0&&this.desiredSize<=0&&(this.sinkCapability=new p.PromiseCapability,this.ready=this.sinkCapability.promise),d.postMessage({sourceName:a,targetName:g,stream:s.ENQUEUE,streamId:t,chunk:f},H)},close(){this.isCancelled||(this.isCancelled=!0,d.postMessage({sourceName:a,targetName:g,stream:s.CLOSE,streamId:t}),delete i.streamSinks[t])},error(f){(0,p.assert)(f instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,d.postMessage({sourceName:a,targetName:g,stream:s.ERROR,streamId:t,reason:N(f)}))},sinkCapability:new p.PromiseCapability,onPull:null,onCancel:null,isCancelled:!1,desiredSize:o.desiredSize,ready:null};y.sinkCapability.resolve(),y.ready=y.sinkCapability.promise,this.streamSinks[t]=y,new Promise(function(f){f(b(o.data,y))}).then(function(){d.postMessage({sourceName:a,targetName:g,stream:s.START_COMPLETE,streamId:t,success:!0})},function(f){d.postMessage({sourceName:a,targetName:g,stream:s.START_COMPLETE,streamId:t,reason:N(f)})})}#t(o){const t=o.streamId,a=this.sourceName,g=o.sourceName,d=this.comObj,i=this.streamControllers[t],b=this.streamSinks[t];switch(o.stream){case s.START_COMPLETE:o.success?i.startCall.resolve():i.startCall.reject(N(o.reason));break;case s.PULL_COMPLETE:o.success?i.pullCall.resolve():i.pullCall.reject(N(o.reason));break;case s.PULL:if(!b){d.postMessage({sourceName:a,targetName:g,stream:s.PULL_COMPLETE,streamId:t,success:!0});break}b.desiredSize<=0&&o.desiredSize>0&&b.sinkCapability.resolve(),b.desiredSize=o.desiredSize,new Promise(function(y){y(b.onPull?.())}).then(function(){d.postMessage({sourceName:a,targetName:g,stream:s.PULL_COMPLETE,streamId:t,success:!0})},function(y){d.postMessage({sourceName:a,targetName:g,stream:s.PULL_COMPLETE,streamId:t,reason:N(y)})});break;case s.ENQUEUE:if((0,p.assert)(i,"enqueue should have stream controller"),i.isClosed)break;i.controller.enqueue(o.chunk);break;case s.CLOSE:if((0,p.assert)(i,"close should have stream controller"),i.isClosed)break;i.isClosed=!0,i.controller.close(),this.#n(i,t);break;case s.ERROR:(0,p.assert)(i,"error should have stream controller"),i.controller.error(N(o.reason)),this.#n(i,t);break;case s.CANCEL_COMPLETE:o.success?i.cancelCall.resolve():i.cancelCall.reject(N(o.reason)),this.#n(i,t);break;case s.CANCEL:if(!b)break;new Promise(function(y){y(b.onCancel?.(N(o.reason)))}).then(function(){d.postMessage({sourceName:a,targetName:g,stream:s.CANCEL_COMPLETE,streamId:t,success:!0})},function(y){d.postMessage({sourceName:a,targetName:g,stream:s.CANCEL_COMPLETE,streamId:t,reason:N(y)})}),b.sinkCapability.reject(N(o.reason)),b.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}async#n(o,t){await Promise.allSettled([o.startCall?.promise,o.pullCall?.promise,o.cancelCall?.promise]),delete this.streamControllers[t]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}c.MessageHandler=ee}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.Metadata=void 0;var p=q(1);class e{#e;#t;constructor({parsedData:N,rawData:ee}){this.#e=N,this.#t=ee}getRaw(){return this.#t}get(N){return this.#e.get(N)??null}getAll(){return(0,p.objectFromMap)(this.#e)}has(N){return this.#e.has(N)}}c.Metadata=e}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.OptionalContentConfig=void 0;var p=q(1),e=q(8);const s=Symbol("INTERNAL");class N{#e=!0;constructor(o,t){this.name=o,this.intent=t}get visible(){return this.#e}_setVisible(o,t){o!==s&&(0,p.unreachable)("Internal method `_setVisible` called."),this.#e=t}}class ee{#e=null;#t=new Map;#n=null;#r=null;constructor(o){if(this.name=null,this.creator=null,o!==null){this.name=o.name,this.creator=o.creator,this.#r=o.order;for(const t of o.groups)this.#t.set(t.id,new N(t.name,t.intent));if(o.baseState==="OFF")for(const t of this.#t.values())t._setVisible(s,!1);for(const t of o.on)this.#t.get(t)._setVisible(s,!0);for(const t of o.off)this.#t.get(t)._setVisible(s,!1);this.#n=this.getHash()}}#o(o){const t=o.length;if(t<2)return!0;const a=o[0];for(let g=1;g<t;g++){const d=o[g];let i;if(Array.isArray(d))i=this.#o(d);else if(this.#t.has(d))i=this.#t.get(d).visible;else return(0,p.warn)(`Optional content group not found: ${d}`),!0;switch(a){case"And":if(!i)return!1;break;case"Or":if(i)return!0;break;case"Not":return!i;default:return!0}}return a==="And"}isVisible(o){if(this.#t.size===0)return!0;if(!o)return(0,p.warn)("Optional content group not defined."),!0;if(o.type==="OCG")return this.#t.has(o.id)?this.#t.get(o.id).visible:((0,p.warn)(`Optional content group not found: ${o.id}`),!0);if(o.type==="OCMD"){if(o.expression)return this.#o(o.expression);if(!o.policy||o.policy==="AnyOn"){for(const t of o.ids){if(!this.#t.has(t))return(0,p.warn)(`Optional content group not found: ${t}`),!0;if(this.#t.get(t).visible)return!0}return!1}else if(o.policy==="AllOn"){for(const t of o.ids){if(!this.#t.has(t))return(0,p.warn)(`Optional content group not found: ${t}`),!0;if(!this.#t.get(t).visible)return!1}return!0}else if(o.policy==="AnyOff"){for(const t of o.ids){if(!this.#t.has(t))return(0,p.warn)(`Optional content group not found: ${t}`),!0;if(!this.#t.get(t).visible)return!0}return!1}else if(o.policy==="AllOff"){for(const t of o.ids){if(!this.#t.has(t))return(0,p.warn)(`Optional content group not found: ${t}`),!0;if(this.#t.get(t).visible)return!1}return!0}return(0,p.warn)(`Unknown optional content policy ${o.policy}.`),!0}return(0,p.warn)(`Unknown group type ${o.type}.`),!0}setVisibility(o,t=!0){if(!this.#t.has(o)){(0,p.warn)(`Optional content group not found: ${o}`);return}this.#t.get(o)._setVisible(s,!!t),this.#e=null}get hasInitialVisibility(){return this.#n===null||this.getHash()===this.#n}getOrder(){return this.#t.size?this.#r?this.#r.slice():[...this.#t.keys()]:null}getGroups(){return this.#t.size>0?(0,p.objectFromMap)(this.#t):null}getGroup(o){return this.#t.get(o)||null}getHash(){if(this.#e!==null)return this.#e;const o=new e.MurmurHash3_64;for(const[t,a]of this.#t)o.update(`${t}:${a.visible}`);return this.#e=o.hexdigest()}}c.OptionalContentConfig=ee}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.PDFDataTransportStream=void 0;var p=q(1),e=q(6);class s{constructor({length:o,initialData:t,progressiveDone:a=!1,contentDispositionFilename:g=null,disableRange:d=!1,disableStream:i=!1},b){if((0,p.assert)(b,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'),this._queuedChunks=[],this._progressiveDone=a,this._contentDispositionFilename=g,t?.length>0){const y=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;this._queuedChunks.push(y)}this._pdfDataRangeTransport=b,this._isStreamingSupported=!i,this._isRangeSupported=!d,this._contentLength=o,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener((y,f)=>{this._onReceiveData({begin:y,chunk:f})}),this._pdfDataRangeTransport.addProgressListener((y,f)=>{this._onProgress({loaded:y,total:f})}),this._pdfDataRangeTransport.addProgressiveReadListener(y=>{this._onReceiveData({chunk:y})}),this._pdfDataRangeTransport.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),this._pdfDataRangeTransport.transportReady()}_onReceiveData({begin:o,chunk:t}){const a=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;if(o===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(a):this._queuedChunks.push(a);else{const g=this._rangeReaders.some(function(d){return d._begin!==o?!1:(d._enqueue(a),!0)});(0,p.assert)(g,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(o){o.total===void 0?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){const t=this._rangeReaders.indexOf(o);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){(0,p.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const o=this._queuedChunks;return this._queuedChunks=null,new N(this,o,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(o,t){if(t<=this._progressiveDataLength)return null;const a=new ee(this,o,t);return this._pdfDataRangeTransport.requestDataRange(o,t),this._rangeReaders.push(a),a}cancelAllRequests(o){this._fullRequestReader?.cancel(o);for(const t of this._rangeReaders.slice(0))t.cancel(o);this._pdfDataRangeTransport.abort()}}c.PDFDataTransportStream=s;class N{constructor(o,t,a=!1,g=null){this._stream=o,this._done=a||!1,this._filename=(0,e.isPdfFile)(g)?g:null,this._queuedChunks=t||[],this._loaded=0;for(const d of this._queuedChunks)this._loaded+=d.byteLength;this._requests=[],this._headersReady=Promise.resolve(),o._fullRequestReader=this,this.onProgress=null}_enqueue(o){this._done||(this._requests.length>0?this._requests.shift().resolve({value:o,done:!1}):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)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const o=new p.PromiseCapability;return this._requests.push(o),o.promise}cancel(o){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class ee{constructor(o,t,a){this._stream=o,this._begin=t,this._end=a,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(o){if(!this._done){if(this._requests.length===0)this._queuedChunk=o;else{this._requests.shift().resolve({value:o,done:!1});for(const a of this._requests)a.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const o=new p.PromiseCapability;return this._requests.push(o),o.promise}cancel(o){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.PDFFetchStream=void 0;var p=q(1),e=q(20);function s(a,g,d){return{method:"GET",headers:a,signal:d.signal,mode:"cors",credentials:g?"include":"same-origin",redirect:"follow"}}function N(a){const g=new Headers;for(const d in a){const i=a[d];i!==void 0&&g.append(d,i)}return g}function ee(a){return a instanceof Uint8Array?a.buffer:a instanceof ArrayBuffer?a:((0,p.warn)(`getArrayBuffer - unexpected data format: ${a}`),new Uint8Array(a).buffer)}class U{constructor(g){this.source=g,this.isHttp=/^https?:/i.test(g.url),this.httpHeaders=this.isHttp&&g.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,p.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new o(this),this._fullRequestReader}getRangeReader(g,d){if(d<=this._progressiveDataLength)return null;const i=new t(this,g,d);return this._rangeRequestReaders.push(i),i}cancelAllRequests(g){this._fullRequestReader?.cancel(g);for(const d of this._rangeRequestReaders.slice(0))d.cancel(g)}}c.PDFFetchStream=U;class o{constructor(g){this._stream=g,this._reader=null,this._loaded=0,this._filename=null;const d=g.source;this._withCredentials=d.withCredentials||!1,this._contentLength=d.length,this._headersCapability=new p.PromiseCapability,this._disableRange=d.disableRange||!1,this._rangeChunkSize=d.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!d.disableStream,this._isRangeSupported=!d.disableRange,this._headers=N(this._stream.httpHeaders);const i=d.url;fetch(i,s(this._headers,this._withCredentials,this._abortController)).then(b=>{if(!(0,e.validateResponseStatus)(b.status))throw(0,e.createResponseStatusError)(b.status,i);this._reader=b.body.getReader(),this._headersCapability.resolve();const y=H=>b.headers.get(H),{allowRangeRequests:f,suggestedLength:T}=(0,e.validateRangeRequestCapabilities)({getResponseHeader:y,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=f,this._contentLength=T||this._contentLength,this._filename=(0,e.extractFilenameFromHeader)(y),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new p.AbortException("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;const{value:g,done:d}=await this._reader.read();return d?{value:g,done:d}:(this._loaded+=g.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:ee(g),done:!1})}cancel(g){this._reader?.cancel(g),this._abortController.abort()}}class t{constructor(g,d,i){this._stream=g,this._reader=null,this._loaded=0;const b=g.source;this._withCredentials=b.withCredentials||!1,this._readCapability=new p.PromiseCapability,this._isStreamingSupported=!b.disableStream,this._abortController=new AbortController,this._headers=N(this._stream.httpHeaders),this._headers.append("Range",`bytes=${d}-${i-1}`);const y=b.url;fetch(y,s(this._headers,this._withCredentials,this._abortController)).then(f=>{if(!(0,e.validateResponseStatus)(f.status))throw(0,e.createResponseStatusError)(f.status,y);this._readCapability.resolve(),this._reader=f.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:g,done:d}=await this._reader.read();return d?{value:g,done:d}:(this._loaded+=g.byteLength,this.onProgress?.({loaded:this._loaded}),{value:ee(g),done:!1})}cancel(g){this._reader?.cancel(g),this._abortController.abort()}}}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.createResponseStatusError=U,c.extractFilenameFromHeader=ee,c.validateRangeRequestCapabilities=N,c.validateResponseStatus=o;var p=q(1),e=q(21),s=q(6);function N({getResponseHeader:t,isHttp:a,rangeChunkSize:g,disableRange:d}){const i={allowRangeRequests:!1,suggestedLength:void 0},b=parseInt(t("Content-Length"),10);return!Number.isInteger(b)||(i.suggestedLength=b,b<=2*g)||d||!a||t("Accept-Ranges")!=="bytes"||(t("Content-Encoding")||"identity")!=="identity"||(i.allowRangeRequests=!0),i}function ee(t){const a=t("Content-Disposition");if(a){let g=(0,e.getFilenameFromContentDispositionHeader)(a);if(g.includes("%"))try{g=decodeURIComponent(g)}catch{}if((0,s.isPdfFile)(g))return g}return null}function U(t,a){return t===404||t===0&&a.startsWith("file:")?new p.MissingPDFException('Missing PDF "'+a+'".'):new p.UnexpectedResponseException(`Unexpected server response (${t}) while retrieving PDF "${a}".`,t)}function o(t){return t===200||t===206}}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.getFilenameFromContentDispositionHeader=e;var p=q(1);function e(s){let N=!0,ee=U("filename\\*","i").exec(s);if(ee){ee=ee[1];let b=g(ee);return b=unescape(b),b=d(b),b=i(b),t(b)}if(ee=a(s),ee){const b=i(ee);return t(b)}if(ee=U("filename","i").exec(s),ee){ee=ee[1];let b=g(ee);return b=i(b),t(b)}function U(b,y){return new RegExp("(?:^|;)\\s*"+b+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',y)}function o(b,y){if(b){if(!/^[\x00-\xFF]+$/.test(y))return y;try{const f=new TextDecoder(b,{fatal:!0}),T=(0,p.stringToBytes)(y);y=f.decode(T),N=!1}catch{}}return y}function t(b){return N&&/[\x80-\xff]/.test(b)&&(b=o("utf-8",b),N&&(b=o("iso-8859-1",b))),b}function a(b){const y=[];let f;const T=U("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(f=T.exec(b))!==null;){let[,I,_,M]=f;if(I=parseInt(I,10),I in y){if(I===0)break;continue}y[I]=[_,M]}const H=[];for(let I=0;I<y.length&&I in y;++I){let[_,M]=y[I];M=g(M),_&&(M=unescape(M),I===0&&(M=d(M))),H.push(M)}return H.join("")}function g(b){if(b.startsWith('"')){const y=b.slice(1).split('\\"');for(let f=0;f<y.length;++f){const T=y[f].indexOf('"');T!==-1&&(y[f]=y[f].slice(0,T),y.length=f+1),y[f]=y[f].replaceAll(/\\(.)/g,"$1")}b=y.join('"')}return b}function d(b){const y=b.indexOf("'");if(y===-1)return b;const f=b.slice(0,y),H=b.slice(y+1).replace(/^[^']*'/,"");return o(f,H)}function i(b){return!b.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(b)?b:b.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(y,f,T,H){if(T==="q"||T==="Q")return H=H.replaceAll("_"," "),H=H.replaceAll(/=([0-9a-fA-F]{2})/g,function(I,_){return String.fromCharCode(parseInt(_,16))}),o(f,H);try{H=atob(H)}catch{}return o(f,H)})}return""}}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.PDFNetworkStream=void 0;var p=q(1),e=q(20);const s=200,N=206;function ee(g){const d=g.response;return typeof d!="string"?d:(0,p.stringToBytes)(d).buffer}class U{constructor(d,i={}){this.url=d,this.isHttp=/^https?:/i.test(d),this.httpHeaders=this.isHttp&&i.httpHeaders||Object.create(null),this.withCredentials=i.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(d,i,b){const y={begin:d,end:i};for(const f in b)y[f]=b[f];return this.request(y)}requestFull(d){return this.request(d)}request(d){const i=new XMLHttpRequest,b=this.currXhrId++,y=this.pendingRequests[b]={xhr:i};i.open("GET",this.url),i.withCredentials=this.withCredentials;for(const f in this.httpHeaders){const T=this.httpHeaders[f];T!==void 0&&i.setRequestHeader(f,T)}return this.isHttp&&"begin"in d&&"end"in d?(i.setRequestHeader("Range",`bytes=${d.begin}-${d.end-1}`),y.expectedStatus=N):y.expectedStatus=s,i.responseType="arraybuffer",d.onError&&(i.onerror=function(f){d.onError(i.status)}),i.onreadystatechange=this.onStateChange.bind(this,b),i.onprogress=this.onProgress.bind(this,b),y.onHeadersReceived=d.onHeadersReceived,y.onDone=d.onDone,y.onError=d.onError,y.onProgress=d.onProgress,i.send(null),b}onProgress(d,i){const b=this.pendingRequests[d];b&&b.onProgress?.(i)}onStateChange(d,i){const b=this.pendingRequests[d];if(!b)return;const y=b.xhr;if(y.readyState>=2&&b.onHeadersReceived&&(b.onHeadersReceived(),delete b.onHeadersReceived),y.readyState!==4||!(d in this.pendingRequests))return;if(delete this.pendingRequests[d],y.status===0&&this.isHttp){b.onError?.(y.status);return}const f=y.status||s;if(!(f===s&&b.expectedStatus===N)&&f!==b.expectedStatus){b.onError?.(y.status);return}const H=ee(y);if(f===N){const I=y.getResponseHeader("Content-Range"),_=/bytes (\d+)-(\d+)\/(\d+)/.exec(I);b.onDone({begin:parseInt(_[1],10),chunk:H})}else H?b.onDone({begin:0,chunk:H}):b.onError?.(y.status)}getRequestXhr(d){return this.pendingRequests[d].xhr}isPendingRequest(d){return d in this.pendingRequests}abortRequest(d){const i=this.pendingRequests[d].xhr;delete this.pendingRequests[d],i.abort()}}class o{constructor(d){this._source=d,this._manager=new U(d.url,{httpHeaders:d.httpHeaders,withCredentials:d.withCredentials}),this._rangeChunkSize=d.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(d){const i=this._rangeRequestReaders.indexOf(d);i>=0&&this._rangeRequestReaders.splice(i,1)}getFullReader(){return(0,p.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new t(this._manager,this._source),this._fullRequestReader}getRangeReader(d,i){const b=new a(this._manager,d,i);return b.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(b),b}cancelAllRequests(d){this._fullRequestReader?.cancel(d);for(const i of this._rangeRequestReaders.slice(0))i.cancel(d)}}c.PDFNetworkStream=o;class t{constructor(d,i){this._manager=d;const b={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=i.url,this._fullRequestId=d.requestFull(b),this._headersReceivedCapability=new p.PromiseCapability,this._disableRange=i.disableRange||!1,this._contentLength=i.length,this._rangeChunkSize=i.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const d=this._fullRequestId,i=this._manager.getRequestXhr(d),b=T=>i.getResponseHeader(T),{allowRangeRequests:y,suggestedLength:f}=(0,e.validateRangeRequestCapabilities)({getResponseHeader:b,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});y&&(this._isRangeSupported=!0),this._contentLength=f||this._contentLength,this._filename=(0,e.extractFilenameFromHeader)(b),this._isRangeSupported&&this._manager.abortRequest(d),this._headersReceivedCapability.resolve()}_onDone(d){if(d&&(this._requests.length>0?this._requests.shift().resolve({value:d.chunk,done:!1}):this._cachedChunks.push(d.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(d){this._storedError=(0,e.createResponseStatusError)(d,this._url),this._headersReceivedCapability.reject(this._storedError);for(const i of this._requests)i.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(d){this.onProgress?.({loaded:d.loaded,total:d.lengthComputable?d.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const d=new p.PromiseCapability;return this._requests.push(d),d.promise}cancel(d){this._done=!0,this._headersReceivedCapability.reject(d);for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class a{constructor(d,i,b){this._manager=d;const y={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=d.url,this._requestId=d.requestRange(i,b,y),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(d){const i=d.chunk;this._requests.length>0?this._requests.shift().resolve({value:i,done:!1}):this._queuedChunk=i,this._done=!0;for(const b of this._requests)b.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(d){this._storedError=(0,e.createResponseStatusError)(d,this._url);for(const i of this._requests)i.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(d){this.isStreamingSupported||this.onProgress?.({loaded:d.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const i=this._queuedChunk;return this._queuedChunk=null,{value:i,done:!1}}if(this._done)return{value:void 0,done:!0};const d=new p.PromiseCapability;return this._requests.push(d),d.promise}cancel(d){this._done=!0;for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.PDFNodeStream=void 0;var p=q(1),e=q(20);const s=/^file:\/\/\/[a-zA-Z]:\//;function N(b){const y=index.require$$5,f=y.parse(b);return f.protocol==="file:"||f.host?f:/^[a-z]:[/\\]/i.test(b)?y.parse(`file:///${b}`):(f.host||(f.protocol="file:"),f)}class ee{constructor(y){this.source=y,this.url=N(y.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.httpHeaders=this.isHttp&&y.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,p.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new d(this):new a(this),this._fullRequestReader}getRangeReader(y,f){if(f<=this._progressiveDataLength)return null;const T=this.isFsUrl?new i(this,y,f):new g(this,y,f);return this._rangeRequestReaders.push(T),T}cancelAllRequests(y){this._fullRequestReader?.cancel(y);for(const f of this._rangeRequestReaders.slice(0))f.cancel(y)}}c.PDFNodeStream=ee;class U{constructor(y){this._url=y.url,this._done=!1,this._storedError=null,this.onProgress=null;const f=y.source;this._contentLength=f.length,this._loaded=0,this._filename=null,this._disableRange=f.disableRange||!1,this._rangeChunkSize=f.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!f.disableStream,this._isRangeSupported=!f.disableRange,this._readableStream=null,this._readCapability=new p.PromiseCapability,this._headersCapability=new p.PromiseCapability}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const y=this._readableStream.read();return y===null?(this._readCapability=new p.PromiseCapability,this.read()):(this._loaded+=y.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(y).buffer,done:!1})}cancel(y){if(!this._readableStream){this._error(y);return}this._readableStream.destroy(y)}_error(y){this._storedError=y,this._readCapability.resolve()}_setReadableStream(y){this._readableStream=y,y.on("readable",()=>{this._readCapability.resolve()}),y.on("end",()=>{y.destroy(),this._done=!0,this._readCapability.resolve()}),y.on("error",f=>{this._error(f)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new p.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class o{constructor(y){this._url=y.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=new p.PromiseCapability;const f=y.source;this._isStreamingSupported=!f.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const y=this._readableStream.read();return y===null?(this._readCapability=new p.PromiseCapability,this.read()):(this._loaded+=y.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(y).buffer,done:!1})}cancel(y){if(!this._readableStream){this._error(y);return}this._readableStream.destroy(y)}_error(y){this._storedError=y,this._readCapability.resolve()}_setReadableStream(y){this._readableStream=y,y.on("readable",()=>{this._readCapability.resolve()}),y.on("end",()=>{y.destroy(),this._done=!0,this._readCapability.resolve()}),y.on("error",f=>{this._error(f)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function t(b,y){return{protocol:b.protocol,auth:b.auth,host:b.hostname,port:b.port,path:b.path,method:"GET",headers:y}}class a extends U{constructor(y){super(y);const f=T=>{if(T.statusCode===404){const M=new p.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=M,this._headersCapability.reject(M);return}this._headersCapability.resolve(),this._setReadableStream(T);const H=M=>this._readableStream.headers[M.toLowerCase()],{allowRangeRequests:I,suggestedLength:_}=(0,e.validateRangeRequestCapabilities)({getResponseHeader:H,isHttp:y.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=I,this._contentLength=_||this._contentLength,this._filename=(0,e.extractFilenameFromHeader)(H)};if(this._request=null,this._url.protocol==="http:"){const T=index.require$$5;this._request=T.request(t(this._url,y.httpHeaders),f)}else{const T=index.require$$5;this._request=T.request(t(this._url,y.httpHeaders),f)}this._request.on("error",T=>{this._storedError=T,this._headersCapability.reject(T)}),this._request.end()}}class g extends o{constructor(y,f,T){super(y),this._httpHeaders={};for(const I in y.httpHeaders){const _=y.httpHeaders[I];_!==void 0&&(this._httpHeaders[I]=_)}this._httpHeaders.Range=`bytes=${f}-${T-1}`;const H=I=>{if(I.statusCode===404){const _=new p.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=_;return}this._setReadableStream(I)};if(this._request=null,this._url.protocol==="http:"){const I=index.require$$5;this._request=I.request(t(this._url,this._httpHeaders),H)}else{const I=index.require$$5;this._request=I.request(t(this._url,this._httpHeaders),H)}this._request.on("error",I=>{this._storedError=I}),this._request.end()}}class d extends U{constructor(y){super(y);let f=decodeURIComponent(this._url.path);s.test(this._url.href)&&(f=f.replace(/^\//,""));const T=index.require$$5;T.lstat(f,(H,I)=>{if(H){H.code==="ENOENT"&&(H=new p.MissingPDFException(`Missing PDF "${f}".`)),this._storedError=H,this._headersCapability.reject(H);return}this._contentLength=I.size,this._setReadableStream(T.createReadStream(f)),this._headersCapability.resolve()})}}class i extends o{constructor(y,f,T){super(y);let H=decodeURIComponent(this._url.path);s.test(this._url.href)&&(H=H.replace(/^\//,""));const I=index.require$$5;this._setReadableStream(I.createReadStream(H,{start:f,end:T-1}))}}}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.SVGGraphics=void 0;var p=q(6),e=q(1);const s={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},N="http://www.w3.org/XML/1998/namespace",ee="http://www.w3.org/1999/xlink",U=["butt","round","square"],o=["miter","round","bevel"],t=function(I,_="",M=!1){if(URL.createObjectURL&&typeof Blob<"u"&&!M)return URL.createObjectURL(new Blob([I],{type:_}));const te="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let ie=`data:${_};base64,`;for(let Y=0,he=I.length;Y<he;Y+=3){const ge=I[Y]&255,Ne=I[Y+1]&255,ke=I[Y+2]&255,Oe=ge>>2,Ve=(ge&3)<<4|Ne>>4,Ee=Y+1<he?(Ne&15)<<2|ke>>6:64,G=Y+2<he?ke&63:64;ie+=te[Oe]+te[Ve]+te[Ee]+te[G]}return ie},a=(function(){const I=new Uint8Array([137,80,78,71,13,10,26,10]),_=12,M=new Int32Array(256);for(let ke=0;ke<256;ke++){let Oe=ke;for(let Ve=0;Ve<8;Ve++)Oe=Oe&1?3988292384^Oe>>1&2147483647:Oe>>1&2147483647;M[ke]=Oe}function te(ke,Oe,Ve){let Ee=-1;for(let G=Oe;G<Ve;G++){const A=(Ee^ke[G])&255,m=M[A];Ee=Ee>>>8^m}return Ee^-1}function ie(ke,Oe,Ve,Ee){let G=Ee;const A=Oe.length;Ve[G]=A>>24&255,Ve[G+1]=A>>16&255,Ve[G+2]=A>>8&255,Ve[G+3]=A&255,G+=4,Ve[G]=ke.charCodeAt(0)&255,Ve[G+1]=ke.charCodeAt(1)&255,Ve[G+2]=ke.charCodeAt(2)&255,Ve[G+3]=ke.charCodeAt(3)&255,G+=4,Ve.set(Oe,G),G+=Oe.length;const m=te(Ve,Ee+4,G);Ve[G]=m>>24&255,Ve[G+1]=m>>16&255,Ve[G+2]=m>>8&255,Ve[G+3]=m&255}function Y(ke,Oe,Ve){let Ee=1,G=0;for(let A=Oe;A<Ve;++A)Ee=(Ee+(ke[A]&255))%65521,G=(G+Ee)%65521;return G<<16|Ee}function he(ke){if(!e.isNodeJS)return ge(ke);try{const Oe=parseInt(process.versions.node)>=8?ke:Buffer.from(ke),Ve=index.require$$5.deflateSync(Oe,{level:9});return Ve instanceof Uint8Array?Ve:new Uint8Array(Ve)}catch(Oe){(0,e.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+Oe)}return ge(ke)}function ge(ke){let Oe=ke.length;const Ve=65535,Ee=Math.ceil(Oe/Ve),G=new Uint8Array(2+Oe+Ee*5+4);let A=0;G[A++]=120,G[A++]=156;let m=0;for(;Oe>Ve;)G[A++]=0,G[A++]=255,G[A++]=255,G[A++]=0,G[A++]=0,G.set(ke.subarray(m,m+Ve),A),A+=Ve,m+=Ve,Oe-=Ve;G[A++]=1,G[A++]=Oe&255,G[A++]=Oe>>8&255,G[A++]=~Oe&65535&255,G[A++]=(~Oe&65535)>>8&255,G.set(ke.subarray(m),A),A+=ke.length-m;const v=Y(ke,0,ke.length);return G[A++]=v>>24&255,G[A++]=v>>16&255,G[A++]=v>>8&255,G[A++]=v&255,G}function Ne(ke,Oe,Ve,Ee){const G=ke.width,A=ke.height;let m,v,C;const V=ke.data;switch(Oe){case e.ImageKind.GRAYSCALE_1BPP:v=0,m=1,C=G+7>>3;break;case e.ImageKind.RGB_24BPP:v=2,m=8,C=G*3;break;case e.ImageKind.RGBA_32BPP:v=6,m=8,C=G*4;break;default:throw new Error("invalid format")}const W=new Uint8Array((1+C)*A);let K=0,L=0;for(let Z=0;Z<A;++Z)W[K++]=0,W.set(V.subarray(L,L+C),K),L+=C,K+=C;if(Oe===e.ImageKind.GRAYSCALE_1BPP&&Ee){K=0;for(let Z=0;Z<A;Z++){K++;for(let re=0;re<C;re++)W[K++]^=255}}const l=new Uint8Array([G>>24&255,G>>16&255,G>>8&255,G&255,A>>24&255,A>>16&255,A>>8&255,A&255,m,v,0,0,0]),S=he(W),R=I.length+_*3+l.length+S.length,O=new Uint8Array(R);let B=0;return O.set(I,B),B+=I.length,ie("IHDR",l,O,B),B+=_+l.length,ie("IDATA",S,O,B),B+=_+S.length,ie("IEND",new Uint8Array(0),O,B),t(O,"image/png",Ve)}return function(Oe,Ve,Ee){const G=Oe.kind===void 0?e.ImageKind.GRAYSCALE_1BPP:Oe.kind;return Ne(Oe,G,Ve,Ee)}})();class g{constructor(){this.fontSizeScale=1,this.fontWeight=s.fontWeight,this.fontSize=0,this.textMatrix=e.IDENTITY_MATRIX,this.fontMatrix=e.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=e.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=s.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(_,M){this.x=_,this.y=M}}function d(I){let _=[];const M=[];for(const te of I){if(te.fn==="save"){_.push({fnId:92,fn:"group",items:[]}),M.push(_),_=_.at(-1).items;continue}te.fn==="restore"?_=M.pop():_.push(te)}return _}function i(I){if(Number.isInteger(I))return I.toString();const _=I.toFixed(10);let M=_.length-1;if(_[M]!=="0")return _;do M--;while(_[M]==="0");return _.substring(0,_[M]==="."?M:M+1)}function b(I){if(I[4]===0&&I[5]===0){if(I[1]===0&&I[2]===0)return I[0]===1&&I[3]===1?"":`scale(${i(I[0])} ${i(I[3])})`;if(I[0]===I[3]&&I[1]===-I[2]){const _=Math.acos(I[0])*180/Math.PI;return`rotate(${i(_)})`}}else if(I[0]===1&&I[1]===0&&I[2]===0&&I[3]===1)return`translate(${i(I[4])} ${i(I[5])})`;return`matrix(${i(I[0])} ${i(I[1])} ${i(I[2])} ${i(I[3])} ${i(I[4])} ${i(I[5])})`}let y=0,f=0,T=0;class H{constructor(_,M,te=!1){(0,p.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future."),this.svgFactory=new p.DOMSVGFactory,this.current=new g,this.transformMatrix=e.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=_,this.objs=M,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!te,this._operatorIdMapping=[];for(const ie in e.OPS)this._operatorIdMapping[e.OPS[ie]]=ie}getObject(_,M=null){return typeof _=="string"?_.startsWith("g_")?this.commonObjs.get(_):this.objs.get(_):M}save(){this.transformStack.push(this.transformMatrix);const _=this.current;this.extraStack.push(_),this.current=_.clone()}restore(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}group(_){this.save(),this.executeOpTree(_),this.restore()}loadDependencies(_){const M=_.fnArray,te=_.argsArray;for(let ie=0,Y=M.length;ie<Y;ie++)if(M[ie]===e.OPS.dependency)for(const he of te[ie]){const ge=he.startsWith("g_")?this.commonObjs:this.objs,Ne=new Promise(ke=>{ge.get(he,ke)});this.current.dependencies.push(Ne)}return Promise.all(this.current.dependencies)}transform(_,M,te,ie,Y,he){const ge=[_,M,te,ie,Y,he];this.transformMatrix=e.Util.transform(this.transformMatrix,ge),this.tgrp=null}getSVG(_,M){this.viewport=M;const te=this._initialize(M);return this.loadDependencies(_).then(()=>(this.transformMatrix=e.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(_)),te))}convertOpList(_){const M=this._operatorIdMapping,te=_.argsArray,ie=_.fnArray,Y=[];for(let he=0,ge=ie.length;he<ge;he++){const Ne=ie[he];Y.push({fnId:Ne,fn:M[Ne],args:te[he]})}return d(Y)}executeOpTree(_){for(const M of _){const te=M.fn,ie=M.fnId,Y=M.args;switch(ie|0){case e.OPS.beginText:this.beginText();break;case e.OPS.dependency:break;case e.OPS.setLeading:this.setLeading(Y);break;case e.OPS.setLeadingMoveText:this.setLeadingMoveText(Y[0],Y[1]);break;case e.OPS.setFont:this.setFont(Y);break;case e.OPS.showText:this.showText(Y[0]);break;case e.OPS.showSpacedText:this.showText(Y[0]);break;case e.OPS.endText:this.endText();break;case e.OPS.moveText:this.moveText(Y[0],Y[1]);break;case e.OPS.setCharSpacing:this.setCharSpacing(Y[0]);break;case e.OPS.setWordSpacing:this.setWordSpacing(Y[0]);break;case e.OPS.setHScale:this.setHScale(Y[0]);break;case e.OPS.setTextMatrix:this.setTextMatrix(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5]);break;case e.OPS.setTextRise:this.setTextRise(Y[0]);break;case e.OPS.setTextRenderingMode:this.setTextRenderingMode(Y[0]);break;case e.OPS.setLineWidth:this.setLineWidth(Y[0]);break;case e.OPS.setLineJoin:this.setLineJoin(Y[0]);break;case e.OPS.setLineCap:this.setLineCap(Y[0]);break;case e.OPS.setMiterLimit:this.setMiterLimit(Y[0]);break;case e.OPS.setFillRGBColor:this.setFillRGBColor(Y[0],Y[1],Y[2]);break;case e.OPS.setStrokeRGBColor:this.setStrokeRGBColor(Y[0],Y[1],Y[2]);break;case e.OPS.setStrokeColorN:this.setStrokeColorN(Y);break;case e.OPS.setFillColorN:this.setFillColorN(Y);break;case e.OPS.shadingFill:this.shadingFill(Y[0]);break;case e.OPS.setDash:this.setDash(Y[0],Y[1]);break;case e.OPS.setRenderingIntent:this.setRenderingIntent(Y[0]);break;case e.OPS.setFlatness:this.setFlatness(Y[0]);break;case e.OPS.setGState:this.setGState(Y[0]);break;case e.OPS.fill:this.fill();break;case e.OPS.eoFill:this.eoFill();break;case e.OPS.stroke:this.stroke();break;case e.OPS.fillStroke:this.fillStroke();break;case e.OPS.eoFillStroke:this.eoFillStroke();break;case e.OPS.clip:this.clip("nonzero");break;case e.OPS.eoClip:this.clip("evenodd");break;case e.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case e.OPS.paintImageXObject:this.paintImageXObject(Y[0]);break;case e.OPS.paintInlineImageXObject:this.paintInlineImageXObject(Y[0]);break;case e.OPS.paintImageMaskXObject:this.paintImageMaskXObject(Y[0]);break;case e.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(Y[0],Y[1]);break;case e.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case e.OPS.closePath:this.closePath();break;case e.OPS.closeStroke:this.closeStroke();break;case e.OPS.closeFillStroke:this.closeFillStroke();break;case e.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case e.OPS.nextLine:this.nextLine();break;case e.OPS.transform:this.transform(Y[0],Y[1],Y[2],Y[3],Y[4],Y[5]);break;case e.OPS.constructPath:this.constructPath(Y[0],Y[1]);break;case e.OPS.endPath:this.endPath();break;case 92:this.group(M.items);break;default:(0,e.warn)(`Unimplemented operator ${te}`);break}}}setWordSpacing(_){this.current.wordSpacing=_}setCharSpacing(_){this.current.charSpacing=_}nextLine(){this.moveText(0,this.current.leading)}setTextMatrix(_,M,te,ie,Y,he){const ge=this.current;ge.textMatrix=ge.lineMatrix=[_,M,te,ie,Y,he],ge.textMatrixScale=Math.hypot(_,M),ge.x=ge.lineX=0,ge.y=ge.lineY=0,ge.xcoords=[],ge.ycoords=[],ge.tspan=this.svgFactory.createElement("svg:tspan"),ge.tspan.setAttributeNS(null,"font-family",ge.fontFamily),ge.tspan.setAttributeNS(null,"font-size",`${i(ge.fontSize)}px`),ge.tspan.setAttributeNS(null,"y",i(-ge.y)),ge.txtElement=this.svgFactory.createElement("svg:text"),ge.txtElement.append(ge.tspan)}beginText(){const _=this.current;_.x=_.lineX=0,_.y=_.lineY=0,_.textMatrix=e.IDENTITY_MATRIX,_.lineMatrix=e.IDENTITY_MATRIX,_.textMatrixScale=1,_.tspan=this.svgFactory.createElement("svg:tspan"),_.txtElement=this.svgFactory.createElement("svg:text"),_.txtgrp=this.svgFactory.createElement("svg:g"),_.xcoords=[],_.ycoords=[]}moveText(_,M){const te=this.current;te.x=te.lineX+=_,te.y=te.lineY+=M,te.xcoords=[],te.ycoords=[],te.tspan=this.svgFactory.createElement("svg:tspan"),te.tspan.setAttributeNS(null,"font-family",te.fontFamily),te.tspan.setAttributeNS(null,"font-size",`${i(te.fontSize)}px`),te.tspan.setAttributeNS(null,"y",i(-te.y))}showText(_){const M=this.current,te=M.font,ie=M.fontSize;if(ie===0)return;const Y=M.fontSizeScale,he=M.charSpacing,ge=M.wordSpacing,Ne=M.fontDirection,ke=M.textHScale*Ne,Oe=te.vertical,Ve=Oe?1:-1,Ee=te.defaultVMetrics,G=ie*M.fontMatrix[0];let A=0;for(const C of _){if(C===null){A+=Ne*ge;continue}else if(typeof C=="number"){A+=Ve*C*ie/1e3;continue}const V=(C.isSpace?ge:0)+he,W=C.fontChar;let K,L,l=C.width;if(Oe){let R;const O=C.vmetric||Ee;R=C.vmetric?O[1]:l*.5,R=-R*G;const B=O[2]*G;l=O?-O[0]:l,K=R/Y,L=(A+B)/Y}else K=A/Y,L=0;(C.isInFont||te.missingFile)&&(M.xcoords.push(M.x+K),Oe&&M.ycoords.push(-M.y+L),M.tspan.textContent+=W);const S=Oe?l*G-V*Ne:l*G+V*Ne;A+=S}M.tspan.setAttributeNS(null,"x",M.xcoords.map(i).join(" ")),Oe?M.tspan.setAttributeNS(null,"y",M.ycoords.map(i).join(" ")):M.tspan.setAttributeNS(null,"y",i(-M.y)),Oe?M.y-=A:M.x+=A*ke,M.tspan.setAttributeNS(null,"font-family",M.fontFamily),M.tspan.setAttributeNS(null,"font-size",`${i(M.fontSize)}px`),M.fontStyle!==s.fontStyle&&M.tspan.setAttributeNS(null,"font-style",M.fontStyle),M.fontWeight!==s.fontWeight&&M.tspan.setAttributeNS(null,"font-weight",M.fontWeight);const m=M.textRenderingMode&e.TextRenderingMode.FILL_STROKE_MASK;if(m===e.TextRenderingMode.FILL||m===e.TextRenderingMode.FILL_STROKE?(M.fillColor!==s.fillColor&&M.tspan.setAttributeNS(null,"fill",M.fillColor),M.fillAlpha<1&&M.tspan.setAttributeNS(null,"fill-opacity",M.fillAlpha)):M.textRenderingMode===e.TextRenderingMode.ADD_TO_PATH?M.tspan.setAttributeNS(null,"fill","transparent"):M.tspan.setAttributeNS(null,"fill","none"),m===e.TextRenderingMode.STROKE||m===e.TextRenderingMode.FILL_STROKE){const C=1/(M.textMatrixScale||1);this._setStrokeAttributes(M.tspan,C)}let v=M.textMatrix;M.textRise!==0&&(v=v.slice(),v[5]+=M.textRise),M.txtElement.setAttributeNS(null,"transform",`${b(v)} scale(${i(ke)}, -1)`),M.txtElement.setAttributeNS(N,"xml:space","preserve"),M.txtElement.append(M.tspan),M.txtgrp.append(M.txtElement),this._ensureTransformGroup().append(M.txtElement)}setLeadingMoveText(_,M){this.setLeading(-M),this.moveText(_,M)}addFontStyle(_){if(!_.data)throw new Error('addFontStyle: No font data available, ensure that the "fontExtraProperties" API parameter is set.');this.cssStyle||(this.cssStyle=this.svgFactory.createElement("svg:style"),this.cssStyle.setAttributeNS(null,"type","text/css"),this.defs.append(this.cssStyle));const M=t(_.data,_.mimetype,this.forceDataSchema);this.cssStyle.textContent+=`@font-face { font-family: "${_.loadedName}"; src: url(${M}); }
|
|
4
4
|
`}setFont(_){const M=this.current,te=this.commonObjs.get(_[0]);let ie=_[1];M.font=te,this.embedFonts&&!te.missingFile&&!this.embeddedFonts[te.loadedName]&&(this.addFontStyle(te),this.embeddedFonts[te.loadedName]=te),M.fontMatrix=te.fontMatrix||e.FONT_IDENTITY_MATRIX;let Y="normal";te.black?Y="900":te.bold&&(Y="bold");const he=te.italic?"italic":"normal";ie<0?(ie=-ie,M.fontDirection=-1):M.fontDirection=1,M.fontSize=ie,M.fontFamily=te.loadedName,M.fontWeight=Y,M.fontStyle=he,M.tspan=this.svgFactory.createElement("svg:tspan"),M.tspan.setAttributeNS(null,"y",i(-M.y)),M.xcoords=[],M.ycoords=[]}endText(){const _=this.current;_.textRenderingMode&e.TextRenderingMode.ADD_TO_PATH_FLAG&&_.txtElement?.hasChildNodes()&&(_.element=_.txtElement,this.clip("nonzero"),this.endPath())}setLineWidth(_){_>0&&(this.current.lineWidth=_)}setLineCap(_){this.current.lineCap=U[_]}setLineJoin(_){this.current.lineJoin=o[_]}setMiterLimit(_){this.current.miterLimit=_}setStrokeAlpha(_){this.current.strokeAlpha=_}setStrokeRGBColor(_,M,te){this.current.strokeColor=e.Util.makeHexColor(_,M,te)}setFillAlpha(_){this.current.fillAlpha=_}setFillRGBColor(_,M,te){this.current.fillColor=e.Util.makeHexColor(_,M,te),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(_){this.current.strokeColor=this._makeColorN_Pattern(_)}setFillColorN(_){this.current.fillColor=this._makeColorN_Pattern(_)}shadingFill(_){const{width:M,height:te}=this.viewport,ie=e.Util.inverseTransform(this.transformMatrix),[Y,he,ge,Ne]=e.Util.getAxialAlignedBoundingBox([0,0,M,te],ie),ke=this.svgFactory.createElement("svg:rect");ke.setAttributeNS(null,"x",Y),ke.setAttributeNS(null,"y",he),ke.setAttributeNS(null,"width",ge-Y),ke.setAttributeNS(null,"height",Ne-he),ke.setAttributeNS(null,"fill",this._makeShadingPattern(_)),this.current.fillAlpha<1&&ke.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(ke)}_makeColorN_Pattern(_){return _[0]==="TilingPattern"?this._makeTilingPattern(_):this._makeShadingPattern(_)}_makeTilingPattern(_){const M=_[1],te=_[2],ie=_[3]||e.IDENTITY_MATRIX,[Y,he,ge,Ne]=_[4],ke=_[5],Oe=_[6],Ve=_[7],Ee=`shading${T++}`,[G,A,m,v]=e.Util.normalizeRect([...e.Util.applyTransform([Y,he],ie),...e.Util.applyTransform([ge,Ne],ie)]),[C,V]=e.Util.singularValueDecompose2dScale(ie),W=ke*C,K=Oe*V,L=this.svgFactory.createElement("svg:pattern");L.setAttributeNS(null,"id",Ee),L.setAttributeNS(null,"patternUnits","userSpaceOnUse"),L.setAttributeNS(null,"width",W),L.setAttributeNS(null,"height",K),L.setAttributeNS(null,"x",`${G}`),L.setAttributeNS(null,"y",`${A}`);const l=this.svg,S=this.transformMatrix,R=this.current.fillColor,O=this.current.strokeColor,B=this.svgFactory.create(m-G,v-A);if(this.svg=B,this.transformMatrix=ie,Ve===2){const Z=e.Util.makeHexColor(...M);this.current.fillColor=Z,this.current.strokeColor=Z}return this.executeOpTree(this.convertOpList(te)),this.svg=l,this.transformMatrix=S,this.current.fillColor=R,this.current.strokeColor=O,L.append(B.childNodes[0]),this.defs.append(L),`url(#${Ee})`}_makeShadingPattern(_){switch(typeof _=="string"&&(_=this.objs.get(_)),_[0]){case"RadialAxial":const M=`shading${T++}`,te=_[3];let ie;switch(_[1]){case"axial":const Y=_[4],he=_[5];ie=this.svgFactory.createElement("svg:linearGradient"),ie.setAttributeNS(null,"id",M),ie.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),ie.setAttributeNS(null,"x1",Y[0]),ie.setAttributeNS(null,"y1",Y[1]),ie.setAttributeNS(null,"x2",he[0]),ie.setAttributeNS(null,"y2",he[1]);break;case"radial":const ge=_[4],Ne=_[5],ke=_[6],Oe=_[7];ie=this.svgFactory.createElement("svg:radialGradient"),ie.setAttributeNS(null,"id",M),ie.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),ie.setAttributeNS(null,"cx",Ne[0]),ie.setAttributeNS(null,"cy",Ne[1]),ie.setAttributeNS(null,"r",Oe),ie.setAttributeNS(null,"fx",ge[0]),ie.setAttributeNS(null,"fy",ge[1]),ie.setAttributeNS(null,"fr",ke);break;default:throw new Error(`Unknown RadialAxial type: ${_[1]}`)}for(const Y of te){const he=this.svgFactory.createElement("svg:stop");he.setAttributeNS(null,"offset",Y[0]),he.setAttributeNS(null,"stop-color",Y[1]),ie.append(he)}return this.defs.append(ie),`url(#${M})`;case"Mesh":return(0,e.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw new Error(`Unknown IR type: ${_[0]}`)}}setDash(_,M){this.current.dashArray=_,this.current.dashPhase=M}constructPath(_,M){const te=this.current;let ie=te.x,Y=te.y,he=[],ge=0;for(const Ne of _)switch(Ne|0){case e.OPS.rectangle:ie=M[ge++],Y=M[ge++];const ke=M[ge++],Oe=M[ge++],Ve=ie+ke,Ee=Y+Oe;he.push("M",i(ie),i(Y),"L",i(Ve),i(Y),"L",i(Ve),i(Ee),"L",i(ie),i(Ee),"Z");break;case e.OPS.moveTo:ie=M[ge++],Y=M[ge++],he.push("M",i(ie),i(Y));break;case e.OPS.lineTo:ie=M[ge++],Y=M[ge++],he.push("L",i(ie),i(Y));break;case e.OPS.curveTo:ie=M[ge+4],Y=M[ge+5],he.push("C",i(M[ge]),i(M[ge+1]),i(M[ge+2]),i(M[ge+3]),i(ie),i(Y)),ge+=6;break;case e.OPS.curveTo2:he.push("C",i(ie),i(Y),i(M[ge]),i(M[ge+1]),i(M[ge+2]),i(M[ge+3])),ie=M[ge+2],Y=M[ge+3],ge+=4;break;case e.OPS.curveTo3:ie=M[ge+2],Y=M[ge+3],he.push("C",i(M[ge]),i(M[ge+1]),i(ie),i(Y),i(ie),i(Y)),ge+=4;break;case e.OPS.closePath:he.push("Z");break}he=he.join(" "),te.path&&_.length>0&&_[0]!==e.OPS.rectangle&&_[0]!==e.OPS.moveTo?he=te.path.getAttributeNS(null,"d")+he:(te.path=this.svgFactory.createElement("svg:path"),this._ensureTransformGroup().append(te.path)),te.path.setAttributeNS(null,"d",he),te.path.setAttributeNS(null,"fill","none"),te.element=te.path,te.setCurrentPoint(ie,Y)}endPath(){const _=this.current;if(_.path=null,!this.pendingClip)return;if(!_.element){this.pendingClip=null;return}const M=`clippath${y++}`,te=this.svgFactory.createElement("svg:clipPath");te.setAttributeNS(null,"id",M),te.setAttributeNS(null,"transform",b(this.transformMatrix));const ie=_.element.cloneNode(!0);if(this.pendingClip==="evenodd"?ie.setAttributeNS(null,"clip-rule","evenodd"):ie.setAttributeNS(null,"clip-rule","nonzero"),this.pendingClip=null,te.append(ie),this.defs.append(te),_.activeClipUrl){_.clipGroup=null;for(const Y of this.extraStack)Y.clipGroup=null;te.setAttributeNS(null,"clip-path",_.activeClipUrl)}_.activeClipUrl=`url(#${M})`,this.tgrp=null}clip(_){this.pendingClip=_}closePath(){const _=this.current;if(_.path){const M=`${_.path.getAttributeNS(null,"d")}Z`;_.path.setAttributeNS(null,"d",M)}}setLeading(_){this.current.leading=-_}setTextRise(_){this.current.textRise=_}setTextRenderingMode(_){this.current.textRenderingMode=_}setHScale(_){this.current.textHScale=_/100}setRenderingIntent(_){}setFlatness(_){}setGState(_){for(const[M,te]of _)switch(M){case"LW":this.setLineWidth(te);break;case"LC":this.setLineCap(te);break;case"LJ":this.setLineJoin(te);break;case"ML":this.setMiterLimit(te);break;case"D":this.setDash(te[0],te[1]);break;case"RI":this.setRenderingIntent(te);break;case"FL":this.setFlatness(te);break;case"Font":this.setFont(te);break;case"CA":this.setStrokeAlpha(te);break;case"ca":this.setFillAlpha(te);break;default:(0,e.warn)(`Unimplemented graphic state operator ${M}`);break}}fill(){const _=this.current;_.element&&(_.element.setAttributeNS(null,"fill",_.fillColor),_.element.setAttributeNS(null,"fill-opacity",_.fillAlpha),this.endPath())}stroke(){const _=this.current;_.element&&(this._setStrokeAttributes(_.element),_.element.setAttributeNS(null,"fill","none"),this.endPath())}_setStrokeAttributes(_,M=1){const te=this.current;let ie=te.dashArray;M!==1&&ie.length>0&&(ie=ie.map(function(Y){return M*Y})),_.setAttributeNS(null,"stroke",te.strokeColor),_.setAttributeNS(null,"stroke-opacity",te.strokeAlpha),_.setAttributeNS(null,"stroke-miterlimit",i(te.miterLimit)),_.setAttributeNS(null,"stroke-linecap",te.lineCap),_.setAttributeNS(null,"stroke-linejoin",te.lineJoin),_.setAttributeNS(null,"stroke-width",i(M*te.lineWidth)+"px"),_.setAttributeNS(null,"stroke-dasharray",ie.map(i).join(" ")),_.setAttributeNS(null,"stroke-dashoffset",i(M*te.dashPhase)+"px")}eoFill(){this.current.element?.setAttributeNS(null,"fill-rule","evenodd"),this.fill()}fillStroke(){this.stroke(),this.fill()}eoFillStroke(){this.current.element?.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()}closeStroke(){this.closePath(),this.stroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.closePath(),this.eoFillStroke()}paintSolidColorImageMask(){const _=this.svgFactory.createElement("svg:rect");_.setAttributeNS(null,"x","0"),_.setAttributeNS(null,"y","0"),_.setAttributeNS(null,"width","1px"),_.setAttributeNS(null,"height","1px"),_.setAttributeNS(null,"fill",this.current.fillColor),this._ensureTransformGroup().append(_)}paintImageXObject(_){const M=this.getObject(_);if(!M){(0,e.warn)(`Dependent image with object ID ${_} is not ready yet`);return}this.paintInlineImageXObject(M)}paintInlineImageXObject(_,M){const te=_.width,ie=_.height,Y=a(_,this.forceDataSchema,!!M),he=this.svgFactory.createElement("svg:rect");he.setAttributeNS(null,"x","0"),he.setAttributeNS(null,"y","0"),he.setAttributeNS(null,"width",i(te)),he.setAttributeNS(null,"height",i(ie)),this.current.element=he,this.clip("nonzero");const ge=this.svgFactory.createElement("svg:image");ge.setAttributeNS(ee,"xlink:href",Y),ge.setAttributeNS(null,"x","0"),ge.setAttributeNS(null,"y",i(-ie)),ge.setAttributeNS(null,"width",i(te)+"px"),ge.setAttributeNS(null,"height",i(ie)+"px"),ge.setAttributeNS(null,"transform",`scale(${i(1/te)} ${i(-1/ie)})`),M?M.append(ge):this._ensureTransformGroup().append(ge)}paintImageMaskXObject(_){const M=this.getObject(_.data,_);if(M.bitmap){(0,e.warn)("paintImageMaskXObject: ImageBitmap support is not implemented, ensure that the `isOffscreenCanvasSupported` API parameter is disabled.");return}const te=this.current,ie=M.width,Y=M.height,he=te.fillColor;te.maskId=`mask${f++}`;const ge=this.svgFactory.createElement("svg:mask");ge.setAttributeNS(null,"id",te.maskId);const Ne=this.svgFactory.createElement("svg:rect");Ne.setAttributeNS(null,"x","0"),Ne.setAttributeNS(null,"y","0"),Ne.setAttributeNS(null,"width",i(ie)),Ne.setAttributeNS(null,"height",i(Y)),Ne.setAttributeNS(null,"fill",he),Ne.setAttributeNS(null,"mask",`url(#${te.maskId})`),this.defs.append(ge),this._ensureTransformGroup().append(Ne),this.paintInlineImageXObject(M,ge)}paintFormXObjectBegin(_,M){if(Array.isArray(_)&&_.length===6&&this.transform(_[0],_[1],_[2],_[3],_[4],_[5]),M){const te=M[2]-M[0],ie=M[3]-M[1],Y=this.svgFactory.createElement("svg:rect");Y.setAttributeNS(null,"x",M[0]),Y.setAttributeNS(null,"y",M[1]),Y.setAttributeNS(null,"width",i(te)),Y.setAttributeNS(null,"height",i(ie)),this.current.element=Y,this.clip("nonzero"),this.endPath()}}paintFormXObjectEnd(){}_initialize(_){const M=this.svgFactory.create(_.width,_.height),te=this.svgFactory.createElement("svg:defs");M.append(te),this.defs=te;const ie=this.svgFactory.createElement("svg:g");return ie.setAttributeNS(null,"transform",b(_.transform)),M.append(ie),this.svg=ie,M}_ensureClipGroup(){if(!this.current.clipGroup){const _=this.svgFactory.createElement("svg:g");_.setAttributeNS(null,"clip-path",this.current.activeClipUrl),this.svg.append(_),this.current.clipGroup=_}return this.current.clipGroup}_ensureTransformGroup(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",b(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}}c.SVGGraphics=H}),((r,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.XfaText=void 0;class q{static textContent(e){const s=[],N={items:s,styles:Object.create(null)};function ee(U){if(!U)return;let o=null;const t=U.name;if(t==="#text")o=U.value;else if(q.shouldBuildText(t))U?.attributes?.textContent?o=U.attributes.textContent:U.value&&(o=U.value);else return;if(o!==null&&s.push({str:o}),!!U.children)for(const a of U.children)ee(a)}return ee(e),N}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}c.XfaText=q}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.TextLayerRenderTask=void 0,c.renderTextLayer=b,c.updateTextLayer=y;var p=q(1),e=q(6);const s=1e5,N=30,ee=.8,U=new Map;function o(f,T){let H;if(T&&p.FeatureTest.isOffscreenCanvasSupported)H=new OffscreenCanvas(f,f).getContext("2d",{alpha:!1});else{const I=document.createElement("canvas");I.width=I.height=f,H=I.getContext("2d",{alpha:!1})}return H}function t(f,T){const H=U.get(f);if(H)return H;const I=o(N,T);I.font=`${N}px ${f}`;const _=I.measureText("");let M=_.fontBoundingBoxAscent,te=Math.abs(_.fontBoundingBoxDescent);if(M){const Y=M/(M+te);return U.set(f,Y),I.canvas.width=I.canvas.height=0,Y}I.strokeStyle="red",I.clearRect(0,0,N,N),I.strokeText("g",0,0);let ie=I.getImageData(0,0,N,N).data;te=0;for(let Y=ie.length-1-3;Y>=0;Y-=4)if(ie[Y]>0){te=Math.ceil(Y/4/N);break}I.clearRect(0,0,N,N),I.strokeText("A",0,N),ie=I.getImageData(0,0,N,N).data,M=0;for(let Y=0,he=ie.length;Y<he;Y+=4)if(ie[Y]>0){M=N-Math.floor(Y/4/N);break}if(I.canvas.width=I.canvas.height=0,M){const Y=M/(M+te);return U.set(f,Y),Y}return U.set(f,ee),ee}function a(f,T,H){const I=document.createElement("span"),_={angle:0,canvasWidth:0,hasText:T.str!=="",hasEOL:T.hasEOL,fontSize:0};f._textDivs.push(I);const M=p.Util.transform(f._transform,T.transform);let te=Math.atan2(M[1],M[0]);const ie=H[T.fontName];ie.vertical&&(te+=Math.PI/2);const Y=Math.hypot(M[2],M[3]),he=Y*t(ie.fontFamily,f._isOffscreenCanvasSupported);let ge,Ne;te===0?(ge=M[4],Ne=M[5]-he):(ge=M[4]+he*Math.sin(te),Ne=M[5]-he*Math.cos(te));const ke="calc(var(--scale-factor)*",Oe=I.style;f._container===f._rootContainer?(Oe.left=`${(100*ge/f._pageWidth).toFixed(2)}%`,Oe.top=`${(100*Ne/f._pageHeight).toFixed(2)}%`):(Oe.left=`${ke}${ge.toFixed(2)}px)`,Oe.top=`${ke}${Ne.toFixed(2)}px)`),Oe.fontSize=`${ke}${Y.toFixed(2)}px)`,Oe.fontFamily=ie.fontFamily,_.fontSize=Y,I.setAttribute("role","presentation"),I.textContent=T.str,I.dir=T.dir,f._fontInspectorEnabled&&(I.dataset.fontName=T.fontName),te!==0&&(_.angle=te*(180/Math.PI));let Ve=!1;if(T.str.length>1)Ve=!0;else if(T.str!==" "&&T.transform[0]!==T.transform[3]){const Ee=Math.abs(T.transform[0]),G=Math.abs(T.transform[3]);Ee!==G&&Math.max(Ee,G)/Math.min(Ee,G)>1.5&&(Ve=!0)}Ve&&(_.canvasWidth=ie.vertical?T.height:T.width),f._textDivProperties.set(I,_),f._isReadableStream&&f._layoutText(I)}function g(f){const{div:T,scale:H,properties:I,ctx:_,prevFontSize:M,prevFontFamily:te}=f,{style:ie}=T;let Y="";if(I.canvasWidth!==0&&I.hasText){const{fontFamily:he}=ie,{canvasWidth:ge,fontSize:Ne}=I;(M!==Ne||te!==he)&&(_.font=`${Ne*H}px ${he}`,f.prevFontSize=Ne,f.prevFontFamily=he);const{width:ke}=_.measureText(T.textContent);ke>0&&(Y=`scaleX(${ge*H/ke})`)}I.angle!==0&&(Y=`rotate(${I.angle}deg) ${Y}`),Y.length>0&&(ie.transform=Y)}function d(f){if(f._canceled)return;const T=f._textDivs,H=f._capability;if(T.length>s){H.resolve();return}if(!f._isReadableStream)for(const _ of T)f._layoutText(_);H.resolve()}class i{constructor({textContentSource:T,container:H,viewport:I,textDivs:_,textDivProperties:M,textContentItemsStr:te,isOffscreenCanvasSupported:ie}){this._textContentSource=T,this._isReadableStream=T instanceof ReadableStream,this._container=this._rootContainer=H,this._textDivs=_||[],this._textContentItemsStr=te||[],this._isOffscreenCanvasSupported=ie,this._fontInspectorEnabled=!!globalThis.FontInspector?.enabled,this._reader=null,this._textDivProperties=M||new WeakMap,this._canceled=!1,this._capability=new p.PromiseCapability,this._layoutTextParams={prevFontSize:null,prevFontFamily:null,div:null,scale:I.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:o(0,ie)};const{pageWidth:Y,pageHeight:he,pageX:ge,pageY:Ne}=I.rawDims;this._transform=[1,0,0,-1,-ge,Ne+he],this._pageWidth=Y,this._pageHeight=he,(0,e.setLayerDimensions)(H,I),this._capability.promise.finally(()=>{this._layoutTextParams=null}).catch(()=>{})}get promise(){return this._capability.promise}cancel(){this._canceled=!0,this._reader&&(this._reader.cancel(new p.AbortException("TextLayer task cancelled.")).catch(()=>{}),this._reader=null),this._capability.reject(new p.AbortException("TextLayer task cancelled."))}_processItems(T,H){for(const I of T){if(I.str===void 0){if(I.type==="beginMarkedContentProps"||I.type==="beginMarkedContent"){const _=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),I.id!==null&&this._container.setAttribute("id",`${I.id}`),_.append(this._container)}else I.type==="endMarkedContent"&&(this._container=this._container.parentNode);continue}this._textContentItemsStr.push(I.str),a(this,I,H)}}_layoutText(T){const H=this._layoutTextParams.properties=this._textDivProperties.get(T);if(this._layoutTextParams.div=T,g(this._layoutTextParams),H.hasText&&this._container.append(T),H.hasEOL){const I=document.createElement("br");I.setAttribute("role","presentation"),this._container.append(I)}}_render(){const T=new p.PromiseCapability;let H=Object.create(null);if(this._isReadableStream){const I=()=>{this._reader.read().then(({value:_,done:M})=>{if(M){T.resolve();return}Object.assign(H,_.styles),this._processItems(_.items,H),I()},T.reject)};this._reader=this._textContentSource.getReader(),I()}else if(this._textContentSource){const{items:I,styles:_}=this._textContentSource;this._processItems(I,_),T.resolve()}else throw new Error('No "textContentSource" parameter specified.');T.promise.then(()=>{H=null,d(this)},this._capability.reject)}}c.TextLayerRenderTask=i;function b(f){!f.textContentSource&&(f.textContent||f.textContentStream)&&((0,e.deprecated)("The TextLayerRender `textContent`/`textContentStream` parameters will be removed in the future, please use `textContentSource` instead."),f.textContentSource=f.textContent||f.textContentStream);const{container:T,viewport:H}=f,I=getComputedStyle(T),_=I.getPropertyValue("visibility"),M=parseFloat(I.getPropertyValue("--scale-factor"));_==="visible"&&(!M||Math.abs(M-H.scale)>1e-5)&&console.error("The `--scale-factor` CSS-variable must be set, to the same value as `viewport.scale`, either on the `container`-element itself or higher up in the DOM.");const te=new i(f);return te._render(),te}function y({container:f,viewport:T,textDivs:H,textDivProperties:I,isOffscreenCanvasSupported:_,mustRotate:M=!0,mustRescale:te=!0}){if(M&&(0,e.setLayerDimensions)(f,{rotation:T.rotation}),te){const ie=o(0,_),he={prevFontSize:null,prevFontFamily:null,div:null,scale:T.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:ie};for(const ge of H)he.properties=I.get(ge),he.div=ge,g(he)}}}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.AnnotationEditorLayer=void 0;var p=q(1),e=q(4),s=q(28),N=q(33),ee=q(6),U=q(34);class o{#e;#t=!1;#n=null;#r=this.pointerup.bind(this);#o=this.pointerdown.bind(this);#s=new Map;#a=!1;#l=!1;#c=!1;#i;static _initialized=!1;constructor({uiManager:a,pageIndex:g,div:d,accessibilityManager:i,annotationLayer:b,viewport:y,l10n:f}){const T=[s.FreeTextEditor,N.InkEditor,U.StampEditor];if(!o._initialized){o._initialized=!0;for(const H of T)H.initialize(f)}a.registerEditorTypes(T),this.#i=a,this.pageIndex=g,this.div=d,this.#e=i,this.#n=b,this.viewport=y,this.#i.addLayer(this)}get isEmpty(){return this.#s.size===0}updateToolbar(a){this.#i.updateToolbar(a)}updateMode(a=this.#i.getMode()){this.#p(),a===p.AnnotationEditorType.INK?(this.addInkEditorIfNeeded(!1),this.disableClick()):this.enableClick(),a!==p.AnnotationEditorType.NONE&&(this.div.classList.toggle("freeTextEditing",a===p.AnnotationEditorType.FREETEXT),this.div.classList.toggle("inkEditing",a===p.AnnotationEditorType.INK),this.div.classList.toggle("stampEditing",a===p.AnnotationEditorType.STAMP),this.div.hidden=!1)}addInkEditorIfNeeded(a){if(!a&&this.#i.getMode()!==p.AnnotationEditorType.INK)return;if(!a){for(const d of this.#s.values())if(d.isEmpty()){d.setInBackground();return}}this.#d({offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(a){this.#i.setEditingState(a)}addCommands(a){this.#i.addCommands(a)}enable(){this.div.style.pointerEvents="auto";const a=new Set;for(const d of this.#s.values())d.enableEditing(),d.annotationElementId&&a.add(d.annotationElementId);if(!this.#n)return;const g=this.#n.getEditableAnnotations();for(const d of g){if(d.hide(),this.#i.isDeletedAnnotationElement(d.data.id)||a.has(d.data.id))continue;const i=this.deserialize(d);i&&(this.addOrRebuild(i),i.enableEditing())}}disable(){this.#c=!0,this.div.style.pointerEvents="none";const a=new Set;for(const g of this.#s.values()){if(g.disableEditing(),!g.annotationElementId||g.serialize()!==null){a.add(g.annotationElementId);continue}this.getEditableAnnotation(g.annotationElementId)?.show(),g.remove()}if(this.#n){const g=this.#n.getEditableAnnotations();for(const d of g){const{id:i}=d.data;a.has(i)||this.#i.isDeletedAnnotationElement(i)||d.show()}}this.#p(),this.isEmpty&&(this.div.hidden=!0),this.#c=!1}getEditableAnnotation(a){return this.#n?.getEditableAnnotation(a)||null}setActiveEditor(a){this.#i.getActive()!==a&&this.#i.setActiveEditor(a)}enableClick(){this.div.addEventListener("pointerdown",this.#o),this.div.addEventListener("pointerup",this.#r)}disableClick(){this.div.removeEventListener("pointerdown",this.#o),this.div.removeEventListener("pointerup",this.#r)}attach(a){this.#s.set(a.id,a);const{annotationElementId:g}=a;g&&this.#i.isDeletedAnnotationElement(g)&&this.#i.removeDeletedAnnotationElement(a)}detach(a){this.#s.delete(a.id),this.#e?.removePointerInTextLayer(a.contentDiv),!this.#c&&a.annotationElementId&&this.#i.addDeletedAnnotationElement(a)}remove(a){this.detach(a),this.#i.removeEditor(a),a.div.contains(document.activeElement)&&setTimeout(()=>{this.#i.focusMainContainer()},0),a.div.remove(),a.isAttachedToDOM=!1,this.#l||this.addInkEditorIfNeeded(!1)}changeParent(a){a.parent!==this&&(a.annotationElementId&&(this.#i.addDeletedAnnotationElement(a.annotationElementId),e.AnnotationEditor.deleteAnnotationElement(a),a.annotationElementId=null),this.attach(a),a.parent?.detach(a),a.setParent(this),a.div&&a.isAttachedToDOM&&(a.div.remove(),this.div.append(a.div)))}add(a){if(this.changeParent(a),this.#i.addEditor(a),this.attach(a),!a.isAttachedToDOM){const g=a.render();this.div.append(g),a.isAttachedToDOM=!0}a.fixAndSetPosition(),a.onceAdded(),this.#i.addToAnnotationStorage(a)}moveEditorInDOM(a){if(!a.isAttachedToDOM)return;const{activeElement:g}=document;a.div.contains(g)&&(a._focusEventsAllowed=!1,setTimeout(()=>{a.div.contains(document.activeElement)?a._focusEventsAllowed=!0:(a.div.addEventListener("focusin",()=>{a._focusEventsAllowed=!0},{once:!0}),g.focus())},0)),a._structTreeParentId=this.#e?.moveElementInDOM(this.div,a.div,a.contentDiv,!0)}addOrRebuild(a){a.needsToBeRebuilt()?a.rebuild():this.add(a)}addUndoableEditor(a){const g=()=>a._uiManager.rebuild(a),d=()=>{a.remove()};this.addCommands({cmd:g,undo:d,mustExec:!1})}getNextId(){return this.#i.getId()}#f(a){switch(this.#i.getMode()){case p.AnnotationEditorType.FREETEXT:return new s.FreeTextEditor(a);case p.AnnotationEditorType.INK:return new N.InkEditor(a);case p.AnnotationEditorType.STAMP:return new U.StampEditor(a)}return null}pasteEditor(a,g){this.#i.updateToolbar(a),this.#i.updateMode(a);const{offsetX:d,offsetY:i}=this.#h(),b=this.getNextId(),y=this.#f({parent:this,id:b,x:d,y:i,uiManager:this.#i,isCentered:!0,...g});y&&this.add(y)}deserialize(a){switch(a.annotationType??a.annotationEditorType){case p.AnnotationEditorType.FREETEXT:return s.FreeTextEditor.deserialize(a,this,this.#i);case p.AnnotationEditorType.INK:return N.InkEditor.deserialize(a,this,this.#i);case p.AnnotationEditorType.STAMP:return U.StampEditor.deserialize(a,this,this.#i)}return null}#d(a,g){const d=this.getNextId(),i=this.#f({parent:this,id:d,x:a.offsetX,y:a.offsetY,uiManager:this.#i,isCentered:g});return i&&this.add(i),i}#h(){const{x:a,y:g,width:d,height:i}=this.div.getBoundingClientRect(),b=Math.max(0,a),y=Math.max(0,g),f=Math.min(window.innerWidth,a+d),T=Math.min(window.innerHeight,g+i),H=(b+f)/2-a,I=(y+T)/2-g,[_,M]=this.viewport.rotation%180===0?[H,I]:[I,H];return{offsetX:_,offsetY:M}}addNewEditor(){this.#d(this.#h(),!0)}setSelected(a){this.#i.setSelected(a)}toggleSelected(a){this.#i.toggleSelected(a)}isSelected(a){return this.#i.isSelected(a)}unselect(a){this.#i.unselect(a)}pointerup(a){const{isMac:g}=p.FeatureTest.platform;if(!(a.button!==0||a.ctrlKey&&g)&&a.target===this.div&&this.#a){if(this.#a=!1,!this.#t){this.#t=!0;return}if(this.#i.getMode()===p.AnnotationEditorType.STAMP){this.#i.unselectAll();return}this.#d(a,!1)}}pointerdown(a){if(this.#a){this.#a=!1;return}const{isMac:g}=p.FeatureTest.platform;if(a.button!==0||a.ctrlKey&&g||a.target!==this.div)return;this.#a=!0;const d=this.#i.getActive();this.#t=!d||d.isEmpty()}findNewParent(a,g,d){const i=this.#i.findParent(g,d);return i===null||i===this?!1:(i.changeParent(a),!0)}destroy(){this.#i.getActive()?.parent===this&&(this.#i.commitOrRemove(),this.#i.setActiveEditor(null));for(const a of this.#s.values())this.#e?.removePointerInTextLayer(a.contentDiv),a.setParent(null),a.isAttachedToDOM=!1,a.div.remove();this.div=null,this.#s.clear(),this.#i.removeLayer(this)}#p(){this.#l=!0;for(const a of this.#s.values())a.isEmpty()&&a.remove();this.#l=!1}render({viewport:a}){this.viewport=a,(0,ee.setLayerDimensions)(this.div,a);for(const g of this.#i.getEditors(this.pageIndex))this.add(g);this.updateMode()}update({viewport:a}){this.#i.commitOrRemove(),this.viewport=a,(0,ee.setLayerDimensions)(this.div,{rotation:a.rotation}),this.updateMode()}get pageDimensions(){const{pageWidth:a,pageHeight:g}=this.viewport.rawDims;return[a,g]}}c.AnnotationEditorLayer=o}),((r,c,q)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.FreeTextEditor=void 0;var p=q(1),e=q(5),s=q(4),N=q(29);class ee extends s.AnnotationEditor{#e=this.editorDivBlur.bind(this);#t=this.editorDivFocus.bind(this);#n=this.editorDivInput.bind(this);#r=this.editorDivKeydown.bind(this);#o;#s="";#a=`${this.id}-editor`;#l;#c=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){const o=ee.prototype,t=d=>d.isEmpty(),a=e.AnnotationEditorUIManager.TRANSLATE_SMALL,g=e.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,p.shadow)(this,"_keyboardManager",new e.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:[-a,0],checker:t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],o._translateEmpty,{args:[-g,0],checker:t}],[["ArrowRight","mac+ArrowRight"],o._translateEmpty,{args:[a,0],checker:t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],o._translateEmpty,{args:[g,0],checker:t}],[["ArrowUp","mac+ArrowUp"],o._translateEmpty,{args:[0,-a],checker:t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],o._translateEmpty,{args:[0,-g],checker:t}],[["ArrowDown","mac+ArrowDown"],o._translateEmpty,{args:[0,a],checker:t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],o._translateEmpty,{args:[0,g],checker:t}]]))}static _type="freetext";constructor(o){super({...o,name:"freeTextEditor"}),this.#o=o.color||ee._defaultColor||s.AnnotationEditor._defaultLineColor,this.#l=o.fontSize||ee._defaultFontSize}static initialize(o){s.AnnotationEditor.initialize(o,{strings:["free_text2_default_content","editor_free_text2_aria_label"]});const t=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(t.getPropertyValue("--freetext-padding"))}static updateDefaultParams(o,t){switch(o){case p.AnnotationEditorParamsType.FREETEXT_SIZE:ee._defaultFontSize=t;break;case p.AnnotationEditorParamsType.FREETEXT_COLOR:ee._defaultColor=t;break}}updateParams(o,t){switch(o){case p.AnnotationEditorParamsType.FREETEXT_SIZE:this.#i(t);break;case p.AnnotationEditorParamsType.FREETEXT_COLOR:this.#f(t);break}}static get defaultPropertiesToUpdate(){return[[p.AnnotationEditorParamsType.FREETEXT_SIZE,ee._defaultFontSize],[p.AnnotationEditorParamsType.FREETEXT_COLOR,ee._defaultColor||s.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[p.AnnotationEditorParamsType.FREETEXT_SIZE,this.#l],[p.AnnotationEditorParamsType.FREETEXT_COLOR,this.#o]]}#i(o){const t=g=>{this.editorDiv.style.fontSize=`calc(${g}px * var(--scale-factor))`,this.translate(0,-(g-this.#l)*this.parentScale),this.#l=g,this.#h()},a=this.#l;this.addCommands({cmd:()=>{t(o)},undo:()=>{t(a)},mustExec:!0,type:p.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#f(o){const t=this.#o;this.addCommands({cmd:()=>{this.#o=this.editorDiv.style.color=o},undo:()=>{this.#o=this.editorDiv.style.color=t},mustExec:!0,type:p.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(o,t){this._uiManager.translateSelectedEditors(o,t,!0)}getInitialTranslation(){const o=this.parentScale;return[-ee._internalPadding*o,-(ee._internalPadding+this.#l)*o]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(p.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.#r),this.editorDiv.addEventListener("focus",this.#t),this.editorDiv.addEventListener("blur",this.#e),this.editorDiv.addEventListener("input",this.#n))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#a),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",this.#r),this.editorDiv.removeEventListener("focus",this.#t),this.editorDiv.removeEventListener("blur",this.#e),this.editorDiv.removeEventListener("input",this.#n),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.#m();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()}#d(){const o=this.editorDiv.getElementsByTagName("div");if(o.length===0)return this.editorDiv.innerText;const t=[];for(const a of o)t.push(a.innerText.replace(/\r\n?|\n/,""));return t.join(`
|