mirror of
https://github.com/TypingMind/typingmind.git
synced 2025-04-08 14:19:08 +00:00
23 lines
No EOL
265 KiB
JavaScript
23 lines
No EOL
265 KiB
JavaScript
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[577],{99299:function(module,__unused_webpack_exports,__webpack_require__){var Buffer=__webpack_require__(48764).Buffer,process=__webpack_require__(34155);/**
|
||
* @licstart The following is the entire license notice for the
|
||
* JavaScript code in this page
|
||
*
|
||
* Copyright 2023 Mozilla Foundation
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*
|
||
* @licend The above is the entire license notice for the
|
||
* JavaScript code in this page
|
||
*/!function(o,l){module.exports=l()}(globalThis,()=>(()=>{"use strict";var __webpack_modules__=[,(o,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.VerbosityLevel=l.Util=l.UnknownErrorException=l.UnexpectedResponseException=l.TextRenderingMode=l.RenderingIntentFlag=l.PromiseCapability=l.PermissionFlag=l.PasswordResponses=l.PasswordException=l.PageActionEventType=l.OPS=l.MissingPDFException=l.MAX_IMAGE_SIZE_TO_CACHE=l.LINE_FACTOR=l.LINE_DESCENT_FACTOR=l.InvalidPDFException=l.ImageKind=l.IDENTITY_MATRIX=l.FormatError=l.FeatureTest=l.FONT_IDENTITY_MATRIX=l.DocumentActionEventType=l.CMapCompressionType=l.BaseException=l.BASELINE_FACTOR=l.AnnotationType=l.AnnotationStateModelType=l.AnnotationReviewState=l.AnnotationReplyType=l.AnnotationMode=l.AnnotationMarkedState=l.AnnotationFlag=l.AnnotationFieldFlag=l.AnnotationEditorType=l.AnnotationEditorPrefix=l.AnnotationEditorParamsType=l.AnnotationBorderStyleType=l.AnnotationActionEventType=l.AbortException=void 0,l.assert=th,l.bytesToString=tS,l.createValidAbsoluteUrl=tc,l.getModificationDate=tB,l.getVerbosityLevel=ta,l.info=tn,l.isArrayBuffer=tN,l.isArrayEqual=tj,l.normalizeUnicode=tq,l.objectFromMap=tP,l.objectSize=tT,l.setVerbosityLevel=tr,l.shadow=tu,l.string32=tE,l.stringToBytes=tC,l.stringToPDFString=tI,l.stringToUTF8String=tD,l.unreachable=tl,l.utf8StringToString=tL,l.warn=to;let u=[1,0,0,1,0,0];l.IDENTITY_MATRIX=u;let A=[.001,0,0,.001,0,0];l.FONT_IDENTITY_MATRIX=A;let S=1e7;l.MAX_IMAGE_SIZE_TO_CACHE=S;let C=1.35;l.LINE_FACTOR=C;let E=.35;l.LINE_DESCENT_FACTOR=E;let T=E/C;l.BASELINE_FACTOR=T;let P={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};l.RenderingIntentFlag=P;let M={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};l.AnnotationMode=M;let F="pdfjs_internal_editor_";l.AnnotationEditorPrefix=F;let O={DISABLE:-1,NONE:0,FREETEXT:3,INK:15};l.AnnotationEditorType=O;let I={FREETEXT_SIZE:1,FREETEXT_COLOR:2,FREETEXT_OPACITY:3,INK_COLOR:11,INK_THICKNESS:12,INK_OPACITY:13};l.AnnotationEditorParamsType=I;let D={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};l.PermissionFlag=D;let L={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4};l.TextRenderingMode=L;let N={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};l.ImageKind=N;let U={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26};l.AnnotationType=U;let H={MARKED:"Marked",REVIEW:"Review"};l.AnnotationStateModelType=H;let W={MARKED:"Marked",UNMARKED:"Unmarked"};l.AnnotationMarkedState=W;let z={ACCEPTED:"Accepted",REJECTED:"Rejected",CANCELLED:"Cancelled",COMPLETED:"Completed",NONE:"None"};l.AnnotationReviewState=z;let V={GROUP:"Group",REPLY:"R"};l.AnnotationReplyType=V;let $={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};l.AnnotationFlag=$;let X={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864};l.AnnotationFieldFlag=X;let K={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};l.AnnotationBorderStyleType=K;let Y={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"};l.AnnotationActionEventType=Y;let J={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};l.DocumentActionEventType=J;let Q={O:"PageOpen",C:"PageClose"};l.PageActionEventType=Q;let Z={ERRORS:0,WARNINGS:1,INFOS:5};l.VerbosityLevel=Z;let tt={NONE:0,BINARY:1};l.CMapCompressionType=tt;let te={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91};l.OPS=te;let ti={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};l.PasswordResponses=ti;let ts=Z.WARNINGS;function tr(o){Number.isInteger(o)&&(ts=o)}function ta(){return ts}function tn(o){ts>=Z.INFOS&&console.log(`Info: ${o}`)}function to(o){ts>=Z.WARNINGS&&console.log(`Warning: ${o}`)}function tl(o){throw Error(o)}function th(o,l){o||tl(l)}function td(o){switch(o?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function tc(o,l=null,u=null){if(!o)return null;try{if(u&&"string"==typeof o){if(u.addDefaultProtocol&&o.startsWith("www.")){let l=o.match(/\./g);l?.length>=2&&(o=`http://${o}`)}if(u.tryConvertEncoding)try{o=tD(o)}catch(o){}}let A=l?new URL(o,l):new URL(o);if(td(A))return A}catch(o){}return null}function tu(o,l,u,A=!1){return Object.defineProperty(o,l,{value:u,enumerable:!A,configurable:!0,writable:!1}),u}let tp=function(){function o(l,u){this.constructor===o&&tl("Cannot initialize BaseException."),this.message=l,this.name=u}return o.prototype=Error(),o.constructor=o,o}();l.BaseException=tp;class tg extends tp{constructor(o,l){super(o,"PasswordException"),this.code=l}}l.PasswordException=tg;class tf extends tp{constructor(o,l){super(o,"UnknownErrorException"),this.details=l}}l.UnknownErrorException=tf;class tm extends tp{constructor(o){super(o,"InvalidPDFException")}}l.InvalidPDFException=tm;class tb extends tp{constructor(o){super(o,"MissingPDFException")}}l.MissingPDFException=tb;class tA extends tp{constructor(o,l){super(o,"UnexpectedResponseException"),this.status=l}}l.UnexpectedResponseException=tA;class tv extends tp{constructor(o){super(o,"FormatError")}}l.FormatError=tv;class t_ extends tp{constructor(o){super(o,"AbortException")}}function tS(o){("object"!=typeof o||o?.length===void 0)&&tl("Invalid argument for bytesToString");let l=o.length,u=8192;if(l<8192)return String.fromCharCode.apply(null,o);let A=[];for(let S=0;S<l;S+=u){let C=Math.min(S+u,l),E=o.subarray(S,C);A.push(String.fromCharCode.apply(null,E))}return A.join("")}function tC(o){"string"!=typeof o&&tl("Invalid argument for stringToBytes");let l=o.length,u=new Uint8Array(l);for(let A=0;A<l;++A)u[A]=255&o.charCodeAt(A);return u}function tE(o){return String.fromCharCode(o>>24&255,o>>16&255,o>>8&255,255&o)}function tT(o){return Object.keys(o).length}function tP(o){let l=Object.create(null);for(let[u,A]of o)l[u]=A;return l}function tM(){let o=new Uint8Array(4);return o[0]=1,1===new Uint32Array(o.buffer,0,1)[0]}function tw(){try{return Function(""),!0}catch(o){return!1}}l.AbortException=t_;class tk{static get isLittleEndian(){return tu(this,"isLittleEndian",tM())}static get isEvalSupported(){return tu(this,"isEvalSupported",tw())}static get isOffscreenCanvasSupported(){return tu(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get platform(){return"undefined"==typeof navigator?tu(this,"platform",{isWin:!1,isMac:!1}):tu(this,"platform",{isWin:navigator.platform.includes("Win"),isMac:navigator.platform.includes("Mac")})}}l.FeatureTest=tk;let tR=[...Array(256).keys()].map(o=>o.toString(16).padStart(2,"0"));class tF{static makeHexColor(o,l,u){return`#${tR[o]}${tR[l]}${tR[u]}`}static scaleMinMax(o,l){let u;o[0]?(o[0]<0&&(u=l[0],l[0]=l[1],l[1]=u),l[0]*=o[0],l[1]*=o[0],o[3]<0&&(u=l[2],l[2]=l[3],l[3]=u),l[2]*=o[3],l[3]*=o[3]):(u=l[0],l[0]=l[2],l[2]=u,u=l[1],l[1]=l[3],l[3]=u,o[1]<0&&(u=l[2],l[2]=l[3],l[3]=u),l[2]*=o[1],l[3]*=o[1],o[2]<0&&(u=l[0],l[0]=l[1],l[1]=u),l[0]*=o[2],l[1]*=o[2]),l[0]+=o[4],l[1]+=o[4],l[2]+=o[5],l[3]+=o[5]}static transform(o,l){return[o[0]*l[0]+o[2]*l[1],o[1]*l[0]+o[3]*l[1],o[0]*l[2]+o[2]*l[3],o[1]*l[2]+o[3]*l[3],o[0]*l[4]+o[2]*l[5]+o[4],o[1]*l[4]+o[3]*l[5]+o[5]]}static applyTransform(o,l){return[o[0]*l[0]+o[1]*l[2]+l[4],o[0]*l[1]+o[1]*l[3]+l[5]]}static applyInverseTransform(o,l){let u=l[0]*l[3]-l[1]*l[2];return[(o[0]*l[3]-o[1]*l[2]+l[2]*l[5]-l[4]*l[3])/u,(-o[0]*l[1]+o[1]*l[0]+l[4]*l[1]-l[5]*l[0])/u]}static getAxialAlignedBoundingBox(o,l){let u=tF.applyTransform(o,l),A=tF.applyTransform(o.slice(2,4),l),S=tF.applyTransform([o[0],o[3]],l),C=tF.applyTransform([o[2],o[1]],l);return[Math.min(u[0],A[0],S[0],C[0]),Math.min(u[1],A[1],S[1],C[1]),Math.max(u[0],A[0],S[0],C[0]),Math.max(u[1],A[1],S[1],C[1])]}static inverseTransform(o){let l=o[0]*o[3]-o[1]*o[2];return[o[3]/l,-o[1]/l,-o[2]/l,o[0]/l,(o[2]*o[5]-o[4]*o[3])/l,(o[4]*o[1]-o[5]*o[0])/l]}static singularValueDecompose2dScale(o){let l=[o[0],o[2],o[1],o[3]],u=o[0]*l[0]+o[1]*l[2],A=o[0]*l[1]+o[1]*l[3],S=o[2]*l[0]+o[3]*l[2],C=o[2]*l[1]+o[3]*l[3],E=(u+C)/2,T=Math.sqrt((u+C)**2-4*(u*C-S*A))/2;return[Math.sqrt(E+T||1),Math.sqrt(E-T||1)]}static normalizeRect(o){let l=o.slice(0);return o[0]>o[2]&&(l[0]=o[2],l[2]=o[0]),o[1]>o[3]&&(l[1]=o[3],l[3]=o[1]),l}static intersect(o,l){let u=Math.max(Math.min(o[0],o[2]),Math.min(l[0],l[2])),A=Math.min(Math.max(o[0],o[2]),Math.max(l[0],l[2]));if(u>A)return null;let S=Math.max(Math.min(o[1],o[3]),Math.min(l[1],l[3])),C=Math.min(Math.max(o[1],o[3]),Math.max(l[1],l[3]));return S>C?null:[u,S,A,C]}static bezierBoundingBox(o,l,u,A,S,C,E,T){let P,M,F,O,I,D,L,N;let U=[],H=[[],[]];for(let H=0;H<2;++H){if(0===H?(M=6*o-12*u+6*S,P=-3*o+9*u-9*S+3*E,F=3*u-3*o):(M=6*l-12*A+6*C,P=-3*l+9*A-9*C+3*T,F=3*A-3*l),1e-12>Math.abs(P)){if(1e-12>Math.abs(M))continue;0<(O=-F/M)&&O<1&&U.push(O);continue}N=Math.sqrt(L=M*M-4*F*P),!(L<0)&&(0<(I=(-M+N)/(2*P))&&I<1&&U.push(I),0<(D=(-M-N)/(2*P))&&D<1&&U.push(D))}let W=U.length,z,V=W;for(;W--;)z=1-(O=U[W]),H[0][W]=z*z*z*o+3*z*z*O*u+3*z*O*O*S+O*O*O*E,H[1][W]=z*z*z*l+3*z*z*O*A+3*z*O*O*C+O*O*O*T;return H[0][V]=o,H[1][V]=l,H[0][V+1]=E,H[1][V+1]=T,H[0].length=H[1].length=V+2,[Math.min(...H[0]),Math.min(...H[1]),Math.max(...H[0]),Math.max(...H[1])]}}l.Util=tF;let tO=[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 tI(o){if(o[0]>="\xef"){let l;if("\xfe"===o[0]&&"\xff"===o[1]?l="utf-16be":"\xff"===o[0]&&"\xfe"===o[1]?l="utf-16le":"\xef"===o[0]&&"\xbb"===o[1]&&"\xbf"===o[2]&&(l="utf-8"),l)try{let u=new TextDecoder(l,{fatal:!0}),A=tC(o);return u.decode(A)}catch(o){to(`stringToPDFString: "${o}".`)}}let l=[];for(let u=0,A=o.length;u<A;u++){let A=tO[o.charCodeAt(u)];l.push(A?String.fromCharCode(A):o.charAt(u))}return l.join("")}function tD(o){return decodeURIComponent(escape(o))}function tL(o){return unescape(encodeURIComponent(o))}function tN(o){return"object"==typeof o&&o?.byteLength!==void 0}function tj(o,l){if(o.length!==l.length)return!1;for(let u=0,A=o.length;u<A;u++)if(o[u]!==l[u])return!1;return!0}function tB(o=new Date){return[o.getUTCFullYear().toString(),(o.getUTCMonth()+1).toString().padStart(2,"0"),o.getUTCDate().toString().padStart(2,"0"),o.getUTCHours().toString().padStart(2,"0"),o.getUTCMinutes().toString().padStart(2,"0"),o.getUTCSeconds().toString().padStart(2,"0")].join("")}class tU{#t=!1;constructor(){this.promise=new Promise((o,l)=>{this.resolve=l=>{this.#t=!0,o(l)},this.reject=o=>{this.#t=!0,l(o)}})}get settled(){return this.#t}}l.PromiseCapability=tU;let tG=null,tH=null;function tq(o){return tG||(tG=/([\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,tH=new Map([["ſt","ſt"]])),o.replaceAll(tG,(o,l,u)=>l?l.normalize("NFKC"):tH.get(u))}},(__unused_webpack_module,exports,__w_pdfjs_require__)=>{let createPDFNetworkStream;Object.defineProperty(exports,"__esModule",{value:!0}),exports.build=exports.RenderTask=exports.PDFWorkerUtil=exports.PDFWorker=exports.PDFPageProxy=exports.PDFDocumentProxy=exports.PDFDocumentLoadingTask=exports.PDFDataRangeTransport=exports.LoopbackPort=exports.DefaultStandardFontDataFactory=exports.DefaultFilterFactory=exports.DefaultCanvasFactory=exports.DefaultCMapReaderFactory=void 0,exports.getDocument=getDocument,exports.version=void 0;var _util=__w_pdfjs_require__(1),_annotation_storage=__w_pdfjs_require__(3),_display_utils=__w_pdfjs_require__(6),_font_loader=__w_pdfjs_require__(9),_canvas=__w_pdfjs_require__(11),_worker_options=__w_pdfjs_require__(14),_is_node=__w_pdfjs_require__(10),_message_handler=__w_pdfjs_require__(15),_metadata=__w_pdfjs_require__(16),_optional_content_config=__w_pdfjs_require__(17),_transport_stream=__w_pdfjs_require__(18),_xfa_text=__w_pdfjs_require__(19);let DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100,DELAYED_CLEANUP_TIMEOUT=5e3,DefaultCanvasFactory=_display_utils.DOMCanvasFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory;let DefaultCMapReaderFactory=_display_utils.DOMCMapReaderFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory;let DefaultFilterFactory=_display_utils.DOMFilterFactory;exports.DefaultFilterFactory=DefaultFilterFactory;let DefaultStandardFontDataFactory=_display_utils.DOMStandardFontDataFactory;if(exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory,_is_node.isNodeJS){let{NodeCanvasFactory,NodeCMapReaderFactory,NodeFilterFactory,NodeStandardFontDataFactory}=__w_pdfjs_require__(20);exports.DefaultCanvasFactory=DefaultCanvasFactory=NodeCanvasFactory,exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory=NodeCMapReaderFactory,exports.DefaultFilterFactory=DefaultFilterFactory=NodeFilterFactory,exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory=NodeStandardFontDataFactory}if(_is_node.isNodeJS){let{PDFNodeStream}=__w_pdfjs_require__(21);createPDFNetworkStream=o=>new PDFNodeStream(o)}else{let{PDFNetworkStream}=__w_pdfjs_require__(24),{PDFFetchStream}=__w_pdfjs_require__(25);createPDFNetworkStream=o=>(0,_display_utils.isValidFetchUrl)(o.url)?new PDFFetchStream(o):new PDFNetworkStream(o)}function getDocument(o){if("string"==typeof o||o instanceof URL?o={url:o}:(0,_util.isArrayBuffer)(o)&&(o={data:o}),"object"!=typeof o)throw Error("Invalid parameter in getDocument, need parameter object.");if(!o.url&&!o.data&&!o.range)throw Error("Invalid parameter object: need either .data, .range or .url");let l=new PDFDocumentLoadingTask,{docId:u}=l,A=o.url?getUrlProp(o.url):null,S=o.data?getDataProp(o.data):null,C=o.httpHeaders||null,E=!0===o.withCredentials,T=o.password??null,P=o.range instanceof PDFDataRangeTransport?o.range:null,M=Number.isInteger(o.rangeChunkSize)&&o.rangeChunkSize>0?o.rangeChunkSize:DEFAULT_RANGE_CHUNK_SIZE,F=o.worker instanceof PDFWorker?o.worker:null,O=o.verbosity,I="string"!=typeof o.docBaseUrl||(0,_display_utils.isDataScheme)(o.docBaseUrl)?null:o.docBaseUrl,D="string"==typeof o.cMapUrl?o.cMapUrl:null,L=!1!==o.cMapPacked,N=o.CMapReaderFactory||DefaultCMapReaderFactory,U="string"==typeof o.standardFontDataUrl?o.standardFontDataUrl:null,H=o.StandardFontDataFactory||DefaultStandardFontDataFactory,W=!0!==o.stopAtErrors,z=Number.isInteger(o.maxImageSize)&&o.maxImageSize>-1?o.maxImageSize:-1,V=!1!==o.isEvalSupported,$="boolean"==typeof o.isOffscreenCanvasSupported?o.isOffscreenCanvasSupported:!_is_node.isNodeJS,X=Number.isInteger(o.canvasMaxAreaInBytes)?o.canvasMaxAreaInBytes:-1,K="boolean"==typeof o.disableFontFace?o.disableFontFace:_is_node.isNodeJS,Y=!0===o.fontExtraProperties,J=!0===o.enableXfa,Q=o.ownerDocument||globalThis.document,Z=!0===o.disableRange,tt=!0===o.disableStream,te=!0===o.disableAutoFetch,ti=!0===o.pdfBug,ts=P?P.length:o.length??NaN,tr="boolean"==typeof o.useSystemFonts?o.useSystemFonts:!_is_node.isNodeJS&&!K,ta="boolean"==typeof o.useWorkerFetch?o.useWorkerFetch:N===_display_utils.DOMCMapReaderFactory&&H===_display_utils.DOMStandardFontDataFactory&&(0,_display_utils.isValidFetchUrl)(D,document.baseURI)&&(0,_display_utils.isValidFetchUrl)(U,document.baseURI),tn=o.canvasFactory||new DefaultCanvasFactory({ownerDocument:Q}),to=o.filterFactory||new DefaultFilterFactory({docId:u,ownerDocument:Q}),tl=null;(0,_util.setVerbosityLevel)(O);let th={canvasFactory:tn,filterFactory:to};if(ta||(th.cMapReaderFactory=new N({baseUrl:D,isCompressed:L}),th.standardFontDataFactory=new H({baseUrl:U})),!F){let o={verbosity:O,port:_worker_options.GlobalWorkerOptions.workerPort};F=o.port?PDFWorker.fromPort(o):new PDFWorker(o),l._worker=F}let td={docId:u,apiVersion:"3.7.107",data:S,password:T,disableAutoFetch:te,rangeChunkSize:M,length:ts,docBaseUrl:I,enableXfa:J,evaluatorOptions:{maxImageSize:z,disableFontFace:K,ignoreErrors:W,isEvalSupported:V,isOffscreenCanvasSupported:$,canvasMaxAreaInBytes:X,fontExtraProperties:Y,useSystemFonts:tr,cMapUrl:ta?D:null,standardFontDataUrl:ta?U:null}},tc={ignoreErrors:W,isEvalSupported:V,disableFontFace:K,fontExtraProperties:Y,enableXfa:J,ownerDocument:Q,disableAutoFetch:te,pdfBug:ti,styleElement:tl};return F.promise.then(function(){if(l.destroyed)throw Error("Loading aborted");return Promise.all([_fetchDocument(F,td),new Promise(function(o){let l;P?l=new _transport_stream.PDFDataTransportStream({length:ts,initialData:P.initialData,progressiveDone:P.progressiveDone,contentDispositionFilename:P.contentDispositionFilename,disableRange:Z,disableStream:tt},P):S||(l=createPDFNetworkStream({url:A,length:ts,httpHeaders:C,withCredentials:E,rangeChunkSize:M,disableRange:Z,disableStream:tt})),o(l)})]).then(function([o,A]){if(l.destroyed)throw Error("Loading aborted");let S=new _message_handler.MessageHandler(u,o,F.port),C=new WorkerTransport(S,l,A,tc,th);l._transport=C,S.send("Ready",null)})}).catch(l._capability.reject),l}async function _fetchDocument(o,l){if(o.destroyed)throw Error("Worker was destroyed");let u=await o.messageHandler.sendWithPromise("GetDocRequest",l,l.data?[l.data.buffer]:null);if(o.destroyed)throw Error("Worker was destroyed");return u}function getUrlProp(o){if(o instanceof URL)return o.href;try{return new URL(o,window.location).href}catch(l){if(_is_node.isNodeJS&&"string"==typeof o)return o}throw Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function getDataProp(o){if(_is_node.isNodeJS&&void 0!==Buffer&&o instanceof Buffer)return(0,_display_utils.deprecated)("Please provide binary data as `Uint8Array`, rather than `Buffer`."),new Uint8Array(o);if(o instanceof Uint8Array&&o.byteLength===o.buffer.byteLength)return o;if("string"==typeof o)return(0,_util.stringToBytes)(o);if("object"==typeof o&&!isNaN(o?.length)||(0,_util.isArrayBuffer)(o))return new Uint8Array(o);throw Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}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,await this._transport?.destroy(),this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}exports.PDFDocumentLoadingTask=PDFDocumentLoadingTask;class PDFDataRangeTransport{constructor(o,l,u=!1,A=null){this.length=o,this.initialData=l,this.progressiveDone=u,this.contentDispositionFilename=A,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=new _util.PromiseCapability}addRangeListener(o){this._rangeListeners.push(o)}addProgressListener(o){this._progressListeners.push(o)}addProgressiveReadListener(o){this._progressiveReadListeners.push(o)}addProgressiveDoneListener(o){this._progressiveDoneListeners.push(o)}onDataRange(o,l){for(let u of this._rangeListeners)u(o,l)}onDataProgress(o,l){this._readyCapability.promise.then(()=>{for(let u of this._progressListeners)u(o,l)})}onDataProgressiveRead(o){this._readyCapability.promise.then(()=>{for(let l of this._progressiveReadListeners)l(o)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(let o of this._progressiveDoneListeners)o()})}transportReady(){this._readyCapability.resolve()}requestDataRange(o,l){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}exports.PDFDataRangeTransport=PDFDataRangeTransport;class PDFDocumentProxy{constructor(o,l){this._pdfInfo=o,this._transport=l}get annotationStorage(){return this._transport.annotationStorage}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return(0,_util.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(o){return this._transport.getPage(o)}getPageIndex(o){return this._transport.getPageIndex(o)}getDestinations(){return this._transport.getDestinations()}getDestination(o){return this._transport.getDestination(o)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJavaScript(){return this._transport.getJavaScript()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){return this._transport.getOptionalContentConfig()}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(o=!1){return this._transport.startCleanup(o||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}exports.PDFDocumentProxy=PDFDocumentProxy;class PDFPageProxy{#i=null;#s=!1;constructor(o,l,u,A=!1){this._pageIndex=o,this._pageInfo=l,this._transport=u,this._stats=A?new _display_utils.StatTimer:null,this._pdfBug=A,this.commonObjs=u.commonObjs,this.objs=new PDFObjects,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:o,rotation:l=this.rotate,offsetX:u=0,offsetY:A=0,dontFlip:S=!1}={}){return new _display_utils.PageViewport({viewBox:this.view,scale:o,rotation:l,offsetX:u,offsetY:A,dontFlip:S})}getAnnotations({intent:o="display"}={}){let l=this._transport.getRenderingIntent(o);return this._transport.getAnnotations(this._pageIndex,l.renderingIntent)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get isPureXfa(){return(0,_util.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:o,viewport:l,intent:u="display",annotationMode:A=_util.AnnotationMode.ENABLE,transform:S=null,background:C=null,optionalContentConfigPromise:E=null,annotationCanvasMap:T=null,pageColors:P=null,printAnnotationStorage:M=null}){if(arguments[0]?.canvasFactory)throw Error("render no longer accepts the `canvasFactory`-option, please pass it to the `getDocument`-function instead.");this._stats?.time("Overall");let F=this._transport.getRenderingIntent(u,A,M);this.#s=!1,this.#r(),E||(E=this._transport.getOptionalContentConfig());let O=this._intentStates.get(F.cacheKey);O||(O=Object.create(null),this._intentStates.set(F.cacheKey,O)),O.streamReaderCancelTimeout&&(clearTimeout(O.streamReaderCancelTimeout),O.streamReaderCancelTimeout=null);let I=!!(F.renderingIntent&_util.RenderingIntentFlag.PRINT);O.displayReadyCapability||(O.displayReadyCapability=new _util.PromiseCapability,O.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(F));let D=o=>{O.renderTasks.delete(L),(this._maybeCleanupAfterRender||I)&&(this.#s=!0),this.#a(!I),o?(L.capability.reject(o),this._abortOperatorList({intentState:O,reason:o instanceof Error?o:Error(o)})):L.capability.resolve(),this._stats?.timeEnd("Rendering"),this._stats?.timeEnd("Overall")},L=new InternalRenderTask({callback:D,params:{canvasContext:o,viewport:l,transform:S,background:C},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:T,operatorList:O.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!I,pdfBug:this._pdfBug,pageColors:P});(O.renderTasks||=new Set).add(L);let N=L.task;return Promise.all([O.displayReadyCapability.promise,E]).then(([o,l])=>{if(this.#s){D();return}this._stats?.time("Rendering"),L.initializeGraphics({transparency:o,optionalContentConfig:l}),L.operatorListChanged()}).catch(D),N}getOperatorList({intent:o="display",annotationMode:l=_util.AnnotationMode.ENABLE,printAnnotationStorage:u=null}={}){let A;function S(){E.operatorList.lastChunk&&(E.opListReadCapability.resolve(E.operatorList),E.renderTasks.delete(A))}let C=this._transport.getRenderingIntent(o,l,u,!0),E=this._intentStates.get(C.cacheKey);return E||(E=Object.create(null),this._intentStates.set(C.cacheKey,E)),E.opListReadCapability||((A=Object.create(null)).operatorListChanged=S,E.opListReadCapability=new _util.PromiseCapability,(E.renderTasks||=new Set).add(A),E.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(C)),E.opListReadCapability.promise}streamTextContent({includeMarkedContent:o=!1,disableNormalization:l=!1}={}){let u=100;return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===o,disableNormalization:!0===l},{highWaterMark:u,size:o=>o.items.length})}getTextContent(o={}){if(this._transport._htmlForXfa)return this.getXfa().then(o=>_xfa_text.XfaText.textContent(o));let l=this.streamTextContent(o);return new Promise(function(o,u){function A(){S.read().then(function({value:l,done:u}){if(u){o(C);return}Object.assign(C.styles,l.styles),C.items.push(...l.items),A()},u)}let S=l.getReader(),C={items:[],styles:Object.create(null)};A()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let o=[];for(let l of this._intentStates.values())if(this._abortOperatorList({intentState:l,reason:Error("Page was destroyed."),force:!0}),!l.opListReadCapability)for(let u of l.renderTasks)o.push(u.completed),u.cancel();return this.objs.clear(),this.#s=!1,this.#r(),Promise.all(o)}cleanup(o=!1){this.#s=!0;let l=this.#a(!1);return o&&l&&(this._stats&&=new _display_utils.StatTimer),l}#a(o=!1){if(this.#r(),!this.#s)return!1;if(o)return this.#i=setTimeout(()=>{this.#i=null,this.#a(!1)},DELAYED_CLEANUP_TIMEOUT),!1;for(let{renderTasks:o,operatorList:l}of this._intentStates.values())if(o.size>0||!l.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#s=!1,!0}#r(){this.#i&&(clearTimeout(this.#i),this.#i=null)}_startRenderPage(o,l){let u=this._intentStates.get(l);u&&(this._stats?.timeEnd("Page Request"),u.displayReadyCapability?.resolve(o))}_renderPageChunk(o,l){for(let u=0,A=o.length;u<A;u++)l.operatorList.fnArray.push(o.fnArray[u]),l.operatorList.argsArray.push(o.argsArray[u]);for(let u of(l.operatorList.lastChunk=o.lastChunk,l.operatorList.separateAnnots=o.separateAnnots,l.renderTasks))u.operatorListChanged();o.lastChunk&&this.#a(!0)}_pumpOperatorList({renderingIntent:o,cacheKey:l,annotationStorageMap:u}){let A=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:o,cacheKey:l,annotationStorage:u}).getReader(),S=this._intentStates.get(l);S.streamReader=A;let C=()=>{A.read().then(({value:o,done:l})=>{if(l){S.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(o,S),C())},o=>{if(S.streamReader=null,!this._transport.destroyed){if(S.operatorList){for(let o of(S.operatorList.lastChunk=!0,S.renderTasks))o.operatorListChanged();this.#a(!0)}if(S.displayReadyCapability)S.displayReadyCapability.reject(o);else if(S.opListReadCapability)S.opListReadCapability.reject(o);else throw o}})};C()}_abortOperatorList({intentState:o,reason:l,force:u=!1}){if(o.streamReader){if(o.streamReaderCancelTimeout&&(clearTimeout(o.streamReaderCancelTimeout),o.streamReaderCancelTimeout=null),!u){if(o.renderTasks.size>0)return;if(l instanceof _display_utils.RenderingCancelledException){let u=RENDERING_CANCELLED_TIMEOUT;l.extraDelay>0&&l.extraDelay<1e3&&(u+=l.extraDelay),o.streamReaderCancelTimeout=setTimeout(()=>{o.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:o,reason:l,force:!0})},u);return}}if(o.streamReader.cancel(new _util.AbortException(l.message)).catch(()=>{}),o.streamReader=null,!this._transport.destroyed){for(let[l,u]of this._intentStates)if(u===o){this._intentStates.delete(l);break}this.cleanup()}}}get stats(){return this._stats}}exports.PDFPageProxy=PDFPageProxy;class LoopbackPort{#n=new Set;#o=Promise.resolve();postMessage(o,l){let u={data:structuredClone(o,l?{transfer:l}:null)};this.#o.then(()=>{for(let o of this.#n)o.call(this,u)})}addEventListener(o,l){this.#n.add(l)}removeEventListener(o,l){this.#n.delete(l)}terminate(){this.#n.clear()}}exports.LoopbackPort=LoopbackPort;let PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};if(exports.PDFWorkerUtil=PDFWorkerUtil,_is_node.isNodeJS)PDFWorkerUtil.isWorkerDisabled=!0,PDFWorkerUtil.fallbackWorkerSrc="./pdf.worker.js";else if("object"==typeof document){let pdfjsFilePath=document?.currentScript?.src;pdfjsFilePath&&(PDFWorkerUtil.fallbackWorkerSrc=pdfjsFilePath.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}PDFWorkerUtil.isSameOrigin=function(o,l){let u;try{if(!(u=new URL(o)).origin||"null"===u.origin)return!1}catch(o){return!1}let A=new URL(l,u);return u.origin===A.origin},PDFWorkerUtil.createCDNWrapper=function(o){let l=`importScripts("${o}");`;return URL.createObjectURL(new Blob([l]))};class PDFWorker{static #l=new WeakMap;constructor({name:o=null,port:l=null,verbosity:u=(0,_util.getVerbosityLevel)()}={}){if(l&&PDFWorker.#l.has(l))throw Error("Cannot use more than one PDFWorker per port.");if(this.name=o,this.destroyed=!1,this.verbosity=u,this._readyCapability=new _util.PromiseCapability,this._port=null,this._webWorker=null,this._messageHandler=null,l){PDFWorker.#l.set(l,this),this._initializeFromPort(l);return}this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(o){this._port=o,this._messageHandler=new _message_handler.MessageHandler("main","worker",o),this._messageHandler.on("ready",function(){}),this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}_initialize(){if(!PDFWorkerUtil.isWorkerDisabled&&!PDFWorker._mainThreadWorkerMessageHandler){let{workerSrc:o}=PDFWorker;try{PDFWorkerUtil.isSameOrigin(window.location.href,o)||(o=PDFWorkerUtil.createCDNWrapper(new URL(o,window.location).href));let l=new Worker(o),u=new _message_handler.MessageHandler("main","worker",l),A=()=>{l.removeEventListener("error",S),u.destroy(),l.terminate(),this.destroyed?this._readyCapability.reject(Error("Worker was destroyed")):this._setupFakeWorker()},S=()=>{this._webWorker||A()};l.addEventListener("error",S),u.on("test",o=>{if(l.removeEventListener("error",S),this.destroyed){A();return}o?(this._messageHandler=u,this._port=l,this._webWorker=l,this._readyCapability.resolve(),u.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),u.destroy(),l.terminate())}),u.on("ready",o=>{if(l.removeEventListener("error",S),this.destroyed){A();return}try{C()}catch(o){this._setupFakeWorker()}});let C=()=>{let o=new Uint8Array;u.send("test",o,[o.buffer])};C();return}catch(o){(0,_util.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){PDFWorkerUtil.isWorkerDisabled||((0,_util.warn)("Setting up fake worker."),PDFWorkerUtil.isWorkerDisabled=!0),PDFWorker._setupFakeWorkerGlobal.then(o=>{if(this.destroyed){this._readyCapability.reject(Error("Worker was destroyed"));return}let l=new LoopbackPort;this._port=l;let u=`fake${PDFWorkerUtil.fakeWorkerId++}`,A=new _message_handler.MessageHandler(u+"_worker",u,l);o.setup(A,l);let S=new _message_handler.MessageHandler(u,u+"_worker",l);this._messageHandler=S,this._readyCapability.resolve(),S.send("configure",{verbosity:this.verbosity})}).catch(o=>{this._readyCapability.reject(Error(`Setting up fake worker failed: "${o.message}".`))})}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),PDFWorker.#l.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(o){if(!o?.port)throw Error("PDFWorker.fromPort - invalid method signature.");return this.#l.has(o.port)?this.#l.get(o.port):new PDFWorker(o)}static get workerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(null!==PDFWorkerUtil.fallbackWorkerSrc)return _is_node.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'),PDFWorkerUtil.fallbackWorkerSrc;throw Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _mainThreadWorkerMessageHandler(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch(o){return null}}static get _setupFakeWorkerGlobal(){let loader=async()=>{let mainWorkerMessageHandler=this._mainThreadWorkerMessageHandler;if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_is_node.isNodeJS){let worker=eval("require")(this.workerSrc);return worker.WorkerMessageHandler}return await (0,_display_utils.loadScript)(this.workerSrc),window.pdfjsWorker.WorkerMessageHandler};return(0,_util.shadow)(this,"_setupFakeWorkerGlobal",loader())}}exports.PDFWorker=PDFWorker;class WorkerTransport{#h=new Map;#d=new Map;#c=new Map;constructor(o,l,u,A,S){this.messageHandler=o,this.loadingTask=l,this.commonObjs=new PDFObjects,this.fontLoader=new _font_loader.FontLoader({ownerDocument:A.ownerDocument,styleElement:A.styleElement}),this._params=A,this.canvasFactory=S.canvasFactory,this.filterFactory=S.filterFactory,this.cMapReaderFactory=S.cMapReaderFactory,this.standardFontDataFactory=S.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._passwordCapability=null,this._networkStream=u,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=new _util.PromiseCapability,this.setupMessageHandler()}#u(o,l=null){let u=this.#h.get(o);if(u)return u;let A=this.messageHandler.sendWithPromise(o,l);return this.#h.set(o,A),A}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}getRenderingIntent(o,l=_util.AnnotationMode.ENABLE,u=null,A=!1){let S=_util.RenderingIntentFlag.DISPLAY,C=null;switch(o){case"any":S=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":S=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${o}`)}switch(l){case _util.AnnotationMode.DISABLE:S+=_util.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case _util.AnnotationMode.ENABLE:break;case _util.AnnotationMode.ENABLE_FORMS:S+=_util.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case _util.AnnotationMode.ENABLE_STORAGE:C=((S+=_util.RenderingIntentFlag.ANNOTATIONS_STORAGE)&_util.RenderingIntentFlag.PRINT&&u instanceof _annotation_storage.PrintAnnotationStorage?u:this.annotationStorage).serializable;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${l}`)}return A&&(S+=_util.RenderingIntentFlag.OPLIST),{renderingIntent:S,cacheKey:`${S}_${_annotation_storage.AnnotationStorage.getHash(C)}`,annotationStorageMap:C}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=new _util.PromiseCapability,this._passwordCapability&&this._passwordCapability.reject(Error("Worker was destroyed during onPassword callback"));let o=[];for(let l of this.#d.values())o.push(l._destroy());this.#d.clear(),this.#c.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();let l=this.messageHandler.sendWithPromise("Terminate",null);return o.push(l),Promise.all(o).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#h.clear(),this.filterFactory.destroy(),this._networkStream&&this._networkStream.cancelAllRequests(new _util.AbortException("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){let{messageHandler:o,loadingTask:l}=this;o.on("GetReader",(o,l)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=o=>{this._lastProgress={loaded:o.loaded,total:o.total}},l.onPull=()=>{this._fullReader.read().then(function({value:o,done:u}){if(u){l.close();return}(0,_util.assert)(o instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),l.enqueue(new Uint8Array(o),1,[o])}).catch(o=>{l.error(o)})},l.onCancel=o=>{this._fullReader.cancel(o),l.ready.catch(o=>{if(!this.destroyed)throw o})}}),o.on("ReaderHeadersReady",o=>{let u=new _util.PromiseCapability,A=this._fullReader;return A.headersReady.then(()=>{A.isStreamingSupported&&A.isRangeSupported||(this._lastProgress&&l.onProgress?.(this._lastProgress),A.onProgress=o=>{l.onProgress?.({loaded:o.loaded,total:o.total})}),u.resolve({isStreamingSupported:A.isStreamingSupported,isRangeSupported:A.isRangeSupported,contentLength:A.contentLength})},u.reject),u.promise}),o.on("GetRangeReader",(o,l)=>{(0,_util.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");let u=this._networkStream.getRangeReader(o.begin,o.end);if(!u){l.close();return}l.onPull=()=>{u.read().then(function({value:o,done:u}){if(u){l.close();return}(0,_util.assert)(o instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),l.enqueue(new Uint8Array(o),1,[o])}).catch(o=>{l.error(o)})},l.onCancel=o=>{u.cancel(o),l.ready.catch(o=>{if(!this.destroyed)throw o})}}),o.on("GetDoc",({pdfInfo:o})=>{this._numPages=o.numPages,this._htmlForXfa=o.htmlForXfa,delete o.htmlForXfa,l._capability.resolve(new PDFDocumentProxy(o,this))}),o.on("DocException",function(o){let u;switch(o.name){case"PasswordException":u=new _util.PasswordException(o.message,o.code);break;case"InvalidPDFException":u=new _util.InvalidPDFException(o.message);break;case"MissingPDFException":u=new _util.MissingPDFException(o.message);break;case"UnexpectedResponseException":u=new _util.UnexpectedResponseException(o.message,o.status);break;case"UnknownErrorException":u=new _util.UnknownErrorException(o.message,o.details);break;default:(0,_util.unreachable)("DocException - expected a valid Error.")}l._capability.reject(u)}),o.on("PasswordRequest",o=>{if(this._passwordCapability=new _util.PromiseCapability,l.onPassword){let u=o=>{o instanceof Error?this._passwordCapability.reject(o):this._passwordCapability.resolve({password:o})};try{l.onPassword(u,o.code)}catch(o){this._passwordCapability.reject(o)}}else this._passwordCapability.reject(new _util.PasswordException(o.message,o.code));return this._passwordCapability.promise}),o.on("DataLoaded",o=>{l.onProgress?.({loaded:o.length,total:o.length}),this.downloadInfoCapability.resolve(o)}),o.on("StartRenderPage",o=>{this.destroyed||this.#d.get(o.pageIndex)._startRenderPage(o.transparency,o.cacheKey)}),o.on("commonobj",([l,u,A])=>{if(!(this.destroyed||this.commonObjs.has(l)))switch(u){case"Font":let S=this._params;if("error"in A){let o=A.error;(0,_util.warn)(`Error during font loading: ${o}`),this.commonObjs.resolve(l,o);break}let C=S.pdfBug&&globalThis.FontInspector?.enabled?(o,l)=>globalThis.FontInspector.fontAdded(o,l):null,E=new _font_loader.FontFaceObject(A,{isEvalSupported:S.isEvalSupported,disableFontFace:S.disableFontFace,ignoreErrors:S.ignoreErrors,inspectFont:C});this.fontLoader.bind(E).catch(u=>o.sendWithPromise("FontFallback",{id:l})).finally(()=>{!S.fontExtraProperties&&E.data&&(E.data=null),this.commonObjs.resolve(l,E)});break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(l,A);break;default:throw Error(`Got unknown common object type ${u}`)}}),o.on("obj",([o,l,u,A])=>{if(this.destroyed)return;let S=this.#d.get(l);if(!S.objs.has(o))switch(u){case"Image":if(S.objs.resolve(o,A),A){let o;if(A.bitmap){let{width:l,height:u}=A;o=l*u*4}else o=A.data?.length||0;o>_util.MAX_IMAGE_SIZE_TO_CACHE&&(S._maybeCleanupAfterRender=!0)}break;case"Pattern":S.objs.resolve(o,A);break;default:throw Error(`Got unknown object type ${u}`)}}),o.on("DocProgress",o=>{this.destroyed||l.onProgress?.({loaded:o.loaded,total:o.total})}),o.on("FetchBuiltInCMap",o=>this.destroyed?Promise.reject(Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(o):Promise.reject(Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),o.on("FetchStandardFontData",o=>this.destroyed?Promise.reject(Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(o):Promise.reject(Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){return this.annotationStorage.size<=0&&(0,_util.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead."),this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:this.annotationStorage.serializable,filename:this._fullReader?.filename??null}).finally(()=>{this.annotationStorage.resetModified()})}getPage(o){if(!Number.isInteger(o)||o<=0||o>this._numPages)return Promise.reject(Error("Invalid page request."));let l=o-1,u=this.#c.get(l);if(u)return u;let A=this.messageHandler.sendWithPromise("GetPage",{pageIndex:l}).then(o=>{if(this.destroyed)throw Error("Transport destroyed");let u=new PDFPageProxy(l,o,this,this._params.pdfBug);return this.#d.set(l,u),u});return this.#c.set(l,A),A}getPageIndex(o){return"object"!=typeof o||null===o||!Number.isInteger(o.num)||o.num<0||!Number.isInteger(o.gen)||o.gen<0?Promise.reject(Error("Invalid pageIndex request.")):this.messageHandler.sendWithPromise("GetPageIndex",{num:o.num,gen:o.gen})}getAnnotations(o,l){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:o,intent:l})}getFieldObjects(){return this.#u("GetFieldObjects")}hasJSActions(){return this.#u("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(o){return"string"!=typeof o?Promise.reject(Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:o})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getJavaScript(){return this.messageHandler.sendWithPromise("GetJavaScript",null)}getDocJSActions(){return this.messageHandler.sendWithPromise("GetDocJSActions",null)}getPageJSActions(o){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:o})}getStructTree(o){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:o})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then(o=>new _optional_content_config.OptionalContentConfig(o))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){let o="GetMetadata",l=this.#h.get(o);if(l)return l;let u=this.messageHandler.sendWithPromise(o,null).then(o=>({info:o[0],metadata:o[1]?new _metadata.Metadata(o[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#h.set(o,u),u}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(o=!1){if(!this.destroyed){for(let o of(await this.messageHandler.sendWithPromise("Cleanup",null),this.#d.values()))if(!o.cleanup())throw Error(`startCleanup: Page ${o.pageNumber} is currently rendering.`);this.commonObjs.clear(),o||this.fontLoader.clear(),this.#h.clear(),this.filterFactory.destroy(!0)}}get loadingParams(){let{disableAutoFetch:o,enableXfa:l}=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:o,enableXfa:l})}}class PDFObjects{#p=Object.create(null);#g(o){return this.#p[o]||(this.#p[o]={capability:new _util.PromiseCapability,data:null})}get(o,l=null){if(l){let u=this.#g(o);return u.capability.promise.then(()=>l(u.data)),null}let u=this.#p[o];if(!u?.capability.settled)throw Error(`Requesting object that isn't resolved yet ${o}.`);return u.data}has(o){let l=this.#p[o];return l?.capability.settled||!1}resolve(o,l=null){let u=this.#g(o);u.data=l,u.capability.resolve()}clear(){for(let o in this.#p){let{data:l}=this.#p[o];l?.bitmap?.close()}this.#p=Object.create(null)}}class RenderTask{#f=null;constructor(o){this.#f=o,this.onContinue=null}get promise(){return this.#f.capability.promise}cancel(o=0){this.#f.cancel(null,o)}get separateAnnots(){let{separateAnnots:o}=this.#f.operatorList;if(!o)return!1;let{annotationCanvasMap:l}=this.#f;return o.form||o.canvas&&l?.size>0}}exports.RenderTask=RenderTask;class InternalRenderTask{static #m=new WeakSet;constructor({callback:o,params:l,objs:u,commonObjs:A,annotationCanvasMap:S,operatorList:C,pageIndex:E,canvasFactory:T,filterFactory:P,useRequestAnimationFrame:M=!1,pdfBug:F=!1,pageColors:O=null}){this.callback=o,this.params=l,this.objs=u,this.commonObjs=A,this.annotationCanvasMap=S,this.operatorListIdx=null,this.operatorList=C,this._pageIndex=E,this.canvasFactory=T,this.filterFactory=P,this._pdfBug=F,this.pageColors=O,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===M&&"undefined"!=typeof window,this.cancelled=!1,this.capability=new _util.PromiseCapability,this.task=new RenderTask(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=l.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:o=!1,optionalContentConfig:l}){if(this.cancelled)return;if(this._canvas){if(InternalRenderTask.#m.has(this._canvas))throw Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");InternalRenderTask.#m.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());let{canvasContext:u,viewport:A,transform:S,background:C}=this.params;this.gfx=new _canvas.CanvasGraphics(u,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:l},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:S,viewport:A,transparency:o,background:C}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(o=null,l=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this._canvas&&InternalRenderTask.#m.delete(this._canvas),this.callback(o||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,"canvas",l))}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}this.stepper?.updateOperatorList(this.operatorList),this.running||this._continue()}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?window.requestAnimationFrame(()=>{this._nextBound().catch(this._cancelBound)}):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){!this.cancelled&&(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(this.pageColors),this._canvas&&InternalRenderTask.#m.delete(this._canvas),this.callback())))}}let version="3.7.107";exports.version=version;let build="036f855dc";exports.build=build},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.PrintAnnotationStorage=l.AnnotationStorage=void 0;var A=u(1),S=u(4),C=u(8);class E{#b=!1;#A=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(o,l){let u=this.#A.get(o);return void 0===u?l:Object.assign(l,u)}getRawValue(o){return this.#A.get(o)}remove(o){if(this.#A.delete(o),0===this.#A.size&&this.resetModified(),"function"==typeof this.onAnnotationEditor){for(let o of this.#A.values())if(o instanceof S.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(o,l){let u=this.#A.get(o),A=!1;if(void 0!==u)for(let[o,S]of Object.entries(l))u[o]!==S&&(A=!0,u[o]=S);else A=!0,this.#A.set(o,l);A&&this.#v(),l instanceof S.AnnotationEditor&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(l.constructor._type)}has(o){return this.#A.has(o)}getAll(){return this.#A.size>0?(0,A.objectFromMap)(this.#A):null}setAll(o){for(let[l,u]of Object.entries(o))this.setValue(l,u)}get size(){return this.#A.size}#v(){this.#b||(this.#b=!0,"function"==typeof this.onSetModified&&this.onSetModified())}resetModified(){this.#b&&(this.#b=!1,"function"==typeof this.onResetModified&&this.onResetModified())}get print(){return new T(this)}get serializable(){if(0===this.#A.size)return null;let o=new Map;for(let[l,u]of this.#A){let A=u instanceof S.AnnotationEditor?u.serialize():u;A&&o.set(l,A)}return o}static getHash(o){if(!o)return"";let l=new C.MurmurHash3_64;for(let[u,A]of o)l.update(`${u}:${JSON.stringify(A)}`);return l.hexdigest()}}l.AnnotationStorage=E;class T extends E{#y=null;constructor(o){super(),this.#y=structuredClone(o.serializable)}get print(){(0,A.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#y}}l.PrintAnnotationStorage=T},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.AnnotationEditor=void 0;var A=u(5),S=u(1);class C{#_=this.focusin.bind(this);#S=this.focusout.bind(this);#C=!1;#x=!1;#E=!1;_uiManager=null;#T=C._zIndex++;static _colorManager=new A.ColorManager;static _zIndex=1;constructor(o){this.constructor===C&&(0,S.unreachable)("Cannot initialize AnnotationEditor."),this.parent=o.parent,this.id=o.id,this.width=this.height=null,this.pageIndex=o.parent.pageIndex,this.name=o.name,this.div=null,this._uiManager=o.uiManager;let{rotation:l,rawDims:{pageWidth:u,pageHeight:A,pageX:E,pageY:T}}=this.parent.viewport;this.rotation=l,this.pageRotation=(360+l-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[u,A],this.pageTranslation=[E,T];let[P,M]=this.parentDimensions;this.x=o.x/P,this.y=o.y/M,this.isAttachedToDOM=!1}static get _defaultLineColor(){return(0,S.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}addCommands(o){this._uiManager.addCommands(o)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#T}setParent(o){null!==o&&(this.pageIndex=o.pageIndex,this.pageDimensions=o.pageDimensions),this.parent=o}focusin(o){this.#C?this.#C=!1:this.parent.setSelected(this)}focusout(o){if(!this.isAttachedToDOM)return;let l=o.relatedTarget;!l?.closest(`#${this.id}`)&&(o.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}dragstart(o){let l=this.parent.div.getBoundingClientRect();this.startX=o.clientX-l.x,this.startY=o.clientY-l.y,o.dataTransfer.setData("text/plain",this.id),o.dataTransfer.effectAllowed="move"}setAt(o,l,u,A){let[S,C]=this.parentDimensions;[u,A]=this.screenToPageTranslation(u,A),this.x=(o+u)/S,this.y=(l+A)/C,this.div.style.left=`${100*this.x}%`,this.div.style.top=`${100*this.y}%`}translate(o,l){let[u,A]=this.parentDimensions;[o,l]=this.screenToPageTranslation(o,l),this.x+=o/u,this.y+=l/A,this.div.style.left=`${100*this.x}%`,this.div.style.top=`${100*this.y}%`}screenToPageTranslation(o,l){switch(this.parentRotation){case 90:return[l,-o];case 180:return[-o,-l];case 270:return[-l,o];default:return[o,l]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{realScale:o}=this._uiManager.viewParameters,[l,u]=this.pageDimensions;return[l*o,u*o]}setDims(o,l){let[u,A]=this.parentDimensions;this.div.style.width=`${100*o/u}%`,this.div.style.height=`${100*l/A}%`}fixDims(){let{style:o}=this.div,{height:l,width:u}=o,A=u.endsWith("%"),S=l.endsWith("%");if(A&&S)return;let[C,E]=this.parentDimensions;A||(o.width=`${100*parseFloat(u)/C}%`),S||(o.height=`${100*parseFloat(l)/E}%`)}getInitialTranslation(){return[0,0]}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.setAttribute("tabIndex",0),this.setInForeground(),this.div.addEventListener("focusin",this.#_),this.div.addEventListener("focusout",this.#S);let[o,l]=this.getInitialTranslation();return this.translate(o,l),(0,A.bindEvents)(this,this.div,["dragstart","pointerdown"]),this.div}pointerdown(o){let{isMac:l}=S.FeatureTest.platform;if(0!==o.button||o.ctrlKey&&l){o.preventDefault();return}o.ctrlKey&&!l||o.shiftKey||o.metaKey&&l?this.parent.toggleSelected(this):this.parent.setSelected(this),this.#C=!0}getRect(o,l){let u=this.parentScale,[A,S]=this.pageDimensions,[C,E]=this.pageTranslation,T=o/u,P=l/u,M=this.x*A,F=this.y*S,O=this.width*A,I=this.height*S;switch(this.rotation){case 0:return[M+T+C,S-F-P-I+E,M+T+O+C,S-F-P+E];case 90:return[M+P+C,S-F+T+E,M+P+I+C,S-F+T+O+E];case 180:return[M-T-O+C,S-F+P+E,M-T+C,S-F+P+I+E];case 270:return[M-P-I+C,S-F-T-O+E,M-P+C,S-F-T+E];default:throw Error("Invalid rotation")}}getRectInCurrentCoords(o,l){let[u,A,S,C]=o,E=S-u,T=C-A;switch(this.rotation){case 0:return[u,l-C,E,T];case 90:return[u,l-A,T,E];case 180:return[S,l-A,E,T];case 270:return[S,l-C,T,E];default:throw Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#E=!0}disableEditMode(){this.#E=!1}isInEditMode(){return this.#E}shouldGetKeyboardEvents(){return!1}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){this.div?.addEventListener("focusin",this.#_)}serialize(){(0,S.unreachable)("An editor must be serializable")}static deserialize(o,l,u){let A=new this.prototype.constructor({parent:l,id:l.getNextId(),uiManager:u});A.rotation=o.rotation;let[S,C]=A.pageDimensions,[E,T,P,M]=A.getRectInCurrentCoords(o.rect,C);return A.x=E/S,A.y=T/C,A.width=P/S,A.height=M/C,A}remove(){this.div.removeEventListener("focusin",this.#_),this.div.removeEventListener("focusout",this.#S),this.isEmpty()||this.commit(),this.parent.remove(this)}select(){this.div?.classList.add("selectedEditor")}unselect(){this.div?.classList.remove("selectedEditor")}updateParams(o,l){}disableEditing(){}enableEditing(){}get propertiesToUpdate(){return{}}get contentDiv(){return this.div}get isEditing(){return this.#x}set isEditing(o){this.#x=o,o?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null)}}l.AnnotationEditor=C},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.KeyboardManager=l.CommandManager=l.ColorManager=l.AnnotationEditorUIManager=void 0,l.bindEvents=C,l.opacityToHex=E;var A=u(1),S=u(6);function C(o,l,u){for(let A of u)l.addEventListener(A,o[A].bind(o))}function E(o){return Math.round(Math.min(255,Math.max(1,255*o))).toString(16).padStart(2,"0")}class T{#P=0;getId(){return`${A.AnnotationEditorPrefix}${this.#P++}`}}class P{#M=[];#w=!1;#k;#R=-1;constructor(o=128){this.#k=o}add({cmd:o,undo:l,mustExec:u,type:A=NaN,overwriteIfSameType:S=!1,keepUndo:C=!1}){if(u&&o(),this.#w)return;let E={cmd:o,undo:l,type:A};if(-1===this.#R){this.#M.length>0&&(this.#M.length=0),this.#R=0,this.#M.push(E);return}if(S&&this.#M[this.#R].type===A){C&&(E.undo=this.#M[this.#R].undo),this.#M[this.#R]=E;return}let T=this.#R+1;T===this.#k?this.#M.splice(0,1):(this.#R=T,T<this.#M.length&&this.#M.splice(T)),this.#M.push(E)}undo(){-1!==this.#R&&(this.#w=!0,this.#M[this.#R].undo(),this.#w=!1,this.#R-=1)}redo(){this.#R<this.#M.length-1&&(this.#R+=1,this.#w=!0,this.#M[this.#R].cmd(),this.#w=!1)}hasSomethingToUndo(){return -1!==this.#R}hasSomethingToRedo(){return this.#R<this.#M.length-1}destroy(){this.#M=null}}l.CommandManager=P;class M{constructor(o){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;let{isMac:l}=A.FeatureTest.platform;for(let[u,A]of o)for(let o of u){let u=o.startsWith("mac+");l&&u?(this.callbacks.set(o.slice(4),A),this.allKeys.add(o.split("+").at(-1))):l||u||(this.callbacks.set(o,A),this.allKeys.add(o.split("+").at(-1)))}}#F(o){o.altKey&&this.buffer.push("alt"),o.ctrlKey&&this.buffer.push("ctrl"),o.metaKey&&this.buffer.push("meta"),o.shiftKey&&this.buffer.push("shift"),this.buffer.push(o.key);let l=this.buffer.join("+");return this.buffer.length=0,l}exec(o,l){if(!this.allKeys.has(l.key))return;let u=this.callbacks.get(this.#F(l));u&&(u.bind(o)(),l.stopPropagation(),l.preventDefault())}}l.KeyboardManager=M;class F{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){let o=new Map([["CanvasText",null],["Canvas",null]]);return(0,S.getColorValues)(o),(0,A.shadow)(this,"_colors",o)}convert(o){let l=(0,S.getRGB)(o);if(!window.matchMedia("(forced-colors: active)").matches)return l;for(let[o,u]of this._colors)if(u.every((o,u)=>o===l[u]))return F._colorsMapping.get(o);return l}getHexCode(o){let l=this._colors.get(o);return l?A.Util.makeHexColor(...l):o}}l.ColorManager=F;class O{#O=null;#I=new Map;#D=new Map;#L=null;#N=new P;#j=0;#B=null;#U=new Set;#G=null;#H=new T;#q=!1;#W=A.AnnotationEditorType.NONE;#z=new Set;#V=this.copy.bind(this);#$=this.cut.bind(this);#X=this.paste.bind(this);#K=this.keydown.bind(this);#Y=this.onEditingAction.bind(this);#J=this.onPageChanging.bind(this);#Q=this.onScaleChanging.bind(this);#Z=this.onRotationChanging.bind(this);#tt={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1};#te=null;static _keyboardManager=new M([[["ctrl+a","mac+meta+a"],O.prototype.selectAll],[["ctrl+z","mac+meta+z"],O.prototype.undo],[["ctrl+y","ctrl+shift+Z","mac+meta+shift+Z"],O.prototype.redo],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete"],O.prototype.delete],[["Escape","mac+Escape"],O.prototype.unselectAll]]);constructor(o,l,u){this.#te=o,this.#G=l,this.#G._on("editingaction",this.#Y),this.#G._on("pagechanging",this.#J),this.#G._on("scalechanging",this.#Q),this.#G._on("rotationchanging",this.#Z),this.#L=u,this.viewParameters={realScale:S.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0}}destroy(){for(let o of(this.#ti(),this.#G._off("editingaction",this.#Y),this.#G._off("pagechanging",this.#J),this.#G._off("scalechanging",this.#Q),this.#G._off("rotationchanging",this.#Z),this.#D.values()))o.destroy();this.#D.clear(),this.#I.clear(),this.#U.clear(),this.#O=null,this.#z.clear(),this.#N.destroy()}onPageChanging({pageNumber:o}){this.#j=o-1}focusMainContainer(){this.#te.focus()}addShouldRescale(o){this.#U.add(o)}removeShouldRescale(o){this.#U.delete(o)}onScaleChanging({scale:o}){for(let l of(this.commitOrRemove(),this.viewParameters.realScale=o*S.PixelsPerInch.PDF_TO_CSS_UNITS,this.#U))l.onScaleChanging()}onRotationChanging({pagesRotation:o}){this.commitOrRemove(),this.viewParameters.rotation=o}addToAnnotationStorage(o){o.isEmpty()||!this.#L||this.#L.has(o.id)||this.#L.setValue(o.id,o)}#ts(){this.#te.addEventListener("keydown",this.#K)}#ti(){this.#te.removeEventListener("keydown",this.#K)}#tr(){document.addEventListener("copy",this.#V),document.addEventListener("cut",this.#$),document.addEventListener("paste",this.#X)}#ta(){document.removeEventListener("copy",this.#V),document.removeEventListener("cut",this.#$),document.removeEventListener("paste",this.#X)}copy(o){if(o.preventDefault(),this.#O&&this.#O.commitOrRemove(),!this.hasSelection)return;let l=[];for(let o of this.#z)o.isEmpty()||l.push(o.serialize());0!==l.length&&o.clipboardData.setData("application/pdfjs",JSON.stringify(l))}cut(o){this.copy(o),this.delete()}paste(o){o.preventDefault();let l=o.clipboardData.getData("application/pdfjs");if(!l)return;try{l=JSON.parse(l)}catch(o){(0,A.warn)(`paste: "${o.message}".`);return}if(!Array.isArray(l))return;this.unselectAll();let u=this.#D.get(this.#j);try{let o=[];for(let A of l){let l=u.deserialize(A);if(!l)return;o.push(l)}let A=()=>{for(let l of o)this.#tn(l);this.#to(o)},S=()=>{for(let l of o)l.remove()};this.addCommands({cmd:A,undo:S,mustExec:!0})}catch(o){(0,A.warn)(`paste: "${o.message}".`)}}keydown(o){this.getActive()?.shouldGetKeyboardEvents()||O._keyboardManager.exec(this,o)}onEditingAction(o){["undo","redo","delete","selectAll"].includes(o.name)&&this[o.name]()}#tl(o){Object.entries(o).some(([o,l])=>this.#tt[o]!==l)&&this.#G.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#tt,o)})}#th(o){this.#G.dispatch("annotationeditorparamschanged",{source:this,details:o})}setEditingState(o){o?(this.#ts(),this.#tr(),this.#tl({isEditing:this.#W!==A.AnnotationEditorType.NONE,isEmpty:this.#td(),hasSomethingToUndo:this.#N.hasSomethingToUndo(),hasSomethingToRedo:this.#N.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#ti(),this.#ta(),this.#tl({isEditing:!1}))}registerEditorTypes(o){if(!this.#B)for(let l of(this.#B=o,this.#B))this.#th(l.defaultPropertiesToUpdate)}getId(){return this.#H.getId()}get currentLayer(){return this.#D.get(this.#j)}get currentPageIndex(){return this.#j}addLayer(o){this.#D.set(o.pageIndex,o),this.#q?o.enable():o.disable()}removeLayer(o){this.#D.delete(o.pageIndex)}updateMode(o){if(this.#W=o,o===A.AnnotationEditorType.NONE)this.setEditingState(!1),this.#tc();else for(let l of(this.setEditingState(!0),this.#tu(),this.#D.values()))l.updateMode(o)}updateToolbar(o){o!==this.#W&&this.#G.dispatch("switchannotationeditormode",{source:this,mode:o})}updateParams(o,l){if(this.#B){for(let u of this.#z)u.updateParams(o,l);for(let u of this.#B)u.updateDefaultParams(o,l)}}#tu(){if(!this.#q)for(let o of(this.#q=!0,this.#D.values()))o.enable()}#tc(){if(this.unselectAll(),this.#q)for(let o of(this.#q=!1,this.#D.values()))o.disable()}getEditors(o){let l=[];for(let u of this.#I.values())u.pageIndex===o&&l.push(u);return l}getEditor(o){return this.#I.get(o)}addEditor(o){this.#I.set(o.id,o)}removeEditor(o){this.#I.delete(o.id),this.unselect(o),this.#L?.remove(o.id)}#tn(o){let l=this.#D.get(o.pageIndex);l?l.addOrRebuild(o):this.addEditor(o)}setActiveEditor(o){this.#O!==o&&(this.#O=o,o&&this.#th(o.propertiesToUpdate))}toggleSelected(o){if(this.#z.has(o)){this.#z.delete(o),o.unselect(),this.#tl({hasSelectedEditor:this.hasSelection});return}this.#z.add(o),o.select(),this.#th(o.propertiesToUpdate),this.#tl({hasSelectedEditor:!0})}setSelected(o){for(let l of this.#z)l!==o&&l.unselect();this.#z.clear(),this.#z.add(o),o.select(),this.#th(o.propertiesToUpdate),this.#tl({hasSelectedEditor:!0})}isSelected(o){return this.#z.has(o)}unselect(o){o.unselect(),this.#z.delete(o),this.#tl({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#z.size}undo(){this.#N.undo(),this.#tl({hasSomethingToUndo:this.#N.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#td()})}redo(){this.#N.redo(),this.#tl({hasSomethingToUndo:!0,hasSomethingToRedo:this.#N.hasSomethingToRedo(),isEmpty:this.#td()})}addCommands(o){this.#N.add(o),this.#tl({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#td()})}#td(){if(0===this.#I.size)return!0;if(1===this.#I.size)for(let o of this.#I.values())return o.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;let o=[...this.#z],l=()=>{for(let l of o)l.remove()},u=()=>{for(let l of o)this.#tn(l)};this.addCommands({cmd:l,undo:u,mustExec:!0})}commitOrRemove(){this.#O?.commitOrRemove()}#to(o){for(let l of(this.#z.clear(),o))l.isEmpty()||(this.#z.add(l),l.select());this.#tl({hasSelectedEditor:!0})}selectAll(){for(let o of this.#z)o.commit();this.#to(this.#I.values())}unselectAll(){if(this.#O){this.#O.commitOrRemove();return}if(0!==this.#z.size){for(let o of this.#z)o.unselect();this.#z.clear(),this.#tl({hasSelectedEditor:!1})}}isActive(o){return this.#O===o}getActive(){return this.#O}getMode(){return this.#W}}l.AnnotationEditorUIManager=O},(o,l,u)=>{let A;Object.defineProperty(l,"__esModule",{value:!0}),l.StatTimer=l.RenderingCancelledException=l.PixelsPerInch=l.PageViewport=l.PDFDateString=l.DOMStandardFontDataFactory=l.DOMSVGFactory=l.DOMFilterFactory=l.DOMCanvasFactory=l.DOMCMapReaderFactory=l.AnnotationPrefix=void 0,l.deprecated=Y,l.getColorValues=tt,l.getCurrentTransform=te,l.getCurrentTransformInverse=ti,l.getFilenameFromUrl=z,l.getPdfFilenameFromUrl=V,l.getRGB=Z,l.getXfaPageViewport=Q,l.isDataScheme=H,l.isPdfFile=W,l.isValidFetchUrl=X,l.loadScript=K,l.setLayerDimensions=ts;var S=u(7),C=u(1);let E="http://www.w3.org/2000/svg",T="pdfjs_internal_id_";l.AnnotationPrefix=T;class P{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}l.PixelsPerInch=P;class M extends S.BaseFilterFactory{#tp;#tg;#e;#tf;#tm;#tb;#tA;#P=0;constructor({docId:o,ownerDocument:l=globalThis.document}={}){super(),this.#e=o,this.#tf=l}get #tv(){return this.#tp||=new Map}get #ty(){if(!this.#tg){let o=this.#tf.createElement("div"),{style:l}=o;l.visibility="hidden",l.contain="strict",l.width=l.height=0,l.position="absolute",l.top=l.left=0,l.zIndex=-1;let u=this.#tf.createElementNS(E,"svg");u.setAttribute("width",0),u.setAttribute("height",0),this.#tg=this.#tf.createElementNS(E,"defs"),o.append(u),u.append(this.#tg),this.#tf.body.append(o)}return this.#tg}#t_(o,l,u){let A=this.#tf.createElementNS(E,l);A.setAttribute("type","discrete"),A.setAttribute("tableValues",u),o.append(A)}addFilter(o){let l,u,A,S;if(!o)return"none";let C=this.#tv.get(o);if(C)return C;if(1===o.length){let C=o[0],E=Array(256);for(let o=0;o<256;o++)E[o]=C[o]/255;S=l=u=A=E.join(",")}else{let[C,E,T]=o,P=Array(256),M=Array(256),F=Array(256);for(let o=0;o<256;o++)P[o]=C[o]/255,M[o]=E[o]/255,F[o]=T[o]/255;l=P.join(","),u=M.join(","),A=F.join(","),S=`${l}${u}${A}`}if(C=this.#tv.get(S))return this.#tv.set(o,C),C;let T=`g_${this.#e}_transfer_map_${this.#P++}`,P=`url(#${T})`;this.#tv.set(o,P),this.#tv.set(S,P);let M=this.#tf.createElementNS(E,"filter",E);M.setAttribute("id",T),M.setAttribute("color-interpolation-filters","sRGB");let F=this.#tf.createElementNS(E,"feComponentTransfer");return M.append(F),this.#t_(F,"feFuncR",l),this.#t_(F,"feFuncG",u),this.#t_(F,"feFuncB",A),this.#ty.append(M),P}addHCMFilter(o,l){let u=`${o}-${l}`;if(this.#tb===u||(this.#tb=u,this.#tA="none",this.#tm?.remove(),!o||!l))return this.#tA;this.#ty.style.color=o;let A=Z(o=getComputedStyle(this.#ty).getPropertyValue("color"));o=C.Util.makeHexColor(...A),this.#ty.style.color=l;let S=Z(l=getComputedStyle(this.#ty).getPropertyValue("color"));if(l=C.Util.makeHexColor(...S),this.#ty.style.color="","#000000"===o&&"#ffffff"===l||o===l)return this.#tA;let T=Array(256);for(let o=0;o<=255;o++){let l=o/255;T[o]=l<=.03928?l/12.92:((l+.055)/1.055)**2.4}let P=T.join(","),M=`g_${this.#e}_hcm_filter`,F=this.#tm=this.#tf.createElementNS(E,"filter",E);F.setAttribute("id",M),F.setAttribute("color-interpolation-filters","sRGB");let O=this.#tf.createElementNS(E,"feComponentTransfer");F.append(O),this.#t_(O,"feFuncR",P),this.#t_(O,"feFuncG",P),this.#t_(O,"feFuncB",P);let I=this.#tf.createElementNS(E,"feColorMatrix");I.setAttribute("type","matrix"),I.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"),F.append(I),O=this.#tf.createElementNS(E,"feComponentTransfer"),F.append(O);let D=(o,l)=>{let u=A[o]/255,C=S[o]/255,E=Array(l+1);for(let o=0;o<=l;o++)E[o]=u+o/l*(C-u);return E.join(",")};return this.#t_(O,"feFuncR",D(0,5)),this.#t_(O,"feFuncG",D(1,5)),this.#t_(O,"feFuncB",D(2,5)),this.#ty.append(F),this.#tA=`url(#${M})`,this.#tA}destroy(o=!1){o&&this.#tA||(this.#tg&&(this.#tg.parentNode.parentNode.remove(),this.#tg=null),this.#tp&&(this.#tp.clear(),this.#tp=null),this.#P=0)}}l.DOMFilterFactory=M;class F extends S.BaseCanvasFactory{constructor({ownerDocument:o=globalThis.document}={}){super(),this._document=o}_createCanvas(o,l){let u=this._document.createElement("canvas");return u.width=o,u.height=l,u}}async function O(o,l=!1){if(X(o,document.baseURI)){let u=await fetch(o);if(!u.ok)throw Error(u.statusText);return l?new Uint8Array(await u.arrayBuffer()):(0,C.stringToBytes)(await u.text())}return new Promise((u,A)=>{let S=new XMLHttpRequest;S.open("GET",o,!0),l&&(S.responseType="arraybuffer"),S.onreadystatechange=()=>{if(S.readyState===XMLHttpRequest.DONE){if(200===S.status||0===S.status){let o;if(l&&S.response?o=new Uint8Array(S.response):!l&&S.responseText&&(o=(0,C.stringToBytes)(S.responseText)),o){u(o);return}}A(Error(S.statusText))}},S.send(null)})}l.DOMCanvasFactory=F;class I extends S.BaseCMapReaderFactory{_fetchData(o,l){return O(o,this.isCompressed).then(o=>({cMapData:o,compressionType:l}))}}l.DOMCMapReaderFactory=I;class D extends S.BaseStandardFontDataFactory{_fetchData(o){return O(o,!0)}}l.DOMStandardFontDataFactory=D;class L extends S.BaseSVGFactory{_createSVG(o){return document.createElementNS(E,o)}}l.DOMSVGFactory=L;class N{constructor({viewBox:o,scale:l,rotation:u,offsetX:A=0,offsetY:S=0,dontFlip:C=!1}){let E,T,P,M,F,O,I,D;this.viewBox=o,this.scale=l,this.rotation=u,this.offsetX=A,this.offsetY=S;let L=(o[2]+o[0])/2,N=(o[3]+o[1])/2;switch((u%=360)<0&&(u+=360),u){case 180:E=-1,T=0,P=0,M=1;break;case 90:E=0,T=1,P=1,M=0;break;case 270:E=0,T=-1,P=-1,M=0;break;case 0:E=1,T=0,P=0,M=-1;break;default:throw Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}C&&(P=-P,M=-M),0===E?(F=Math.abs(N-o[1])*l+A,O=Math.abs(L-o[0])*l+S,I=(o[3]-o[1])*l,D=(o[2]-o[0])*l):(F=Math.abs(L-o[0])*l+A,O=Math.abs(N-o[1])*l+S,I=(o[2]-o[0])*l,D=(o[3]-o[1])*l),this.transform=[E*l,T*l,P*l,M*l,F-E*l*L-P*l*N,O-T*l*L-M*l*N],this.width=I,this.height=D}get rawDims(){let{viewBox:o}=this;return(0,C.shadow)(this,"rawDims",{pageWidth:o[2]-o[0],pageHeight:o[3]-o[1],pageX:o[0],pageY:o[1]})}clone({scale:o=this.scale,rotation:l=this.rotation,offsetX:u=this.offsetX,offsetY:A=this.offsetY,dontFlip:S=!1}={}){return new N({viewBox:this.viewBox.slice(),scale:o,rotation:l,offsetX:u,offsetY:A,dontFlip:S})}convertToViewportPoint(o,l){return C.Util.applyTransform([o,l],this.transform)}convertToViewportRectangle(o){let l=C.Util.applyTransform([o[0],o[1]],this.transform),u=C.Util.applyTransform([o[2],o[3]],this.transform);return[l[0],l[1],u[0],u[1]]}convertToPdfPoint(o,l){return C.Util.applyInverseTransform([o,l],this.transform)}}l.PageViewport=N;class U extends C.BaseException{constructor(o,l,u=0){super(o,"RenderingCancelledException"),this.type=l,this.extraDelay=u}}function H(o){let l=o.length,u=0;for(;u<l&&""===o[u].trim();)u++;return"data:"===o.substring(u,u+5).toLowerCase()}function W(o){return"string"==typeof o&&/\.pdf$/i.test(o)}function z(o,l=!1){return l||([o]=o.split(/[#?]/,1)),o.substring(o.lastIndexOf("/")+1)}function V(o,l="document.pdf"){if("string"!=typeof o)return l;if(H(o))return(0,C.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),l;let u=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,A=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(o),S=u.exec(A[1])||u.exec(A[2])||u.exec(A[3]);if(S&&(S=S[0]).includes("%"))try{S=u.exec(decodeURIComponent(S))[0]}catch(o){}return S||l}l.RenderingCancelledException=U;class ${started=Object.create(null);times=[];time(o){o in this.started&&(0,C.warn)(`Timer is already running for ${o}`),this.started[o]=Date.now()}timeEnd(o){o in this.started||(0,C.warn)(`Timer has not been started for ${o}`),this.times.push({name:o,start:this.started[o],end:Date.now()}),delete this.started[o]}toString(){let o=[],l=0;for(let{name:o}of this.times)l=Math.max(o.length,l);for(let{name:u,start:A,end:S}of this.times)o.push(`${u.padEnd(l)} ${S-A}ms
|
||
`);return o.join("")}}function X(o,l){try{let{protocol:u}=l?new URL(o,l):new URL(o);return"http:"===u||"https:"===u}catch(o){return!1}}function K(o,l=!1){return new Promise((u,A)=>{let S=document.createElement("script");S.src=o,S.onload=function(o){l&&S.remove(),u(o)},S.onerror=function(){A(Error(`Cannot load script at: ${S.src}`))},(document.head||document.documentElement).append(S)})}function Y(o){console.log("Deprecated API usage: "+o)}l.StatTimer=$;class J{static toDateObject(o){if(!o||"string"!=typeof o)return null;let l=(A||=RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?")).exec(o);if(!l)return null;let u=parseInt(l[1],10),S=parseInt(l[2],10);S=S>=1&&S<=12?S-1:0;let C=parseInt(l[3],10);C=C>=1&&C<=31?C:1;let E=parseInt(l[4],10);E=E>=0&&E<=23?E:0;let T=parseInt(l[5],10);T=T>=0&&T<=59?T:0;let P=parseInt(l[6],10);P=P>=0&&P<=59?P:0;let M=l[7]||"Z",F=parseInt(l[8],10);F=F>=0&&F<=23?F:0;let O=parseInt(l[9],10)||0;return O=O>=0&&O<=59?O:0,"-"===M?(E+=F,T+=O):"+"===M&&(E-=F,T-=O),new Date(Date.UTC(u,S,C,E,T,P))}}function Q(o,{scale:l=1,rotation:u=0}){let{width:A,height:S}=o.attributes.style;return new N({viewBox:[0,0,parseInt(A),parseInt(S)],scale:l,rotation:u})}function Z(o){if(o.startsWith("#")){let l=parseInt(o.slice(1),16);return[(16711680&l)>>16,(65280&l)>>8,255&l]}return o.startsWith("rgb(")?o.slice(4,-1).split(",").map(o=>parseInt(o)):o.startsWith("rgba(")?o.slice(5,-1).split(",").map(o=>parseInt(o)).slice(0,3):((0,C.warn)(`Not a valid color format: "${o}"`),[0,0,0])}function tt(o){let l=document.createElement("span");for(let u of(l.style.visibility="hidden",document.body.append(l),o.keys())){l.style.color=u;let A=window.getComputedStyle(l).color;o.set(u,Z(A))}l.remove()}function te(o){let{a:l,b:u,c:A,d:S,e:C,f:E}=o.getTransform();return[l,u,A,S,C,E]}function ti(o){let{a:l,b:u,c:A,d:S,e:C,f:E}=o.getTransform().invertSelf();return[l,u,A,S,C,E]}function ts(o,l,u=!1,A=!0){if(l instanceof N){let{pageWidth:A,pageHeight:S}=l.rawDims,{style:C}=o,E=`calc(var(--scale-factor) * ${A}px)`,T=`calc(var(--scale-factor) * ${S}px)`;u&&l.rotation%180!=0?(C.width=T,C.height=E):(C.width=E,C.height=T)}A&&o.setAttribute("data-main-rotation",l.rotation)}l.PDFDateString=J},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.BaseStandardFontDataFactory=l.BaseSVGFactory=l.BaseFilterFactory=l.BaseCanvasFactory=l.BaseCMapReaderFactory=void 0;var A=u(1);class S{constructor(){this.constructor===S&&(0,A.unreachable)("Cannot initialize BaseFilterFactory.")}addFilter(o){return"none"}addHCMFilter(o,l){return"none"}destroy(o=!1){}}l.BaseFilterFactory=S;class C{constructor(){this.constructor===C&&(0,A.unreachable)("Cannot initialize BaseCanvasFactory.")}create(o,l){if(o<=0||l<=0)throw Error("Invalid canvas size");let u=this._createCanvas(o,l);return{canvas:u,context:u.getContext("2d")}}reset(o,l,u){if(!o.canvas)throw Error("Canvas is not specified");if(l<=0||u<=0)throw Error("Invalid canvas size");o.canvas.width=l,o.canvas.height=u}destroy(o){if(!o.canvas)throw Error("Canvas is not specified");o.canvas.width=0,o.canvas.height=0,o.canvas=null,o.context=null}_createCanvas(o,l){(0,A.unreachable)("Abstract method `_createCanvas` called.")}}l.BaseCanvasFactory=C;class E{constructor({baseUrl:o=null,isCompressed:l=!0}){this.constructor===E&&(0,A.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=o,this.isCompressed=l}async fetch({name:o}){if(!this.baseUrl)throw Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!o)throw Error("CMap name must be specified.");let l=this.baseUrl+o+(this.isCompressed?".bcmap":""),u=this.isCompressed?A.CMapCompressionType.BINARY:A.CMapCompressionType.NONE;return this._fetchData(l,u).catch(o=>{throw Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${l}`)})}_fetchData(o,l){(0,A.unreachable)("Abstract method `_fetchData` called.")}}l.BaseCMapReaderFactory=E;class T{constructor({baseUrl:o=null}){this.constructor===T&&(0,A.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=o}async fetch({filename:o}){if(!this.baseUrl)throw Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!o)throw Error("Font filename must be specified.");let l=`${this.baseUrl}${o}`;return this._fetchData(l).catch(o=>{throw Error(`Unable to load font data at: ${l}`)})}_fetchData(o){(0,A.unreachable)("Abstract method `_fetchData` called.")}}l.BaseStandardFontDataFactory=T;class P{constructor(){this.constructor===P&&(0,A.unreachable)("Cannot initialize BaseSVGFactory.")}create(o,l,u=!1){if(o<=0||l<=0)throw Error("Invalid SVG dimensions");let A=this._createSVG("svg:svg");return A.setAttribute("version","1.1"),u||(A.setAttribute("width",`${o}px`),A.setAttribute("height",`${l}px`)),A.setAttribute("preserveAspectRatio","none"),A.setAttribute("viewBox",`0 0 ${o} ${l}`),A}createElement(o){if("string"!=typeof o)throw Error("Invalid SVG element type");return this._createSVG(o)}_createSVG(o){(0,A.unreachable)("Abstract method `_createSVG` called.")}}l.BaseSVGFactory=P},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.MurmurHash3_64=void 0;var A=u(1);let S=3285377520,C=4294901760,E=65535;class T{constructor(o){this.h1=o?4294967295&o:S,this.h2=o?4294967295&o:S}update(o){let l,u;if("string"==typeof o){l=new Uint8Array(2*o.length),u=0;for(let A=0,S=o.length;A<S;A++){let S=o.charCodeAt(A);S<=255?l[u++]=S:(l[u++]=S>>>8,l[u++]=255&S)}}else if((0,A.isArrayBuffer)(o))u=(l=o.slice()).byteLength;else throw Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");let S=u>>2,T=u-4*S,P=new Uint32Array(l.buffer,0,S),M=0,F=0,O=this.h1,I=this.h2,D=3432918353,L=461845907,N=3432918353&E,U=461845907&E;for(let o=0;o<S;o++)1&o?(O^=M=(M=(M=(M=P[o])*D&C|M*N&E)<<15|M>>>17)*L&C|M*U&E,O=5*(O=O<<13|O>>>19)+3864292196):(I^=F=(F=(F=(F=P[o])*D&C|F*N&E)<<15|F>>>17)*L&C|F*U&E,I=5*(I=I<<13|I>>>19)+3864292196);switch(M=0,T){case 3:M^=l[4*S+2]<<16;case 2:M^=l[4*S+1]<<8;case 1:M^=l[4*S],M=(M=(M=M*D&C|M*N&E)<<15|M>>>17)*L&C|M*U&E,1&S?O^=M:I^=M}this.h1=O,this.h2=I}hexdigest(){let o=this.h1,l=this.h2;return o^=l>>>1,o=3981806797*o&C|36045*o&E,l=4283543511*l&C|((l<<16|o>>>16)*2950163797&C)>>>16,o^=l>>>1,o=444984403*o&C|60499*o&E,l=3301882366*l&C|((l<<16|o>>>16)*3120437893&C)>>>16,((o^=l>>>1)>>>0).toString(16).padStart(8,"0")+(l>>>0).toString(16).padStart(8,"0")}}l.MurmurHash3_64=T},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.FontLoader=l.FontFaceObject=void 0;var A=u(1),S=u(10);class C{#tS=new Set;constructor({ownerDocument:o=globalThis.document,styleElement:l=null}){this._document=o,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(o){this.nativeFontFaces.add(o),this._document.fonts.add(o)}removeNativeFontFace(o){this.nativeFontFaces.delete(o),this._document.fonts.delete(o)}insertRule(o){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));let l=this.styleElement.sheet;l.insertRule(o,l.cssRules.length)}clear(){for(let o of this.nativeFontFaces)this._document.fonts.delete(o);this.nativeFontFaces.clear(),this.#tS.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont(o){if(!(!o||this.#tS.has(o.loadedName))){if((0,A.assert)(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:l,src:u,style:S}=o,C=new FontFace(l,u,S);this.addNativeFontFace(C);try{await C.load(),this.#tS.add(l)}catch{(0,A.warn)(`Cannot load system font: ${o.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(C)}return}(0,A.unreachable)("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(o){if(o.attached||o.missingFile&&!o.systemFontInfo)return;if(o.attached=!0,o.systemFontInfo){await this.loadSystemFont(o.systemFontInfo);return}if(this.isFontLoadingAPISupported){let l=o.createNativeFontFace();if(l){this.addNativeFontFace(l);try{await l.loaded}catch(u){throw(0,A.warn)(`Failed to load font '${l.family}': '${u}'.`),o.disableFontFace=!0,u}}return}let l=o.createFontFaceRule();if(l){if(this.insertRule(l),this.isSyncFontLoadingSupported)return;await new Promise(l=>{let u=this._queueLoadingCallback(l);this._prepareFontLoadEvent(o,u)})}}get isFontLoadingAPISupported(){let o=!!this._document?.fonts;return(0,A.shadow)(this,"isFontLoadingAPISupported",o)}get isSyncFontLoadingSupported(){let o=!1;return S.isNodeJS?o=!0:"undefined"!=typeof navigator&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent)&&(o=!0),(0,A.shadow)(this,"isSyncFontLoadingSupported",o)}_queueLoadingCallback(o){let{loadingRequests:l}=this,u={done:!1,complete:function(){for((0,A.assert)(!u.done,"completeRequest() cannot be called twice."),u.done=!0;l.length>0&&l[0].done;)setTimeout(l.shift().callback,0)},callback:o};return l.push(u),u}get _loadTestFont(){let o=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return(0,A.shadow)(this,"_loadTestFont",o)}_prepareFontLoadEvent(o,l){let u,S;function C(o,l){return o.charCodeAt(l)<<24|o.charCodeAt(l+1)<<16|o.charCodeAt(l+2)<<8|255&o.charCodeAt(l+3)}function E(o,l,u,A){return o.substring(0,l)+A+o.substring(l+u)}let T=this._document.createElement("canvas");T.width=1,T.height=1;let P=T.getContext("2d"),M=0;function F(o,l){if(++M>30){(0,A.warn)("Load test font never loaded."),l();return}if(P.font="30px "+o,P.fillText(".",0,20),P.getImageData(0,0,1,1).data[3]>0){l();return}setTimeout(F.bind(null,o,l))}let O=`lt${Date.now()}${this.loadTestFontId++}`,I=this._loadTestFont;I=E(I,976,O.length,O);let D=16,L=1482184792,N=C(I,16);for(u=0,S=O.length-3;u<S;u+=4)N=N-L+C(O,u)|0;u<O.length&&(N=N-L+C(O+"XXX",u)|0),I=E(I,D,4,(0,A.string32)(N));let U=`url(data:font/opentype;base64,${btoa(I)});`,H=`@font-face {font-family:"${O}";src:${U}}`;this.insertRule(H);let W=this._document.createElement("div");for(let l of(W.style.visibility="hidden",W.style.width=W.style.height="10px",W.style.position="absolute",W.style.top=W.style.left="0px",[o.loadedName,O])){let o=this._document.createElement("span");o.textContent="Hi",o.style.fontFamily=l,W.append(o)}this._document.body.append(W),F(O,()=>{W.remove(),l.complete()})}}l.FontLoader=C;class E{constructor(o,{isEvalSupported:l=!0,disableFontFace:u=!1,ignoreErrors:A=!1,inspectFont:S=null}){for(let l in this.compiledGlyphs=Object.create(null),o)this[l]=o[l];this.isEvalSupported=!1!==l,this.disableFontFace=!0===u,this.ignoreErrors=!0===A,this._inspectFont=S}createNativeFontFace(){let o;if(!this.data||this.disableFontFace)return null;if(this.cssFontInfo){let l={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(l.style=`oblique ${this.cssFontInfo.italicAngle}deg`),o=new FontFace(this.cssFontInfo.fontFamily,this.data,l)}else o=new FontFace(this.loadedName,this.data,{});return this._inspectFont?.(this),o}createFontFaceRule(){let o;if(!this.data||this.disableFontFace)return null;let l=(0,A.bytesToString)(this.data),u=`url(data:${this.mimetype};base64,${btoa(l)});`;if(this.cssFontInfo){let l=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(l+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),o=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${l}src:${u}}`}else o=`@font-face {font-family:"${this.loadedName}";src:${u}}`;return this._inspectFont?.(this,u),o}getPathGenerator(o,l){let u;if(void 0!==this.compiledGlyphs[l])return this.compiledGlyphs[l];try{u=o.get(this.loadedName+"_path_"+l)}catch(o){if(!this.ignoreErrors)throw o;return(0,A.warn)(`getPathGenerator - ignoring character: "${o}".`),this.compiledGlyphs[l]=function(o,l){}}if(this.isEvalSupported&&A.FeatureTest.isEvalSupported){let o=[];for(let l of u){let u=void 0!==l.args?l.args.join(","):"";o.push("c.",l.cmd,"(",u,");\n")}return this.compiledGlyphs[l]=Function("c","size",o.join(""))}return this.compiledGlyphs[l]=function(o,l){for(let A of u)"scale"===A.cmd&&(A.args=[l,-l]),o[A.cmd].apply(o,A.args)}}}l.FontFaceObject=E},(o,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.isNodeJS=void 0;let u="object"==typeof process&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&"browser"!==process.type);l.isNodeJS=u},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.CanvasGraphics=void 0;var A=u(1),S=u(6),C=u(12),E=u(13),T=u(10);let P=16,M=100,F=4096,O=15,I=10,D=1e3,L=16;function N(o,l){if(o._removeMirroring)throw Error("Context is already forwarding operations.");o.__originalSave=o.save,o.__originalRestore=o.restore,o.__originalRotate=o.rotate,o.__originalScale=o.scale,o.__originalTranslate=o.translate,o.__originalTransform=o.transform,o.__originalSetTransform=o.setTransform,o.__originalResetTransform=o.resetTransform,o.__originalClip=o.clip,o.__originalMoveTo=o.moveTo,o.__originalLineTo=o.lineTo,o.__originalBezierCurveTo=o.bezierCurveTo,o.__originalRect=o.rect,o.__originalClosePath=o.closePath,o.__originalBeginPath=o.beginPath,o._removeMirroring=()=>{o.save=o.__originalSave,o.restore=o.__originalRestore,o.rotate=o.__originalRotate,o.scale=o.__originalScale,o.translate=o.__originalTranslate,o.transform=o.__originalTransform,o.setTransform=o.__originalSetTransform,o.resetTransform=o.__originalResetTransform,o.clip=o.__originalClip,o.moveTo=o.__originalMoveTo,o.lineTo=o.__originalLineTo,o.bezierCurveTo=o.__originalBezierCurveTo,o.rect=o.__originalRect,o.closePath=o.__originalClosePath,o.beginPath=o.__originalBeginPath,delete o._removeMirroring},o.save=function(){l.save(),this.__originalSave()},o.restore=function(){l.restore(),this.__originalRestore()},o.translate=function(o,u){l.translate(o,u),this.__originalTranslate(o,u)},o.scale=function(o,u){l.scale(o,u),this.__originalScale(o,u)},o.transform=function(o,u,A,S,C,E){l.transform(o,u,A,S,C,E),this.__originalTransform(o,u,A,S,C,E)},o.setTransform=function(o,u,A,S,C,E){l.setTransform(o,u,A,S,C,E),this.__originalSetTransform(o,u,A,S,C,E)},o.resetTransform=function(){l.resetTransform(),this.__originalResetTransform()},o.rotate=function(o){l.rotate(o),this.__originalRotate(o)},o.clip=function(o){l.clip(o),this.__originalClip(o)},o.moveTo=function(o,u){l.moveTo(o,u),this.__originalMoveTo(o,u)},o.lineTo=function(o,u){l.lineTo(o,u),this.__originalLineTo(o,u)},o.bezierCurveTo=function(o,u,A,S,C,E){l.bezierCurveTo(o,u,A,S,C,E),this.__originalBezierCurveTo(o,u,A,S,C,E)},o.rect=function(o,u,A,S){l.rect(o,u,A,S),this.__originalRect(o,u,A,S)},o.closePath=function(){l.closePath(),this.__originalClosePath()},o.beginPath=function(){l.beginPath(),this.__originalBeginPath()}}class U{constructor(o){this.canvasFactory=o,this.cache=Object.create(null)}getCanvas(o,l,u){let A;return void 0!==this.cache[o]?(A=this.cache[o],this.canvasFactory.reset(A,l,u)):(A=this.canvasFactory.create(l,u),this.cache[o]=A),A}delete(o){delete this.cache[o]}clear(){for(let o in this.cache){let l=this.cache[o];this.canvasFactory.destroy(l),delete this.cache[o]}}}function H(o,l,u,A,C,E,T,P,M,F){let[O,I,D,L,N,U]=(0,S.getCurrentTransform)(o);if(0===I&&0===D){let S=Math.round(T*O+N),H=Math.round(P*L+U),W=Math.abs(Math.round((T+M)*O+N)-S)||1,z=Math.abs(Math.round((P+F)*L+U)-H)||1;return o.setTransform(Math.sign(O),0,0,Math.sign(L),S,H),o.drawImage(l,u,A,C,E,0,0,W,z),o.setTransform(O,I,D,L,N,U),[W,z]}if(0===O&&0===L){let S=Math.round(P*D+N),H=Math.round(T*I+U),W=Math.abs(Math.round((P+F)*D+N)-S)||1,z=Math.abs(Math.round((T+M)*I+U)-H)||1;return o.setTransform(0,Math.sign(I),Math.sign(D),0,S,H),o.drawImage(l,u,A,C,E,0,0,z,W),o.setTransform(O,I,D,L,N,U),[z,W]}return o.drawImage(l,u,A,C,E,T,P,M,F),[Math.hypot(O,I)*M,Math.hypot(D,L)*F]}function W(o){let l,u,A;let{width:S,height:C}=o;if(S>D||C>D)return null;let E=1e3,T=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),P=S+1,M=new Uint8Array(P*(C+1)),F=S+7&-8,O=new Uint8Array(F*C),I=0;for(let l of o.data){let o=128;for(;o>0;)O[I++]=l&o?0:255,o>>=1}let L=0;for(0!==O[I=0]&&(M[0]=1,++L),u=1;u<S;u++)O[I]!==O[I+1]&&(M[u]=O[I]?2:1,++L),I++;for(0!==O[I]&&(M[u]=2,++L),l=1;l<C;l++){I=l*F,A=l*P,O[I-F]!==O[I]&&(M[A]=O[I]?1:8,++L);let o=(O[I]?4:0)+(O[I-F]?8:0);for(u=1;u<S;u++)T[o=(o>>2)+(O[I+1]?4:0)+(O[I-F+1]?8:0)]&&(M[A+u]=T[o],++L),I++;if(O[I-F]!==O[I]&&(M[A+u]=O[I]?2:4,++L),L>E)return null}for(I=F*(C-1),A=l*P,0!==O[I]&&(M[A]=8,++L),u=1;u<S;u++)O[I]!==O[I+1]&&(M[A+u]=O[I]?4:8,++L),I++;if(0!==O[I]&&(M[A+u]=4,++L),L>E)return null;let N=new Int32Array([0,P,-1,0,-P,0,0,0,1]),U=new Path2D;for(l=0;L&&l<=C;l++){let o=l*P,u=o+S;for(;o<u&&!M[o];)o++;if(o===u)continue;U.moveTo(o%P,l);let A=o,C=M[o];do{let l=N[C];do o+=l;while(!M[o]);let u=M[o];5!==u&&10!==u?(C=u,M[o]=0):(C=u&51*C>>4,M[o]&=C>>2|C<<2),U.lineTo(o%P,o/P|0),!M[o]&&--L}while(A!==o);--l}return O=null,M=null,function(o){o.save(),o.scale(1/S,-1/C),o.translate(0,-C),o.fill(U),o.beginPath(),o.restore()}}class z{constructor(o,l){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=A.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=A.FONT_IDENTITY_MATRIX,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=A.TextRenderingMode.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,o,l])}clone(){let o=Object.create(this);return o.clipBox=this.clipBox.slice(),o}setCurrentPoint(o,l){this.x=o,this.y=l}updatePathMinMax(o,l,u){[l,u]=A.Util.applyTransform([l,u],o),this.minX=Math.min(this.minX,l),this.minY=Math.min(this.minY,u),this.maxX=Math.max(this.maxX,l),this.maxY=Math.max(this.maxY,u)}updateRectMinMax(o,l){let u=A.Util.applyTransform(l,o),S=A.Util.applyTransform(l.slice(2),o);this.minX=Math.min(this.minX,u[0],S[0]),this.minY=Math.min(this.minY,u[1],S[1]),this.maxX=Math.max(this.maxX,u[0],S[0]),this.maxY=Math.max(this.maxY,u[1],S[1])}updateScalingPathMinMax(o,l){A.Util.scaleMinMax(o,l),this.minX=Math.min(this.minX,l[0]),this.maxX=Math.max(this.maxX,l[1]),this.minY=Math.min(this.minY,l[2]),this.maxY=Math.max(this.maxY,l[3])}updateCurvePathMinMax(o,l,u,S,C,E,T,P,M,F){let O=A.Util.bezierBoundingBox(l,u,S,C,E,T,P,M);if(F){F[0]=Math.min(F[0],O[0],O[2]),F[1]=Math.max(F[1],O[0],O[2]),F[2]=Math.min(F[2],O[1],O[3]),F[3]=Math.max(F[3],O[1],O[3]);return}this.updateRectMinMax(o,O)}getPathBoundingBox(o=C.PathType.FILL,l=null){let u=[this.minX,this.minY,this.maxX,this.maxY];if(o===C.PathType.STROKE){l||(0,A.unreachable)("Stroke bounding box must include transform.");let o=A.Util.singularValueDecompose2dScale(l),S=o[0]*this.lineWidth/2,C=o[1]*this.lineWidth/2;u[0]-=S,u[1]-=C,u[2]+=S,u[3]+=C}return u}updateClipFromPath(){let o=A.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(o||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(o){this.clipBox=o,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(o=C.PathType.FILL,l=null){return A.Util.intersect(this.clipBox,this.getPathBoundingBox(o,l))}}function V(o,l){let u,S,C,E;if("undefined"!=typeof ImageData&&l instanceof ImageData){o.putImageData(l,0,0);return}let T=l.height,P=l.width,M=T%L,F=(T-M)/L,O=0===M?F:F+1,I=o.createImageData(P,L),D=0,N,U=l.data,H=I.data;if(l.kind===A.ImageKind.GRAYSCALE_1BPP){let l=U.byteLength,E=new Uint32Array(H.buffer,0,H.byteLength>>2),T=E.length,W=P+7>>3,z=4294967295,V=A.FeatureTest.isLittleEndian?4278190080:255;for(u=0;u<O;u++){for(S=0,C=u<F?L:M,N=0;S<C;S++){let o=l-D,u=0,A=o>W?P:8*o-7,S=-8&A,C=0,T=0;for(;u<S;u+=8)T=U[D++],E[N++]=128&T?z:V,E[N++]=64&T?z:V,E[N++]=32&T?z:V,E[N++]=16&T?z:V,E[N++]=8&T?z:V,E[N++]=4&T?z:V,E[N++]=2&T?z:V,E[N++]=1&T?z:V;for(;u<A;u++)0===C&&(T=U[D++],C=128),E[N++]=T&C?z:V,C>>=1}for(;N<T;)E[N++]=0;o.putImageData(I,0,u*L)}}else if(l.kind===A.ImageKind.RGBA_32BPP){for(u=0,S=0,E=P*L*4;u<F;u++)H.set(U.subarray(D,D+E)),D+=E,o.putImageData(I,0,S),S+=L;u<O&&(E=P*M*4,H.set(U.subarray(D,D+E)),o.putImageData(I,0,S))}else if(l.kind===A.ImageKind.RGB_24BPP)for(u=0,E=P*(C=L);u<O;u++){for(u>=F&&(E=P*(C=M)),N=0,S=E;S--;)H[N++]=U[D++],H[N++]=U[D++],H[N++]=U[D++],H[N++]=255;o.putImageData(I,0,u*L)}else throw Error(`bad image kind: ${l.kind}`)}function $(o,l){if(l.bitmap){o.drawImage(l.bitmap,0,0);return}let u=l.height,A=l.width,S=u%L,C=(u-S)/L,T=0===S?C:C+1,P=o.createImageData(A,L),M=0,F=l.data,O=P.data;for(let l=0;l<T;l++){let u=l<C?L:S;({srcPos:M}=(0,E.convertBlackAndWhiteToRGBA)({src:F,srcPos:M,dest:O,width:A,height:u,nonBlackColor:0})),o.putImageData(P,0,l*L)}}function X(o,l){for(let u of["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"])void 0!==o[u]&&(l[u]=o[u]);void 0!==o.setLineDash&&(l.setLineDash(o.getLineDash()),l.lineDashOffset=o.lineDashOffset)}function K(o){o.strokeStyle=o.fillStyle="#000000",o.fillRule="nonzero",o.globalAlpha=1,o.lineWidth=1,o.lineCap="butt",o.lineJoin="miter",o.miterLimit=10,o.globalCompositeOperation="source-over",o.font="10px sans-serif",void 0!==o.setLineDash&&(o.setLineDash([]),o.lineDashOffset=0),T.isNodeJS||(o.filter="none")}function Y(o,l,u,A){let S=o.length;for(let C=3;C<S;C+=4){let S=o[C];if(0===S)o[C-3]=l,o[C-2]=u,o[C-1]=A;else if(S<255){let E=255-S;o[C-3]=o[C-3]*S+l*E>>8,o[C-2]=o[C-2]*S+u*E>>8,o[C-1]=o[C-1]*S+A*E>>8}}}function J(o,l,u){let A=o.length,S=1/255;for(let C=3;C<A;C+=4){let A=u?u[o[C]]:o[C];l[C]=l[C]*A*S|0}}function Q(o,l,u){let A=o.length;for(let S=3;S<A;S+=4){let A=77*o[S-3]+152*o[S-2]+28*o[S-1];l[S]=u?l[S]*u[A>>8]>>8:l[S]*A>>16}}function Z(o,l,u,A,S,C,E,T,P,M,F){let O;let I=!!C,D=I?C[0]:0,L=I?C[1]:0,N=I?C[2]:0;O="Luminosity"===S?Q:J;let U=Math.min(A,Math.ceil(1048576/u));for(let S=0;S<A;S+=U){let C=Math.min(U,A-S),H=o.getImageData(T-M,S+(P-F),u,C),W=l.getImageData(T,S+P,u,C);I&&Y(H.data,D,L,N),O(H.data,W.data,E),l.putImageData(W,T,S+P)}}function tt(o,l,u,A){let S=A[0],C=A[1],E=A[2]-S,T=A[3]-C;0!==E&&0!==T&&(Z(l.context,u,E,T,l.subtype,l.backdrop,l.transferMap,S,C,l.offsetX,l.offsetY),o.save(),o.globalAlpha=1,o.globalCompositeOperation="source-over",o.setTransform(1,0,0,1,0,0),o.drawImage(u.canvas,0,0),o.restore())}function te(o,l){let u=A.Util.singularValueDecompose2dScale(o);u[0]=Math.fround(u[0]),u[1]=Math.fround(u[1]);let C=Math.fround((globalThis.devicePixelRatio||1)*S.PixelsPerInch.PDF_TO_CSS_UNITS);return void 0!==l?l:u[0]<=C||u[1]<=C}let ti=["butt","round","square"],ts=["miter","round","bevel"],tr={},ta={};class tn{constructor(o,l,u,A,S,{optionalContentConfig:C,markedContentStack:E=null},T,P){this.ctx=o,this.current=new z(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=l,this.objs=u,this.canvasFactory=A,this.filterFactory=S,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=E||[],this.optionalContentConfig=C,this.cachedCanvases=new U(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=T,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=P,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(o,l=null){return"string"==typeof o?o.startsWith("g_")?this.commonObjs.get(o):this.objs.get(o):l}beginDrawing({transform:o,viewport:l,transparency:u=!1,background:A=null}){let C=this.ctx.canvas.width,E=this.ctx.canvas.height,T=this.ctx.fillStyle;if(this.ctx.fillStyle=A||"#ffffff",this.ctx.fillRect(0,0,C,E),this.ctx.fillStyle=T,u){let o=this.cachedCanvases.getCanvas("transparent",C,E);this.compositeCtx=this.ctx,this.transparentCanvas=o.canvas,this.ctx=o.context,this.ctx.save(),this.ctx.transform(...(0,S.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),K(this.ctx),o&&(this.ctx.transform(...o),this.outputScaleX=o[0],this.outputScaleY=o[0]),this.ctx.transform(...l.transform),this.viewportScale=l.scale,this.baseTransform=(0,S.getCurrentTransform)(this.ctx)}executeOperatorList(o,l,u,S){let C;let E=o.argsArray,T=o.fnArray,P=l||0,M=E.length;if(M===P)return P;let F=M-P>I&&"function"==typeof u,D=F?Date.now()+O:0,L=0,N=this.commonObjs,U=this.objs;for(;;){if(void 0!==S&&P===S.nextBreakPoint)return S.breakIt(P,u),P;if((C=T[P])!==A.OPS.dependency)this[C].apply(this,E[P]);else for(let o of E[P]){let l=o.startsWith("g_")?N:U;if(!l.has(o))return l.get(o,u),P}if(++P===M)return P;if(F&&++L>I){if(Date.now()>D)return u(),P;L=0}}}#tC(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}endDrawing(){for(let o of(this.#tC(),this.cachedCanvases.clear(),this.cachedPatterns.clear(),this._cachedBitmapsMap.values())){for(let l of o.values())"undefined"!=typeof HTMLCanvasElement&&l instanceof HTMLCanvasElement&&(l.width=l.height=0);o.clear()}this._cachedBitmapsMap.clear(),this.#tx()}#tx(){if(this.pageColors){let o=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==o){let l=this.ctx.filter;this.ctx.filter=o,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=l}}}_scaleImage(o,l){let u,A;let S=o.width,C=o.height,E=Math.max(Math.hypot(l[0],l[1]),1),T=Math.max(Math.hypot(l[2],l[3]),1),P=S,M=C,F="prescale1";for(;E>2&&P>1||T>2&&M>1;){let l=P,S=M;E>2&&P>1&&(l=P>=16384?Math.floor(P/2)-1||1:Math.ceil(P/2),E/=P/l),T>2&&M>1&&(S=M>=16384?Math.floor(M/2)-1||1:Math.ceil(M)/2,T/=M/S),(A=(u=this.cachedCanvases.getCanvas(F,l,S)).context).clearRect(0,0,l,S),A.drawImage(o,0,0,P,M,0,0,l,S),o=u.canvas,P=l,M=S,F="prescale1"===F?"prescale2":"prescale1"}return{img:o,paintWidth:P,paintHeight:M}}_createMaskCanvas(o){let l,u,E,T;let P=this.ctx,{width:M,height:F}=o,O=this.current.fillColor,I=this.current.patternFill,D=(0,S.getCurrentTransform)(P);if((o.bitmap||o.data)&&o.count>1){let A=o.bitmap||o.data.buffer;u=JSON.stringify(I?D:[D.slice(0,4),O]),(l=this._cachedBitmapsMap.get(A))||(l=new Map,this._cachedBitmapsMap.set(A,l));let S=l.get(u);if(S&&!I)return{canvas:S,offsetX:Math.round(Math.min(D[0],D[2])+D[4]),offsetY:Math.round(Math.min(D[1],D[3])+D[5])};E=S}E||$((T=this.cachedCanvases.getCanvas("maskCanvas",M,F)).context,o);let L=A.Util.transform(D,[1/M,0,0,-1/F,0,0]);L=A.Util.transform(L,[1,0,0,1,0,-F]);let N=A.Util.applyTransform([0,0],L),U=A.Util.applyTransform([M,F],L),W=A.Util.normalizeRect([N[0],N[1],U[0],U[1]]),z=Math.round(W[2]-W[0])||1,V=Math.round(W[3]-W[1])||1,X=this.cachedCanvases.getCanvas("fillCanvas",z,V),K=X.context,Y=Math.min(N[0],U[0]),J=Math.min(N[1],U[1]);K.translate(-Y,-J),K.transform(...L),!E&&(E=(E=this._scaleImage(T.canvas,(0,S.getCurrentTransformInverse)(K))).img,l&&I&&l.set(u,E)),K.imageSmoothingEnabled=te((0,S.getCurrentTransform)(K),o.interpolate),H(K,E,0,0,E.width,E.height,0,0,M,F),K.globalCompositeOperation="source-in";let Q=A.Util.transform((0,S.getCurrentTransformInverse)(K),[1,0,0,1,-Y,-J]);return K.fillStyle=I?O.getPattern(P,this,Q,C.PathType.FILL):O,K.fillRect(0,0,M,F),l&&!I&&(this.cachedCanvases.delete("fillCanvas"),l.set(u,X.canvas)),{canvas:X.canvas,offsetX:Math.round(Y),offsetY:Math.round(J)}}setLineWidth(o){o!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=o,this.ctx.lineWidth=o}setLineCap(o){this.ctx.lineCap=ti[o]}setLineJoin(o){this.ctx.lineJoin=ts[o]}setMiterLimit(o){this.ctx.miterLimit=o}setDash(o,l){let u=this.ctx;void 0!==u.setLineDash&&(u.setLineDash(o),u.lineDashOffset=l)}setRenderingIntent(o){}setFlatness(o){}setGState(o){for(let[l,u]of o)switch(l){case"LW":this.setLineWidth(u);break;case"LC":this.setLineCap(u);break;case"LJ":this.setLineJoin(u);break;case"ML":this.setMiterLimit(u);break;case"D":this.setDash(u[0],u[1]);break;case"RI":this.setRenderingIntent(u);break;case"FL":this.setFlatness(u);break;case"Font":this.setFont(u[0],u[1]);break;case"CA":this.current.strokeAlpha=u;break;case"ca":this.current.fillAlpha=u,this.ctx.globalAlpha=u;break;case"BM":this.ctx.globalCompositeOperation=u;break;case"SMask":this.current.activeSMask=u?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(u)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){let o=this.inSMaskMode;this.current.activeSMask&&!o?this.beginSMaskMode():!this.current.activeSMask&&o&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw Error("beginSMaskMode called while already in smask mode");let o=this.ctx.canvas.width,l=this.ctx.canvas.height,u="smaskGroupAt"+this.groupLevel,A=this.cachedCanvases.getCanvas(u,o,l);this.suspendedCtx=this.ctx,this.ctx=A.context;let C=this.ctx;C.setTransform(...(0,S.getCurrentTransform)(this.suspendedCtx)),X(this.suspendedCtx,C),N(C,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),X(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(o){if(!this.current.activeSMask)return;o?(o[0]=Math.floor(o[0]),o[1]=Math.floor(o[1]),o[2]=Math.ceil(o[2]),o[3]=Math.ceil(o[3])):o=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let l=this.current.activeSMask;tt(this.suspendedCtx,l,this.ctx,o),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}save(){this.inSMaskMode?(X(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();let o=this.current;this.stateStack.push(o),this.current=o.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),X(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(o,l,u,A,S,C){this.ctx.transform(o,l,u,A,S,C),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(o,l,u){let C,E;let T=this.ctx,P=this.current,M=P.x,F=P.y,O=(0,S.getCurrentTransform)(T),I=0===O[0]&&0===O[3]||0===O[1]&&0===O[2],D=I?u.slice(0):null;for(let u=0,S=0,L=o.length;u<L;u++)switch(0|o[u]){case A.OPS.rectangle:M=l[S++],F=l[S++];let L=l[S++],N=l[S++],U=M+L,H=F+N;T.moveTo(M,F),0===L||0===N?T.lineTo(U,H):(T.lineTo(U,F),T.lineTo(U,H),T.lineTo(M,H)),I||P.updateRectMinMax(O,[M,F,U,H]),T.closePath();break;case A.OPS.moveTo:M=l[S++],F=l[S++],T.moveTo(M,F),I||P.updatePathMinMax(O,M,F);break;case A.OPS.lineTo:M=l[S++],F=l[S++],T.lineTo(M,F),I||P.updatePathMinMax(O,M,F);break;case A.OPS.curveTo:C=M,E=F,M=l[S+4],F=l[S+5],T.bezierCurveTo(l[S],l[S+1],l[S+2],l[S+3],M,F),P.updateCurvePathMinMax(O,C,E,l[S],l[S+1],l[S+2],l[S+3],M,F,D),S+=6;break;case A.OPS.curveTo2:C=M,E=F,T.bezierCurveTo(M,F,l[S],l[S+1],l[S+2],l[S+3]),P.updateCurvePathMinMax(O,C,E,M,F,l[S],l[S+1],l[S+2],l[S+3],D),M=l[S+2],F=l[S+3],S+=4;break;case A.OPS.curveTo3:C=M,E=F,M=l[S+2],F=l[S+3],T.bezierCurveTo(l[S],l[S+1],M,F,M,F),P.updateCurvePathMinMax(O,C,E,l[S],l[S+1],M,F,M,F,D),S+=4;break;case A.OPS.closePath:T.closePath()}I&&P.updateScalingPathMinMax(O,D),P.setCurrentPoint(M,F)}closePath(){this.ctx.closePath()}stroke(o=!0){let l=this.ctx,u=this.current.strokeColor;l.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"==typeof u&&u?.getPattern?(l.save(),l.strokeStyle=u.getPattern(l,this,(0,S.getCurrentTransformInverse)(l),C.PathType.STROKE),this.rescaleAndStroke(!1),l.restore()):this.rescaleAndStroke(!0)),o&&this.consumePath(this.current.getClippedPathBoundingBox()),l.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(o=!0){let l=this.ctx,u=this.current.fillColor,A=this.current.patternFill,E=!1;A&&(l.save(),l.fillStyle=u.getPattern(l,this,(0,S.getCurrentTransformInverse)(l),C.PathType.FILL),E=!0);let T=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==T&&(this.pendingEOFill?(l.fill("evenodd"),this.pendingEOFill=!1):l.fill()),E&&l.restore(),o&&this.consumePath(T)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=tr}eoClip(){this.pendingClip=ta}beginText(){this.current.textMatrix=A.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){let o=this.pendingTextPaths,l=this.ctx;if(void 0===o){l.beginPath();return}for(let u of(l.save(),l.beginPath(),o))l.setTransform(...u.transform),l.translate(u.x,u.y),u.addToPath(l,u.fontSize);l.restore(),l.clip(),l.beginPath(),delete this.pendingTextPaths}setCharSpacing(o){this.current.charSpacing=o}setWordSpacing(o){this.current.wordSpacing=o}setHScale(o){this.current.textHScale=o/100}setLeading(o){this.current.leading=-o}setFont(o,l){let u=this.commonObjs.get(o),S=this.current;if(!u)throw Error(`Can't find font for ${o}`);if(S.fontMatrix=u.fontMatrix||A.FONT_IDENTITY_MATRIX,(0===S.fontMatrix[0]||0===S.fontMatrix[3])&&(0,A.warn)("Invalid font matrix for font "+o),l<0?(l=-l,S.fontDirection=-1):S.fontDirection=1,this.current.font=u,this.current.fontSize=l,u.isType3Font)return;let C=u.loadedName||"sans-serif",E=u.systemFontInfo?.css||`"${C}", ${u.fallbackName}`,T="normal";u.black?T="900":u.bold&&(T="bold");let F=u.italic?"italic":"normal",O=l;l<P?O=P:l>M&&(O=M),this.current.fontSizeScale=l/O,this.ctx.font=`${F} ${T} ${O}px ${E}`}setTextRenderingMode(o){this.current.textRenderingMode=o}setTextRise(o){this.current.textRise=o}moveText(o,l){this.current.x=this.current.lineX+=o,this.current.y=this.current.lineY+=l}setLeadingMoveText(o,l){this.setLeading(-l),this.moveText(o,l)}setTextMatrix(o,l,u,A,S,C){this.current.textMatrix=[o,l,u,A,S,C],this.current.textMatrixScale=Math.hypot(o,l),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(o,l,u,C){let E;let T=this.ctx,P=this.current,M=P.font,F=P.textRenderingMode,O=P.fontSize/P.fontSizeScale,I=F&A.TextRenderingMode.FILL_STROKE_MASK,D=!!(F&A.TextRenderingMode.ADD_TO_PATH_FLAG),L=P.patternFill&&!M.missingFile;(M.disableFontFace||D||L)&&(E=M.getPathGenerator(this.commonObjs,o)),M.disableFontFace||L?(T.save(),T.translate(l,u),T.beginPath(),E(T,O),C&&T.setTransform(...C),(I===A.TextRenderingMode.FILL||I===A.TextRenderingMode.FILL_STROKE)&&T.fill(),(I===A.TextRenderingMode.STROKE||I===A.TextRenderingMode.FILL_STROKE)&&T.stroke(),T.restore()):((I===A.TextRenderingMode.FILL||I===A.TextRenderingMode.FILL_STROKE)&&T.fillText(o,l,u),(I===A.TextRenderingMode.STROKE||I===A.TextRenderingMode.FILL_STROKE)&&T.strokeText(o,l,u)),D&&(this.pendingTextPaths||=[]).push({transform:(0,S.getCurrentTransform)(T),x:l,y:u,fontSize:O,addToPath:E})}get isFontSubpixelAAEnabled(){let{context:o}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);o.scale(1.5,1),o.fillText("I",0,10);let l=o.getImageData(0,0,10,10).data,u=!1;for(let o=3;o<l.length;o+=4)if(l[o]>0&&l[o]<255){u=!0;break}return(0,A.shadow)(this,"isFontSubpixelAAEnabled",u)}showText(o){let l;let u=this.current,E=u.font;if(E.isType3Font)return this.showType3Text(o);let T=u.fontSize;if(0===T)return;let P=this.ctx,M=u.fontSizeScale,F=u.charSpacing,O=u.wordSpacing,I=u.fontDirection,D=u.textHScale*I,L=o.length,N=E.vertical,U=N?1:-1,H=E.defaultVMetrics,W=T*u.fontMatrix[0],z=u.textRenderingMode===A.TextRenderingMode.FILL&&!E.disableFontFace&&!u.patternFill;if(P.save(),P.transform(...u.textMatrix),P.translate(u.x,u.y+u.textRise),I>0?P.scale(D,-1):P.scale(D,1),u.patternFill){P.save();let o=u.fillColor.getPattern(P,this,(0,S.getCurrentTransformInverse)(P),C.PathType.FILL);l=(0,S.getCurrentTransform)(P),P.restore(),P.fillStyle=o}let V=u.lineWidth,$=u.textMatrixScale;if(0===$||0===V){let o=u.textRenderingMode&A.TextRenderingMode.FILL_STROKE_MASK;(o===A.TextRenderingMode.STROKE||o===A.TextRenderingMode.FILL_STROKE)&&(V=this.getSinglePixelWidth())}else V/=$;if(1!==M&&(P.scale(M,M),V/=M),P.lineWidth=V,E.isInvalidPDFjsFont){let l=[],A=0;for(let u of o)l.push(u.unicode),A+=u.width;P.fillText(l.join(""),0,0),u.x+=A*W*D,P.restore(),this.compose();return}let X=0,K;for(K=0;K<L;++K){let u,A,S;let C=o[K];if("number"==typeof C){X+=U*C*T/1e3;continue}let D=!1,L=(C.isSpace?O:0)+F,V=C.fontChar,$=C.accent,Y=C.width;if(N){let o=C.vmetric||H,l=-(C.vmetric?o[1]:.5*Y)*W,S=o[2]*W;Y=o?-o[0]:Y,u=l/M,A=(X+S)/M}else u=X/M,A=0;if(E.remeasure&&Y>0){let o=1e3*P.measureText(V).width/T*M;if(Y<o&&this.isFontSubpixelAAEnabled){let l=Y/o;D=!0,P.save(),P.scale(l,1),u/=l}else Y!==o&&(u+=(Y-o)/2e3*T/M)}if(this.contentVisible&&(C.isInFont||E.missingFile)){if(z&&!$)P.fillText(V,u,A);else if(this.paintChar(V,u,A,l),$){let o=u+T*$.offset.x/M,S=A-T*$.offset.y/M;this.paintChar($.fontChar,o,S,l)}}X+=S=N?Y*W-L*I:Y*W+L*I,D&&P.restore()}N?u.y-=X:u.x+=X*D,P.restore(),this.compose()}showType3Text(o){let l,u,S,C;let E=this.ctx,T=this.current,P=T.font,M=T.fontSize,F=T.fontDirection,O=P.vertical?1:-1,I=T.charSpacing,D=T.wordSpacing,L=T.textHScale*F,N=T.fontMatrix||A.FONT_IDENTITY_MATRIX,U=o.length;if(T.textRenderingMode!==A.TextRenderingMode.INVISIBLE&&0!==M){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,E.save(),E.transform(...T.textMatrix),E.translate(T.x,T.y),E.scale(L,F),l=0;l<U;++l){if("number"==typeof(u=o[l])){C=O*u*M/1e3,this.ctx.translate(C,0),T.x+=C*L;continue}let F=(u.isSpace?D:0)+I,U=P.charProcOperatorList[u.operatorListId];if(!U){(0,A.warn)(`Type3 character "${u.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=u,this.save(),E.scale(M,M),E.transform(...N),this.executeOperatorList(U),this.restore()),S=A.Util.applyTransform([u.width,0],N)[0]*M+F,E.translate(S,0),T.x+=S*L}E.restore(),this.processingType3=null}}setCharWidth(o,l){}setCharWidthAndBounds(o,l,u,A,S,C){this.ctx.rect(u,A,S-u,C-A),this.ctx.clip(),this.endPath()}getColorN_Pattern(o){let l;if("TilingPattern"===o[0]){let u=o[1],A=this.baseTransform||(0,S.getCurrentTransform)(this.ctx),E={createCanvasGraphics:o=>new tn(o,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};l=new C.TilingPattern(o,u,this.ctx,E,A)}else l=this._getPattern(o[1],o[2]);return l}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(o,l,u){let S=A.Util.makeHexColor(o,l,u);this.ctx.strokeStyle=S,this.current.strokeColor=S}setFillRGBColor(o,l,u){let S=A.Util.makeHexColor(o,l,u);this.ctx.fillStyle=S,this.current.fillColor=S,this.current.patternFill=!1}_getPattern(o,l=null){let u;return this.cachedPatterns.has(o)?u=this.cachedPatterns.get(o):(u=(0,C.getShadingPattern)(this.getObject(o)),this.cachedPatterns.set(o,u)),l&&(u.matrix=l),u}shadingFill(o){if(!this.contentVisible)return;let l=this.ctx;this.save();let u=this._getPattern(o);l.fillStyle=u.getPattern(l,this,(0,S.getCurrentTransformInverse)(l),C.PathType.SHADING);let E=(0,S.getCurrentTransformInverse)(l);if(E){let o=l.canvas,u=o.width,S=o.height,C=A.Util.applyTransform([0,0],E),T=A.Util.applyTransform([0,S],E),P=A.Util.applyTransform([u,0],E),M=A.Util.applyTransform([u,S],E),F=Math.min(C[0],T[0],P[0],M[0]),O=Math.min(C[1],T[1],P[1],M[1]),I=Math.max(C[0],T[0],P[0],M[0]),D=Math.max(C[1],T[1],P[1],M[1]);this.ctx.fillRect(F,O,I-F,D-O)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){(0,A.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,A.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(o,l){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(o)&&6===o.length&&this.transform(...o),this.baseTransform=(0,S.getCurrentTransform)(this.ctx),l)){let o=l[2]-l[0],u=l[3]-l[1];this.ctx.rect(l[0],l[1],o,u),this.current.updateRectMinMax((0,S.getCurrentTransform)(this.ctx),l),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(o){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);let l=this.ctx;o.isolated||(0,A.info)("TODO: Support non-isolated groups."),o.knockout&&(0,A.warn)("Knockout groups not supported.");let u=(0,S.getCurrentTransform)(l);if(o.matrix&&l.transform(...o.matrix),!o.bbox)throw Error("Bounding box is required.");let C=A.Util.getAxialAlignedBoundingBox(o.bbox,(0,S.getCurrentTransform)(l)),E=[0,0,l.canvas.width,l.canvas.height],T=Math.floor((C=A.Util.intersect(C,E)||[0,0,0,0])[0]),P=Math.floor(C[1]),M=Math.max(Math.ceil(C[2])-T,1),O=Math.max(Math.ceil(C[3])-P,1),I=1,D=1;M>F&&(I=M/F,M=F),O>F&&(D=O/F,O=F),this.current.startNewPathAndClipBox([0,0,M,O]);let L="groupAt"+this.groupLevel;o.smask&&(L+="_smask_"+this.smaskCounter++%2);let N=this.cachedCanvases.getCanvas(L,M,O),U=N.context;U.scale(1/I,1/D),U.translate(-T,-P),U.transform(...u),o.smask?this.smaskStack.push({canvas:N.canvas,context:U,offsetX:T,offsetY:P,scaleX:I,scaleY:D,subtype:o.smask.subtype,backdrop:o.smask.backdrop,transferMap:o.smask.transferMap||null,startTransformInverse:null}):(l.setTransform(1,0,0,1,0,0),l.translate(T,P),l.scale(I,D),l.save()),X(l,U),this.ctx=U,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(l),this.groupLevel++}endGroup(o){if(!this.contentVisible)return;this.groupLevel--;let l=this.ctx,u=this.groupStack.pop();if(this.ctx=u,this.ctx.imageSmoothingEnabled=!1,o.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();let o=(0,S.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...o);let u=A.Util.getAxialAlignedBoundingBox([0,0,l.canvas.width,l.canvas.height],o);this.ctx.drawImage(l.canvas,0,0),this.ctx.restore(),this.compose(u)}}beginAnnotation(o,l,u,C,E){if(this.#tC(),K(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(l)&&4===l.length){let C=l[2]-l[0],T=l[3]-l[1];if(E&&this.annotationCanvasMap){u=u.slice(),u[4]-=l[0],u[5]-=l[1],(l=l.slice())[0]=l[1]=0,l[2]=C,l[3]=T;let[E,P]=A.Util.singularValueDecompose2dScale((0,S.getCurrentTransform)(this.ctx)),{viewportScale:M}=this,F=Math.ceil(C*this.outputScaleX*M),O=Math.ceil(T*this.outputScaleY*M);this.annotationCanvas=this.canvasFactory.create(F,O);let{canvas:I,context:D}=this.annotationCanvas;this.annotationCanvasMap.set(o,I),this.annotationCanvas.savedCtx=this.ctx,this.ctx=D,this.ctx.save(),this.ctx.setTransform(E,0,0,-P,0,T*P),K(this.ctx)}else K(this.ctx),this.ctx.rect(l[0],l[1],C,T),this.ctx.clip(),this.endPath()}this.current=new z(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...u),this.transform(...C)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#tx(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(o){if(!this.contentVisible)return;let l=o.count;(o=this.getObject(o.data,o)).count=l;let u=this.ctx,A=this.processingType3;if(A&&(void 0===A.compiled&&(A.compiled=W(o)),A.compiled)){A.compiled(u);return}let S=this._createMaskCanvas(o),C=S.canvas;u.save(),u.setTransform(1,0,0,1,0,0),u.drawImage(C,S.offsetX,S.offsetY),u.restore(),this.compose()}paintImageMaskXObjectRepeat(o,l,u=0,C=0,E,T){if(!this.contentVisible)return;o=this.getObject(o.data,o);let P=this.ctx;P.save();let M=(0,S.getCurrentTransform)(P);P.transform(l,u,C,E,0,0);let F=this._createMaskCanvas(o);P.setTransform(1,0,0,1,F.offsetX-M[4],F.offsetY-M[5]);for(let o=0,S=T.length;o<S;o+=2){let S=A.Util.transform(M,[l,u,C,E,T[o],T[o+1]]),[O,I]=A.Util.applyTransform([0,0],S);P.drawImage(F.canvas,O,I)}P.restore(),this.compose()}paintImageMaskXObjectGroup(o){if(!this.contentVisible)return;let l=this.ctx,u=this.current.fillColor,A=this.current.patternFill;for(let E of o){let{data:o,width:T,height:P,transform:M}=E,F=this.cachedCanvases.getCanvas("maskCanvas",T,P),O=F.context;O.save(),$(O,this.getObject(o,E)),O.globalCompositeOperation="source-in",O.fillStyle=A?u.getPattern(O,this,(0,S.getCurrentTransformInverse)(l),C.PathType.FILL):u,O.fillRect(0,0,T,P),O.restore(),l.save(),l.transform(...M),l.scale(1,-1),H(l,F.canvas,0,0,T,P,0,-1,1,1),l.restore()}this.compose()}paintImageXObject(o){if(!this.contentVisible)return;let l=this.getObject(o);if(!l){(0,A.warn)("Dependent image isn't ready yet");return}this.paintInlineImageXObject(l)}paintImageXObjectRepeat(o,l,u,S){if(!this.contentVisible)return;let C=this.getObject(o);if(!C){(0,A.warn)("Dependent image isn't ready yet");return}let E=C.width,T=C.height,P=[];for(let o=0,A=S.length;o<A;o+=2)P.push({transform:[l,0,0,u,S[o],S[o+1]],x:0,y:0,w:E,h:T});this.paintInlineImageXObjectGroup(C,P)}applyTransferMapsToCanvas(o){return"none"!==this.current.transferMaps&&(o.filter=this.current.transferMaps,o.drawImage(o.canvas,0,0),o.filter="none"),o.canvas}applyTransferMapsToBitmap(o){if("none"===this.current.transferMaps)return o.bitmap;let{bitmap:l,width:u,height:A}=o,S=this.cachedCanvases.getCanvas("inlineImage",u,A),C=S.context;return C.filter=this.current.transferMaps,C.drawImage(l,0,0),C.filter="none",S.canvas}paintInlineImageXObject(o){let l;if(!this.contentVisible)return;let u=o.width,A=o.height,C=this.ctx;if(this.save(),T.isNodeJS||(C.filter="none"),C.scale(1/u,-1/A),o.bitmap)l=this.applyTransferMapsToBitmap(o);else if("function"==typeof HTMLElement&&o instanceof HTMLElement||!o.data)l=o;else{let S=this.cachedCanvases.getCanvas("inlineImage",u,A).context;V(S,o),l=this.applyTransferMapsToCanvas(S)}let E=this._scaleImage(l,(0,S.getCurrentTransformInverse)(C));C.imageSmoothingEnabled=te((0,S.getCurrentTransform)(C),o.interpolate),H(C,E.img,0,0,E.paintWidth,E.paintHeight,0,-A,u,A),this.compose(),this.restore()}paintInlineImageXObjectGroup(o,l){let u;if(!this.contentVisible)return;let A=this.ctx;if(o.bitmap)u=o.bitmap;else{let l=o.width,A=o.height,S=this.cachedCanvases.getCanvas("inlineImage",l,A).context;V(S,o),u=this.applyTransferMapsToCanvas(S)}for(let o of l)A.save(),A.transform(...o.transform),A.scale(1,-1),H(A,u,o.x,o.y,o.w,o.h,0,-1,1,1),A.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(o){}markPointProps(o,l){}beginMarkedContent(o){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(o,l){"OC"===o?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(l)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(o){let l=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(o);let u=this.ctx;this.pendingClip&&(l||(this.pendingClip===ta?u.clip("evenodd"):u.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),u.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let o=(0,S.getCurrentTransform)(this.ctx);if(0===o[1]&&0===o[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(o[0]),Math.abs(o[3]));else{let l=Math.abs(o[0]*o[3]-o[2]*o[1]),u=Math.hypot(o[0],o[2]),A=Math.hypot(o[1],o[3]);this._cachedGetSinglePixelWidth=Math.max(u,A)/l}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){let o,l;let{lineWidth:u}=this.current,{a:A,b:S,c:C,d:E}=this.ctx.getTransform();if(0===S&&0===C){let S=Math.abs(A),C=Math.abs(E);if(S===C){if(0===u)o=l=1/S;else{let A=S*u;o=l=A<1?1/A:1}}else if(0===u)o=1/S,l=1/C;else{let A=S*u,E=C*u;o=A<1?1/A:1,l=E<1?1/E:1}}else{let T=Math.abs(A*E-S*C),P=Math.hypot(A,S),M=Math.hypot(C,E);if(0===u)o=M/T,l=P/T;else{let A=u*T;o=M>A?M/A:1,l=P>A?P/A:1}}this._cachedScaleForStroking[0]=o,this._cachedScaleForStroking[1]=l}return this._cachedScaleForStroking}rescaleAndStroke(o){let{ctx:l}=this,{lineWidth:u}=this.current,[A,S]=this.getScaleForStroking();if(l.lineWidth=u||1,1===A&&1===S){l.stroke();return}let C=l.getLineDash();if(o&&l.save(),l.scale(A,S),C.length>0){let o=Math.max(A,S);l.setLineDash(C.map(l=>l/o)),l.lineDashOffset/=o}l.stroke(),o&&l.restore()}isContentVisible(){for(let o=this.markedContentStack.length-1;o>=0;o--)if(!this.markedContentStack[o].visible)return!1;return!0}}for(let o in l.CanvasGraphics=tn,A.OPS)void 0!==tn.prototype[o]&&(tn.prototype[A.OPS[o]]=tn.prototype[o])},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TilingPattern=l.PathType=void 0,l.getShadingPattern=D;var A=u(1),S=u(6);let C={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function E(o,l){if(!l)return;let u=l[2]-l[0],A=l[3]-l[1],S=new Path2D;S.rect(l[0],l[1],u,A),o.clip(S)}l.PathType=C;class T{constructor(){this.constructor===T&&(0,A.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,A.unreachable)("Abstract method `getPattern` called.")}}class P extends T{constructor(o){super(),this._type=o[1],this._bbox=o[2],this._colorStops=o[3],this._p0=o[4],this._p1=o[5],this._r0=o[6],this._r1=o[7],this.matrix=null}_createGradient(o){let l;for(let u of("axial"===this._type?l=o.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(l=o.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1)),this._colorStops))l.addColorStop(u[0],u[1]);return l}getPattern(o,l,u,T){let P;if(T===C.STROKE||T===C.FILL){let C=l.current.getClippedPathBoundingBox(T,(0,S.getCurrentTransform)(o))||[0,0,0,0],M=Math.ceil(C[2]-C[0])||1,F=Math.ceil(C[3]-C[1])||1,O=l.cachedCanvases.getCanvas("pattern",M,F,!0),I=O.context;I.clearRect(0,0,I.canvas.width,I.canvas.height),I.beginPath(),I.rect(0,0,I.canvas.width,I.canvas.height),I.translate(-C[0],-C[1]),u=A.Util.transform(u,[1,0,0,1,C[0],C[1]]),I.transform(...l.baseTransform),this.matrix&&I.transform(...this.matrix),E(I,this._bbox),I.fillStyle=this._createGradient(I),I.fill(),P=o.createPattern(O.canvas,"no-repeat");let D=new DOMMatrix(u);P.setTransform(D)}else E(o,this._bbox),P=this._createGradient(o);return P}}function M(o,l,u,A,S,C,E,T){let P,M,F,O,I,D,L,N,U;let H=l.coords,W=l.colors,z=o.data,V=4*o.width;H[u+1]>H[A+1]&&(P=u,u=A,A=P,P=C,C=E,E=P),H[A+1]>H[S+1]&&(P=A,A=S,S=P,P=E,E=T,T=P),H[u+1]>H[A+1]&&(P=u,u=A,A=P,P=C,C=E,E=P);let $=(H[u]+l.offsetX)*l.scaleX,X=(H[u+1]+l.offsetY)*l.scaleY,K=(H[A]+l.offsetX)*l.scaleX,Y=(H[A+1]+l.offsetY)*l.scaleY,J=(H[S]+l.offsetX)*l.scaleX,Q=(H[S+1]+l.offsetY)*l.scaleY;if(X>=Q)return;let Z=W[C],tt=W[C+1],te=W[C+2],ti=W[E],ts=W[E+1],tr=W[E+2],ta=W[T],tn=W[T+1],to=W[T+2],tl=Math.round(X),th=Math.round(Q);for(let o=tl;o<=th;o++){let l;if(o<Y){let l;M=$-($-K)*(l=o<X?0:(X-o)/(X-Y)),F=Z-(Z-ti)*l,O=tt-(tt-ts)*l,I=te-(te-tr)*l}else{let l;M=K-(K-J)*(l=o>Q?1:Y===Q?0:(Y-o)/(Y-Q)),F=ti-(ti-ta)*l,O=ts-(ts-tn)*l,I=tr-(tr-to)*l}D=$-($-J)*(l=o<X?0:o>Q?1:(X-o)/(X-Q)),L=Z-(Z-ta)*l,N=tt-(tt-tn)*l,U=te-(te-to)*l;let u=Math.round(Math.min(M,D)),A=Math.round(Math.max(M,D)),S=V*o+4*u;for(let o=u;o<=A;o++)(l=(M-o)/(M-D))<0?l=0:l>1&&(l=1),z[S++]=F-(F-L)*l|0,z[S++]=O-(O-N)*l|0,z[S++]=I-(I-U)*l|0,z[S++]=255}}function F(o,l,u){let A,S;let C=l.coords,E=l.colors;switch(l.type){case"lattice":let T=l.verticesPerRow,P=Math.floor(C.length/T)-1,F=T-1;for(A=0;A<P;A++){let l=A*T;for(let A=0;A<F;A++,l++)M(o,u,C[l],C[l+1],C[l+T],E[l],E[l+1],E[l+T]),M(o,u,C[l+T+1],C[l+1],C[l+T],E[l+T+1],E[l+1],E[l+T])}break;case"triangles":for(A=0,S=C.length;A<S;A+=3)M(o,u,C[A],C[A+1],C[A+2],E[A],E[A+1],E[A+2]);break;default:throw Error("illegal figure")}}class O extends T{constructor(o){super(),this._coords=o[2],this._colors=o[3],this._figures=o[4],this._bounds=o[5],this._bbox=o[7],this._background=o[8],this.matrix=null}_createMeshCanvas(o,l,u){let A=1.1,S=3e3,C=2,E=Math.floor(this._bounds[0]),T=Math.floor(this._bounds[1]),P=Math.ceil(this._bounds[2])-E,M=Math.ceil(this._bounds[3])-T,O=Math.min(Math.ceil(Math.abs(P*o[0]*A)),S),I=Math.min(Math.ceil(Math.abs(M*o[1]*A)),S),D=P/O,L=M/I,N={coords:this._coords,colors:this._colors,offsetX:-E,offsetY:-T,scaleX:1/D,scaleY:1/L},U=O+2*C,H=I+2*C,W=u.getCanvas("mesh",U,H,!1),z=W.context,V=z.createImageData(O,I);if(l){let o=V.data;for(let u=0,A=o.length;u<A;u+=4)o[u]=l[0],o[u+1]=l[1],o[u+2]=l[2],o[u+3]=255}for(let o of this._figures)F(V,o,N);return z.putImageData(V,C,C),{canvas:W.canvas,offsetX:E-C*D,offsetY:T-C*L,scaleX:D,scaleY:L}}getPattern(o,l,u,T){let P;if(E(o,this._bbox),T===C.SHADING)P=A.Util.singularValueDecompose2dScale((0,S.getCurrentTransform)(o));else if(P=A.Util.singularValueDecompose2dScale(l.baseTransform),this.matrix){let o=A.Util.singularValueDecompose2dScale(this.matrix);P=[P[0]*o[0],P[1]*o[1]]}let M=this._createMeshCanvas(P,T===C.SHADING?null:this._background,l.cachedCanvases);return T!==C.SHADING&&(o.setTransform(...l.baseTransform),this.matrix&&o.transform(...this.matrix)),o.translate(M.offsetX,M.offsetY),o.scale(M.scaleX,M.scaleY),o.createPattern(M.canvas,"no-repeat")}}class I extends T{getPattern(){return"hotpink"}}function D(o){switch(o[0]){case"RadialAxial":return new P(o);case"Mesh":return new O(o);case"Dummy":return new I}throw Error(`Unknown IR type: ${o[0]}`)}let L={COLORED:1,UNCOLORED:2};class N{static MAX_PATTERN_SIZE=3e3;constructor(o,l,u,A,S){this.operatorList=o[2],this.matrix=o[3]||[1,0,0,1,0,0],this.bbox=o[4],this.xstep=o[5],this.ystep=o[6],this.paintType=o[7],this.tilingType=o[8],this.color=l,this.ctx=u,this.canvasGraphicsFactory=A,this.baseTransform=S}createPatternCanvas(o){let l=this.operatorList,u=this.bbox,C=this.xstep,E=this.ystep,T=this.paintType,P=this.tilingType,M=this.color,F=this.canvasGraphicsFactory;(0,A.info)("TilingType: "+P);let O=u[0],I=u[1],D=u[2],L=u[3],N=A.Util.singularValueDecompose2dScale(this.matrix),U=A.Util.singularValueDecompose2dScale(this.baseTransform),H=[N[0]*U[0],N[1]*U[1]],W=this.getSizeAndScale(C,this.ctx.canvas.width,H[0]),z=this.getSizeAndScale(E,this.ctx.canvas.height,H[1]),V=o.cachedCanvases.getCanvas("pattern",W.size,z.size,!0),$=V.context,X=F.createCanvasGraphics($);X.groupLevel=o.groupLevel,this.setFillAndStrokeStyleToContext(X,T,M);let K=O,Y=I,J=D,Q=L;return O<0&&(K=0,J+=Math.abs(O)),I<0&&(Y=0,Q+=Math.abs(I)),$.translate(-(W.scale*K),-(z.scale*Y)),X.transform(W.scale,0,0,z.scale,0,0),$.save(),this.clipBbox(X,K,Y,J,Q),X.baseTransform=(0,S.getCurrentTransform)(X.ctx),X.executeOperatorList(l),X.endDrawing(),{canvas:V.canvas,scaleX:W.scale,scaleY:z.scale,offsetX:K,offsetY:Y}}getSizeAndScale(o,l,u){o=Math.abs(o);let A=Math.max(N.MAX_PATTERN_SIZE,l),S=Math.ceil(o*u);return S>=A?S=A:u=S/o,{scale:u,size:S}}clipBbox(o,l,u,A,C){let E=A-l,T=C-u;o.ctx.rect(l,u,E,T),o.current.updateRectMinMax((0,S.getCurrentTransform)(o.ctx),[l,u,A,C]),o.clip(),o.endPath()}setFillAndStrokeStyleToContext(o,l,u){let S=o.ctx,C=o.current;switch(l){case L.COLORED:let E=this.ctx;S.fillStyle=E.fillStyle,S.strokeStyle=E.strokeStyle,C.fillColor=E.fillStyle,C.strokeColor=E.strokeStyle;break;case L.UNCOLORED:let T=A.Util.makeHexColor(u[0],u[1],u[2]);S.fillStyle=T,S.strokeStyle=T,C.fillColor=T,C.strokeColor=T;break;default:throw new A.FormatError(`Unsupported paint type: ${l}`)}}getPattern(o,l,u,S){let E=u;S!==C.SHADING&&(E=A.Util.transform(E,l.baseTransform),this.matrix&&(E=A.Util.transform(E,this.matrix)));let T=this.createPatternCanvas(l),P=new DOMMatrix(E);P=(P=P.translate(T.offsetX,T.offsetY)).scale(1/T.scaleX,1/T.scaleY);let M=o.createPattern(T.canvas,"repeat");return M.setTransform(P),M}}l.TilingPattern=N},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.convertBlackAndWhiteToRGBA=C,l.convertToRGBA=S,l.grayToRGBA=T;var A=u(1);function S(o){switch(o.kind){case A.ImageKind.GRAYSCALE_1BPP:return C(o);case A.ImageKind.RGB_24BPP:return E(o)}return null}function C({src:o,srcPos:l=0,dest:u,width:S,height:C,nonBlackColor:E=4294967295,inverseDecode:T=!1}){let P=A.FeatureTest.isLittleEndian?4278190080:255,[M,F]=T?[E,P]:[P,E],O=S>>3,I=7&S,D=o.length;u=new Uint32Array(u.buffer);let L=0;for(let A=0;A<C;A++){for(let A=l+O;l<A;l++){let A=l<D?o[l]:255;u[L++]=128&A?F:M,u[L++]=64&A?F:M,u[L++]=32&A?F:M,u[L++]=16&A?F:M,u[L++]=8&A?F:M,u[L++]=4&A?F:M,u[L++]=2&A?F:M,u[L++]=1&A?F:M}if(0===I)continue;let A=l<D?o[l++]:255;for(let o=0;o<I;o++)u[L++]=A&1<<7-o?F:M}return{srcPos:l,destPos:L}}function E({src:o,srcPos:l=0,dest:u,destPos:S=0,width:C,height:E}){let T=0,P=o.length>>2,M=new Uint32Array(o.buffer,l,P);if(A.FeatureTest.isLittleEndian){for(;T<P-2;T+=3,S+=4){let o=M[T],l=M[T+1],A=M[T+2];u[S]=4278190080|o,u[S+1]=o>>>24|l<<8|4278190080,u[S+2]=l>>>16|A<<16|4278190080,u[S+3]=A>>>8|4278190080}for(let l=4*T,A=o.length;l<A;l+=3)u[S++]=o[l]|o[l+1]<<8|o[l+2]<<16|4278190080}else{for(;T<P-2;T+=3,S+=4){let o=M[T],l=M[T+1],A=M[T+2];u[S]=255|o,u[S+1]=o<<24|l>>>8|255,u[S+2]=l<<16|A>>>16|255,u[S+3]=A<<8|255}for(let l=4*T,A=o.length;l<A;l+=3)u[S++]=o[l]<<24|o[l+1]<<16|o[l+2]<<8|255}return{srcPos:l,destPos:S}}function T(o,l){if(A.FeatureTest.isLittleEndian)for(let u=0,A=o.length;u<A;u++)l[u]=65793*o[u]|4278190080;else for(let u=0,A=o.length;u<A;u++)l[u]=16843008*o[u]|255}},(o,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.GlobalWorkerOptions=void 0;let u=Object.create(null);l.GlobalWorkerOptions=u,u.workerPort=null,u.workerSrc=""},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.MessageHandler=void 0;var A=u(1);let S={DATA:1,ERROR:2},C={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function E(o){switch(o instanceof Error||"object"==typeof o&&null!==o||(0,A.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),o.name){case"AbortException":return new A.AbortException(o.message);case"MissingPDFException":return new A.MissingPDFException(o.message);case"PasswordException":return new A.PasswordException(o.message,o.code);case"UnexpectedResponseException":return new A.UnexpectedResponseException(o.message,o.status);case"UnknownErrorException":return new A.UnknownErrorException(o.message,o.details);default:return new A.UnknownErrorException(o.message,o.toString())}}class T{constructor(o,l,u){this.sourceName=o,this.targetName=l,this.comObj=u,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=o=>{let l=o.data;if(l.targetName!==this.sourceName)return;if(l.stream){this.#tE(l);return}if(l.callback){let o=l.callbackId,u=this.callbackCapabilities[o];if(!u)throw Error(`Cannot resolve callback ${o}`);if(delete this.callbackCapabilities[o],l.callback===S.DATA)u.resolve(l.data);else if(l.callback===S.ERROR)u.reject(E(l.reason));else throw Error("Unexpected callback case");return}let A=this.actionHandler[l.action];if(!A)throw Error(`Unknown action from worker: ${l.action}`);if(l.callbackId){let o=this.sourceName,C=l.sourceName;new Promise(function(o){o(A(l.data))}).then(function(A){u.postMessage({sourceName:o,targetName:C,callback:S.DATA,callbackId:l.callbackId,data:A})},function(A){u.postMessage({sourceName:o,targetName:C,callback:S.ERROR,callbackId:l.callbackId,reason:E(A)})});return}if(l.streamId){this.#tT(l);return}A(l.data)},u.addEventListener("message",this._onComObjOnMessage)}on(o,l){let u=this.actionHandler;if(u[o])throw Error(`There is already an actionName called "${o}"`);u[o]=l}send(o,l,u){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:o,data:l},u)}sendWithPromise(o,l,u){let S=this.callbackId++,C=new A.PromiseCapability;this.callbackCapabilities[S]=C;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:o,callbackId:S,data:l},u)}catch(o){C.reject(o)}return C.promise}sendWithStream(o,l,u,S){let T=this.streamId++,P=this.sourceName,M=this.targetName,F=this.comObj;return new ReadableStream({start:u=>{let C=new A.PromiseCapability;return this.streamControllers[T]={controller:u,startCall:C,pullCall:null,cancelCall:null,isClosed:!1},F.postMessage({sourceName:P,targetName:M,action:o,streamId:T,data:l,desiredSize:u.desiredSize},S),C.promise},pull:o=>{let l=new A.PromiseCapability;return this.streamControllers[T].pullCall=l,F.postMessage({sourceName:P,targetName:M,stream:C.PULL,streamId:T,desiredSize:o.desiredSize}),l.promise},cancel:o=>{(0,A.assert)(o instanceof Error,"cancel must have a valid reason");let l=new A.PromiseCapability;return this.streamControllers[T].cancelCall=l,this.streamControllers[T].isClosed=!0,F.postMessage({sourceName:P,targetName:M,stream:C.CANCEL,streamId:T,reason:E(o)}),l.promise}},u)}#tT(o){let l=o.streamId,u=this.sourceName,S=o.sourceName,T=this.comObj,P=this,M=this.actionHandler[o.action],F={enqueue(o,E=1,P){if(this.isCancelled)return;let M=this.desiredSize;this.desiredSize-=E,M>0&&this.desiredSize<=0&&(this.sinkCapability=new A.PromiseCapability,this.ready=this.sinkCapability.promise),T.postMessage({sourceName:u,targetName:S,stream:C.ENQUEUE,streamId:l,chunk:o},P)},close(){this.isCancelled||(this.isCancelled=!0,T.postMessage({sourceName:u,targetName:S,stream:C.CLOSE,streamId:l}),delete P.streamSinks[l])},error(o){(0,A.assert)(o instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,T.postMessage({sourceName:u,targetName:S,stream:C.ERROR,streamId:l,reason:E(o)}))},sinkCapability:new A.PromiseCapability,onPull:null,onCancel:null,isCancelled:!1,desiredSize:o.desiredSize,ready:null};F.sinkCapability.resolve(),F.ready=F.sinkCapability.promise,this.streamSinks[l]=F,new Promise(function(l){l(M(o.data,F))}).then(function(){T.postMessage({sourceName:u,targetName:S,stream:C.START_COMPLETE,streamId:l,success:!0})},function(o){T.postMessage({sourceName:u,targetName:S,stream:C.START_COMPLETE,streamId:l,reason:E(o)})})}#tE(o){let l=o.streamId,u=this.sourceName,S=o.sourceName,T=this.comObj,P=this.streamControllers[l],M=this.streamSinks[l];switch(o.stream){case C.START_COMPLETE:o.success?P.startCall.resolve():P.startCall.reject(E(o.reason));break;case C.PULL_COMPLETE:o.success?P.pullCall.resolve():P.pullCall.reject(E(o.reason));break;case C.PULL:if(!M){T.postMessage({sourceName:u,targetName:S,stream:C.PULL_COMPLETE,streamId:l,success:!0});break}M.desiredSize<=0&&o.desiredSize>0&&M.sinkCapability.resolve(),M.desiredSize=o.desiredSize,new Promise(function(o){o(M.onPull?.())}).then(function(){T.postMessage({sourceName:u,targetName:S,stream:C.PULL_COMPLETE,streamId:l,success:!0})},function(o){T.postMessage({sourceName:u,targetName:S,stream:C.PULL_COMPLETE,streamId:l,reason:E(o)})});break;case C.ENQUEUE:if((0,A.assert)(P,"enqueue should have stream controller"),P.isClosed)break;P.controller.enqueue(o.chunk);break;case C.CLOSE:if((0,A.assert)(P,"close should have stream controller"),P.isClosed)break;P.isClosed=!0,P.controller.close(),this.#tP(P,l);break;case C.ERROR:(0,A.assert)(P,"error should have stream controller"),P.controller.error(E(o.reason)),this.#tP(P,l);break;case C.CANCEL_COMPLETE:o.success?P.cancelCall.resolve():P.cancelCall.reject(E(o.reason)),this.#tP(P,l);break;case C.CANCEL:if(!M)break;new Promise(function(l){l(M.onCancel?.(E(o.reason)))}).then(function(){T.postMessage({sourceName:u,targetName:S,stream:C.CANCEL_COMPLETE,streamId:l,success:!0})},function(o){T.postMessage({sourceName:u,targetName:S,stream:C.CANCEL_COMPLETE,streamId:l,reason:E(o)})}),M.sinkCapability.reject(E(o.reason)),M.isCancelled=!0,delete this.streamSinks[l];break;default:throw Error("Unexpected stream case")}}async #tP(o,l){await Promise.allSettled([o.startCall?.promise,o.pullCall?.promise,o.cancelCall?.promise]),delete this.streamControllers[l]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}l.MessageHandler=T},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.Metadata=void 0;var A=u(1);class S{#tM;#tw;constructor({parsedData:o,rawData:l}){this.#tM=o,this.#tw=l}getRaw(){return this.#tw}get(o){return this.#tM.get(o)??null}getAll(){return(0,A.objectFromMap)(this.#tM)}has(o){return this.#tM.has(o)}}l.Metadata=S},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.OptionalContentConfig=void 0;var A=u(1),S=u(8);let C=Symbol("INTERNAL");class E{#tk=!0;constructor(o,l){this.name=o,this.intent=l}get visible(){return this.#tk}_setVisible(o,l){o!==C&&(0,A.unreachable)("Internal method `_setVisible` called."),this.#tk=l}}class T{#tR=null;#tF=new Map;#tO=null;#tI=null;constructor(o){if(this.name=null,this.creator=null,null===o)return;for(let l of(this.name=o.name,this.creator=o.creator,this.#tI=o.order,o.groups))this.#tF.set(l.id,new E(l.name,l.intent));if("OFF"===o.baseState)for(let o of this.#tF.values())o._setVisible(C,!1);for(let l of o.on)this.#tF.get(l)._setVisible(C,!0);for(let l of o.off)this.#tF.get(l)._setVisible(C,!1);this.#tO=this.getHash()}#tD(o){let l=o.length;if(l<2)return!0;let u=o[0];for(let S=1;S<l;S++){let l;let C=o[S];if(Array.isArray(C))l=this.#tD(C);else{if(!this.#tF.has(C))return(0,A.warn)(`Optional content group not found: ${C}`),!0;l=this.#tF.get(C).visible}switch(u){case"And":if(!l)return!1;break;case"Or":if(l)return!0;break;case"Not":return!l;default:return!0}}return"And"===u}isVisible(o){if(0===this.#tF.size)return!0;if(!o)return(0,A.warn)("Optional content group not defined."),!0;if("OCG"===o.type)return this.#tF.has(o.id)?this.#tF.get(o.id).visible:((0,A.warn)(`Optional content group not found: ${o.id}`),!0);if("OCMD"===o.type){if(o.expression)return this.#tD(o.expression);if(o.policy&&"AnyOn"!==o.policy){if("AllOn"===o.policy){for(let l of o.ids){if(!this.#tF.has(l)){(0,A.warn)(`Optional content group not found: ${l}`);break}if(!this.#tF.get(l).visible)return!1}return!0}if("AnyOff"===o.policy){for(let l of o.ids){if(!this.#tF.has(l))return(0,A.warn)(`Optional content group not found: ${l}`),!0;if(!this.#tF.get(l).visible)return!0}return!1}if("AllOff"===o.policy){for(let l of o.ids){if(!this.#tF.has(l)){(0,A.warn)(`Optional content group not found: ${l}`);break}if(this.#tF.get(l).visible)return!1}return!0}}else{for(let l of o.ids){if(!this.#tF.has(l))return(0,A.warn)(`Optional content group not found: ${l}`),!0;if(this.#tF.get(l).visible)return!0}return!1}return(0,A.warn)(`Unknown optional content policy ${o.policy}.`),!0}return(0,A.warn)(`Unknown group type ${o.type}.`),!0}setVisibility(o,l=!0){if(!this.#tF.has(o)){(0,A.warn)(`Optional content group not found: ${o}`);return}this.#tF.get(o)._setVisible(C,!!l),this.#tR=null}get hasInitialVisibility(){return this.getHash()===this.#tO}getOrder(){return this.#tF.size?this.#tI?this.#tI.slice():[...this.#tF.keys()]:null}getGroups(){return this.#tF.size>0?(0,A.objectFromMap)(this.#tF):null}getGroup(o){return this.#tF.get(o)||null}getHash(){if(null!==this.#tR)return this.#tR;let o=new S.MurmurHash3_64;for(let[l,u]of this.#tF)o.update(`${l}:${u.visible}`);return this.#tR=o.hexdigest()}}l.OptionalContentConfig=T},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.PDFDataTransportStream=void 0;var A=u(1),S=u(6);class C{constructor({length:o,initialData:l,progressiveDone:u=!1,contentDispositionFilename:S=null,disableRange:C=!1,disableStream:E=!1},T){if((0,A.assert)(T,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'),this._queuedChunks=[],this._progressiveDone=u,this._contentDispositionFilename=S,l?.length>0){let o=l instanceof Uint8Array&&l.byteLength===l.buffer.byteLength?l.buffer:new Uint8Array(l).buffer;this._queuedChunks.push(o)}this._pdfDataRangeTransport=T,this._isStreamingSupported=!E,this._isRangeSupported=!C,this._contentLength=o,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener((o,l)=>{this._onReceiveData({begin:o,chunk:l})}),this._pdfDataRangeTransport.addProgressListener((o,l)=>{this._onProgress({loaded:o,total:l})}),this._pdfDataRangeTransport.addProgressiveReadListener(o=>{this._onReceiveData({chunk:o})}),this._pdfDataRangeTransport.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),this._pdfDataRangeTransport.transportReady()}_onReceiveData({begin:o,chunk:l}){let u=l instanceof Uint8Array&&l.byteLength===l.buffer.byteLength?l.buffer:new Uint8Array(l).buffer;if(void 0===o)this._fullRequestReader?this._fullRequestReader._enqueue(u):this._queuedChunks.push(u);else{let l=this._rangeReaders.some(function(l){return l._begin===o&&(l._enqueue(u),!0)});(0,A.assert)(l,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(o){void 0===o.total?this._rangeReaders[0]?.onProgress?.({loaded:o.loaded}):this._fullRequestReader?.onProgress?.({loaded:o.loaded,total:o.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(o){let l=this._rangeReaders.indexOf(o);l>=0&&this._rangeReaders.splice(l,1)}getFullReader(){(0,A.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");let o=this._queuedChunks;return this._queuedChunks=null,new E(this,o,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(o,l){if(l<=this._progressiveDataLength)return null;let u=new T(this,o,l);return this._pdfDataRangeTransport.requestDataRange(o,l),this._rangeReaders.push(u),u}cancelAllRequests(o){for(let l of(this._fullRequestReader?.cancel(o),this._rangeReaders.slice(0)))l.cancel(o);this._pdfDataRangeTransport.abort()}}l.PDFDataTransportStream=C;class E{constructor(o,l,u=!1,A=null){for(let C of(this._stream=o,this._done=u||!1,this._filename=(0,S.isPdfFile)(A)?A:null,this._queuedChunks=l||[],this._loaded=0,this._queuedChunks))this._loaded+=C.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};let o=new A.PromiseCapability;return this._requests.push(o),o.promise}cancel(o){for(let o of(this._done=!0,this._requests))o.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class T{constructor(o,l,u){this._stream=o,this._begin=l,this._end=u,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(o){if(!this._done){if(0===this._requests.length)this._queuedChunk=o;else{for(let l of(this._requests.shift().resolve({value:o,done:!1}),this._requests))l.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){let o=this._queuedChunk;return this._queuedChunk=null,{value:o,done:!1}}if(this._done)return{value:void 0,done:!0};let o=new A.PromiseCapability;return this._requests.push(o),o.promise}cancel(o){for(let o of(this._done=!0,this._requests))o.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}},(o,l)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.XfaText=void 0;class u{static textContent(o){let l=[],A={items:l,styles:Object.create(null)};function S(o){if(!o)return;let A=null,C=o.name;if("#text"===C)A=o.value;else{if(!u.shouldBuildText(C))return;o?.attributes?.textContent?A=o.attributes.textContent:o.value&&(A=o.value)}if(null!==A&&l.push({str:A}),o.children)for(let l of o.children)S(l)}return S(o),A}static shouldBuildText(o){return!("textarea"===o||"input"===o||"option"===o||"select"===o)}}l.XfaText=u},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.NodeStandardFontDataFactory=l.NodeFilterFactory=l.NodeCanvasFactory=l.NodeCMapReaderFactory=void 0;var A=u(7);let S=function(o){return new Promise((l,u)=>{__webpack_require__(70172).readFile(o,(o,A)=>{if(o||!A){u(Error(o));return}l(new Uint8Array(A))})})};class C extends A.BaseFilterFactory{}l.NodeFilterFactory=C;class E extends A.BaseCanvasFactory{_createCanvas(o,l){return __webpack_require__(93414).createCanvas(o,l)}}l.NodeCanvasFactory=E;class T extends A.BaseCMapReaderFactory{_fetchData(o,l){return S(o).then(o=>({cMapData:o,compressionType:l}))}}l.NodeCMapReaderFactory=T;class P extends A.BaseStandardFontDataFactory{_fetchData(o){return S(o)}}l.NodeStandardFontDataFactory=P},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.PDFNodeStream=void 0;var A=u(1),S=u(22);let C=__webpack_require__(70172),E=__webpack_require__(2001),T=__webpack_require__(33779),P=__webpack_require__(11987),M=/^file:\/\/\/[a-zA-Z]:\//;function F(o){let l=P.parse(o);return"file:"===l.protocol||l.host?l:/^[a-z]:[/\\]/i.test(o)?P.parse(`file:///${o}`):(l.host||(l.protocol="file:"),l)}class O{constructor(o){this.source=o,this.url=F(o.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.httpHeaders=this.isHttp&&o.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,A.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new H(this):new N(this),this._fullRequestReader}getRangeReader(o,l){if(l<=this._progressiveDataLength)return null;let u=this.isFsUrl?new W(this,o,l):new U(this,o,l);return this._rangeRequestReaders.push(u),u}cancelAllRequests(o){for(let l of(this._fullRequestReader?.cancel(o),this._rangeRequestReaders.slice(0)))l.cancel(o)}}l.PDFNodeStream=O;class I{constructor(o){this._url=o.url,this._done=!1,this._storedError=null,this.onProgress=null;let l=o.source;this._contentLength=l.length,this._loaded=0,this._filename=null,this._disableRange=l.disableRange||!1,this._rangeChunkSize=l.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!l.disableStream,this._isRangeSupported=!l.disableRange,this._readableStream=null,this._readCapability=new A.PromiseCapability,this._headersCapability=new A.PromiseCapability}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;let o=this._readableStream.read();return null===o?(this._readCapability=new A.PromiseCapability,this.read()):(this._loaded+=o.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(o).buffer,done:!1})}cancel(o){if(!this._readableStream){this._error(o);return}this._readableStream.destroy(o)}_error(o){this._storedError=o,this._readCapability.resolve()}_setReadableStream(o){this._readableStream=o,o.on("readable",()=>{this._readCapability.resolve()}),o.on("end",()=>{o.destroy(),this._done=!0,this._readCapability.resolve()}),o.on("error",o=>{this._error(o)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new A.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class D{constructor(o){this._url=o.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=new A.PromiseCapability;let l=o.source;this._isStreamingSupported=!l.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;let o=this._readableStream.read();return null===o?(this._readCapability=new A.PromiseCapability,this.read()):(this._loaded+=o.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(o).buffer,done:!1})}cancel(o){if(!this._readableStream){this._error(o);return}this._readableStream.destroy(o)}_error(o){this._storedError=o,this._readCapability.resolve()}_setReadableStream(o){this._readableStream=o,o.on("readable",()=>{this._readCapability.resolve()}),o.on("end",()=>{o.destroy(),this._done=!0,this._readCapability.resolve()}),o.on("error",o=>{this._error(o)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function L(o,l){return{protocol:o.protocol,auth:o.auth,host:o.hostname,port:o.port,path:o.path,method:"GET",headers:l}}class N extends I{constructor(o){super(o);let l=l=>{if(404===l.statusCode){let o=new A.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=o,this._headersCapability.reject(o);return}this._headersCapability.resolve(),this._setReadableStream(l);let u=o=>this._readableStream.headers[o.toLowerCase()],{allowRangeRequests:C,suggestedLength:E}=(0,S.validateRangeRequestCapabilities)({getResponseHeader:u,isHttp:o.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=C,this._contentLength=E||this._contentLength,this._filename=(0,S.extractFilenameFromHeader)(u)};this._request=null,"http:"===this._url.protocol?this._request=E.request(L(this._url,o.httpHeaders),l):this._request=T.request(L(this._url,o.httpHeaders),l),this._request.on("error",o=>{this._storedError=o,this._headersCapability.reject(o)}),this._request.end()}}class U extends D{constructor(o,l,u){for(let l in super(o),this._httpHeaders={},o.httpHeaders){let u=o.httpHeaders[l];void 0!==u&&(this._httpHeaders[l]=u)}this._httpHeaders.Range=`bytes=${l}-${u-1}`;let S=o=>{if(404===o.statusCode){let o=new A.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=o;return}this._setReadableStream(o)};this._request=null,"http:"===this._url.protocol?this._request=E.request(L(this._url,this._httpHeaders),S):this._request=T.request(L(this._url,this._httpHeaders),S),this._request.on("error",o=>{this._storedError=o}),this._request.end()}}class H extends I{constructor(o){super(o);let l=decodeURIComponent(this._url.path);M.test(this._url.href)&&(l=l.replace(/^\//,"")),C.lstat(l,(o,u)=>{if(o){"ENOENT"===o.code&&(o=new A.MissingPDFException(`Missing PDF "${l}".`)),this._storedError=o,this._headersCapability.reject(o);return}this._contentLength=u.size,this._setReadableStream(C.createReadStream(l)),this._headersCapability.resolve()})}}class W extends D{constructor(o,l,u){super(o);let A=decodeURIComponent(this._url.path);M.test(this._url.href)&&(A=A.replace(/^\//,"")),this._setReadableStream(C.createReadStream(A,{start:l,end:u-1}))}}},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.createResponseStatusError=P,l.extractFilenameFromHeader=T,l.validateRangeRequestCapabilities=E,l.validateResponseStatus=M;var A=u(1),S=u(23),C=u(6);function E({getResponseHeader:o,isHttp:l,rangeChunkSize:u,disableRange:A}){let S={allowRangeRequests:!1,suggestedLength:void 0},C=parseInt(o("Content-Length"),10);return Number.isInteger(C)&&(S.suggestedLength=C,C<=2*u||A||!l||"bytes"!==o("Accept-Ranges")||"identity"!==(o("Content-Encoding")||"identity")||(S.allowRangeRequests=!0)),S}function T(o){let l=o("Content-Disposition");if(l){let o=(0,S.getFilenameFromContentDispositionHeader)(l);if(o.includes("%"))try{o=decodeURIComponent(o)}catch(o){}if((0,C.isPdfFile)(o))return o}return null}function P(o,l){return 404===o||0===o&&l.startsWith("file:")?new A.MissingPDFException('Missing PDF "'+l+'".'):new A.UnexpectedResponseException(`Unexpected server response (${o}) while retrieving PDF "${l}".`,o)}function M(o){return 200===o||206===o}},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.getFilenameFromContentDispositionHeader=S;var A=u(1);function S(o){let l=!0,u=S("filename\\*","i").exec(o);if(u){let o=P(u=u[1]);return E(o=F(o=M(o=unescape(o))))}if(u=T(o))return E(F(u));if(u=S("filename","i").exec(o)){let o=P(u=u[1]);return E(o=F(o))}function S(o,l){return RegExp("(?:^|;)\\s*"+o+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',l)}function C(o,u){if(o){if(!/^[\x00-\xFF]+$/.test(u))return u;try{let S=new TextDecoder(o,{fatal:!0}),C=(0,A.stringToBytes)(u);u=S.decode(C),l=!1}catch(o){}}return u}function E(o){return l&&/[\x80-\xff]/.test(o)&&(o=C("utf-8",o),l&&(o=C("iso-8859-1",o))),o}function T(o){let l;let u=[],A=S("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(l=A.exec(o));){let[,o,A,S]=l;if((o=parseInt(o,10))in u){if(0===o)break;continue}u[o]=[A,S]}let C=[];for(let o=0;o<u.length&&(o in u);++o){let[l,A]=u[o];A=P(A),l&&(A=unescape(A),0===o&&(A=M(A))),C.push(A)}return C.join("")}function P(o){if(o.startsWith('"')){let l=o.slice(1).split('\\"');for(let o=0;o<l.length;++o){let u=l[o].indexOf('"');-1!==u&&(l[o]=l[o].slice(0,u),l.length=o+1),l[o]=l[o].replaceAll(/\\(.)/g,"$1")}o=l.join('"')}return o}function M(o){let l=o.indexOf("'");return -1===l?o:C(o.slice(0,l),o.slice(l+1).replace(/^[^']*'/,""))}function F(o){return!o.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(o)?o:o.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(o,l,u,A){if("q"===u||"Q"===u)return C(l,A=(A=A.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,function(o,l){return String.fromCharCode(parseInt(l,16))}));try{A=atob(A)}catch(o){}return C(l,A)})}return""}},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.PDFNetworkStream=void 0;var A=u(1),S=u(22);let C=200,E=206;function T(o){let l=o.response;return"string"!=typeof l?l:(0,A.stringToBytes)(l).buffer}class P{constructor(o,l={}){this.url=o,this.isHttp=/^https?:/i.test(o),this.httpHeaders=this.isHttp&&l.httpHeaders||Object.create(null),this.withCredentials=l.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(o,l,u){let A={begin:o,end:l};for(let o in u)A[o]=u[o];return this.request(A)}requestFull(o){return this.request(o)}request(o){let l=new XMLHttpRequest,u=this.currXhrId++,A=this.pendingRequests[u]={xhr:l};for(let o in l.open("GET",this.url),l.withCredentials=this.withCredentials,this.httpHeaders){let u=this.httpHeaders[o];void 0!==u&&l.setRequestHeader(o,u)}return this.isHttp&&"begin"in o&&"end"in o?(l.setRequestHeader("Range",`bytes=${o.begin}-${o.end-1}`),A.expectedStatus=E):A.expectedStatus=C,l.responseType="arraybuffer",o.onError&&(l.onerror=function(u){o.onError(l.status)}),l.onreadystatechange=this.onStateChange.bind(this,u),l.onprogress=this.onProgress.bind(this,u),A.onHeadersReceived=o.onHeadersReceived,A.onDone=o.onDone,A.onError=o.onError,A.onProgress=o.onProgress,l.send(null),u}onProgress(o,l){let u=this.pendingRequests[o];u&&u.onProgress?.(l)}onStateChange(o,l){let u=this.pendingRequests[o];if(!u)return;let A=u.xhr;if(A.readyState>=2&&u.onHeadersReceived&&(u.onHeadersReceived(),delete u.onHeadersReceived),4!==A.readyState||!(o in this.pendingRequests))return;if(delete this.pendingRequests[o],0===A.status&&this.isHttp){u.onError?.(A.status);return}let S=A.status||C;if(!(S===C&&u.expectedStatus===E)&&S!==u.expectedStatus){u.onError?.(A.status);return}let P=T(A);if(S===E){let o=A.getResponseHeader("Content-Range"),l=/bytes (\d+)-(\d+)\/(\d+)/.exec(o);u.onDone({begin:parseInt(l[1],10),chunk:P})}else P?u.onDone({begin:0,chunk:P}):u.onError?.(A.status)}getRequestXhr(o){return this.pendingRequests[o].xhr}isPendingRequest(o){return o in this.pendingRequests}abortRequest(o){let l=this.pendingRequests[o].xhr;delete this.pendingRequests[o],l.abort()}}class M{constructor(o){this._source=o,this._manager=new P(o.url,{httpHeaders:o.httpHeaders,withCredentials:o.withCredentials}),this._rangeChunkSize=o.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(o){let l=this._rangeRequestReaders.indexOf(o);l>=0&&this._rangeRequestReaders.splice(l,1)}getFullReader(){return(0,A.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new F(this._manager,this._source),this._fullRequestReader}getRangeReader(o,l){let u=new O(this._manager,o,l);return u.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(u),u}cancelAllRequests(o){for(let l of(this._fullRequestReader?.cancel(o),this._rangeRequestReaders.slice(0)))l.cancel(o)}}l.PDFNetworkStream=M;class F{constructor(o,l){this._manager=o;let u={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=l.url,this._fullRequestId=o.requestFull(u),this._headersReceivedCapability=new A.PromiseCapability,this._disableRange=l.disableRange||!1,this._contentLength=l.length,this._rangeChunkSize=l.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){let o=this._fullRequestId,l=this._manager.getRequestXhr(o),u=o=>l.getResponseHeader(o),{allowRangeRequests:A,suggestedLength:C}=(0,S.validateRangeRequestCapabilities)({getResponseHeader:u,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});A&&(this._isRangeSupported=!0),this._contentLength=C||this._contentLength,this._filename=(0,S.extractFilenameFromHeader)(u),this._isRangeSupported&&this._manager.abortRequest(o),this._headersReceivedCapability.resolve()}_onDone(o){if(o&&(this._requests.length>0?this._requests.shift().resolve({value:o.chunk,done:!1}):this._cachedChunks.push(o.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(let o of this._requests)o.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(o){for(let l of(this._storedError=(0,S.createResponseStatusError)(o,this._url),this._headersReceivedCapability.reject(this._storedError),this._requests))l.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(o){this.onProgress?.({loaded:o.loaded,total:o.lengthComputable?o.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let o=new A.PromiseCapability;return this._requests.push(o),o.promise}cancel(o){for(let l of(this._done=!0,this._headersReceivedCapability.reject(o),this._requests))l.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class O{constructor(o,l,u){this._manager=o;let A={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=o.url,this._requestId=o.requestRange(l,u,A),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(o){let l=o.chunk;for(let o of(this._requests.length>0?this._requests.shift().resolve({value:l,done:!1}):this._queuedChunk=l,this._done=!0,this._requests))o.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(o){for(let l of(this._storedError=(0,S.createResponseStatusError)(o,this._url),this._requests))l.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(o){this.isStreamingSupported||this.onProgress?.({loaded:o.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){let o=this._queuedChunk;return this._queuedChunk=null,{value:o,done:!1}}if(this._done)return{value:void 0,done:!0};let o=new A.PromiseCapability;return this._requests.push(o),o.promise}cancel(o){for(let o of(this._done=!0,this._requests))o.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.PDFFetchStream=void 0;var A=u(1),S=u(22);function C(o,l,u){return{method:"GET",headers:o,signal:u.signal,mode:"cors",credentials:l?"include":"same-origin",redirect:"follow"}}function E(o){let l=new Headers;for(let u in o){let A=o[u];void 0!==A&&l.append(u,A)}return l}function T(o){return o instanceof Uint8Array?o.buffer:o instanceof ArrayBuffer?o:((0,A.warn)(`getArrayBuffer - unexpected data format: ${o}`),new Uint8Array(o).buffer)}class P{constructor(o){this.source=o,this.isHttp=/^https?:/i.test(o.url),this.httpHeaders=this.isHttp&&o.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,A.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new M(this),this._fullRequestReader}getRangeReader(o,l){if(l<=this._progressiveDataLength)return null;let u=new F(this,o,l);return this._rangeRequestReaders.push(u),u}cancelAllRequests(o){for(let l of(this._fullRequestReader?.cancel(o),this._rangeRequestReaders.slice(0)))l.cancel(o)}}l.PDFFetchStream=P;class M{constructor(o){this._stream=o,this._reader=null,this._loaded=0,this._filename=null;let l=o.source;this._withCredentials=l.withCredentials||!1,this._contentLength=l.length,this._headersCapability=new A.PromiseCapability,this._disableRange=l.disableRange||!1,this._rangeChunkSize=l.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!l.disableStream,this._isRangeSupported=!l.disableRange,this._headers=E(this._stream.httpHeaders);let u=l.url;fetch(u,C(this._headers,this._withCredentials,this._abortController)).then(o=>{if(!(0,S.validateResponseStatus)(o.status))throw(0,S.createResponseStatusError)(o.status,u);this._reader=o.body.getReader(),this._headersCapability.resolve();let l=l=>o.headers.get(l),{allowRangeRequests:C,suggestedLength:E}=(0,S.validateRangeRequestCapabilities)({getResponseHeader:l,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=C,this._contentLength=E||this._contentLength,this._filename=(0,S.extractFilenameFromHeader)(l),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new A.AbortException("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;let{value:o,done:l}=await this._reader.read();return l?{value:o,done:l}:(this._loaded+=o.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:T(o),done:!1})}cancel(o){this._reader?.cancel(o),this._abortController.abort()}}class F{constructor(o,l,u){this._stream=o,this._reader=null,this._loaded=0;let T=o.source;this._withCredentials=T.withCredentials||!1,this._readCapability=new A.PromiseCapability,this._isStreamingSupported=!T.disableStream,this._abortController=new AbortController,this._headers=E(this._stream.httpHeaders),this._headers.append("Range",`bytes=${l}-${u-1}`);let P=T.url;fetch(P,C(this._headers,this._withCredentials,this._abortController)).then(o=>{if(!(0,S.validateResponseStatus)(o.status))throw(0,S.createResponseStatusError)(o.status,P);this._readCapability.resolve(),this._reader=o.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;let{value:o,done:l}=await this._reader.read();return l?{value:o,done:l}:(this._loaded+=o.byteLength,this.onProgress?.({loaded:this._loaded}),{value:T(o),done:!1})}cancel(o){this._reader?.cancel(o),this._abortController.abort()}}},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.TextLayerRenderTask=void 0,l.renderTextLayer=N,l.updateTextLayer=U;var A=u(1),S=u(6);let C=1e5,E=30,T=.8,P=new Map;function M(o,l){let u;if(l&&A.FeatureTest.isOffscreenCanvasSupported)u=new OffscreenCanvas(o,o).getContext("2d",{alpha:!1});else{let l=document.createElement("canvas");l.width=l.height=o,u=l.getContext("2d",{alpha:!1})}return u}function F(o,l){let u=P.get(o);if(u)return u;let A=M(E,l);A.font=`${E}px ${o}`;let S=A.measureText(""),C=S.fontBoundingBoxAscent,F=Math.abs(S.fontBoundingBoxDescent);if(C){let l=C/(C+F);return P.set(o,l),A.canvas.width=A.canvas.height=0,l}A.strokeStyle="red",A.clearRect(0,0,E,E),A.strokeText("g",0,0);let O=A.getImageData(0,0,E,E).data;F=0;for(let o=O.length-1-3;o>=0;o-=4)if(O[o]>0){F=Math.ceil(o/4/E);break}A.clearRect(0,0,E,E),A.strokeText("A",0,E),O=A.getImageData(0,0,E,E).data,C=0;for(let o=0,l=O.length;o<l;o+=4)if(O[o]>0){C=E-Math.floor(o/4/E);break}if(A.canvas.width=A.canvas.height=0,C){let l=C/(C+F);return P.set(o,l),l}return P.set(o,T),T}function O(o,l,u){let S,C;let E=document.createElement("span"),T={angle:0,canvasWidth:0,hasText:""!==l.str,hasEOL:l.hasEOL,fontSize:0};o._textDivs.push(E);let P=A.Util.transform(o._transform,l.transform),M=Math.atan2(P[1],P[0]),O=u[l.fontName];O.vertical&&(M+=Math.PI/2);let I=Math.hypot(P[2],P[3]),D=I*F(O.fontFamily,o._isOffscreenCanvasSupported);0===M?(S=P[4],C=P[5]-D):(S=P[4]+D*Math.sin(M),C=P[5]-D*Math.cos(M));let L="calc(var(--scale-factor)*",N=E.style;o._container===o._rootContainer?(N.left=`${(100*S/o._pageWidth).toFixed(2)}%`,N.top=`${(100*C/o._pageHeight).toFixed(2)}%`):(N.left=`${L}${S.toFixed(2)}px)`,N.top=`${L}${C.toFixed(2)}px)`),N.fontSize=`${L}${I.toFixed(2)}px)`,N.fontFamily=O.fontFamily,T.fontSize=I,E.setAttribute("role","presentation"),E.textContent=l.str,E.dir=l.dir,o._fontInspectorEnabled&&(E.dataset.fontName=l.fontName),0!==M&&(T.angle=180/Math.PI*M);let U=!1;if(l.str.length>1)U=!0;else if(" "!==l.str&&l.transform[0]!==l.transform[3]){let o=Math.abs(l.transform[0]),u=Math.abs(l.transform[3]);o!==u&&Math.max(o,u)/Math.min(o,u)>1.5&&(U=!0)}U&&(T.canvasWidth=O.vertical?l.height:l.width),o._textDivProperties.set(E,T),o._isReadableStream&&o._layoutText(E)}function I(o){let{div:l,scale:u,properties:A,ctx:S,prevFontSize:C,prevFontFamily:E}=o,{style:T}=l,P="";if(0!==A.canvasWidth&&A.hasText){let{fontFamily:M}=T,{canvasWidth:F,fontSize:O}=A;(C!==O||E!==M)&&(S.font=`${O*u}px ${M}`,o.prevFontSize=O,o.prevFontFamily=M);let{width:I}=S.measureText(l.textContent);I>0&&(P=`scaleX(${F*u/I})`)}0!==A.angle&&(P=`rotate(${A.angle}deg) ${P}`),P.length>0&&(T.transform=P)}function D(o){if(o._canceled)return;let l=o._textDivs,u=o._capability;if(l.length>C){u.resolve();return}if(!o._isReadableStream)for(let u of l)o._layoutText(u);u.resolve()}class L{constructor({textContentSource:o,container:l,viewport:u,textDivs:C,textDivProperties:E,textContentItemsStr:T,isOffscreenCanvasSupported:P}){this._textContentSource=o,this._isReadableStream=o instanceof ReadableStream,this._container=this._rootContainer=l,this._textDivs=C||[],this._textContentItemsStr=T||[],this._isOffscreenCanvasSupported=P,this._fontInspectorEnabled=!!globalThis.FontInspector?.enabled,this._reader=null,this._textDivProperties=E||new WeakMap,this._canceled=!1,this._capability=new A.PromiseCapability,this._layoutTextParams={prevFontSize:null,prevFontFamily:null,div:null,scale:u.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:M(0,P)};let{pageWidth:F,pageHeight:O,pageX:I,pageY:D}=u.rawDims;this._transform=[1,0,0,-1,-I,D+O],this._pageWidth=F,this._pageHeight=O,(0,S.setLayerDimensions)(l,u),this._capability.promise.finally(()=>{this._layoutTextParams=null}).catch(()=>{})}get promise(){return this._capability.promise}cancel(){this._canceled=!0,this._reader&&(this._reader.cancel(new A.AbortException("TextLayer task cancelled.")).catch(()=>{}),this._reader=null),this._capability.reject(new A.AbortException("TextLayer task cancelled."))}_processItems(o,l){for(let u of o){if(void 0===u.str){if("beginMarkedContentProps"===u.type||"beginMarkedContent"===u.type){let o=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),null!==u.id&&this._container.setAttribute("id",`${u.id}`),o.append(this._container)}else"endMarkedContent"===u.type&&(this._container=this._container.parentNode);continue}this._textContentItemsStr.push(u.str),O(this,u,l)}}_layoutText(o){let l=this._layoutTextParams.properties=this._textDivProperties.get(o);if(this._layoutTextParams.div=o,I(this._layoutTextParams),l.hasText&&this._container.append(o),l.hasEOL){let o=document.createElement("br");o.setAttribute("role","presentation"),this._container.append(o)}}_render(){let o=new A.PromiseCapability,l=Object.create(null);if(this._isReadableStream){let u=()=>{this._reader.read().then(({value:A,done:S})=>{if(S){o.resolve();return}Object.assign(l,A.styles),this._processItems(A.items,l),u()},o.reject)};this._reader=this._textContentSource.getReader(),u()}else if(this._textContentSource){let{items:l,styles:u}=this._textContentSource;this._processItems(l,u),o.resolve()}else throw Error('No "textContentSource" parameter specified.');o.promise.then(()=>{l=null,D(this)},this._capability.reject)}}function N(o){!o.textContentSource&&(o.textContent||o.textContentStream)&&((0,S.deprecated)("The TextLayerRender `textContent`/`textContentStream` parameters will be removed in the future, please use `textContentSource` instead."),o.textContentSource=o.textContent||o.textContentStream);let{container:l,viewport:u}=o,A=getComputedStyle(l),C=A.getPropertyValue("visibility"),E=parseFloat(A.getPropertyValue("--scale-factor"));"visible"===C&&(!E||Math.abs(E-u.scale)>1e-5)&&console.error("The `--scale-factor` CSS-variable must be set, to the same value as `viewport.scale`, either on the `container`-element itself or higher up in the DOM.");let T=new L(o);return T._render(),T}function U({container:o,viewport:l,textDivs:u,textDivProperties:A,isOffscreenCanvasSupported:C,mustRotate:E=!0,mustRescale:T=!0}){if(E&&(0,S.setLayerDimensions)(o,{rotation:l.rotation}),T){let o=M(0,C),S={prevFontSize:null,prevFontFamily:null,div:null,scale:l.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:o};for(let o of u)S.properties=A.get(o),S.div=o,I(S)}}l.TextLayerRenderTask=L},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.AnnotationEditorLayer=void 0;var A=u(1),S=u(5),C=u(28),E=u(29),T=u(6);class P{#tL;#tN=!1;#tj=this.pointerup.bind(this);#tB=this.pointerdown.bind(this);#tU=new Map;#tG=!1;#tH=!1;#tq;static _initialized=!1;constructor(o){P._initialized||(P._initialized=!0,C.FreeTextEditor.initialize(o.l10n),E.InkEditor.initialize(o.l10n)),o.uiManager.registerEditorTypes([C.FreeTextEditor,E.InkEditor]),this.#tq=o.uiManager,this.pageIndex=o.pageIndex,this.div=o.div,this.#tL=o.accessibilityManager,this.#tq.addLayer(this)}get isEmpty(){return 0===this.#tU.size}updateToolbar(o){this.#tq.updateToolbar(o)}updateMode(o=this.#tq.getMode()){this.#tW(),o===A.AnnotationEditorType.INK?(this.addInkEditorIfNeeded(!1),this.disableClick()):this.enableClick(),this.#tq.unselectAll(),o!==A.AnnotationEditorType.NONE&&(this.div.classList.toggle("freeTextEditing",o===A.AnnotationEditorType.FREETEXT),this.div.classList.toggle("inkEditing",o===A.AnnotationEditorType.INK),this.div.hidden=!1)}addInkEditorIfNeeded(o){if(o||this.#tq.getMode()===A.AnnotationEditorType.INK){if(!o){for(let o of this.#tU.values())if(o.isEmpty()){o.setInBackground();return}}this.#tz({offsetX:0,offsetY:0}).setInBackground()}}setEditingState(o){this.#tq.setEditingState(o)}addCommands(o){this.#tq.addCommands(o)}enable(){for(let o of(this.div.style.pointerEvents="auto",this.#tU.values()))o.enableEditing()}disable(){for(let o of(this.div.style.pointerEvents="none",this.#tU.values()))o.disableEditing();this.#tW(),this.isEmpty&&(this.div.hidden=!0)}setActiveEditor(o){this.#tq.getActive()!==o&&this.#tq.setActiveEditor(o)}enableClick(){this.div.addEventListener("pointerdown",this.#tB),this.div.addEventListener("pointerup",this.#tj)}disableClick(){this.div.removeEventListener("pointerdown",this.#tB),this.div.removeEventListener("pointerup",this.#tj)}attach(o){this.#tU.set(o.id,o)}detach(o){this.#tU.delete(o.id),this.#tL?.removePointerInTextLayer(o.contentDiv)}remove(o){this.#tq.removeEditor(o),this.detach(o),o.div.style.display="none",setTimeout(()=>{o.div.style.display="",o.div.remove(),o.isAttachedToDOM=!1,document.activeElement===document.body&&this.#tq.focusMainContainer()},0),this.#tH||this.addInkEditorIfNeeded(!1)}#tV(o){o.parent!==this&&(this.attach(o),o.parent?.detach(o),o.setParent(this),o.div&&o.isAttachedToDOM&&(o.div.remove(),this.div.append(o.div)))}add(o){if(this.#tV(o),this.#tq.addEditor(o),this.attach(o),!o.isAttachedToDOM){let l=o.render();this.div.append(l),o.isAttachedToDOM=!0}this.moveEditorInDOM(o),o.onceAdded(),this.#tq.addToAnnotationStorage(o)}moveEditorInDOM(o){this.#tL?.moveElementInDOM(this.div,o.div,o.contentDiv,!0)}addOrRebuild(o){o.needsToBeRebuilt()?o.rebuild():this.add(o)}addANewEditor(o){let l=()=>{this.addOrRebuild(o)},u=()=>{o.remove()};this.addCommands({cmd:l,undo:u,mustExec:!0})}addUndoableEditor(o){let l=()=>{this.addOrRebuild(o)},u=()=>{o.remove()};this.addCommands({cmd:l,undo:u,mustExec:!1})}getNextId(){return this.#tq.getId()}#t$(o){switch(this.#tq.getMode()){case A.AnnotationEditorType.FREETEXT:return new C.FreeTextEditor(o);case A.AnnotationEditorType.INK:return new E.InkEditor(o)}return null}deserialize(o){switch(o.annotationType){case A.AnnotationEditorType.FREETEXT:return C.FreeTextEditor.deserialize(o,this,this.#tq);case A.AnnotationEditorType.INK:return E.InkEditor.deserialize(o,this,this.#tq)}return null}#tz(o){let l=this.getNextId(),u=this.#t$({parent:this,id:l,x:o.offsetX,y:o.offsetY,uiManager:this.#tq});return u&&this.add(u),u}setSelected(o){this.#tq.setSelected(o)}toggleSelected(o){this.#tq.toggleSelected(o)}isSelected(o){return this.#tq.isSelected(o)}unselect(o){this.#tq.unselect(o)}pointerup(o){let{isMac:l}=A.FeatureTest.platform;if(0===o.button&&(!o.ctrlKey||!l)&&o.target===this.div&&this.#tG){if(this.#tG=!1,!this.#tN){this.#tN=!0;return}this.#tz(o)}}pointerdown(o){let{isMac:l}=A.FeatureTest.platform;if(0!==o.button||o.ctrlKey&&l||o.target!==this.div)return;this.#tG=!0;let u=this.#tq.getActive();this.#tN=!u||u.isEmpty()}drop(o){let l=o.dataTransfer.getData("text/plain"),u=this.#tq.getEditor(l);if(!u)return;o.preventDefault(),o.dataTransfer.dropEffect="move",this.#tV(u);let A=this.div.getBoundingClientRect(),S=o.clientX-A.x,C=o.clientY-A.y;u.translate(S-u.startX,C-u.startY),this.moveEditorInDOM(u),u.div.focus()}dragover(o){o.preventDefault()}destroy(){for(let o of(this.#tq.getActive()?.parent===this&&this.#tq.setActiveEditor(null),this.#tU.values()))this.#tL?.removePointerInTextLayer(o.contentDiv),o.setParent(null),o.isAttachedToDOM=!1,o.div.remove();this.div=null,this.#tU.clear(),this.#tq.removeLayer(this)}#tW(){for(let o of(this.#tH=!0,this.#tU.values()))o.isEmpty()&&o.remove();this.#tH=!1}render({viewport:o}){for(let l of(this.viewport=o,(0,T.setLayerDimensions)(this.div,o),(0,S.bindEvents)(this,this.div,["dragover","drop"]),this.#tq.getEditors(this.pageIndex)))this.add(l);this.updateMode()}update({viewport:o}){this.#tq.commitOrRemove(),this.viewport=o,(0,T.setLayerDimensions)(this.div,{rotation:o.rotation}),this.updateMode()}get pageDimensions(){let{pageWidth:o,pageHeight:l}=this.viewport.rawDims;return[o,l]}}l.AnnotationEditorLayer=P},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.FreeTextEditor=void 0;var A=u(1),S=u(5),C=u(4);class E extends C.AnnotationEditor{#tX=this.editorDivBlur.bind(this);#tK=this.editorDivFocus.bind(this);#tY=this.editorDivInput.bind(this);#tJ=this.editorDivKeydown.bind(this);#tQ;#tZ="";#t0=`${this.id}-editor`;#t1=!1;#t2;static _freeTextDefaultContent="";static _l10nPromise;static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static _keyboardManager=new S.KeyboardManager([[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],E.prototype.commitOrRemove]]);static _type="freetext";constructor(o){super({...o,name:"freeTextEditor"}),this.#tQ=o.color||E._defaultColor||C.AnnotationEditor._defaultLineColor,this.#t2=o.fontSize||E._defaultFontSize}static initialize(o){this._l10nPromise=new Map(["free_text2_default_content","editor_free_text2_aria_label"].map(l=>[l,o.get(l)]));let l=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(l.getPropertyValue("--freetext-padding"))}static updateDefaultParams(o,l){switch(o){case A.AnnotationEditorParamsType.FREETEXT_SIZE:E._defaultFontSize=l;break;case A.AnnotationEditorParamsType.FREETEXT_COLOR:E._defaultColor=l}}updateParams(o,l){switch(o){case A.AnnotationEditorParamsType.FREETEXT_SIZE:this.#t3(l);break;case A.AnnotationEditorParamsType.FREETEXT_COLOR:this.#t5(l)}}static get defaultPropertiesToUpdate(){return[[A.AnnotationEditorParamsType.FREETEXT_SIZE,E._defaultFontSize],[A.AnnotationEditorParamsType.FREETEXT_COLOR,E._defaultColor||C.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[A.AnnotationEditorParamsType.FREETEXT_SIZE,this.#t2],[A.AnnotationEditorParamsType.FREETEXT_COLOR,this.#tQ]]}#t3(o){let l=o=>{this.editorDiv.style.fontSize=`calc(${o}px * var(--scale-factor))`,this.translate(0,-(o-this.#t2)*this.parentScale),this.#t2=o,this.#t4()},u=this.#t2;this.addCommands({cmd:()=>{l(o)},undo:()=>{l(u)},mustExec:!0,type:A.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#t5(o){let l=this.#tQ;this.addCommands({cmd:()=>{this.#tQ=this.editorDiv.style.color=o},undo:()=>{this.#tQ=this.editorDiv.style.color=l},mustExec:!0,type:A.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}getInitialTranslation(){let o=this.parentScale;return[-E._internalPadding*o,-(E._internalPadding+this.#t2)*o]}rebuild(){super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(A.AnnotationEditorType.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this.div.draggable=!1,this.div.removeAttribute("aria-activedescendant"),this.editorDiv.addEventListener("keydown",this.#tJ),this.editorDiv.addEventListener("focus",this.#tK),this.editorDiv.addEventListener("blur",this.#tX),this.editorDiv.addEventListener("input",this.#tY))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#t0),this.div.draggable=!0,this.editorDiv.removeEventListener("keydown",this.#tJ),this.editorDiv.removeEventListener("focus",this.#tK),this.editorDiv.removeEventListener("blur",this.#tX),this.editorDiv.removeEventListener("input",this.#tY),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freeTextEditing"))}focusin(o){super.focusin(o),o.target!==this.editorDiv&&this.editorDiv.focus()}onceAdded(){this.width||(this.enableEditMode(),this.editorDiv.focus())}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1,this.parent.setEditingState(!0),this.parent.div.classList.add("freeTextEditing"),super.remove()}#t8(){let o=this.editorDiv.getElementsByTagName("div");if(0===o.length)return this.editorDiv.innerText;let l=[];for(let u of o)l.push(u.innerText.replace(/\r\n?|\n/,""));return l.join("\n")}#t4(){let o;let[l,u]=this.parentDimensions;if(this.isAttachedToDOM)o=this.div.getBoundingClientRect();else{let{currentLayer:l,div:u}=this,A=u.style.display;u.style.display="hidden",l.div.append(this.div),o=u.getBoundingClientRect(),u.remove(),u.style.display=A}this.width=o.width/l,this.height=o.height/u}commit(){this.isInEditMode()&&(super.commit(),this.#t1||(this.#t1=!0,this.parent.addUndoableEditor(this)),this.disableEditMode(),this.#tZ=this.#t8().trimEnd(),this.#t4())}shouldGetKeyboardEvents(){return this.isInEditMode()}dblclick(o){this.enableEditMode(),this.editorDiv.focus()}keydown(o){o.target===this.div&&"Enter"===o.key&&(this.enableEditMode(),this.editorDiv.focus())}editorDivKeydown(o){E._keyboardManager.exec(this,o)}editorDivFocus(o){this.isEditing=!0}editorDivBlur(o){this.isEditing=!1}editorDivInput(o){this.parent.div.classList.toggle("freeTextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){let o,l;if(this.div)return this.div;this.width&&(o=this.x,l=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#t0),this.enableEditing(),E._l10nPromise.get("editor_free_text2_aria_label").then(o=>this.editorDiv?.setAttribute("aria-label",o)),E._l10nPromise.get("free_text2_default_content").then(o=>this.editorDiv?.setAttribute("default-content",o)),this.editorDiv.contentEditable=!0;let{style:u}=this.editorDiv;if(u.fontSize=`calc(${this.#t2}px * var(--scale-factor))`,u.color=this.#tQ,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),(0,S.bindEvents)(this,this.div,["dblclick","keydown"]),this.width){let[u,A]=this.parentDimensions;for(let S of(this.setAt(o*u,l*A,this.width*u,this.height*A),this.#tZ.split("\n"))){let o=document.createElement("div");o.append(S?document.createTextNode(S):document.createElement("br")),this.editorDiv.append(o)}this.div.draggable=!0,this.editorDiv.contentEditable=!1}else this.div.draggable=!1,this.editorDiv.contentEditable=!0;return this.div}get contentDiv(){return this.editorDiv}static deserialize(o,l,u){let S=super.deserialize(o,l,u);return S.#t2=o.fontSize,S.#tQ=A.Util.makeHexColor(...o.color),S.#tZ=o.value,S}serialize(){if(this.isEmpty())return null;let o=E._internalPadding*this.parentScale,l=this.getRect(o,o),u=C.AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#tQ);return{annotationType:A.AnnotationEditorType.FREETEXT,color:u,fontSize:this.#t2,value:this.#tZ,pageIndex:this.pageIndex,rect:l,rotation:this.rotation}}}l.FreeTextEditor=E},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.InkEditor=void 0;var A=u(1),S=u(4),C=u(5);let E=16;class T extends S.AnnotationEditor{#t6=0;#t7=0;#t9=0;#et=this.canvasContextMenu.bind(this);#ee=this.canvasPointermove.bind(this);#ei=this.canvasPointerleave.bind(this);#es=this.canvasPointerup.bind(this);#er=this.canvasPointerdown.bind(this);#ea=new Path2D;#en=!1;#eo=!1;#el=!1;#eh=null;#ed=0;#ec=0;#eu=null;static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=1;static _l10nPromise;static _type="ink";constructor(o){super({...o,name:"inkEditor"}),this.color=o.color||null,this.thickness=o.thickness||null,this.opacity=o.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0}static initialize(o){this._l10nPromise=new Map(["editor_ink_canvas_aria_label","editor_ink2_aria_label"].map(l=>[l,o.get(l)]))}static updateDefaultParams(o,l){switch(o){case A.AnnotationEditorParamsType.INK_THICKNESS:T._defaultThickness=l;break;case A.AnnotationEditorParamsType.INK_COLOR:T._defaultColor=l;break;case A.AnnotationEditorParamsType.INK_OPACITY:T._defaultOpacity=l/100}}updateParams(o,l){switch(o){case A.AnnotationEditorParamsType.INK_THICKNESS:this.#ep(l);break;case A.AnnotationEditorParamsType.INK_COLOR:this.#t5(l);break;case A.AnnotationEditorParamsType.INK_OPACITY:this.#eg(l)}}static get defaultPropertiesToUpdate(){return[[A.AnnotationEditorParamsType.INK_THICKNESS,T._defaultThickness],[A.AnnotationEditorParamsType.INK_COLOR,T._defaultColor||S.AnnotationEditor._defaultLineColor],[A.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*T._defaultOpacity)]]}get propertiesToUpdate(){return[[A.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||T._defaultThickness],[A.AnnotationEditorParamsType.INK_COLOR,this.color||T._defaultColor||S.AnnotationEditor._defaultLineColor],[A.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??T._defaultOpacity))]]}#ep(o){let l=this.thickness;this.addCommands({cmd:()=>{this.thickness=o,this.#ef()},undo:()=>{this.thickness=l,this.#ef()},mustExec:!0,type:A.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#t5(o){let l=this.color;this.addCommands({cmd:()=>{this.color=o,this.#em()},undo:()=>{this.color=l,this.#em()},mustExec:!0,type:A.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#eg(o){o/=100;let l=this.opacity;this.addCommands({cmd:()=>{this.opacity=o,this.#em()},undo:()=>{this.opacity=l,this.#em()},mustExec:!0,type:A.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){super.rebuild(),null!==this.div&&(this.canvas||(this.#eb(),this.#eA()),this.isAttachedToDOM||(this.parent.add(this),this.#ev()),this.#ef())}remove(){null!==this.canvas&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.#eh.disconnect(),this.#eh=null,super.remove())}setParent(o){!this.parent&&o?this._uiManager.removeShouldRescale(this):this.parent&&null===o&&this._uiManager.addShouldRescale(this),super.setParent(o)}onScaleChanging(){let[o,l]=this.parentDimensions,u=this.width*o,A=this.height*l;this.setDimensions(u,A)}enableEditMode(){this.#en||null===this.canvas||(super.enableEditMode(),this.div.draggable=!1,this.canvas.addEventListener("pointerdown",this.#er))}disableEditMode(){this.isInEditMode()&&null!==this.canvas&&(super.disableEditMode(),this.div.draggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",this.#er))}onceAdded(){this.div.draggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}#ey(){let{parentRotation:o,parentDimensions:[l,u]}=this;switch(o){case 90:return[0,u,u,l];case 180:return[l,u,l,u];case 270:return[l,0,u,l];default:return[0,0,l,u]}}#e_(){let{ctx:o,color:l,opacity:u,thickness:A,parentScale:S,scaleFactor:E}=this;o.lineWidth=A*S/E,o.lineCap="round",o.lineJoin="round",o.miterLimit=10,o.strokeStyle=`${l}${(0,C.opacityToHex)(u)}`}#eS(o,l){this.canvas.addEventListener("contextmenu",this.#et),this.canvas.addEventListener("pointerleave",this.#ei),this.canvas.addEventListener("pointermove",this.#ee),this.canvas.addEventListener("pointerup",this.#es),this.canvas.removeEventListener("pointerdown",this.#er),this.isEditing=!0,this.#el||(this.#el=!0,this.#ev(),this.thickness||=T._defaultThickness,this.color||=T._defaultColor||S.AnnotationEditor._defaultLineColor,this.opacity??=T._defaultOpacity),this.currentPath.push([o,l]),this.#eo=!1,this.#e_(),this.#eu=()=>{this.#eC(),this.#eu&&window.requestAnimationFrame(this.#eu)},window.requestAnimationFrame(this.#eu)}#ex(o,l){let[u,A]=this.currentPath.at(-1);if(this.currentPath.length>1&&o===u&&l===A)return;let S=this.currentPath,C=this.#ea;if(S.push([o,l]),this.#eo=!0,S.length<=2){C.moveTo(...S[0]),C.lineTo(o,l);return}3===S.length&&(this.#ea=C=new Path2D,C.moveTo(...S[0])),this.#eE(C,...S.at(-3),...S.at(-2),o,l)}#eT(){if(0===this.currentPath.length)return;let o=this.currentPath.at(-1);this.#ea.lineTo(...o)}#eP(o,l){let u;if(this.#eu=null,o=Math.min(Math.max(o,0),this.canvas.width),l=Math.min(Math.max(l,0),this.canvas.height),this.#ex(o,l),this.#eT(),1!==this.currentPath.length)u=this.#eM();else{let A=[o,l];u=[[A,A.slice(),A.slice(),A]]}let A=this.#ea,S=this.currentPath;this.currentPath=[],this.#ea=new Path2D;let C=()=>{this.allRawPaths.push(S),this.paths.push(u),this.bezierPath2D.push(A),this.rebuild()},E=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),0===this.paths.length?this.remove():(this.canvas||(this.#eb(),this.#eA()),this.#ef())};this.addCommands({cmd:C,undo:E,mustExec:!0})}#eC(){if(!this.#eo)return;this.#eo=!1,this.thickness,this.parentScale;let o=this.currentPath.slice(-3),{ctx:l}=(o.map(o=>o[0]),o.map(o=>o[1]),this);for(let o of(l.save(),l.clearRect(0,0,this.canvas.width,this.canvas.height),this.bezierPath2D))l.stroke(o);l.stroke(this.#ea),l.restore()}#eE(o,l,u,A,S,C,E){let T=(l+A)/2,P=(u+S)/2,M=(A+C)/2,F=(S+E)/2;o.bezierCurveTo(T+2*(A-T)/3,P+2*(S-P)/3,M+2*(A-M)/3,F+2*(S-F)/3,M,F)}#eM(){let o;let l=this.currentPath;if(l.length<=2)return[[l[0],l[0],l.at(-1),l.at(-1)]];let u=[],[A,S]=l[0];for(o=1;o<l.length-2;o++){let[C,E]=l[o],[T,P]=l[o+1],M=(C+T)/2,F=(E+P)/2,O=[A+2*(C-A)/3,S+2*(E-S)/3],I=[M+2*(C-M)/3,F+2*(E-F)/3];u.push([[A,S],O,I,[M,F]]),[A,S]=[M,F]}let[C,E]=l[o],[T,P]=l[o+1],M=[A+2*(C-A)/3,S+2*(E-S)/3],F=[T+2*(C-T)/3,P+2*(E-P)/3];return u.push([[A,S],M,F,[T,P]]),u}#em(){if(this.isEmpty()){this.#ew();return}this.#e_();let{canvas:o,ctx:l}=this;for(let u of(l.setTransform(1,0,0,1,0,0),l.clearRect(0,0,o.width,o.height),this.#ew(),this.bezierPath2D))l.stroke(u)}commit(){this.#en||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),this.#en=!0,this.div.classList.add("disabled"),this.#ef(!0),this.parent.addInkEditorIfNeeded(!0),this.parent.moveEditorInDOM(this),this.div.focus({preventScroll:!0}))}focusin(o){super.focusin(o),this.enableEditMode()}canvasPointerdown(o){0===o.button&&this.isInEditMode()&&!this.#en&&(this.setInForeground(),o.preventDefault(),"mouse"!==o.type&&this.div.focus(),this.#eS(o.offsetX,o.offsetY))}canvasContextMenu(o){o.preventDefault()}canvasPointermove(o){o.preventDefault(),this.#ex(o.offsetX,o.offsetY)}canvasPointerup(o){o.preventDefault(),this.#ek(o)}canvasPointerleave(o){this.#ek(o)}#ek(o){this.canvas.removeEventListener("pointerleave",this.#ei),this.canvas.removeEventListener("pointermove",this.#ee),this.canvas.removeEventListener("pointerup",this.#es),this.canvas.addEventListener("pointerdown",this.#er),setTimeout(()=>{this.canvas.removeEventListener("contextmenu",this.#et)},10),this.#eP(o.offsetX,o.offsetY),this.addToAnnotationStorage(),this.setInBackground()}#eb(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",T._l10nPromise.get("editor_ink_canvas_aria_label").then(o=>this.canvas?.setAttribute("aria-label",o)),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")}#eA(){this.#eh=new ResizeObserver(o=>{let l=o[0].contentRect;l.width&&l.height&&this.setDimensions(l.width,l.height)}),this.#eh.observe(this.div)}render(){let o,l;if(this.div)return this.div;this.width&&(o=this.x,l=this.y),super.render(),T._l10nPromise.get("editor_ink2_aria_label").then(o=>this.div?.setAttribute("aria-label",o));let[u,A,S,C]=this.#ey();if(this.setAt(u,A,0,0),this.setDims(S,C),this.#eb(),this.width){let[u,A]=this.parentDimensions;this.setAt(o*u,l*A,this.width*u,this.height*A),this.#el=!0,this.#ev(),this.setDims(this.width*u,this.height*A),this.#em(),this.#eR(),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return this.#eA(),this.div}#ev(){if(!this.#el)return;let[o,l]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*o),this.canvas.height=Math.ceil(this.height*l),this.#ew()}setDimensions(o,l){let u=Math.round(o),A=Math.round(l);if(this.#ed===u&&this.#ec===A)return;this.#ed=u,this.#ec=A,this.canvas.style.visibility="hidden",this.#t6&&Math.abs(this.#t6-o/l)>.01&&(l=Math.ceil(o/this.#t6),this.setDims(o,l));let[S,C]=this.parentDimensions;this.width=o/S,this.height=l/C,this.#en&&this.#eF(o,l),this.#ev(),this.#em(),this.canvas.style.visibility="visible",this.fixDims()}#eF(o,l){let u=this.#eO(),A=(o-u)/this.#t9,S=(l-u)/this.#t7;this.scaleFactor=Math.min(A,S)}#ew(){let o=this.#eO()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+o,this.translationY*this.scaleFactor+o)}static #eI(o){let l=new Path2D;for(let u=0,A=o.length;u<A;u++){let[A,S,C,E]=o[u];0===u&&l.moveTo(...A),l.bezierCurveTo(S[0],S[1],C[0],C[1],E[0],E[1])}return l}#eD(o,l,u,A){let S,C;let E=4,T=[],P=this.thickness/2;for(let M of this.paths){S=[],C=[];for(let T=0,F=M.length;T<F;T++){let[F,O,I,D]=M[T],L=o*(F[0]+l)+P,N=A-o*(F[1]+u)-P,U=o*(O[0]+l)+P,H=A-o*(O[1]+u)-P,W=o*(I[0]+l)+P,z=A-o*(I[1]+u)-P,V=o*(D[0]+l)+P,$=A-o*(D[1]+u)-P;0===T&&(S.push(L,N),C.push(L,N)),S.push(U,H,W,z,V,$),this.#eL(L,N,U,H,W,z,V,$,E,C)}T.push({bezier:S,points:C})}return T}#eL(o,l,u,A,S,C,E,T,P,M){if(this.#eN(o,l,u,A,S,C,E,T)){M.push(E,T);return}for(let F=1;F<P-1;F++){let O=F/P,I=1-O,D=O*o+I*u,L=O*l+I*A,N=O*u+I*S,U=O*A+I*C,H=O*S+I*E,W=O*C+I*T;D=O*D+I*N,L=O*L+I*U,N=O*N+I*H,U=O*U+I*W,D=O*D+I*N,L=O*L+I*U,M.push(D,L)}M.push(E,T)}#eN(o,l,u,A,S,C,E,T){return Math.max((3*u-2*o-E)**2,(3*S-o-2*E)**2)+Math.max((3*A-2*l-T)**2,(3*C-l-2*T)**2)<=10}#ej(){let o=1/0,l=-1/0,u=1/0,S=-1/0;for(let C of this.paths)for(let[E,T,P,M]of C){let C=A.Util.bezierBoundingBox(...E,...T,...P,...M);o=Math.min(o,C[0]),u=Math.min(u,C[1]),l=Math.max(l,C[2]),S=Math.max(S,C[3])}return[o,u,l,S]}#eO(){return this.#en?Math.ceil(this.thickness*this.parentScale):0}#ef(o=!1){if(this.isEmpty())return;if(!this.#en){this.#em();return}let l=this.#ej(),u=this.#eO();this.#t9=Math.max(E,l[2]-l[0]),this.#t7=Math.max(E,l[3]-l[1]);let A=Math.ceil(u+this.#t9*this.scaleFactor),S=Math.ceil(u+this.#t7*this.scaleFactor),[C,T]=this.parentDimensions;this.width=A/C,this.height=S/T,this.#t6=A/S,this.#eR();let P=this.translationX,M=this.translationY;this.translationX=-l[0],this.translationY=-l[1],this.#ev(),this.#em(),this.#ed=A,this.#ec=S,this.setDims(A,S);let F=o?u/this.scaleFactor/2:0;this.translate(P-this.translationX-F,M-this.translationY-F)}#eR(){let{style:o}=this.div;this.#t6>=1?(o.minHeight=`${E}px`,o.minWidth=`${Math.round(this.#t6*E)}px`):(o.minWidth=`${E}px`,o.minHeight=`${Math.round(E/this.#t6)}px`)}static deserialize(o,l,u){let S=super.deserialize(o,l,u);S.thickness=o.thickness,S.color=A.Util.makeHexColor(...o.color),S.opacity=o.opacity;let[C,T]=S.pageDimensions,P=S.width*C,M=S.height*T,F=S.parentScale,O=o.thickness/2;for(let{bezier:l}of(S.#t6=P/M,S.#en=!0,S.#ed=Math.round(P),S.#ec=Math.round(M),o.paths)){let o=[];S.paths.push(o);let u=F*(l[0]-O),A=F*(M-l[1]-O);for(let S=2,C=l.length;S<C;S+=6){let C=F*(l[S]-O),E=F*(M-l[S+1]-O),T=F*(l[S+2]-O),P=F*(M-l[S+3]-O),I=F*(l[S+4]-O),D=F*(M-l[S+5]-O);o.push([[u,A],[C,E],[T,P],[I,D]]),u=I,A=D}let C=this.#eI(o);S.bezierPath2D.push(C)}let I=S.#ej();return S.#t9=Math.max(E,I[2]-I[0]),S.#t7=Math.max(E,I[3]-I[1]),S.#eF(P,M),S}serialize(){if(this.isEmpty())return null;let o=this.getRect(0,0),l=this.rotation%180==0?o[3]-o[1]:o[2]-o[0],u=S.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:A.AnnotationEditorType.INK,color:u,thickness:this.thickness,opacity:this.opacity,paths:this.#eD(this.scaleFactor/this.parentScale,this.translationX,this.translationY,l),pageIndex:this.pageIndex,rect:o,rotation:this.rotation}}}l.InkEditor=T},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.AnnotationLayer=void 0;var A=u(1),S=u(6),C=u(3),E=u(31),T=u(32);let P=1e3,M=9,F=new WeakSet;function O(o){return{width:o[2]-o[0],height:o[3]-o[1]}}class I{static create(o){switch(o.data.annotationType){case A.AnnotationType.LINK:return new L(o);case A.AnnotationType.TEXT:return new N(o);case A.AnnotationType.WIDGET:switch(o.data.fieldType){case"Tx":return new H(o);case"Btn":if(o.data.radioButton)return new z(o);if(o.data.checkBox)return new W(o);return new V(o);case"Ch":return new $(o)}return new U(o);case A.AnnotationType.POPUP:return new X(o);case A.AnnotationType.FREETEXT:return new Y(o);case A.AnnotationType.LINE:return new J(o);case A.AnnotationType.SQUARE:return new Q(o);case A.AnnotationType.CIRCLE:return new Z(o);case A.AnnotationType.POLYLINE:return new tt(o);case A.AnnotationType.CARET:return new ti(o);case A.AnnotationType.INK:return new ts(o);case A.AnnotationType.POLYGON:return new te(o);case A.AnnotationType.HIGHLIGHT:return new tr(o);case A.AnnotationType.UNDERLINE:return new ta(o);case A.AnnotationType.SQUIGGLY:return new tn(o);case A.AnnotationType.STRIKEOUT:return new to(o);case A.AnnotationType.STAMP:return new tl(o);case A.AnnotationType.FILEATTACHMENT:return new th(o);default:return new D(o)}}}class D{constructor(o,{isRenderable:l=!1,ignoreBorder:u=!1,createQuadrilaterals:A=!1}={}){this.isRenderable=l,this.data=o.data,this.layer=o.layer,this.page=o.page,this.viewport=o.viewport,this.linkService=o.linkService,this.downloadManager=o.downloadManager,this.imageResourcesPath=o.imageResourcesPath,this.renderForms=o.renderForms,this.svgFactory=o.svgFactory,this.annotationStorage=o.annotationStorage,this.enableScripting=o.enableScripting,this.hasJSActions=o.hasJSActions,this._fieldObjects=o.fieldObjects,l&&(this.container=this._createContainer(u)),A&&(this.quadrilaterals=this._createQuadrilaterals(u))}_createContainer(o=!1){let{data:l,page:u,viewport:S}=this,C=document.createElement("section");C.setAttribute("data-annotation-id",l.id),l.noRotate&&C.classList.add("norotate");let{pageWidth:E,pageHeight:T,pageX:P,pageY:M}=S.rawDims,{width:F,height:I}=O(l.rect),D=A.Util.normalizeRect([l.rect[0],u.view[3]-l.rect[1]+u.view[1],l.rect[2],u.view[3]-l.rect[3]+u.view[1]]);if(!o&&l.borderStyle.width>0){C.style.borderWidth=`${l.borderStyle.width}px`;let o=l.borderStyle.horizontalCornerRadius,u=l.borderStyle.verticalCornerRadius;if(o>0||u>0){let l=`calc(${o}px * var(--scale-factor)) / calc(${u}px * var(--scale-factor))`;C.style.borderRadius=l}else if(this instanceof z){let o=`calc(${F}px * var(--scale-factor)) / calc(${I}px * var(--scale-factor))`;C.style.borderRadius=o}switch(l.borderStyle.style){case A.AnnotationBorderStyleType.SOLID:C.style.borderStyle="solid";break;case A.AnnotationBorderStyleType.DASHED:C.style.borderStyle="dashed";break;case A.AnnotationBorderStyleType.BEVELED:(0,A.warn)("Unimplemented border style: beveled");break;case A.AnnotationBorderStyleType.INSET:(0,A.warn)("Unimplemented border style: inset");break;case A.AnnotationBorderStyleType.UNDERLINE:C.style.borderBottomStyle="solid"}let S=l.borderColor||null;S?C.style.borderColor=A.Util.makeHexColor(0|S[0],0|S[1],0|S[2]):C.style.borderWidth=0}C.style.left=`${100*(D[0]-P)/E}%`,C.style.top=`${100*(D[1]-M)/T}%`;let{rotation:L}=l;return l.hasOwnCanvas||0===L?(C.style.width=`${100*F/E}%`,C.style.height=`${100*I/T}%`):this.setRotation(L,C),C}setRotation(o,l=this.container){let u,A;let{pageWidth:S,pageHeight:C}=this.viewport.rawDims,{width:E,height:T}=O(this.data.rect);o%180==0?(u=100*E/S,A=100*T/C):(u=100*T/S,A=100*E/C),l.style.width=`${u}%`,l.style.height=`${A}%`,l.setAttribute("data-main-rotation",(360-o)%360)}get _commonActions(){let o=(o,l,u)=>{let A=u.detail[o];u.target.style[l]=E.ColorConverters[`${A[0]}_HTML`](A.slice(1))};return(0,A.shadow)(this,"_commonActions",{display:o=>{let l=o.detail.display%2==1;this.container.style.visibility=l?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{hidden:l,print:0===o.detail.display||3===o.detail.display})},print:o=>{this.annotationStorage.setValue(this.data.id,{print:o.detail.print})},hidden:o=>{this.container.style.visibility=o.detail.hidden?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{hidden:o.detail.hidden})},focus:o=>{setTimeout(()=>o.target.focus({preventScroll:!1}),0)},userName:o=>{o.target.title=o.detail.userName},readonly:o=>{o.detail.readonly?o.target.setAttribute("readonly",""):o.target.removeAttribute("readonly")},required:o=>{this._setRequired(o.target,o.detail.required)},bgColor:l=>{o("bgColor","backgroundColor",l)},fillColor:l=>{o("fillColor","backgroundColor",l)},fgColor:l=>{o("fgColor","color",l)},textColor:l=>{o("textColor","color",l)},borderColor:l=>{o("borderColor","borderColor",l)},strokeColor:l=>{o("strokeColor","borderColor",l)},rotation:o=>{let l=o.detail.rotation;this.setRotation(l),this.annotationStorage.setValue(this.data.id,{rotation:l})}})}_dispatchEventFromSandbox(o,l){let u=this._commonActions;for(let A of Object.keys(l.detail)){let S=o[A]||u[A];S?.(l)}}_setDefaultPropertiesFromJS(o){if(!this.enableScripting)return;let l=this.annotationStorage.getRawValue(this.data.id);if(!l)return;let u=this._commonActions;for(let[A,S]of Object.entries(l)){let C=u[A];C&&(C({detail:{[A]:S},target:o}),delete l[A])}}_createQuadrilaterals(o=!1){if(!this.data.quadPoints)return null;let l=[],u=this.data.rect;for(let u of this.data.quadPoints)this.data.rect=[u[2].x,u[2].y,u[1].x,u[1].y],l.push(this._createContainer(o));return this.data.rect=u,l}_createPopup(o,l){let u=this.container;this.quadrilaterals&&(o||=this.quadrilaterals,u=this.quadrilaterals[0]),o||((o=document.createElement("div")).classList.add("popupTriggerArea"),u.append(o));let A=new K({container:u,trigger:o,color:l.color,titleObj:l.titleObj,modificationDate:l.modificationDate,contentsObj:l.contentsObj,richText:l.richText,hideWrapper:!0}).render();A.style.left="100%",u.append(A)}_renderQuadrilaterals(o){for(let l of this.quadrilaterals)l.classList.add(o);return this.quadrilaterals}render(){(0,A.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(o,l=null){let u=[];if(this._fieldObjects){let S=this._fieldObjects[o];if(S)for(let{page:o,id:C,exportValues:E}of S){if(-1===o||C===l)continue;let S="string"==typeof E?E:null,T=document.querySelector(`[data-element-id="${C}"]`);if(T&&!F.has(T)){(0,A.warn)(`_getElementsByName - element not allowed: ${C}`);continue}u.push({id:C,exportValue:S,domElement:T})}return u}for(let A of document.getElementsByName(o)){let{exportValue:o}=A,S=A.getAttribute("data-element-id");S!==l&&F.has(A)&&u.push({id:S,exportValue:o,domElement:A})}return u}}class L extends D{constructor(o,l=null){super(o,{isRenderable:!0,ignoreBorder:!!l?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=o.data.isTooltipOnly}render(){let{data:o,linkService:l}=this,u=document.createElement("a");u.setAttribute("data-element-id",o.id);let A=!1;return(o.url?(l.addLinkAttributes(u,o.url,o.newWindow),A=!0):o.action?(this._bindNamedAction(u,o.action),A=!0):o.attachment?(this._bindAttachment(u,o.attachment),A=!0):o.setOCGState?(this.#eB(u,o.setOCGState),A=!0):o.dest?(this._bindLink(u,o.dest),A=!0):(o.actions&&(o.actions.Action||o.actions["Mouse Up"]||o.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(u,o),A=!0),o.resetForm?(this._bindResetFormAction(u,o.resetForm),A=!0):this.isTooltipOnly&&!A&&(this._bindLink(u,""),A=!0)),this.quadrilaterals)?this._renderQuadrilaterals("linkAnnotation").map((o,l)=>{let A=0===l?u:u.cloneNode();return o.append(A),o}):(this.container.classList.add("linkAnnotation"),A&&this.container.append(u),this.container)}#eU(){this.container.setAttribute("data-internal-link","")}_bindLink(o,l){o.href=this.linkService.getDestinationHash(l),o.onclick=()=>(l&&this.linkService.goToDestination(l),!1),(l||""===l)&&this.#eU()}_bindNamedAction(o,l){o.href=this.linkService.getAnchorUrl(""),o.onclick=()=>(this.linkService.executeNamedAction(l),!1),this.#eU()}_bindAttachment(o,l){o.href=this.linkService.getAnchorUrl(""),o.onclick=()=>(this.downloadManager?.openOrDownloadData(this.container,l.content,l.filename),!1),this.#eU()}#eB(o,l){o.href=this.linkService.getAnchorUrl(""),o.onclick=()=>(this.linkService.executeSetOCGState(l),!1),this.#eU()}_bindJSAction(o,l){o.href=this.linkService.getAnchorUrl("");let u=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(let A of Object.keys(l.actions)){let S=u.get(A);S&&(o[S]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:l.id,name:A}}),!1))}o.onclick||(o.onclick=()=>!1),this.#eU()}_bindResetFormAction(o,l){let u=o.onclick;if(u||(o.href=this.linkService.getAnchorUrl("")),this.#eU(),!this._fieldObjects){(0,A.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),u||(o.onclick=()=>!1);return}o.onclick=()=>{u?.();let{fields:o,refs:S,include:C}=l,E=[];if(0!==o.length||0!==S.length){let l=new Set(S);for(let u of o)for(let{id:o}of this._fieldObjects[u]||[])l.add(o);for(let o of Object.values(this._fieldObjects))for(let u of o)l.has(u.id)===C&&E.push(u)}else for(let o of Object.values(this._fieldObjects))E.push(...o);let T=this.annotationStorage,P=[];for(let o of E){let{id:l}=o;switch(P.push(l),o.type){case"text":{let u=o.defaultValue||"";T.setValue(l,{value:u});break}case"checkbox":case"radiobutton":{let u=o.defaultValue===o.exportValues;T.setValue(l,{value:u});break}case"combobox":case"listbox":{let u=o.defaultValue||"";T.setValue(l,{value:u});break}default:continue}let u=document.querySelector(`[data-element-id="${l}"]`);if(u){if(!F.has(u)){(0,A.warn)(`_bindResetFormAction - element not allowed: ${l}`);continue}u.dispatchEvent(new Event("resetform"))}}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:P,name:"ResetForm"}}),!1}}}class N extends D{constructor(o){super(o,{isRenderable:!!(o.data.hasPopup||o.data.titleObj?.str||o.data.contentsObj?.str||o.data.richText?.str)})}render(){this.container.classList.add("textAnnotation");let o=document.createElement("img");return o.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",o.alt="[{{type}} Annotation]",o.dataset.l10nId="text_annotation_type",o.dataset.l10nArgs=JSON.stringify({type:this.data.name}),this.data.hasPopup||this._createPopup(o,this.data),this.container.append(o),this.container}}class U extends D{render(){return this.data.alternativeText&&(this.container.title=this.data.alternativeText),this.container}showElementAndHideCanvas(o){this.data.hasOwnCanvas&&(o.previousSibling?.nodeName==="CANVAS"&&(o.previousSibling.hidden=!0),o.hidden=!1)}_getKeyModifier(o){let{isWin:l,isMac:u}=A.FeatureTest.platform;return l&&o.ctrlKey||u&&o.metaKey}_setEventListener(o,l,u,A){l.includes("mouse")?o.addEventListener(l,o=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:u,value:A(o),shift:o.shiftKey,modifier:this._getKeyModifier(o)}})}):o.addEventListener(l,o=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:u,value:A(o)}})})}_setEventListeners(o,l,u){for(let[A,S]of l)("Action"===S||this.data.actions?.[S])&&this._setEventListener(o,A,S,u)}_setBackgroundColor(o){let l=this.data.backgroundColor||null;o.style.backgroundColor=null===l?"transparent":A.Util.makeHexColor(l[0],l[1],l[2])}_setTextStyle(o){let l;let u=["left","center","right"],{fontColor:S}=this.data.defaultAppearanceData,C=this.data.defaultAppearanceData.fontSize||M,E=o.style,T=2,P=o=>Math.round(10*o)/10;if(this.data.multiLine){let o=Math.abs(this.data.rect[3]-this.data.rect[1]-T),u=Math.round(o/(A.LINE_FACTOR*C))||1;l=Math.min(C,P(o/u/A.LINE_FACTOR))}else l=Math.min(C,P(Math.abs(this.data.rect[3]-this.data.rect[1]-T)/A.LINE_FACTOR));E.fontSize=`calc(${l}px * var(--scale-factor))`,E.color=A.Util.makeHexColor(S[0],S[1],S[2]),null!==this.data.textAlignment&&(E.textAlign=u[this.data.textAlignment])}_setRequired(o,l){l?o.setAttribute("required",!0):o.removeAttribute("required"),o.setAttribute("aria-required",l)}}class H extends U{constructor(o){super(o,{isRenderable:o.renderForms||!o.data.hasAppearance&&!!o.data.fieldValue})}setPropertyOnSiblings(o,l,u,A){let S=this.annotationStorage;for(let C of this._getElementsByName(o.name,o.id))C.domElement&&(C.domElement[l]=u),S.setValue(C.id,{[A]:u})}render(){let o=this.annotationStorage,l=this.data.id;this.container.classList.add("textWidgetAnnotation");let u=null;if(this.renderForms){let A=o.getValue(l,{value:this.data.fieldValue}),S=A.value||"",C=o.getValue(l,{charLimit:this.data.maxLen}).charLimit;C&&S.length>C&&(S=S.slice(0,C));let E=A.formattedValue||this.data.textContent?.join("\n")||null;E&&this.data.comb&&(E=E.replaceAll(/\s+/g,""));let T={userValue:S,formattedValue:E,lastCommittedValue:null,commitKey:1};this.data.multiLine?((u=document.createElement("textarea")).textContent=E??S,this.data.doNotScroll&&(u.style.overflowY="hidden")):((u=document.createElement("input")).type="text",u.setAttribute("value",E??S),this.data.doNotScroll&&(u.style.overflowX="hidden")),this.data.hasOwnCanvas&&(u.hidden=!0),F.add(u),u.setAttribute("data-element-id",l),u.disabled=this.data.readOnly,u.name=this.data.fieldName,u.tabIndex=P,this._setRequired(u,this.data.required),C&&(u.maxLength=C),u.addEventListener("input",A=>{o.setValue(l,{value:A.target.value}),this.setPropertyOnSiblings(u,"value",A.target.value,"value"),T.formattedValue=null}),u.addEventListener("resetform",o=>{let l=this.data.defaultFieldValue??"";u.value=T.userValue=l,T.formattedValue=null});let M=o=>{let{formattedValue:l}=T;null!=l&&(o.target.value=l),o.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){u.addEventListener("focus",o=>{let{target:l}=o;T.userValue&&(l.value=T.userValue),T.lastCommittedValue=l.value,T.commitKey=1}),u.addEventListener("updatefromsandbox",u=>{this.showElementAndHideCanvas(u.target);let A={value(u){T.userValue=u.detail.value??"",o.setValue(l,{value:T.userValue.toString()}),u.target.value=T.userValue},formattedValue(u){let{formattedValue:A}=u.detail;T.formattedValue=A,null!=A&&u.target!==document.activeElement&&(u.target.value=A),o.setValue(l,{formattedValue:A})},selRange(o){o.target.setSelectionRange(...o.detail.selRange)},charLimit:u=>{let{charLimit:A}=u.detail,{target:S}=u;if(0===A){S.removeAttribute("maxLength");return}S.setAttribute("maxLength",A);let C=T.userValue;C&&!(C.length<=A)&&(C=C.slice(0,A),S.value=T.userValue=C,o.setValue(l,{value:C}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:l,name:"Keystroke",value:C,willCommit:!0,commitKey:1,selStart:S.selectionStart,selEnd:S.selectionEnd}}))}};this._dispatchEventFromSandbox(A,u)}),u.addEventListener("keydown",o=>{T.commitKey=1;let u=-1;if("Escape"===o.key?u=0:"Enter"!==o.key||this.data.multiLine?"Tab"===o.key&&(T.commitKey=3):u=2,-1===u)return;let{value:A}=o.target;T.lastCommittedValue!==A&&(T.lastCommittedValue=A,T.userValue=A,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:l,name:"Keystroke",value:A,willCommit:!0,commitKey:u,selStart:o.target.selectionStart,selEnd:o.target.selectionEnd}}))});let A=M;M=null,u.addEventListener("blur",o=>{if(!o.relatedTarget)return;let{value:u}=o.target;T.userValue=u,T.lastCommittedValue!==u&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:l,name:"Keystroke",value:u,willCommit:!0,commitKey:T.commitKey,selStart:o.target.selectionStart,selEnd:o.target.selectionEnd}}),A(o)}),this.data.actions?.Keystroke&&u.addEventListener("beforeinput",o=>{T.lastCommittedValue=null;let{data:u,target:A}=o,{value:S,selectionStart:C,selectionEnd:E}=A,P=C,M=E;switch(o.inputType){case"deleteWordBackward":{let o=S.substring(0,C).match(/\w*[^\w]*$/);o&&(P-=o[0].length);break}case"deleteWordForward":{let o=S.substring(C).match(/^[^\w]*\w*/);o&&(M+=o[0].length);break}case"deleteContentBackward":C===E&&(P-=1);break;case"deleteContentForward":C===E&&(M+=1)}o.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:l,name:"Keystroke",value:S,change:u||"",willCommit:!1,selStart:P,selEnd:M}})}),this._setEventListeners(u,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.value)}if(M&&u.addEventListener("blur",M),this.data.comb){let o=(this.data.rect[2]-this.data.rect[0])/C;u.classList.add("comb"),u.style.letterSpacing=`calc(${o}px * var(--scale-factor) - 1ch)`}}else(u=document.createElement("div")).textContent=this.data.fieldValue,u.style.verticalAlign="middle",u.style.display="table-cell";return this._setTextStyle(u),this._setBackgroundColor(u),this._setDefaultPropertiesFromJS(u),this.container.append(u),this.container}}class W extends U{constructor(o){super(o,{isRenderable:o.renderForms})}render(){let o=this.annotationStorage,l=this.data,u=l.id,A=o.getValue(u,{value:l.exportValue===l.fieldValue}).value;"string"==typeof A&&(A="Off"!==A,o.setValue(u,{value:A})),this.container.classList.add("buttonWidgetAnnotation","checkBox");let S=document.createElement("input");return F.add(S),S.setAttribute("data-element-id",u),S.disabled=l.readOnly,this._setRequired(S,this.data.required),S.type="checkbox",S.name=l.fieldName,A&&S.setAttribute("checked",!0),S.setAttribute("exportValue",l.exportValue),S.tabIndex=P,S.addEventListener("change",A=>{let{name:S,checked:C}=A.target;for(let A of this._getElementsByName(S,u)){let u=C&&A.exportValue===l.exportValue;A.domElement&&(A.domElement.checked=u),o.setValue(A.id,{value:u})}o.setValue(u,{value:C})}),S.addEventListener("resetform",o=>{let u=l.defaultFieldValue||"Off";o.target.checked=u===l.exportValue}),this.enableScripting&&this.hasJSActions&&(S.addEventListener("updatefromsandbox",l=>{let A={value(l){l.target.checked="Off"!==l.detail.value,o.setValue(u,{value:l.target.checked})}};this._dispatchEventFromSandbox(A,l)}),this._setEventListeners(S,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.checked)),this._setBackgroundColor(S),this._setDefaultPropertiesFromJS(S),this.container.append(S),this.container}}class z extends U{constructor(o){super(o,{isRenderable:o.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");let o=this.annotationStorage,l=this.data,u=l.id,A=o.getValue(u,{value:l.fieldValue===l.buttonValue}).value;"string"==typeof A&&(A=A!==l.buttonValue,o.setValue(u,{value:A}));let S=document.createElement("input");if(F.add(S),S.setAttribute("data-element-id",u),S.disabled=l.readOnly,this._setRequired(S,this.data.required),S.type="radio",S.name=l.fieldName,A&&S.setAttribute("checked",!0),S.tabIndex=P,S.addEventListener("change",l=>{let{name:A,checked:S}=l.target;for(let l of this._getElementsByName(A,u))o.setValue(l.id,{value:!1});o.setValue(u,{value:S})}),S.addEventListener("resetform",o=>{let u=l.defaultFieldValue;o.target.checked=null!=u&&u===l.buttonValue}),this.enableScripting&&this.hasJSActions){let A=l.buttonValue;S.addEventListener("updatefromsandbox",l=>{let S={value:l=>{let S=A===l.detail.value;for(let A of this._getElementsByName(l.target.name)){let l=S&&A.id===u;A.domElement&&(A.domElement.checked=l),o.setValue(A.id,{value:l})}}};this._dispatchEventFromSandbox(S,l)}),this._setEventListeners(S,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],o=>o.target.checked)}return this._setBackgroundColor(S),this._setDefaultPropertiesFromJS(S),this.container.append(S),this.container}}class V extends L{constructor(o){super(o,{ignoreBorder:o.data.hasAppearance})}render(){let o=super.render();o.classList.add("buttonWidgetAnnotation","pushButton"),this.data.alternativeText&&(o.title=this.data.alternativeText);let l=o.lastChild;return this.enableScripting&&this.hasJSActions&&l&&(this._setDefaultPropertiesFromJS(l),l.addEventListener("updatefromsandbox",o=>{this._dispatchEventFromSandbox({},o)})),o}}class $ extends U{constructor(o){super(o,{isRenderable:o.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");let o=this.annotationStorage,l=this.data.id,u=o.getValue(l,{value:this.data.fieldValue}),A=document.createElement("select");F.add(A),A.setAttribute("data-element-id",l),A.disabled=this.data.readOnly,this._setRequired(A,this.data.required),A.name=this.data.fieldName,A.tabIndex=P;let S=this.data.combo&&this.data.options.length>0;for(let o of(!this.data.combo&&(A.size=this.data.options.length,this.data.multiSelect&&(A.multiple=!0)),A.addEventListener("resetform",o=>{let l=this.data.defaultFieldValue;for(let o of A.options)o.selected=o.value===l}),this.data.options)){let l=document.createElement("option");l.textContent=o.displayValue,l.value=o.exportValue,u.value.includes(o.exportValue)&&(l.setAttribute("selected",!0),S=!1),A.append(l)}let C=null;if(S){let o=document.createElement("option");o.value=" ",o.setAttribute("hidden",!0),o.setAttribute("selected",!0),A.prepend(o),C=()=>{o.remove(),A.removeEventListener("input",C),C=null},A.addEventListener("input",C)}let E=o=>{let l=o?"value":"textContent",{options:u,multiple:S}=A;return S?Array.prototype.filter.call(u,o=>o.selected).map(o=>o[l]):-1===u.selectedIndex?null:u[u.selectedIndex][l]},T=E(!1),M=o=>{let l=o.target.options;return Array.prototype.map.call(l,o=>({displayValue:o.textContent,exportValue:o.value}))};return this.enableScripting&&this.hasJSActions?(A.addEventListener("updatefromsandbox",u=>{let S={value(u){C?.();let S=u.detail.value,P=new Set(Array.isArray(S)?S:[S]);for(let o of A.options)o.selected=P.has(o.value);o.setValue(l,{value:E(!0)}),T=E(!1)},multipleSelection(o){A.multiple=!0},remove(u){let S=A.options,C=u.detail.remove;S[C].selected=!1,A.remove(C),S.length>0&&-1===Array.prototype.findIndex.call(S,o=>o.selected)&&(S[0].selected=!0),o.setValue(l,{value:E(!0),items:M(u)}),T=E(!1)},clear(u){for(;0!==A.length;)A.remove(0);o.setValue(l,{value:null,items:[]}),T=E(!1)},insert(u){let{index:S,displayValue:C,exportValue:P}=u.detail.insert,F=A.children[S],O=document.createElement("option");O.textContent=C,O.value=P,F?F.before(O):A.append(O),o.setValue(l,{value:E(!0),items:M(u)}),T=E(!1)},items(u){let{items:S}=u.detail;for(;0!==A.length;)A.remove(0);for(let o of S){let{displayValue:l,exportValue:u}=o,S=document.createElement("option");S.textContent=l,S.value=u,A.append(S)}A.options.length>0&&(A.options[0].selected=!0),o.setValue(l,{value:E(!0),items:M(u)}),T=E(!1)},indices(u){let A=new Set(u.detail.indices);for(let o of u.target.options)o.selected=A.has(o.index);o.setValue(l,{value:E(!0)}),T=E(!1)},editable(o){o.target.disabled=!o.detail.editable}};this._dispatchEventFromSandbox(S,u)}),A.addEventListener("input",u=>{let A=E(!0);o.setValue(l,{value:A}),u.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:l,name:"Keystroke",value:T,changeEx:A,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(A,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],o=>o.target.value)):A.addEventListener("input",function(u){o.setValue(l,{value:E(!0)})}),this.data.combo&&this._setTextStyle(A),this._setBackgroundColor(A),this._setDefaultPropertiesFromJS(A),this.container.append(A),this.container}}class X extends D{static IGNORE_TYPES=new Set(["Line","Square","Circle","PolyLine","Polygon","Ink"]);constructor(o){let{data:l}=o;super(o,{isRenderable:!X.IGNORE_TYPES.has(l.parentType)&&!!(l.titleObj?.str||l.contentsObj?.str||l.richText?.str)})}render(){this.container.classList.add("popupAnnotation");let o=this.layer.querySelectorAll(`[data-annotation-id="${this.data.parentId}"]`);if(0===o.length)return this.container;let l=new K({container:this.container,trigger:Array.from(o),color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText}),u=this.page,S=A.Util.normalizeRect([this.data.parentRect[0],u.view[3]-this.data.parentRect[1]+u.view[1],this.data.parentRect[2],u.view[3]-this.data.parentRect[3]+u.view[1]]),C=S[0]+this.data.parentRect[2]-this.data.parentRect[0],E=S[1],{pageWidth:T,pageHeight:P,pageX:M,pageY:F}=this.viewport.rawDims;return this.container.style.left=`${100*(C-M)/T}%`,this.container.style.top=`${100*(E-F)/P}%`,this.container.append(l.render()),this.container}}class K{constructor(o){this.container=o.container,this.trigger=o.trigger,this.color=o.color,this.titleObj=o.titleObj,this.modificationDate=o.modificationDate,this.contentsObj=o.contentsObj,this.richText=o.richText,this.hideWrapper=o.hideWrapper||!1,this.pinned=!1}render(){let o=.7,l=document.createElement("div");l.classList.add("popupWrapper"),this.hideElement=this.hideWrapper?l:this.container,this.hideElement.hidden=!0;let u=document.createElement("div");u.classList.add("popup");let C=this.color;if(C){let l=o*(255-C[0])+C[0],S=o*(255-C[1])+C[1],E=o*(255-C[2])+C[2];u.style.backgroundColor=A.Util.makeHexColor(0|l,0|S,0|E)}let E=document.createElement("h1");E.dir=this.titleObj.dir,E.textContent=this.titleObj.str,u.append(E);let P=S.PDFDateString.toDateObject(this.modificationDate);if(P){let o=document.createElement("span");o.classList.add("popupDate"),o.textContent="{{date}}, {{time}}",o.dataset.l10nId="annotation_date_string",o.dataset.l10nArgs=JSON.stringify({date:P.toLocaleDateString(),time:P.toLocaleTimeString()}),u.append(o)}if(this.richText?.str&&(!this.contentsObj?.str||this.contentsObj.str===this.richText.str))T.XfaLayer.render({xfaHtml:this.richText.html,intent:"richText",div:u}),u.lastChild.classList.add("richText","popupContent");else{let o=this._formatContents(this.contentsObj);u.append(o)}for(let o of(Array.isArray(this.trigger)||(this.trigger=[this.trigger]),this.trigger))o.addEventListener("click",this._toggle.bind(this)),o.addEventListener("mouseover",this._show.bind(this,!1)),o.addEventListener("mouseout",this._hide.bind(this,!1));return u.addEventListener("click",this._hide.bind(this,!0)),l.append(u),l}_formatContents({str:o,dir:l}){let u=document.createElement("p");u.classList.add("popupContent"),u.dir=l;let A=o.split(/(?:\r\n?|\n)/);for(let o=0,l=A.length;o<l;++o){let S=A[o];u.append(document.createTextNode(S)),o<l-1&&u.append(document.createElement("br"))}return u}_toggle(){this.pinned?this._hide(!0):this._show(!0)}_show(o=!1){o&&(this.pinned=!0),this.hideElement.hidden&&(this.hideElement.hidden=!1,this.container.style.zIndex=parseInt(this.container.style.zIndex)+1e3)}_hide(o=!0){o&&(this.pinned=!1),this.hideElement.hidden||this.pinned||(this.hideElement.hidden=!0,this.container.style.zIndex=parseInt(this.container.style.zIndex)-1e3)}}class Y extends D{constructor(o){super(o,{isRenderable:!!(o.data.hasPopup||o.data.titleObj?.str||o.data.contentsObj?.str||o.data.richText?.str),ignoreBorder:!0}),this.textContent=o.data.textContent}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){let o=document.createElement("div");for(let l of(o.classList.add("annotationTextContent"),o.setAttribute("role","comment"),this.textContent)){let u=document.createElement("span");u.textContent=l,o.append(u)}this.container.append(o)}return this.data.hasPopup||this._createPopup(null,this.data),this.container}}class J extends D{constructor(o){super(o,{isRenderable:!!(o.data.hasPopup||o.data.titleObj?.str||o.data.contentsObj?.str||o.data.richText?.str),ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");let o=this.data,{width:l,height:u}=O(o.rect),A=this.svgFactory.create(l,u,!0),S=this.svgFactory.createElement("svg:line");return S.setAttribute("x1",o.rect[2]-o.lineCoordinates[0]),S.setAttribute("y1",o.rect[3]-o.lineCoordinates[1]),S.setAttribute("x2",o.rect[2]-o.lineCoordinates[2]),S.setAttribute("y2",o.rect[3]-o.lineCoordinates[3]),S.setAttribute("stroke-width",o.borderStyle.width||1),S.setAttribute("stroke","transparent"),S.setAttribute("fill","transparent"),A.append(S),this.container.append(A),this._createPopup(S,o),this.container}}class Q extends D{constructor(o){super(o,{isRenderable:!!(o.data.hasPopup||o.data.titleObj?.str||o.data.contentsObj?.str||o.data.richText?.str),ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");let o=this.data,{width:l,height:u}=O(o.rect),A=this.svgFactory.create(l,u,!0),S=o.borderStyle.width,C=this.svgFactory.createElement("svg:rect");return C.setAttribute("x",S/2),C.setAttribute("y",S/2),C.setAttribute("width",l-S),C.setAttribute("height",u-S),C.setAttribute("stroke-width",S||1),C.setAttribute("stroke","transparent"),C.setAttribute("fill","transparent"),A.append(C),this.container.append(A),this._createPopup(C,o),this.container}}class Z extends D{constructor(o){super(o,{isRenderable:!!(o.data.hasPopup||o.data.titleObj?.str||o.data.contentsObj?.str||o.data.richText?.str),ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");let o=this.data,{width:l,height:u}=O(o.rect),A=this.svgFactory.create(l,u,!0),S=o.borderStyle.width,C=this.svgFactory.createElement("svg:ellipse");return C.setAttribute("cx",l/2),C.setAttribute("cy",u/2),C.setAttribute("rx",l/2-S/2),C.setAttribute("ry",u/2-S/2),C.setAttribute("stroke-width",S||1),C.setAttribute("stroke","transparent"),C.setAttribute("fill","transparent"),A.append(C),this.container.append(A),this._createPopup(C,o),this.container}}class tt extends D{constructor(o){super(o,{isRenderable:!!(o.data.hasPopup||o.data.titleObj?.str||o.data.contentsObj?.str||o.data.richText?.str),ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);let o=this.data,{width:l,height:u}=O(o.rect),A=this.svgFactory.create(l,u,!0),S=[];for(let l of o.vertices){let u=l.x-o.rect[0],A=o.rect[3]-l.y;S.push(u+","+A)}S=S.join(" ");let C=this.svgFactory.createElement(this.svgElementName);return C.setAttribute("points",S),C.setAttribute("stroke-width",o.borderStyle.width||1),C.setAttribute("stroke","transparent"),C.setAttribute("fill","transparent"),A.append(C),this.container.append(A),this._createPopup(C,o),this.container}}class te extends tt{constructor(o){super(o),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class ti extends D{constructor(o){super(o,{isRenderable:!!(o.data.hasPopup||o.data.titleObj?.str||o.data.contentsObj?.str||o.data.richText?.str),ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),this.data.hasPopup||this._createPopup(null,this.data),this.container}}class ts extends D{constructor(o){super(o,{isRenderable:!!(o.data.hasPopup||o.data.titleObj?.str||o.data.contentsObj?.str||o.data.richText?.str),ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);let o=this.data,{width:l,height:u}=O(o.rect),A=this.svgFactory.create(l,u,!0);for(let l of o.inkLists){let u=[];for(let A of l){let l=A.x-o.rect[0],S=o.rect[3]-A.y;u.push(`${l},${S}`)}u=u.join(" ");let S=this.svgFactory.createElement(this.svgElementName);S.setAttribute("points",u),S.setAttribute("stroke-width",o.borderStyle.width||1),S.setAttribute("stroke","transparent"),S.setAttribute("fill","transparent"),this._createPopup(S,o),A.append(S)}return this.container.append(A),this.container}}class tr extends D{constructor(o){super(o,{isRenderable:!!(o.data.hasPopup||o.data.titleObj?.str||o.data.contentsObj?.str||o.data.richText?.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){return(this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals)?this._renderQuadrilaterals("highlightAnnotation"):(this.container.classList.add("highlightAnnotation"),this.container)}}class ta extends D{constructor(o){super(o,{isRenderable:!!(o.data.hasPopup||o.data.titleObj?.str||o.data.contentsObj?.str||o.data.richText?.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){return(this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals)?this._renderQuadrilaterals("underlineAnnotation"):(this.container.classList.add("underlineAnnotation"),this.container)}}class tn extends D{constructor(o){super(o,{isRenderable:!!(o.data.hasPopup||o.data.titleObj?.str||o.data.contentsObj?.str||o.data.richText?.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){return(this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals)?this._renderQuadrilaterals("squigglyAnnotation"):(this.container.classList.add("squigglyAnnotation"),this.container)}}class to extends D{constructor(o){super(o,{isRenderable:!!(o.data.hasPopup||o.data.titleObj?.str||o.data.contentsObj?.str||o.data.richText?.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){return(this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals)?this._renderQuadrilaterals("strikeoutAnnotation"):(this.container.classList.add("strikeoutAnnotation"),this.container)}}class tl extends D{constructor(o){super(o,{isRenderable:!!(o.data.hasPopup||o.data.titleObj?.str||o.data.contentsObj?.str||o.data.richText?.str),ignoreBorder:!0})}render(){return this.container.classList.add("stampAnnotation"),this.data.hasPopup||this._createPopup(null,this.data),this.container}}class th extends D{constructor(o){super(o,{isRenderable:!0});let{filename:l,content:u}=this.data.file;this.filename=(0,S.getFilenameFromUrl)(l,!0),this.content=u,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,filename:l,content:u})}render(){let o;return this.container.classList.add("fileAttachmentAnnotation"),this.data.hasAppearance?o=document.createElement("div"):(o=document.createElement("img")).src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(this.data.name)?"paperclip":"pushpin"}.svg`,o.classList.add("popupTriggerArea"),o.addEventListener("dblclick",this._download.bind(this)),!this.data.hasPopup&&(this.data.titleObj?.str||this.data.contentsObj?.str||this.data.richText)&&this._createPopup(o,this.data),this.container.append(o),this.container}_download(){this.downloadManager?.openOrDownloadData(this.container,this.content,this.filename)}}class td{static #eG(o,l,u,A){let C=o.firstChild||o;C.id=`${S.AnnotationPrefix}${l}`,u.append(o),A?.moveElementInDOM(u,o,C,!1)}static render(o){let{annotations:l,div:u,viewport:E,accessibilityManager:T}=o;(0,S.setLayerDimensions)(u,E);let P={data:null,layer:u,page:o.page,viewport:E,linkService:o.linkService,downloadManager:o.downloadManager,imageResourcesPath:o.imageResourcesPath||"",renderForms:!1!==o.renderForms,svgFactory:new S.DOMSVGFactory,annotationStorage:o.annotationStorage||new C.AnnotationStorage,enableScripting:!0===o.enableScripting,hasJSActions:o.hasJSActions,fieldObjects:o.fieldObjects},M=0;for(let o of l){if(o.noHTML)continue;if(o.annotationType!==A.AnnotationType.POPUP){let{width:l,height:u}=O(o.rect);if(l<=0||u<=0)continue}P.data=o;let l=I.create(P);if(!l.isRenderable)continue;let S=l.render();if(o.hidden&&(S.style.visibility="hidden"),Array.isArray(S))for(let l of S)l.style.zIndex=M++,td.#eG(l,o.id,u,T);else S.style.zIndex=M++,l instanceof X?u.prepend(S):td.#eG(S,o.id,u,T)}this.#eH(u,o.annotationCanvasMap)}static update(o){let{annotationCanvasMap:l,div:u,viewport:A}=o;(0,S.setLayerDimensions)(u,{rotation:A.rotation}),this.#eH(u,l),u.hidden=!1}static #eH(o,l){if(l){for(let[u,A]of l){let l=o.querySelector(`[data-annotation-id="${u}"]`);if(!l)continue;let{firstChild:S}=l;S?"CANVAS"===S.nodeName?S.replaceWith(A):S.before(A):l.append(A)}l.clear()}}}l.AnnotationLayer=td},(o,l)=>{function u(o){return Math.floor(255*Math.max(0,Math.min(1,o))).toString(16).padStart(2,"0")}Object.defineProperty(l,"__esModule",{value:!0}),l.ColorConverters=void 0;class A{static CMYK_G([o,l,u,A]){return["G",1-Math.min(1,.3*o+.59*u+.11*l+A)]}static G_CMYK([o]){return["CMYK",0,0,0,1-o]}static G_RGB([o]){return["RGB",o,o,o]}static G_HTML([o]){let l=u(o);return`#${l}${l}${l}`}static RGB_G([o,l,u]){return["G",.3*o+.59*l+.11*u]}static RGB_HTML([o,l,A]){let S=u(o),C=u(l),E=u(A);return`#${S}${C}${E}`}static T_HTML(){return"#00000000"}static CMYK_RGB([o,l,u,A]){return["RGB",1-Math.min(1,o+A),1-Math.min(1,u+A),1-Math.min(1,l+A)]}static CMYK_HTML(o){let l=this.CMYK_RGB(o).slice(1);return this.RGB_HTML(l)}static RGB_CMYK([o,l,u]){let A=1-o,S=1-l,C=1-u,E=Math.min(A,S,C);return["CMYK",A,S,C,E]}}l.ColorConverters=A},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.XfaLayer=void 0;var A=u(19);class S{static setupStorage(o,l,u,A,S){let C=A.getValue(l,{value:null});switch(u.name){case"textarea":if(null!==C.value&&(o.textContent=C.value),"print"===S)break;o.addEventListener("input",o=>{A.setValue(l,{value:o.target.value})});break;case"input":if("radio"===u.attributes.type||"checkbox"===u.attributes.type){if(C.value===u.attributes.xfaOn?o.setAttribute("checked",!0):C.value===u.attributes.xfaOff&&o.removeAttribute("checked"),"print"===S)break;o.addEventListener("change",o=>{A.setValue(l,{value:o.target.checked?o.target.getAttribute("xfaOn"):o.target.getAttribute("xfaOff")})})}else{if(null!==C.value&&o.setAttribute("value",C.value),"print"===S)break;o.addEventListener("input",o=>{A.setValue(l,{value:o.target.value})})}break;case"select":if(null!==C.value)for(let o of u.children)o.attributes.value===C.value&&(o.attributes.selected=!0);o.addEventListener("input",o=>{let u=o.target.options,S=-1===u.selectedIndex?"":u[u.selectedIndex].value;A.setValue(l,{value:S})})}}static setAttributes({html:o,element:l,storage:u=null,intent:A,linkService:S}){let{attributes:C}=l,E=o instanceof HTMLAnchorElement;for(let[l,u]of("radio"===C.type&&(C.name=`${C.name}-${A}`),Object.entries(C)))if(null!=u)switch(l){case"class":u.length&&o.setAttribute(l,u.join(" "));break;case"dataId":break;case"id":o.setAttribute("data-element-id",u);break;case"style":Object.assign(o.style,u);break;case"textContent":o.textContent=u;break;default:E&&("href"===l||"newWindow"===l)||o.setAttribute(l,u)}E&&S.addLinkAttributes(o,C.href,C.newWindow),u&&C.dataId&&this.setupStorage(o,C.dataId,l,u)}static render(o){let l=o.annotationStorage,u=o.linkService,S=o.xfaHtml,C=o.intent||"display",E=document.createElement(S.name);S.attributes&&this.setAttributes({html:E,element:S,intent:C,linkService:u});let T=[[S,-1,E]],P=o.div;if(P.append(E),o.viewport){let l=`matrix(${o.viewport.transform.join(",")})`;P.style.transform=l}"richText"!==C&&P.setAttribute("class","xfaLayer xfaFont");let M=[];for(;T.length>0;){let o;let[S,E,P]=T.at(-1);if(E+1===S.children.length){T.pop();continue}let F=S.children[++T.at(-1)[1]];if(null===F)continue;let{name:O}=F;if("#text"===O){let o=document.createTextNode(F.value);M.push(o),P.append(o);continue}if(o=F?.attributes?.xmlns?document.createElementNS(F.attributes.xmlns,O):document.createElement(O),P.append(o),F.attributes&&this.setAttributes({html:o,element:F,storage:l,intent:C,linkService:u}),F.children&&F.children.length>0)T.push([F,-1,o]);else if(F.value){let l=document.createTextNode(F.value);A.XfaText.shouldBuildText(O)&&M.push(l),o.append(l)}}for(let o of P.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))o.setAttribute("readOnly",!0);return{textDivs:M}}static update(o){let l=`matrix(${o.viewport.transform.join(",")})`;o.div.style.transform=l,o.div.hidden=!1}}l.XfaLayer=S},(o,l,u)=>{Object.defineProperty(l,"__esModule",{value:!0}),l.SVGGraphics=void 0;var A=u(6),S=u(1),C=u(10);let E=class{constructor(){(0,S.unreachable)("Not implemented: SVGGraphics")}};l.SVGGraphics=E;{let o={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},u="http://www.w3.org/XML/1998/namespace",F="http://www.w3.org/1999/xlink",O=["butt","round","square"],I=["miter","round","bevel"],D=function(o,l="",u=!1){if(URL.createObjectURL&&"undefined"!=typeof Blob&&!u)return URL.createObjectURL(new Blob([o],{type:l}));let A="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",S=`data:${l};base64,`;for(let l=0,u=o.length;l<u;l+=3){let C=255&o[l],E=255&o[l+1],T=255&o[l+2],P=C>>2,M=(3&C)<<4|E>>4,F=l+1<u?(15&E)<<2|T>>6:64,O=l+2<u?63&T:64;S+=A[P]+A[M]+A[F]+A[O]}return S},L=function(){let o=new Uint8Array([137,80,78,71,13,10,26,10]),l=12,u=new Int32Array(256);for(let o=0;o<256;o++){let l=o;for(let o=0;o<8;o++)l=1&l?3988292384^l>>1&2147483647:l>>1&2147483647;u[o]=l}function A(o,l,A){let S=-1;for(let C=l;C<A;C++){let l=u[(S^o[C])&255];S=S>>>8^l}return -1^S}function E(o,l,u,S){let C=S,E=l.length;u[C]=E>>24&255,u[C+1]=E>>16&255,u[C+2]=E>>8&255,u[C+3]=255&E,u[C+=4]=255&o.charCodeAt(0),u[C+1]=255&o.charCodeAt(1),u[C+2]=255&o.charCodeAt(2),u[C+3]=255&o.charCodeAt(3),C+=4,u.set(l,C);let T=A(u,S+4,C+=l.length);u[C]=T>>24&255,u[C+1]=T>>16&255,u[C+2]=T>>8&255,u[C+3]=255&T}function T(o,l,u){let A=1,S=0;for(let C=l;C<u;++C)S=(S+(A=(A+(255&o[C]))%65521))%65521;return S<<16|A}function P(o){if(!C.isNodeJS)return M(o);try{let l;l=parseInt(process.versions.node)>=8?o:Buffer.from(o);let u=__webpack_require__(82258).deflateSync(l,{level:9});return u instanceof Uint8Array?u:new Uint8Array(u)}catch(o){(0,S.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+o)}return M(o)}function M(o){let l=o.length,u=65535,A=Math.ceil(l/65535),S=new Uint8Array(2+l+5*A+4),C=0;S[C++]=120,S[C++]=156;let E=0;for(;l>u;)S[C++]=0,S[C++]=255,S[C++]=255,S[C++]=0,S[C++]=0,S.set(o.subarray(E,E+u),C),C+=u,E+=u,l-=u;S[C++]=1,S[C++]=255&l,S[C++]=l>>8&255,S[C++]=255&~l,S[C++]=(65535&~l)>>8&255,S.set(o.subarray(E),C),C+=o.length-E;let P=T(o,0,o.length);return S[C++]=P>>24&255,S[C++]=P>>16&255,S[C++]=P>>8&255,S[C++]=255&P,S}function F(u,A,C,T){let M,F,O;let I=u.width,L=u.height,N=u.data;switch(A){case S.ImageKind.GRAYSCALE_1BPP:F=0,M=1,O=I+7>>3;break;case S.ImageKind.RGB_24BPP:F=2,M=8,O=3*I;break;case S.ImageKind.RGBA_32BPP:F=6,M=8,O=4*I;break;default:throw Error("invalid format")}let U=new Uint8Array((1+O)*L),H=0,W=0;for(let o=0;o<L;++o)U[H++]=0,U.set(N.subarray(W,W+O),H),W+=O,H+=O;if(A===S.ImageKind.GRAYSCALE_1BPP&&T){H=0;for(let o=0;o<L;o++){H++;for(let o=0;o<O;o++)U[H++]^=255}}let z=new Uint8Array([I>>24&255,I>>16&255,I>>8&255,255&I,L>>24&255,L>>16&255,L>>8&255,255&L,M,F,0,0,0]),V=P(U),$=o.length+3*l+z.length+V.length,X=new Uint8Array($),K=0;return X.set(o,K),E("IHDR",z,X,K+=o.length),E("IDATA",V,X,K+=l+z.length),K+=l+V.length,E("IEND",new Uint8Array(0),X,K),D(X,"image/png",C)}return function(o,l,u){let A=void 0===o.kind?S.ImageKind.GRAYSCALE_1BPP:o.kind;return F(o,A,l,u)}}();class N{constructor(){this.fontSizeScale=1,this.fontWeight=o.fontWeight,this.fontSize=0,this.textMatrix=S.IDENTITY_MATRIX,this.fontMatrix=S.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=S.TextRenderingMode.FILL,this.textMatrixScale=1,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRise=0,this.fillColor=o.fillColor,this.strokeColor="#000000",this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.lineJoin="",this.lineCap="",this.miterLimit=0,this.dashArray=[],this.dashPhase=0,this.dependencies=[],this.activeClipUrl=null,this.clipGroup=null,this.maskId=""}clone(){return Object.create(this)}setCurrentPoint(o,l){this.x=o,this.y=l}}function T(o){let l=[],u=[];for(let A of o){if("save"===A.fn){l.push({fnId:92,fn:"group",items:[]}),u.push(l),l=l.at(-1).items;continue}"restore"===A.fn?l=u.pop():l.push(A)}return l}function P(o){if(Number.isInteger(o))return o.toString();let l=o.toFixed(10),u=l.length-1;if("0"!==l[u])return l;do u--;while("0"===l[u]);return l.substring(0,"."===l[u]?u:u+1)}function M(o){if(0===o[4]&&0===o[5]){if(0===o[1]&&0===o[2])return 1===o[0]&&1===o[3]?"":`scale(${P(o[0])} ${P(o[3])})`;if(o[0]===o[3]&&o[1]===-o[2]){let l=180*Math.acos(o[0])/Math.PI;return`rotate(${P(l)})`}}else if(1===o[0]&&0===o[1]&&0===o[2]&&1===o[3])return`translate(${P(o[4])} ${P(o[5])})`;return`matrix(${P(o[0])} ${P(o[1])} ${P(o[2])} ${P(o[3])} ${P(o[4])} ${P(o[5])})`}let U=0,H=0,W=0;l.SVGGraphics=E=class{constructor(o,l,u=!1){for(let C in(0,A.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future."),this.svgFactory=new A.DOMSVGFactory,this.current=new N,this.transformMatrix=S.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=o,this.objs=l,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!u,this._operatorIdMapping=[],S.OPS)this._operatorIdMapping[S.OPS[C]]=C}getObject(o,l=null){return"string"==typeof o?o.startsWith("g_")?this.commonObjs.get(o):this.objs.get(o):l}save(){this.transformStack.push(this.transformMatrix);let o=this.current;this.extraStack.push(o),this.current=o.clone()}restore(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}group(o){this.save(),this.executeOpTree(o),this.restore()}loadDependencies(o){let l=o.fnArray,u=o.argsArray;for(let o=0,A=l.length;o<A;o++)if(l[o]===S.OPS.dependency)for(let l of u[o]){let o=l.startsWith("g_")?this.commonObjs:this.objs,u=new Promise(u=>{o.get(l,u)});this.current.dependencies.push(u)}return Promise.all(this.current.dependencies)}transform(o,l,u,A,C,E){let T=[o,l,u,A,C,E];this.transformMatrix=S.Util.transform(this.transformMatrix,T),this.tgrp=null}getSVG(o,l){this.viewport=l;let u=this._initialize(l);return this.loadDependencies(o).then(()=>(this.transformMatrix=S.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(o)),u))}convertOpList(o){let l=this._operatorIdMapping,u=o.argsArray,A=o.fnArray,S=[];for(let o=0,C=A.length;o<C;o++){let C=A[o];S.push({fnId:C,fn:l[C],args:u[o]})}return T(S)}executeOpTree(o){for(let l of o){let o=l.fn,u=l.fnId,A=l.args;switch(0|u){case S.OPS.beginText:this.beginText();break;case S.OPS.dependency:break;case S.OPS.setLeading:this.setLeading(A);break;case S.OPS.setLeadingMoveText:this.setLeadingMoveText(A[0],A[1]);break;case S.OPS.setFont:this.setFont(A);break;case S.OPS.showText:case S.OPS.showSpacedText:this.showText(A[0]);break;case S.OPS.endText:this.endText();break;case S.OPS.moveText:this.moveText(A[0],A[1]);break;case S.OPS.setCharSpacing:this.setCharSpacing(A[0]);break;case S.OPS.setWordSpacing:this.setWordSpacing(A[0]);break;case S.OPS.setHScale:this.setHScale(A[0]);break;case S.OPS.setTextMatrix:this.setTextMatrix(A[0],A[1],A[2],A[3],A[4],A[5]);break;case S.OPS.setTextRise:this.setTextRise(A[0]);break;case S.OPS.setTextRenderingMode:this.setTextRenderingMode(A[0]);break;case S.OPS.setLineWidth:this.setLineWidth(A[0]);break;case S.OPS.setLineJoin:this.setLineJoin(A[0]);break;case S.OPS.setLineCap:this.setLineCap(A[0]);break;case S.OPS.setMiterLimit:this.setMiterLimit(A[0]);break;case S.OPS.setFillRGBColor:this.setFillRGBColor(A[0],A[1],A[2]);break;case S.OPS.setStrokeRGBColor:this.setStrokeRGBColor(A[0],A[1],A[2]);break;case S.OPS.setStrokeColorN:this.setStrokeColorN(A);break;case S.OPS.setFillColorN:this.setFillColorN(A);break;case S.OPS.shadingFill:this.shadingFill(A[0]);break;case S.OPS.setDash:this.setDash(A[0],A[1]);break;case S.OPS.setRenderingIntent:this.setRenderingIntent(A[0]);break;case S.OPS.setFlatness:this.setFlatness(A[0]);break;case S.OPS.setGState:this.setGState(A[0]);break;case S.OPS.fill:this.fill();break;case S.OPS.eoFill:this.eoFill();break;case S.OPS.stroke:this.stroke();break;case S.OPS.fillStroke:this.fillStroke();break;case S.OPS.eoFillStroke:this.eoFillStroke();break;case S.OPS.clip:this.clip("nonzero");break;case S.OPS.eoClip:this.clip("evenodd");break;case S.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case S.OPS.paintImageXObject:this.paintImageXObject(A[0]);break;case S.OPS.paintInlineImageXObject:this.paintInlineImageXObject(A[0]);break;case S.OPS.paintImageMaskXObject:this.paintImageMaskXObject(A[0]);break;case S.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(A[0],A[1]);break;case S.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case S.OPS.closePath:this.closePath();break;case S.OPS.closeStroke:this.closeStroke();break;case S.OPS.closeFillStroke:this.closeFillStroke();break;case S.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case S.OPS.nextLine:this.nextLine();break;case S.OPS.transform:this.transform(A[0],A[1],A[2],A[3],A[4],A[5]);break;case S.OPS.constructPath:this.constructPath(A[0],A[1]);break;case S.OPS.endPath:this.endPath();break;case 92:this.group(l.items);break;default:(0,S.warn)(`Unimplemented operator ${o}`)}}}setWordSpacing(o){this.current.wordSpacing=o}setCharSpacing(o){this.current.charSpacing=o}nextLine(){this.moveText(0,this.current.leading)}setTextMatrix(o,l,u,A,S,C){let E=this.current;E.textMatrix=E.lineMatrix=[o,l,u,A,S,C],E.textMatrixScale=Math.hypot(o,l),E.x=E.lineX=0,E.y=E.lineY=0,E.xcoords=[],E.ycoords=[],E.tspan=this.svgFactory.createElement("svg:tspan"),E.tspan.setAttributeNS(null,"font-family",E.fontFamily),E.tspan.setAttributeNS(null,"font-size",`${P(E.fontSize)}px`),E.tspan.setAttributeNS(null,"y",P(-E.y)),E.txtElement=this.svgFactory.createElement("svg:text"),E.txtElement.append(E.tspan)}beginText(){let o=this.current;o.x=o.lineX=0,o.y=o.lineY=0,o.textMatrix=S.IDENTITY_MATRIX,o.lineMatrix=S.IDENTITY_MATRIX,o.textMatrixScale=1,o.tspan=this.svgFactory.createElement("svg:tspan"),o.txtElement=this.svgFactory.createElement("svg:text"),o.txtgrp=this.svgFactory.createElement("svg:g"),o.xcoords=[],o.ycoords=[]}moveText(o,l){let u=this.current;u.x=u.lineX+=o,u.y=u.lineY+=l,u.xcoords=[],u.ycoords=[],u.tspan=this.svgFactory.createElement("svg:tspan"),u.tspan.setAttributeNS(null,"font-family",u.fontFamily),u.tspan.setAttributeNS(null,"font-size",`${P(u.fontSize)}px`),u.tspan.setAttributeNS(null,"y",P(-u.y))}showText(l){let A=this.current,C=A.font,E=A.fontSize;if(0===E)return;let T=A.fontSizeScale,F=A.charSpacing,O=A.wordSpacing,I=A.fontDirection,D=A.textHScale*I,L=C.vertical,N=L?1:-1,U=C.defaultVMetrics,H=E*A.fontMatrix[0],W=0;for(let o of l){let l,u,S;if(null===o){W+=I*O;continue}if("number"==typeof o){W+=N*o*E/1e3;continue}let P=(o.isSpace?O:0)+F,M=o.fontChar,D=o.width;if(L){let A;let S=o.vmetric||U;A=-(A=o.vmetric?S[1]:.5*D)*H;let C=S[2]*H;D=S?-S[0]:D,l=A/T,u=(W+C)/T}else l=W/T,u=0;(o.isInFont||C.missingFile)&&(A.xcoords.push(A.x+l),L&&A.ycoords.push(-A.y+u),A.tspan.textContent+=M),W+=S=L?D*H-P*I:D*H+P*I}A.tspan.setAttributeNS(null,"x",A.xcoords.map(P).join(" ")),L?A.tspan.setAttributeNS(null,"y",A.ycoords.map(P).join(" ")):A.tspan.setAttributeNS(null,"y",P(-A.y)),L?A.y-=W:A.x+=W*D,A.tspan.setAttributeNS(null,"font-family",A.fontFamily),A.tspan.setAttributeNS(null,"font-size",`${P(A.fontSize)}px`),A.fontStyle!==o.fontStyle&&A.tspan.setAttributeNS(null,"font-style",A.fontStyle),A.fontWeight!==o.fontWeight&&A.tspan.setAttributeNS(null,"font-weight",A.fontWeight);let z=A.textRenderingMode&S.TextRenderingMode.FILL_STROKE_MASK;if(z===S.TextRenderingMode.FILL||z===S.TextRenderingMode.FILL_STROKE?(A.fillColor!==o.fillColor&&A.tspan.setAttributeNS(null,"fill",A.fillColor),A.fillAlpha<1&&A.tspan.setAttributeNS(null,"fill-opacity",A.fillAlpha)):A.textRenderingMode===S.TextRenderingMode.ADD_TO_PATH?A.tspan.setAttributeNS(null,"fill","transparent"):A.tspan.setAttributeNS(null,"fill","none"),z===S.TextRenderingMode.STROKE||z===S.TextRenderingMode.FILL_STROKE){let o=1/(A.textMatrixScale||1);this._setStrokeAttributes(A.tspan,o)}let V=A.textMatrix;0!==A.textRise&&(V=V.slice(),V[5]+=A.textRise),A.txtElement.setAttributeNS(null,"transform",`${M(V)} scale(${P(D)}, -1)`),A.txtElement.setAttributeNS(u,"xml:space","preserve"),A.txtElement.append(A.tspan),A.txtgrp.append(A.txtElement),this._ensureTransformGroup().append(A.txtElement)}setLeadingMoveText(o,l){this.setLeading(-l),this.moveText(o,l)}addFontStyle(o){if(!o.data)throw Error('addFontStyle: No font data available, ensure that the "fontExtraProperties" API parameter is set.');this.cssStyle||(this.cssStyle=this.svgFactory.createElement("svg:style"),this.cssStyle.setAttributeNS(null,"type","text/css"),this.defs.append(this.cssStyle));let l=D(o.data,o.mimetype,this.forceDataSchema);this.cssStyle.textContent+=`@font-face { font-family: "${o.loadedName}"; src: url(${l}); }
|
||
`}setFont(o){let l=this.current,u=this.commonObjs.get(o[0]),A=o[1];l.font=u,!this.embedFonts||u.missingFile||this.embeddedFonts[u.loadedName]||(this.addFontStyle(u),this.embeddedFonts[u.loadedName]=u),l.fontMatrix=u.fontMatrix||S.FONT_IDENTITY_MATRIX;let C="normal";u.black?C="900":u.bold&&(C="bold");let E=u.italic?"italic":"normal";A<0?(A=-A,l.fontDirection=-1):l.fontDirection=1,l.fontSize=A,l.fontFamily=u.loadedName,l.fontWeight=C,l.fontStyle=E,l.tspan=this.svgFactory.createElement("svg:tspan"),l.tspan.setAttributeNS(null,"y",P(-l.y)),l.xcoords=[],l.ycoords=[]}endText(){let o=this.current;o.textRenderingMode&S.TextRenderingMode.ADD_TO_PATH_FLAG&&o.txtElement?.hasChildNodes()&&(o.element=o.txtElement,this.clip("nonzero"),this.endPath())}setLineWidth(o){o>0&&(this.current.lineWidth=o)}setLineCap(o){this.current.lineCap=O[o]}setLineJoin(o){this.current.lineJoin=I[o]}setMiterLimit(o){this.current.miterLimit=o}setStrokeAlpha(o){this.current.strokeAlpha=o}setStrokeRGBColor(o,l,u){this.current.strokeColor=S.Util.makeHexColor(o,l,u)}setFillAlpha(o){this.current.fillAlpha=o}setFillRGBColor(o,l,u){this.current.fillColor=S.Util.makeHexColor(o,l,u),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(o){this.current.strokeColor=this._makeColorN_Pattern(o)}setFillColorN(o){this.current.fillColor=this._makeColorN_Pattern(o)}shadingFill(o){let l=this.viewport.width,u=this.viewport.height,A=S.Util.inverseTransform(this.transformMatrix),C=S.Util.applyTransform([0,0],A),E=S.Util.applyTransform([0,u],A),T=S.Util.applyTransform([l,0],A),P=S.Util.applyTransform([l,u],A),M=Math.min(C[0],E[0],T[0],P[0]),F=Math.min(C[1],E[1],T[1],P[1]),O=Math.max(C[0],E[0],T[0],P[0]),I=Math.max(C[1],E[1],T[1],P[1]),D=this.svgFactory.createElement("svg:rect");D.setAttributeNS(null,"x",M),D.setAttributeNS(null,"y",F),D.setAttributeNS(null,"width",O-M),D.setAttributeNS(null,"height",I-F),D.setAttributeNS(null,"fill",this._makeShadingPattern(o)),this.current.fillAlpha<1&&D.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(D)}_makeColorN_Pattern(o){return"TilingPattern"===o[0]?this._makeTilingPattern(o):this._makeShadingPattern(o)}_makeTilingPattern(o){let l=o[1],u=o[2],A=o[3]||S.IDENTITY_MATRIX,[C,E,T,P]=o[4],M=o[5],F=o[6],O=o[7],I=`shading${W++}`,[D,L,N,U]=S.Util.normalizeRect([...S.Util.applyTransform([C,E],A),...S.Util.applyTransform([T,P],A)]),[H,z]=S.Util.singularValueDecompose2dScale(A),V=M*H,$=F*z,X=this.svgFactory.createElement("svg:pattern");X.setAttributeNS(null,"id",I),X.setAttributeNS(null,"patternUnits","userSpaceOnUse"),X.setAttributeNS(null,"width",V),X.setAttributeNS(null,"height",$),X.setAttributeNS(null,"x",`${D}`),X.setAttributeNS(null,"y",`${L}`);let K=this.svg,Y=this.transformMatrix,J=this.current.fillColor,Q=this.current.strokeColor,Z=this.svgFactory.create(N-D,U-L);if(this.svg=Z,this.transformMatrix=A,2===O){let o=S.Util.makeHexColor(...l);this.current.fillColor=o,this.current.strokeColor=o}return this.executeOpTree(this.convertOpList(u)),this.svg=K,this.transformMatrix=Y,this.current.fillColor=J,this.current.strokeColor=Q,X.append(Z.childNodes[0]),this.defs.append(X),`url(#${I})`}_makeShadingPattern(o){switch("string"==typeof o&&(o=this.objs.get(o)),o[0]){case"RadialAxial":let l;let u=`shading${W++}`,A=o[3];switch(o[1]){case"axial":let C=o[4],E=o[5];(l=this.svgFactory.createElement("svg:linearGradient")).setAttributeNS(null,"id",u),l.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),l.setAttributeNS(null,"x1",C[0]),l.setAttributeNS(null,"y1",C[1]),l.setAttributeNS(null,"x2",E[0]),l.setAttributeNS(null,"y2",E[1]);break;case"radial":let T=o[4],P=o[5],M=o[6],F=o[7];(l=this.svgFactory.createElement("svg:radialGradient")).setAttributeNS(null,"id",u),l.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),l.setAttributeNS(null,"cx",P[0]),l.setAttributeNS(null,"cy",P[1]),l.setAttributeNS(null,"r",F),l.setAttributeNS(null,"fx",T[0]),l.setAttributeNS(null,"fy",T[1]),l.setAttributeNS(null,"fr",M);break;default:throw Error(`Unknown RadialAxial type: ${o[1]}`)}for(let o of A){let u=this.svgFactory.createElement("svg:stop");u.setAttributeNS(null,"offset",o[0]),u.setAttributeNS(null,"stop-color",o[1]),l.append(u)}return this.defs.append(l),`url(#${u})`;case"Mesh":return(0,S.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw Error(`Unknown IR type: ${o[0]}`)}}setDash(o,l){this.current.dashArray=o,this.current.dashPhase=l}constructPath(o,l){let u=this.current,A=u.x,C=u.y,E=[],T=0;for(let u of o)switch(0|u){case S.OPS.rectangle:A=l[T++],C=l[T++];let o=l[T++],M=l[T++],F=A+o,O=C+M;E.push("M",P(A),P(C),"L",P(F),P(C),"L",P(F),P(O),"L",P(A),P(O),"Z");break;case S.OPS.moveTo:A=l[T++],C=l[T++],E.push("M",P(A),P(C));break;case S.OPS.lineTo:A=l[T++],C=l[T++],E.push("L",P(A),P(C));break;case S.OPS.curveTo:A=l[T+4],C=l[T+5],E.push("C",P(l[T]),P(l[T+1]),P(l[T+2]),P(l[T+3]),P(A),P(C)),T+=6;break;case S.OPS.curveTo2:E.push("C",P(A),P(C),P(l[T]),P(l[T+1]),P(l[T+2]),P(l[T+3])),A=l[T+2],C=l[T+3],T+=4;break;case S.OPS.curveTo3:A=l[T+2],C=l[T+3],E.push("C",P(l[T]),P(l[T+1]),P(A),P(C),P(A),P(C)),T+=4;break;case S.OPS.closePath:E.push("Z")}E=E.join(" "),u.path&&o.length>0&&o[0]!==S.OPS.rectangle&&o[0]!==S.OPS.moveTo?E=u.path.getAttributeNS(null,"d")+E:(u.path=this.svgFactory.createElement("svg:path"),this._ensureTransformGroup().append(u.path)),u.path.setAttributeNS(null,"d",E),u.path.setAttributeNS(null,"fill","none"),u.element=u.path,u.setCurrentPoint(A,C)}endPath(){let o=this.current;if(o.path=null,!this.pendingClip)return;if(!o.element){this.pendingClip=null;return}let l=`clippath${U++}`,u=this.svgFactory.createElement("svg:clipPath");u.setAttributeNS(null,"id",l),u.setAttributeNS(null,"transform",M(this.transformMatrix));let A=o.element.cloneNode(!0);if("evenodd"===this.pendingClip?A.setAttributeNS(null,"clip-rule","evenodd"):A.setAttributeNS(null,"clip-rule","nonzero"),this.pendingClip=null,u.append(A),this.defs.append(u),o.activeClipUrl){for(let l of(o.clipGroup=null,this.extraStack))l.clipGroup=null;u.setAttributeNS(null,"clip-path",o.activeClipUrl)}o.activeClipUrl=`url(#${l})`,this.tgrp=null}clip(o){this.pendingClip=o}closePath(){let o=this.current;if(o.path){let l=`${o.path.getAttributeNS(null,"d")}Z`;o.path.setAttributeNS(null,"d",l)}}setLeading(o){this.current.leading=-o}setTextRise(o){this.current.textRise=o}setTextRenderingMode(o){this.current.textRenderingMode=o}setHScale(o){this.current.textHScale=o/100}setRenderingIntent(o){}setFlatness(o){}setGState(o){for(let[l,u]of o)switch(l){case"LW":this.setLineWidth(u);break;case"LC":this.setLineCap(u);break;case"LJ":this.setLineJoin(u);break;case"ML":this.setMiterLimit(u);break;case"D":this.setDash(u[0],u[1]);break;case"RI":this.setRenderingIntent(u);break;case"FL":this.setFlatness(u);break;case"Font":this.setFont(u);break;case"CA":this.setStrokeAlpha(u);break;case"ca":this.setFillAlpha(u);break;default:(0,S.warn)(`Unimplemented graphic state operator ${l}`)}}fill(){let o=this.current;o.element&&(o.element.setAttributeNS(null,"fill",o.fillColor),o.element.setAttributeNS(null,"fill-opacity",o.fillAlpha),this.endPath())}stroke(){let o=this.current;o.element&&(this._setStrokeAttributes(o.element),o.element.setAttributeNS(null,"fill","none"),this.endPath())}_setStrokeAttributes(o,l=1){let u=this.current,A=u.dashArray;1!==l&&A.length>0&&(A=A.map(function(o){return l*o})),o.setAttributeNS(null,"stroke",u.strokeColor),o.setAttributeNS(null,"stroke-opacity",u.strokeAlpha),o.setAttributeNS(null,"stroke-miterlimit",P(u.miterLimit)),o.setAttributeNS(null,"stroke-linecap",u.lineCap),o.setAttributeNS(null,"stroke-linejoin",u.lineJoin),o.setAttributeNS(null,"stroke-width",P(l*u.lineWidth)+"px"),o.setAttributeNS(null,"stroke-dasharray",A.map(P).join(" ")),o.setAttributeNS(null,"stroke-dashoffset",P(l*u.dashPhase)+"px")}eoFill(){this.current.element?.setAttributeNS(null,"fill-rule","evenodd"),this.fill()}fillStroke(){this.stroke(),this.fill()}eoFillStroke(){this.current.element?.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()}closeStroke(){this.closePath(),this.stroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.closePath(),this.eoFillStroke()}paintSolidColorImageMask(){let o=this.svgFactory.createElement("svg:rect");o.setAttributeNS(null,"x","0"),o.setAttributeNS(null,"y","0"),o.setAttributeNS(null,"width","1px"),o.setAttributeNS(null,"height","1px"),o.setAttributeNS(null,"fill",this.current.fillColor),this._ensureTransformGroup().append(o)}paintImageXObject(o){let l=this.getObject(o);if(!l){(0,S.warn)(`Dependent image with object ID ${o} is not ready yet`);return}this.paintInlineImageXObject(l)}paintInlineImageXObject(o,l){let u=o.width,A=o.height,S=L(o,this.forceDataSchema,!!l),C=this.svgFactory.createElement("svg:rect");C.setAttributeNS(null,"x","0"),C.setAttributeNS(null,"y","0"),C.setAttributeNS(null,"width",P(u)),C.setAttributeNS(null,"height",P(A)),this.current.element=C,this.clip("nonzero");let E=this.svgFactory.createElement("svg:image");E.setAttributeNS(F,"xlink:href",S),E.setAttributeNS(null,"x","0"),E.setAttributeNS(null,"y",P(-A)),E.setAttributeNS(null,"width",P(u)+"px"),E.setAttributeNS(null,"height",P(A)+"px"),E.setAttributeNS(null,"transform",`scale(${P(1/u)} ${P(-1/A)})`),l?l.append(E):this._ensureTransformGroup().append(E)}paintImageMaskXObject(o){let l=this.getObject(o.data,o);if(l.bitmap){(0,S.warn)("paintImageMaskXObject: ImageBitmap support is not implemented, ensure that the `isOffscreenCanvasSupported` API parameter is disabled.");return}let u=this.current,A=l.width,C=l.height,E=u.fillColor;u.maskId=`mask${H++}`;let T=this.svgFactory.createElement("svg:mask");T.setAttributeNS(null,"id",u.maskId);let M=this.svgFactory.createElement("svg:rect");M.setAttributeNS(null,"x","0"),M.setAttributeNS(null,"y","0"),M.setAttributeNS(null,"width",P(A)),M.setAttributeNS(null,"height",P(C)),M.setAttributeNS(null,"fill",E),M.setAttributeNS(null,"mask",`url(#${u.maskId})`),this.defs.append(T),this._ensureTransformGroup().append(M),this.paintInlineImageXObject(l,T)}paintFormXObjectBegin(o,l){if(Array.isArray(o)&&6===o.length&&this.transform(o[0],o[1],o[2],o[3],o[4],o[5]),l){let o=l[2]-l[0],u=l[3]-l[1],A=this.svgFactory.createElement("svg:rect");A.setAttributeNS(null,"x",l[0]),A.setAttributeNS(null,"y",l[1]),A.setAttributeNS(null,"width",P(o)),A.setAttributeNS(null,"height",P(u)),this.current.element=A,this.clip("nonzero"),this.endPath()}}paintFormXObjectEnd(){}_initialize(o){let l=this.svgFactory.create(o.width,o.height),u=this.svgFactory.createElement("svg:defs");l.append(u),this.defs=u;let A=this.svgFactory.createElement("svg:g");return A.setAttributeNS(null,"transform",M(o.transform)),l.append(A),this.svg=A,l}_ensureClipGroup(){if(!this.current.clipGroup){let o=this.svgFactory.createElement("svg:g");o.setAttributeNS(null,"clip-path",this.current.activeClipUrl),this.svg.append(o),this.current.clipGroup=o}return this.current.clipGroup}_ensureTransformGroup(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",M(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}}}}],__webpack_module_cache__={};function __w_pdfjs_require__(o){var l=__webpack_module_cache__[o];if(void 0!==l)return l.exports;var u=__webpack_module_cache__[o]={exports:{}};return __webpack_modules__[o](u,u.exports,__w_pdfjs_require__),u.exports}var __nested_webpack_exports__={};return(()=>{var o=__nested_webpack_exports__;Object.defineProperty(o,"__esModule",{value:!0}),Object.defineProperty(o,"AbortException",{enumerable:!0,get:function(){return l.AbortException}}),Object.defineProperty(o,"AnnotationEditorLayer",{enumerable:!0,get:function(){return C.AnnotationEditorLayer}}),Object.defineProperty(o,"AnnotationEditorParamsType",{enumerable:!0,get:function(){return l.AnnotationEditorParamsType}}),Object.defineProperty(o,"AnnotationEditorType",{enumerable:!0,get:function(){return l.AnnotationEditorType}}),Object.defineProperty(o,"AnnotationEditorUIManager",{enumerable:!0,get:function(){return E.AnnotationEditorUIManager}}),Object.defineProperty(o,"AnnotationLayer",{enumerable:!0,get:function(){return T.AnnotationLayer}}),Object.defineProperty(o,"AnnotationMode",{enumerable:!0,get:function(){return l.AnnotationMode}}),Object.defineProperty(o,"CMapCompressionType",{enumerable:!0,get:function(){return l.CMapCompressionType}}),Object.defineProperty(o,"FeatureTest",{enumerable:!0,get:function(){return l.FeatureTest}}),Object.defineProperty(o,"GlobalWorkerOptions",{enumerable:!0,get:function(){return P.GlobalWorkerOptions}}),Object.defineProperty(o,"InvalidPDFException",{enumerable:!0,get:function(){return l.InvalidPDFException}}),Object.defineProperty(o,"MissingPDFException",{enumerable:!0,get:function(){return l.MissingPDFException}}),Object.defineProperty(o,"OPS",{enumerable:!0,get:function(){return l.OPS}}),Object.defineProperty(o,"PDFDataRangeTransport",{enumerable:!0,get:function(){return u.PDFDataRangeTransport}}),Object.defineProperty(o,"PDFDateString",{enumerable:!0,get:function(){return A.PDFDateString}}),Object.defineProperty(o,"PDFWorker",{enumerable:!0,get:function(){return u.PDFWorker}}),Object.defineProperty(o,"PasswordResponses",{enumerable:!0,get:function(){return l.PasswordResponses}}),Object.defineProperty(o,"PermissionFlag",{enumerable:!0,get:function(){return l.PermissionFlag}}),Object.defineProperty(o,"PixelsPerInch",{enumerable:!0,get:function(){return A.PixelsPerInch}}),Object.defineProperty(o,"PromiseCapability",{enumerable:!0,get:function(){return l.PromiseCapability}}),Object.defineProperty(o,"RenderingCancelledException",{enumerable:!0,get:function(){return A.RenderingCancelledException}}),Object.defineProperty(o,"SVGGraphics",{enumerable:!0,get:function(){return M.SVGGraphics}}),Object.defineProperty(o,"UnexpectedResponseException",{enumerable:!0,get:function(){return l.UnexpectedResponseException}}),Object.defineProperty(o,"Util",{enumerable:!0,get:function(){return l.Util}}),Object.defineProperty(o,"VerbosityLevel",{enumerable:!0,get:function(){return l.VerbosityLevel}}),Object.defineProperty(o,"XfaLayer",{enumerable:!0,get:function(){return F.XfaLayer}}),Object.defineProperty(o,"build",{enumerable:!0,get:function(){return u.build}}),Object.defineProperty(o,"createValidAbsoluteUrl",{enumerable:!0,get:function(){return l.createValidAbsoluteUrl}}),Object.defineProperty(o,"getDocument",{enumerable:!0,get:function(){return u.getDocument}}),Object.defineProperty(o,"getFilenameFromUrl",{enumerable:!0,get:function(){return A.getFilenameFromUrl}}),Object.defineProperty(o,"getPdfFilenameFromUrl",{enumerable:!0,get:function(){return A.getPdfFilenameFromUrl}}),Object.defineProperty(o,"getXfaPageViewport",{enumerable:!0,get:function(){return A.getXfaPageViewport}}),Object.defineProperty(o,"isDataScheme",{enumerable:!0,get:function(){return A.isDataScheme}}),Object.defineProperty(o,"isPdfFile",{enumerable:!0,get:function(){return A.isPdfFile}}),Object.defineProperty(o,"loadScript",{enumerable:!0,get:function(){return A.loadScript}}),Object.defineProperty(o,"normalizeUnicode",{enumerable:!0,get:function(){return l.normalizeUnicode}}),Object.defineProperty(o,"renderTextLayer",{enumerable:!0,get:function(){return S.renderTextLayer}}),Object.defineProperty(o,"setLayerDimensions",{enumerable:!0,get:function(){return A.setLayerDimensions}}),Object.defineProperty(o,"shadow",{enumerable:!0,get:function(){return l.shadow}}),Object.defineProperty(o,"updateTextLayer",{enumerable:!0,get:function(){return S.updateTextLayer}}),Object.defineProperty(o,"version",{enumerable:!0,get:function(){return u.version}});var l=__w_pdfjs_require__(1),u=__w_pdfjs_require__(2),A=__w_pdfjs_require__(6),S=__w_pdfjs_require__(26),C=__w_pdfjs_require__(27),E=__w_pdfjs_require__(5),T=__w_pdfjs_require__(30),P=__w_pdfjs_require__(14),M=__w_pdfjs_require__(33),F=__w_pdfjs_require__(32)})(),__nested_webpack_exports__})())}}]); |