var Qn=Object.defineProperty;var bn=M=>{throw TypeError(M)};var Zn=(M,e,H)=>e in M?Qn(M,e,{enumerable:!0,configurable:!0,writable:!0,value:H}):M[e]=H;var Qt=(M,e,H)=>Zn(M,typeof e!="symbol"?e+"":e,H),Le=(M,e,H)=>e.has(M)||bn("Cannot "+H);var t=(M,e,H)=>(Le(M,e,"read from private field"),H?H.call(M):e.get(M)),rt=(M,e,H)=>e.has(M)?bn("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(M):e.set(M,H),ot=(M,e,H,n)=>(Le(M,e,"write to private field"),n?n.call(M,H):e.set(M,H),H),J=(M,e,H)=>(Le(M,e,"access private method"),H);var ue=(M,e,H,n)=>({set _(f){ot(M,e,f,H)},get _(){return t(M,e,n)}});import{g as getAugmentedNamespace,a as getDefaultExportFromCjs,r as reactExports,j as jsxRuntimeExports,d as dt}from"./index.js";function _mergeNamespaces(M,e){for(var H=0;H<e.length;H++){const n=e[H];if(typeof n!="string"&&!Array.isArray(n)){for(const f in n)if(f!=="default"&&!(f in M)){const X=Object.getOwnPropertyDescriptor(n,f);X&&Object.defineProperty(M,f,X.get?X:{enumerable:!0,get:()=>n[f]})}}}return Object.freeze(Object.defineProperty(M,Symbol.toStringTag,{value:"Module"}))}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$1={exports:{}};const __viteBrowserExternal={},__viteBrowserExternal$1=Object.freeze(Object.defineProperty({__proto__:null,default:__viteBrowserExternal},Symbol.toStringTag,{value:"Module"})),require$$5=getAugmentedNamespace(__viteBrowserExternal$1);(function(module,exports){(function(e,H){module.exports=e.pdfjsLib=H()})(globalThis,()=>(()=>{var __webpack_modules__=[,(M,e)=>{var Kt;Object.defineProperty(e,"__esModule",{value:!0}),e.VerbosityLevel=e.Util=e.UnknownErrorException=e.UnexpectedResponseException=e.TextRenderingMode=e.RenderingIntentFlag=e.PromiseCapability=e.PermissionFlag=e.PasswordResponses=e.PasswordException=e.PageActionEventType=e.OPS=e.MissingPDFException=e.MAX_IMAGE_SIZE_TO_CACHE=e.LINE_FACTOR=e.LINE_DESCENT_FACTOR=e.InvalidPDFException=e.ImageKind=e.IDENTITY_MATRIX=e.FormatError=e.FeatureTest=e.FONT_IDENTITY_MATRIX=e.DocumentActionEventType=e.CMapCompressionType=e.BaseException=e.BASELINE_FACTOR=e.AnnotationType=e.AnnotationReplyType=e.AnnotationPrefix=e.AnnotationMode=e.AnnotationFlag=e.AnnotationFieldFlag=e.AnnotationEditorType=e.AnnotationEditorPrefix=e.AnnotationEditorParamsType=e.AnnotationBorderStyleType=e.AnnotationActionEventType=e.AbortException=void 0,e.assert=C,e.bytesToString=pt,e.createValidAbsoluteUrl=it,e.getModificationDate=Tt,e.getUuid=jt,e.getVerbosityLevel=V,e.info=Q,e.isArrayBuffer=Z,e.isArrayEqual=Ct,e.isNodeJS=void 0,e.normalizeUnicode=kt,e.objectFromMap=yt,e.objectSize=At,e.setVerbosityLevel=et,e.shadow=w,e.string32=bt,e.stringToBytes=gt,e.stringToPDFString=mt,e.stringToUTF8String=wt,e.unreachable=lt,e.utf8StringToString=vt,e.warn=W;const H=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser");e.isNodeJS=H;const n=[1,0,0,1,0,0];e.IDENTITY_MATRIX=n;const f=[.001,0,0,.001,0,0];e.FONT_IDENTITY_MATRIX=f;const X=1e7;e.MAX_IMAGE_SIZE_TO_CACHE=X;const G=1.35;e.LINE_FACTOR=G;const ut=.35;e.LINE_DESCENT_FACTOR=ut;const R=ut/G;e.BASELINE_FACTOR=R;const T={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256};e.RenderingIntentFlag=T;const m={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3};e.AnnotationMode=m;const B="pdfjs_internal_editor_";e.AnnotationEditorPrefix=B;const j={DISABLE:-1,NONE:0,FREETEXT:3,STAMP:13,INK:15};e.AnnotationEditorType=j;const A={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23};e.AnnotationEditorParamsType=A;const _={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048};e.PermissionFlag=_;const S={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};e.TextRenderingMode=S;const g={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3};e.ImageKind=g;const u={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26};e.AnnotationType=u;const y={GROUP:"Group",REPLY:"R"};e.AnnotationReplyType=y;const D={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512};e.AnnotationFlag=D;const v={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};e.AnnotationFieldFlag=v;const o={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};e.AnnotationBorderStyleType=o;const d={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"};e.AnnotationActionEventType=d;const l={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"};e.DocumentActionEventType=l;const c={O:"PageOpen",C:"PageClose"};e.PageActionEventType=c;const h={ERRORS:0,WARNINGS:1,INFOS:5};e.VerbosityLevel=h;const N={NONE:0,BINARY:1};e.CMapCompressionType=N;const a={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91};e.OPS=a;const E={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};e.PasswordResponses=E;let P=h.WARNINGS;function et(St){Number.isInteger(St)&&(P=St)}function V(){return P}function Q(St){P>=h.INFOS&&console.log(`Info: ${St}`)}function W(St){P>=h.WARNINGS&&console.log(`Warning: ${St}`)}function lt(St){throw new Error(St)}function C(St,at){St||lt(at)}function $(St){switch(St==null?void 0:St.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function it(St,at=null,ct=null){if(!St)return null;try{if(ct&&typeof St=="string"){if(ct.addDefaultProtocol&&St.startsWith("www.")){const qt=St.match(/\./g);(qt==null?void 0:qt.length)>=2&&(St=`http://${St}`)}if(ct.tryConvertEncoding)try{St=wt(St)}catch{}}const Mt=at?new URL(St,at):new URL(St);if($(Mt))return Mt}catch{}return null}function w(St,at,ct,Mt=!1){return Object.defineProperty(St,at,{value:ct,enumerable:!Mt,configurable:!0,writable:!1}),ct}const i=function(){function at(ct,Mt){this.constructor===at&<("Cannot initialize BaseException."),this.message=ct,this.name=Mt}return at.prototype=new Error,at.constructor=at,at}();e.BaseException=i;class s extends i{constructor(at,ct){super(at,"PasswordException"),this.code=ct}}e.PasswordException=s;class p extends i{constructor(at,ct){super(at,"UnknownErrorException"),this.details=ct}}e.UnknownErrorException=p;class F extends i{constructor(at){super(at,"InvalidPDFException")}}e.InvalidPDFException=F;class L extends i{constructor(at){super(at,"MissingPDFException")}}e.MissingPDFException=L;class I extends i{constructor(at,ct){super(at,"UnexpectedResponseException"),this.status=ct}}e.UnexpectedResponseException=I;class q extends i{constructor(at){super(at,"FormatError")}}e.FormatError=q;class tt extends i{constructor(at){super(at,"AbortException")}}e.AbortException=tt;function pt(St){(typeof St!="object"||(St==null?void 0:St.length)===void 0)&<("Invalid argument for bytesToString");const at=St.length,ct=8192;if(at<ct)return String.fromCharCode.apply(null,St);const Mt=[];for(let qt=0;qt<at;qt+=ct){const zt=Math.min(qt+ct,at),U=St.subarray(qt,zt);Mt.push(String.fromCharCode.apply(null,U))}return Mt.join("")}function gt(St){typeof St!="string"&<("Invalid argument for stringToBytes");const at=St.length,ct=new Uint8Array(at);for(let Mt=0;Mt<at;++Mt)ct[Mt]=St.charCodeAt(Mt)&255;return ct}function bt(St){return String.fromCharCode(St>>24&255,St>>16&255,St>>8&255,St&255)}function At(St){return Object.keys(St).length}function yt(St){const at=Object.create(null);for(const[ct,Mt]of St)at[ct]=Mt;return at}function Y(){const St=new Uint8Array(4);return St[0]=1,new Uint32Array(St.buffer,0,1)[0]===1}function nt(){try{return new Function(""),!0}catch{return!1}}class b{static get isLittleEndian(){return w(this,"isLittleEndian",Y())}static get isEvalSupported(){return w(this,"isEvalSupported",nt())}static get isOffscreenCanvasSupported(){return w(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator>"u"?w(this,"platform",{isWin:!1,isMac:!1}):w(this,"platform",{isWin:navigator.platform.includes("Win"),isMac:navigator.platform.includes("Mac")})}static get isCSSRoundSupported(){var at,ct;return w(this,"isCSSRoundSupported",(ct=(at=globalThis.CSS)==null?void 0:at.supports)==null?void 0:ct.call(at,"width: round(1.5px, 1px)"))}}e.FeatureTest=b;const O=[...Array(256).keys()].map(St=>St.toString(16).padStart(2,"0"));class K{static makeHexColor(at,ct,Mt){return`#${O[at]}${O[ct]}${O[Mt]}`}static scaleMinMax(at,ct){let Mt;at[0]?(at[0]<0&&(Mt=ct[0],ct[0]=ct[1],ct[1]=Mt),ct[0]*=at[0],ct[1]*=at[0],at[3]<0&&(Mt=ct[2],ct[2]=ct[3],ct[3]=Mt),ct[2]*=at[3],ct[3]*=at[3]):(Mt=ct[0],ct[0]=ct[2],ct[2]=Mt,Mt=ct[1],ct[1]=ct[3],ct[3]=Mt,at[1]<0&&(Mt=ct[2],ct[2]=ct[3],ct[3]=Mt),ct[2]*=at[1],ct[3]*=at[1],at[2]<0&&(Mt=ct[0],ct[0]=ct[1],ct[1]=Mt),ct[0]*=at[2],ct[1]*=at[2]),ct[0]+=at[4],ct[1]+=at[4],ct[2]+=at[5],ct[3]+=at[5]}static transform(at,ct){return[at[0]*ct[0]+at[2]*ct[1],at[1]*ct[0]+at[3]*ct[1],at[0]*ct[2]+at[2]*ct[3],at[1]*ct[2]+at[3]*ct[3],at[0]*ct[4]+at[2]*ct[5]+at[4],at[1]*ct[4]+at[3]*ct[5]+at[5]]}static applyTransform(at,ct){const Mt=at[0]*ct[0]+at[1]*ct[2]+ct[4],qt=at[0]*ct[1]+at[1]*ct[3]+ct[5];return[Mt,qt]}static applyInverseTransform(at,ct){const Mt=ct[0]*ct[3]-ct[1]*ct[2],qt=(at[0]*ct[3]-at[1]*ct[2]+ct[2]*ct[5]-ct[4]*ct[3])/Mt,zt=(-at[0]*ct[1]+at[1]*ct[0]+ct[4]*ct[1]-ct[5]*ct[0])/Mt;return[qt,zt]}static getAxialAlignedBoundingBox(at,ct){const Mt=this.applyTransform(at,ct),qt=this.applyTransform(at.slice(2,4),ct),zt=this.applyTransform([at[0],at[3]],ct),U=this.applyTransform([at[2],at[1]],ct);return[Math.min(Mt[0],qt[0],zt[0],U[0]),Math.min(Mt[1],qt[1],zt[1],U[1]),Math.max(Mt[0],qt[0],zt[0],U[0]),Math.max(Mt[1],qt[1],zt[1],U[1])]}static inverseTransform(at){const ct=at[0]*at[3]-at[1]*at[2];return[at[3]/ct,-at[1]/ct,-at[2]/ct,at[0]/ct,(at[2]*at[5]-at[4]*at[3])/ct,(at[4]*at[1]-at[5]*at[0])/ct]}static singularValueDecompose2dScale(at){const ct=[at[0],at[2],at[1],at[3]],Mt=at[0]*ct[0]+at[1]*ct[2],qt=at[0]*ct[1]+at[1]*ct[3],zt=at[2]*ct[0]+at[3]*ct[2],U=at[2]*ct[1]+at[3]*ct[3],_t=(Mt+U)/2,Pt=Math.sqrt((Mt+U)**2-4*(Mt*U-zt*qt))/2,It=_t+Pt||1,Bt=_t-Pt||1;return[Math.sqrt(It),Math.sqrt(Bt)]}static normalizeRect(at){const ct=at.slice(0);return at[0]>at[2]&&(ct[0]=at[2],ct[2]=at[0]),at[1]>at[3]&&(ct[1]=at[3],ct[3]=at[1]),ct}static intersect(at,ct){const Mt=Math.max(Math.min(at[0],at[2]),Math.min(ct[0],ct[2])),qt=Math.min(Math.max(at[0],at[2]),Math.max(ct[0],ct[2]));if(Mt>qt)return null;const zt=Math.max(Math.min(at[1],at[3]),Math.min(ct[1],ct[3])),U=Math.min(Math.max(at[1],at[3]),Math.max(ct[1],ct[3]));return zt>U?null:[Mt,zt,qt,U]}static bezierBoundingBox(at,ct,Mt,qt,zt,U,_t,Pt){const It=[],Bt=[[],[]];let Ft,k,x,z,ht,ft,Et,xt;for(let Gt=0;Gt<2;++Gt){if(Gt===0?(k=6*at-12*Mt+6*zt,Ft=-3*at+9*Mt-9*zt+3*_t,x=3*Mt-3*at):(k=6*ct-12*qt+6*U,Ft=-3*ct+9*qt-9*U+3*Pt,x=3*qt-3*ct),Math.abs(Ft)<1e-12){if(Math.abs(k)<1e-12)continue;z=-x/k,0<z&&z<1&&It.push(z);continue}Et=k*k-4*x*Ft,xt=Math.sqrt(Et),!(Et<0)&&(ht=(-k+xt)/(2*Ft),0<ht&&ht<1&&It.push(ht),ft=(-k-xt)/(2*Ft),0<ft&&ft<1&&It.push(ft))}let Ot=It.length,Dt;const Rt=Ot;for(;Ot--;)z=It[Ot],Dt=1-z,Bt[0][Ot]=Dt*Dt*Dt*at+3*Dt*Dt*z*Mt+3*Dt*z*z*zt+z*z*z*_t,Bt[1][Ot]=Dt*Dt*Dt*ct+3*Dt*Dt*z*qt+3*Dt*z*z*U+z*z*z*Pt;return Bt[0][Rt]=at,Bt[1][Rt]=ct,Bt[0][Rt+1]=_t,Bt[1][Rt+1]=Pt,Bt[0].length=Bt[1].length=Rt+2,[Math.min(...Bt[0]),Math.min(...Bt[1]),Math.max(...Bt[0]),Math.max(...Bt[1])]}}e.Util=K;const st=[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 mt(St){if(St[0]>="ï"){let ct;if(St[0]==="þ"&&St[1]==="ÿ"?ct="utf-16be":St[0]==="ÿ"&&St[1]==="þ"?ct="utf-16le":St[0]==="ï"&&St[1]==="»"&&St[2]==="¿"&&(ct="utf-8"),ct)try{const Mt=new TextDecoder(ct,{fatal:!0}),qt=gt(St);return Mt.decode(qt)}catch(Mt){W(`stringToPDFString: "${Mt}".`)}}const at=[];for(let ct=0,Mt=St.length;ct<Mt;ct++){const qt=st[St.charCodeAt(ct)];at.push(qt?String.fromCharCode(qt):St.charAt(ct))}return at.join("")}function wt(St){return decodeURIComponent(escape(St))}function vt(St){return unescape(encodeURIComponent(St))}function Z(St){return typeof St=="object"&&(St==null?void 0:St.byteLength)!==void 0}function Ct(St,at){if(St.length!==at.length)return!1;for(let ct=0,Mt=St.length;ct<Mt;ct++)if(St[ct]!==at[ct])return!1;return!0}function Tt(St=new Date){return[St.getUTCFullYear().toString(),(St.getUTCMonth()+1).toString().padStart(2,"0"),St.getUTCDate().toString().padStart(2,"0"),St.getUTCHours().toString().padStart(2,"0"),St.getUTCMinutes().toString().padStart(2,"0"),St.getUTCSeconds().toString().padStart(2,"0")].join("")}class Wt{constructor(){rt(this,Kt,!1);this.promise=new Promise((at,ct)=>{this.resolve=Mt=>{ot(this,Kt,!0),at(Mt)},this.reject=Mt=>{ot(this,Kt,!0),ct(Mt)}})}get settled(){return t(this,Kt)}}Kt=new WeakMap,e.PromiseCapability=Wt;let Ut=null,Xt=null;function kt(St){return Ut||(Ut=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,Xt=new Map([["ſt","ſt"]])),St.replaceAll(Ut,(at,ct,Mt)=>ct?ct.normalize("NFKC"):Xt.get(Mt))}function jt(){if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.randomUUID)=="function")return crypto.randomUUID();const St=new Uint8Array(32);if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.getRandomValues)=="function")crypto.getRandomValues(St);else for(let at=0;at<32;at++)St[at]=Math.floor(Math.random()*255);return pt(St)}const Vt="pdfjs_internal_id_";e.AnnotationPrefix=Vt},(__unused_webpack_module,exports,__w_pdfjs_require__)=>{var M,H,n,f,oe,ye,ut,R,T,m,B,j,A,_,S,ve,u,y,Ie,v,o;Object.defineProperty(exports,"__esModule",{value:!0}),exports.RenderTask=exports.PDFWorkerUtil=exports.PDFWorker=exports.PDFPageProxy=exports.PDFDocumentProxy=exports.PDFDocumentLoadingTask=exports.PDFDataRangeTransport=exports.LoopbackPort=exports.DefaultStandardFontDataFactory=exports.DefaultFilterFactory=exports.DefaultCanvasFactory=exports.DefaultCMapReaderFactory=void 0,Object.defineProperty(exports,"SVGGraphics",{enumerable:!0,get:function(){return _displaySvg.SVGGraphics}}),exports.build=void 0,exports.getDocument=getDocument,exports.version=void 0;var _util=__w_pdfjs_require__(1),_annotation_storage=__w_pdfjs_require__(3),_display_utils=__w_pdfjs_require__(6),_font_loader=__w_pdfjs_require__(9),_displayNode_utils=__w_pdfjs_require__(10),_canvas=__w_pdfjs_require__(11),_worker_options=__w_pdfjs_require__(14),_message_handler=__w_pdfjs_require__(15),_metadata=__w_pdfjs_require__(16),_optional_content_config=__w_pdfjs_require__(17),_transport_stream=__w_pdfjs_require__(18),_displayFetch_stream=__w_pdfjs_require__(19),_displayNetwork=__w_pdfjs_require__(22),_displayNode_stream=__w_pdfjs_require__(23),_displaySvg=__w_pdfjs_require__(24),_xfa_text=__w_pdfjs_require__(25);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100,DELAYED_CLEANUP_TIMEOUT=5e3,DefaultCanvasFactory=_util.isNodeJS?_displayNode_utils.NodeCanvasFactory:_display_utils.DOMCanvasFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory;const DefaultCMapReaderFactory=_util.isNodeJS?_displayNode_utils.NodeCMapReaderFactory:_display_utils.DOMCMapReaderFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory;const DefaultFilterFactory=_util.isNodeJS?_displayNode_utils.NodeFilterFactory:_display_utils.DOMFilterFactory;exports.DefaultFilterFactory=DefaultFilterFactory;const DefaultStandardFontDataFactory=_util.isNodeJS?_displayNode_utils.NodeStandardFontDataFactory:_display_utils.DOMStandardFontDataFactory;exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory;function getDocument(l){if(typeof l=="string"||l instanceof URL?l={url:l}:(0,_util.isArrayBuffer)(l)&&(l={data:l}),typeof l!="object")throw new Error("Invalid parameter in getDocument, need parameter object.");if(!l.url&&!l.data&&!l.range)throw new Error("Invalid parameter object: need either .data, .range or .url");const c=new PDFDocumentLoadingTask,{docId:h}=c,N=l.url?getUrlProp(l.url):null,a=l.data?getDataProp(l.data):null,E=l.httpHeaders||null,P=l.withCredentials===!0,et=l.password??null,V=l.range instanceof PDFDataRangeTransport?l.range:null,Q=Number.isInteger(l.rangeChunkSize)&&l.rangeChunkSize>0?l.rangeChunkSize:DEFAULT_RANGE_CHUNK_SIZE;let W=l.worker instanceof PDFWorker?l.worker:null;const lt=l.verbosity,C=typeof l.docBaseUrl=="string"&&!(0,_display_utils.isDataScheme)(l.docBaseUrl)?l.docBaseUrl:null,$=typeof l.cMapUrl=="string"?l.cMapUrl:null,it=l.cMapPacked!==!1,w=l.CMapReaderFactory||DefaultCMapReaderFactory,i=typeof l.standardFontDataUrl=="string"?l.standardFontDataUrl:null,s=l.StandardFontDataFactory||DefaultStandardFontDataFactory,p=l.stopAtErrors!==!0,F=Number.isInteger(l.maxImageSize)&&l.maxImageSize>-1?l.maxImageSize:-1,L=l.isEvalSupported!==!1,I=typeof l.isOffscreenCanvasSupported=="boolean"?l.isOffscreenCanvasSupported:!_util.isNodeJS,q=Number.isInteger(l.canvasMaxAreaInBytes)?l.canvasMaxAreaInBytes:-1,tt=typeof l.disableFontFace=="boolean"?l.disableFontFace:_util.isNodeJS,pt=l.fontExtraProperties===!0,gt=l.enableXfa===!0,bt=l.ownerDocument||globalThis.document,At=l.disableRange===!0,yt=l.disableStream===!0,Y=l.disableAutoFetch===!0,nt=l.pdfBug===!0,b=V?V.length:l.length??NaN,O=typeof l.useSystemFonts=="boolean"?l.useSystemFonts:!_util.isNodeJS&&!tt,K=typeof l.useWorkerFetch=="boolean"?l.useWorkerFetch:w===_display_utils.DOMCMapReaderFactory&&s===_display_utils.DOMStandardFontDataFactory&&$&&i&&(0,_display_utils.isValidFetchUrl)($,document.baseURI)&&(0,_display_utils.isValidFetchUrl)(i,document.baseURI),st=l.canvasFactory||new DefaultCanvasFactory({ownerDocument:bt}),mt=l.filterFactory||new DefaultFilterFactory({docId:h,ownerDocument:bt}),wt=null;(0,_util.setVerbosityLevel)(lt);const vt={canvasFactory:st,filterFactory:mt};if(K||(vt.cMapReaderFactory=new w({baseUrl:$,isCompressed:it}),vt.standardFontDataFactory=new s({baseUrl:i})),!W){const Tt={verbosity:lt,port:_worker_options.GlobalWorkerOptions.workerPort};W=Tt.port?PDFWorker.fromPort(Tt):new PDFWorker(Tt),c._worker=W}const Z={docId:h,apiVersion:"3.11.174",data:a,password:et,disableAutoFetch:Y,rangeChunkSize:Q,length:b,docBaseUrl:C,enableXfa:gt,evaluatorOptions:{maxImageSize:F,disableFontFace:tt,ignoreErrors:p,isEvalSupported:L,isOffscreenCanvasSupported:I,canvasMaxAreaInBytes:q,fontExtraProperties:pt,useSystemFonts:O,cMapUrl:K?$:null,standardFontDataUrl:K?i:null}},Ct={ignoreErrors:p,isEvalSupported:L,disableFontFace:tt,fontExtraProperties:pt,enableXfa:gt,ownerDocument:bt,disableAutoFetch:Y,pdfBug:nt,styleElement:wt};return W.promise.then(function(){if(c.destroyed)throw new Error("Loading aborted");const Tt=_fetchDocument(W,Z),Wt=new Promise(function(Ut){let Xt;V?Xt=new _transport_stream.PDFDataTransportStream({length:b,initialData:V.initialData,progressiveDone:V.progressiveDone,contentDispositionFilename:V.contentDispositionFilename,disableRange:At,disableStream:yt},V):a||(Xt=(jt=>_util.isNodeJS?new _displayNode_stream.PDFNodeStream(jt):(0,_display_utils.isValidFetchUrl)(jt.url)?new _displayFetch_stream.PDFFetchStream(jt):new _displayNetwork.PDFNetworkStream(jt))({url:N,length:b,httpHeaders:E,withCredentials:P,rangeChunkSize:Q,disableRange:At,disableStream:yt})),Ut(Xt)});return Promise.all([Tt,Wt]).then(function([Ut,Xt]){if(c.destroyed)throw new Error("Loading aborted");const kt=new _message_handler.MessageHandler(h,Ut,W.port),jt=new WorkerTransport(kt,c,Xt,Ct,vt);c._transport=jt,kt.send("Ready",null)})}).catch(c._capability.reject),c}async function _fetchDocument(l,c){if(l.destroyed)throw new Error("Worker was destroyed");const h=await l.messageHandler.sendWithPromise("GetDocRequest",c,c.data?[c.data.buffer]:null);if(l.destroyed)throw new Error("Worker was destroyed");return h}function getUrlProp(l){if(l instanceof URL)return l.href;try{return new URL(l,window.location).href}catch{if(_util.isNodeJS&&typeof l=="string")return l}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function getDataProp(l){if(_util.isNodeJS&&typeof Buffer<"u"&&l instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(l instanceof Uint8Array&&l.byteLength===l.buffer.byteLength)return l;if(typeof l=="string")return(0,_util.stringToBytes)(l);if(typeof l=="object"&&!isNaN(l==null?void 0:l.length)||(0,_util.isArrayBuffer)(l))return new Uint8Array(l);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}const e=class e{constructor(){this._capability=new _util.PromiseCapability,this._transport=null,this._worker=null,this.docId=`d${ue(e,M)._++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){var c,h,N;this.destroyed=!0;try{(c=this._worker)!=null&&c.port&&(this._worker._pendingDestroy=!0),await((h=this._transport)==null?void 0:h.destroy())}catch(a){throw(N=this._worker)!=null&&N.port&&delete this._worker._pendingDestroy,a}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}};M=new WeakMap,rt(e,M,0);let PDFDocumentLoadingTask=e;exports.PDFDocumentLoadingTask=PDFDocumentLoadingTask;class PDFDataRangeTransport{constructor(c,h,N=!1,a=null){this.length=c,this.initialData=h,this.progressiveDone=N,this.contentDispositionFilename=a,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=new _util.PromiseCapability}addRangeListener(c){this._rangeListeners.push(c)}addProgressListener(c){this._progressListeners.push(c)}addProgressiveReadListener(c){this._progressiveReadListeners.push(c)}addProgressiveDoneListener(c){this._progressiveDoneListeners.push(c)}onDataRange(c,h){for(const N of this._rangeListeners)N(c,h)}onDataProgress(c,h){this._readyCapability.promise.then(()=>{for(const N of this._progressListeners)N(c,h)})}onDataProgressiveRead(c){this._readyCapability.promise.then(()=>{for(const h of this._progressiveReadListeners)h(c)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const c of this._progressiveDoneListeners)c()})}transportReady(){this._readyCapability.resolve()}requestDataRange(c,h){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}exports.PDFDataRangeTransport=PDFDataRangeTransport;class PDFDocumentProxy{constructor(c,h){this._pdfInfo=c,this._transport=h,Object.defineProperty(this,"getJavaScript",{value:()=>((0,_display_utils.deprecated)("`PDFDocumentProxy.getJavaScript`, please use `PDFDocumentProxy.getJSActions` instead."),this.getJSActions().then(N=>{if(!N)return N;const a=[];for(const E in N)a.push(...N[E]);return a}))})}get annotationStorage(){return this._transport.annotationStorage}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return(0,_util.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(c){return this._transport.getPage(c)}getPageIndex(c){return this._transport.getPageIndex(c)}getDestinations(){return this._transport.getDestinations()}getDestination(c){return this._transport.getDestination(c)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){return this._transport.getOptionalContentConfig()}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(c=!1){return this._transport.startCleanup(c||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}exports.PDFDocumentProxy=PDFDocumentProxy;class PDFPageProxy{constructor(c,h,N,a=!1){rt(this,f);rt(this,H,null);rt(this,n,!1);this._pageIndex=c,this._pageInfo=h,this._transport=N,this._stats=a?new _display_utils.StatTimer:null,this._pdfBug=a,this.commonObjs=N.commonObjs,this.objs=new PDFObjects,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:c,rotation:h=this.rotate,offsetX:N=0,offsetY:a=0,dontFlip:E=!1}={}){return new _display_utils.PageViewport({viewBox:this.view,scale:c,rotation:h,offsetX:N,offsetY:a,dontFlip:E})}getAnnotations({intent:c="display"}={}){const h=this._transport.getRenderingIntent(c);return this._transport.getAnnotations(this._pageIndex,h.renderingIntent)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return(0,_util.shadow)(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var c;return((c=this._transport._htmlForXfa)==null?void 0:c.children[this._pageIndex])||null}render({canvasContext:c,viewport:h,intent:N="display",annotationMode:a=_util.AnnotationMode.ENABLE,transform:E=null,background:P=null,optionalContentConfigPromise:et=null,annotationCanvasMap:V=null,pageColors:Q=null,printAnnotationStorage:W=null}){var s,p;(s=this._stats)==null||s.time("Overall");const lt=this._transport.getRenderingIntent(N,a,W);ot(this,n,!1),J(this,f,ye).call(this),et||(et=this._transport.getOptionalContentConfig());let C=this._intentStates.get(lt.cacheKey);C||(C=Object.create(null),this._intentStates.set(lt.cacheKey,C)),C.streamReaderCancelTimeout&&(clearTimeout(C.streamReaderCancelTimeout),C.streamReaderCancelTimeout=null);const $=!!(lt.renderingIntent&_util.RenderingIntentFlag.PRINT);C.displayReadyCapability||(C.displayReadyCapability=new _util.PromiseCapability,C.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(p=this._stats)==null||p.time("Page Request"),this._pumpOperatorList(lt));const it=F=>{var L,I;C.renderTasks.delete(w),(this._maybeCleanupAfterRender||$)&&ot(this,n,!0),J(this,f,oe).call(this,!$),F?(w.capability.reject(F),this._abortOperatorList({intentState:C,reason:F instanceof Error?F:new Error(F)})):w.capability.resolve(),(L=this._stats)==null||L.timeEnd("Rendering"),(I=this._stats)==null||I.timeEnd("Overall")},w=new InternalRenderTask({callback:it,params:{canvasContext:c,viewport:h,transform:E,background:P},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:V,operatorList:C.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!$,pdfBug:this._pdfBug,pageColors:Q});(C.renderTasks||(C.renderTasks=new Set)).add(w);const i=w.task;return Promise.all([C.displayReadyCapability.promise,et]).then(([F,L])=>{var I;if(this.destroyed){it();return}(I=this._stats)==null||I.time("Rendering"),w.initializeGraphics({transparency:F,optionalContentConfig:L}),w.operatorListChanged()}).catch(it),i}getOperatorList({intent:c="display",annotationMode:h=_util.AnnotationMode.ENABLE,printAnnotationStorage:N=null}={}){var V;function a(){P.operatorList.lastChunk&&(P.opListReadCapability.resolve(P.operatorList),P.renderTasks.delete(et))}const E=this._transport.getRenderingIntent(c,h,N,!0);let P=this._intentStates.get(E.cacheKey);P||(P=Object.create(null),this._intentStates.set(E.cacheKey,P));let et;return P.opListReadCapability||(et=Object.create(null),et.operatorListChanged=a,P.opListReadCapability=new _util.PromiseCapability,(P.renderTasks||(P.renderTasks=new Set)).add(et),P.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(V=this._stats)==null||V.time("Page Request"),this._pumpOperatorList(E)),P.opListReadCapability.promise}streamTextContent({includeMarkedContent:c=!1,disableNormalization:h=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:c===!0,disableNormalization:h===!0},{highWaterMark:100,size(a){return a.items.length}})}getTextContent(c={}){if(this._transport._htmlForXfa)return this.getXfa().then(N=>_xfa_text.XfaText.textContent(N));const h=this.streamTextContent(c);return new Promise(function(N,a){function E(){P.read().then(function({value:V,done:Q}){if(Q){N(et);return}Object.assign(et.styles,V.styles),et.items.push(...V.items),E()},a)}const P=h.getReader(),et={items:[],styles:Object.create(null)};E()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const c=[];for(const h of this._intentStates.values())if(this._abortOperatorList({intentState:h,reason:new Error("Page was destroyed."),force:!0}),!h.opListReadCapability)for(const N of h.renderTasks)c.push(N.completed),N.cancel();return this.objs.clear(),ot(this,n,!1),J(this,f,ye).call(this),Promise.all(c)}cleanup(c=!1){ot(this,n,!0);const h=J(this,f,oe).call(this,!1);return c&&h&&this._stats&&(this._stats=new _display_utils.StatTimer),h}_startRenderPage(c,h){var a,E;const N=this._intentStates.get(h);N&&((a=this._stats)==null||a.timeEnd("Page Request"),(E=N.displayReadyCapability)==null||E.resolve(c))}_renderPageChunk(c,h){for(let N=0,a=c.length;N<a;N++)h.operatorList.fnArray.push(c.fnArray[N]),h.operatorList.argsArray.push(c.argsArray[N]);h.operatorList.lastChunk=c.lastChunk,h.operatorList.separateAnnots=c.separateAnnots;for(const N of h.renderTasks)N.operatorListChanged();c.lastChunk&&J(this,f,oe).call(this,!0)}_pumpOperatorList({renderingIntent:c,cacheKey:h,annotationStorageSerializable:N}){const{map:a,transfers:E}=N,et=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:c,cacheKey:h,annotationStorage:a},E).getReader(),V=this._intentStates.get(h);V.streamReader=et;const Q=()=>{et.read().then(({value:W,done:lt})=>{if(lt){V.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(W,V),Q())},W=>{if(V.streamReader=null,!this._transport.destroyed){if(V.operatorList){V.operatorList.lastChunk=!0;for(const lt of V.renderTasks)lt.operatorListChanged();J(this,f,oe).call(this,!0)}if(V.displayReadyCapability)V.displayReadyCapability.reject(W);else if(V.opListReadCapability)V.opListReadCapability.reject(W);else throw W}})};Q()}_abortOperatorList({intentState:c,reason:h,force:N=!1}){if(c.streamReader){if(c.streamReaderCancelTimeout&&(clearTimeout(c.streamReaderCancelTimeout),c.streamReaderCancelTimeout=null),!N){if(c.renderTasks.size>0)return;if(h instanceof _display_utils.RenderingCancelledException){let a=RENDERING_CANCELLED_TIMEOUT;h.extraDelay>0&&h.extraDelay<1e3&&(a+=h.extraDelay),c.streamReaderCancelTimeout=setTimeout(()=>{c.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:c,reason:h,force:!0})},a);return}}if(c.streamReader.cancel(new _util.AbortException(h.message)).catch(()=>{}),c.streamReader=null,!this._transport.destroyed){for(const[a,E]of this._intentStates)if(E===c){this._intentStates.delete(a);break}this.cleanup()}}}get stats(){return this._stats}}H=new WeakMap,n=new WeakMap,f=new WeakSet,oe=function(c=!1){if(J(this,f,ye).call(this),!t(this,n)||this.destroyed)return!1;if(c)return ot(this,H,setTimeout(()=>{ot(this,H,null),J(this,f,oe).call(this,!1)},DELAYED_CLEANUP_TIMEOUT)),!1;for(const{renderTasks:h,operatorList:N}of this._intentStates.values())if(h.size>0||!N.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),ot(this,n,!1),!0},ye=function(){t(this,H)&&(clearTimeout(t(this,H)),ot(this,H,null))},exports.PDFPageProxy=PDFPageProxy;class LoopbackPort{constructor(){rt(this,ut,new Set);rt(this,R,Promise.resolve())}postMessage(c,h){const N={data:structuredClone(c,h?{transfer:h}:null)};t(this,R).then(()=>{for(const a of t(this,ut))a.call(this,N)})}addEventListener(c,h){t(this,ut).add(h)}removeEventListener(c,h){t(this,ut).delete(h)}terminate(){t(this,ut).clear()}}ut=new WeakMap,R=new WeakMap,exports.LoopbackPort=LoopbackPort;const PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};exports.PDFWorkerUtil=PDFWorkerUtil;{if(_util.isNodeJS&&typeof commonjsRequire=="function")PDFWorkerUtil.isWorkerDisabled=!0,PDFWorkerUtil.fallbackWorkerSrc="./pdf.worker.js";else if(typeof document=="object"){const l=(T=document==null?void 0:document.currentScript)==null?void 0:T.src;l&&(PDFWorkerUtil.fallbackWorkerSrc=l.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}PDFWorkerUtil.isSameOrigin=function(l,c){let h;try{if(h=new URL(l),!h.origin||h.origin==="null")return!1}catch{return!1}const N=new URL(c,h);return h.origin===N.origin},PDFWorkerUtil.createCDNWrapper=function(l){const c=`importScripts("${l}");`;return URL.createObjectURL(new Blob([c]))}}const _PDFWorker=class _PDFWorker{constructor({name:l=null,port:c=null,verbosity:h=(0,_util.getVerbosityLevel)()}={}){var N;if(this.name=l,this.destroyed=!1,this.verbosity=h,this._readyCapability=new _util.PromiseCapability,this._port=null,this._webWorker=null,this._messageHandler=null,c){if((N=t(_PDFWorker,m))!=null&&N.has(c))throw new Error("Cannot use more than one PDFWorker per port.");(t(_PDFWorker,m)||ot(_PDFWorker,m,new WeakMap)).set(c,this),this._initializeFromPort(c);return}this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(l){this._port=l,this._messageHandler=new _message_handler.MessageHandler("main","worker",l),this._messageHandler.on("ready",function(){}),this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}_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 c=new Worker(l),h=new _message_handler.MessageHandler("main","worker",c),N=()=>{c.removeEventListener("error",a),h.destroy(),c.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},a=()=>{this._webWorker||N()};c.addEventListener("error",a),h.on("test",P=>{if(c.removeEventListener("error",a),this.destroyed){N();return}P?(this._messageHandler=h,this._port=c,this._webWorker=c,this._readyCapability.resolve(),h.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),h.destroy(),c.terminate())}),h.on("ready",P=>{if(c.removeEventListener("error",a),this.destroyed){N();return}try{E()}catch{this._setupFakeWorker()}});const E=()=>{const P=new Uint8Array;h.send("test",P,[P.buffer])};E();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 c=new LoopbackPort;this._port=c;const h=`fake${PDFWorkerUtil.fakeWorkerId++}`,N=new _message_handler.MessageHandler(h+"_worker",h,c);l.setup(N,c);const a=new _message_handler.MessageHandler(h,h+"_worker",c);this._messageHandler=a,this._readyCapability.resolve(),a.send("configure",{verbosity:this.verbosity})}).catch(l=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${l.message}".`))})}destroy(){var l;this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),(l=t(_PDFWorker,m))==null||l.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(l){var h;if(!(l!=null&&l.port))throw new Error("PDFWorker.fromPort - invalid method signature.");const c=(h=t(this,m))==null?void 0:h.get(l.port);if(c){if(c._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return c}return new _PDFWorker(l)}static get workerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(PDFWorkerUtil.fallbackWorkerSrc!==null)return _util.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'),PDFWorkerUtil.fallbackWorkerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _mainThreadWorkerMessageHandler(){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(_util.isNodeJS&&typeof commonjsRequire=="function"){const worker=eval("require")(this.workerSrc);return worker.WorkerMessageHandler}return await(0,_display_utils.loadScript)(this.workerSrc),window.pdfjsWorker.WorkerMessageHandler};return(0,_util.shadow)(this,"_setupFakeWorkerGlobal",loader())}};m=new WeakMap,rt(_PDFWorker,m);let PDFWorker=_PDFWorker;exports.PDFWorker=PDFWorker;class WorkerTransport{constructor(c,h,N,a,E){rt(this,S);rt(this,B,new Map);rt(this,j,new Map);rt(this,A,new Map);rt(this,_,null);this.messageHandler=c,this.loadingTask=h,this.commonObjs=new PDFObjects,this.fontLoader=new _font_loader.FontLoader({ownerDocument:a.ownerDocument,styleElement:a.styleElement}),this._params=a,this.canvasFactory=E.canvasFactory,this.filterFactory=E.filterFactory,this.cMapReaderFactory=E.cMapReaderFactory,this.standardFontDataFactory=E.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=N,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=new _util.PromiseCapability,this.setupMessageHandler()}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}getRenderingIntent(c,h=_util.AnnotationMode.ENABLE,N=null,a=!1){let E=_util.RenderingIntentFlag.DISPLAY,P=_annotation_storage.SerializableEmpty;switch(c){case"any":E=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":E=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${c}`)}switch(h){case _util.AnnotationMode.DISABLE:E+=_util.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case _util.AnnotationMode.ENABLE:break;case _util.AnnotationMode.ENABLE_FORMS:E+=_util.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case _util.AnnotationMode.ENABLE_STORAGE:E+=_util.RenderingIntentFlag.ANNOTATIONS_STORAGE,P=(E&_util.RenderingIntentFlag.PRINT&&N instanceof _annotation_storage.PrintAnnotationStorage?N:this.annotationStorage).serializable;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${h}`)}return a&&(E+=_util.RenderingIntentFlag.OPLIST),{renderingIntent:E,cacheKey:`${E}_${P.hash}`,annotationStorageSerializable:P}}destroy(){var N;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=new _util.PromiseCapability,(N=t(this,_))==null||N.reject(new Error("Worker was destroyed during onPassword callback"));const c=[];for(const a of t(this,j).values())c.push(a._destroy());t(this,j).clear(),t(this,A).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const h=this.messageHandler.sendWithPromise("Terminate",null);return c.push(h),Promise.all(c).then(()=>{var a;this.commonObjs.clear(),this.fontLoader.clear(),t(this,B).clear(),this.filterFactory.destroy(),(a=this._networkStream)==null||a.cancelAllRequests(new _util.AbortException("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:c,loadingTask:h}=this;c.on("GetReader",(N,a)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=E=>{this._lastProgress={loaded:E.loaded,total:E.total}},a.onPull=()=>{this._fullReader.read().then(function({value:E,done:P}){if(P){a.close();return}(0,_util.assert)(E instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),a.enqueue(new Uint8Array(E),1,[E])}).catch(E=>{a.error(E)})},a.onCancel=E=>{this._fullReader.cancel(E),a.ready.catch(P=>{if(!this.destroyed)throw P})}}),c.on("ReaderHeadersReady",N=>{const a=new _util.PromiseCapability,E=this._fullReader;return E.headersReady.then(()=>{var P;(!E.isStreamingSupported||!E.isRangeSupported)&&(this._lastProgress&&((P=h.onProgress)==null||P.call(h,this._lastProgress)),E.onProgress=et=>{var V;(V=h.onProgress)==null||V.call(h,{loaded:et.loaded,total:et.total})}),a.resolve({isStreamingSupported:E.isStreamingSupported,isRangeSupported:E.isRangeSupported,contentLength:E.contentLength})},a.reject),a.promise}),c.on("GetRangeReader",(N,a)=>{(0,_util.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const E=this._networkStream.getRangeReader(N.begin,N.end);if(!E){a.close();return}a.onPull=()=>{E.read().then(function({value:P,done:et}){if(et){a.close();return}(0,_util.assert)(P instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),a.enqueue(new Uint8Array(P),1,[P])}).catch(P=>{a.error(P)})},a.onCancel=P=>{E.cancel(P),a.ready.catch(et=>{if(!this.destroyed)throw et})}}),c.on("GetDoc",({pdfInfo:N})=>{this._numPages=N.numPages,this._htmlForXfa=N.htmlForXfa,delete N.htmlForXfa,h._capability.resolve(new PDFDocumentProxy(N,this))}),c.on("DocException",function(N){let a;switch(N.name){case"PasswordException":a=new _util.PasswordException(N.message,N.code);break;case"InvalidPDFException":a=new _util.InvalidPDFException(N.message);break;case"MissingPDFException":a=new _util.MissingPDFException(N.message);break;case"UnexpectedResponseException":a=new _util.UnexpectedResponseException(N.message,N.status);break;case"UnknownErrorException":a=new _util.UnknownErrorException(N.message,N.details);break;default:(0,_util.unreachable)("DocException - expected a valid Error.")}h._capability.reject(a)}),c.on("PasswordRequest",N=>{if(ot(this,_,new _util.PromiseCapability),h.onPassword){const a=E=>{E instanceof Error?t(this,_).reject(E):t(this,_).resolve({password:E})};try{h.onPassword(a,N.code)}catch(E){t(this,_).reject(E)}}else t(this,_).reject(new _util.PasswordException(N.message,N.code));return t(this,_).promise}),c.on("DataLoaded",N=>{var a;(a=h.onProgress)==null||a.call(h,{loaded:N.length,total:N.length}),this.downloadInfoCapability.resolve(N)}),c.on("StartRenderPage",N=>{if(this.destroyed)return;t(this,j).get(N.pageIndex)._startRenderPage(N.transparency,N.cacheKey)}),c.on("commonobj",([N,a,E])=>{var P;if(!this.destroyed&&!this.commonObjs.has(N))switch(a){case"Font":const et=this._params;if("error"in E){const W=E.error;(0,_util.warn)(`Error during font loading: ${W}`),this.commonObjs.resolve(N,W);break}const V=et.pdfBug&&((P=globalThis.FontInspector)!=null&&P.enabled)?(W,lt)=>globalThis.FontInspector.fontAdded(W,lt):null,Q=new _font_loader.FontFaceObject(E,{isEvalSupported:et.isEvalSupported,disableFontFace:et.disableFontFace,ignoreErrors:et.ignoreErrors,inspectFont:V});this.fontLoader.bind(Q).catch(W=>c.sendWithPromise("FontFallback",{id:N})).finally(()=>{!et.fontExtraProperties&&Q.data&&(Q.data=null),this.commonObjs.resolve(N,Q)});break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(N,E);break;default:throw new Error(`Got unknown common object type ${a}`)}}),c.on("obj",([N,a,E,P])=>{var V;if(this.destroyed)return;const et=t(this,j).get(a);if(!et.objs.has(N))switch(E){case"Image":if(et.objs.resolve(N,P),P){let Q;if(P.bitmap){const{width:W,height:lt}=P;Q=W*lt*4}else Q=((V=P.data)==null?void 0:V.length)||0;Q>_util.MAX_IMAGE_SIZE_TO_CACHE&&(et._maybeCleanupAfterRender=!0)}break;case"Pattern":et.objs.resolve(N,P);break;default:throw new Error(`Got unknown object type ${E}`)}}),c.on("DocProgress",N=>{var a;this.destroyed||(a=h.onProgress)==null||a.call(h,{loaded:N.loaded,total:N.total})}),c.on("FetchBuiltInCMap",N=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(N):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),c.on("FetchStandardFontData",N=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(N):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var N;this.annotationStorage.size<=0&&(0,_util.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:c,transfers:h}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:c,filename:((N=this._fullReader)==null?void 0:N.filename)??null},h).finally(()=>{this.annotationStorage.resetModified()})}getPage(c){if(!Number.isInteger(c)||c<=0||c>this._numPages)return Promise.reject(new Error("Invalid page request."));const h=c-1,N=t(this,A).get(h);if(N)return N;const a=this.messageHandler.sendWithPromise("GetPage",{pageIndex:h}).then(E=>{if(this.destroyed)throw new Error("Transport destroyed");const P=new PDFPageProxy(h,E,this,this._params.pdfBug);return t(this,j).set(h,P),P});return t(this,A).set(h,a),a}getPageIndex(c){return typeof c!="object"||c===null||!Number.isInteger(c.num)||c.num<0||!Number.isInteger(c.gen)||c.gen<0?Promise.reject(new Error("Invalid pageIndex request.")):this.messageHandler.sendWithPromise("GetPageIndex",{num:c.num,gen:c.gen})}getAnnotations(c,h){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:c,intent:h})}getFieldObjects(){return J(this,S,ve).call(this,"GetFieldObjects")}hasJSActions(){return J(this,S,ve).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(c){return typeof c!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:c})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return J(this,S,ve).call(this,"GetDocJSActions")}getPageJSActions(c){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:c})}getStructTree(c){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:c})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then(c=>new _optional_content_config.OptionalContentConfig(c))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const c="GetMetadata",h=t(this,B).get(c);if(h)return h;const N=this.messageHandler.sendWithPromise(c,null).then(a=>{var E,P;return{info:a[0],metadata:a[1]?new _metadata.Metadata(a[1]):null,contentDispositionFilename:((E=this._fullReader)==null?void 0:E.filename)??null,contentLength:((P=this._fullReader)==null?void 0:P.contentLength)??null}});return t(this,B).set(c,N),N}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(c=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const h of t(this,j).values())if(!h.cleanup())throw new Error(`startCleanup: Page ${h.pageNumber} is currently rendering.`);this.commonObjs.clear(),c||this.fontLoader.clear(),t(this,B).clear(),this.filterFactory.destroy(!0)}}get loadingParams(){const{disableAutoFetch:c,enableXfa:h}=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:c,enableXfa:h})}}B=new WeakMap,j=new WeakMap,A=new WeakMap,_=new WeakMap,S=new WeakSet,ve=function(c,h=null){const N=t(this,B).get(c);if(N)return N;const a=this.messageHandler.sendWithPromise(c,h);return t(this,B).set(c,a),a};class PDFObjects{constructor(){rt(this,y);rt(this,u,Object.create(null))}get(c,h=null){if(h){const a=J(this,y,Ie).call(this,c);return a.capability.promise.then(()=>h(a.data)),null}const N=t(this,u)[c];if(!(N!=null&&N.capability.settled))throw new Error(`Requesting object that isn't resolved yet ${c}.`);return N.data}has(c){const h=t(this,u)[c];return(h==null?void 0:h.capability.settled)||!1}resolve(c,h=null){const N=J(this,y,Ie).call(this,c);N.data=h,N.capability.resolve()}clear(){var c;for(const h in t(this,u)){const{data:N}=t(this,u)[h];(c=N==null?void 0:N.bitmap)==null||c.close()}ot(this,u,Object.create(null))}}u=new WeakMap,y=new WeakSet,Ie=function(c){var h;return(h=t(this,u))[c]||(h[c]={capability:new _util.PromiseCapability,data:null})};class RenderTask{constructor(c){rt(this,v,null);ot(this,v,c),this.onContinue=null}get promise(){return t(this,v).capability.promise}cancel(c=0){t(this,v).cancel(null,c)}get separateAnnots(){const{separateAnnots:c}=t(this,v).operatorList;if(!c)return!1;const{annotationCanvasMap:h}=t(this,v);return c.form||c.canvas&&(h==null?void 0:h.size)>0}}v=new WeakMap,exports.RenderTask=RenderTask;const d=class d{constructor({callback:c,params:h,objs:N,commonObjs:a,annotationCanvasMap:E,operatorList:P,pageIndex:et,canvasFactory:V,filterFactory:Q,useRequestAnimationFrame:W=!1,pdfBug:lt=!1,pageColors:C=null}){this.callback=c,this.params=h,this.objs=N,this.commonObjs=a,this.annotationCanvasMap=E,this.operatorListIdx=null,this.operatorList=P,this._pageIndex=et,this.canvasFactory=V,this.filterFactory=Q,this._pdfBug=lt,this.pageColors=C,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=W===!0&&typeof window<"u",this.cancelled=!1,this.capability=new _util.PromiseCapability,this.task=new RenderTask(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=h.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:c=!1,optionalContentConfig:h}){var et,V;if(this.cancelled)return;if(this._canvas){if(t(d,o).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.");t(d,o).add(this._canvas)}this._pdfBug&&((et=globalThis.StepperManager)!=null&&et.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:N,viewport:a,transform:E,background:P}=this.params;this.gfx=new _canvas.CanvasGraphics(N,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:h},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:E,viewport:a,transparency:c,background:P}),this.operatorListIdx=0,this.graphicsReady=!0,(V=this.graphicsReadyCallback)==null||V.call(this)}cancel(c=null,h=0){var N;this.running=!1,this.cancelled=!0,(N=this.gfx)==null||N.endDrawing(),t(d,o).delete(this._canvas),this.callback(c||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,h))}operatorListChanged(){var c;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(c=this.stepper)==null||c.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(),t(d,o).delete(this._canvas),this.callback())))}};o=new WeakMap,rt(d,o,new WeakSet);let InternalRenderTask=d;const version="3.11.174";exports.version=version;const build="ce8716743";exports.build=build},(M,e,H)=>{var T,m,B,_n,A;Object.defineProperty(e,"__esModule",{value:!0}),e.SerializableEmpty=e.PrintAnnotationStorage=e.AnnotationStorage=void 0;var n=H(1),f=H(4),X=H(8);const G=Object.freeze({map:null,hash:"",transfers:void 0});e.SerializableEmpty=G;class ut{constructor(){rt(this,B);rt(this,T,!1);rt(this,m,new Map);this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(S,g){const u=t(this,m).get(S);return u===void 0?g:Object.assign(g,u)}getRawValue(S){return t(this,m).get(S)}remove(S){if(t(this,m).delete(S),t(this,m).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const g of t(this,m).values())if(g instanceof f.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(S,g){const u=t(this,m).get(S);let y=!1;if(u!==void 0)for(const[D,v]of Object.entries(g))u[D]!==v&&(y=!0,u[D]=v);else y=!0,t(this,m).set(S,g);y&&J(this,B,_n).call(this),g instanceof f.AnnotationEditor&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(g.constructor._type)}has(S){return t(this,m).has(S)}getAll(){return t(this,m).size>0?(0,n.objectFromMap)(t(this,m)):null}setAll(S){for(const[g,u]of Object.entries(S))this.setValue(g,u)}get size(){return t(this,m).size}resetModified(){t(this,T)&&(ot(this,T,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new R(this)}get serializable(){if(t(this,m).size===0)return G;const S=new Map,g=new X.MurmurHash3_64,u=[],y=Object.create(null);let D=!1;for(const[v,o]of t(this,m)){const d=o instanceof f.AnnotationEditor?o.serialize(!1,y):o;d&&(S.set(v,d),g.update(`${v}:${JSON.stringify(d)}`),D||(D=!!d.bitmap))}if(D)for(const v of S.values())v.bitmap&&u.push(v.bitmap);return S.size>0?{map:S,hash:g.hexdigest(),transfers:u}:G}}T=new WeakMap,m=new WeakMap,B=new WeakSet,_n=function(){t(this,T)||(ot(this,T,!0),typeof this.onSetModified=="function"&&this.onSetModified())},e.AnnotationStorage=ut;class R extends ut{constructor(g){super();rt(this,A);const{map:u,hash:y,transfers:D}=g.serializable,v=structuredClone(u,D?{transfer:D}:null);ot(this,A,{map:v,hash:y,transfers:D})}get print(){(0,n.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return t(this,A)}}A=new WeakMap,e.PrintAnnotationStorage=R},(M,e,H)=>{var R,T,m,B,j,A,_,S,g,u,y,D,v,o,d,Oe,Ne,h,je,Be,An,yn,vn,Ue,En;Object.defineProperty(e,"__esModule",{value:!0}),e.AnnotationEditor=void 0;var n=H(5),f=H(1),X=H(6);const W=class W{constructor(C){rt(this,d);rt(this,R,"");rt(this,T,!1);rt(this,m,null);rt(this,B,null);rt(this,j,null);rt(this,A,!1);rt(this,_,null);rt(this,S,this.focusin.bind(this));rt(this,g,this.focusout.bind(this));rt(this,u,!1);rt(this,y,!1);rt(this,D,!1);Qt(this,"_initialOptions",Object.create(null));Qt(this,"_uiManager",null);Qt(this,"_focusEventsAllowed",!0);Qt(this,"_l10nPromise",null);rt(this,v,!1);rt(this,o,W._zIndex++);this.constructor===W&&(0,f.unreachable)("Cannot initialize AnnotationEditor."),this.parent=C.parent,this.id=C.id,this.width=this.height=null,this.pageIndex=C.parent.pageIndex,this.name=C.name,this.div=null,this._uiManager=C.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=C.isCentered,this._structTreeParentId=null;const{rotation:$,rawDims:{pageWidth:it,pageHeight:w,pageX:i,pageY:s}}=this.parent.viewport;this.rotation=$,this.pageRotation=(360+$-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[it,w],this.pageTranslation=[i,s];const[p,F]=this.parentDimensions;this.x=C.x/p,this.y=C.y/F,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return(0,f.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(C){const $=new ut({id:C.parent.getNextId(),parent:C.parent,uiManager:C._uiManager});$.annotationElementId=C.annotationElementId,$.deleted=!0,$._uiManager.addToAnnotationStorage($)}static initialize(C,$=null){if(W._l10nPromise||(W._l10nPromise=new Map(["editor_alt_text_button_label","editor_alt_text_edit_button_label","editor_alt_text_decorative_tooltip"].map(w=>[w,C.get(w)]))),$!=null&&$.strings)for(const w of $.strings)W._l10nPromise.set(w,C.get(w));if(W._borderLineWidth!==-1)return;const it=getComputedStyle(document.documentElement);W._borderLineWidth=parseFloat(it.getPropertyValue("--outline-width"))||0}static updateDefaultParams(C,$){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(C){return!1}static paste(C,$){(0,f.unreachable)("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return t(this,v)}set _isDraggable(C){var $;ot(this,v,C),($=this.div)==null||$.classList.toggle("draggable",C)}center(){const[C,$]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*$/(C*2),this.y+=this.width*C/($*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*$/(C*2),this.y-=this.width*C/($*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(C){this._uiManager.addCommands(C)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=t(this,o)}setParent(C){C!==null&&(this.pageIndex=C.pageIndex,this.pageDimensions=C.pageDimensions),this.parent=C}focusin(C){this._focusEventsAllowed&&(t(this,u)?ot(this,u,!1):this.parent.setSelected(this))}focusout(C){var it;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const $=C.relatedTarget;$!=null&&$.closest(`#${this.id}`)||(C.preventDefault(),(it=this.parent)!=null&&it.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(C,$,it,w){const[i,s]=this.parentDimensions;[it,w]=this.screenToPageTranslation(it,w),this.x=(C+it)/i,this.y=($+w)/s,this.fixAndSetPosition()}translate(C,$){J(this,d,Oe).call(this,this.parentDimensions,C,$)}translateInPage(C,$){J(this,d,Oe).call(this,this.pageDimensions,C,$),this.div.scrollIntoView({block:"nearest"})}drag(C,$){const[it,w]=this.parentDimensions;if(this.x+=C/it,this.y+=$/w,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:L,y:I}=this.div.getBoundingClientRect();this.parent.findNewParent(this,L,I)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:i,y:s}=this;const[p,F]=J(this,d,Ne).call(this);i+=p,s+=F,this.div.style.left=`${(100*i).toFixed(2)}%`,this.div.style.top=`${(100*s).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}fixAndSetPosition(){const[C,$]=this.pageDimensions;let{x:it,y:w,width:i,height:s}=this;switch(i*=C,s*=$,it*=C,w*=$,this.rotation){case 0:it=Math.max(0,Math.min(C-i,it)),w=Math.max(0,Math.min($-s,w));break;case 90:it=Math.max(0,Math.min(C-s,it)),w=Math.min($,Math.max(i,w));break;case 180:it=Math.min(C,Math.max(i,it)),w=Math.min($,Math.max(s,w));break;case 270:it=Math.min(C,Math.max(s,it)),w=Math.max(0,Math.min($-i,w));break}this.x=it/=C,this.y=w/=$;const[p,F]=J(this,d,Ne).call(this);it+=p,w+=F;const{style:L}=this.div;L.left=`${(100*it).toFixed(2)}%`,L.top=`${(100*w).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(C,$){var it;return J(it=W,h,je).call(it,C,$,this.parentRotation)}pageTranslationToScreen(C,$){var it;return J(it=W,h,je).call(it,C,$,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:C,pageDimensions:[$,it]}=this,w=$*C,i=it*C;return f.FeatureTest.isCSSRoundSupported?[Math.round(w),Math.round(i)]:[w,i]}setDims(C,$){var i;const[it,w]=this.parentDimensions;this.div.style.width=`${(100*C/it).toFixed(2)}%`,t(this,A)||(this.div.style.height=`${(100*$/w).toFixed(2)}%`),(i=t(this,m))==null||i.classList.toggle("small",C<W.SMALL_EDITOR_SIZE||$<W.SMALL_EDITOR_SIZE)}fixDims(){const{style:C}=this.div,{height:$,width:it}=C,w=it.endsWith("%"),i=!t(this,A)&&$.endsWith("%");if(w&&i)return;const[s,p]=this.parentDimensions;w||(C.width=`${(100*parseFloat(it)/s).toFixed(2)}%`),!t(this,A)&&!i&&(C.height=`${(100*parseFloat($)/p).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}async addAltTextButton(){if(t(this,m))return;const C=ot(this,m,document.createElement("button"));C.className="altText";const $=await W._l10nPromise.get("editor_alt_text_button_label");C.textContent=$,C.setAttribute("aria-label",$),C.tabIndex="0",C.addEventListener("contextmenu",X.noContextMenu),C.addEventListener("pointerdown",it=>it.stopPropagation()),C.addEventListener("click",it=>{it.preventDefault(),this._uiManager.editAltText(this)},{capture:!0}),C.addEventListener("keydown",it=>{it.target===C&&it.key==="Enter"&&(it.preventDefault(),this._uiManager.editAltText(this))}),J(this,d,Ue).call(this),this.div.append(C),W.SMALL_EDITOR_SIZE||(W.SMALL_EDITOR_SIZE=Math.min(128,Math.round(C.getBoundingClientRect().width*1.4)))}getClientDimensions(){return this.div.getBoundingClientRect()}get altTextData(){return{altText:t(this,R),decorative:t(this,T)}}set altTextData({altText:C,decorative:$}){t(this,R)===C&&t(this,T)===$||(ot(this,R,C),ot(this,T,$),J(this,d,Ue).call(this))}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",t(this,S)),this.div.addEventListener("focusout",t(this,g));const[C,$]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*$/C).toFixed(2)}%`,this.div.style.maxHeight=`${(100*C/$).toFixed(2)}%`);const[it,w]=this.getInitialTranslation();return this.translate(it,w),(0,n.bindEvents)(this,this.div,["pointerdown"]),this.div}pointerdown(C){const{isMac:$}=f.FeatureTest.platform;if(C.button!==0||C.ctrlKey&&$){C.preventDefault();return}ot(this,u,!0),J(this,d,En).call(this,C)}moveInDOM(){var C;(C=this.parent)==null||C.moveEditorInDOM(this)}_setParentAndPosition(C,$,it){C.changeParent(this),this.x=$,this.y=it,this.fixAndSetPosition()}getRect(C,$){const it=this.parentScale,[w,i]=this.pageDimensions,[s,p]=this.pageTranslation,F=C/it,L=$/it,I=this.x*w,q=this.y*i,tt=this.width*w,pt=this.height*i;switch(this.rotation){case 0:return[I+F+s,i-q-L-pt+p,I+F+tt+s,i-q-L+p];case 90:return[I+L+s,i-q+F+p,I+L+pt+s,i-q+F+tt+p];case 180:return[I-F-tt+s,i-q+L+p,I-F+s,i-q+L+pt+p];case 270:return[I-L-pt+s,i-q-F-tt+p,I-L+s,i-q-F+p];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(C,$){const[it,w,i,s]=C,p=i-it,F=s-w;switch(this.rotation){case 0:return[it,$-s,p,F];case 90:return[it,$-w,F,p];case 180:return[i,$-w,p,F];case 270:return[i,$-s,F,p];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){ot(this,D,!0)}disableEditMode(){ot(this,D,!1)}isInEditMode(){return t(this,D)}shouldGetKeyboardEvents(){return!1}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){var C,$;(C=this.div)==null||C.addEventListener("focusin",t(this,S)),($=this.div)==null||$.addEventListener("focusout",t(this,g))}serialize(C=!1,$=null){(0,f.unreachable)("An editor must be serializable")}static deserialize(C,$,it){const w=new this.prototype.constructor({parent:$,id:$.getNextId(),uiManager:it});w.rotation=C.rotation;const[i,s]=w.pageDimensions,[p,F,L,I]=w.getRectInCurrentCoords(C.rect,s);return w.x=p/i,w.y=F/s,w.width=L/i,w.height=I/s,w}remove(){var C;this.div.removeEventListener("focusin",t(this,S)),this.div.removeEventListener("focusout",t(this,g)),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),(C=t(this,m))==null||C.remove(),ot(this,m,null),ot(this,B,null)}get isResizable(){return!1}makeResizable(){this.isResizable&&(J(this,d,An).call(this),t(this,_).classList.remove("hidden"))}select(){var C;this.makeResizable(),(C=this.div)==null||C.classList.add("selectedEditor")}unselect(){var C,$,it;(C=t(this,_))==null||C.classList.add("hidden"),($=this.div)==null||$.classList.remove("selectedEditor"),(it=this.div)!=null&&it.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus()}updateParams(C,$){}disableEditing(){t(this,m)&&(t(this,m).hidden=!0)}enableEditing(){t(this,m)&&(t(this,m).hidden=!1)}enterInEditMode(){}get contentDiv(){return this.div}get isEditing(){return t(this,y)}set isEditing(C){ot(this,y,C),this.parent&&(C?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(C,$){ot(this,A,!0);const it=C/$,{style:w}=this.div;w.aspectRatio=it,w.height="auto"}static get MIN_SIZE(){return 16}};R=new WeakMap,T=new WeakMap,m=new WeakMap,B=new WeakMap,j=new WeakMap,A=new WeakMap,_=new WeakMap,S=new WeakMap,g=new WeakMap,u=new WeakMap,y=new WeakMap,D=new WeakMap,v=new WeakMap,o=new WeakMap,d=new WeakSet,Oe=function([C,$],it,w){[it,w]=this.screenToPageTranslation(it,w),this.x+=it/C,this.y+=w/$,this.fixAndSetPosition()},Ne=function(){const[C,$]=this.parentDimensions,{_borderLineWidth:it}=W,w=it/C,i=it/$;switch(this.rotation){case 90:return[-w,i];case 180:return[w,i];case 270:return[w,-i];default:return[-w,-i]}},h=new WeakSet,je=function(C,$,it){switch(it){case 90:return[$,-C];case 180:return[-C,-$];case 270:return[-$,C];default:return[C,$]}},Be=function(C){switch(C){case 90:{const[$,it]=this.pageDimensions;return[0,-$/it,it/$,0]}case 180:return[-1,0,0,-1];case 270:{const[$,it]=this.pageDimensions;return[0,$/it,-it/$,0]}default:return[1,0,0,1]}},An=function(){if(t(this,_))return;ot(this,_,document.createElement("div")),t(this,_).classList.add("resizers");const C=["topLeft","topRight","bottomRight","bottomLeft"];this._willKeepAspectRatio||C.push("topMiddle","middleRight","bottomMiddle","middleLeft");for(const $ of C){const it=document.createElement("div");t(this,_).append(it),it.classList.add("resizer",$),it.addEventListener("pointerdown",J(this,d,yn).bind(this,$)),it.addEventListener("contextmenu",X.noContextMenu)}this.div.prepend(t(this,_))},yn=function(C,$){$.preventDefault();const{isMac:it}=f.FeatureTest.platform;if($.button!==0||$.ctrlKey&&it)return;const w=J(this,d,vn).bind(this,C),i=this._isDraggable;this._isDraggable=!1;const s={passive:!0,capture:!0};window.addEventListener("pointermove",w,s);const p=this.x,F=this.y,L=this.width,I=this.height,q=this.parent.div.style.cursor,tt=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle($.target).cursor;const pt=()=>{this._isDraggable=i,window.removeEventListener("pointerup",pt),window.removeEventListener("blur",pt),window.removeEventListener("pointermove",w,s),this.parent.div.style.cursor=q,this.div.style.cursor=tt;const gt=this.x,bt=this.y,At=this.width,yt=this.height;gt===p&&bt===F&&At===L&&yt===I||this.addCommands({cmd:()=>{this.width=At,this.height=yt,this.x=gt,this.y=bt;const[Y,nt]=this.parentDimensions;this.setDims(Y*At,nt*yt),this.fixAndSetPosition()},undo:()=>{this.width=L,this.height=I,this.x=p,this.y=F;const[Y,nt]=this.parentDimensions;this.setDims(Y*L,nt*I),this.fixAndSetPosition()},mustExec:!0})};window.addEventListener("pointerup",pt),window.addEventListener("blur",pt)},vn=function(C,$){const[it,w]=this.parentDimensions,i=this.x,s=this.y,p=this.width,F=this.height,L=W.MIN_SIZE/it,I=W.MIN_SIZE/w,q=kt=>Math.round(kt*1e4)/1e4,tt=J(this,d,Be).call(this,this.rotation),pt=(kt,jt)=>[tt[0]*kt+tt[2]*jt,tt[1]*kt+tt[3]*jt],gt=J(this,d,Be).call(this,360-this.rotation),bt=(kt,jt)=>[gt[0]*kt+gt[2]*jt,gt[1]*kt+gt[3]*jt];let At,yt,Y=!1,nt=!1;switch(C){case"topLeft":Y=!0,At=(kt,jt)=>[0,0],yt=(kt,jt)=>[kt,jt];break;case"topMiddle":At=(kt,jt)=>[kt/2,0],yt=(kt,jt)=>[kt/2,jt];break;case"topRight":Y=!0,At=(kt,jt)=>[kt,0],yt=(kt,jt)=>[0,jt];break;case"middleRight":nt=!0,At=(kt,jt)=>[kt,jt/2],yt=(kt,jt)=>[0,jt/2];break;case"bottomRight":Y=!0,At=(kt,jt)=>[kt,jt],yt=(kt,jt)=>[0,0];break;case"bottomMiddle":At=(kt,jt)=>[kt/2,jt],yt=(kt,jt)=>[kt/2,0];break;case"bottomLeft":Y=!0,At=(kt,jt)=>[0,jt],yt=(kt,jt)=>[kt,0];break;case"middleLeft":nt=!0,At=(kt,jt)=>[0,jt/2],yt=(kt,jt)=>[kt,jt/2];break}const b=At(p,F),O=yt(p,F);let K=pt(...O);const st=q(i+K[0]),mt=q(s+K[1]);let wt=1,vt=1,[Z,Ct]=this.screenToPageTranslation($.movementX,$.movementY);if([Z,Ct]=bt(Z/it,Ct/w),Y){const kt=Math.hypot(p,F);wt=vt=Math.max(Math.min(Math.hypot(O[0]-b[0]-Z,O[1]-b[1]-Ct)/kt,1/p,1/F),L/p,I/F)}else nt?wt=Math.max(L,Math.min(1,Math.abs(O[0]-b[0]-Z)))/p:vt=Math.max(I,Math.min(1,Math.abs(O[1]-b[1]-Ct)))/F;const Tt=q(p*wt),Wt=q(F*vt);K=pt(...yt(Tt,Wt));const Ut=st-K[0],Xt=mt-K[1];this.width=Tt,this.height=Wt,this.x=Ut,this.y=Xt,this.setDims(it*Tt,w*Wt),this.fixAndSetPosition()},Ue=async function(){var it;const C=t(this,m);if(!C)return;if(!t(this,R)&&!t(this,T)){C.classList.remove("done"),(it=t(this,B))==null||it.remove();return}W._l10nPromise.get("editor_alt_text_edit_button_label").then(w=>{C.setAttribute("aria-label",w)});let $=t(this,B);if(!$){ot(this,B,$=document.createElement("span")),$.className="tooltip",$.setAttribute("role","tooltip");const w=$.id=`alt-text-tooltip-${this.id}`;C.setAttribute("aria-describedby",w);const i=100;C.addEventListener("mouseenter",()=>{ot(this,j,setTimeout(()=>{ot(this,j,null),t(this,B).classList.add("show"),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",subtype:this.editorType,data:{action:"alt_text_tooltip"}}})},i))}),C.addEventListener("mouseleave",()=>{var s;clearTimeout(t(this,j)),ot(this,j,null),(s=t(this,B))==null||s.classList.remove("show")})}C.classList.add("done"),$.innerText=t(this,T)?await W._l10nPromise.get("editor_alt_text_decorative_tooltip"):t(this,R),$.parentNode||C.append($)},En=function(C){if(!this._isDraggable)return;const $=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let it,w;$&&(it={passive:!0,capture:!0},w=s=>{const[p,F]=this.screenToPageTranslation(s.movementX,s.movementY);this._uiManager.dragSelectedEditors(p,F)},window.addEventListener("pointermove",w,it));const i=()=>{if(window.removeEventListener("pointerup",i),window.removeEventListener("blur",i),$&&window.removeEventListener("pointermove",w,it),ot(this,u,!1),!this._uiManager.endDragSession()){const{isMac:s}=f.FeatureTest.platform;C.ctrlKey&&!s||C.shiftKey||C.metaKey&&s?this.parent.toggleSelected(this):this.parent.setSelected(this)}};window.addEventListener("pointerup",i),window.addEventListener("blur",i)},rt(W,h),Qt(W,"_borderLineWidth",-1),Qt(W,"_colorManager",new n.ColorManager),Qt(W,"_zIndex",1),Qt(W,"SMALL_EDITOR_SIZE",0);let G=W;e.AnnotationEditor=G;class ut extends G{constructor(C){super(C),this.annotationElementId=C.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}},(M,e,H)=>{var A,_,S,g,u,He,v,o,d,l,c,Sn,a,E,P,et,V,Q,W,lt,C,$,it,w,i,s,p,F,L,I,q,tt,pt,gt,bt,At,yt,Y,nt,b,O,K,st,mt,wt,vt,Z,wn,We,Ge,Ee,Ve,$e,ee,fe,xn,Tn,ze,pe,Xe;Object.defineProperty(e,"__esModule",{value:!0}),e.KeyboardManager=e.CommandManager=e.ColorManager=e.AnnotationEditorUIManager=void 0,e.bindEvents=X,e.opacityToHex=G;var n=H(1),f=H(6);function X(zt,U,_t){for(const Pt of _t)U.addEventListener(Pt,zt[Pt].bind(zt))}function G(zt){return Math.round(Math.min(255,Math.max(1,255*zt))).toString(16).padStart(2,"0")}class ut{constructor(){rt(this,A,0)}getId(){return`${n.AnnotationEditorPrefix}${ue(this,A)._++}`}}A=new WeakMap;const D=class D{constructor(){rt(this,u);rt(this,_,(0,n.getUuid)());rt(this,S,0);rt(this,g,null)}static get _isSVGFittingCanvas(){const U='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',Pt=new OffscreenCanvas(1,3).getContext("2d"),It=new Image;It.src=U;const Bt=It.decode().then(()=>(Pt.drawImage(It,0,0,1,1,0,0,1,3),new Uint32Array(Pt.getImageData(0,0,1,1).data.buffer)[0]===0));return(0,n.shadow)(this,"_isSVGFittingCanvas",Bt)}async getFromFile(U){const{lastModified:_t,name:Pt,size:It,type:Bt}=U;return J(this,u,He).call(this,`${_t}_${Pt}_${It}_${Bt}`,U)}async getFromUrl(U){return J(this,u,He).call(this,U,U)}async getFromId(U){t(this,g)||ot(this,g,new Map);const _t=t(this,g).get(U);return _t?_t.bitmap?(_t.refCounter+=1,_t):_t.file?this.getFromFile(_t.file):this.getFromUrl(_t.url):null}getSvgUrl(U){const _t=t(this,g).get(U);return _t!=null&&_t.isSvg?_t.svgUrl:null}deleteId(U){t(this,g)||ot(this,g,new Map);const _t=t(this,g).get(U);_t&&(_t.refCounter-=1,_t.refCounter===0&&(_t.bitmap=null))}isValidId(U){return U.startsWith(`image_${t(this,_)}_`)}};_=new WeakMap,S=new WeakMap,g=new WeakMap,u=new WeakSet,He=async function(U,_t){t(this,g)||ot(this,g,new Map);let Pt=t(this,g).get(U);if(Pt===null)return null;if(Pt!=null&&Pt.bitmap)return Pt.refCounter+=1,Pt;try{Pt||(Pt={bitmap:null,id:`image_${t(this,_)}_${ue(this,S)._++}`,refCounter:0,isSvg:!1});let It;if(typeof _t=="string"){Pt.url=_t;const Bt=await fetch(_t);if(!Bt.ok)throw new Error(Bt.statusText);It=await Bt.blob()}else It=Pt.file=_t;if(It.type==="image/svg+xml"){const Bt=D._isSVGFittingCanvas,Ft=new FileReader,k=new Image,x=new Promise((z,ht)=>{k.onload=()=>{Pt.bitmap=k,Pt.isSvg=!0,z()},Ft.onload=async()=>{const ft=Pt.svgUrl=Ft.result;k.src=await Bt?`${ft}#svgView(preserveAspectRatio(none))`:ft},k.onerror=Ft.onerror=ht});Ft.readAsDataURL(It),await x}else Pt.bitmap=await createImageBitmap(It);Pt.refCounter=1}catch(It){console.error(It),Pt=null}return t(this,g).set(U,Pt),Pt&&t(this,g).set(Pt.id,Pt),Pt};let R=D;class T{constructor(U=128){rt(this,v,[]);rt(this,o,!1);rt(this,d);rt(this,l,-1);ot(this,d,U)}add({cmd:U,undo:_t,mustExec:Pt,type:It=NaN,overwriteIfSameType:Bt=!1,keepUndo:Ft=!1}){if(Pt&&U(),t(this,o))return;const k={cmd:U,undo:_t,type:It};if(t(this,l)===-1){t(this,v).length>0&&(t(this,v).length=0),ot(this,l,0),t(this,v).push(k);return}if(Bt&&t(this,v)[t(this,l)].type===It){Ft&&(k.undo=t(this,v)[t(this,l)].undo),t(this,v)[t(this,l)]=k;return}const x=t(this,l)+1;x===t(this,d)?t(this,v).splice(0,1):(ot(this,l,x),x<t(this,v).length&&t(this,v).splice(x)),t(this,v).push(k)}undo(){t(this,l)!==-1&&(ot(this,o,!0),t(this,v)[t(this,l)].undo(),ot(this,o,!1),ot(this,l,t(this,l)-1))}redo(){t(this,l)<t(this,v).length-1&&(ot(this,l,t(this,l)+1),ot(this,o,!0),t(this,v)[t(this,l)].cmd(),ot(this,o,!1))}hasSomethingToUndo(){return t(this,l)!==-1}hasSomethingToRedo(){return t(this,l)<t(this,v).length-1}destroy(){ot(this,v,null)}}v=new WeakMap,o=new WeakMap,d=new WeakMap,l=new WeakMap,e.CommandManager=T;class m{constructor(U){rt(this,c);this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:_t}=n.FeatureTest.platform;for(const[Pt,It,Bt={}]of U)for(const Ft of Pt){const k=Ft.startsWith("mac+");_t&&k?(this.callbacks.set(Ft.slice(4),{callback:It,options:Bt}),this.allKeys.add(Ft.split("+").at(-1))):!_t&&!k&&(this.callbacks.set(Ft,{callback:It,options:Bt}),this.allKeys.add(Ft.split("+").at(-1)))}}exec(U,_t){if(!this.allKeys.has(_t.key))return;const Pt=this.callbacks.get(J(this,c,Sn).call(this,_t));if(!Pt)return;const{callback:It,options:{bubbles:Bt=!1,args:Ft=[],checker:k=null}}=Pt;k&&!k(U,_t)||(It.bind(U,...Ft)(),Bt||(_t.stopPropagation(),_t.preventDefault()))}}c=new WeakSet,Sn=function(U){U.altKey&&this.buffer.push("alt"),U.ctrlKey&&this.buffer.push("ctrl"),U.metaKey&&this.buffer.push("meta"),U.shiftKey&&this.buffer.push("shift"),this.buffer.push(U.key);const _t=this.buffer.join("+");return this.buffer.length=0,_t},e.KeyboardManager=m;const N=class N{get _colors(){const U=new Map([["CanvasText",null],["Canvas",null]]);return(0,f.getColorValues)(U),(0,n.shadow)(this,"_colors",U)}convert(U){const _t=(0,f.getRGB)(U);if(!window.matchMedia("(forced-colors: active)").matches)return _t;for(const[Pt,It]of this._colors)if(It.every((Bt,Ft)=>Bt===_t[Ft]))return N._colorsMapping.get(Pt);return _t}getHexCode(U){const _t=this._colors.get(U);return _t?n.Util.makeHexColor(..._t):U}};Qt(N,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let B=N;e.ColorManager=B;const qt=class qt{constructor(U,_t,Pt,It,Bt,Ft){rt(this,Z);rt(this,a,null);rt(this,E,new Map);rt(this,P,new Map);rt(this,et,null);rt(this,V,null);rt(this,Q,new T);rt(this,W,0);rt(this,lt,new Set);rt(this,C,null);rt(this,$,null);rt(this,it,new Set);rt(this,w,null);rt(this,i,new ut);rt(this,s,!1);rt(this,p,!1);rt(this,F,null);rt(this,L,n.AnnotationEditorType.NONE);rt(this,I,new Set);rt(this,q,null);rt(this,tt,this.blur.bind(this));rt(this,pt,this.focus.bind(this));rt(this,gt,this.copy.bind(this));rt(this,bt,this.cut.bind(this));rt(this,At,this.paste.bind(this));rt(this,yt,this.keydown.bind(this));rt(this,Y,this.onEditingAction.bind(this));rt(this,nt,this.onPageChanging.bind(this));rt(this,b,this.onScaleChanging.bind(this));rt(this,O,this.onRotationChanging.bind(this));rt(this,K,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1});rt(this,st,[0,0]);rt(this,mt,null);rt(this,wt,null);rt(this,vt,null);ot(this,wt,U),ot(this,vt,_t),ot(this,et,Pt),this._eventBus=It,this._eventBus._on("editingaction",t(this,Y)),this._eventBus._on("pagechanging",t(this,nt)),this._eventBus._on("scalechanging",t(this,b)),this._eventBus._on("rotationchanging",t(this,O)),ot(this,V,Bt.annotationStorage),ot(this,w,Bt.filterFactory),ot(this,q,Ft),this.viewParameters={realScale:f.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0}}static get _keyboardManager(){const U=qt.prototype,_t=Bt=>{const{activeElement:Ft}=document;return Ft&&t(Bt,wt).contains(Ft)&&Bt.hasSomethingToControl()},Pt=this.TRANSLATE_SMALL,It=this.TRANSLATE_BIG;return(0,n.shadow)(this,"_keyboardManager",new m([[["ctrl+a","mac+meta+a"],U.selectAll],[["ctrl+z","mac+meta+z"],U.undo],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],U.redo],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],U.delete],[["Escape","mac+Escape"],U.unselectAll],[["ArrowLeft","mac+ArrowLeft"],U.translateSelectedEditors,{args:[-Pt,0],checker:_t}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],U.translateSelectedEditors,{args:[-It,0],checker:_t}],[["ArrowRight","mac+ArrowRight"],U.translateSelectedEditors,{args:[Pt,0],checker:_t}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],U.translateSelectedEditors,{args:[It,0],checker:_t}],[["ArrowUp","mac+ArrowUp"],U.translateSelectedEditors,{args:[0,-Pt],checker:_t}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],U.translateSelectedEditors,{args:[0,-It],checker:_t}],[["ArrowDown","mac+ArrowDown"],U.translateSelectedEditors,{args:[0,Pt],checker:_t}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],U.translateSelectedEditors,{args:[0,It],checker:_t}]]))}destroy(){J(this,Z,Ee).call(this),J(this,Z,We).call(this),this._eventBus._off("editingaction",t(this,Y)),this._eventBus._off("pagechanging",t(this,nt)),this._eventBus._off("scalechanging",t(this,b)),this._eventBus._off("rotationchanging",t(this,O));for(const U of t(this,P).values())U.destroy();t(this,P).clear(),t(this,E).clear(),t(this,it).clear(),ot(this,a,null),t(this,I).clear(),t(this,Q).destroy(),t(this,et).destroy()}get hcmFilter(){return(0,n.shadow)(this,"hcmFilter",t(this,q)?t(this,w).addHCMFilter(t(this,q).foreground,t(this,q).background):"none")}get direction(){return(0,n.shadow)(this,"direction",getComputedStyle(t(this,wt)).direction)}editAltText(U){var _t;(_t=t(this,et))==null||_t.editAltText(this,U)}onPageChanging({pageNumber:U}){ot(this,W,U-1)}focusMainContainer(){t(this,wt).focus()}findParent(U,_t){for(const Pt of t(this,P).values()){const{x:It,y:Bt,width:Ft,height:k}=Pt.div.getBoundingClientRect();if(U>=It&&U<=It+Ft&&_t>=Bt&&_t<=Bt+k)return Pt}return null}disableUserSelect(U=!1){t(this,vt).classList.toggle("noUserSelect",U)}addShouldRescale(U){t(this,it).add(U)}removeShouldRescale(U){t(this,it).delete(U)}onScaleChanging({scale:U}){this.commitOrRemove(),this.viewParameters.realScale=U*f.PixelsPerInch.PDF_TO_CSS_UNITS;for(const _t of t(this,it))_t.onScaleChanging()}onRotationChanging({pagesRotation:U}){this.commitOrRemove(),this.viewParameters.rotation=U}addToAnnotationStorage(U){!U.isEmpty()&&t(this,V)&&!t(this,V).has(U.id)&&t(this,V).setValue(U.id,U)}blur(){if(!this.hasSelection)return;const{activeElement:U}=document;for(const _t of t(this,I))if(_t.div.contains(U)){ot(this,F,[_t,U]),_t._focusEventsAllowed=!1;break}}focus(){if(!t(this,F))return;const[U,_t]=t(this,F);ot(this,F,null),_t.addEventListener("focusin",()=>{U._focusEventsAllowed=!0},{once:!0}),_t.focus()}addEditListeners(){J(this,Z,Ge).call(this),J(this,Z,Ve).call(this)}removeEditListeners(){J(this,Z,Ee).call(this),J(this,Z,$e).call(this)}copy(U){var Pt;if(U.preventDefault(),(Pt=t(this,a))==null||Pt.commitOrRemove(),!this.hasSelection)return;const _t=[];for(const It of t(this,I)){const Bt=It.serialize(!0);Bt&&_t.push(Bt)}_t.length!==0&&U.clipboardData.setData("application/pdfjs",JSON.stringify(_t))}cut(U){this.copy(U),this.delete()}paste(U){U.preventDefault();const{clipboardData:_t}=U;for(const Bt of _t.items)for(const Ft of t(this,$))if(Ft.isHandlingMimeForPasting(Bt.type)){Ft.paste(Bt,this.currentLayer);return}let Pt=_t.getData("application/pdfjs");if(!Pt)return;try{Pt=JSON.parse(Pt)}catch(Bt){(0,n.warn)(`paste: "${Bt.message}".`);return}if(!Array.isArray(Pt))return;this.unselectAll();const It=this.currentLayer;try{const Bt=[];for(const x of Pt){const z=It.deserialize(x);if(!z)return;Bt.push(z)}const Ft=()=>{for(const x of Bt)J(this,Z,ze).call(this,x);J(this,Z,Xe).call(this,Bt)},k=()=>{for(const x of Bt)x.remove()};this.addCommands({cmd:Ft,undo:k,mustExec:!0})}catch(Bt){(0,n.warn)(`paste: "${Bt.message}".`)}}keydown(U){var _t;(_t=this.getActive())!=null&&_t.shouldGetKeyboardEvents()||qt._keyboardManager.exec(this,U)}onEditingAction(U){["undo","redo","delete","selectAll"].includes(U.name)&&this[U.name]()}setEditingState(U){U?(J(this,Z,wn).call(this),J(this,Z,Ge).call(this),J(this,Z,Ve).call(this),J(this,Z,ee).call(this,{isEditing:t(this,L)!==n.AnnotationEditorType.NONE,isEmpty:J(this,Z,pe).call(this),hasSomethingToUndo:t(this,Q).hasSomethingToUndo(),hasSomethingToRedo:t(this,Q).hasSomethingToRedo(),hasSelectedEditor:!1})):(J(this,Z,We).call(this),J(this,Z,Ee).call(this),J(this,Z,$e).call(this),J(this,Z,ee).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(U){if(!t(this,$)){ot(this,$,U);for(const _t of t(this,$))J(this,Z,fe).call(this,_t.defaultPropertiesToUpdate)}}getId(){return t(this,i).getId()}get currentLayer(){return t(this,P).get(t(this,W))}getLayer(U){return t(this,P).get(U)}get currentPageIndex(){return t(this,W)}addLayer(U){t(this,P).set(U.pageIndex,U),t(this,s)?U.enable():U.disable()}removeLayer(U){t(this,P).delete(U.pageIndex)}updateMode(U,_t=null){if(t(this,L)!==U){if(ot(this,L,U),U===n.AnnotationEditorType.NONE){this.setEditingState(!1),J(this,Z,Tn).call(this);return}this.setEditingState(!0),J(this,Z,xn).call(this),this.unselectAll();for(const Pt of t(this,P).values())Pt.updateMode(U);if(_t){for(const Pt of t(this,E).values())if(Pt.annotationElementId===_t){this.setSelected(Pt),Pt.enterInEditMode();break}}}}updateToolbar(U){U!==t(this,L)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:U})}updateParams(U,_t){if(t(this,$)){if(U===n.AnnotationEditorParamsType.CREATE){this.currentLayer.addNewEditor(U);return}for(const Pt of t(this,I))Pt.updateParams(U,_t);for(const Pt of t(this,$))Pt.updateDefaultParams(U,_t)}}enableWaiting(U=!1){if(t(this,p)!==U){ot(this,p,U);for(const _t of t(this,P).values())U?_t.disableClick():_t.enableClick(),_t.div.classList.toggle("waiting",U)}}getEditors(U){const _t=[];for(const Pt of t(this,E).values())Pt.pageIndex===U&&_t.push(Pt);return _t}getEditor(U){return t(this,E).get(U)}addEditor(U){t(this,E).set(U.id,U)}removeEditor(U){var _t;t(this,E).delete(U.id),this.unselect(U),(!U.annotationElementId||!t(this,lt).has(U.annotationElementId))&&((_t=t(this,V))==null||_t.remove(U.id))}addDeletedAnnotationElement(U){t(this,lt).add(U.annotationElementId),U.deleted=!0}isDeletedAnnotationElement(U){return t(this,lt).has(U)}removeDeletedAnnotationElement(U){t(this,lt).delete(U.annotationElementId),U.deleted=!1}setActiveEditor(U){t(this,a)!==U&&(ot(this,a,U),U&&J(this,Z,fe).call(this,U.propertiesToUpdate))}toggleSelected(U){if(t(this,I).has(U)){t(this,I).delete(U),U.unselect(),J(this,Z,ee).call(this,{hasSelectedEditor:this.hasSelection});return}t(this,I).add(U),U.select(),J(this,Z,fe).call(this,U.propertiesToUpdate),J(this,Z,ee).call(this,{hasSelectedEditor:!0})}setSelected(U){for(const _t of t(this,I))_t!==U&&_t.unselect();t(this,I).clear(),t(this,I).add(U),U.select(),J(this,Z,fe).call(this,U.propertiesToUpdate),J(this,Z,ee).call(this,{hasSelectedEditor:!0})}isSelected(U){return t(this,I).has(U)}unselect(U){U.unselect(),t(this,I).delete(U),J(this,Z,ee).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return t(this,I).size!==0}undo(){t(this,Q).undo(),J(this,Z,ee).call(this,{hasSomethingToUndo:t(this,Q).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:J(this,Z,pe).call(this)})}redo(){t(this,Q).redo(),J(this,Z,ee).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:t(this,Q).hasSomethingToRedo(),isEmpty:J(this,Z,pe).call(this)})}addCommands(U){t(this,Q).add(U),J(this,Z,ee).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:J(this,Z,pe).call(this)})}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const U=[...t(this,I)],_t=()=>{for(const It of U)It.remove()},Pt=()=>{for(const It of U)J(this,Z,ze).call(this,It)};this.addCommands({cmd:_t,undo:Pt,mustExec:!0})}commitOrRemove(){var U;(U=t(this,a))==null||U.commitOrRemove()}hasSomethingToControl(){return t(this,a)||this.hasSelection}selectAll(){for(const U of t(this,I))U.commit();J(this,Z,Xe).call(this,t(this,E).values())}unselectAll(){if(t(this,a)){t(this,a).commitOrRemove();return}if(this.hasSelection){for(const U of t(this,I))U.unselect();t(this,I).clear(),J(this,Z,ee).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(U,_t,Pt=!1){if(Pt||this.commitOrRemove(),!this.hasSelection)return;t(this,st)[0]+=U,t(this,st)[1]+=_t;const[It,Bt]=t(this,st),Ft=[...t(this,I)],k=1e3;t(this,mt)&&clearTimeout(t(this,mt)),ot(this,mt,setTimeout(()=>{ot(this,mt,null),t(this,st)[0]=t(this,st)[1]=0,this.addCommands({cmd:()=>{for(const x of Ft)t(this,E).has(x.id)&&x.translateInPage(It,Bt)},undo:()=>{for(const x of Ft)t(this,E).has(x.id)&&x.translateInPage(-It,-Bt)},mustExec:!1})},k));for(const x of Ft)x.translateInPage(U,_t)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),ot(this,C,new Map);for(const U of t(this,I))t(this,C).set(U,{savedX:U.x,savedY:U.y,savedPageIndex:U.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!t(this,C))return!1;this.disableUserSelect(!1);const U=t(this,C);ot(this,C,null);let _t=!1;for(const[{x:It,y:Bt,pageIndex:Ft},k]of U)k.newX=It,k.newY=Bt,k.newPageIndex=Ft,_t||(_t=It!==k.savedX||Bt!==k.savedY||Ft!==k.savedPageIndex);if(!_t)return!1;const Pt=(It,Bt,Ft,k)=>{if(t(this,E).has(It.id)){const x=t(this,P).get(k);x?It._setParentAndPosition(x,Bt,Ft):(It.pageIndex=k,It.x=Bt,It.y=Ft)}};return this.addCommands({cmd:()=>{for(const[It,{newX:Bt,newY:Ft,newPageIndex:k}]of U)Pt(It,Bt,Ft,k)},undo:()=>{for(const[It,{savedX:Bt,savedY:Ft,savedPageIndex:k}]of U)Pt(It,Bt,Ft,k)},mustExec:!0}),!0}dragSelectedEditors(U,_t){if(t(this,C))for(const Pt of t(this,C).keys())Pt.drag(U,_t)}rebuild(U){if(U.parent===null){const _t=this.getLayer(U.pageIndex);_t?(_t.changeParent(U),_t.addOrRebuild(U)):(this.addEditor(U),this.addToAnnotationStorage(U),U.rebuild())}else U.parent.addOrRebuild(U)}isActive(U){return t(this,a)===U}getActive(){return t(this,a)}getMode(){return t(this,L)}get imageManager(){return(0,n.shadow)(this,"imageManager",new R)}};a=new WeakMap,E=new WeakMap,P=new WeakMap,et=new WeakMap,V=new WeakMap,Q=new WeakMap,W=new WeakMap,lt=new WeakMap,C=new WeakMap,$=new WeakMap,it=new WeakMap,w=new WeakMap,i=new WeakMap,s=new WeakMap,p=new WeakMap,F=new WeakMap,L=new WeakMap,I=new WeakMap,q=new WeakMap,tt=new WeakMap,pt=new WeakMap,gt=new WeakMap,bt=new WeakMap,At=new WeakMap,yt=new WeakMap,Y=new WeakMap,nt=new WeakMap,b=new WeakMap,O=new WeakMap,K=new WeakMap,st=new WeakMap,mt=new WeakMap,wt=new WeakMap,vt=new WeakMap,Z=new WeakSet,wn=function(){window.addEventListener("focus",t(this,pt)),window.addEventListener("blur",t(this,tt))},We=function(){window.removeEventListener("focus",t(this,pt)),window.removeEventListener("blur",t(this,tt))},Ge=function(){window.addEventListener("keydown",t(this,yt),{capture:!0})},Ee=function(){window.removeEventListener("keydown",t(this,yt),{capture:!0})},Ve=function(){document.addEventListener("copy",t(this,gt)),document.addEventListener("cut",t(this,bt)),document.addEventListener("paste",t(this,At))},$e=function(){document.removeEventListener("copy",t(this,gt)),document.removeEventListener("cut",t(this,bt)),document.removeEventListener("paste",t(this,At))},ee=function(U){Object.entries(U).some(([Pt,It])=>t(this,K)[Pt]!==It)&&this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(t(this,K),U)})},fe=function(U){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:U})},xn=function(){if(!t(this,s)){ot(this,s,!0);for(const U of t(this,P).values())U.enable()}},Tn=function(){if(this.unselectAll(),t(this,s)){ot(this,s,!1);for(const U of t(this,P).values())U.disable()}},ze=function(U){const _t=t(this,P).get(U.pageIndex);_t?_t.addOrRebuild(U):this.addEditor(U)},pe=function(){if(t(this,E).size===0)return!0;if(t(this,E).size===1)for(const U of t(this,E).values())return U.isEmpty();return!1},Xe=function(U){t(this,I).clear();for(const _t of U)_t.isEmpty()||(t(this,I).add(_t),_t.select());J(this,Z,ee).call(this,{hasSelectedEditor:!0})},Qt(qt,"TRANSLATE_SMALL",1),Qt(qt,"TRANSLATE_BIG",10);let j=qt;e.AnnotationEditorUIManager=j},(M,e,H)=>{var W,lt,C,$,it,w,i,s,p,F,L,I,le,ce,qe,Se,we,ge,me;Object.defineProperty(e,"__esModule",{value:!0}),e.StatTimer=e.RenderingCancelledException=e.PixelsPerInch=e.PageViewport=e.PDFDateString=e.DOMStandardFontDataFactory=e.DOMSVGFactory=e.DOMFilterFactory=e.DOMCanvasFactory=e.DOMCMapReaderFactory=void 0,e.deprecated=l,e.getColorValues=E,e.getCurrentTransform=P,e.getCurrentTransformInverse=et,e.getFilenameFromUrl=u,e.getPdfFilenameFromUrl=y,e.getRGB=a,e.getXfaPageViewport=N,e.isDataScheme=S,e.isPdfFile=g,e.isValidFetchUrl=v,e.loadScript=d,e.noContextMenu=o,e.setLayerDimensions=V;var n=H(7),f=H(1);const X="http://www.w3.org/2000/svg",Q=class Q{};Qt(Q,"CSS",96),Qt(Q,"PDF",72),Qt(Q,"PDF_TO_CSS_UNITS",Q.CSS/Q.PDF);let G=Q;e.PixelsPerInch=G;class ut extends n.BaseFilterFactory{constructor({docId:b,ownerDocument:O=globalThis.document}={}){super();rt(this,I);rt(this,W);rt(this,lt);rt(this,C);rt(this,$);rt(this,it);rt(this,w);rt(this,i);rt(this,s);rt(this,p);rt(this,F);rt(this,L,0);ot(this,C,b),ot(this,$,O)}addFilter(b){if(!b)return"none";let O=t(this,I,le).get(b);if(O)return O;let K,st,mt,wt;if(b.length===1){const Tt=b[0],Wt=new Array(256);for(let Ut=0;Ut<256;Ut++)Wt[Ut]=Tt[Ut]/255;wt=K=st=mt=Wt.join(",")}else{const[Tt,Wt,Ut]=b,Xt=new Array(256),kt=new Array(256),jt=new Array(256);for(let Vt=0;Vt<256;Vt++)Xt[Vt]=Tt[Vt]/255,kt[Vt]=Wt[Vt]/255,jt[Vt]=Ut[Vt]/255;K=Xt.join(","),st=kt.join(","),mt=jt.join(","),wt=`${K}${st}${mt}`}if(O=t(this,I,le).get(wt),O)return t(this,I,le).set(b,O),O;const vt=`g_${t(this,C)}_transfer_map_${ue(this,L)._++}`,Z=`url(#${vt})`;t(this,I,le).set(b,Z),t(this,I,le).set(wt,Z);const Ct=J(this,I,Se).call(this,vt);return J(this,I,ge).call(this,K,st,mt,Ct),Z}addHCMFilter(b,O){var Wt;const K=`${b}-${O}`;if(t(this,w)===K)return t(this,i);if(ot(this,w,K),ot(this,i,"none"),(Wt=t(this,it))==null||Wt.remove(),!b||!O)return t(this,i);const st=J(this,I,me).call(this,b);b=f.Util.makeHexColor(...st);const mt=J(this,I,me).call(this,O);if(O=f.Util.makeHexColor(...mt),t(this,I,ce).style.color="",b==="#000000"&&O==="#ffffff"||b===O)return t(this,i);const wt=new Array(256);for(let Ut=0;Ut<=255;Ut++){const Xt=Ut/255;wt[Ut]=Xt<=.03928?Xt/12.92:((Xt+.055)/1.055)**2.4}const vt=wt.join(","),Z=`g_${t(this,C)}_hcm_filter`,Ct=ot(this,s,J(this,I,Se).call(this,Z));J(this,I,ge).call(this,vt,vt,vt,Ct),J(this,I,qe).call(this,Ct);const Tt=(Ut,Xt)=>{const kt=st[Ut]/255,jt=mt[Ut]/255,Vt=new Array(Xt+1);for(let Kt=0;Kt<=Xt;Kt++)Vt[Kt]=kt+Kt/Xt*(jt-kt);return Vt.join(",")};return J(this,I,ge).call(this,Tt(0,5),Tt(1,5),Tt(2,5),Ct),ot(this,i,`url(#${Z})`),t(this,i)}addHighlightHCMFilter(b,O,K,st){var jt;const mt=`${b}-${O}-${K}-${st}`;if(t(this,p)===mt)return t(this,F);if(ot(this,p,mt),ot(this,F,"none"),(jt=t(this,s))==null||jt.remove(),!b||!O)return t(this,F);const[wt,vt]=[b,O].map(J(this,I,me).bind(this));let Z=Math.round(.2126*wt[0]+.7152*wt[1]+.0722*wt[2]),Ct=Math.round(.2126*vt[0]+.7152*vt[1]+.0722*vt[2]),[Tt,Wt]=[K,st].map(J(this,I,me).bind(this));Ct<Z&&([Z,Ct,Tt,Wt]=[Ct,Z,Wt,Tt]),t(this,I,ce).style.color="";const Ut=(Vt,Kt,St)=>{const at=new Array(256),ct=(Ct-Z)/St,Mt=Vt/255,qt=(Kt-Vt)/(255*St);let zt=0;for(let U=0;U<=St;U++){const _t=Math.round(Z+U*ct),Pt=Mt+U*qt;for(let It=zt;It<=_t;It++)at[It]=Pt;zt=_t+1}for(let U=zt;U<256;U++)at[U]=at[zt-1];return at.join(",")},Xt=`g_${t(this,C)}_hcm_highlight_filter`,kt=ot(this,s,J(this,I,Se).call(this,Xt));return J(this,I,qe).call(this,kt),J(this,I,ge).call(this,Ut(Tt[0],Wt[0],5),Ut(Tt[1],Wt[1],5),Ut(Tt[2],Wt[2],5),kt),ot(this,F,`url(#${Xt})`),t(this,F)}destroy(b=!1){b&&(t(this,i)||t(this,F))||(t(this,lt)&&(t(this,lt).parentNode.parentNode.remove(),ot(this,lt,null)),t(this,W)&&(t(this,W).clear(),ot(this,W,null)),ot(this,L,0))}}W=new WeakMap,lt=new WeakMap,C=new WeakMap,$=new WeakMap,it=new WeakMap,w=new WeakMap,i=new WeakMap,s=new WeakMap,p=new WeakMap,F=new WeakMap,L=new WeakMap,I=new WeakSet,le=function(){return t(this,W)||ot(this,W,new Map)},ce=function(){if(!t(this,lt)){const b=t(this,$).createElement("div"),{style:O}=b;O.visibility="hidden",O.contain="strict",O.width=O.height=0,O.position="absolute",O.top=O.left=0,O.zIndex=-1;const K=t(this,$).createElementNS(X,"svg");K.setAttribute("width",0),K.setAttribute("height",0),ot(this,lt,t(this,$).createElementNS(X,"defs")),b.append(K),K.append(t(this,lt)),t(this,$).body.append(b)}return t(this,lt)},qe=function(b){const O=t(this,$).createElementNS(X,"feColorMatrix");O.setAttribute("type","matrix"),O.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),b.append(O)},Se=function(b){const O=t(this,$).createElementNS(X,"filter");return O.setAttribute("color-interpolation-filters","sRGB"),O.setAttribute("id",b),t(this,I,ce).append(O),O},we=function(b,O,K){const st=t(this,$).createElementNS(X,O);st.setAttribute("type","discrete"),st.setAttribute("tableValues",K),b.append(st)},ge=function(b,O,K,st){const mt=t(this,$).createElementNS(X,"feComponentTransfer");st.append(mt),J(this,I,we).call(this,mt,"feFuncR",b),J(this,I,we).call(this,mt,"feFuncG",O),J(this,I,we).call(this,mt,"feFuncB",K)},me=function(b){return t(this,I,ce).style.color=b,a(getComputedStyle(t(this,I,ce)).getPropertyValue("color"))},e.DOMFilterFactory=ut;class R extends n.BaseCanvasFactory{constructor({ownerDocument:nt=globalThis.document}={}){super(),this._document=nt}_createCanvas(nt,b){const O=this._document.createElement("canvas");return O.width=nt,O.height=b,O}}e.DOMCanvasFactory=R;async function T(Y,nt=!1){if(v(Y,document.baseURI)){const b=await fetch(Y);if(!b.ok)throw new Error(b.statusText);return nt?new Uint8Array(await b.arrayBuffer()):(0,f.stringToBytes)(await b.text())}return new Promise((b,O)=>{const K=new XMLHttpRequest;K.open("GET",Y,!0),nt&&(K.responseType="arraybuffer"),K.onreadystatechange=()=>{if(K.readyState===XMLHttpRequest.DONE){if(K.status===200||K.status===0){let st;if(nt&&K.response?st=new Uint8Array(K.response):!nt&&K.responseText&&(st=(0,f.stringToBytes)(K.responseText)),st){b(st);return}}O(new Error(K.statusText))}},K.send(null)})}class m extends n.BaseCMapReaderFactory{_fetchData(nt,b){return T(nt,this.isCompressed).then(O=>({cMapData:O,compressionType:b}))}}e.DOMCMapReaderFactory=m;class B extends n.BaseStandardFontDataFactory{_fetchData(nt){return T(nt,!0)}}e.DOMStandardFontDataFactory=B;class j extends n.BaseSVGFactory{_createSVG(nt){return document.createElementNS(X,nt)}}e.DOMSVGFactory=j;class A{constructor({viewBox:nt,scale:b,rotation:O,offsetX:K=0,offsetY:st=0,dontFlip:mt=!1}){this.viewBox=nt,this.scale=b,this.rotation=O,this.offsetX=K,this.offsetY=st;const wt=(nt[2]+nt[0])/2,vt=(nt[3]+nt[1])/2;let Z,Ct,Tt,Wt;switch(O%=360,O<0&&(O+=360),O){case 180:Z=-1,Ct=0,Tt=0,Wt=1;break;case 90:Z=0,Ct=1,Tt=1,Wt=0;break;case 270:Z=0,Ct=-1,Tt=-1,Wt=0;break;case 0:Z=1,Ct=0,Tt=0,Wt=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}mt&&(Tt=-Tt,Wt=-Wt);let Ut,Xt,kt,jt;Z===0?(Ut=Math.abs(vt-nt[1])*b+K,Xt=Math.abs(wt-nt[0])*b+st,kt=(nt[3]-nt[1])*b,jt=(nt[2]-nt[0])*b):(Ut=Math.abs(wt-nt[0])*b+K,Xt=Math.abs(vt-nt[1])*b+st,kt=(nt[2]-nt[0])*b,jt=(nt[3]-nt[1])*b),this.transform=[Z*b,Ct*b,Tt*b,Wt*b,Ut-Z*b*wt-Tt*b*vt,Xt-Ct*b*wt-Wt*b*vt],this.width=kt,this.height=jt}get rawDims(){const{viewBox:nt}=this;return(0,f.shadow)(this,"rawDims",{pageWidth:nt[2]-nt[0],pageHeight:nt[3]-nt[1],pageX:nt[0],pageY:nt[1]})}clone({scale:nt=this.scale,rotation:b=this.rotation,offsetX:O=this.offsetX,offsetY:K=this.offsetY,dontFlip:st=!1}={}){return new A({viewBox:this.viewBox.slice(),scale:nt,rotation:b,offsetX:O,offsetY:K,dontFlip:st})}convertToViewportPoint(nt,b){return f.Util.applyTransform([nt,b],this.transform)}convertToViewportRectangle(nt){const b=f.Util.applyTransform([nt[0],nt[1]],this.transform),O=f.Util.applyTransform([nt[2],nt[3]],this.transform);return[b[0],b[1],O[0],O[1]]}convertToPdfPoint(nt,b){return f.Util.applyInverseTransform([nt,b],this.transform)}}e.PageViewport=A;class _ extends f.BaseException{constructor(nt,b=0){super(nt,"RenderingCancelledException"),this.extraDelay=b}}e.RenderingCancelledException=_;function S(Y){const nt=Y.length;let b=0;for(;b<nt&&Y[b].trim()==="";)b++;return Y.substring(b,b+5).toLowerCase()==="data:"}function g(Y){return typeof Y=="string"&&/\.pdf$/i.test(Y)}function u(Y,nt=!1){return nt||([Y]=Y.split(/[#?]/,1)),Y.substring(Y.lastIndexOf("/")+1)}function y(Y,nt="document.pdf"){if(typeof Y!="string")return nt;if(S(Y))return(0,f.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),nt;const b=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,O=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,K=b.exec(Y);let st=O.exec(K[1])||O.exec(K[2])||O.exec(K[3]);if(st&&(st=st[0],st.includes("%")))try{st=O.exec(decodeURIComponent(st))[0]}catch{}return st||nt}class D{constructor(){Qt(this,"started",Object.create(null));Qt(this,"times",[])}time(nt){nt in this.started&&(0,f.warn)(`Timer is already running for ${nt}`),this.started[nt]=Date.now()}timeEnd(nt){nt in this.started||(0,f.warn)(`Timer has not been started for ${nt}`),this.times.push({name:nt,start:this.started[nt],end:Date.now()}),delete this.started[nt]}toString(){const nt=[];let b=0;for(const{name:O}of this.times)b=Math.max(O.length,b);for(const{name:O,start:K,end:st}of this.times)nt.push(`${O.padEnd(b)} ${st-K}ms
`);return nt.join("")}}e.StatTimer=D;function v(Y,nt){try{const{protocol:b}=nt?new URL(Y,nt):new URL(Y);return b==="http:"||b==="https:"}catch{return!1}}function o(Y){Y.preventDefault()}function d(Y,nt=!1){return new Promise((b,O)=>{const K=document.createElement("script");K.src=Y,K.onload=function(st){nt&&K.remove(),b(st)},K.onerror=function(){O(new Error(`Cannot load script at: ${K.src}`))},(document.head||document.documentElement).append(K)})}function l(Y){console.log("Deprecated API usage: "+Y)}let c;class h{static toDateObject(nt){if(!nt||typeof nt!="string")return null;c||(c=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const b=c.exec(nt);if(!b)return null;const O=parseInt(b[1],10);let K=parseInt(b[2],10);K=K>=1&&K<=12?K-1:0;let st=parseInt(b[3],10);st=st>=1&&st<=31?st:1;let mt=parseInt(b[4],10);mt=mt>=0&&mt<=23?mt:0;let wt=parseInt(b[5],10);wt=wt>=0&&wt<=59?wt:0;let vt=parseInt(b[6],10);vt=vt>=0&&vt<=59?vt:0;const Z=b[7]||"Z";let Ct=parseInt(b[8],10);Ct=Ct>=0&&Ct<=23?Ct:0;let Tt=parseInt(b[9],10)||0;return Tt=Tt>=0&&Tt<=59?Tt:0,Z==="-"?(mt+=Ct,wt+=Tt):Z==="+"&&(mt-=Ct,wt-=Tt),new Date(Date.UTC(O,K,st,mt,wt,vt))}}e.PDFDateString=h;function N(Y,{scale:nt=1,rotation:b=0}){const{width:O,height:K}=Y.attributes.style,st=[0,0,parseInt(O),parseInt(K)];return new A({viewBox:st,scale:nt,rotation:b})}function a(Y){if(Y.startsWith("#")){const nt=parseInt(Y.slice(1),16);return[(nt&16711680)>>16,(nt&65280)>>8,nt&255]}return Y.startsWith("rgb(")?Y.slice(4,-1).split(",").map(nt=>parseInt(nt)):Y.startsWith("rgba(")?Y.slice(5,-1).split(",").map(nt=>parseInt(nt)).slice(0,3):((0,f.warn)(`Not a valid color format: "${Y}"`),[0,0,0])}function E(Y){const nt=document.createElement("span");nt.style.visibility="hidden",document.body.append(nt);for(const b of Y.keys()){nt.style.color=b;const O=window.getComputedStyle(nt).color;Y.set(b,a(O))}nt.remove()}function P(Y){const{a:nt,b,c:O,d:K,e:st,f:mt}=Y.getTransform();return[nt,b,O,K,st,mt]}function et(Y){const{a:nt,b,c:O,d:K,e:st,f:mt}=Y.getTransform().invertSelf();return[nt,b,O,K,st,mt]}function V(Y,nt,b=!1,O=!0){if(nt instanceof A){const{pageWidth:K,pageHeight:st}=nt.rawDims,{style:mt}=Y,wt=f.FeatureTest.isCSSRoundSupported,vt=`var(--scale-factor) * ${K}px`,Z=`var(--scale-factor) * ${st}px`,Ct=wt?`round(${vt}, 1px)`:`calc(${vt})`,Tt=wt?`round(${Z}, 1px)`:`calc(${Z})`;!b||nt.rotation%180===0?(mt.width=Ct,mt.height=Tt):(mt.width=Tt,mt.height=Ct)}O&&Y.setAttribute("data-main-rotation",nt.rotation)}},(M,e,H)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BaseStandardFontDataFactory=e.BaseSVGFactory=e.BaseFilterFactory=e.BaseCanvasFactory=e.BaseCMapReaderFactory=void 0;var n=H(1);class f{constructor(){this.constructor===f&&(0,n.unreachable)("Cannot initialize BaseFilterFactory.")}addFilter(m){return"none"}addHCMFilter(m,B){return"none"}addHighlightHCMFilter(m,B,j,A){return"none"}destroy(m=!1){}}e.BaseFilterFactory=f;class X{constructor(){this.constructor===X&&(0,n.unreachable)("Cannot initialize BaseCanvasFactory.")}create(m,B){if(m<=0||B<=0)throw new Error("Invalid canvas size");const j=this._createCanvas(m,B);return{canvas:j,context:j.getContext("2d")}}reset(m,B,j){if(!m.canvas)throw new Error("Canvas is not specified");if(B<=0||j<=0)throw new Error("Invalid canvas size");m.canvas.width=B,m.canvas.height=j}destroy(m){if(!m.canvas)throw new Error("Canvas is not specified");m.canvas.width=0,m.canvas.height=0,m.canvas=null,m.context=null}_createCanvas(m,B){(0,n.unreachable)("Abstract method `_createCanvas` called.")}}e.BaseCanvasFactory=X;class G{constructor({baseUrl:m=null,isCompressed:B=!0}){this.constructor===G&&(0,n.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=m,this.isCompressed=B}async fetch({name:m}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!m)throw new Error("CMap name must be specified.");const B=this.baseUrl+m+(this.isCompressed?".bcmap":""),j=this.isCompressed?n.CMapCompressionType.BINARY:n.CMapCompressionType.NONE;return this._fetchData(B,j).catch(A=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${B}`)})}_fetchData(m,B){(0,n.unreachable)("Abstract method `_fetchData` called.")}}e.BaseCMapReaderFactory=G;class ut{constructor({baseUrl:m=null}){this.constructor===ut&&(0,n.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=m}async fetch({filename:m}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!m)throw new Error("Font filename must be specified.");const B=`${this.baseUrl}${m}`;return this._fetchData(B).catch(j=>{throw new Error(`Unable to load font data at: ${B}`)})}_fetchData(m){(0,n.unreachable)("Abstract method `_fetchData` called.")}}e.BaseStandardFontDataFactory=ut;class R{constructor(){this.constructor===R&&(0,n.unreachable)("Cannot initialize BaseSVGFactory.")}create(m,B,j=!1){if(m<=0||B<=0)throw new Error("Invalid SVG dimensions");const A=this._createSVG("svg:svg");return A.setAttribute("version","1.1"),j||(A.setAttribute("width",`${m}px`),A.setAttribute("height",`${B}px`)),A.setAttribute("preserveAspectRatio","none"),A.setAttribute("viewBox",`0 0 ${m} ${B}`),A}createElement(m){if(typeof m!="string")throw new Error("Invalid SVG element type");return this._createSVG(m)}_createSVG(m){(0,n.unreachable)("Abstract method `_createSVG` called.")}}e.BaseSVGFactory=R},(M,e,H)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MurmurHash3_64=void 0;var n=H(1);const f=3285377520,X=4294901760,G=65535;class ut{constructor(T){this.h1=T?T&4294967295:f,this.h2=T?T&4294967295:f}update(T){let m,B;if(typeof T=="string"){m=new Uint8Array(T.length*2),B=0;for(let l=0,c=T.length;l<c;l++){const h=T.charCodeAt(l);h<=255?m[B++]=h:(m[B++]=h>>>8,m[B++]=h&255)}}else if((0,n.isArrayBuffer)(T))m=T.slice(),B=m.byteLength;else throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");const j=B>>2,A=B-j*4,_=new Uint32Array(m.buffer,0,j);let S=0,g=0,u=this.h1,y=this.h2;const D=3432918353,v=461845907,o=D&G,d=v&G;for(let l=0;l<j;l++)l&1?(S=_[l],S=S*D&X|S*o&G,S=S<<15|S>>>17,S=S*v&X|S*d&G,u^=S,u=u<<13|u>>>19,u=u*5+3864292196):(g=_[l],g=g*D&X|g*o&G,g=g<<15|g>>>17,g=g*v&X|g*d&G,y^=g,y=y<<13|y>>>19,y=y*5+3864292196);switch(S=0,A){case 3:S^=m[j*4+2]<<16;case 2:S^=m[j*4+1]<<8;case 1:S^=m[j*4],S=S*D&X|S*o&G,S=S<<15|S>>>17,S=S*v&X|S*d&G,j&1?u^=S:y^=S}this.h1=u,this.h2=y}hexdigest(){let T=this.h1,m=this.h2;return T^=m>>>1,T=T*3981806797&X|T*36045&G,m=m*4283543511&X|((m<<16|T>>>16)*2950163797&X)>>>16,T^=m>>>1,T=T*444984403&X|T*60499&G,m=m*3301882366&X|((m<<16|T>>>16)*3120437893&X)>>>16,T^=m>>>1,(T>>>0).toString(16).padStart(8,"0")+(m>>>0).toString(16).padStart(8,"0")}}e.MurmurHash3_64=ut},(M,e,H)=>{var G;Object.defineProperty(e,"__esModule",{value:!0}),e.FontLoader=e.FontFaceObject=void 0;var n=H(1);class f{constructor({ownerDocument:R=globalThis.document,styleElement:T=null}){rt(this,G,new Set);this._document=R,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(R){this.nativeFontFaces.add(R),this._document.fonts.add(R)}removeNativeFontFace(R){this.nativeFontFaces.delete(R),this._document.fonts.delete(R)}insertRule(R){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const T=this.styleElement.sheet;T.insertRule(R,T.cssRules.length)}clear(){for(const R of this.nativeFontFaces)this._document.fonts.delete(R);this.nativeFontFaces.clear(),t(this,G).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont(R){if(!(!R||t(this,G).has(R.loadedName))){if((0,n.assert)(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:T,src:m,style:B}=R,j=new FontFace(T,m,B);this.addNativeFontFace(j);try{await j.load(),t(this,G).add(T)}catch{(0,n.warn)(`Cannot load system font: ${R.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(j)}return}(0,n.unreachable)("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(R){if(R.attached||R.missingFile&&!R.systemFontInfo)return;if(R.attached=!0,R.systemFontInfo){await this.loadSystemFont(R.systemFontInfo);return}if(this.isFontLoadingAPISupported){const m=R.createNativeFontFace();if(m){this.addNativeFontFace(m);try{await m.loaded}catch(B){throw(0,n.warn)(`Failed to load font '${m.family}': '${B}'.`),R.disableFontFace=!0,B}}return}const T=R.createFontFaceRule();if(T){if(this.insertRule(T),this.isSyncFontLoadingSupported)return;await new Promise(m=>{const B=this._queueLoadingCallback(m);this._prepareFontLoadEvent(R,B)})}}get isFontLoadingAPISupported(){var T;const R=!!((T=this._document)!=null&&T.fonts);return(0,n.shadow)(this,"isFontLoadingAPISupported",R)}get isSyncFontLoadingSupported(){let R=!1;return(n.isNodeJS||typeof navigator<"u"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(R=!0),(0,n.shadow)(this,"isSyncFontLoadingSupported",R)}_queueLoadingCallback(R){function T(){for((0,n.assert)(!B.done,"completeRequest() cannot be called twice."),B.done=!0;m.length>0&&m[0].done;){const j=m.shift();setTimeout(j.callback,0)}}const{loadingRequests:m}=this,B={done:!1,complete:T,callback:R};return m.push(B),B}get _loadTestFont(){const R=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return(0,n.shadow)(this,"_loadTestFont",R)}_prepareFontLoadEvent(R,T){function m(a,E){return a.charCodeAt(E)<<24|a.charCodeAt(E+1)<<16|a.charCodeAt(E+2)<<8|a.charCodeAt(E+3)&255}function B(a,E,P,et){const V=a.substring(0,E),Q=a.substring(E+P);return V+et+Q}let j,A;const _=this._document.createElement("canvas");_.width=1,_.height=1;const S=_.getContext("2d");let g=0;function u(a,E){if(++g>30){(0,n.warn)("Load test font never loaded."),E();return}if(S.font="30px "+a,S.fillText(".",0,20),S.getImageData(0,0,1,1).data[3]>0){E();return}setTimeout(u.bind(null,a,E))}const y=`lt${Date.now()}${this.loadTestFontId++}`;let D=this._loadTestFont;D=B(D,976,y.length,y);const o=16,d=1482184792;let l=m(D,o);for(j=0,A=y.length-3;j<A;j+=4)l=l-d+m(y,j)|0;j<y.length&&(l=l-d+m(y+"XXX",j)|0),D=B(D,o,4,(0,n.string32)(l));const c=`url(data:font/opentype;base64,${btoa(D)});`,h=`@font-face {font-family:"${y}";src:${c}}`;this.insertRule(h);const N=this._document.createElement("div");N.style.visibility="hidden",N.style.width=N.style.height="10px",N.style.position="absolute",N.style.top=N.style.left="0px";for(const a of[R.loadedName,y]){const E=this._document.createElement("span");E.textContent="Hi",E.style.fontFamily=a,N.append(E)}this._document.body.append(N),u(y,()=>{N.remove(),T.complete()})}}G=new WeakMap,e.FontLoader=f;class X{constructor(R,{isEvalSupported:T=!0,disableFontFace:m=!1,ignoreErrors:B=!1,inspectFont:j=null}){this.compiledGlyphs=Object.create(null);for(const A in R)this[A]=R[A];this.isEvalSupported=T!==!1,this.disableFontFace=m===!0,this.ignoreErrors=B===!0,this._inspectFont=j}createNativeFontFace(){var T;if(!this.data||this.disableFontFace)return null;let R;if(!this.cssFontInfo)R=new FontFace(this.loadedName,this.data,{});else{const m={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(m.style=`oblique ${this.cssFontInfo.italicAngle}deg`),R=new FontFace(this.cssFontInfo.fontFamily,this.data,m)}return(T=this._inspectFont)==null||T.call(this,this),R}createFontFaceRule(){var B;if(!this.data||this.disableFontFace)return null;const R=(0,n.bytesToString)(this.data),T=`url(data:${this.mimetype};base64,${btoa(R)});`;let m;if(!this.cssFontInfo)m=`@font-face {font-family:"${this.loadedName}";src:${T}}`;else{let j=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(j+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),m=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${j}src:${T}}`}return(B=this._inspectFont)==null||B.call(this,this,T),m}getPathGenerator(R,T){if(this.compiledGlyphs[T]!==void 0)return this.compiledGlyphs[T];let m;try{m=R.get(this.loadedName+"_path_"+T)}catch(B){if(!this.ignoreErrors)throw B;return(0,n.warn)(`getPathGenerator - ignoring character: "${B}".`),this.compiledGlyphs[T]=function(j,A){}}if(this.isEvalSupported&&n.FeatureTest.isEvalSupported){const B=[];for(const j of m){const A=j.args!==void 0?j.args.join(","):"";B.push("c.",j.cmd,"(",A,`);
`)}return this.compiledGlyphs[T]=new Function("c","size",B.join(""))}return this.compiledGlyphs[T]=function(B,j){for(const A of m)A.cmd==="scale"&&(A.args=[j,-j]),B[A.cmd].apply(B,A.args)}}}e.FontFaceObject=X},(M,e,H)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NodeStandardFontDataFactory=e.NodeFilterFactory=e.NodeCanvasFactory=e.NodeCMapReaderFactory=void 0;var n=H(7);H(1);const f=function(T){return new Promise((m,B)=>{require$$5.readFile(T,(A,_)=>{if(A||!_){B(new Error(A));return}m(new Uint8Array(_))})})};class X extends n.BaseFilterFactory{}e.NodeFilterFactory=X;class G extends n.BaseCanvasFactory{_createCanvas(m,B){return require$$5.createCanvas(m,B)}}e.NodeCanvasFactory=G;class ut extends n.BaseCMapReaderFactory{_fetchData(m,B){return f(m).then(j=>({cMapData:j,compressionType:B}))}}e.NodeCMapReaderFactory=ut;class R extends n.BaseStandardFontDataFactory{_fetchData(m){return f(m)}}e.NodeStandardFontDataFactory=R},(M,e,H)=>{var lt,Ye,Ke;Object.defineProperty(e,"__esModule",{value:!0}),e.CanvasGraphics=void 0;var n=H(1),f=H(6),X=H(12),G=H(13);const ut=16,R=100,T=4096,m=15,B=10,j=1e3,A=16;function _(w,i){if(w._removeMirroring)throw new Error("Context is already forwarding operations.");w.__originalSave=w.save,w.__originalRestore=w.restore,w.__originalRotate=w.rotate,w.__originalScale=w.scale,w.__originalTranslate=w.translate,w.__originalTransform=w.transform,w.__originalSetTransform=w.setTransform,w.__originalResetTransform=w.resetTransform,w.__originalClip=w.clip,w.__originalMoveTo=w.moveTo,w.__originalLineTo=w.lineTo,w.__originalBezierCurveTo=w.bezierCurveTo,w.__originalRect=w.rect,w.__originalClosePath=w.closePath,w.__originalBeginPath=w.beginPath,w._removeMirroring=()=>{w.save=w.__originalSave,w.restore=w.__originalRestore,w.rotate=w.__originalRotate,w.scale=w.__originalScale,w.translate=w.__originalTranslate,w.transform=w.__originalTransform,w.setTransform=w.__originalSetTransform,w.resetTransform=w.__originalResetTransform,w.clip=w.__originalClip,w.moveTo=w.__originalMoveTo,w.lineTo=w.__originalLineTo,w.bezierCurveTo=w.__originalBezierCurveTo,w.rect=w.__originalRect,w.closePath=w.__originalClosePath,w.beginPath=w.__originalBeginPath,delete w._removeMirroring},w.save=function(){i.save(),this.__originalSave()},w.restore=function(){i.restore(),this.__originalRestore()},w.translate=function(p,F){i.translate(p,F),this.__originalTranslate(p,F)},w.scale=function(p,F){i.scale(p,F),this.__originalScale(p,F)},w.transform=function(p,F,L,I,q,tt){i.transform(p,F,L,I,q,tt),this.__originalTransform(p,F,L,I,q,tt)},w.setTransform=function(p,F,L,I,q,tt){i.setTransform(p,F,L,I,q,tt),this.__originalSetTransform(p,F,L,I,q,tt)},w.resetTransform=function(){i.resetTransform(),this.__originalResetTransform()},w.rotate=function(p){i.rotate(p),this.__originalRotate(p)},w.clip=function(p){i.clip(p),this.__originalClip(p)},w.moveTo=function(s,p){i.moveTo(s,p),this.__originalMoveTo(s,p)},w.lineTo=function(s,p){i.lineTo(s,p),this.__originalLineTo(s,p)},w.bezierCurveTo=function(s,p,F,L,I,q){i.bezierCurveTo(s,p,F,L,I,q),this.__originalBezierCurveTo(s,p,F,L,I,q)},w.rect=function(s,p,F,L){i.rect(s,p,F,L),this.__originalRect(s,p,F,L)},w.closePath=function(){i.closePath(),this.__originalClosePath()},w.beginPath=function(){i.beginPath(),this.__originalBeginPath()}}class S{constructor(i){this.canvasFactory=i,this.cache=Object.create(null)}getCanvas(i,s,p){let F;return this.cache[i]!==void 0?(F=this.cache[i],this.canvasFactory.reset(F,s,p)):(F=this.canvasFactory.create(s,p),this.cache[i]=F),F}delete(i){delete this.cache[i]}clear(){for(const i in this.cache){const s=this.cache[i];this.canvasFactory.destroy(s),delete this.cache[i]}}}function g(w,i,s,p,F,L,I,q,tt,pt){const[gt,bt,At,yt,Y,nt]=(0,f.getCurrentTransform)(w);if(bt===0&&At===0){const K=I*gt+Y,st=Math.round(K),mt=q*yt+nt,wt=Math.round(mt),vt=(I+tt)*gt+Y,Z=Math.abs(Math.round(vt)-st)||1,Ct=(q+pt)*yt+nt,Tt=Math.abs(Math.round(Ct)-wt)||1;return w.setTransform(Math.sign(gt),0,0,Math.sign(yt),st,wt),w.drawImage(i,s,p,F,L,0,0,Z,Tt),w.setTransform(gt,bt,At,yt,Y,nt),[Z,Tt]}if(gt===0&&yt===0){const K=q*At+Y,st=Math.round(K),mt=I*bt+nt,wt=Math.round(mt),vt=(q+pt)*At+Y,Z=Math.abs(Math.round(vt)-st)||1,Ct=(I+tt)*bt+nt,Tt=Math.abs(Math.round(Ct)-wt)||1;return w.setTransform(0,Math.sign(bt),Math.sign(At),0,st,wt),w.drawImage(i,s,p,F,L,0,0,Tt,Z),w.setTransform(gt,bt,At,yt,Y,nt),[Tt,Z]}w.drawImage(i,s,p,F,L,I,q,tt,pt);const b=Math.hypot(gt,bt),O=Math.hypot(At,yt);return[b*tt,O*pt]}function u(w){const{width:i,height:s}=w;if(i>j||s>j)return null;const p=1e3,F=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),L=i+1;let I=new Uint8Array(L*(s+1)),q,tt,pt;const gt=i+7&-8;let bt=new Uint8Array(gt*s),At=0;for(const O of w.data){let K=128;for(;K>0;)bt[At++]=O&K?0:255,K>>=1}let yt=0;for(At=0,bt[At]!==0&&(I[0]=1,++yt),tt=1;tt<i;tt++)bt[At]!==bt[At+1]&&(I[tt]=bt[At]?2:1,++yt),At++;for(bt[At]!==0&&(I[tt]=2,++yt),q=1;q<s;q++){At=q*gt,pt=q*L,bt[At-gt]!==bt[At]&&(I[pt]=bt[At]?1:8,++yt);let O=(bt[At]?4:0)+(bt[At-gt]?8:0);for(tt=1;tt<i;tt++)O=(O>>2)+(bt[At+1]?4:0)+(bt[At-gt+1]?8:0),F[O]&&(I[pt+tt]=F[O],++yt),At++;if(bt[At-gt]!==bt[At]&&(I[pt+tt]=bt[At]?2:4,++yt),yt>p)return null}for(At=gt*(s-1),pt=q*L,bt[At]!==0&&(I[pt]=8,++yt),tt=1;tt<i;tt++)bt[At]!==bt[At+1]&&(I[pt+tt]=bt[At]?4:8,++yt),At++;if(bt[At]!==0&&(I[pt+tt]=4,++yt),yt>p)return null;const Y=new Int32Array([0,L,-1,0,-L,0,0,0,1]),nt=new Path2D;for(q=0;yt&&q<=s;q++){let O=q*L;const K=O+i;for(;O<K&&!I[O];)O++;if(O===K)continue;nt.moveTo(O%L,q);const st=O;let mt=I[O];do{const wt=Y[mt];do O+=wt;while(!I[O]);const vt=I[O];vt!==5&&vt!==10?(mt=vt,I[O]=0):(mt=vt&51*mt>>4,I[O]&=mt>>2|mt<<2),nt.lineTo(O%L,O/L|0),I[O]||--yt}while(st!==O);--q}return bt=null,I=null,function(O){O.save(),O.scale(1/i,-1/s),O.translate(0,-s),O.fill(nt),O.beginPath(),O.restore()}}class y{constructor(i,s){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=n.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=n.FONT_IDENTITY_MATRIX,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=n.TextRenderingMode.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,i,s])}clone(){const i=Object.create(this);return i.clipBox=this.clipBox.slice(),i}setCurrentPoint(i,s){this.x=i,this.y=s}updatePathMinMax(i,s,p){[s,p]=n.Util.applyTransform([s,p],i),this.minX=Math.min(this.minX,s),this.minY=Math.min(this.minY,p),this.maxX=Math.max(this.maxX,s),this.maxY=Math.max(this.maxY,p)}updateRectMinMax(i,s){const p=n.Util.applyTransform(s,i),F=n.Util.applyTransform(s.slice(2),i);this.minX=Math.min(this.minX,p[0],F[0]),this.minY=Math.min(this.minY,p[1],F[1]),this.maxX=Math.max(this.maxX,p[0],F[0]),this.maxY=Math.max(this.maxY,p[1],F[1])}updateScalingPathMinMax(i,s){n.Util.scaleMinMax(i,s),this.minX=Math.min(this.minX,s[0]),this.maxX=Math.max(this.maxX,s[1]),this.minY=Math.min(this.minY,s[2]),this.maxY=Math.max(this.maxY,s[3])}updateCurvePathMinMax(i,s,p,F,L,I,q,tt,pt,gt){const bt=n.Util.bezierBoundingBox(s,p,F,L,I,q,tt,pt);if(gt){gt[0]=Math.min(gt[0],bt[0],bt[2]),gt[1]=Math.max(gt[1],bt[0],bt[2]),gt[2]=Math.min(gt[2],bt[1],bt[3]),gt[3]=Math.max(gt[3],bt[1],bt[3]);return}this.updateRectMinMax(i,bt)}getPathBoundingBox(i=X.PathType.FILL,s=null){const p=[this.minX,this.minY,this.maxX,this.maxY];if(i===X.PathType.STROKE){s||(0,n.unreachable)("Stroke bounding box must include transform.");const F=n.Util.singularValueDecompose2dScale(s),L=F[0]*this.lineWidth/2,I=F[1]*this.lineWidth/2;p[0]-=L,p[1]-=I,p[2]+=L,p[3]+=I}return p}updateClipFromPath(){const i=n.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(i||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(i){this.clipBox=i,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(i=X.PathType.FILL,s=null){return n.Util.intersect(this.clipBox,this.getPathBoundingBox(i,s))}}function D(w,i){if(typeof ImageData<"u"&&i instanceof ImageData){w.putImageData(i,0,0);return}const s=i.height,p=i.width,F=s%A,L=(s-F)/A,I=F===0?L:L+1,q=w.createImageData(p,A);let tt=0,pt;const gt=i.data,bt=q.data;let At,yt,Y,nt;if(i.kind===n.ImageKind.GRAYSCALE_1BPP){const b=gt.byteLength,O=new Uint32Array(bt.buffer,0,bt.byteLength>>2),K=O.length,st=p+7>>3,mt=4294967295,wt=n.FeatureTest.isLittleEndian?4278190080:255;for(At=0;At<I;At++){for(Y=At<L?A:F,pt=0,yt=0;yt<Y;yt++){const vt=b-tt;let Z=0;const Ct=vt>st?p:vt*8-7,Tt=Ct&-8;let Wt=0,Ut=0;for(;Z<Tt;Z+=8)Ut=gt[tt++],O[pt++]=Ut&128?mt:wt,O[pt++]=Ut&64?mt:wt,O[pt++]=Ut&32?mt:wt,O[pt++]=Ut&16?mt:wt,O[pt++]=Ut&8?mt:wt,O[pt++]=Ut&4?mt:wt,O[pt++]=Ut&2?mt:wt,O[pt++]=Ut&1?mt:wt;for(;Z<Ct;Z++)Wt===0&&(Ut=gt[tt++],Wt=128),O[pt++]=Ut&Wt?mt:wt,Wt>>=1}for(;pt<K;)O[pt++]=0;w.putImageData(q,0,At*A)}}else if(i.kind===n.ImageKind.RGBA_32BPP){for(yt=0,nt=p*A*4,At=0;At<L;At++)bt.set(gt.subarray(tt,tt+nt)),tt+=nt,w.putImageData(q,0,yt),yt+=A;At<I&&(nt=p*F*4,bt.set(gt.subarray(tt,tt+nt)),w.putImageData(q,0,yt))}else if(i.kind===n.ImageKind.RGB_24BPP)for(Y=A,nt=p*Y,At=0;At<I;At++){for(At>=L&&(Y=F,nt=p*Y),pt=0,yt=nt;yt--;)bt[pt++]=gt[tt++],bt[pt++]=gt[tt++],bt[pt++]=gt[tt++],bt[pt++]=255;w.putImageData(q,0,At*A)}else throw new Error(`bad image kind: ${i.kind}`)}function v(w,i){if(i.bitmap){w.drawImage(i.bitmap,0,0);return}const s=i.height,p=i.width,F=s%A,L=(s-F)/A,I=F===0?L:L+1,q=w.createImageData(p,A);let tt=0;const pt=i.data,gt=q.data;for(let bt=0;bt<I;bt++){const At=bt<L?A:F;({srcPos:tt}=(0,G.convertBlackAndWhiteToRGBA)({src:pt,srcPos:tt,dest:gt,width:p,height:At,nonBlackColor:0})),w.putImageData(q,0,bt*A)}}function o(w,i){const s=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const p of s)w[p]!==void 0&&(i[p]=w[p]);w.setLineDash!==void 0&&(i.setLineDash(w.getLineDash()),i.lineDashOffset=w.lineDashOffset)}function d(w){if(w.strokeStyle=w.fillStyle="#000000",w.fillRule="nonzero",w.globalAlpha=1,w.lineWidth=1,w.lineCap="butt",w.lineJoin="miter",w.miterLimit=10,w.globalCompositeOperation="source-over",w.font="10px sans-serif",w.setLineDash!==void 0&&(w.setLineDash([]),w.lineDashOffset=0),!n.isNodeJS){const{filter:i}=w;i!=="none"&&i!==""&&(w.filter="none")}}function l(w,i,s,p){const F=w.length;for(let L=3;L<F;L+=4){const I=w[L];if(I===0)w[L-3]=i,w[L-2]=s,w[L-1]=p;else if(I<255){const q=255-I;w[L-3]=w[L-3]*I+i*q>>8,w[L-2]=w[L-2]*I+s*q>>8,w[L-1]=w[L-1]*I+p*q>>8}}}function c(w,i,s){const p=w.length,F=1/255;for(let L=3;L<p;L+=4){const I=s?s[w[L]]:w[L];i[L]=i[L]*I*F|0}}function h(w,i,s){const p=w.length;for(let F=3;F<p;F+=4){const L=w[F-3]*77+w[F-2]*152+w[F-1]*28;i[F]=s?i[F]*s[L>>8]>>8:i[F]*L>>16}}function N(w,i,s,p,F,L,I,q,tt,pt,gt){const bt=!!L,At=bt?L[0]:0,yt=bt?L[1]:0,Y=bt?L[2]:0,nt=F==="Luminosity"?h:c,O=Math.min(p,Math.ceil(1048576/s));for(let K=0;K<p;K+=O){const st=Math.min(O,p-K),mt=w.getImageData(q-pt,K+(tt-gt),s,st),wt=i.getImageData(q,K+tt,s,st);bt&&l(mt.data,At,yt,Y),nt(mt.data,wt.data,I),i.putImageData(wt,q,K+tt)}}function a(w,i,s,p){const F=p[0],L=p[1],I=p[2]-F,q=p[3]-L;I===0||q===0||(N(i.context,s,I,q,i.subtype,i.backdrop,i.transferMap,F,L,i.offsetX,i.offsetY),w.save(),w.globalAlpha=1,w.globalCompositeOperation="source-over",w.setTransform(1,0,0,1,0,0),w.drawImage(s.canvas,0,0),w.restore())}function E(w,i){const s=n.Util.singularValueDecompose2dScale(w);s[0]=Math.fround(s[0]),s[1]=Math.fround(s[1]);const p=Math.fround((globalThis.devicePixelRatio||1)*f.PixelsPerInch.PDF_TO_CSS_UNITS);return i!==void 0?i:s[0]<=p||s[1]<=p}const P=["butt","round","square"],et=["miter","round","bevel"],V={},Q={},it=class it{constructor(i,s,p,F,L,{optionalContentConfig:I,markedContentStack:q=null},tt,pt){rt(this,lt);this.ctx=i,this.current=new y(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=s,this.objs=p,this.canvasFactory=F,this.filterFactory=L,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=q||[],this.optionalContentConfig=I,this.cachedCanvases=new S(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=tt,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=pt,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(i,s=null){return typeof i=="string"?i.startsWith("g_")?this.commonObjs.get(i):this.objs.get(i):s}beginDrawing({transform:i,viewport:s,transparency:p=!1,background:F=null}){const L=this.ctx.canvas.width,I=this.ctx.canvas.height,q=this.ctx.fillStyle;if(this.ctx.fillStyle=F||"#ffffff",this.ctx.fillRect(0,0,L,I),this.ctx.fillStyle=q,p){const tt=this.cachedCanvases.getCanvas("transparent",L,I);this.compositeCtx=this.ctx,this.transparentCanvas=tt.canvas,this.ctx=tt.context,this.ctx.save(),this.ctx.transform(...(0,f.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),d(this.ctx),i&&(this.ctx.transform(...i),this.outputScaleX=i[0],this.outputScaleY=i[0]),this.ctx.transform(...s.transform),this.viewportScale=s.scale,this.baseTransform=(0,f.getCurrentTransform)(this.ctx)}executeOperatorList(i,s,p,F){const L=i.argsArray,I=i.fnArray;let q=s||0;const tt=L.length;if(tt===q)return q;const pt=tt-q>B&&typeof p=="function",gt=pt?Date.now()+m:0;let bt=0;const At=this.commonObjs,yt=this.objs;let Y;for(;;){if(F!==void 0&&q===F.nextBreakPoint)return F.breakIt(q,p),q;if(Y=I[q],Y!==n.OPS.dependency)this[Y].apply(this,L[q]);else for(const nt of L[q]){const b=nt.startsWith("g_")?At:yt;if(!b.has(nt))return b.get(nt,p),q}if(q++,q===tt)return q;if(pt&&++bt>B){if(Date.now()>gt)return p(),q;bt=0}}}endDrawing(){J(this,lt,Ye).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const i of this._cachedBitmapsMap.values()){for(const s of i.values())typeof HTMLCanvasElement<"u"&&s instanceof HTMLCanvasElement&&(s.width=s.height=0);i.clear()}this._cachedBitmapsMap.clear(),J(this,lt,Ke).call(this)}_scaleImage(i,s){const p=i.width,F=i.height;let L=Math.max(Math.hypot(s[0],s[1]),1),I=Math.max(Math.hypot(s[2],s[3]),1),q=p,tt=F,pt="prescale1",gt,bt;for(;L>2&&q>1||I>2&&tt>1;){let At=q,yt=tt;L>2&&q>1&&(At=q>=16384?Math.floor(q/2)-1||1:Math.ceil(q/2),L/=q/At),I>2&&tt>1&&(yt=tt>=16384?Math.floor(tt/2)-1||1:Math.ceil(tt)/2,I/=tt/yt),gt=this.cachedCanvases.getCanvas(pt,At,yt),bt=gt.context,bt.clearRect(0,0,At,yt),bt.drawImage(i,0,0,q,tt,0,0,At,yt),i=gt.canvas,q=At,tt=yt,pt=pt==="prescale1"?"prescale2":"prescale1"}return{img:i,paintWidth:q,paintHeight:tt}}_createMaskCanvas(i){const s=this.ctx,{width:p,height:F}=i,L=this.current.fillColor,I=this.current.patternFill,q=(0,f.getCurrentTransform)(s);let tt,pt,gt,bt;if((i.bitmap||i.data)&&i.count>1){const Z=i.bitmap||i.data.buffer;pt=JSON.stringify(I?q:[q.slice(0,4),L]),tt=this._cachedBitmapsMap.get(Z),tt||(tt=new Map,this._cachedBitmapsMap.set(Z,tt));const Ct=tt.get(pt);if(Ct&&!I){const Tt=Math.round(Math.min(q[0],q[2])+q[4]),Wt=Math.round(Math.min(q[1],q[3])+q[5]);return{canvas:Ct,offsetX:Tt,offsetY:Wt}}gt=Ct}gt||(bt=this.cachedCanvases.getCanvas("maskCanvas",p,F),v(bt.context,i));let At=n.Util.transform(q,[1/p,0,0,-1/F,0,0]);At=n.Util.transform(At,[1,0,0,1,0,-F]);const yt=n.Util.applyTransform([0,0],At),Y=n.Util.applyTransform([p,F],At),nt=n.Util.normalizeRect([yt[0],yt[1],Y[0],Y[1]]),b=Math.round(nt[2]-nt[0])||1,O=Math.round(nt[3]-nt[1])||1,K=this.cachedCanvases.getCanvas("fillCanvas",b,O),st=K.context,mt=Math.min(yt[0],Y[0]),wt=Math.min(yt[1],Y[1]);st.translate(-mt,-wt),st.transform(...At),gt||(gt=this._scaleImage(bt.canvas,(0,f.getCurrentTransformInverse)(st)),gt=gt.img,tt&&I&&tt.set(pt,gt)),st.imageSmoothingEnabled=E((0,f.getCurrentTransform)(st),i.interpolate),g(st,gt,0,0,gt.width,gt.height,0,0,p,F),st.globalCompositeOperation="source-in";const vt=n.Util.transform((0,f.getCurrentTransformInverse)(st),[1,0,0,1,-mt,-wt]);return st.fillStyle=I?L.getPattern(s,this,vt,X.PathType.FILL):L,st.fillRect(0,0,p,F),tt&&!I&&(this.cachedCanvases.delete("fillCanvas"),tt.set(pt,K.canvas)),{canvas:K.canvas,offsetX:Math.round(mt),offsetY:Math.round(wt)}}setLineWidth(i){i!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=i,this.ctx.lineWidth=i}setLineCap(i){this.ctx.lineCap=P[i]}setLineJoin(i){this.ctx.lineJoin=et[i]}setMiterLimit(i){this.ctx.miterLimit=i}setDash(i,s){const p=this.ctx;p.setLineDash!==void 0&&(p.setLineDash(i),p.lineDashOffset=s)}setRenderingIntent(i){}setFlatness(i){}setGState(i){for(const[s,p]of i)switch(s){case"LW":this.setLineWidth(p);break;case"LC":this.setLineCap(p);break;case"LJ":this.setLineJoin(p);break;case"ML":this.setMiterLimit(p);break;case"D":this.setDash(p[0],p[1]);break;case"RI":this.setRenderingIntent(p);break;case"FL":this.setFlatness(p);break;case"Font":this.setFont(p[0],p[1]);break;case"CA":this.current.strokeAlpha=p;break;case"ca":this.current.fillAlpha=p,this.ctx.globalAlpha=p;break;case"BM":this.ctx.globalCompositeOperation=p;break;case"SMask":this.current.activeSMask=p?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(p);break}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const i=this.inSMaskMode;this.current.activeSMask&&!i?this.beginSMaskMode():!this.current.activeSMask&&i&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const i=this.ctx.canvas.width,s=this.ctx.canvas.height,p="smaskGroupAt"+this.groupLevel,F=this.cachedCanvases.getCanvas(p,i,s);this.suspendedCtx=this.ctx,this.ctx=F.context;const L=this.ctx;L.setTransform(...(0,f.getCurrentTransform)(this.suspendedCtx)),o(this.suspendedCtx,L),_(L,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(),o(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(i){if(!this.current.activeSMask)return;i?(i[0]=Math.floor(i[0]),i[1]=Math.floor(i[1]),i[2]=Math.ceil(i[2]),i[3]=Math.ceil(i[3])):i=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const s=this.current.activeSMask,p=this.suspendedCtx;a(p,s,this.ctx,i),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?(o(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const i=this.current;this.stateStack.push(i),this.current=i.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),o(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(i,s,p,F,L,I){this.ctx.transform(i,s,p,F,L,I),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(i,s,p){const F=this.ctx,L=this.current;let I=L.x,q=L.y,tt,pt;const gt=(0,f.getCurrentTransform)(F),bt=gt[0]===0&>[3]===0||gt[1]===0&>[2]===0,At=bt?p.slice(0):null;for(let yt=0,Y=0,nt=i.length;yt<nt;yt++)switch(i[yt]|0){case n.OPS.rectangle:I=s[Y++],q=s[Y++];const b=s[Y++],O=s[Y++],K=I+b,st=q+O;F.moveTo(I,q),b===0||O===0?F.lineTo(K,st):(F.lineTo(K,q),F.lineTo(K,st),F.lineTo(I,st)),bt||L.updateRectMinMax(gt,[I,q,K,st]),F.closePath();break;case n.OPS.moveTo:I=s[Y++],q=s[Y++],F.moveTo(I,q),bt||L.updatePathMinMax(gt,I,q);break;case n.OPS.lineTo:I=s[Y++],q=s[Y++],F.lineTo(I,q),bt||L.updatePathMinMax(gt,I,q);break;case n.OPS.curveTo:tt=I,pt=q,I=s[Y+4],q=s[Y+5],F.bezierCurveTo(s[Y],s[Y+1],s[Y+2],s[Y+3],I,q),L.updateCurvePathMinMax(gt,tt,pt,s[Y],s[Y+1],s[Y+2],s[Y+3],I,q,At),Y+=6;break;case n.OPS.curveTo2:tt=I,pt=q,F.bezierCurveTo(I,q,s[Y],s[Y+1],s[Y+2],s[Y+3]),L.updateCurvePathMinMax(gt,tt,pt,I,q,s[Y],s[Y+1],s[Y+2],s[Y+3],At),I=s[Y+2],q=s[Y+3],Y+=4;break;case n.OPS.curveTo3:tt=I,pt=q,I=s[Y+2],q=s[Y+3],F.bezierCurveTo(s[Y],s[Y+1],I,q,I,q),L.updateCurvePathMinMax(gt,tt,pt,s[Y],s[Y+1],I,q,I,q,At),Y+=4;break;case n.OPS.closePath:F.closePath();break}bt&&L.updateScalingPathMinMax(gt,At),L.setCurrentPoint(I,q)}closePath(){this.ctx.closePath()}stroke(i=!0){const s=this.ctx,p=this.current.strokeColor;s.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof p=="object"&&(p!=null&&p.getPattern)?(s.save(),s.strokeStyle=p.getPattern(s,this,(0,f.getCurrentTransformInverse)(s),X.PathType.STROKE),this.rescaleAndStroke(!1),s.restore()):this.rescaleAndStroke(!0)),i&&this.consumePath(this.current.getClippedPathBoundingBox()),s.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(i=!0){const s=this.ctx,p=this.current.fillColor,F=this.current.patternFill;let L=!1;F&&(s.save(),s.fillStyle=p.getPattern(s,this,(0,f.getCurrentTransformInverse)(s),X.PathType.FILL),L=!0);const I=this.current.getClippedPathBoundingBox();this.contentVisible&&I!==null&&(this.pendingEOFill?(s.fill("evenodd"),this.pendingEOFill=!1):s.fill()),L&&s.restore(),i&&this.consumePath(I)}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=V}eoClip(){this.pendingClip=Q}beginText(){this.current.textMatrix=n.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const i=this.pendingTextPaths,s=this.ctx;if(i===void 0){s.beginPath();return}s.save(),s.beginPath();for(const p of i)s.setTransform(...p.transform),s.translate(p.x,p.y),p.addToPath(s,p.fontSize);s.restore(),s.clip(),s.beginPath(),delete this.pendingTextPaths}setCharSpacing(i){this.current.charSpacing=i}setWordSpacing(i){this.current.wordSpacing=i}setHScale(i){this.current.textHScale=i/100}setLeading(i){this.current.leading=-i}setFont(i,s){var gt;const p=this.commonObjs.get(i),F=this.current;if(!p)throw new Error(`Can't find font for ${i}`);if(F.fontMatrix=p.fontMatrix||n.FONT_IDENTITY_MATRIX,(F.fontMatrix[0]===0||F.fontMatrix[3]===0)&&(0,n.warn)("Invalid font matrix for font "+i),s<0?(s=-s,F.fontDirection=-1):F.fontDirection=1,this.current.font=p,this.current.fontSize=s,p.isType3Font)return;const L=p.loadedName||"sans-serif",I=((gt=p.systemFontInfo)==null?void 0:gt.css)||`"${L}", ${p.fallbackName}`;let q="normal";p.black?q="900":p.bold&&(q="bold");const tt=p.italic?"italic":"normal";let pt=s;s<ut?pt=ut:s>R&&(pt=R),this.current.fontSizeScale=s/pt,this.ctx.font=`${tt} ${q} ${pt}px ${I}`}setTextRenderingMode(i){this.current.textRenderingMode=i}setTextRise(i){this.current.textRise=i}moveText(i,s){this.current.x=this.current.lineX+=i,this.current.y=this.current.lineY+=s}setLeadingMoveText(i,s){this.setLeading(-s),this.moveText(i,s)}setTextMatrix(i,s,p,F,L,I){this.current.textMatrix=[i,s,p,F,L,I],this.current.textMatrixScale=Math.hypot(i,s),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(i,s,p,F){const L=this.ctx,I=this.current,q=I.font,tt=I.textRenderingMode,pt=I.fontSize/I.fontSizeScale,gt=tt&n.TextRenderingMode.FILL_STROKE_MASK,bt=!!(tt&n.TextRenderingMode.ADD_TO_PATH_FLAG),At=I.patternFill&&!q.missingFile;let yt;(q.disableFontFace||bt||At)&&(yt=q.getPathGenerator(this.commonObjs,i)),q.disableFontFace||At?(L.save(),L.translate(s,p),L.beginPath(),yt(L,pt),F&&L.setTransform(...F),(gt===n.TextRenderingMode.FILL||gt===n.TextRenderingMode.FILL_STROKE)&&L.fill(),(gt===n.TextRenderingMode.STROKE||gt===n.TextRenderingMode.FILL_STROKE)&&L.stroke(),L.restore()):((gt===n.TextRenderingMode.FILL||gt===n.TextRenderingMode.FILL_STROKE)&&L.fillText(i,s,p),(gt===n.TextRenderingMode.STROKE||gt===n.TextRenderingMode.FILL_STROKE)&&L.strokeText(i,s,p)),bt&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:(0,f.getCurrentTransform)(L),x:s,y:p,fontSize:pt,addToPath:yt})}get isFontSubpixelAAEnabled(){const{context:i}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);i.scale(1.5,1),i.fillText("I",0,10);const s=i.getImageData(0,0,10,10).data;let p=!1;for(let F=3;F<s.length;F+=4)if(s[F]>0&&s[F]<255){p=!0;break}return(0,n.shadow)(this,"isFontSubpixelAAEnabled",p)}showText(i){const s=this.current,p=s.font;if(p.isType3Font)return this.showType3Text(i);const F=s.fontSize;if(F===0)return;const L=this.ctx,I=s.fontSizeScale,q=s.charSpacing,tt=s.wordSpacing,pt=s.fontDirection,gt=s.textHScale*pt,bt=i.length,At=p.vertical,yt=At?1:-1,Y=p.defaultVMetrics,nt=F*s.fontMatrix[0],b=s.textRenderingMode===n.TextRenderingMode.FILL&&!p.disableFontFace&&!s.patternFill;L.save(),L.transform(...s.textMatrix),L.translate(s.x,s.y+s.textRise),pt>0?L.scale(gt,-1):L.scale(gt,1);let O;if(s.patternFill){L.save();const vt=s.fillColor.getPattern(L,this,(0,f.getCurrentTransformInverse)(L),X.PathType.FILL);O=(0,f.getCurrentTransform)(L),L.restore(),L.fillStyle=vt}let K=s.lineWidth;const st=s.textMatrixScale;if(st===0||K===0){const vt=s.textRenderingMode&n.TextRenderingMode.FILL_STROKE_MASK;(vt===n.TextRenderingMode.STROKE||vt===n.TextRenderingMode.FILL_STROKE)&&(K=this.getSinglePixelWidth())}else K/=st;if(I!==1&&(L.scale(I,I),K/=I),L.lineWidth=K,p.isInvalidPDFjsFont){const vt=[];let Z=0;for(const Ct of i)vt.push(Ct.unicode),Z+=Ct.width;L.fillText(vt.join(""),0,0),s.x+=Z*nt*gt,L.restore(),this.compose();return}let mt=0,wt;for(wt=0;wt<bt;++wt){const vt=i[wt];if(typeof vt=="number"){mt+=yt*vt*F/1e3;continue}let Z=!1;const Ct=(vt.isSpace?tt:0)+q,Tt=vt.fontChar,Wt=vt.accent;let Ut,Xt,kt=vt.width;if(At){const Vt=vt.vmetric||Y,Kt=-(vt.vmetric?Vt[1]:kt*.5)*nt,St=Vt[2]*nt;kt=Vt?-Vt[0]:kt,Ut=Kt/I,Xt=(mt+St)/I}else Ut=mt/I,Xt=0;if(p.remeasure&&kt>0){const Vt=L.measureText(Tt).width*1e3/F*I;if(kt<Vt&&this.isFontSubpixelAAEnabled){const Kt=kt/Vt;Z=!0,L.save(),L.scale(Kt,1),Ut/=Kt}else kt!==Vt&&(Ut+=(kt-Vt)/2e3*F/I)}if(this.contentVisible&&(vt.isInFont||p.missingFile)){if(b&&!Wt)L.fillText(Tt,Ut,Xt);else if(this.paintChar(Tt,Ut,Xt,O),Wt){const Vt=Ut+F*Wt.offset.x/I,Kt=Xt-F*Wt.offset.y/I;this.paintChar(Wt.fontChar,Vt,Kt,O)}}const jt=At?kt*nt-Ct*pt:kt*nt+Ct*pt;mt+=jt,Z&&L.restore()}At?s.y-=mt:s.x+=mt*gt,L.restore(),this.compose()}showType3Text(i){const s=this.ctx,p=this.current,F=p.font,L=p.fontSize,I=p.fontDirection,q=F.vertical?1:-1,tt=p.charSpacing,pt=p.wordSpacing,gt=p.textHScale*I,bt=p.fontMatrix||n.FONT_IDENTITY_MATRIX,At=i.length,yt=p.textRenderingMode===n.TextRenderingMode.INVISIBLE;let Y,nt,b,O;if(!(yt||L===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,s.save(),s.transform(...p.textMatrix),s.translate(p.x,p.y),s.scale(gt,I),Y=0;Y<At;++Y){if(nt=i[Y],typeof nt=="number"){O=q*nt*L/1e3,this.ctx.translate(O,0),p.x+=O*gt;continue}const K=(nt.isSpace?pt:0)+tt,st=F.charProcOperatorList[nt.operatorListId];if(!st){(0,n.warn)(`Type3 character "${nt.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=nt,this.save(),s.scale(L,L),s.transform(...bt),this.executeOperatorList(st),this.restore()),b=n.Util.applyTransform([nt.width,0],bt)[0]*L+K,s.translate(b,0),p.x+=b*gt}s.restore(),this.processingType3=null}}setCharWidth(i,s){}setCharWidthAndBounds(i,s,p,F,L,I){this.ctx.rect(p,F,L-p,I-F),this.ctx.clip(),this.endPath()}getColorN_Pattern(i){let s;if(i[0]==="TilingPattern"){const p=i[1],F=this.baseTransform||(0,f.getCurrentTransform)(this.ctx),L={createCanvasGraphics:I=>new it(I,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};s=new X.TilingPattern(i,p,this.ctx,L,F)}else s=this._getPattern(i[1],i[2]);return s}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(i,s,p){const F=n.Util.makeHexColor(i,s,p);this.ctx.strokeStyle=F,this.current.strokeColor=F}setFillRGBColor(i,s,p){const F=n.Util.makeHexColor(i,s,p);this.ctx.fillStyle=F,this.current.fillColor=F,this.current.patternFill=!1}_getPattern(i,s=null){let p;return this.cachedPatterns.has(i)?p=this.cachedPatterns.get(i):(p=(0,X.getShadingPattern)(this.getObject(i)),this.cachedPatterns.set(i,p)),s&&(p.matrix=s),p}shadingFill(i){if(!this.contentVisible)return;const s=this.ctx;this.save();const p=this._getPattern(i);s.fillStyle=p.getPattern(s,this,(0,f.getCurrentTransformInverse)(s),X.PathType.SHADING);const F=(0,f.getCurrentTransformInverse)(s);if(F){const{width:L,height:I}=s.canvas,[q,tt,pt,gt]=n.Util.getAxialAlignedBoundingBox([0,0,L,I],F);this.ctx.fillRect(q,tt,pt-q,gt-tt)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){(0,n.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,n.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(i,s){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(i)&&i.length===6&&this.transform(...i),this.baseTransform=(0,f.getCurrentTransform)(this.ctx),s)){const p=s[2]-s[0],F=s[3]-s[1];this.ctx.rect(s[0],s[1],p,F),this.current.updateRectMinMax((0,f.getCurrentTransform)(this.ctx),s),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(i){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const s=this.ctx;i.isolated||(0,n.info)("TODO: Support non-isolated groups."),i.knockout&&(0,n.warn)("Knockout groups not supported.");const p=(0,f.getCurrentTransform)(s);if(i.matrix&&s.transform(...i.matrix),!i.bbox)throw new Error("Bounding box is required.");let F=n.Util.getAxialAlignedBoundingBox(i.bbox,(0,f.getCurrentTransform)(s));const L=[0,0,s.canvas.width,s.canvas.height];F=n.Util.intersect(F,L)||[0,0,0,0];const I=Math.floor(F[0]),q=Math.floor(F[1]);let tt=Math.max(Math.ceil(F[2])-I,1),pt=Math.max(Math.ceil(F[3])-q,1),gt=1,bt=1;tt>T&&(gt=tt/T,tt=T),pt>T&&(bt=pt/T,pt=T),this.current.startNewPathAndClipBox([0,0,tt,pt]);let At="groupAt"+this.groupLevel;i.smask&&(At+="_smask_"+this.smaskCounter++%2);const yt=this.cachedCanvases.getCanvas(At,tt,pt),Y=yt.context;Y.scale(1/gt,1/bt),Y.translate(-I,-q),Y.transform(...p),i.smask?this.smaskStack.push({canvas:yt.canvas,context:Y,offsetX:I,offsetY:q,scaleX:gt,scaleY:bt,subtype:i.smask.subtype,backdrop:i.smask.backdrop,transferMap:i.smask.transferMap||null,startTransformInverse:null}):(s.setTransform(1,0,0,1,0,0),s.translate(I,q),s.scale(gt,bt),s.save()),o(s,Y),this.ctx=Y,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(s),this.groupLevel++}endGroup(i){if(!this.contentVisible)return;this.groupLevel--;const s=this.ctx,p=this.groupStack.pop();if(this.ctx=p,this.ctx.imageSmoothingEnabled=!1,i.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const F=(0,f.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...F);const L=n.Util.getAxialAlignedBoundingBox([0,0,s.canvas.width,s.canvas.height],F);this.ctx.drawImage(s.canvas,0,0),this.ctx.restore(),this.compose(L)}}beginAnnotation(i,s,p,F,L){if(J(this,lt,Ye).call(this),d(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(s)&&s.length===4){const I=s[2]-s[0],q=s[3]-s[1];if(L&&this.annotationCanvasMap){p=p.slice(),p[4]-=s[0],p[5]-=s[1],s=s.slice(),s[0]=s[1]=0,s[2]=I,s[3]=q;const[tt,pt]=n.Util.singularValueDecompose2dScale((0,f.getCurrentTransform)(this.ctx)),{viewportScale:gt}=this,bt=Math.ceil(I*this.outputScaleX*gt),At=Math.ceil(q*this.outputScaleY*gt);this.annotationCanvas=this.canvasFactory.create(bt,At);const{canvas:yt,context:Y}=this.annotationCanvas;this.annotationCanvasMap.set(i,yt),this.annotationCanvas.savedCtx=this.ctx,this.ctx=Y,this.ctx.save(),this.ctx.setTransform(tt,0,0,-pt,0,q*pt),d(this.ctx)}else d(this.ctx),this.ctx.rect(s[0],s[1],I,q),this.ctx.clip(),this.endPath()}this.current=new y(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...p),this.transform(...F)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),J(this,lt,Ke).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(i){if(!this.contentVisible)return;const s=i.count;i=this.getObject(i.data,i),i.count=s;const p=this.ctx,F=this.processingType3;if(F&&(F.compiled===void 0&&(F.compiled=u(i)),F.compiled)){F.compiled(p);return}const L=this._createMaskCanvas(i),I=L.canvas;p.save(),p.setTransform(1,0,0,1,0,0),p.drawImage(I,L.offsetX,L.offsetY),p.restore(),this.compose()}paintImageMaskXObjectRepeat(i,s,p=0,F=0,L,I){if(!this.contentVisible)return;i=this.getObject(i.data,i);const q=this.ctx;q.save();const tt=(0,f.getCurrentTransform)(q);q.transform(s,p,F,L,0,0);const pt=this._createMaskCanvas(i);q.setTransform(1,0,0,1,pt.offsetX-tt[4],pt.offsetY-tt[5]);for(let gt=0,bt=I.length;gt<bt;gt+=2){const At=n.Util.transform(tt,[s,p,F,L,I[gt],I[gt+1]]),[yt,Y]=n.Util.applyTransform([0,0],At);q.drawImage(pt.canvas,yt,Y)}q.restore(),this.compose()}paintImageMaskXObjectGroup(i){if(!this.contentVisible)return;const s=this.ctx,p=this.current.fillColor,F=this.current.patternFill;for(const L of i){const{data:I,width:q,height:tt,transform:pt}=L,gt=this.cachedCanvases.getCanvas("maskCanvas",q,tt),bt=gt.context;bt.save();const At=this.getObject(I,L);v(bt,At),bt.globalCompositeOperation="source-in",bt.fillStyle=F?p.getPattern(bt,this,(0,f.getCurrentTransformInverse)(s),X.PathType.FILL):p,bt.fillRect(0,0,q,tt),bt.restore(),s.save(),s.transform(...pt),s.scale(1,-1),g(s,gt.canvas,0,0,q,tt,0,-1,1,1),s.restore()}this.compose()}paintImageXObject(i){if(!this.contentVisible)return;const s=this.getObject(i);if(!s){(0,n.warn)("Dependent image isn't ready yet");return}this.paintInlineImageXObject(s)}paintImageXObjectRepeat(i,s,p,F){if(!this.contentVisible)return;const L=this.getObject(i);if(!L){(0,n.warn)("Dependent image isn't ready yet");return}const I=L.width,q=L.height,tt=[];for(let pt=0,gt=F.length;pt<gt;pt+=2)tt.push({transform:[s,0,0,p,F[pt],F[pt+1]],x:0,y:0,w:I,h:q});this.paintInlineImageXObjectGroup(L,tt)}applyTransferMapsToCanvas(i){return this.current.transferMaps!=="none"&&(i.filter=this.current.transferMaps,i.drawImage(i.canvas,0,0),i.filter="none"),i.canvas}applyTransferMapsToBitmap(i){if(this.current.transferMaps==="none")return i.bitmap;const{bitmap:s,width:p,height:F}=i,L=this.cachedCanvases.getCanvas("inlineImage",p,F),I=L.context;return I.filter=this.current.transferMaps,I.drawImage(s,0,0),I.filter="none",L.canvas}paintInlineImageXObject(i){if(!this.contentVisible)return;const s=i.width,p=i.height,F=this.ctx;if(this.save(),!n.isNodeJS){const{filter:q}=F;q!=="none"&&q!==""&&(F.filter="none")}F.scale(1/s,-1/p);let L;if(i.bitmap)L=this.applyTransferMapsToBitmap(i);else if(typeof HTMLElement=="function"&&i instanceof HTMLElement||!i.data)L=i;else{const tt=this.cachedCanvases.getCanvas("inlineImage",s,p).context;D(tt,i),L=this.applyTransferMapsToCanvas(tt)}const I=this._scaleImage(L,(0,f.getCurrentTransformInverse)(F));F.imageSmoothingEnabled=E((0,f.getCurrentTransform)(F),i.interpolate),g(F,I.img,0,0,I.paintWidth,I.paintHeight,0,-p,s,p),this.compose(),this.restore()}paintInlineImageXObjectGroup(i,s){if(!this.contentVisible)return;const p=this.ctx;let F;if(i.bitmap)F=i.bitmap;else{const L=i.width,I=i.height,tt=this.cachedCanvases.getCanvas("inlineImage",L,I).context;D(tt,i),F=this.applyTransferMapsToCanvas(tt)}for(const L of s)p.save(),p.transform(...L.transform),p.scale(1,-1),g(p,F,L.x,L.y,L.w,L.h,0,-1,1,1),p.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(i){}markPointProps(i,s){}beginMarkedContent(i){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(i,s){i==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(s)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(i){const s=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(i);const p=this.ctx;this.pendingClip&&(s||(this.pendingClip===Q?p.clip("evenodd"):p.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),p.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const i=(0,f.getCurrentTransform)(this.ctx);if(i[1]===0&&i[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(i[0]),Math.abs(i[3]));else{const s=Math.abs(i[0]*i[3]-i[2]*i[1]),p=Math.hypot(i[0],i[2]),F=Math.hypot(i[1],i[3]);this._cachedGetSinglePixelWidth=Math.max(p,F)/s}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:i}=this.current,{a:s,b:p,c:F,d:L}=this.ctx.getTransform();let I,q;if(p===0&&F===0){const tt=Math.abs(s),pt=Math.abs(L);if(tt===pt)if(i===0)I=q=1/tt;else{const gt=tt*i;I=q=gt<1?1/gt:1}else if(i===0)I=1/tt,q=1/pt;else{const gt=tt*i,bt=pt*i;I=gt<1?1/gt:1,q=bt<1?1/bt:1}}else{const tt=Math.abs(s*L-p*F),pt=Math.hypot(s,p),gt=Math.hypot(F,L);if(i===0)I=gt/tt,q=pt/tt;else{const bt=i*tt;I=gt>bt?gt/bt:1,q=pt>bt?pt/bt:1}}this._cachedScaleForStroking[0]=I,this._cachedScaleForStroking[1]=q}return this._cachedScaleForStroking}rescaleAndStroke(i){const{ctx:s}=this,{lineWidth:p}=this.current,[F,L]=this.getScaleForStroking();if(s.lineWidth=p||1,F===1&&L===1){s.stroke();return}const I=s.getLineDash();if(i&&s.save(),s.scale(F,L),I.length>0){const q=Math.max(F,L);s.setLineDash(I.map(tt=>tt/q)),s.lineDashOffset/=q}s.stroke(),i&&s.restore()}isContentVisible(){for(let i=this.markedContentStack.length-1;i>=0;i--)if(!this.markedContentStack[i].visible)return!1;return!0}};lt=new WeakSet,Ye=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)},Ke=function(){if(this.pageColors){const i=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(i!=="none"){const s=this.ctx.filter;this.ctx.filter=i,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=s}}};let W=it;e.CanvasGraphics=W;for(const w in n.OPS)W.prototype[w]!==void 0&&(W.prototype[n.OPS[w]]=W.prototype[w])},(M,e,H)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TilingPattern=e.PathType=void 0,e.getShadingPattern=A;var n=H(1),f=H(6);const X={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};e.PathType=X;function G(u,y){if(!y)return;const D=y[2]-y[0],v=y[3]-y[1],o=new Path2D;o.rect(y[0],y[1],D,v),u.clip(o)}class ut{constructor(){this.constructor===ut&&(0,n.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,n.unreachable)("Abstract method `getPattern` called.")}}class R extends ut{constructor(y){super(),this._type=y[1],this._bbox=y[2],this._colorStops=y[3],this._p0=y[4],this._p1=y[5],this._r0=y[6],this._r1=y[7],this.matrix=null}_createGradient(y){let D;this._type==="axial"?D=y.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(D=y.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const v of this._colorStops)D.addColorStop(v[0],v[1]);return D}getPattern(y,D,v,o){let d;if(o===X.STROKE||o===X.FILL){const l=D.current.getClippedPathBoundingBox(o,(0,f.getCurrentTransform)(y))||[0,0,0,0],c=Math.ceil(l[2]-l[0])||1,h=Math.ceil(l[3]-l[1])||1,N=D.cachedCanvases.getCanvas("pattern",c,h,!0),a=N.context;a.clearRect(0,0,a.canvas.width,a.canvas.height),a.beginPath(),a.rect(0,0,a.canvas.width,a.canvas.height),a.translate(-l[0],-l[1]),v=n.Util.transform(v,[1,0,0,1,l[0],l[1]]),a.transform(...D.baseTransform),this.matrix&&a.transform(...this.matrix),G(a,this._bbox),a.fillStyle=this._createGradient(a),a.fill(),d=y.createPattern(N.canvas,"no-repeat");const E=new DOMMatrix(v);d.setTransform(E)}else G(y,this._bbox),d=this._createGradient(y);return d}}function T(u,y,D,v,o,d,l,c){const h=y.coords,N=y.colors,a=u.data,E=u.width*4;let P;h[D+1]>h[v+1]&&(P=D,D=v,v=P,P=d,d=l,l=P),h[v+1]>h[o+1]&&(P=v,v=o,o=P,P=l,l=c,c=P),h[D+1]>h[v+1]&&(P=D,D=v,v=P,P=d,d=l,l=P);const et=(h[D]+y.offsetX)*y.scaleX,V=(h[D+1]+y.offsetY)*y.scaleY,Q=(h[v]+y.offsetX)*y.scaleX,W=(h[v+1]+y.offsetY)*y.scaleY,lt=(h[o]+y.offsetX)*y.scaleX,C=(h[o+1]+y.offsetY)*y.scaleY;if(V>=C)return;const $=N[d],it=N[d+1],w=N[d+2],i=N[l],s=N[l+1],p=N[l+2],F=N[c],L=N[c+1],I=N[c+2],q=Math.round(V),tt=Math.round(C);let pt,gt,bt,At,yt,Y,nt,b;for(let O=q;O<=tt;O++){if(O<W){const vt=O<V?0:(V-O)/(V-W);pt=et-(et-Q)*vt,gt=$-($-i)*vt,bt=it-(it-s)*vt,At=w-(w-p)*vt}else{let vt;O>C?vt=1:W===C?vt=0:vt=(W-O)/(W-C),pt=Q-(Q-lt)*vt,gt=i-(i-F)*vt,bt=s-(s-L)*vt,At=p-(p-I)*vt}let K;O<V?K=0:O>C?K=1:K=(V-O)/(V-C),yt=et-(et-lt)*K,Y=$-($-F)*K,nt=it-(it-L)*K,b=w-(w-I)*K;const st=Math.round(Math.min(pt,yt)),mt=Math.round(Math.max(pt,yt));let wt=E*O+st*4;for(let vt=st;vt<=mt;vt++)K=(pt-vt)/(pt-yt),K<0?K=0:K>1&&(K=1),a[wt++]=gt-(gt-Y)*K|0,a[wt++]=bt-(bt-nt)*K|0,a[wt++]=At-(At-b)*K|0,a[wt++]=255}}function m(u,y,D){const v=y.coords,o=y.colors;let d,l;switch(y.type){case"lattice":const c=y.verticesPerRow,h=Math.floor(v.length/c)-1,N=c-1;for(d=0;d<h;d++){let a=d*c;for(let E=0;E<N;E++,a++)T(u,D,v[a],v[a+1],v[a+c],o[a],o[a+1],o[a+c]),T(u,D,v[a+c+1],v[a+1],v[a+c],o[a+c+1],o[a+1],o[a+c])}break;case"triangles":for(d=0,l=v.length;d<l;d+=3)T(u,D,v[d],v[d+1],v[d+2],o[d],o[d+1],o[d+2]);break;default:throw new Error("illegal figure")}}class B extends ut{constructor(y){super(),this._coords=y[2],this._colors=y[3],this._figures=y[4],this._bounds=y[5],this._bbox=y[7],this._background=y[8],this.matrix=null}_createMeshCanvas(y,D,v){const c=Math.floor(this._bounds[0]),h=Math.floor(this._bounds[1]),N=Math.ceil(this._bounds[2])-c,a=Math.ceil(this._bounds[3])-h,E=Math.min(Math.ceil(Math.abs(N*y[0]*1.1)),3e3),P=Math.min(Math.ceil(Math.abs(a*y[1]*1.1)),3e3),et=N/E,V=a/P,Q={coords:this._coords,colors:this._colors,offsetX:-c,offsetY:-h,scaleX:1/et,scaleY:1/V},W=E+2*2,lt=P+2*2,C=v.getCanvas("mesh",W,lt,!1),$=C.context,it=$.createImageData(E,P);if(D){const i=it.data;for(let s=0,p=i.length;s<p;s+=4)i[s]=D[0],i[s+1]=D[1],i[s+2]=D[2],i[s+3]=255}for(const i of this._figures)m(it,i,Q);return $.putImageData(it,2,2),{canvas:C.canvas,offsetX:c-2*et,offsetY:h-2*V,scaleX:et,scaleY:V}}getPattern(y,D,v,o){G(y,this._bbox);let d;if(o===X.SHADING)d=n.Util.singularValueDecompose2dScale((0,f.getCurrentTransform)(y));else if(d=n.Util.singularValueDecompose2dScale(D.baseTransform),this.matrix){const c=n.Util.singularValueDecompose2dScale(this.matrix);d=[d[0]*c[0],d[1]*c[1]]}const l=this._createMeshCanvas(d,o===X.SHADING?null:this._background,D.cachedCanvases);return o!==X.SHADING&&(y.setTransform(...D.baseTransform),this.matrix&&y.transform(...this.matrix)),y.translate(l.offsetX,l.offsetY),y.scale(l.scaleX,l.scaleY),y.createPattern(l.canvas,"no-repeat")}}class j extends ut{getPattern(){return"hotpink"}}function A(u){switch(u[0]){case"RadialAxial":return new R(u);case"Mesh":return new B(u);case"Dummy":return new j}throw new Error(`Unknown IR type: ${u[0]}`)}const _={COLORED:1,UNCOLORED:2},g=class g{constructor(y,D,v,o,d){this.operatorList=y[2],this.matrix=y[3]||[1,0,0,1,0,0],this.bbox=y[4],this.xstep=y[5],this.ystep=y[6],this.paintType=y[7],this.tilingType=y[8],this.color=D,this.ctx=v,this.canvasGraphicsFactory=o,this.baseTransform=d}createPatternCanvas(y){const D=this.operatorList,v=this.bbox,o=this.xstep,d=this.ystep,l=this.paintType,c=this.tilingType,h=this.color,N=this.canvasGraphicsFactory;(0,n.info)("TilingType: "+c);const a=v[0],E=v[1],P=v[2],et=v[3],V=n.Util.singularValueDecompose2dScale(this.matrix),Q=n.Util.singularValueDecompose2dScale(this.baseTransform),W=[V[0]*Q[0],V[1]*Q[1]],lt=this.getSizeAndScale(o,this.ctx.canvas.width,W[0]),C=this.getSizeAndScale(d,this.ctx.canvas.height,W[1]),$=y.cachedCanvases.getCanvas("pattern",lt.size,C.size,!0),it=$.context,w=N.createCanvasGraphics(it);w.groupLevel=y.groupLevel,this.setFillAndStrokeStyleToContext(w,l,h);let i=a,s=E,p=P,F=et;return a<0&&(i=0,p+=Math.abs(a)),E<0&&(s=0,F+=Math.abs(E)),it.translate(-(lt.scale*i),-(C.scale*s)),w.transform(lt.scale,0,0,C.scale,0,0),it.save(),this.clipBbox(w,i,s,p,F),w.baseTransform=(0,f.getCurrentTransform)(w.ctx),w.executeOperatorList(D),w.endDrawing(),{canvas:$.canvas,scaleX:lt.scale,scaleY:C.scale,offsetX:i,offsetY:s}}getSizeAndScale(y,D,v){y=Math.abs(y);const o=Math.max(g.MAX_PATTERN_SIZE,D);let d=Math.ceil(y*v);return d>=o?d=o:v=d/y,{scale:v,size:d}}clipBbox(y,D,v,o,d){const l=o-D,c=d-v;y.ctx.rect(D,v,l,c),y.current.updateRectMinMax((0,f.getCurrentTransform)(y.ctx),[D,v,o,d]),y.clip(),y.endPath()}setFillAndStrokeStyleToContext(y,D,v){const o=y.ctx,d=y.current;switch(D){case _.COLORED:const l=this.ctx;o.fillStyle=l.fillStyle,o.strokeStyle=l.strokeStyle,d.fillColor=l.fillStyle,d.strokeColor=l.strokeStyle;break;case _.UNCOLORED:const c=n.Util.makeHexColor(v[0],v[1],v[2]);o.fillStyle=c,o.strokeStyle=c,d.fillColor=c,d.strokeColor=c;break;default:throw new n.FormatError(`Unsupported paint type: ${D}`)}}getPattern(y,D,v,o){let d=v;o!==X.SHADING&&(d=n.Util.transform(d,D.baseTransform),this.matrix&&(d=n.Util.transform(d,this.matrix)));const l=this.createPatternCanvas(D);let c=new DOMMatrix(d);c=c.translate(l.offsetX,l.offsetY),c=c.scale(1/l.scaleX,1/l.scaleY);const h=y.createPattern(l.canvas,"repeat");return h.setTransform(c),h}};Qt(g,"MAX_PATTERN_SIZE",3e3);let S=g;e.TilingPattern=S},(M,e,H)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.convertBlackAndWhiteToRGBA=X,e.convertToRGBA=f,e.grayToRGBA=ut;var n=H(1);function f(R){switch(R.kind){case n.ImageKind.GRAYSCALE_1BPP:return X(R);case n.ImageKind.RGB_24BPP:return G(R)}return null}function X({src:R,srcPos:T=0,dest:m,width:B,height:j,nonBlackColor:A=4294967295,inverseDecode:_=!1}){const S=n.FeatureTest.isLittleEndian?4278190080:255,[g,u]=_?[A,S]:[S,A],y=B>>3,D=B&7,v=R.length;m=new Uint32Array(m.buffer);let o=0;for(let d=0;d<j;d++){for(const c=T+y;T<c;T++){const h=T<v?R[T]:255;m[o++]=h&128?u:g,m[o++]=h&64?u:g,m[o++]=h&32?u:g,m[o++]=h&16?u:g,m[o++]=h&8?u:g,m[o++]=h&4?u:g,m[o++]=h&2?u:g,m[o++]=h&1?u:g}if(D===0)continue;const l=T<v?R[T++]:255;for(let c=0;c<D;c++)m[o++]=l&1<<7-c?u:g}return{srcPos:T,destPos:o}}function G({src:R,srcPos:T=0,dest:m,destPos:B=0,width:j,height:A}){let _=0;const S=R.length>>2,g=new Uint32Array(R.buffer,T,S);if(n.FeatureTest.isLittleEndian){for(;_<S-2;_+=3,B+=4){const u=g[_],y=g[_+1],D=g[_+2];m[B]=u|4278190080,m[B+1]=u>>>24|y<<8|4278190080,m[B+2]=y>>>16|D<<16|4278190080,m[B+3]=D>>>8|4278190080}for(let u=_*4,y=R.length;u<y;u+=3)m[B++]=R[u]|R[u+1]<<8|R[u+2]<<16|4278190080}else{for(;_<S-2;_+=3,B+=4){const u=g[_],y=g[_+1],D=g[_+2];m[B]=u|255,m[B+1]=u<<24|y>>>8|255,m[B+2]=y<<16|D>>>16|255,m[B+3]=D<<8|255}for(let u=_*4,y=R.length;u<y;u+=3)m[B++]=R[u]<<24|R[u+1]<<16|R[u+2]<<8|255}return{srcPos:T,destPos:B}}function ut(R,T){if(n.FeatureTest.isLittleEndian)for(let m=0,B=R.length;m<B;m++)T[m]=R[m]*65793|4278190080;else for(let m=0,B=R.length;m<B;m++)T[m]=R[m]*16843008|255}},(M,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalWorkerOptions=void 0;const H=Object.create(null);e.GlobalWorkerOptions=H,H.workerPort=null,H.workerSrc=""},(M,e,H)=>{var R,Cn,Pn,xe;Object.defineProperty(e,"__esModule",{value:!0}),e.MessageHandler=void 0;var n=H(1);const f={UNKNOWN:0,DATA:1,ERROR:2},X={UNKNOWN:0,CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function G(j){switch(j instanceof Error||typeof j=="object"&&j!==null||(0,n.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),j.name){case"AbortException":return new n.AbortException(j.message);case"MissingPDFException":return new n.MissingPDFException(j.message);case"PasswordException":return new n.PasswordException(j.message,j.code);case"UnexpectedResponseException":return new n.UnexpectedResponseException(j.message,j.status);case"UnknownErrorException":return new n.UnknownErrorException(j.message,j.details);default:return new n.UnknownErrorException(j.message,j.toString())}}class ut{constructor(A,_,S){rt(this,R);this.sourceName=A,this.targetName=_,this.comObj=S,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=g=>{const u=g.data;if(u.targetName!==this.sourceName)return;if(u.stream){J(this,R,Pn).call(this,u);return}if(u.callback){const D=u.callbackId,v=this.callbackCapabilities[D];if(!v)throw new Error(`Cannot resolve callback ${D}`);if(delete this.callbackCapabilities[D],u.callback===f.DATA)v.resolve(u.data);else if(u.callback===f.ERROR)v.reject(G(u.reason));else throw new Error("Unexpected callback case");return}const y=this.actionHandler[u.action];if(!y)throw new Error(`Unknown action from worker: ${u.action}`);if(u.callbackId){const D=this.sourceName,v=u.sourceName;new Promise(function(o){o(y(u.data))}).then(function(o){S.postMessage({sourceName:D,targetName:v,callback:f.DATA,callbackId:u.callbackId,data:o})},function(o){S.postMessage({sourceName:D,targetName:v,callback:f.ERROR,callbackId:u.callbackId,reason:G(o)})});return}if(u.streamId){J(this,R,Cn).call(this,u);return}y(u.data)},S.addEventListener("message",this._onComObjOnMessage)}on(A,_){const S=this.actionHandler;if(S[A])throw new Error(`There is already an actionName called "${A}"`);S[A]=_}send(A,_,S){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:A,data:_},S)}sendWithPromise(A,_,S){const g=this.callbackId++,u=new n.PromiseCapability;this.callbackCapabilities[g]=u;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:A,callbackId:g,data:_},S)}catch(y){u.reject(y)}return u.promise}sendWithStream(A,_,S,g){const u=this.streamId++,y=this.sourceName,D=this.targetName,v=this.comObj;return new ReadableStream({start:o=>{const d=new n.PromiseCapability;return this.streamControllers[u]={controller:o,startCall:d,pullCall:null,cancelCall:null,isClosed:!1},v.postMessage({sourceName:y,targetName:D,action:A,streamId:u,data:_,desiredSize:o.desiredSize},g),d.promise},pull:o=>{const d=new n.PromiseCapability;return this.streamControllers[u].pullCall=d,v.postMessage({sourceName:y,targetName:D,stream:X.PULL,streamId:u,desiredSize:o.desiredSize}),d.promise},cancel:o=>{(0,n.assert)(o instanceof Error,"cancel must have a valid reason");const d=new n.PromiseCapability;return this.streamControllers[u].cancelCall=d,this.streamControllers[u].isClosed=!0,v.postMessage({sourceName:y,targetName:D,stream:X.CANCEL,streamId:u,reason:G(o)}),d.promise}},S)}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}R=new WeakSet,Cn=function(A){const _=A.streamId,S=this.sourceName,g=A.sourceName,u=this.comObj,y=this,D=this.actionHandler[A.action],v={enqueue(o,d=1,l){if(this.isCancelled)return;const c=this.desiredSize;this.desiredSize-=d,c>0&&this.desiredSize<=0&&(this.sinkCapability=new n.PromiseCapability,this.ready=this.sinkCapability.promise),u.postMessage({sourceName:S,targetName:g,stream:X.ENQUEUE,streamId:_,chunk:o},l)},close(){this.isCancelled||(this.isCancelled=!0,u.postMessage({sourceName:S,targetName:g,stream:X.CLOSE,streamId:_}),delete y.streamSinks[_])},error(o){(0,n.assert)(o instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,u.postMessage({sourceName:S,targetName:g,stream:X.ERROR,streamId:_,reason:G(o)}))},sinkCapability:new n.PromiseCapability,onPull:null,onCancel:null,isCancelled:!1,desiredSize:A.desiredSize,ready:null};v.sinkCapability.resolve(),v.ready=v.sinkCapability.promise,this.streamSinks[_]=v,new Promise(function(o){o(D(A.data,v))}).then(function(){u.postMessage({sourceName:S,targetName:g,stream:X.START_COMPLETE,streamId:_,success:!0})},function(o){u.postMessage({sourceName:S,targetName:g,stream:X.START_COMPLETE,streamId:_,reason:G(o)})})},Pn=function(A){const _=A.streamId,S=this.sourceName,g=A.sourceName,u=this.comObj,y=this.streamControllers[_],D=this.streamSinks[_];switch(A.stream){case X.START_COMPLETE:A.success?y.startCall.resolve():y.startCall.reject(G(A.reason));break;case X.PULL_COMPLETE:A.success?y.pullCall.resolve():y.pullCall.reject(G(A.reason));break;case X.PULL:if(!D){u.postMessage({sourceName:S,targetName:g,stream:X.PULL_COMPLETE,streamId:_,success:!0});break}D.desiredSize<=0&&A.desiredSize>0&&D.sinkCapability.resolve(),D.desiredSize=A.desiredSize,new Promise(function(v){var o;v((o=D.onPull)==null?void 0:o.call(D))}).then(function(){u.postMessage({sourceName:S,targetName:g,stream:X.PULL_COMPLETE,streamId:_,success:!0})},function(v){u.postMessage({sourceName:S,targetName:g,stream:X.PULL_COMPLETE,streamId:_,reason:G(v)})});break;case X.ENQUEUE:if((0,n.assert)(y,"enqueue should have stream controller"),y.isClosed)break;y.controller.enqueue(A.chunk);break;case X.CLOSE:if((0,n.assert)(y,"close should have stream controller"),y.isClosed)break;y.isClosed=!0,y.controller.close(),J(this,R,xe).call(this,y,_);break;case X.ERROR:(0,n.assert)(y,"error should have stream controller"),y.controller.error(G(A.reason)),J(this,R,xe).call(this,y,_);break;case X.CANCEL_COMPLETE:A.success?y.cancelCall.resolve():y.cancelCall.reject(G(A.reason)),J(this,R,xe).call(this,y,_);break;case X.CANCEL:if(!D)break;new Promise(function(v){var o;v((o=D.onCancel)==null?void 0:o.call(D,G(A.reason)))}).then(function(){u.postMessage({sourceName:S,targetName:g,stream:X.CANCEL_COMPLETE,streamId:_,success:!0})},function(v){u.postMessage({sourceName:S,targetName:g,stream:X.CANCEL_COMPLETE,streamId:_,reason:G(v)})}),D.sinkCapability.reject(G(A.reason)),D.isCancelled=!0,delete this.streamSinks[_];break;default:throw new Error("Unexpected stream case")}},xe=async function(A,_){var S,g,u;await Promise.allSettled([(S=A.startCall)==null?void 0:S.promise,(g=A.pullCall)==null?void 0:g.promise,(u=A.cancelCall)==null?void 0:u.promise]),delete this.streamControllers[_]},e.MessageHandler=ut},(M,e,H)=>{var X,G;Object.defineProperty(e,"__esModule",{value:!0}),e.Metadata=void 0;var n=H(1);class f{constructor({parsedData:R,rawData:T}){rt(this,X);rt(this,G);ot(this,X,R),ot(this,G,T)}getRaw(){return t(this,G)}get(R){return t(this,X).get(R)??null}getAll(){return(0,n.objectFromMap)(t(this,X))}has(R){return t(this,X).has(R)}}X=new WeakMap,G=new WeakMap,e.Metadata=f},(M,e,H)=>{var R,T,m,B,j,A,Je;Object.defineProperty(e,"__esModule",{value:!0}),e.OptionalContentConfig=void 0;var n=H(1),f=H(8);const X=Symbol("INTERNAL");class G{constructor(g,u){rt(this,R,!0);this.name=g,this.intent=u}get visible(){return t(this,R)}_setVisible(g,u){g!==X&&(0,n.unreachable)("Internal method `_setVisible` called."),ot(this,R,u)}}R=new WeakMap;class ut{constructor(g){rt(this,A);rt(this,T,null);rt(this,m,new Map);rt(this,B,null);rt(this,j,null);if(this.name=null,this.creator=null,g!==null){this.name=g.name,this.creator=g.creator,ot(this,j,g.order);for(const u of g.groups)t(this,m).set(u.id,new G(u.name,u.intent));if(g.baseState==="OFF")for(const u of t(this,m).values())u._setVisible(X,!1);for(const u of g.on)t(this,m).get(u)._setVisible(X,!0);for(const u of g.off)t(this,m).get(u)._setVisible(X,!1);ot(this,B,this.getHash())}}isVisible(g){if(t(this,m).size===0)return!0;if(!g)return(0,n.warn)("Optional content group not defined."),!0;if(g.type==="OCG")return t(this,m).has(g.id)?t(this,m).get(g.id).visible:((0,n.warn)(`Optional content group not found: ${g.id}`),!0);if(g.type==="OCMD"){if(g.expression)return J(this,A,Je).call(this,g.expression);if(!g.policy||g.policy==="AnyOn"){for(const u of g.ids){if(!t(this,m).has(u))return(0,n.warn)(`Optional content group not found: ${u}`),!0;if(t(this,m).get(u).visible)return!0}return!1}else if(g.policy==="AllOn"){for(const u of g.ids){if(!t(this,m).has(u))return(0,n.warn)(`Optional content group not found: ${u}`),!0;if(!t(this,m).get(u).visible)return!1}return!0}else if(g.policy==="AnyOff"){for(const u of g.ids){if(!t(this,m).has(u))return(0,n.warn)(`Optional content group not found: ${u}`),!0;if(!t(this,m).get(u).visible)return!0}return!1}else if(g.policy==="AllOff"){for(const u of g.ids){if(!t(this,m).has(u))return(0,n.warn)(`Optional content group not found: ${u}`),!0;if(t(this,m).get(u).visible)return!1}return!0}return(0,n.warn)(`Unknown optional content policy ${g.policy}.`),!0}return(0,n.warn)(`Unknown group type ${g.type}.`),!0}setVisibility(g,u=!0){if(!t(this,m).has(g)){(0,n.warn)(`Optional content group not found: ${g}`);return}t(this,m).get(g)._setVisible(X,!!u),ot(this,T,null)}get hasInitialVisibility(){return t(this,B)===null||this.getHash()===t(this,B)}getOrder(){return t(this,m).size?t(this,j)?t(this,j).slice():[...t(this,m).keys()]:null}getGroups(){return t(this,m).size>0?(0,n.objectFromMap)(t(this,m)):null}getGroup(g){return t(this,m).get(g)||null}getHash(){if(t(this,T)!==null)return t(this,T);const g=new f.MurmurHash3_64;for(const[u,y]of t(this,m))g.update(`${u}:${y.visible}`);return ot(this,T,g.hexdigest())}}T=new WeakMap,m=new WeakMap,B=new WeakMap,j=new WeakMap,A=new WeakSet,Je=function(g){const u=g.length;if(u<2)return!0;const y=g[0];for(let D=1;D<u;D++){const v=g[D];let o;if(Array.isArray(v))o=J(this,A,Je).call(this,v);else if(t(this,m).has(v))o=t(this,m).get(v).visible;else return(0,n.warn)(`Optional content group not found: ${v}`),!0;switch(y){case"And":if(!o)return!1;break;case"Or":if(o)return!0;break;case"Not":return!o;default:return!0}}return y==="And"},e.OptionalContentConfig=ut},(M,e,H)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PDFDataTransportStream=void 0;var n=H(1),f=H(6);class X{constructor({length:T,initialData:m,progressiveDone:B=!1,contentDispositionFilename:j=null,disableRange:A=!1,disableStream:_=!1},S){if((0,n.assert)(S,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'),this._queuedChunks=[],this._progressiveDone=B,this._contentDispositionFilename=j,(m==null?void 0:m.length)>0){const g=m instanceof Uint8Array&&m.byteLength===m.buffer.byteLength?m.buffer:new Uint8Array(m).buffer;this._queuedChunks.push(g)}this._pdfDataRangeTransport=S,this._isStreamingSupported=!_,this._isRangeSupported=!A,this._contentLength=T,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener((g,u)=>{this._onReceiveData({begin:g,chunk:u})}),this._pdfDataRangeTransport.addProgressListener((g,u)=>{this._onProgress({loaded:g,total:u})}),this._pdfDataRangeTransport.addProgressiveReadListener(g=>{this._onReceiveData({chunk:g})}),this._pdfDataRangeTransport.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),this._pdfDataRangeTransport.transportReady()}_onReceiveData({begin:T,chunk:m}){const B=m instanceof Uint8Array&&m.byteLength===m.buffer.byteLength?m.buffer:new Uint8Array(m).buffer;if(T===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(B):this._queuedChunks.push(B);else{const j=this._rangeReaders.some(function(A){return A._begin!==T?!1:(A._enqueue(B),!0)});(0,n.assert)(j,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var T;return((T=this._fullRequestReader)==null?void 0:T._loaded)??0}_onProgress(T){var m,B,j,A;T.total===void 0?(B=(m=this._rangeReaders[0])==null?void 0:m.onProgress)==null||B.call(m,{loaded:T.loaded}):(A=(j=this._fullRequestReader)==null?void 0:j.onProgress)==null||A.call(j,{loaded:T.loaded,total:T.total})}_onProgressiveDone(){var T;(T=this._fullRequestReader)==null||T.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(T){const m=this._rangeReaders.indexOf(T);m>=0&&this._rangeReaders.splice(m,1)}getFullReader(){(0,n.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const T=this._queuedChunks;return this._queuedChunks=null,new G(this,T,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(T,m){if(m<=this._progressiveDataLength)return null;const B=new ut(this,T,m);return this._pdfDataRangeTransport.requestDataRange(T,m),this._rangeReaders.push(B),B}cancelAllRequests(T){var m;(m=this._fullRequestReader)==null||m.cancel(T);for(const B of this._rangeReaders.slice(0))B.cancel(T);this._pdfDataRangeTransport.abort()}}e.PDFDataTransportStream=X;class G{constructor(T,m,B=!1,j=null){this._stream=T,this._done=B||!1,this._filename=(0,f.isPdfFile)(j)?j:null,this._queuedChunks=m||[],this._loaded=0;for(const A of this._queuedChunks)this._loaded+=A.byteLength;this._requests=[],this._headersReady=Promise.resolve(),T._fullRequestReader=this,this.onProgress=null}_enqueue(T){this._done||(this._requests.length>0?this._requests.shift().resolve({value:T,done:!1}):this._queuedChunks.push(T),this._loaded+=T.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 T=new n.PromiseCapability;return this._requests.push(T),T.promise}cancel(T){this._done=!0;for(const m of this._requests)m.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class ut{constructor(T,m,B){this._stream=T,this._begin=m,this._end=B,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(T){if(!this._done){if(this._requests.length===0)this._queuedChunk=T;else{this._requests.shift().resolve({value:T,done:!1});for(const B of this._requests)B.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 m=this._queuedChunk;return this._queuedChunk=null,{value:m,done:!1}}if(this._done)return{value:void 0,done:!0};const T=new n.PromiseCapability;return this._requests.push(T),T.promise}cancel(T){this._done=!0;for(const m of this._requests)m.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}},(M,e,H)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PDFFetchStream=void 0;var n=H(1),f=H(20);function X(B,j,A){return{method:"GET",headers:B,signal:A.signal,mode:"cors",credentials:j?"include":"same-origin",redirect:"follow"}}function G(B){const j=new Headers;for(const A in B){const _=B[A];_!==void 0&&j.append(A,_)}return j}function ut(B){return B instanceof Uint8Array?B.buffer:B instanceof ArrayBuffer?B:((0,n.warn)(`getArrayBuffer - unexpected data format: ${B}`),new Uint8Array(B).buffer)}class R{constructor(j){this.source=j,this.isHttp=/^https?:/i.test(j.url),this.httpHeaders=this.isHttp&&j.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var j;return((j=this._fullRequestReader)==null?void 0:j._loaded)??0}getFullReader(){return(0,n.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new T(this),this._fullRequestReader}getRangeReader(j,A){if(A<=this._progressiveDataLength)return null;const _=new m(this,j,A);return this._rangeRequestReaders.push(_),_}cancelAllRequests(j){var A;(A=this._fullRequestReader)==null||A.cancel(j);for(const _ of this._rangeRequestReaders.slice(0))_.cancel(j)}}e.PDFFetchStream=R;class T{constructor(j){this._stream=j,this._reader=null,this._loaded=0,this._filename=null;const A=j.source;this._withCredentials=A.withCredentials||!1,this._contentLength=A.length,this._headersCapability=new n.PromiseCapability,this._disableRange=A.disableRange||!1,this._rangeChunkSize=A.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!A.disableStream,this._isRangeSupported=!A.disableRange,this._headers=G(this._stream.httpHeaders);const _=A.url;fetch(_,X(this._headers,this._withCredentials,this._abortController)).then(S=>{if(!(0,f.validateResponseStatus)(S.status))throw(0,f.createResponseStatusError)(S.status,_);this._reader=S.body.getReader(),this._headersCapability.resolve();const g=D=>S.headers.get(D),{allowRangeRequests:u,suggestedLength:y}=(0,f.validateRangeRequestCapabilities)({getResponseHeader:g,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=u,this._contentLength=y||this._contentLength,this._filename=(0,f.extractFilenameFromHeader)(g),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new n.AbortException("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var _;await this._headersCapability.promise;const{value:j,done:A}=await this._reader.read();return A?{value:j,done:A}:(this._loaded+=j.byteLength,(_=this.onProgress)==null||_.call(this,{loaded:this._loaded,total:this._contentLength}),{value:ut(j),done:!1})}cancel(j){var A;(A=this._reader)==null||A.cancel(j),this._abortController.abort()}}class m{constructor(j,A,_){this._stream=j,this._reader=null,this._loaded=0;const S=j.source;this._withCredentials=S.withCredentials||!1,this._readCapability=new n.PromiseCapability,this._isStreamingSupported=!S.disableStream,this._abortController=new AbortController,this._headers=G(this._stream.httpHeaders),this._headers.append("Range",`bytes=${A}-${_-1}`);const g=S.url;fetch(g,X(this._headers,this._withCredentials,this._abortController)).then(u=>{if(!(0,f.validateResponseStatus)(u.status))throw(0,f.createResponseStatusError)(u.status,g);this._readCapability.resolve(),this._reader=u.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var _;await this._readCapability.promise;const{value:j,done:A}=await this._reader.read();return A?{value:j,done:A}:(this._loaded+=j.byteLength,(_=this.onProgress)==null||_.call(this,{loaded:this._loaded}),{value:ut(j),done:!1})}cancel(j){var A;(A=this._reader)==null||A.cancel(j),this._abortController.abort()}}},(M,e,H)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createResponseStatusError=R,e.extractFilenameFromHeader=ut,e.validateRangeRequestCapabilities=G,e.validateResponseStatus=T;var n=H(1),f=H(21),X=H(6);function G({getResponseHeader:m,isHttp:B,rangeChunkSize:j,disableRange:A}){const _={allowRangeRequests:!1,suggestedLength:void 0},S=parseInt(m("Content-Length"),10);return!Number.isInteger(S)||(_.suggestedLength=S,S<=2*j)||A||!B||m("Accept-Ranges")!=="bytes"||(m("Content-Encoding")||"identity")!=="identity"||(_.allowRangeRequests=!0),_}function ut(m){const B=m("Content-Disposition");if(B){let j=(0,f.getFilenameFromContentDispositionHeader)(B);if(j.includes("%"))try{j=decodeURIComponent(j)}catch{}if((0,X.isPdfFile)(j))return j}return null}function R(m,B){return m===404||m===0&&B.startsWith("file:")?new n.MissingPDFException('Missing PDF "'+B+'".'):new n.UnexpectedResponseException(`Unexpected server response (${m}) while retrieving PDF "${B}".`,m)}function T(m){return m===200||m===206}},(M,e,H)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getFilenameFromContentDispositionHeader=f;var n=H(1);function f(X){let G=!0,ut=R("filename\\*","i").exec(X);if(ut){ut=ut[1];let S=j(ut);return S=unescape(S),S=A(S),S=_(S),m(S)}if(ut=B(X),ut){const S=_(ut);return m(S)}if(ut=R("filename","i").exec(X),ut){ut=ut[1];let S=j(ut);return S=_(S),m(S)}function R(S,g){return new RegExp("(?:^|;)\\s*"+S+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',g)}function T(S,g){if(S){if(!/^[\x00-\xFF]+$/.test(g))return g;try{const u=new TextDecoder(S,{fatal:!0}),y=(0,n.stringToBytes)(g);g=u.decode(y),G=!1}catch{}}return g}function m(S){return G&&/[\x80-\xff]/.test(S)&&(S=T("utf-8",S),G&&(S=T("iso-8859-1",S))),S}function B(S){const g=[];let u;const y=R("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(u=y.exec(S))!==null;){let[,v,o,d]=u;if(v=parseInt(v,10),v in g){if(v===0)break;continue}g[v]=[o,d]}const D=[];for(let v=0;v<g.length&&v in g;++v){let[o,d]=g[v];d=j(d),o&&(d=unescape(d),v===0&&(d=A(d))),D.push(d)}return D.join("")}function j(S){if(S.startsWith('"')){const g=S.slice(1).split('\\"');for(let u=0;u<g.length;++u){const y=g[u].indexOf('"');y!==-1&&(g[u]=g[u].slice(0,y),g.length=u+1),g[u]=g[u].replaceAll(/\\(.)/g,"$1")}S=g.join('"')}return S}function A(S){const g=S.indexOf("'");if(g===-1)return S;const u=S.slice(0,g),D=S.slice(g+1).replace(/^[^']*'/,"");return T(u,D)}function _(S){return!S.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(S)?S:S.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(g,u,y,D){if(y==="q"||y==="Q")return D=D.replaceAll("_"," "),D=D.replaceAll(/=([0-9a-fA-F]{2})/g,function(v,o){return String.fromCharCode(parseInt(o,16))}),T(u,D);try{D=atob(D)}catch{}return T(u,D)})}return""}},(M,e,H)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PDFNetworkStream=void 0;var n=H(1),f=H(20);const X=200,G=206;function ut(j){const A=j.response;return typeof A!="string"?A:(0,n.stringToBytes)(A).buffer}class R{constructor(A,_={}){this.url=A,this.isHttp=/^https?:/i.test(A),this.httpHeaders=this.isHttp&&_.httpHeaders||Object.create(null),this.withCredentials=_.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(A,_,S){const g={begin:A,end:_};for(const u in S)g[u]=S[u];return this.request(g)}requestFull(A){return this.request(A)}request(A){const _=new XMLHttpRequest,S=this.currXhrId++,g=this.pendingRequests[S]={xhr:_};_.open("GET",this.url),_.withCredentials=this.withCredentials;for(const u in this.httpHeaders){const y=this.httpHeaders[u];y!==void 0&&_.setRequestHeader(u,y)}return this.isHttp&&"begin"in A&&"end"in A?(_.setRequestHeader("Range",`bytes=${A.begin}-${A.end-1}`),g.expectedStatus=G):g.expectedStatus=X,_.responseType="arraybuffer",A.onError&&(_.onerror=function(u){A.onError(_.status)}),_.onreadystatechange=this.onStateChange.bind(this,S),_.onprogress=this.onProgress.bind(this,S),g.onHeadersReceived=A.onHeadersReceived,g.onDone=A.onDone,g.onError=A.onError,g.onProgress=A.onProgress,_.send(null),S}onProgress(A,_){var g;const S=this.pendingRequests[A];S&&((g=S.onProgress)==null||g.call(S,_))}onStateChange(A,_){var v,o,d;const S=this.pendingRequests[A];if(!S)return;const g=S.xhr;if(g.readyState>=2&&S.onHeadersReceived&&(S.onHeadersReceived(),delete S.onHeadersReceived),g.readyState!==4||!(A in this.pendingRequests))return;if(delete this.pendingRequests[A],g.status===0&&this.isHttp){(v=S.onError)==null||v.call(S,g.status);return}const u=g.status||X;if(!(u===X&&S.expectedStatus===G)&&u!==S.expectedStatus){(o=S.onError)==null||o.call(S,g.status);return}const D=ut(g);if(u===G){const l=g.getResponseHeader("Content-Range"),c=/bytes (\d+)-(\d+)\/(\d+)/.exec(l);S.onDone({begin:parseInt(c[1],10),chunk:D})}else D?S.onDone({begin:0,chunk:D}):(d=S.onError)==null||d.call(S,g.status)}getRequestXhr(A){return this.pendingRequests[A].xhr}isPendingRequest(A){return A in this.pendingRequests}abortRequest(A){const _=this.pendingRequests[A].xhr;delete this.pendingRequests[A],_.abort()}}class T{constructor(A){this._source=A,this._manager=new R(A.url,{httpHeaders:A.httpHeaders,withCredentials:A.withCredentials}),this._rangeChunkSize=A.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(A){const _=this._rangeRequestReaders.indexOf(A);_>=0&&this._rangeRequestReaders.splice(_,1)}getFullReader(){return(0,n.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new m(this._manager,this._source),this._fullRequestReader}getRangeReader(A,_){const S=new B(this._manager,A,_);return S.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(S),S}cancelAllRequests(A){var _;(_=this._fullRequestReader)==null||_.cancel(A);for(const S of this._rangeRequestReaders.slice(0))S.cancel(A)}}e.PDFNetworkStream=T;class m{constructor(A,_){this._manager=A;const S={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=_.url,this._fullRequestId=A.requestFull(S),this._headersReceivedCapability=new n.PromiseCapability,this._disableRange=_.disableRange||!1,this._contentLength=_.length,this._rangeChunkSize=_.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 A=this._fullRequestId,_=this._manager.getRequestXhr(A),S=y=>_.getResponseHeader(y),{allowRangeRequests:g,suggestedLength:u}=(0,f.validateRangeRequestCapabilities)({getResponseHeader:S,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});g&&(this._isRangeSupported=!0),this._contentLength=u||this._contentLength,this._filename=(0,f.extractFilenameFromHeader)(S),this._isRangeSupported&&this._manager.abortRequest(A),this._headersReceivedCapability.resolve()}_onDone(A){if(A&&(this._requests.length>0?this._requests.shift().resolve({value:A.chunk,done:!1}):this._cachedChunks.push(A.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const _ of this._requests)_.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(A){this._storedError=(0,f.createResponseStatusError)(A,this._url),this._headersReceivedCapability.reject(this._storedError);for(const _ of this._requests)_.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(A){var _;(_=this.onProgress)==null||_.call(this,{loaded:A.loaded,total:A.lengthComputable?A.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 A=new n.PromiseCapability;return this._requests.push(A),A.promise}cancel(A){this._done=!0,this._headersReceivedCapability.reject(A);for(const _ of this._requests)_.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class B{constructor(A,_,S){this._manager=A;const g={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=A.url,this._requestId=A.requestRange(_,S,g),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){var A;(A=this.onClosed)==null||A.call(this,this)}_onDone(A){const _=A.chunk;this._requests.length>0?this._requests.shift().resolve({value:_,done:!1}):this._queuedChunk=_,this._done=!0;for(const S of this._requests)S.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(A){this._storedError=(0,f.createResponseStatusError)(A,this._url);for(const _ of this._requests)_.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(A){var _;this.isStreamingSupported||(_=this.onProgress)==null||_.call(this,{loaded:A.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const _=this._queuedChunk;return this._queuedChunk=null,{value:_,done:!1}}if(this._done)return{value:void 0,done:!0};const A=new n.PromiseCapability;return this._requests.push(A),A.promise}cancel(A){this._done=!0;for(const _ of this._requests)_.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}},(M,e,H)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PDFNodeStream=void 0;var n=H(1),f=H(20);const X=/^file:\/\/\/[a-zA-Z]:\//;function G(S){const g=require$$5,u=g.parse(S);return u.protocol==="file:"||u.host?u:/^[a-z]:[/\\]/i.test(S)?g.parse(`file:///${S}`):(u.host||(u.protocol="file:"),u)}class ut{constructor(g){this.source=g,this.url=G(g.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.httpHeaders=this.isHttp&&g.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var g;return((g=this._fullRequestReader)==null?void 0:g._loaded)??0}getFullReader(){return(0,n.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new A(this):new B(this),this._fullRequestReader}getRangeReader(g,u){if(u<=this._progressiveDataLength)return null;const y=this.isFsUrl?new _(this,g,u):new j(this,g,u);return this._rangeRequestReaders.push(y),y}cancelAllRequests(g){var u;(u=this._fullRequestReader)==null||u.cancel(g);for(const y of this._rangeRequestReaders.slice(0))y.cancel(g)}}e.PDFNodeStream=ut;class R{constructor(g){this._url=g.url,this._done=!1,this._storedError=null,this.onProgress=null;const u=g.source;this._contentLength=u.length,this._loaded=0,this._filename=null,this._disableRange=u.disableRange||!1,this._rangeChunkSize=u.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!u.disableStream,this._isRangeSupported=!u.disableRange,this._readableStream=null,this._readCapability=new n.PromiseCapability,this._headersCapability=new n.PromiseCapability}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var y;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const g=this._readableStream.read();return g===null?(this._readCapability=new n.PromiseCapability,this.read()):(this._loaded+=g.length,(y=this.onProgress)==null||y.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(g).buffer,done:!1})}cancel(g){if(!this._readableStream){this._error(g);return}this._readableStream.destroy(g)}_error(g){this._storedError=g,this._readCapability.resolve()}_setReadableStream(g){this._readableStream=g,g.on("readable",()=>{this._readCapability.resolve()}),g.on("end",()=>{g.destroy(),this._done=!0,this._readCapability.resolve()}),g.on("error",u=>{this._error(u)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new n.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class T{constructor(g){this._url=g.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=new n.PromiseCapability;const u=g.source;this._isStreamingSupported=!u.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){var y;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const g=this._readableStream.read();return g===null?(this._readCapability=new n.PromiseCapability,this.read()):(this._loaded+=g.length,(y=this.onProgress)==null||y.call(this,{loaded:this._loaded}),{value:new Uint8Array(g).buffer,done:!1})}cancel(g){if(!this._readableStream){this._error(g);return}this._readableStream.destroy(g)}_error(g){this._storedError=g,this._readCapability.resolve()}_setReadableStream(g){this._readableStream=g,g.on("readable",()=>{this._readCapability.resolve()}),g.on("end",()=>{g.destroy(),this._done=!0,this._readCapability.resolve()}),g.on("error",u=>{this._error(u)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function m(S,g){return{protocol:S.protocol,auth:S.auth,host:S.hostname,port:S.port,path:S.path,method:"GET",headers:g}}class B extends R{constructor(g){super(g);const u=y=>{if(y.statusCode===404){const d=new n.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=d,this._headersCapability.reject(d);return}this._headersCapability.resolve(),this._setReadableStream(y);const D=d=>this._readableStream.headers[d.toLowerCase()],{allowRangeRequests:v,suggestedLength:o}=(0,f.validateRangeRequestCapabilities)({getResponseHeader:D,isHttp:g.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=v,this._contentLength=o||this._contentLength,this._filename=(0,f.extractFilenameFromHeader)(D)};if(this._request=null,this._url.protocol==="http:"){const y=require$$5;this._request=y.request(m(this._url,g.httpHeaders),u)}else{const y=require$$5;this._request=y.request(m(this._url,g.httpHeaders),u)}this._request.on("error",y=>{this._storedError=y,this._headersCapability.reject(y)}),this._request.end()}}class j extends T{constructor(g,u,y){super(g),this._httpHeaders={};for(const v in g.httpHeaders){const o=g.httpHeaders[v];o!==void 0&&(this._httpHeaders[v]=o)}this._httpHeaders.Range=`bytes=${u}-${y-1}`;const D=v=>{if(v.statusCode===404){const o=new n.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=o;return}this._setReadableStream(v)};if(this._request=null,this._url.protocol==="http:"){const v=require$$5;this._request=v.request(m(this._url,this._httpHeaders),D)}else{const v=require$$5;this._request=v.request(m(this._url,this._httpHeaders),D)}this._request.on("error",v=>{this._storedError=v}),this._request.end()}}class A extends R{constructor(g){super(g);let u=decodeURIComponent(this._url.path);X.test(this._url.href)&&(u=u.replace(/^\//,""));const y=require$$5;y.lstat(u,(D,v)=>{if(D){D.code==="ENOENT"&&(D=new n.MissingPDFException(`Missing PDF "${u}".`)),this._storedError=D,this._headersCapability.reject(D);return}this._contentLength=v.size,this._setReadableStream(y.createReadStream(u)),this._headersCapability.resolve()})}}class _ extends T{constructor(g,u,y){super(g);let D=decodeURIComponent(this._url.path);X.test(this._url.href)&&(D=D.replace(/^\//,""));const v=require$$5;this._setReadableStream(v.createReadStream(D,{start:u,end:y-1}))}}},(M,e,H)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SVGGraphics=void 0;var n=H(6),f=H(1);const X={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},G="http://www.w3.org/XML/1998/namespace",ut="http://www.w3.org/1999/xlink",R=["butt","round","square"],T=["miter","round","bevel"],m=function(v,o="",d=!1){if(URL.createObjectURL&&typeof Blob<"u"&&!d)return URL.createObjectURL(new Blob([v],{type:o}));const l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let c=`data:${o};base64,`;for(let h=0,N=v.length;h<N;h+=3){const a=v[h]&255,E=v[h+1]&255,P=v[h+2]&255,et=a>>2,V=(a&3)<<4|E>>4,Q=h+1<N?(E&15)<<2|P>>6:64,W=h+2<N?P&63:64;c+=l[et]+l[V]+l[Q]+l[W]}return c},B=function(){const v=new Uint8Array([137,80,78,71,13,10,26,10]),o=12,d=new Int32Array(256);for(let P=0;P<256;P++){let et=P;for(let V=0;V<8;V++)et=et&1?3988292384^et>>1&2147483647:et>>1&2147483647;d[P]=et}function l(P,et,V){let Q=-1;for(let W=et;W<V;W++){const lt=(Q^P[W])&255,C=d[lt];Q=Q>>>8^C}return Q^-1}function c(P,et,V,Q){let W=Q;const lt=et.length;V[W]=lt>>24&255,V[W+1]=lt>>16&255,V[W+2]=lt>>8&255,V[W+3]=lt&255,W+=4,V[W]=P.charCodeAt(0)&255,V[W+1]=P.charCodeAt(1)&255,V[W+2]=P.charCodeAt(2)&255,V[W+3]=P.charCodeAt(3)&255,W+=4,V.set(et,W),W+=et.length;const C=l(V,Q+4,W);V[W]=C>>24&255,V[W+1]=C>>16&255,V[W+2]=C>>8&255,V[W+3]=C&255}function h(P,et,V){let Q=1,W=0;for(let lt=et;lt<V;++lt)Q=(Q+(P[lt]&255))%65521,W=(W+Q)%65521;return W<<16|Q}function N(P){if(!f.isNodeJS)return a(P);try{const et=parseInt(process.versions.node)>=8?P:Buffer.from(P),V=require$$5.deflateSync(et,{level:9});return V instanceof Uint8Array?V:new Uint8Array(V)}catch(et){(0,f.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+et)}return a(P)}function a(P){let et=P.length;const V=65535,Q=Math.ceil(et/V),W=new Uint8Array(2+et+Q*5+4);let lt=0;W[lt++]=120,W[lt++]=156;let C=0;for(;et>V;)W[lt++]=0,W[lt++]=255,W[lt++]=255,W[lt++]=0,W[lt++]=0,W.set(P.subarray(C,C+V),lt),lt+=V,C+=V,et-=V;W[lt++]=1,W[lt++]=et&255,W[lt++]=et>>8&255,W[lt++]=~et&65535&255,W[lt++]=(~et&65535)>>8&255,W.set(P.subarray(C),lt),lt+=P.length-C;const $=h(P,0,P.length);return W[lt++]=$>>24&255,W[lt++]=$>>16&255,W[lt++]=$>>8&255,W[lt++]=$&255,W}function E(P,et,V,Q){const W=P.width,lt=P.height;let C,$,it;const w=P.data;switch(et){case f.ImageKind.GRAYSCALE_1BPP:$=0,C=1,it=W+7>>3;break;case f.ImageKind.RGB_24BPP:$=2,C=8,it=W*3;break;case f.ImageKind.RGBA_32BPP:$=6,C=8,it=W*4;break;default:throw new Error("invalid format")}const i=new Uint8Array((1+it)*lt);let s=0,p=0;for(let pt=0;pt<lt;++pt)i[s++]=0,i.set(w.subarray(p,p+it),s),p+=it,s+=it;if(et===f.ImageKind.GRAYSCALE_1BPP&&Q){s=0;for(let pt=0;pt<lt;pt++){s++;for(let gt=0;gt<it;gt++)i[s++]^=255}}const F=new Uint8Array([W>>24&255,W>>16&255,W>>8&255,W&255,lt>>24&255,lt>>16&255,lt>>8&255,lt&255,C,$,0,0,0]),L=N(i),I=v.length+o*3+F.length+L.length,q=new Uint8Array(I);let tt=0;return q.set(v,tt),tt+=v.length,c("IHDR",F,q,tt),tt+=o+F.length,c("IDATA",L,q,tt),tt+=o+L.length,c("IEND",new Uint8Array(0),q,tt),m(q,"image/png",V)}return function(et,V,Q){const W=et.kind===void 0?f.ImageKind.GRAYSCALE_1BPP:et.kind;return E(et,W,V,Q)}}();class j{constructor(){this.fontSizeScale=1,this.fontWeight=X.fontWeight,this.fontSize=0,this.textMatrix=f.IDENTITY_MATRIX,this.fontMatrix=f.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=f.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=X.fillColor,this.strokeColor="#000000",this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.lineJoin="",this.lineCap="",this.miterLimit=0,this.dashArray=[],this.dashPhase=0,this.dependencies=[],this.activeClipUrl=null,this.clipGroup=null,this.maskId=""}clone(){return Object.create(this)}setCurrentPoint(o,d){this.x=o,this.y=d}}function A(v){let o=[];const d=[];for(const l of v){if(l.fn==="save"){o.push({fnId:92,fn:"group",items:[]}),d.push(o),o=o.at(-1).items;continue}l.fn==="restore"?o=d.pop():o.push(l)}return o}function _(v){if(Number.isInteger(v))return v.toString();const o=v.toFixed(10);let d=o.length-1;if(o[d]!=="0")return o;do d--;while(o[d]==="0");return o.substring(0,o[d]==="."?d:d+1)}function S(v){if(v[4]===0&&v[5]===0){if(v[1]===0&&v[2]===0)return v[0]===1&&v[3]===1?"":`scale(${_(v[0])} ${_(v[3])})`;if(v[0]===v[3]&&v[1]===-v[2]){const o=Math.acos(v[0])*180/Math.PI;return`rotate(${_(o)})`}}else if(v[0]===1&&v[1]===0&&v[2]===0&&v[3]===1)return`translate(${_(v[4])} ${_(v[5])})`;return`matrix(${_(v[0])} ${_(v[1])} ${_(v[2])} ${_(v[3])} ${_(v[4])} ${_(v[5])})`}let g=0,u=0,y=0;class D{constructor(o,d,l=!1){(0,n.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future."),this.svgFactory=new n.DOMSVGFactory,this.current=new j,this.transformMatrix=f.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=o,this.objs=d,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!l,this._operatorIdMapping=[];for(const c in f.OPS)this._operatorIdMapping[f.OPS[c]]=c}getObject(o,d=null){return typeof o=="string"?o.startsWith("g_")?this.commonObjs.get(o):this.objs.get(o):d}save(){this.transformStack.push(this.transformMatrix);const o=this.current;this.extraStack.push(o),this.current=o.clone()}restore(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}group(o){this.save(),this.executeOpTree(o),this.restore()}loadDependencies(o){const d=o.fnArray,l=o.argsArray;for(let c=0,h=d.length;c<h;c++)if(d[c]===f.OPS.dependency)for(const N of l[c]){const a=N.startsWith("g_")?this.commonObjs:this.objs,E=new Promise(P=>{a.get(N,P)});this.current.dependencies.push(E)}return Promise.all(this.current.dependencies)}transform(o,d,l,c,h,N){const a=[o,d,l,c,h,N];this.transformMatrix=f.Util.transform(this.transformMatrix,a),this.tgrp=null}getSVG(o,d){this.viewport=d;const l=this._initialize(d);return this.loadDependencies(o).then(()=>(this.transformMatrix=f.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(o)),l))}convertOpList(o){const d=this._operatorIdMapping,l=o.argsArray,c=o.fnArray,h=[];for(let N=0,a=c.length;N<a;N++){const E=c[N];h.push({fnId:E,fn:d[E],args:l[N]})}return A(h)}executeOpTree(o){for(const d of o){const l=d.fn,c=d.fnId,h=d.args;switch(c|0){case f.OPS.beginText:this.beginText();break;case f.OPS.dependency:break;case f.OPS.setLeading:this.setLeading(h);break;case f.OPS.setLeadingMoveText:this.setLeadingMoveText(h[0],h[1]);break;case f.OPS.setFont:this.setFont(h);break;case f.OPS.showText:this.showText(h[0]);break;case f.OPS.showSpacedText:this.showText(h[0]);break;case f.OPS.endText:this.endText();break;case f.OPS.moveText:this.moveText(h[0],h[1]);break;case f.OPS.setCharSpacing:this.setCharSpacing(h[0]);break;case f.OPS.setWordSpacing:this.setWordSpacing(h[0]);break;case f.OPS.setHScale:this.setHScale(h[0]);break;case f.OPS.setTextMatrix:this.setTextMatrix(h[0],h[1],h[2],h[3],h[4],h[5]);break;case f.OPS.setTextRise:this.setTextRise(h[0]);break;case f.OPS.setTextRenderingMode:this.setTextRenderingMode(h[0]);break;case f.OPS.setLineWidth:this.setLineWidth(h[0]);break;case f.OPS.setLineJoin:this.setLineJoin(h[0]);break;case f.OPS.setLineCap:this.setLineCap(h[0]);break;case f.OPS.setMiterLimit:this.setMiterLimit(h[0]);break;case f.OPS.setFillRGBColor:this.setFillRGBColor(h[0],h[1],h[2]);break;case f.OPS.setStrokeRGBColor:this.setStrokeRGBColor(h[0],h[1],h[2]);break;case f.OPS.setStrokeColorN:this.setStrokeColorN(h);break;case f.OPS.setFillColorN:this.setFillColorN(h);break;case f.OPS.shadingFill:this.shadingFill(h[0]);break;case f.OPS.setDash:this.setDash(h[0],h[1]);break;case f.OPS.setRenderingIntent:this.setRenderingIntent(h[0]);break;case f.OPS.setFlatness:this.setFlatness(h[0]);break;case f.OPS.setGState:this.setGState(h[0]);break;case f.OPS.fill:this.fill();break;case f.OPS.eoFill:this.eoFill();break;case f.OPS.stroke:this.stroke();break;case f.OPS.fillStroke:this.fillStroke();break;case f.OPS.eoFillStroke:this.eoFillStroke();break;case f.OPS.clip:this.clip("nonzero");break;case f.OPS.eoClip:this.clip("evenodd");break;case f.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case f.OPS.paintImageXObject:this.paintImageXObject(h[0]);break;case f.OPS.paintInlineImageXObject:this.paintInlineImageXObject(h[0]);break;case f.OPS.paintImageMaskXObject:this.paintImageMaskXObject(h[0]);break;case f.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(h[0],h[1]);break;case f.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case f.OPS.closePath:this.closePath();break;case f.OPS.closeStroke:this.closeStroke();break;case f.OPS.closeFillStroke:this.closeFillStroke();break;case f.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case f.OPS.nextLine:this.nextLine();break;case f.OPS.transform:this.transform(h[0],h[1],h[2],h[3],h[4],h[5]);break;case f.OPS.constructPath:this.constructPath(h[0],h[1]);break;case f.OPS.endPath:this.endPath();break;case 92:this.group(d.items);break;default:(0,f.warn)(`Unimplemented operator ${l}`);break}}}setWordSpacing(o){this.current.wordSpacing=o}setCharSpacing(o){this.current.charSpacing=o}nextLine(){this.moveText(0,this.current.leading)}setTextMatrix(o,d,l,c,h,N){const a=this.current;a.textMatrix=a.lineMatrix=[o,d,l,c,h,N],a.textMatrixScale=Math.hypot(o,d),a.x=a.lineX=0,a.y=a.lineY=0,a.xcoords=[],a.ycoords=[],a.tspan=this.svgFactory.createElement("svg:tspan"),a.tspan.setAttributeNS(null,"font-family",a.fontFamily),a.tspan.setAttributeNS(null,"font-size",`${_(a.fontSize)}px`),a.tspan.setAttributeNS(null,"y",_(-a.y)),a.txtElement=this.svgFactory.createElement("svg:text"),a.txtElement.append(a.tspan)}beginText(){const o=this.current;o.x=o.lineX=0,o.y=o.lineY=0,o.textMatrix=f.IDENTITY_MATRIX,o.lineMatrix=f.IDENTITY_MATRIX,o.textMatrixScale=1,o.tspan=this.svgFactory.createElement("svg:tspan"),o.txtElement=this.svgFactory.createElement("svg:text"),o.txtgrp=this.svgFactory.createElement("svg:g"),o.xcoords=[],o.ycoords=[]}moveText(o,d){const l=this.current;l.x=l.lineX+=o,l.y=l.lineY+=d,l.xcoords=[],l.ycoords=[],l.tspan=this.svgFactory.createElement("svg:tspan"),l.tspan.setAttributeNS(null,"font-family",l.fontFamily),l.tspan.setAttributeNS(null,"font-size",`${_(l.fontSize)}px`),l.tspan.setAttributeNS(null,"y",_(-l.y))}showText(o){const d=this.current,l=d.font,c=d.fontSize;if(c===0)return;const h=d.fontSizeScale,N=d.charSpacing,a=d.wordSpacing,E=d.fontDirection,P=d.textHScale*E,et=l.vertical,V=et?1:-1,Q=l.defaultVMetrics,W=c*d.fontMatrix[0];let lt=0;for(const it of o){if(it===null){lt+=E*a;continue}else if(typeof it=="number"){lt+=V*it*c/1e3;continue}const w=(it.isSpace?a:0)+N,i=it.fontChar;let s,p,F=it.width;if(et){let I;const q=it.vmetric||Q;I=it.vmetric?q[1]:F*.5,I=-I*W;const tt=q[2]*W;F=q?-q[0]:F,s=I/h,p=(lt+tt)/h}else s=lt/h,p=0;(it.isInFont||l.missingFile)&&(d.xcoords.push(d.x+s),et&&d.ycoords.push(-d.y+p),d.tspan.textContent+=i);const L=et?F*W-w*E:F*W+w*E;lt+=L}d.tspan.setAttributeNS(null,"x",d.xcoords.map(_).join(" ")),et?d.tspan.setAttributeNS(null,"y",d.ycoords.map(_).join(" ")):d.tspan.setAttributeNS(null,"y",_(-d.y)),et?d.y-=lt:d.x+=lt*P,d.tspan.setAttributeNS(null,"font-family",d.fontFamily),d.tspan.setAttributeNS(null,"font-size",`${_(d.fontSize)}px`),d.fontStyle!==X.fontStyle&&d.tspan.setAttributeNS(null,"font-style",d.fontStyle),d.fontWeight!==X.fontWeight&&d.tspan.setAttributeNS(null,"font-weight",d.fontWeight);const C=d.textRenderingMode&f.TextRenderingMode.FILL_STROKE_MASK;if(C===f.TextRenderingMode.FILL||C===f.TextRenderingMode.FILL_STROKE?(d.fillColor!==X.fillColor&&d.tspan.setAttributeNS(null,"fill",d.fillColor),d.fillAlpha<1&&d.tspan.setAttributeNS(null,"fill-opacity",d.fillAlpha)):d.textRenderingMode===f.TextRenderingMode.ADD_TO_PATH?d.tspan.setAttributeNS(null,"fill","transparent"):d.tspan.setAttributeNS(null,"fill","none"),C===f.TextRenderingMode.STROKE||C===f.TextRenderingMode.FILL_STROKE){const it=1/(d.textMatrixScale||1);this._setStrokeAttributes(d.tspan,it)}let $=d.textMatrix;d.textRise!==0&&($=$.slice(),$[5]+=d.textRise),d.txtElement.setAttributeNS(null,"transform",`${S($)} scale(${_(P)}, -1)`),d.txtElement.setAttributeNS(G,"xml:space","preserve"),d.txtElement.append(d.tspan),d.txtgrp.append(d.txtElement),this._ensureTransformGroup().append(d.txtElement)}setLeadingMoveText(o,d){this.setLeading(-d),this.moveText(o,d)}addFontStyle(o){if(!o.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 d=m(o.data,o.mimetype,this.forceDataSchema);this.cssStyle.textContent+=`@font-face { font-family: "${o.loadedName}"; src: url(${d}); }
`}setFont(o){const d=this.current,l=this.commonObjs.get(o[0]);let c=o[1];d.font=l,this.embedFonts&&!l.missingFile&&!this.embeddedFonts[l.loadedName]&&(this.addFontStyle(l),this.embeddedFonts[l.loadedName]=l),d.fontMatrix=l.fontMatrix||f.FONT_IDENTITY_MATRIX;let h="normal";l.black?h="900":l.bold&&(h="bold");const N=l.italic?"italic":"normal";c<0?(c=-c,d.fontDirection=-1):d.fontDirection=1,d.fontSize=c,d.fontFamily=l.loadedName,d.fontWeight=h,d.fontStyle=N,d.tspan=this.svgFactory.createElement("svg:tspan"),d.tspan.setAttributeNS(null,"y",_(-d.y)),d.xcoords=[],d.ycoords=[]}endText(){var d;const o=this.current;o.textRenderingMode&f.TextRenderingMode.ADD_TO_PATH_FLAG&&((d=o.txtElement)!=null&&d.hasChildNodes())&&(o.element=o.txtElement,this.clip("nonzero"),this.endPath())}setLineWidth(o){o>0&&(this.current.lineWidth=o)}setLineCap(o){this.current.lineCap=R[o]}setLineJoin(o){this.current.lineJoin=T[o]}setMiterLimit(o){this.current.miterLimit=o}setStrokeAlpha(o){this.current.strokeAlpha=o}setStrokeRGBColor(o,d,l){this.current.strokeColor=f.Util.makeHexColor(o,d,l)}setFillAlpha(o){this.current.fillAlpha=o}setFillRGBColor(o,d,l){this.current.fillColor=f.Util.makeHexColor(o,d,l),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(o){this.current.strokeColor=this._makeColorN_Pattern(o)}setFillColorN(o){this.current.fillColor=this._makeColorN_Pattern(o)}shadingFill(o){const{width:d,height:l}=this.viewport,c=f.Util.inverseTransform(this.transformMatrix),[h,N,a,E]=f.Util.getAxialAlignedBoundingBox([0,0,d,l],c),P=this.svgFactory.createElement("svg:rect");P.setAttributeNS(null,"x",h),P.setAttributeNS(null,"y",N),P.setAttributeNS(null,"width",a-h),P.setAttributeNS(null,"height",E-N),P.setAttributeNS(null,"fill",this._makeShadingPattern(o)),this.current.fillAlpha<1&&P.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(P)}_makeColorN_Pattern(o){return o[0]==="TilingPattern"?this._makeTilingPattern(o):this._makeShadingPattern(o)}_makeTilingPattern(o){const d=o[1],l=o[2],c=o[3]||f.IDENTITY_MATRIX,[h,N,a,E]=o[4],P=o[5],et=o[6],V=o[7],Q=`shading${y++}`,[W,lt,C,$]=f.Util.normalizeRect([...f.Util.applyTransform([h,N],c),...f.Util.applyTransform([a,E],c)]),[it,w]=f.Util.singularValueDecompose2dScale(c),i=P*it,s=et*w,p=this.svgFactory.createElement("svg:pattern");p.setAttributeNS(null,"id",Q),p.setAttributeNS(null,"patternUnits","userSpaceOnUse"),p.setAttributeNS(null,"width",i),p.setAttributeNS(null,"height",s),p.setAttributeNS(null,"x",`${W}`),p.setAttributeNS(null,"y",`${lt}`);const F=this.svg,L=this.transformMatrix,I=this.current.fillColor,q=this.current.strokeColor,tt=this.svgFactory.create(C-W,$-lt);if(this.svg=tt,this.transformMatrix=c,V===2){const pt=f.Util.makeHexColor(...d);this.current.fillColor=pt,this.current.strokeColor=pt}return this.executeOpTree(this.convertOpList(l)),this.svg=F,this.transformMatrix=L,this.current.fillColor=I,this.current.strokeColor=q,p.append(tt.childNodes[0]),this.defs.append(p),`url(#${Q})`}_makeShadingPattern(o){switch(typeof o=="string"&&(o=this.objs.get(o)),o[0]){case"RadialAxial":const d=`shading${y++}`,l=o[3];let c;switch(o[1]){case"axial":const h=o[4],N=o[5];c=this.svgFactory.createElement("svg:linearGradient"),c.setAttributeNS(null,"id",d),c.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),c.setAttributeNS(null,"x1",h[0]),c.setAttributeNS(null,"y1",h[1]),c.setAttributeNS(null,"x2",N[0]),c.setAttributeNS(null,"y2",N[1]);break;case"radial":const a=o[4],E=o[5],P=o[6],et=o[7];c=this.svgFactory.createElement("svg:radialGradient"),c.setAttributeNS(null,"id",d),c.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),c.setAttributeNS(null,"cx",E[0]),c.setAttributeNS(null,"cy",E[1]),c.setAttributeNS(null,"r",et),c.setAttributeNS(null,"fx",a[0]),c.setAttributeNS(null,"fy",a[1]),c.setAttributeNS(null,"fr",P);break;default:throw new Error(`Unknown RadialAxial type: ${o[1]}`)}for(const h of l){const N=this.svgFactory.createElement("svg:stop");N.setAttributeNS(null,"offset",h[0]),N.setAttributeNS(null,"stop-color",h[1]),c.append(N)}return this.defs.append(c),`url(#${d})`;case"Mesh":return(0,f.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw new Error(`Unknown IR type: ${o[0]}`)}}setDash(o,d){this.current.dashArray=o,this.current.dashPhase=d}constructPath(o,d){const l=this.current;let c=l.x,h=l.y,N=[],a=0;for(const E of o)switch(E|0){case f.OPS.rectangle:c=d[a++],h=d[a++];const P=d[a++],et=d[a++],V=c+P,Q=h+et;N.push("M",_(c),_(h),"L",_(V),_(h),"L",_(V),_(Q),"L",_(c),_(Q),"Z");break;case f.OPS.moveTo:c=d[a++],h=d[a++],N.push("M",_(c),_(h));break;case f.OPS.lineTo:c=d[a++],h=d[a++],N.push("L",_(c),_(h));break;case f.OPS.curveTo:c=d[a+4],h=d[a+5],N.push("C",_(d[a]),_(d[a+1]),_(d[a+2]),_(d[a+3]),_(c),_(h)),a+=6;break;case f.OPS.curveTo2:N.push("C",_(c),_(h),_(d[a]),_(d[a+1]),_(d[a+2]),_(d[a+3])),c=d[a+2],h=d[a+3],a+=4;break;case f.OPS.curveTo3:c=d[a+2],h=d[a+3],N.push("C",_(d[a]),_(d[a+1]),_(c),_(h),_(c),_(h)),a+=4;break;case f.OPS.closePath:N.push("Z");break}N=N.join(" "),l.path&&o.length>0&&o[0]!==f.OPS.rectangle&&o[0]!==f.OPS.moveTo?N=l.path.getAttributeNS(null,"d")+N:(l.path=this.svgFactory.createElement("svg:path"),this._ensureTransformGroup().append(l.path)),l.path.setAttributeNS(null,"d",N),l.path.setAttributeNS(null,"fill","none"),l.element=l.path,l.setCurrentPoint(c,h)}endPath(){const o=this.current;if(o.path=null,!this.pendingClip)return;if(!o.element){this.pendingClip=null;return}const d=`clippath${g++}`,l=this.svgFactory.createElement("svg:clipPath");l.setAttributeNS(null,"id",d),l.setAttributeNS(null,"transform",S(this.transformMatrix));const c=o.element.cloneNode(!0);if(this.pendingClip==="evenodd"?c.setAttributeNS(null,"clip-rule","evenodd"):c.setAttributeNS(null,"clip-rule","nonzero"),this.pendingClip=null,l.append(c),this.defs.append(l),o.activeClipUrl){o.clipGroup=null;for(const h of this.extraStack)h.clipGroup=null;l.setAttributeNS(null,"clip-path",o.activeClipUrl)}o.activeClipUrl=`url(#${d})`,this.tgrp=null}clip(o){this.pendingClip=o}closePath(){const o=this.current;if(o.path){const d=`${o.path.getAttributeNS(null,"d")}Z`;o.path.setAttributeNS(null,"d",d)}}setLeading(o){this.current.leading=-o}setTextRise(o){this.current.textRise=o}setTextRenderingMode(o){this.current.textRenderingMode=o}setHScale(o){this.current.textHScale=o/100}setRenderingIntent(o){}setFlatness(o){}setGState(o){for(const[d,l]of o)switch(d){case"LW":this.setLineWidth(l);break;case"LC":this.setLineCap(l);break;case"LJ":this.setLineJoin(l);break;case"ML":this.setMiterLimit(l);break;case"D":this.setDash(l[0],l[1]);break;case"RI":this.setRenderingIntent(l);break;case"FL":this.setFlatness(l);break;case"Font":this.setFont(l);break;case"CA":this.setStrokeAlpha(l);break;case"ca":this.setFillAlpha(l);break;default:(0,f.warn)(`Unimplemented graphic state operator ${d}`);break}}fill(){const o=this.current;o.element&&(o.element.setAttributeNS(null,"fill",o.fillColor),o.element.setAttributeNS(null,"fill-opacity",o.fillAlpha),this.endPath())}stroke(){const o=this.current;o.element&&(this._setStrokeAttributes(o.element),o.element.setAttributeNS(null,"fill","none"),this.endPath())}_setStrokeAttributes(o,d=1){const l=this.current;let c=l.dashArray;d!==1&&c.length>0&&(c=c.map(function(h){return d*h})),o.setAttributeNS(null,"stroke",l.strokeColor),o.setAttributeNS(null,"stroke-opacity",l.strokeAlpha),o.setAttributeNS(null,"stroke-miterlimit",_(l.miterLimit)),o.setAttributeNS(null,"stroke-linecap",l.lineCap),o.setAttributeNS(null,"stroke-linejoin",l.lineJoin),o.setAttributeNS(null,"stroke-width",_(d*l.lineWidth)+"px"),o.setAttributeNS(null,"stroke-dasharray",c.map(_).join(" ")),o.setAttributeNS(null,"stroke-dashoffset",_(d*l.dashPhase)+"px")}eoFill(){var o;(o=this.current.element)==null||o.setAttributeNS(null,"fill-rule","evenodd"),this.fill()}fillStroke(){this.stroke(),this.fill()}eoFillStroke(){var o;(o=this.current.element)==null||o.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()}closeStroke(){this.closePath(),this.stroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.closePath(),this.eoFillStroke()}paintSolidColorImageMask(){const o=this.svgFactory.createElement("svg:rect");o.setAttributeNS(null,"x","0"),o.setAttributeNS(null,"y","0"),o.setAttributeNS(null,"width","1px"),o.setAttributeNS(null,"height","1px"),o.setAttributeNS(null,"fill",this.current.fillColor),this._ensureTransformGroup().append(o)}paintImageXObject(o){const d=this.getObject(o);if(!d){(0,f.warn)(`Dependent image with object ID ${o} is not ready yet`);return}this.paintInlineImageXObject(d)}paintInlineImageXObject(o,d){const l=o.width,c=o.height,h=B(o,this.forceDataSchema,!!d),N=this.svgFactory.createElement("svg:rect");N.setAttributeNS(null,"x","0"),N.setAttributeNS(null,"y","0"),N.setAttributeNS(null,"width",_(l)),N.setAttributeNS(null,"height",_(c)),this.current.element=N,this.clip("nonzero");const a=this.svgFactory.createElement("svg:image");a.setAttributeNS(ut,"xlink:href",h),a.setAttributeNS(null,"x","0"),a.setAttributeNS(null,"y",_(-c)),a.setAttributeNS(null,"width",_(l)+"px"),a.setAttributeNS(null,"height",_(c)+"px"),a.setAttributeNS(null,"transform",`scale(${_(1/l)} ${_(-1/c)})`),d?d.append(a):this._ensureTransformGroup().append(a)}paintImageMaskXObject(o){const d=this.getObject(o.data,o);if(d.bitmap){(0,f.warn)("paintImageMaskXObject: ImageBitmap support is not implemented, ensure that the `isOffscreenCanvasSupported` API parameter is disabled.");return}const l=this.current,c=d.width,h=d.height,N=l.fillColor;l.maskId=`mask${u++}`;const a=this.svgFactory.createElement("svg:mask");a.setAttributeNS(null,"id",l.maskId);const E=this.svgFactory.createElement("svg:rect");E.setAttributeNS(null,"x","0"),E.setAttributeNS(null,"y","0"),E.setAttributeNS(null,"width",_(c)),E.setAttributeNS(null,"height",_(h)),E.setAttributeNS(null,"fill",N),E.setAttributeNS(null,"mask",`url(#${l.maskId})`),this.defs.append(a),this._ensureTransformGroup().append(E),this.paintInlineImageXObject(d,a)}paintFormXObjectBegin(o,d){if(Array.isArray(o)&&o.length===6&&this.transform(o[0],o[1],o[2],o[3],o[4],o[5]),d){const l=d[2]-d[0],c=d[3]-d[1],h=this.svgFactory.createElement("svg:rect");h.setAttributeNS(null,"x",d[0]),h.setAttributeNS(null,"y",d[1]),h.setAttributeNS(null,"width",_(l)),h.setAttributeNS(null,"height",_(c)),this.current.element=h,this.clip("nonzero"),this.endPath()}}paintFormXObjectEnd(){}_initialize(o){const d=this.svgFactory.create(o.width,o.height),l=this.svgFactory.createElement("svg:defs");d.append(l),this.defs=l;const c=this.svgFactory.createElement("svg:g");return c.setAttributeNS(null,"transform",S(o.transform)),d.append(c),this.svg=c,d}_ensureClipGroup(){if(!this.current.clipGroup){const o=this.svgFactory.createElement("svg:g");o.setAttributeNS(null,"clip-path",this.current.activeClipUrl),this.svg.append(o),this.current.clipGroup=o}return this.current.clipGroup}_ensureTransformGroup(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",S(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}}e.SVGGraphics=D},(M,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.XfaText=void 0;class H{static textContent(f){const X=[],G={items:X,styles:Object.create(null)};function ut(R){var B;if(!R)return;let T=null;const m=R.name;if(m==="#text")T=R.value;else if(H.shouldBuildText(m))(B=R==null?void 0:R.attributes)!=null&&B.textContent?T=R.attributes.textContent:R.value&&(T=R.value);else return;if(T!==null&&X.push({str:T}),!!R.children)for(const j of R.children)ut(j)}return ut(f),G}static shouldBuildText(f){return!(f==="textarea"||f==="input"||f==="option"||f==="select")}}e.XfaText=H},(M,e,H)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TextLayerRenderTask=void 0,e.renderTextLayer=S,e.updateTextLayer=g;var n=H(1),f=H(6);const X=1e5,G=30,ut=.8,R=new Map;function T(u,y){let D;if(y&&n.FeatureTest.isOffscreenCanvasSupported)D=new OffscreenCanvas(u,u).getContext("2d",{alpha:!1});else{const v=document.createElement("canvas");v.width=v.height=u,D=v.getContext("2d",{alpha:!1})}return D}function m(u,y){const D=R.get(u);if(D)return D;const v=T(G,y);v.font=`${G}px ${u}`;const o=v.measureText("");let d=o.fontBoundingBoxAscent,l=Math.abs(o.fontBoundingBoxDescent);if(d){const h=d/(d+l);return R.set(u,h),v.canvas.width=v.canvas.height=0,h}v.strokeStyle="red",v.clearRect(0,0,G,G),v.strokeText("g",0,0);let c=v.getImageData(0,0,G,G).data;l=0;for(let h=c.length-1-3;h>=0;h-=4)if(c[h]>0){l=Math.ceil(h/4/G);break}v.clearRect(0,0,G,G),v.strokeText("A",0,G),c=v.getImageData(0,0,G,G).data,d=0;for(let h=0,N=c.length;h<N;h+=4)if(c[h]>0){d=G-Math.floor(h/4/G);break}if(v.canvas.width=v.canvas.height=0,d){const h=d/(d+l);return R.set(u,h),h}return R.set(u,ut),ut}function B(u,y,D){const v=document.createElement("span"),o={angle:0,canvasWidth:0,hasText:y.str!=="",hasEOL:y.hasEOL,fontSize:0};u._textDivs.push(v);const d=n.Util.transform(u._transform,y.transform);let l=Math.atan2(d[1],d[0]);const c=D[y.fontName];c.vertical&&(l+=Math.PI/2);const h=Math.hypot(d[2],d[3]),N=h*m(c.fontFamily,u._isOffscreenCanvasSupported);let a,E;l===0?(a=d[4],E=d[5]-N):(a=d[4]+N*Math.sin(l),E=d[5]-N*Math.cos(l));const P="calc(var(--scale-factor)*",et=v.style;u._container===u._rootContainer?(et.left=`${(100*a/u._pageWidth).toFixed(2)}%`,et.top=`${(100*E/u._pageHeight).toFixed(2)}%`):(et.left=`${P}${a.toFixed(2)}px)`,et.top=`${P}${E.toFixed(2)}px)`),et.fontSize=`${P}${h.toFixed(2)}px)`,et.fontFamily=c.fontFamily,o.fontSize=h,v.setAttribute("role","presentation"),v.textContent=y.str,v.dir=y.dir,u._fontInspectorEnabled&&(v.dataset.fontName=y.fontName),l!==0&&(o.angle=l*(180/Math.PI));let V=!1;if(y.str.length>1)V=!0;else if(y.str!==" "&&y.transform[0]!==y.transform[3]){const Q=Math.abs(y.transform[0]),W=Math.abs(y.transform[3]);Q!==W&&Math.max(Q,W)/Math.min(Q,W)>1.5&&(V=!0)}V&&(o.canvasWidth=c.vertical?y.height:y.width),u._textDivProperties.set(v,o),u._isReadableStream&&u._layoutText(v)}function j(u){const{div:y,scale:D,properties:v,ctx:o,prevFontSize:d,prevFontFamily:l}=u,{style:c}=y;let h="";if(v.canvasWidth!==0&&v.hasText){const{fontFamily:N}=c,{canvasWidth:a,fontSize:E}=v;(d!==E||l!==N)&&(o.font=`${E*D}px ${N}`,u.prevFontSize=E,u.prevFontFamily=N);const{width:P}=o.measureText(y.textContent);P>0&&(h=`scaleX(${a*D/P})`)}v.angle!==0&&(h=`rotate(${v.angle}deg) ${h}`),h.length>0&&(c.transform=h)}function A(u){if(u._canceled)return;const y=u._textDivs,D=u._capability;if(y.length>X){D.resolve();return}if(!u._isReadableStream)for(const o of y)u._layoutText(o);D.resolve()}class _{constructor({textContentSource:y,container:D,viewport:v,textDivs:o,textDivProperties:d,textContentItemsStr:l,isOffscreenCanvasSupported:c}){var P;this._textContentSource=y,this._isReadableStream=y instanceof ReadableStream,this._container=this._rootContainer=D,this._textDivs=o||[],this._textContentItemsStr=l||[],this._isOffscreenCanvasSupported=c,this._fontInspectorEnabled=!!((P=globalThis.FontInspector)!=null&&P.enabled),this._reader=null,this._textDivProperties=d||new WeakMap,this._canceled=!1,this._capability=new n.PromiseCapability,this._layoutTextParams={prevFontSize:null,prevFontFamily:null,div:null,scale:v.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:T(0,c)};const{pageWidth:h,pageHeight:N,pageX:a,pageY:E}=v.rawDims;this._transform=[1,0,0,-1,-a,E+N],this._pageWidth=h,this._pageHeight=N,(0,f.setLayerDimensions)(D,v),this._capability.promise.finally(()=>{this._layoutTextParams=null}).catch(()=>{})}get promise(){return this._capability.promise}cancel(){this._canceled=!0,this._reader&&(this._reader.cancel(new n.AbortException("TextLayer task cancelled.")).catch(()=>{}),this._reader=null),this._capability.reject(new n.AbortException("TextLayer task cancelled."))}_processItems(y,D){for(const v of y){if(v.str===void 0){if(v.type==="beginMarkedContentProps"||v.type==="beginMarkedContent"){const o=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),v.id!==null&&this._container.setAttribute("id",`${v.id}`),o.append(this._container)}else v.type==="endMarkedContent"&&(this._container=this._container.parentNode);continue}this._textContentItemsStr.push(v.str),B(this,v,D)}}_layoutText(y){const D=this._layoutTextParams.properties=this._textDivProperties.get(y);if(this._layoutTextParams.div=y,j(this._layoutTextParams),D.hasText&&this._container.append(y),D.hasEOL){const v=document.createElement("br");v.setAttribute("role","presentation"),this._container.append(v)}}_render(){const y=new n.PromiseCapability;let D=Object.create(null);if(this._isReadableStream){const v=()=>{this._reader.read().then(({value:o,done:d})=>{if(d){y.resolve();return}Object.assign(D,o.styles),this._processItems(o.items,D),v()},y.reject)};this._reader=this._textContentSource.getReader(),v()}else if(this._textContentSource){const{items:v,styles:o}=this._textContentSource;this._processItems(v,o),y.resolve()}else throw new Error('No "textContentSource" parameter specified.');y.promise.then(()=>{D=null,A(this)},this._capability.reject)}}e.TextLayerRenderTask=_;function S(u){!u.textContentSource&&(u.textContent||u.textContentStream)&&((0,f.deprecated)("The TextLayerRender `textContent`/`textContentStream` parameters will be removed in the future, please use `textContentSource` instead."),u.textContentSource=u.textContent||u.textContentStream);const{container:y,viewport:D}=u,v=getComputedStyle(y),o=v.getPropertyValue("visibility"),d=parseFloat(v.getPropertyValue("--scale-factor"));o==="visible"&&(!d||Math.abs(d-D.scale)>1e-5)&&console.error("The `--scale-factor` CSS-variable must be set, to the same value as `viewport.scale`, either on the `container`-element itself or higher up in the DOM.");const l=new _(u);return l._render(),l}function g({container:u,viewport:y,textDivs:D,textDivProperties:v,isOffscreenCanvasSupported:o,mustRotate:d=!0,mustRescale:l=!0}){if(d&&(0,f.setLayerDimensions)(u,{rotation:y.rotation}),l){const c=T(0,o),N={prevFontSize:null,prevFontFamily:null,div:null,scale:y.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:c};for(const a of D)N.properties=v.get(a),N.div=a,j(N)}}},(M,e,H)=>{var m,B,j,A,_,S,g,u,y,D,v,Qe,Te,Ze,tn;Object.defineProperty(e,"__esModule",{value:!0}),e.AnnotationEditorLayer=void 0;var n=H(1),f=H(4),X=H(28),G=H(33),ut=H(6),R=H(34);const h=class h{constructor({uiManager:a,pageIndex:E,div:P,accessibilityManager:et,annotationLayer:V,viewport:Q,l10n:W}){rt(this,v);rt(this,m);rt(this,B,!1);rt(this,j,null);rt(this,A,this.pointerup.bind(this));rt(this,_,this.pointerdown.bind(this));rt(this,S,new Map);rt(this,g,!1);rt(this,u,!1);rt(this,y,!1);rt(this,D);const lt=[X.FreeTextEditor,G.InkEditor,R.StampEditor];if(!h._initialized){h._initialized=!0;for(const C of lt)C.initialize(W)}a.registerEditorTypes(lt),ot(this,D,a),this.pageIndex=E,this.div=P,ot(this,m,et),ot(this,j,V),this.viewport=Q,t(this,D).addLayer(this)}get isEmpty(){return t(this,S).size===0}updateToolbar(a){t(this,D).updateToolbar(a)}updateMode(a=t(this,D).getMode()){J(this,v,tn).call(this),a===n.AnnotationEditorType.INK?(this.addInkEditorIfNeeded(!1),this.disableClick()):this.enableClick(),a!==n.AnnotationEditorType.NONE&&(this.div.classList.toggle("freeTextEditing",a===n.AnnotationEditorType.FREETEXT),this.div.classList.toggle("inkEditing",a===n.AnnotationEditorType.INK),this.div.classList.toggle("stampEditing",a===n.AnnotationEditorType.STAMP),this.div.hidden=!1)}addInkEditorIfNeeded(a){if(!a&&t(this,D).getMode()!==n.AnnotationEditorType.INK)return;if(!a){for(const P of t(this,S).values())if(P.isEmpty()){P.setInBackground();return}}J(this,v,Te).call(this,{offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(a){t(this,D).setEditingState(a)}addCommands(a){t(this,D).addCommands(a)}enable(){this.div.style.pointerEvents="auto";const a=new Set;for(const P of t(this,S).values())P.enableEditing(),P.annotationElementId&&a.add(P.annotationElementId);if(!t(this,j))return;const E=t(this,j).getEditableAnnotations();for(const P of E){if(P.hide(),t(this,D).isDeletedAnnotationElement(P.data.id)||a.has(P.data.id))continue;const et=this.deserialize(P);et&&(this.addOrRebuild(et),et.enableEditing())}}disable(){var E;ot(this,y,!0),this.div.style.pointerEvents="none";const a=new Set;for(const P of t(this,S).values()){if(P.disableEditing(),!P.annotationElementId||P.serialize()!==null){a.add(P.annotationElementId);continue}(E=this.getEditableAnnotation(P.annotationElementId))==null||E.show(),P.remove()}if(t(this,j)){const P=t(this,j).getEditableAnnotations();for(const et of P){const{id:V}=et.data;a.has(V)||t(this,D).isDeletedAnnotationElement(V)||et.show()}}J(this,v,tn).call(this),this.isEmpty&&(this.div.hidden=!0),ot(this,y,!1)}getEditableAnnotation(a){var E;return((E=t(this,j))==null?void 0:E.getEditableAnnotation(a))||null}setActiveEditor(a){t(this,D).getActive()!==a&&t(this,D).setActiveEditor(a)}enableClick(){this.div.addEventListener("pointerdown",t(this,_)),this.div.addEventListener("pointerup",t(this,A))}disableClick(){this.div.removeEventListener("pointerdown",t(this,_)),this.div.removeEventListener("pointerup",t(this,A))}attach(a){t(this,S).set(a.id,a);const{annotationElementId:E}=a;E&&t(this,D).isDeletedAnnotationElement(E)&&t(this,D).removeDeletedAnnotationElement(a)}detach(a){var E;t(this,S).delete(a.id),(E=t(this,m))==null||E.removePointerInTextLayer(a.contentDiv),!t(this,y)&&a.annotationElementId&&t(this,D).addDeletedAnnotationElement(a)}remove(a){this.detach(a),t(this,D).removeEditor(a),a.div.contains(document.activeElement)&&setTimeout(()=>{t(this,D).focusMainContainer()},0),a.div.remove(),a.isAttachedToDOM=!1,t(this,u)||this.addInkEditorIfNeeded(!1)}changeParent(a){var E;a.parent!==this&&(a.annotationElementId&&(t(this,D).addDeletedAnnotationElement(a.annotationElementId),f.AnnotationEditor.deleteAnnotationElement(a),a.annotationElementId=null),this.attach(a),(E=a.parent)==null||E.detach(a),a.setParent(this),a.div&&a.isAttachedToDOM&&(a.div.remove(),this.div.append(a.div)))}add(a){if(this.changeParent(a),t(this,D).addEditor(a),this.attach(a),!a.isAttachedToDOM){const E=a.render();this.div.append(E),a.isAttachedToDOM=!0}a.fixAndSetPosition(),a.onceAdded(),t(this,D).addToAnnotationStorage(a)}moveEditorInDOM(a){var P;if(!a.isAttachedToDOM)return;const{activeElement:E}=document;a.div.contains(E)&&(a._focusEventsAllowed=!1,setTimeout(()=>{a.div.contains(document.activeElement)?a._focusEventsAllowed=!0:(a.div.addEventListener("focusin",()=>{a._focusEventsAllowed=!0},{once:!0}),E.focus())},0)),a._structTreeParentId=(P=t(this,m))==null?void 0:P.moveElementInDOM(this.div,a.div,a.contentDiv,!0)}addOrRebuild(a){a.needsToBeRebuilt()?a.rebuild():this.add(a)}addUndoableEditor(a){const E=()=>a._uiManager.rebuild(a),P=()=>{a.remove()};this.addCommands({cmd:E,undo:P,mustExec:!1})}getNextId(){return t(this,D).getId()}pasteEditor(a,E){t(this,D).updateToolbar(a),t(this,D).updateMode(a);const{offsetX:P,offsetY:et}=J(this,v,Ze).call(this),V=this.getNextId(),Q=J(this,v,Qe).call(this,{parent:this,id:V,x:P,y:et,uiManager:t(this,D),isCentered:!0,...E});Q&&this.add(Q)}deserialize(a){switch(a.annotationType??a.annotationEditorType){case n.AnnotationEditorType.FREETEXT:return X.FreeTextEditor.deserialize(a,this,t(this,D));case n.AnnotationEditorType.INK:return G.InkEditor.deserialize(a,this,t(this,D));case n.AnnotationEditorType.STAMP:return R.StampEditor.deserialize(a,this,t(this,D))}return null}addNewEditor(){J(this,v,Te).call(this,J(this,v,Ze).call(this),!0)}setSelected(a){t(this,D).setSelected(a)}toggleSelected(a){t(this,D).toggleSelected(a)}isSelected(a){return t(this,D).isSelected(a)}unselect(a){t(this,D).unselect(a)}pointerup(a){const{isMac:E}=n.FeatureTest.platform;if(!(a.button!==0||a.ctrlKey&&E)&&a.target===this.div&&t(this,g)){if(ot(this,g,!1),!t(this,B)){ot(this,B,!0);return}if(t(this,D).getMode()===n.AnnotationEditorType.STAMP){t(this,D).unselectAll();return}J(this,v,Te).call(this,a,!1)}}pointerdown(a){if(t(this,g)){ot(this,g,!1);return}const{isMac:E}=n.FeatureTest.platform;if(a.button!==0||a.ctrlKey&&E||a.target!==this.div)return;ot(this,g,!0);const P=t(this,D).getActive();ot(this,B,!P||P.isEmpty())}findNewParent(a,E,P){const et=t(this,D).findParent(E,P);return et===null||et===this?!1:(et.changeParent(a),!0)}destroy(){var a,E;((a=t(this,D).getActive())==null?void 0:a.parent)===this&&(t(this,D).commitOrRemove(),t(this,D).setActiveEditor(null));for(const P of t(this,S).values())(E=t(this,m))==null||E.removePointerInTextLayer(P.contentDiv),P.setParent(null),P.isAttachedToDOM=!1,P.div.remove();this.div=null,t(this,S).clear(),t(this,D).removeLayer(this)}render({viewport:a}){this.viewport=a,(0,ut.setLayerDimensions)(this.div,a);for(const E of t(this,D).getEditors(this.pageIndex))this.add(E);this.updateMode()}update({viewport:a}){t(this,D).commitOrRemove(),this.viewport=a,(0,ut.setLayerDimensions)(this.div,{rotation:a.rotation}),this.updateMode()}get pageDimensions(){const{pageWidth:a,pageHeight:E}=this.viewport.rawDims;return[a,E]}};m=new WeakMap,B=new WeakMap,j=new WeakMap,A=new WeakMap,_=new WeakMap,S=new WeakMap,g=new WeakMap,u=new WeakMap,y=new WeakMap,D=new WeakMap,v=new WeakSet,Qe=function(a){switch(t(this,D).getMode()){case n.AnnotationEditorType.FREETEXT:return new X.FreeTextEditor(a);case n.AnnotationEditorType.INK:return new G.InkEditor(a);case n.AnnotationEditorType.STAMP:return new R.StampEditor(a)}return null},Te=function(a,E){const P=this.getNextId(),et=J(this,v,Qe).call(this,{parent:this,id:P,x:a.offsetX,y:a.offsetY,uiManager:t(this,D),isCentered:E});return et&&this.add(et),et},Ze=function(){const{x:a,y:E,width:P,height:et}=this.div.getBoundingClientRect(),V=Math.max(0,a),Q=Math.max(0,E),W=Math.min(window.innerWidth,a+P),lt=Math.min(window.innerHeight,E+et),C=(V+W)/2-a,$=(Q+lt)/2-E,[it,w]=this.viewport.rotation%180===0?[C,$]:[$,C];return{offsetX:it,offsetY:w}},tn=function(){ot(this,u,!0);for(const a of t(this,S).values())a.isEmpty()&&a.remove();ot(this,u,!1)},Qt(h,"_initialized",!1);let T=h;e.AnnotationEditorLayer=T},(M,e,H)=>{var R,T,m,B,j,A,_,S,g,u,Rn,kn,Fn,be,en,Mn,nn;Object.defineProperty(e,"__esModule",{value:!0}),e.FreeTextEditor=void 0;var n=H(1),f=H(5),X=H(4),G=H(29);const h=class h extends X.AnnotationEditor{constructor(E){super({...E,name:"freeTextEditor"});rt(this,u);rt(this,R,this.editorDivBlur.bind(this));rt(this,T,this.editorDivFocus.bind(this));rt(this,m,this.editorDivInput.bind(this));rt(this,B,this.editorDivKeydown.bind(this));rt(this,j);rt(this,A,"");rt(this,_,`${this.id}-editor`);rt(this,S);rt(this,g,null);ot(this,j,E.color||h._defaultColor||X.AnnotationEditor._defaultLineColor),ot(this,S,E.fontSize||h._defaultFontSize)}static get _keyboardManager(){const E=h.prototype,P=Q=>Q.isEmpty(),et=f.AnnotationEditorUIManager.TRANSLATE_SMALL,V=f.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,n.shadow)(this,"_keyboardManager",new f.KeyboardManager([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],E.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],E.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],E._translateEmpty,{args:[-et,0],checker:P}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],E._translateEmpty,{args:[-V,0],checker:P}],[["ArrowRight","mac+ArrowRight"],E._translateEmpty,{args:[et,0],checker:P}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],E._translateEmpty,{args:[V,0],checker:P}],[["ArrowUp","mac+ArrowUp"],E._translateEmpty,{args:[0,-et],checker:P}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],E._translateEmpty,{args:[0,-V],checker:P}],[["ArrowDown","mac+ArrowDown"],E._translateEmpty,{args:[0,et],checker:P}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],E._translateEmpty,{args:[0,V],checker:P}]]))}static initialize(E){X.AnnotationEditor.initialize(E,{strings:["free_text2_default_content","editor_free_text2_aria_label"]});const P=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(P.getPropertyValue("--freetext-padding"))}static updateDefaultParams(E,P){switch(E){case n.AnnotationEditorParamsType.FREETEXT_SIZE:h._defaultFontSize=P;break;case n.AnnotationEditorParamsType.FREETEXT_COLOR:h._defaultColor=P;break}}updateParams(E,P){switch(E){case n.AnnotationEditorParamsType.FREETEXT_SIZE:J(this,u,Rn).call(this,P);break;case n.AnnotationEditorParamsType.FREETEXT_COLOR:J(this,u,kn).call(this,P);break}}static get defaultPropertiesToUpdate(){return[[n.AnnotationEditorParamsType.FREETEXT_SIZE,h._defaultFontSize],[n.AnnotationEditorParamsType.FREETEXT_COLOR,h._defaultColor||X.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[n.AnnotationEditorParamsType.FREETEXT_SIZE,t(this,S)],[n.AnnotationEditorParamsType.FREETEXT_COLOR,t(this,j)]]}_translateEmpty(E,P){this._uiManager.translateSelectedEditors(E,P,!0)}getInitialTranslation(){const E=this.parentScale;return[-h._internalPadding*E,-(h._internalPadding+t(this,S))*E]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(n.AnnotationEditorType.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.editorDiv.addEventListener("keydown",t(this,B)),this.editorDiv.addEventListener("focus",t(this,T)),this.editorDiv.addEventListener("blur",t(this,R)),this.editorDiv.addEventListener("input",t(this,m)))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",t(this,_)),this._isDraggable=!0,this.editorDiv.removeEventListener("keydown",t(this,B)),this.editorDiv.removeEventListener("focus",t(this,T)),this.editorDiv.removeEventListener("blur",t(this,R)),this.editorDiv.removeEventListener("input",t(this,m)),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freeTextEditing"))}focusin(E){this._focusEventsAllowed&&(super.focusin(E),E.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){var E;if(this.width){J(this,u,nn).call(this);return}this.enableEditMode(),this.editorDiv.focus(),(E=this._initialOptions)!=null&&E.isCentered&&this.center(),this._initialOptions=null}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freeTextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const E=t(this,A),P=ot(this,A,J(this,u,Fn).call(this).trimEnd());if(E===P)return;const et=V=>{if(ot(this,A,V),!V){this.remove();return}J(this,u,en).call(this),this._uiManager.rebuild(this),J(this,u,be).call(this)};this.addCommands({cmd:()=>{et(P)},undo:()=>{et(E)},mustExec:!1}),J(this,u,be).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(E){this.enterInEditMode()}keydown(E){E.target===this.div&&E.key==="Enter"&&(this.enterInEditMode(),E.preventDefault())}editorDivKeydown(E){h._keyboardManager.exec(this,E)}editorDivFocus(E){this.isEditing=!0}editorDivBlur(E){this.isEditing=!1}editorDivInput(E){this.parent.div.classList.toggle("freeTextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let E,P;this.width&&(E=this.x,P=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",t(this,_)),this.enableEditing(),X.AnnotationEditor._l10nPromise.get("editor_free_text2_aria_label").then(V=>{var Q;return(Q=this.editorDiv)==null?void 0:Q.setAttribute("aria-label",V)}),X.AnnotationEditor._l10nPromise.get("free_text2_default_content").then(V=>{var Q;return(Q=this.editorDiv)==null?void 0:Q.setAttribute("default-content",V)}),this.editorDiv.contentEditable=!0;const{style:et}=this.editorDiv;if(et.fontSize=`calc(${t(this,S)}px * var(--scale-factor))`,et.color=t(this,j),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),(0,f.bindEvents)(this,this.div,["dblclick","keydown"]),this.width){const[V,Q]=this.parentDimensions;if(this.annotationElementId){const{position:W}=t(this,g);let[lt,C]=this.getInitialTranslation();[lt,C]=this.pageTranslationToScreen(lt,C);const[$,it]=this.pageDimensions,[w,i]=this.pageTranslation;let s,p;switch(this.rotation){case 0:s=E+(W[0]-w)/$,p=P+this.height-(W[1]-i)/it;break;case 90:s=E+(W[0]-w)/$,p=P-(W[1]-i)/it,[lt,C]=[C,-lt];break;case 180:s=E-this.width+(W[0]-w)/$,p=P-(W[1]-i)/it,[lt,C]=[-lt,-C];break;case 270:s=E+(W[0]-w-this.height*it)/$,p=P+(W[1]-i-this.width*$)/it,[lt,C]=[-C,lt];break}this.setAt(s*V,p*Q,lt,C)}else this.setAt(E*V,P*Q,this.width*V,this.height*Q);J(this,u,en).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}get contentDiv(){return this.editorDiv}static deserialize(E,P,et){let V=null;if(E instanceof G.FreeTextAnnotationElement){const{data:{defaultAppearanceData:{fontSize:W,fontColor:lt},rect:C,rotation:$,id:it},textContent:w,textPosition:i,parent:{page:{pageNumber:s}}}=E;if(!w||w.length===0)return null;V=E={annotationType:n.AnnotationEditorType.FREETEXT,color:Array.from(lt),fontSize:W,value:w.join(`
`),position:i,pageIndex:s-1,rect:C,rotation:$,id:it,deleted:!1}}const Q=super.deserialize(E,P,et);return ot(Q,S,E.fontSize),ot(Q,j,n.Util.makeHexColor(...E.color)),ot(Q,A,E.value),Q.annotationElementId=E.id||null,ot(Q,g,V),Q}serialize(E=!1){if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0};const P=h._internalPadding*this.parentScale,et=this.getRect(P,P),V=X.AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:t(this,j)),Q={annotationType:n.AnnotationEditorType.FREETEXT,color:V,fontSize:t(this,S),value:t(this,A),pageIndex:this.pageIndex,rect:et,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return E?Q:this.annotationElementId&&!J(this,u,Mn).call(this,Q)?null:(Q.id=this.annotationElementId,Q)}};R=new WeakMap,T=new WeakMap,m=new WeakMap,B=new WeakMap,j=new WeakMap,A=new WeakMap,_=new WeakMap,S=new WeakMap,g=new WeakMap,u=new WeakSet,Rn=function(E){const P=V=>{this.editorDiv.style.fontSize=`calc(${V}px * var(--scale-factor))`,this.translate(0,-(V-t(this,S))*this.parentScale),ot(this,S,V),J(this,u,be).call(this)},et=t(this,S);this.addCommands({cmd:()=>{P(E)},undo:()=>{P(et)},mustExec:!0,type:n.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},kn=function(E){const P=t(this,j);this.addCommands({cmd:()=>{ot(this,j,this.editorDiv.style.color=E)},undo:()=>{ot(this,j,this.editorDiv.style.color=P)},mustExec:!0,type:n.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},Fn=function(){const E=this.editorDiv.getElementsByTagName("div");if(E.length===0)return this.editorDiv.innerText;const P=[];for(const et of E)P.push(et.innerText.replace(/\r\n?|\n/,""));return P.join(`
`)},be=function(){const[E,P]=this.parentDimensions;let et;if(this.isAttachedToDOM)et=this.div.getBoundingClientRect();else{const{currentLayer:V,div:Q}=this,W=Q.style.display;Q.style.display="hidden",V.div.append(this.div),et=Q.getBoundingClientRect(),Q.remove(),Q.style.display=W}this.rotation%180===this.parentRotation%180?(this.width=et.width/E,this.height=et.height/P):(this.width=et.height/E,this.height=et.width/P),this.fixAndSetPosition()},en=function(){if(this.editorDiv.replaceChildren(),!!t(this,A))for(const E of t(this,A).split(`
`)){const P=document.createElement("div");P.append(E?document.createTextNode(E):document.createElement("br")),this.editorDiv.append(P)}},Mn=function(E){const{value:P,fontSize:et,color:V,rect:Q,pageIndex:W}=t(this,g);return E.value!==P||E.fontSize!==et||E.rect.some((lt,C)=>Math.abs(lt-Q[C])>=1)||E.color.some((lt,C)=>lt!==V[C])||E.pageIndex!==W},nn=function(E=!1){if(!this.annotationElementId)return;if(J(this,u,be).call(this),!E&&(this.width===0||this.height===0)){setTimeout(()=>J(this,u,nn).call(this,!0),0);return}const P=h._internalPadding*this.parentScale;t(this,g).rect=this.getRect(P,P)},Qt(h,"_freeTextDefaultContent",""),Qt(h,"_internalPadding",0),Qt(h,"_defaultColor",null),Qt(h,"_defaultFontSize",10),Qt(h,"_type","freetext");let ut=h;e.FreeTextEditor=ut},(M,e,H)=>{var p,L,ae,Dn,tt,pt,gt,bt,At,yt,Y,nt,b,O,K,st,mt,wt,vt,Z,Ct,Tt,Ln,Ce,sn,rn,jt,Vt,Kt,St,at,ct,Mt,an,zt,U,_t,Pt,In,on;Object.defineProperty(e,"__esModule",{value:!0}),e.StampAnnotationElement=e.InkAnnotationElement=e.FreeTextAnnotationElement=e.AnnotationLayer=void 0;var n=H(1),f=H(6),X=H(3),G=H(30),ut=H(31),R=H(32);const T=1e3,m=9,B=new WeakSet;function j(Ft){return{width:Ft[2]-Ft[0],height:Ft[3]-Ft[1]}}class A{static create(k){switch(k.data.annotationType){case n.AnnotationType.LINK:return new S(k);case n.AnnotationType.TEXT:return new g(k);case n.AnnotationType.WIDGET:switch(k.data.fieldType){case"Tx":return new y(k);case"Btn":return k.data.radioButton?new o(k):k.data.checkBox?new v(k):new d(k);case"Ch":return new l(k);case"Sig":return new D(k)}return new u(k);case n.AnnotationType.POPUP:return new c(k);case n.AnnotationType.FREETEXT:return new N(k);case n.AnnotationType.LINE:return new a(k);case n.AnnotationType.SQUARE:return new E(k);case n.AnnotationType.CIRCLE:return new P(k);case n.AnnotationType.POLYLINE:return new et(k);case n.AnnotationType.CARET:return new Q(k);case n.AnnotationType.INK:return new W(k);case n.AnnotationType.POLYGON:return new V(k);case n.AnnotationType.HIGHLIGHT:return new lt(k);case n.AnnotationType.UNDERLINE:return new C(k);case n.AnnotationType.SQUIGGLY:return new $(k);case n.AnnotationType.STRIKEOUT:return new it(k);case n.AnnotationType.STAMP:return new w(k);case n.AnnotationType.FILEATTACHMENT:return new i(k);default:return new _(k)}}}const F=class F{constructor(k,{isRenderable:x=!1,ignoreBorder:z=!1,createQuadrilaterals:ht=!1}={}){rt(this,p,!1);this.isRenderable=x,this.data=k.data,this.layer=k.layer,this.linkService=k.linkService,this.downloadManager=k.downloadManager,this.imageResourcesPath=k.imageResourcesPath,this.renderForms=k.renderForms,this.svgFactory=k.svgFactory,this.annotationStorage=k.annotationStorage,this.enableScripting=k.enableScripting,this.hasJSActions=k.hasJSActions,this._fieldObjects=k.fieldObjects,this.parent=k.parent,x&&(this.container=this._createContainer(z)),ht&&this._createQuadrilaterals()}static _hasPopupData({titleObj:k,contentsObj:x,richText:z}){return!!(k!=null&&k.str||x!=null&&x.str||z!=null&&z.str)}get hasPopupData(){return F._hasPopupData(this.data)}_createContainer(k){const{data:x,parent:{page:z,viewport:ht}}=this,ft=document.createElement("section");ft.setAttribute("data-annotation-id",x.id),this instanceof u||(ft.tabIndex=T),ft.style.zIndex=this.parent.zIndex++,this.data.popupRef&&ft.setAttribute("aria-haspopup","dialog"),x.noRotate&&ft.classList.add("norotate");const{pageWidth:Et,pageHeight:xt,pageX:Ot,pageY:Dt}=ht.rawDims;if(!x.rect||this instanceof c){const{rotation:Ht}=x;return!x.hasOwnCanvas&&Ht!==0&&this.setRotation(Ht,ft),ft}const{width:Rt,height:Gt}=j(x.rect),Lt=n.Util.normalizeRect([x.rect[0],z.view[3]-x.rect[1]+z.view[1],x.rect[2],z.view[3]-x.rect[3]+z.view[1]]);if(!k&&x.borderStyle.width>0){ft.style.borderWidth=`${x.borderStyle.width}px`;const Ht=x.borderStyle.horizontalCornerRadius,$t=x.borderStyle.verticalCornerRadius;if(Ht>0||$t>0){const Jt=`calc(${Ht}px * var(--scale-factor)) / calc(${$t}px * var(--scale-factor))`;ft.style.borderRadius=Jt}else if(this instanceof o){const Jt=`calc(${Rt}px * var(--scale-factor)) / calc(${Gt}px * var(--scale-factor))`;ft.style.borderRadius=Jt}switch(x.borderStyle.style){case n.AnnotationBorderStyleType.SOLID:ft.style.borderStyle="solid";break;case n.AnnotationBorderStyleType.DASHED:ft.style.borderStyle="dashed";break;case n.AnnotationBorderStyleType.BEVELED:(0,n.warn)("Unimplemented border style: beveled");break;case n.AnnotationBorderStyleType.INSET:(0,n.warn)("Unimplemented border style: inset");break;case n.AnnotationBorderStyleType.UNDERLINE:ft.style.borderBottomStyle="solid";break}const Yt=x.borderColor||null;Yt?(ot(this,p,!0),ft.style.borderColor=n.Util.makeHexColor(Yt[0]|0,Yt[1]|0,Yt[2]|0)):ft.style.borderWidth=0}ft.style.left=`${100*(Lt[0]-Ot)/Et}%`,ft.style.top=`${100*(Lt[1]-Dt)/xt}%`;const{rotation:Nt}=x;return x.hasOwnCanvas||Nt===0?(ft.style.width=`${100*Rt/Et}%`,ft.style.height=`${100*Gt/xt}%`):this.setRotation(Nt,ft),ft}setRotation(k,x=this.container){if(!this.data.rect)return;const{pageWidth:z,pageHeight:ht}=this.parent.viewport.rawDims,{width:ft,height:Et}=j(this.data.rect);let xt,Ot;k%180===0?(xt=100*ft/z,Ot=100*Et/ht):(xt=100*Et/z,Ot=100*ft/ht),x.style.width=`${xt}%`,x.style.height=`${Ot}%`,x.setAttribute("data-main-rotation",(360-k)%360)}get _commonActions(){const k=(x,z,ht)=>{const ft=ht.detail[x],Et=ft[0],xt=ft.slice(1);ht.target.style[z]=G.ColorConverters[`${Et}_HTML`](xt),this.annotationStorage.setValue(this.data.id,{[z]:G.ColorConverters[`${Et}_rgb`](xt)})};return(0,n.shadow)(this,"_commonActions",{display:x=>{const{display:z}=x.detail,ht=z%2===1;this.container.style.visibility=ht?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:ht,noPrint:z===1||z===2})},print:x=>{this.annotationStorage.setValue(this.data.id,{noPrint:!x.detail.print})},hidden:x=>{const{hidden:z}=x.detail;this.container.style.visibility=z?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:z,noView:z})},focus:x=>{setTimeout(()=>x.target.focus({preventScroll:!1}),0)},userName:x=>{x.target.title=x.detail.userName},readonly:x=>{x.target.disabled=x.detail.readonly},required:x=>{this._setRequired(x.target,x.detail.required)},bgColor:x=>{k("bgColor","backgroundColor",x)},fillColor:x=>{k("fillColor","backgroundColor",x)},fgColor:x=>{k("fgColor","color",x)},textColor:x=>{k("textColor","color",x)},borderColor:x=>{k("borderColor","borderColor",x)},strokeColor:x=>{k("strokeColor","borderColor",x)},rotation:x=>{const z=x.detail.rotation;this.setRotation(z),this.annotationStorage.setValue(this.data.id,{rotation:z})}})}_dispatchEventFromSandbox(k,x){const z=this._commonActions;for(const ht of Object.keys(x.detail)){const ft=k[ht]||z[ht];ft==null||ft(x)}}_setDefaultPropertiesFromJS(k){if(!this.enableScripting)return;const x=this.annotationStorage.getRawValue(this.data.id);if(!x)return;const z=this._commonActions;for(const[ht,ft]of Object.entries(x)){const Et=z[ht];if(Et){const xt={detail:{[ht]:ft},target:k};Et(xt),delete x[ht]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:k}=this.data;if(!k)return;const[x,z,ht,ft]=this.data.rect;if(k.length===1){const[,{x:$t,y:Yt},{x:Jt,y:te}]=k[0];if(ht===$t&&ft===Yt&&x===Jt&&z===te)return}const{style:Et}=this.container;let xt;if(t(this,p)){const{borderColor:$t,borderWidth:Yt}=Et;Et.borderWidth=0,xt=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${$t}" stroke-width="${Yt}">`],this.container.classList.add("hasBorder")}const Ot=ht-x,Dt=ft-z,{svgFactory:Rt}=this,Gt=Rt.createElement("svg");Gt.classList.add("quadrilateralsContainer"),Gt.setAttribute("width",0),Gt.setAttribute("height",0);const Lt=Rt.createElement("defs");Gt.append(Lt);const Nt=Rt.createElement("clipPath"),Ht=`clippath_${this.data.id}`;Nt.setAttribute("id",Ht),Nt.setAttribute("clipPathUnits","objectBoundingBox"),Lt.append(Nt);for(const[,{x:$t,y:Yt},{x:Jt,y:te}]of k){const Zt=Rt.createElement("rect"),ne=(Jt-x)/Ot,se=(ft-Yt)/Dt,re=($t-Jt)/Ot,mn=(Yt-te)/Dt;Zt.setAttribute("x",ne),Zt.setAttribute("y",se),Zt.setAttribute("width",re),Zt.setAttribute("height",mn),Nt.append(Zt),xt==null||xt.push(`<rect vector-effect="non-scaling-stroke" x="${ne}" y="${se}" width="${re}" height="${mn}"/>`)}t(this,p)&&(xt.push("</g></svg>')"),Et.backgroundImage=xt.join("")),this.container.append(Gt),this.container.style.clipPath=`url(#${Ht})`}_createPopup(){const{container:k,data:x}=this;k.setAttribute("aria-haspopup","dialog");const z=new c({data:{color:x.color,titleObj:x.titleObj,modificationDate:x.modificationDate,contentsObj:x.contentsObj,richText:x.richText,parentRect:x.rect,borderStyle:0,id:`popup_${x.id}`,rotation:x.rotation},parent:this.parent,elements:[this]});this.parent.div.append(z.render())}render(){(0,n.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(k,x=null){const z=[];if(this._fieldObjects){const ht=this._fieldObjects[k];if(ht)for(const{page:ft,id:Et,exportValues:xt}of ht){if(ft===-1||Et===x)continue;const Ot=typeof xt=="string"?xt:null,Dt=document.querySelector(`[data-element-id="${Et}"]`);if(Dt&&!B.has(Dt)){(0,n.warn)(`_getElementsByName - element not allowed: ${Et}`);continue}z.push({id:Et,exportValue:Ot,domElement:Dt})}return z}for(const ht of document.getElementsByName(k)){const{exportValue:ft}=ht,Et=ht.getAttribute("data-element-id");Et!==x&&B.has(ht)&&z.push({id:Et,exportValue:ft,domElement:ht})}return z}show(){var k;this.container&&(this.container.hidden=!1),(k=this.popup)==null||k.maybeShow()}hide(){var k;this.container&&(this.container.hidden=!0),(k=this.popup)==null||k.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const k=this.getElementsToTriggerPopup();if(Array.isArray(k))for(const x of k)x.classList.add("highlightArea");else k.classList.add("highlightArea")}_editOnDoubleClick(){const{annotationEditorType:k,data:{id:x}}=this;this.container.addEventListener("dblclick",()=>{var z;(z=this.linkService.eventBus)==null||z.dispatch("switchannotationeditormode",{source:this,mode:k,editId:x})})}};p=new WeakMap;let _=F;class S extends _{constructor(x,z=null){super(x,{isRenderable:!0,ignoreBorder:!!(z!=null&&z.ignoreBorder),createQuadrilaterals:!0});rt(this,L);this.isTooltipOnly=x.data.isTooltipOnly}render(){const{data:x,linkService:z}=this,ht=document.createElement("a");ht.setAttribute("data-element-id",x.id);let ft=!1;return x.url?(z.addLinkAttributes(ht,x.url,x.newWindow),ft=!0):x.action?(this._bindNamedAction(ht,x.action),ft=!0):x.attachment?(this._bindAttachment(ht,x.attachment),ft=!0):x.setOCGState?(J(this,L,Dn).call(this,ht,x.setOCGState),ft=!0):x.dest?(this._bindLink(ht,x.dest),ft=!0):(x.actions&&(x.actions.Action||x.actions["Mouse Up"]||x.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(ht,x),ft=!0),x.resetForm?(this._bindResetFormAction(ht,x.resetForm),ft=!0):this.isTooltipOnly&&!ft&&(this._bindLink(ht,""),ft=!0)),this.container.classList.add("linkAnnotation"),ft&&this.container.append(ht),this.container}_bindLink(x,z){x.href=this.linkService.getDestinationHash(z),x.onclick=()=>(z&&this.linkService.goToDestination(z),!1),(z||z==="")&&J(this,L,ae).call(this)}_bindNamedAction(x,z){x.href=this.linkService.getAnchorUrl(""),x.onclick=()=>(this.linkService.executeNamedAction(z),!1),J(this,L,ae).call(this)}_bindAttachment(x,z){x.href=this.linkService.getAnchorUrl(""),x.onclick=()=>{var ht;return(ht=this.downloadManager)==null||ht.openOrDownloadData(this.container,z.content,z.filename),!1},J(this,L,ae).call(this)}_bindJSAction(x,z){x.href=this.linkService.getAnchorUrl("");const ht=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const ft of Object.keys(z.actions)){const Et=ht.get(ft);Et&&(x[Et]=()=>{var xt;return(xt=this.linkService.eventBus)==null||xt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:z.id,name:ft}}),!1})}x.onclick||(x.onclick=()=>!1),J(this,L,ae).call(this)}_bindResetFormAction(x,z){const ht=x.onclick;if(ht||(x.href=this.linkService.getAnchorUrl("")),J(this,L,ae).call(this),!this._fieldObjects){(0,n.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),ht||(x.onclick=()=>!1);return}x.onclick=()=>{var Gt;ht==null||ht();const{fields:ft,refs:Et,include:xt}=z,Ot=[];if(ft.length!==0||Et.length!==0){const Lt=new Set(Et);for(const Nt of ft){const Ht=this._fieldObjects[Nt]||[];for(const{id:$t}of Ht)Lt.add($t)}for(const Nt of Object.values(this._fieldObjects))for(const Ht of Nt)Lt.has(Ht.id)===xt&&Ot.push(Ht)}else for(const Lt of Object.values(this._fieldObjects))Ot.push(...Lt);const Dt=this.annotationStorage,Rt=[];for(const Lt of Ot){const{id:Nt}=Lt;switch(Rt.push(Nt),Lt.type){case"text":{const $t=Lt.defaultValue||"";Dt.setValue(Nt,{value:$t});break}case"checkbox":case"radiobutton":{const $t=Lt.defaultValue===Lt.exportValues;Dt.setValue(Nt,{value:$t});break}case"combobox":case"listbox":{const $t=Lt.defaultValue||"";Dt.setValue(Nt,{value:$t});break}default:continue}const Ht=document.querySelector(`[data-element-id="${Nt}"]`);if(Ht){if(!B.has(Ht)){(0,n.warn)(`_bindResetFormAction - element not allowed: ${Nt}`);continue}}else continue;Ht.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((Gt=this.linkService.eventBus)==null||Gt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:Rt,name:"ResetForm"}})),!1}}}L=new WeakSet,ae=function(){this.container.setAttribute("data-internal-link","")},Dn=function(x,z){x.href=this.linkService.getAnchorUrl(""),x.onclick=()=>(this.linkService.executeSetOCGState(z),!1),J(this,L,ae).call(this)};class g extends _{constructor(k){super(k,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const k=document.createElement("img");return k.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",k.alt="[{{type}} Annotation]",k.dataset.l10nId="text_annotation_type",k.dataset.l10nArgs=JSON.stringify({type:this.data.name}),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(k),this.container}}class u extends _{render(){return this.data.alternativeText&&(this.container.title=this.data.alternativeText),this.container}showElementAndHideCanvas(k){var x;this.data.hasOwnCanvas&&(((x=k.previousSibling)==null?void 0:x.nodeName)==="CANVAS"&&(k.previousSibling.hidden=!0),k.hidden=!1)}_getKeyModifier(k){const{isWin:x,isMac:z}=n.FeatureTest.platform;return x&&k.ctrlKey||z&&k.metaKey}_setEventListener(k,x,z,ht,ft){z.includes("mouse")?k.addEventListener(z,Et=>{var xt;(xt=this.linkService.eventBus)==null||xt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:ht,value:ft(Et),shift:Et.shiftKey,modifier:this._getKeyModifier(Et)}})}):k.addEventListener(z,Et=>{var xt;if(z==="blur"){if(!x.focused||!Et.relatedTarget)return;x.focused=!1}else if(z==="focus"){if(x.focused)return;x.focused=!0}ft&&((xt=this.linkService.eventBus)==null||xt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:ht,value:ft(Et)}}))})}_setEventListeners(k,x,z,ht){var ft,Et,xt;for(const[Ot,Dt]of z)(Dt==="Action"||(ft=this.data.actions)!=null&&ft[Dt])&&((Dt==="Focus"||Dt==="Blur")&&(x||(x={focused:!1})),this._setEventListener(k,x,Ot,Dt,ht),Dt==="Focus"&&!((Et=this.data.actions)!=null&&Et.Blur)?this._setEventListener(k,x,"blur","Blur",null):Dt==="Blur"&&!((xt=this.data.actions)!=null&&xt.Focus)&&this._setEventListener(k,x,"focus","Focus",null))}_setBackgroundColor(k){const x=this.data.backgroundColor||null;k.style.backgroundColor=x===null?"transparent":n.Util.makeHexColor(x[0],x[1],x[2])}_setTextStyle(k){const x=["left","center","right"],{fontColor:z}=this.data.defaultAppearanceData,ht=this.data.defaultAppearanceData.fontSize||m,ft=k.style;let Et;const xt=2,Ot=Dt=>Math.round(10*Dt)/10;if(this.data.multiLine){const Dt=Math.abs(this.data.rect[3]-this.data.rect[1]-xt),Rt=Math.round(Dt/(n.LINE_FACTOR*ht))||1,Gt=Dt/Rt;Et=Math.min(ht,Ot(Gt/n.LINE_FACTOR))}else{const Dt=Math.abs(this.data.rect[3]-this.data.rect[1]-xt);Et=Math.min(ht,Ot(Dt/n.LINE_FACTOR))}ft.fontSize=`calc(${Et}px * var(--scale-factor))`,ft.color=n.Util.makeHexColor(z[0],z[1],z[2]),this.data.textAlignment!==null&&(ft.textAlign=x[this.data.textAlignment])}_setRequired(k,x){x?k.setAttribute("required",!0):k.removeAttribute("required"),k.setAttribute("aria-required",x)}}class y extends u{constructor(k){const x=k.renderForms||!k.data.hasAppearance&&!!k.data.fieldValue;super(k,{isRenderable:x})}setPropertyOnSiblings(k,x,z,ht){const ft=this.annotationStorage;for(const Et of this._getElementsByName(k.name,k.id))Et.domElement&&(Et.domElement[x]=z),ft.setValue(Et.id,{[ht]:z})}render(){var ht,ft;const k=this.annotationStorage,x=this.data.id;this.container.classList.add("textWidgetAnnotation");let z=null;if(this.renderForms){const Et=k.getValue(x,{value:this.data.fieldValue});let xt=Et.value||"";const Ot=k.getValue(x,{charLimit:this.data.maxLen}).charLimit;Ot&&xt.length>Ot&&(xt=xt.slice(0,Ot));let Dt=Et.formattedValue||((ht=this.data.textContent)==null?void 0:ht.join(`
`))||null;Dt&&this.data.comb&&(Dt=Dt.replaceAll(/\s+/g,""));const Rt={userValue:xt,formattedValue:Dt,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(z=document.createElement("textarea"),z.textContent=Dt??xt,this.data.doNotScroll&&(z.style.overflowY="hidden")):(z=document.createElement("input"),z.type="text",z.setAttribute("value",Dt??xt),this.data.doNotScroll&&(z.style.overflowX="hidden")),this.data.hasOwnCanvas&&(z.hidden=!0),B.add(z),z.setAttribute("data-element-id",x),z.disabled=this.data.readOnly,z.name=this.data.fieldName,z.tabIndex=T,this._setRequired(z,this.data.required),Ot&&(z.maxLength=Ot),z.addEventListener("input",Lt=>{k.setValue(x,{value:Lt.target.value}),this.setPropertyOnSiblings(z,"value",Lt.target.value,"value"),Rt.formattedValue=null}),z.addEventListener("resetform",Lt=>{const Nt=this.data.defaultFieldValue??"";z.value=Rt.userValue=Nt,Rt.formattedValue=null});let Gt=Lt=>{const{formattedValue:Nt}=Rt;Nt!=null&&(Lt.target.value=Nt),Lt.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){z.addEventListener("focus",Nt=>{if(Rt.focused)return;const{target:Ht}=Nt;Rt.userValue&&(Ht.value=Rt.userValue),Rt.lastCommittedValue=Ht.value,Rt.commitKey=1,Rt.focused=!0}),z.addEventListener("updatefromsandbox",Nt=>{this.showElementAndHideCanvas(Nt.target);const Ht={value($t){Rt.userValue=$t.detail.value??"",k.setValue(x,{value:Rt.userValue.toString()}),$t.target.value=Rt.userValue},formattedValue($t){const{formattedValue:Yt}=$t.detail;Rt.formattedValue=Yt,Yt!=null&&$t.target!==document.activeElement&&($t.target.value=Yt),k.setValue(x,{formattedValue:Yt})},selRange($t){$t.target.setSelectionRange(...$t.detail.selRange)},charLimit:$t=>{var Zt;const{charLimit:Yt}=$t.detail,{target:Jt}=$t;if(Yt===0){Jt.removeAttribute("maxLength");return}Jt.setAttribute("maxLength",Yt);let te=Rt.userValue;!te||te.length<=Yt||(te=te.slice(0,Yt),Jt.value=Rt.userValue=te,k.setValue(x,{value:te}),(Zt=this.linkService.eventBus)==null||Zt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:x,name:"Keystroke",value:te,willCommit:!0,commitKey:1,selStart:Jt.selectionStart,selEnd:Jt.selectionEnd}}))}};this._dispatchEventFromSandbox(Ht,Nt)}),z.addEventListener("keydown",Nt=>{var Yt;Rt.commitKey=1;let Ht=-1;if(Nt.key==="Escape"?Ht=0:Nt.key==="Enter"&&!this.data.multiLine?Ht=2:Nt.key==="Tab"&&(Rt.commitKey=3),Ht===-1)return;const{value:$t}=Nt.target;Rt.lastCommittedValue!==$t&&(Rt.lastCommittedValue=$t,Rt.userValue=$t,(Yt=this.linkService.eventBus)==null||Yt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:x,name:"Keystroke",value:$t,willCommit:!0,commitKey:Ht,selStart:Nt.target.selectionStart,selEnd:Nt.target.selectionEnd}}))});const Lt=Gt;Gt=null,z.addEventListener("blur",Nt=>{var $t;if(!Rt.focused||!Nt.relatedTarget)return;Rt.focused=!1;const{value:Ht}=Nt.target;Rt.userValue=Ht,Rt.lastCommittedValue!==Ht&&(($t=this.linkService.eventBus)==null||$t.dispatch("dispatcheventinsandbox",{source:this,detail:{id:x,name:"Keystroke",value:Ht,willCommit:!0,commitKey:Rt.commitKey,selStart:Nt.target.selectionStart,selEnd:Nt.target.selectionEnd}})),Lt(Nt)}),(ft=this.data.actions)!=null&&ft.Keystroke&&z.addEventListener("beforeinput",Nt=>{var se;Rt.lastCommittedValue=null;const{data:Ht,target:$t}=Nt,{value:Yt,selectionStart:Jt,selectionEnd:te}=$t;let Zt=Jt,ne=te;switch(Nt.inputType){case"deleteWordBackward":{const re=Yt.substring(0,Jt).match(/\w*[^\w]*$/);re&&(Zt-=re[0].length);break}case"deleteWordForward":{const re=Yt.substring(Jt).match(/^[^\w]*\w*/);re&&(ne+=re[0].length);break}case"deleteContentBackward":Jt===te&&(Zt-=1);break;case"deleteContentForward":Jt===te&&(ne+=1);break}Nt.preventDefault(),(se=this.linkService.eventBus)==null||se.dispatch("dispatcheventinsandbox",{source:this,detail:{id:x,name:"Keystroke",value:Yt,change:Ht||"",willCommit:!1,selStart:Zt,selEnd:ne}})}),this._setEventListeners(z,Rt,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],Nt=>Nt.target.value)}if(Gt&&z.addEventListener("blur",Gt),this.data.comb){const Nt=(this.data.rect[2]-this.data.rect[0])/Ot;z.classList.add("comb"),z.style.letterSpacing=`calc(${Nt}px * var(--scale-factor) - 1ch)`}}else z=document.createElement("div"),z.textContent=this.data.fieldValue,z.style.verticalAlign="middle",z.style.display="table-cell";return this._setTextStyle(z),this._setBackgroundColor(z),this._setDefaultPropertiesFromJS(z),this.container.append(z),this.container}}class D extends u{constructor(k){super(k,{isRenderable:!!k.data.hasOwnCanvas})}}class v extends u{constructor(k){super(k,{isRenderable:k.renderForms})}render(){const k=this.annotationStorage,x=this.data,z=x.id;let ht=k.getValue(z,{value:x.exportValue===x.fieldValue}).value;typeof ht=="string"&&(ht=ht!=="Off",k.setValue(z,{value:ht})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const ft=document.createElement("input");return B.add(ft),ft.setAttribute("data-element-id",z),ft.disabled=x.readOnly,this._setRequired(ft,this.data.required),ft.type="checkbox",ft.name=x.fieldName,ht&&ft.setAttribute("checked",!0),ft.setAttribute("exportValue",x.exportValue),ft.tabIndex=T,ft.addEventListener("change",Et=>{const{name:xt,checked:Ot}=Et.target;for(const Dt of this._getElementsByName(xt,z)){const Rt=Ot&&Dt.exportValue===x.exportValue;Dt.domElement&&(Dt.domElement.checked=Rt),k.setValue(Dt.id,{value:Rt})}k.setValue(z,{value:Ot})}),ft.addEventListener("resetform",Et=>{const xt=x.defaultFieldValue||"Off";Et.target.checked=xt===x.exportValue}),this.enableScripting&&this.hasJSActions&&(ft.addEventListener("updatefromsandbox",Et=>{const xt={value(Ot){Ot.target.checked=Ot.detail.value!=="Off",k.setValue(z,{value:Ot.target.checked})}};this._dispatchEventFromSandbox(xt,Et)}),this._setEventListeners(ft,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],Et=>Et.target.checked)),this._setBackgroundColor(ft),this._setDefaultPropertiesFromJS(ft),this.container.append(ft),this.container}}class o extends u{constructor(k){super(k,{isRenderable:k.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const k=this.annotationStorage,x=this.data,z=x.id;let ht=k.getValue(z,{value:x.fieldValue===x.buttonValue}).value;typeof ht=="string"&&(ht=ht!==x.buttonValue,k.setValue(z,{value:ht}));const ft=document.createElement("input");if(B.add(ft),ft.setAttribute("data-element-id",z),ft.disabled=x.readOnly,this._setRequired(ft,this.data.required),ft.type="radio",ft.name=x.fieldName,ht&&ft.setAttribute("checked",!0),ft.tabIndex=T,ft.addEventListener("change",Et=>{const{name:xt,checked:Ot}=Et.target;for(const Dt of this._getElementsByName(xt,z))k.setValue(Dt.id,{value:!1});k.setValue(z,{value:Ot})}),ft.addEventListener("resetform",Et=>{const xt=x.defaultFieldValue;Et.target.checked=xt!=null&&xt===x.buttonValue}),this.enableScripting&&this.hasJSActions){const Et=x.buttonValue;ft.addEventListener("updatefromsandbox",xt=>{const Ot={value:Dt=>{const Rt=Et===Dt.detail.value;for(const Gt of this._getElementsByName(Dt.target.name)){const Lt=Rt&&Gt.id===z;Gt.domElement&&(Gt.domElement.checked=Lt),k.setValue(Gt.id,{value:Lt})}}};this._dispatchEventFromSandbox(Ot,xt)}),this._setEventListeners(ft,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],xt=>xt.target.checked)}return this._setBackgroundColor(ft),this._setDefaultPropertiesFromJS(ft),this.container.append(ft),this.container}}class d extends S{constructor(k){super(k,{ignoreBorder:k.data.hasAppearance})}render(){const k=super.render();k.classList.add("buttonWidgetAnnotation","pushButton"),this.data.alternativeText&&(k.title=this.data.alternativeText);const x=k.lastChild;return this.enableScripting&&this.hasJSActions&&x&&(this._setDefaultPropertiesFromJS(x),x.addEventListener("updatefromsandbox",z=>{this._dispatchEventFromSandbox({},z)})),k}}class l extends u{constructor(k){super(k,{isRenderable:k.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const k=this.annotationStorage,x=this.data.id,z=k.getValue(x,{value:this.data.fieldValue}),ht=document.createElement("select");B.add(ht),ht.setAttribute("data-element-id",x),ht.disabled=this.data.readOnly,this._setRequired(ht,this.data.required),ht.name=this.data.fieldName,ht.tabIndex=T;let ft=this.data.combo&&this.data.options.length>0;this.data.combo||(ht.size=this.data.options.length,this.data.multiSelect&&(ht.multiple=!0)),ht.addEventListener("resetform",Rt=>{const Gt=this.data.defaultFieldValue;for(const Lt of ht.options)Lt.selected=Lt.value===Gt});for(const Rt of this.data.options){const Gt=document.createElement("option");Gt.textContent=Rt.displayValue,Gt.value=Rt.exportValue,z.value.includes(Rt.exportValue)&&(Gt.setAttribute("selected",!0),ft=!1),ht.append(Gt)}let Et=null;if(ft){const Rt=document.createElement("option");Rt.value=" ",Rt.setAttribute("hidden",!0),Rt.setAttribute("selected",!0),ht.prepend(Rt),Et=()=>{Rt.remove(),ht.removeEventListener("input",Et),Et=null},ht.addEventListener("input",Et)}const xt=Rt=>{const Gt=Rt?"value":"textContent",{options:Lt,multiple:Nt}=ht;return Nt?Array.prototype.filter.call(Lt,Ht=>Ht.selected).map(Ht=>Ht[Gt]):Lt.selectedIndex===-1?null:Lt[Lt.selectedIndex][Gt]};let Ot=xt(!1);const Dt=Rt=>{const Gt=Rt.target.options;return Array.prototype.map.call(Gt,Lt=>({displayValue:Lt.textContent,exportValue:Lt.value}))};return this.enableScripting&&this.hasJSActions?(ht.addEventListener("updatefromsandbox",Rt=>{const Gt={value(Lt){Et==null||Et();const Nt=Lt.detail.value,Ht=new Set(Array.isArray(Nt)?Nt:[Nt]);for(const $t of ht.options)$t.selected=Ht.has($t.value);k.setValue(x,{value:xt(!0)}),Ot=xt(!1)},multipleSelection(Lt){ht.multiple=!0},remove(Lt){const Nt=ht.options,Ht=Lt.detail.remove;Nt[Ht].selected=!1,ht.remove(Ht),Nt.length>0&&Array.prototype.findIndex.call(Nt,Yt=>Yt.selected)===-1&&(Nt[0].selected=!0),k.setValue(x,{value:xt(!0),items:Dt(Lt)}),Ot=xt(!1)},clear(Lt){for(;ht.length!==0;)ht.remove(0);k.setValue(x,{value:null,items:[]}),Ot=xt(!1)},insert(Lt){const{index:Nt,displayValue:Ht,exportValue:$t}=Lt.detail.insert,Yt=ht.children[Nt],Jt=document.createElement("option");Jt.textContent=Ht,Jt.value=$t,Yt?Yt.before(Jt):ht.append(Jt),k.setValue(x,{value:xt(!0),items:Dt(Lt)}),Ot=xt(!1)},items(Lt){const{items:Nt}=Lt.detail;for(;ht.length!==0;)ht.remove(0);for(const Ht of Nt){const{displayValue:$t,exportValue:Yt}=Ht,Jt=document.createElement("option");Jt.textContent=$t,Jt.value=Yt,ht.append(Jt)}ht.options.length>0&&(ht.options[0].selected=!0),k.setValue(x,{value:xt(!0),items:Dt(Lt)}),Ot=xt(!1)},indices(Lt){const Nt=new Set(Lt.detail.indices);for(const Ht of Lt.target.options)Ht.selected=Nt.has(Ht.index);k.setValue(x,{value:xt(!0)}),Ot=xt(!1)},editable(Lt){Lt.target.disabled=!Lt.detail.editable}};this._dispatchEventFromSandbox(Gt,Rt)}),ht.addEventListener("input",Rt=>{var Lt;const Gt=xt(!0);k.setValue(x,{value:Gt}),Rt.preventDefault(),(Lt=this.linkService.eventBus)==null||Lt.dispatch("dispatcheventinsandbox",{source:this,detail:{id:x,name:"Keystroke",value:Ot,changeEx:Gt,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(ht,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],Rt=>Rt.target.value)):ht.addEventListener("input",function(Rt){k.setValue(x,{value:xt(!0)})}),this.data.combo&&this._setTextStyle(ht),this._setBackgroundColor(ht),this._setDefaultPropertiesFromJS(ht),this.container.append(ht),this.container}}class c extends _{constructor(k){const{data:x,elements:z}=k;super(k,{isRenderable:_._hasPopupData(x)}),this.elements=z}render(){this.container.classList.add("popupAnnotation");const k=new h({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),x=[];for(const z of this.elements)z.popup=k,x.push(z.data.id),z.addHighlightArea();return this.container.setAttribute("aria-controls",x.map(z=>`${n.AnnotationPrefix}${z}`).join(",")),this.container}}class h{constructor({container:k,color:x,elements:z,titleObj:ht,modificationDate:ft,contentsObj:Et,richText:xt,parent:Ot,rect:Dt,parentRect:Rt,open:Gt}){rt(this,Tt);rt(this,tt,null);rt(this,pt,J(this,Tt,Ln).bind(this));rt(this,gt,J(this,Tt,rn).bind(this));rt(this,bt,J(this,Tt,sn).bind(this));rt(this,At,J(this,Tt,Ce).bind(this));rt(this,yt,null);rt(this,Y,null);rt(this,nt,null);rt(this,b,null);rt(this,O,null);rt(this,K,null);rt(this,st,!1);rt(this,mt,null);rt(this,wt,null);rt(this,vt,null);rt(this,Z,null);rt(this,Ct,!1);var Nt;ot(this,Y,k),ot(this,Z,ht),ot(this,nt,Et),ot(this,vt,xt),ot(this,O,Ot),ot(this,yt,x),ot(this,wt,Dt),ot(this,K,Rt),ot(this,b,z);const Lt=f.PDFDateString.toDateObject(ft);Lt&&ot(this,tt,Ot.l10n.get("annotation_date_string",{date:Lt.toLocaleDateString(),time:Lt.toLocaleTimeString()})),this.trigger=z.flatMap(Ht=>Ht.getElementsToTriggerPopup());for(const Ht of this.trigger)Ht.addEventListener("click",t(this,At)),Ht.addEventListener("mouseenter",t(this,bt)),Ht.addEventListener("mouseleave",t(this,gt)),Ht.classList.add("popupTriggerArea");for(const Ht of z)(Nt=Ht.container)==null||Nt.addEventListener("keydown",t(this,pt));t(this,Y).hidden=!0,Gt&&J(this,Tt,Ce).call(this)}render(){if(t(this,mt))return;const{page:{view:k},viewport:{rawDims:{pageWidth:x,pageHeight:z,pageX:ht,pageY:ft}}}=t(this,O),Et=ot(this,mt,document.createElement("div"));if(Et.className="popup",t(this,yt)){const Zt=Et.style.outlineColor=n.Util.makeHexColor(...t(this,yt));CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?Et.style.backgroundColor=`color-mix(in srgb, ${Zt} 30%, white)`:Et.style.backgroundColor=n.Util.makeHexColor(...t(this,yt).map(se=>Math.floor(.7*(255-se)+se)))}const xt=document.createElement("span");xt.className="header";const Ot=document.createElement("h1");if(xt.append(Ot),{dir:Ot.dir,str:Ot.textContent}=t(this,Z),Et.append(xt),t(this,tt)){const Zt=document.createElement("span");Zt.classList.add("popupDate"),t(this,tt).then(ne=>{Zt.textContent=ne}),xt.append(Zt)}const Dt=t(this,nt),Rt=t(this,vt);if(Rt!=null&&Rt.str&&(!(Dt!=null&&Dt.str)||Dt.str===Rt.str))R.XfaLayer.render({xfaHtml:Rt.html,intent:"richText",div:Et}),Et.lastChild.classList.add("richText","popupContent");else{const Zt=this._formatContents(Dt);Et.append(Zt)}let Gt=!!t(this,K),Lt=Gt?t(this,K):t(this,wt);for(const Zt of t(this,b))if(!Lt||n.Util.intersect(Zt.data.rect,Lt)!==null){Lt=Zt.data.rect,Gt=!0;break}const Nt=n.Util.normalizeRect([Lt[0],k[3]-Lt[1]+k[1],Lt[2],k[3]-Lt[3]+k[1]]),$t=Gt?Lt[2]-Lt[0]+5:0,Yt=Nt[0]+$t,Jt=Nt[1],{style:te}=t(this,Y);te.left=`${100*(Yt-ht)/x}%`,te.top=`${100*(Jt-ft)/z}%`,t(this,Y).append(Et)}_formatContents({str:k,dir:x}){const z=document.createElement("p");z.classList.add("popupContent"),z.dir=x;const ht=k.split(/(?:\r\n?|\n)/);for(let ft=0,Et=ht.length;ft<Et;++ft){const xt=ht[ft];z.append(document.createTextNode(xt)),ft<Et-1&&z.append(document.createElement("br"))}return z}forceHide(){ot(this,Ct,this.isVisible),t(this,Ct)&&(t(this,Y).hidden=!0)}maybeShow(){t(this,Ct)&&(ot(this,Ct,!1),t(this,Y).hidden=!1)}get isVisible(){return t(this,Y).hidden===!1}}tt=new WeakMap,pt=new WeakMap,gt=new WeakMap,bt=new WeakMap,At=new WeakMap,yt=new WeakMap,Y=new WeakMap,nt=new WeakMap,b=new WeakMap,O=new WeakMap,K=new WeakMap,st=new WeakMap,mt=new WeakMap,wt=new WeakMap,vt=new WeakMap,Z=new WeakMap,Ct=new WeakMap,Tt=new WeakSet,Ln=function(k){k.altKey||k.shiftKey||k.ctrlKey||k.metaKey||(k.key==="Enter"||k.key==="Escape"&&t(this,st))&&J(this,Tt,Ce).call(this)},Ce=function(){ot(this,st,!t(this,st)),t(this,st)?(J(this,Tt,sn).call(this),t(this,Y).addEventListener("click",t(this,At)),t(this,Y).addEventListener("keydown",t(this,pt))):(J(this,Tt,rn).call(this),t(this,Y).removeEventListener("click",t(this,At)),t(this,Y).removeEventListener("keydown",t(this,pt)))},sn=function(){t(this,mt)||this.render(),this.isVisible?t(this,st)&&t(this,Y).classList.add("focused"):(t(this,Y).hidden=!1,t(this,Y).style.zIndex=parseInt(t(this,Y).style.zIndex)+1e3)},rn=function(){t(this,Y).classList.remove("focused"),!(t(this,st)||!this.isVisible)&&(t(this,Y).hidden=!0,t(this,Y).style.zIndex=parseInt(t(this,Y).style.zIndex)-1e3)};class N extends _{constructor(k){super(k,{isRenderable:!0,ignoreBorder:!0}),this.textContent=k.data.textContent,this.textPosition=k.data.textPosition,this.annotationEditorType=n.AnnotationEditorType.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const k=document.createElement("div");k.classList.add("annotationTextContent"),k.setAttribute("role","comment");for(const x of this.textContent){const z=document.createElement("span");z.textContent=x,k.append(z)}this.container.append(k)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}e.FreeTextAnnotationElement=N;class a extends _{constructor(x){super(x,{isRenderable:!0,ignoreBorder:!0});rt(this,jt,null)}render(){this.container.classList.add("lineAnnotation");const x=this.data,{width:z,height:ht}=j(x.rect),ft=this.svgFactory.create(z,ht,!0),Et=ot(this,jt,this.svgFactory.createElement("svg:line"));return Et.setAttribute("x1",x.rect[2]-x.lineCoordinates[0]),Et.setAttribute("y1",x.rect[3]-x.lineCoordinates[1]),Et.setAttribute("x2",x.rect[2]-x.lineCoordinates[2]),Et.setAttribute("y2",x.rect[3]-x.lineCoordinates[3]),Et.setAttribute("stroke-width",x.borderStyle.width||1),Et.setAttribute("stroke","transparent"),Et.setAttribute("fill","transparent"),ft.append(Et),this.container.append(ft),!x.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return t(this,jt)}addHighlightArea(){this.container.classList.add("highlightArea")}}jt=new WeakMap;class E extends _{constructor(x){super(x,{isRenderable:!0,ignoreBorder:!0});rt(this,Vt,null)}render(){this.container.classList.add("squareAnnotation");const x=this.data,{width:z,height:ht}=j(x.rect),ft=this.svgFactory.create(z,ht,!0),Et=x.borderStyle.width,xt=ot(this,Vt,this.svgFactory.createElement("svg:rect"));return xt.setAttribute("x",Et/2),xt.setAttribute("y",Et/2),xt.setAttribute("width",z-Et),xt.setAttribute("height",ht-Et),xt.setAttribute("stroke-width",Et||1),xt.setAttribute("stroke","transparent"),xt.setAttribute("fill","transparent"),ft.append(xt),this.container.append(ft),!x.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return t(this,Vt)}addHighlightArea(){this.container.classList.add("highlightArea")}}Vt=new WeakMap;class P extends _{constructor(x){super(x,{isRenderable:!0,ignoreBorder:!0});rt(this,Kt,null)}render(){this.container.classList.add("circleAnnotation");const x=this.data,{width:z,height:ht}=j(x.rect),ft=this.svgFactory.create(z,ht,!0),Et=x.borderStyle.width,xt=ot(this,Kt,this.svgFactory.createElement("svg:ellipse"));return xt.setAttribute("cx",z/2),xt.setAttribute("cy",ht/2),xt.setAttribute("rx",z/2-Et/2),xt.setAttribute("ry",ht/2-Et/2),xt.setAttribute("stroke-width",Et||1),xt.setAttribute("stroke","transparent"),xt.setAttribute("fill","transparent"),ft.append(xt),this.container.append(ft),!x.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return t(this,Kt)}addHighlightArea(){this.container.classList.add("highlightArea")}}Kt=new WeakMap;class et extends _{constructor(x){super(x,{isRenderable:!0,ignoreBorder:!0});rt(this,St,null);this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const x=this.data,{width:z,height:ht}=j(x.rect),ft=this.svgFactory.create(z,ht,!0);let Et=[];for(const Ot of x.vertices){const Dt=Ot.x-x.rect[0],Rt=x.rect[3]-Ot.y;Et.push(Dt+","+Rt)}Et=Et.join(" ");const xt=ot(this,St,this.svgFactory.createElement(this.svgElementName));return xt.setAttribute("points",Et),xt.setAttribute("stroke-width",x.borderStyle.width||1),xt.setAttribute("stroke","transparent"),xt.setAttribute("fill","transparent"),ft.append(xt),this.container.append(ft),!x.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return t(this,St)}addHighlightArea(){this.container.classList.add("highlightArea")}}St=new WeakMap;class V extends et{constructor(k){super(k),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class Q extends _{constructor(k){super(k,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class W extends _{constructor(x){super(x,{isRenderable:!0,ignoreBorder:!0});rt(this,at,[]);this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=n.AnnotationEditorType.INK}render(){this.container.classList.add(this.containerClassName);const x=this.data,{width:z,height:ht}=j(x.rect),ft=this.svgFactory.create(z,ht,!0);for(const Et of x.inkLists){let xt=[];for(const Dt of Et){const Rt=Dt.x-x.rect[0],Gt=x.rect[3]-Dt.y;xt.push(`${Rt},${Gt}`)}xt=xt.join(" ");const Ot=this.svgFactory.createElement(this.svgElementName);t(this,at).push(Ot),Ot.setAttribute("points",xt),Ot.setAttribute("stroke-width",x.borderStyle.width||1),Ot.setAttribute("stroke","transparent"),Ot.setAttribute("fill","transparent"),!x.popupRef&&this.hasPopupData&&this._createPopup(),ft.append(Ot)}return this.container.append(ft),this.container}getElementsToTriggerPopup(){return t(this,at)}addHighlightArea(){this.container.classList.add("highlightArea")}}at=new WeakMap,e.InkAnnotationElement=W;class lt extends _{constructor(k){super(k,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this.container}}class C extends _{constructor(k){super(k,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class $ extends _{constructor(k){super(k,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class it extends _{constructor(k){super(k,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class w extends _{constructor(k){super(k,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("stampAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}e.StampAnnotationElement=w;class i extends _{constructor(x){var ft;super(x,{isRenderable:!0});rt(this,Mt);rt(this,ct,null);const{filename:z,content:ht}=this.data.file;this.filename=(0,f.getFilenameFromUrl)(z,!0),this.content=ht,(ft=this.linkService.eventBus)==null||ft.dispatch("fileattachmentannotation",{source:this,filename:z,content:ht})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:x,data:z}=this;let ht;z.hasAppearance||z.fillAlpha===0?ht=document.createElement("div"):(ht=document.createElement("img"),ht.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(z.name)?"paperclip":"pushpin"}.svg`,z.fillAlpha&&z.fillAlpha<1&&(ht.style=`filter: opacity(${Math.round(z.fillAlpha*100)}%);`)),ht.addEventListener("dblclick",J(this,Mt,an).bind(this)),ot(this,ct,ht);const{isMac:ft}=n.FeatureTest.platform;return x.addEventListener("keydown",Et=>{Et.key==="Enter"&&(ft?Et.metaKey:Et.ctrlKey)&&J(this,Mt,an).call(this)}),!z.popupRef&&this.hasPopupData?this._createPopup():ht.classList.add("popupTriggerArea"),x.append(ht),x}getElementsToTriggerPopup(){return t(this,ct)}addHighlightArea(){this.container.classList.add("highlightArea")}}ct=new WeakMap,Mt=new WeakSet,an=function(){var x;(x=this.downloadManager)==null||x.openOrDownloadData(this.container,this.content,this.filename)};class s{constructor({div:k,accessibilityManager:x,annotationCanvasMap:z,l10n:ht,page:ft,viewport:Et}){rt(this,Pt);rt(this,zt,null);rt(this,U,null);rt(this,_t,new Map);this.div=k,ot(this,zt,x),ot(this,U,z),this.l10n=ht,this.page=ft,this.viewport=Et,this.zIndex=0,this.l10n||(this.l10n=ut.NullL10n)}async render(k){const{annotations:x}=k,z=this.div;(0,f.setLayerDimensions)(z,this.viewport);const ht=new Map,ft={data:null,layer:z,linkService:k.linkService,downloadManager:k.downloadManager,imageResourcesPath:k.imageResourcesPath||"",renderForms:k.renderForms!==!1,svgFactory:new f.DOMSVGFactory,annotationStorage:k.annotationStorage||new X.AnnotationStorage,enableScripting:k.enableScripting===!0,hasJSActions:k.hasJSActions,fieldObjects:k.fieldObjects,parent:this,elements:null};for(const Et of x){if(Et.noHTML)continue;const xt=Et.annotationType===n.AnnotationType.POPUP;if(xt){const Rt=ht.get(Et.id);if(!Rt)continue;ft.elements=Rt}else{const{width:Rt,height:Gt}=j(Et.rect);if(Rt<=0||Gt<=0)continue}ft.data=Et;const Ot=A.create(ft);if(!Ot.isRenderable)continue;if(!xt&&Et.popupRef){const Rt=ht.get(Et.popupRef);Rt?Rt.push(Ot):ht.set(Et.popupRef,[Ot])}Ot.annotationEditorType>0&&t(this,_t).set(Ot.data.id,Ot);const Dt=Ot.render();Et.hidden&&(Dt.style.visibility="hidden"),J(this,Pt,In).call(this,Dt,Et.id)}J(this,Pt,on).call(this),await this.l10n.translate(z)}update({viewport:k}){const x=this.div;this.viewport=k,(0,f.setLayerDimensions)(x,{rotation:k.rotation}),J(this,Pt,on).call(this),x.hidden=!1}getEditableAnnotations(){return Array.from(t(this,_t).values())}getEditableAnnotation(k){return t(this,_t).get(k)}}zt=new WeakMap,U=new WeakMap,_t=new WeakMap,Pt=new WeakSet,In=function(k,x){var ht;const z=k.firstChild||k;z.id=`${n.AnnotationPrefix}${x}`,this.div.append(k),(ht=t(this,zt))==null||ht.moveElementInDOM(this.div,k,z,!1)},on=function(){if(!t(this,U))return;const k=this.div;for(const[x,z]of t(this,U)){const ht=k.querySelector(`[data-annotation-id="${x}"]`);if(!ht)continue;const{firstChild:ft}=ht;ft?ft.nodeName==="CANVAS"?ft.replaceWith(z):ft.before(z):ht.append(z)}t(this,U).clear()},e.AnnotationLayer=s},(M,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ColorConverters=void 0;function H(X){return Math.floor(Math.max(0,Math.min(1,X))*255).toString(16).padStart(2,"0")}function n(X){return Math.max(0,Math.min(255,255*X))}class f{static CMYK_G([G,ut,R,T]){return["G",1-Math.min(1,.3*G+.59*R+.11*ut+T)]}static G_CMYK([G]){return["CMYK",0,0,0,1-G]}static G_RGB([G]){return["RGB",G,G,G]}static G_rgb([G]){return G=n(G),[G,G,G]}static G_HTML([G]){const ut=H(G);return`#${ut}${ut}${ut}`}static RGB_G([G,ut,R]){return["G",.3*G+.59*ut+.11*R]}static RGB_rgb(G){return G.map(n)}static RGB_HTML(G){return`#${G.map(H).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([G,ut,R,T]){return["RGB",1-Math.min(1,G+T),1-Math.min(1,R+T),1-Math.min(1,ut+T)]}static CMYK_rgb([G,ut,R,T]){return[n(1-Math.min(1,G+T)),n(1-Math.min(1,R+T)),n(1-Math.min(1,ut+T))]}static CMYK_HTML(G){const ut=this.CMYK_RGB(G).slice(1);return this.RGB_HTML(ut)}static RGB_CMYK([G,ut,R]){const T=1-G,m=1-ut,B=1-R,j=Math.min(T,m,B);return["CMYK",T,m,B,j]}}e.ColorConverters=f},(M,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NullL10n=void 0,e.getL10nFallback=n;const H={of_pages:"of {{pagesCount}}",page_of_pages:"({{pageNumber}} of {{pagesCount}})",document_properties_kb:"{{size_kb}} KB ({{size_b}} bytes)",document_properties_mb:"{{size_mb}} MB ({{size_b}} bytes)",document_properties_date_string:"{{date}}, {{time}}",document_properties_page_size_unit_inches:"in",document_properties_page_size_unit_millimeters:"mm",document_properties_page_size_orientation_portrait:"portrait",document_properties_page_size_orientation_landscape:"landscape",document_properties_page_size_name_a3:"A3",document_properties_page_size_name_a4:"A4",document_properties_page_size_name_letter:"Letter",document_properties_page_size_name_legal:"Legal",document_properties_page_size_dimension_string:"{{width}} × {{height}} {{unit}} ({{orientation}})",document_properties_page_size_dimension_name_string:"{{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})",document_properties_linearized_yes:"Yes",document_properties_linearized_no:"No",additional_layers:"Additional Layers",page_landmark:"Page {{page}}",thumb_page_title:"Page {{page}}",thumb_page_canvas:"Thumbnail of Page {{page}}",find_reached_top:"Reached top of document, continued from bottom",find_reached_bottom:"Reached end of document, continued from top","find_match_count[one]":"{{current}} of {{total}} match","find_match_count[other]":"{{current}} of {{total}} matches","find_match_count_limit[one]":"More than {{limit}} match","find_match_count_limit[other]":"More than {{limit}} matches",find_not_found:"Phrase not found",page_scale_width:"Page Width",page_scale_fit:"Page Fit",page_scale_auto:"Automatic Zoom",page_scale_actual:"Actual Size",page_scale_percent:"{{scale}}%",loading_error:"An error occurred while loading the PDF.",invalid_file_error:"Invalid or corrupted PDF file.",missing_file_error:"Missing PDF file.",unexpected_response_error:"Unexpected server response.",rendering_error:"An error occurred while rendering the page.",annotation_date_string:"{{date}}, {{time}}",printing_not_supported:"Warning: Printing is not fully supported by this browser.",printing_not_ready:"Warning: The PDF is not fully loaded for printing.",web_fonts_disabled:"Web fonts are disabled: unable to use embedded PDF fonts.",free_text2_default_content:"Start typing…",editor_free_text2_aria_label:"Text Editor",editor_ink2_aria_label:"Draw Editor",editor_ink_canvas_aria_label:"User-created image",editor_alt_text_button_label:"Alt text",editor_alt_text_edit_button_label:"Edit alt text",editor_alt_text_decorative_tooltip:"Marked as decorative"};H.print_progress_percent="{{progress}}%";function n(G,ut){switch(G){case"find_match_count":G=`find_match_count[${ut.total===1?"one":"other"}]`;break;case"find_match_count_limit":G=`find_match_count_limit[${ut.limit===1?"one":"other"}]`;break}return H[G]||""}function f(G,ut){return ut?G.replaceAll(/\{\{\s*(\w+)\s*\}\}/g,(R,T)=>T in ut?ut[T]:"{{"+T+"}}"):G}const X={async getLanguage(){return"en-us"},async getDirection(){return"ltr"},async get(G,ut=null,R=n(G,ut)){return f(R,ut)},async translate(G){}};e.NullL10n=X},(M,e,H)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.XfaLayer=void 0;var n=H(25);class f{static setupStorage(G,ut,R,T,m){const B=T.getValue(ut,{value:null});switch(R.name){case"textarea":if(B.value!==null&&(G.textContent=B.value),m==="print")break;G.addEventListener("input",j=>{T.setValue(ut,{value:j.target.value})});break;case"input":if(R.attributes.type==="radio"||R.attributes.type==="checkbox"){if(B.value===R.attributes.xfaOn?G.setAttribute("checked",!0):B.value===R.attributes.xfaOff&&G.removeAttribute("checked"),m==="print")break;G.addEventListener("change",j=>{T.setValue(ut,{value:j.target.checked?j.target.getAttribute("xfaOn"):j.target.getAttribute("xfaOff")})})}else{if(B.value!==null&&G.setAttribute("value",B.value),m==="print")break;G.addEventListener("input",j=>{T.setValue(ut,{value:j.target.value})})}break;case"select":if(B.value!==null){G.setAttribute("value",B.value);for(const j of R.children)j.attributes.value===B.value?j.attributes.selected=!0:j.attributes.hasOwnProperty("selected")&&delete j.attributes.selected}G.addEventListener("input",j=>{const A=j.target.options,_=A.selectedIndex===-1?"":A[A.selectedIndex].value;T.setValue(ut,{value:_})});break}}static setAttributes({html:G,element:ut,storage:R=null,intent:T,linkService:m}){const{attributes:B}=ut,j=G instanceof HTMLAnchorElement;B.type==="radio"&&(B.name=`${B.name}-${T}`);for(const[A,_]of Object.entries(B))if(_!=null)switch(A){case"class":_.length&&G.setAttribute(A,_.join(" "));break;case"dataId":break;case"id":G.setAttribute("data-element-id",_);break;case"style":Object.assign(G.style,_);break;case"textContent":G.textContent=_;break;default:(!j||A!=="href"&&A!=="newWindow")&&G.setAttribute(A,_)}j&&m.addLinkAttributes(G,B.href,B.newWindow),R&&B.dataId&&this.setupStorage(G,B.dataId,ut,R)}static render(G){var S;const ut=G.annotationStorage,R=G.linkService,T=G.xfaHtml,m=G.intent||"display",B=document.createElement(T.name);T.attributes&&this.setAttributes({html:B,element:T,intent:m,linkService:R});const j=[[T,-1,B]],A=G.div;if(A.append(B),G.viewport){const g=`matrix(${G.viewport.transform.join(",")})`;A.style.transform=g}m!=="richText"&&A.setAttribute("class","xfaLayer xfaFont");const _=[];for(;j.length>0;){const[g,u,y]=j.at(-1);if(u+1===g.children.length){j.pop();continue}const D=g.children[++j.at(-1)[1]];if(D===null)continue;const{name:v}=D;if(v==="#text"){const d=document.createTextNode(D.value);_.push(d),y.append(d);continue}const o=(S=D==null?void 0:D.attributes)!=null&&S.xmlns?document.createElementNS(D.attributes.xmlns,v):document.createElement(v);if(y.append(o),D.attributes&&this.setAttributes({html:o,element:D,storage:ut,intent:m,linkService:R}),D.children&&D.children.length>0)j.push([D,-1,o]);else if(D.value){const d=document.createTextNode(D.value);n.XfaText.shouldBuildText(v)&&_.push(d),o.append(d)}}for(const g of A.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))g.setAttribute("readOnly",!0);return{textDivs:_}}static update(G){const ut=`matrix(${G.viewport.transform.join(",")})`;G.div.style.transform=ut,G.div.hidden=!1}}e.XfaLayer=f},(M,e,H)=>{var T,m,B,j,A,_,S,g,u,y,D,v,o,d,l,On,Nn,jn,Bn,ln,Un,cn,Hn,Wn,Gn,Vn,$n,ie,hn,Pe,Re,he,dn,ke,L,zn,un,Xn,qn,fn,Fe,de;Object.defineProperty(e,"__esModule",{value:!0}),e.InkEditor=void 0;var n=H(1),f=H(4),X=H(29),G=H(6),ut=H(5);const yt=class yt extends f.AnnotationEditor{constructor(b){super({...b,name:"inkEditor"});rt(this,l);rt(this,T,0);rt(this,m,0);rt(this,B,this.canvasPointermove.bind(this));rt(this,j,this.canvasPointerleave.bind(this));rt(this,A,this.canvasPointerup.bind(this));rt(this,_,this.canvasPointerdown.bind(this));rt(this,S,new Path2D);rt(this,g,!1);rt(this,u,!1);rt(this,y,!1);rt(this,D,null);rt(this,v,0);rt(this,o,0);rt(this,d,null);this.color=b.color||null,this.thickness=b.thickness||null,this.opacity=b.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(b){f.AnnotationEditor.initialize(b,{strings:["editor_ink_canvas_aria_label","editor_ink2_aria_label"]})}static updateDefaultParams(b,O){switch(b){case n.AnnotationEditorParamsType.INK_THICKNESS:yt._defaultThickness=O;break;case n.AnnotationEditorParamsType.INK_COLOR:yt._defaultColor=O;break;case n.AnnotationEditorParamsType.INK_OPACITY:yt._defaultOpacity=O/100;break}}updateParams(b,O){switch(b){case n.AnnotationEditorParamsType.INK_THICKNESS:J(this,l,On).call(this,O);break;case n.AnnotationEditorParamsType.INK_COLOR:J(this,l,Nn).call(this,O);break;case n.AnnotationEditorParamsType.INK_OPACITY:J(this,l,jn).call(this,O);break}}static get defaultPropertiesToUpdate(){return[[n.AnnotationEditorParamsType.INK_THICKNESS,yt._defaultThickness],[n.AnnotationEditorParamsType.INK_COLOR,yt._defaultColor||f.AnnotationEditor._defaultLineColor],[n.AnnotationEditorParamsType.INK_OPACITY,Math.round(yt._defaultOpacity*100)]]}get propertiesToUpdate(){return[[n.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||yt._defaultThickness],[n.AnnotationEditorParamsType.INK_COLOR,this.color||yt._defaultColor||f.AnnotationEditor._defaultLineColor],[n.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??yt._defaultOpacity))]]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(J(this,l,Pe).call(this),J(this,l,Re).call(this)),this.isAttachedToDOM||(this.parent.add(this),J(this,l,he).call(this)),J(this,l,de).call(this)))}remove(){this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,t(this,D).disconnect(),ot(this,D,null),super.remove())}setParent(b){!this.parent&&b?this._uiManager.removeShouldRescale(this):this.parent&&b===null&&this._uiManager.addShouldRescale(this),super.setParent(b)}onScaleChanging(){const[b,O]=this.parentDimensions,K=this.width*b,st=this.height*O;this.setDimensions(K,st)}enableEditMode(){t(this,g)||this.canvas===null||(super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener("pointerdown",t(this,_)))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",t(this,_)))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}commit(){t(this,g)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),ot(this,g,!0),this.div.classList.add("disabled"),J(this,l,de).call(this,!0),this.makeResizable(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(b){this._focusEventsAllowed&&(super.focusin(b),this.enableEditMode())}canvasPointerdown(b){b.button!==0||!this.isInEditMode()||t(this,g)||(this.setInForeground(),b.preventDefault(),b.type!=="mouse"&&this.div.focus(),J(this,l,Un).call(this,b.offsetX,b.offsetY))}canvasPointermove(b){b.preventDefault(),J(this,l,cn).call(this,b.offsetX,b.offsetY)}canvasPointerup(b){b.preventDefault(),J(this,l,hn).call(this,b)}canvasPointerleave(b){J(this,l,hn).call(this,b)}get isResizable(){return!this.isEmpty()&&t(this,g)}render(){if(this.div)return this.div;let b,O;this.width&&(b=this.x,O=this.y),super.render(),f.AnnotationEditor._l10nPromise.get("editor_ink2_aria_label").then(vt=>{var Z;return(Z=this.div)==null?void 0:Z.setAttribute("aria-label",vt)});const[K,st,mt,wt]=J(this,l,Bn).call(this);if(this.setAt(K,st,0,0),this.setDims(mt,wt),J(this,l,Pe).call(this),this.width){const[vt,Z]=this.parentDimensions;this.setAspectRatio(this.width*vt,this.height*Z),this.setAt(b*vt,O*Z,this.width*vt,this.height*Z),ot(this,y,!0),J(this,l,he).call(this),this.setDims(this.width*vt,this.height*Z),J(this,l,ie).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return J(this,l,Re).call(this),this.div}setDimensions(b,O){const K=Math.round(b),st=Math.round(O);if(t(this,v)===K&&t(this,o)===st)return;ot(this,v,K),ot(this,o,st),this.canvas.style.visibility="hidden";const[mt,wt]=this.parentDimensions;this.width=b/mt,this.height=O/wt,this.fixAndSetPosition(),t(this,g)&&J(this,l,dn).call(this,b,O),J(this,l,he).call(this),J(this,l,ie).call(this),this.canvas.style.visibility="visible",this.fixDims()}static deserialize(b,O,K){var jt,Vt,Kt;if(b instanceof X.InkAnnotationElement)return null;const st=super.deserialize(b,O,K);st.thickness=b.thickness,st.color=n.Util.makeHexColor(...b.color),st.opacity=b.opacity;const[mt,wt]=st.pageDimensions,vt=st.width*mt,Z=st.height*wt,Ct=st.parentScale,Tt=b.thickness/2;ot(st,g,!0),ot(st,v,Math.round(vt)),ot(st,o,Math.round(Z));const{paths:Wt,rect:Ut,rotation:Xt}=b;for(let{bezier:St}of Wt){St=J(jt=yt,L,Xn).call(jt,St,Ut,Xt);const at=[];st.paths.push(at);let ct=Ct*(St[0]-Tt),Mt=Ct*(St[1]-Tt);for(let zt=2,U=St.length;zt<U;zt+=6){const _t=Ct*(St[zt]-Tt),Pt=Ct*(St[zt+1]-Tt),It=Ct*(St[zt+2]-Tt),Bt=Ct*(St[zt+3]-Tt),Ft=Ct*(St[zt+4]-Tt),k=Ct*(St[zt+5]-Tt);at.push([[ct,Mt],[_t,Pt],[It,Bt],[Ft,k]]),ct=Ft,Mt=k}const qt=J(this,L,zn).call(this,at);st.bezierPath2D.push(qt)}const kt=J(Vt=st,l,fn).call(Vt);return ot(st,m,Math.max(f.AnnotationEditor.MIN_SIZE,kt[2]-kt[0])),ot(st,T,Math.max(f.AnnotationEditor.MIN_SIZE,kt[3]-kt[1])),J(Kt=st,l,dn).call(Kt,vt,Z),st}serialize(){if(this.isEmpty())return null;const b=this.getRect(0,0),O=f.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:n.AnnotationEditorType.INK,color:O,thickness:this.thickness,opacity:this.opacity,paths:J(this,l,qn).call(this,this.scaleFactor/this.parentScale,this.translationX,this.translationY,b),pageIndex:this.pageIndex,rect:b,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}};T=new WeakMap,m=new WeakMap,B=new WeakMap,j=new WeakMap,A=new WeakMap,_=new WeakMap,S=new WeakMap,g=new WeakMap,u=new WeakMap,y=new WeakMap,D=new WeakMap,v=new WeakMap,o=new WeakMap,d=new WeakMap,l=new WeakSet,On=function(b){const O=this.thickness;this.addCommands({cmd:()=>{this.thickness=b,J(this,l,de).call(this)},undo:()=>{this.thickness=O,J(this,l,de).call(this)},mustExec:!0,type:n.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})},Nn=function(b){const O=this.color;this.addCommands({cmd:()=>{this.color=b,J(this,l,ie).call(this)},undo:()=>{this.color=O,J(this,l,ie).call(this)},mustExec:!0,type:n.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})},jn=function(b){b/=100;const O=this.opacity;this.addCommands({cmd:()=>{this.opacity=b,J(this,l,ie).call(this)},undo:()=>{this.opacity=O,J(this,l,ie).call(this)},mustExec:!0,type:n.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})},Bn=function(){const{parentRotation:b,parentDimensions:[O,K]}=this;switch(b){case 90:return[0,K,K,O];case 180:return[O,K,O,K];case 270:return[O,0,K,O];default:return[0,0,O,K]}},ln=function(){const{ctx:b,color:O,opacity:K,thickness:st,parentScale:mt,scaleFactor:wt}=this;b.lineWidth=st*mt/wt,b.lineCap="round",b.lineJoin="round",b.miterLimit=10,b.strokeStyle=`${O}${(0,ut.opacityToHex)(K)}`},Un=function(b,O){this.canvas.addEventListener("contextmenu",G.noContextMenu),this.canvas.addEventListener("pointerleave",t(this,j)),this.canvas.addEventListener("pointermove",t(this,B)),this.canvas.addEventListener("pointerup",t(this,A)),this.canvas.removeEventListener("pointerdown",t(this,_)),this.isEditing=!0,t(this,y)||(ot(this,y,!0),J(this,l,he).call(this),this.thickness||(this.thickness=yt._defaultThickness),this.color||(this.color=yt._defaultColor||f.AnnotationEditor._defaultLineColor),this.opacity??(this.opacity=yt._defaultOpacity)),this.currentPath.push([b,O]),ot(this,u,!1),J(this,l,ln).call(this),ot(this,d,()=>{J(this,l,Gn).call(this),t(this,d)&&window.requestAnimationFrame(t(this,d))}),window.requestAnimationFrame(t(this,d))},cn=function(b,O){const[K,st]=this.currentPath.at(-1);if(this.currentPath.length>1&&b===K&&O===st)return;const mt=this.currentPath;let wt=t(this,S);if(mt.push([b,O]),ot(this,u,!0),mt.length<=2){wt.moveTo(...mt[0]),wt.lineTo(b,O);return}mt.length===3&&(ot(this,S,wt=new Path2D),wt.moveTo(...mt[0])),J(this,l,Vn).call(this,wt,...mt.at(-3),...mt.at(-2),b,O)},Hn=function(){if(this.currentPath.length===0)return;const b=this.currentPath.at(-1);t(this,S).lineTo(...b)},Wn=function(b,O){ot(this,d,null),b=Math.min(Math.max(b,0),this.canvas.width),O=Math.min(Math.max(O,0),this.canvas.height),J(this,l,cn).call(this,b,O),J(this,l,Hn).call(this);let K;if(this.currentPath.length!==1)K=J(this,l,$n).call(this);else{const Z=[b,O];K=[[Z,Z.slice(),Z.slice(),Z]]}const st=t(this,S),mt=this.currentPath;this.currentPath=[],ot(this,S,new Path2D);const wt=()=>{this.allRawPaths.push(mt),this.paths.push(K),this.bezierPath2D.push(st),this.rebuild()},vt=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(J(this,l,Pe).call(this),J(this,l,Re).call(this)),J(this,l,de).call(this))};this.addCommands({cmd:wt,undo:vt,mustExec:!0})},Gn=function(){if(!t(this,u))return;ot(this,u,!1);const b=Math.ceil(this.thickness*this.parentScale),O=this.currentPath.slice(-3),K=O.map(wt=>wt[0]),st=O.map(wt=>wt[1]);Math.min(...K)-b,Math.max(...K)+b,Math.min(...st)-b,Math.max(...st)+b;const{ctx:mt}=this;mt.save(),mt.clearRect(0,0,this.canvas.width,this.canvas.height);for(const wt of this.bezierPath2D)mt.stroke(wt);mt.stroke(t(this,S)),mt.restore()},Vn=function(b,O,K,st,mt,wt,vt){const Z=(O+st)/2,Ct=(K+mt)/2,Tt=(st+wt)/2,Wt=(mt+vt)/2;b.bezierCurveTo(Z+2*(st-Z)/3,Ct+2*(mt-Ct)/3,Tt+2*(st-Tt)/3,Wt+2*(mt-Wt)/3,Tt,Wt)},$n=function(){const b=this.currentPath;if(b.length<=2)return[[b[0],b[0],b.at(-1),b.at(-1)]];const O=[];let K,[st,mt]=b[0];for(K=1;K<b.length-2;K++){const[Ut,Xt]=b[K],[kt,jt]=b[K+1],Vt=(Ut+kt)/2,Kt=(Xt+jt)/2,St=[st+2*(Ut-st)/3,mt+2*(Xt-mt)/3],at=[Vt+2*(Ut-Vt)/3,Kt+2*(Xt-Kt)/3];O.push([[st,mt],St,at,[Vt,Kt]]),[st,mt]=[Vt,Kt]}const[wt,vt]=b[K],[Z,Ct]=b[K+1],Tt=[st+2*(wt-st)/3,mt+2*(vt-mt)/3],Wt=[Z+2*(wt-Z)/3,Ct+2*(vt-Ct)/3];return O.push([[st,mt],Tt,Wt,[Z,Ct]]),O},ie=function(){if(this.isEmpty()){J(this,l,ke).call(this);return}J(this,l,ln).call(this);const{canvas:b,ctx:O}=this;O.setTransform(1,0,0,1,0,0),O.clearRect(0,0,b.width,b.height),J(this,l,ke).call(this);for(const K of this.bezierPath2D)O.stroke(K)},hn=function(b){this.canvas.removeEventListener("pointerleave",t(this,j)),this.canvas.removeEventListener("pointermove",t(this,B)),this.canvas.removeEventListener("pointerup",t(this,A)),this.canvas.addEventListener("pointerdown",t(this,_)),setTimeout(()=>{this.canvas.removeEventListener("contextmenu",G.noContextMenu)},10),J(this,l,Wn).call(this,b.offsetX,b.offsetY),this.addToAnnotationStorage(),this.setInBackground()},Pe=function(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",f.AnnotationEditor._l10nPromise.get("editor_ink_canvas_aria_label").then(b=>{var O;return(O=this.canvas)==null?void 0:O.setAttribute("aria-label",b)}),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")},Re=function(){ot(this,D,new ResizeObserver(b=>{const O=b[0].contentRect;O.width&&O.height&&this.setDimensions(O.width,O.height)})),t(this,D).observe(this.div)},he=function(){if(!t(this,y))return;const[b,O]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*b),this.canvas.height=Math.ceil(this.height*O),J(this,l,ke).call(this)},dn=function(b,O){const K=J(this,l,Fe).call(this),st=(b-K)/t(this,m),mt=(O-K)/t(this,T);this.scaleFactor=Math.min(st,mt)},ke=function(){const b=J(this,l,Fe).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+b,this.translationY*this.scaleFactor+b)},L=new WeakSet,zn=function(b){const O=new Path2D;for(let K=0,st=b.length;K<st;K++){const[mt,wt,vt,Z]=b[K];K===0&&O.moveTo(...mt),O.bezierCurveTo(wt[0],wt[1],vt[0],vt[1],Z[0],Z[1])}return O},un=function(b,O,K){const[st,mt,wt,vt]=O;switch(K){case 0:for(let Z=0,Ct=b.length;Z<Ct;Z+=2)b[Z]+=st,b[Z+1]=vt-b[Z+1];break;case 90:for(let Z=0,Ct=b.length;Z<Ct;Z+=2){const Tt=b[Z];b[Z]=b[Z+1]+st,b[Z+1]=Tt+mt}break;case 180:for(let Z=0,Ct=b.length;Z<Ct;Z+=2)b[Z]=wt-b[Z],b[Z+1]+=mt;break;case 270:for(let Z=0,Ct=b.length;Z<Ct;Z+=2){const Tt=b[Z];b[Z]=wt-b[Z+1],b[Z+1]=vt-Tt}break;default:throw new Error("Invalid rotation")}return b},Xn=function(b,O,K){const[st,mt,wt,vt]=O;switch(K){case 0:for(let Z=0,Ct=b.length;Z<Ct;Z+=2)b[Z]-=st,b[Z+1]=vt-b[Z+1];break;case 90:for(let Z=0,Ct=b.length;Z<Ct;Z+=2){const Tt=b[Z];b[Z]=b[Z+1]-mt,b[Z+1]=Tt-st}break;case 180:for(let Z=0,Ct=b.length;Z<Ct;Z+=2)b[Z]=wt-b[Z],b[Z+1]-=mt;break;case 270:for(let Z=0,Ct=b.length;Z<Ct;Z+=2){const Tt=b[Z];b[Z]=vt-b[Z+1],b[Z+1]=wt-Tt}break;default:throw new Error("Invalid rotation")}return b},qn=function(b,O,K,st){var Ct,Tt;const mt=[],wt=this.thickness/2,vt=b*O+wt,Z=b*K+wt;for(const Wt of this.paths){const Ut=[],Xt=[];for(let kt=0,jt=Wt.length;kt<jt;kt++){const[Vt,Kt,St,at]=Wt[kt],ct=b*Vt[0]+vt,Mt=b*Vt[1]+Z,qt=b*Kt[0]+vt,zt=b*Kt[1]+Z,U=b*St[0]+vt,_t=b*St[1]+Z,Pt=b*at[0]+vt,It=b*at[1]+Z;kt===0&&(Ut.push(ct,Mt),Xt.push(ct,Mt)),Ut.push(qt,zt,U,_t,Pt,It),Xt.push(qt,zt),kt===jt-1&&Xt.push(Pt,It)}mt.push({bezier:J(Ct=yt,L,un).call(Ct,Ut,st,this.rotation),points:J(Tt=yt,L,un).call(Tt,Xt,st,this.rotation)})}return mt},fn=function(){let b=1/0,O=-1/0,K=1/0,st=-1/0;for(const mt of this.paths)for(const[wt,vt,Z,Ct]of mt){const Tt=n.Util.bezierBoundingBox(...wt,...vt,...Z,...Ct);b=Math.min(b,Tt[0]),K=Math.min(K,Tt[1]),O=Math.max(O,Tt[2]),st=Math.max(st,Tt[3])}return[b,K,O,st]},Fe=function(){return t(this,g)?Math.ceil(this.thickness*this.parentScale):0},de=function(b=!1){if(this.isEmpty())return;if(!t(this,g)){J(this,l,ie).call(this);return}const O=J(this,l,fn).call(this),K=J(this,l,Fe).call(this);ot(this,m,Math.max(f.AnnotationEditor.MIN_SIZE,O[2]-O[0])),ot(this,T,Math.max(f.AnnotationEditor.MIN_SIZE,O[3]-O[1]));const st=Math.ceil(K+t(this,m)*this.scaleFactor),mt=Math.ceil(K+t(this,T)*this.scaleFactor),[wt,vt]=this.parentDimensions;this.width=st/wt,this.height=mt/vt,this.setAspectRatio(st,mt);const Z=this.translationX,Ct=this.translationY;this.translationX=-O[0],this.translationY=-O[1],J(this,l,he).call(this),J(this,l,ie).call(this),ot(this,v,st),ot(this,o,mt),this.setDims(st,mt);const Tt=b?K/this.scaleFactor/2:0;this.translate(Z-this.translationX-Tt,Ct-this.translationY-Tt)},rt(yt,L),Qt(yt,"_defaultColor",null),Qt(yt,"_defaultOpacity",1),Qt(yt,"_defaultThickness",1),Qt(yt,"_type","ink");let R=yt;e.InkEditor=R},(M,e,H)=>{var R,T,m,B,j,A,_,S,g,u,y,_e,Ae,Me,pn,Yn,Kn,gn,De,Jn;Object.defineProperty(e,"__esModule",{value:!0}),e.StampEditor=void 0;var n=H(1),f=H(4),X=H(6),G=H(29);const E=class E extends f.AnnotationEditor{constructor(V){super({...V,name:"stampEditor"});rt(this,y);rt(this,R,null);rt(this,T,null);rt(this,m,null);rt(this,B,null);rt(this,j,null);rt(this,A,null);rt(this,_,null);rt(this,S,null);rt(this,g,!1);rt(this,u,!1);ot(this,B,V.bitmapUrl),ot(this,j,V.bitmapFile)}static initialize(V){f.AnnotationEditor.initialize(V)}static get supportedTypes(){const V=["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"];return(0,n.shadow)(this,"supportedTypes",V.map(Q=>`image/${Q}`))}static get supportedTypesStr(){return(0,n.shadow)(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(V){return this.supportedTypes.includes(V)}static paste(V,Q){Q.pasteEditor(n.AnnotationEditorType.STAMP,{bitmapFile:V.getAsFile()})}remove(){var V,Q;t(this,T)&&(ot(this,R,null),this._uiManager.imageManager.deleteId(t(this,T)),(V=t(this,A))==null||V.remove(),ot(this,A,null),(Q=t(this,_))==null||Q.disconnect(),ot(this,_,null)),super.remove()}rebuild(){if(!this.parent){t(this,T)&&J(this,y,Me).call(this);return}super.rebuild(),this.div!==null&&(t(this,T)&&J(this,y,Me).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(t(this,m)||t(this,R)||t(this,B)||t(this,j))}get isResizable(){return!0}render(){if(this.div)return this.div;let V,Q;if(this.width&&(V=this.x,Q=this.y),super.render(),this.div.hidden=!0,t(this,R)?J(this,y,pn).call(this):J(this,y,Me).call(this),this.width){const[W,lt]=this.parentDimensions;this.setAt(V*W,Q*lt,this.width*W,this.height*lt)}return this.div}static deserialize(V,Q,W){if(V instanceof G.StampAnnotationElement)return null;const lt=super.deserialize(V,Q,W),{rect:C,bitmapUrl:$,bitmapId:it,isSvg:w,accessibilityData:i}=V;it&&W.imageManager.isValidId(it)?ot(lt,T,it):ot(lt,B,$),ot(lt,g,w);const[s,p]=lt.pageDimensions;return lt.width=(C[2]-C[0])/s,lt.height=(C[3]-C[1])/p,i&&(lt.altTextData=i),lt}serialize(V=!1,Q=null){if(this.isEmpty())return null;const W={annotationType:n.AnnotationEditorType.STAMP,bitmapId:t(this,T),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:t(this,g),structTreeParentId:this._structTreeParentId};if(V)return W.bitmapUrl=J(this,y,De).call(this,!0),W.accessibilityData=this.altTextData,W;const{decorative:lt,altText:C}=this.altTextData;if(!lt&&C&&(W.accessibilityData={type:"Figure",alt:C}),Q===null)return W;Q.stamps||(Q.stamps=new Map);const $=t(this,g)?(W.rect[2]-W.rect[0])*(W.rect[3]-W.rect[1]):null;if(!Q.stamps.has(t(this,T)))Q.stamps.set(t(this,T),{area:$,serialized:W}),W.bitmap=J(this,y,De).call(this,!1);else if(t(this,g)){const it=Q.stamps.get(t(this,T));$>it.area&&(it.area=$,it.serialized.bitmap.close(),it.serialized.bitmap=J(this,y,De).call(this,!1))}return W}};R=new WeakMap,T=new WeakMap,m=new WeakMap,B=new WeakMap,j=new WeakMap,A=new WeakMap,_=new WeakMap,S=new WeakMap,g=new WeakMap,u=new WeakMap,y=new WeakSet,_e=function(V,Q=!1){if(!V){this.remove();return}ot(this,R,V.bitmap),Q||(ot(this,T,V.id),ot(this,g,V.isSvg)),J(this,y,pn).call(this)},Ae=function(){ot(this,m,null),this._uiManager.enableWaiting(!1),t(this,A)&&this.div.focus()},Me=function(){if(t(this,T)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(t(this,T)).then(Q=>J(this,y,_e).call(this,Q,!0)).finally(()=>J(this,y,Ae).call(this));return}if(t(this,B)){const Q=t(this,B);ot(this,B,null),this._uiManager.enableWaiting(!0),ot(this,m,this._uiManager.imageManager.getFromUrl(Q).then(W=>J(this,y,_e).call(this,W)).finally(()=>J(this,y,Ae).call(this)));return}if(t(this,j)){const Q=t(this,j);ot(this,j,null),this._uiManager.enableWaiting(!0),ot(this,m,this._uiManager.imageManager.getFromFile(Q).then(W=>J(this,y,_e).call(this,W)).finally(()=>J(this,y,Ae).call(this)));return}const V=document.createElement("input");V.type="file",V.accept=E.supportedTypesStr,ot(this,m,new Promise(Q=>{V.addEventListener("change",async()=>{if(!V.files||V.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);const W=await this._uiManager.imageManager.getFromFile(V.files[0]);J(this,y,_e).call(this,W)}Q()}),V.addEventListener("cancel",()=>{this.remove(),Q()})}).finally(()=>J(this,y,Ae).call(this))),V.click()},pn=function(){const{div:V}=this;let{width:Q,height:W}=t(this,R);const[lt,C]=this.pageDimensions,$=.75;if(this.width)Q=this.width*lt,W=this.height*C;else if(Q>$*lt||W>$*C){const s=Math.min($*lt/Q,$*C/W);Q*=s,W*=s}const[it,w]=this.parentDimensions;this.setDims(Q*it/lt,W*w/C),this._uiManager.enableWaiting(!1);const i=ot(this,A,document.createElement("canvas"));V.append(i),V.hidden=!1,J(this,y,gn).call(this,Q,W),J(this,y,Jn).call(this),t(this,u)||(this.parent.addUndoableEditor(this),ot(this,u,!0)),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",subtype:this.editorType,data:{action:"inserted_image"}}}),this.addAltTextButton()},Yn=function(V,Q){var $;const[W,lt]=this.parentDimensions;this.width=V/W,this.height=Q/lt,this.setDims(V,Q),($=this._initialOptions)!=null&&$.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,t(this,S)!==null&&clearTimeout(t(this,S)),ot(this,S,setTimeout(()=>{ot(this,S,null),J(this,y,gn).call(this,V,Q)},200))},Kn=function(V,Q){const{width:W,height:lt}=t(this,R);let C=W,$=lt,it=t(this,R);for(;C>2*V||$>2*Q;){const w=C,i=$;C>2*V&&(C=C>=16384?Math.floor(C/2)-1:Math.ceil(C/2)),$>2*Q&&($=$>=16384?Math.floor($/2)-1:Math.ceil($/2));const s=new OffscreenCanvas(C,$);s.getContext("2d").drawImage(it,0,0,w,i,0,0,C,$),it=s.transferToImageBitmap()}return it},gn=function(V,Q){V=Math.ceil(V),Q=Math.ceil(Q);const W=t(this,A);if(!W||W.width===V&&W.height===Q)return;W.width=V,W.height=Q;const lt=t(this,g)?t(this,R):J(this,y,Kn).call(this,V,Q),C=W.getContext("2d");C.filter=this._uiManager.hcmFilter,C.drawImage(lt,0,0,lt.width,lt.height,0,0,V,Q)},De=function(V){if(V){if(t(this,g)){const lt=this._uiManager.imageManager.getSvgUrl(t(this,T));if(lt)return lt}const Q=document.createElement("canvas");return{width:Q.width,height:Q.height}=t(this,R),Q.getContext("2d").drawImage(t(this,R),0,0),Q.toDataURL()}if(t(this,g)){const[Q,W]=this.pageDimensions,lt=Math.round(this.width*Q*X.PixelsPerInch.PDF_TO_CSS_UNITS),C=Math.round(this.height*W*X.PixelsPerInch.PDF_TO_CSS_UNITS),$=new OffscreenCanvas(lt,C);return $.getContext("2d").drawImage(t(this,R),0,0,t(this,R).width,t(this,R).height,0,0,lt,C),$.transferToImageBitmap()}return structuredClone(t(this,R))},Jn=function(){ot(this,_,new ResizeObserver(V=>{const Q=V[0].contentRect;Q.width&&Q.height&&J(this,y,Yn).call(this,Q.width,Q.height)})),t(this,_).observe(this.div)},Qt(E,"_type","stamp");let ut=E;e.StampEditor=ut}],__webpack_module_cache__={};function __w_pdfjs_require__(M){var e=__webpack_module_cache__[M];if(e!==void 0)return e.exports;var H=__webpack_module_cache__[M]={exports:{}};return __webpack_modules__[M](H,H.exports,__w_pdfjs_require__),H.exports}var __webpack_exports__={};return(()=>{var M=__webpack_exports__;Object.defineProperty(M,"__esModule",{value:!0}),Object.defineProperty(M,"AbortException",{enumerable:!0,get:function(){return e.AbortException}}),Object.defineProperty(M,"AnnotationEditorLayer",{enumerable:!0,get:function(){return X.AnnotationEditorLayer}}),Object.defineProperty(M,"AnnotationEditorParamsType",{enumerable:!0,get:function(){return e.AnnotationEditorParamsType}}),Object.defineProperty(M,"AnnotationEditorType",{enumerable:!0,get:function(){return e.AnnotationEditorType}}),Object.defineProperty(M,"AnnotationEditorUIManager",{enumerable:!0,get:function(){return G.AnnotationEditorUIManager}}),Object.defineProperty(M,"AnnotationLayer",{enumerable:!0,get:function(){return ut.AnnotationLayer}}),Object.defineProperty(M,"AnnotationMode",{enumerable:!0,get:function(){return e.AnnotationMode}}),Object.defineProperty(M,"CMapCompressionType",{enumerable:!0,get:function(){return e.CMapCompressionType}}),Object.defineProperty(M,"DOMSVGFactory",{enumerable:!0,get:function(){return n.DOMSVGFactory}}),Object.defineProperty(M,"FeatureTest",{enumerable:!0,get:function(){return e.FeatureTest}}),Object.defineProperty(M,"GlobalWorkerOptions",{enumerable:!0,get:function(){return R.GlobalWorkerOptions}}),Object.defineProperty(M,"ImageKind",{enumerable:!0,get:function(){return e.ImageKind}}),Object.defineProperty(M,"InvalidPDFException",{enumerable:!0,get:function(){return e.InvalidPDFException}}),Object.defineProperty(M,"MissingPDFException",{enumerable:!0,get:function(){return e.MissingPDFException}}),Object.defineProperty(M,"OPS",{enumerable:!0,get:function(){return e.OPS}}),Object.defineProperty(M,"PDFDataRangeTransport",{enumerable:!0,get:function(){return H.PDFDataRangeTransport}}),Object.defineProperty(M,"PDFDateString",{enumerable:!0,get:function(){return n.PDFDateString}}),Object.defineProperty(M,"PDFWorker",{enumerable:!0,get:function(){return H.PDFWorker}}),Object.defineProperty(M,"PasswordResponses",{enumerable:!0,get:function(){return e.PasswordResponses}}),Object.defineProperty(M,"PermissionFlag",{enumerable:!0,get:function(){return e.PermissionFlag}}),Object.defineProperty(M,"PixelsPerInch",{enumerable:!0,get:function(){return n.PixelsPerInch}}),Object.defineProperty(M,"PromiseCapability",{enumerable:!0,get:function(){return e.PromiseCapability}}),Object.defineProperty(M,"RenderingCancelledException",{enumerable:!0,get:function(){return n.RenderingCancelledException}}),Object.defineProperty(M,"SVGGraphics",{enumerable:!0,get:function(){return H.SVGGraphics}}),Object.defineProperty(M,"UnexpectedResponseException",{enumerable:!0,get:function(){return e.UnexpectedResponseException}}),Object.defineProperty(M,"Util",{enumerable:!0,get:function(){return e.Util}}),Object.defineProperty(M,"VerbosityLevel",{enumerable:!0,get:function(){return e.VerbosityLevel}}),Object.defineProperty(M,"XfaLayer",{enumerable:!0,get:function(){return T.XfaLayer}}),Object.defineProperty(M,"build",{enumerable:!0,get:function(){return H.build}}),Object.defineProperty(M,"createValidAbsoluteUrl",{enumerable:!0,get:function(){return e.createValidAbsoluteUrl}}),Object.defineProperty(M,"getDocument",{enumerable:!0,get:function(){return H.getDocument}}),Object.defineProperty(M,"getFilenameFromUrl",{enumerable:!0,get:function(){return n.getFilenameFromUrl}}),Object.defineProperty(M,"getPdfFilenameFromUrl",{enumerable:!0,get:function(){return n.getPdfFilenameFromUrl}}),Object.defineProperty(M,"getXfaPageViewport",{enumerable:!0,get:function(){return n.getXfaPageViewport}}),Object.defineProperty(M,"isDataScheme",{enumerable:!0,get:function(){return n.isDataScheme}}),Object.defineProperty(M,"isPdfFile",{enumerable:!0,get:function(){return n.isPdfFile}}),Object.defineProperty(M,"loadScript",{enumerable:!0,get:function(){return n.loadScript}}),Object.defineProperty(M,"noContextMenu",{enumerable:!0,get:function(){return n.noContextMenu}}),Object.defineProperty(M,"normalizeUnicode",{enumerable:!0,get:function(){return e.normalizeUnicode}}),Object.defineProperty(M,"renderTextLayer",{enumerable:!0,get:function(){return f.renderTextLayer}}),Object.defineProperty(M,"setLayerDimensions",{enumerable:!0,get:function(){return n.setLayerDimensions}}),Object.defineProperty(M,"shadow",{enumerable:!0,get:function(){return e.shadow}}),Object.defineProperty(M,"updateTextLayer",{enumerable:!0,get:function(){return f.updateTextLayer}}),Object.defineProperty(M,"version",{enumerable:!0,get:function(){return H.version}});var e=__w_pdfjs_require__(1),H=__w_pdfjs_require__(2),n=__w_pdfjs_require__(6),f=__w_pdfjs_require__(26),X=__w_pdfjs_require__(27),G=__w_pdfjs_require__(5),ut=__w_pdfjs_require__(29),R=__w_pdfjs_require__(14),T=__w_pdfjs_require__(32)})(),__webpack_exports__})())})(pdf$1);var pdfExports=pdf$1.exports;const pdf=getDefaultExportFromCjs(pdfExports),pdfjsModule=_mergeNamespaces({__proto__:null,default:pdf},[pdfExports]),pdfjs="default"in pdfjsModule?pdf:pdfjsModule;var __spreadArray=function(M,e,H){if(H||arguments.length===2)for(var n=0,f=e.length,X;n<f;n++)(X||!(n in e))&&(X||(X=Array.prototype.slice.call(e,0,n)),X[n]=e[n]);return M.concat(X||Array.prototype.slice.call(e))},clipboardEvents=["onCopy","onCut","onPaste"],compositionEvents=["onCompositionEnd","onCompositionStart","onCompositionUpdate"],focusEvents=["onFocus","onBlur"],formEvents=["onInput","onInvalid","onReset","onSubmit"],imageEvents=["onLoad","onError"],keyboardEvents=["onKeyDown","onKeyPress","onKeyUp"],mediaEvents=["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],mouseEvents=["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],dragEvents=["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],selectionEvents=["onSelect"],touchEvents=["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],pointerEvents=["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],uiEvents=["onScroll"],wheelEvents=["onWheel"],animationEvents=["onAnimationStart","onAnimationEnd","onAnimationIteration"],transitionEvents=["onTransitionEnd"],otherEvents=["onToggle"],changeEvents=["onChange"],allEvents=__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([],clipboardEvents,!0),compositionEvents,!0),focusEvents,!0),formEvents,!0),imageEvents,!0),keyboardEvents,!0),mediaEvents,!0),mouseEvents,!0),dragEvents,!0),selectionEvents,!0),touchEvents,!0),pointerEvents,!0),uiEvents,!0),wheelEvents,!0),animationEvents,!0),transitionEvents,!0),changeEvents,!0),otherEvents,!0);function makeEventProps(M,e){var H={};return allEvents.forEach(function(n){var f=M[n];f&&(e?H[n]=function(X){return f(X,e(n))}:H[n]=f)}),H}function makeCancellablePromise(M){var e=!1,H=new Promise(function(n,f){M.then(function(X){return!e&&n(X)}).catch(function(X){return!e&&f(X)})});return{promise:H,cancel:function(){e=!0}}}function r(M){var e,H,n="";if(typeof M=="string"||typeof M=="number")n+=M;else if(typeof M=="object")if(Array.isArray(M)){var f=M.length;for(e=0;e<f;e++)M[e]&&(H=r(M[e]))&&(n&&(n+=" "),n+=H)}else for(H in M)M[H]&&(n&&(n+=" "),n+=H);return n}function clsx(){for(var M,e,H=0,n="",f=arguments.length;H<f;H++)(M=arguments[H])&&(e=r(M))&&(n&&(n+=" "),n+=e);return n}var prefix="Invariant failed";function invariant(M,e){if(!M)throw new Error(prefix)}var warning=function(){},warning_1=warning;const warning$1=getDefaultExportFromCjs(warning_1);var has=Object.prototype.hasOwnProperty;function find(M,e,H){for(H of M.keys())if(dequal(H,e))return H}function dequal(M,e){var H,n,f;if(M===e)return!0;if(M&&e&&(H=M.constructor)===e.constructor){if(H===Date)return M.getTime()===e.getTime();if(H===RegExp)return M.toString()===e.toString();if(H===Array){if((n=M.length)===e.length)for(;n--&&dequal(M[n],e[n]););return n===-1}if(H===Set){if(M.size!==e.size)return!1;for(n of M)if(f=n,f&&typeof f=="object"&&(f=find(e,f),!f)||!e.has(f))return!1;return!0}if(H===Map){if(M.size!==e.size)return!1;for(n of M)if(f=n[0],f&&typeof f=="object"&&(f=find(e,f),!f)||!dequal(n[1],e.get(f)))return!1;return!0}if(H===ArrayBuffer)M=new Uint8Array(M),e=new Uint8Array(e);else if(H===DataView){if((n=M.byteLength)===e.byteLength)for(;n--&&M.getInt8(n)===e.getInt8(n););return n===-1}if(ArrayBuffer.isView(M)){if((n=M.byteLength)===e.byteLength)for(;n--&&M[n]===e[n];);return n===-1}if(!H||typeof M=="object"){n=0;for(H in M)if(has.call(M,H)&&++n&&!has.call(e,H)||!(H in e)||!dequal(M[H],e[H]))return!1;return Object.keys(e).length===n}}return M!==M&&e!==e}const DocumentContext=reactExports.createContext(null);function Message({children:M,type:e}){return jsxRuntimeExports.jsx("div",{className:`react-pdf__message react-pdf__message--${e}`,children:M})}const DEFAULT_LINK_REL="noopener noreferrer nofollow";class LinkService{constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}setDocument(e){this.pdfDocument=e}setViewer(e){this.pdfViewer=e}setExternalLinkRel(e){this.externalLinkRel=e}setExternalLinkTarget(e){this.externalLinkTarget=e}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return invariant(this.pdfViewer),this.pdfViewer.currentPageNumber||0}set page(e){invariant(this.pdfViewer),this.pdfViewer.currentPageNumber=e}get rotation(){return 0}set rotation(e){}goToDestination(e){return new Promise(H=>{invariant(this.pdfDocument),invariant(e),typeof e=="string"?this.pdfDocument.getDestination(e).then(H):Array.isArray(e)?H(e):e.then(H)}).then(H=>{invariant(Array.isArray(H));const n=H[0];new Promise(f=>{invariant(this.pdfDocument),n instanceof Object?this.pdfDocument.getPageIndex(n).then(X=>{f(X)}).catch(()=>{invariant(!1)}):typeof n=="number"?f(n):invariant(!1)}).then(f=>{const X=f+1;invariant(this.pdfViewer),invariant(X>=1&&X<=this.pagesCount),this.pdfViewer.scrollPageIntoView({dest:H,pageIndex:f,pageNumber:X})})})}navigateTo(e){this.goToDestination(e)}goToPage(e){const H=e-1;invariant(this.pdfViewer),invariant(e>=1&&e<=this.pagesCount),this.pdfViewer.scrollPageIntoView({pageIndex:H,pageNumber:e})}addLinkAttributes(e,H,n){e.href=H,e.rel=this.externalLinkRel||DEFAULT_LINK_REL,e.target=n?"_blank":this.externalLinkTarget||""}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}setHash(){}executeNamedAction(){}cachePageRef(){}isPageVisible(){return!0}isPageCached(){return!0}executeSetOCGState(){}}const PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},isBrowser=typeof document<"u",isLocalFileSystem=isBrowser&&window.location.protocol==="file:";function isDefined(M){return typeof M<"u"}function isProvided(M){return isDefined(M)&&M!==null}function isString(M){return typeof M=="string"}function isArrayBuffer(M){return M instanceof ArrayBuffer}function isBlob(M){return invariant(isBrowser),M instanceof Blob}function isDataURI(M){return isString(M)&&/^data:/.test(M)}function dataURItoByteString(M){invariant(isDataURI(M));const[e="",H=""]=M.split(",");return e.split(";").indexOf("base64")!==-1?atob(H):unescape(H)}function getDevicePixelRatio(){return isBrowser&&window.devicePixelRatio||1}const allowFileAccessFromFilesTip="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function displayCORSWarning(){warning$1(!isLocalFileSystem,`Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ${allowFileAccessFromFilesTip}`)}function displayWorkerWarning(){warning$1(!isLocalFileSystem,`Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ${allowFileAccessFromFilesTip}`)}function cancelRunningTask(M){M&&M.cancel&&M.cancel()}function makePageCallback(M,e){return Object.defineProperty(M,"width",{get(){return this.view[2]*e},configurable:!0}),Object.defineProperty(M,"height",{get(){return this.view[3]*e},configurable:!0}),Object.defineProperty(M,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(M,"originalHeight",{get(){return this.view[3]},configurable:!0}),M}function isCancelException(M){return M.name==="RenderingCancelledException"}function loadFromFile(M){return new Promise((e,H)=>{const n=new FileReader;n.onload=()=>{if(!n.result)return H(new Error("Error while reading a file."));e(n.result)},n.onerror=f=>{if(!f.target)return H(new Error("Error while reading a file."));const{error:X}=f.target;if(!X)return H(new Error("Error while reading a file."));switch(X.code){case X.NOT_FOUND_ERR:return H(new Error("Error while reading a file: File not found."));case X.SECURITY_ERR:return H(new Error("Error while reading a file: Security error."));case X.ABORT_ERR:return H(new Error("Error while reading a file: Aborted."));default:return H(new Error("Error while reading a file."))}},n.readAsArrayBuffer(M)})}function reducer(M,e){switch(e.type){case"RESOLVE":return{value:e.value,error:void 0};case"REJECT":return{value:!1,error:e.error};case"RESET":return{value:void 0,error:void 0};default:return M}}function useResolver(){return reactExports.useReducer(reducer,{value:void 0,error:void 0})}var __awaiter=function(M,e,H,n){function f(X){return X instanceof H?X:new H(function(G){G(X)})}return new(H||(H=Promise))(function(X,G){function ut(m){try{T(n.next(m))}catch(B){G(B)}}function R(m){try{T(n.throw(m))}catch(B){G(B)}}function T(m){m.done?X(m.value):f(m.value).then(ut,R)}T((n=n.apply(M,e||[])).next())})},__rest$1=function(M,e){var H={};for(var n in M)Object.prototype.hasOwnProperty.call(M,n)&&e.indexOf(n)<0&&(H[n]=M[n]);if(M!=null&&typeof Object.getOwnPropertySymbols=="function")for(var f=0,n=Object.getOwnPropertySymbols(M);f<n.length;f++)e.indexOf(n[f])<0&&Object.prototype.propertyIsEnumerable.call(M,n[f])&&(H[n[f]]=M[n[f]]);return H};const{PDFDataRangeTransport}=pdfjs,defaultOnPassword=(M,e)=>{switch(e){case PasswordResponses.NEED_PASSWORD:{const H=prompt("Enter the password to open this PDF file.");M(H);break}case PasswordResponses.INCORRECT_PASSWORD:{const H=prompt("Invalid password. Please try again.");M(H);break}}};function isParameterObject(M){return typeof M=="object"&&M!==null&&("data"in M||"range"in M||"url"in M)}const Document=reactExports.forwardRef(function M(e,H){var{children:n,className:f,error:X="Failed to load PDF file.",externalLinkRel:G,externalLinkTarget:ut,file:R,inputRef:T,imageResourcesPath:m,loading:B="Loading PDF…",noData:j="No PDF file specified.",onItemClick:A,onLoadError:_,onLoadProgress:S,onLoadSuccess:g,onPassword:u=defaultOnPassword,onSourceError:y,onSourceSuccess:D,options:v,renderMode:o,rotate:d}=e,l=__rest$1(e,["children","className","error","externalLinkRel","externalLinkTarget","file","inputRef","imageResourcesPath","loading","noData","onItemClick","onLoadError","onLoadProgress","onLoadSuccess","onPassword","onSourceError","onSourceSuccess","options","renderMode","rotate"]);const[c,h]=useResolver(),{value:N,error:a}=c,[E,P]=useResolver(),{value:et,error:V}=E,Q=reactExports.useRef(new LinkService),W=reactExports.useRef([]),lt=reactExports.useRef(void 0),C=reactExports.useRef(void 0);R&&R!==lt.current&&isParameterObject(R)&&(warning$1(!dequal(R,lt.current),`File prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.`),lt.current=R),v&&v!==C.current&&(warning$1(!dequal(v,C.current),`Options prop passed to <Document /> changed, but it's equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.`),C.current=v);const $=reactExports.useRef({scrollPageIntoView:Y=>{const{dest:nt,pageNumber:b,pageIndex:O=b-1}=Y;if(A){A({dest:nt,pageIndex:O,pageNumber:b});return}const K=W.current[O];if(K){K.scrollIntoView();return}warning$1(!1,`An internal link leading to page ${b} was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document> and handle navigating by yourself or ensure that all pages are rendered within <Document>.`)}});reactExports.useImperativeHandle(H,()=>({linkService:Q,pages:W,viewer:$}),[]);function it(){D&&D()}function w(){a&&(warning$1(!1,a.toString()),y&&y(a))}function i(){h({type:"RESET"})}reactExports.useEffect(i,[R,h]);const s=reactExports.useCallback(()=>__awaiter(this,void 0,void 0,function*(){if(!R)return null;if(typeof R=="string")return isDataURI(R)?{data:dataURItoByteString(R)}:(displayCORSWarning(),{url:R});if(R instanceof PDFDataRangeTransport)return{range:R};if(isArrayBuffer(R))return{data:R};if(isBrowser&&isBlob(R))return{data:yield loadFromFile(R)};if(invariant(typeof R=="object"),invariant(isParameterObject(R)),"url"in R&&typeof R.url=="string"){if(isDataURI(R.url)){const{url:Y}=R,nt=__rest$1(R,["url"]),b=dataURItoByteString(Y);return Object.assign({data:b},nt)}displayCORSWarning()}return R}),[R]);reactExports.useEffect(()=>{const Y=makeCancellablePromise(s());return Y.promise.then(nt=>{h({type:"RESOLVE",value:nt})}).catch(nt=>{h({type:"REJECT",error:nt})}),()=>{cancelRunningTask(Y)}},[s,h]),reactExports.useEffect(()=>{if(!(typeof N>"u")){if(N===!1){w();return}it()}},[N]);function p(){et&&(g&&g(et),W.current=new Array(et.numPages),Q.current.setDocument(et))}function F(){V&&(warning$1(!1,V.toString()),_&&_(V))}function L(){P({type:"RESET"})}reactExports.useEffect(L,[P,N]);function I(){if(!N)return;const Y=Object.assign(Object.assign({},v),{isEvalSupported:!1}),nt=Object.assign(Object.assign({},N),Y),b=pdfjs.getDocument(nt);S&&(b.onProgress=S),u&&(b.onPassword=u);const O=b;return O.promise.then(K=>{P({type:"RESOLVE",value:K})}).catch(K=>{O.destroyed||P({type:"REJECT",error:K})}),()=>{O.destroy()}}reactExports.useEffect(I,[v,P,N]),reactExports.useEffect(()=>{if(!(typeof et>"u")){if(et===!1){F();return}p()}},[et]);function q(){Q.current.setViewer($.current),Q.current.setExternalLinkRel(G),Q.current.setExternalLinkTarget(ut)}reactExports.useEffect(q,[G,ut]);function tt(Y,nt){W.current[Y]=nt}function pt(Y){delete W.current[Y]}const gt=reactExports.useMemo(()=>({imageResourcesPath:m,linkService:Q.current,onItemClick:A,pdf:et,registerPage:tt,renderMode:o,rotate:d,unregisterPage:pt}),[m,A,et,o,d]),bt=reactExports.useMemo(()=>makeEventProps(l,()=>et),[l,et]);function At(){return jsxRuntimeExports.jsx(DocumentContext.Provider,{value:gt,children:n})}function yt(){return R?et==null?jsxRuntimeExports.jsx(Message,{type:"loading",children:typeof B=="function"?B():B}):et===!1?jsxRuntimeExports.jsx(Message,{type:"error",children:typeof X=="function"?X():X}):At():jsxRuntimeExports.jsx(Message,{type:"no-data",children:typeof j=="function"?j():j})}return jsxRuntimeExports.jsx("div",Object.assign({className:clsx("react-pdf__Document",f),ref:T,style:{"--scale-factor":"1"}},bt,{children:yt()}))});function useDocumentContext(){return reactExports.useContext(DocumentContext)}function mergeRefs(){for(var M=[],e=0;e<arguments.length;e++)M[e]=arguments[e];var H=M.filter(Boolean);if(H.length<=1){var n=H[0];return n||null}return function(X){H.forEach(function(G){typeof G=="function"?G(X):G&&(G.current=X)})}}const PageContext=reactExports.createContext(null),PDF_ROLE_TO_HTML_ROLE={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},HEADING_PATTERN=/^H(\d+)$/;function isPdfRole(M){return M in PDF_ROLE_TO_HTML_ROLE}function isStructTreeNode(M){return"children"in M}function isStructTreeNodeWithOnlyContentChild(M){return isStructTreeNode(M)?M.children.length===1&&0 in M.children&&"id"in M.children[0]:!1}function getRoleAttributes(M){const e={};if(isStructTreeNode(M)){const{role:H}=M,n=H.match(HEADING_PATTERN);if(n)e.role="heading",e["aria-level"]=Number(n[1]);else if(isPdfRole(H)){const f=PDF_ROLE_TO_HTML_ROLE[H];f&&(e.role=f)}}return e}function getBaseAttributes(M){const e={};if(isStructTreeNode(M)){if(M.alt!==void 0&&(e["aria-label"]=M.alt),M.lang!==void 0&&(e.lang=M.lang),isStructTreeNodeWithOnlyContentChild(M)){const[H]=M.children;if(H){const n=getBaseAttributes(H);return Object.assign(Object.assign({},e),n)}}}else"id"in M&&(e["aria-owns"]=M.id);return e}function getAttributes(M){return M?Object.assign(Object.assign({},getRoleAttributes(M)),getBaseAttributes(M)):null}function StructTreeItem({className:M,node:e}){const H=reactExports.useMemo(()=>getAttributes(e),[e]),n=reactExports.useMemo(()=>!isStructTreeNode(e)||isStructTreeNodeWithOnlyContentChild(e)?null:e.children.map((f,X)=>jsxRuntimeExports.jsx(StructTreeItem,{node:f},X)),[e]);return jsxRuntimeExports.jsx("span",Object.assign({className:M},H,{children:n}))}function usePageContext(){return reactExports.useContext(PageContext)}function StructTree(){const M=usePageContext();invariant(M);const{onGetStructTreeError:e,onGetStructTreeSuccess:H}=M,[n,f]=useResolver(),{value:X,error:G}=n,{customTextRenderer:ut,page:R}=M;function T(){X&&H&&H(X)}function m(){G&&(warning$1(!1,G.toString()),e&&e(G))}function B(){f({type:"RESET"})}reactExports.useEffect(B,[f,R]);function j(){if(ut||!R)return;const A=makeCancellablePromise(R.getStructTree()),_=A;return A.promise.then(S=>{f({type:"RESOLVE",value:S})}).catch(S=>{f({type:"REJECT",error:S})}),()=>cancelRunningTask(_)}return reactExports.useEffect(j,[ut,R,f]),reactExports.useEffect(()=>{if(X!==void 0){if(X===!1){m();return}T()}},[X]),X?jsxRuntimeExports.jsx(StructTreeItem,{className:"react-pdf__Page__structTree structTree",node:X}):null}const ANNOTATION_MODE=pdfjs.AnnotationMode;function PageCanvas(M){const e=usePageContext();invariant(e);const H=Object.assign(Object.assign({},e),M),{_className:n,canvasBackground:f,devicePixelRatio:X=getDevicePixelRatio(),onRenderError:G,onRenderSuccess:ut,page:R,renderForms:T,renderTextLayer:m,rotate:B,scale:j}=H,{canvasRef:A}=M;invariant(R);const _=reactExports.useRef(null);function S(){R&&ut&&ut(makePageCallback(R,j))}function g(o){isCancelException(o)||(warning$1(!1,o.toString()),G&&G(o))}const u=reactExports.useMemo(()=>R.getViewport({scale:j*X,rotation:B}),[X,R,B,j]),y=reactExports.useMemo(()=>R.getViewport({scale:j,rotation:B}),[R,B,j]);function D(){if(!R)return;R.cleanup();const{current:o}=_;if(!o)return;o.width=u.width,o.height=u.height,o.style.width=`${Math.floor(y.width)}px`,o.style.height=`${Math.floor(y.height)}px`,o.style.visibility="hidden";const d={annotationMode:T?ANNOTATION_MODE.ENABLE_FORMS:ANNOTATION_MODE.ENABLE,canvasContext:o.getContext("2d",{alpha:!1}),viewport:u};f&&(d.background=f);const l=R.render(d),c=l;return l.promise.then(()=>{o.style.visibility="",S()}).catch(g),()=>cancelRunningTask(c)}reactExports.useEffect(D,[f,_,X,R,T,u,y]);const v=reactExports.useCallback(()=>{const{current:o}=_;o&&(o.width=0,o.height=0)},[_]);return reactExports.useEffect(()=>v,[v]),jsxRuntimeExports.jsx("canvas",{className:`${n}__canvas`,dir:"ltr",ref:mergeRefs(A,_),style:{display:"block",userSelect:"none"},children:m?jsxRuntimeExports.jsx(StructTree,{}):null})}function PageSVG(){const M=usePageContext();invariant(M);const{_className:e,onRenderSuccess:H,onRenderError:n,page:f,rotate:X,scale:G}=M;invariant(f);const[ut,R]=useResolver(),{value:T,error:m}=ut;function B(){f&&H&&H(makePageCallback(f,G))}function j(){m&&(isCancelException(m)||(warning$1(!1,m.toString()),n&&n(m)))}const A=reactExports.useMemo(()=>f.getViewport({scale:G,rotation:X}),[f,X,G]);function _(){R({type:"RESET"})}reactExports.useEffect(_,[f,R,A]);function S(){if(!f)return;const D=makeCancellablePromise(f.getOperatorList());return D.promise.then(v=>{new pdfjs.SVGGraphics(f.commonObjs,f.objs).getSVG(v,A).then(d=>{if(!(d instanceof SVGElement))throw new Error("getSVG returned unexpected result.");R({type:"RESOLVE",value:d})}).catch(d=>{R({type:"REJECT",error:d})})}).catch(v=>{R({type:"REJECT",error:v})}),()=>cancelRunningTask(D)}reactExports.useEffect(S,[f,R,A]),reactExports.useEffect(()=>{if(T!==void 0){if(T===!1){j();return}B()}},[T]);function g(D){if(!D||!T)return;D.firstElementChild||D.appendChild(T);const{width:v,height:o}=A;T.setAttribute("width",`${v}`),T.setAttribute("height",`${o}`)}const{width:u,height:y}=A;return jsxRuntimeExports.jsx("div",{className:`${e}__svg`,ref:D=>g(D),style:{display:"block",backgroundColor:"white",overflow:"hidden",width:u,height:y,userSelect:"none"}})}function isTextItem(M){return"str"in M}function TextLayer(){const M=usePageContext();invariant(M);const{customTextRenderer:e,onGetTextError:H,onGetTextSuccess:n,onRenderTextLayerError:f,onRenderTextLayerSuccess:X,page:G,pageIndex:ut,pageNumber:R,rotate:T,scale:m}=M;invariant(G);const[B,j]=useResolver(),{value:A,error:_}=B,S=reactExports.useRef(null),g=reactExports.useRef(void 0);warning$1(parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10)===1,"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer");function u(){A&&n&&n(A)}function y(){_&&(warning$1(!1,_.toString()),H&&H(_))}function D(){j({type:"RESET"})}reactExports.useEffect(D,[G,j]);function v(){if(!G)return;const a=makeCancellablePromise(G.getTextContent()),E=a;return a.promise.then(P=>{j({type:"RESOLVE",value:P})}).catch(P=>{j({type:"REJECT",error:P})}),()=>cancelRunningTask(E)}reactExports.useEffect(v,[G,j]),reactExports.useEffect(()=>{if(A!==void 0){if(A===!1){y();return}u()}},[A]);const o=reactExports.useCallback(()=>{X&&X()},[X]),d=reactExports.useCallback(a=>{warning$1(!1,a.toString()),f&&f(a)},[f]);function l(){const a=g.current;a&&a.classList.add("active")}function c(){const a=g.current;a&&a.classList.remove("active")}const h=reactExports.useMemo(()=>G.getViewport({scale:m,rotation:T}),[G,T,m]);function N(){if(!G||!A)return;const{current:a}=S;if(!a)return;a.innerHTML="";const E=G.streamTextContent({includeMarkedContent:!0}),P={container:a,textContentSource:E,viewport:h},et=pdfjs.renderTextLayer(P),V=et;return et.promise.then(()=>{const Q=document.createElement("div");Q.className="endOfContent",a.append(Q),g.current=Q;const W=a.querySelectorAll('[role="presentation"]');if(e){let lt=0;A.items.forEach((C,$)=>{if(!isTextItem(C))return;const it=W[lt];if(!it)return;const w=e(Object.assign({pageIndex:ut,pageNumber:R,itemIndex:$},C));it.innerHTML=w,lt+=C.str&&C.hasEOL?2:1})}o()}).catch(d),()=>cancelRunningTask(V)}return reactExports.useLayoutEffect(N,[e,d,o,G,ut,R,A,h]),jsxRuntimeExports.jsx("div",{className:clsx("react-pdf__Page__textContent","textLayer"),onMouseUp:c,onMouseDown:l,ref:S})}function AnnotationLayer(){const M=useDocumentContext(),e=usePageContext();invariant(e);const H=Object.assign(Object.assign({},M),e),{imageResourcesPath:n,linkService:f,onGetAnnotationsError:X,onGetAnnotationsSuccess:G,onRenderAnnotationLayerError:ut,onRenderAnnotationLayerSuccess:R,page:T,pdf:m,renderForms:B,rotate:j,scale:A=1}=H;invariant(m),invariant(T),invariant(f);const[_,S]=useResolver(),{value:g,error:u}=_,y=reactExports.useRef(null);warning$1(parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10)===1,"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations");function D(){g&&G&&G(g)}function v(){u&&(warning$1(!1,u.toString()),X&&X(u))}function o(){S({type:"RESET"})}reactExports.useEffect(o,[S,T]);function d(){if(!T)return;const a=makeCancellablePromise(T.getAnnotations()),E=a;return a.promise.then(P=>{S({type:"RESOLVE",value:P})}).catch(P=>{S({type:"REJECT",error:P})}),()=>{cancelRunningTask(E)}}reactExports.useEffect(d,[S,T,B]),reactExports.useEffect(()=>{if(g!==void 0){if(g===!1){v();return}D()}},[g]);function l(){R&&R()}function c(a){warning$1(!1,`${a}`),ut&&ut(a)}const h=reactExports.useMemo(()=>T.getViewport({scale:A,rotation:j}),[T,j,A]);function N(){if(!m||!T||!f||!g)return;const{current:a}=y;if(!a)return;const E=h.clone({dontFlip:!0}),P={accessibilityManager:null,annotationCanvasMap:null,div:a,l10n:null,page:T,viewport:E},et={annotations:g,annotationStorage:m.annotationStorage,div:a,downloadManager:null,imageResourcesPath:n,linkService:f,page:T,renderForms:B,viewport:E};a.innerHTML="";try{new pdfjs.AnnotationLayer(P).render(et),l()}catch(V){c(V)}return()=>{}}return reactExports.useEffect(N,[g,n,f,T,B,h]),jsxRuntimeExports.jsx("div",{className:clsx("react-pdf__Page__annotations","annotationLayer"),ref:y})}var __rest=function(M,e){var H={};for(var n in M)Object.prototype.hasOwnProperty.call(M,n)&&e.indexOf(n)<0&&(H[n]=M[n]);if(M!=null&&typeof Object.getOwnPropertySymbols=="function")for(var f=0,n=Object.getOwnPropertySymbols(M);f<n.length;f++)e.indexOf(n[f])<0&&Object.prototype.propertyIsEnumerable.call(M,n[f])&&(H[n[f]]=M[n[f]]);return H};const defaultScale=1;function Page(M){const e=useDocumentContext(),H=Object.assign(Object.assign({},e),M),{_className:n="react-pdf__Page",_enableRegisterUnregisterPage:f=!0,canvasBackground:X,canvasRef:G,children:ut,className:R,customRenderer:T,customTextRenderer:m,devicePixelRatio:B,error:j="Failed to load the page.",height:A,inputRef:_,loading:S="Loading page…",noData:g="No page specified.",onGetAnnotationsError:u,onGetAnnotationsSuccess:y,onGetStructTreeError:D,onGetStructTreeSuccess:v,onGetTextError:o,onGetTextSuccess:d,onLoadError:l,onLoadSuccess:c,onRenderAnnotationLayerError:h,onRenderAnnotationLayerSuccess:N,onRenderError:a,onRenderSuccess:E,onRenderTextLayerError:P,onRenderTextLayerSuccess:et,pageIndex:V,pageNumber:Q,pdf:W,registerPage:lt,renderAnnotationLayer:C=!0,renderForms:$=!1,renderMode:it="canvas",renderTextLayer:w=!0,rotate:i,scale:s=defaultScale,unregisterPage:p,width:F}=H,L=__rest(H,["_className","_enableRegisterUnregisterPage","canvasBackground","canvasRef","children","className","customRenderer","customTextRenderer","devicePixelRatio","error","height","inputRef","loading","noData","onGetAnnotationsError","onGetAnnotationsSuccess","onGetStructTreeError","onGetStructTreeSuccess","onGetTextError","onGetTextSuccess","onLoadError","onLoadSuccess","onRenderAnnotationLayerError","onRenderAnnotationLayerSuccess","onRenderError","onRenderSuccess","onRenderTextLayerError","onRenderTextLayerSuccess","pageIndex","pageNumber","pdf","registerPage","renderAnnotationLayer","renderForms","renderMode","renderTextLayer","rotate","scale","unregisterPage","width"]),[I,q]=useResolver(),{value:tt,error:pt}=I,gt=reactExports.useRef(null);invariant(W);const bt=isProvided(Q)?Q-1:V??null,At=Q??(isProvided(V)?V+1:null),yt=i??(tt?tt.rotate:null),Y=reactExports.useMemo(()=>{if(!tt)return null;let kt=1;const jt=s??defaultScale;if(F||A){const Vt=tt.getViewport({scale:1,rotation:yt});F?kt=F/Vt.width:A&&(kt=A/Vt.height)}return jt*kt},[A,tt,yt,s,F]);function nt(){return()=>{isProvided(bt)&&f&&p&&p(bt)}}reactExports.useEffect(nt,[f,W,bt,p]);function b(){if(c){if(!tt||!Y)return;c(makePageCallback(tt,Y))}if(f&<){if(!isProvided(bt)||!gt.current)return;lt(bt,gt.current)}}function O(){pt&&(warning$1(!1,pt.toString()),l&&l(pt))}function K(){q({type:"RESET"})}reactExports.useEffect(K,[q,W,bt]);function st(){if(!W||!At)return;const kt=makeCancellablePromise(W.getPage(At)),jt=kt;return kt.promise.then(Vt=>{q({type:"RESOLVE",value:Vt})}).catch(Vt=>{q({type:"REJECT",error:Vt})}),()=>cancelRunningTask(jt)}reactExports.useEffect(st,[q,W,bt,At,lt]),reactExports.useEffect(()=>{if(tt!==void 0){if(tt===!1){O();return}b()}},[tt,Y]);const mt=reactExports.useMemo(()=>tt&&isProvided(bt)&&At&&isProvided(yt)&&isProvided(Y)?{_className:n,canvasBackground:X,customTextRenderer:m,devicePixelRatio:B,onGetAnnotationsError:u,onGetAnnotationsSuccess:y,onGetStructTreeError:D,onGetStructTreeSuccess:v,onGetTextError:o,onGetTextSuccess:d,onRenderAnnotationLayerError:h,onRenderAnnotationLayerSuccess:N,onRenderError:a,onRenderSuccess:E,onRenderTextLayerError:P,onRenderTextLayerSuccess:et,page:tt,pageIndex:bt,pageNumber:At,renderForms:$,renderTextLayer:w,rotate:yt,scale:Y}:null,[n,X,m,B,u,y,D,v,o,d,h,N,a,E,P,et,tt,bt,At,$,w,yt,Y]),wt=reactExports.useMemo(()=>makeEventProps(L,()=>tt&&(Y?makePageCallback(tt,Y):void 0)),[L,tt,Y]),vt=`${bt}@${Y}/${yt}`,Z=`${bt}/${yt}`;function Ct(){switch(it){case"custom":return invariant(T),jsxRuntimeExports.jsx(T,{},`${vt}_custom`);case"none":return null;case"svg":return jsxRuntimeExports.jsx(PageSVG,{},`${Z}_svg`);case"canvas":default:return jsxRuntimeExports.jsx(PageCanvas,{canvasRef:G},`${vt}_canvas`)}}function Tt(){return w?jsxRuntimeExports.jsx(TextLayer,{},`${vt}_text`):null}function Wt(){return C?jsxRuntimeExports.jsx(AnnotationLayer,{},`${vt}_annotations`):null}function Ut(){return jsxRuntimeExports.jsxs(PageContext.Provider,{value:mt,children:[Ct(),Tt(),Wt(),ut]})}function Xt(){return At?W===null||tt===void 0||tt===null?jsxRuntimeExports.jsx(Message,{type:"loading",children:typeof S=="function"?S():S}):W===!1||tt===!1?jsxRuntimeExports.jsx(Message,{type:"error",children:typeof j=="function"?j():j}):Ut():jsxRuntimeExports.jsx(Message,{type:"no-data",children:typeof g=="function"?g():g})}return jsxRuntimeExports.jsx("div",Object.assign({className:clsx(n,R),"data-page-number":At,ref:mergeRefs(_,gt),style:{"--scale-factor":`${Y}`,backgroundColor:X||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"}},wt,{children:Xt()}))}displayWorkerWarning();pdfjs.GlobalWorkerOptions.workerSrc="pdf.worker.js";pdfjs.GlobalWorkerOptions.workerSrc=`https://unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.js`;function PDFViewer({url:M,className:e}){const[H,n]=reactExports.useState(0),f=reactExports.useCallback(ut=>console.error(ut),[]),X=reactExports.useCallback(({numPages:ut})=>{n(ut)},[]),G=reactExports.useMemo(()=>({url:M,withCredentials:!0}),[M]);return jsxRuntimeExports.jsx(StyledDocument,{file:G,className:e,onLoadSuccess:X,onLoadError:f,onSourceError:f,children:Array.from(new Array(H),(ut,R)=>jsxRuntimeExports.jsx(StyledPage,{pageNumber:R+1},`page_${R+1}`))})}const StyledDocument=dt(Document).withConfig({displayName:"PDFViewer__StyledDocument",componentId:"sc-97b02986-0"})(["display:flex;flex-direction:column;gap:1rem;width:100%;overflow-x:auto;overflow-y:visible;padding-bottom:1rem;"]),StyledPage=dt(Page).withConfig({displayName:"PDFViewer__StyledPage",componentId:"sc-97b02986-1"})(["margin:auto;border-radius:",";overflow:hidden;box-shadow:",";"],({theme:M})=>M.radius,({theme:M})=>M.boxShadow);export{PDFViewer as default};
//# sourceMappingURL=chunk_index.js.map