@gientech/modual 1.8.6 → 1.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,449 +0,0 @@
1
- var Xn=Object.defineProperty;var Sn=m=>{throw TypeError(m)};var Gn=(m,a,A)=>a in m?Xn(m,a,{enumerable:!0,configurable:!0,writable:!0,value:A}):m[a]=A;var ee=(m,a,A)=>Gn(m,typeof a!="symbol"?a+"":a,A),an=(m,a,A)=>a.has(m)||Sn("Cannot "+A);var R=(m,a,A)=>(an(m,a,"read from private field"),A?A.call(m):a.get(m)),Ot=(m,a,A)=>a.has(m)?Sn("Cannot add the same private member more than once"):a instanceof WeakSet?a.add(m):a.set(m,A),It=(m,a,A,f)=>(an(m,a,"write to private field"),f?f.call(m,A):a.set(m,A),A),Dt=(m,a,A)=>(an(m,a,"access private method"),A);var on=(m,a,A,f)=>({set _(_){It(m,a,_,A)},get _(){return R(m,a,f)}});import{jsxs,jsx,Fragment}from"react/jsx-runtime";import React__default,{forwardRef,createElement,useState,useRef,useEffect,useCallback,useMemo}from"react";import{a as createLucideIcon,Z as getAugmentedNamespace,d as dt$1,b as axios}from"./index-BbHMAb8g.js";import{H as Hv,l as la}from"./index-BbpyNfEd.js";import{C as ChevronRight}from"./index-fhKUis2J.js";import{X}from"./x-BjRa5XLp.js";/**
2
- * @license lucide-react v0.456.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const ChevronLeft=createLucideIcon("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
7
- * @license lucide-react v0.456.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const Download=createLucideIcon("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
12
- * @license lucide-react v0.456.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const Pencil=createLucideIcon("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
17
- * @license lucide-react v0.456.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const RotateCcw=createLucideIcon("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
22
- * @license lucide-react v0.456.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */const RotateCw=createLucideIcon("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
27
- * @license lucide-react v0.456.0 - ISC
28
- *
29
- * This source code is licensed under the ISC license.
30
- * See the LICENSE file in the root directory of this source tree.
31
- */const ZoomIn=createLucideIcon("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/**
32
- * @license lucide-react v0.456.0 - ISC
33
- *
34
- * This source code is licensed under the ISC license.
35
- * See the LICENSE file in the root directory of this source tree.
36
- */const ZoomOut=createLucideIcon("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);function commonjsRequire(m){throw new Error('Could not dynamically require "'+m+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var pdf={exports:{}};const __viteBrowserExternal={},__viteBrowserExternal$1=Object.freeze(Object.defineProperty({__proto__:null,default:__viteBrowserExternal},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(__viteBrowserExternal$1);var hasRequiredPdf;function requirePdf(){return hasRequiredPdf||(hasRequiredPdf=1,(function(module,exports){(function(a,A){module.exports=A()})(globalThis,()=>(()=>{var __webpack_modules__=[,((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.VerbosityLevel=a.Util=a.UnknownErrorException=a.UnexpectedResponseException=a.UNSUPPORTED_FEATURES=a.TextRenderingMode=a.StreamType=a.RenderingIntentFlag=a.PermissionFlag=a.PasswordResponses=a.PasswordException=a.PageActionEventType=a.OPS=a.MissingPDFException=a.LINE_FACTOR=a.LINE_DESCENT_FACTOR=a.InvalidPDFException=a.ImageKind=a.IDENTITY_MATRIX=a.FormatError=a.FontType=a.FeatureTest=a.FONT_IDENTITY_MATRIX=a.DocumentActionEventType=a.CMapCompressionType=a.BaseException=a.AnnotationType=a.AnnotationStateModelType=a.AnnotationReviewState=a.AnnotationReplyType=a.AnnotationMode=a.AnnotationMarkedState=a.AnnotationFlag=a.AnnotationFieldFlag=a.AnnotationEditorType=a.AnnotationEditorPrefix=a.AnnotationEditorParamsType=a.AnnotationBorderStyleType=a.AnnotationActionEventType=a.AbortException=void 0,a.arrayByteLength=L,a.arraysToBytes=_t,a.assert=h,a.bytesToString=D,a.createPromiseCapability=de,a.createValidAbsoluteUrl=T,a.escapeString=Gt,a.getModificationDate=ce,a.getVerbosityLevel=Q,a.info=xt,a.isArrayBuffer=Jt,a.isArrayEqual=oe,a.isAscii=Zt,a.objectFromMap=At,a.objectSize=Z,a.setVerbosityLevel=G,a.shadow=O,a.string32=z,a.stringToBytes=p,a.stringToPDFString=zt,a.stringToUTF16BEString=Xt,a.stringToUTF8String=Vt,a.unreachable=H,a.utf8StringToString=Yt,a.warn=Rt,A(2);const f=[1,0,0,1,0,0];a.IDENTITY_MATRIX=f;const _=[.001,0,0,.001,0,0];a.FONT_IDENTITY_MATRIX=_;const V=1.35;a.LINE_FACTOR=V;const q=.35;a.LINE_DESCENT_FACTOR=q;const Y={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};a.RenderingIntentFlag=Y;const M={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};a.AnnotationMode=M;const b="pdfjs_internal_editor_";a.AnnotationEditorPrefix=b;const w={DISABLE:-1,NONE:0,FREETEXT:3,INK:15};a.AnnotationEditorType=w;const P={FREETEXT_SIZE:1,FREETEXT_COLOR:2,FREETEXT_OPACITY:3,INK_COLOR:11,INK_THICKNESS:12,INK_OPACITY:13};a.AnnotationEditorParamsType=P;const S={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};a.PermissionFlag=S;const F={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};a.TextRenderingMode=F;const l={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};a.ImageKind=l;const t={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};a.AnnotationType=t;const r={MARKED:"Marked",REVIEW:"Review"};a.AnnotationStateModelType=r;const o={MARKED:"Marked",UNMARKED:"Unmarked"};a.AnnotationMarkedState=o;const v={ACCEPTED:"Accepted",REJECTED:"Rejected",CANCELLED:"Cancelled",COMPLETED:"Completed",NONE:"None"};a.AnnotationReviewState=v;const g={GROUP:"Group",REPLY:"R"};a.AnnotationReplyType=g;const u={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};a.AnnotationFlag=u;const n={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};a.AnnotationFieldFlag=n;const i={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};a.AnnotationBorderStyleType=i;const e={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"};a.AnnotationActionEventType=e;const E={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};a.DocumentActionEventType=E;const x={O:"PageOpen",C:"PageClose"};a.PageActionEventType=x;const j={UNKNOWN:"UNKNOWN",FLATE:"FLATE",LZW:"LZW",DCT:"DCT",JPX:"JPX",JBIG:"JBIG",A85:"A85",AHX:"AHX",CCF:"CCF",RLX:"RLX"};a.StreamType=j;const I={UNKNOWN:"UNKNOWN",TYPE1:"TYPE1",TYPE1STANDARD:"TYPE1STANDARD",TYPE1C:"TYPE1C",CIDFONTTYPE0:"CIDFONTTYPE0",CIDFONTTYPE0C:"CIDFONTTYPE0C",TRUETYPE:"TRUETYPE",CIDFONTTYPE2:"CIDFONTTYPE2",TYPE3:"TYPE3",OPENTYPE:"OPENTYPE",TYPE0:"TYPE0",MMTYPE1:"MMTYPE1"};a.FontType=I;const yt={ERRORS:0,WARNINGS:1,INFOS:5};a.VerbosityLevel=yt;const wt={NONE:0,BINARY:1,STREAM:2};a.CMapCompressionType=wt;const bt={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,beginAnnotations:78,endAnnotations:79,beginAnnotation:80,endAnnotation:81,paintJpegXObject:82,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91};a.OPS=bt;const K={unknown:"unknown",forms:"forms",javaScript:"javaScript",signatures:"signatures",smask:"smask",shadingPattern:"shadingPattern",font:"font",errorTilingPattern:"errorTilingPattern",errorExtGState:"errorExtGState",errorXObject:"errorXObject",errorFontLoadType3:"errorFontLoadType3",errorFontState:"errorFontState",errorFontMissing:"errorFontMissing",errorFontTranslate:"errorFontTranslate",errorColorSpace:"errorColorSpace",errorOperatorList:"errorOperatorList",errorFontToUnicode:"errorFontToUnicode",errorFontLoadNative:"errorFontLoadNative",errorFontBuildPath:"errorFontBuildPath",errorFontGetPath:"errorFontGetPath",errorMarkedContent:"errorMarkedContent",errorContentSubStream:"errorContentSubStream"};a.UNSUPPORTED_FEATURES=K;const B={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};a.PasswordResponses=B;let U=yt.WARNINGS;function G(Pt){Number.isInteger(Pt)&&(U=Pt)}function Q(){return U}function xt(Pt){U>=yt.INFOS&&console.log(`Info: ${Pt}`)}function Rt(Pt){U>=yt.WARNINGS&&console.log(`Warning: ${Pt}`)}function H(Pt){throw new Error(Pt)}function h(Pt,J){Pt||H(J)}function c(Pt){if(!Pt)return!1;switch(Pt.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function T(Pt,J=null,pt=null){if(!Pt)return null;try{if(pt&&typeof Pt=="string"){if(pt.addDefaultProtocol&&Pt.startsWith("www.")){const qt=Pt.match(/\./g);qt&&qt.length>=2&&(Pt=`http://${Pt}`)}if(pt.tryConvertEncoding)try{Pt=Vt(Pt)}catch{}}const Lt=J?new URL(Pt,J):new URL(Pt);if(c(Lt))return Lt}catch{}return null}function O(Pt,J,pt){return Object.defineProperty(Pt,J,{value:pt,enumerable:!0,configurable:!0,writable:!1}),pt}const $=(function(){function J(pt,Lt){this.constructor===J&&H("Cannot initialize BaseException."),this.message=pt,this.name=Lt}return J.prototype=new Error,J.constructor=J,J})();a.BaseException=$;class W extends ${constructor(J,pt){super(J,"PasswordException"),this.code=pt}}a.PasswordException=W;class s extends ${constructor(J,pt){super(J,"UnknownErrorException"),this.details=pt}}a.UnknownErrorException=s;class d extends ${constructor(J){super(J,"InvalidPDFException")}}a.InvalidPDFException=d;class C extends ${constructor(J){super(J,"MissingPDFException")}}a.MissingPDFException=C;class y extends ${constructor(J,pt){super(J,"UnexpectedResponseException"),this.status=pt}}a.UnexpectedResponseException=y;class k extends ${constructor(J){super(J,"FormatError")}}a.FormatError=k;class N extends ${constructor(J){super(J,"AbortException")}}a.AbortException=N;function D(Pt){(typeof Pt!="object"||Pt===null||Pt.length===void 0)&&H("Invalid argument for bytesToString");const J=Pt.length,pt=8192;if(J<pt)return String.fromCharCode.apply(null,Pt);const Lt=[];for(let qt=0;qt<J;qt+=pt){const Ct=Math.min(qt+pt,J),Tt=Pt.subarray(qt,Ct);Lt.push(String.fromCharCode.apply(null,Tt))}return Lt.join("")}function p(Pt){typeof Pt!="string"&&H("Invalid argument for stringToBytes");const J=Pt.length,pt=new Uint8Array(J);for(let Lt=0;Lt<J;++Lt)pt[Lt]=Pt.charCodeAt(Lt)&255;return pt}function L(Pt){if(Pt.length!==void 0)return Pt.length;if(Pt.byteLength!==void 0)return Pt.byteLength;H("Invalid argument for arrayByteLength")}function _t(Pt){const J=Pt.length;if(J===1&&Pt[0]instanceof Uint8Array)return Pt[0];let pt=0;for(let Ct=0;Ct<J;Ct++)pt+=L(Pt[Ct]);let Lt=0;const qt=new Uint8Array(pt);for(let Ct=0;Ct<J;Ct++){let Tt=Pt[Ct];Tt instanceof Uint8Array||(typeof Tt=="string"?Tt=p(Tt):Tt=new Uint8Array(Tt));const $t=Tt.byteLength;qt.set(Tt,Lt),Lt+=$t}return qt}function z(Pt){return String.fromCharCode(Pt>>24&255,Pt>>16&255,Pt>>8&255,Pt&255)}function Z(Pt){return Object.keys(Pt).length}function At(Pt){const J=Object.create(null);for(const[pt,Lt]of Pt)J[pt]=Lt;return J}function kt(){const Pt=new Uint8Array(4);return Pt[0]=1,new Uint32Array(Pt.buffer,0,1)[0]===1}function Mt(){try{return new Function(""),!0}catch{return!1}}class St{static get isLittleEndian(){return O(this,"isLittleEndian",kt())}static get isEvalSupported(){return O(this,"isEvalSupported",Mt())}static get isOffscreenCanvasSupported(){return O(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}}a.FeatureTest=St;const Ht=[...Array(256).keys()].map(Pt=>Pt.toString(16).padStart(2,"0"));class Ut{static makeHexColor(J,pt,Lt){return`#${Ht[J]}${Ht[pt]}${Ht[Lt]}`}static scaleMinMax(J,pt){let Lt;J[0]?(J[0]<0&&(Lt=pt[0],pt[0]=pt[1],pt[1]=Lt),pt[0]*=J[0],pt[1]*=J[0],J[3]<0&&(Lt=pt[2],pt[2]=pt[3],pt[3]=Lt),pt[2]*=J[3],pt[3]*=J[3]):(Lt=pt[0],pt[0]=pt[2],pt[2]=Lt,Lt=pt[1],pt[1]=pt[3],pt[3]=Lt,J[1]<0&&(Lt=pt[2],pt[2]=pt[3],pt[3]=Lt),pt[2]*=J[1],pt[3]*=J[1],J[2]<0&&(Lt=pt[0],pt[0]=pt[1],pt[1]=Lt),pt[0]*=J[2],pt[1]*=J[2]),pt[0]+=J[4],pt[1]+=J[4],pt[2]+=J[5],pt[3]+=J[5]}static transform(J,pt){return[J[0]*pt[0]+J[2]*pt[1],J[1]*pt[0]+J[3]*pt[1],J[0]*pt[2]+J[2]*pt[3],J[1]*pt[2]+J[3]*pt[3],J[0]*pt[4]+J[2]*pt[5]+J[4],J[1]*pt[4]+J[3]*pt[5]+J[5]]}static applyTransform(J,pt){const Lt=J[0]*pt[0]+J[1]*pt[2]+pt[4],qt=J[0]*pt[1]+J[1]*pt[3]+pt[5];return[Lt,qt]}static applyInverseTransform(J,pt){const Lt=pt[0]*pt[3]-pt[1]*pt[2],qt=(J[0]*pt[3]-J[1]*pt[2]+pt[2]*pt[5]-pt[4]*pt[3])/Lt,Ct=(-J[0]*pt[1]+J[1]*pt[0]+pt[4]*pt[1]-pt[5]*pt[0])/Lt;return[qt,Ct]}static getAxialAlignedBoundingBox(J,pt){const Lt=Ut.applyTransform(J,pt),qt=Ut.applyTransform(J.slice(2,4),pt),Ct=Ut.applyTransform([J[0],J[3]],pt),Tt=Ut.applyTransform([J[2],J[1]],pt);return[Math.min(Lt[0],qt[0],Ct[0],Tt[0]),Math.min(Lt[1],qt[1],Ct[1],Tt[1]),Math.max(Lt[0],qt[0],Ct[0],Tt[0]),Math.max(Lt[1],qt[1],Ct[1],Tt[1])]}static inverseTransform(J){const pt=J[0]*J[3]-J[1]*J[2];return[J[3]/pt,-J[1]/pt,-J[2]/pt,J[0]/pt,(J[2]*J[5]-J[4]*J[3])/pt,(J[4]*J[1]-J[5]*J[0])/pt]}static apply3dTransform(J,pt){return[J[0]*pt[0]+J[1]*pt[1]+J[2]*pt[2],J[3]*pt[0]+J[4]*pt[1]+J[5]*pt[2],J[6]*pt[0]+J[7]*pt[1]+J[8]*pt[2]]}static singularValueDecompose2dScale(J){const pt=[J[0],J[2],J[1],J[3]],Lt=J[0]*pt[0]+J[1]*pt[2],qt=J[0]*pt[1]+J[1]*pt[3],Ct=J[2]*pt[0]+J[3]*pt[2],Tt=J[2]*pt[1]+J[3]*pt[3],$t=(Lt+Tt)/2,jt=Math.sqrt((Lt+Tt)**2-4*(Lt*Tt-Ct*qt))/2,Wt=$t+jt||1,Qt=$t-jt||1;return[Math.sqrt(Wt),Math.sqrt(Qt)]}static normalizeRect(J){const pt=J.slice(0);return J[0]>J[2]&&(pt[0]=J[2],pt[2]=J[0]),J[1]>J[3]&&(pt[1]=J[3],pt[3]=J[1]),pt}static intersect(J,pt){const Lt=Math.max(Math.min(J[0],J[2]),Math.min(pt[0],pt[2])),qt=Math.min(Math.max(J[0],J[2]),Math.max(pt[0],pt[2]));if(Lt>qt)return null;const Ct=Math.max(Math.min(J[1],J[3]),Math.min(pt[1],pt[3])),Tt=Math.min(Math.max(J[1],J[3]),Math.max(pt[1],pt[3]));return Ct>Tt?null:[Lt,Ct,qt,Tt]}static bezierBoundingBox(J,pt,Lt,qt,Ct,Tt,$t,jt){const Wt=[],Qt=[[],[]];let se,Kt,ae,te,ge,he,nn,sn;for(let rn=0;rn<2;++rn){if(rn===0?(Kt=6*J-12*Lt+6*Ct,se=-3*J+9*Lt-9*Ct+3*$t,ae=3*Lt-3*J):(Kt=6*pt-12*qt+6*Tt,se=-3*pt+9*qt-9*Tt+3*jt,ae=3*qt-3*pt),Math.abs(se)<1e-12){if(Math.abs(Kt)<1e-12)continue;te=-ae/Kt,0<te&&te<1&&Wt.push(te);continue}nn=Kt*Kt-4*ae*se,sn=Math.sqrt(nn),!(nn<0)&&(ge=(-Kt+sn)/(2*se),0<ge&&ge<1&&Wt.push(ge),he=(-Kt-sn)/(2*se),0<he&&he<1&&Wt.push(he))}let me=Wt.length,ie;const ye=me;for(;me--;)te=Wt[me],ie=1-te,Qt[0][me]=ie*ie*ie*J+3*ie*ie*te*Lt+3*ie*te*te*Ct+te*te*te*$t,Qt[1][me]=ie*ie*ie*pt+3*ie*ie*te*qt+3*ie*te*te*Tt+te*te*te*jt;return Qt[0][ye]=J,Qt[1][ye]=pt,Qt[0][ye+1]=$t,Qt[1][ye+1]=jt,Qt[0].length=Qt[1].length=ye+2,[Math.min(...Qt[0]),Math.min(...Qt[1]),Math.max(...Qt[0]),Math.max(...Qt[1])]}}a.Util=Ut;const Nt=[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 zt(Pt){if(Pt[0]>="\xEF"){let pt;if(Pt[0]==="\xFE"&&Pt[1]==="\xFF"?pt="utf-16be":Pt[0]==="\xFF"&&Pt[1]==="\xFE"?pt="utf-16le":Pt[0]==="\xEF"&&Pt[1]==="\xBB"&&Pt[2]==="\xBF"&&(pt="utf-8"),pt)try{const Lt=new TextDecoder(pt,{fatal:!0}),qt=p(Pt);return Lt.decode(qt)}catch(Lt){Rt(`stringToPDFString: "${Lt}".`)}}const J=[];for(let pt=0,Lt=Pt.length;pt<Lt;pt++){const qt=Nt[Pt.charCodeAt(pt)];J.push(qt?String.fromCharCode(qt):Pt.charAt(pt))}return J.join("")}function Gt(Pt){return Pt.replace(/([()\\\n\r])/g,J=>J===`
37
- `?"\\n":J==="\r"?"\\r":`\\${J}`)}function Zt(Pt){return/^[\x00-\x7F]*$/.test(Pt)}function Xt(Pt){const J=["\xFE\xFF"];for(let pt=0,Lt=Pt.length;pt<Lt;pt++){const qt=Pt.charCodeAt(pt);J.push(String.fromCharCode(qt>>8&255),String.fromCharCode(qt&255))}return J.join("")}function Vt(Pt){return decodeURIComponent(escape(Pt))}function Yt(Pt){return unescape(encodeURIComponent(Pt))}function Jt(Pt){return typeof Pt=="object"&&Pt!==null&&Pt.byteLength!==void 0}function oe(Pt,J){if(Pt.length!==J.length)return!1;for(let pt=0,Lt=Pt.length;pt<Lt;pt++)if(Pt[pt]!==J[pt])return!1;return!0}function ce(Pt=new Date){return[Pt.getUTCFullYear().toString(),(Pt.getUTCMonth()+1).toString().padStart(2,"0"),Pt.getUTCDate().toString().padStart(2,"0"),Pt.getUTCHours().toString().padStart(2,"0"),Pt.getUTCMinutes().toString().padStart(2,"0"),Pt.getUTCSeconds().toString().padStart(2,"0")].join("")}function de(){const Pt=Object.create(null);let J=!1;return Object.defineProperty(Pt,"settled",{get(){return J}}),Pt.promise=new Promise(function(pt,Lt){Pt.resolve=function(qt){J=!0,pt(qt)},Pt.reject=function(qt){J=!0,Lt(qt)}}),Pt}}),((m,a,A)=>{A(3)}),((m,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.isNodeJS=void 0;const A=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser");a.isNodeJS=A}),((__unused_webpack_module,exports,__w_pdfjs_require__)=>{var m,A,f,_,V,q,Y,M,b,ln,P,S;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.DefaultCanvasFactory=exports.DefaultCMapReaderFactory=void 0,exports.getDocument=getDocument,exports.setPDFNetworkStreamFactory=setPDFNetworkStreamFactory,exports.version=void 0;var _util=__w_pdfjs_require__(1),_annotation_storage=__w_pdfjs_require__(5),_display_utils=__w_pdfjs_require__(8),_font_loader=__w_pdfjs_require__(11),_canvas=__w_pdfjs_require__(12),_worker_options=__w_pdfjs_require__(15),_is_node=__w_pdfjs_require__(3),_message_handler=__w_pdfjs_require__(16),_metadata=__w_pdfjs_require__(17),_optional_content_config=__w_pdfjs_require__(18),_transport_stream=__w_pdfjs_require__(19),_xfa_text=__w_pdfjs_require__(20);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100;let DefaultCanvasFactory=_display_utils.DOMCanvasFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory;let DefaultCMapReaderFactory=_display_utils.DOMCMapReaderFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory;let DefaultStandardFontDataFactory=_display_utils.DOMStandardFontDataFactory;if(exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory,_is_node.isNodeJS){const{NodeCanvasFactory:l,NodeCMapReaderFactory:t,NodeStandardFontDataFactory:r}=__w_pdfjs_require__(21);exports.DefaultCanvasFactory=DefaultCanvasFactory=l,exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory=t,exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory=r}let createPDFNetworkStream;function setPDFNetworkStreamFactory(l){createPDFNetworkStream=l}function getDocument(l){const t=new PDFDocumentLoadingTask;let r;if(typeof l=="string"||l instanceof URL)r={url:l};else if((0,_util.isArrayBuffer)(l))r={data:l};else if(l instanceof PDFDataRangeTransport)r={range:l};else{if(typeof l!="object")throw new Error("Invalid parameter in getDocument, need either string, URL, TypedArray, or parameter object.");if(!l.url&&!l.data&&!l.range)throw new Error("Invalid parameter object: need either .data, .range or .url");r=l}const o=Object.create(null);let v=null,g=null;for(const n in r){const i=r[n];switch(n){case"url":if(typeof window<"u")try{o[n]=new URL(i,window.location).href;continue}catch(e){(0,_util.warn)(`Cannot create valid URL: "${e}".`)}else if(typeof i=="string"||i instanceof URL){o[n]=i.toString();continue}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.");case"range":v=i;continue;case"worker":g=i;continue;case"data":if(_is_node.isNodeJS&&typeof Buffer<"u"&&i instanceof Buffer)o[n]=new Uint8Array(i);else{if(i instanceof Uint8Array)break;if(typeof i=="string")o[n]=(0,_util.stringToBytes)(i);else if(typeof i=="object"&&i!==null&&!isNaN(i.length))o[n]=new Uint8Array(i);else if((0,_util.isArrayBuffer)(i))o[n]=new Uint8Array(i);else throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}continue}o[n]=i}if(o.CMapReaderFactory=o.CMapReaderFactory||DefaultCMapReaderFactory,o.StandardFontDataFactory=o.StandardFontDataFactory||DefaultStandardFontDataFactory,o.ignoreErrors=o.stopAtErrors!==!0,o.fontExtraProperties=o.fontExtraProperties===!0,o.pdfBug=o.pdfBug===!0,o.enableXfa=o.enableXfa===!0,(!Number.isInteger(o.rangeChunkSize)||o.rangeChunkSize<1)&&(o.rangeChunkSize=DEFAULT_RANGE_CHUNK_SIZE),(typeof o.docBaseUrl!="string"||(0,_display_utils.isDataScheme)(o.docBaseUrl))&&(o.docBaseUrl=null),(!Number.isInteger(o.maxImageSize)||o.maxImageSize<-1)&&(o.maxImageSize=-1),typeof o.cMapUrl!="string"&&(o.cMapUrl=null),typeof o.standardFontDataUrl!="string"&&(o.standardFontDataUrl=null),typeof o.useWorkerFetch!="boolean"&&(o.useWorkerFetch=o.CMapReaderFactory===_display_utils.DOMCMapReaderFactory&&o.StandardFontDataFactory===_display_utils.DOMStandardFontDataFactory),typeof o.isEvalSupported!="boolean"&&(o.isEvalSupported=!0),typeof o.disableFontFace!="boolean"&&(o.disableFontFace=_is_node.isNodeJS),typeof o.useSystemFonts!="boolean"&&(o.useSystemFonts=!_is_node.isNodeJS&&!o.disableFontFace),(typeof o.ownerDocument!="object"||o.ownerDocument===null)&&(o.ownerDocument=globalThis.document),typeof o.disableRange!="boolean"&&(o.disableRange=!1),typeof o.disableStream!="boolean"&&(o.disableStream=!1),typeof o.disableAutoFetch!="boolean"&&(o.disableAutoFetch=!1),(0,_util.setVerbosityLevel)(o.verbosity),!g){const n={verbosity:o.verbosity,port:_worker_options.GlobalWorkerOptions.workerPort};g=n.port?PDFWorker.fromPort(n):new PDFWorker(n),t._worker=g}const u=t.docId;return g.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");const n=_fetchDocument(g,o,v,u),i=new Promise(function(e){let E;v?E=new _transport_stream.PDFDataTransportStream({length:o.length,initialData:o.initialData,progressiveDone:o.progressiveDone,contentDispositionFilename:o.contentDispositionFilename,disableRange:o.disableRange,disableStream:o.disableStream},v):o.data||(E=createPDFNetworkStream({url:o.url,length:o.length,httpHeaders:o.httpHeaders,withCredentials:o.withCredentials,rangeChunkSize:o.rangeChunkSize,disableRange:o.disableRange,disableStream:o.disableStream})),e(E)});return Promise.all([n,i]).then(function([e,E]){if(t.destroyed)throw new Error("Loading aborted");const x=new _message_handler.MessageHandler(u,e,g.port),j=new WorkerTransport(x,t,E,o);t._transport=j,x.send("Ready",null)})}).catch(t._capability.reject),t}async function _fetchDocument(l,t,r,o){if(l.destroyed)throw new Error("Worker was destroyed");r&&(t.length=r.length,t.initialData=r.initialData,t.progressiveDone=r.progressiveDone,t.contentDispositionFilename=r.contentDispositionFilename);const v=await l.messageHandler.sendWithPromise("GetDocRequest",{docId:o,apiVersion:"2.16.105",source:{data:t.data,url:t.url,password:t.password,disableAutoFetch:t.disableAutoFetch,rangeChunkSize:t.rangeChunkSize,length:t.length},maxImageSize:t.maxImageSize,disableFontFace:t.disableFontFace,docBaseUrl:t.docBaseUrl,ignoreErrors:t.ignoreErrors,isEvalSupported:t.isEvalSupported,fontExtraProperties:t.fontExtraProperties,enableXfa:t.enableXfa,useSystemFonts:t.useSystemFonts,cMapUrl:t.useWorkerFetch?t.cMapUrl:null,standardFontDataUrl:t.useWorkerFetch?t.standardFontDataUrl:null});if(t.data&&(t.data=null),l.destroyed)throw new Error("Worker was destroyed");return v}const a=class a{constructor(){this._capability=(0,_util.createPromiseCapability)(),this._transport=null,this._worker=null,this.docId=`d${on(a,m)._++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null,this.onUnsupportedFeature=null}get promise(){return this._capability.promise}async destroy(){var t;this.destroyed=!0,await((t=this._transport)==null?void 0:t.destroy()),this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}};m=new WeakMap,Ot(a,m,0);let PDFDocumentLoadingTask=a;exports.PDFDocumentLoadingTask=PDFDocumentLoadingTask;class PDFDataRangeTransport{constructor(t,r,o=!1,v=null){this.length=t,this.initialData=r,this.progressiveDone=o,this.contentDispositionFilename=v,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=(0,_util.createPromiseCapability)()}addRangeListener(t){this._rangeListeners.push(t)}addProgressListener(t){this._progressListeners.push(t)}addProgressiveReadListener(t){this._progressiveReadListeners.push(t)}addProgressiveDoneListener(t){this._progressiveDoneListeners.push(t)}onDataRange(t,r){for(const o of this._rangeListeners)o(t,r)}onDataProgress(t,r){this._readyCapability.promise.then(()=>{for(const o of this._progressListeners)o(t,r)})}onDataProgressiveRead(t){this._readyCapability.promise.then(()=>{for(const r of this._progressiveReadListeners)r(t)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const t of this._progressiveDoneListeners)t()})}transportReady(){this._readyCapability.resolve()}requestDataRange(t,r){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}exports.PDFDataRangeTransport=PDFDataRangeTransport;class PDFDocumentProxy{constructor(t,r){this._pdfInfo=t,this._transport=r,Object.defineProperty(this,"fingerprint",{get(){return(0,_display_utils.deprecated)("`PDFDocumentProxy.fingerprint`, please use `PDFDocumentProxy.fingerprints` instead."),this.fingerprints[0]}}),Object.defineProperty(this,"getStats",{value:async()=>((0,_display_utils.deprecated)("`PDFDocumentProxy.getStats`, please use the `PDFDocumentProxy.stats`-getter instead."),this.stats||{streamTypes:{},fontTypes:{}})})}get annotationStorage(){return this._transport.annotationStorage}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get stats(){return this._transport.stats}get isPureXfa(){return!!this._transport._htmlForXfa}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}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()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}saveDocument(){return this._transport.annotationStorage.size<=0&&(0,_display_utils.deprecated)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead."),this._transport.saveDocument()}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}exports.PDFDocumentProxy=PDFDocumentProxy;class PDFPageProxy{constructor(t,r,o,v,g=!1){this._pageIndex=t,this._pageInfo=r,this._ownerDocument=v,this._transport=o,this._stats=g?new _display_utils.StatTimer:null,this._pdfBug=g,this.commonObjs=o.commonObjs,this.objs=new PDFObjects,this._bitmaps=new Set,this.cleanupAfterRender=!1,this.pendingCleanup=!1,this._intentStates=new Map,this._annotationPromises=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:t,rotation:r=this.rotate,offsetX:o=0,offsetY:v=0,dontFlip:g=!1}={}){return new _display_utils.PageViewport({viewBox:this.view,scale:t,rotation:r,offsetX:o,offsetY:v,dontFlip:g})}getAnnotations({intent:t="display"}={}){const r=this._transport.getRenderingIntent(t);let o=this._annotationPromises.get(r.cacheKey);return o||(o=this._transport.getAnnotations(this._pageIndex,r.renderingIntent),this._annotationPromises.set(r.cacheKey,o),o=o.then(v=>{for(const g of v)g.titleObj!==void 0&&Object.defineProperty(g,"title",{get(){return(0,_display_utils.deprecated)("`title`-property on annotation, please use `titleObj` instead."),g.titleObj.str}}),g.contentsObj!==void 0&&Object.defineProperty(g,"contents",{get(){return(0,_display_utils.deprecated)("`contents`-property on annotation, please use `contentsObj` instead."),g.contentsObj.str}});return v})),o}getJSActions(){return this._jsActionsPromise||(this._jsActionsPromise=this._transport.getPageJSActions(this._pageIndex))}async getXfa(){var t;return((t=this._transport._htmlForXfa)==null?void 0:t.children[this._pageIndex])||null}render({canvasContext:t,viewport:r,intent:o="display",annotationMode:v=_util.AnnotationMode.ENABLE,transform:g=null,imageLayer:u=null,canvasFactory:n=null,background:i=null,optionalContentConfigPromise:e=null,annotationCanvasMap:E=null,pageColors:x=null,printAnnotationStorage:j=null}){var G,Q;((G=arguments[0])==null?void 0:G.renderInteractiveForms)!==void 0&&((0,_display_utils.deprecated)("render no longer accepts the `renderInteractiveForms`-option, please use the `annotationMode`-option instead."),arguments[0].renderInteractiveForms===!0&&v===_util.AnnotationMode.ENABLE&&(v=_util.AnnotationMode.ENABLE_FORMS)),((Q=arguments[0])==null?void 0:Q.includeAnnotationStorage)!==void 0&&((0,_display_utils.deprecated)("render no longer accepts the `includeAnnotationStorage`-option, please use the `annotationMode`-option instead."),arguments[0].includeAnnotationStorage===!0&&v===_util.AnnotationMode.ENABLE&&(v=_util.AnnotationMode.ENABLE_STORAGE)),this._stats&&this._stats.time("Overall");const I=this._transport.getRenderingIntent(o,v,j);this.pendingCleanup=!1,e||(e=this._transport.getOptionalContentConfig());let yt=this._intentStates.get(I.cacheKey);yt||(yt=Object.create(null),this._intentStates.set(I.cacheKey,yt)),yt.streamReaderCancelTimeout&&(clearTimeout(yt.streamReaderCancelTimeout),yt.streamReaderCancelTimeout=null);const wt=n||new DefaultCanvasFactory({ownerDocument:this._ownerDocument}),bt=!!(I.renderingIntent&_util.RenderingIntentFlag.PRINT);yt.displayReadyCapability||(yt.displayReadyCapability=(0,_util.createPromiseCapability)(),yt.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats&&this._stats.time("Page Request"),this._pumpOperatorList(I));const K=xt=>{yt.renderTasks.delete(B),(this.cleanupAfterRender||bt)&&(this.pendingCleanup=!0),this._tryCleanup(),xt?(B.capability.reject(xt),this._abortOperatorList({intentState:yt,reason:xt instanceof Error?xt:new Error(xt)})):B.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"))},B=new InternalRenderTask({callback:K,params:{canvasContext:t,viewport:r,transform:g,imageLayer:u,background:i},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:E,operatorList:yt.operatorList,pageIndex:this._pageIndex,canvasFactory:wt,useRequestAnimationFrame:!bt,pdfBug:this._pdfBug,pageColors:x});(yt.renderTasks||(yt.renderTasks=new Set)).add(B);const U=B.task;return Promise.all([yt.displayReadyCapability.promise,e]).then(([xt,Rt])=>{if(this.pendingCleanup){K();return}this._stats&&this._stats.time("Rendering"),B.initializeGraphics({transparency:xt,optionalContentConfig:Rt}),B.operatorListChanged()}).catch(K),U}getOperatorList({intent:t="display",annotationMode:r=_util.AnnotationMode.ENABLE,printAnnotationStorage:o=null}={}){function v(){u.operatorList.lastChunk&&(u.opListReadCapability.resolve(u.operatorList),u.renderTasks.delete(n))}const g=this._transport.getRenderingIntent(t,r,o,!0);let u=this._intentStates.get(g.cacheKey);u||(u=Object.create(null),this._intentStates.set(g.cacheKey,u));let n;return u.opListReadCapability||(n=Object.create(null),n.operatorListChanged=v,u.opListReadCapability=(0,_util.createPromiseCapability)(),(u.renderTasks||(u.renderTasks=new Set)).add(n),u.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats&&this._stats.time("Page Request"),this._pumpOperatorList(g)),u.opListReadCapability.promise}streamTextContent({disableCombineTextItems:t=!1,includeMarkedContent:r=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,combineTextItems:t!==!0,includeMarkedContent:r===!0},{highWaterMark:100,size(v){return v.items.length}})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(o=>_xfa_text.XfaText.textContent(o));const r=this.streamTextContent(t);return new Promise(function(o,v){function g(){u.read().then(function({value:i,done:e}){if(e){o(n);return}Object.assign(n.styles,i.styles),n.items.push(...i.items),g()},v)}const u=r.getReader(),n={items:[],styles:Object.create(null)};g()})}getStructTree(){return this._structTreePromise||(this._structTreePromise=this._transport.getStructTree(this._pageIndex))}_destroy(){this.destroyed=!0;const t=[];for(const r of this._intentStates.values())if(this._abortOperatorList({intentState:r,reason:new Error("Page was destroyed."),force:!0}),!r.opListReadCapability)for(const o of r.renderTasks)t.push(o.completed),o.cancel();this.objs.clear();for(const r of this._bitmaps)r.close();return this._bitmaps.clear(),this._annotationPromises.clear(),this._jsActionsPromise=null,this._structTreePromise=null,this.pendingCleanup=!1,Promise.all(t)}cleanup(t=!1){return this.pendingCleanup=!0,this._tryCleanup(t)}_tryCleanup(t=!1){if(!this.pendingCleanup)return!1;for(const{renderTasks:r,operatorList:o}of this._intentStates.values())if(r.size>0||!o.lastChunk)return!1;this._intentStates.clear(),this.objs.clear(),this._annotationPromises.clear(),this._jsActionsPromise=null,this._structTreePromise=null,t&&this._stats&&(this._stats=new _display_utils.StatTimer);for(const r of this._bitmaps)r.close();return this._bitmaps.clear(),this.pendingCleanup=!1,!0}_startRenderPage(t,r){const o=this._intentStates.get(r);o&&(this._stats&&this._stats.timeEnd("Page Request"),o.displayReadyCapability&&o.displayReadyCapability.resolve(t))}_renderPageChunk(t,r){for(let o=0,v=t.length;o<v;o++)r.operatorList.fnArray.push(t.fnArray[o]),r.operatorList.argsArray.push(t.argsArray[o]);r.operatorList.lastChunk=t.lastChunk,r.operatorList.separateAnnots=t.separateAnnots;for(const o of r.renderTasks)o.operatorListChanged();t.lastChunk&&this._tryCleanup()}_pumpOperatorList({renderingIntent:t,cacheKey:r,annotationStorageMap:o}){const g=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:r,annotationStorage:o}).getReader(),u=this._intentStates.get(r);u.streamReader=g;const n=()=>{g.read().then(({value:i,done:e})=>{if(e){u.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(i,u),n())},i=>{if(u.streamReader=null,!this._transport.destroyed){if(u.operatorList){u.operatorList.lastChunk=!0;for(const e of u.renderTasks)e.operatorListChanged();this._tryCleanup()}if(u.displayReadyCapability)u.displayReadyCapability.reject(i);else if(u.opListReadCapability)u.opListReadCapability.reject(i);else throw i}})};n()}_abortOperatorList({intentState:t,reason:r,force:o=!1}){if(t.streamReader){if(!o){if(t.renderTasks.size>0)return;if(r instanceof _display_utils.RenderingCancelledException){t.streamReaderCancelTimeout=setTimeout(()=>{this._abortOperatorList({intentState:t,reason:r,force:!0}),t.streamReaderCancelTimeout=null},RENDERING_CANCELLED_TIMEOUT);return}}if(t.streamReader.cancel(new _util.AbortException(r.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[v,g]of this._intentStates)if(g===t){this._intentStates.delete(v);break}this.cleanup()}}}get stats(){return this._stats}}exports.PDFPageProxy=PDFPageProxy;class LoopbackPort{constructor(){this._listeners=[],this._deferred=Promise.resolve()}postMessage(t,r){const o={data:structuredClone(t,r)};this._deferred.then(()=>{for(const v of this._listeners)v.call(this,o)})}addEventListener(t,r){this._listeners.push(r)}removeEventListener(t,r){const o=this._listeners.indexOf(r);this._listeners.splice(o,1)}terminate(){this._listeners.length=0}}exports.LoopbackPort=LoopbackPort;const PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};exports.PDFWorkerUtil=PDFWorkerUtil;{if(_is_node.isNodeJS&&typeof commonjsRequire=="function")PDFWorkerUtil.isWorkerDisabled=!0,PDFWorkerUtil.fallbackWorkerSrc="./pdf.worker.js";else if(typeof document=="object"){const l=(A=document==null?void 0:document.currentScript)==null?void 0:A.src;l&&(PDFWorkerUtil.fallbackWorkerSrc=l.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}PDFWorkerUtil.isSameOrigin=function(l,t){let r;try{if(r=new URL(l),!r.origin||r.origin==="null")return!1}catch{return!1}const o=new URL(t,r);return r.origin===o.origin},PDFWorkerUtil.createCDNWrapper=function(l){const t=`importScripts("${l}");`;return URL.createObjectURL(new Blob([t]))}}const _PDFWorker=class _PDFWorker{constructor({name:l=null,port:t=null,verbosity:r=(0,_util.getVerbosityLevel)()}={}){if(t&&R(_PDFWorker,f).has(t))throw new Error("Cannot use more than one PDFWorker per port.");if(this.name=l,this.destroyed=!1,this.verbosity=r,this._readyCapability=(0,_util.createPromiseCapability)(),this._port=null,this._webWorker=null,this._messageHandler=null,t){R(_PDFWorker,f).set(t,this),this._initializeFromPort(t);return}this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(l){this._port=l,this._messageHandler=new _message_handler.MessageHandler("main","worker",l),this._messageHandler.on("ready",function(){}),this._readyCapability.resolve()}_initialize(){if(!PDFWorkerUtil.isWorkerDisabled&&!_PDFWorker._mainThreadWorkerMessageHandler){let{workerSrc:l}=_PDFWorker;try{PDFWorkerUtil.isSameOrigin(window.location.href,l)||(l=PDFWorkerUtil.createCDNWrapper(new URL(l,window.location).href));const t=new Worker(l),r=new _message_handler.MessageHandler("main","worker",t),o=()=>{t.removeEventListener("error",v),r.destroy(),t.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},v=()=>{this._webWorker||o()};t.addEventListener("error",v),r.on("test",u=>{if(t.removeEventListener("error",v),this.destroyed){o();return}u?(this._messageHandler=r,this._port=t,this._webWorker=t,this._readyCapability.resolve(),r.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),r.destroy(),t.terminate())}),r.on("ready",u=>{if(t.removeEventListener("error",v),this.destroyed){o();return}try{g()}catch{this._setupFakeWorker()}});const g=()=>{const u=new Uint8Array;r.send("test",u,[u.buffer])};g();return}catch{(0,_util.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){PDFWorkerUtil.isWorkerDisabled||((0,_util.warn)("Setting up fake worker."),PDFWorkerUtil.isWorkerDisabled=!0),_PDFWorker._setupFakeWorkerGlobal.then(l=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const t=new LoopbackPort;this._port=t;const r=`fake${PDFWorkerUtil.fakeWorkerId++}`,o=new _message_handler.MessageHandler(r+"_worker",r,t);l.setup(o,t);const v=new _message_handler.MessageHandler(r,r+"_worker",t);this._messageHandler=v,this._readyCapability.resolve(),v.send("configure",{verbosity:this.verbosity})}).catch(l=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${l.message}".`))})}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),R(_PDFWorker,f).delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(l){if(!(l!=null&&l.port))throw new Error("PDFWorker.fromPort - invalid method signature.");return R(this,f).has(l.port)?R(this,f).get(l.port):new _PDFWorker(l)}static get workerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(PDFWorkerUtil.fallbackWorkerSrc!==null)return _is_node.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'),PDFWorkerUtil.fallbackWorkerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _mainThreadWorkerMessageHandler(){var l;try{return((l=globalThis.pdfjsWorker)==null?void 0:l.WorkerMessageHandler)||null}catch{return null}}static get _setupFakeWorkerGlobal(){const loader=async()=>{const mainWorkerMessageHandler=this._mainThreadWorkerMessageHandler;if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_is_node.isNodeJS&&typeof commonjsRequire=="function"){const worker=eval("require")(this.workerSrc);return worker.WorkerMessageHandler}return await(0,_display_utils.loadScript)(this.workerSrc),window.pdfjsWorker.WorkerMessageHandler};return(0,_util.shadow)(this,"_setupFakeWorkerGlobal",loader())}};f=new WeakMap,Ot(_PDFWorker,f,new WeakMap);let PDFWorker=_PDFWorker;exports.PDFWorker=PDFWorker,PDFWorker.getWorkerSrc=function(){return(0,_display_utils.deprecated)("`PDFWorker.getWorkerSrc()`, please use `PDFWorker.workerSrc` instead."),this.workerSrc};class WorkerTransport{constructor(t,r,o,v){Ot(this,_,null);Ot(this,V,new Map);Ot(this,q,new Map);Ot(this,Y,null);this.messageHandler=t,this.loadingTask=r,this.commonObjs=new PDFObjects,this.fontLoader=new _font_loader.FontLoader({docId:r.docId,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),ownerDocument:v.ownerDocument,styleElement:v.styleElement}),this._params=v,v.useWorkerFetch||(this.CMapReaderFactory=new v.CMapReaderFactory({baseUrl:v.cMapUrl,isCompressed:v.cMapPacked}),this.StandardFontDataFactory=new v.StandardFontDataFactory({baseUrl:v.standardFontDataUrl})),this.destroyed=!1,this.destroyCapability=null,this._passwordCapability=null,this._networkStream=o,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=(0,_util.createPromiseCapability)(),this.setupMessageHandler()}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}get stats(){return R(this,_)}getRenderingIntent(t,r=_util.AnnotationMode.ENABLE,o=null,v=!1){let g=_util.RenderingIntentFlag.DISPLAY,u=null;switch(t){case"any":g=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":g=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${t}`)}switch(r){case _util.AnnotationMode.DISABLE:g+=_util.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case _util.AnnotationMode.ENABLE:break;case _util.AnnotationMode.ENABLE_FORMS:g+=_util.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case _util.AnnotationMode.ENABLE_STORAGE:g+=_util.RenderingIntentFlag.ANNOTATIONS_STORAGE,u=(g&_util.RenderingIntentFlag.PRINT&&o instanceof _annotation_storage.PrintAnnotationStorage?o:this.annotationStorage).serializable;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${r}`)}return v&&(g+=_util.RenderingIntentFlag.OPLIST),{renderingIntent:g,cacheKey:`${g}_${_annotation_storage.AnnotationStorage.getHash(u)}`,annotationStorageMap:u}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=(0,_util.createPromiseCapability)(),this._passwordCapability&&this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const o of R(this,V).values())t.push(o._destroy());R(this,V).clear(),R(this,q).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const r=this.messageHandler.sendWithPromise("Terminate",null);return t.push(r),Promise.all(t).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),It(this,Y,null),this._getFieldObjectsPromise=null,this._hasJSActionsPromise=null,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(){const{messageHandler:t,loadingTask:r}=this;t.on("GetReader",(o,v)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=g=>{this._lastProgress={loaded:g.loaded,total:g.total}},v.onPull=()=>{this._fullReader.read().then(function({value:g,done:u}){if(u){v.close();return}(0,_util.assert)((0,_util.isArrayBuffer)(g),"GetReader - expected an ArrayBuffer."),v.enqueue(new Uint8Array(g),1,[g])}).catch(g=>{v.error(g)})},v.onCancel=g=>{this._fullReader.cancel(g),v.ready.catch(u=>{if(!this.destroyed)throw u})}}),t.on("ReaderHeadersReady",o=>{const v=(0,_util.createPromiseCapability)(),g=this._fullReader;return g.headersReady.then(()=>{var u;(!g.isStreamingSupported||!g.isRangeSupported)&&(this._lastProgress&&((u=r.onProgress)==null||u.call(r,this._lastProgress)),g.onProgress=n=>{var i;(i=r.onProgress)==null||i.call(r,{loaded:n.loaded,total:n.total})}),v.resolve({isStreamingSupported:g.isStreamingSupported,isRangeSupported:g.isRangeSupported,contentLength:g.contentLength})},v.reject),v.promise}),t.on("GetRangeReader",(o,v)=>{(0,_util.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const g=this._networkStream.getRangeReader(o.begin,o.end);if(!g){v.close();return}v.onPull=()=>{g.read().then(function({value:u,done:n}){if(n){v.close();return}(0,_util.assert)((0,_util.isArrayBuffer)(u),"GetRangeReader - expected an ArrayBuffer."),v.enqueue(new Uint8Array(u),1,[u])}).catch(u=>{v.error(u)})},v.onCancel=u=>{g.cancel(u),v.ready.catch(n=>{if(!this.destroyed)throw n})}}),t.on("GetDoc",({pdfInfo:o})=>{this._numPages=o.numPages,this._htmlForXfa=o.htmlForXfa,delete o.htmlForXfa,r._capability.resolve(new PDFDocumentProxy(o,this))}),t.on("DocException",function(o){let v;switch(o.name){case"PasswordException":v=new _util.PasswordException(o.message,o.code);break;case"InvalidPDFException":v=new _util.InvalidPDFException(o.message);break;case"MissingPDFException":v=new _util.MissingPDFException(o.message);break;case"UnexpectedResponseException":v=new _util.UnexpectedResponseException(o.message,o.status);break;case"UnknownErrorException":v=new _util.UnknownErrorException(o.message,o.details);break;default:(0,_util.unreachable)("DocException - expected a valid Error.")}r._capability.reject(v)}),t.on("PasswordRequest",o=>{if(this._passwordCapability=(0,_util.createPromiseCapability)(),r.onPassword){const v=g=>{g instanceof Error?this._passwordCapability.reject(g):this._passwordCapability.resolve({password:g})};try{r.onPassword(v,o.code)}catch(g){this._passwordCapability.reject(g)}}else this._passwordCapability.reject(new _util.PasswordException(o.message,o.code));return this._passwordCapability.promise}),t.on("DataLoaded",o=>{var v;(v=r.onProgress)==null||v.call(r,{loaded:o.length,total:o.length}),this.downloadInfoCapability.resolve(o)}),t.on("StartRenderPage",o=>{if(this.destroyed)return;R(this,V).get(o.pageIndex)._startRenderPage(o.transparency,o.cacheKey)}),t.on("commonobj",([o,v,g])=>{var u;if(!this.destroyed&&!this.commonObjs.has(o))switch(v){case"Font":const n=this._params;if("error"in g){const E=g.error;(0,_util.warn)(`Error during font loading: ${E}`),this.commonObjs.resolve(o,E);break}let i=null;n.pdfBug&&((u=globalThis.FontInspector)!=null&&u.enabled)&&(i={registerFont(E,x){globalThis.FontInspector.fontAdded(E,x)}});const e=new _font_loader.FontFaceObject(g,{isEvalSupported:n.isEvalSupported,disableFontFace:n.disableFontFace,ignoreErrors:n.ignoreErrors,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),fontRegistry:i});this.fontLoader.bind(e).catch(E=>t.sendWithPromise("FontFallback",{id:o})).finally(()=>{!n.fontExtraProperties&&e.data&&(e.data=null),this.commonObjs.resolve(o,e)});break;case"FontPath":case"Image":this.commonObjs.resolve(o,g);break;default:throw new Error(`Got unknown common object type ${v}`)}}),t.on("obj",([o,v,g,u])=>{var i;if(this.destroyed)return;const n=R(this,V).get(v);if(!n.objs.has(o))switch(g){case"Image":n.objs.resolve(o,u);const e=8e6;if(u){let E;if(u.bitmap){const{bitmap:x,width:j,height:I}=u;E=j*I*4,n._bitmaps.add(x)}else E=((i=u.data)==null?void 0:i.length)||0;E>e&&(n.cleanupAfterRender=!0)}break;case"Pattern":n.objs.resolve(o,u);break;default:throw new Error(`Got unknown object type ${g}`)}}),t.on("DocProgress",o=>{var v;this.destroyed||(v=r.onProgress)==null||v.call(r,{loaded:o.loaded,total:o.total})}),t.on("DocStats",o=>{this.destroyed||It(this,_,Object.freeze({streamTypes:Object.freeze(o.streamTypes),fontTypes:Object.freeze(o.fontTypes)}))}),t.on("UnsupportedFeature",this._onUnsupportedFeature.bind(this)),t.on("FetchBuiltInCMap",o=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.CMapReaderFactory?this.CMapReaderFactory.fetch(o):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),t.on("FetchStandardFontData",o=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.StandardFontDataFactory?this.StandardFontDataFactory.fetch(o):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}_onUnsupportedFeature({featureId:t}){var r,o;this.destroyed||(o=(r=this.loadingTask).onUnsupportedFeature)==null||o.call(r,t)}getData(){return this.messageHandler.sendWithPromise("GetData",null)}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const r=t-1,o=R(this,q).get(r);if(o)return o;const v=this.messageHandler.sendWithPromise("GetPage",{pageIndex:r}).then(g=>{if(this.destroyed)throw new Error("Transport destroyed");const u=new PDFPageProxy(r,g,this,this._params.ownerDocument,this._params.pdfBug);return R(this,V).set(r,u),u});return R(this,q).set(r,v),v}getPageIndex(t){return typeof t!="object"||t===null||!Number.isInteger(t.num)||t.num<0||!Number.isInteger(t.gen)||t.gen<0?Promise.reject(new Error("Invalid pageIndex request.")):this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen})}getAnnotations(t,r){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:r})}saveDocument(){var t;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:this.annotationStorage.serializable,filename:((t=this._fullReader)==null?void 0:t.filename)??null}).finally(()=>{this.annotationStorage.resetModified()})}getFieldObjects(){return this._getFieldObjectsPromise||(this._getFieldObjectsPromise=this.messageHandler.sendWithPromise("GetFieldObjects",null))}hasJSActions(){return this._hasJSActionsPromise||(this._hasJSActionsPromise=this.messageHandler.sendWithPromise("HasJSActions",null))}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return typeof t!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}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(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then(t=>new _optional_content_config.OptionalContentConfig(t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){return R(this,Y)||It(this,Y,this.messageHandler.sendWithPromise("GetMetadata",null).then(t=>{var r,o;return{info:t[0],metadata:t[1]?new _metadata.Metadata(t[1]):null,contentDispositionFilename:((r=this._fullReader)==null?void 0:r.filename)??null,contentLength:((o=this._fullReader)==null?void 0:o.contentLength)??null}}))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(await this.messageHandler.sendWithPromise("Cleanup",null),!this.destroyed){for(const r of R(this,V).values())if(!r.cleanup())throw new Error(`startCleanup: Page ${r.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),It(this,Y,null),this._getFieldObjectsPromise=null,this._hasJSActionsPromise=null}}get loadingParams(){const t=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:t.disableAutoFetch,enableXfa:t.enableXfa})}}_=new WeakMap,V=new WeakMap,q=new WeakMap,Y=new WeakMap;class PDFObjects{constructor(){Ot(this,b);Ot(this,M,Object.create(null))}get(t,r=null){if(r){const v=Dt(this,b,ln).call(this,t);return v.capability.promise.then(()=>r(v.data)),null}const o=R(this,M)[t];if(!(o!=null&&o.capability.settled))throw new Error(`Requesting object that isn't resolved yet ${t}.`);return o.data}has(t){const r=R(this,M)[t];return(r==null?void 0:r.capability.settled)||!1}resolve(t,r=null){const o=Dt(this,b,ln).call(this,t);o.data=r,o.capability.resolve()}clear(){It(this,M,Object.create(null))}}M=new WeakMap,b=new WeakSet,ln=function(t){const r=R(this,M)[t];return r||(R(this,M)[t]={capability:(0,_util.createPromiseCapability)(),data:null})};class RenderTask{constructor(t){Ot(this,P,null);It(this,P,t),this.onContinue=null}get promise(){return R(this,P).capability.promise}cancel(){R(this,P).cancel()}get separateAnnots(){const{separateAnnots:t}=R(this,P).operatorList;if(!t)return!1;const{annotationCanvasMap:r}=R(this,P);return t.form||t.canvas&&(r==null?void 0:r.size)>0}}P=new WeakMap,exports.RenderTask=RenderTask;const F=class F{constructor({callback:t,params:r,objs:o,commonObjs:v,annotationCanvasMap:g,operatorList:u,pageIndex:n,canvasFactory:i,useRequestAnimationFrame:e=!1,pdfBug:E=!1,pageColors:x=null}){this.callback=t,this.params=r,this.objs=o,this.commonObjs=v,this.annotationCanvasMap=g,this.operatorListIdx=null,this.operatorList=u,this._pageIndex=n,this.canvasFactory=i,this._pdfBug=E,this.pageColors=x,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=e===!0&&typeof window<"u",this.cancelled=!1,this.capability=(0,_util.createPromiseCapability)(),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=r.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:r}){var i;if(this.cancelled)return;if(this._canvas){if(R(F,S).has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");R(F,S).add(this._canvas)}this._pdfBug&&((i=globalThis.StepperManager)!=null&&i.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:o,viewport:v,transform:g,imageLayer:u,background:n}=this.params;this.gfx=new _canvas.CanvasGraphics(o,this.commonObjs,this.objs,this.canvasFactory,u,r,this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:g,viewport:v,transparency:t,background:n}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback&&this.graphicsReadyCallback()}cancel(t=null){this.running=!1,this.cancelled=!0,this.gfx&&this.gfx.endDrawing(),this._canvas&&R(F,S).delete(this._canvas),this.callback(t||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,"canvas"))}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}this.stepper&&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._canvas&&R(F,S).delete(this._canvas),this.callback())))}};S=new WeakMap,Ot(F,S,new WeakSet);let InternalRenderTask=F;const version="2.16.105";exports.version=version;const build="172ccdbe5";exports.build=build}),((m,a,A)=>{var M,xn,w;Object.defineProperty(a,"__esModule",{value:!0}),a.PrintAnnotationStorage=a.AnnotationStorage=void 0;var f=A(1),_=A(6),V=A(10);class q{constructor(){Ot(this,M);this._storage=new Map,this._modified=!1,this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(S,F){const l=this._storage.get(S);return l===void 0?F:Object.assign(F,l)}getRawValue(S){return this._storage.get(S)}remove(S){if(this._storage.delete(S),this._storage.size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const F of this._storage.values())if(F instanceof _.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(S,F){const l=this._storage.get(S);let t=!1;if(l!==void 0)for(const[r,o]of Object.entries(F))l[r]!==o&&(t=!0,l[r]=o);else t=!0,this._storage.set(S,F);t&&Dt(this,M,xn).call(this),F instanceof _.AnnotationEditor&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(F.constructor._type)}has(S){return this._storage.has(S)}getAll(){return this._storage.size>0?(0,f.objectFromMap)(this._storage):null}get size(){return this._storage.size}resetModified(){this._modified&&(this._modified=!1,typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new Y(this)}get serializable(){if(this._storage.size===0)return null;const S=new Map;for(const[F,l]of this._storage){const t=l instanceof _.AnnotationEditor?l.serialize():l;t&&S.set(F,t)}return S}static getHash(S){if(!S)return"";const F=new V.MurmurHash3_64;for(const[l,t]of S)F.update(`${l}:${JSON.stringify(t)}`);return F.hexdigest()}}M=new WeakSet,xn=function(){this._modified||(this._modified=!0,typeof this.onSetModified=="function"&&this.onSetModified())},a.AnnotationStorage=q;class Y extends q{constructor(F){super();Ot(this,w,null);It(this,w,structuredClone(F.serializable))}get print(){(0,f.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return R(this,w)}}w=new WeakMap,a.PrintAnnotationStorage=Y}),((m,a,A)=>{var q,Y,M,b,w,P;Object.defineProperty(a,"__esModule",{value:!0}),a.AnnotationEditor=void 0;var f=A(7),_=A(1);const S=class S{constructor(l){Ot(this,q,this.focusin.bind(this));Ot(this,Y,this.focusout.bind(this));Ot(this,M,!1);Ot(this,b,!1);Ot(this,w,!1);Ot(this,P,S._zIndex++);this.constructor===S&&(0,_.unreachable)("Cannot initialize AnnotationEditor."),this.parent=l.parent,this.id=l.id,this.width=this.height=null,this.pageIndex=l.parent.pageIndex,this.name=l.name,this.div=null;const[t,r]=this.parent.viewportBaseDimensions;this.x=l.x/t,this.y=l.y/r,this.rotation=this.parent.viewport.rotation,this.isAttachedToDOM=!1}static get _defaultLineColor(){return(0,_.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=R(this,P)}focusin(l){R(this,M)?It(this,M,!1):this.parent.setSelected(this)}focusout(l){if(!this.isAttachedToDOM)return;const t=l.relatedTarget;t!=null&&t.closest(`#${this.id}`)||(l.preventDefault(),this.parent.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.parent.addToAnnotationStorage(this)}dragstart(l){const t=this.parent.div.getBoundingClientRect();this.startX=l.clientX-t.x,this.startY=l.clientY-t.y,l.dataTransfer.setData("text/plain",this.id),l.dataTransfer.effectAllowed="move"}setAt(l,t,r,o){const[v,g]=this.parent.viewportBaseDimensions;[r,o]=this.screenToPageTranslation(r,o),this.x=(l+r)/v,this.y=(t+o)/g,this.div.style.left=`${100*this.x}%`,this.div.style.top=`${100*this.y}%`}translate(l,t){const[r,o]=this.parent.viewportBaseDimensions;[l,t]=this.screenToPageTranslation(l,t),this.x+=l/r,this.y+=t/o,this.div.style.left=`${100*this.x}%`,this.div.style.top=`${100*this.y}%`}screenToPageTranslation(l,t){const{rotation:r}=this.parent.viewport;switch(r){case 90:return[t,-l];case 180:return[-l,-t];case 270:return[-t,l];default:return[l,t]}}setDims(l,t){const[r,o]=this.parent.viewportBaseDimensions;this.div.style.width=`${100*l/r}%`,this.div.style.height=`${100*t/o}%`}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",R(this,q)),this.div.addEventListener("focusout",R(this,Y));const[l,t]=this.getInitialTranslation();return this.translate(l,t),(0,f.bindEvents)(this,this.div,["dragstart","pointerdown"]),this.div}pointerdown(l){const t=f.KeyboardManager.platform.isMac;if(l.button!==0||l.ctrlKey&&t){l.preventDefault();return}l.ctrlKey&&!t||l.shiftKey||l.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this),It(this,M,!0)}getRect(l,t){const[r,o]=this.parent.viewportBaseDimensions,[v,g]=this.parent.pageDimensions,u=v*l/r,n=g*t/o,i=this.x*v,e=this.y*g,E=this.width*v,x=this.height*g;switch(this.rotation){case 0:return[i+u,g-e-n-x,i+u+E,g-e-n];case 90:return[i+n,g-e+u,i+n+x,g-e+u+E];case 180:return[i-u-E,g-e+n,i-u,g-e+n+x];case 270:return[i-n-x,g-e-u-E,i-n,g-e-u];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(l,t){const[r,o,v,g]=l,u=v-r,n=g-o;switch(this.rotation){case 0:return[r,t-g,u,n];case 90:return[r,t-o,n,u];case 180:return[v,t-o,u,n];case 270:return[v,t-g,n,u];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){It(this,w,!0)}disableEditMode(){It(this,w,!1)}isInEditMode(){return R(this,w)}shouldGetKeyboardEvents(){return!1}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){var l;(l=this.div)==null||l.addEventListener("focusin",R(this,q))}serialize(){(0,_.unreachable)("An editor must be serializable")}static deserialize(l,t){const r=new this.prototype.constructor({parent:t,id:t.getNextId()});r.rotation=l.rotation;const[o,v]=t.pageDimensions,[g,u,n,i]=r.getRectInCurrentCoords(l.rect,v);return r.x=g/o,r.y=u/v,r.width=n/o,r.height=i/v,r}remove(){this.div.removeEventListener("focusin",R(this,q)),this.div.removeEventListener("focusout",R(this,Y)),this.isEmpty()||this.commit(),this.parent.remove(this)}select(){var l;(l=this.div)==null||l.classList.add("selectedEditor")}unselect(){var l;(l=this.div)==null||l.classList.remove("selectedEditor")}updateParams(l,t){}disableEditing(){}enableEditing(){}get propertiesToUpdate(){return{}}get contentDiv(){return this.div}get isEditing(){return R(this,b)}set isEditing(l){It(this,b,l),l?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null)}};q=new WeakMap,Y=new WeakMap,M=new WeakMap,b=new WeakMap,w=new WeakMap,P=new WeakMap,ee(S,"_colorManager",new f.ColorManager),ee(S,"_zIndex",1);let V=S;a.AnnotationEditor=V}),((m,a,A)=>{var F,l,t,r,o,v,wn,n,e,E,x,j,I,yt,wt,bt,K,B,U,G,Q,xt,Rt,H,h,c,kn,un,re,Ee,Pn,Tn,cn,Ce,ve;Object.defineProperty(a,"__esModule",{value:!0}),a.KeyboardManager=a.CommandManager=a.ColorManager=a.AnnotationEditorUIManager=void 0,a.bindEvents=V,a.opacityToHex=q;var f=A(1),_=A(8);function V(D,p,L){for(const _t of L)p.addEventListener(_t,D[_t].bind(D))}function q(D){return Math.round(Math.min(255,Math.max(1,255*D))).toString(16).padStart(2,"0")}class Y{constructor(){Ot(this,F,0)}getId(){return`${f.AnnotationEditorPrefix}${on(this,F)._++}`}}F=new WeakMap;class M{constructor(p=128){Ot(this,l,[]);Ot(this,t,!1);Ot(this,r);Ot(this,o,-1);It(this,r,p)}add({cmd:p,undo:L,mustExec:_t,type:z=NaN,overwriteIfSameType:Z=!1,keepUndo:At=!1}){if(_t&&p(),R(this,t))return;const kt={cmd:p,undo:L,type:z};if(R(this,o)===-1){R(this,l).length>0&&(R(this,l).length=0),It(this,o,0),R(this,l).push(kt);return}if(Z&&R(this,l)[R(this,o)].type===z){At&&(kt.undo=R(this,l)[R(this,o)].undo),R(this,l)[R(this,o)]=kt;return}const Mt=R(this,o)+1;Mt===R(this,r)?R(this,l).splice(0,1):(It(this,o,Mt),Mt<R(this,l).length&&R(this,l).splice(Mt)),R(this,l).push(kt)}undo(){R(this,o)!==-1&&(It(this,t,!0),R(this,l)[R(this,o)].undo(),It(this,t,!1),It(this,o,R(this,o)-1))}redo(){R(this,o)<R(this,l).length-1&&(It(this,o,R(this,o)+1),It(this,t,!0),R(this,l)[R(this,o)].cmd(),It(this,t,!1))}hasSomethingToUndo(){return R(this,o)!==-1}hasSomethingToRedo(){return R(this,o)<R(this,l).length-1}destroy(){It(this,l,null)}}l=new WeakMap,t=new WeakMap,r=new WeakMap,o=new WeakMap,a.CommandManager=M;const u=class u{constructor(p){Ot(this,v);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const L=u.platform.isMac;for(const[_t,z]of p)for(const Z of _t){const At=Z.startsWith("mac+");L&&At?(this.callbacks.set(Z.slice(4),z),this.allKeys.add(Z.split("+").at(-1))):!L&&!At&&(this.callbacks.set(Z,z),this.allKeys.add(Z.split("+").at(-1)))}}static get platform(){const p=typeof navigator<"u"?navigator.platform:"";return(0,f.shadow)(this,"platform",{isWin:p.includes("Win"),isMac:p.includes("Mac")})}exec(p,L){if(!this.allKeys.has(L.key))return;const _t=this.callbacks.get(Dt(this,v,wn).call(this,L));_t&&(_t.bind(p)(),L.stopPropagation(),L.preventDefault())}};v=new WeakSet,wn=function(p){p.altKey&&this.buffer.push("alt"),p.ctrlKey&&this.buffer.push("ctrl"),p.metaKey&&this.buffer.push("meta"),p.shiftKey&&this.buffer.push("shift"),this.buffer.push(p.key);const L=this.buffer.join("+");return this.buffer.length=0,L};let b=u;a.KeyboardManager=b;class w{constructor(){Ot(this,n,null)}copy(p){p&&(Array.isArray(p)?It(this,n,p.map(L=>L.serialize())):It(this,n,[p.serialize()]),It(this,n,R(this,n).filter(L=>!!L)),R(this,n).length===0&&It(this,n,null))}paste(){return R(this,n)}isEmpty(){return R(this,n)===null}destroy(){It(this,n,null)}}n=new WeakMap;const i=class i{get _colors(){const p=new Map([["CanvasText",null],["Canvas",null]]);return(0,_.getColorValues)(p),(0,f.shadow)(this,"_colors",p)}convert(p){const L=(0,_.getRGB)(p);if(!window.matchMedia("(forced-colors: active)").matches)return L;for(const[_t,z]of this._colors)if(z.every((Z,At)=>Z===L[At]))return i._colorsMapping.get(_t);return L}getHexCode(p){const L=this._colors.get(p);return L?f.Util.makeHexColor(...L):p}};ee(i,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let P=i;a.ColorManager=P;const N=class N{constructor(p,L){Ot(this,c);Ot(this,e,null);Ot(this,E,new Map);Ot(this,x,new Map);Ot(this,j,new w);Ot(this,I,new M);Ot(this,yt,0);Ot(this,wt,null);Ot(this,bt,null);Ot(this,K,new Y);Ot(this,B,!1);Ot(this,U,f.AnnotationEditorType.NONE);Ot(this,G,new Set);Ot(this,Q,this.keydown.bind(this));Ot(this,xt,this.onEditingAction.bind(this));Ot(this,Rt,this.onPageChanging.bind(this));Ot(this,H,{isEditing:!1,isEmpty:!0,hasEmptyClipboard:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1});Ot(this,h,null);It(this,h,p),It(this,bt,L),R(this,bt)._on("editingaction",R(this,xt)),R(this,bt)._on("pagechanging",R(this,Rt))}destroy(){Dt(this,c,un).call(this),R(this,bt)._off("editingaction",R(this,xt)),R(this,bt)._off("pagechanging",R(this,Rt));for(const p of R(this,x).values())p.destroy();R(this,x).clear(),R(this,E).clear(),It(this,e,null),R(this,G).clear(),R(this,j).destroy(),R(this,I).destroy()}onPageChanging({pageNumber:p}){It(this,yt,p-1)}focusMainContainer(){R(this,h).focus()}keydown(p){var L;(L=this.getActive())!=null&&L.shouldGetKeyboardEvents()||N._keyboardManager.exec(this,p)}onEditingAction(p){["undo","redo","cut","copy","paste","delete","selectAll"].includes(p.name)&&this[p.name]()}setEditingState(p){p?(Dt(this,c,kn).call(this),Dt(this,c,re).call(this,{isEditing:R(this,U)!==f.AnnotationEditorType.NONE,isEmpty:Dt(this,c,Ce).call(this),hasSomethingToUndo:R(this,I).hasSomethingToUndo(),hasSomethingToRedo:R(this,I).hasSomethingToRedo(),hasSelectedEditor:!1,hasEmptyClipboard:R(this,j).isEmpty()})):(Dt(this,c,un).call(this),Dt(this,c,re).call(this,{isEditing:!1}))}registerEditorTypes(p){It(this,wt,p);for(const L of R(this,wt))Dt(this,c,Ee).call(this,L.defaultPropertiesToUpdate)}getId(){return R(this,K).getId()}addLayer(p){R(this,x).set(p.pageIndex,p),R(this,B)?p.enable():p.disable()}removeLayer(p){R(this,x).delete(p.pageIndex)}updateMode(p){if(It(this,U,p),p===f.AnnotationEditorType.NONE)this.setEditingState(!1),Dt(this,c,Tn).call(this);else{this.setEditingState(!0),Dt(this,c,Pn).call(this);for(const L of R(this,x).values())L.updateMode(p)}}updateToolbar(p){p!==R(this,U)&&R(this,bt).dispatch("switchannotationeditormode",{source:this,mode:p})}updateParams(p,L){for(const _t of R(this,G))_t.updateParams(p,L);for(const _t of R(this,wt))_t.updateDefaultParams(p,L)}getEditors(p){const L=[];for(const _t of R(this,E).values())_t.pageIndex===p&&L.push(_t);return L}getEditor(p){return R(this,E).get(p)}addEditor(p){R(this,E).set(p.id,p)}removeEditor(p){R(this,E).delete(p.id),this.unselect(p)}setActiveEditor(p){R(this,e)!==p&&(It(this,e,p),p&&Dt(this,c,Ee).call(this,p.propertiesToUpdate))}toggleSelected(p){if(R(this,G).has(p)){R(this,G).delete(p),p.unselect(),Dt(this,c,re).call(this,{hasSelectedEditor:this.hasSelection});return}R(this,G).add(p),p.select(),Dt(this,c,Ee).call(this,p.propertiesToUpdate),Dt(this,c,re).call(this,{hasSelectedEditor:!0})}setSelected(p){for(const L of R(this,G))L!==p&&L.unselect();R(this,G).clear(),R(this,G).add(p),p.select(),Dt(this,c,Ee).call(this,p.propertiesToUpdate),Dt(this,c,re).call(this,{hasSelectedEditor:!0})}isSelected(p){return R(this,G).has(p)}unselect(p){p.unselect(),R(this,G).delete(p),Dt(this,c,re).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return R(this,G).size!==0}undo(){R(this,I).undo(),Dt(this,c,re).call(this,{hasSomethingToUndo:R(this,I).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:Dt(this,c,Ce).call(this)})}redo(){R(this,I).redo(),Dt(this,c,re).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:R(this,I).hasSomethingToRedo(),isEmpty:Dt(this,c,Ce).call(this)})}addCommands(p){R(this,I).add(p),Dt(this,c,re).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:Dt(this,c,Ce).call(this)})}delete(){if(R(this,e)&&R(this,e).commitOrRemove(),!this.hasSelection)return;const p=[...R(this,G)],L=()=>{for(const z of p)z.remove()},_t=()=>{for(const z of p)Dt(this,c,cn).call(this,z)};this.addCommands({cmd:L,undo:_t,mustExec:!0})}copy(){if(R(this,e)&&R(this,e).commitOrRemove(),this.hasSelection){const p=[];for(const L of R(this,G))L.isEmpty()||p.push(L);if(p.length===0)return;R(this,j).copy(p),Dt(this,c,re).call(this,{hasEmptyClipboard:!1})}}cut(){this.copy(),this.delete()}paste(){if(R(this,j).isEmpty())return;this.unselectAll();const p=R(this,x).get(R(this,yt)),L=R(this,j).paste().map(Z=>p.deserialize(Z)),_t=()=>{for(const Z of L)Dt(this,c,cn).call(this,Z);Dt(this,c,ve).call(this,L)},z=()=>{for(const Z of L)Z.remove()};this.addCommands({cmd:_t,undo:z,mustExec:!0})}selectAll(){for(const p of R(this,G))p.commit();Dt(this,c,ve).call(this,R(this,E).values())}unselectAll(){if(R(this,e)){R(this,e).commitOrRemove();return}if(Dt(this,c,ve).size!==0){for(const p of R(this,G))p.unselect();R(this,G).clear(),Dt(this,c,re).call(this,{hasSelectedEditor:!1})}}isActive(p){return R(this,e)===p}getActive(){return R(this,e)}getMode(){return R(this,U)}};e=new WeakMap,E=new WeakMap,x=new WeakMap,j=new WeakMap,I=new WeakMap,yt=new WeakMap,wt=new WeakMap,bt=new WeakMap,K=new WeakMap,B=new WeakMap,U=new WeakMap,G=new WeakMap,Q=new WeakMap,xt=new WeakMap,Rt=new WeakMap,H=new WeakMap,h=new WeakMap,c=new WeakSet,kn=function(){R(this,h).addEventListener("keydown",R(this,Q))},un=function(){R(this,h).removeEventListener("keydown",R(this,Q))},re=function(p){Object.entries(p).some(([_t,z])=>R(this,H)[_t]!==z)&&R(this,bt).dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(R(this,H),p)})},Ee=function(p){R(this,bt).dispatch("annotationeditorparamschanged",{source:this,details:p})},Pn=function(){if(!R(this,B)){It(this,B,!0);for(const p of R(this,x).values())p.enable()}},Tn=function(){if(this.unselectAll(),R(this,B)){It(this,B,!1);for(const p of R(this,x).values())p.disable()}},cn=function(p){const L=R(this,x).get(p.pageIndex);L?L.addOrRebuild(p):this.addEditor(p)},Ce=function(){if(R(this,E).size===0)return!0;if(R(this,E).size===1)for(const p of R(this,E).values())return p.isEmpty();return!1},ve=function(p){R(this,G).clear();for(const L of p)L.isEmpty()||(R(this,G).add(L),L.select());Dt(this,c,re).call(this,{hasSelectedEditor:!0})},ee(N,"_keyboardManager",new b([[["ctrl+a","mac+meta+a"],N.prototype.selectAll],[["ctrl+c","mac+meta+c"],N.prototype.copy],[["ctrl+v","mac+meta+v"],N.prototype.paste],[["ctrl+x","mac+meta+x"],N.prototype.cut],[["ctrl+z","mac+meta+z"],N.prototype.undo],[["ctrl+y","ctrl+shift+Z","mac+meta+shift+Z"],N.prototype.redo],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete"],N.prototype.delete],[["Escape","mac+Escape"],N.prototype.unselectAll]]));let S=N;a.AnnotationEditorUIManager=S}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.StatTimer=a.RenderingCancelledException=a.PixelsPerInch=a.PageViewport=a.PDFDateString=a.DOMStandardFontDataFactory=a.DOMSVGFactory=a.DOMCanvasFactory=a.DOMCMapReaderFactory=a.AnnotationPrefix=void 0,a.deprecated=i,a.getColorValues=I,a.getCurrentTransform=yt,a.getCurrentTransformInverse=wt,a.getFilenameFromUrl=o,a.getPdfFilenameFromUrl=v,a.getRGB=j,a.getXfaPageViewport=x,a.isDataScheme=t,a.isPdfFile=r,a.isValidFetchUrl=u,a.loadScript=n;var f=A(9),_=A(1);const V="http://www.w3.org/2000/svg",q="pdfjs_internal_id_";a.AnnotationPrefix=q;const bt=class bt{};ee(bt,"CSS",96),ee(bt,"PDF",72),ee(bt,"PDF_TO_CSS_UNITS",bt.CSS/bt.PDF);let Y=bt;a.PixelsPerInch=Y;class M extends f.BaseCanvasFactory{constructor({ownerDocument:B=globalThis.document}={}){super(),this._document=B}_createCanvas(B,U){const G=this._document.createElement("canvas");return G.width=B,G.height=U,G}}a.DOMCanvasFactory=M;async function b(K,B=!1){if(u(K,document.baseURI)){const U=await fetch(K);if(!U.ok)throw new Error(U.statusText);return B?new Uint8Array(await U.arrayBuffer()):(0,_.stringToBytes)(await U.text())}return new Promise((U,G)=>{const Q=new XMLHttpRequest;Q.open("GET",K,!0),B&&(Q.responseType="arraybuffer"),Q.onreadystatechange=()=>{if(Q.readyState===XMLHttpRequest.DONE){if(Q.status===200||Q.status===0){let xt;if(B&&Q.response?xt=new Uint8Array(Q.response):!B&&Q.responseText&&(xt=(0,_.stringToBytes)(Q.responseText)),xt){U(xt);return}}G(new Error(Q.statusText))}},Q.send(null)})}class w extends f.BaseCMapReaderFactory{_fetchData(B,U){return b(B,this.isCompressed).then(G=>({cMapData:G,compressionType:U}))}}a.DOMCMapReaderFactory=w;class P extends f.BaseStandardFontDataFactory{_fetchData(B){return b(B,!0)}}a.DOMStandardFontDataFactory=P;class S extends f.BaseSVGFactory{_createSVG(B){return document.createElementNS(V,B)}}a.DOMSVGFactory=S;class F{constructor({viewBox:B,scale:U,rotation:G,offsetX:Q=0,offsetY:xt=0,dontFlip:Rt=!1}){this.viewBox=B,this.scale=U,this.rotation=G,this.offsetX=Q,this.offsetY=xt;const H=(B[2]+B[0])/2,h=(B[3]+B[1])/2;let c,T,O,$;switch(G%=360,G<0&&(G+=360),G){case 180:c=-1,T=0,O=0,$=1;break;case 90:c=0,T=1,O=1,$=0;break;case 270:c=0,T=-1,O=-1,$=0;break;case 0:c=1,T=0,O=0,$=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}Rt&&(O=-O,$=-$);let W,s,d,C;c===0?(W=Math.abs(h-B[1])*U+Q,s=Math.abs(H-B[0])*U+xt,d=Math.abs(B[3]-B[1])*U,C=Math.abs(B[2]-B[0])*U):(W=Math.abs(H-B[0])*U+Q,s=Math.abs(h-B[1])*U+xt,d=Math.abs(B[2]-B[0])*U,C=Math.abs(B[3]-B[1])*U),this.transform=[c*U,T*U,O*U,$*U,W-c*U*H-O*U*h,s-T*U*H-$*U*h],this.width=d,this.height=C}clone({scale:B=this.scale,rotation:U=this.rotation,offsetX:G=this.offsetX,offsetY:Q=this.offsetY,dontFlip:xt=!1}={}){return new F({viewBox:this.viewBox.slice(),scale:B,rotation:U,offsetX:G,offsetY:Q,dontFlip:xt})}convertToViewportPoint(B,U){return _.Util.applyTransform([B,U],this.transform)}convertToViewportRectangle(B){const U=_.Util.applyTransform([B[0],B[1]],this.transform),G=_.Util.applyTransform([B[2],B[3]],this.transform);return[U[0],U[1],G[0],G[1]]}convertToPdfPoint(B,U){return _.Util.applyInverseTransform([B,U],this.transform)}}a.PageViewport=F;class l extends _.BaseException{constructor(B,U){super(B,"RenderingCancelledException"),this.type=U}}a.RenderingCancelledException=l;function t(K){const B=K.length;let U=0;for(;U<B&&K[U].trim()==="";)U++;return K.substring(U,U+5).toLowerCase()==="data:"}function r(K){return typeof K=="string"&&/\.pdf$/i.test(K)}function o(K){const B=K.indexOf("#"),U=K.indexOf("?"),G=Math.min(B>0?B:K.length,U>0?U:K.length);return K.substring(K.lastIndexOf("/",G)+1,G)}function v(K,B="document.pdf"){if(typeof K!="string")return B;if(t(K))return(0,_.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),B;const U=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,G=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,Q=U.exec(K);let xt=G.exec(Q[1])||G.exec(Q[2])||G.exec(Q[3]);if(xt&&(xt=xt[0],xt.includes("%")))try{xt=G.exec(decodeURIComponent(xt))[0]}catch{}return xt||B}class g{constructor(){this.started=Object.create(null),this.times=[]}time(B){B in this.started&&(0,_.warn)(`Timer is already running for ${B}`),this.started[B]=Date.now()}timeEnd(B){B in this.started||(0,_.warn)(`Timer has not been started for ${B}`),this.times.push({name:B,start:this.started[B],end:Date.now()}),delete this.started[B]}toString(){const B=[];let U=0;for(const G of this.times){const Q=G.name;Q.length>U&&(U=Q.length)}for(const G of this.times){const Q=G.end-G.start;B.push(`${G.name.padEnd(U)} ${Q}ms
38
- `)}return B.join("")}}a.StatTimer=g;function u(K,B){try{const{protocol:U}=B?new URL(K,B):new URL(K);return U==="http:"||U==="https:"}catch{return!1}}function n(K,B=!1){return new Promise((U,G)=>{const Q=document.createElement("script");Q.src=K,Q.onload=function(xt){B&&Q.remove(),U(xt)},Q.onerror=function(){G(new Error(`Cannot load script at: ${Q.src}`))},(document.head||document.documentElement).append(Q)})}function i(K){console.log("Deprecated API usage: "+K)}let e;class E{static toDateObject(B){if(!B||typeof B!="string")return null;e||(e=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const U=e.exec(B);if(!U)return null;const G=parseInt(U[1],10);let Q=parseInt(U[2],10);Q=Q>=1&&Q<=12?Q-1:0;let xt=parseInt(U[3],10);xt=xt>=1&&xt<=31?xt:1;let Rt=parseInt(U[4],10);Rt=Rt>=0&&Rt<=23?Rt:0;let H=parseInt(U[5],10);H=H>=0&&H<=59?H:0;let h=parseInt(U[6],10);h=h>=0&&h<=59?h:0;const c=U[7]||"Z";let T=parseInt(U[8],10);T=T>=0&&T<=23?T:0;let O=parseInt(U[9],10)||0;return O=O>=0&&O<=59?O:0,c==="-"?(Rt+=T,H+=O):c==="+"&&(Rt-=T,H-=O),new Date(Date.UTC(G,Q,xt,Rt,H,h))}}a.PDFDateString=E;function x(K,{scale:B=1,rotation:U=0}){const{width:G,height:Q}=K.attributes.style,xt=[0,0,parseInt(G),parseInt(Q)];return new F({viewBox:xt,scale:B,rotation:U})}function j(K){if(K.startsWith("#")){const B=parseInt(K.slice(1),16);return[(B&16711680)>>16,(B&65280)>>8,B&255]}return K.startsWith("rgb(")?K.slice(4,-1).split(",").map(B=>parseInt(B)):K.startsWith("rgba(")?K.slice(5,-1).split(",").map(B=>parseInt(B)).slice(0,3):((0,_.warn)(`Not a valid color format: "${K}"`),[0,0,0])}function I(K){const B=document.createElement("span");B.style.visibility="hidden",document.body.append(B);for(const U of K.keys()){B.style.color=U;const G=window.getComputedStyle(B).color;K.set(U,j(G))}B.remove()}function yt(K){const{a:B,b:U,c:G,d:Q,e:xt,f:Rt}=K.getTransform();return[B,U,G,Q,xt,Rt]}function wt(K){const{a:B,b:U,c:G,d:Q,e:xt,f:Rt}=K.getTransform().invertSelf();return[B,U,G,Q,xt,Rt]}}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.BaseStandardFontDataFactory=a.BaseSVGFactory=a.BaseCanvasFactory=a.BaseCMapReaderFactory=void 0;var f=A(1);class _{constructor(){this.constructor===_&&(0,f.unreachable)("Cannot initialize BaseCanvasFactory.")}create(b,w){if(b<=0||w<=0)throw new Error("Invalid canvas size");const P=this._createCanvas(b,w);return{canvas:P,context:P.getContext("2d")}}reset(b,w,P){if(!b.canvas)throw new Error("Canvas is not specified");if(w<=0||P<=0)throw new Error("Invalid canvas size");b.canvas.width=w,b.canvas.height=P}destroy(b){if(!b.canvas)throw new Error("Canvas is not specified");b.canvas.width=0,b.canvas.height=0,b.canvas=null,b.context=null}_createCanvas(b,w){(0,f.unreachable)("Abstract method `_createCanvas` called.")}}a.BaseCanvasFactory=_;class V{constructor({baseUrl:b=null,isCompressed:w=!1}){this.constructor===V&&(0,f.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=b,this.isCompressed=w}async fetch({name:b}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!b)throw new Error("CMap name must be specified.");const w=this.baseUrl+b+(this.isCompressed?".bcmap":""),P=this.isCompressed?f.CMapCompressionType.BINARY:f.CMapCompressionType.NONE;return this._fetchData(w,P).catch(S=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${w}`)})}_fetchData(b,w){(0,f.unreachable)("Abstract method `_fetchData` called.")}}a.BaseCMapReaderFactory=V;class q{constructor({baseUrl:b=null}){this.constructor===q&&(0,f.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=b}async fetch({filename:b}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!b)throw new Error("Font filename must be specified.");const w=`${this.baseUrl}${b}`;return this._fetchData(w).catch(P=>{throw new Error(`Unable to load font data at: ${w}`)})}_fetchData(b){(0,f.unreachable)("Abstract method `_fetchData` called.")}}a.BaseStandardFontDataFactory=q;class Y{constructor(){this.constructor===Y&&(0,f.unreachable)("Cannot initialize BaseSVGFactory.")}create(b,w,P=!1){if(b<=0||w<=0)throw new Error("Invalid SVG dimensions");const S=this._createSVG("svg:svg");return S.setAttribute("version","1.1"),P||(S.setAttribute("width",`${b}px`),S.setAttribute("height",`${w}px`)),S.setAttribute("preserveAspectRatio","none"),S.setAttribute("viewBox",`0 0 ${b} ${w}`),S}createElement(b){if(typeof b!="string")throw new Error("Invalid SVG element type");return this._createSVG(b)}_createSVG(b){(0,f.unreachable)("Abstract method `_createSVG` called.")}}a.BaseSVGFactory=Y}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.MurmurHash3_64=void 0;var f=A(1);const _=3285377520,V=4294901760,q=65535;class Y{constructor(b){this.h1=b?b&4294967295:_,this.h2=b?b&4294967295:_}update(b){let w,P;if(typeof b=="string"){w=new Uint8Array(b.length*2),P=0;for(let e=0,E=b.length;e<E;e++){const x=b.charCodeAt(e);x<=255?w[P++]=x:(w[P++]=x>>>8,w[P++]=x&255)}}else if((0,f.isArrayBuffer)(b))w=b.slice(),P=w.byteLength;else throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");const S=P>>2,F=P-S*4,l=new Uint32Array(w.buffer,0,S);let t=0,r=0,o=this.h1,v=this.h2;const g=3432918353,u=461845907,n=g&q,i=u&q;for(let e=0;e<S;e++)e&1?(t=l[e],t=t*g&V|t*n&q,t=t<<15|t>>>17,t=t*u&V|t*i&q,o^=t,o=o<<13|o>>>19,o=o*5+3864292196):(r=l[e],r=r*g&V|r*n&q,r=r<<15|r>>>17,r=r*u&V|r*i&q,v^=r,v=v<<13|v>>>19,v=v*5+3864292196);switch(t=0,F){case 3:t^=w[S*4+2]<<16;case 2:t^=w[S*4+1]<<8;case 1:t^=w[S*4],t=t*g&V|t*n&q,t=t<<15|t>>>17,t=t*u&V|t*i&q,S&1?o^=t:v^=t}this.h1=o,this.h2=v}hexdigest(){let b=this.h1,w=this.h2;b^=w>>>1,b=b*3981806797&V|b*36045&q,w=w*4283543511&V|((w<<16|b>>>16)*2950163797&V)>>>16,b^=w>>>1,b=b*444984403&V|b*60499&q,w=w*3301882366&V|((w<<16|b>>>16)*3120437893&V)>>>16,b^=w>>>1;const P=(b>>>0).toString(16),S=(w>>>0).toString(16);return P.padStart(8,"0")+S.padStart(8,"0")}}a.MurmurHash3_64=Y}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.FontLoader=a.FontFaceObject=void 0;var f=A(1);class _{constructor({docId:M,onUnsupportedFeature:b,ownerDocument:w=globalThis.document,styleElement:P=null}){this.constructor===_&&(0,f.unreachable)("Cannot initialize BaseFontLoader."),this.docId=M,this._onUnsupportedFeature=b,this._document=w,this.nativeFontFaces=[],this.styleElement=null}addNativeFontFace(M){this.nativeFontFaces.push(M),this._document.fonts.add(M)}insertRule(M){let b=this.styleElement;b||(b=this.styleElement=this._document.createElement("style"),b.id=`PDFJS_FONT_STYLE_TAG_${this.docId}`,this._document.documentElement.getElementsByTagName("head")[0].append(b));const w=b.sheet;w.insertRule(M,w.cssRules.length)}clear(){for(const M of this.nativeFontFaces)this._document.fonts.delete(M);this.nativeFontFaces.length=0,this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async bind(M){if(M.attached||M.missingFile)return;if(M.attached=!0,this.isFontLoadingAPISupported){const w=M.createNativeFontFace();if(w){this.addNativeFontFace(w);try{await w.loaded}catch(P){throw this._onUnsupportedFeature({featureId:f.UNSUPPORTED_FEATURES.errorFontLoadNative}),(0,f.warn)(`Failed to load font '${w.family}': '${P}'.`),M.disableFontFace=!0,P}}return}const b=M.createFontFaceRule();if(b){if(this.insertRule(b),this.isSyncFontLoadingSupported)return;await new Promise(w=>{const P=this._queueLoadingCallback(w);this._prepareFontLoadEvent([b],[M],P)})}}_queueLoadingCallback(M){(0,f.unreachable)("Abstract method `_queueLoadingCallback`.")}get isFontLoadingAPISupported(){var b;const M=!!((b=this._document)!=null&&b.fonts);return(0,f.shadow)(this,"isFontLoadingAPISupported",M)}get isSyncFontLoadingSupported(){(0,f.unreachable)("Abstract method `isSyncFontLoadingSupported`.")}get _loadTestFont(){(0,f.unreachable)("Abstract method `_loadTestFont`.")}_prepareFontLoadEvent(M,b,w){(0,f.unreachable)("Abstract method `_prepareFontLoadEvent`.")}}let V;a.FontLoader=V,a.FontLoader=V=class extends _{constructor(M){super(M),this.loadingContext={requests:[],nextRequestId:0},this.loadTestFontId=0}get isSyncFontLoadingSupported(){let M=!1;if(typeof navigator>"u")M=!0;else{const b=/Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent);(b==null?void 0:b[1])>=14&&(M=!0)}return(0,f.shadow)(this,"isSyncFontLoadingSupported",M)}_queueLoadingCallback(M){function b(){for((0,f.assert)(!P.done,"completeRequest() cannot be called twice."),P.done=!0;w.requests.length>0&&w.requests[0].done;){const S=w.requests.shift();setTimeout(S.callback,0)}}const w=this.loadingContext,P={id:`pdfjs-font-loading-${w.nextRequestId++}`,done:!1,complete:b,callback:M};return w.requests.push(P),P}get _loadTestFont(){const M=function(){return atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==")};return(0,f.shadow)(this,"_loadTestFont",M())}_prepareFontLoadEvent(M,b,w){function P(wt,bt){return wt.charCodeAt(bt)<<24|wt.charCodeAt(bt+1)<<16|wt.charCodeAt(bt+2)<<8|wt.charCodeAt(bt+3)&255}function S(wt,bt,K,B){const U=wt.substring(0,bt),G=wt.substring(bt+K);return U+B+G}let F,l;const t=this._document.createElement("canvas");t.width=1,t.height=1;const r=t.getContext("2d");let o=0;function v(wt,bt){if(o++,o>30){(0,f.warn)("Load test font never loaded."),bt();return}if(r.font="30px "+wt,r.fillText(".",0,20),r.getImageData(0,0,1,1).data[3]>0){bt();return}setTimeout(v.bind(null,wt,bt))}const g=`lt${Date.now()}${this.loadTestFontId++}`;let u=this._loadTestFont;u=S(u,976,g.length,g);const i=16,e=1482184792;let E=P(u,i);for(F=0,l=g.length-3;F<l;F+=4)E=E-e+P(g,F)|0;F<g.length&&(E=E-e+P(g+"XXX",F)|0),u=S(u,i,4,(0,f.string32)(E));const x=`url(data:font/opentype;base64,${btoa(u)});`,j=`@font-face {font-family:"${g}";src:${x}}`;this.insertRule(j);const I=[];for(const wt of b)I.push(wt.loadedName);I.push(g);const yt=this._document.createElement("div");yt.style.visibility="hidden",yt.style.width=yt.style.height="10px",yt.style.position="absolute",yt.style.top=yt.style.left="0px";for(const wt of I){const bt=this._document.createElement("span");bt.textContent="Hi",bt.style.fontFamily=wt,yt.append(bt)}this._document.body.append(yt),v(g,()=>{yt.remove(),w.complete()})}};class q{constructor(M,{isEvalSupported:b=!0,disableFontFace:w=!1,ignoreErrors:P=!1,onUnsupportedFeature:S,fontRegistry:F=null}){this.compiledGlyphs=Object.create(null);for(const l in M)this[l]=M[l];this.isEvalSupported=b!==!1,this.disableFontFace=w===!0,this.ignoreErrors=P===!0,this._onUnsupportedFeature=S,this.fontRegistry=F}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let M;if(!this.cssFontInfo)M=new FontFace(this.loadedName,this.data,{});else{const b={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(b.style=`oblique ${this.cssFontInfo.italicAngle}deg`),M=new FontFace(this.cssFontInfo.fontFamily,this.data,b)}return this.fontRegistry&&this.fontRegistry.registerFont(this),M}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const M=(0,f.bytesToString)(this.data),b=`url(data:${this.mimetype};base64,${btoa(M)});`;let w;if(!this.cssFontInfo)w=`@font-face {font-family:"${this.loadedName}";src:${b}}`;else{let P=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(P+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),w=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${P}src:${b}}`}return this.fontRegistry&&this.fontRegistry.registerFont(this,b),w}getPathGenerator(M,b){if(this.compiledGlyphs[b]!==void 0)return this.compiledGlyphs[b];let w;try{w=M.get(this.loadedName+"_path_"+b)}catch(P){if(!this.ignoreErrors)throw P;return this._onUnsupportedFeature({featureId:f.UNSUPPORTED_FEATURES.errorFontGetPath}),(0,f.warn)(`getPathGenerator - ignoring character: "${P}".`),this.compiledGlyphs[b]=function(S,F){}}if(this.isEvalSupported&&f.FeatureTest.isEvalSupported){const P=[];for(const S of w){const F=S.args!==void 0?S.args.join(","):"";P.push("c.",S.cmd,"(",F,`);
39
- `)}return this.compiledGlyphs[b]=new Function("c","size",P.join(""))}return this.compiledGlyphs[b]=function(P,S){for(const F of w)F.cmd==="scale"&&(F.args=[S,-S]),P[F.cmd].apply(P,F.args)}}}a.FontFaceObject=q}),((m,a,A)=>{var Q,dn;Object.defineProperty(a,"__esModule",{value:!0}),a.CanvasGraphics=void 0;var f=A(8),_=A(1),V=A(13),q=A(14),Y=A(3);const M=16,b=100,w=4096,P=15,S=10,F=Y.isNodeJS&&typeof Path2D>"u"?-1:1e3,l=16;function t(H,h){if(H._removeMirroring)throw new Error("Context is already forwarding operations.");H.__originalSave=H.save,H.__originalRestore=H.restore,H.__originalRotate=H.rotate,H.__originalScale=H.scale,H.__originalTranslate=H.translate,H.__originalTransform=H.transform,H.__originalSetTransform=H.setTransform,H.__originalResetTransform=H.resetTransform,H.__originalClip=H.clip,H.__originalMoveTo=H.moveTo,H.__originalLineTo=H.lineTo,H.__originalBezierCurveTo=H.bezierCurveTo,H.__originalRect=H.rect,H.__originalClosePath=H.closePath,H.__originalBeginPath=H.beginPath,H._removeMirroring=()=>{H.save=H.__originalSave,H.restore=H.__originalRestore,H.rotate=H.__originalRotate,H.scale=H.__originalScale,H.translate=H.__originalTranslate,H.transform=H.__originalTransform,H.setTransform=H.__originalSetTransform,H.resetTransform=H.__originalResetTransform,H.clip=H.__originalClip,H.moveTo=H.__originalMoveTo,H.lineTo=H.__originalLineTo,H.bezierCurveTo=H.__originalBezierCurveTo,H.rect=H.__originalRect,H.closePath=H.__originalClosePath,H.beginPath=H.__originalBeginPath,delete H._removeMirroring},H.save=function(){h.save(),this.__originalSave()},H.restore=function(){h.restore(),this.__originalRestore()},H.translate=function(T,O){h.translate(T,O),this.__originalTranslate(T,O)},H.scale=function(T,O){h.scale(T,O),this.__originalScale(T,O)},H.transform=function(T,O,$,W,s,d){h.transform(T,O,$,W,s,d),this.__originalTransform(T,O,$,W,s,d)},H.setTransform=function(T,O,$,W,s,d){h.setTransform(T,O,$,W,s,d),this.__originalSetTransform(T,O,$,W,s,d)},H.resetTransform=function(){h.resetTransform(),this.__originalResetTransform()},H.rotate=function(T){h.rotate(T),this.__originalRotate(T)},H.clip=function(T){h.clip(T),this.__originalClip(T)},H.moveTo=function(c,T){h.moveTo(c,T),this.__originalMoveTo(c,T)},H.lineTo=function(c,T){h.lineTo(c,T),this.__originalLineTo(c,T)},H.bezierCurveTo=function(c,T,O,$,W,s){h.bezierCurveTo(c,T,O,$,W,s),this.__originalBezierCurveTo(c,T,O,$,W,s)},H.rect=function(c,T,O,$){h.rect(c,T,O,$),this.__originalRect(c,T,O,$)},H.closePath=function(){h.closePath(),this.__originalClosePath()},H.beginPath=function(){h.beginPath(),this.__originalBeginPath()}}class r{constructor(h){this.canvasFactory=h,this.cache=Object.create(null)}getCanvas(h,c,T){let O;return this.cache[h]!==void 0?(O=this.cache[h],this.canvasFactory.reset(O,c,T)):(O=this.canvasFactory.create(c,T),this.cache[h]=O),O}delete(h){delete this.cache[h]}clear(){for(const h in this.cache){const c=this.cache[h];this.canvasFactory.destroy(c),delete this.cache[h]}}}function o(H,h,c,T,O,$,W,s,d,C){const[y,k,N,D,p,L]=(0,f.getCurrentTransform)(H);if(k===0&&N===0){const Z=W*y+p,At=Math.round(Z),kt=s*D+L,Mt=Math.round(kt),St=(W+d)*y+p,Ht=Math.abs(Math.round(St)-At)||1,Ut=(s+C)*D+L,Nt=Math.abs(Math.round(Ut)-Mt)||1;return H.setTransform(Math.sign(y),0,0,Math.sign(D),At,Mt),H.drawImage(h,c,T,O,$,0,0,Ht,Nt),H.setTransform(y,k,N,D,p,L),[Ht,Nt]}if(y===0&&D===0){const Z=s*N+p,At=Math.round(Z),kt=W*k+L,Mt=Math.round(kt),St=(s+C)*N+p,Ht=Math.abs(Math.round(St)-At)||1,Ut=(W+d)*k+L,Nt=Math.abs(Math.round(Ut)-Mt)||1;return H.setTransform(0,Math.sign(k),Math.sign(N),0,At,Mt),H.drawImage(h,c,T,O,$,0,0,Nt,Ht),H.setTransform(y,k,N,D,p,L),[Nt,Ht]}H.drawImage(h,c,T,O,$,W,s,d,C);const _t=Math.hypot(y,k),z=Math.hypot(N,D);return[_t*d,z*C]}function v(H){const{width:h,height:c}=H;if(h>F||c>F)return null;const T=1e3,O=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),$=h+1;let W=new Uint8Array($*(c+1)),s,d,C;const y=h+7&-8;let k=new Uint8Array(y*c),N=0;for(const z of H.data){let Z=128;for(;Z>0;)k[N++]=z&Z?0:255,Z>>=1}let D=0;for(N=0,k[N]!==0&&(W[0]=1,++D),d=1;d<h;d++)k[N]!==k[N+1]&&(W[d]=k[N]?2:1,++D),N++;for(k[N]!==0&&(W[d]=2,++D),s=1;s<c;s++){N=s*y,C=s*$,k[N-y]!==k[N]&&(W[C]=k[N]?1:8,++D);let z=(k[N]?4:0)+(k[N-y]?8:0);for(d=1;d<h;d++)z=(z>>2)+(k[N+1]?4:0)+(k[N-y+1]?8:0),O[z]&&(W[C+d]=O[z],++D),N++;if(k[N-y]!==k[N]&&(W[C+d]=k[N]?2:4,++D),D>T)return null}for(N=y*(c-1),C=s*$,k[N]!==0&&(W[C]=8,++D),d=1;d<h;d++)k[N]!==k[N+1]&&(W[C+d]=k[N]?4:8,++D),N++;if(k[N]!==0&&(W[C+d]=4,++D),D>T)return null;const p=new Int32Array([0,$,-1,0,-$,0,0,0,1]),L=new Path2D;for(s=0;D&&s<=c;s++){let z=s*$;const Z=z+h;for(;z<Z&&!W[z];)z++;if(z===Z)continue;L.moveTo(z%$,s);const At=z;let kt=W[z];do{const Mt=p[kt];do z+=Mt;while(!W[z]);const St=W[z];St!==5&&St!==10?(kt=St,W[z]=0):(kt=St&51*kt>>4,W[z]&=kt>>2|kt<<2),L.lineTo(z%$,z/$|0),W[z]||--D}while(At!==z);--s}return k=null,W=null,function(z){z.save(),z.scale(1/h,-1/c),z.translate(0,-c),z.fill(L),z.beginPath(),z.restore()}}class g{constructor(h,c){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=_.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=_.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=_.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=null,this.startNewPathAndClipBox([0,0,h,c])}clone(){const h=Object.create(this);return h.clipBox=this.clipBox.slice(),h}setCurrentPoint(h,c){this.x=h,this.y=c}updatePathMinMax(h,c,T){[c,T]=_.Util.applyTransform([c,T],h),this.minX=Math.min(this.minX,c),this.minY=Math.min(this.minY,T),this.maxX=Math.max(this.maxX,c),this.maxY=Math.max(this.maxY,T)}updateRectMinMax(h,c){const T=_.Util.applyTransform(c,h),O=_.Util.applyTransform(c.slice(2),h);this.minX=Math.min(this.minX,T[0],O[0]),this.minY=Math.min(this.minY,T[1],O[1]),this.maxX=Math.max(this.maxX,T[0],O[0]),this.maxY=Math.max(this.maxY,T[1],O[1])}updateScalingPathMinMax(h,c){_.Util.scaleMinMax(h,c),this.minX=Math.min(this.minX,c[0]),this.maxX=Math.max(this.maxX,c[1]),this.minY=Math.min(this.minY,c[2]),this.maxY=Math.max(this.maxY,c[3])}updateCurvePathMinMax(h,c,T,O,$,W,s,d,C,y){const k=_.Util.bezierBoundingBox(c,T,O,$,W,s,d,C);if(y){y[0]=Math.min(y[0],k[0],k[2]),y[1]=Math.max(y[1],k[0],k[2]),y[2]=Math.min(y[2],k[1],k[3]),y[3]=Math.max(y[3],k[1],k[3]);return}this.updateRectMinMax(h,k)}getPathBoundingBox(h=V.PathType.FILL,c=null){const T=[this.minX,this.minY,this.maxX,this.maxY];if(h===V.PathType.STROKE){c||(0,_.unreachable)("Stroke bounding box must include transform.");const O=_.Util.singularValueDecompose2dScale(c),$=O[0]*this.lineWidth/2,W=O[1]*this.lineWidth/2;T[0]-=$,T[1]-=W,T[2]+=$,T[3]+=W}return T}updateClipFromPath(){const h=_.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(h||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(h){this.clipBox=h,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(h=V.PathType.FILL,c=null){return _.Util.intersect(this.clipBox,this.getPathBoundingBox(h,c))}}function u(H,h,c=null){if(typeof ImageData<"u"&&h instanceof ImageData){H.putImageData(h,0,0);return}const T=h.height,O=h.width,$=T%l,W=(T-$)/l,s=$===0?W:W+1,d=H.createImageData(O,l);let C=0,y;const k=h.data,N=d.data;let D,p,L,_t,z,Z,At,kt;if(c)switch(c.length){case 1:z=c[0],Z=c[0],At=c[0],kt=c[0];break;case 4:z=c[0],Z=c[1],At=c[2],kt=c[3];break}if(h.kind===_.ImageKind.GRAYSCALE_1BPP){const Mt=k.byteLength,St=new Uint32Array(N.buffer,0,N.byteLength>>2),Ht=St.length,Ut=O+7>>3;let Nt=4294967295,zt=_.FeatureTest.isLittleEndian?4278190080:255;for(kt&&kt[0]===255&&kt[255]===0&&([Nt,zt]=[zt,Nt]),D=0;D<s;D++){for(L=D<W?l:$,y=0,p=0;p<L;p++){const Gt=Mt-C;let Zt=0;const Xt=Gt>Ut?O:Gt*8-7,Vt=Xt&-8;let Yt=0,Jt=0;for(;Zt<Vt;Zt+=8)Jt=k[C++],St[y++]=Jt&128?Nt:zt,St[y++]=Jt&64?Nt:zt,St[y++]=Jt&32?Nt:zt,St[y++]=Jt&16?Nt:zt,St[y++]=Jt&8?Nt:zt,St[y++]=Jt&4?Nt:zt,St[y++]=Jt&2?Nt:zt,St[y++]=Jt&1?Nt:zt;for(;Zt<Xt;Zt++)Yt===0&&(Jt=k[C++],Yt=128),St[y++]=Jt&Yt?Nt:zt,Yt>>=1}for(;y<Ht;)St[y++]=0;H.putImageData(d,0,D*l)}}else if(h.kind===_.ImageKind.RGBA_32BPP){const Mt=!!(z||Z||At);for(p=0,_t=O*l*4,D=0;D<W;D++){if(N.set(k.subarray(C,C+_t)),C+=_t,Mt)for(let St=0;St<_t;St+=4)z&&(N[St+0]=z[N[St+0]]),Z&&(N[St+1]=Z[N[St+1]]),At&&(N[St+2]=At[N[St+2]]);H.putImageData(d,0,p),p+=l}if(D<s){if(_t=O*$*4,N.set(k.subarray(C,C+_t)),Mt)for(let St=0;St<_t;St+=4)z&&(N[St+0]=z[N[St+0]]),Z&&(N[St+1]=Z[N[St+1]]),At&&(N[St+2]=At[N[St+2]]);H.putImageData(d,0,p)}}else if(h.kind===_.ImageKind.RGB_24BPP){const Mt=!!(z||Z||At);for(L=l,_t=O*L,D=0;D<s;D++){for(D>=W&&(L=$,_t=O*L),y=0,p=_t;p--;)N[y++]=k[C++],N[y++]=k[C++],N[y++]=k[C++],N[y++]=255;if(Mt)for(let St=0;St<y;St+=4)z&&(N[St+0]=z[N[St+0]]),Z&&(N[St+1]=Z[N[St+1]]),At&&(N[St+2]=At[N[St+2]]);H.putImageData(d,0,D*l)}}else throw new Error(`bad image kind: ${h.kind}`)}function n(H,h){if(h.bitmap){H.drawImage(h.bitmap,0,0);return}const c=h.height,T=h.width,O=c%l,$=(c-O)/l,W=O===0?$:$+1,s=H.createImageData(T,l);let d=0;const C=h.data,y=s.data;for(let k=0;k<W;k++){const N=k<$?l:O;({srcPos:d}=(0,q.applyMaskImageData)({src:C,srcPos:d,dest:y,width:T,height:N})),H.putImageData(s,0,k*l)}}function i(H,h){const c=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font"];for(let T=0,O=c.length;T<O;T++){const $=c[T];H[$]!==void 0&&(h[$]=H[$])}H.setLineDash!==void 0&&(h.setLineDash(H.getLineDash()),h.lineDashOffset=H.lineDashOffset)}function e(H,h){H.strokeStyle=H.fillStyle=h||"#000000",H.fillRule="nonzero",H.globalAlpha=1,H.lineWidth=1,H.lineCap="butt",H.lineJoin="miter",H.miterLimit=10,H.globalCompositeOperation="source-over",H.font="10px sans-serif",H.setLineDash!==void 0&&(H.setLineDash([]),H.lineDashOffset=0)}function E(H,h,c,T){const O=H.length;for(let $=3;$<O;$+=4){const W=H[$];if(W===0)H[$-3]=h,H[$-2]=c,H[$-1]=T;else if(W<255){const s=255-W;H[$-3]=H[$-3]*W+h*s>>8,H[$-2]=H[$-2]*W+c*s>>8,H[$-1]=H[$-1]*W+T*s>>8}}}function x(H,h,c){const T=H.length,O=1/255;for(let $=3;$<T;$+=4){const W=c?c[H[$]]:H[$];h[$]=h[$]*W*O|0}}function j(H,h,c){const T=H.length;for(let O=3;O<T;O+=4){const $=H[O-3]*77+H[O-2]*152+H[O-1]*28;h[O]=c?h[O]*c[$>>8]>>8:h[O]*$>>16}}function I(H,h,c,T,O,$,W,s,d,C,y){const k=!!$,N=k?$[0]:0,D=k?$[1]:0,p=k?$[2]:0;let L;O==="Luminosity"?L=j:L=x;const z=Math.min(T,Math.ceil(1048576/c));for(let Z=0;Z<T;Z+=z){const At=Math.min(z,T-Z),kt=H.getImageData(s-C,Z+(d-y),c,At),Mt=h.getImageData(s,Z+d,c,At);k&&E(kt.data,N,D,p),L(kt.data,Mt.data,W),h.putImageData(Mt,s,Z+d)}}function yt(H,h,c,T){const O=T[0],$=T[1],W=T[2]-O,s=T[3]-$;W===0||s===0||(I(h.context,c,W,s,h.subtype,h.backdrop,h.transferMap,O,$,h.offsetX,h.offsetY),H.save(),H.globalAlpha=1,H.globalCompositeOperation="source-over",H.setTransform(1,0,0,1,0,0),H.drawImage(c.canvas,0,0),H.restore())}function wt(H,h){const c=_.Util.singularValueDecompose2dScale(H);c[0]=Math.fround(c[0]),c[1]=Math.fround(c[1]);const T=Math.fround((globalThis.devicePixelRatio||1)*f.PixelsPerInch.PDF_TO_CSS_UNITS);return h!==void 0?h:c[0]<=T||c[1]<=T}const bt=["butt","round","square"],K=["miter","round","bevel"],B={},U={},Rt=class Rt{constructor(h,c,T,O,$,W,s,d){Ot(this,Q);this.ctx=h,this.current=new g(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=c,this.objs=T,this.canvasFactory=O,this.imageLayer=$,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=[],this.optionalContentConfig=W,this.cachedCanvases=new r(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=s,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.backgroundColor=(d==null?void 0:d.background)||null,this.foregroundColor=(d==null?void 0:d.foreground)||null,this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(h,c=null){return typeof h=="string"?h.startsWith("g_")?this.commonObjs.get(h):this.objs.get(h):c}beginDrawing({transform:h,viewport:c,transparency:T=!1,background:O=null}){const $=this.ctx.canvas.width,W=this.ctx.canvas.height,s=O||"#ffffff";if(this.ctx.save(),this.foregroundColor&&this.backgroundColor){this.ctx.fillStyle=this.foregroundColor;const d=this.foregroundColor=this.ctx.fillStyle;this.ctx.fillStyle=this.backgroundColor;const C=this.backgroundColor=this.ctx.fillStyle;let y=!0,k=s;if(this.ctx.fillStyle=s,k=this.ctx.fillStyle,y=typeof k=="string"&&/^#[0-9A-Fa-f]{6}$/.test(k),d==="#000000"&&C==="#ffffff"||d===C||!y)this.foregroundColor=this.backgroundColor=null;else{const[N,D,p]=(0,f.getRGB)(k),L=z=>(z/=255,z<=.03928?z/12.92:((z+.055)/1.055)**2.4),_t=Math.round(.2126*L(N)+.7152*L(D)+.0722*L(p));this.selectColor=(z,Z,At)=>{const kt=.2126*L(z)+.7152*L(Z)+.0722*L(At);return Math.round(kt)===_t?C:d}}}if(this.ctx.fillStyle=this.backgroundColor||s,this.ctx.fillRect(0,0,$,W),this.ctx.restore(),T){const d=this.cachedCanvases.getCanvas("transparent",$,W);this.compositeCtx=this.ctx,this.transparentCanvas=d.canvas,this.ctx=d.context,this.ctx.save(),this.ctx.transform(...(0,f.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),e(this.ctx,this.foregroundColor),h&&(this.ctx.transform(...h),this.outputScaleX=h[0],this.outputScaleY=h[0]),this.ctx.transform(...c.transform),this.viewportScale=c.scale,this.baseTransform=(0,f.getCurrentTransform)(this.ctx),this.imageLayer&&((0,f.deprecated)("The `imageLayer` functionality will be removed in the future."),this.imageLayer.beginLayout())}executeOperatorList(h,c,T,O){const $=h.argsArray,W=h.fnArray;let s=c||0;const d=$.length;if(d===s)return s;const C=d-s>S&&typeof T=="function",y=C?Date.now()+P:0;let k=0;const N=this.commonObjs,D=this.objs;let p;for(;;){if(O!==void 0&&s===O.nextBreakPoint)return O.breakIt(s,T),s;if(p=W[s],p!==_.OPS.dependency)this[p].apply(this,$[s]);else for(const L of $[s]){const _t=L.startsWith("g_")?N:D;if(!_t.has(L))return _t.get(L,T),s}if(s++,s===d)return s;if(C&&++k>S){if(Date.now()>y)return T(),s;k=0}}}endDrawing(){Dt(this,Q,dn).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const h of this._cachedBitmapsMap.values()){for(const c of h.values())typeof HTMLCanvasElement<"u"&&c instanceof HTMLCanvasElement&&(c.width=c.height=0);h.clear()}this._cachedBitmapsMap.clear(),this.imageLayer&&this.imageLayer.endLayout()}_scaleImage(h,c){const T=h.width,O=h.height;let $=Math.max(Math.hypot(c[0],c[1]),1),W=Math.max(Math.hypot(c[2],c[3]),1),s=T,d=O,C="prescale1",y,k;for(;$>2&&s>1||W>2&&d>1;){let N=s,D=d;$>2&&s>1&&(N=Math.ceil(s/2),$/=s/N),W>2&&d>1&&(D=Math.ceil(d/2),W/=d/D),y=this.cachedCanvases.getCanvas(C,N,D),k=y.context,k.clearRect(0,0,N,D),k.drawImage(h,0,0,s,d,0,0,N,D),h=y.canvas,s=N,d=D,C=C==="prescale1"?"prescale2":"prescale1"}return{img:h,paintWidth:s,paintHeight:d}}_createMaskCanvas(h){const c=this.ctx,{width:T,height:O}=h,$=this.current.fillColor,W=this.current.patternFill,s=(0,f.getCurrentTransform)(c);let d,C,y,k;if((h.bitmap||h.data)&&h.count>1){const Ht=h.bitmap||h.data.buffer,Ut=s.slice(0,4);C=JSON.stringify(W?Ut:[Ut,$]),d=this._cachedBitmapsMap.get(Ht),d||(d=new Map,this._cachedBitmapsMap.set(Ht,d));const Nt=d.get(C);if(Nt&&!W){const zt=Math.round(Math.min(s[0],s[2])+s[4]),Gt=Math.round(Math.min(s[1],s[3])+s[5]);return{canvas:Nt,offsetX:zt,offsetY:Gt}}y=Nt}y||(k=this.cachedCanvases.getCanvas("maskCanvas",T,O),n(k.context,h));let N=_.Util.transform(s,[1/T,0,0,-1/O,0,0]);N=_.Util.transform(N,[1,0,0,1,0,-O]);const D=_.Util.applyTransform([0,0],N),p=_.Util.applyTransform([T,O],N),L=_.Util.normalizeRect([D[0],D[1],p[0],p[1]]),_t=Math.round(L[2]-L[0])||1,z=Math.round(L[3]-L[1])||1,Z=this.cachedCanvases.getCanvas("fillCanvas",_t,z),At=Z.context,kt=Math.min(D[0],p[0]),Mt=Math.min(D[1],p[1]);At.translate(-kt,-Mt),At.transform(...N),y||(y=this._scaleImage(k.canvas,(0,f.getCurrentTransformInverse)(At)),y=y.img,d&&W&&d.set(C,y)),At.imageSmoothingEnabled=wt((0,f.getCurrentTransform)(At),h.interpolate),o(At,y,0,0,y.width,y.height,0,0,T,O),At.globalCompositeOperation="source-in";const St=_.Util.transform((0,f.getCurrentTransformInverse)(At),[1,0,0,1,-kt,-Mt]);return At.fillStyle=W?$.getPattern(c,this,St,V.PathType.FILL):$,At.fillRect(0,0,T,O),d&&!W&&(this.cachedCanvases.delete("fillCanvas"),d.set(C,Z.canvas)),{canvas:Z.canvas,offsetX:Math.round(kt),offsetY:Math.round(Mt)}}setLineWidth(h){h!==this.current.lineWidth&&(this._cachedScaleForStroking=null),this.current.lineWidth=h,this.ctx.lineWidth=h}setLineCap(h){this.ctx.lineCap=bt[h]}setLineJoin(h){this.ctx.lineJoin=K[h]}setMiterLimit(h){this.ctx.miterLimit=h}setDash(h,c){const T=this.ctx;T.setLineDash!==void 0&&(T.setLineDash(h),T.lineDashOffset=c)}setRenderingIntent(h){}setFlatness(h){}setGState(h){for(let c=0,T=h.length;c<T;c++){const O=h[c],$=O[0],W=O[1];switch($){case"LW":this.setLineWidth(W);break;case"LC":this.setLineCap(W);break;case"LJ":this.setLineJoin(W);break;case"ML":this.setMiterLimit(W);break;case"D":this.setDash(W[0],W[1]);break;case"RI":this.setRenderingIntent(W);break;case"FL":this.setFlatness(W);break;case"Font":this.setFont(W[0],W[1]);break;case"CA":this.current.strokeAlpha=O[1];break;case"ca":this.current.fillAlpha=O[1],this.ctx.globalAlpha=O[1];break;case"BM":this.ctx.globalCompositeOperation=W;break;case"SMask":this.current.activeSMask=W?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.current.transferMaps=W}}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const h=this.inSMaskMode;this.current.activeSMask&&!h?this.beginSMaskMode():!this.current.activeSMask&&h&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const h=this.ctx.canvas.width,c=this.ctx.canvas.height,T="smaskGroupAt"+this.groupLevel,O=this.cachedCanvases.getCanvas(T,h,c);this.suspendedCtx=this.ctx,this.ctx=O.context;const $=this.ctx;$.setTransform(...(0,f.getCurrentTransform)(this.suspendedCtx)),i(this.suspendedCtx,$),t($,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),i(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(h){if(!this.current.activeSMask)return;h?(h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]),h[2]=Math.ceil(h[2]),h[3]=Math.ceil(h[3])):h=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const c=this.current.activeSMask,T=this.suspendedCtx;yt(T,c,this.ctx,h),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?(i(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const h=this.current;this.stateStack.push(h),this.current=h.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),i(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null)}transform(h,c,T,O,$,W){this.ctx.transform(h,c,T,O,$,W),this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null}constructPath(h,c,T){const O=this.ctx,$=this.current;let W=$.x,s=$.y,d,C;const y=(0,f.getCurrentTransform)(O),k=y[0]===0&&y[3]===0||y[1]===0&&y[2]===0,N=k?T.slice(0):null;for(let D=0,p=0,L=h.length;D<L;D++)switch(h[D]|0){case _.OPS.rectangle:W=c[p++],s=c[p++];const _t=c[p++],z=c[p++],Z=W+_t,At=s+z;O.moveTo(W,s),_t===0||z===0?O.lineTo(Z,At):(O.lineTo(Z,s),O.lineTo(Z,At),O.lineTo(W,At)),k||$.updateRectMinMax(y,[W,s,Z,At]),O.closePath();break;case _.OPS.moveTo:W=c[p++],s=c[p++],O.moveTo(W,s),k||$.updatePathMinMax(y,W,s);break;case _.OPS.lineTo:W=c[p++],s=c[p++],O.lineTo(W,s),k||$.updatePathMinMax(y,W,s);break;case _.OPS.curveTo:d=W,C=s,W=c[p+4],s=c[p+5],O.bezierCurveTo(c[p],c[p+1],c[p+2],c[p+3],W,s),$.updateCurvePathMinMax(y,d,C,c[p],c[p+1],c[p+2],c[p+3],W,s,N),p+=6;break;case _.OPS.curveTo2:d=W,C=s,O.bezierCurveTo(W,s,c[p],c[p+1],c[p+2],c[p+3]),$.updateCurvePathMinMax(y,d,C,W,s,c[p],c[p+1],c[p+2],c[p+3],N),W=c[p+2],s=c[p+3],p+=4;break;case _.OPS.curveTo3:d=W,C=s,W=c[p+2],s=c[p+3],O.bezierCurveTo(c[p],c[p+1],W,s,W,s),$.updateCurvePathMinMax(y,d,C,c[p],c[p+1],W,s,W,s,N),p+=4;break;case _.OPS.closePath:O.closePath();break}k&&$.updateScalingPathMinMax(y,N),$.setCurrentPoint(W,s)}closePath(){this.ctx.closePath()}stroke(h){h=typeof h<"u"?h:!0;const c=this.ctx,T=this.current.strokeColor;c.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof T=="object"&&(T!=null&&T.getPattern)?(c.save(),c.strokeStyle=T.getPattern(c,this,(0,f.getCurrentTransformInverse)(c),V.PathType.STROKE),this.rescaleAndStroke(!1),c.restore()):this.rescaleAndStroke(!0)),h&&this.consumePath(this.current.getClippedPathBoundingBox()),c.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(h){h=typeof h<"u"?h:!0;const c=this.ctx,T=this.current.fillColor,O=this.current.patternFill;let $=!1;O&&(c.save(),c.fillStyle=T.getPattern(c,this,(0,f.getCurrentTransformInverse)(c),V.PathType.FILL),$=!0);const W=this.current.getClippedPathBoundingBox();this.contentVisible&&W!==null&&(this.pendingEOFill?(c.fill("evenodd"),this.pendingEOFill=!1):c.fill()),$&&c.restore(),h&&this.consumePath(W)}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=B}eoClip(){this.pendingClip=U}beginText(){this.current.textMatrix=_.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const h=this.pendingTextPaths,c=this.ctx;if(h===void 0){c.beginPath();return}c.save(),c.beginPath();for(const T of h)c.setTransform(...T.transform),c.translate(T.x,T.y),T.addToPath(c,T.fontSize);c.restore(),c.clip(),c.beginPath(),delete this.pendingTextPaths}setCharSpacing(h){this.current.charSpacing=h}setWordSpacing(h){this.current.wordSpacing=h}setHScale(h){this.current.textHScale=h/100}setLeading(h){this.current.leading=-h}setFont(h,c){const T=this.commonObjs.get(h),O=this.current;if(!T)throw new Error(`Can't find font for ${h}`);if(O.fontMatrix=T.fontMatrix||_.FONT_IDENTITY_MATRIX,(O.fontMatrix[0]===0||O.fontMatrix[3]===0)&&(0,_.warn)("Invalid font matrix for font "+h),c<0?(c=-c,O.fontDirection=-1):O.fontDirection=1,this.current.font=T,this.current.fontSize=c,T.isType3Font)return;const $=T.loadedName||"sans-serif";let W="normal";T.black?W="900":T.bold&&(W="bold");const s=T.italic?"italic":"normal",d=`"${$}", ${T.fallbackName}`;let C=c;c<M?C=M:c>b&&(C=b),this.current.fontSizeScale=c/C,this.ctx.font=`${s} ${W} ${C}px ${d}`}setTextRenderingMode(h){this.current.textRenderingMode=h}setTextRise(h){this.current.textRise=h}moveText(h,c){this.current.x=this.current.lineX+=h,this.current.y=this.current.lineY+=c}setLeadingMoveText(h,c){this.setLeading(-c),this.moveText(h,c)}setTextMatrix(h,c,T,O,$,W){this.current.textMatrix=[h,c,T,O,$,W],this.current.textMatrixScale=Math.hypot(h,c),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(h,c,T,O){const $=this.ctx,W=this.current,s=W.font,d=W.textRenderingMode,C=W.fontSize/W.fontSizeScale,y=d&_.TextRenderingMode.FILL_STROKE_MASK,k=!!(d&_.TextRenderingMode.ADD_TO_PATH_FLAG),N=W.patternFill&&!s.missingFile;let D;(s.disableFontFace||k||N)&&(D=s.getPathGenerator(this.commonObjs,h)),s.disableFontFace||N?($.save(),$.translate(c,T),$.beginPath(),D($,C),O&&$.setTransform(...O),(y===_.TextRenderingMode.FILL||y===_.TextRenderingMode.FILL_STROKE)&&$.fill(),(y===_.TextRenderingMode.STROKE||y===_.TextRenderingMode.FILL_STROKE)&&$.stroke(),$.restore()):((y===_.TextRenderingMode.FILL||y===_.TextRenderingMode.FILL_STROKE)&&$.fillText(h,c,T),(y===_.TextRenderingMode.STROKE||y===_.TextRenderingMode.FILL_STROKE)&&$.strokeText(h,c,T)),k&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:(0,f.getCurrentTransform)($),x:c,y:T,fontSize:C,addToPath:D})}get isFontSubpixelAAEnabled(){const{context:h}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);h.scale(1.5,1),h.fillText("I",0,10);const c=h.getImageData(0,0,10,10).data;let T=!1;for(let O=3;O<c.length;O+=4)if(c[O]>0&&c[O]<255){T=!0;break}return(0,_.shadow)(this,"isFontSubpixelAAEnabled",T)}showText(h){const c=this.current,T=c.font;if(T.isType3Font)return this.showType3Text(h);const O=c.fontSize;if(O===0)return;const $=this.ctx,W=c.fontSizeScale,s=c.charSpacing,d=c.wordSpacing,C=c.fontDirection,y=c.textHScale*C,k=h.length,N=T.vertical,D=N?1:-1,p=T.defaultVMetrics,L=O*c.fontMatrix[0],_t=c.textRenderingMode===_.TextRenderingMode.FILL&&!T.disableFontFace&&!c.patternFill;$.save(),$.transform(...c.textMatrix),$.translate(c.x,c.y+c.textRise),C>0?$.scale(y,-1):$.scale(y,1);let z;if(c.patternFill){$.save();const St=c.fillColor.getPattern($,this,(0,f.getCurrentTransformInverse)($),V.PathType.FILL);z=(0,f.getCurrentTransform)($),$.restore(),$.fillStyle=St}let Z=c.lineWidth;const At=c.textMatrixScale;if(At===0||Z===0){const St=c.textRenderingMode&_.TextRenderingMode.FILL_STROKE_MASK;(St===_.TextRenderingMode.STROKE||St===_.TextRenderingMode.FILL_STROKE)&&(Z=this.getSinglePixelWidth())}else Z/=At;W!==1&&($.scale(W,W),Z/=W),$.lineWidth=Z;let kt=0,Mt;for(Mt=0;Mt<k;++Mt){const St=h[Mt];if(typeof St=="number"){kt+=D*St*O/1e3;continue}let Ht=!1;const Ut=(St.isSpace?d:0)+s,Nt=St.fontChar,zt=St.accent;let Gt,Zt,Xt=St.width;if(N){const Yt=St.vmetric||p,Jt=-(St.vmetric?Yt[1]:Xt*.5)*L,oe=Yt[2]*L;Xt=Yt?-Yt[0]:Xt,Gt=Jt/W,Zt=(kt+oe)/W}else Gt=kt/W,Zt=0;if(T.remeasure&&Xt>0){const Yt=$.measureText(Nt).width*1e3/O*W;if(Xt<Yt&&this.isFontSubpixelAAEnabled){const Jt=Xt/Yt;Ht=!0,$.save(),$.scale(Jt,1),Gt/=Jt}else Xt!==Yt&&(Gt+=(Xt-Yt)/2e3*O/W)}if(this.contentVisible&&(St.isInFont||T.missingFile)){if(_t&&!zt)$.fillText(Nt,Gt,Zt);else if(this.paintChar(Nt,Gt,Zt,z),zt){const Yt=Gt+O*zt.offset.x/W,Jt=Zt-O*zt.offset.y/W;this.paintChar(zt.fontChar,Yt,Jt,z)}}let Vt;N?Vt=Xt*L-Ut*C:Vt=Xt*L+Ut*C,kt+=Vt,Ht&&$.restore()}N?c.y-=kt:c.x+=kt*y,$.restore(),this.compose()}showType3Text(h){const c=this.ctx,T=this.current,O=T.font,$=T.fontSize,W=T.fontDirection,s=O.vertical?1:-1,d=T.charSpacing,C=T.wordSpacing,y=T.textHScale*W,k=T.fontMatrix||_.FONT_IDENTITY_MATRIX,N=h.length,D=T.textRenderingMode===_.TextRenderingMode.INVISIBLE;let p,L,_t,z;if(!(D||$===0)){for(this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null,c.save(),c.transform(...T.textMatrix),c.translate(T.x,T.y),c.scale(y,W),p=0;p<N;++p){if(L=h[p],typeof L=="number"){z=s*L*$/1e3,this.ctx.translate(z,0),T.x+=z*y;continue}const Z=(L.isSpace?C:0)+d,At=O.charProcOperatorList[L.operatorListId];if(!At){(0,_.warn)(`Type3 character "${L.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=L,this.save(),c.scale($,$),c.transform(...k),this.executeOperatorList(At),this.restore()),_t=_.Util.applyTransform([L.width,0],k)[0]*$+Z,c.translate(_t,0),T.x+=_t*y}c.restore(),this.processingType3=null}}setCharWidth(h,c){}setCharWidthAndBounds(h,c,T,O,$,W){this.ctx.rect(T,O,$-T,W-O),this.ctx.clip(),this.endPath()}getColorN_Pattern(h){let c;if(h[0]==="TilingPattern"){const T=h[1],O=this.baseTransform||(0,f.getCurrentTransform)(this.ctx),$={createCanvasGraphics:W=>new Rt(W,this.commonObjs,this.objs,this.canvasFactory)};c=new V.TilingPattern(h,T,this.ctx,$,O)}else c=this._getPattern(h[1],h[2]);return c}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(h,c,T){var $;const O=(($=this.selectColor)==null?void 0:$.call(this,h,c,T))||_.Util.makeHexColor(h,c,T);this.ctx.strokeStyle=O,this.current.strokeColor=O}setFillRGBColor(h,c,T){var $;const O=(($=this.selectColor)==null?void 0:$.call(this,h,c,T))||_.Util.makeHexColor(h,c,T);this.ctx.fillStyle=O,this.current.fillColor=O,this.current.patternFill=!1}_getPattern(h,c=null){let T;return this.cachedPatterns.has(h)?T=this.cachedPatterns.get(h):(T=(0,V.getShadingPattern)(this.objs.get(h)),this.cachedPatterns.set(h,T)),c&&(T.matrix=c),T}shadingFill(h){if(!this.contentVisible)return;const c=this.ctx;this.save();const T=this._getPattern(h);c.fillStyle=T.getPattern(c,this,(0,f.getCurrentTransformInverse)(c),V.PathType.SHADING);const O=(0,f.getCurrentTransformInverse)(c);if(O){const $=c.canvas,W=$.width,s=$.height,d=_.Util.applyTransform([0,0],O),C=_.Util.applyTransform([0,s],O),y=_.Util.applyTransform([W,0],O),k=_.Util.applyTransform([W,s],O),N=Math.min(d[0],C[0],y[0],k[0]),D=Math.min(d[1],C[1],y[1],k[1]),p=Math.max(d[0],C[0],y[0],k[0]),L=Math.max(d[1],C[1],y[1],k[1]);this.ctx.fillRect(N,D,p-N,L-D)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){(0,_.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,_.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(h,c){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(h)&&h.length===6&&this.transform(...h),this.baseTransform=(0,f.getCurrentTransform)(this.ctx),c)){const T=c[2]-c[0],O=c[3]-c[1];this.ctx.rect(c[0],c[1],T,O),this.current.updateRectMinMax((0,f.getCurrentTransform)(this.ctx),c),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(h){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const c=this.ctx;h.isolated||(0,_.info)("TODO: Support non-isolated groups."),h.knockout&&(0,_.warn)("Knockout groups not supported.");const T=(0,f.getCurrentTransform)(c);if(h.matrix&&c.transform(...h.matrix),!h.bbox)throw new Error("Bounding box is required.");let O=_.Util.getAxialAlignedBoundingBox(h.bbox,(0,f.getCurrentTransform)(c));const $=[0,0,c.canvas.width,c.canvas.height];O=_.Util.intersect(O,$)||[0,0,0,0];const W=Math.floor(O[0]),s=Math.floor(O[1]);let d=Math.max(Math.ceil(O[2])-W,1),C=Math.max(Math.ceil(O[3])-s,1),y=1,k=1;d>w&&(y=d/w,d=w),C>w&&(k=C/w,C=w),this.current.startNewPathAndClipBox([0,0,d,C]);let N="groupAt"+this.groupLevel;h.smask&&(N+="_smask_"+this.smaskCounter++%2);const D=this.cachedCanvases.getCanvas(N,d,C),p=D.context;p.scale(1/y,1/k),p.translate(-W,-s),p.transform(...T),h.smask?this.smaskStack.push({canvas:D.canvas,context:p,offsetX:W,offsetY:s,scaleX:y,scaleY:k,subtype:h.smask.subtype,backdrop:h.smask.backdrop,transferMap:h.smask.transferMap||null,startTransformInverse:null}):(c.setTransform(1,0,0,1,0,0),c.translate(W,s),c.scale(y,k),c.save()),i(c,p),this.ctx=p,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(c),this.groupLevel++}endGroup(h){if(!this.contentVisible)return;this.groupLevel--;const c=this.ctx,T=this.groupStack.pop();if(this.ctx=T,this.ctx.imageSmoothingEnabled=!1,h.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const O=(0,f.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...O);const $=_.Util.getAxialAlignedBoundingBox([0,0,c.canvas.width,c.canvas.height],O);this.ctx.drawImage(c.canvas,0,0),this.ctx.restore(),this.compose($)}}beginAnnotation(h,c,T,O,$){if(Dt(this,Q,dn).call(this),e(this.ctx,this.foregroundColor),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(c)&&c.length===4){const W=c[2]-c[0],s=c[3]-c[1];if($&&this.annotationCanvasMap){T=T.slice(),T[4]-=c[0],T[5]-=c[1],c=c.slice(),c[0]=c[1]=0,c[2]=W,c[3]=s;const[d,C]=_.Util.singularValueDecompose2dScale((0,f.getCurrentTransform)(this.ctx)),{viewportScale:y}=this,k=Math.ceil(W*this.outputScaleX*y),N=Math.ceil(s*this.outputScaleY*y);this.annotationCanvas=this.canvasFactory.create(k,N);const{canvas:D,context:p}=this.annotationCanvas;this.annotationCanvasMap.set(h,D),this.annotationCanvas.savedCtx=this.ctx,this.ctx=p,this.ctx.setTransform(d,0,0,-C,0,s*C),e(this.ctx,this.foregroundColor)}else e(this.ctx,this.foregroundColor),this.ctx.rect(c[0],c[1],W,s),this.ctx.clip(),this.endPath()}this.current=new g(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...T),this.transform(...O)}endAnnotation(){this.annotationCanvas&&(this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(h){if(!this.contentVisible)return;const c=h.count;h=this.getObject(h.data,h),h.count=c;const T=this.ctx,O=this.processingType3;if(O&&(O.compiled===void 0&&(O.compiled=v(h)),O.compiled)){O.compiled(T);return}const $=this._createMaskCanvas(h),W=$.canvas;T.save(),T.setTransform(1,0,0,1,0,0),T.drawImage(W,$.offsetX,$.offsetY),T.restore(),this.compose()}paintImageMaskXObjectRepeat(h,c,T=0,O=0,$,W){if(!this.contentVisible)return;h=this.getObject(h.data,h);const s=this.ctx;s.save();const d=(0,f.getCurrentTransform)(s);s.transform(c,T,O,$,0,0);const C=this._createMaskCanvas(h);s.setTransform(1,0,0,1,0,0);for(let y=0,k=W.length;y<k;y+=2){const N=_.Util.transform(d,[c,T,O,$,W[y],W[y+1]]),[D,p]=_.Util.applyTransform([0,0],N);s.drawImage(C.canvas,D,p)}s.restore(),this.compose()}paintImageMaskXObjectGroup(h){if(!this.contentVisible)return;const c=this.ctx,T=this.current.fillColor,O=this.current.patternFill;for(const $ of h){const{data:W,width:s,height:d,transform:C}=$,y=this.cachedCanvases.getCanvas("maskCanvas",s,d),k=y.context;k.save();const N=this.getObject(W,$);n(k,N),k.globalCompositeOperation="source-in",k.fillStyle=O?T.getPattern(k,this,(0,f.getCurrentTransformInverse)(c),V.PathType.FILL):T,k.fillRect(0,0,s,d),k.restore(),c.save(),c.transform(...C),c.scale(1,-1),o(c,y.canvas,0,0,s,d,0,-1,1,1),c.restore()}this.compose()}paintImageXObject(h){if(!this.contentVisible)return;const c=this.getObject(h);if(!c){(0,_.warn)("Dependent image isn't ready yet");return}this.paintInlineImageXObject(c)}paintImageXObjectRepeat(h,c,T,O){if(!this.contentVisible)return;const $=this.getObject(h);if(!$){(0,_.warn)("Dependent image isn't ready yet");return}const W=$.width,s=$.height,d=[];for(let C=0,y=O.length;C<y;C+=2)d.push({transform:[c,0,0,T,O[C],O[C+1]],x:0,y:0,w:W,h:s});this.paintInlineImageXObjectGroup($,d)}paintInlineImageXObject(h){if(!this.contentVisible)return;const c=h.width,T=h.height,O=this.ctx;this.save(),O.scale(1/c,-1/T);let $;if(typeof HTMLElement=="function"&&h instanceof HTMLElement||!h.data)$=h;else{const C=this.cachedCanvases.getCanvas("inlineImage",c,T),y=C.context;u(y,h,this.current.transferMaps),$=C.canvas}const W=this._scaleImage($,(0,f.getCurrentTransformInverse)(O));O.imageSmoothingEnabled=wt((0,f.getCurrentTransform)(O),h.interpolate);const[s,d]=o(O,W.img,0,0,W.paintWidth,W.paintHeight,0,-T,c,T);if(this.imageLayer){const[C,y]=_.Util.applyTransform([0,-T],(0,f.getCurrentTransform)(this.ctx));this.imageLayer.appendImage({imgData:h,left:C,top:y,width:s,height:d})}this.compose(),this.restore()}paintInlineImageXObjectGroup(h,c){if(!this.contentVisible)return;const T=this.ctx,O=h.width,$=h.height,W=this.cachedCanvases.getCanvas("inlineImage",O,$),s=W.context;u(s,h,this.current.transferMaps);for(const d of c){if(T.save(),T.transform(...d.transform),T.scale(1,-1),o(T,W.canvas,d.x,d.y,d.w,d.h,0,-1,1,1),this.imageLayer){const[C,y]=_.Util.applyTransform([d.x,d.y],(0,f.getCurrentTransform)(this.ctx));this.imageLayer.appendImage({imgData:h,left:C,top:y,width:O,height:$})}T.restore()}this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(h){}markPointProps(h,c){}beginMarkedContent(h){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(h,c){h==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(c)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(h){const c=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(h);const T=this.ctx;this.pendingClip&&(c||(this.pendingClip===U?T.clip("evenodd"):T.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),T.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const h=(0,f.getCurrentTransform)(this.ctx);if(h[1]===0&&h[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(h[0]),Math.abs(h[3]));else{const c=Math.abs(h[0]*h[3]-h[2]*h[1]),T=Math.hypot(h[0],h[2]),O=Math.hypot(h[1],h[3]);this._cachedGetSinglePixelWidth=Math.max(T,O)/c}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(!this._cachedScaleForStroking){const{lineWidth:h}=this.current,c=(0,f.getCurrentTransform)(this.ctx);let T,O;if(c[1]===0&&c[2]===0){const $=Math.abs(c[0]),W=Math.abs(c[3]);if(h===0)T=1/$,O=1/W;else{const s=$*h,d=W*h;T=s<1?1/s:1,O=d<1?1/d:1}}else{const $=Math.abs(c[0]*c[3]-c[2]*c[1]),W=Math.hypot(c[0],c[1]),s=Math.hypot(c[2],c[3]);if(h===0)T=s/$,O=W/$;else{const d=h*$;T=s>d?s/d:1,O=W>d?W/d:1}}this._cachedScaleForStroking=[T,O]}return this._cachedScaleForStroking}rescaleAndStroke(h){const{ctx:c}=this,{lineWidth:T}=this.current,[O,$]=this.getScaleForStroking();if(c.lineWidth=T||1,O===1&&$===1){c.stroke();return}let W,s,d;h&&(W=(0,f.getCurrentTransform)(c),s=c.getLineDash().slice(),d=c.lineDashOffset),c.scale(O,$);const C=Math.max(O,$);c.setLineDash(c.getLineDash().map(y=>y/C)),c.lineDashOffset/=C,c.stroke(),h&&(c.setTransform(...W),c.setLineDash(s),c.lineDashOffset=d)}isContentVisible(){for(let h=this.markedContentStack.length-1;h>=0;h--)if(!this.markedContentStack[h].visible)return!1;return!0}};Q=new WeakSet,dn=function(){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)};let G=Rt;a.CanvasGraphics=G;for(const H in _.OPS)G.prototype[H]!==void 0&&(G.prototype[_.OPS[H]]=G.prototype[H])}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.TilingPattern=a.PathType=void 0,a.getShadingPattern=l;var f=A(1),_=A(8),V=A(3);const q={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};a.PathType=q;function Y(o,v){if(!v||V.isNodeJS)return;const g=v[2]-v[0],u=v[3]-v[1],n=new Path2D;n.rect(v[0],v[1],g,u),o.clip(n)}class M{constructor(){this.constructor===M&&(0,f.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,f.unreachable)("Abstract method `getPattern` called.")}}class b extends M{constructor(v){super(),this._type=v[1],this._bbox=v[2],this._colorStops=v[3],this._p0=v[4],this._p1=v[5],this._r0=v[6],this._r1=v[7],this.matrix=null}_createGradient(v){let g;this._type==="axial"?g=v.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(g=v.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const u of this._colorStops)g.addColorStop(u[0],u[1]);return g}getPattern(v,g,u,n){let i;if(n===q.STROKE||n===q.FILL){const e=g.current.getClippedPathBoundingBox(n,(0,_.getCurrentTransform)(v))||[0,0,0,0],E=Math.ceil(e[2]-e[0])||1,x=Math.ceil(e[3]-e[1])||1,j=g.cachedCanvases.getCanvas("pattern",E,x,!0),I=j.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(-e[0],-e[1]),u=f.Util.transform(u,[1,0,0,1,e[0],e[1]]),I.transform(...g.baseTransform),this.matrix&&I.transform(...this.matrix),Y(I,this._bbox),I.fillStyle=this._createGradient(I),I.fill(),i=v.createPattern(j.canvas,"no-repeat");const yt=new DOMMatrix(u);try{i.setTransform(yt)}catch(wt){(0,f.warn)(`RadialAxialShadingPattern.getPattern: "${wt==null?void 0:wt.message}".`)}}else Y(v,this._bbox),i=this._createGradient(v);return i}}function w(o,v,g,u,n,i,e,E){const x=v.coords,j=v.colors,I=o.data,yt=o.width*4;let wt;x[g+1]>x[u+1]&&(wt=g,g=u,u=wt,wt=i,i=e,e=wt),x[u+1]>x[n+1]&&(wt=u,u=n,n=wt,wt=e,e=E,E=wt),x[g+1]>x[u+1]&&(wt=g,g=u,u=wt,wt=i,i=e,e=wt);const bt=(x[g]+v.offsetX)*v.scaleX,K=(x[g+1]+v.offsetY)*v.scaleY,B=(x[u]+v.offsetX)*v.scaleX,U=(x[u+1]+v.offsetY)*v.scaleY,G=(x[n]+v.offsetX)*v.scaleX,Q=(x[n+1]+v.offsetY)*v.scaleY;if(K>=Q)return;const xt=j[i],Rt=j[i+1],H=j[i+2],h=j[e],c=j[e+1],T=j[e+2],O=j[E],$=j[E+1],W=j[E+2],s=Math.round(K),d=Math.round(Q);let C,y,k,N,D,p,L,_t;for(let z=s;z<=d;z++){if(z<U){let St;z<K?St=0:St=(K-z)/(K-U),C=bt-(bt-B)*St,y=xt-(xt-h)*St,k=Rt-(Rt-c)*St,N=H-(H-T)*St}else{let St;z>Q?St=1:U===Q?St=0:St=(U-z)/(U-Q),C=B-(B-G)*St,y=h-(h-O)*St,k=c-(c-$)*St,N=T-(T-W)*St}let Z;z<K?Z=0:z>Q?Z=1:Z=(K-z)/(K-Q),D=bt-(bt-G)*Z,p=xt-(xt-O)*Z,L=Rt-(Rt-$)*Z,_t=H-(H-W)*Z;const At=Math.round(Math.min(C,D)),kt=Math.round(Math.max(C,D));let Mt=yt*z+At*4;for(let St=At;St<=kt;St++)Z=(C-St)/(C-D),Z<0?Z=0:Z>1&&(Z=1),I[Mt++]=y-(y-p)*Z|0,I[Mt++]=k-(k-L)*Z|0,I[Mt++]=N-(N-_t)*Z|0,I[Mt++]=255}}function P(o,v,g){const u=v.coords,n=v.colors;let i,e;switch(v.type){case"lattice":const E=v.verticesPerRow,x=Math.floor(u.length/E)-1,j=E-1;for(i=0;i<x;i++){let I=i*E;for(let yt=0;yt<j;yt++,I++)w(o,g,u[I],u[I+1],u[I+E],n[I],n[I+1],n[I+E]),w(o,g,u[I+E+1],u[I+1],u[I+E],n[I+E+1],n[I+1],n[I+E])}break;case"triangles":for(i=0,e=u.length;i<e;i+=3)w(o,g,u[i],u[i+1],u[i+2],n[i],n[i+1],n[i+2]);break;default:throw new Error("illegal figure")}}class S extends M{constructor(v){super(),this._coords=v[2],this._colors=v[3],this._figures=v[4],this._bounds=v[5],this._bbox=v[7],this._background=v[8],this.matrix=null}_createMeshCanvas(v,g,u){const E=Math.floor(this._bounds[0]),x=Math.floor(this._bounds[1]),j=Math.ceil(this._bounds[2])-E,I=Math.ceil(this._bounds[3])-x,yt=Math.min(Math.ceil(Math.abs(j*v[0]*1.1)),3e3),wt=Math.min(Math.ceil(Math.abs(I*v[1]*1.1)),3e3),bt=j/yt,K=I/wt,B={coords:this._coords,colors:this._colors,offsetX:-E,offsetY:-x,scaleX:1/bt,scaleY:1/K},U=yt+4,G=wt+4,Q=u.getCanvas("mesh",U,G,!1),xt=Q.context,Rt=xt.createImageData(yt,wt);if(g){const h=Rt.data;for(let c=0,T=h.length;c<T;c+=4)h[c]=g[0],h[c+1]=g[1],h[c+2]=g[2],h[c+3]=255}for(const h of this._figures)P(Rt,h,B);return xt.putImageData(Rt,2,2),{canvas:Q.canvas,offsetX:E-2*bt,offsetY:x-2*K,scaleX:bt,scaleY:K}}getPattern(v,g,u,n){Y(v,this._bbox);let i;if(n===q.SHADING)i=f.Util.singularValueDecompose2dScale((0,_.getCurrentTransform)(v));else if(i=f.Util.singularValueDecompose2dScale(g.baseTransform),this.matrix){const E=f.Util.singularValueDecompose2dScale(this.matrix);i=[i[0]*E[0],i[1]*E[1]]}const e=this._createMeshCanvas(i,n===q.SHADING?null:this._background,g.cachedCanvases);return n!==q.SHADING&&(v.setTransform(...g.baseTransform),this.matrix&&v.transform(...this.matrix)),v.translate(e.offsetX,e.offsetY),v.scale(e.scaleX,e.scaleY),v.createPattern(e.canvas,"no-repeat")}}class F extends M{getPattern(){return"hotpink"}}function l(o){switch(o[0]){case"RadialAxial":return new b(o);case"Mesh":return new S(o);case"Dummy":return new F}throw new Error(`Unknown IR type: ${o[0]}`)}const t={COLORED:1,UNCOLORED:2};class r{static get MAX_PATTERN_SIZE(){return(0,f.shadow)(this,"MAX_PATTERN_SIZE",3e3)}constructor(v,g,u,n,i){this.operatorList=v[2],this.matrix=v[3]||[1,0,0,1,0,0],this.bbox=v[4],this.xstep=v[5],this.ystep=v[6],this.paintType=v[7],this.tilingType=v[8],this.color=g,this.ctx=u,this.canvasGraphicsFactory=n,this.baseTransform=i}createPatternCanvas(v){const g=this.operatorList,u=this.bbox,n=this.xstep,i=this.ystep,e=this.paintType,E=this.tilingType,x=this.color,j=this.canvasGraphicsFactory;(0,f.info)("TilingType: "+E);const I=u[0],yt=u[1],wt=u[2],bt=u[3],K=f.Util.singularValueDecompose2dScale(this.matrix),B=f.Util.singularValueDecompose2dScale(this.baseTransform),U=[K[0]*B[0],K[1]*B[1]],G=this.getSizeAndScale(n,this.ctx.canvas.width,U[0]),Q=this.getSizeAndScale(i,this.ctx.canvas.height,U[1]),xt=v.cachedCanvases.getCanvas("pattern",G.size,Q.size,!0),Rt=xt.context,H=j.createCanvasGraphics(Rt);H.groupLevel=v.groupLevel,this.setFillAndStrokeStyleToContext(H,e,x);let h=I,c=yt,T=wt,O=bt;return I<0&&(h=0,T+=Math.abs(I)),yt<0&&(c=0,O+=Math.abs(yt)),Rt.translate(-(G.scale*h),-(Q.scale*c)),H.transform(G.scale,0,0,Q.scale,0,0),Rt.save(),this.clipBbox(H,h,c,T,O),H.baseTransform=(0,_.getCurrentTransform)(H.ctx),H.executeOperatorList(g),H.endDrawing(),{canvas:xt.canvas,scaleX:G.scale,scaleY:Q.scale,offsetX:h,offsetY:c}}getSizeAndScale(v,g,u){v=Math.abs(v);const n=Math.max(r.MAX_PATTERN_SIZE,g);let i=Math.ceil(v*u);return i>=n?i=n:u=i/v,{scale:u,size:i}}clipBbox(v,g,u,n,i){const e=n-g,E=i-u;v.ctx.rect(g,u,e,E),v.current.updateRectMinMax((0,_.getCurrentTransform)(v.ctx),[g,u,n,i]),v.clip(),v.endPath()}setFillAndStrokeStyleToContext(v,g,u){const n=v.ctx,i=v.current;switch(g){case t.COLORED:const e=this.ctx;n.fillStyle=e.fillStyle,n.strokeStyle=e.strokeStyle,i.fillColor=e.fillStyle,i.strokeColor=e.strokeStyle;break;case t.UNCOLORED:const E=f.Util.makeHexColor(u[0],u[1],u[2]);n.fillStyle=E,n.strokeStyle=E,i.fillColor=E,i.strokeColor=E;break;default:throw new f.FormatError(`Unsupported paint type: ${g}`)}}getPattern(v,g,u,n){let i=u;n!==q.SHADING&&(i=f.Util.transform(i,g.baseTransform),this.matrix&&(i=f.Util.transform(i,this.matrix)));const e=this.createPatternCanvas(g);let E=new DOMMatrix(i);E=E.translate(e.offsetX,e.offsetY),E=E.scale(1/e.scaleX,1/e.scaleY);const x=v.createPattern(e.canvas,"repeat");try{x.setTransform(E)}catch(j){(0,f.warn)(`TilingPattern.getPattern: "${j==null?void 0:j.message}".`)}return x}}a.TilingPattern=r}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.applyMaskImageData=_;var f=A(1);function _({src:V,srcPos:q=0,dest:Y,destPos:M=0,width:b,height:w,inverseDecode:P=!1}){const S=f.FeatureTest.isLittleEndian?4278190080:255,[F,l]=P?[0,S]:[S,0],t=b>>3,r=b&7,o=V.length;Y=new Uint32Array(Y.buffer);for(let v=0;v<w;v++){for(const u=q+t;q<u;q++){const n=q<o?V[q]:255;Y[M++]=n&128?l:F,Y[M++]=n&64?l:F,Y[M++]=n&32?l:F,Y[M++]=n&16?l:F,Y[M++]=n&8?l:F,Y[M++]=n&4?l:F,Y[M++]=n&2?l:F,Y[M++]=n&1?l:F}if(r===0)continue;const g=q<o?V[q++]:255;for(let u=0;u<r;u++)Y[M++]=g&1<<7-u?l:F}return{srcPos:q,destPos:M}}}),((m,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.GlobalWorkerOptions=void 0;const A=Object.create(null);a.GlobalWorkerOptions=A,A.workerPort=A.workerPort===void 0?null:A.workerPort,A.workerSrc=A.workerSrc===void 0?"":A.workerSrc}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.MessageHandler=void 0;var f=A(1);const _={DATA:1,ERROR:2},V={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function q(M){switch(M instanceof Error||typeof M=="object"&&M!==null||(0,f.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),M.name){case"AbortException":return new f.AbortException(M.message);case"MissingPDFException":return new f.MissingPDFException(M.message);case"PasswordException":return new f.PasswordException(M.message,M.code);case"UnexpectedResponseException":return new f.UnexpectedResponseException(M.message,M.status);case"UnknownErrorException":return new f.UnknownErrorException(M.message,M.details);default:return new f.UnknownErrorException(M.message,M.toString())}}class Y{constructor(b,w,P){this.sourceName=b,this.targetName=w,this.comObj=P,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=S=>{const F=S.data;if(F.targetName!==this.sourceName)return;if(F.stream){this._processStreamMessage(F);return}if(F.callback){const t=F.callbackId,r=this.callbackCapabilities[t];if(!r)throw new Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],F.callback===_.DATA)r.resolve(F.data);else if(F.callback===_.ERROR)r.reject(q(F.reason));else throw new Error("Unexpected callback case");return}const l=this.actionHandler[F.action];if(!l)throw new Error(`Unknown action from worker: ${F.action}`);if(F.callbackId){const t=this.sourceName,r=F.sourceName;new Promise(function(o){o(l(F.data))}).then(function(o){P.postMessage({sourceName:t,targetName:r,callback:_.DATA,callbackId:F.callbackId,data:o})},function(o){P.postMessage({sourceName:t,targetName:r,callback:_.ERROR,callbackId:F.callbackId,reason:q(o)})});return}if(F.streamId){this._createStreamSink(F);return}l(F.data)},P.addEventListener("message",this._onComObjOnMessage)}on(b,w){const P=this.actionHandler;if(P[b])throw new Error(`There is already an actionName called "${b}"`);P[b]=w}send(b,w,P){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:b,data:w},P)}sendWithPromise(b,w,P){const S=this.callbackId++,F=(0,f.createPromiseCapability)();this.callbackCapabilities[S]=F;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:b,callbackId:S,data:w},P)}catch(l){F.reject(l)}return F.promise}sendWithStream(b,w,P,S){const F=this.streamId++,l=this.sourceName,t=this.targetName,r=this.comObj;return new ReadableStream({start:o=>{const v=(0,f.createPromiseCapability)();return this.streamControllers[F]={controller:o,startCall:v,pullCall:null,cancelCall:null,isClosed:!1},r.postMessage({sourceName:l,targetName:t,action:b,streamId:F,data:w,desiredSize:o.desiredSize},S),v.promise},pull:o=>{const v=(0,f.createPromiseCapability)();return this.streamControllers[F].pullCall=v,r.postMessage({sourceName:l,targetName:t,stream:V.PULL,streamId:F,desiredSize:o.desiredSize}),v.promise},cancel:o=>{(0,f.assert)(o instanceof Error,"cancel must have a valid reason");const v=(0,f.createPromiseCapability)();return this.streamControllers[F].cancelCall=v,this.streamControllers[F].isClosed=!0,r.postMessage({sourceName:l,targetName:t,stream:V.CANCEL,streamId:F,reason:q(o)}),v.promise}},P)}_createStreamSink(b){const w=b.streamId,P=this.sourceName,S=b.sourceName,F=this.comObj,l=this,t=this.actionHandler[b.action],r={enqueue(o,v=1,g){if(this.isCancelled)return;const u=this.desiredSize;this.desiredSize-=v,u>0&&this.desiredSize<=0&&(this.sinkCapability=(0,f.createPromiseCapability)(),this.ready=this.sinkCapability.promise),F.postMessage({sourceName:P,targetName:S,stream:V.ENQUEUE,streamId:w,chunk:o},g)},close(){this.isCancelled||(this.isCancelled=!0,F.postMessage({sourceName:P,targetName:S,stream:V.CLOSE,streamId:w}),delete l.streamSinks[w])},error(o){(0,f.assert)(o instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,F.postMessage({sourceName:P,targetName:S,stream:V.ERROR,streamId:w,reason:q(o)}))},sinkCapability:(0,f.createPromiseCapability)(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:b.desiredSize,ready:null};r.sinkCapability.resolve(),r.ready=r.sinkCapability.promise,this.streamSinks[w]=r,new Promise(function(o){o(t(b.data,r))}).then(function(){F.postMessage({sourceName:P,targetName:S,stream:V.START_COMPLETE,streamId:w,success:!0})},function(o){F.postMessage({sourceName:P,targetName:S,stream:V.START_COMPLETE,streamId:w,reason:q(o)})})}_processStreamMessage(b){const w=b.streamId,P=this.sourceName,S=b.sourceName,F=this.comObj,l=this.streamControllers[w],t=this.streamSinks[w];switch(b.stream){case V.START_COMPLETE:b.success?l.startCall.resolve():l.startCall.reject(q(b.reason));break;case V.PULL_COMPLETE:b.success?l.pullCall.resolve():l.pullCall.reject(q(b.reason));break;case V.PULL:if(!t){F.postMessage({sourceName:P,targetName:S,stream:V.PULL_COMPLETE,streamId:w,success:!0});break}t.desiredSize<=0&&b.desiredSize>0&&t.sinkCapability.resolve(),t.desiredSize=b.desiredSize,new Promise(function(r){r(t.onPull&&t.onPull())}).then(function(){F.postMessage({sourceName:P,targetName:S,stream:V.PULL_COMPLETE,streamId:w,success:!0})},function(r){F.postMessage({sourceName:P,targetName:S,stream:V.PULL_COMPLETE,streamId:w,reason:q(r)})});break;case V.ENQUEUE:if((0,f.assert)(l,"enqueue should have stream controller"),l.isClosed)break;l.controller.enqueue(b.chunk);break;case V.CLOSE:if((0,f.assert)(l,"close should have stream controller"),l.isClosed)break;l.isClosed=!0,l.controller.close(),this._deleteStreamController(l,w);break;case V.ERROR:(0,f.assert)(l,"error should have stream controller"),l.controller.error(q(b.reason)),this._deleteStreamController(l,w);break;case V.CANCEL_COMPLETE:b.success?l.cancelCall.resolve():l.cancelCall.reject(q(b.reason)),this._deleteStreamController(l,w);break;case V.CANCEL:if(!t)break;new Promise(function(r){r(t.onCancel&&t.onCancel(q(b.reason)))}).then(function(){F.postMessage({sourceName:P,targetName:S,stream:V.CANCEL_COMPLETE,streamId:w,success:!0})},function(r){F.postMessage({sourceName:P,targetName:S,stream:V.CANCEL_COMPLETE,streamId:w,reason:q(r)})}),t.sinkCapability.reject(q(b.reason)),t.isCancelled=!0,delete this.streamSinks[w];break;default:throw new Error("Unexpected stream case")}}async _deleteStreamController(b,w){await Promise.allSettled([b.startCall&&b.startCall.promise,b.pullCall&&b.pullCall.promise,b.cancelCall&&b.cancelCall.promise]),delete this.streamControllers[w]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}a.MessageHandler=Y}),((m,a,A)=>{var V,q;Object.defineProperty(a,"__esModule",{value:!0}),a.Metadata=void 0;var f=A(1);class _{constructor({parsedData:M,rawData:b}){Ot(this,V);Ot(this,q);It(this,V,M),It(this,q,b)}getRaw(){return R(this,q)}get(M){return R(this,V).get(M)??null}getAll(){return(0,f.objectFromMap)(R(this,V))}has(M){return R(this,V).has(M)}}V=new WeakMap,q=new WeakMap,a.Metadata=_}),((m,a,A)=>{var Y,M,b,w,P,S,hn;Object.defineProperty(a,"__esModule",{value:!0}),a.OptionalContentConfig=void 0;var f=A(1);const _=Symbol("INTERNAL");class V{constructor(t,r){Ot(this,Y,!0);this.name=t,this.intent=r}get visible(){return R(this,Y)}_setVisible(t,r){t!==_&&(0,f.unreachable)("Internal method `_setVisible` called."),It(this,Y,r)}}Y=new WeakMap;class q{constructor(t){Ot(this,S);Ot(this,M,!0);Ot(this,b,new Map);Ot(this,w,null);Ot(this,P,null);if(this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,It(this,P,t.order);for(const r of t.groups)R(this,b).set(r.id,new V(r.name,r.intent));if(t.baseState==="OFF")for(const r of R(this,b).values())r._setVisible(_,!1);for(const r of t.on)R(this,b).get(r)._setVisible(_,!0);for(const r of t.off)R(this,b).get(r)._setVisible(_,!1);It(this,w,new Map);for(const[r,o]of R(this,b))R(this,w).set(r,o.visible)}}isVisible(t){if(R(this,b).size===0)return!0;if(!t)return(0,f.warn)("Optional content group not defined."),!0;if(t.type==="OCG")return R(this,b).has(t.id)?R(this,b).get(t.id).visible:((0,f.warn)(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return Dt(this,S,hn).call(this,t.expression);if(!t.policy||t.policy==="AnyOn"){for(const r of t.ids){if(!R(this,b).has(r))return(0,f.warn)(`Optional content group not found: ${r}`),!0;if(R(this,b).get(r).visible)return!0}return!1}else if(t.policy==="AllOn"){for(const r of t.ids){if(!R(this,b).has(r))return(0,f.warn)(`Optional content group not found: ${r}`),!0;if(!R(this,b).get(r).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(const r of t.ids){if(!R(this,b).has(r))return(0,f.warn)(`Optional content group not found: ${r}`),!0;if(!R(this,b).get(r).visible)return!0}return!1}else if(t.policy==="AllOff"){for(const r of t.ids){if(!R(this,b).has(r))return(0,f.warn)(`Optional content group not found: ${r}`),!0;if(R(this,b).get(r).visible)return!1}return!0}return(0,f.warn)(`Unknown optional content policy ${t.policy}.`),!0}return(0,f.warn)(`Unknown group type ${t.type}.`),!0}setVisibility(t,r=!0){if(!R(this,b).has(t)){(0,f.warn)(`Optional content group not found: ${t}`);return}R(this,b).get(t)._setVisible(_,!!r),It(this,M,null)}get hasInitialVisibility(){if(R(this,M)!==null)return R(this,M);for(const[t,r]of R(this,b)){const o=R(this,w).get(t);if(r.visible!==o)return It(this,M,!1)}return It(this,M,!0)}getOrder(){return R(this,b).size?R(this,P)?R(this,P).slice():[...R(this,b).keys()]:null}getGroups(){return R(this,b).size>0?(0,f.objectFromMap)(R(this,b)):null}getGroup(t){return R(this,b).get(t)||null}}M=new WeakMap,b=new WeakMap,w=new WeakMap,P=new WeakMap,S=new WeakSet,hn=function(t){const r=t.length;if(r<2)return!0;const o=t[0];for(let v=1;v<r;v++){const g=t[v];let u;if(Array.isArray(g))u=Dt(this,S,hn).call(this,g);else if(R(this,b).has(g))u=R(this,b).get(g).visible;else return(0,f.warn)(`Optional content group not found: ${g}`),!0;switch(o){case"And":if(!u)return!1;break;case"Or":if(u)return!0;break;case"Not":return!u;default:return!0}}return o==="And"},a.OptionalContentConfig=q}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.PDFDataTransportStream=void 0;var f=A(1),_=A(8);class V{constructor(b,w){(0,f.assert)(w,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'),this._queuedChunks=[],this._progressiveDone=b.progressiveDone||!1,this._contentDispositionFilename=b.contentDispositionFilename||null;const P=b.initialData;if((P==null?void 0:P.length)>0){const S=new Uint8Array(P).buffer;this._queuedChunks.push(S)}this._pdfDataRangeTransport=w,this._isStreamingSupported=!b.disableStream,this._isRangeSupported=!b.disableRange,this._contentLength=b.length,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener((S,F)=>{this._onReceiveData({begin:S,chunk:F})}),this._pdfDataRangeTransport.addProgressListener((S,F)=>{this._onProgress({loaded:S,total:F})}),this._pdfDataRangeTransport.addProgressiveReadListener(S=>{this._onReceiveData({chunk:S})}),this._pdfDataRangeTransport.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),this._pdfDataRangeTransport.transportReady()}_onReceiveData(b){const w=new Uint8Array(b.chunk).buffer;if(b.begin===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(w):this._queuedChunks.push(w);else{const P=this._rangeReaders.some(function(S){return S._begin!==b.begin?!1:(S._enqueue(w),!0)});(0,f.assert)(P,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var b;return((b=this._fullRequestReader)==null?void 0:b._loaded)??0}_onProgress(b){if(b.total===void 0){const w=this._rangeReaders[0];w!=null&&w.onProgress&&w.onProgress({loaded:b.loaded})}else{const w=this._fullRequestReader;w!=null&&w.onProgress&&w.onProgress({loaded:b.loaded,total:b.total})}}_onProgressiveDone(){this._fullRequestReader&&this._fullRequestReader.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(b){const w=this._rangeReaders.indexOf(b);w>=0&&this._rangeReaders.splice(w,1)}getFullReader(){(0,f.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const b=this._queuedChunks;return this._queuedChunks=null,new q(this,b,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(b,w){if(w<=this._progressiveDataLength)return null;const P=new Y(this,b,w);return this._pdfDataRangeTransport.requestDataRange(b,w),this._rangeReaders.push(P),P}cancelAllRequests(b){this._fullRequestReader&&this._fullRequestReader.cancel(b);for(const w of this._rangeReaders.slice(0))w.cancel(b);this._pdfDataRangeTransport.abort()}}a.PDFDataTransportStream=V;class q{constructor(b,w,P=!1,S=null){this._stream=b,this._done=P||!1,this._filename=(0,_.isPdfFile)(S)?S:null,this._queuedChunks=w||[],this._loaded=0;for(const F of this._queuedChunks)this._loaded+=F.byteLength;this._requests=[],this._headersReady=Promise.resolve(),b._fullRequestReader=this,this.onProgress=null}_enqueue(b){this._done||(this._requests.length>0?this._requests.shift().resolve({value:b,done:!1}):this._queuedChunks.push(b),this._loaded+=b.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const b=(0,f.createPromiseCapability)();return this._requests.push(b),b.promise}cancel(b){this._done=!0;for(const w of this._requests)w.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class Y{constructor(b,w,P){this._stream=b,this._begin=w,this._end=P,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(b){if(!this._done){if(this._requests.length===0)this._queuedChunk=b;else{this._requests.shift().resolve({value:b,done:!1});for(const P of this._requests)P.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const w=this._queuedChunk;return this._queuedChunk=null,{value:w,done:!1}}if(this._done)return{value:void 0,done:!0};const b=(0,f.createPromiseCapability)();return this._requests.push(b),b.promise}cancel(b){this._done=!0;for(const w of this._requests)w.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}}),((m,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.XfaText=void 0;class A{static textContent(_){const V=[],q={items:V,styles:Object.create(null)};function Y(M){var P;if(!M)return;let b=null;const w=M.name;if(w==="#text")b=M.value;else if(A.shouldBuildText(w))(P=M==null?void 0:M.attributes)!=null&&P.textContent?b=M.attributes.textContent:M.value&&(b=M.value);else return;if(b!==null&&V.push({str:b}),!!M.children)for(const S of M.children)Y(S)}return Y(_),q}static shouldBuildText(_){return!(_==="textarea"||_==="input"||_==="option"||_==="select")}}a.XfaText=A}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.NodeStandardFontDataFactory=a.NodeCanvasFactory=a.NodeCMapReaderFactory=void 0;var f=A(9);const _=function(M){return new Promise((b,w)=>{require$$0.readFile(M,(S,F)=>{if(S||!F){w(new Error(S));return}b(new Uint8Array(F))})})};class V extends f.BaseCanvasFactory{_createCanvas(b,w){return require$$0.createCanvas(b,w)}}a.NodeCanvasFactory=V;class q extends f.BaseCMapReaderFactory{_fetchData(b,w){return _(b).then(P=>({cMapData:P,compressionType:w}))}}a.NodeCMapReaderFactory=q;class Y extends f.BaseStandardFontDataFactory{_fetchData(b){return _(b)}}a.NodeStandardFontDataFactory=Y}),((m,a,A)=>{var M,b,w,P,S,F,l,t,r,fn,Dn,pn,Rn;Object.defineProperty(a,"__esModule",{value:!0}),a.AnnotationEditorLayer=void 0;var f=A(7),_=A(1),V=A(23),q=A(24);const n=class n{constructor(e){Ot(this,r);Ot(this,M);Ot(this,b,!1);Ot(this,w,this.pointerup.bind(this));Ot(this,P,this.pointerdown.bind(this));Ot(this,S,new Map);Ot(this,F,!1);Ot(this,l,!1);Ot(this,t);n._initialized||(n._initialized=!0,V.FreeTextEditor.initialize(e.l10n),q.InkEditor.initialize(e.l10n),e.uiManager.registerEditorTypes([V.FreeTextEditor,q.InkEditor])),It(this,t,e.uiManager),this.annotationStorage=e.annotationStorage,this.pageIndex=e.pageIndex,this.div=e.div,It(this,M,e.accessibilityManager),R(this,t).addLayer(this)}updateToolbar(e){R(this,t).updateToolbar(e)}updateMode(e=R(this,t).getMode()){Dt(this,r,Rn).call(this),e===_.AnnotationEditorType.INK?(this.addInkEditorIfNeeded(!1),this.disableClick()):this.enableClick(),R(this,t).unselectAll()}addInkEditorIfNeeded(e){if(!e&&R(this,t).getMode()!==_.AnnotationEditorType.INK)return;if(!e){for(const x of R(this,S).values())if(x.isEmpty()){x.setInBackground();return}}Dt(this,r,pn).call(this,{offsetX:0,offsetY:0}).setInBackground()}setEditingState(e){R(this,t).setEditingState(e)}addCommands(e){R(this,t).addCommands(e)}enable(){this.div.style.pointerEvents="auto";for(const e of R(this,S).values())e.enableEditing()}disable(){this.div.style.pointerEvents="none";for(const e of R(this,S).values())e.disableEditing()}setActiveEditor(e){R(this,t).getActive()!==e&&R(this,t).setActiveEditor(e)}enableClick(){this.div.addEventListener("pointerdown",R(this,P)),this.div.addEventListener("pointerup",R(this,w))}disableClick(){this.div.removeEventListener("pointerdown",R(this,P)),this.div.removeEventListener("pointerup",R(this,w))}attach(e){R(this,S).set(e.id,e)}detach(e){var E;R(this,S).delete(e.id),(E=R(this,M))==null||E.removePointerInTextLayer(e.contentDiv)}remove(e){R(this,t).removeEditor(e),this.detach(e),this.annotationStorage.remove(e.id),e.div.style.display="none",setTimeout(()=>{e.div.style.display="",e.div.remove(),e.isAttachedToDOM=!1,document.activeElement===document.body&&R(this,t).focusMainContainer()},0),R(this,l)||this.addInkEditorIfNeeded(!1)}add(e){if(Dt(this,r,fn).call(this,e),R(this,t).addEditor(e),this.attach(e),!e.isAttachedToDOM){const E=e.render();this.div.append(E),e.isAttachedToDOM=!0}this.moveEditorInDOM(e),e.onceAdded(),this.addToAnnotationStorage(e)}moveEditorInDOM(e){var E;(E=R(this,M))==null||E.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addToAnnotationStorage(e){!e.isEmpty()&&!this.annotationStorage.has(e.id)&&this.annotationStorage.setValue(e.id,e)}addOrRebuild(e){e.needsToBeRebuilt()?e.rebuild():this.add(e)}addANewEditor(e){const E=()=>{this.addOrRebuild(e)},x=()=>{e.remove()};this.addCommands({cmd:E,undo:x,mustExec:!0})}addUndoableEditor(e){const E=()=>{this.addOrRebuild(e)},x=()=>{e.remove()};this.addCommands({cmd:E,undo:x,mustExec:!1})}getNextId(){return R(this,t).getId()}deserialize(e){switch(e.annotationType){case _.AnnotationEditorType.FREETEXT:return V.FreeTextEditor.deserialize(e,this);case _.AnnotationEditorType.INK:return q.InkEditor.deserialize(e,this)}return null}setSelected(e){R(this,t).setSelected(e)}toggleSelected(e){R(this,t).toggleSelected(e)}isSelected(e){return R(this,t).isSelected(e)}unselect(e){R(this,t).unselect(e)}pointerup(e){const E=f.KeyboardManager.platform.isMac;if(!(e.button!==0||e.ctrlKey&&E)&&e.target===this.div&&R(this,F)){if(It(this,F,!1),!R(this,b)){It(this,b,!0);return}Dt(this,r,pn).call(this,e)}}pointerdown(e){const E=f.KeyboardManager.platform.isMac;if(e.button!==0||e.ctrlKey&&E||e.target!==this.div)return;It(this,F,!0);const x=R(this,t).getActive();It(this,b,!x||x.isEmpty())}drop(e){const E=e.dataTransfer.getData("text/plain"),x=R(this,t).getEditor(E);if(!x)return;e.preventDefault(),e.dataTransfer.dropEffect="move",Dt(this,r,fn).call(this,x);const j=this.div.getBoundingClientRect(),I=e.clientX-j.x,yt=e.clientY-j.y;x.translate(I-x.startX,yt-x.startY),this.moveEditorInDOM(x),x.div.focus()}dragover(e){e.preventDefault()}destroy(){var e,E;((e=R(this,t).getActive())==null?void 0:e.parent)===this&&R(this,t).setActiveEditor(null);for(const x of R(this,S).values())(E=R(this,M))==null||E.removePointerInTextLayer(x.contentDiv),x.isAttachedToDOM=!1,x.div.remove(),x.parent=null;this.div=null,R(this,S).clear(),R(this,t).removeLayer(this)}render(e){this.viewport=e.viewport,(0,f.bindEvents)(this,this.div,["dragover","drop"]),this.setDimensions();for(const E of R(this,t).getEditors(this.pageIndex))this.add(E);this.updateMode()}update(e){this.viewport=e.viewport,this.setDimensions(),this.updateMode()}get scaleFactor(){return this.viewport.scale}get pageDimensions(){const[e,E,x,j]=this.viewport.viewBox,I=x-e,yt=j-E;return[I,yt]}get viewportBaseDimensions(){const{width:e,height:E,rotation:x}=this.viewport;return x%180===0?[e,E]:[E,e]}setDimensions(){const{width:e,height:E,rotation:x}=this.viewport,j=x%180!==0,I=Math.floor(e)+"px",yt=Math.floor(E)+"px";this.div.style.width=j?yt:I,this.div.style.height=j?I:yt,this.div.setAttribute("data-main-rotation",x)}};M=new WeakMap,b=new WeakMap,w=new WeakMap,P=new WeakMap,S=new WeakMap,F=new WeakMap,l=new WeakMap,t=new WeakMap,r=new WeakSet,fn=function(e){var E;e.parent!==this&&(this.attach(e),e.pageIndex=this.pageIndex,(E=e.parent)==null||E.detach(e),e.parent=this,e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))},Dn=function(e){switch(R(this,t).getMode()){case _.AnnotationEditorType.FREETEXT:return new V.FreeTextEditor(e);case _.AnnotationEditorType.INK:return new q.InkEditor(e)}return null},pn=function(e){const E=this.getNextId(),x=Dt(this,r,Dn).call(this,{parent:this,id:E,x:e.offsetX,y:e.offsetY});return x&&this.add(x),x},Rn=function(){It(this,l,!0);for(const e of R(this,S).values())e.isEmpty()&&e.remove();It(this,l,!1)},ee(n,"_initialized",!1);let Y=n;a.AnnotationEditorLayer=Y}),((m,a,A)=>{var Y,M,b,w,P,S,F,l,Mn,On,In,gn;Object.defineProperty(a,"__esModule",{value:!0}),a.FreeTextEditor=void 0;var f=A(1),_=A(7),V=A(6);const g=class g extends V.AnnotationEditor{constructor(i){super({...i,name:"freeTextEditor"});Ot(this,l);Ot(this,Y,this.editorDivBlur.bind(this));Ot(this,M,this.editorDivFocus.bind(this));Ot(this,b,this.editorDivKeydown.bind(this));Ot(this,w);Ot(this,P,"");Ot(this,S,!1);Ot(this,F);It(this,w,i.color||g._defaultColor||V.AnnotationEditor._defaultLineColor),It(this,F,i.fontSize||g._defaultFontSize)}static initialize(i){this._l10nPromise=new Map(["free_text_default_content","editor_free_text_aria_label"].map(E=>[E,i.get(E)]));const e=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(e.getPropertyValue("--freetext-padding"))}static updateDefaultParams(i,e){switch(i){case f.AnnotationEditorParamsType.FREETEXT_SIZE:g._defaultFontSize=e;break;case f.AnnotationEditorParamsType.FREETEXT_COLOR:g._defaultColor=e;break}}updateParams(i,e){switch(i){case f.AnnotationEditorParamsType.FREETEXT_SIZE:Dt(this,l,Mn).call(this,e);break;case f.AnnotationEditorParamsType.FREETEXT_COLOR:Dt(this,l,On).call(this,e);break}}static get defaultPropertiesToUpdate(){return[[f.AnnotationEditorParamsType.FREETEXT_SIZE,g._defaultFontSize],[f.AnnotationEditorParamsType.FREETEXT_COLOR,g._defaultColor||V.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[f.AnnotationEditorParamsType.FREETEXT_SIZE,R(this,F)],[f.AnnotationEditorParamsType.FREETEXT_COLOR,R(this,w)]]}getInitialTranslation(){return[-g._internalPadding*this.parent.scaleFactor,-(g._internalPadding+R(this,F))*this.parent.scaleFactor]}rebuild(){super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(f.AnnotationEditorType.FREETEXT),super.enableEditMode(),this.enableEditing(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this.div.draggable=!1,this.editorDiv.addEventListener("keydown",R(this,b)),this.editorDiv.addEventListener("focus",R(this,M)),this.editorDiv.addEventListener("blur",R(this,Y)))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.disableEditing(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.draggable=!0,this.editorDiv.removeEventListener("keydown",R(this,b)),this.editorDiv.removeEventListener("focus",R(this,M)),this.editorDiv.removeEventListener("blur",R(this,Y)),this.div.focus(),this.isEditing=!1)}focusin(i){super.focusin(i),i.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),super.remove()}commit(){super.commit(),R(this,S)||(It(this,S,!0),this.parent.addUndoableEditor(this)),this.disableEditMode(),It(this,P,Dt(this,l,In).call(this).trimEnd()),Dt(this,l,gn).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}dblclick(i){this.enableEditMode(),this.editorDiv.focus()}keydown(i){i.target===this.div&&i.key==="Enter"&&(this.enableEditMode(),this.editorDiv.focus())}editorDivKeydown(i){g._keyboardManager.exec(this,i)}editorDivFocus(i){this.isEditing=!0}editorDivBlur(i){this.isEditing=!1}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let i,e;this.width&&(i=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",`${this.id}-editor`),this.enableEditing(),g._l10nPromise.get("editor_free_text_aria_label").then(x=>{var j;return(j=this.editorDiv)==null?void 0:j.setAttribute("aria-label",x)}),g._l10nPromise.get("free_text_default_content").then(x=>{var j;return(j=this.editorDiv)==null?void 0:j.setAttribute("default-content",x)}),this.editorDiv.contentEditable=!0;const{style:E}=this.editorDiv;if(E.fontSize=`calc(${R(this,F)}px * var(--scale-factor))`,E.color=R(this,w),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),(0,_.bindEvents)(this,this.div,["dblclick","keydown"]),this.width){const[x,j]=this.parent.viewportBaseDimensions;this.setAt(i*x,e*j,this.width*x,this.height*j);for(const I of R(this,P).split(`
40
- `)){const yt=document.createElement("div");yt.append(I?document.createTextNode(I):document.createElement("br")),this.editorDiv.append(yt)}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(i,e){const E=super.deserialize(i,e);return It(E,F,i.fontSize),It(E,w,f.Util.makeHexColor(...i.color)),It(E,P,i.value),E}serialize(){if(this.isEmpty())return null;const i=g._internalPadding*this.parent.scaleFactor,e=this.getRect(i,i),E=V.AnnotationEditor._colorManager.convert(getComputedStyle(this.editorDiv).color);return{annotationType:f.AnnotationEditorType.FREETEXT,color:E,fontSize:R(this,F),value:R(this,P),pageIndex:this.parent.pageIndex,rect:e,rotation:this.rotation}}};Y=new WeakMap,M=new WeakMap,b=new WeakMap,w=new WeakMap,P=new WeakMap,S=new WeakMap,F=new WeakMap,l=new WeakSet,Mn=function(i){const e=x=>{this.editorDiv.style.fontSize=`calc(${x}px * var(--scale-factor))`,this.translate(0,-(x-R(this,F))*this.parent.scaleFactor),It(this,F,x),Dt(this,l,gn).call(this)},E=R(this,F);this.parent.addCommands({cmd:()=>{e(i)},undo:()=>{e(E)},mustExec:!0,type:f.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},On=function(i){const e=R(this,w);this.parent.addCommands({cmd:()=>{It(this,w,i),this.editorDiv.style.color=i},undo:()=>{It(this,w,e),this.editorDiv.style.color=e},mustExec:!0,type:f.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},In=function(){const i=this.editorDiv.getElementsByTagName("div");if(i.length===0)return this.editorDiv.innerText;const e=[];for(let E=0,x=i.length;E<x;E++){const I=i[E].firstChild;(I==null?void 0:I.nodeName)==="#text"?e.push(I.data):e.push("")}return e.join(`
41
- `)},gn=function(){const[i,e]=this.parent.viewportBaseDimensions,E=this.div.getBoundingClientRect();this.width=E.width/i,this.height=E.height/e},ee(g,"_freeTextDefaultContent",""),ee(g,"_l10nPromise"),ee(g,"_internalPadding",0),ee(g,"_defaultColor",null),ee(g,"_defaultFontSize",10),ee(g,"_keyboardManager",new _.KeyboardManager([[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],g.prototype.commitOrRemove]])),ee(g,"_type","freetext");let q=g;a.FreeTextEditor=q}),((m,a,A)=>{var b,w,P,S,F,l,t,r,o,v,g,u,n,i,e,Ln,Bn,Nn,jn,mn,$n,Un,Wn,le,bn,Fe,we,fe,_n,tn,h,An,Hn,qn,zn,yn,en,pe,En;Object.defineProperty(a,"__esModule",{value:!0}),a.InkEditor=void 0,Object.defineProperty(a,"fitCurve",{enumerable:!0,get:function(){return V.fitCurve}});var f=A(1),_=A(6),V=A(25),q=A(7);const Y=16,y=class y extends _.AnnotationEditor{constructor(D){super({...D,name:"inkEditor"});Ot(this,e);Ot(this,b,0);Ot(this,w,0);Ot(this,P,0);Ot(this,S,this.canvasPointermove.bind(this));Ot(this,F,this.canvasPointerleave.bind(this));Ot(this,l,this.canvasPointerup.bind(this));Ot(this,t,this.canvasPointerdown.bind(this));Ot(this,r,!1);Ot(this,o,!1);Ot(this,v,null);Ot(this,g,null);Ot(this,u,0);Ot(this,n,0);Ot(this,i,null);this.color=D.color||null,this.thickness=D.thickness||null,this.opacity=D.opacity||null,this.paths=[],this.bezierPath2D=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0}static initialize(D){this._l10nPromise=new Map(["editor_ink_canvas_aria_label","editor_ink_aria_label"].map(p=>[p,D.get(p)]))}static updateDefaultParams(D,p){switch(D){case f.AnnotationEditorParamsType.INK_THICKNESS:y._defaultThickness=p;break;case f.AnnotationEditorParamsType.INK_COLOR:y._defaultColor=p;break;case f.AnnotationEditorParamsType.INK_OPACITY:y._defaultOpacity=p/100;break}}updateParams(D,p){switch(D){case f.AnnotationEditorParamsType.INK_THICKNESS:Dt(this,e,Ln).call(this,p);break;case f.AnnotationEditorParamsType.INK_COLOR:Dt(this,e,Bn).call(this,p);break;case f.AnnotationEditorParamsType.INK_OPACITY:Dt(this,e,Nn).call(this,p);break}}static get defaultPropertiesToUpdate(){return[[f.AnnotationEditorParamsType.INK_THICKNESS,y._defaultThickness],[f.AnnotationEditorParamsType.INK_COLOR,y._defaultColor||_.AnnotationEditor._defaultLineColor],[f.AnnotationEditorParamsType.INK_OPACITY,Math.round(y._defaultOpacity*100)]]}get propertiesToUpdate(){return[[f.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||y._defaultThickness],[f.AnnotationEditorParamsType.INK_COLOR,this.color||y._defaultColor||_.AnnotationEditor._defaultLineColor],[f.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??y._defaultOpacity))]]}rebuild(){super.rebuild(),this.div!==null&&(this.canvas||(Dt(this,e,Fe).call(this),Dt(this,e,we).call(this)),this.isAttachedToDOM||(this.parent.add(this),Dt(this,e,fe).call(this)),Dt(this,e,pe).call(this))}remove(){this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,R(this,g).disconnect(),It(this,g,null),super.remove())}enableEditMode(){R(this,r)||this.canvas===null||(super.enableEditMode(),this.div.draggable=!1,this.canvas.addEventListener("pointerdown",R(this,t)),this.canvas.addEventListener("pointerup",R(this,l)))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this.div.draggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",R(this,t)),this.canvas.removeEventListener("pointerup",R(this,l)))}onceAdded(){this.div.draggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}commit(){R(this,r)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),It(this,r,!0),this.div.classList.add("disabled"),Dt(this,e,pe).call(this,!0),this.parent.addInkEditorIfNeeded(!0),this.parent.moveEditorInDOM(this),this.div.focus())}focusin(D){super.focusin(D),this.enableEditMode()}canvasPointerdown(D){D.button!==0||!this.isInEditMode()||R(this,r)||(this.setInForeground(),D.type!=="mouse"&&this.div.focus(),D.stopPropagation(),this.canvas.addEventListener("pointerleave",R(this,F)),this.canvas.addEventListener("pointermove",R(this,S)),Dt(this,e,$n).call(this,D.offsetX,D.offsetY))}canvasPointermove(D){D.stopPropagation(),Dt(this,e,Un).call(this,D.offsetX,D.offsetY)}canvasPointerup(D){D.button===0&&this.isInEditMode()&&this.currentPath.length!==0&&(D.stopPropagation(),Dt(this,e,bn).call(this,D),this.setInBackground())}canvasPointerleave(D){Dt(this,e,bn).call(this,D),this.setInBackground()}render(){if(this.div)return this.div;let D,p;this.width&&(D=this.x,p=this.y),super.render(),y._l10nPromise.get("editor_ink_aria_label").then(At=>{var kt;return(kt=this.div)==null?void 0:kt.setAttribute("aria-label",At)});const[L,_t,z,Z]=Dt(this,e,jn).call(this);if(this.setAt(L,_t,0,0),this.setDims(z,Z),Dt(this,e,Fe).call(this),this.width){const[At,kt]=this.parent.viewportBaseDimensions;this.setAt(D*At,p*kt,this.width*At,this.height*kt),It(this,o,!0),Dt(this,e,fe).call(this),this.setDims(this.width*At,this.height*kt),Dt(this,e,le).call(this),Dt(this,e,En).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return Dt(this,e,we).call(this),this.div}setDimensions(D,p){const L=Math.round(D),_t=Math.round(p);if(R(this,u)===L&&R(this,n)===_t)return;It(this,u,L),It(this,n,_t),this.canvas.style.visibility="hidden",R(this,b)&&Math.abs(R(this,b)-D/p)>.01&&(p=Math.ceil(D/R(this,b)),this.setDims(D,p));const[z,Z]=this.parent.viewportBaseDimensions;this.width=D/z,this.height=p/Z,R(this,r)&&Dt(this,e,_n).call(this,D,p),Dt(this,e,fe).call(this),Dt(this,e,le).call(this),this.canvas.style.visibility="visible"}static deserialize(D,p){var Ht,Ut;const L=super.deserialize(D,p);L.thickness=D.thickness,L.color=f.Util.makeHexColor(...D.color),L.opacity=D.opacity;const[_t,z]=p.pageDimensions,Z=L.width*_t,At=L.height*z,kt=p.scaleFactor,Mt=D.thickness/2;It(L,b,Z/At),It(L,r,!0),It(L,u,Math.round(Z)),It(L,n,Math.round(At));for(const{bezier:Nt}of D.paths){const zt=[];L.paths.push(zt);let Gt=kt*(Nt[0]-Mt),Zt=kt*(At-Nt[1]-Mt);for(let Vt=2,Yt=Nt.length;Vt<Yt;Vt+=6){const Jt=kt*(Nt[Vt]-Mt),oe=kt*(At-Nt[Vt+1]-Mt),ce=kt*(Nt[Vt+2]-Mt),de=kt*(At-Nt[Vt+3]-Mt),Pt=kt*(Nt[Vt+4]-Mt),J=kt*(At-Nt[Vt+5]-Mt);zt.push([[Gt,Zt],[Jt,oe],[ce,de],[Pt,J]]),Gt=Pt,Zt=J}const Xt=Dt(this,h,An).call(this,zt);L.bezierPath2D.push(Xt)}const St=Dt(Ht=L,e,yn).call(Ht);return It(L,P,Math.max(Y,St[2]-St[0])),It(L,w,Math.max(Y,St[3]-St[1])),Dt(Ut=L,e,_n).call(Ut,Z,At),L}serialize(){if(this.isEmpty())return null;const D=this.getRect(0,0),p=this.rotation%180===0?D[3]-D[1]:D[2]-D[0],L=_.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:f.AnnotationEditorType.INK,color:L,thickness:this.thickness,opacity:this.opacity,paths:Dt(this,e,Hn).call(this,this.scaleFactor/this.parent.scaleFactor,this.translationX,this.translationY,p),pageIndex:this.parent.pageIndex,rect:D,rotation:this.rotation}}};b=new WeakMap,w=new WeakMap,P=new WeakMap,S=new WeakMap,F=new WeakMap,l=new WeakMap,t=new WeakMap,r=new WeakMap,o=new WeakMap,v=new WeakMap,g=new WeakMap,u=new WeakMap,n=new WeakMap,i=new WeakMap,e=new WeakSet,Ln=function(D){const p=this.thickness;this.parent.addCommands({cmd:()=>{this.thickness=D,Dt(this,e,pe).call(this)},undo:()=>{this.thickness=p,Dt(this,e,pe).call(this)},mustExec:!0,type:f.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})},Bn=function(D){const p=this.color;this.parent.addCommands({cmd:()=>{this.color=D,Dt(this,e,le).call(this)},undo:()=>{this.color=p,Dt(this,e,le).call(this)},mustExec:!0,type:f.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})},Nn=function(D){D/=100;const p=this.opacity;this.parent.addCommands({cmd:()=>{this.opacity=D,Dt(this,e,le).call(this)},undo:()=>{this.opacity=p,Dt(this,e,le).call(this)},mustExec:!0,type:f.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})},jn=function(){const{width:D,height:p,rotation:L}=this.parent.viewport;switch(L){case 90:return[0,D,D,p];case 180:return[D,p,D,p];case 270:return[p,0,D,p];default:return[0,0,D,p]}},mn=function(){this.ctx.lineWidth=this.thickness*this.parent.scaleFactor/this.scaleFactor,this.ctx.lineCap="round",this.ctx.lineJoin="round",this.ctx.miterLimit=10,this.ctx.strokeStyle=`${this.color}${(0,q.opacityToHex)(this.opacity)}`},$n=function(D,p){this.isEditing=!0,R(this,o)||(It(this,o,!0),Dt(this,e,fe).call(this),this.thickness||(this.thickness=y._defaultThickness),this.color||(this.color=y._defaultColor||_.AnnotationEditor._defaultLineColor),this.opacity??(this.opacity=y._defaultOpacity)),this.currentPath.push([D,p]),It(this,v,null),Dt(this,e,mn).call(this),this.ctx.beginPath(),this.ctx.moveTo(D,p),It(this,i,()=>{R(this,i)&&(R(this,v)&&(this.isEmpty()?(this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)):Dt(this,e,le).call(this),this.ctx.lineTo(...R(this,v)),It(this,v,null),this.ctx.stroke()),window.requestAnimationFrame(R(this,i)))}),window.requestAnimationFrame(R(this,i))},Un=function(D,p){const[L,_t]=this.currentPath.at(-1);D===L&&p===_t||(this.currentPath.push([D,p]),It(this,v,[D,p]))},Wn=function(D,p){var Mt;this.ctx.closePath(),It(this,i,null),D=Math.min(Math.max(D,0),this.canvas.width),p=Math.min(Math.max(p,0),this.canvas.height);const[L,_t]=this.currentPath.at(-1);(D!==L||p!==_t)&&this.currentPath.push([D,p]);let z;if(this.currentPath.length!==1)z=(0,V.fitCurve)(this.currentPath,30,null);else{const St=[D,p];z=[[St,St.slice(),St.slice(),St]]}const Z=Dt(Mt=y,h,An).call(Mt,z);this.currentPath.length=0;const At=()=>{this.paths.push(z),this.bezierPath2D.push(Z),this.rebuild()},kt=()=>{this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(Dt(this,e,Fe).call(this),Dt(this,e,we).call(this)),Dt(this,e,pe).call(this))};this.parent.addCommands({cmd:At,undo:kt,mustExec:!0})},le=function(){if(this.isEmpty()){Dt(this,e,tn).call(this);return}Dt(this,e,mn).call(this);const{canvas:D,ctx:p}=this;p.setTransform(1,0,0,1,0,0),p.clearRect(0,0,D.width,D.height),Dt(this,e,tn).call(this);for(const L of this.bezierPath2D)p.stroke(L)},bn=function(D){Dt(this,e,Wn).call(this,D.offsetX,D.offsetY),this.canvas.removeEventListener("pointerleave",R(this,F)),this.canvas.removeEventListener("pointermove",R(this,S)),this.parent.addToAnnotationStorage(this)},Fe=function(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",y._l10nPromise.get("editor_ink_canvas_aria_label").then(D=>{var p;return(p=this.canvas)==null?void 0:p.setAttribute("aria-label",D)}),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")},we=function(){It(this,g,new ResizeObserver(D=>{const p=D[0].contentRect;p.width&&p.height&&this.setDimensions(p.width,p.height)})),R(this,g).observe(this.div)},fe=function(){if(!R(this,o))return;const[D,p]=this.parent.viewportBaseDimensions;this.canvas.width=Math.ceil(this.width*D),this.canvas.height=Math.ceil(this.height*p),Dt(this,e,tn).call(this)},_n=function(D,p){const L=Dt(this,e,en).call(this),_t=(D-L)/R(this,P),z=(p-L)/R(this,w);this.scaleFactor=Math.min(_t,z)},tn=function(){const D=Dt(this,e,en).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+D,this.translationY*this.scaleFactor+D)},h=new WeakSet,An=function(D){const p=new Path2D;for(let L=0,_t=D.length;L<_t;L++){const[z,Z,At,kt]=D[L];L===0&&p.moveTo(...z),p.bezierCurveTo(Z[0],Z[1],At[0],At[1],kt[0],kt[1])}return p},Hn=function(D,p,L,_t){const Z=[],At=this.thickness/2;let kt,Mt;for(const St of this.paths){kt=[],Mt=[];for(let Ht=0,Ut=St.length;Ht<Ut;Ht++){const[Nt,zt,Gt,Zt]=St[Ht],Xt=D*(Nt[0]+p)+At,Vt=_t-D*(Nt[1]+L)-At,Yt=D*(zt[0]+p)+At,Jt=_t-D*(zt[1]+L)-At,oe=D*(Gt[0]+p)+At,ce=_t-D*(Gt[1]+L)-At,de=D*(Zt[0]+p)+At,Pt=_t-D*(Zt[1]+L)-At;Ht===0&&(kt.push(Xt,Vt),Mt.push(Xt,Vt)),kt.push(Yt,Jt,oe,ce,de,Pt),Dt(this,e,qn).call(this,Xt,Vt,Yt,Jt,oe,ce,de,Pt,4,Mt)}Z.push({bezier:kt,points:Mt})}return Z},qn=function(D,p,L,_t,z,Z,At,kt,Mt,St){if(Dt(this,e,zn).call(this,D,p,L,_t,z,Z,At,kt)){St.push(At,kt);return}for(let Ht=1;Ht<Mt-1;Ht++){const Ut=Ht/Mt,Nt=1-Ut;let zt=Ut*D+Nt*L,Gt=Ut*p+Nt*_t,Zt=Ut*L+Nt*z,Xt=Ut*_t+Nt*Z;const Vt=Ut*z+Nt*At,Yt=Ut*Z+Nt*kt;zt=Ut*zt+Nt*Zt,Gt=Ut*Gt+Nt*Xt,Zt=Ut*Zt+Nt*Vt,Xt=Ut*Xt+Nt*Yt,zt=Ut*zt+Nt*Zt,Gt=Ut*Gt+Nt*Xt,St.push(zt,Gt)}St.push(At,kt)},zn=function(D,p,L,_t,z,Z,At,kt){const St=(3*L-2*D-At)**2,Ht=(3*_t-2*p-kt)**2,Ut=(3*z-D-2*At)**2,Nt=(3*Z-p-2*kt)**2;return Math.max(St,Ut)+Math.max(Ht,Nt)<=10},yn=function(){let D=1/0,p=-1/0,L=1/0,_t=-1/0;for(const z of this.paths)for(const[Z,At,kt,Mt]of z){const St=f.Util.bezierBoundingBox(...Z,...At,...kt,...Mt);D=Math.min(D,St[0]),L=Math.min(L,St[1]),p=Math.max(p,St[2]),_t=Math.max(_t,St[3])}return[D,L,p,_t]},en=function(){return R(this,r)?Math.ceil(this.thickness*this.parent.scaleFactor):0},pe=function(D=!1){if(this.isEmpty())return;if(!R(this,r)){Dt(this,e,le).call(this);return}const p=Dt(this,e,yn).call(this),L=Dt(this,e,en).call(this);It(this,P,Math.max(Y,p[2]-p[0])),It(this,w,Math.max(Y,p[3]-p[1]));const _t=Math.ceil(L+R(this,P)*this.scaleFactor),z=Math.ceil(L+R(this,w)*this.scaleFactor),[Z,At]=this.parent.viewportBaseDimensions;this.width=_t/Z,this.height=z/At,It(this,b,_t/z),Dt(this,e,En).call(this);const kt=this.translationX,Mt=this.translationY;this.translationX=-p[0],this.translationY=-p[1],Dt(this,e,fe).call(this),Dt(this,e,le).call(this),It(this,u,_t),It(this,n,z),this.setDims(_t,z);const St=D?L/this.scaleFactor/2:0;this.translate(kt-this.translationX-St,Mt-this.translationY-St)},En=function(){const{style:D}=this.div;R(this,b)>=1?(D.minHeight=`${Y}px`,D.minWidth=`${Math.round(R(this,b)*Y)}px`):(D.minWidth=`${Y}px`,D.minHeight=`${Math.round(Y/R(this,b))}px`)},Ot(y,h),ee(y,"_defaultColor",null),ee(y,"_defaultOpacity",1),ee(y,"_defaultThickness",1),ee(y,"_l10nPromise"),ee(y,"_type","ink");let M=y;a.InkEditor=M}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.fitCurve=void 0;const f=A(26);a.fitCurve=f}),(m=>{function a(l,t,r){if(!Array.isArray(l))throw new TypeError("First argument should be an array");if(l.forEach(u=>{if(!Array.isArray(u)||u.some(n=>typeof n!="number")||u.length!==l[0].length)throw Error("Each point should be an array of numbers. Each point should have the same amount of numbers.")}),l=l.filter((u,n)=>n===0||!u.every((i,e)=>i===l[n-1][e])),l.length<2)return[];const o=l.length,v=P(l[1],l[0]),g=P(l[o-2],l[o-1]);return A(l,v,g,t,r)}function A(l,t,r,o,v){var u,n,i,e,E,x,j,I,yt,wt,bt,K,B;if(l.length===2)return K=S.vectorLen(S.subtract(l[0],l[1]))/3,u=[l[0],S.addArrays(l[0],S.mulItems(t,K)),S.addArrays(l[1],S.mulItems(r,K)),l[1]],[u];if(n=Y(l),[u,e,x]=f(l,n,n,t,r,v),e===0||e<o)return[u];if(e<o*o)for(i=n,E=e,j=x,B=0;B<20;B++){if(i=V(u,l,i),[u,e,x]=f(l,n,i,t,r,v),e<o)return[u];if(x===j){let U=e/E;if(U>.9999&&U<1.0001)break}E=e,j=x}return bt=[],I=S.subtract(l[x-1],l[x+1]),I.every(U=>U===0)&&(I=S.subtract(l[x-1],l[x]),[I[0],I[1]]=[-I[1],I[0]]),yt=S.normalize(I),wt=S.mulItems(yt,-1),bt=bt.concat(A(l.slice(0,x+1),t,yt,o,v)),bt=bt.concat(A(l.slice(x),wt,r,o,v)),bt}function f(l,t,r,o,v,g){var u,n,i;return u=_(l,r,o,v),[n,i]=M(l,u,t),g&&g({bez:u,points:l,params:t,maxErr:n,maxPoint:i}),[u,n,i]}function _(l,t,r,o){var v,g,u,n,i,e,E,x,j,I,yt,wt,bt,K,B,U,G,Q=l[0],xt=l[l.length-1];for(v=[Q,null,null,xt],g=S.zeros_Xx2x2(t.length),bt=0,K=t.length;bt<K;bt++)U=t[bt],G=1-U,u=g[bt],u[0]=S.mulItems(r,3*U*(G*G)),u[1]=S.mulItems(o,3*G*(U*U));for(n=[[0,0],[0,0]],i=[0,0],bt=0,K=l.length;bt<K;bt++)U=t[bt],u=g[bt],n[0][0]+=S.dot(u[0],u[0]),n[0][1]+=S.dot(u[0],u[1]),n[1][0]+=S.dot(u[0],u[1]),n[1][1]+=S.dot(u[1],u[1]),B=S.subtract(l[bt],F.q([Q,Q,xt,xt],U)),i[0]+=S.dot(u[0],B),i[1]+=S.dot(u[1],B);return e=n[0][0]*n[1][1]-n[1][0]*n[0][1],E=n[0][0]*i[1]-n[1][0]*i[0],x=i[0]*n[1][1]-i[1]*n[0][1],j=e===0?0:x/e,I=e===0?0:E/e,wt=S.vectorLen(S.subtract(Q,xt)),yt=1e-6*wt,j<yt||I<yt?(v[1]=S.addArrays(Q,S.mulItems(r,wt/3)),v[2]=S.addArrays(xt,S.mulItems(o,wt/3))):(v[1]=S.addArrays(Q,S.mulItems(r,j)),v[2]=S.addArrays(xt,S.mulItems(o,I))),v}function V(l,t,r){return r.map((o,v)=>q(l,t[v],o))}function q(l,t,r){var o=S.subtract(F.q(l,r),t),v=F.qprime(l,r),g=S.mulMatrix(o,v),u=S.sum(S.squareItems(v))+2*S.mulMatrix(o,F.qprimeprime(l,r));return u===0?r:r-g/u}function Y(l){var t=[],r,o,v;return l.forEach((g,u)=>{r=u?o+S.vectorLen(S.subtract(g,v)):0,t.push(r),o=r,v=g}),t=t.map(g=>g/o),t}function M(l,t,r){var o,v,g,u,n,i,e,E;v=0,g=Math.floor(l.length/2);const x=b(t,10);for(n=0,i=l.length;n<i;n++)e=l[n],E=w(t,r[n],x,10),u=S.subtract(F.q(t,E),e),o=u[0]*u[0]+u[1]*u[1],o>v&&(v=o,g=n);return[v,g]}var b=function(l,t){for(var r,o=[0],v=l[0],g=0,u=1;u<=t;u++)r=F.q(l,u/t),g+=S.vectorLen(S.subtract(r,v)),o.push(g),v=r;return o=o.map(n=>n/g),o};function w(l,t,r,o){if(t<0)return 0;if(t>1)return 1;for(var v,g,u,n,i,e=1;e<=o;e++)if(t<=r[e]){n=(e-1)/o,u=e/o,g=r[e-1],v=r[e],i=(t-g)/(v-g)*(u-n)+n;break}return i}function P(l,t){return S.normalize(S.subtract(l,t))}class S{static zeros_Xx2x2(t){for(var r=[];t--;)r.push([0,0]);return r}static mulItems(t,r){return t.map(o=>o*r)}static mulMatrix(t,r){return t.reduce((o,v,g)=>o+v*r[g],0)}static subtract(t,r){return t.map((o,v)=>o-r[v])}static addArrays(t,r){return t.map((o,v)=>o+r[v])}static addItems(t,r){return t.map(o=>o+r)}static sum(t){return t.reduce((r,o)=>r+o)}static dot(t,r){return S.mulMatrix(t,r)}static vectorLen(t){return Math.hypot(...t)}static divItems(t,r){return t.map(o=>o/r)}static squareItems(t){return t.map(r=>r*r)}static normalize(t){return this.divItems(t,this.vectorLen(t))}}class F{static q(t,r){var o=1-r,v=S.mulItems(t[0],o*o*o),g=S.mulItems(t[1],3*o*o*r),u=S.mulItems(t[2],3*o*r*r),n=S.mulItems(t[3],r*r*r);return S.addArrays(S.addArrays(v,g),S.addArrays(u,n))}static qprime(t,r){var o=1-r,v=S.mulItems(S.subtract(t[1],t[0]),3*o*o),g=S.mulItems(S.subtract(t[2],t[1]),6*o*r),u=S.mulItems(S.subtract(t[3],t[2]),3*r*r);return S.addArrays(S.addArrays(v,g),u)}static qprimeprime(t,r){return S.addArrays(S.mulItems(S.addArrays(S.subtract(t[2],S.mulItems(t[1],2)),t[0]),6*(1-r)),S.mulItems(S.addArrays(S.subtract(t[3],S.mulItems(t[2],2)),t[1]),6*r))}}m.exports=a,m.exports.fitCubic=A,m.exports.createTangent=P}),((m,a,A)=>{var h,Cn,vn,Fn;Object.defineProperty(a,"__esModule",{value:!0}),a.AnnotationLayer=void 0;var f=A(1),_=A(8),V=A(5),q=A(28),Y=A(29);const M=1e3,b=9,w=new WeakSet;function P(W){return{width:W[2]-W[0],height:W[3]-W[1]}}class S{static create(s){switch(s.data.annotationType){case f.AnnotationType.LINK:return new l(s);case f.AnnotationType.TEXT:return new t(s);case f.AnnotationType.WIDGET:switch(s.data.fieldType){case"Tx":return new o(s);case"Btn":return s.data.radioButton?new g(s):s.data.checkBox?new v(s):new u(s);case"Ch":return new n(s)}return new r(s);case f.AnnotationType.POPUP:return new i(s);case f.AnnotationType.FREETEXT:return new E(s);case f.AnnotationType.LINE:return new x(s);case f.AnnotationType.SQUARE:return new j(s);case f.AnnotationType.CIRCLE:return new I(s);case f.AnnotationType.POLYLINE:return new yt(s);case f.AnnotationType.CARET:return new bt(s);case f.AnnotationType.INK:return new K(s);case f.AnnotationType.POLYGON:return new wt(s);case f.AnnotationType.HIGHLIGHT:return new B(s);case f.AnnotationType.UNDERLINE:return new U(s);case f.AnnotationType.SQUIGGLY:return new G(s);case f.AnnotationType.STRIKEOUT:return new Q(s);case f.AnnotationType.STAMP:return new xt(s);case f.AnnotationType.FILEATTACHMENT:return new Rt(s);default:return new F(s)}}}class F{constructor(s,{isRenderable:d=!1,ignoreBorder:C=!1,createQuadrilaterals:y=!1}={}){this.isRenderable=d,this.data=s.data,this.layer=s.layer,this.page=s.page,this.viewport=s.viewport,this.linkService=s.linkService,this.downloadManager=s.downloadManager,this.imageResourcesPath=s.imageResourcesPath,this.renderForms=s.renderForms,this.svgFactory=s.svgFactory,this.annotationStorage=s.annotationStorage,this.enableScripting=s.enableScripting,this.hasJSActions=s.hasJSActions,this._fieldObjects=s.fieldObjects,this._mouseState=s.mouseState,d&&(this.container=this._createContainer(C)),y&&(this.quadrilaterals=this._createQuadrilaterals(C))}_createContainer(s=!1){const d=this.data,C=this.page,y=this.viewport,k=document.createElement("section"),{width:N,height:D}=P(d.rect),[p,L,_t,z]=y.viewBox,Z=_t-p,At=z-L;k.setAttribute("data-annotation-id",d.id);const kt=f.Util.normalizeRect([d.rect[0],C.view[3]-d.rect[1]+C.view[1],d.rect[2],C.view[3]-d.rect[3]+C.view[1]]);if(!s&&d.borderStyle.width>0){k.style.borderWidth=`${d.borderStyle.width}px`;const St=d.borderStyle.horizontalCornerRadius,Ht=d.borderStyle.verticalCornerRadius;if(St>0||Ht>0){const Nt=`calc(${St}px * var(--scale-factor)) / calc(${Ht}px * var(--scale-factor))`;k.style.borderRadius=Nt}else if(this instanceof g){const Nt=`calc(${N}px * var(--scale-factor)) / calc(${D}px * var(--scale-factor))`;k.style.borderRadius=Nt}switch(d.borderStyle.style){case f.AnnotationBorderStyleType.SOLID:k.style.borderStyle="solid";break;case f.AnnotationBorderStyleType.DASHED:k.style.borderStyle="dashed";break;case f.AnnotationBorderStyleType.BEVELED:(0,f.warn)("Unimplemented border style: beveled");break;case f.AnnotationBorderStyleType.INSET:(0,f.warn)("Unimplemented border style: inset");break;case f.AnnotationBorderStyleType.UNDERLINE:k.style.borderBottomStyle="solid";break}const Ut=d.borderColor||null;Ut?k.style.borderColor=f.Util.makeHexColor(Ut[0]|0,Ut[1]|0,Ut[2]|0):k.style.borderWidth=0}k.style.left=`${100*(kt[0]-p)/Z}%`,k.style.top=`${100*(kt[1]-L)/At}%`;const{rotation:Mt}=d;return d.hasOwnCanvas||Mt===0?(k.style.width=`${100*N/Z}%`,k.style.height=`${100*D/At}%`):this.setRotation(Mt,k),k}setRotation(s,d=this.container){const[C,y,k,N]=this.viewport.viewBox,D=k-C,p=N-y,{width:L,height:_t}=P(this.data.rect);let z,Z;s%180===0?(z=100*L/D,Z=100*_t/p):(z=100*_t/D,Z=100*L/p),d.style.width=`${z}%`,d.style.height=`${Z}%`,d.setAttribute("data-main-rotation",(360-s)%360)}get _commonActions(){const s=(d,C,y)=>{const k=y.detail[d];y.target.style[C]=q.ColorConverters[`${k[0]}_HTML`](k.slice(1))};return(0,f.shadow)(this,"_commonActions",{display:d=>{const C=d.detail.display%2===1;this.container.style.visibility=C?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{hidden:C,print:d.detail.display===0||d.detail.display===3})},print:d=>{this.annotationStorage.setValue(this.data.id,{print:d.detail.print})},hidden:d=>{this.container.style.visibility=d.detail.hidden?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{hidden:d.detail.hidden})},focus:d=>{setTimeout(()=>d.target.focus({preventScroll:!1}),0)},userName:d=>{d.target.title=d.detail.userName},readonly:d=>{d.detail.readonly?d.target.setAttribute("readonly",""):d.target.removeAttribute("readonly")},required:d=>{this._setRequired(d.target,d.detail.required)},bgColor:d=>{s("bgColor","backgroundColor",d)},fillColor:d=>{s("fillColor","backgroundColor",d)},fgColor:d=>{s("fgColor","color",d)},textColor:d=>{s("textColor","color",d)},borderColor:d=>{s("borderColor","borderColor",d)},strokeColor:d=>{s("strokeColor","borderColor",d)},rotation:d=>{const C=d.detail.rotation;this.setRotation(C),this.annotationStorage.setValue(this.data.id,{rotation:C})}})}_dispatchEventFromSandbox(s,d){const C=this._commonActions;for(const y of Object.keys(d.detail)){const k=s[y]||C[y];k&&k(d)}}_setDefaultPropertiesFromJS(s){if(!this.enableScripting)return;const d=this.annotationStorage.getRawValue(this.data.id);if(!d)return;const C=this._commonActions;for(const[y,k]of Object.entries(d)){const N=C[y];if(N){const D={detail:{[y]:k},target:s};N(D),delete d[y]}}}_createQuadrilaterals(s=!1){if(!this.data.quadPoints)return null;const d=[],C=this.data.rect;for(const y of this.data.quadPoints)this.data.rect=[y[2].x,y[2].y,y[1].x,y[1].y],d.push(this._createContainer(s));return this.data.rect=C,d}_createPopup(s,d){let C=this.container;this.quadrilaterals&&(s=s||this.quadrilaterals,C=this.quadrilaterals[0]),s||(s=document.createElement("div"),s.className="popupTriggerArea",C.append(s));const k=new e({container:C,trigger:s,color:d.color,titleObj:d.titleObj,modificationDate:d.modificationDate,contentsObj:d.contentsObj,richText:d.richText,hideWrapper:!0}).render();k.style.left="100%",C.append(k)}_renderQuadrilaterals(s){for(const d of this.quadrilaterals)d.className=s;return this.quadrilaterals}render(){(0,f.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(s,d=null){const C=[];if(this._fieldObjects){const y=this._fieldObjects[s];if(y)for(const{page:k,id:N,exportValues:D}of y){if(k===-1||N===d)continue;const p=typeof D=="string"?D:null,L=document.querySelector(`[data-element-id="${N}"]`);if(L&&!w.has(L)){(0,f.warn)(`_getElementsByName - element not allowed: ${N}`);continue}C.push({id:N,exportValue:p,domElement:L})}return C}for(const y of document.getElementsByName(s)){const{id:k,exportValue:N}=y;k!==d&&w.has(y)&&C.push({id:k,exportValue:N,domElement:y})}return C}static get platform(){const s=typeof navigator<"u"?navigator.platform:"";return(0,f.shadow)(this,"platform",{isWin:s.includes("Win"),isMac:s.includes("Mac")})}}class l extends F{constructor(s,d=null){super(s,{isRenderable:!0,ignoreBorder:!!(d!=null&&d.ignoreBorder),createQuadrilaterals:!0}),this.isTooltipOnly=s.data.isTooltipOnly}render(){const{data:s,linkService:d}=this,C=document.createElement("a");C.setAttribute("data-element-id",s.id);let y=!1;return s.url?(d.addLinkAttributes(C,s.url,s.newWindow),y=!0):s.action?(this._bindNamedAction(C,s.action),y=!0):s.dest?(this._bindLink(C,s.dest),y=!0):(s.actions&&(s.actions.Action||s.actions["Mouse Up"]||s.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(C,s),y=!0),s.resetForm?(this._bindResetFormAction(C,s.resetForm),y=!0):this.isTooltipOnly&&!y&&(this._bindLink(C,""),y=!0)),this.quadrilaterals?this._renderQuadrilaterals("linkAnnotation").map((k,N)=>{const D=N===0?C:C.cloneNode();return k.append(D),k}):(this.container.className="linkAnnotation",y&&this.container.append(C),this.container)}_bindLink(s,d){s.href=this.linkService.getDestinationHash(d),s.onclick=()=>(d&&this.linkService.goToDestination(d),!1),(d||d==="")&&(s.className="internalLink")}_bindNamedAction(s,d){s.href=this.linkService.getAnchorUrl(""),s.onclick=()=>(this.linkService.executeNamedAction(d),!1),s.className="internalLink"}_bindJSAction(s,d){s.href=this.linkService.getAnchorUrl("");const C=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const y of Object.keys(d.actions)){const k=C.get(y);k&&(s[k]=()=>{var N;return(N=this.linkService.eventBus)==null||N.dispatch("dispatcheventinsandbox",{source:this,detail:{id:d.id,name:y}}),!1})}s.onclick||(s.onclick=()=>!1),s.className="internalLink"}_bindResetFormAction(s,d){const C=s.onclick;if(C||(s.href=this.linkService.getAnchorUrl("")),s.className="internalLink",!this._fieldObjects){(0,f.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),C||(s.onclick=()=>!1);return}s.onclick=()=>{var _t;C&&C();const{fields:y,refs:k,include:N}=d,D=[];if(y.length!==0||k.length!==0){const z=new Set(k);for(const Z of y){const At=this._fieldObjects[Z]||[];for(const{id:kt}of At)z.add(kt)}for(const Z of Object.values(this._fieldObjects))for(const At of Z)z.has(At.id)===N&&D.push(At)}else for(const z of Object.values(this._fieldObjects))D.push(...z);const p=this.annotationStorage,L=[];for(const z of D){const{id:Z}=z;switch(L.push(Z),z.type){case"text":{const kt=z.defaultValue||"";p.setValue(Z,{value:kt});break}case"checkbox":case"radiobutton":{const kt=z.defaultValue===z.exportValues;p.setValue(Z,{value:kt});break}case"combobox":case"listbox":{const kt=z.defaultValue||"";p.setValue(Z,{value:kt});break}default:continue}const At=document.querySelector(`[data-element-id="${Z}"]`);if(At){if(!w.has(At)){(0,f.warn)(`_bindResetFormAction - element not allowed: ${Z}`);continue}}else continue;At.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((_t=this.linkService.eventBus)==null||_t.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:L,name:"ResetForm"}})),!1}}}class t extends F{constructor(s){var C,y,k;const d=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(y=s.data.contentsObj)!=null&&y.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:d})}render(){this.container.className="textAnnotation";const s=document.createElement("img");return s.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",s.alt="[{{type}} Annotation]",s.dataset.l10nId="text_annotation_type",s.dataset.l10nArgs=JSON.stringify({type:this.data.name}),this.data.hasPopup||this._createPopup(s,this.data),this.container.append(s),this.container}}class r extends F{render(){return this.data.alternativeText&&(this.container.title=this.data.alternativeText),this.container}_getKeyModifier(s){const{isWin:d,isMac:C}=F.platform;return d&&s.ctrlKey||C&&s.metaKey}_setEventListener(s,d,C,y){d.includes("mouse")?s.addEventListener(d,k=>{var N;(N=this.linkService.eventBus)==null||N.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:C,value:y(k),shift:k.shiftKey,modifier:this._getKeyModifier(k)}})}):s.addEventListener(d,k=>{var N;(N=this.linkService.eventBus)==null||N.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:C,value:y(k)}})})}_setEventListeners(s,d,C){var y;for(const[k,N]of d)(N==="Action"||(y=this.data.actions)!=null&&y[N])&&this._setEventListener(s,k,N,C)}_setBackgroundColor(s){const d=this.data.backgroundColor||null;s.style.backgroundColor=d===null?"transparent":f.Util.makeHexColor(d[0],d[1],d[2])}_setTextStyle(s){const d=["left","center","right"],{fontColor:C}=this.data.defaultAppearanceData,y=this.data.defaultAppearanceData.fontSize||b,k=s.style;let N;if(this.data.multiLine){const D=Math.abs(this.data.rect[3]-this.data.rect[1]),p=Math.round(D/(f.LINE_FACTOR*y))||1,L=D/p;N=Math.min(y,Math.round(L/f.LINE_FACTOR))}else{const D=Math.abs(this.data.rect[3]-this.data.rect[1]);N=Math.min(y,Math.round(D/f.LINE_FACTOR))}k.fontSize=`calc(${N}px * var(--scale-factor))`,k.color=f.Util.makeHexColor(C[0],C[1],C[2]),this.data.textAlignment!==null&&(k.textAlign=d[this.data.textAlignment])}_setRequired(s,d){d?s.setAttribute("required",!0):s.removeAttribute("required"),s.setAttribute("aria-required",d)}}class o extends r{constructor(s){const d=s.renderForms||!s.data.hasAppearance&&!!s.data.fieldValue;super(s,{isRenderable:d})}setPropertyOnSiblings(s,d,C,y){const k=this.annotationStorage;for(const N of this._getElementsByName(s.name,s.id))N.domElement&&(N.domElement[d]=C),k.setValue(N.id,{[y]:C})}render(){var y;const s=this.annotationStorage,d=this.data.id;this.container.className="textWidgetAnnotation";let C=null;if(this.renderForms){const k=s.getValue(d,{value:this.data.fieldValue});let N=k.formattedValue||k.value||"";const D=s.getValue(d,{charLimit:this.data.maxLen}).charLimit;D&&N.length>D&&(N=N.slice(0,D));const p={userValue:N,formattedValue:null,valueOnFocus:""};this.data.multiLine?(C=document.createElement("textarea"),C.textContent=N,this.data.doNotScroll&&(C.style.overflowY="hidden")):(C=document.createElement("input"),C.type="text",C.setAttribute("value",N),this.data.doNotScroll&&(C.style.overflowX="hidden")),w.add(C),C.setAttribute("data-element-id",d),C.disabled=this.data.readOnly,C.name=this.data.fieldName,C.tabIndex=M,this._setRequired(C,this.data.required),D&&(C.maxLength=D),C.addEventListener("input",_t=>{s.setValue(d,{value:_t.target.value}),this.setPropertyOnSiblings(C,"value",_t.target.value,"value")}),C.addEventListener("resetform",_t=>{const z=this.data.defaultFieldValue??"";C.value=p.userValue=z,p.formattedValue=null});let L=_t=>{const{formattedValue:z}=p;z!=null&&(_t.target.value=z),_t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){C.addEventListener("focus",z=>{p.userValue&&(z.target.value=p.userValue),p.valueOnFocus=z.target.value}),C.addEventListener("updatefromsandbox",z=>{const Z={value(At){p.userValue=At.detail.value??"",s.setValue(d,{value:p.userValue.toString()}),At.target.value=p.userValue},formattedValue(At){const{formattedValue:kt}=At.detail;p.formattedValue=kt,kt!=null&&At.target!==document.activeElement&&(At.target.value=kt),s.setValue(d,{formattedValue:kt})},selRange(At){At.target.setSelectionRange(...At.detail.selRange)},charLimit:At=>{var Ht;const{charLimit:kt}=At.detail,{target:Mt}=At;if(kt===0){Mt.removeAttribute("maxLength");return}Mt.setAttribute("maxLength",kt);let St=p.userValue;!St||St.length<=kt||(St=St.slice(0,kt),Mt.value=p.userValue=St,s.setValue(d,{value:St}),(Ht=this.linkService.eventBus)==null||Ht.dispatch("dispatcheventinsandbox",{source:this,detail:{id:d,name:"Keystroke",value:St,willCommit:!0,commitKey:1,selStart:Mt.selectionStart,selEnd:Mt.selectionEnd}}))}};this._dispatchEventFromSandbox(Z,z)}),C.addEventListener("keydown",z=>{var kt;let Z=-1;if(z.key==="Escape"?Z=0:z.key==="Enter"?Z=2:z.key==="Tab"&&(Z=3),Z===-1)return;const{value:At}=z.target;p.valueOnFocus!==At&&(p.userValue=At,(kt=this.linkService.eventBus)==null||kt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:d,name:"Keystroke",value:At,willCommit:!0,commitKey:Z,selStart:z.target.selectionStart,selEnd:z.target.selectionEnd}}))});const _t=L;L=null,C.addEventListener("blur",z=>{var At;const{value:Z}=z.target;p.userValue=Z,this._mouseState.isDown&&p.valueOnFocus!==Z&&((At=this.linkService.eventBus)==null||At.dispatch("dispatcheventinsandbox",{source:this,detail:{id:d,name:"Keystroke",value:Z,willCommit:!0,commitKey:1,selStart:z.target.selectionStart,selEnd:z.target.selectionEnd}})),_t(z)}),(y=this.data.actions)!=null&&y.Keystroke&&C.addEventListener("beforeinput",z=>{var Nt;const{data:Z,target:At}=z,{value:kt,selectionStart:Mt,selectionEnd:St}=At;let Ht=Mt,Ut=St;switch(z.inputType){case"deleteWordBackward":{const zt=kt.substring(0,Mt).match(/\w*[^\w]*$/);zt&&(Ht-=zt[0].length);break}case"deleteWordForward":{const zt=kt.substring(Mt).match(/^[^\w]*\w*/);zt&&(Ut+=zt[0].length);break}case"deleteContentBackward":Mt===St&&(Ht-=1);break;case"deleteContentForward":Mt===St&&(Ut+=1);break}z.preventDefault(),(Nt=this.linkService.eventBus)==null||Nt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:d,name:"Keystroke",value:kt,change:Z||"",willCommit:!1,selStart:Ht,selEnd:Ut}})}),this._setEventListeners(C,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],z=>z.target.value)}if(L&&C.addEventListener("blur",L),this.data.comb){const z=(this.data.rect[2]-this.data.rect[0])/D;C.classList.add("comb"),C.style.letterSpacing=`calc(${z}px * var(--scale-factor) - 1ch)`}}else C=document.createElement("div"),C.textContent=this.data.fieldValue,C.style.verticalAlign="middle",C.style.display="table-cell";return this._setTextStyle(C),this._setBackgroundColor(C),this._setDefaultPropertiesFromJS(C),this.container.append(C),this.container}}class v extends r{constructor(s){super(s,{isRenderable:s.renderForms})}render(){const s=this.annotationStorage,d=this.data,C=d.id;let y=s.getValue(C,{value:d.exportValue===d.fieldValue}).value;typeof y=="string"&&(y=y!=="Off",s.setValue(C,{value:y})),this.container.className="buttonWidgetAnnotation checkBox";const k=document.createElement("input");return w.add(k),k.setAttribute("data-element-id",C),k.disabled=d.readOnly,this._setRequired(k,this.data.required),k.type="checkbox",k.name=d.fieldName,y&&k.setAttribute("checked",!0),k.setAttribute("exportValue",d.exportValue),k.tabIndex=M,k.addEventListener("change",N=>{const{name:D,checked:p}=N.target;for(const L of this._getElementsByName(D,C)){const _t=p&&L.exportValue===d.exportValue;L.domElement&&(L.domElement.checked=_t),s.setValue(L.id,{value:_t})}s.setValue(C,{value:p})}),k.addEventListener("resetform",N=>{const D=d.defaultFieldValue||"Off";N.target.checked=D===d.exportValue}),this.enableScripting&&this.hasJSActions&&(k.addEventListener("updatefromsandbox",N=>{const D={value(p){p.target.checked=p.detail.value!=="Off",s.setValue(C,{value:p.target.checked})}};this._dispatchEventFromSandbox(D,N)}),this._setEventListeners(k,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],N=>N.target.checked)),this._setBackgroundColor(k),this._setDefaultPropertiesFromJS(k),this.container.append(k),this.container}}class g extends r{constructor(s){super(s,{isRenderable:s.renderForms})}render(){this.container.className="buttonWidgetAnnotation radioButton";const s=this.annotationStorage,d=this.data,C=d.id;let y=s.getValue(C,{value:d.fieldValue===d.buttonValue}).value;typeof y=="string"&&(y=y!==d.buttonValue,s.setValue(C,{value:y}));const k=document.createElement("input");if(w.add(k),k.setAttribute("data-element-id",C),k.disabled=d.readOnly,this._setRequired(k,this.data.required),k.type="radio",k.name=d.fieldName,y&&k.setAttribute("checked",!0),k.tabIndex=M,k.addEventListener("change",N=>{const{name:D,checked:p}=N.target;for(const L of this._getElementsByName(D,C))s.setValue(L.id,{value:!1});s.setValue(C,{value:p})}),k.addEventListener("resetform",N=>{const D=d.defaultFieldValue;N.target.checked=D!=null&&D===d.buttonValue}),this.enableScripting&&this.hasJSActions){const N=d.buttonValue;k.addEventListener("updatefromsandbox",D=>{const p={value:L=>{const _t=N===L.detail.value;for(const z of this._getElementsByName(L.target.name)){const Z=_t&&z.id===C;z.domElement&&(z.domElement.checked=Z),s.setValue(z.id,{value:Z})}}};this._dispatchEventFromSandbox(p,D)}),this._setEventListeners(k,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],D=>D.target.checked)}return this._setBackgroundColor(k),this._setDefaultPropertiesFromJS(k),this.container.append(k),this.container}}class u extends l{constructor(s){super(s,{ignoreBorder:s.data.hasAppearance})}render(){const s=super.render();s.className="buttonWidgetAnnotation pushButton",this.data.alternativeText&&(s.title=this.data.alternativeText);const d=s.lastChild;return this.enableScripting&&this.hasJSActions&&d&&(this._setDefaultPropertiesFromJS(d),d.addEventListener("updatefromsandbox",C=>{this._dispatchEventFromSandbox({},C)})),s}}class n extends r{constructor(s){super(s,{isRenderable:s.renderForms})}render(){this.container.className="choiceWidgetAnnotation";const s=this.annotationStorage,d=this.data.id,C=s.getValue(d,{value:this.data.fieldValue}),y=document.createElement("select");w.add(y),y.setAttribute("data-element-id",d),y.disabled=this.data.readOnly,this._setRequired(y,this.data.required),y.name=this.data.fieldName,y.tabIndex=M;let k=this.data.combo&&this.data.options.length>0;this.data.combo||(y.size=this.data.options.length,this.data.multiSelect&&(y.multiple=!0)),y.addEventListener("resetform",L=>{const _t=this.data.defaultFieldValue;for(const z of y.options)z.selected=z.value===_t});for(const L of this.data.options){const _t=document.createElement("option");_t.textContent=L.displayValue,_t.value=L.exportValue,C.value.includes(L.exportValue)&&(_t.setAttribute("selected",!0),k=!1),y.append(_t)}let N=null;if(k){const L=document.createElement("option");L.value=" ",L.setAttribute("hidden",!0),L.setAttribute("selected",!0),y.prepend(L),N=()=>{L.remove(),y.removeEventListener("input",N),N=null},y.addEventListener("input",N)}const D=(L,_t)=>{const z=_t?"value":"textContent",Z=L.target.options;return L.target.multiple?Array.prototype.filter.call(Z,At=>At.selected).map(At=>At[z]):Z.selectedIndex===-1?null:Z[Z.selectedIndex][z]},p=L=>{const _t=L.target.options;return Array.prototype.map.call(_t,z=>({displayValue:z.textContent,exportValue:z.value}))};return this.enableScripting&&this.hasJSActions?(y.addEventListener("updatefromsandbox",L=>{const _t={value(z){N==null||N();const Z=z.detail.value,At=new Set(Array.isArray(Z)?Z:[Z]);for(const kt of y.options)kt.selected=At.has(kt.value);s.setValue(d,{value:D(z,!0)})},multipleSelection(z){y.multiple=!0},remove(z){const Z=y.options,At=z.detail.remove;Z[At].selected=!1,y.remove(At),Z.length>0&&Array.prototype.findIndex.call(Z,Mt=>Mt.selected)===-1&&(Z[0].selected=!0),s.setValue(d,{value:D(z,!0),items:p(z)})},clear(z){for(;y.length!==0;)y.remove(0);s.setValue(d,{value:null,items:[]})},insert(z){const{index:Z,displayValue:At,exportValue:kt}=z.detail.insert,Mt=y.children[Z],St=document.createElement("option");St.textContent=At,St.value=kt,Mt?Mt.before(St):y.append(St),s.setValue(d,{value:D(z,!0),items:p(z)})},items(z){const{items:Z}=z.detail;for(;y.length!==0;)y.remove(0);for(const At of Z){const{displayValue:kt,exportValue:Mt}=At,St=document.createElement("option");St.textContent=kt,St.value=Mt,y.append(St)}y.options.length>0&&(y.options[0].selected=!0),s.setValue(d,{value:D(z,!0),items:p(z)})},indices(z){const Z=new Set(z.detail.indices);for(const At of z.target.options)At.selected=Z.has(At.index);s.setValue(d,{value:D(z,!0)})},editable(z){z.target.disabled=!z.detail.editable}};this._dispatchEventFromSandbox(_t,L)}),y.addEventListener("input",L=>{var Z;const _t=D(L,!0),z=D(L,!1);s.setValue(d,{value:_t}),(Z=this.linkService.eventBus)==null||Z.dispatch("dispatcheventinsandbox",{source:this,detail:{id:d,name:"Keystroke",value:z,changeEx:_t,willCommit:!0,commitKey:1,keyDown:!1}})}),this._setEventListeners(y,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"]],L=>L.target.checked)):y.addEventListener("input",function(L){s.setValue(d,{value:D(L,!0)})}),this.data.combo&&this._setTextStyle(y),this._setBackgroundColor(y),this._setDefaultPropertiesFromJS(y),this.container.append(y),this.container}}class i extends F{constructor(s){var C,y,k;const d=!!((C=s.data.titleObj)!=null&&C.str||(y=s.data.contentsObj)!=null&&y.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:d})}render(){const s=["Line","Square","Circle","PolyLine","Polygon","Ink"];if(this.container.className="popupAnnotation",s.includes(this.data.parentType))return this.container;const d=`[data-annotation-id="${this.data.parentId}"]`,C=this.layer.querySelectorAll(d);if(C.length===0)return this.container;const y=new e({container:this.container,trigger:Array.from(C),color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText}),k=this.page,N=f.Util.normalizeRect([this.data.parentRect[0],k.view[3]-this.data.parentRect[1]+k.view[1],this.data.parentRect[2],k.view[3]-this.data.parentRect[3]+k.view[1]]),D=N[0]+this.data.parentRect[2]-this.data.parentRect[0],p=N[1],[L,_t,z,Z]=this.viewport.viewBox,At=z-L,kt=Z-_t;return this.container.style.left=`${100*(D-L)/At}%`,this.container.style.top=`${100*(p-_t)/kt}%`,this.container.append(y.render()),this.container}}class e{constructor(s){this.container=s.container,this.trigger=s.trigger,this.color=s.color,this.titleObj=s.titleObj,this.modificationDate=s.modificationDate,this.contentsObj=s.contentsObj,this.richText=s.richText,this.hideWrapper=s.hideWrapper||!1,this.pinned=!1}render(){var D,p;const d=document.createElement("div");d.className="popupWrapper",this.hideElement=this.hideWrapper?d:this.container,this.hideElement.hidden=!0;const C=document.createElement("div");C.className="popup";const y=this.color;if(y){const L=.7*(255-y[0])+y[0],_t=.7*(255-y[1])+y[1],z=.7*(255-y[2])+y[2];C.style.backgroundColor=f.Util.makeHexColor(L|0,_t|0,z|0)}const k=document.createElement("h1");k.dir=this.titleObj.dir,k.textContent=this.titleObj.str,C.append(k);const N=_.PDFDateString.toDateObject(this.modificationDate);if(N){const L=document.createElement("span");L.className="popupDate",L.textContent="{{date}}, {{time}}",L.dataset.l10nId="annotation_date_string",L.dataset.l10nArgs=JSON.stringify({date:N.toLocaleDateString(),time:N.toLocaleTimeString()}),C.append(L)}if((D=this.richText)!=null&&D.str&&(!((p=this.contentsObj)!=null&&p.str)||this.contentsObj.str===this.richText.str))Y.XfaLayer.render({xfaHtml:this.richText.html,intent:"richText",div:C}),C.lastChild.className="richText popupContent";else{const L=this._formatContents(this.contentsObj);C.append(L)}Array.isArray(this.trigger)||(this.trigger=[this.trigger]);for(const L of this.trigger)L.addEventListener("click",this._toggle.bind(this)),L.addEventListener("mouseover",this._show.bind(this,!1)),L.addEventListener("mouseout",this._hide.bind(this,!1));return C.addEventListener("click",this._hide.bind(this,!0)),d.append(C),d}_formatContents({str:s,dir:d}){const C=document.createElement("p");C.className="popupContent",C.dir=d;const y=s.split(/(?:\r\n?|\n)/);for(let k=0,N=y.length;k<N;++k){const D=y[k];C.append(document.createTextNode(D)),k<N-1&&C.append(document.createElement("br"))}return C}_toggle(){this.pinned?this._hide(!0):this._show(!0)}_show(s=!1){s&&(this.pinned=!0),this.hideElement.hidden&&(this.hideElement.hidden=!1,this.container.style.zIndex=parseInt(this.container.style.zIndex)+1e3)}_hide(s=!0){s&&(this.pinned=!1),!this.hideElement.hidden&&!this.pinned&&(this.hideElement.hidden=!0,this.container.style.zIndex=parseInt(this.container.style.zIndex)-1e3)}}class E extends F{constructor(s){var C,y,k;const d=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(y=s.data.contentsObj)!=null&&y.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:d,ignoreBorder:!0}),this.textContent=s.data.textContent}render(){if(this.container.className="freeTextAnnotation",this.textContent){const s=document.createElement("div");s.className="annotationTextContent",s.setAttribute("role","comment");for(const d of this.textContent){const C=document.createElement("span");C.textContent=d,s.append(C)}this.container.append(s)}return this.data.hasPopup||this._createPopup(null,this.data),this.container}}class x extends F{constructor(s){var C,y,k;const d=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(y=s.data.contentsObj)!=null&&y.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:d,ignoreBorder:!0})}render(){this.container.className="lineAnnotation";const s=this.data,{width:d,height:C}=P(s.rect),y=this.svgFactory.create(d,C,!0),k=this.svgFactory.createElement("svg:line");return k.setAttribute("x1",s.rect[2]-s.lineCoordinates[0]),k.setAttribute("y1",s.rect[3]-s.lineCoordinates[1]),k.setAttribute("x2",s.rect[2]-s.lineCoordinates[2]),k.setAttribute("y2",s.rect[3]-s.lineCoordinates[3]),k.setAttribute("stroke-width",s.borderStyle.width||1),k.setAttribute("stroke","transparent"),k.setAttribute("fill","transparent"),y.append(k),this.container.append(y),this._createPopup(k,s),this.container}}class j extends F{constructor(s){var C,y,k;const d=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(y=s.data.contentsObj)!=null&&y.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:d,ignoreBorder:!0})}render(){this.container.className="squareAnnotation";const s=this.data,{width:d,height:C}=P(s.rect),y=this.svgFactory.create(d,C,!0),k=s.borderStyle.width,N=this.svgFactory.createElement("svg:rect");return N.setAttribute("x",k/2),N.setAttribute("y",k/2),N.setAttribute("width",d-k),N.setAttribute("height",C-k),N.setAttribute("stroke-width",k||1),N.setAttribute("stroke","transparent"),N.setAttribute("fill","transparent"),y.append(N),this.container.append(y),this._createPopup(N,s),this.container}}class I extends F{constructor(s){var C,y,k;const d=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(y=s.data.contentsObj)!=null&&y.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:d,ignoreBorder:!0})}render(){this.container.className="circleAnnotation";const s=this.data,{width:d,height:C}=P(s.rect),y=this.svgFactory.create(d,C,!0),k=s.borderStyle.width,N=this.svgFactory.createElement("svg:ellipse");return N.setAttribute("cx",d/2),N.setAttribute("cy",C/2),N.setAttribute("rx",d/2-k/2),N.setAttribute("ry",C/2-k/2),N.setAttribute("stroke-width",k||1),N.setAttribute("stroke","transparent"),N.setAttribute("fill","transparent"),y.append(N),this.container.append(y),this._createPopup(N,s),this.container}}class yt extends F{constructor(s){var C,y,k;const d=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(y=s.data.contentsObj)!=null&&y.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:d,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.className=this.containerClassName;const s=this.data,{width:d,height:C}=P(s.rect),y=this.svgFactory.create(d,C,!0);let k=[];for(const D of s.vertices){const p=D.x-s.rect[0],L=s.rect[3]-D.y;k.push(p+","+L)}k=k.join(" ");const N=this.svgFactory.createElement(this.svgElementName);return N.setAttribute("points",k),N.setAttribute("stroke-width",s.borderStyle.width||1),N.setAttribute("stroke","transparent"),N.setAttribute("fill","transparent"),y.append(N),this.container.append(y),this._createPopup(N,s),this.container}}class wt extends yt{constructor(s){super(s),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class bt extends F{constructor(s){var C,y,k;const d=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(y=s.data.contentsObj)!=null&&y.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:d,ignoreBorder:!0})}render(){return this.container.className="caretAnnotation",this.data.hasPopup||this._createPopup(null,this.data),this.container}}class K extends F{constructor(s){var C,y,k;const d=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(y=s.data.contentsObj)!=null&&y.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:d,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline"}render(){this.container.className=this.containerClassName;const s=this.data,{width:d,height:C}=P(s.rect),y=this.svgFactory.create(d,C,!0);for(const k of s.inkLists){let N=[];for(const p of k){const L=p.x-s.rect[0],_t=s.rect[3]-p.y;N.push(`${L},${_t}`)}N=N.join(" ");const D=this.svgFactory.createElement(this.svgElementName);D.setAttribute("points",N),D.setAttribute("stroke-width",s.borderStyle.width||1),D.setAttribute("stroke","transparent"),D.setAttribute("fill","transparent"),this._createPopup(D,s),y.append(D)}return this.container.append(y),this.container}}class B extends F{constructor(s){var C,y,k;const d=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(y=s.data.contentsObj)!=null&&y.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:d,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("highlightAnnotation"):(this.container.className="highlightAnnotation",this.container)}}class U extends F{constructor(s){var C,y,k;const d=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(y=s.data.contentsObj)!=null&&y.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:d,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("underlineAnnotation"):(this.container.className="underlineAnnotation",this.container)}}class G extends F{constructor(s){var C,y,k;const d=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(y=s.data.contentsObj)!=null&&y.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:d,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("squigglyAnnotation"):(this.container.className="squigglyAnnotation",this.container)}}class Q extends F{constructor(s){var C,y,k;const d=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(y=s.data.contentsObj)!=null&&y.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:d,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("strikeoutAnnotation"):(this.container.className="strikeoutAnnotation",this.container)}}class xt extends F{constructor(s){var C,y,k;const d=!!(s.data.hasPopup||(C=s.data.titleObj)!=null&&C.str||(y=s.data.contentsObj)!=null&&y.str||(k=s.data.richText)!=null&&k.str);super(s,{isRenderable:d,ignoreBorder:!0})}render(){return this.container.className="stampAnnotation",this.data.hasPopup||this._createPopup(null,this.data),this.container}}class Rt extends F{constructor(s){var y;super(s,{isRenderable:!0});const{filename:d,content:C}=this.data.file;this.filename=(0,_.getFilenameFromUrl)(d),this.content=C,(y=this.linkService.eventBus)==null||y.dispatch("fileattachmentannotation",{source:this,filename:d,content:C})}render(){var d,C;this.container.className="fileAttachmentAnnotation";const s=document.createElement("div");return s.className="popupTriggerArea",s.addEventListener("dblclick",this._download.bind(this)),!this.data.hasPopup&&((d=this.data.titleObj)!=null&&d.str||(C=this.data.contentsObj)!=null&&C.str||this.data.richText)&&this._createPopup(s,this.data),this.container.append(s),this.container}_download(){var s;(s=this.downloadManager)==null||s.openOrDownloadData(this.container,this.content,this.filename)}}const $=class ${static render(s){var D,p;const{annotations:d,div:C,viewport:y,accessibilityManager:k}=s;Dt(this,h,vn).call(this,C,y);let N=0;for(const L of d){if(L.annotationType!==f.AnnotationType.POPUP){const{width:z,height:Z}=P(L.rect);if(z<=0||Z<=0)continue}const _t=S.create({data:L,layer:C,page:s.page,viewport:y,linkService:s.linkService,downloadManager:s.downloadManager,imageResourcesPath:s.imageResourcesPath||"",renderForms:s.renderForms!==!1,svgFactory:new _.DOMSVGFactory,annotationStorage:s.annotationStorage||new V.AnnotationStorage,enableScripting:s.enableScripting,hasJSActions:s.hasJSActions,fieldObjects:s.fieldObjects,mouseState:s.mouseState||{isDown:!1}});if(_t.isRenderable){const z=_t.render();if(L.hidden&&(z.style.visibility="hidden"),Array.isArray(z))for(const Z of z)Z.style.zIndex=N++,Dt(D=$,h,Cn).call(D,Z,L.id,C,k);else z.style.zIndex=N++,_t instanceof i?C.prepend(z):Dt(p=$,h,Cn).call(p,z,L.id,C,k)}}Dt(this,h,Fn).call(this,C,s.annotationCanvasMap)}static update(s){const{annotationCanvasMap:d,div:C,viewport:y}=s;Dt(this,h,vn).call(this,C,y),Dt(this,h,Fn).call(this,C,d),C.hidden=!1}};h=new WeakSet,Cn=function(s,d,C,y){const k=s.firstChild||s;k.id=`${_.AnnotationPrefix}${d}`,C.append(s),y==null||y.moveElementInDOM(C,s,k,!1)},vn=function(s,{width:d,height:C,rotation:y}){const{style:k}=s,N=y%180!==0,D=Math.floor(d)+"px",p=Math.floor(C)+"px";k.width=N?p:D,k.height=N?D:p,s.setAttribute("data-main-rotation",y)},Fn=function(s,d){if(d){for(const[C,y]of d){const k=s.querySelector(`[data-annotation-id="${C}"]`);if(!k)continue;const{firstChild:N}=k;N?N.nodeName==="CANVAS"?N.replaceWith(y):N.before(y):k.append(y)}d.clear()}},Ot($,h);let H=$;a.AnnotationLayer=H}),((m,a)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.ColorConverters=void 0;function A(_){return Math.floor(Math.max(0,Math.min(1,_))*255).toString(16).padStart(2,"0")}class f{static CMYK_G([V,q,Y,M]){return["G",1-Math.min(1,.3*V+.59*Y+.11*q+M)]}static G_CMYK([V]){return["CMYK",0,0,0,1-V]}static G_RGB([V]){return["RGB",V,V,V]}static G_HTML([V]){const q=A(V);return`#${q}${q}${q}`}static RGB_G([V,q,Y]){return["G",.3*V+.59*q+.11*Y]}static RGB_HTML([V,q,Y]){const M=A(V),b=A(q),w=A(Y);return`#${M}${b}${w}`}static T_HTML(){return"#00000000"}static CMYK_RGB([V,q,Y,M]){return["RGB",1-Math.min(1,V+M),1-Math.min(1,Y+M),1-Math.min(1,q+M)]}static CMYK_HTML(V){const q=this.CMYK_RGB(V).slice(1);return this.RGB_HTML(q)}static RGB_CMYK([V,q,Y]){const M=1-V,b=1-q,w=1-Y,P=Math.min(M,b,w);return["CMYK",M,b,w,P]}}a.ColorConverters=f}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.XfaLayer=void 0;var f=A(20);class _{static setupStorage(q,Y,M,b,w){const P=b.getValue(Y,{value:null});switch(M.name){case"textarea":if(P.value!==null&&(q.textContent=P.value),w==="print")break;q.addEventListener("input",S=>{b.setValue(Y,{value:S.target.value})});break;case"input":if(M.attributes.type==="radio"||M.attributes.type==="checkbox"){if(P.value===M.attributes.xfaOn?q.setAttribute("checked",!0):P.value===M.attributes.xfaOff&&q.removeAttribute("checked"),w==="print")break;q.addEventListener("change",S=>{b.setValue(Y,{value:S.target.checked?S.target.getAttribute("xfaOn"):S.target.getAttribute("xfaOff")})})}else{if(P.value!==null&&q.setAttribute("value",P.value),w==="print")break;q.addEventListener("input",S=>{b.setValue(Y,{value:S.target.value})})}break;case"select":if(P.value!==null)for(const S of M.children)S.attributes.value===P.value&&(S.attributes.selected=!0);q.addEventListener("input",S=>{const F=S.target.options,l=F.selectedIndex===-1?"":F[F.selectedIndex].value;b.setValue(Y,{value:l})});break}}static setAttributes({html:q,element:Y,storage:M=null,intent:b,linkService:w}){const{attributes:P}=Y,S=q instanceof HTMLAnchorElement;P.type==="radio"&&(P.name=`${P.name}-${b}`);for(const[F,l]of Object.entries(P))if(l!=null)switch(F){case"class":l.length&&q.setAttribute(F,l.join(" "));break;case"dataId":break;case"id":q.setAttribute("data-element-id",l);break;case"style":Object.assign(q.style,l);break;case"textContent":q.textContent=l;break;default:(!S||F!=="href"&&F!=="newWindow")&&q.setAttribute(F,l)}S&&w.addLinkAttributes(q,P.href,P.newWindow),M&&P.dataId&&this.setupStorage(q,P.dataId,Y,M)}static render(q){var t;const Y=q.annotationStorage,M=q.linkService,b=q.xfaHtml,w=q.intent||"display",P=document.createElement(b.name);b.attributes&&this.setAttributes({html:P,element:b,intent:w,linkService:M});const S=[[b,-1,P]],F=q.div;if(F.append(P),q.viewport){const r=`matrix(${q.viewport.transform.join(",")})`;F.style.transform=r}w!=="richText"&&F.setAttribute("class","xfaLayer xfaFont");const l=[];for(;S.length>0;){const[r,o,v]=S.at(-1);if(o+1===r.children.length){S.pop();continue}const g=r.children[++S.at(-1)[1]];if(g===null)continue;const{name:u}=g;if(u==="#text"){const i=document.createTextNode(g.value);l.push(i),v.append(i);continue}let n;if((t=g==null?void 0:g.attributes)!=null&&t.xmlns?n=document.createElementNS(g.attributes.xmlns,u):n=document.createElement(u),v.append(n),g.attributes&&this.setAttributes({html:n,element:g,storage:Y,intent:w,linkService:M}),g.children&&g.children.length>0)S.push([g,-1,n]);else if(g.value){const i=document.createTextNode(g.value);f.XfaText.shouldBuildText(u)&&l.push(i),n.append(i)}}for(const r of F.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))r.setAttribute("readOnly",!0);return{textDivs:l}}static update(q){const Y=`matrix(${q.viewport.transform.join(",")})`;q.div.style.transform=Y,q.div.hidden=!1}}a.XfaLayer=_}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.TextLayerRenderTask=void 0,a.renderTextLayer=v;var f=A(1),_=A(8);const V=1e5,q=30,Y=.8,M=new Map,b=/^\s+$/g;function w(g,u){const n=M.get(g);if(n)return n;u.save(),u.font=`${q}px ${g}`;const i=u.measureText("");let e=i.fontBoundingBoxAscent,E=Math.abs(i.fontBoundingBoxDescent);if(e){u.restore();const j=e/(e+E);return M.set(g,j),j}u.strokeStyle="red",u.clearRect(0,0,q,q),u.strokeText("g",0,0);let x=u.getImageData(0,0,q,q).data;E=0;for(let j=x.length-1-3;j>=0;j-=4)if(x[j]>0){E=Math.ceil(j/4/q);break}u.clearRect(0,0,q,q),u.strokeText("A",0,q),x=u.getImageData(0,0,q,q).data,e=0;for(let j=0,I=x.length;j<I;j+=4)if(x[j]>0){e=q-Math.floor(j/4/q);break}if(u.restore(),e){const j=e/(e+E);return M.set(g,j),j}return M.set(g,Y),Y}function P(g,u,n,i){const e=document.createElement("span"),E=g._enhanceTextSelection?{angle:0,canvasWidth:0,hasText:u.str!=="",hasEOL:u.hasEOL,originalTransform:null,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,scale:1,fontSize:0}:{angle:0,canvasWidth:0,hasText:u.str!=="",hasEOL:u.hasEOL,fontSize:0};g._textDivs.push(e);const x=f.Util.transform(g._viewport.transform,u.transform);let j=Math.atan2(x[1],x[0]);const I=n[u.fontName];I.vertical&&(j+=Math.PI/2);const yt=Math.hypot(x[2],x[3]),wt=yt*w(I.fontFamily,i);let bt,K;j===0?(bt=x[4],K=x[5]-wt):(bt=x[4]+wt*Math.sin(j),K=x[5]-wt*Math.cos(j)),e.style.left=`${bt}px`,e.style.top=`${K}px`,e.style.fontSize=`${yt}px`,e.style.fontFamily=I.fontFamily,E.fontSize=yt,e.setAttribute("role","presentation"),e.textContent=u.str,e.dir=u.dir,g._fontInspectorEnabled&&(e.dataset.fontName=u.fontName),j!==0&&(E.angle=j*(180/Math.PI));let B=!1;if(u.str.length>1||g._enhanceTextSelection&&b.test(u.str))B=!0;else if(u.str!==" "&&u.transform[0]!==u.transform[3]){const U=Math.abs(u.transform[0]),G=Math.abs(u.transform[3]);U!==G&&Math.max(U,G)/Math.min(U,G)>1.5&&(B=!0)}if(B&&(I.vertical?E.canvasWidth=u.height*g._viewport.scale:E.canvasWidth=u.width*g._viewport.scale),g._textDivProperties.set(e,E),g._textContentStream&&g._layoutText(e),g._enhanceTextSelection&&E.hasText){let U=1,G=0;j!==0&&(U=Math.cos(j),G=Math.sin(j));const Q=(I.vertical?u.height:u.width)*g._viewport.scale,xt=yt;let Rt,H;j!==0?(Rt=[U,G,-G,U,bt,K],H=f.Util.getAxialAlignedBoundingBox([0,0,Q,xt],Rt)):H=[bt,K,bt+Q,K+xt],g._bounds.push({left:H[0],top:H[1],right:H[2],bottom:H[3],div:e,size:[Q,xt],m:Rt})}}function S(g){if(g._canceled)return;const u=g._textDivs,n=g._capability,i=u.length;if(i>V){g._renderingDone=!0,n.resolve();return}if(!g._textContentStream)for(let e=0;e<i;e++)g._layoutText(u[e]);g._renderingDone=!0,n.resolve()}function F(g,u,n){let i=0;for(let e=0;e<n;e++){const E=g[u++];E>0&&(i=i?Math.min(E,i):E)}return i}function l(g){const u=g._bounds,n=g._viewport,i=t(n.width,n.height,u);for(let e=0;e<i.length;e++){const E=u[e].div,x=g._textDivProperties.get(E);if(x.angle===0){x.paddingLeft=u[e].left-i[e].left,x.paddingTop=u[e].top-i[e].top,x.paddingRight=i[e].right-u[e].right,x.paddingBottom=i[e].bottom-u[e].bottom,g._textDivProperties.set(E,x);continue}const j=i[e],I=u[e],yt=I.m,wt=yt[0],bt=yt[1],K=[[0,0],[0,I.size[1]],[I.size[0],0],I.size],B=new Float64Array(64);for(let G=0,Q=K.length;G<Q;G++){const xt=f.Util.applyTransform(K[G],yt);B[G+0]=wt&&(j.left-xt[0])/wt,B[G+4]=bt&&(j.top-xt[1])/bt,B[G+8]=wt&&(j.right-xt[0])/wt,B[G+12]=bt&&(j.bottom-xt[1])/bt,B[G+16]=bt&&(j.left-xt[0])/-bt,B[G+20]=wt&&(j.top-xt[1])/wt,B[G+24]=bt&&(j.right-xt[0])/-bt,B[G+28]=wt&&(j.bottom-xt[1])/wt,B[G+32]=wt&&(j.left-xt[0])/-wt,B[G+36]=bt&&(j.top-xt[1])/-bt,B[G+40]=wt&&(j.right-xt[0])/-wt,B[G+44]=bt&&(j.bottom-xt[1])/-bt,B[G+48]=bt&&(j.left-xt[0])/bt,B[G+52]=wt&&(j.top-xt[1])/-wt,B[G+56]=bt&&(j.right-xt[0])/bt,B[G+60]=wt&&(j.bottom-xt[1])/-wt}const U=1+Math.min(Math.abs(wt),Math.abs(bt));x.paddingLeft=F(B,32,16)/U,x.paddingTop=F(B,48,16)/U,x.paddingRight=F(B,0,16)/U,x.paddingBottom=F(B,16,16)/U,g._textDivProperties.set(E,x)}}function t(g,u,n){const i=n.map(function(E,x){return{x1:E.left,y1:E.top,x2:E.right,y2:E.bottom,index:x,x1New:void 0,x2New:void 0}});r(g,i);const e=new Array(n.length);for(const E of i){const x=E.index;e[x]={left:E.x1New,top:0,right:E.x2New,bottom:0}}n.map(function(E,x){const j=e[x],I=i[x];I.x1=E.top,I.y1=g-j.right,I.x2=E.bottom,I.y2=g-j.left,I.index=x,I.x1New=void 0,I.x2New=void 0}),r(u,i);for(const E of i){const x=E.index;e[x].top=E.x1New,e[x].bottom=E.x2New}return e}function r(g,u){u.sort(function(e,E){return e.x1-E.x1||e.index-E.index});const i=[{start:-1/0,end:1/0,boundary:{x1:-1/0,y1:-1/0,x2:0,y2:1/0,index:-1,x1New:0,x2New:0}}];for(const e of u){let E=0;for(;E<i.length&&i[E].end<=e.y1;)E++;let x=i.length-1;for(;x>=0&&i[x].start>=e.y2;)x--;let j,I,yt,wt,bt=-1/0;for(yt=E;yt<=x;yt++){j=i[yt],I=j.boundary;let U;I.x2>e.x1?U=I.index>e.index?I.x1New:e.x1:I.x2New===void 0?U=(I.x2+e.x1)/2:U=I.x2New,U>bt&&(bt=U)}for(e.x1New=bt,yt=E;yt<=x;yt++)j=i[yt],I=j.boundary,I.x2New===void 0?I.x2>e.x1?I.index>e.index&&(I.x2New=I.x2):I.x2New=bt:I.x2New>bt&&(I.x2New=Math.max(bt,I.x2));const K=[];let B=null;for(yt=E;yt<=x;yt++){j=i[yt],I=j.boundary;const U=I.x2>e.x2?I:e;B===U?K.at(-1).end=j.end:(K.push({start:j.start,end:j.end,boundary:U}),B=U)}for(i[E].start<e.y1&&(K[0].start=e.y1,K.unshift({start:i[E].start,end:e.y1,boundary:i[E].boundary})),e.y2<i[x].end&&(K.at(-1).end=e.y2,K.push({start:e.y2,end:i[x].end,boundary:i[x].boundary})),yt=E;yt<=x;yt++){if(j=i[yt],I=j.boundary,I.x2New!==void 0)continue;let U=!1;for(wt=E-1;!U&&wt>=0&&i[wt].start>=I.y1;wt--)U=i[wt].boundary===I;for(wt=x+1;!U&&wt<i.length&&i[wt].end<=I.y2;wt++)U=i[wt].boundary===I;for(wt=0;!U&&wt<K.length;wt++)U=K[wt].boundary===I;U||(I.x2New=bt)}Array.prototype.splice.apply(i,[E,x-E+1,...K])}for(const e of i){const E=e.boundary;E.x2New===void 0&&(E.x2New=Math.max(g,E.x2))}}class o{constructor({textContent:u,textContentStream:n,container:i,viewport:e,textDivs:E,textContentItemsStr:x,enhanceTextSelection:j}){var I;j&&(0,_.deprecated)("The `enhanceTextSelection` functionality will be removed in the future."),this._textContent=u,this._textContentStream=n,this._container=i,this._document=i.ownerDocument,this._viewport=e,this._textDivs=E||[],this._textContentItemsStr=x||[],this._enhanceTextSelection=!!j,this._fontInspectorEnabled=!!((I=globalThis.FontInspector)!=null&&I.enabled),this._reader=null,this._layoutTextLastFontSize=null,this._layoutTextLastFontFamily=null,this._layoutTextCtx=null,this._textDivProperties=new WeakMap,this._renderingDone=!1,this._canceled=!1,this._capability=(0,f.createPromiseCapability)(),this._renderTimer=null,this._bounds=[],this._devicePixelRatio=globalThis.devicePixelRatio||1,this._capability.promise.finally(()=>{this._enhanceTextSelection||(this._textDivProperties=null),this._layoutTextCtx&&(this._layoutTextCtx.canvas.width=0,this._layoutTextCtx.canvas.height=0,this._layoutTextCtx=null)}).catch(()=>{})}get promise(){return this._capability.promise}cancel(){this._canceled=!0,this._reader&&(this._reader.cancel(new f.AbortException("TextLayer task cancelled.")).catch(()=>{}),this._reader=null),this._renderTimer!==null&&(clearTimeout(this._renderTimer),this._renderTimer=null),this._capability.reject(new Error("TextLayer task cancelled."))}_processItems(u,n){for(let i=0,e=u.length;i<e;i++){if(u[i].str===void 0){if(u[i].type==="beginMarkedContentProps"||u[i].type==="beginMarkedContent"){const E=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),u[i].id!==null&&this._container.setAttribute("id",`${u[i].id}`),E.append(this._container)}else u[i].type==="endMarkedContent"&&(this._container=this._container.parentNode);continue}this._textContentItemsStr.push(u[i].str),P(this,u[i],n,this._layoutTextCtx)}}_layoutText(u){const n=this._textDivProperties.get(u);let i="";if(n.canvasWidth!==0&&n.hasText){const{fontFamily:e}=u.style,{fontSize:E}=n;(E!==this._layoutTextLastFontSize||e!==this._layoutTextLastFontFamily)&&(this._layoutTextCtx.font=`${E*this._devicePixelRatio}px ${e}`,this._layoutTextLastFontSize=E,this._layoutTextLastFontFamily=e);const{width:x}=this._layoutTextCtx.measureText(u.textContent);if(x>0){const j=this._devicePixelRatio*n.canvasWidth/x;this._enhanceTextSelection&&(n.scale=j),i=`scaleX(${j})`}}if(n.angle!==0&&(i=`rotate(${n.angle}deg) ${i}`),i.length>0&&(this._enhanceTextSelection&&(n.originalTransform=i),u.style.transform=i),n.hasText&&this._container.append(u),n.hasEOL){const e=document.createElement("br");e.setAttribute("role","presentation"),this._container.append(e)}}_render(u=0){const n=(0,f.createPromiseCapability)();let i=Object.create(null);const e=this._document.createElement("canvas");if(e.height=e.width=q,this._layoutTextCtx=e.getContext("2d",{alpha:!1}),this._textContent){const E=this._textContent.items,x=this._textContent.styles;this._processItems(E,x),n.resolve()}else if(this._textContentStream){const E=()=>{this._reader.read().then(({value:x,done:j})=>{if(j){n.resolve();return}Object.assign(i,x.styles),this._processItems(x.items,i),E()},n.reject)};this._reader=this._textContentStream.getReader(),E()}else throw new Error('Neither "textContent" nor "textContentStream" parameters specified.');n.promise.then(()=>{i=null,u?this._renderTimer=setTimeout(()=>{S(this),this._renderTimer=null},u):S(this)},this._capability.reject)}expandTextDivs(u=!1){if(!this._enhanceTextSelection||!this._renderingDone)return;this._bounds!==null&&(l(this),this._bounds=null);const n=[],i=[];for(let e=0,E=this._textDivs.length;e<E;e++){const x=this._textDivs[e],j=this._textDivProperties.get(x);j.hasText&&(u?(n.length=0,i.length=0,j.originalTransform&&n.push(j.originalTransform),j.paddingTop>0?(i.push(`${j.paddingTop}px`),n.push(`translateY(${-j.paddingTop}px)`)):i.push(0),j.paddingRight>0?i.push(`${j.paddingRight/j.scale}px`):i.push(0),j.paddingBottom>0?i.push(`${j.paddingBottom}px`):i.push(0),j.paddingLeft>0?(i.push(`${j.paddingLeft/j.scale}px`),n.push(`translateX(${-j.paddingLeft/j.scale}px)`)):i.push(0),x.style.padding=i.join(" "),n.length&&(x.style.transform=n.join(" "))):(x.style.padding=null,x.style.transform=j.originalTransform))}}}a.TextLayerRenderTask=o;function v(g){const u=new o({textContent:g.textContent,textContentStream:g.textContentStream,container:g.container,viewport:g.viewport,textDivs:g.textDivs,textContentItemsStr:g.textContentItemsStr,enhanceTextSelection:g.enhanceTextSelection});return u._render(g.timeout),u}}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.SVGGraphics=void 0;var f=A(8),_=A(1),V=A(3);let q=class{constructor(){(0,_.unreachable)("Not implemented: SVGGraphics")}};a.SVGGraphics=q;{let t=function(n){let i=[];const e=[];for(const E of n){if(E.fn==="save"){i.push({fnId:92,fn:"group",items:[]}),e.push(i),i=i.at(-1).items;continue}E.fn==="restore"?i=e.pop():i.push(E)}return i},r=function(n){if(Number.isInteger(n))return n.toString();const i=n.toFixed(10);let e=i.length-1;if(i[e]!=="0")return i;do e--;while(i[e]==="0");return i.substring(0,i[e]==="."?e:e+1)},o=function(n){if(n[4]===0&&n[5]===0){if(n[1]===0&&n[2]===0)return n[0]===1&&n[3]===1?"":`scale(${r(n[0])} ${r(n[3])})`;if(n[0]===n[3]&&n[1]===-n[2]){const i=Math.acos(n[0])*180/Math.PI;return`rotate(${r(i)})`}}else if(n[0]===1&&n[1]===0&&n[2]===0&&n[3]===1)return`translate(${r(n[4])} ${r(n[5])})`;return`matrix(${r(n[0])} ${r(n[1])} ${r(n[2])} ${r(n[3])} ${r(n[4])} ${r(n[5])})`};const Y={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},M="http://www.w3.org/XML/1998/namespace",b="http://www.w3.org/1999/xlink",w=["butt","round","square"],P=["miter","round","bevel"],S=function(n,i="",e=!1){if(URL.createObjectURL&&typeof Blob<"u"&&!e)return URL.createObjectURL(new Blob([n],{type:i}));const E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let x=`data:${i};base64,`;for(let j=0,I=n.length;j<I;j+=3){const yt=n[j]&255,wt=n[j+1]&255,bt=n[j+2]&255,K=yt>>2,B=(yt&3)<<4|wt>>4,U=j+1<I?(wt&15)<<2|bt>>6:64,G=j+2<I?bt&63:64;x+=E[K]+E[B]+E[U]+E[G]}return x},F=(function(){const n=new Uint8Array([137,80,78,71,13,10,26,10]),i=12,e=new Int32Array(256);for(let bt=0;bt<256;bt++){let K=bt;for(let B=0;B<8;B++)K&1?K=3988292384^K>>1&2147483647:K=K>>1&2147483647;e[bt]=K}function E(bt,K,B){let U=-1;for(let G=K;G<B;G++){const Q=(U^bt[G])&255,xt=e[Q];U=U>>>8^xt}return U^-1}function x(bt,K,B,U){let G=U;const Q=K.length;B[G]=Q>>24&255,B[G+1]=Q>>16&255,B[G+2]=Q>>8&255,B[G+3]=Q&255,G+=4,B[G]=bt.charCodeAt(0)&255,B[G+1]=bt.charCodeAt(1)&255,B[G+2]=bt.charCodeAt(2)&255,B[G+3]=bt.charCodeAt(3)&255,G+=4,B.set(K,G),G+=K.length;const xt=E(B,U+4,G);B[G]=xt>>24&255,B[G+1]=xt>>16&255,B[G+2]=xt>>8&255,B[G+3]=xt&255}function j(bt,K,B){let U=1,G=0;for(let Q=K;Q<B;++Q)U=(U+(bt[Q]&255))%65521,G=(G+U)%65521;return G<<16|U}function I(bt){if(!V.isNodeJS)return yt(bt);try{let K;parseInt(process.versions.node)>=8?K=bt:K=Buffer.from(bt);const B=require$$0.deflateSync(K,{level:9});return B instanceof Uint8Array?B:new Uint8Array(B)}catch(K){(0,_.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+K)}return yt(bt)}function yt(bt){let K=bt.length;const B=65535,U=Math.ceil(K/B),G=new Uint8Array(2+K+U*5+4);let Q=0;G[Q++]=120,G[Q++]=156;let xt=0;for(;K>B;)G[Q++]=0,G[Q++]=255,G[Q++]=255,G[Q++]=0,G[Q++]=0,G.set(bt.subarray(xt,xt+B),Q),Q+=B,xt+=B,K-=B;G[Q++]=1,G[Q++]=K&255,G[Q++]=K>>8&255,G[Q++]=~K&65535&255,G[Q++]=(~K&65535)>>8&255,G.set(bt.subarray(xt),Q),Q+=bt.length-xt;const Rt=j(bt,0,bt.length);return G[Q++]=Rt>>24&255,G[Q++]=Rt>>16&255,G[Q++]=Rt>>8&255,G[Q++]=Rt&255,G}function wt(bt,K,B,U){const G=bt.width,Q=bt.height;let xt,Rt,H;const h=bt.data;switch(K){case _.ImageKind.GRAYSCALE_1BPP:Rt=0,xt=1,H=G+7>>3;break;case _.ImageKind.RGB_24BPP:Rt=2,xt=8,H=G*3;break;case _.ImageKind.RGBA_32BPP:Rt=6,xt=8,H=G*4;break;default:throw new Error("invalid format")}const c=new Uint8Array((1+H)*Q);let T=0,O=0;for(let y=0;y<Q;++y)c[T++]=0,c.set(h.subarray(O,O+H),T),O+=H,T+=H;if(K===_.ImageKind.GRAYSCALE_1BPP&&U){T=0;for(let y=0;y<Q;y++){T++;for(let k=0;k<H;k++)c[T++]^=255}}const $=new Uint8Array([G>>24&255,G>>16&255,G>>8&255,G&255,Q>>24&255,Q>>16&255,Q>>8&255,Q&255,xt,Rt,0,0,0]),W=I(c),s=n.length+i*3+$.length+W.length,d=new Uint8Array(s);let C=0;return d.set(n,C),C+=n.length,x("IHDR",$,d,C),C+=i+$.length,x("IDATA",W,d,C),C+=i+W.length,x("IEND",new Uint8Array(0),d,C),S(d,"image/png",B)}return function(K,B,U){const G=K.kind===void 0?_.ImageKind.GRAYSCALE_1BPP:K.kind;return wt(K,G,B,U)}})();class l{constructor(){this.fontSizeScale=1,this.fontWeight=Y.fontWeight,this.fontSize=0,this.textMatrix=_.IDENTITY_MATRIX,this.fontMatrix=_.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=_.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=Y.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(i,e){this.x=i,this.y=e}}let v=0,g=0,u=0;a.SVGGraphics=q=class{constructor(n,i,e=!1){(0,f.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future."),this.svgFactory=new f.DOMSVGFactory,this.current=new l,this.transformMatrix=_.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=n,this.objs=i,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!e,this._operatorIdMapping=[];for(const E in _.OPS)this._operatorIdMapping[_.OPS[E]]=E}save(){this.transformStack.push(this.transformMatrix);const n=this.current;this.extraStack.push(n),this.current=n.clone()}restore(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}group(n){this.save(),this.executeOpTree(n),this.restore()}loadDependencies(n){const i=n.fnArray,e=n.argsArray;for(let E=0,x=i.length;E<x;E++)if(i[E]===_.OPS.dependency)for(const j of e[E]){const I=j.startsWith("g_")?this.commonObjs:this.objs,yt=new Promise(wt=>{I.get(j,wt)});this.current.dependencies.push(yt)}return Promise.all(this.current.dependencies)}transform(n,i,e,E,x,j){const I=[n,i,e,E,x,j];this.transformMatrix=_.Util.transform(this.transformMatrix,I),this.tgrp=null}getSVG(n,i){this.viewport=i;const e=this._initialize(i);return this.loadDependencies(n).then(()=>(this.transformMatrix=_.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(n)),e))}convertOpList(n){const i=this._operatorIdMapping,e=n.argsArray,E=n.fnArray,x=[];for(let j=0,I=E.length;j<I;j++){const yt=E[j];x.push({fnId:yt,fn:i[yt],args:e[j]})}return t(x)}executeOpTree(n){for(const i of n){const e=i.fn,E=i.fnId,x=i.args;switch(E|0){case _.OPS.beginText:this.beginText();break;case _.OPS.dependency:break;case _.OPS.setLeading:this.setLeading(x);break;case _.OPS.setLeadingMoveText:this.setLeadingMoveText(x[0],x[1]);break;case _.OPS.setFont:this.setFont(x);break;case _.OPS.showText:this.showText(x[0]);break;case _.OPS.showSpacedText:this.showText(x[0]);break;case _.OPS.endText:this.endText();break;case _.OPS.moveText:this.moveText(x[0],x[1]);break;case _.OPS.setCharSpacing:this.setCharSpacing(x[0]);break;case _.OPS.setWordSpacing:this.setWordSpacing(x[0]);break;case _.OPS.setHScale:this.setHScale(x[0]);break;case _.OPS.setTextMatrix:this.setTextMatrix(x[0],x[1],x[2],x[3],x[4],x[5]);break;case _.OPS.setTextRise:this.setTextRise(x[0]);break;case _.OPS.setTextRenderingMode:this.setTextRenderingMode(x[0]);break;case _.OPS.setLineWidth:this.setLineWidth(x[0]);break;case _.OPS.setLineJoin:this.setLineJoin(x[0]);break;case _.OPS.setLineCap:this.setLineCap(x[0]);break;case _.OPS.setMiterLimit:this.setMiterLimit(x[0]);break;case _.OPS.setFillRGBColor:this.setFillRGBColor(x[0],x[1],x[2]);break;case _.OPS.setStrokeRGBColor:this.setStrokeRGBColor(x[0],x[1],x[2]);break;case _.OPS.setStrokeColorN:this.setStrokeColorN(x);break;case _.OPS.setFillColorN:this.setFillColorN(x);break;case _.OPS.shadingFill:this.shadingFill(x[0]);break;case _.OPS.setDash:this.setDash(x[0],x[1]);break;case _.OPS.setRenderingIntent:this.setRenderingIntent(x[0]);break;case _.OPS.setFlatness:this.setFlatness(x[0]);break;case _.OPS.setGState:this.setGState(x[0]);break;case _.OPS.fill:this.fill();break;case _.OPS.eoFill:this.eoFill();break;case _.OPS.stroke:this.stroke();break;case _.OPS.fillStroke:this.fillStroke();break;case _.OPS.eoFillStroke:this.eoFillStroke();break;case _.OPS.clip:this.clip("nonzero");break;case _.OPS.eoClip:this.clip("evenodd");break;case _.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case _.OPS.paintImageXObject:this.paintImageXObject(x[0]);break;case _.OPS.paintInlineImageXObject:this.paintInlineImageXObject(x[0]);break;case _.OPS.paintImageMaskXObject:this.paintImageMaskXObject(x[0]);break;case _.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(x[0],x[1]);break;case _.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case _.OPS.closePath:this.closePath();break;case _.OPS.closeStroke:this.closeStroke();break;case _.OPS.closeFillStroke:this.closeFillStroke();break;case _.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case _.OPS.nextLine:this.nextLine();break;case _.OPS.transform:this.transform(x[0],x[1],x[2],x[3],x[4],x[5]);break;case _.OPS.constructPath:this.constructPath(x[0],x[1]);break;case _.OPS.endPath:this.endPath();break;case 92:this.group(i.items);break;default:(0,_.warn)(`Unimplemented operator ${e}`);break}}}setWordSpacing(n){this.current.wordSpacing=n}setCharSpacing(n){this.current.charSpacing=n}nextLine(){this.moveText(0,this.current.leading)}setTextMatrix(n,i,e,E,x,j){const I=this.current;I.textMatrix=I.lineMatrix=[n,i,e,E,x,j],I.textMatrixScale=Math.hypot(n,i),I.x=I.lineX=0,I.y=I.lineY=0,I.xcoords=[],I.ycoords=[],I.tspan=this.svgFactory.createElement("svg:tspan"),I.tspan.setAttributeNS(null,"font-family",I.fontFamily),I.tspan.setAttributeNS(null,"font-size",`${r(I.fontSize)}px`),I.tspan.setAttributeNS(null,"y",r(-I.y)),I.txtElement=this.svgFactory.createElement("svg:text"),I.txtElement.append(I.tspan)}beginText(){const n=this.current;n.x=n.lineX=0,n.y=n.lineY=0,n.textMatrix=_.IDENTITY_MATRIX,n.lineMatrix=_.IDENTITY_MATRIX,n.textMatrixScale=1,n.tspan=this.svgFactory.createElement("svg:tspan"),n.txtElement=this.svgFactory.createElement("svg:text"),n.txtgrp=this.svgFactory.createElement("svg:g"),n.xcoords=[],n.ycoords=[]}moveText(n,i){const e=this.current;e.x=e.lineX+=n,e.y=e.lineY+=i,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",`${r(e.fontSize)}px`),e.tspan.setAttributeNS(null,"y",r(-e.y))}showText(n){const i=this.current,e=i.font,E=i.fontSize;if(E===0)return;const x=i.fontSizeScale,j=i.charSpacing,I=i.wordSpacing,yt=i.fontDirection,wt=i.textHScale*yt,bt=e.vertical,K=bt?1:-1,B=e.defaultVMetrics,U=E*i.fontMatrix[0];let G=0;for(const Rt of n){if(Rt===null){G+=yt*I;continue}else if(typeof Rt=="number"){G+=K*Rt*E/1e3;continue}const H=(Rt.isSpace?I:0)+j,h=Rt.fontChar;let c,T,O=Rt.width;if(bt){let W;const s=Rt.vmetric||B;W=Rt.vmetric?s[1]:O*.5,W=-W*U;const d=s[2]*U;O=s?-s[0]:O,c=W/x,T=(G+d)/x}else c=G/x,T=0;(Rt.isInFont||e.missingFile)&&(i.xcoords.push(i.x+c),bt&&i.ycoords.push(-i.y+T),i.tspan.textContent+=h);let $;bt?$=O*U-H*yt:$=O*U+H*yt,G+=$}i.tspan.setAttributeNS(null,"x",i.xcoords.map(r).join(" ")),bt?i.tspan.setAttributeNS(null,"y",i.ycoords.map(r).join(" ")):i.tspan.setAttributeNS(null,"y",r(-i.y)),bt?i.y-=G:i.x+=G*wt,i.tspan.setAttributeNS(null,"font-family",i.fontFamily),i.tspan.setAttributeNS(null,"font-size",`${r(i.fontSize)}px`),i.fontStyle!==Y.fontStyle&&i.tspan.setAttributeNS(null,"font-style",i.fontStyle),i.fontWeight!==Y.fontWeight&&i.tspan.setAttributeNS(null,"font-weight",i.fontWeight);const Q=i.textRenderingMode&_.TextRenderingMode.FILL_STROKE_MASK;if(Q===_.TextRenderingMode.FILL||Q===_.TextRenderingMode.FILL_STROKE?(i.fillColor!==Y.fillColor&&i.tspan.setAttributeNS(null,"fill",i.fillColor),i.fillAlpha<1&&i.tspan.setAttributeNS(null,"fill-opacity",i.fillAlpha)):i.textRenderingMode===_.TextRenderingMode.ADD_TO_PATH?i.tspan.setAttributeNS(null,"fill","transparent"):i.tspan.setAttributeNS(null,"fill","none"),Q===_.TextRenderingMode.STROKE||Q===_.TextRenderingMode.FILL_STROKE){const Rt=1/(i.textMatrixScale||1);this._setStrokeAttributes(i.tspan,Rt)}let xt=i.textMatrix;i.textRise!==0&&(xt=xt.slice(),xt[5]+=i.textRise),i.txtElement.setAttributeNS(null,"transform",`${o(xt)} scale(${r(wt)}, -1)`),i.txtElement.setAttributeNS(M,"xml:space","preserve"),i.txtElement.append(i.tspan),i.txtgrp.append(i.txtElement),this._ensureTransformGroup().append(i.txtElement)}setLeadingMoveText(n,i){this.setLeading(-i),this.moveText(n,i)}addFontStyle(n){if(!n.data)throw new Error('addFontStyle: No font data available, ensure that the "fontExtraProperties" API parameter is set.');this.cssStyle||(this.cssStyle=this.svgFactory.createElement("svg:style"),this.cssStyle.setAttributeNS(null,"type","text/css"),this.defs.append(this.cssStyle));const i=S(n.data,n.mimetype,this.forceDataSchema);this.cssStyle.textContent+=`@font-face { font-family: "${n.loadedName}"; src: url(${i}); }
42
- `}setFont(n){const i=this.current,e=this.commonObjs.get(n[0]);let E=n[1];i.font=e,this.embedFonts&&!e.missingFile&&!this.embeddedFonts[e.loadedName]&&(this.addFontStyle(e),this.embeddedFonts[e.loadedName]=e),i.fontMatrix=e.fontMatrix||_.FONT_IDENTITY_MATRIX;let x="normal";e.black?x="900":e.bold&&(x="bold");const j=e.italic?"italic":"normal";E<0?(E=-E,i.fontDirection=-1):i.fontDirection=1,i.fontSize=E,i.fontFamily=e.loadedName,i.fontWeight=x,i.fontStyle=j,i.tspan=this.svgFactory.createElement("svg:tspan"),i.tspan.setAttributeNS(null,"y",r(-i.y)),i.xcoords=[],i.ycoords=[]}endText(){var i;const n=this.current;n.textRenderingMode&_.TextRenderingMode.ADD_TO_PATH_FLAG&&((i=n.txtElement)!=null&&i.hasChildNodes())&&(n.element=n.txtElement,this.clip("nonzero"),this.endPath())}setLineWidth(n){n>0&&(this.current.lineWidth=n)}setLineCap(n){this.current.lineCap=w[n]}setLineJoin(n){this.current.lineJoin=P[n]}setMiterLimit(n){this.current.miterLimit=n}setStrokeAlpha(n){this.current.strokeAlpha=n}setStrokeRGBColor(n,i,e){this.current.strokeColor=_.Util.makeHexColor(n,i,e)}setFillAlpha(n){this.current.fillAlpha=n}setFillRGBColor(n,i,e){this.current.fillColor=_.Util.makeHexColor(n,i,e),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(n){this.current.strokeColor=this._makeColorN_Pattern(n)}setFillColorN(n){this.current.fillColor=this._makeColorN_Pattern(n)}shadingFill(n){const i=this.viewport.width,e=this.viewport.height,E=_.Util.inverseTransform(this.transformMatrix),x=_.Util.applyTransform([0,0],E),j=_.Util.applyTransform([0,e],E),I=_.Util.applyTransform([i,0],E),yt=_.Util.applyTransform([i,e],E),wt=Math.min(x[0],j[0],I[0],yt[0]),bt=Math.min(x[1],j[1],I[1],yt[1]),K=Math.max(x[0],j[0],I[0],yt[0]),B=Math.max(x[1],j[1],I[1],yt[1]),U=this.svgFactory.createElement("svg:rect");U.setAttributeNS(null,"x",wt),U.setAttributeNS(null,"y",bt),U.setAttributeNS(null,"width",K-wt),U.setAttributeNS(null,"height",B-bt),U.setAttributeNS(null,"fill",this._makeShadingPattern(n)),this.current.fillAlpha<1&&U.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(U)}_makeColorN_Pattern(n){return n[0]==="TilingPattern"?this._makeTilingPattern(n):this._makeShadingPattern(n)}_makeTilingPattern(n){const i=n[1],e=n[2],E=n[3]||_.IDENTITY_MATRIX,[x,j,I,yt]=n[4],wt=n[5],bt=n[6],K=n[7],B=`shading${u++}`,[U,G,Q,xt]=_.Util.normalizeRect([..._.Util.applyTransform([x,j],E),..._.Util.applyTransform([I,yt],E)]),[Rt,H]=_.Util.singularValueDecompose2dScale(E),h=wt*Rt,c=bt*H,T=this.svgFactory.createElement("svg:pattern");T.setAttributeNS(null,"id",B),T.setAttributeNS(null,"patternUnits","userSpaceOnUse"),T.setAttributeNS(null,"width",h),T.setAttributeNS(null,"height",c),T.setAttributeNS(null,"x",`${U}`),T.setAttributeNS(null,"y",`${G}`);const O=this.svg,$=this.transformMatrix,W=this.current.fillColor,s=this.current.strokeColor,d=this.svgFactory.create(Q-U,xt-G);if(this.svg=d,this.transformMatrix=E,K===2){const C=_.Util.makeHexColor(...i);this.current.fillColor=C,this.current.strokeColor=C}return this.executeOpTree(this.convertOpList(e)),this.svg=O,this.transformMatrix=$,this.current.fillColor=W,this.current.strokeColor=s,T.append(d.childNodes[0]),this.defs.append(T),`url(#${B})`}_makeShadingPattern(n){switch(typeof n=="string"&&(n=this.objs.get(n)),n[0]){case"RadialAxial":const i=`shading${u++}`,e=n[3];let E;switch(n[1]){case"axial":const x=n[4],j=n[5];E=this.svgFactory.createElement("svg:linearGradient"),E.setAttributeNS(null,"id",i),E.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),E.setAttributeNS(null,"x1",x[0]),E.setAttributeNS(null,"y1",x[1]),E.setAttributeNS(null,"x2",j[0]),E.setAttributeNS(null,"y2",j[1]);break;case"radial":const I=n[4],yt=n[5],wt=n[6],bt=n[7];E=this.svgFactory.createElement("svg:radialGradient"),E.setAttributeNS(null,"id",i),E.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),E.setAttributeNS(null,"cx",yt[0]),E.setAttributeNS(null,"cy",yt[1]),E.setAttributeNS(null,"r",bt),E.setAttributeNS(null,"fx",I[0]),E.setAttributeNS(null,"fy",I[1]),E.setAttributeNS(null,"fr",wt);break;default:throw new Error(`Unknown RadialAxial type: ${n[1]}`)}for(const x of e){const j=this.svgFactory.createElement("svg:stop");j.setAttributeNS(null,"offset",x[0]),j.setAttributeNS(null,"stop-color",x[1]),E.append(j)}return this.defs.append(E),`url(#${i})`;case"Mesh":return(0,_.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw new Error(`Unknown IR type: ${n[0]}`)}}setDash(n,i){this.current.dashArray=n,this.current.dashPhase=i}constructPath(n,i){const e=this.current;let E=e.x,x=e.y,j=[],I=0;for(const yt of n)switch(yt|0){case _.OPS.rectangle:E=i[I++],x=i[I++];const wt=i[I++],bt=i[I++],K=E+wt,B=x+bt;j.push("M",r(E),r(x),"L",r(K),r(x),"L",r(K),r(B),"L",r(E),r(B),"Z");break;case _.OPS.moveTo:E=i[I++],x=i[I++],j.push("M",r(E),r(x));break;case _.OPS.lineTo:E=i[I++],x=i[I++],j.push("L",r(E),r(x));break;case _.OPS.curveTo:E=i[I+4],x=i[I+5],j.push("C",r(i[I]),r(i[I+1]),r(i[I+2]),r(i[I+3]),r(E),r(x)),I+=6;break;case _.OPS.curveTo2:j.push("C",r(E),r(x),r(i[I]),r(i[I+1]),r(i[I+2]),r(i[I+3])),E=i[I+2],x=i[I+3],I+=4;break;case _.OPS.curveTo3:E=i[I+2],x=i[I+3],j.push("C",r(i[I]),r(i[I+1]),r(E),r(x),r(E),r(x)),I+=4;break;case _.OPS.closePath:j.push("Z");break}j=j.join(" "),e.path&&n.length>0&&n[0]!==_.OPS.rectangle&&n[0]!==_.OPS.moveTo?j=e.path.getAttributeNS(null,"d")+j:(e.path=this.svgFactory.createElement("svg:path"),this._ensureTransformGroup().append(e.path)),e.path.setAttributeNS(null,"d",j),e.path.setAttributeNS(null,"fill","none"),e.element=e.path,e.setCurrentPoint(E,x)}endPath(){const n=this.current;if(n.path=null,!this.pendingClip)return;if(!n.element){this.pendingClip=null;return}const i=`clippath${v++}`,e=this.svgFactory.createElement("svg:clipPath");e.setAttributeNS(null,"id",i),e.setAttributeNS(null,"transform",o(this.transformMatrix));const E=n.element.cloneNode(!0);if(this.pendingClip==="evenodd"?E.setAttributeNS(null,"clip-rule","evenodd"):E.setAttributeNS(null,"clip-rule","nonzero"),this.pendingClip=null,e.append(E),this.defs.append(e),n.activeClipUrl){n.clipGroup=null;for(const x of this.extraStack)x.clipGroup=null;e.setAttributeNS(null,"clip-path",n.activeClipUrl)}n.activeClipUrl=`url(#${i})`,this.tgrp=null}clip(n){this.pendingClip=n}closePath(){const n=this.current;if(n.path){const i=`${n.path.getAttributeNS(null,"d")}Z`;n.path.setAttributeNS(null,"d",i)}}setLeading(n){this.current.leading=-n}setTextRise(n){this.current.textRise=n}setTextRenderingMode(n){this.current.textRenderingMode=n}setHScale(n){this.current.textHScale=n/100}setRenderingIntent(n){}setFlatness(n){}setGState(n){for(const[i,e]of n)switch(i){case"LW":this.setLineWidth(e);break;case"LC":this.setLineCap(e);break;case"LJ":this.setLineJoin(e);break;case"ML":this.setMiterLimit(e);break;case"D":this.setDash(e[0],e[1]);break;case"RI":this.setRenderingIntent(e);break;case"FL":this.setFlatness(e);break;case"Font":this.setFont(e);break;case"CA":this.setStrokeAlpha(e);break;case"ca":this.setFillAlpha(e);break;default:(0,_.warn)(`Unimplemented graphic state operator ${i}`);break}}fill(){const n=this.current;n.element&&(n.element.setAttributeNS(null,"fill",n.fillColor),n.element.setAttributeNS(null,"fill-opacity",n.fillAlpha),this.endPath())}stroke(){const n=this.current;n.element&&(this._setStrokeAttributes(n.element),n.element.setAttributeNS(null,"fill","none"),this.endPath())}_setStrokeAttributes(n,i=1){const e=this.current;let E=e.dashArray;i!==1&&E.length>0&&(E=E.map(function(x){return i*x})),n.setAttributeNS(null,"stroke",e.strokeColor),n.setAttributeNS(null,"stroke-opacity",e.strokeAlpha),n.setAttributeNS(null,"stroke-miterlimit",r(e.miterLimit)),n.setAttributeNS(null,"stroke-linecap",e.lineCap),n.setAttributeNS(null,"stroke-linejoin",e.lineJoin),n.setAttributeNS(null,"stroke-width",r(i*e.lineWidth)+"px"),n.setAttributeNS(null,"stroke-dasharray",E.map(r).join(" ")),n.setAttributeNS(null,"stroke-dashoffset",r(i*e.dashPhase)+"px")}eoFill(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fill()}fillStroke(){this.stroke(),this.fill()}eoFillStroke(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()}closeStroke(){this.closePath(),this.stroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.closePath(),this.eoFillStroke()}paintSolidColorImageMask(){const n=this.svgFactory.createElement("svg:rect");n.setAttributeNS(null,"x","0"),n.setAttributeNS(null,"y","0"),n.setAttributeNS(null,"width","1px"),n.setAttributeNS(null,"height","1px"),n.setAttributeNS(null,"fill",this.current.fillColor),this._ensureTransformGroup().append(n)}paintImageXObject(n){const i=n.startsWith("g_")?this.commonObjs.get(n):this.objs.get(n);if(!i){(0,_.warn)(`Dependent image with object ID ${n} is not ready yet`);return}this.paintInlineImageXObject(i)}paintInlineImageXObject(n,i){const e=n.width,E=n.height,x=F(n,this.forceDataSchema,!!i),j=this.svgFactory.createElement("svg:rect");j.setAttributeNS(null,"x","0"),j.setAttributeNS(null,"y","0"),j.setAttributeNS(null,"width",r(e)),j.setAttributeNS(null,"height",r(E)),this.current.element=j,this.clip("nonzero");const I=this.svgFactory.createElement("svg:image");I.setAttributeNS(b,"xlink:href",x),I.setAttributeNS(null,"x","0"),I.setAttributeNS(null,"y",r(-E)),I.setAttributeNS(null,"width",r(e)+"px"),I.setAttributeNS(null,"height",r(E)+"px"),I.setAttributeNS(null,"transform",`scale(${r(1/e)} ${r(-1/E)})`),i?i.append(I):this._ensureTransformGroup().append(I)}paintImageMaskXObject(n){const i=this.current,e=n.width,E=n.height,x=i.fillColor;i.maskId=`mask${g++}`;const j=this.svgFactory.createElement("svg:mask");j.setAttributeNS(null,"id",i.maskId);const I=this.svgFactory.createElement("svg:rect");I.setAttributeNS(null,"x","0"),I.setAttributeNS(null,"y","0"),I.setAttributeNS(null,"width",r(e)),I.setAttributeNS(null,"height",r(E)),I.setAttributeNS(null,"fill",x),I.setAttributeNS(null,"mask",`url(#${i.maskId})`),this.defs.append(j),this._ensureTransformGroup().append(I),this.paintInlineImageXObject(n,j)}paintFormXObjectBegin(n,i){if(Array.isArray(n)&&n.length===6&&this.transform(n[0],n[1],n[2],n[3],n[4],n[5]),i){const e=i[2]-i[0],E=i[3]-i[1],x=this.svgFactory.createElement("svg:rect");x.setAttributeNS(null,"x",i[0]),x.setAttributeNS(null,"y",i[1]),x.setAttributeNS(null,"width",r(e)),x.setAttributeNS(null,"height",r(E)),this.current.element=x,this.clip("nonzero"),this.endPath()}}paintFormXObjectEnd(){}_initialize(n){const i=this.svgFactory.create(n.width,n.height),e=this.svgFactory.createElement("svg:defs");i.append(e),this.defs=e;const E=this.svgFactory.createElement("svg:g");return E.setAttributeNS(null,"transform",o(n.transform)),i.append(E),this.svg=E,i}_ensureClipGroup(){if(!this.current.clipGroup){const n=this.svgFactory.createElement("svg:g");n.setAttributeNS(null,"clip-path",this.current.activeClipUrl),this.svg.append(n),this.current.clipGroup=n}return this.current.clipGroup}_ensureTransformGroup(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",o(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}}}}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.PDFNodeStream=void 0;var f=A(1),_=A(33);const V=require$$0,q=require$$0,Y=require$$0,M=require$$0,b=/^file:\/\/\/[a-zA-Z]:\//;function w(g){const u=M.parse(g);return u.protocol==="file:"||u.host?u:/^[a-z]:[/\\]/i.test(g)?M.parse(`file:///${g}`):(u.host||(u.protocol="file:"),u)}class P{constructor(u){this.source=u,this.url=w(u.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.httpHeaders=this.isHttp&&u.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var u;return((u=this._fullRequestReader)==null?void 0:u._loaded)??0}getFullReader(){return(0,f.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new o(this):new t(this),this._fullRequestReader}getRangeReader(u,n){if(n<=this._progressiveDataLength)return null;const i=this.isFsUrl?new v(this,u,n):new r(this,u,n);return this._rangeRequestReaders.push(i),i}cancelAllRequests(u){this._fullRequestReader&&this._fullRequestReader.cancel(u);for(const n of this._rangeRequestReaders.slice(0))n.cancel(u)}}a.PDFNodeStream=P;class S{constructor(u){this._url=u.url,this._done=!1,this._storedError=null,this.onProgress=null;const n=u.source;this._contentLength=n.length,this._loaded=0,this._filename=null,this._disableRange=n.disableRange||!1,this._rangeChunkSize=n.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!n.disableStream,this._isRangeSupported=!n.disableRange,this._readableStream=null,this._readCapability=(0,f.createPromiseCapability)(),this._headersCapability=(0,f.createPromiseCapability)()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const u=this._readableStream.read();return u===null?(this._readCapability=(0,f.createPromiseCapability)(),this.read()):(this._loaded+=u.length,this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(u).buffer,done:!1})}cancel(u){if(!this._readableStream){this._error(u);return}this._readableStream.destroy(u)}_error(u){this._storedError=u,this._readCapability.resolve()}_setReadableStream(u){this._readableStream=u,u.on("readable",()=>{this._readCapability.resolve()}),u.on("end",()=>{u.destroy(),this._done=!0,this._readCapability.resolve()}),u.on("error",n=>{this._error(n)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new f.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class F{constructor(u){this._url=u.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=(0,f.createPromiseCapability)();const n=u.source;this._isStreamingSupported=!n.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const u=this._readableStream.read();return u===null?(this._readCapability=(0,f.createPromiseCapability)(),this.read()):(this._loaded+=u.length,this.onProgress&&this.onProgress({loaded:this._loaded}),{value:new Uint8Array(u).buffer,done:!1})}cancel(u){if(!this._readableStream){this._error(u);return}this._readableStream.destroy(u)}_error(u){this._storedError=u,this._readCapability.resolve()}_setReadableStream(u){this._readableStream=u,u.on("readable",()=>{this._readCapability.resolve()}),u.on("end",()=>{u.destroy(),this._done=!0,this._readCapability.resolve()}),u.on("error",n=>{this._error(n)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function l(g,u){return{protocol:g.protocol,auth:g.auth,host:g.hostname,port:g.port,path:g.path,method:"GET",headers:u}}class t extends S{constructor(u){super(u);const n=i=>{if(i.statusCode===404){const j=new f.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=j,this._headersCapability.reject(j);return}this._headersCapability.resolve(),this._setReadableStream(i);const e=j=>this._readableStream.headers[j.toLowerCase()],{allowRangeRequests:E,suggestedLength:x}=(0,_.validateRangeRequestCapabilities)({getResponseHeader:e,isHttp:u.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=E,this._contentLength=x||this._contentLength,this._filename=(0,_.extractFilenameFromHeader)(e)};this._request=null,this._url.protocol==="http:"?this._request=q.request(l(this._url,u.httpHeaders),n):this._request=Y.request(l(this._url,u.httpHeaders),n),this._request.on("error",i=>{this._storedError=i,this._headersCapability.reject(i)}),this._request.end()}}class r extends F{constructor(u,n,i){super(u),this._httpHeaders={};for(const E in u.httpHeaders){const x=u.httpHeaders[E];typeof x>"u"||(this._httpHeaders[E]=x)}this._httpHeaders.Range=`bytes=${n}-${i-1}`;const e=E=>{if(E.statusCode===404){const x=new f.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=x;return}this._setReadableStream(E)};this._request=null,this._url.protocol==="http:"?this._request=q.request(l(this._url,this._httpHeaders),e):this._request=Y.request(l(this._url,this._httpHeaders),e),this._request.on("error",E=>{this._storedError=E}),this._request.end()}}class o extends S{constructor(u){super(u);let n=decodeURIComponent(this._url.path);b.test(this._url.href)&&(n=n.replace(/^\//,"")),V.lstat(n,(i,e)=>{if(i){i.code==="ENOENT"&&(i=new f.MissingPDFException(`Missing PDF "${n}".`)),this._storedError=i,this._headersCapability.reject(i);return}this._contentLength=e.size,this._setReadableStream(V.createReadStream(n)),this._headersCapability.resolve()})}}class v extends F{constructor(u,n,i){super(u);let e=decodeURIComponent(this._url.path);b.test(this._url.href)&&(e=e.replace(/^\//,"")),this._setReadableStream(V.createReadStream(e,{start:n,end:i-1}))}}}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.createResponseStatusError=M,a.extractFilenameFromHeader=Y,a.validateRangeRequestCapabilities=q,a.validateResponseStatus=b;var f=A(1),_=A(34),V=A(8);function q({getResponseHeader:w,isHttp:P,rangeChunkSize:S,disableRange:F}){const l={allowRangeRequests:!1,suggestedLength:void 0},t=parseInt(w("Content-Length"),10);return!Number.isInteger(t)||(l.suggestedLength=t,t<=2*S)||F||!P||w("Accept-Ranges")!=="bytes"||(w("Content-Encoding")||"identity")!=="identity"||(l.allowRangeRequests=!0),l}function Y(w){const P=w("Content-Disposition");if(P){let S=(0,_.getFilenameFromContentDispositionHeader)(P);if(S.includes("%"))try{S=decodeURIComponent(S)}catch{}if((0,V.isPdfFile)(S))return S}return null}function M(w,P){return w===404||w===0&&P.startsWith("file:")?new f.MissingPDFException('Missing PDF "'+P+'".'):new f.UnexpectedResponseException(`Unexpected server response (${w}) while retrieving PDF "${P}".`,w)}function b(w){return w===200||w===206}}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.getFilenameFromContentDispositionHeader=_;var f=A(1);function _(V){let q=!0,Y=M("filename\\*","i").exec(V);if(Y){Y=Y[1];let t=S(Y);return t=unescape(t),t=F(t),t=l(t),w(t)}if(Y=P(V),Y){const t=l(Y);return w(t)}if(Y=M("filename","i").exec(V),Y){Y=Y[1];let t=S(Y);return t=l(t),w(t)}function M(t,r){return new RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',r)}function b(t,r){if(t){if(!/^[\x00-\xFF]+$/.test(r))return r;try{const o=new TextDecoder(t,{fatal:!0}),v=(0,f.stringToBytes)(r);r=o.decode(v),q=!1}catch{}}return r}function w(t){return q&&/[\x80-\xff]/.test(t)&&(t=b("utf-8",t),q&&(t=b("iso-8859-1",t))),t}function P(t){const r=[];let o;const v=M("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(o=v.exec(t))!==null;){let[,u,n,i]=o;if(u=parseInt(u,10),u in r){if(u===0)break;continue}r[u]=[n,i]}const g=[];for(let u=0;u<r.length&&u in r;++u){let[n,i]=r[u];i=S(i),n&&(i=unescape(i),u===0&&(i=F(i))),g.push(i)}return g.join("")}function S(t){if(t.startsWith('"')){const r=t.slice(1).split('\\"');for(let o=0;o<r.length;++o){const v=r[o].indexOf('"');v!==-1&&(r[o]=r[o].slice(0,v),r.length=o+1),r[o]=r[o].replace(/\\(.)/g,"$1")}t=r.join('"')}return t}function F(t){const r=t.indexOf("'");if(r===-1)return t;const o=t.slice(0,r),g=t.slice(r+1).replace(/^[^']*'/,"");return b(o,g)}function l(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replace(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(r,o,v,g){if(v==="q"||v==="Q")return g=g.replace(/_/g," "),g=g.replace(/=([0-9a-fA-F]{2})/g,function(u,n){return String.fromCharCode(parseInt(n,16))}),b(o,g);try{g=atob(g)}catch{}return b(o,g)})}return""}}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.PDFNetworkStream=void 0;var f=A(1),_=A(33);const V=200,q=206;function Y(S){const F=S.response;return typeof F!="string"?F:(0,f.stringToBytes)(F).buffer}class M{constructor(F,l={}){this.url=F,this.isHttp=/^https?:/i.test(F),this.httpHeaders=this.isHttp&&l.httpHeaders||Object.create(null),this.withCredentials=l.withCredentials||!1,this.getXhr=l.getXhr||function(){return new XMLHttpRequest},this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(F,l,t){const r={begin:F,end:l};for(const o in t)r[o]=t[o];return this.request(r)}requestFull(F){return this.request(F)}request(F){const l=this.getXhr(),t=this.currXhrId++,r=this.pendingRequests[t]={xhr:l};l.open("GET",this.url),l.withCredentials=this.withCredentials;for(const o in this.httpHeaders){const v=this.httpHeaders[o];typeof v>"u"||l.setRequestHeader(o,v)}return this.isHttp&&"begin"in F&&"end"in F?(l.setRequestHeader("Range",`bytes=${F.begin}-${F.end-1}`),r.expectedStatus=q):r.expectedStatus=V,l.responseType="arraybuffer",F.onError&&(l.onerror=function(o){F.onError(l.status)}),l.onreadystatechange=this.onStateChange.bind(this,t),l.onprogress=this.onProgress.bind(this,t),r.onHeadersReceived=F.onHeadersReceived,r.onDone=F.onDone,r.onError=F.onError,r.onProgress=F.onProgress,l.send(null),t}onProgress(F,l){var r;const t=this.pendingRequests[F];t&&((r=t.onProgress)==null||r.call(t,l))}onStateChange(F,l){var u,n,i;const t=this.pendingRequests[F];if(!t)return;const r=t.xhr;if(r.readyState>=2&&t.onHeadersReceived&&(t.onHeadersReceived(),delete t.onHeadersReceived),r.readyState!==4||!(F in this.pendingRequests))return;if(delete this.pendingRequests[F],r.status===0&&this.isHttp){(u=t.onError)==null||u.call(t,r.status);return}const o=r.status||V;if(!(o===V&&t.expectedStatus===q)&&o!==t.expectedStatus){(n=t.onError)==null||n.call(t,r.status);return}const g=Y(r);if(o===q){const e=r.getResponseHeader("Content-Range"),E=/bytes (\d+)-(\d+)\/(\d+)/.exec(e);t.onDone({begin:parseInt(E[1],10),chunk:g})}else g?t.onDone({begin:0,chunk:g}):(i=t.onError)==null||i.call(t,r.status)}getRequestXhr(F){return this.pendingRequests[F].xhr}isPendingRequest(F){return F in this.pendingRequests}abortRequest(F){const l=this.pendingRequests[F].xhr;delete this.pendingRequests[F],l.abort()}}class b{constructor(F){this._source=F,this._manager=new M(F.url,{httpHeaders:F.httpHeaders,withCredentials:F.withCredentials}),this._rangeChunkSize=F.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(F){const l=this._rangeRequestReaders.indexOf(F);l>=0&&this._rangeRequestReaders.splice(l,1)}getFullReader(){return(0,f.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new w(this._manager,this._source),this._fullRequestReader}getRangeReader(F,l){const t=new P(this._manager,F,l);return t.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(t),t}cancelAllRequests(F){var l;(l=this._fullRequestReader)==null||l.cancel(F);for(const t of this._rangeRequestReaders.slice(0))t.cancel(F)}}a.PDFNetworkStream=b;class w{constructor(F,l){this._manager=F;const t={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=F.requestFull(t),this._headersReceivedCapability=(0,f.createPromiseCapability)(),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(){const F=this._fullRequestId,l=this._manager.getRequestXhr(F),t=v=>l.getResponseHeader(v),{allowRangeRequests:r,suggestedLength:o}=(0,_.validateRangeRequestCapabilities)({getResponseHeader:t,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});r&&(this._isRangeSupported=!0),this._contentLength=o||this._contentLength,this._filename=(0,_.extractFilenameFromHeader)(t),this._isRangeSupported&&this._manager.abortRequest(F),this._headersReceivedCapability.resolve()}_onDone(F){if(F&&(this._requests.length>0?this._requests.shift().resolve({value:F.chunk,done:!1}):this._cachedChunks.push(F.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const l of this._requests)l.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(F){this._storedError=(0,_.createResponseStatusError)(F,this._url),this._headersReceivedCapability.reject(this._storedError);for(const l of this._requests)l.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(F){var l;(l=this.onProgress)==null||l.call(this,{loaded:F.loaded,total:F.lengthComputable?F.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const F=(0,f.createPromiseCapability)();return this._requests.push(F),F.promise}cancel(F){this._done=!0,this._headersReceivedCapability.reject(F);for(const l of 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 P{constructor(F,l,t){this._manager=F;const r={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=F.url,this._requestId=F.requestRange(l,t,r),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){var F;(F=this.onClosed)==null||F.call(this,this)}_onDone(F){const l=F.chunk;this._requests.length>0?this._requests.shift().resolve({value:l,done:!1}):this._queuedChunk=l,this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(F){this._storedError=(0,_.createResponseStatusError)(F,this._url);for(const l of this._requests)l.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(F){var l;this.isStreamingSupported||(l=this.onProgress)==null||l.call(this,{loaded:F.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const l=this._queuedChunk;return this._queuedChunk=null,{value:l,done:!1}}if(this._done)return{value:void 0,done:!0};const F=(0,f.createPromiseCapability)();return this._requests.push(F),F.promise}cancel(F){this._done=!0;for(const l of this._requests)l.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}}),((m,a,A)=>{Object.defineProperty(a,"__esModule",{value:!0}),a.PDFFetchStream=void 0;var f=A(1),_=A(33);function V(w,P,S){return{method:"GET",headers:w,signal:S.signal,mode:"cors",credentials:P?"include":"same-origin",redirect:"follow"}}function q(w){const P=new Headers;for(const S in w){const F=w[S];typeof F>"u"||P.append(S,F)}return P}class Y{constructor(P){this.source=P,this.isHttp=/^https?:/i.test(P.url),this.httpHeaders=this.isHttp&&P.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var P;return((P=this._fullRequestReader)==null?void 0:P._loaded)??0}getFullReader(){return(0,f.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new M(this),this._fullRequestReader}getRangeReader(P,S){if(S<=this._progressiveDataLength)return null;const F=new b(this,P,S);return this._rangeRequestReaders.push(F),F}cancelAllRequests(P){this._fullRequestReader&&this._fullRequestReader.cancel(P);for(const S of this._rangeRequestReaders.slice(0))S.cancel(P)}}a.PDFFetchStream=Y;class M{constructor(P){this._stream=P,this._reader=null,this._loaded=0,this._filename=null;const S=P.source;this._withCredentials=S.withCredentials||!1,this._contentLength=S.length,this._headersCapability=(0,f.createPromiseCapability)(),this._disableRange=S.disableRange||!1,this._rangeChunkSize=S.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!S.disableStream,this._isRangeSupported=!S.disableRange,this._headers=q(this._stream.httpHeaders);const F=S.url;fetch(F,V(this._headers,this._withCredentials,this._abortController)).then(l=>{if(!(0,_.validateResponseStatus)(l.status))throw(0,_.createResponseStatusError)(l.status,F);this._reader=l.body.getReader(),this._headersCapability.resolve();const t=v=>l.headers.get(v),{allowRangeRequests:r,suggestedLength:o}=(0,_.validateRangeRequestCapabilities)({getResponseHeader:t,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=r,this._contentLength=o||this._contentLength,this._filename=(0,_.extractFilenameFromHeader)(t),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new f.AbortException("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;const{value:P,done:S}=await this._reader.read();return S?{value:P,done:S}:(this._loaded+=P.byteLength,this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(P).buffer,done:!1})}cancel(P){this._reader&&this._reader.cancel(P),this._abortController.abort()}}class b{constructor(P,S,F){this._stream=P,this._reader=null,this._loaded=0;const l=P.source;this._withCredentials=l.withCredentials||!1,this._readCapability=(0,f.createPromiseCapability)(),this._isStreamingSupported=!l.disableStream,this._abortController=new AbortController,this._headers=q(this._stream.httpHeaders),this._headers.append("Range",`bytes=${S}-${F-1}`);const t=l.url;fetch(t,V(this._headers,this._withCredentials,this._abortController)).then(r=>{if(!(0,_.validateResponseStatus)(r.status))throw(0,_.createResponseStatusError)(r.status,t);this._readCapability.resolve(),this._reader=r.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:P,done:S}=await this._reader.read();return S?{value:P,done:S}:(this._loaded+=P.byteLength,this.onProgress&&this.onProgress({loaded:this._loaded}),{value:new Uint8Array(P).buffer,done:!1})}cancel(P){this._reader&&this._reader.cancel(P),this._abortController.abort()}}})],__webpack_module_cache__={};function __w_pdfjs_require__(m){var a=__webpack_module_cache__[m];if(a!==void 0)return a.exports;var A=__webpack_module_cache__[m]={exports:{}};return __webpack_modules__[m](A,A.exports,__w_pdfjs_require__),A.exports}var __webpack_exports__={};return(()=>{var m=__webpack_exports__;Object.defineProperty(m,"__esModule",{value:!0}),Object.defineProperty(m,"AnnotationEditorLayer",{enumerable:!0,get:function(){return _.AnnotationEditorLayer}}),Object.defineProperty(m,"AnnotationEditorParamsType",{enumerable:!0,get:function(){return a.AnnotationEditorParamsType}}),Object.defineProperty(m,"AnnotationEditorType",{enumerable:!0,get:function(){return a.AnnotationEditorType}}),Object.defineProperty(m,"AnnotationEditorUIManager",{enumerable:!0,get:function(){return V.AnnotationEditorUIManager}}),Object.defineProperty(m,"AnnotationLayer",{enumerable:!0,get:function(){return q.AnnotationLayer}}),Object.defineProperty(m,"AnnotationMode",{enumerable:!0,get:function(){return a.AnnotationMode}}),Object.defineProperty(m,"CMapCompressionType",{enumerable:!0,get:function(){return a.CMapCompressionType}}),Object.defineProperty(m,"GlobalWorkerOptions",{enumerable:!0,get:function(){return Y.GlobalWorkerOptions}}),Object.defineProperty(m,"InvalidPDFException",{enumerable:!0,get:function(){return a.InvalidPDFException}}),Object.defineProperty(m,"LoopbackPort",{enumerable:!0,get:function(){return A.LoopbackPort}}),Object.defineProperty(m,"MissingPDFException",{enumerable:!0,get:function(){return a.MissingPDFException}}),Object.defineProperty(m,"OPS",{enumerable:!0,get:function(){return a.OPS}}),Object.defineProperty(m,"PDFDataRangeTransport",{enumerable:!0,get:function(){return A.PDFDataRangeTransport}}),Object.defineProperty(m,"PDFDateString",{enumerable:!0,get:function(){return f.PDFDateString}}),Object.defineProperty(m,"PDFWorker",{enumerable:!0,get:function(){return A.PDFWorker}}),Object.defineProperty(m,"PasswordResponses",{enumerable:!0,get:function(){return a.PasswordResponses}}),Object.defineProperty(m,"PermissionFlag",{enumerable:!0,get:function(){return a.PermissionFlag}}),Object.defineProperty(m,"PixelsPerInch",{enumerable:!0,get:function(){return f.PixelsPerInch}}),Object.defineProperty(m,"RenderingCancelledException",{enumerable:!0,get:function(){return f.RenderingCancelledException}}),Object.defineProperty(m,"SVGGraphics",{enumerable:!0,get:function(){return w.SVGGraphics}}),Object.defineProperty(m,"UNSUPPORTED_FEATURES",{enumerable:!0,get:function(){return a.UNSUPPORTED_FEATURES}}),Object.defineProperty(m,"UnexpectedResponseException",{enumerable:!0,get:function(){return a.UnexpectedResponseException}}),Object.defineProperty(m,"Util",{enumerable:!0,get:function(){return a.Util}}),Object.defineProperty(m,"VerbosityLevel",{enumerable:!0,get:function(){return a.VerbosityLevel}}),Object.defineProperty(m,"XfaLayer",{enumerable:!0,get:function(){return P.XfaLayer}}),Object.defineProperty(m,"build",{enumerable:!0,get:function(){return A.build}}),Object.defineProperty(m,"createPromiseCapability",{enumerable:!0,get:function(){return a.createPromiseCapability}}),Object.defineProperty(m,"createValidAbsoluteUrl",{enumerable:!0,get:function(){return a.createValidAbsoluteUrl}}),Object.defineProperty(m,"getDocument",{enumerable:!0,get:function(){return A.getDocument}}),Object.defineProperty(m,"getFilenameFromUrl",{enumerable:!0,get:function(){return f.getFilenameFromUrl}}),Object.defineProperty(m,"getPdfFilenameFromUrl",{enumerable:!0,get:function(){return f.getPdfFilenameFromUrl}}),Object.defineProperty(m,"getXfaPageViewport",{enumerable:!0,get:function(){return f.getXfaPageViewport}}),Object.defineProperty(m,"isPdfFile",{enumerable:!0,get:function(){return f.isPdfFile}}),Object.defineProperty(m,"loadScript",{enumerable:!0,get:function(){return f.loadScript}}),Object.defineProperty(m,"renderTextLayer",{enumerable:!0,get:function(){return b.renderTextLayer}}),Object.defineProperty(m,"shadow",{enumerable:!0,get:function(){return a.shadow}}),Object.defineProperty(m,"version",{enumerable:!0,get:function(){return A.version}});var a=__w_pdfjs_require__(1),A=__w_pdfjs_require__(4),f=__w_pdfjs_require__(8),_=__w_pdfjs_require__(22),V=__w_pdfjs_require__(7),q=__w_pdfjs_require__(27),Y=__w_pdfjs_require__(15),M=__w_pdfjs_require__(3),b=__w_pdfjs_require__(30),w=__w_pdfjs_require__(31),P=__w_pdfjs_require__(29);if(M.isNodeJS){const{PDFNodeStream:S}=__w_pdfjs_require__(32);(0,A.setPDFNetworkStreamFactory)(F=>new S(F))}else{const{PDFNetworkStream:S}=__w_pdfjs_require__(35),{PDFFetchStream:F}=__w_pdfjs_require__(36);(0,A.setPDFNetworkStreamFactory)(l=>(0,f.isValidFetchUrl)(l.url)?new F(l):new S(l))}})(),__webpack_exports__})())})(pdf)),pdf.exports}var pdfExports=requirePdf();const De="#FFEB3B",Be=()=>`annotation_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,ke=({pageNumber:m,scale:a,isAnnotating:A,annotations:f=[],onAnnotationAdd:_,onAnnotationDelete:V,readOnly:q=!1})=>{const Y=useRef(null),[M,b]=useState(!1),[w,P]=useState({x:0,y:0}),[S,F]=useState(null),[l,t]=useState(null),r=useCallback(u=>{if(!A||!Y.current)return;const n=Y.current.getBoundingClientRect(),i=(u.clientX-n.left)/n.width,e=(u.clientY-n.top)/n.height;console.log("\u9F20\u6807\u6309\u4E0B\u4F4D\u7F6E:",{clientX:u.clientX,clientY:u.clientY,rect:n,x:i,y:e,scale:a}),b(!0),P({x:i,y:e})},[A,a]),o=useCallback(u=>{if(!M||!Y.current)return;const n=Y.current.getBoundingClientRect(),i=(u.clientX-n.left)/n.width,e=(u.clientY-n.top)/n.height;F({x:Math.min(w.x,i),y:Math.min(w.y,e),width:Math.abs(i-w.x),height:Math.abs(e-w.y)})},[M,w,a]),v=useCallback(()=>{if(!M||!S)return;if(b(!1),S.width<5||S.height<5){F(null);return}const u={id:Be(),pageNumber:m,...S,content:"",color:De};_==null||_(u),F(null)},[M,S,m,_]),g=useCallback(u=>{t(l===u?null:u)},[l]);return useCallback((u,n)=>{const i={...u,content:n};_==null||_(i)},[_]),useCallback(u=>{V==null||V(u),t(null)},[V]),console.log("\u6807\u6CE8\u7EC4\u4EF6\u6E32\u67D3:",{pageNumber:m,annotations:f.length,currentPageAnnotationsCount:f.filter(u=>u.pageNumber===m).length,currentPageAnnotations:f.filter(u=>u.pageNumber===m)}),React__default.createElement("div",{ref:Y,style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:10,pointerEvents:"auto"},onMouseDown:r,onMouseMove:o,onMouseUp:v,onMouseLeave:v},S&&React__default.createElement("div",{className:"absolute border-2 border-yellow-400 bg-yellow-100/30",style:{left:`${S.x*100}%`,top:`${S.y*100}%`,width:`${S.width*100}%`,height:`${S.height*100}%`}}),f.filter(u=>u.pageNumber===m).map(u=>(console.log("\u6E32\u67D3\u6807\u6CE8:",u.id,`\u4F4D\u7F6E: ${u.x*100}%, ${u.y*100}%`),React__default.createElement("div",{key:u.id,style:{width:"100%",height:"100%",position:"absolute",top:0,left:0}},React__default.createElement("div",{className:"border border-solid",style:{position:"absolute",left:`${u.x*100}%`,top:`${u.y*100}%`,width:`${u.width*100}%`,height:`${u.height*100}%`,borderWidth:"2px",borderColor:`${u.color}`,backgroundColor:`${u.color}4D`,zIndex:1e3},onClick:()=>g(u.id)})))))},Ae={colors:{primary:"#007bff",secondary:"#6c757d",success:"#008000",warning:"#FFA500",error:"#FF0000",info:"#0000FF",background:"#f8f9fa",text:"#343a40",border:"#dee2e6",disabled:"#808080",disabledBackground:"#F5F5F5",disabledText:"#808080"},space:{sidebar:"md",size:"md",radius:"md",padding:"md",margin:"md",shadow:"md",lineHeight:"md"}},$e=dt$1.div`
43
- display: flex;
44
- align-items: center;
45
- justify-content: center;
46
- height: 200px;
47
- color: ${m=>m.$theme.colors.disabledText};
48
- font-size: 14px;
49
- `,Pe=dt$1.div`
50
- display: flex;
51
- align-items: center;
52
- justify-content: center;
53
- height: 200px;
54
- color: ${m=>m.$theme.colors.error};
55
- font-size: 14px;
56
- text-align: center;
57
- `,Te=({pdfDocument:m,currentPage:a,pdfStartPage:A=1,scale:f,annotations:_,isAnnotating:V,isSlidesMode:q=!1,onPageChange:Y,onScaleChange:M,onAnnotationChange:b,onAnnotationDelete:w,styles:P})=>{const[S,F]=useState(!1),[l,t]=useState(null),[r,o]=useState(0),[v,g]=useState(0),[u,n]=useState(!1),[i,e]=useState(!0),E=(P==null?void 0:P.theme)||Ae,x=useRef(null),j=useRef(null),I=useRef(!1),yt=useRef(null),wt=useCallback(K=>{if(!j.current||!i||!M)return null;const B=j.current,U=B.offsetWidth-40,G=B.offsetHeight-40,Q=U/K.width,xt=G/K.height,Rt=Math.min(Q,xt,1),H=Math.max(.3,Math.min(1,Rt));return console.log("\u81EA\u52A8\u8BA1\u7B97\u7F29\u653E\u6BD4\u4F8B:",{containerWidth:U,containerHeight:G,viewportWidth:K.width,viewportHeight:K.height,scaleX:Q,scaleY:xt,autoScale:Rt,finalScale:H}),H},[i,M]),bt=useCallback(async()=>{if(!(!m||!x.current)){if(I.current||yt.current===a){console.log("\u9875\u9762\u6B63\u5728\u6E32\u67D3\u4E2D\uFF0C\u8DF3\u8FC7");return}try{yt.current=a,I.current=!0;const K=a-A+1;if(console.log(`\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3\u9875\u9762: PDF\u8D77\u59CB\u9875\uFF1ApdfStartPage=${A}, \u5168\u5C40\u9875\u7801\uFF1AcurrentPage=${a}, \u76F8\u5BF9\u9875\u7801=${K}`),K<1||K>m.numPages)throw console.error(`\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u76F8\u5BF9\u9875\u7801=${K}, PDF\u603B\u9875\u6570=${m.numPages}`),new Error(`\u9875\u7801\u8D85\u51FA\u8303\u56F4: \u8BF7\u6C42\u7B2C${a}\u9875\uFF0C\u4F46PDF\u6587\u6863\u53EA\u5305\u542B${m.numPages}\u9875`);const B=await m.getPage(K),U=x.current,G=U.getContext("2d");console.log("\u5F53\u524Dscale\u503C:",f);const Q=B.getViewport({scale:1});if(console.log("viewport\u5C3A\u5BF8:",Q.width,"x",Q.height),i&&e(!1),U.width=Q.width,U.height=Q.height,await B.render({canvasContext:G,viewport:Q}).promise,console.log("PDF\u6E32\u67D3\u6210\u529F, canvas\u5C3A\u5BF8:",U.width,"x",U.height),j.current){const xt=j.current;console.log("\u5BB9\u5668\u5C3A\u5BF8:",xt.offsetWidth,"x",xt.offsetHeight),console.log("Canvas\u663E\u793A\u5C3A\u5BF8:",U.offsetWidth,"x",U.offsetHeight)}}catch(K){console.error("PDF\u6E32\u67D3\u5931\u8D25:",K)}finally{I.current=!1}}},[m,f,A,wt,M,a]);return useEffect(()=>{m&&a&&A&&(console.log("\u8BA1\u7B97\u4E0B\uFF0CrenderPage:","pdfStartPage:"+A,"currentPage:"+a,"pdfDocument:",m),bt())},[a,m,A]),useEffect(()=>{m&&a&&bt()},[f,m,a]),S?React__default.createElement("div",{className:"flex justify-center items-center min-h-full"},React__default.createElement($e,{$theme:E},"\u52A0\u8F7D\u4E2D...")):l?React__default.createElement("div",{className:"flex justify-center items-center min-h-full"},React__default.createElement(Pe,{$theme:E},React__default.createElement("div",null,React__default.createElement("div",null,"\u52A0\u8F7D\u5931\u8D25"),React__default.createElement("div",{style:{fontSize:"12px",marginTop:"8px"}},l)))):React__default.createElement("div",{ref:j,className:"bg-gray-100",style:{display:q?"block":"flex",justifyContent:q?"initial":"center",alignItems:q?"initial":"flex-start",padding:"20px",minHeight:"100%",width:"100%",overflow:"visible"}},S?React__default.createElement("div",{className:"flex flex-col items-center gap-2 mt-20"},React__default.createElement("div",{className:"animate-spin rounded-full h-6 w-6 border-b-2 border-gray-900"}),React__default.createElement("div",{className:"text-xs text-gray-600"},"PDF\u52A0\u8F7D\u4E2D...")):l?React__default.createElement("div",{className:"flex flex-col items-center gap-2 mt-20 text-red-500"},React__default.createElement("div",null,"\u6E32\u67D3\u9519\u8BEF"),React__default.createElement("div",{className:"text-xs"},l)):React__default.createElement("div",{className:"flex justify-center items-start"},React__default.createElement("div",{className:"relative",style:{transform:`scale(${f})`,transformOrigin:"center",display:"inline-block"}},React__default.createElement("canvas",{ref:x,className:"shadow-lg bg-white border border-gray-300",style:{display:"block"}}),React__default.createElement(ke,{pageNumber:a,scale:f,isAnnotating:V,annotations:_,onAnnotationAdd:b,onAnnotationDelete:w,readOnly:!V}))))},_e=dt$1.div`
58
- flex: 1;
59
- background: ${m=>m.$theme.colors.background};
60
- position: relative;
61
- display: flex;
62
- flex-direction: column;
63
- scroll-behavior: smooth;
64
-
65
- min-height: 0; /* 确保flex子元素可以收缩 */
66
- height: calc(100% - 1px); /* 明确的高度设置,减去header高度 */
67
- /* 支持大尺寸内容的滚动 */
68
- overflow-x: auto;
69
- overflow-y: auto; /* 改为auto,允许垂直滚动 */
70
- `,Re=dt$1.div`
71
- display: flex;
72
- align-items: center;
73
- justify-content: center;
74
- height: 100%;
75
- color: ${m=>m.$theme.colors.disabledText};
76
- `,Ne=dt$1.div`
77
- display: flex;
78
- flex-direction: column;
79
- align-items: center;
80
- justify-content: center;
81
- height: 100%;
82
- color: ${m=>m.$theme.colors.error};
83
- text-align: center;
84
- padding: 20px;
85
- `,Le=`
86
- .md-annotation {
87
- position: relative;
88
- display: inline;
89
- cursor: pointer;
90
- transition: opacity 0.2s;
91
- background-color: var(--highlight-color, #FFE599);
92
- }
93
-
94
- .md-annotation:hover {
95
- opacity: 0.8;
96
- }
97
-
98
- /* \u8868\u683C\u6807\u6CE8\u6837\u5F0F */
99
- .table-annotation {
100
- background-color: var(--table-highlight-color, rgba(255, 229, 153, 0.5));
101
- }
102
-
103
- /* markdown_table\u6A21\u5F0F\u4E0B\u7684\u8868\u683C\u6837\u5F0F */
104
- .markdown-table-mode table {
105
- overflow: visible !important;
106
- max-width: none !important;
107
- width: auto !important;
108
- table-layout: auto !important;
109
- }
110
-
111
- .markdown-table-mode table,
112
- .markdown-table-mode table * {
113
- overflow: visible !important;
114
- }
115
-
116
- .markdown-table-mode .table-container{
117
- margin: 0 !important;
118
- overflow: auto !important;
119
- width: 100% !important;
120
- min-width: 100% !important;
121
- }
122
-
123
- /* \u786E\u4FDD\u8868\u683C\u5355\u5143\u683C\u4E0D\u4F1A\u88AB\u538B\u7F29 */
124
- .markdown-table-mode table td,
125
- .markdown-table-mode table th {
126
- white-space: nowrap !important;
127
- min-width: 50px !important;
128
- }
129
-
130
- /* \u79FB\u9664fit-content\uFF0C\u4F7F\u7528100%\u5BBD\u5EA6\u786E\u4FDD\u5185\u5BB9\u80FD\u6B63\u5E38\u663E\u793A */
131
- .markdown-table-mode div{
132
- width: fit-content !important;
133
- }
134
-
135
- /* \u4E3A\u8868\u683C\u6DFB\u52A0\u6700\u5C0F\u5BBD\u5EA6\uFF0C\u786E\u4FDD\u5185\u5BB9\u4E0D\u88AB\u538B\u7F29 */
136
- .markdown-table-mode table {
137
- min-width: fit-content !important;
138
- }
139
-
140
- .markdown-table-mode.markdown-scrollbar::-webkit-scrollbar {
141
- width: 12px;
142
- height: 12px;
143
- }
144
-
145
-
146
- /* \u81EA\u5B9A\u4E49\u6EDA\u52A8\u6761\u6837\u5F0F */
147
- .markdown-scrollbar::-webkit-scrollbar {
148
- width: 8px;
149
- height: 8px;
150
- }
151
-
152
- .markdown-scrollbar::-webkit-scrollbar-track {
153
- background: #f1f1f1;
154
- border-radius: 4px;
155
- }
156
-
157
- .markdown-scrollbar::-webkit-scrollbar-thumb {
158
- background: #c1c1c1;
159
- border-radius: 4px;
160
- }
161
-
162
- .markdown-scrollbar::-webkit-scrollbar-thumb:hover {
163
- background: #a9a9a;
164
- }
165
- `,ze={colors:{primary:"#007bff",secondary:"#6c757d",success:"#008000",warning:"#FFA500",error:"#FF0000",info:"#0000FF",background:"#f8f9fa",text:"#343a40",border:"#dee2e6",disabled:"#808080",disabledBackground:"#F5F5F5",disabledText:"#808080"},space:{sidebar:"md",size:"md",radius:"md",padding:"md",margin:"md",shadow:"md",lineHeight:"md"}},Se=m=>{if(console.log("=== detectFileType \u5F00\u59CB ==="),console.log("\u8F93\u5165\u6570\u636E:",m),!m)return console.log("\u6570\u636E\u4E3A\u7A7A\uFF0C\u8FD4\u56DE unknown"),"unknown";const a=m.fileName||"",A=m.fileType||"",f=m.content;return console.log("\u68C0\u6D4B\u53C2\u6570:",{fileName:a,fileType:A,content:f}),A==="pdf"||A==="pdf_slides"?(console.log("\u68C0\u6D4B\u5230PDF\u6587\u4EF6"),A):A==="image"?(console.log("\u68C0\u6D4B\u5230\u56FE\u7247\u6587\u4EF6"),"image"):A==="markdown_table"?(console.log("\u68C0\u6D4B\u5230Markdown\u8868\u683C\u6587\u4EF6"),"markdown_table"):A==="markdown"?(console.log("\u68C0\u6D4B\u5230Markdown\u6587\u4EF6"),"markdown"):A==="html"?(console.log("\u68C0\u6D4B\u5230HTML\u6587\u4EF6"),"html"):A==="text"?(console.log("\u68C0\u6D4B\u5230\u6587\u672C\u6587\u4EF6"),"text"):a.toLowerCase().endsWith(".pdf")||(f==null?void 0:f.type)==="pdf"?(console.log("\u68C0\u6D4B\u5230PDF\u6587\u4EF6"),"pdf"):a.toLowerCase().match(/\.(jpg|jpeg|png|gif|bmp|webp)$/)||(f==null?void 0:f.type)==="image"?(console.log("\u68C0\u6D4B\u5230\u56FE\u7247\u6587\u4EF6"),"image"):a.toLowerCase().endsWith(".md")||(f==null?void 0:f.type)==="markdown"?(console.log("\u68C0\u6D4B\u5230Markdown\u6587\u4EF6"),"markdown"):a.toLowerCase().match(/\.(html|htm)$/)||(f==null?void 0:f.type)==="html"?(console.log("\u68C0\u6D4B\u5230HTML\u6587\u4EF6"),"html"):a.toLowerCase().match(/\.(txt|log|json|xml|css|js|ts)$/)||(f==null?void 0:f.type)==="text"?(console.log("\u68C0\u6D4B\u5230\u6587\u672C\u6587\u4EF6"),"text"):(console.log("\u672A\u8BC6\u522B\u7684\u6587\u4EF6\u7C7B\u578B\uFF0C\u8FD4\u56DE unknown"),"unknown")},Me=(m,a,A=!1)=>{var f,_,V,q,Y,M,b;console.log("\u8BA1\u7B97\u4E0B\uFF0CrenderPdfContent:","pdfStartPage:"+m.pdfStartPage,"currentPage:"+a.currentPage),console.log("=== renderPdfContent \u5F00\u59CB ==="),console.log("PDF\u6570\u636E:",m),console.log("PDF\u6587\u6863:",(f=m.content)==null?void 0:f.document),console.log("PDF\u6587\u6863\u7C7B\u578B:",typeof((_=m.content)==null?void 0:_.document)),console.log("PDF\u6587\u6863\u662F\u5426\u4E3Anull:",((V=m.content)==null?void 0:V.document)===null),console.log("PDF\u6587\u6863\u662F\u5426\u4E3Aundefined:",((q=m.content)==null?void 0:q.document)===void 0),console.log("PDF\u6587\u6863\u65B9\u6CD5:",(Y=m.content)!=null&&Y.document?Object.getOwnPropertyNames(Object.getPrototypeOf(m.content.document)):"\u65E0\u6587\u6863"),console.log("PDF\u6587\u6863\u5C5E\u6027:",(M=m.content)!=null&&M.document?Object.keys(m.content.document):"\u65E0\u6587\u6863");const w=m.pdfStartPage||1;console.log("PDF\u8D77\u59CB\u9875:",w);const P=(a.annotationData||[]).filter(l=>"pageNumber"in l&&"x"in l&&"y"in l);console.log("=== PDF\u6807\u6CE8\u6570\u636E ==="),console.log("\u539F\u59CBannotationData:",a.annotationData),console.log("\u8FC7\u6EE4\u540E\u7684pdfAnnotations:",P);const S=A?.82:1,F=a.initialZoom||a.scale||S;return React__default.createElement(Te,{pdfDocument:((b=m.content)==null?void 0:b.document)||null,currentPage:a.currentPage||1,pdfStartPage:w,scale:F,annotations:P,isAnnotating:!1,isSlidesMode:A,onPageChange:a.eventsEmit?l=>{var t;return(t=a.eventsEmit)==null?void 0:t.call(a,"pageChange",{pageNumber:l})}:void 0,onScaleChange:a.eventsEmit?l=>{var t;return(t=a.eventsEmit)==null?void 0:t.call(a,"scaleChange",{scale:l})}:void 0,onAnnotationChange:a.eventsEmit?l=>{var t;return(t=a.eventsEmit)==null?void 0:t.call(a,"annotationChange",{annotation:l})}:void 0,onAnnotationDelete:a.eventsEmit?l=>{var t;return(t=a.eventsEmit)==null?void 0:t.call(a,"annotationDelete",{annotationId:l})}:void 0,styles:a.styles})},We=(m,a)=>{var A,f,_,V,q,Y,M,b,w,P,S,F,l,t;console.log("=== Fviewer renderImageContent ==="),console.log("data:",m),console.log("data.content:",m.content),console.log("data.content?.url:",(A=m.content)==null?void 0:A.url),console.log("rotation:",a.rotation);const r=((f=m.content)==null?void 0:f.url)||m.content,[o,v]=useState(!0),[g,u]=useState(!1),n=()=>{console.log("\u56FE\u7247\u52A0\u8F7D\u5B8C\u6210:",r),v(!1),u(!1)},i=()=>{console.error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25:",r),v(!1),u(!0)};return React__default.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",padding:"20px",overflow:"auto",position:"relative",backgroundColor:"#272727"}},o&&React__default.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"flex",flexDirection:"column",alignItems:"center",gap:"12px",zIndex:1}},React__default.createElement("div",{style:{width:"32px",height:"32px",border:`3px solid ${((q=(V=(_=a.styles)==null?void 0:_.theme)==null?void 0:V.colors)==null?void 0:q.border)||"#dee2e6"}`,borderTop:`3px solid ${((b=(M=(Y=a.styles)==null?void 0:Y.theme)==null?void 0:M.colors)==null?void 0:b.primary)||"#007bff"}`,borderRadius:"50%",animation:"spin 1s linear infinite"}}),React__default.createElement("div",{style:{fontSize:"12px",color:((S=(P=(w=a.styles)==null?void 0:w.theme)==null?void 0:P.colors)==null?void 0:S.text)||"#343a40"}},"\u56FE\u7247\u52A0\u8F7D\u4E2D...")),g&&React__default.createElement("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",display:"flex",flexDirection:"column",alignItems:"center",gap:"8px",zIndex:1}},React__default.createElement("div",{style:{fontSize:"14px",color:((t=(l=(F=a.styles)==null?void 0:F.theme)==null?void 0:l.colors)==null?void 0:t.error)||"#dc3545"}},"\u56FE\u7247\u52A0\u8F7D\u5931\u8D25")),React__default.createElement("img",{src:r,alt:m.fileName||"\u56FE\u7247",onLoad:n,onError:i,style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain",transform:`scale(${a.scale||1}) rotate(${a.rotation||0}deg)`,opacity:o?0:1,transition:"opacity 0.3s ease-in-out, transform 0.2s ease-in-out"}}),React__default.createElement("style",null,`
166
- @keyframes spin {
167
- 0% { transform: rotate(0deg); }
168
- 100% { transform: rotate(360deg); }
169
- }
170
- `))},Ie=(m,a)=>{var A,f,_,V,q;console.log("=== Fviewer renderTextContent ==="),console.log("data:",m),console.log("data.content:",m.content);let Y="";typeof m.content=="string"?Y=m.content:(A=m.content)!=null&&A.text?Y=m.content.text:(f=m.content)!=null&&f.content&&(Y=m.content.content),console.log("\u5B9E\u9645\u6587\u672C\u5185\u5BB9:",Y);const M=useRef(null),b=useRef(null);return useEffect(()=>{if(M.current&&b.current&&Y){const w=setTimeout(()=>{var P;const S=((P=M.current)==null?void 0:P.scrollHeight)||0,F=Math.max(S+80,200);b.current&&(b.current.style.minHeight=`${F}px`,console.log("\u6587\u672C\u7EB8\u5F20\u9AD8\u5EA6\u8C03\u6574\u5B8C\u6210:",F))},100);return()=>clearTimeout(w)}},[Y]),React__default.createElement("div",{style:{height:"100%",overflow:"auto",backgroundColor:"#f5f5f5",padding:"20px",display:"flex",justifyContent:"center",position:"relative"}},React__default.createElement("div",{ref:b,style:{width:"100%",maxWidth:"800px",backgroundColor:"white",boxShadow:"0 4px 8px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06)",borderRadius:"8px",padding:"40px",margin:"20px 0",position:"relative",transform:`scale(${a.scale||1})`,transition:"transform 0.2s ease-in-out",transformOrigin:"top center"}},React__default.createElement("div",{ref:M,style:{width:"100%",overflow:"visible"}},React__default.createElement(Hv,{dataSource:{type:la.TEXT,content:Y},size:"md",theme:{primaryColor:((q=(V=(_=a.styles)==null?void 0:_.theme)==null?void 0:V.colors)==null?void 0:q.primary)||"#007bff",backgroundColor:"transparent",textColor:"#333",borderColor:"transparent",borderRadius:"0",padding:"0"},style:{border:"none",background:"transparent",width:"100%",height:"auto",overflow:"visible"}})),React__default.createElement("div",{style:{position:"absolute",top:"0",left:"0",right:"0",height:"2px",background:"linear-gradient(90deg, #e0e0e0 0%, #f0f0f0 50%, #e0e0e0 100%)",borderTopLeftRadius:"8px",borderTopRightRadius:"8px"}})))},je=({data:m,parentProps:a,isTableMode:A=!1})=>{var f,_,V,q,Y,M,b,w,P,S,F,l;const t=useRef(null),r=useRef(null),o=useRef(null),v=useRef(!1);useRef(0),useRef(null);const[g]=useState(!1),u=(B,U)=>{console.log("=== Markdownit\u6EDA\u52A8\u4E8B\u4EF6\u89E6\u53D1 ==="),console.log("\u6EDA\u52A8\u4F4D\u7F6E:",{scrollTop:B,scrollHeight:U}),a.eventsEmit&&a.eventsEmit("markdown_scroll",{scrollTop:B,scrollHeight:U})},n=()=>{console.log("=== Markdownit\u6EDA\u52A8\u5230\u9876\u90E8 ==="),a.eventsEmit&&a.eventsEmit("markdown_scroll_to_top")},i=()=>{console.log("=== Markdownit\u6EDA\u52A8\u5230\u5E95\u90E8 ==="),a.eventsEmit&&a.eventsEmit("markdown_scroll_to_bottom")},e=useRef();e.current=B=>{var U,G;try{if(!A)return;const Q=typeof m.content=="string"?m.content:((U=m.content)==null?void 0:U.content)||"";if(!Q||I.length===0)return;const xt=JSON.stringify(I.map(H=>({o:H.offsets,c:H.color}))),Rt=`${Q.length}:${Q.substring(0,64)}:${Q.substring(Q.length-64)}|${xt}`;if(((G=B.dataset)==null?void 0:G.tableAnnoRuntimeSig)===Rt)return;setTimeout(()=>{bt(),B.dataset&&(B.dataset.tableAnnoRuntimeSig=Rt)},50)}catch(Q){console.warn("[MarkdownRendered] apply failed",Q)}};const E=React__default.useCallback(B=>{var U;return(U=e.current)==null?void 0:U.call(e,B)},[]),x=useCallback(()=>{var B;if(!g||!t.current)return;const U=window.getSelection();if(!U||U.isCollapsed)return;const G=U.getRangeAt(0),Q=G.toString().trim();if(!Q)return;const xt=t.current;let Rt=0,H=0;const h=document.createTreeWalker(xt,NodeFilter.SHOW_TEXT,{acceptNode:O=>{var $;return($=O.parentElement)!=null&&$.closest("pre")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}});let c=h.nextNode();for(;c;){if(c===G.startContainer){H=Rt+G.startOffset;break}Rt+=((B=c.textContent)==null?void 0:B.length)||0,c=h.nextNode()}console.log("\u9009\u4E2D\u6587\u672C\u4FE1\u606F:",{text:Q,startOffset:H,charCount:Rt,container:G.startContainer.textContent});const T={id:`md-anno-${Date.now()}`,start:H,end:H+Q.length,color:"#FFE599"};console.log("\u521B\u5EFA\u65B0\u6807\u6CE8:",T),a.eventsEmit&&a.eventsEmit("md_annotation_add",T),U.removeAllRanges()},[g,a.eventsEmit]),j=A?[]:(a.annotationData||[]).filter(B=>"start"in B&&"end"in B&&!("pageNumber"in B)),I=A?(a.annotationData||[]).filter(B=>"offsets"in B&&Array.isArray(B.offsets)):[],yt=useCallback(()=>{if(console.log("=== \u5F00\u59CB\u6E05\u7A7A\u6240\u6709\u6807\u6CE8 ==="),!t.current){console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u65E0\u6CD5\u6E05\u7A7A\u6807\u6CE8");return}const B=t.current.querySelectorAll(".md-annotation");console.log("\u6E05\u7A7AMarkdown\u6807\u6CE8\u6570\u91CF:",B.length),B.length>0&&B.forEach(U=>{const G=U.parentNode;G&&G.replaceChild(document.createTextNode(U.textContent||""),U)}),console.log("\u6240\u6709\u6807\u6CE8\u5DF2\u6E05\u7A7A")},[]),wt=useCallback(()=>{t.current&&(t.current.querySelectorAll("table").forEach(B=>{Array.from(B.rows).forEach(U=>{Array.from(U.cells).forEach(G=>{G.getAttribute("data-table-annotated")==="1"&&(G.style.removeProperty("background"),G.style.removeProperty("background-color"),G.removeAttribute("data-table-annotated"),G.removeAttribute("title"))})})}),console.log("\u5DF2\u6E05\u7A7A\u6240\u6709\u8868\u683C\u6807\u6CE8"))},[]),bt=useCallback(()=>{if(console.log("=== \u5F00\u59CB\u5E94\u7528\u8868\u683C\u6807\u6CE8 ==="),console.log("tableAnnotations:",I),!t.current){console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA");return}if(wt(),!I.length){console.log("\u6CA1\u6709\u8868\u683C\u6807\u6CE8\u6570\u636E\uFF0C\u4EC5\u6E05\u7A7A\u65E7\u6807\u6CE8");return}const B=t.current.querySelectorAll("table");if(console.log("\u627E\u5230\u8868\u683C\u6570\u91CF:",B.length),B.length===0){console.log("\u6CA1\u6709\u627E\u5230\u8868\u683C\u5143\u7D20");return}v.current=!0,I.forEach((U,G)=>{const Q=U.offsets;if(console.log("\u5904\u7406\u8868\u683C\u6807\u6CE8:",U),!Array.isArray(Q)||!Q.length||!Array.isArray(Q[0])||Q[0].length!==2){console.warn("[TableAnnotation] annotation.offsets is not valid",U);return}Q.forEach((xt,Rt)=>{const[H,h]=xt;if(typeof H!="number"||typeof h!="number"){console.warn("[TableAnnotation] offset is not [number, number]",xt);return}B.forEach((c,T)=>{var O;const $=Array.from(c.rows),W=$[H];if(!W){console.warn("[TableAnnotation] row out of range",{row:H,tableIndex:T,totalRows:$.length});return}const s=(O=W.cells)==null?void 0:O[h];if(!s){console.warn("[TableAnnotation] cell is undefined",{row:H,col:h,tableIndex:T});return}const d=U.color||"rgba(255, 229, 153, 0.5)",C=getComputedStyle(s).backgroundColor;s.getAttribute("data-table-annotated")==="1"&&(C===d||s.style.backgroundColor===d)||(s.style.setProperty("background",d,"important"),s.style.setProperty("background-color",d,"important"),s.setAttribute("data-table-annotated","1")),U.content&&(s.title=U.content),Rt===0&&G===0&&setTimeout(()=>{s.scrollIntoView({behavior:"smooth",block:"start"})},300)})})}),requestAnimationFrame(()=>{v.current=!1})},[I,wt]),K=useCallback(()=>{if(console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8 ==="),!t.current||!j.length){console.log("\u6761\u4EF6\u4E0D\u6EE1\u8DB3\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");return}r.current&&clearTimeout(r.current);const B=()=>{var U;console.log("\u5F00\u59CB\u5E94\u7528\u6807\u6CE8...");const G=(U=t.current)==null?void 0:U.querySelectorAll(".md-annotation");console.log("\u79FB\u9664\u73B0\u6709\u6807\u6CE8\u6570\u91CF:",(G==null?void 0:G.length)||0),G==null||G.forEach(T=>{const O=T.parentNode;O&&O.replaceChild(document.createTextNode(T.textContent||""),T)});const Q=document.createTreeWalker(t.current,NodeFilter.SHOW_TEXT,{acceptNode:T=>{var O;return(O=T.parentElement)!=null&&O.closest("pre")?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),xt=[];let Rt;for(;Rt=Q.nextNode();)xt.push(Rt);if(console.log("\u627E\u5230\u6587\u672C\u8282\u70B9\u6570\u91CF:",xt.length),xt.length===0){console.log("\u6CA1\u6709\u627E\u5230\u6587\u672C\u8282\u70B9\uFF0C\u5EF6\u8FDF\u91CD\u8BD5..."),r.current=setTimeout(()=>{B()},200);return}let H=0;const h=xt.map(T=>{var O;const $=H;return H+=((O=T.textContent)==null?void 0:O.length)||0,{node:T,start:$,end:H,text:T.textContent}});console.log("\u6587\u672C\u8282\u70B9\u4F4D\u7F6E:",h),console.log("\u603B\u6587\u672C\u957F\u5EA6:",H);const c=[...j].sort((T,O)=>O.start-T.start);console.log("\u6392\u5E8F\u540E\u7684\u6807\u6CE8:",c),c.forEach(T=>{const{start:O,end:$,color:W}=T;console.log("\u5904\u7406\u6807\u6CE8:",{annotation:T,nodePositions:h});const s=h.filter(d=>O<d.end&&$>d.start);console.log("\u76F8\u5173\u8282\u70B9\u6570\u91CF:",s.length),s.forEach(({node:d,start:C})=>{var y,k,N,D,p,L;const _t=Math.max(0,O-C),z=Math.min(((y=d.textContent)==null?void 0:y.length)||0,$-C);if(console.log("\u672C\u5730\u4F4D\u7F6E:",{localStart:_t,localEnd:z,nodeTextLength:(k=d.textContent)==null?void 0:k.length}),_t>=z){console.log("\u672C\u5730\u4F4D\u7F6E\u65E0\u6548\uFF0C\u8DF3\u8FC7");return}const Z=((N=d.textContent)==null?void 0:N.slice(0,_t))||"",At=((D=d.textContent)==null?void 0:D.slice(_t,z))||"",kt=((p=d.textContent)==null?void 0:p.slice(z))||"";console.log("\u5206\u5272\u6587\u672C:",{before:Z,annotatedText:At,after:kt});const Mt=document.createElement("span");Mt.className="md-annotation",Mt.style.backgroundColor=W||"#FFE599",Mt.textContent=At;const St=document.createDocumentFragment();Z&&St.appendChild(document.createTextNode(Z)),St.appendChild(Mt),kt&&St.appendChild(document.createTextNode(kt)),(L=d.parentNode)==null||L.replaceChild(St,d),console.log("\u6210\u529F\u5E94\u7528\u6807\u6CE8:",At)})})};r.current=setTimeout(()=>{B()},100)},[j]);return useEffect(()=>{var B;if(A){console.log("[MarkdownContentView] table mode: skip effect, wait for onRendered");return}const U=typeof m.content=="string"?m.content:((B=m.content)==null?void 0:B.content)||"";if(!U||typeof U!="string"){console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u6807\u6CE8\u5E94\u7528");return}if(console.log("=== \u5F00\u59CB\u5E94\u7528Markdown\u6807\u6CE8\u9AD8\u4EAE ==="),console.log("markdownRef.current:",t.current),console.log("isTableMode:",A),console.log("mdAnnotations:",j),console.log("tableAnnotations:",I),console.log("data.content:",m.content),console.log("\u5B9E\u9645\u5185\u5BB9:",U),!t.current){console.log("markdownRef\u4E0D\u5B58\u5728\uFF0C\u9000\u51FA\u6807\u6CE8\u5E94\u7528");return}if(A||yt(),!A&&j.length>0){K();return}console.log("\u6CA1\u6709\u9700\u8981\u5E94\u7528\u7684\u6807\u6CE8")},[A,I,j]),useEffect(()=>{if(!A)return document.addEventListener("mouseup",x),()=>{document.removeEventListener("mouseup",x)}},[x,A]),useEffect(()=>{var B;const U=typeof m.content=="string"?m.content:((B=m.content)==null?void 0:B.content)||"";if(!U||typeof U!="string"){console.log("Markdown\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\uFF0C\u8DF3\u8FC7\u8C03\u8BD5\u4FE1\u606F\u6253\u5370");return}console.log("=== Markdown\u5185\u5BB9\u4FE1\u606F ==="),console.log("isTableMode:",A),console.log("\u5185\u5BB9\u957F\u5EA6:",U.length||0),typeof U=="string"?(console.log("\u5185\u5BB9\u524D100\u5B57\u7B26:",U.substring(0,100)),console.log("\u5185\u5BB9\u540E100\u5B57\u7B26:",U.substring(U.length-100))):(console.log("\u5185\u5BB9\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B:",typeof U),console.log("\u5185\u5BB9\u503C:",U)),console.log("\u6807\u6CE8\u6570\u636E:",j),console.log("\u8868\u683C\u6807\u6CE8\u6570\u636E:",I)},[j,I,A]),useEffect(()=>{if(A&&t.current){const B=setTimeout(()=>{var U;const G=(U=t.current)==null?void 0:U.querySelectorAll("table");G&&G.length>0&&(console.log("\u8C03\u6574\u8868\u683C\u5C3A\u5BF8\uFF0C\u627E\u5230\u8868\u683C\u6570\u91CF:",G.length),G.forEach((Q,xt)=>{if(Q instanceof HTMLTableElement){Q.style.width="100%",Q.style.minWidth="100%",Q.style.tableLayout="auto";const Rt=Q.closest(".markdown-table-mode");Rt&&Rt instanceof HTMLElement&&(Rt.style.width="100%",Rt.style.overflowX="auto"),console.log(`\u8868\u683C ${xt+1} \u5C3A\u5BF8\u8C03\u6574\u5B8C\u6210`)}}))},500);return()=>clearTimeout(B)}},[A,m.content]),useEffect(()=>()=>{r.current&&clearTimeout(r.current),o.current&&(o.current.disconnect(),o.current=null)},[]),React__default.createElement("div",{style:{height:"100%",width:"100%",overflow:"auto"},className:`markdown-container markdown-scrollbar ${A?"markdown-table-mode":""}`},React__default.createElement("style",null,Le),React__default.createElement("div",{ref:t},React__default.createElement(Hv,{dataSource:{type:la.MARKDOWN,content:(()=>{var B,U;return typeof m.content=="string"?m.content:(B=m.content)!=null&&B.text?m.content.text:(U=m.content)!=null&&U.content?m.content.content:""})()},size:"md",onScroll:A?void 0:u,onScrollToTop:A?void 0:n,onScrollToBottom:A?void 0:i,onRendered:E,theme:{primaryColor:((V=(_=(f=a.styles)==null?void 0:f.theme)==null?void 0:_.colors)==null?void 0:V.primary)||"#007bff",backgroundColor:((M=(Y=(q=a.styles)==null?void 0:q.theme)==null?void 0:Y.colors)==null?void 0:M.background)||"#f8f9fa",textColor:((P=(w=(b=a.styles)==null?void 0:b.theme)==null?void 0:w.colors)==null?void 0:P.text)||"#343a40",borderColor:((l=(F=(S=a.styles)==null?void 0:S.theme)==null?void 0:F.colors)==null?void 0:l.border)||"#dee2e6",borderRadius:A?"0px":"8px",padding:A?"0px":"20px"},style:{height:"100%",border:"none",background:"transparent",overflowY:A?"visible":"scroll"}})))},Oe=({markdown:m,onRendered:a,tableAnnotations:A=[]})=>{const f=useRef(null),_=q=>{const Y=q.split(/\r?\n/).filter(S=>S.trim().length>0);let M=-1;for(let S=0;S<Y.length-1;S++){const F=Y[S].trim(),l=Y[S+1].trim();if(F.startsWith("|")&&F.endsWith("|")&&l.replace(/\s|:|\|/g,"").match(/^[-]+$/)){M=S;break}}if(M===-1)return null;const b=Y[M].split("|").slice(1,-1).map(S=>S.trim()),w=[];for(let S=M+2;S<Y.length;S++){const F=Y[S].trim();if(!F.startsWith("|")||!F.endsWith("|"))break;w.push(F)}const P=w.map(S=>S.split("|").slice(1,-1).map(F=>F.trim()));return{headers:b,rows:P}},V=React__default.useMemo(()=>_(m),[m]);return useEffect(()=>{const q=()=>{try{if(!f.current)return;const M=f.current.querySelectorAll("table");if(M.forEach(b=>{Array.from(b.rows).forEach(w=>{Array.from(w.cells).forEach(P=>{P.getAttribute("data-table-annotated")==="1"&&(P.style.removeProperty("background"),P.style.removeProperty("background-color"),P.removeAttribute("data-table-annotated"),P.removeAttribute("title"))})})}),!A.length||!M||M.length===0)return;A.forEach((b,w)=>{(b.offsets||[]).forEach((P,S)=>{const[F,l]=P;M.forEach(t=>{var r;const o=Array.from(t.rows)[F];if(!o)return;const v=(r=o.cells)==null?void 0:r[l];if(!v)return;const g=b.color||"rgba(255, 229, 153, 0.5)";v.getAttribute("data-table-annotated")==="1"||(v.style.setProperty("background",g,"important"),v.style.setProperty("background-color",g,"important"),v.setAttribute("data-table-annotated","1"),b.content&&(v.title=b.content)),w===0&&S===0&&setTimeout(()=>v.scrollIntoView({behavior:"smooth",block:"start"}),50)})})})}catch(M){console.warn("[MinimalMarkdownTable] apply annotations failed",M)}},Y=requestAnimationFrame(()=>{q(),a&&a()});return()=>cancelAnimationFrame(Y)},[m,A,a]),V?React__default.createElement("div",{ref:f,className:"markdown-table-mode z-mdtbl-wrapper"},React__default.createElement("style",null,`
171
- .z-mdtbl-wrapper { overflow: auto; position: relative; }
172
- .z-mdtbl { border-collapse: separate; border-spacing: 0; background: transparent; box-shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06); border-radius: 8px; }
173
- .z-mdtbl th, .z-mdtbl td { border: 1px solid #e5e7eb; padding: 10px 14px; font-size: 13px; line-height: 1.4; color: inherit; }
174
- .z-mdtbl th { background: transparent; font-weight: 600; color: inherit; }
175
- .z-mdtbl tbody tr:nth-child(odd) { background: transparent; }
176
- .z-mdtbl tbody tr:hover { background: transparent; }
177
- .z-mdtbl td, .z-mdtbl th { white-space: nowrap; }
178
- .z-mdtbl thead tr:first-child th:first-child { border-top-left-radius: 8px; }
179
- .z-mdtbl thead tr:first-child th:last-child { border-top-right-radius: 8px; }
180
- .z-mdtbl tbody tr:last-child td:first-child { border-bottom-left-radius: 8px; }
181
- .z-mdtbl tbody tr:last-child td:last-child { border-bottom-right-radius: 8px; }
182
- `),React__default.createElement("table",{className:"z-mdtbl"},React__default.createElement("thead",null,React__default.createElement("tr",null,V.headers.map((q,Y)=>React__default.createElement("th",{key:Y},q)))),React__default.createElement("tbody",null,V.rows.map((q,Y)=>React__default.createElement("tr",{key:Y},q.map((M,b)=>React__default.createElement("td",{key:b},M))))))):React__default.createElement("div",{ref:f,style:{padding:"8px"}},"\u65E0\u6CD5\u89E3\u6790\u4E3A\u8868\u683C")},He=(m,a)=>{var A,f;console.log("=== Fviewer renderHtmlContent ==="),console.log("data:",m),console.log("data.content:",m.content);let _="";return typeof m.content=="string"?_=m.content:(A=m.content)!=null&&A.text?_=m.content.text:(f=m.content)!=null&&f.content&&(_=m.content.content),console.log("\u6700\u7EC8\u4F20\u9012\u7ED9 iframe \u7684 content:",_),React__default.createElement("div",{style:{height:"100%",overflow:"auto",position:"relative"}},React__default.createElement("iframe",{srcDoc:_,style:{width:"100%",height:"100%",border:"none",background:"white"},title:"HTML Preview",sandbox:"allow-same-origin allow-scripts"}))},Ze=(m,a)=>React__default.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%",color:"#666"}},React__default.createElement("div",null,React__default.createElement("div",null,"\u4E0D\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B"),React__default.createElement("div",{style:{fontSize:"12px",marginTop:"8px"}},m.fileName||"\u672A\u77E5\u6587\u4EF6"))),Xe=({data:m,annotationData:a=[],totalPage:A=0,currentPage:f=1,scale:_,rotation:V=0,eventsEmit:q,styles:Y,tools:M={annotation:!0,download:!0,zoom:!0,close:!0,navigation:!0},customComponents:b,className:w,contentClass:P})=>{var S,F,l,t;const r=(Y==null?void 0:Y.theme)||ze,[o,v]=useState(!1),[g]=useState("\u5185\u5BB9\u52A0\u8F7D\u4E2D..."),[u,n]=useState(null);console.log("=== Fviewer \u63A5\u6536\u6570\u636E ==="),console.log("Fviewer data:",m),console.log("Fviewer data.content:",m==null?void 0:m.content),console.log("Fviewer data.content.document:",(S=m==null?void 0:m.content)==null?void 0:S.document),console.log("Fviewer data.content.document\u7C7B\u578B:",typeof((F=m==null?void 0:m.content)==null?void 0:F.document)),console.log("Fviewer data.content.document\u662F\u5426\u4E3Anull:",((l=m==null?void 0:m.content)==null?void 0:l.document)===null),console.log("Fviewer data.content.document\u662F\u5426\u4E3Aundefined:",((t=m==null?void 0:m.content)==null?void 0:t.document)===void 0),console.log("Fviewer currentPage:",f),console.log("Fviewer scale:",_);const i=useRef(null),e=useRef(null),E=useRef(0);E.current+=1,console.log("[Fviewer] render count:",E.current);const x=Se(m);console.log("=== Fviewer \u7EC4\u4EF6 ==="),console.log("\u68C0\u6D4B\u5230\u7684\u6587\u4EF6\u7C7B\u578B:",x),console.log("\u5B8C\u6574\u6570\u636E:",m);const j=()=>{var I;switch(console.log("\u5F00\u59CB\u6E32\u67D3\u5185\u5BB9\uFF0C\u6587\u4EF6\u7C7B\u578B:",x),x){case"pdf":case"pdf_slides":return console.log("\u8BA1\u7B97\u4E0B\uFF0C\u6E32\u67D3PDF\u5185\u5BB9:",x,"pdfStartPage:"+m.pdfStartPage,"currentPage:"+f),Me(m,{data:m,annotationData:a,totalPage:A,currentPage:f,scale:_,eventsEmit:q,styles:Y,tools:M,className:w,contentClass:P},x==="pdf_slides");case"image":return console.log("\u6E32\u67D3\u56FE\u7247\u5185\u5BB9"),We(m,{scale:_,rotation:V,styles:Y});case"text":return console.log("\u6E32\u67D3\u6587\u672C\u5185\u5BB9"),Ie(m,{scale:_,styles:Y});case"markdown":case"markdown_table":if(console.log("\u6E32\u67D3Markdown\u5185\u5BB9:",x),x==="markdown_table"){const yt=typeof m.content=="string"?m.content:((I=m.content)==null?void 0:I.content)||"",wt=(a||[]).filter(bt=>"offsets"in bt&&Array.isArray(bt.offsets));return React__default.createElement(Oe,{markdown:yt,tableAnnotations:wt})}return React__default.createElement(je,{data:m,parentProps:{data:m,annotationData:a,eventsEmit:q,styles:Y,tools:M,className:w,contentClass:P},isTableMode:!1});case"html":return console.log("\u6E32\u67D3HTML\u5185\u5BB9"),He(m);default:return console.log("\u6E32\u67D3\u672A\u77E5\u7C7B\u578B\u5185\u5BB9"),Ze(m)}};return React__default.useEffect(()=>{const I=i.current,yt=e.current,wt=I!==m,bt=yt!==(m?m.content:void 0);console.log("[Fviewer useEffect:data] triggered",{dataChanged:wt,contentChanged:bt,hasData:!!m,hasContent:!!(m!=null&&m.content),isLoadingBefore:o}),i.current=m,e.current=m?m.content:void 0},[m==null?void 0:m.content]),React__default.useEffect(()=>{u&&v(!1)},[u]),React__default.useEffect(()=>{console.log("=== Fviewer annotationData \u53D8\u5316\u76D1\u542C ==="),console.log("annotationData:",a),console.log("annotationData \u957F\u5EA6:",(a==null?void 0:a.length)||0),console.log("\u5F53\u524D\u6587\u4EF6\u7C7B\u578B:",x)},[a,x]),React__default.createElement(_e,{$theme:r,className:P},o?b!=null&&b.LoadingComponent?React__default.createElement(b.LoadingComponent,{status:g,theme:r}):React__default.createElement(Re,{$theme:r},g):u?b!=null&&b.ErrorComponent?React__default.createElement(b.ErrorComponent,{error:u,theme:r}):React__default.createElement(Ne,{$theme:r},React__default.createElement("div",null,"\u52A0\u8F7D\u5931\u8D25"),React__default.createElement("div",{style:{fontSize:"12px",marginTop:"8px"}},u)):j())};/**
183
- * @license lucide-react v0.456.0 - ISC
184
- *
185
- * This source code is licensed under the ISC license.
186
- * See the LICENSE file in the root directory of this source tree.
187
- */const qe=m=>m.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),be=(...m)=>m.filter((a,A,f)=>!!a&&a.trim()!==""&&f.indexOf(a)===A).join(" ").trim();/**
188
- * @license lucide-react v0.456.0 - ISC
189
- *
190
- * This source code is licensed under the ISC license.
191
- * See the LICENSE file in the root directory of this source tree.
192
- */var Ue={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
193
- * @license lucide-react v0.456.0 - ISC
194
- *
195
- * This source code is licensed under the ISC license.
196
- * See the LICENSE file in the root directory of this source tree.
197
- */const Ye=forwardRef(({color:m="currentColor",size:a=24,strokeWidth:A=2,absoluteStrokeWidth:f,className:_="",children:V,iconNode:q,...Y},M)=>createElement("svg",{ref:M,...Ue,width:a,height:a,stroke:m,strokeWidth:f?Number(A)*24/Number(a):A,className:be("lucide",_),...Y},[...q.map(([b,w])=>createElement(b,w)),...Array.isArray(V)?V:[V]]));/**
198
- * @license lucide-react v0.456.0 - ISC
199
- *
200
- * This source code is licensed under the ISC license.
201
- * See the LICENSE file in the root directory of this source tree.
202
- */const ue=(m,a)=>{const A=forwardRef(({className:f,..._},V)=>createElement(Ye,{ref:V,iconNode:a,className:be(`lucide-${qe(m)}`,f),..._}));return A.displayName=`${m}`,A};/**
203
- * @license lucide-react v0.456.0 - ISC
204
- *
205
- * This source code is licensed under the ISC license.
206
- * See the LICENSE file in the root directory of this source tree.
207
- */const Ge=ue("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
208
- * @license lucide-react v0.456.0 - ISC
209
- *
210
- * This source code is licensed under the ISC license.
211
- * See the LICENSE file in the root directory of this source tree.
212
- */const Ve=ue("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
213
- * @license lucide-react v0.456.0 - ISC
214
- *
215
- * This source code is licensed under the ISC license.
216
- * See the LICENSE file in the root directory of this source tree.
217
- */const Je=ue("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
218
- * @license lucide-react v0.456.0 - ISC
219
- *
220
- * This source code is licensed under the ISC license.
221
- * See the LICENSE file in the root directory of this source tree.
222
- */const Ke=ue("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
223
- * @license lucide-react v0.456.0 - ISC
224
- *
225
- * This source code is licensed under the ISC license.
226
- * See the LICENSE file in the root directory of this source tree.
227
- */const Qe=ue("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
228
- * @license lucide-react v0.456.0 - ISC
229
- *
230
- * This source code is licensed under the ISC license.
231
- * See the LICENSE file in the root directory of this source tree.
232
- */const et=ue("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
233
- * @license lucide-react v0.456.0 - ISC
234
- *
235
- * This source code is licensed under the ISC license.
236
- * See the LICENSE file in the root directory of this source tree.
237
- */const tt=ue("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
238
- * @license lucide-react v0.456.0 - ISC
239
- *
240
- * This source code is licensed under the ISC license.
241
- * See the LICENSE file in the root directory of this source tree.
242
- */const ot=ue("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/**
243
- * @license lucide-react v0.456.0 - ISC
244
- *
245
- * This source code is licensed under the ISC license.
246
- * See the LICENSE file in the root directory of this source tree.
247
- */const nt=ue("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),ut=dt$1.div`
248
- display: flex;
249
- align-items: center;
250
- padding: 0px 12px;
251
- justify-content: space-between;
252
- padding: ${m=>m.$theme.space.padding};
253
- border-bottom: 1px solid ${m=>m.$theme.colors.border};
254
- background: ${m=>m.$theme.colors.background};
255
- min-height: 52px;
256
- `,rt=dt$1.div`
257
- display: flex;
258
- align-items: center;
259
- gap: 8px;
260
- flex: 1;
261
- min-width: 0;
262
- `,lt=dt$1.div`
263
- font-size: 14px;
264
- font-weight: 500;
265
- color: ${m=>m.$theme.colors.text};
266
- white-space: nowrap;
267
- overflow: hidden;
268
- text-overflow: ellipsis;
269
- `,at=dt$1.div`
270
- font-size: 12px;
271
- color: ${m=>m.$theme.colors.disabledText};
272
- white-space: nowrap;
273
- `,st=dt$1.div`
274
- display: flex;
275
- align-items: center;
276
- gap: 4px;
277
- `,ne=dt$1.button`
278
- display: flex;
279
- align-items: center;
280
- justify-content: center;
281
- width: 32px;
282
- height: 32px;
283
- border: none;
284
- border-radius: ${m=>m.$theme.space.radius};
285
- background: ${m=>m.$active?m.$theme.colors.primary+"20":"transparent"};
286
- color: ${m=>m.$active?m.$theme.colors.primary:m.$theme.colors.text};
287
- cursor: pointer;
288
- transition: all 0.2s ease;
289
-
290
- /* 确保图标有默认颜色 */
291
- & > svg {
292
- color: currentColor;
293
- stroke: currentColor;
294
- }
295
-
296
- &:hover {
297
- background: ${m=>m.$theme.colors.primary+"10"};
298
- color: ${m=>m.$theme.colors.primary};
299
- }
300
-
301
- &:disabled {
302
- opacity: 0.5;
303
- cursor: not-allowed;
304
- }
305
- `,it=dt$1.div`
306
- font-size: 12px;
307
- color: ${m=>m.$theme.colors.disabledText};
308
- min-width: 40px;
309
- text-align: center;
310
- `,ct={colors:{primary:"#007bff",secondary:"#6c757d",success:"#008000",warning:"#FFA500",error:"#FF0000",info:"#0000FF",background:"#f8f9fa",text:"#343a40",border:"#dee2e6",disabled:"#808080",disabledBackground:"#F5F5F5",disabledText:"#808080"},space:{sidebar:"12px",size:"12px",radius:"4px",padding:"8px 12px",margin:"4px",shadow:"0 2px 4px rgba(0,0,0,0.1)",lineHeight:"1.5"}};React__default.memo(({fileName:m="\u672A\u77E5\u6587\u4EF6",currentPage:a=1,totalPage:A=0,tools:f={annotation:!0,download:!0,zoom:!0,close:!0,navigation:!0,rotate:!0},styles:_,onPrevPage:V,onNextPage:q,onZoomIn:Y,onZoomOut:M,onAnnotationToggle:b,onDownload:w,onRotateLeft:P,onRotateRight:S,onClose:F,scale:l=1,isAnnotating:t=!1,className:r})=>{const o=(_==null?void 0:_.theme)||ct;return console.log("Header\u7EC4\u4EF6\u6E32\u67D3 - currentPage:",a,"totalPage:",A),React__default.createElement(ut,{$theme:o,className:r},React__default.createElement(rt,{$theme:o},React__default.createElement(lt,{$theme:o},m)),React__default.createElement(st,{$theme:o},f.navigation&&React__default.createElement(React__default.Fragment,null,React__default.createElement(ne,{$theme:o,onClick:V,disabled:a<=1,title:"\u4E0A\u4E00\u9875"},React__default.createElement(Ge,{size:16})),A>0&&React__default.createElement(at,{$theme:o},a," / ",A),React__default.createElement(ne,{$theme:o,onClick:q,disabled:!A||a>=A,title:"\u4E0B\u4E00\u9875"},React__default.createElement(Ve,{size:16}))),f.zoom&&React__default.createElement(React__default.Fragment,null,React__default.createElement(ne,{$theme:o,onClick:M,disabled:l<=.3,title:"\u7F29\u5C0F"},React__default.createElement(nt,{size:16})),React__default.createElement(it,{$theme:o},Math.round(l*100),"%"),React__default.createElement(ne,{$theme:o,onClick:Y,disabled:l>=3,title:"\u653E\u5927"},React__default.createElement(ot,{size:16}))),f.annotation&&React__default.createElement(ne,{$theme:o,$active:t,onClick:b,title:t?"\u9000\u51FA\u6807\u6CE8":"\u5F00\u59CB\u6807\u6CE8"},React__default.createElement(Ke,{size:16})),f.download&&React__default.createElement(ne,{$theme:o,onClick:w,title:"\u4E0B\u8F7D"},React__default.createElement(Je,{size:16})),f.rotate&&React__default.createElement(React__default.Fragment,null,React__default.createElement(ne,{$theme:o,onClick:P,title:"\u5411\u5DE6\u65CB\u8F6C"},React__default.createElement(Qe,{size:16})),React__default.createElement(ne,{$theme:o,onClick:S,title:"\u5411\u53F3\u65CB\u8F6C"},React__default.createElement(et,{size:16}))),f.close&&React__default.createElement(ne,{$theme:o,onClick:F,title:"\u5173\u95ED"},React__default.createElement(tt,{size:16}))))});const dt=()=>{if(vt()){console.log("PDF Worker \u5DF2\u7ECF\u6CE8\u518C");return}const m=`PDF Worker \u672A\u6CE8\u518C\u3002\u8BF7\u5728\u5E94\u7528\u5165\u53E3\u5904\u8C03\u7528 registerPDFWorker() \u6CE8\u518C Worker\u3002
311
- \u793A\u4F8B\uFF1Aimport { registerPDFWorker } from "@mxmweb/fviewer";
312
- registerPDFWorker("/worker/pdf.worker.min.js");
313
- \u6CE8\u610F\uFF1AWorker \u6587\u4EF6\u8DEF\u5F84\u9700\u8981\u6839\u636E\u5B9E\u9645\u90E8\u7F72\u60C5\u51B5\u8C03\u6574\u3002`;throw console.error(m),new Error(m)},xe=(m,a,A)=>{if(!m&&!a)return"unknown";const f=m||"",_=a||"";return f.toLowerCase().endsWith(".pdf")||_==="pdf"?"pdf":f.toLowerCase().match(/\.(jpg|jpeg|png|gif|bmp|webp)$/)||_==="image"?"image":f.toLowerCase().endsWith(".md")||_==="markdown"?_==="markdown_table"?"markdown_table":"markdown":f.toLowerCase().match(/\.(html|htm)$/)||_==="html"?"html":f.toLowerCase().match(/\.(txt|log|json|xml|css|js|ts)$/)||_==="text"?"text":"unknown"},mt=async(m,a={})=>{console.log("=== parsePdfFile \u5F00\u59CB ==="),console.log("\u8F93\u5165\u6570\u636E:",{data:typeof m,options:a});try{dt();let A;if(typeof m=="string"){console.log("\u4ECEURL\u52A0\u8F7DPDF:",m);const V=pdfExports.getDocument({url:m,httpHeaders:a.token?{Authorization:a.token}:void 0});console.log("=== PDF\u52A0\u8F7D\u4EFB\u52A1\u8BE6\u7EC6\u4FE1\u606F ==="),console.log("\u52A0\u8F7D\u4EFB\u52A1\u5BF9\u8C61:",V),console.log("\u52A0\u8F7D\u4EFB\u52A1\u7C7B\u578B:",typeof V),console.log("\u52A0\u8F7D\u4EFB\u52A1\u65B9\u6CD5:",Object.getOwnPropertyNames(Object.getPrototypeOf(V))),console.log("\u52A0\u8F7D\u4EFB\u52A1\u5C5E\u6027:",Object.keys(V)),A=await V.promise,console.log("=== PDF\u6587\u6863\u52A0\u8F7D\u5B8C\u6210 ==="),console.log("PDF\u6587\u6863\u5BF9\u8C61:",A),console.log("PDF\u6587\u6863\u7C7B\u578B:",typeof A),console.log("PDF\u6587\u6863\u65B9\u6CD5:",Object.getOwnPropertyNames(Object.getPrototypeOf(A))),console.log("PDF\u6587\u6863\u5C5E\u6027:",Object.keys(A))}else{console.log("\u4ECEArrayBuffer\u52A0\u8F7DPDF");const V=pdfExports.getDocument({data:m});console.log("=== PDF\u52A0\u8F7D\u4EFB\u52A1\u8BE6\u7EC6\u4FE1\u606F ==="),console.log("\u52A0\u8F7D\u4EFB\u52A1\u5BF9\u8C61:",V),console.log("\u52A0\u8F7D\u4EFB\u52A1\u7C7B\u578B:",typeof V),A=await V.promise,console.log("=== PDF\u6587\u6863\u52A0\u8F7D\u5B8C\u6210 ==="),console.log("PDF\u6587\u6863\u5BF9\u8C61:",A),console.log("PDF\u6587\u6863\u7C7B\u578B:",typeof A)}const f=A.numPages;console.log("PDF\u52A0\u8F7D\u6210\u529F\uFF0C\u603B\u9875\u6570:",f),console.log("PDF\u6307\u7EB9:",A.fingerprints),console.log("PDF\u4F20\u8F93\u5BF9\u8C61:",A._transport);const _={type:"pdf",content:{type:"pdf",document:A,totalPages:f},fileName:a.fileName,fileType:"pdf",totalPages:f};return console.log("=== \u89E3\u6790\u7ED3\u679C\u8BE6\u7EC6\u4FE1\u606F ==="),console.log("\u89E3\u6790\u7ED3\u679C:",_),console.log("\u89E3\u6790\u7ED3\u679C\u7C7B\u578B:",typeof _),console.log("\u89E3\u6790\u7ED3\u679C\u5C5E\u6027:",Object.keys(_)),console.log("\u5185\u5BB9\u5BF9\u8C61:",_.content),console.log("\u6587\u6863\u5BF9\u8C61:",_.content.document),_}catch(A){console.error("PDF\u89E3\u6790\u5931\u8D25:",A),console.error("\u9519\u8BEF\u8BE6\u60C5:",{message:A instanceof Error?A.message:"\u672A\u77E5\u9519\u8BEF",stack:A instanceof Error?A.stack:void 0,name:A instanceof Error?A.name:void 0,url:typeof m=="string"?m:"ArrayBuffer",options:a});let f="PDF\u89E3\u6790\u5931\u8D25";return A instanceof Error&&(A.message.includes("PDF Worker \u672A\u6CE8\u518C")||A.message.includes("Worker \u672A\u6CE8\u518C")?f=A.message:A.message.includes("Invalid PDF structure")?f="PDF\u6587\u4EF6\u7ED3\u6784\u65E0\u6548\uFF0C\u53EF\u80FD\u6587\u4EF6\u635F\u574F\u6216\u4E0D\u662F\u6709\u6548\u7684PDF\u6587\u4EF6":A.message.includes("Failed to fetch")?f="PDF\u6587\u4EF6\u4E0B\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u8FDE\u63A5\u548C\u6587\u4EF6URL":A.message.includes("Worker")||A.message.includes("worker")?f="PDF\u89E3\u6790\u5668\u521D\u59CB\u5316\u5931\u8D25\u3002\u8BF7\u786E\u4FDD\u5728\u5E94\u7528\u5165\u53E3\u5904\u8C03\u7528 registerPDFWorker() \u6CE8\u518C Worker \u6587\u4EF6\u3002":f=`PDF\u89E3\u6790\u5931\u8D25: ${A.message}`),{type:"pdf",content:null,fileName:a.fileName,fileType:"pdf",error:f}}},gt=async(m,a={})=>{console.log("=== parseImageFile \u5F00\u59CB ==="),console.log("\u8F93\u5165\u6570\u636E:",{data:typeof m,options:a});try{let A;if(typeof m=="string")console.log("\u4ECEURL\u52A0\u8F7D\u56FE\u7247:",m),A=m;else{console.log("\u4ECEArrayBuffer\u52A0\u8F7D\u56FE\u7247");const _=new Blob([m]);A=URL.createObjectURL(_)}console.log("\u5F00\u59CB\u9884\u52A0\u8F7D\u56FE\u7247:",A),await new Promise((_,V)=>{const q=new Image;q.onload=()=>{console.log("\u56FE\u7247\u9884\u52A0\u8F7D\u6210\u529F:",A),console.log("\u56FE\u7247\u5C3A\u5BF8:",q.width,"x",q.height),_()},q.onerror=()=>{console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:",A),V(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"))};const Y=setTimeout(()=>{V(new Error("\u56FE\u7247\u52A0\u8F7D\u8D85\u65F6"))},1e4);q.onload=()=>{clearTimeout(Y),console.log("\u56FE\u7247\u9884\u52A0\u8F7D\u6210\u529F:",A),console.log("\u56FE\u7247\u5C3A\u5BF8:",q.width,"x",q.height),_()},q.onerror=()=>{clearTimeout(Y),console.error("\u56FE\u7247\u9884\u52A0\u8F7D\u5931\u8D25:",A),V(new Error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"))},q.src=A});const f={type:"image",content:{type:"image",url:A},fileName:a.fileName,fileType:"image"};return console.log("=== parseImageFile \u7ED3\u679C ==="),console.log("result:",f),f}catch(A){return console.error("\u56FE\u7247\u89E3\u6790\u5931\u8D25:",A),{type:"image",content:null,fileName:a.fileName,fileType:"image",error:`\u56FE\u7247\u89E3\u6790\u5931\u8D25: ${A instanceof Error?A.message:"\u672A\u77E5\u9519\u8BEF"}`}}},ft=async(m,a={})=>{try{let A;if(typeof m=="string"){const f=await fetch(m,{headers:a.token?{Authorization:a.token}:void 0});if(!f.ok)throw new Error(`HTTP ${f.status}: ${f.statusText}`);A=await f.text()}else A=new TextDecoder("utf-8").decode(m);return{type:"text",content:{type:"text",text:A},fileName:a.fileName,fileType:"text"}}catch(A){return{type:"text",content:null,fileName:a.fileName,fileType:"text",error:`\u6587\u672C\u89E3\u6790\u5931\u8D25: ${A instanceof Error?A.message:"\u672A\u77E5\u9519\u8BEF"}`}}},Et=async(m,a={})=>{try{let A;if(typeof m=="string"){const f=await fetch(m,{headers:a.token?{Authorization:a.token}:void 0});if(!f.ok)throw new Error(`HTTP ${f.status}: ${f.statusText}`);A=await f.text()}else A=new TextDecoder("utf-8").decode(m);return{type:"markdown",content:{type:"markdown",text:A},fileName:a.fileName,fileType:"markdown"}}catch(A){return{type:"markdown",content:null,fileName:a.fileName,fileType:"markdown",error:`Markdown\u89E3\u6790\u5931\u8D25: ${A instanceof Error?A.message:"\u672A\u77E5\u9519\u8BEF"}`}}},ht=async(m,a={})=>{console.log("=== parseHtmlFile \u5F00\u59CB ==="),console.log("\u8F93\u5165\u6570\u636E:",{data:typeof m,options:a});try{let A;if(typeof m=="string"){console.log("\u4ECEURL\u52A0\u8F7DHTML:",m);const _=await fetch(m,{headers:a.token?{Authorization:a.token}:void 0});if(console.log("HTTP\u54CD\u5E94\u72B6\u6001:",_.status,_.statusText),!_.ok)throw new Error(`HTTP ${_.status}: ${_.statusText}`);A=await _.text(),console.log("HTML\u5185\u5BB9\u957F\u5EA6:",A.length),console.log("HTML\u5185\u5BB9\u524D500\u5B57\u7B26:",A.substring(0,500))}else console.log("\u4ECEArrayBuffer\u52A0\u8F7DHTML"),A=new TextDecoder("utf-8").decode(m);const f={type:"html",content:{type:"html",text:A},fileName:a.fileName,fileType:"html"};return console.log("=== parseHtmlFile \u7ED3\u679C ==="),console.log("result:",f),console.log("result.content.text \u957F\u5EA6:",f.content.text.length),console.log("result.content.text \u524D200\u5B57\u7B26:",f.content.text.substring(0,200)),f}catch(A){return console.error("HTML\u89E3\u6790\u5931\u8D25:",A),{type:"html",content:null,fileName:a.fileName,fileType:"html",error:`HTML\u89E3\u6790\u5931\u8D25: ${A instanceof Error?A.message:"\u672A\u77E5\u9519\u8BEF"}`}}},Ft=async(m,a={})=>{switch(xe(a.fileName,a.fileType)){case"pdf":return await mt(m,a);case"image":return await gt(m,a);case"text":return await ft(m,a);case"markdown":case"markdown_table":return await Et(m,a);case"html":return await ht(m,a);default:return{type:"unknown",content:null,fileName:a.fileName,fileType:a.fileType,error:"\u4E0D\u652F\u6301\u7684\u6587\u4EF6\u7C7B\u578B"}}};dt$1.div`
314
- display: flex;
315
- flex-direction: column;
316
- height: 100%;
317
- width: 100%;
318
- background: ${m=>m.$theme.colors.background};
319
- border: 1px solid ${m=>m.$theme.colors.border};
320
- border-radius: ${m=>m.$theme.space.radius};
321
- overflow: hidden;
322
- min-height: 0; /* 确保flex子元素可以收缩 */
323
- `;dt$1.div`
324
- display: flex;
325
- align-items: center;
326
- justify-content: center;
327
- height: 100%;
328
- color: ${m=>m.$theme.colors.disabledText};
329
- font-size: 14px;
330
- `;dt$1.div`
331
- display: flex;
332
- flex-direction: column;
333
- align-items: center;
334
- justify-content: center;
335
- height: 100%;
336
- color: ${m=>m.$theme.colors.error};
337
- text-align: center;
338
- padding: 20px;
339
- `;const vt=()=>!!pdfExports.GlobalWorkerOptions.workerSrc,Bt=(m="/worker/pdf.worker.min.js")=>{try{if(pdfExports.GlobalWorkerOptions.workerSrc){console.log("PDF Worker \u5DF2\u7ECF\u6CE8\u518C:",pdfExports.GlobalWorkerOptions.workerSrc);return}pdfExports.GlobalWorkerOptions.workerSrc=m,console.log("PDF Worker \u6CE8\u518C\u6210\u529F:",m)}catch(a){console.error("PDF Worker \u6CE8\u518C\u5931\u8D25:",a)}},HeaderContainer=dt$1.div`
340
- display: flex;
341
- align-items: center;
342
- padding: 0px 12px;
343
- justify-content: space-between;
344
- padding: ${m=>m.$theme.space.padding};
345
- border-bottom: 1px solid ${m=>m.$theme.colors.border};
346
- background: ${m=>m.$theme.colors.background};
347
- min-height: 52px;
348
- `,FileInfo=dt$1.div`
349
- display: flex;
350
- align-items: center;
351
- gap: 8px;
352
- flex: 1;
353
- min-width: 0;
354
- `,FileName=dt$1.div`
355
- font-size: 14px;
356
- font-weight: 500;
357
- color: ${m=>m.$theme.colors.text};
358
- white-space: nowrap;
359
- overflow: hidden;
360
- text-overflow: ellipsis;
361
- `,PageInfo=dt$1.div`
362
- font-size: 12px;
363
- color: ${m=>m.$theme.colors.disabledText};
364
- white-space: nowrap;
365
- `,ToolBar=dt$1.div`
366
- display: flex;
367
- align-items: center;
368
- gap: 4px;
369
- `,ToolButton=dt$1.button`
370
- display: flex;
371
- align-items: center;
372
- justify-content: center;
373
- width: 32px;
374
- height: 32px;
375
- border: none;
376
- border-radius: ${m=>m.$theme.space.radius};
377
- background: ${m=>m.$active?m.$theme.colors.primary+"20":"transparent"};
378
- color: ${m=>m.$active?m.$theme.colors.primary:m.$theme.colors.text};
379
- cursor: pointer;
380
- transition: all 0.2s ease;
381
-
382
- &:hover {
383
- background: ${m=>m.$theme.colors.primary+"10"};
384
- color: ${m=>m.$theme.colors.primary};
385
- }
386
-
387
- &:disabled {
388
- opacity: 0.5;
389
- cursor: not-allowed;
390
- }
391
- `,ZoomInfo=dt$1.div`
392
- font-size: 12px;
393
- color: ${m=>m.$theme.colors.disabledText};
394
- min-width: 40px;
395
- text-align: center;
396
- `,defaultTheme$1={colors:{primary:"#007bff",secondary:"#6c757d",success:"#008000",warning:"#FFA500",error:"#FF0000",info:"#0000FF",background:"#f8f9fa",text:"#343a40",border:"#dee2e6",disabled:"#808080",disabledBackground:"#F5F5F5",disabledText:"#808080"},space:{sidebar:"md",size:"md",radius:"md",padding:"md",margin:"md",shadow:"md",lineHeight:"md"}},Header=React__default.memo(({fileName:m="\u672A\u77E5\u6587\u4EF6",currentPage:a=1,totalPage:A=0,tools:f={annotation:!0,download:!0,zoom:!0,close:!0,navigation:!0,rotate:!0},styles:_,onPrevPage:V,onNextPage:q,onZoomIn:Y,onZoomOut:M,onAnnotationToggle:b,onDownload:w,onRotateLeft:P,onRotateRight:S,onClose:F,scale:l=1,isAnnotating:t=!1,className:r})=>{const o=(_==null?void 0:_.theme)||defaultTheme$1;return console.log("Header\u7EC4\u4EF6\u6E32\u67D3 - currentPage:",a,"totalPage:",A),jsxs(HeaderContainer,{$theme:o,className:r,children:[jsx(FileInfo,{$theme:o,children:jsx(FileName,{$theme:o,children:m})}),jsxs(ToolBar,{$theme:o,children:[f.navigation&&jsxs(Fragment,{children:[jsx(ToolButton,{$theme:o,onClick:V,disabled:a<=1,title:"\u4E0A\u4E00\u9875",children:jsx(ChevronLeft,{size:16})}),A>0&&jsxs(PageInfo,{$theme:o,children:[a," / ",A]}),jsx(ToolButton,{$theme:o,onClick:q,disabled:!A||a>=A,title:"\u4E0B\u4E00\u9875",children:jsx(ChevronRight,{size:16})})]}),f.zoom&&jsxs(Fragment,{children:[jsx(ToolButton,{$theme:o,onClick:M,disabled:l<=.3,title:"\u7F29\u5C0F",children:jsx(ZoomOut,{size:16})}),jsxs(ZoomInfo,{$theme:o,children:[Math.round(l*100),"%"]}),jsx(ToolButton,{$theme:o,onClick:Y,disabled:l>=3,title:"\u653E\u5927",children:jsx(ZoomIn,{size:16})})]}),f.annotation&&jsx(ToolButton,{$theme:o,$active:t,onClick:b,title:t?"\u9000\u51FA\u6807\u6CE8":"\u5F00\u59CB\u6807\u6CE8",children:jsx(Pencil,{size:16})}),f.download&&jsx(ToolButton,{$theme:o,onClick:w,title:"\u4E0B\u8F7D",children:jsx(Download,{size:16})}),f.rotate&&jsxs(Fragment,{children:[jsx(ToolButton,{$theme:o,onClick:P,title:"\u5411\u5DE6\u65CB\u8F6C",children:jsx(RotateCcw,{size:16})}),jsx(ToolButton,{$theme:o,onClick:S,title:"\u5411\u53F3\u65CB\u8F6C",children:jsx(RotateCw,{size:16})})]}),f.close&&jsx(ToolButton,{$theme:o,onClick:F,title:"\u5173\u95ED",children:jsx(X,{size:16})})]})]})}),ReaderContainer=dt$1.div`
397
- display: flex;
398
- flex-direction: column;
399
- height: 100%;
400
- width: 100%;
401
- background: ${m=>m.$theme.colors.background};
402
- border: 1px solid ${m=>m.$theme.colors.border};
403
- border-radius: ${m=>m.$theme.space.radius};
404
- overflow: hidden;
405
- min-height: 0;
406
- position: relative; // 添加相对定位,用于loading遮罩的绝对定位
407
-
408
- /* 添加动画样式 */
409
- @keyframes spin {
410
- 0% {
411
- transform: rotate(0deg);
412
- }
413
- 100% {
414
- transform: rotate(360deg);
415
- }
416
- }
417
- `,DefaultLoadingComponent=({status:m,theme:a})=>jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%",padding:"40px",background:a.colors.background},children:[jsxs("div",{style:{position:"relative",width:"80px",height:"80px",marginBottom:"24px"},children:[jsx("div",{style:{width:"60px",height:"80px",background:a.colors.primary,borderRadius:"8px 8px 0 0",position:"relative",margin:"0 auto"},children:jsx("div",{style:{position:"absolute",top:"0",right:"0",width:"0",height:"0",borderStyle:"solid",borderWidth:"0 20px 20px 0",borderColor:`transparent ${a.colors.background} transparent transparent`}})}),jsx("div",{style:{position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"20px",height:"20px",borderRadius:"50%",background:a.colors.background,animation:"pulse 1.5s ease-in-out infinite"}})]}),jsx("div",{style:{fontSize:"16px",fontWeight:"500",color:a.colors.text,marginBottom:"8px",textAlign:"center"},children:m}),jsx("div",{style:{width:"200px",height:"4px",background:a.colors.border,borderRadius:"2px",overflow:"hidden",position:"relative"},children:jsx("div",{style:{width:"30%",height:"100%",background:a.colors.primary,borderRadius:"2px",animation:"loading-progress 2s ease-in-out infinite"}})}),jsx("style",{children:`
418
- @keyframes pulse {
419
- 0%, 100% {
420
- opacity: 1;
421
- transform: translate(-50%, -50%) scale(1);
422
- }
423
- 50% {
424
- opacity: 0.5;
425
- transform: translate(-50%, -50%) scale(1.1);
426
- }
427
- }
428
-
429
- @keyframes loading-progress {
430
- 0% {
431
- transform: translateX(-100%);
432
- }
433
- 50% {
434
- transform: translateX(0%);
435
- }
436
- 100% {
437
- transform: translateX(100%);
438
- }
439
- }
440
- `})]}),ErrorContainer=dt$1.div`
441
- display: flex;
442
- flex-direction: column;
443
- align-items: center;
444
- justify-content: center;
445
- height: 100%;
446
- color: ${m=>m.$theme.colors.error};
447
- text-align: center;
448
- padding: 20px;
449
- `,DEFAULT_STREAM_API_URL="http://10.15.12.13:9005/proxy/index/knowledgeBase/file/stream",CACHE_EXPIRY_TIME=300*1e3,defaultTheme={colors:{primary:"#007bff",secondary:"#6c757d",success:"#008000",warning:"#FFA500",error:"#FF0000",info:"#0000FF",background:"#f8f9fa",text:"#343a40",border:"#dee2e6",disabled:"#808080",disabledBackground:"#F5F5F5",disabledText:"#808080"},space:{sidebar:"12px",size:"12px",radius:"4px",padding:"8px 12px",margin:"4px",shadow:"0 2px 4px rgba(0,0,0,0.1)",lineHeight:"1.5"}},GientechStreamReader=({convertedFilePath:m,fileName:a,fileType:A,csrfToken:f,initialPage:_=1,initialZoom:V=1,totalPages:q,annotations:Y=[],pageSize:M=5,streamApiUrl:b=DEFAULT_STREAM_API_URL,authorization:w,eventsEmit:P=()=>{},tools:S,styles:F,customComponents:l,className:t,headerClass:r,contentClass:o})=>{const[v,g]=useState(!0),[u,n]=useState("\u6B63\u5728\u52A0\u8F7D\u6587\u6863..."),[i,e]=useState(null),[E,x]=useState(_),[j,I]=useState(q||0),[yt,wt]=useState(V),[bt,K]=useState(0),[B,U]=useState(null),[G,Q]=useState(null),[xt,Rt]=useState(""),[H,h]=useState(null),[c,T]=useState(null),[O,$]=useState({}),W=useRef(!1),s=useRef(!1),d=useRef({}),C=useRef({}),y=useRef(null),k=useRef(null),N=useRef(_),D=useRef(0);D.current+=1,console.log("[GientechStreamReader] render count:",D.current),console.log("[GientechStreamReader] props snapshot (early):",{fileType:A,currentPage:E,totalPages:j,hasMarkdown:!!xt,hasImage:!!G,hasText:!!H,hasHtml:!!c,isLoading:v,error:i});const p=(F==null?void 0:F.theme)||defaultTheme;useEffect(()=>{W.current=!1,s.current=!1},[A,m]);const _t=useCallback(()=>{const Ct={annotation:!0,download:!0,zoom:!0,close:!0,navigation:!0,rotate:!1};let Tt;switch(A){case"pdf":case"pdf_slides":Tt={...Ct,annotation:!1,download:!1,navigation:!0,rotate:!1};break;case"image":Tt={...Ct,annotation:!1,download:!1,navigation:!1,rotate:!0,zoom:!0};break;case"markdown":case"markdown_table":Tt={...Ct,annotation:!1,download:!1,navigation:!1,rotate:!1,zoom:!1};break;case"text":case"html":case"unknown":Tt={...Ct,annotation:!1,download:!1,navigation:!1,rotate:!1,zoom:!1};break;default:Tt=Ct}return S?{...Tt,...S}:Tt},[A,S])(),z=useCallback((Ct,Tt)=>{const $t=Math.floor((Ct-1)/Tt)*Tt+1;return`${$t}-${$t+Tt-1}`},[]),Z=useCallback(async Ct=>{var Qt;if(!(A==="pdf"||A==="pdf_slides"))return console.log(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u662FPDF\uFF0C\u8DF3\u8FC7\u7F13\u5B58\u68C0\u67E5`),null;console.log(`\u68C0\u67E5\u9875\u9762 ${Ct} \u662F\u5426\u5728\u7F13\u5B58\u4E2D`);const $t=d.current[Ct];if($t&&Date.now()-$t.timestamp<CACHE_EXPIRY_TIME)return console.log(`\u4F7F\u7528\u5355\u4E2A\u9875\u9762\u7F13\u5B58: ${Ct}`),$t.pdfDocument?(console.log(`\u76F4\u63A5\u8FD4\u56DE\u7F13\u5B58\u7684PDF\u6587\u6863: ${Ct}`),$t.pdfDocument):null;const jt=z(Ct,M),Wt=C.current[jt];if(console.log(`\u68C0\u67E5chunk\u7F13\u5B58: ${jt}, \u5B58\u5728: ${!!Wt}, \u5305\u542B\u9875\u9762: ${((Qt=Wt==null?void 0:Wt.pages)==null?void 0:Qt.join(", "))||"\u65E0"}`),Wt&&Date.now()-Wt.timestamp<CACHE_EXPIRY_TIME){if(Wt.pages.includes(Ct))return console.log(`\u4F7F\u7528chunk\u7F13\u5B58: ${Ct} (chunk: ${jt})`),Wt.pdfDocument?(console.log(`\u76F4\u63A5\u8FD4\u56DE\u7F13\u5B58\u7684PDF\u6587\u6863: ${Ct}`),Wt.pdfDocument):null;console.log(`\u9875\u9762 ${Ct} \u4E0D\u5728chunk ${jt} \u4E2D\uFF0Cchunk\u5305\u542B: ${Wt.pages.join(", ")}`)}return console.log(`\u9875\u9762 ${Ct} \u4E0D\u5728\u4EFB\u4F55\u7F13\u5B58\u4E2D\uFF0C\u9700\u8981\u91CD\u65B0\u8BF7\u6C42`),null},[M,z,A]),At=useCallback(async Ct=>{var Tt;try{if(!(A==="pdf"||A==="pdf_slides"))throw console.log(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u9700\u8981\u5206\u9875\u53C2\u6570\uFF0C\u83B7\u53D6\u5B8C\u6574\u5185\u5BB9`),new Error(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u652F\u6301\u5206\u9875\u52A0\u8F7D`);const jt=Math.floor((Ct-1)/M)*M+1,Wt=z(Ct,M);console.log(`\u8BF7\u6C42PDF chunk\u6570\u636E: ${jt} (\u5305\u542B\u9875\u9762 ${jt}-${jt+M-1})`);const Qt={"Content-Type":"application/json"};w&&(Qt.Authorization=w),f&&(Qt["X-CSRF-TOKEN-IN"]=f);const se={convertedFilePath:m,pageNo:jt,pageSize:M},Kt=await axios.post(b,se,{headers:Qt,responseType:"arraybuffer"}),ae=Kt.headers["x-csrf-token-out"]||Kt.headers["X-CSRF-TOKEN-OUT"];ae&&(console.log("\u83B7\u53D6\u5230\u54CD\u5E94\u5934\u4E2D\u7684CSRF Token:",ae),P("request_finish",ae));const te=Array.from({length:M},(ge,he)=>jt+he);return C.current[Wt]={data:Kt.data,pages:te,timestamp:Date.now(),totalPages:q},console.log(`\u7F13\u5B58PDF chunk\u6570\u636E: ${Wt}, \u5305\u542B\u9875\u9762: ${te.join(", ")}, \u8BF7\u6C42\u7684\u9875\u9762: ${Ct}`),console.log("\u5F53\u524D\u6240\u6709\u7F13\u5B58:",Object.keys(C.current)),Kt.data}catch($t){throw console.error("\u83B7\u53D6PDF stream\u6570\u636E\u5931\u8D25:",$t),new Error(`PDF\u8BF7\u6C42\u5931\u8D25: ${((Tt=$t.response)==null?void 0:Tt.status)||"\u7F51\u7EDC\u9519\u8BEF"}`)}},[b,m,M,w,z,q,j,A,P]),kt=useCallback(async(Ct,Tt=!1)=>{var jt;if(!Ct)return;if(!(A==="pdf"||A==="pdf_slides"))return console.log(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u662FPDF\uFF0C\u8DF3\u8FC7PDF\u52A0\u8F7D\u903B\u8F91`),null;try{Tt?(g(!0),n("\u6B63\u5728\u52A0\u8F7DPDF\u6587\u6863...")):(g(!0),n(`\u6B63\u5728\u52A0\u8F7D\u7B2C ${Ct} \u9875...`)),e(null),console.log(`\u5F00\u59CB\u52A0\u8F7DPDF\u9875\u9762: ${Ct}, \u521D\u59CB\u52A0\u8F7D: ${Tt}`);const Wt=await Z(Ct);if(Wt)return console.log(`\u4F7F\u7528\u7F13\u5B58\u7684PDF\u6587\u6863: ${Ct}`),U(Wt),g(!1),n(""),console.log(`\u9875\u9762 ${Ct} \u52A0\u8F7D\u5B8C\u6210\uFF08\u4F7F\u7528\u7F13\u5B58\uFF09`),Wt;const Qt=await At(Ct),se=await Ft(Qt,{fileName:a||"Stream\u6587\u6863",fileType:"pdf",token:w});if(se.error)throw new Error(se.error);if(se.type!=="pdf"||!((jt=se.content)!=null&&jt.document))throw new Error("\u89E3\u6790\u7ED3\u679C\u4E0D\u662F\u6709\u6548\u7684PDF\u6587\u6863");const Kt=se.content.document;console.log("\u8BBE\u7F6EPDF\u6587\u6863:",Kt),console.log("PDF\u6587\u6863\u7C7B\u578B:",typeof Kt),console.log("PDF\u6587\u6863\u65B9\u6CD5:",Kt?Object.getOwnPropertyNames(Object.getPrototypeOf(Kt)):"\u65E0\u6587\u6863"),console.log("PDF\u6587\u6863\u9875\u6570:",Kt?Kt.numPages:"\u65E0\u9875\u6570"),console.log("\u5F53\u524D\u8BF7\u6C42\u7684\u9875\u9762:",Ct),console.log("PDF\u6587\u6863\u5305\u542B\u7684\u9875\u9762\u8303\u56F4:",Kt?`1-${Kt.numPages}`:"\u65E0\u9875\u6570"),U(Kt);const ae=z(Ct,M);if(C.current[ae]&&(C.current[ae].pdfDocument=Kt,console.log(`\u7F13\u5B58PDF\u6587\u6863\u5230chunk: ${ae}`)),q)console.log(`\u4F7F\u7528\u7528\u6237\u4F20\u5165\u7684\u603B\u9875\u6570: ${q}`),I(q);else if(Kt&&Kt.numPages){const te=Kt.numPages;console.log(`\u7528\u6237\u672A\u4F20\u5165\u603B\u9875\u6570\uFF0C\u4ECEPDF\u6587\u6863\u83B7\u53D6\u5B9E\u9645\u603B\u9875\u6570: ${te}`),I(te)}return g(!1),n(""),console.log(`\u9875\u9762 ${Ct} \u52A0\u8F7D\u5B8C\u6210`),Kt}catch(Wt){throw console.error("PDF\u52A0\u8F7D\u5931\u8D25:",Wt),e(Wt.message||"PDF\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),g(!1),n(""),Wt}},[At,a,w,j,Z,z,M,A]),Mt=useCallback(Ct=>{if(!(A==="pdf"||A==="pdf_slides"))return!1;const $t=d.current[Ct];if($t&&Date.now()-$t.timestamp<CACHE_EXPIRY_TIME)return!!$t.pdfDocument;const jt=z(Ct,M),Wt=C.current[jt];return Wt&&Date.now()-Wt.timestamp<CACHE_EXPIRY_TIME?Wt.pages.includes(Ct)&&!!Wt.pdfDocument:!1},[M,z,A]),St=useCallback(()=>{console.log("\u68C0\u67E5markdown\u5185\u5BB9\u662F\u5426\u5728\u7F13\u5B58\u4E2D");const Ct=y.current;return Ct&&Date.now()-Ct.timestamp<CACHE_EXPIRY_TIME?(console.log("\u4F7F\u7528markdown\u5185\u5BB9\u7F13\u5B58"),Ct.data):(console.log("markdown\u5185\u5BB9\u4E0D\u5728\u7F13\u5B58\u4E2D\uFF0C\u9700\u8981\u91CD\u65B0\u8BF7\u6C42"),null)},[]),Ht=useCallback(async()=>{var Ct;try{console.log("\u8BF7\u6C42\u5B8C\u6574markdown\u6570\u636E");const Tt={"Content-Type":"application/json"};w&&(Tt.Authorization=w),f&&(Tt["X-CSRF-TOKEN-IN"]=f);const $t={convertedFilePath:m};console.log("\u53D1\u9001markdown\u8BF7\u6C42:",$t);const jt=await axios.post(b,$t,{headers:Tt,responseType:"text"}),Wt=jt.headers["x-csrf-token-out"]||jt.headers["X-CSRF-TOKEN-OUT"];return Wt&&(console.log("\u83B7\u53D6\u5230\u54CD\u5E94\u5934\u4E2D\u7684CSRF Token:",Wt),P("request_finish",Wt)),console.log("markdown\u54CD\u5E94\u72B6\u6001:",jt.status),console.log("markdown\u54CD\u5E94\u6570\u636E\u957F\u5EA6:",((Ct=jt.data)==null?void 0:Ct.length)||0),jt.data}catch(Tt){throw console.error("\u83B7\u53D6markdown\u6570\u636E\u5931\u8D25:",Tt),new Error(`\u83B7\u53D6markdown\u6570\u636E\u5931\u8D25: ${Tt.message}`)}},[m,w,b,P]),Ut=useCallback(async()=>{try{g(!0),n("\u6B63\u5728\u52A0\u8F7Dmarkdown\u6587\u6863..."),e(null),console.log("\u5F00\u59CB\u52A0\u8F7D\u5B8C\u6574markdown\u6587\u6863");const Ct=St();if(Ct)return console.log("\u4F7F\u7528\u7F13\u5B58\u7684markdown\u5185\u5BB9"),Rt(Ct),g(!1),n(""),Ct;const Tt=await Ht();return y.current={data:Tt,timestamp:Date.now()},Rt(Tt),g(!1),n(""),console.log("\u5B8C\u6574markdown\u6587\u6863\u52A0\u8F7D\u5B8C\u6210"),Tt}catch(Ct){throw console.error("markdown\u52A0\u8F7D\u5931\u8D25:",Ct),e(Ct.message||"markdown\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),g(!1),n(""),Ct}},[Ht,St]),Nt=useCallback(async()=>{try{const Ct={"Content-Type":"application/json"};w&&(Ct.Authorization=w),f&&(Ct["X-CSRF-TOKEN-IN"]=f);const Tt={convertedFilePath:m},$t=await axios.post(b,Tt,{headers:Ct,responseType:"arraybuffer"}),jt=$t.headers["x-csrf-token-out"]||$t.headers["X-CSRF-TOKEN-OUT"];return jt&&(console.log("\u83B7\u53D6\u5230\u54CD\u5E94\u5934\u4E2D\u7684CSRF Token:",jt),P("request_finish",jt)),$t.data}catch(Ct){throw console.error("\u83B7\u53D6\u56FE\u7247\u6570\u636E\u5931\u8D25:",Ct),new Error(`\u83B7\u53D6\u56FE\u7247\u6570\u636E\u5931\u8D25: ${Ct.message}`)}},[m,w,b,P]),zt=useCallback(async()=>{try{g(!0),n("\u6B63\u5728\u52A0\u8F7D\u56FE\u7247..."),e(null);const Ct=await Nt(),Tt=await Ft(Ct,{fileName:a||"\u56FE\u7247",fileType:"image",token:w});if(Tt.error)throw new Error(Tt.error);if(Tt.type!=="image"||!Tt.content)throw new Error("\u89E3\u6790\u7ED3\u679C\u4E0D\u662F\u6709\u6548\u7684\u56FE\u7247");return Q(Tt.content),g(!1),n(""),Tt.content}catch(Ct){throw console.error("\u56FE\u7247\u52A0\u8F7D\u5931\u8D25:",Ct),e(Ct.message||"\u56FE\u7247\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),g(!1),n(""),Ct}},[w,a,Nt]),Gt=useCallback(async()=>{var Ct;try{console.log(`\u8BF7\u6C42\u901A\u7528\u6587\u4EF6\u6570\u636E\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}`);const Tt={"Content-Type":"application/json"};w&&(Tt.Authorization=w),f&&(Tt["X-CSRF-TOKEN-IN"]=f);const $t={convertedFilePath:m};console.log("\u53D1\u9001\u901A\u7528\u6587\u4EF6\u8BF7\u6C42:",$t);const jt=await axios.post(b,$t,{headers:Tt,responseType:"arraybuffer"}),Wt=jt.headers["x-csrf-token-out"]||jt.headers["X-CSRF-TOKEN-OUT"];return Wt&&(console.log("\u83B7\u53D6\u5230\u54CD\u5E94\u5934\u4E2D\u7684CSRF Token:",Wt),P("request_finish",Wt)),console.log("\u901A\u7528\u6587\u4EF6\u54CD\u5E94\u72B6\u6001:",jt.status),console.log("\u901A\u7528\u6587\u4EF6\u54CD\u5E94\u6570\u636E\u957F\u5EA6:",((Ct=jt.data)==null?void 0:Ct.byteLength)||0),jt.data}catch(Tt){throw console.error("\u83B7\u53D6\u901A\u7528\u6587\u4EF6\u6570\u636E\u5931\u8D25:",Tt),new Error(`\u83B7\u53D6\u901A\u7528\u6587\u4EF6\u6570\u636E\u5931\u8D25: ${Tt.message}`)}},[m,w,b,P]),Zt=useCallback(async()=>{try{if(console.log("=== loadGenericDocument \u88AB\u8C03\u7528 ==="),console.log("\u8C03\u7528\u6808:",new Error().stack),console.log("\u5F53\u524D\u65F6\u95F4:",new Date().toISOString()),W.current){console.log(`\u901A\u7528\u6587\u6863\u6B63\u5728\u52A0\u8F7D\u4E2D\uFF0C\u5FFD\u7565\u91CD\u590D\u8BF7\u6C42\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}`);return}if(s.current){console.log(`\u901A\u7528\u6587\u6863\u5DF2\u7ECF\u52A0\u8F7D\u8FC7\uFF0C\u5FFD\u7565\u91CD\u590D\u8BF7\u6C42\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}`);return}const Ct=`${A}_${m}`,Tt=O[Ct];if(console.log(`\u68C0\u67E5\u901A\u7528\u6587\u6863\u7F13\u5B58\uFF0Ckey: ${Ct}, \u7F13\u5B58\u5B58\u5728: ${!!Tt}, \u7F13\u5B58\u65F6\u95F4: ${Tt?Date.now()-Tt.timestamp:"N/A"}ms`),Tt&&Date.now()-Tt.timestamp<CACHE_EXPIRY_TIME)return console.log(`\u4F7F\u7528\u7F13\u5B58\u7684\u901A\u7528\u6587\u6863\u5185\u5BB9\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}`),A==="text"&&Tt.content?h(Tt.content):A==="html"&&Tt.content&&T(Tt.content),x(1),I(q||1),g(!1),n(""),Tt.content;W.current=!0,g(!0),n(`\u6B63\u5728\u52A0\u8F7D${A}\u6587\u6863...`),e(null),console.log(`\u5F00\u59CB\u52A0\u8F7D\u901A\u7528\u6587\u6863\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}`);const $t=await Gt(),jt=await Ft($t,{fileName:a||`${A}\u6587\u6863`,fileType:A,token:w});if(jt.error)throw new Error(jt.error);let Wt=null;if(jt.type==="text"&&jt.content)h(jt.content),Wt=jt.content;else if(jt.type==="html"&&jt.content)T(jt.content),Wt=jt.content;else if(jt.type==="image"&&jt.content)Q(jt.content),Wt=jt.content;else{const se=new TextDecoder("utf-8").decode($t);h({type:"text",content:se}),Wt={type:"text",content:se}}if(Wt){const Qt=`${A}_${m}`,se={...O,[Qt]:{content:Wt,timestamp:Date.now()}};$(se),console.log(`\u901A\u7528\u6587\u6863\u5185\u5BB9\u5DF2\u7F13\u5B58\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}, \u7F13\u5B58\u952E: ${Qt}`),console.log("\u5F53\u524D\u7F13\u5B58\u72B6\u6001:",se)}return g(!1),n(""),W.current=!1,s.current=!0,console.log(`\u901A\u7528\u6587\u6863\u52A0\u8F7D\u5B8C\u6210\uFF0C\u6587\u4EF6\u7C7B\u578B: ${A}`),jt}catch(Ct){throw console.error("\u901A\u7528\u6587\u6863\u52A0\u8F7D\u5931\u8D25:",Ct),e(Ct.message||"\u901A\u7528\u6587\u6863\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),g(!1),n(""),W.current=!1,s.current=!0,Ct}},[Gt,a,w]),Xt=useCallback(async Ct=>{if(Ct===N.current)return;if(v){console.log("\u9875\u9762\u6B63\u5728\u52A0\u8F7D\u4E2D\uFF0C\u5FFD\u7565\u7FFB\u9875\u8BF7\u6C42");return}if(!(A==="pdf"||A==="pdf_slides")){console.log(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u652F\u6301\u7FFB\u9875\uFF0C\u5FFD\u7565\u7FFB\u9875\u8BF7\u6C42`);return}console.log("PDF\u9875\u9762\u53D8\u5316:",Ct,"\u5F53\u524D\u9875:",N.current),console.log(`\u9875\u9762 ${Ct} \u662F\u5426\u5728\u7F13\u5B58\u4E2D:`,Mt(Ct)),N.current=Ct,x(Ct);try{await kt(Ct,!1),P("pageChange",{pageNumber:Ct,totalPages:q||j})}catch($t){console.error("PDF\u9875\u9762\u52A0\u8F7D\u5931\u8D25:",$t);const jt=N.current;x(jt)}},[kt,j,P,Mt,v,A]);useEffect(()=>{N.current=E,console.log("\u5F53\u524D\u9875\u72B6\u6001\u66F4\u65B0:",E)},[E]);const Vt=useCallback(Ct=>{wt(Ct),P("zoomChange",{scale:Ct})},[P]),Yt=useCallback(()=>{P("viewer:close")},[P]),Jt=useCallback(()=>{const Ct=Math.min(3,yt+.1);Vt(Ct)},[yt,Vt]),oe=useCallback(()=>{const Ct=Math.max(.3,yt-.1);Vt(Ct)},[yt,Vt]),ce=useCallback(()=>{const Ct=(bt-90+360)%360;K(Ct),P("rotateChange",{rotation:Ct})},[bt,P]),de=useCallback(()=>{const Ct=(bt+90)%360;K(Ct),P("rotateChange",{rotation:Ct})},[bt,P]),Pt=useCallback(()=>{if(!(A==="pdf"||A==="pdf_slides")){console.log(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u652F\u6301\u7FFB\u9875\uFF0C\u5FFD\u7565\u7FFB\u9875\u8BF7\u6C42`);return}const Tt=N.current-1;Tt>=1&&Xt(Tt)},[Xt,A]),J=useCallback(()=>{if(!(A==="pdf"||A==="pdf_slides")){console.log(`\u6587\u4EF6\u7C7B\u578B ${A} \u4E0D\u652F\u6301\u7FFB\u9875\uFF0C\u5FFD\u7565\u7FFB\u9875\u8BF7\u6C42`);return}const Tt=N.current+1,$t=q||j;$t&&Tt<=$t&&Xt(Tt)},[j,Xt,A]),pt=useCallback(()=>{const Ct=Date.now();Object.keys(d.current).forEach(Tt=>{const $t=d.current[parseInt(Tt)];Ct-$t.timestamp>CACHE_EXPIRY_TIME&&(delete d.current[parseInt(Tt)],console.log(`\u6E05\u7406\u8FC7\u671F\u9875\u9762\u7F13\u5B58: ${Tt}`))}),Object.keys(C.current).forEach(Tt=>{const $t=C.current[Tt];Ct-$t.timestamp>CACHE_EXPIRY_TIME&&(delete C.current[Tt],console.log(`\u6E05\u7406\u8FC7\u671Fchunk\u7F13\u5B58: ${Tt}`))}),y.current&&Ct-y.current.timestamp>CACHE_EXPIRY_TIME&&(y.current=null,console.log("\u6E05\u7406\u8FC7\u671Fmarkdown\u5185\u5BB9\u7F13\u5B58")),$(Tt=>{const $t={...Tt};return Object.keys($t).forEach(jt=>{Ct-$t[jt].timestamp>CACHE_EXPIRY_TIME&&(delete $t[jt],console.log(`\u6E05\u7406\u8FC7\u671F\u901A\u7528\u6587\u4EF6\u7F13\u5B58: ${jt}`))}),$t})},[]),Lt=useCallback(()=>{if(a)return a;try{const Ct=new URL(m);return decodeURIComponent(Ct.pathname.split("/").pop()||"")||"Stream\u6587\u6863"}catch{const Ct=m.split("/");return decodeURIComponent(Ct[Ct.length-1])||"Stream\u6587\u6863"}},[m,a]);useEffect(()=>{const Ct=setInterval(pt,CACHE_EXPIRY_TIME);return()=>clearInterval(Ct)},[pt]),useEffect(()=>()=>{d.current={},C.current={},y.current=null,$({}),console.log("\u7EC4\u4EF6\u5378\u8F7D\uFF0C\u6E05\u7406\u6240\u6709\u7F13\u5B58")},[]),useEffect(()=>{console.log("=== useEffect \u88AB\u89E6\u53D1 ==="),console.log("\u89E6\u53D1\u65F6\u95F4:",new Date().toISOString()),console.log("\u89E6\u53D1\u539F\u56E0:",{initialPage:_,fileType:A}),(async()=>{try{const Tt=A==="pdf"||A==="pdf_slides",$t=Tt&&_||1;console.log("\u5F00\u59CB\u521D\u59CB\u52A0\u8F7D\uFF0C\u6587\u4EF6\u7C7B\u578B:",A,"\u6709\u6548\u9875\u7801:",$t,"\u662F\u5426PDF:",Tt),A==="markdown"||A==="markdown_table"?(await Ut(),x(1),I(q||1),P("pageChange",{pageNumber:1,totalPages:q||1})):A==="image"?(await zt(),x(1),I(q||1),K(0),P("pageChange",{pageNumber:1,totalPages:q||1})):Tt?(await kt($t,!0),x($t),setTimeout(()=>{P("pageChange",{pageNumber:$t,totalPages:q||j})},0)):(console.log("=== \u521D\u59CB\u52A0\u8F7D\uFF1A\u4F7F\u7528\u901A\u7528\u52A0\u8F7D\u51FD\u6570\u5904\u7406\u6587\u4EF6\u7C7B\u578B ===",A),await Zt(),x(1),I(q||1),P("pageChange",{pageNumber:1,totalPages:q||1}))}catch(Tt){console.error("\u521D\u59CB\u52A0\u8F7D\u5931\u8D25:",Tt),e((Tt==null?void 0:Tt.message)||"\u6587\u4EF6\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5"),g(!1),n("")}})()},[_,A,m]);const qt=useMemo(()=>Math.floor((E-1)/M)*M+1,[E,M]);return i?jsx(ReaderContainer,{$theme:p,className:t,children:l!=null&&l.ErrorComponent?jsx(l.ErrorComponent,{error:i,theme:p}):jsxs(ErrorContainer,{$theme:p,children:[jsx("div",{children:"\u52A0\u8F7D\u5931\u8D25"}),jsx("div",{style:{fontSize:"12px",marginTop:"8px"},children:i})]})}):v?jsxs(ReaderContainer,{$theme:p,className:t,children:[jsx(Header,{fileName:Lt(),currentPage:E,totalPage:j,scale:yt,isAnnotating:!1,tools:_t,styles:F,onPrevPage:()=>{},onNextPage:()=>{},onZoomIn:()=>{},onZoomOut:()=>{},onAnnotationToggle:()=>{},onDownload:()=>{},onClose:Yt,className:r}),l!=null&&l.LoadingComponent?jsx(l.LoadingComponent,{status:u,theme:p}):jsx(DefaultLoadingComponent,{status:u,theme:p})]}):jsxs(ReaderContainer,{$theme:p,className:t,children:[jsx(Header,{fileName:Lt(),currentPage:E,totalPage:j,scale:yt,isAnnotating:!1,tools:{..._t,navigation:A==="pdf"||A==="pdf_slides"?_t.navigation:!1,rotate:A==="image"},styles:F,onPrevPage:Pt,onNextPage:J,onZoomIn:Jt,onZoomOut:oe,onRotateLeft:A==="image"?ce:void 0,onRotateRight:A==="image"?de:void 0,onAnnotationToggle:()=>{},onDownload:()=>{},onClose:Yt,className:r}),A==="markdown"||A==="markdown_table"?jsxs("div",{ref:k,style:{flex:1,overflow:"auto",position:"relative"},className:o,children:[jsx(Xe,{data:{content:xt,...Lt()&&{fileName:Lt()},...A&&{fileType:A},...j&&{totalPages:j}},annotationData:Y,totalPage:j,currentPage:E,scale:yt,eventsEmit:(Ct,Tt)=>{console.log("Fviewer\u4E8B\u4EF6:",Ct,Tt),P(Ct==="md_annotation_add"?"md_annotation_add":Ct==="table_annotation_add"?"table_annotation_add":Ct,Tt)},styles:F,tools:_t,customComponents:l,contentClass:o}),(console.log("=== \u4F20\u9012\u7ED9Fviewer\u7684markdown\u5185\u5BB9 ==="),console.log("markdownContent:",xt),console.log("markdownContent\u957F\u5EA6:",xt.length),console.log("markdownContent\u524D100\u5B57\u7B26:",xt.substring(0,100)),console.log("markdownContent\u540E100\u5B57\u7B26:",xt.substring(xt.length-100)),null)]}):A==="image"?jsx(Xe,{data:{content:G,...Lt()&&{fileName:Lt()},...A&&{fileType:A}},annotationData:Y,totalPage:1,currentPage:1,scale:yt,rotation:bt,eventsEmit:P,styles:F,tools:{..._t,navigation:!1,rotate:!0},customComponents:l,contentClass:o}):A==="pdf"||A==="pdf_slides"?jsx(Xe,{data:{content:{document:B},...Lt()&&{fileName:Lt()},...A&&{fileType:A},...j&&{totalPages:j},pdfStartPage:qt},annotationData:Y,totalPage:j,currentPage:E,scale:yt,initialZoom:V,eventsEmit:(Ct,Tt)=>{console.log("Fviewer\u4E8B\u4EF6:",Ct,Tt),Ct==="scaleChange"&&console.log("\u6536\u5230\u7F29\u653E\u53D8\u5316\u4E8B\u4EF6:",Tt),P(Ct,Tt)},styles:F,tools:_t,customComponents:l,contentClass:o}):jsx(Xe,{data:{content:H||c||{type:"text",content:"\u6587\u4EF6\u5185\u5BB9\u52A0\u8F7D\u4E2D..."},...Lt()&&{fileName:Lt()},...A&&{fileType:A}},annotationData:Y,totalPage:1,currentPage:1,scale:yt,eventsEmit:P,styles:F,tools:{..._t,navigation:!1},customComponents:l,contentClass:o})]})};export{Bt as B,ChevronLeft as C,GientechStreamReader as G,commonjsRequire as c,require$$0 as r};