var __defProp=Object.defineProperty,__defNormalProp=(t,e,s)=>e in t?__defProp(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s,__publicField=(t,e,s)=>(__defNormalProp(t,"symbol"!=typeof e?e+"":e,s),s),__accessCheck=(t,e,s)=>{if(!e.has(t))throw TypeError("Cannot "+s)},__privateGet=(t,e,s)=>(__accessCheck(t,e,"read from private field"),s?s.call(t):e.get(t)),__privateAdd=(t,e,s)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,s)},__privateSet=(t,e,s,i)=>(__accessCheck(t,e,"write to private field"),i?i.call(t,s):e.set(t,s),s),__privateWrapper=(t,e,s,i)=>({set _(i){__privateSet(t,e,i,s)},get _(){return __privateGet(t,e,i)}}),__privateMethod=(t,e,s)=>(__accessCheck(t,e,"access private method"),s);import{_ as _export_sfc,r as ref,$ as watch,Z as nextTick,a as openBlock,c as createBlock,w as withCtx,e as createVNode,b as createTextVNode,t as toDisplayString,J as normalizeClass,d as createCommentVNode,k as index$i,i as index$g,D as useUserStore,ah as reactive,R as computed,p as onLoad,B as onShow,Q as getStorageSync,v as showLoading,A as showToast,x as hideLoading,G as resolveEasycom,H as resolveDynamicComponent,U as __easycom_3,ai as __easycom_3$1,aj as __easycom_4,ak as __easycom_5,al as __easycom_9,f as createElementBlock,h as renderList,F as Fragment,X as withModifiers,I as unref,ag as uploadFile,am as setStorageSync,N as showModal,z as removeStorageSync,a4 as previewImage,a7 as navigateBack,m as index$q,L as index$x,l as normalizeStyle}from"./index-0UG2BwZe.js";import{_ as __easycom_8}from"./uni-icons.LhDlNFdH.js";import{u as useHomeButton,d as dayjs}from"./dayjs.min.C9F1n3ac.js";import{c as commonjsRequire,r as require$$5}from"./___vite-browser-external_commonjs-proxy.B2Lrrf4l.js";import"./_commonjsHelpers.DN37M9Hi.js";var pdf={exports:{}};(function(module,exports){var factory;globalThis,factory=()=>(()=>{var __webpack_modules__=[,(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.VerbosityLevel=e.Util=e.UnknownErrorException=e.UnexpectedResponseException=e.UNSUPPORTED_FEATURES=e.TextRenderingMode=e.StreamType=e.RenderingIntentFlag=e.PermissionFlag=e.PasswordResponses=e.PasswordException=e.PageActionEventType=e.OPS=e.MissingPDFException=e.LINE_FACTOR=e.LINE_DESCENT_FACTOR=e.InvalidPDFException=e.ImageKind=e.IDENTITY_MATRIX=e.FormatError=e.FontType=e.FeatureTest=e.FONT_IDENTITY_MATRIX=e.DocumentActionEventType=e.CMapCompressionType=e.BaseException=e.AnnotationType=e.AnnotationStateModelType=e.AnnotationReviewState=e.AnnotationReplyType=e.AnnotationMode=e.AnnotationMarkedState=e.AnnotationFlag=e.AnnotationFieldFlag=e.AnnotationEditorType=e.AnnotationEditorPrefix=e.AnnotationEditorParamsType=e.AnnotationBorderStyleType=e.AnnotationActionEventType=e.AbortException=void 0,e.arrayByteLength=h,e.arraysToBytes=function(t){const e=t.length;if(1===e&&t[0]instanceof Uint8Array)return t[0];let s=0;for(let r=0;r<e;r++)s+=h(t[r]);let i=0;const a=new Uint8Array(s);for(let r=0;r<e;r++){let e=t[r];e instanceof Uint8Array||(e="string"==typeof e?c(e):new Uint8Array(e));const s=e.byteLength;a.set(e,i),i+=s}return a},e.assert=function(t,e){t||n(e)},e.bytesToString=function(t){"object"==typeof t&&null!==t&&void 0!==t.length||n("Invalid argument for bytesToString");const e=t.length,s=8192;if(e<s)return String.fromCharCode.apply(null,t);const i=[];for(let a=0;a<e;a+=s){const r=Math.min(a+s,e),n=t.subarray(a,r);i.push(String.fromCharCode.apply(null,n))}return i.join("")},e.createPromiseCapability=function(){const t=Object.create(null);let e=!1;return Object.defineProperty(t,"settled",{get:()=>e}),t.promise=new Promise(function(s,i){t.resolve=function(t){e=!0,s(t)},t.reject=function(t){e=!0,i(t)}}),t},e.createValidAbsoluteUrl=function(t,e=null,s=null){if(!t)return null;try{if(s&&"string"==typeof t){if(s.addDefaultProtocol&&t.startsWith("www.")){const e=t.match(/\./g);e&&e.length>=2&&(t=`http://${t}`)}if(s.tryConvertEncoding)try{t=_(t)}catch(i){}}const a=e?new URL(t,e):new URL(t);if(function(t){if(!t)return!1;switch(t.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(a))return a}catch(i){}return null},e.escapeString=function(t){return t.replace(/([()\\\n\r])/g,t=>"\n"===t?"\\n":"\r"===t?"\\r":`\\${t}`)},e.getModificationDate=function(t=new Date){return[t.getUTCFullYear().toString(),(t.getUTCMonth()+1).toString().padStart(2,"0"),t.getUTCDate().toString().padStart(2,"0"),t.getUTCHours().toString().padStart(2,"0"),t.getUTCMinutes().toString().padStart(2,"0"),t.getUTCSeconds().toString().padStart(2,"0")].join("")},e.getVerbosityLevel=function(){return a},e.info=function(t){a>=i.INFOS&&console.log(`Info: ${t}`)},e.isArrayBuffer=function(t){return"object"==typeof t&&null!==t&&void 0!==t.byteLength},e.isArrayEqual=function(t,e){if(t.length!==e.length)return!1;for(let s=0,i=t.length;s<i;s++)if(t[s]!==e[s])return!1;return!0},e.isAscii=function(t){return/^[\x00-\x7F]*$/.test(t)},e.objectFromMap=function(t){const e=Object.create(null);for(const[s,i]of t)e[s]=i;return e},e.objectSize=function(t){return Object.keys(t).length},e.setVerbosityLevel=function(t){Number.isInteger(t)&&(a=t)},e.shadow=o,e.string32=function(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,255&t)},e.stringToBytes=c,e.stringToPDFString=function(t){if(t[0]>="ï"){let e;if("þ"===t[0]&&"ÿ"===t[1]?e="utf-16be":"ÿ"===t[0]&&"þ"===t[1]?e="utf-16le":"ï"===t[0]&&"»"===t[1]&&"¿"===t[2]&&(e="utf-8"),e)try{const s=new TextDecoder(e,{fatal:!0}),i=c(t);return s.decode(i)}catch(s){r(`stringToPDFString: "${s}".`)}}const e=[];for(let i=0,a=t.length;i<a;i++){const s=p[t.charCodeAt(i)];e.push(s?String.fromCharCode(s):t.charAt(i))}return e.join("")},e.stringToUTF16BEString=function(t){const e=["þÿ"];for(let s=0,i=t.length;s<i;s++){const i=t.charCodeAt(s);e.push(String.fromCharCode(i>>8&255),String.fromCharCode(255&i))}return e.join("")},e.stringToUTF8String=_,e.unreachable=n,e.utf8StringToString=function(t){return unescape(encodeURIComponent(t))},e.warn=r,s(2),e.IDENTITY_MATRIX=[1,0,0,1,0,0],e.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0],e.LINE_FACTOR=1.35,e.LINE_DESCENT_FACTOR=.35,e.RenderingIntentFlag={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256},e.AnnotationMode={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},e.AnnotationEditorPrefix="pdfjs_internal_editor_",e.AnnotationEditorType={DISABLE:-1,NONE:0,FREETEXT:3,INK:15},e.AnnotationEditorParamsType={FREETEXT_SIZE:1,FREETEXT_COLOR:2,FREETEXT_OPACITY:3,INK_COLOR:11,INK_THICKNESS:12,INK_OPACITY:13},e.PermissionFlag={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.TextRenderingMode={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.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},e.AnnotationType={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.AnnotationStateModelType={MARKED:"Marked",REVIEW:"Review"},e.AnnotationMarkedState={MARKED:"Marked",UNMARKED:"Unmarked"},e.AnnotationReviewState={ACCEPTED:"Accepted",REJECTED:"Rejected",CANCELLED:"Cancelled",COMPLETED:"Completed",NONE:"None"},e.AnnotationReplyType={GROUP:"Group",REPLY:"R"},e.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512},e.AnnotationFieldFlag={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.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},e.AnnotationActionEventType={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.DocumentActionEventType={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"},e.PageActionEventType={O:"PageOpen",C:"PageClose"},e.StreamType={UNKNOWN:"UNKNOWN",FLATE:"FLATE",LZW:"LZW",DCT:"DCT",JPX:"JPX",JBIG:"JBIG",A85:"A85",AHX:"AHX",CCF:"CCF",RLX:"RLX"},e.FontType={UNKNOWN:"UNKNOWN",TYPE1:"TYPE1",TYPE1STANDARD:"TYPE1STANDARD",TYPE1C:"TYPE1C",CIDFONTTYPE0:"CIDFONTTYPE0",CIDFONTTYPE0C:"CIDFONTTYPE0C",TRUETYPE:"TRUETYPE",CIDFONTTYPE2:"CIDFONTTYPE2",TYPE3:"TYPE3",OPENTYPE:"OPENTYPE",TYPE0:"TYPE0",MMTYPE1:"MMTYPE1"};const i={ERRORS:0,WARNINGS:1,INFOS:5};e.VerbosityLevel=i,e.CMapCompressionType={NONE:0,BINARY:1,STREAM:2},e.OPS={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotations:78,endAnnotations:79,beginAnnotation:80,endAnnotation:81,paintJpegXObject:82,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91},e.UNSUPPORTED_FEATURES={unknown:"unknown",forms:"forms",javaScript:"javaScript",signatures:"signatures",smask:"smask",shadingPattern:"shadingPattern",font:"font",errorTilingPattern:"errorTilingPattern",errorExtGState:"errorExtGState",errorXObject:"errorXObject",errorFontLoadType3:"errorFontLoadType3",errorFontState:"errorFontState",errorFontMissing:"errorFontMissing",errorFontTranslate:"errorFontTranslate",errorColorSpace:"errorColorSpace",errorOperatorList:"errorOperatorList",errorFontToUnicode:"errorFontToUnicode",errorFontLoadNative:"errorFontLoadNative",errorFontBuildPath:"errorFontBuildPath",errorFontGetPath:"errorFontGetPath",errorMarkedContent:"errorMarkedContent",errorContentSubStream:"errorContentSubStream"},e.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let a=i.WARNINGS;function r(t){a>=i.WARNINGS&&console.log(`Warning: ${t}`)}function n(t){throw new Error(t)}function o(t,e,s){return Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!1}),s}const l=function(){function t(e,s){this.constructor===t&&n("Cannot initialize BaseException."),this.message=e,this.name=s}return t.prototype=new Error,t.constructor=t,t}();function c(t){"string"!=typeof t&&n("Invalid argument for stringToBytes");const e=t.length,s=new Uint8Array(e);for(let i=0;i<e;++i)s[i]=255&t.charCodeAt(i);return s}function h(t){return void 0!==t.length?t.length:void 0!==t.byteLength?t.byteLength:void n("Invalid argument for arrayByteLength")}e.BaseException=l,e.PasswordException=class extends l{constructor(t,e){super(t,"PasswordException"),this.code=e}},e.UnknownErrorException=class extends l{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}},e.InvalidPDFException=class extends l{constructor(t){super(t,"InvalidPDFException")}},e.MissingPDFException=class extends l{constructor(t){super(t,"MissingPDFException")}},e.UnexpectedResponseException=class extends l{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}},e.FormatError=class extends l{constructor(t){super(t,"FormatError")}},e.AbortException=class extends l{constructor(t){super(t,"AbortException")}},e.FeatureTest=class{static get isLittleEndian(){return o(this,"isLittleEndian",function(){const t=new Uint8Array(4);return t[0]=1,1===new Uint32Array(t.buffer,0,1)[0]}())}static get isEvalSupported(){return o(this,"isEvalSupported",function(){try{return new Function(""),!0}catch(t){return!1}}())}static get isOffscreenCanvasSupported(){return o(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}};const d=[...Array(256).keys()].map(t=>t.toString(16).padStart(2,"0"));class u{static makeHexColor(t,e,s){return`#${d[t]}${d[e]}${d[s]}`}static scaleMinMax(t,e){let s;t[0]?(t[0]<0&&(s=e[0],e[0]=e[1],e[1]=s),e[0]*=t[0],e[1]*=t[0],t[3]<0&&(s=e[2],e[2]=e[3],e[3]=s),e[2]*=t[3],e[3]*=t[3]):(s=e[0],e[0]=e[2],e[2]=s,s=e[1],e[1]=e[3],e[3]=s,t[1]<0&&(s=e[2],e[2]=e[3],e[3]=s),e[2]*=t[1],e[3]*=t[1],t[2]<0&&(s=e[0],e[0]=e[1],e[1]=s),e[0]*=t[2],e[1]*=t[2]),e[0]+=t[4],e[1]+=t[4],e[2]+=t[5],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static applyTransform(t,e){return[t[0]*e[0]+t[1]*e[2]+e[4],t[0]*e[1]+t[1]*e[3]+e[5]]}static applyInverseTransform(t,e){const s=e[0]*e[3]-e[1]*e[2];return[(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/s,(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/s]}static getAxialAlignedBoundingBox(t,e){const s=u.applyTransform(t,e),i=u.applyTransform(t.slice(2,4),e),a=u.applyTransform([t[0],t[3]],e),r=u.applyTransform([t[2],t[1]],e);return[Math.min(s[0],i[0],a[0],r[0]),Math.min(s[1],i[1],a[1],r[1]),Math.max(s[0],i[0],a[0],r[0]),Math.max(s[1],i[1],a[1],r[1])]}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static apply3dTransform(t,e){return[t[0]*e[0]+t[1]*e[1]+t[2]*e[2],t[3]*e[0]+t[4]*e[1]+t[5]*e[2],t[6]*e[0]+t[7]*e[1]+t[8]*e[2]]}static singularValueDecompose2dScale(t){const e=[t[0],t[2],t[1],t[3]],s=t[0]*e[0]+t[1]*e[2],i=t[0]*e[1]+t[1]*e[3],a=t[2]*e[0]+t[3]*e[2],r=t[2]*e[1]+t[3]*e[3],n=(s+r)/2,o=Math.sqrt((s+r)**2-4*(s*r-a*i))/2,l=n+o||1,c=n-o||1;return[Math.sqrt(l),Math.sqrt(c)]}static normalizeRect(t){const e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){const s=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),i=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(s>i)return null;const a=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),r=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return a>r?null:[s,a,i,r]}static bezierBoundingBox(t,e,s,i,a,r,n,o){const l=[],c=[[],[]];let h,d,u,p,_,f,g,m;for(let y=0;y<2;++y)if(0===y?(d=6*t-12*s+6*a,h=-3*t+9*s-9*a+3*n,u=3*s-3*t):(d=6*e-12*i+6*r,h=-3*e+9*i-9*r+3*o,u=3*i-3*e),Math.abs(h)<1e-12){if(Math.abs(d)<1e-12)continue;p=-u/d,0<p&&p<1&&l.push(p)}else g=d*d-4*u*h,m=Math.sqrt(g),g<0||(_=(-d+m)/(2*h),0<_&&_<1&&l.push(_),f=(-d-m)/(2*h),0<f&&f<1&&l.push(f));let v,b=l.length;const A=b;for(;b--;)p=l[b],v=1-p,c[0][b]=v*v*v*t+3*v*v*p*s+3*v*p*p*a+p*p*p*n,c[1][b]=v*v*v*e+3*v*v*p*i+3*v*p*p*r+p*p*p*o;return c[0][A]=t,c[1][A]=e,c[0][A+1]=n,c[1][A+1]=o,c[0].length=c[1].length=A+2,[Math.min(...c[0]),Math.min(...c[1]),Math.max(...c[0]),Math.max(...c[1])]}}e.Util=u;const p=[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 _(t){return decodeURIComponent(escape(t))}},(t,e,s)=>{s(3)},(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isNodeJS=void 0;const s=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type);e.isNodeJS=s},(__unused_webpack_module,exports,__w_pdfjs_require__)=>{var _docId,_a,_workerPorts,_docStats,_pageCache,_pagePromises,_metadataPromise,_objs,_ensureObj,ensureObj_fn,_internalRenderTask,_canvasInUse;Object.defineProperty(exports,"__esModule",{value:!0}),exports.build=exports.RenderTask=exports.PDFWorkerUtil=exports.PDFWorker=exports.PDFPageProxy=exports.PDFDocumentProxy=exports.PDFDocumentLoadingTask=exports.PDFDataRangeTransport=exports.LoopbackPort=exports.DefaultStandardFontDataFactory=exports.DefaultCanvasFactory=exports.DefaultCMapReaderFactory=void 0,exports.getDocument=getDocument,exports.setPDFNetworkStreamFactory=setPDFNetworkStreamFactory,exports.version=void 0;var _util=__w_pdfjs_require__(1),_annotation_storage=__w_pdfjs_require__(5),_display_utils=__w_pdfjs_require__(8),_font_loader=__w_pdfjs_require__(11),_canvas=__w_pdfjs_require__(12),_worker_options=__w_pdfjs_require__(15),_is_node=__w_pdfjs_require__(3),_message_handler=__w_pdfjs_require__(16),_metadata=__w_pdfjs_require__(17),_optional_content_config=__w_pdfjs_require__(18),_transport_stream=__w_pdfjs_require__(19),_xfa_text=__w_pdfjs_require__(20);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100;let DefaultCanvasFactory=_display_utils.DOMCanvasFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory;let DefaultCMapReaderFactory=_display_utils.DOMCMapReaderFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory;let DefaultStandardFontDataFactory=_display_utils.DOMStandardFontDataFactory,createPDFNetworkStream;if(exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory,_is_node.isNodeJS){const{NodeCanvasFactory:t,NodeCMapReaderFactory:e,NodeStandardFontDataFactory:s}=__w_pdfjs_require__(21);exports.DefaultCanvasFactory=DefaultCanvasFactory=t,exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory=e,exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory=s}function setPDFNetworkStreamFactory(t){createPDFNetworkStream=t}function getDocument(t){const e=new PDFDocumentLoadingTask;let s;if("string"==typeof t||t instanceof URL)s={url:t};else if((0,_util.isArrayBuffer)(t))s={data:t};else if(t instanceof PDFDataRangeTransport)s={range:t};else{if("object"!=typeof t)throw new Error("Invalid parameter in getDocument, need either string, URL, TypedArray, or parameter object.");if(!t.url&&!t.data&&!t.range)throw new Error("Invalid parameter object: need either .data, .range or .url");s=t}const i=Object.create(null);let a=null,r=null;for(const l in s){const t=s[l];switch(l){case"url":if("undefined"!=typeof window)try{i[l]=new URL(t,window.location).href;continue}catch(o){(0,_util.warn)(`Cannot create valid URL: "${o}".`)}else if("string"==typeof t||t instanceof URL){i[l]=t.toString();continue}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.");case"range":a=t;continue;case"worker":r=t;continue;case"data":if(_is_node.isNodeJS&&"undefined"!=typeof Buffer&&t instanceof Buffer)i[l]=new Uint8Array(t);else{if(t instanceof Uint8Array)break;if("string"==typeof t)i[l]=(0,_util.stringToBytes)(t);else if("object"!=typeof t||null===t||isNaN(t.length)){if(!(0,_util.isArrayBuffer)(t))throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.");i[l]=new Uint8Array(t)}else i[l]=new Uint8Array(t)}continue}i[l]=t}if(i.CMapReaderFactory=i.CMapReaderFactory||DefaultCMapReaderFactory,i.StandardFontDataFactory=i.StandardFontDataFactory||DefaultStandardFontDataFactory,i.ignoreErrors=!0!==i.stopAtErrors,i.fontExtraProperties=!0===i.fontExtraProperties,i.pdfBug=!0===i.pdfBug,i.enableXfa=!0===i.enableXfa,(!Number.isInteger(i.rangeChunkSize)||i.rangeChunkSize<1)&&(i.rangeChunkSize=DEFAULT_RANGE_CHUNK_SIZE),("string"!=typeof i.docBaseUrl||(0,_display_utils.isDataScheme)(i.docBaseUrl))&&(i.docBaseUrl=null),(!Number.isInteger(i.maxImageSize)||i.maxImageSize<-1)&&(i.maxImageSize=-1),"string"!=typeof i.cMapUrl&&(i.cMapUrl=null),"string"!=typeof i.standardFontDataUrl&&(i.standardFontDataUrl=null),"boolean"!=typeof i.useWorkerFetch&&(i.useWorkerFetch=i.CMapReaderFactory===_display_utils.DOMCMapReaderFactory&&i.StandardFontDataFactory===_display_utils.DOMStandardFontDataFactory),"boolean"!=typeof i.isEvalSupported&&(i.isEvalSupported=!0),"boolean"!=typeof i.disableFontFace&&(i.disableFontFace=_is_node.isNodeJS),"boolean"!=typeof i.useSystemFonts&&(i.useSystemFonts=!_is_node.isNodeJS&&!i.disableFontFace),"object"==typeof i.ownerDocument&&null!==i.ownerDocument||(i.ownerDocument=globalThis.document),"boolean"!=typeof i.disableRange&&(i.disableRange=!1),"boolean"!=typeof i.disableStream&&(i.disableStream=!1),"boolean"!=typeof i.disableAutoFetch&&(i.disableAutoFetch=!1),(0,_util.setVerbosityLevel)(i.verbosity),!r){const t={verbosity:i.verbosity,port:_worker_options.GlobalWorkerOptions.workerPort};r=t.port?PDFWorker.fromPort(t):new PDFWorker(t),e._worker=r}const n=e.docId;return r.promise.then(function(){if(e.destroyed)throw new Error("Loading aborted");const t=_fetchDocument(r,i,a,n),s=new Promise(function(t){let e;a?e=new _transport_stream.PDFDataTransportStream({length:i.length,initialData:i.initialData,progressiveDone:i.progressiveDone,contentDispositionFilename:i.contentDispositionFilename,disableRange:i.disableRange,disableStream:i.disableStream},a):i.data||(e=createPDFNetworkStream({url:i.url,length:i.length,httpHeaders:i.httpHeaders,withCredentials:i.withCredentials,rangeChunkSize:i.rangeChunkSize,disableRange:i.disableRange,disableStream:i.disableStream})),t(e)});return Promise.all([t,s]).then(function([t,s]){if(e.destroyed)throw new Error("Loading aborted");const a=new _message_handler.MessageHandler(n,t,r.port),o=new WorkerTransport(a,e,s,i);e._transport=o,a.send("Ready",null)})}).catch(e._capability.reject),e}async function _fetchDocument(t,e,s,i){if(t.destroyed)throw new Error("Worker was destroyed");s&&(e.length=s.length,e.initialData=s.initialData,e.progressiveDone=s.progressiveDone,e.contentDispositionFilename=s.contentDispositionFilename);const a=await t.messageHandler.sendWithPromise("GetDocRequest",{docId:i,apiVersion:"2.16.105",source:{data:e.data,url:e.url,password:e.password,disableAutoFetch:e.disableAutoFetch,rangeChunkSize:e.rangeChunkSize,length:e.length},maxImageSize:e.maxImageSize,disableFontFace:e.disableFontFace,docBaseUrl:e.docBaseUrl,ignoreErrors:e.ignoreErrors,isEvalSupported:e.isEvalSupported,fontExtraProperties:e.fontExtraProperties,enableXfa:e.enableXfa,useSystemFonts:e.useSystemFonts,cMapUrl:e.useWorkerFetch?e.cMapUrl:null,standardFontDataUrl:e.useWorkerFetch?e.standardFontDataUrl:null});if(e.data&&(e.data=null),t.destroyed)throw new Error("Worker was destroyed");return a}const _PDFDocumentLoadingTask=class t{constructor(){this._capability=(0,_util.createPromiseCapability)(),this._transport=null,this._worker=null,this.docId="d"+__privateWrapper(t,_docId)._++,this.destroyed=!1,this.onPassword=null,this.onProgress=null,this.onUnsupportedFeature=null}get promise(){return this._capability.promise}async destroy(){var t;this.destroyed=!0,await(null==(t=this._transport)?void 0:t.destroy()),this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}};_docId=new WeakMap,__privateAdd(_PDFDocumentLoadingTask,_docId,0);let PDFDocumentLoadingTask=_PDFDocumentLoadingTask;exports.PDFDocumentLoadingTask=PDFDocumentLoadingTask;class PDFDataRangeTransport{constructor(t,e,s=!1,i=null){this.length=t,this.initialData=e,this.progressiveDone=s,this.contentDispositionFilename=i,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=(0,_util.createPromiseCapability)()}addRangeListener(t){this._rangeListeners.push(t)}addProgressListener(t){this._progressListeners.push(t)}addProgressiveReadListener(t){this._progressiveReadListeners.push(t)}addProgressiveDoneListener(t){this._progressiveDoneListeners.push(t)}onDataRange(t,e){for(const s of this._rangeListeners)s(t,e)}onDataProgress(t,e){this._readyCapability.promise.then(()=>{for(const s of this._progressListeners)s(t,e)})}onDataProgressiveRead(t){this._readyCapability.promise.then(()=>{for(const e of this._progressiveReadListeners)e(t)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const t of this._progressiveDoneListeners)t()})}transportReady(){this._readyCapability.resolve()}requestDataRange(t,e){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}exports.PDFDataRangeTransport=PDFDataRangeTransport;class PDFDocumentProxy{constructor(t,e){this._pdfInfo=t,this._transport=e,Object.defineProperty(this,"fingerprint",{get(){return(0,_display_utils.deprecated)("`PDFDocumentProxy.fingerprint`, please use `PDFDocumentProxy.fingerprints` instead."),this.fingerprints[0]}}),Object.defineProperty(this,"getStats",{value:async()=>((0,_display_utils.deprecated)("`PDFDocumentProxy.getStats`, please use the `PDFDocumentProxy.stats`-getter instead."),this.stats||{streamTypes:{},fontTypes:{}})})}get annotationStorage(){return this._transport.annotationStorage}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get stats(){return this._transport.stats}get isPureXfa(){return!!this._transport._htmlForXfa}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJavaScript(){return this._transport.getJavaScript()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){return this._transport.getOptionalContentConfig()}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}saveDocument(){return this._transport.annotationStorage.size<=0&&(0,_display_utils.deprecated)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead."),this._transport.saveDocument()}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}exports.PDFDocumentProxy=PDFDocumentProxy;class PDFPageProxy{constructor(t,e,s,i,a=!1){this._pageIndex=t,this._pageInfo=e,this._ownerDocument=i,this._transport=s,this._stats=a?new _display_utils.StatTimer:null,this._pdfBug=a,this.commonObjs=s.commonObjs,this.objs=new PDFObjects,this._bitmaps=new Set,this.cleanupAfterRender=!1,this.pendingCleanup=!1,this._intentStates=new Map,this._annotationPromises=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:t,rotation:e=this.rotate,offsetX:s=0,offsetY:i=0,dontFlip:a=!1}={}){return new _display_utils.PageViewport({viewBox:this.view,scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:a})}getAnnotations({intent:t="display"}={}){const e=this._transport.getRenderingIntent(t);let s=this._annotationPromises.get(e.cacheKey);return s||(s=this._transport.getAnnotations(this._pageIndex,e.renderingIntent),this._annotationPromises.set(e.cacheKey,s),s=s.then(t=>{for(const e of t)void 0!==e.titleObj&&Object.defineProperty(e,"title",{get:()=>((0,_display_utils.deprecated)("`title`-property on annotation, please use `titleObj` instead."),e.titleObj.str)}),void 0!==e.contentsObj&&Object.defineProperty(e,"contents",{get:()=>((0,_display_utils.deprecated)("`contents`-property on annotation, please use `contentsObj` instead."),e.contentsObj.str)});return t})),s}getJSActions(){return this._jsActionsPromise||(this._jsActionsPromise=this._transport.getPageJSActions(this._pageIndex))}async getXfa(){var t;return(null==(t=this._transport._htmlForXfa)?void 0:t.children[this._pageIndex])||null}render({canvasContext:t,viewport:e,intent:s="display",annotationMode:i=_util.AnnotationMode.ENABLE,transform:a=null,imageLayer:r=null,canvasFactory:n=null,background:o=null,optionalContentConfigPromise:l=null,annotationCanvasMap:c=null,pageColors:h=null,printAnnotationStorage:d=null}){var u,p;void 0!==(null==(u=arguments[0])?void 0:u.renderInteractiveForms)&&((0,_display_utils.deprecated)("render no longer accepts the `renderInteractiveForms`-option, please use the `annotationMode`-option instead."),!0===arguments[0].renderInteractiveForms&&i===_util.AnnotationMode.ENABLE&&(i=_util.AnnotationMode.ENABLE_FORMS)),void 0!==(null==(p=arguments[0])?void 0:p.includeAnnotationStorage)&&((0,_display_utils.deprecated)("render no longer accepts the `includeAnnotationStorage`-option, please use the `annotationMode`-option instead."),!0===arguments[0].includeAnnotationStorage&&i===_util.AnnotationMode.ENABLE&&(i=_util.AnnotationMode.ENABLE_STORAGE)),this._stats&&this._stats.time("Overall");const _=this._transport.getRenderingIntent(s,i,d);this.pendingCleanup=!1,l||(l=this._transport.getOptionalContentConfig());let f=this._intentStates.get(_.cacheKey);f||(f=Object.create(null),this._intentStates.set(_.cacheKey,f)),f.streamReaderCancelTimeout&&(clearTimeout(f.streamReaderCancelTimeout),f.streamReaderCancelTimeout=null);const g=n||new DefaultCanvasFactory({ownerDocument:this._ownerDocument}),m=!!(_.renderingIntent&_util.RenderingIntentFlag.PRINT);f.displayReadyCapability||(f.displayReadyCapability=(0,_util.createPromiseCapability)(),f.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats&&this._stats.time("Page Request"),this._pumpOperatorList(_));const v=t=>{f.renderTasks.delete(b),(this.cleanupAfterRender||m)&&(this.pendingCleanup=!0),this._tryCleanup(),t?(b.capability.reject(t),this._abortOperatorList({intentState:f,reason:t instanceof Error?t:new Error(t)})):b.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"))},b=new InternalRenderTask({callback:v,params:{canvasContext:t,viewport:e,transform:a,imageLayer:r,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:f.operatorList,pageIndex:this._pageIndex,canvasFactory:g,useRequestAnimationFrame:!m,pdfBug:this._pdfBug,pageColors:h});(f.renderTasks||(f.renderTasks=new Set)).add(b);const A=b.task;return Promise.all([f.displayReadyCapability.promise,l]).then(([t,e])=>{this.pendingCleanup?v():(this._stats&&this._stats.time("Rendering"),b.initializeGraphics({transparency:t,optionalContentConfig:e}),b.operatorListChanged())}).catch(v),A}getOperatorList({intent:t="display",annotationMode:e=_util.AnnotationMode.ENABLE,printAnnotationStorage:s=null}={}){const i=this._transport.getRenderingIntent(t,e,s,!0);let a,r=this._intentStates.get(i.cacheKey);return r||(r=Object.create(null),this._intentStates.set(i.cacheKey,r)),r.opListReadCapability||(a=Object.create(null),a.operatorListChanged=function(){r.operatorList.lastChunk&&(r.opListReadCapability.resolve(r.operatorList),r.renderTasks.delete(a))},r.opListReadCapability=(0,_util.createPromiseCapability)(),(r.renderTasks||(r.renderTasks=new Set)).add(a),r.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats&&this._stats.time("Page Request"),this._pumpOperatorList(i)),r.opListReadCapability.promise}streamTextContent({disableCombineTextItems:t=!1,includeMarkedContent:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,combineTextItems:!0!==t,includeMarkedContent:!0===e},{highWaterMark:100,size:t=>t.items.length})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(t=>_xfa_text.XfaText.textContent(t));const e=this.streamTextContent(t);return new Promise(function(t,s){const i=e.getReader(),a={items:[],styles:Object.create(null)};!function e(){i.read().then(function({value:s,done:i}){i?t(a):(Object.assign(a.styles,s.styles),a.items.push(...s.items),e())},s)}()})}getStructTree(){return this._structTreePromise||(this._structTreePromise=this._transport.getStructTree(this._pageIndex))}_destroy(){this.destroyed=!0;const t=[];for(const e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(const s of e.renderTasks)t.push(s.completed),s.cancel();this.objs.clear();for(const e of this._bitmaps)e.close();return this._bitmaps.clear(),this._annotationPromises.clear(),this._jsActionsPromise=null,this._structTreePromise=null,this.pendingCleanup=!1,Promise.all(t)}cleanup(t=!1){return this.pendingCleanup=!0,this._tryCleanup(t)}_tryCleanup(t=!1){if(!this.pendingCleanup)return!1;for(const{renderTasks:e,operatorList:s}of this._intentStates.values())if(e.size>0||!s.lastChunk)return!1;this._intentStates.clear(),this.objs.clear(),this._annotationPromises.clear(),this._jsActionsPromise=null,this._structTreePromise=null,t&&this._stats&&(this._stats=new _display_utils.StatTimer);for(const e of this._bitmaps)e.close();return this._bitmaps.clear(),this.pendingCleanup=!1,!0}_startRenderPage(t,e){const s=this._intentStates.get(e);s&&(this._stats&&this._stats.timeEnd("Page Request"),s.displayReadyCapability&&s.displayReadyCapability.resolve(t))}_renderPageChunk(t,e){for(let s=0,i=t.length;s<i;s++)e.operatorList.fnArray.push(t.fnArray[s]),e.operatorList.argsArray.push(t.argsArray[s]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(const s of e.renderTasks)s.operatorListChanged();t.lastChunk&&this._tryCleanup()}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageMap:s}){const i=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:s}).getReader(),a=this._intentStates.get(e);a.streamReader=i;const r=()=>{i.read().then(({value:t,done:e})=>{e?a.streamReader=null:this._transport.destroyed||(this._renderPageChunk(t,a),r())},t=>{if(a.streamReader=null,!this._transport.destroyed){if(a.operatorList){a.operatorList.lastChunk=!0;for(const t of a.renderTasks)t.operatorListChanged();this._tryCleanup()}if(a.displayReadyCapability)a.displayReadyCapability.reject(t);else{if(!a.opListReadCapability)throw t;a.opListReadCapability.reject(t)}}})};r()}_abortOperatorList({intentState:t,reason:e,force:s=!1}){if(t.streamReader){if(!s){if(t.renderTasks.size>0)return;if(e instanceof _display_utils.RenderingCancelledException)return void(t.streamReaderCancelTimeout=setTimeout(()=>{this._abortOperatorList({intentState:t,reason:e,force:!0}),t.streamReaderCancelTimeout=null},RENDERING_CANCELLED_TIMEOUT))}if(t.streamReader.cancel(new _util.AbortException(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[e,s]of this._intentStates)if(s===t){this._intentStates.delete(e);break}this.cleanup()}}}get stats(){return this._stats}}exports.PDFPageProxy=PDFPageProxy;class LoopbackPort{constructor(){this._listeners=[],this._deferred=Promise.resolve()}postMessage(t,e){const s={data:structuredClone(t,e)};this._deferred.then(()=>{for(const t of this._listeners)t.call(this,s)})}addEventListener(t,e){this._listeners.push(e)}removeEventListener(t,e){const s=this._listeners.indexOf(e);this._listeners.splice(s,1)}terminate(){this._listeners.length=0}}exports.LoopbackPort=LoopbackPort;const PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};if(exports.PDFWorkerUtil=PDFWorkerUtil,_is_node.isNodeJS&&"function"==typeof commonjsRequire)PDFWorkerUtil.isWorkerDisabled=!0,PDFWorkerUtil.fallbackWorkerSrc="./pdf.worker.js";else if("object"==typeof document){const t=null==(_a=null==document?void 0:document.currentScript)?void 0:_a.src;t&&(PDFWorkerUtil.fallbackWorkerSrc=t.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}PDFWorkerUtil.isSameOrigin=function(t,e){let s;try{if(s=new URL(t),!s.origin||"null"===s.origin)return!1}catch(a){return!1}const i=new URL(e,s);return s.origin===i.origin},PDFWorkerUtil.createCDNWrapper=function(t){const e=`importScripts("${t}");`;return URL.createObjectURL(new Blob([e]))};const _PDFWorker=class _PDFWorker{constructor({name:t=null,port:e=null,verbosity:s=(0,_util.getVerbosityLevel)()}={}){if(e&&__privateGet(_PDFWorker,_workerPorts).has(e))throw new Error("Cannot use more than one PDFWorker per port.");if(this.name=t,this.destroyed=!1,this.verbosity=s,this._readyCapability=(0,_util.createPromiseCapability)(),this._port=null,this._webWorker=null,this._messageHandler=null,e)return __privateGet(_PDFWorker,_workerPorts).set(e,this),void this._initializeFromPort(e);this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(t){this._port=t,this._messageHandler=new _message_handler.MessageHandler("main","worker",t),this._messageHandler.on("ready",function(){}),this._readyCapability.resolve()}_initialize(){if(!PDFWorkerUtil.isWorkerDisabled&&!_PDFWorker._mainThreadWorkerMessageHandler){let{workerSrc:e}=_PDFWorker;try{PDFWorkerUtil.isSameOrigin(window.location.href,e)||(e=PDFWorkerUtil.createCDNWrapper(new URL(e,window.location).href));const t=new Worker(e),s=new _message_handler.MessageHandler("main","worker",t),i=()=>{t.removeEventListener("error",a),s.destroy(),t.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},a=()=>{this._webWorker||i()};t.addEventListener("error",a),s.on("test",e=>{t.removeEventListener("error",a),this.destroyed?i():e?(this._messageHandler=s,this._port=t,this._webWorker=t,this._readyCapability.resolve(),s.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),s.destroy(),t.terminate())}),s.on("ready",e=>{if(t.removeEventListener("error",a),this.destroyed)i();else try{r()}catch(s){this._setupFakeWorker()}});const r=()=>{const t=new Uint8Array;s.send("test",t,[t.buffer])};return void r()}catch(t){(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(t=>{if(this.destroyed)return void this._readyCapability.reject(new Error("Worker was destroyed"));const e=new LoopbackPort;this._port=e;const s="fake"+PDFWorkerUtil.fakeWorkerId++,i=new _message_handler.MessageHandler(s+"_worker",s,e);t.setup(i,e);const a=new _message_handler.MessageHandler(s,s+"_worker",e);this._messageHandler=a,this._readyCapability.resolve(),a.send("configure",{verbosity:this.verbosity})}).catch(t=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),__privateGet(_PDFWorker,_workerPorts).delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){if(!(null==t?void 0:t.port))throw new Error("PDFWorker.fromPort - invalid method signature.");return __privateGet(this,_workerPorts).has(t.port)?__privateGet(this,_workerPorts).get(t.port):new _PDFWorker(t)}static get workerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(null!==PDFWorkerUtil.fallbackWorkerSrc)return _is_node.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'),PDFWorkerUtil.fallbackWorkerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _mainThreadWorkerMessageHandler(){var t;try{return(null==(t=globalThis.pdfjsWorker)?void 0:t.WorkerMessageHandler)||null}catch(e){return null}}static get _setupFakeWorkerGlobal(){const loader=async()=>{const mainWorkerMessageHandler=this._mainThreadWorkerMessageHandler;if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_is_node.isNodeJS&&"function"==typeof commonjsRequire){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())}};_workerPorts=new WeakMap,__privateAdd(_PDFWorker,_workerPorts,new WeakMap);let PDFWorker=_PDFWorker;exports.PDFWorker=PDFWorker,PDFWorker.getWorkerSrc=function(){return(0,_display_utils.deprecated)("`PDFWorker.getWorkerSrc()`, please use `PDFWorker.workerSrc` instead."),this.workerSrc};class WorkerTransport{constructor(t,e,s,i){__privateAdd(this,_docStats,null),__privateAdd(this,_pageCache,new Map),__privateAdd(this,_pagePromises,new Map),__privateAdd(this,_metadataPromise,null),this.messageHandler=t,this.loadingTask=e,this.commonObjs=new PDFObjects,this.fontLoader=new _font_loader.FontLoader({docId:e.docId,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),ownerDocument:i.ownerDocument,styleElement:i.styleElement}),this._params=i,i.useWorkerFetch||(this.CMapReaderFactory=new i.CMapReaderFactory({baseUrl:i.cMapUrl,isCompressed:i.cMapPacked}),this.StandardFontDataFactory=new i.StandardFontDataFactory({baseUrl:i.standardFontDataUrl})),this.destroyed=!1,this.destroyCapability=null,this._passwordCapability=null,this._networkStream=s,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=(0,_util.createPromiseCapability)(),this.setupMessageHandler()}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}get stats(){return __privateGet(this,_docStats)}getRenderingIntent(t,e=_util.AnnotationMode.ENABLE,s=null,i=!1){let a=_util.RenderingIntentFlag.DISPLAY,r=null;switch(t){case"any":a=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":a=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${t}`)}switch(e){case _util.AnnotationMode.DISABLE:a+=_util.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case _util.AnnotationMode.ENABLE:break;case _util.AnnotationMode.ENABLE_FORMS:a+=_util.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case _util.AnnotationMode.ENABLE_STORAGE:a+=_util.RenderingIntentFlag.ANNOTATIONS_STORAGE,r=(a&_util.RenderingIntentFlag.PRINT&&s instanceof _annotation_storage.PrintAnnotationStorage?s:this.annotationStorage).serializable;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${e}`)}return i&&(a+=_util.RenderingIntentFlag.OPLIST),{renderingIntent:a,cacheKey:`${a}_${_annotation_storage.AnnotationStorage.getHash(r)}`,annotationStorageMap:r}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=(0,_util.createPromiseCapability)(),this._passwordCapability&&this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const s of __privateGet(this,_pageCache).values())t.push(s._destroy());__privateGet(this,_pageCache).clear(),__privateGet(this,_pagePromises).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),__privateSet(this,_metadataPromise,null),this._getFieldObjectsPromise=null,this._hasJSActionsPromise=null,this._networkStream&&this._networkStream.cancelAllRequests(new _util.AbortException("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(t,e)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=t=>{this._lastProgress={loaded:t.loaded,total:t.total}},e.onPull=()=>{this._fullReader.read().then(function({value:t,done:s}){s?e.close():((0,_util.assert)((0,_util.isArrayBuffer)(t),"GetReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(t),1,[t]))}).catch(t=>{e.error(t)})},e.onCancel=t=>{this._fullReader.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}}),t.on("ReaderHeadersReady",t=>{const s=(0,_util.createPromiseCapability)(),i=this._fullReader;return i.headersReady.then(()=>{var t;i.isStreamingSupported&&i.isRangeSupported||(this._lastProgress&&(null==(t=e.onProgress)||t.call(e,this._lastProgress)),i.onProgress=t=>{var s;null==(s=e.onProgress)||s.call(e,{loaded:t.loaded,total:t.total})}),s.resolve({isStreamingSupported:i.isStreamingSupported,isRangeSupported:i.isRangeSupported,contentLength:i.contentLength})},s.reject),s.promise}),t.on("GetRangeReader",(t,e)=>{(0,_util.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const s=this._networkStream.getRangeReader(t.begin,t.end);s?(e.onPull=()=>{s.read().then(function({value:t,done:s}){s?e.close():((0,_util.assert)((0,_util.isArrayBuffer)(t),"GetRangeReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(t),1,[t]))}).catch(t=>{e.error(t)})},e.onCancel=t=>{s.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}):e.close()}),t.on("GetDoc",({pdfInfo:t})=>{this._numPages=t.numPages,this._htmlForXfa=t.htmlForXfa,delete t.htmlForXfa,e._capability.resolve(new PDFDocumentProxy(t,this))}),t.on("DocException",function(t){let s;switch(t.name){case"PasswordException":s=new _util.PasswordException(t.message,t.code);break;case"InvalidPDFException":s=new _util.InvalidPDFException(t.message);break;case"MissingPDFException":s=new _util.MissingPDFException(t.message);break;case"UnexpectedResponseException":s=new _util.UnexpectedResponseException(t.message,t.status);break;case"UnknownErrorException":s=new _util.UnknownErrorException(t.message,t.details);break;default:(0,_util.unreachable)("DocException - expected a valid Error.")}e._capability.reject(s)}),t.on("PasswordRequest",t=>{if(this._passwordCapability=(0,_util.createPromiseCapability)(),e.onPassword){const i=t=>{t instanceof Error?this._passwordCapability.reject(t):this._passwordCapability.resolve({password:t})};try{e.onPassword(i,t.code)}catch(s){this._passwordCapability.reject(s)}}else this._passwordCapability.reject(new _util.PasswordException(t.message,t.code));return this._passwordCapability.promise}),t.on("DataLoaded",t=>{var s;null==(s=e.onProgress)||s.call(e,{loaded:t.length,total:t.length}),this.downloadInfoCapability.resolve(t)}),t.on("StartRenderPage",t=>{this.destroyed||__privateGet(this,_pageCache).get(t.pageIndex)._startRenderPage(t.transparency,t.cacheKey)}),t.on("commonobj",([e,s,i])=>{var a;if(!this.destroyed&&!this.commonObjs.has(e))switch(s){case"Font":const r=this._params;if("error"in i){const t=i.error;(0,_util.warn)(`Error during font loading: ${t}`),this.commonObjs.resolve(e,t);break}let n=null;r.pdfBug&&(null==(a=globalThis.FontInspector)?void 0:a.enabled)&&(n={registerFont(t,e){globalThis.FontInspector.fontAdded(t,e)}});const o=new _font_loader.FontFaceObject(i,{isEvalSupported:r.isEvalSupported,disableFontFace:r.disableFontFace,ignoreErrors:r.ignoreErrors,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),fontRegistry:n});this.fontLoader.bind(o).catch(s=>t.sendWithPromise("FontFallback",{id:e})).finally(()=>{!r.fontExtraProperties&&o.data&&(o.data=null),this.commonObjs.resolve(e,o)});break;case"FontPath":case"Image":this.commonObjs.resolve(e,i);break;default:throw new Error(`Got unknown common object type ${s}`)}}),t.on("obj",([t,e,s,i])=>{var a;if(this.destroyed)return;const r=__privateGet(this,_pageCache).get(e);if(!r.objs.has(t))switch(s){case"Image":r.objs.resolve(t,i);const e=8e6;if(i){let t;if(i.bitmap){const{bitmap:e,width:s,height:a}=i;t=s*a*4,r._bitmaps.add(e)}else t=(null==(a=i.data)?void 0:a.length)||0;t>e&&(r.cleanupAfterRender=!0)}break;case"Pattern":r.objs.resolve(t,i);break;default:throw new Error(`Got unknown object type ${s}`)}}),t.on("DocProgress",t=>{var s;this.destroyed||null==(s=e.onProgress)||s.call(e,{loaded:t.loaded,total:t.total})}),t.on("DocStats",t=>{this.destroyed||__privateSet(this,_docStats,Object.freeze({streamTypes:Object.freeze(t.streamTypes),fontTypes:Object.freeze(t.fontTypes)}))}),t.on("UnsupportedFeature",this._onUnsupportedFeature.bind(this)),t.on("FetchBuiltInCMap",t=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.CMapReaderFactory?this.CMapReaderFactory.fetch(t):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),t.on("FetchStandardFontData",t=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.StandardFontDataFactory?this.StandardFontDataFactory.fetch(t):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}_onUnsupportedFeature({featureId:t}){var e,s;this.destroyed||null==(s=(e=this.loadingTask).onUnsupportedFeature)||s.call(e,t)}getData(){return this.messageHandler.sendWithPromise("GetData",null)}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const e=t-1,s=__privateGet(this,_pagePromises).get(e);if(s)return s;const i=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(t=>{if(this.destroyed)throw new Error("Transport destroyed");const s=new PDFPageProxy(e,t,this,this._params.ownerDocument,this._params.pdfBug);return __privateGet(this,_pageCache).set(e,s),s});return __privateGet(this,_pagePromises).set(e,i),i}getPageIndex(t){return"object"!=typeof t||null===t||!Number.isInteger(t.num)||t.num<0||!Number.isInteger(t.gen)||t.gen<0?Promise.reject(new Error("Invalid pageIndex request.")):this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen})}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}saveDocument(){var t;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:this.annotationStorage.serializable,filename:(null==(t=this._fullReader)?void 0:t.filename)??null}).finally(()=>{this.annotationStorage.resetModified()})}getFieldObjects(){return this._getFieldObjectsPromise||(this._getFieldObjectsPromise=this.messageHandler.sendWithPromise("GetFieldObjects",null))}hasJSActions(){return this._hasJSActionsPromise||(this._hasJSActionsPromise=this.messageHandler.sendWithPromise("HasJSActions",null))}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return"string"!=typeof t?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getJavaScript(){return this.messageHandler.sendWithPromise("GetJavaScript",null)}getDocJSActions(){return this.messageHandler.sendWithPromise("GetDocJSActions",null)}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then(t=>new _optional_content_config.OptionalContentConfig(t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){return __privateGet(this,_metadataPromise)||__privateSet(this,_metadataPromise,this.messageHandler.sendWithPromise("GetMetadata",null).then(t=>{var e,s;return{info:t[0],metadata:t[1]?new _metadata.Metadata(t[1]):null,contentDispositionFilename:(null==(e=this._fullReader)?void 0:e.filename)??null,contentLength:(null==(s=this._fullReader)?void 0:s.contentLength)??null}}))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(t=!1){if(await this.messageHandler.sendWithPromise("Cleanup",null),!this.destroyed){for(const t of __privateGet(this,_pageCache).values())if(!t.cleanup())throw new Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),__privateSet(this,_metadataPromise,null),this._getFieldObjectsPromise=null,this._hasJSActionsPromise=null}}get loadingParams(){const t=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:t.disableAutoFetch,enableXfa:t.enableXfa})}}_docStats=new WeakMap,_pageCache=new WeakMap,_pagePromises=new WeakMap,_metadataPromise=new WeakMap;class PDFObjects{constructor(){__privateAdd(this,_ensureObj),__privateAdd(this,_objs,Object.create(null))}get(t,e=null){if(e){const s=__privateMethod(this,_ensureObj,ensureObj_fn).call(this,t);return s.capability.promise.then(()=>e(s.data)),null}const s=__privateGet(this,_objs)[t];if(!(null==s?void 0:s.capability.settled))throw new Error(`Requesting object that isn't resolved yet ${t}.`);return s.data}has(t){const e=__privateGet(this,_objs)[t];return(null==e?void 0:e.capability.settled)||!1}resolve(t,e=null){const s=__privateMethod(this,_ensureObj,ensureObj_fn).call(this,t);s.data=e,s.capability.resolve()}clear(){__privateSet(this,_objs,Object.create(null))}}_objs=new WeakMap,_ensureObj=new WeakSet,ensureObj_fn=function(t){const e=__privateGet(this,_objs)[t];return e||(__privateGet(this,_objs)[t]={capability:(0,_util.createPromiseCapability)(),data:null})};class RenderTask{constructor(t){__privateAdd(this,_internalRenderTask,null),__privateSet(this,_internalRenderTask,t),this.onContinue=null}get promise(){return __privateGet(this,_internalRenderTask).capability.promise}cancel(){__privateGet(this,_internalRenderTask).cancel()}get separateAnnots(){const{separateAnnots:t}=__privateGet(this,_internalRenderTask).operatorList;if(!t)return!1;const{annotationCanvasMap:e}=__privateGet(this,_internalRenderTask);return t.form||t.canvas&&(null==e?void 0:e.size)>0}}_internalRenderTask=new WeakMap,exports.RenderTask=RenderTask;const _InternalRenderTask=class t{constructor({callback:t,params:e,objs:s,commonObjs:i,annotationCanvasMap:a,operatorList:r,pageIndex:n,canvasFactory:o,useRequestAnimationFrame:l=!1,pdfBug:c=!1,pageColors:h=null}){this.callback=t,this.params=e,this.objs=s,this.commonObjs=i,this.annotationCanvasMap=a,this.operatorListIdx=null,this.operatorList=r,this._pageIndex=n,this.canvasFactory=o,this._pdfBug=c,this.pageColors=h,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===l&&"undefined"!=typeof window,this.cancelled=!1,this.capability=(0,_util.createPromiseCapability)(),this.task=new RenderTask(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=e.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:s}){var i;if(this.cancelled)return;if(this._canvas){if(__privateGet(t,_canvasInUse).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.");__privateGet(t,_canvasInUse).add(this._canvas)}this._pdfBug&&(null==(i=globalThis.StepperManager)?void 0:i.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:a,viewport:r,transform:n,imageLayer:o,background:l}=this.params;this.gfx=new _canvas.CanvasGraphics(a,this.commonObjs,this.objs,this.canvasFactory,o,s,this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:n,viewport:r,transparency:e,background:l}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback&&this.graphicsReadyCallback()}cancel(e=null){this.running=!1,this.cancelled=!0,this.gfx&&this.gfx.endDrawing(),this._canvas&&__privateGet(t,_canvasInUse).delete(this._canvas),this.callback(e||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,"canvas"))}operatorListChanged(){this.graphicsReady?(this.stepper&&this.stepper.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound)}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?window.requestAnimationFrame(()=>{this._nextBound().catch(this._cancelBound)}):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),this._canvas&&__privateGet(t,_canvasInUse).delete(this._canvas),this.callback())))}};_canvasInUse=new WeakMap,__privateAdd(_InternalRenderTask,_canvasInUse,new WeakSet);let InternalRenderTask=_InternalRenderTask;const version="2.16.105";exports.version=version;const build="172ccdbe5";exports.build=build},(t,e,s)=>{var i,a,r;Object.defineProperty(e,"__esModule",{value:!0}),e.PrintAnnotationStorage=e.AnnotationStorage=void 0;var n=s(1),o=s(6),l=s(10);class c{constructor(){__privateAdd(this,i),this._storage=new Map,this._modified=!1,this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const s=this._storage.get(t);return void 0===s?e:Object.assign(e,s)}getRawValue(t){return this._storage.get(t)}remove(t){if(this._storage.delete(t),0===this._storage.size&&this.resetModified(),"function"==typeof this.onAnnotationEditor){for(const t of this._storage.values())if(t instanceof o.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(t,e){const s=this._storage.get(t);let r=!1;if(void 0!==s)for(const[i,a]of Object.entries(e))s[i]!==a&&(r=!0,s[i]=a);else r=!0,this._storage.set(t,e);r&&__privateMethod(this,i,a).call(this),e instanceof o.AnnotationEditor&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(e.constructor._type)}has(t){return this._storage.has(t)}getAll(){return this._storage.size>0?(0,n.objectFromMap)(this._storage):null}get size(){return this._storage.size}resetModified(){this._modified&&(this._modified=!1,"function"==typeof this.onResetModified&&this.onResetModified())}get print(){return new h(this)}get serializable(){if(0===this._storage.size)return null;const t=new Map;for(const[e,s]of this._storage){const i=s instanceof o.AnnotationEditor?s.serialize():s;i&&t.set(e,i)}return t}static getHash(t){if(!t)return"";const e=new l.MurmurHash3_64;for(const[s,i]of t)e.update(`${s}:${JSON.stringify(i)}`);return e.hexdigest()}}i=new WeakSet,a=function(){this._modified||(this._modified=!0,"function"==typeof this.onSetModified&&this.onSetModified())},e.AnnotationStorage=c;class h extends c{constructor(t){super(),__privateAdd(this,r,null),__privateSet(this,r,structuredClone(t.serializable))}get print(){(0,n.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return __privateGet(this,r)}}r=new WeakMap,e.PrintAnnotationStorage=h},(t,e,s)=>{var i,a,r,n,o,l;Object.defineProperty(e,"__esModule",{value:!0}),e.AnnotationEditor=void 0;var c=s(7),h=s(1);const d=class t{constructor(e){__privateAdd(this,i,this.focusin.bind(this)),__privateAdd(this,a,this.focusout.bind(this)),__privateAdd(this,r,!1),__privateAdd(this,n,!1),__privateAdd(this,o,!1),__privateAdd(this,l,t._zIndex++),this.constructor===t&&(0,h.unreachable)("Cannot initialize AnnotationEditor."),this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null;const[s,c]=this.parent.viewportBaseDimensions;this.x=e.x/s,this.y=e.y/c,this.rotation=this.parent.viewport.rotation,this.isAttachedToDOM=!1}static get _defaultLineColor(){return(0,h.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=__privateGet(this,l)}focusin(t){__privateGet(this,r)?__privateSet(this,r,!1):this.parent.setSelected(this)}focusout(t){if(!this.isAttachedToDOM)return;const e=t.relatedTarget;(null==e?void 0:e.closest(`#${this.id}`))||(t.preventDefault(),this.parent.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.parent.addToAnnotationStorage(this)}dragstart(t){const e=this.parent.div.getBoundingClientRect();this.startX=t.clientX-e.x,this.startY=t.clientY-e.y,t.dataTransfer.setData("text/plain",this.id),t.dataTransfer.effectAllowed="move"}setAt(t,e,s,i){const[a,r]=this.parent.viewportBaseDimensions;[s,i]=this.screenToPageTranslation(s,i),this.x=(t+s)/a,this.y=(e+i)/r,this.div.style.left=100*this.x+"%",this.div.style.top=100*this.y+"%"}translate(t,e){const[s,i]=this.parent.viewportBaseDimensions;[t,e]=this.screenToPageTranslation(t,e),this.x+=t/s,this.y+=e/i,this.div.style.left=100*this.x+"%",this.div.style.top=100*this.y+"%"}screenToPageTranslation(t,e){const{rotation:s}=this.parent.viewport;switch(s){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}setDims(t,e){const[s,i]=this.parent.viewportBaseDimensions;this.div.style.width=100*t/s+"%",this.div.style.height=100*e/i+"%"}getInitialTranslation(){return[0,0]}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.setAttribute("tabIndex",0),this.setInForeground(),this.div.addEventListener("focusin",__privateGet(this,i)),this.div.addEventListener("focusout",__privateGet(this,a));const[t,e]=this.getInitialTranslation();return this.translate(t,e),(0,c.bindEvents)(this,this.div,["dragstart","pointerdown"]),this.div}pointerdown(t){const e=c.KeyboardManager.platform.isMac;0!==t.button||t.ctrlKey&&e?t.preventDefault():(t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this),__privateSet(this,r,!0))}getRect(t,e){const[s,i]=this.parent.viewportBaseDimensions,[a,r]=this.parent.pageDimensions,n=a*t/s,o=r*e/i,l=this.x*a,c=this.y*r,h=this.width*a,d=this.height*r;switch(this.rotation){case 0:return[l+n,r-c-o-d,l+n+h,r-c-o];case 90:return[l+o,r-c+n,l+o+d,r-c+n+h];case 180:return[l-n-h,r-c+o,l-n,r-c+o+d];case 270:return[l-o-d,r-c-n-h,l-o,r-c-n];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[s,i,a,r]=t,n=a-s,o=r-i;switch(this.rotation){case 0:return[s,e-r,n,o];case 90:return[s,e-i,o,n];case 180:return[a,e-i,n,o];case 270:return[a,e-r,o,n];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){__privateSet(this,o,!0)}disableEditMode(){__privateSet(this,o,!1)}isInEditMode(){return __privateGet(this,o)}shouldGetKeyboardEvents(){return!1}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){var t;null==(t=this.div)||t.addEventListener("focusin",__privateGet(this,i))}serialize(){(0,h.unreachable)("An editor must be serializable")}static deserialize(t,e){const s=new this.prototype.constructor({parent:e,id:e.getNextId()});s.rotation=t.rotation;const[i,a]=e.pageDimensions,[r,n,o,l]=s.getRectInCurrentCoords(t.rect,a);return s.x=r/i,s.y=n/a,s.width=o/i,s.height=l/a,s}remove(){this.div.removeEventListener("focusin",__privateGet(this,i)),this.div.removeEventListener("focusout",__privateGet(this,a)),this.isEmpty()||this.commit(),this.parent.remove(this)}select(){var t;null==(t=this.div)||t.classList.add("selectedEditor")}unselect(){var t;null==(t=this.div)||t.classList.remove("selectedEditor")}updateParams(t,e){}disableEditing(){}enableEditing(){}get propertiesToUpdate(){return{}}get contentDiv(){return this.div}get isEditing(){return __privateGet(this,n)}set isEditing(t){__privateSet(this,n,t),t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null)}};i=new WeakMap,a=new WeakMap,r=new WeakMap,n=new WeakMap,o=new WeakMap,l=new WeakMap,__publicField(d,"_colorManager",new c.ColorManager),__publicField(d,"_zIndex",1);let u=d;e.AnnotationEditor=u},(t,e,s)=>{var i,a,r,n,o,l,c,h,d,u,p,_,f,g,m,v,b,A,y,x,S,w,C,k,T,E,P,M,F,R,D,N,I,O,L,G,j,B,W,U,V,q,z;Object.defineProperty(e,"__esModule",{value:!0}),e.KeyboardManager=e.CommandManager=e.ColorManager=e.AnnotationEditorUIManager=void 0,e.bindEvents=function(t,e,s){for(const i of s)e.addEventListener(i,t[i].bind(t))},e.opacityToHex=function(t){return Math.round(Math.min(255,Math.max(1,255*t))).toString(16).padStart(2,"0")};var H=s(1),$=s(8);class X{constructor(){__privateAdd(this,i,0)}getId(){return`${H.AnnotationEditorPrefix}${__privateWrapper(this,i)._++}`}}i=new WeakMap;class Y{constructor(t=128){__privateAdd(this,a,[]),__privateAdd(this,r,!1),__privateAdd(this,n,void 0),__privateAdd(this,o,-1),__privateSet(this,n,t)}add({cmd:t,undo:e,mustExec:s,type:i=NaN,overwriteIfSameType:l=!1,keepUndo:c=!1}){if(s&&t(),__privateGet(this,r))return;const h={cmd:t,undo:e,type:i};if(-1===__privateGet(this,o))return __privateGet(this,a).length>0&&(__privateGet(this,a).length=0),__privateSet(this,o,0),void __privateGet(this,a).push(h);if(l&&__privateGet(this,a)[__privateGet(this,o)].type===i)return c&&(h.undo=__privateGet(this,a)[__privateGet(this,o)].undo),void(__privateGet(this,a)[__privateGet(this,o)]=h);const d=__privateGet(this,o)+1;d===__privateGet(this,n)?__privateGet(this,a).splice(0,1):(__privateSet(this,o,d),d<__privateGet(this,a).length&&__privateGet(this,a).splice(d)),__privateGet(this,a).push(h)}undo(){-1!==__privateGet(this,o)&&(__privateSet(this,r,!0),__privateGet(this,a)[__privateGet(this,o)].undo(),__privateSet(this,r,!1),__privateSet(this,o,__privateGet(this,o)-1))}redo(){__privateGet(this,o)<__privateGet(this,a).length-1&&(__privateSet(this,o,__privateGet(this,o)+1),__privateSet(this,r,!0),__privateGet(this,a)[__privateGet(this,o)].cmd(),__privateSet(this,r,!1))}hasSomethingToUndo(){return-1!==__privateGet(this,o)}hasSomethingToRedo(){return __privateGet(this,o)<__privateGet(this,a).length-1}destroy(){__privateSet(this,a,null)}}a=new WeakMap,r=new WeakMap,n=new WeakMap,o=new WeakMap,e.CommandManager=Y,l=new WeakSet,c=function(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);const e=this.buffer.join("+");return this.buffer.length=0,e};let K=class t{constructor(e){__privateAdd(this,l),this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const s=t.platform.isMac;for(const[t,i]of e)for(const e of t){const t=e.startsWith("mac+");s&&t?(this.callbacks.set(e.slice(4),i),this.allKeys.add(e.split("+").at(-1))):s||t||(this.callbacks.set(e,i),this.allKeys.add(e.split("+").at(-1)))}}static get platform(){const t="undefined"!=typeof navigator?navigator.platform:"";return(0,H.shadow)(this,"platform",{isWin:t.includes("Win"),isMac:t.includes("Mac")})}exec(t,e){if(!this.allKeys.has(e.key))return;const s=this.callbacks.get(__privateMethod(this,l,c).call(this,e));s&&(s.bind(t)(),e.stopPropagation(),e.preventDefault())}};e.KeyboardManager=K;class J{constructor(){__privateAdd(this,h,null)}copy(t){t&&(Array.isArray(t)?__privateSet(this,h,t.map(t=>t.serialize())):__privateSet(this,h,[t.serialize()]),__privateSet(this,h,__privateGet(this,h).filter(t=>!!t)),0===__privateGet(this,h).length&&__privateSet(this,h,null))}paste(){return __privateGet(this,h)}isEmpty(){return null===__privateGet(this,h)}destroy(){__privateSet(this,h,null)}}h=new WeakMap;const Q=class t{get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return(0,$.getColorValues)(t),(0,H.shadow)(this,"_colors",t)}convert(e){const s=(0,$.getRGB)(e);if(!window.matchMedia("(forced-colors: active)").matches)return s;for(const[i,a]of this._colors)if(a.every((t,e)=>t===s[e]))return t._colorsMapping.get(i);return s}getHexCode(t){const e=this._colors.get(t);return e?H.Util.makeHexColor(...e):t}};__publicField(Q,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let Z=Q;e.ColorManager=Z;const tt=class t{constructor(t,e){__privateAdd(this,E),__privateAdd(this,M),__privateAdd(this,R),__privateAdd(this,N),__privateAdd(this,O),__privateAdd(this,G),__privateAdd(this,B),__privateAdd(this,U),__privateAdd(this,q),__privateAdd(this,d,null),__privateAdd(this,u,new Map),__privateAdd(this,p,new Map),__privateAdd(this,_,new J),__privateAdd(this,f,new Y),__privateAdd(this,g,0),__privateAdd(this,m,null),__privateAdd(this,v,null),__privateAdd(this,b,new X),__privateAdd(this,A,!1),__privateAdd(this,y,H.AnnotationEditorType.NONE),__privateAdd(this,x,new Set),__privateAdd(this,S,this.keydown.bind(this)),__privateAdd(this,w,this.onEditingAction.bind(this)),__privateAdd(this,C,this.onPageChanging.bind(this)),__privateAdd(this,k,{isEditing:!1,isEmpty:!0,hasEmptyClipboard:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1}),__privateAdd(this,T,null),__privateSet(this,T,t),__privateSet(this,v,e),__privateGet(this,v)._on("editingaction",__privateGet(this,w)),__privateGet(this,v)._on("pagechanging",__privateGet(this,C))}destroy(){__privateMethod(this,M,F).call(this),__privateGet(this,v)._off("editingaction",__privateGet(this,w)),__privateGet(this,v)._off("pagechanging",__privateGet(this,C));for(const t of __privateGet(this,p).values())t.destroy();__privateGet(this,p).clear(),__privateGet(this,u).clear(),__privateSet(this,d,null),__privateGet(this,x).clear(),__privateGet(this,_).destroy(),__privateGet(this,f).destroy()}onPageChanging({pageNumber:t}){__privateSet(this,g,t-1)}focusMainContainer(){__privateGet(this,T).focus()}keydown(e){var s;(null==(s=this.getActive())?void 0:s.shouldGetKeyboardEvents())||t._keyboardManager.exec(this,e)}onEditingAction(t){["undo","redo","cut","copy","paste","delete","selectAll"].includes(t.name)&&this[t.name]()}setEditingState(t){t?(__privateMethod(this,E,P).call(this),__privateMethod(this,R,D).call(this,{isEditing:__privateGet(this,y)!==H.AnnotationEditorType.NONE,isEmpty:__privateMethod(this,U,V).call(this),hasSomethingToUndo:__privateGet(this,f).hasSomethingToUndo(),hasSomethingToRedo:__privateGet(this,f).hasSomethingToRedo(),hasSelectedEditor:!1,hasEmptyClipboard:__privateGet(this,_).isEmpty()})):(__privateMethod(this,M,F).call(this),__privateMethod(this,R,D).call(this,{isEditing:!1}))}registerEditorTypes(t){__privateSet(this,m,t);for(const e of __privateGet(this,m))__privateMethod(this,N,I).call(this,e.defaultPropertiesToUpdate)}getId(){return __privateGet(this,b).getId()}addLayer(t){__privateGet(this,p).set(t.pageIndex,t),__privateGet(this,A)?t.enable():t.disable()}removeLayer(t){__privateGet(this,p).delete(t.pageIndex)}updateMode(t){if(__privateSet(this,y,t),t===H.AnnotationEditorType.NONE)this.setEditingState(!1),__privateMethod(this,G,j).call(this);else{this.setEditingState(!0),__privateMethod(this,O,L).call(this);for(const e of __privateGet(this,p).values())e.updateMode(t)}}updateToolbar(t){t!==__privateGet(this,y)&&__privateGet(this,v).dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){for(const s of __privateGet(this,x))s.updateParams(t,e);for(const s of __privateGet(this,m))s.updateDefaultParams(t,e)}getEditors(t){const e=[];for(const s of __privateGet(this,u).values())s.pageIndex===t&&e.push(s);return e}getEditor(t){return __privateGet(this,u).get(t)}addEditor(t){__privateGet(this,u).set(t.id,t)}removeEditor(t){__privateGet(this,u).delete(t.id),this.unselect(t)}setActiveEditor(t){__privateGet(this,d)!==t&&(__privateSet(this,d,t),t&&__privateMethod(this,N,I).call(this,t.propertiesToUpdate))}toggleSelected(t){if(__privateGet(this,x).has(t))return __privateGet(this,x).delete(t),t.unselect(),void __privateMethod(this,R,D).call(this,{hasSelectedEditor:this.hasSelection});__privateGet(this,x).add(t),t.select(),__privateMethod(this,N,I).call(this,t.propertiesToUpdate),__privateMethod(this,R,D).call(this,{hasSelectedEditor:!0})}setSelected(t){for(const e of __privateGet(this,x))e!==t&&e.unselect();__privateGet(this,x).clear(),__privateGet(this,x).add(t),t.select(),__privateMethod(this,N,I).call(this,t.propertiesToUpdate),__privateMethod(this,R,D).call(this,{hasSelectedEditor:!0})}isSelected(t){return __privateGet(this,x).has(t)}unselect(t){t.unselect(),__privateGet(this,x).delete(t),__privateMethod(this,R,D).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==__privateGet(this,x).size}undo(){__privateGet(this,f).undo(),__privateMethod(this,R,D).call(this,{hasSomethingToUndo:__privateGet(this,f).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:__privateMethod(this,U,V).call(this)})}redo(){__privateGet(this,f).redo(),__privateMethod(this,R,D).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:__privateGet(this,f).hasSomethingToRedo(),isEmpty:__privateMethod(this,U,V).call(this)})}addCommands(t){__privateGet(this,f).add(t),__privateMethod(this,R,D).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:__privateMethod(this,U,V).call(this)})}delete(){if(__privateGet(this,d)&&__privateGet(this,d).commitOrRemove(),!this.hasSelection)return;const t=[...__privateGet(this,x)];this.addCommands({cmd:()=>{for(const e of t)e.remove()},undo:()=>{for(const e of t)__privateMethod(this,B,W).call(this,e)},mustExec:!0})}copy(){if(__privateGet(this,d)&&__privateGet(this,d).commitOrRemove(),this.hasSelection){const t=[];for(const e of __privateGet(this,x))e.isEmpty()||t.push(e);if(0===t.length)return;__privateGet(this,_).copy(t),__privateMethod(this,R,D).call(this,{hasEmptyClipboard:!1})}}cut(){this.copy(),this.delete()}paste(){if(__privateGet(this,_).isEmpty())return;this.unselectAll();const t=__privateGet(this,p).get(__privateGet(this,g)),e=__privateGet(this,_).paste().map(e=>t.deserialize(e));this.addCommands({cmd:()=>{for(const t of e)__privateMethod(this,B,W).call(this,t);__privateMethod(this,q,z).call(this,e)},undo:()=>{for(const t of e)t.remove()},mustExec:!0})}selectAll(){for(const t of __privateGet(this,x))t.commit();__privateMethod(this,q,z).call(this,__privateGet(this,u).values())}unselectAll(){if(__privateGet(this,d))__privateGet(this,d).commitOrRemove();else if(0!==__privateMethod(this,q,z).size){for(const t of __privateGet(this,x))t.unselect();__privateGet(this,x).clear(),__privateMethod(this,R,D).call(this,{hasSelectedEditor:!1})}}isActive(t){return __privateGet(this,d)===t}getActive(){return __privateGet(this,d)}getMode(){return __privateGet(this,y)}};d=new WeakMap,u=new WeakMap,p=new WeakMap,_=new WeakMap,f=new WeakMap,g=new WeakMap,m=new WeakMap,v=new WeakMap,b=new WeakMap,A=new WeakMap,y=new WeakMap,x=new WeakMap,S=new WeakMap,w=new WeakMap,C=new WeakMap,k=new WeakMap,T=new WeakMap,E=new WeakSet,P=function(){__privateGet(this,T).addEventListener("keydown",__privateGet(this,S))},M=new WeakSet,F=function(){__privateGet(this,T).removeEventListener("keydown",__privateGet(this,S))},R=new WeakSet,D=function(t){Object.entries(t).some(([t,e])=>__privateGet(this,k)[t]!==e)&&__privateGet(this,v).dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(__privateGet(this,k),t)})},N=new WeakSet,I=function(t){__privateGet(this,v).dispatch("annotationeditorparamschanged",{source:this,details:t})},O=new WeakSet,L=function(){if(!__privateGet(this,A)){__privateSet(this,A,!0);for(const t of __privateGet(this,p).values())t.enable()}},G=new WeakSet,j=function(){if(this.unselectAll(),__privateGet(this,A)){__privateSet(this,A,!1);for(const t of __privateGet(this,p).values())t.disable()}},B=new WeakSet,W=function(t){const e=__privateGet(this,p).get(t.pageIndex);e?e.addOrRebuild(t):this.addEditor(t)},U=new WeakSet,V=function(){if(0===__privateGet(this,u).size)return!0;if(1===__privateGet(this,u).size)for(const t of __privateGet(this,u).values())return t.isEmpty();return!1},q=new WeakSet,z=function(t){__privateGet(this,x).clear();for(const e of t)e.isEmpty()||(__privateGet(this,x).add(e),e.select());__privateMethod(this,R,D).call(this,{hasSelectedEditor:!0})},__publicField(tt,"_keyboardManager",new K([[["ctrl+a","mac+meta+a"],tt.prototype.selectAll],[["ctrl+c","mac+meta+c"],tt.prototype.copy],[["ctrl+v","mac+meta+v"],tt.prototype.paste],[["ctrl+x","mac+meta+x"],tt.prototype.cut],[["ctrl+z","mac+meta+z"],tt.prototype.undo],[["ctrl+y","ctrl+shift+Z","mac+meta+shift+Z"],tt.prototype.redo],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete"],tt.prototype.delete],[["Escape","mac+Escape"],tt.prototype.unselectAll]]));let et=tt;e.AnnotationEditorUIManager=et},(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.StatTimer=e.RenderingCancelledException=e.PixelsPerInch=e.PageViewport=e.PDFDateString=e.DOMStandardFontDataFactory=e.DOMSVGFactory=e.DOMCanvasFactory=e.DOMCMapReaderFactory=e.AnnotationPrefix=void 0,e.deprecated=function(t){console.log("Deprecated API usage: "+t)},e.getColorValues=function(t){const e=document.createElement("span");e.style.visibility="hidden",document.body.append(e);for(const s of t.keys()){e.style.color=s;const i=window.getComputedStyle(e).color;t.set(s,m(i))}e.remove()},e.getCurrentTransform=function(t){const{a:e,b:s,c:i,d:a,e:r,f:n}=t.getTransform();return[e,s,i,a,r,n]},e.getCurrentTransformInverse=function(t){const{a:e,b:s,c:i,d:a,e:r,f:n}=t.getTransform().invertSelf();return[e,s,i,a,r,n]},e.getFilenameFromUrl=function(t){const e=t.indexOf("#"),s=t.indexOf("?"),i=Math.min(e>0?e:t.length,s>0?s:t.length);return t.substring(t.lastIndexOf("/",i)+1,i)},e.getPdfFilenameFromUrl=function(t,e="document.pdf"){if("string"!=typeof t)return e;if(f(t))return(0,a.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const s=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,i=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(t);let r=s.exec(i[1])||s.exec(i[2])||s.exec(i[3]);if(r&&(r=r[0],r.includes("%")))try{r=s.exec(decodeURIComponent(r))[0]}catch(n){}return r||e},e.getRGB=m,e.getXfaPageViewport=function(t,{scale:e=1,rotation:s=0}){const{width:i,height:a}=t.attributes.style,r=[0,0,parseInt(i),parseInt(a)];return new p({viewBox:r,scale:e,rotation:s})},e.isDataScheme=f,e.isPdfFile=function(t){return"string"==typeof t&&/\.pdf$/i.test(t)},e.isValidFetchUrl=g,e.loadScript=function(t,e=!1){return new Promise((s,i)=>{const a=document.createElement("script");a.src=t,a.onload=function(t){e&&a.remove(),s(t)},a.onerror=function(){i(new Error(`Cannot load script at: ${a.src}`))},(document.head||document.documentElement).append(a)})};var i=s(9),a=s(1);e.AnnotationPrefix="pdfjs_internal_id_";const r=class{};__publicField(r,"CSS",96),__publicField(r,"PDF",72),__publicField(r,"PDF_TO_CSS_UNITS",r.CSS/r.PDF);let n,o=r;e.PixelsPerInch=o;class l extends i.BaseCanvasFactory{constructor({ownerDocument:t=globalThis.document}={}){super(),this._document=t}_createCanvas(t,e){const s=this._document.createElement("canvas");return s.width=t,s.height=e,s}}async function c(t,e=!1){if(g(t,document.baseURI)){const s=await fetch(t);if(!s.ok)throw new Error(s.statusText);return e?new Uint8Array(await s.arrayBuffer()):(0,a.stringToBytes)(await s.text())}return new Promise((s,i)=>{const r=new XMLHttpRequest;r.open("GET",t,!0),e&&(r.responseType="arraybuffer"),r.onreadystatechange=()=>{if(r.readyState===XMLHttpRequest.DONE){if(200===r.status||0===r.status){let t;if(e&&r.response?t=new Uint8Array(r.response):!e&&r.responseText&&(t=(0,a.stringToBytes)(r.responseText)),t)return void s(t)}i(new Error(r.statusText))}},r.send(null)})}e.DOMCanvasFactory=l;class h extends i.BaseCMapReaderFactory{_fetchData(t,e){return c(t,this.isCompressed).then(t=>({cMapData:t,compressionType:e}))}}e.DOMCMapReaderFactory=h;class d extends i.BaseStandardFontDataFactory{_fetchData(t){return c(t,!0)}}e.DOMStandardFontDataFactory=d;class u extends i.BaseSVGFactory{_createSVG(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}}e.DOMSVGFactory=u;class p{constructor({viewBox:t,scale:e,rotation:s,offsetX:i=0,offsetY:a=0,dontFlip:r=!1}){this.viewBox=t,this.scale=e,this.rotation=s,this.offsetX=i,this.offsetY=a;const n=(t[2]+t[0])/2,o=(t[3]+t[1])/2;let l,c,h,d,u,p,_,f;switch((s%=360)<0&&(s+=360),s){case 180:l=-1,c=0,h=0,d=1;break;case 90:l=0,c=1,h=1,d=0;break;case 270:l=0,c=-1,h=-1,d=0;break;case 0:l=1,c=0,h=0,d=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}r&&(h=-h,d=-d),0===l?(u=Math.abs(o-t[1])*e+i,p=Math.abs(n-t[0])*e+a,_=Math.abs(t[3]-t[1])*e,f=Math.abs(t[2]-t[0])*e):(u=Math.abs(n-t[0])*e+i,p=Math.abs(o-t[1])*e+a,_=Math.abs(t[2]-t[0])*e,f=Math.abs(t[3]-t[1])*e),this.transform=[l*e,c*e,h*e,d*e,u-l*e*n-h*e*o,p-c*e*n-d*e*o],this.width=_,this.height=f}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:s=this.offsetX,offsetY:i=this.offsetY,dontFlip:a=!1}={}){return new p({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:s,offsetY:i,dontFlip:a})}convertToViewportPoint(t,e){return a.Util.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){const e=a.Util.applyTransform([t[0],t[1]],this.transform),s=a.Util.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],s[0],s[1]]}convertToPdfPoint(t,e){return a.Util.applyInverseTransform([t,e],this.transform)}}e.PageViewport=p;class _ extends a.BaseException{constructor(t,e){super(t,"RenderingCancelledException"),this.type=e}}function f(t){const e=t.length;let s=0;for(;s<e&&""===t[s].trim();)s++;return"data:"===t.substring(s,s+5).toLowerCase()}function g(t,e){try{const{protocol:s}=e?new URL(t,e):new URL(t);return"http:"===s||"https:"===s}catch(s){return!1}}function m(t){if(t.startsWith("#")){const e=parseInt(t.slice(1),16);return[(16711680&e)>>16,(65280&e)>>8,255&e]}return t.startsWith("rgb(")?t.slice(4,-1).split(",").map(t=>parseInt(t)):t.startsWith("rgba(")?t.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):((0,a.warn)(`Not a valid color format: "${t}"`),[0,0,0])}e.RenderingCancelledException=_,e.StatTimer=class{constructor(){this.started=Object.create(null),this.times=[]}time(t){t in this.started&&(0,a.warn)(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||(0,a.warn)(`Timer has not been started for ${t}`),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){const t=[];let e=0;for(const s of this.times){const t=s.name;t.length>e&&(e=t.length)}for(const s of this.times){const i=s.end-s.start;t.push(`${s.name.padEnd(e)} ${i}ms\n`)}return t.join("")}},e.PDFDateString=class{static toDateObject(t){if(!t||"string"!=typeof t)return null;n||(n=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const e=n.exec(t);if(!e)return null;const s=parseInt(e[1],10);let i=parseInt(e[2],10);i=i>=1&&i<=12?i-1:0;let a=parseInt(e[3],10);a=a>=1&&a<=31?a:1;let r=parseInt(e[4],10);r=r>=0&&r<=23?r:0;let o=parseInt(e[5],10);o=o>=0&&o<=59?o:0;let l=parseInt(e[6],10);l=l>=0&&l<=59?l:0;const c=e[7]||"Z";let h=parseInt(e[8],10);h=h>=0&&h<=23?h:0;let d=parseInt(e[9],10)||0;return d=d>=0&&d<=59?d:0,"-"===c?(r+=h,o+=d):"+"===c&&(r-=h,o-=d),new Date(Date.UTC(s,i,a,r,o,l))}}},(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BaseStandardFontDataFactory=e.BaseSVGFactory=e.BaseCanvasFactory=e.BaseCMapReaderFactory=void 0;var i=s(1);class a{constructor(){this.constructor===a&&(0,i.unreachable)("Cannot initialize BaseCanvasFactory.")}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const s=this._createCanvas(t,e);return{canvas:s,context:s.getContext("2d")}}reset(t,e,s){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||s<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=s}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){(0,i.unreachable)("Abstract method `_createCanvas` called.")}}e.BaseCanvasFactory=a;class r{constructor({baseUrl:t=null,isCompressed:e=!1}){this.constructor===r&&(0,i.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=t,this.isCompressed=e}async fetch({name:t}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!t)throw new Error("CMap name must be specified.");const e=this.baseUrl+t+(this.isCompressed?".bcmap":""),s=this.isCompressed?i.CMapCompressionType.BINARY:i.CMapCompressionType.NONE;return this._fetchData(e,s).catch(t=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${e}`)})}_fetchData(t,e){(0,i.unreachable)("Abstract method `_fetchData` called.")}}e.BaseCMapReaderFactory=r;class n{constructor({baseUrl:t=null}){this.constructor===n&&(0,i.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=t}async fetch({filename:t}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!t)throw new Error("Font filename must be specified.");const e=`${this.baseUrl}${t}`;return this._fetchData(e).catch(t=>{throw new Error(`Unable to load font data at: ${e}`)})}_fetchData(t){(0,i.unreachable)("Abstract method `_fetchData` called.")}}e.BaseStandardFontDataFactory=n;class o{constructor(){this.constructor===o&&(0,i.unreachable)("Cannot initialize BaseSVGFactory.")}create(t,e,s=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const i=this._createSVG("svg:svg");return i.setAttribute("version","1.1"),s||(i.setAttribute("width",`${t}px`),i.setAttribute("height",`${e}px`)),i.setAttribute("preserveAspectRatio","none"),i.setAttribute("viewBox",`0 0 ${t} ${e}`),i}createElement(t){if("string"!=typeof t)throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){(0,i.unreachable)("Abstract method `_createSVG` called.")}}e.BaseSVGFactory=o},(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MurmurHash3_64=void 0;var i=s(1);const a=3285377520,r=4294901760,n=65535;e.MurmurHash3_64=class{constructor(t){this.h1=t?4294967295&t:a,this.h2=t?4294967295&t:a}update(t){let e,s;if("string"==typeof t){e=new Uint8Array(2*t.length),s=0;for(let i=0,a=t.length;i<a;i++){const a=t.charCodeAt(i);a<=255?e[s++]=a:(e[s++]=a>>>8,e[s++]=255&a)}}else{if(!(0,i.isArrayBuffer)(t))throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");e=t.slice(),s=e.byteLength}const a=s>>2,o=s-4*a,l=new Uint32Array(e.buffer,0,a);let c=0,h=0,d=this.h1,u=this.h2;const p=3432918353,_=461845907,f=11601,g=13715;for(let i=0;i<a;i++)1&i?(c=l[i],c=c*p&r|c*f&n,c=c<<15|c>>>17,c=c*_&r|c*g&n,d^=c,d=d<<13|d>>>19,d=5*d+3864292196):(h=l[i],h=h*p&r|h*f&n,h=h<<15|h>>>17,h=h*_&r|h*g&n,u^=h,u=u<<13|u>>>19,u=5*u+3864292196);switch(c=0,o){case 3:c^=e[4*a+2]<<16;case 2:c^=e[4*a+1]<<8;case 1:c^=e[4*a],c=c*p&r|c*f&n,c=c<<15|c>>>17,c=c*_&r|c*g&n,1&a?d^=c:u^=c}this.h1=d,this.h2=u}hexdigest(){let t=this.h1,e=this.h2;t^=e>>>1,t=3981806797*t&r|36045*t&n,e=4283543511*e&r|(2950163797*(e<<16|t>>>16)&r)>>>16,t^=e>>>1,t=444984403*t&r|60499*t&n,e=3301882366*e&r|(3120437893*(e<<16|t>>>16)&r)>>>16,t^=e>>>1;const s=(t>>>0).toString(16),i=(e>>>0).toString(16);return s.padStart(8,"0")+i.padStart(8,"0")}}},(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FontLoader=e.FontFaceObject=void 0;var i=s(1);class a{constructor({docId:t,onUnsupportedFeature:e,ownerDocument:s=globalThis.document,styleElement:r=null}){this.constructor===a&&(0,i.unreachable)("Cannot initialize BaseFontLoader."),this.docId=t,this._onUnsupportedFeature=e,this._document=s,this.nativeFontFaces=[],this.styleElement=null}addNativeFontFace(t){this.nativeFontFaces.push(t),this._document.fonts.add(t)}insertRule(t){let e=this.styleElement;e||(e=this.styleElement=this._document.createElement("style"),e.id=`PDFJS_FONT_STYLE_TAG_${this.docId}`,this._document.documentElement.getElementsByTagName("head")[0].append(e));const s=e.sheet;s.insertRule(t,s.cssRules.length)}clear(){for(const t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.length=0,this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async bind(t){if(t.attached||t.missingFile)return;if(t.attached=!0,this.isFontLoadingAPISupported){const e=t.createNativeFontFace();if(e){this.addNativeFontFace(e);try{await e.loaded}catch(s){throw this._onUnsupportedFeature({featureId:i.UNSUPPORTED_FEATURES.errorFontLoadNative}),(0,i.warn)(`Failed to load font '${e.family}': '${s}'.`),t.disableFontFace=!0,s}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(s=>{const i=this._queueLoadingCallback(s);this._prepareFontLoadEvent([e],[t],i)})}}_queueLoadingCallback(t){(0,i.unreachable)("Abstract method `_queueLoadingCallback`.")}get isFontLoadingAPISupported(){var t;const e=!!(null==(t=this._document)?void 0:t.fonts);return(0,i.shadow)(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){(0,i.unreachable)("Abstract method `isSyncFontLoadingSupported`.")}get _loadTestFont(){(0,i.unreachable)("Abstract method `_loadTestFont`.")}_prepareFontLoadEvent(t,e,s){(0,i.unreachable)("Abstract method `_prepareFontLoadEvent`.")}}let r;e.FontLoader=r,e.FontLoader=r=class extends a{constructor(t){super(t),this.loadingContext={requests:[],nextRequestId:0},this.loadTestFontId=0}get isSyncFontLoadingSupported(){let t=!1;if("undefined"==typeof navigator)t=!0;else{const e=/Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent);(null==e?void 0:e[1])>=14&&(t=!0)}return(0,i.shadow)(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){const e=this.loadingContext,s={id:"pdfjs-font-loading-"+e.nextRequestId++,done:!1,complete:function(){for((0,i.assert)(!s.done,"completeRequest() cannot be called twice."),s.done=!0;e.requests.length>0&&e.requests[0].done;){const t=e.requests.shift();setTimeout(t.callback,0)}},callback:t};return e.requests.push(s),s}get _loadTestFont(){return(0,i.shadow)(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(t,e,s){function a(t,e){return t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|255&t.charCodeAt(e+3)}function r(t,e,s,i){return t.substring(0,e)+i+t.substring(e+s)}let n,o;const l=this._document.createElement("canvas");l.width=1,l.height=1;const c=l.getContext("2d");let h=0;const d=`lt${Date.now()}${this.loadTestFontId++}`;let u=this._loadTestFont;u=r(u,976,d.length,d);const p=1482184792;let _=a(u,16);for(n=0,o=d.length-3;n<o;n+=4)_=_-p+a(d,n)|0;n<d.length&&(_=_-p+a(d+"XXX",n)|0),u=r(u,16,4,(0,i.string32)(_));const f=`@font-face {font-family:"${d}";src:url(data:font/opentype;base64,${btoa(u)});}`;this.insertRule(f);const g=[];for(const i of e)g.push(i.loadedName);g.push(d);const m=this._document.createElement("div");m.style.visibility="hidden",m.style.width=m.style.height="10px",m.style.position="absolute",m.style.top=m.style.left="0px";for(const i of g){const t=this._document.createElement("span");t.textContent="Hi",t.style.fontFamily=i,m.append(t)}this._document.body.append(m),function t(e,s){if(h++,h>30)return(0,i.warn)("Load test font never loaded."),void s();c.font="30px "+e,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0?s():setTimeout(t.bind(null,e,s))}(d,()=>{m.remove(),s.complete()})}},e.FontFaceObject=class{constructor(t,{isEvalSupported:e=!0,disableFontFace:s=!1,ignoreErrors:i=!1,onUnsupportedFeature:a,fontRegistry:r=null}){this.compiledGlyphs=Object.create(null);for(const n in t)this[n]=t[n];this.isEvalSupported=!1!==e,this.disableFontFace=!0===s,this.ignoreErrors=!0===i,this._onUnsupportedFeature=a,this.fontRegistry=r}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let t;if(this.cssFontInfo){const e={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(e.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,e)}else t=new FontFace(this.loadedName,this.data,{});return this.fontRegistry&&this.fontRegistry.registerFont(this),t}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const t=(0,i.bytesToString)(this.data),e=`url(data:${this.mimetype};base64,${btoa(t)});`;let s;if(this.cssFontInfo){let t=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(t+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),s=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${t}src:${e}}`}else s=`@font-face {font-family:"${this.loadedName}";src:${e}}`;return this.fontRegistry&&this.fontRegistry.registerFont(this,e),s}getPathGenerator(t,e){if(void 0!==this.compiledGlyphs[e])return this.compiledGlyphs[e];let s;try{s=t.get(this.loadedName+"_path_"+e)}catch(a){if(!this.ignoreErrors)throw a;return this._onUnsupportedFeature({featureId:i.UNSUPPORTED_FEATURES.errorFontGetPath}),(0,i.warn)(`getPathGenerator - ignoring character: "${a}".`),this.compiledGlyphs[e]=function(t,e){}}if(this.isEvalSupported&&i.FeatureTest.isEvalSupported){const t=[];for(const e of s){const s=void 0!==e.args?e.args.join(","):"";t.push("c.",e.cmd,"(",s,");\n")}return this.compiledGlyphs[e]=new Function("c","size",t.join(""))}return this.compiledGlyphs[e]=function(t,e){for(const i of s)"scale"===i.cmd&&(i.args=[e,-e]),t[i.cmd].apply(t,i.args)}}}},(t,e,s)=>{var i,a;Object.defineProperty(e,"__esModule",{value:!0}),e.CanvasGraphics=void 0;var r=s(8),n=s(1),o=s(13),l=s(14),c=s(3);const h=4096,d=c.isNodeJS&&"undefined"==typeof Path2D?-1:1e3,u=16;class p{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,s){let i;return void 0!==this.cache[t]?(i=this.cache[t],this.canvasFactory.reset(i,e,s)):(i=this.canvasFactory.create(e,s),this.cache[t]=i),i}delete(t){delete this.cache[t]}clear(){for(const t in this.cache){const e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}}function _(t,e,s,i,a,n,o,l,c,h){const[d,u,p,_,f,g]=(0,r.getCurrentTransform)(t);if(0===u&&0===p){const r=o*d+f,m=Math.round(r),v=l*_+g,b=Math.round(v),A=(o+c)*d+f,y=Math.abs(Math.round(A)-m)||1,x=(l+h)*_+g,S=Math.abs(Math.round(x)-b)||1;return t.setTransform(Math.sign(d),0,0,Math.sign(_),m,b),t.drawImage(e,s,i,a,n,0,0,y,S),t.setTransform(d,u,p,_,f,g),[y,S]}if(0===d&&0===_){const r=l*p+f,m=Math.round(r),v=o*u+g,b=Math.round(v),A=(l+h)*p+f,y=Math.abs(Math.round(A)-m)||1,x=(o+c)*u+g,S=Math.abs(Math.round(x)-b)||1;return t.setTransform(0,Math.sign(u),Math.sign(p),0,m,b),t.drawImage(e,s,i,a,n,0,0,S,y),t.setTransform(d,u,p,_,f,g),[S,y]}return t.drawImage(e,s,i,a,n,o,l,c,h),[Math.hypot(d,u)*c,Math.hypot(p,_)*h]}class f{constructor(t,e){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=null,this.startNewPathAndClipBox([0,0,t,e])}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t}setCurrentPoint(t,e){this.x=t,this.y=e}updatePathMinMax(t,e,s){[e,s]=n.Util.applyTransform([e,s],t),this.minX=Math.min(this.minX,e),this.minY=Math.min(this.minY,s),this.maxX=Math.max(this.maxX,e),this.maxY=Math.max(this.maxY,s)}updateRectMinMax(t,e){const s=n.Util.applyTransform(e,t),i=n.Util.applyTransform(e.slice(2),t);this.minX=Math.min(this.minX,s[0],i[0]),this.minY=Math.min(this.minY,s[1],i[1]),this.maxX=Math.max(this.maxX,s[0],i[0]),this.maxY=Math.max(this.maxY,s[1],i[1])}updateScalingPathMinMax(t,e){n.Util.scaleMinMax(t,e),this.minX=Math.min(this.minX,e[0]),this.maxX=Math.max(this.maxX,e[1]),this.minY=Math.min(this.minY,e[2]),this.maxY=Math.max(this.maxY,e[3])}updateCurvePathMinMax(t,e,s,i,a,r,o,l,c,h){const d=n.Util.bezierBoundingBox(e,s,i,a,r,o,l,c);if(h)return h[0]=Math.min(h[0],d[0],d[2]),h[1]=Math.max(h[1],d[0],d[2]),h[2]=Math.min(h[2],d[1],d[3]),void(h[3]=Math.max(h[3],d[1],d[3]));this.updateRectMinMax(t,d)}getPathBoundingBox(t=o.PathType.FILL,e=null){const s=[this.minX,this.minY,this.maxX,this.maxY];if(t===o.PathType.STROKE){e||(0,n.unreachable)("Stroke bounding box must include transform.");const t=n.Util.singularValueDecompose2dScale(e),i=t[0]*this.lineWidth/2,a=t[1]*this.lineWidth/2;s[0]-=i,s[1]-=a,s[2]+=i,s[3]+=a}return s}updateClipFromPath(){const t=n.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(t){this.clipBox=t,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(t=o.PathType.FILL,e=null){return n.Util.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function g(t,e,s=null){if("undefined"!=typeof ImageData&&e instanceof ImageData)return void t.putImageData(e,0,0);const i=e.height,a=e.width,r=i%u,o=(i-r)/u,l=0===r?o:o+1,c=t.createImageData(a,u);let h,d=0;const p=e.data,_=c.data;let f,g,m,v,b,A,y,x;if(s)switch(s.length){case 1:b=s[0],A=s[0],y=s[0],x=s[0];break;case 4:b=s[0],A=s[1],y=s[2],x=s[3]}if(e.kind===n.ImageKind.GRAYSCALE_1BPP){const e=p.byteLength,s=new Uint32Array(_.buffer,0,_.byteLength>>2),i=s.length,v=a+7>>3;let b=4294967295,A=n.FeatureTest.isLittleEndian?4278190080:255;for(x&&255===x[0]&&0===x[255]&&([b,A]=[A,b]),f=0;f<l;f++){for(m=f<o?u:r,h=0,g=0;g<m;g++){const t=e-d;let i=0;const r=t>v?a:8*t-7,n=-8&r;let o=0,l=0;for(;i<n;i+=8)l=p[d++],s[h++]=128&l?b:A,s[h++]=64&l?b:A,s[h++]=32&l?b:A,s[h++]=16&l?b:A,s[h++]=8&l?b:A,s[h++]=4&l?b:A,s[h++]=2&l?b:A,s[h++]=1&l?b:A;for(;i<r;i++)0===o&&(l=p[d++],o=128),s[h++]=l&o?b:A,o>>=1}for(;h<i;)s[h++]=0;t.putImageData(c,0,f*u)}}else if(e.kind===n.ImageKind.RGBA_32BPP){const e=!!(b||A||y);for(g=0,v=a*u*4,f=0;f<o;f++){if(_.set(p.subarray(d,d+v)),d+=v,e)for(let t=0;t<v;t+=4)b&&(_[t+0]=b[_[t+0]]),A&&(_[t+1]=A[_[t+1]]),y&&(_[t+2]=y[_[t+2]]);t.putImageData(c,0,g),g+=u}if(f<l){if(v=a*r*4,_.set(p.subarray(d,d+v)),e)for(let t=0;t<v;t+=4)b&&(_[t+0]=b[_[t+0]]),A&&(_[t+1]=A[_[t+1]]),y&&(_[t+2]=y[_[t+2]]);t.putImageData(c,0,g)}}else{if(e.kind!==n.ImageKind.RGB_24BPP)throw new Error(`bad image kind: ${e.kind}`);{const e=!!(b||A||y);for(m=u,v=a*m,f=0;f<l;f++){for(f>=o&&(m=r,v=a*m),h=0,g=v;g--;)_[h++]=p[d++],_[h++]=p[d++],_[h++]=p[d++],_[h++]=255;if(e)for(let t=0;t<h;t+=4)b&&(_[t+0]=b[_[t+0]]),A&&(_[t+1]=A[_[t+1]]),y&&(_[t+2]=y[_[t+2]]);t.putImageData(c,0,f*u)}}}}function m(t,e){if(e.bitmap)return void t.drawImage(e.bitmap,0,0);const s=e.height,i=e.width,a=s%u,r=(s-a)/u,n=0===a?r:r+1,o=t.createImageData(i,u);let c=0;const h=e.data,d=o.data;for(let p=0;p<n;p++){const e=p<r?u:a;({srcPos:c}=(0,l.applyMaskImageData)({src:h,srcPos:c,dest:d,width:i,height:e})),t.putImageData(o,0,p*u)}}function v(t,e){const s=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font"];for(let i=0,a=s.length;i<a;i++){const a=s[i];void 0!==t[a]&&(e[a]=t[a])}void 0!==t.setLineDash&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function b(t,e){t.strokeStyle=t.fillStyle=e||"#000000",t.fillRule="nonzero",t.globalAlpha=1,t.lineWidth=1,t.lineCap="butt",t.lineJoin="miter",t.miterLimit=10,t.globalCompositeOperation="source-over",t.font="10px sans-serif",void 0!==t.setLineDash&&(t.setLineDash([]),t.lineDashOffset=0)}function A(t,e,s,i){const a=t.length;for(let r=3;r<a;r+=4){const a=t[r];if(0===a)t[r-3]=e,t[r-2]=s,t[r-1]=i;else if(a<255){const n=255-a;t[r-3]=t[r-3]*a+e*n>>8,t[r-2]=t[r-2]*a+s*n>>8,t[r-1]=t[r-1]*a+i*n>>8}}}function y(t,e,s){const i=t.length,a=1/255;for(let r=3;r<i;r+=4){const i=s?s[t[r]]:t[r];e[r]=e[r]*i*a|0}}function x(t,e,s){const i=t.length;for(let a=3;a<i;a+=4){const i=77*t[a-3]+152*t[a-2]+28*t[a-1];e[a]=s?e[a]*s[i>>8]>>8:e[a]*i>>16}}function S(t,e,s,i){const a=i[0],r=i[1],n=i[2]-a,o=i[3]-r;0!==n&&0!==o&&(function(t,e,s,i,a,r,n,o,l,c,h){const d=!!r,u=d?r[0]:0,p=d?r[1]:0,_=d?r[2]:0;let f;f="Luminosity"===a?x:y;const g=Math.min(i,Math.ceil(1048576/s));for(let m=0;m<i;m+=g){const a=Math.min(g,i-m),r=t.getImageData(o-c,m+(l-h),s,a),v=e.getImageData(o,m+l,s,a);d&&A(r.data,u,p,_),f(r.data,v.data,n),e.putImageData(v,o,m+l)}}(e.context,s,n,o,e.subtype,e.backdrop,e.transferMap,a,r,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(s.canvas,0,0),t.restore())}function w(t,e){const s=n.Util.singularValueDecompose2dScale(t);s[0]=Math.fround(s[0]),s[1]=Math.fround(s[1]);const i=Math.fround((globalThis.devicePixelRatio||1)*r.PixelsPerInch.PDF_TO_CSS_UNITS);return void 0!==e?e:s[0]<=i||s[1]<=i}const C=["butt","round","square"],k=["miter","round","bevel"],T={},E={};i=new WeakSet,a=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)};let P=class t{constructor(t,e,s,a,r,n,o,l){__privateAdd(this,i),this.ctx=t,this.current=new f(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=e,this.objs=s,this.canvasFactory=a,this.imageLayer=r,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=[],this.optionalContentConfig=n,this.cachedCanvases=new p(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=o,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.backgroundColor=(null==l?void 0:l.background)||null,this.foregroundColor=(null==l?void 0:l.foreground)||null,this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(t,e=null){return"string"==typeof t?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):e}beginDrawing({transform:t,viewport:e,transparency:s=!1,background:i=null}){const a=this.ctx.canvas.width,n=this.ctx.canvas.height,o=i||"#ffffff";if(this.ctx.save(),this.foregroundColor&&this.backgroundColor){this.ctx.fillStyle=this.foregroundColor;const t=this.foregroundColor=this.ctx.fillStyle;this.ctx.fillStyle=this.backgroundColor;const e=this.backgroundColor=this.ctx.fillStyle;let s=!0,i=o;if(this.ctx.fillStyle=o,i=this.ctx.fillStyle,s="string"==typeof i&&/^#[0-9A-Fa-f]{6}$/.test(i),"#000000"===t&&"#ffffff"===e||t===e||!s)this.foregroundColor=this.backgroundColor=null;else{const[s,a,n]=(0,r.getRGB)(i),o=t=>(t/=255)<=.03928?t/12.92:((t+.055)/1.055)**2.4,l=Math.round(.2126*o(s)+.7152*o(a)+.0722*o(n));this.selectColor=(s,i,a)=>{const r=.2126*o(s)+.7152*o(i)+.0722*o(a);return Math.round(r)===l?e:t}}}if(this.ctx.fillStyle=this.backgroundColor||o,this.ctx.fillRect(0,0,a,n),this.ctx.restore(),s){const t=this.cachedCanvases.getCanvas("transparent",a,n);this.compositeCtx=this.ctx,this.transparentCanvas=t.canvas,this.ctx=t.context,this.ctx.save(),this.ctx.transform(...(0,r.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),b(this.ctx,this.foregroundColor),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[0]),this.ctx.transform(...e.transform),this.viewportScale=e.scale,this.baseTransform=(0,r.getCurrentTransform)(this.ctx),this.imageLayer&&((0,r.deprecated)("The `imageLayer` functionality will be removed in the future."),this.imageLayer.beginLayout())}executeOperatorList(t,e,s,i){const a=t.argsArray,r=t.fnArray;let o=e||0;const l=a.length;if(l===o)return o;const c=l-o>10&&"function"==typeof s,h=c?Date.now()+15:0;let d=0;const u=this.commonObjs,p=this.objs;let _;for(;;){if(void 0!==i&&o===i.nextBreakPoint)return i.breakIt(o,s),o;if(_=r[o],_!==n.OPS.dependency)this[_].apply(this,a[o]);else for(const t of a[o]){const e=t.startsWith("g_")?u:p;if(!e.has(t))return e.get(t,s),o}if(o++,o===l)return o;if(c&&++d>10){if(Date.now()>h)return s(),o;d=0}}}endDrawing(){__privateMethod(this,i,a).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const e of t.values())"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),this.imageLayer&&this.imageLayer.endLayout()}_scaleImage(t,e){const s=t.width,i=t.height;let a,r,n=Math.max(Math.hypot(e[0],e[1]),1),o=Math.max(Math.hypot(e[2],e[3]),1),l=s,c=i,h="prescale1";for(;n>2&&l>1||o>2&&c>1;){let e=l,s=c;n>2&&l>1&&(e=Math.ceil(l/2),n/=l/e),o>2&&c>1&&(s=Math.ceil(c/2),o/=c/s),a=this.cachedCanvases.getCanvas(h,e,s),r=a.context,r.clearRect(0,0,e,s),r.drawImage(t,0,0,l,c,0,0,e,s),t=a.canvas,l=e,c=s,h="prescale1"===h?"prescale2":"prescale1"}return{img:t,paintWidth:l,paintHeight:c}}_createMaskCanvas(t){const e=this.ctx,{width:s,height:i}=t,a=this.current.fillColor,l=this.current.patternFill,c=(0,r.getCurrentTransform)(e);let h,d,u,p;if((t.bitmap||t.data)&&t.count>1){const e=t.bitmap||t.data.buffer,s=c.slice(0,4);d=JSON.stringify(l?s:[s,a]),h=this._cachedBitmapsMap.get(e),h||(h=new Map,this._cachedBitmapsMap.set(e,h));const i=h.get(d);if(i&&!l)return{canvas:i,offsetX:Math.round(Math.min(c[0],c[2])+c[4]),offsetY:Math.round(Math.min(c[1],c[3])+c[5])};u=i}u||(p=this.cachedCanvases.getCanvas("maskCanvas",s,i),m(p.context,t));let f=n.Util.transform(c,[1/s,0,0,-1/i,0,0]);f=n.Util.transform(f,[1,0,0,1,0,-i]);const g=n.Util.applyTransform([0,0],f),v=n.Util.applyTransform([s,i],f),b=n.Util.normalizeRect([g[0],g[1],v[0],v[1]]),A=Math.round(b[2]-b[0])||1,y=Math.round(b[3]-b[1])||1,x=this.cachedCanvases.getCanvas("fillCanvas",A,y),S=x.context,C=Math.min(g[0],v[0]),k=Math.min(g[1],v[1]);S.translate(-C,-k),S.transform(...f),u||(u=this._scaleImage(p.canvas,(0,r.getCurrentTransformInverse)(S)),u=u.img,h&&l&&h.set(d,u)),S.imageSmoothingEnabled=w((0,r.getCurrentTransform)(S),t.interpolate),_(S,u,0,0,u.width,u.height,0,0,s,i),S.globalCompositeOperation="source-in";const T=n.Util.transform((0,r.getCurrentTransformInverse)(S),[1,0,0,1,-C,-k]);return S.fillStyle=l?a.getPattern(e,this,T,o.PathType.FILL):a,S.fillRect(0,0,s,i),h&&!l&&(this.cachedCanvases.delete("fillCanvas"),h.set(d,x.canvas)),{canvas:x.canvas,offsetX:Math.round(C),offsetY:Math.round(k)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking=null),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=C[t]}setLineJoin(t){this.ctx.lineJoin=k[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){const s=this.ctx;void 0!==s.setLineDash&&(s.setLineDash(t),s.lineDashOffset=e)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(let e=0,s=t.length;e<s;e++){const s=t[e],i=s[0],a=s[1];switch(i){case"LW":this.setLineWidth(a);break;case"LC":this.setLineCap(a);break;case"LJ":this.setLineJoin(a);break;case"ML":this.setMiterLimit(a);break;case"D":this.setDash(a[0],a[1]);break;case"RI":this.setRenderingIntent(a);break;case"FL":this.setFlatness(a);break;case"Font":this.setFont(a[0],a[1]);break;case"CA":this.current.strokeAlpha=s[1];break;case"ca":this.current.fillAlpha=s[1],this.ctx.globalAlpha=s[1];break;case"BM":this.ctx.globalCompositeOperation=a;break;case"SMask":this.current.activeSMask=a?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.current.transferMaps=a}}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const t=this.ctx.canvas.width,e=this.ctx.canvas.height,s="smaskGroupAt"+this.groupLevel,i=this.cachedCanvases.getCanvas(s,t,e);this.suspendedCtx=this.ctx,this.ctx=i.context;const a=this.ctx;a.setTransform(...(0,r.getCurrentTransform)(this.suspendedCtx)),v(this.suspendedCtx,a),function(t,e){if(t._removeMirroring)throw new Error("Context is already forwarding operations.");t.__originalSave=t.save,t.__originalRestore=t.restore,t.__originalRotate=t.rotate,t.__originalScale=t.scale,t.__originalTranslate=t.translate,t.__originalTransform=t.transform,t.__originalSetTransform=t.setTransform,t.__originalResetTransform=t.resetTransform,t.__originalClip=t.clip,t.__originalMoveTo=t.moveTo,t.__originalLineTo=t.lineTo,t.__originalBezierCurveTo=t.bezierCurveTo,t.__originalRect=t.rect,t.__originalClosePath=t.closePath,t.__originalBeginPath=t.beginPath,t._removeMirroring=()=>{t.save=t.__originalSave,t.restore=t.__originalRestore,t.rotate=t.__originalRotate,t.scale=t.__originalScale,t.translate=t.__originalTranslate,t.transform=t.__originalTransform,t.setTransform=t.__originalSetTransform,t.resetTransform=t.__originalResetTransform,t.clip=t.__originalClip,t.moveTo=t.__originalMoveTo,t.lineTo=t.__originalLineTo,t.bezierCurveTo=t.__originalBezierCurveTo,t.rect=t.__originalRect,t.closePath=t.__originalClosePath,t.beginPath=t.__originalBeginPath,delete t._removeMirroring},t.save=function(){e.save(),this.__originalSave()},t.restore=function(){e.restore(),this.__originalRestore()},t.translate=function(t,s){e.translate(t,s),this.__originalTranslate(t,s)},t.scale=function(t,s){e.scale(t,s),this.__originalScale(t,s)},t.transform=function(t,s,i,a,r,n){e.transform(t,s,i,a,r,n),this.__originalTransform(t,s,i,a,r,n)},t.setTransform=function(t,s,i,a,r,n){e.setTransform(t,s,i,a,r,n),this.__originalSetTransform(t,s,i,a,r,n)},t.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},t.rotate=function(t){e.rotate(t),this.__originalRotate(t)},t.clip=function(t){e.clip(t),this.__originalClip(t)},t.moveTo=function(t,s){e.moveTo(t,s),this.__originalMoveTo(t,s)},t.lineTo=function(t,s){e.lineTo(t,s),this.__originalLineTo(t,s)},t.bezierCurveTo=function(t,s,i,a,r,n){e.bezierCurveTo(t,s,i,a,r,n),this.__originalBezierCurveTo(t,s,i,a,r,n)},t.rect=function(t,s,i,a){e.rect(t,s,i,a),this.__originalRect(t,s,i,a)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}(a,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(),v(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const e=this.current.activeSMask;S(this.suspendedCtx,e,this.ctx,t),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?(v(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const t=this.current;this.stateStack.push(t),this.current=t.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),v(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null)}transform(t,e,s,i,a,r){this.ctx.transform(t,e,s,i,a,r),this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null}constructPath(t,e,s){const i=this.ctx,a=this.current;let o,l,c=a.x,h=a.y;const d=(0,r.getCurrentTransform)(i),u=0===d[0]&&0===d[3]||0===d[1]&&0===d[2],p=u?s.slice(0):null;for(let r=0,_=0,f=t.length;r<f;r++)switch(0|t[r]){case n.OPS.rectangle:c=e[_++],h=e[_++];const t=e[_++],s=e[_++],r=c+t,f=h+s;i.moveTo(c,h),0===t||0===s?i.lineTo(r,f):(i.lineTo(r,h),i.lineTo(r,f),i.lineTo(c,f)),u||a.updateRectMinMax(d,[c,h,r,f]),i.closePath();break;case n.OPS.moveTo:c=e[_++],h=e[_++],i.moveTo(c,h),u||a.updatePathMinMax(d,c,h);break;case n.OPS.lineTo:c=e[_++],h=e[_++],i.lineTo(c,h),u||a.updatePathMinMax(d,c,h);break;case n.OPS.curveTo:o=c,l=h,c=e[_+4],h=e[_+5],i.bezierCurveTo(e[_],e[_+1],e[_+2],e[_+3],c,h),a.updateCurvePathMinMax(d,o,l,e[_],e[_+1],e[_+2],e[_+3],c,h,p),_+=6;break;case n.OPS.curveTo2:o=c,l=h,i.bezierCurveTo(c,h,e[_],e[_+1],e[_+2],e[_+3]),a.updateCurvePathMinMax(d,o,l,c,h,e[_],e[_+1],e[_+2],e[_+3],p),c=e[_+2],h=e[_+3],_+=4;break;case n.OPS.curveTo3:o=c,l=h,c=e[_+2],h=e[_+3],i.bezierCurveTo(e[_],e[_+1],c,h,c,h),a.updateCurvePathMinMax(d,o,l,e[_],e[_+1],c,h,c,h,p),_+=4;break;case n.OPS.closePath:i.closePath()}u&&a.updateScalingPathMinMax(d,p),a.setCurrentPoint(c,h)}closePath(){this.ctx.closePath()}stroke(t){t=void 0===t||t;const e=this.ctx,s=this.current.strokeColor;e.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"==typeof s&&(null==s?void 0:s.getPattern)?(e.save(),e.strokeStyle=s.getPattern(e,this,(0,r.getCurrentTransformInverse)(e),o.PathType.STROKE),this.rescaleAndStroke(!1),e.restore()):this.rescaleAndStroke(!0)),t&&this.consumePath(this.current.getClippedPathBoundingBox()),e.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(t){t=void 0===t||t;const e=this.ctx,s=this.current.fillColor;let i=!1;this.current.patternFill&&(e.save(),e.fillStyle=s.getPattern(e,this,(0,r.getCurrentTransformInverse)(e),o.PathType.FILL),i=!0);const a=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==a&&(this.pendingEOFill?(e.fill("evenodd"),this.pendingEOFill=!1):e.fill()),i&&e.restore(),t&&this.consumePath(a)}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=T}eoClip(){this.pendingClip=E}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 t=this.pendingTextPaths,e=this.ctx;if(void 0!==t){e.save(),e.beginPath();for(const s of t)e.setTransform(...s.transform),e.translate(s.x,s.y),s.addToPath(e,s.fontSize);e.restore(),e.clip(),e.beginPath(),delete this.pendingTextPaths}else e.beginPath()}setCharSpacing(t){this.current.charSpacing=t}setWordSpacing(t){this.current.wordSpacing=t}setHScale(t){this.current.textHScale=t/100}setLeading(t){this.current.leading=-t}setFont(t,e){const s=this.commonObjs.get(t),i=this.current;if(!s)throw new Error(`Can't find font for ${t}`);if(i.fontMatrix=s.fontMatrix||n.FONT_IDENTITY_MATRIX,0!==i.fontMatrix[0]&&0!==i.fontMatrix[3]||(0,n.warn)("Invalid font matrix for font "+t),e<0?(e=-e,i.fontDirection=-1):i.fontDirection=1,this.current.font=s,this.current.fontSize=e,s.isType3Font)return;const a=s.loadedName||"sans-serif";let r="normal";s.black?r="900":s.bold&&(r="bold");const o=s.italic?"italic":"normal",l=`"${a}", ${s.fallbackName}`;let c=e;e<16?c=16:e>100&&(c=100),this.current.fontSizeScale=e/c,this.ctx.font=`${o} ${r} ${c}px ${l}`}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,e){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=e}setLeadingMoveText(t,e){this.setLeading(-e),this.moveText(t,e)}setTextMatrix(t,e,s,i,a,r){this.current.textMatrix=[t,e,s,i,a,r],this.current.textMatrixScale=Math.hypot(t,e),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,e,s,i){const a=this.ctx,o=this.current,l=o.font,c=o.textRenderingMode,h=o.fontSize/o.fontSizeScale,d=c&n.TextRenderingMode.FILL_STROKE_MASK,u=!!(c&n.TextRenderingMode.ADD_TO_PATH_FLAG),p=o.patternFill&&!l.missingFile;let _;(l.disableFontFace||u||p)&&(_=l.getPathGenerator(this.commonObjs,t)),l.disableFontFace||p?(a.save(),a.translate(e,s),a.beginPath(),_(a,h),i&&a.setTransform(...i),d!==n.TextRenderingMode.FILL&&d!==n.TextRenderingMode.FILL_STROKE||a.fill(),d!==n.TextRenderingMode.STROKE&&d!==n.TextRenderingMode.FILL_STROKE||a.stroke(),a.restore()):(d!==n.TextRenderingMode.FILL&&d!==n.TextRenderingMode.FILL_STROKE||a.fillText(t,e,s),d!==n.TextRenderingMode.STROKE&&d!==n.TextRenderingMode.FILL_STROKE||a.strokeText(t,e,s)),u&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:(0,r.getCurrentTransform)(a),x:e,y:s,fontSize:h,addToPath:_})}get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);const e=t.getImageData(0,0,10,10).data;let s=!1;for(let i=3;i<e.length;i+=4)if(e[i]>0&&e[i]<255){s=!0;break}return(0,n.shadow)(this,"isFontSubpixelAAEnabled",s)}showText(t){const e=this.current,s=e.font;if(s.isType3Font)return this.showType3Text(t);const i=e.fontSize;if(0===i)return;const a=this.ctx,l=e.fontSizeScale,c=e.charSpacing,h=e.wordSpacing,d=e.fontDirection,u=e.textHScale*d,p=t.length,_=s.vertical,f=_?1:-1,g=s.defaultVMetrics,m=i*e.fontMatrix[0],v=e.textRenderingMode===n.TextRenderingMode.FILL&&!s.disableFontFace&&!e.patternFill;let b;if(a.save(),a.transform(...e.textMatrix),a.translate(e.x,e.y+e.textRise),d>0?a.scale(u,-1):a.scale(u,1),e.patternFill){a.save();const t=e.fillColor.getPattern(a,this,(0,r.getCurrentTransformInverse)(a),o.PathType.FILL);b=(0,r.getCurrentTransform)(a),a.restore(),a.fillStyle=t}let A=e.lineWidth;const y=e.textMatrixScale;if(0===y||0===A){const t=e.textRenderingMode&n.TextRenderingMode.FILL_STROKE_MASK;t!==n.TextRenderingMode.STROKE&&t!==n.TextRenderingMode.FILL_STROKE||(A=this.getSinglePixelWidth())}else A/=y;1!==l&&(a.scale(l,l),A/=l),a.lineWidth=A;let x,S=0;for(x=0;x<p;++x){const e=t[x];if("number"==typeof e){S+=f*e*i/1e3;continue}let r=!1;const n=(e.isSpace?h:0)+c,o=e.fontChar,u=e.accent;let p,A,y,w=e.width;if(_){const t=e.vmetric||g,s=-(e.vmetric?t[1]:.5*w)*m,i=t[2]*m;w=t?-t[0]:w,p=s/l,A=(S+i)/l}else p=S/l,A=0;if(s.remeasure&&w>0){const t=1e3*a.measureText(o).width/i*l;if(w<t&&this.isFontSubpixelAAEnabled){const e=w/t;r=!0,a.save(),a.scale(e,1),p/=e}else w!==t&&(p+=(w-t)/2e3*i/l)}if(this.contentVisible&&(e.isInFont||s.missingFile))if(v&&!u)a.fillText(o,p,A);else if(this.paintChar(o,p,A,b),u){const t=p+i*u.offset.x/l,e=A-i*u.offset.y/l;this.paintChar(u.fontChar,t,e,b)}y=_?w*m-n*d:w*m+n*d,S+=y,r&&a.restore()}_?e.y-=S:e.x+=S*u,a.restore(),this.compose()}showType3Text(t){const e=this.ctx,s=this.current,i=s.font,a=s.fontSize,r=s.fontDirection,o=i.vertical?1:-1,l=s.charSpacing,c=s.wordSpacing,h=s.textHScale*r,d=s.fontMatrix||n.FONT_IDENTITY_MATRIX,u=t.length;let p,_,f,g;if(s.textRenderingMode!==n.TextRenderingMode.INVISIBLE&&0!==a){for(this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null,e.save(),e.transform(...s.textMatrix),e.translate(s.x,s.y),e.scale(h,r),p=0;p<u;++p){if(_=t[p],"number"==typeof _){g=o*_*a/1e3,this.ctx.translate(g,0),s.x+=g*h;continue}const r=(_.isSpace?c:0)+l,u=i.charProcOperatorList[_.operatorListId];u?(this.contentVisible&&(this.processingType3=_,this.save(),e.scale(a,a),e.transform(...d),this.executeOperatorList(u),this.restore()),f=n.Util.applyTransform([_.width,0],d)[0]*a+r,e.translate(f,0),s.x+=f*h):(0,n.warn)(`Type3 character "${_.operatorListId}" is not available.`)}e.restore(),this.processingType3=null}}setCharWidth(t,e){}setCharWidthAndBounds(t,e,s,i,a,r){this.ctx.rect(s,i,a-s,r-i),this.ctx.clip(),this.endPath()}getColorN_Pattern(e){let s;if("TilingPattern"===e[0]){const i=e[1],a=this.baseTransform||(0,r.getCurrentTransform)(this.ctx),n={createCanvasGraphics:e=>new t(e,this.commonObjs,this.objs,this.canvasFactory)};s=new o.TilingPattern(e,i,this.ctx,n,a)}else s=this._getPattern(e[1],e[2]);return s}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,e,s){var i;const a=(null==(i=this.selectColor)?void 0:i.call(this,t,e,s))||n.Util.makeHexColor(t,e,s);this.ctx.strokeStyle=a,this.current.strokeColor=a}setFillRGBColor(t,e,s){var i;const a=(null==(i=this.selectColor)?void 0:i.call(this,t,e,s))||n.Util.makeHexColor(t,e,s);this.ctx.fillStyle=a,this.current.fillColor=a,this.current.patternFill=!1}_getPattern(t,e=null){let s;return this.cachedPatterns.has(t)?s=this.cachedPatterns.get(t):(s=(0,o.getShadingPattern)(this.objs.get(t)),this.cachedPatterns.set(t,s)),e&&(s.matrix=e),s}shadingFill(t){if(!this.contentVisible)return;const e=this.ctx;this.save();const s=this._getPattern(t);e.fillStyle=s.getPattern(e,this,(0,r.getCurrentTransformInverse)(e),o.PathType.SHADING);const i=(0,r.getCurrentTransformInverse)(e);if(i){const t=e.canvas,s=t.width,a=t.height,r=n.Util.applyTransform([0,0],i),o=n.Util.applyTransform([0,a],i),l=n.Util.applyTransform([s,0],i),c=n.Util.applyTransform([s,a],i),h=Math.min(r[0],o[0],l[0],c[0]),d=Math.min(r[1],o[1],l[1],c[1]),u=Math.max(r[0],o[0],l[0],c[0]),p=Math.max(r[1],o[1],l[1],c[1]);this.ctx.fillRect(h,d,u-h,p-d)}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(t,e){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(t)&&6===t.length&&this.transform(...t),this.baseTransform=(0,r.getCurrentTransform)(this.ctx),e)){const t=e[2]-e[0],s=e[3]-e[1];this.ctx.rect(e[0],e[1],t,s),this.current.updateRectMinMax((0,r.getCurrentTransform)(this.ctx),e),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const e=this.ctx;t.isolated||(0,n.info)("TODO: Support non-isolated groups."),t.knockout&&(0,n.warn)("Knockout groups not supported.");const s=(0,r.getCurrentTransform)(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let i=n.Util.getAxialAlignedBoundingBox(t.bbox,(0,r.getCurrentTransform)(e));const a=[0,0,e.canvas.width,e.canvas.height];i=n.Util.intersect(i,a)||[0,0,0,0];const o=Math.floor(i[0]),l=Math.floor(i[1]);let c=Math.max(Math.ceil(i[2])-o,1),d=Math.max(Math.ceil(i[3])-l,1),u=1,p=1;c>h&&(u=c/h,c=h),d>h&&(p=d/h,d=h),this.current.startNewPathAndClipBox([0,0,c,d]);let _="groupAt"+this.groupLevel;t.smask&&(_+="_smask_"+this.smaskCounter++%2);const f=this.cachedCanvases.getCanvas(_,c,d),g=f.context;g.scale(1/u,1/p),g.translate(-o,-l),g.transform(...s),t.smask?this.smaskStack.push({canvas:f.canvas,context:g,offsetX:o,offsetY:l,scaleX:u,scaleY:p,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(e.setTransform(1,0,0,1,0,0),e.translate(o,l),e.scale(u,p),e.save()),v(e,g),this.ctx=g,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(e),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;const e=this.ctx,s=this.groupStack.pop();if(this.ctx=s,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const t=(0,r.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...t);const s=n.Util.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],t);this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(s)}}beginAnnotation(t,e,s,o,l){if(__privateMethod(this,i,a).call(this),b(this.ctx,this.foregroundColor),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(e)&&4===e.length){const i=e[2]-e[0],a=e[3]-e[1];if(l&&this.annotationCanvasMap){(s=s.slice())[4]-=e[0],s[5]-=e[1],(e=e.slice())[0]=e[1]=0,e[2]=i,e[3]=a;const[o,l]=n.Util.singularValueDecompose2dScale((0,r.getCurrentTransform)(this.ctx)),{viewportScale:c}=this,h=Math.ceil(i*this.outputScaleX*c),d=Math.ceil(a*this.outputScaleY*c);this.annotationCanvas=this.canvasFactory.create(h,d);const{canvas:u,context:p}=this.annotationCanvas;this.annotationCanvasMap.set(t,u),this.annotationCanvas.savedCtx=this.ctx,this.ctx=p,this.ctx.setTransform(o,0,0,-l,0,a*l),b(this.ctx,this.foregroundColor)}else b(this.ctx,this.foregroundColor),this.ctx.rect(e[0],e[1],i,a),this.ctx.clip(),this.endPath()}this.current=new f(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...s),this.transform(...o)}endAnnotation(){this.annotationCanvas&&(this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t){if(!this.contentVisible)return;const e=t.count;(t=this.getObject(t.data,t)).count=e;const s=this.ctx,i=this.processingType3;if(i&&(void 0===i.compiled&&(i.compiled=function(t){const{width:e,height:s}=t;if(e>d||s>d)return null;const i=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),a=e+1;let r,n,o,l=new Uint8Array(a*(s+1));const c=e+7&-8;let h=new Uint8Array(c*s),u=0;for(const d of t.data){let t=128;for(;t>0;)h[u++]=d&t?0:255,t>>=1}let p=0;for(u=0,0!==h[u]&&(l[0]=1,++p),n=1;n<e;n++)h[u]!==h[u+1]&&(l[n]=h[u]?2:1,++p),u++;for(0!==h[u]&&(l[n]=2,++p),r=1;r<s;r++){u=r*c,o=r*a,h[u-c]!==h[u]&&(l[o]=h[u]?1:8,++p);let t=(h[u]?4:0)+(h[u-c]?8:0);for(n=1;n<e;n++)t=(t>>2)+(h[u+1]?4:0)+(h[u-c+1]?8:0),i[t]&&(l[o+n]=i[t],++p),u++;if(h[u-c]!==h[u]&&(l[o+n]=h[u]?2:4,++p),p>1e3)return null}for(u=c*(s-1),o=r*a,0!==h[u]&&(l[o]=8,++p),n=1;n<e;n++)h[u]!==h[u+1]&&(l[o+n]=h[u]?4:8,++p),u++;if(0!==h[u]&&(l[o+n]=4,++p),p>1e3)return null;const _=new Int32Array([0,a,-1,0,-a,0,0,0,1]),f=new Path2D;for(r=0;p&&r<=s;r++){let t=r*a;const s=t+e;for(;t<s&&!l[t];)t++;if(t===s)continue;f.moveTo(t%a,r);const i=t;let n=l[t];do{const e=_[n];do{t+=e}while(!l[t]);const s=l[t];5!==s&&10!==s?(n=s,l[t]=0):(n=s&51*n>>4,l[t]&=n>>2|n<<2),f.lineTo(t%a,t/a|0),l[t]||--p}while(i!==t);--r}return h=null,l=null,function(t){t.save(),t.scale(1/e,-1/s),t.translate(0,-s),t.fill(f),t.beginPath(),t.restore()}}(t)),i.compiled))return void i.compiled(s);const a=this._createMaskCanvas(t),r=a.canvas;s.save(),s.setTransform(1,0,0,1,0,0),s.drawImage(r,a.offsetX,a.offsetY),s.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,s=0,i=0,a,o){if(!this.contentVisible)return;t=this.getObject(t.data,t);const l=this.ctx;l.save();const c=(0,r.getCurrentTransform)(l);l.transform(e,s,i,a,0,0);const h=this._createMaskCanvas(t);l.setTransform(1,0,0,1,0,0);for(let r=0,d=o.length;r<d;r+=2){const t=n.Util.transform(c,[e,s,i,a,o[r],o[r+1]]),[d,u]=n.Util.applyTransform([0,0],t);l.drawImage(h.canvas,d,u)}l.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const e=this.ctx,s=this.current.fillColor,i=this.current.patternFill;for(const a of t){const{data:t,width:n,height:l,transform:c}=a,h=this.cachedCanvases.getCanvas("maskCanvas",n,l),d=h.context;d.save(),m(d,this.getObject(t,a)),d.globalCompositeOperation="source-in",d.fillStyle=i?s.getPattern(d,this,(0,r.getCurrentTransformInverse)(e),o.PathType.FILL):s,d.fillRect(0,0,n,l),d.restore(),e.save(),e.transform(...c),e.scale(1,-1),_(e,h.canvas,0,0,n,l,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const e=this.getObject(t);e?this.paintInlineImageXObject(e):(0,n.warn)("Dependent image isn't ready yet")}paintImageXObjectRepeat(t,e,s,i){if(!this.contentVisible)return;const a=this.getObject(t);if(!a)return void(0,n.warn)("Dependent image isn't ready yet");const r=a.width,o=a.height,l=[];for(let n=0,c=i.length;n<c;n+=2)l.push({transform:[e,0,0,s,i[n],i[n+1]],x:0,y:0,w:r,h:o});this.paintInlineImageXObjectGroup(a,l)}paintInlineImageXObject(t){if(!this.contentVisible)return;const e=t.width,s=t.height,i=this.ctx;let a;if(this.save(),i.scale(1/e,-1/s),"function"==typeof HTMLElement&&t instanceof HTMLElement||!t.data)a=t;else{const i=this.cachedCanvases.getCanvas("inlineImage",e,s);g(i.context,t,this.current.transferMaps),a=i.canvas}const o=this._scaleImage(a,(0,r.getCurrentTransformInverse)(i));i.imageSmoothingEnabled=w((0,r.getCurrentTransform)(i),t.interpolate);const[l,c]=_(i,o.img,0,0,o.paintWidth,o.paintHeight,0,-s,e,s);if(this.imageLayer){const[e,i]=n.Util.applyTransform([0,-s],(0,r.getCurrentTransform)(this.ctx));this.imageLayer.appendImage({imgData:t,left:e,top:i,width:l,height:c})}this.compose(),this.restore()}paintInlineImageXObjectGroup(t,e){if(!this.contentVisible)return;const s=this.ctx,i=t.width,a=t.height,o=this.cachedCanvases.getCanvas("inlineImage",i,a);g(o.context,t,this.current.transferMaps);for(const l of e){if(s.save(),s.transform(...l.transform),s.scale(1,-1),_(s,o.canvas,l.x,l.y,l.w,l.h,0,-1,1,1),this.imageLayer){const[e,s]=n.Util.applyTransform([l.x,l.y],(0,r.getCurrentTransform)(this.ctx));this.imageLayer.appendImage({imgData:t,left:e,top:s,width:i,height:a})}s.restore()}this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t){}markPointProps(t,e){}beginMarkedContent(t){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e){"OC"===t?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(e)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(t){const e=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);const s=this.ctx;this.pendingClip&&(e||(this.pendingClip===E?s.clip("evenodd"):s.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),s.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=(0,r.getCurrentTransform)(this.ctx);if(0===t[1]&&0===t[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{const e=Math.abs(t[0]*t[3]-t[2]*t[1]),s=Math.hypot(t[0],t[2]),i=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(s,i)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(!this._cachedScaleForStroking){const{lineWidth:t}=this.current,e=(0,r.getCurrentTransform)(this.ctx);let s,i;if(0===e[1]&&0===e[2]){const a=Math.abs(e[0]),r=Math.abs(e[3]);if(0===t)s=1/a,i=1/r;else{const e=a*t,n=r*t;s=e<1?1/e:1,i=n<1?1/n:1}}else{const a=Math.abs(e[0]*e[3]-e[2]*e[1]),r=Math.hypot(e[0],e[1]),n=Math.hypot(e[2],e[3]);if(0===t)s=n/a,i=r/a;else{const e=t*a;s=n>e?n/e:1,i=r>e?r/e:1}}this._cachedScaleForStroking=[s,i]}return this._cachedScaleForStroking}rescaleAndStroke(t){const{ctx:e}=this,{lineWidth:s}=this.current,[i,a]=this.getScaleForStroking();if(e.lineWidth=s||1,1===i&&1===a)return void e.stroke();let n,o,l;t&&(n=(0,r.getCurrentTransform)(e),o=e.getLineDash().slice(),l=e.lineDashOffset),e.scale(i,a);const c=Math.max(i,a);e.setLineDash(e.getLineDash().map(t=>t/c)),e.lineDashOffset/=c,e.stroke(),t&&(e.setTransform(...n),e.setLineDash(o),e.lineDashOffset=l)}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}};e.CanvasGraphics=P;for(const M in n.OPS)void 0!==P.prototype[M]&&(P.prototype[n.OPS[M]]=P.prototype[M])},(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TilingPattern=e.PathType=void 0,e.getShadingPattern=function(t){switch(t[0]){case"RadialAxial":return new c(t);case"Mesh":return new u(t);case"Dummy":return new p}throw new Error(`Unknown IR type: ${t[0]}`)};var i=s(1),a=s(8),r=s(3);const n={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function o(t,e){if(!e||r.isNodeJS)return;const s=e[2]-e[0],i=e[3]-e[1],a=new Path2D;a.rect(e[0],e[1],s,i),t.clip(a)}e.PathType=n;class l{constructor(){this.constructor===l&&(0,i.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,i.unreachable)("Abstract method `getPattern` called.")}}class c extends l{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}_createGradient(t){let e;"axial"===this._type?e=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(e=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const s of this._colorStops)e.addColorStop(s[0],s[1]);return e}getPattern(t,e,s,r){let l;if(r===n.STROKE||r===n.FILL){const n=e.current.getClippedPathBoundingBox(r,(0,a.getCurrentTransform)(t))||[0,0,0,0],h=Math.ceil(n[2]-n[0])||1,d=Math.ceil(n[3]-n[1])||1,u=e.cachedCanvases.getCanvas("pattern",h,d,!0),p=u.context;p.clearRect(0,0,p.canvas.width,p.canvas.height),p.beginPath(),p.rect(0,0,p.canvas.width,p.canvas.height),p.translate(-n[0],-n[1]),s=i.Util.transform(s,[1,0,0,1,n[0],n[1]]),p.transform(...e.baseTransform),this.matrix&&p.transform(...this.matrix),o(p,this._bbox),p.fillStyle=this._createGradient(p),p.fill(),l=t.createPattern(u.canvas,"no-repeat");const _=new DOMMatrix(s);try{l.setTransform(_)}catch(c){(0,i.warn)(`RadialAxialShadingPattern.getPattern: "${null==c?void 0:c.message}".`)}}else o(t,this._bbox),l=this._createGradient(t);return l}}function h(t,e,s,i,a,r,n,o){const l=e.coords,c=e.colors,h=t.data,d=4*t.width;let u;l[s+1]>l[i+1]&&(u=s,s=i,i=u,u=r,r=n,n=u),l[i+1]>l[a+1]&&(u=i,i=a,a=u,u=n,n=o,o=u),l[s+1]>l[i+1]&&(u=s,s=i,i=u,u=r,r=n,n=u);const p=(l[s]+e.offsetX)*e.scaleX,_=(l[s+1]+e.offsetY)*e.scaleY,f=(l[i]+e.offsetX)*e.scaleX,g=(l[i+1]+e.offsetY)*e.scaleY,m=(l[a]+e.offsetX)*e.scaleX,v=(l[a+1]+e.offsetY)*e.scaleY;if(_>=v)return;const b=c[r],A=c[r+1],y=c[r+2],x=c[n],S=c[n+1],w=c[n+2],C=c[o],k=c[o+1],T=c[o+2],E=Math.round(_),P=Math.round(v);let M,F,R,D,N,I,O,L;for(let G=E;G<=P;G++){if(G<g){let t;t=G<_?0:(_-G)/(_-g),M=p-(p-f)*t,F=b-(b-x)*t,R=A-(A-S)*t,D=y-(y-w)*t}else{let t;t=G>v?1:g===v?0:(g-G)/(g-v),M=f-(f-m)*t,F=x-(x-C)*t,R=S-(S-k)*t,D=w-(w-T)*t}let t;t=G<_?0:G>v?1:(_-G)/(_-v),N=p-(p-m)*t,I=b-(b-C)*t,O=A-(A-k)*t,L=y-(y-T)*t;const e=Math.round(Math.min(M,N)),s=Math.round(Math.max(M,N));let i=d*G+4*e;for(let a=e;a<=s;a++)t=(M-a)/(M-N),t<0?t=0:t>1&&(t=1),h[i++]=F-(F-I)*t|0,h[i++]=R-(R-O)*t|0,h[i++]=D-(D-L)*t|0,h[i++]=255}}function d(t,e,s){const i=e.coords,a=e.colors;let r,n;switch(e.type){case"lattice":const o=e.verticesPerRow,l=Math.floor(i.length/o)-1,c=o-1;for(r=0;r<l;r++){let e=r*o;for(let r=0;r<c;r++,e++)h(t,s,i[e],i[e+1],i[e+o],a[e],a[e+1],a[e+o]),h(t,s,i[e+o+1],i[e+1],i[e+o],a[e+o+1],a[e+1],a[e+o])}break;case"triangles":for(r=0,n=i.length;r<n;r+=3)h(t,s,i[r],i[r+1],i[r+2],a[r],a[r+1],a[r+2]);break;default:throw new Error("illegal figure")}}class u extends l{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[7],this._background=t[8],this.matrix=null}_createMeshCanvas(t,e,s){const i=Math.floor(this._bounds[0]),a=Math.floor(this._bounds[1]),r=Math.ceil(this._bounds[2])-i,n=Math.ceil(this._bounds[3])-a,o=Math.min(Math.ceil(Math.abs(r*t[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(n*t[1]*1.1)),3e3),c=r/o,h=n/l,u={coords:this._coords,colors:this._colors,offsetX:-i,offsetY:-a,scaleX:1/c,scaleY:1/h},p=o+4,_=l+4,f=s.getCanvas("mesh",p,_,!1),g=f.context,m=g.createImageData(o,l);if(e){const t=m.data;for(let s=0,i=t.length;s<i;s+=4)t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=255}for(const v of this._figures)d(m,v,u);return g.putImageData(m,2,2),{canvas:f.canvas,offsetX:i-2*c,offsetY:a-2*h,scaleX:c,scaleY:h}}getPattern(t,e,s,r){let l;if(o(t,this._bbox),r===n.SHADING)l=i.Util.singularValueDecompose2dScale((0,a.getCurrentTransform)(t));else if(l=i.Util.singularValueDecompose2dScale(e.baseTransform),this.matrix){const t=i.Util.singularValueDecompose2dScale(this.matrix);l=[l[0]*t[0],l[1]*t[1]]}const c=this._createMeshCanvas(l,r===n.SHADING?null:this._background,e.cachedCanvases);return r!==n.SHADING&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(c.offsetX,c.offsetY),t.scale(c.scaleX,c.scaleY),t.createPattern(c.canvas,"no-repeat")}}class p extends l{getPattern(){return"hotpink"}}const _=1,f=2;class g{static get MAX_PATTERN_SIZE(){return(0,i.shadow)(this,"MAX_PATTERN_SIZE",3e3)}constructor(t,e,s,i,a){this.operatorList=t[2],this.matrix=t[3]||[1,0,0,1,0,0],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.color=e,this.ctx=s,this.canvasGraphicsFactory=i,this.baseTransform=a}createPatternCanvas(t){const e=this.operatorList,s=this.bbox,r=this.xstep,n=this.ystep,o=this.paintType,l=this.tilingType,c=this.color,h=this.canvasGraphicsFactory;(0,i.info)("TilingType: "+l);const d=s[0],u=s[1],p=s[2],_=s[3],f=i.Util.singularValueDecompose2dScale(this.matrix),g=i.Util.singularValueDecompose2dScale(this.baseTransform),m=[f[0]*g[0],f[1]*g[1]],v=this.getSizeAndScale(r,this.ctx.canvas.width,m[0]),b=this.getSizeAndScale(n,this.ctx.canvas.height,m[1]),A=t.cachedCanvases.getCanvas("pattern",v.size,b.size,!0),y=A.context,x=h.createCanvasGraphics(y);x.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(x,o,c);let S=d,w=u,C=p,k=_;return d<0&&(S=0,C+=Math.abs(d)),u<0&&(w=0,k+=Math.abs(u)),y.translate(-v.scale*S,-b.scale*w),x.transform(v.scale,0,0,b.scale,0,0),y.save(),this.clipBbox(x,S,w,C,k),x.baseTransform=(0,a.getCurrentTransform)(x.ctx),x.executeOperatorList(e),x.endDrawing(),{canvas:A.canvas,scaleX:v.scale,scaleY:b.scale,offsetX:S,offsetY:w}}getSizeAndScale(t,e,s){t=Math.abs(t);const i=Math.max(g.MAX_PATTERN_SIZE,e);let a=Math.ceil(t*s);return a>=i?a=i:s=a/t,{scale:s,size:a}}clipBbox(t,e,s,i,r){const n=i-e,o=r-s;t.ctx.rect(e,s,n,o),t.current.updateRectMinMax((0,a.getCurrentTransform)(t.ctx),[e,s,i,r]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,s){const a=t.ctx,r=t.current;switch(e){case _:const t=this.ctx;a.fillStyle=t.fillStyle,a.strokeStyle=t.strokeStyle,r.fillColor=t.fillStyle,r.strokeColor=t.strokeStyle;break;case f:const n=i.Util.makeHexColor(s[0],s[1],s[2]);a.fillStyle=n,a.strokeStyle=n,r.fillColor=n,r.strokeColor=n;break;default:throw new i.FormatError(`Unsupported paint type: ${e}`)}}getPattern(t,e,s,a){let r=s;a!==n.SHADING&&(r=i.Util.transform(r,e.baseTransform),this.matrix&&(r=i.Util.transform(r,this.matrix)));const o=this.createPatternCanvas(e);let l=new DOMMatrix(r);l=l.translate(o.offsetX,o.offsetY),l=l.scale(1/o.scaleX,1/o.scaleY);const c=t.createPattern(o.canvas,"repeat");try{c.setTransform(l)}catch(h){(0,i.warn)(`TilingPattern.getPattern: "${null==h?void 0:h.message}".`)}return c}}e.TilingPattern=g},(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.applyMaskImageData=function({src:t,srcPos:e=0,dest:s,destPos:a=0,width:r,height:n,inverseDecode:o=!1}){const l=i.FeatureTest.isLittleEndian?4278190080:255,[c,h]=o?[0,l]:[l,0],d=r>>3,u=7&r,p=t.length;s=new Uint32Array(s.buffer);for(let i=0;i<n;i++){for(const r=e+d;e<r;e++){const i=e<p?t[e]:255;s[a++]=128&i?h:c,s[a++]=64&i?h:c,s[a++]=32&i?h:c,s[a++]=16&i?h:c,s[a++]=8&i?h:c,s[a++]=4&i?h:c,s[a++]=2&i?h:c,s[a++]=1&i?h:c}if(0===u)continue;const i=e<p?t[e++]:255;for(let t=0;t<u;t++)s[a++]=i&1<<7-t?h:c}return{srcPos:e,destPos:a}};var i=s(1)},(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalWorkerOptions=void 0;const s=Object.create(null);e.GlobalWorkerOptions=s,s.workerPort=void 0===s.workerPort?null:s.workerPort,s.workerSrc=void 0===s.workerSrc?"":s.workerSrc},(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MessageHandler=void 0;var i=s(1);const a=1,r=2,n=1,o=2,l=3,c=4,h=5,d=6,u=7,p=8;function _(t){switch(t instanceof Error||"object"==typeof t&&null!==t||(0,i.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new i.AbortException(t.message);case"MissingPDFException":return new i.MissingPDFException(t.message);case"PasswordException":return new i.PasswordException(t.message,t.code);case"UnexpectedResponseException":return new i.UnexpectedResponseException(t.message,t.status);case"UnknownErrorException":return new i.UnknownErrorException(t.message,t.details);default:return new i.UnknownErrorException(t.message,t.toString())}}e.MessageHandler=class{constructor(t,e,s){this.sourceName=t,this.targetName=e,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=t=>{const e=t.data;if(e.targetName!==this.sourceName)return;if(e.stream)return void this._processStreamMessage(e);if(e.callback){const t=e.callbackId,s=this.callbackCapabilities[t];if(!s)throw new Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],e.callback===a)s.resolve(e.data);else{if(e.callback!==r)throw new Error("Unexpected callback case");s.reject(_(e.reason))}return}const i=this.actionHandler[e.action];if(!i)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const t=this.sourceName,n=e.sourceName;return void new Promise(function(t){t(i(e.data))}).then(function(i){s.postMessage({sourceName:t,targetName:n,callback:a,callbackId:e.callbackId,data:i})},function(i){s.postMessage({sourceName:t,targetName:n,callback:r,callbackId:e.callbackId,reason:_(i)})})}e.streamId?this._createStreamSink(e):i(e.data)},s.addEventListener("message",this._onComObjOnMessage)}on(t,e){const s=this.actionHandler;if(s[t])throw new Error(`There is already an actionName called "${t}"`);s[t]=e}send(t,e,s){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},s)}sendWithPromise(t,e,s){const a=this.callbackId++,r=(0,i.createPromiseCapability)();this.callbackCapabilities[a]=r;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:a,data:e},s)}catch(n){r.reject(n)}return r.promise}sendWithStream(t,e,s,a){const r=this.streamId++,o=this.sourceName,l=this.targetName,c=this.comObj;return new ReadableStream({start:s=>{const n=(0,i.createPromiseCapability)();return this.streamControllers[r]={controller:s,startCall:n,pullCall:null,cancelCall:null,isClosed:!1},c.postMessage({sourceName:o,targetName:l,action:t,streamId:r,data:e,desiredSize:s.desiredSize},a),n.promise},pull:t=>{const e=(0,i.createPromiseCapability)();return this.streamControllers[r].pullCall=e,c.postMessage({sourceName:o,targetName:l,stream:d,streamId:r,desiredSize:t.desiredSize}),e.promise},cancel:t=>{(0,i.assert)(t instanceof Error,"cancel must have a valid reason");const e=(0,i.createPromiseCapability)();return this.streamControllers[r].cancelCall=e,this.streamControllers[r].isClosed=!0,c.postMessage({sourceName:o,targetName:l,stream:n,streamId:r,reason:_(t)}),e.promise}},s)}_createStreamSink(t){const e=t.streamId,s=this.sourceName,a=t.sourceName,r=this.comObj,n=this,o=this.actionHandler[t.action],d={enqueue(t,n=1,o){if(this.isCancelled)return;const l=this.desiredSize;this.desiredSize-=n,l>0&&this.desiredSize<=0&&(this.sinkCapability=(0,i.createPromiseCapability)(),this.ready=this.sinkCapability.promise),r.postMessage({sourceName:s,targetName:a,stream:c,streamId:e,chunk:t},o)},close(){this.isCancelled||(this.isCancelled=!0,r.postMessage({sourceName:s,targetName:a,stream:l,streamId:e}),delete n.streamSinks[e])},error(t){(0,i.assert)(t instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,r.postMessage({sourceName:s,targetName:a,stream:h,streamId:e,reason:_(t)}))},sinkCapability:(0,i.createPromiseCapability)(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};d.sinkCapability.resolve(),d.ready=d.sinkCapability.promise,this.streamSinks[e]=d,new Promise(function(e){e(o(t.data,d))}).then(function(){r.postMessage({sourceName:s,targetName:a,stream:p,streamId:e,success:!0})},function(t){r.postMessage({sourceName:s,targetName:a,stream:p,streamId:e,reason:_(t)})})}_processStreamMessage(t){const e=t.streamId,s=this.sourceName,a=t.sourceName,r=this.comObj,f=this.streamControllers[e],g=this.streamSinks[e];switch(t.stream){case p:t.success?f.startCall.resolve():f.startCall.reject(_(t.reason));break;case u:t.success?f.pullCall.resolve():f.pullCall.reject(_(t.reason));break;case d:if(!g){r.postMessage({sourceName:s,targetName:a,stream:u,streamId:e,success:!0});break}g.desiredSize<=0&&t.desiredSize>0&&g.sinkCapability.resolve(),g.desiredSize=t.desiredSize,new Promise(function(t){t(g.onPull&&g.onPull())}).then(function(){r.postMessage({sourceName:s,targetName:a,stream:u,streamId:e,success:!0})},function(t){r.postMessage({sourceName:s,targetName:a,stream:u,streamId:e,reason:_(t)})});break;case c:if((0,i.assert)(f,"enqueue should have stream controller"),f.isClosed)break;f.controller.enqueue(t.chunk);break;case l:if((0,i.assert)(f,"close should have stream controller"),f.isClosed)break;f.isClosed=!0,f.controller.close(),this._deleteStreamController(f,e);break;case h:(0,i.assert)(f,"error should have stream controller"),f.controller.error(_(t.reason)),this._deleteStreamController(f,e);break;case o:t.success?f.cancelCall.resolve():f.cancelCall.reject(_(t.reason)),this._deleteStreamController(f,e);break;case n:if(!g)break;new Promise(function(e){e(g.onCancel&&g.onCancel(_(t.reason)))}).then(function(){r.postMessage({sourceName:s,targetName:a,stream:o,streamId:e,success:!0})},function(t){r.postMessage({sourceName:s,targetName:a,stream:o,streamId:e,reason:_(t)})}),g.sinkCapability.reject(_(t.reason)),g.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}async _deleteStreamController(t,e){await Promise.allSettled([t.startCall&&t.startCall.promise,t.pullCall&&t.pullCall.promise,t.cancelCall&&t.cancelCall.promise]),delete this.streamControllers[e]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}},(t,e,s)=>{var i,a;Object.defineProperty(e,"__esModule",{value:!0}),e.Metadata=void 0;var r=s(1);i=new WeakMap,a=new WeakMap,e.Metadata=class{constructor({parsedData:t,rawData:e}){__privateAdd(this,i,void 0),__privateAdd(this,a,void 0),__privateSet(this,i,t),__privateSet(this,a,e)}getRaw(){return __privateGet(this,a)}get(t){return __privateGet(this,i).get(t)??null}getAll(){return(0,r.objectFromMap)(__privateGet(this,i))}has(t){return __privateGet(this,i).has(t)}}},(t,e,s)=>{var i,a,r,n,o,l,c;Object.defineProperty(e,"__esModule",{value:!0}),e.OptionalContentConfig=void 0;var h=s(1);const d=Symbol("INTERNAL");class u{constructor(t,e){__privateAdd(this,i,!0),this.name=t,this.intent=e}get visible(){return __privateGet(this,i)}_setVisible(t,e){t!==d&&(0,h.unreachable)("Internal method `_setVisible` called."),__privateSet(this,i,e)}}i=new WeakMap,a=new WeakMap,r=new WeakMap,n=new WeakMap,o=new WeakMap,l=new WeakSet,c=function(t){const e=t.length;if(e<2)return!0;const s=t[0];for(let i=1;i<e;i++){const e=t[i];let a;if(Array.isArray(e))a=__privateMethod(this,l,c).call(this,e);else{if(!__privateGet(this,r).has(e))return(0,h.warn)(`Optional content group not found: ${e}`),!0;a=__privateGet(this,r).get(e).visible}switch(s){case"And":if(!a)return!1;break;case"Or":if(a)return!0;break;case"Not":return!a;default:return!0}}return"And"===s},e.OptionalContentConfig=class{constructor(t){if(__privateAdd(this,l),__privateAdd(this,a,!0),__privateAdd(this,r,new Map),__privateAdd(this,n,null),__privateAdd(this,o,null),this.name=null,this.creator=null,null!==t){this.name=t.name,this.creator=t.creator,__privateSet(this,o,t.order);for(const e of t.groups)__privateGet(this,r).set(e.id,new u(e.name,e.intent));if("OFF"===t.baseState)for(const t of __privateGet(this,r).values())t._setVisible(d,!1);for(const e of t.on)__privateGet(this,r).get(e)._setVisible(d,!0);for(const e of t.off)__privateGet(this,r).get(e)._setVisible(d,!1);__privateSet(this,n,new Map);for(const[t,e]of __privateGet(this,r))__privateGet(this,n).set(t,e.visible)}}isVisible(t){if(0===__privateGet(this,r).size)return!0;if(!t)return(0,h.warn)("Optional content group not defined."),!0;if("OCG"===t.type)return __privateGet(this,r).has(t.id)?__privateGet(this,r).get(t.id).visible:((0,h.warn)(`Optional content group not found: ${t.id}`),!0);if("OCMD"===t.type){if(t.expression)return __privateMethod(this,l,c).call(this,t.expression);if(!t.policy||"AnyOn"===t.policy){for(const e of t.ids){if(!__privateGet(this,r).has(e))return(0,h.warn)(`Optional content group not found: ${e}`),!0;if(__privateGet(this,r).get(e).visible)return!0}return!1}if("AllOn"===t.policy){for(const e of t.ids){if(!__privateGet(this,r).has(e))return(0,h.warn)(`Optional content group not found: ${e}`),!0;if(!__privateGet(this,r).get(e).visible)return!1}return!0}if("AnyOff"===t.policy){for(const e of t.ids){if(!__privateGet(this,r).has(e))return(0,h.warn)(`Optional content group not found: ${e}`),!0;if(!__privateGet(this,r).get(e).visible)return!0}return!1}if("AllOff"===t.policy){for(const e of t.ids){if(!__privateGet(this,r).has(e))return(0,h.warn)(`Optional content group not found: ${e}`),!0;if(__privateGet(this,r).get(e).visible)return!1}return!0}return(0,h.warn)(`Unknown optional content policy ${t.policy}.`),!0}return(0,h.warn)(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0){__privateGet(this,r).has(t)?(__privateGet(this,r).get(t)._setVisible(d,!!e),__privateSet(this,a,null)):(0,h.warn)(`Optional content group not found: ${t}`)}get hasInitialVisibility(){if(null!==__privateGet(this,a))return __privateGet(this,a);for(const[t,e]of __privateGet(this,r)){const s=__privateGet(this,n).get(t);if(e.visible!==s)return __privateSet(this,a,!1)}return __privateSet(this,a,!0)}getOrder(){return __privateGet(this,r).size?__privateGet(this,o)?__privateGet(this,o).slice():[...__privateGet(this,r).keys()]:null}getGroups(){return __privateGet(this,r).size>0?(0,h.objectFromMap)(__privateGet(this,r)):null}getGroup(t){return __privateGet(this,r).get(t)||null}}},(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PDFDataTransportStream=void 0;var i=s(1),a=s(8);e.PDFDataTransportStream=class{constructor(t,e){(0,i.assert)(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'),this._queuedChunks=[],this._progressiveDone=t.progressiveDone||!1,this._contentDispositionFilename=t.contentDispositionFilename||null;const s=t.initialData;if((null==s?void 0:s.length)>0){const t=new Uint8Array(s).buffer;this._queuedChunks.push(t)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._contentLength=t.length,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener((t,e)=>{this._onReceiveData({begin:t,chunk:e})}),this._pdfDataRangeTransport.addProgressListener((t,e)=>{this._onProgress({loaded:t,total:e})}),this._pdfDataRangeTransport.addProgressiveReadListener(t=>{this._onReceiveData({chunk:t})}),this._pdfDataRangeTransport.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),this._pdfDataRangeTransport.transportReady()}_onReceiveData(t){const e=new Uint8Array(t.chunk).buffer;if(void 0===t.begin)this._fullRequestReader?this._fullRequestReader._enqueue(e):this._queuedChunks.push(e);else{const s=this._rangeReaders.some(function(s){return s._begin===t.begin&&(s._enqueue(e),!0)});(0,i.assert)(s,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var t;return(null==(t=this._fullRequestReader)?void 0:t._loaded)??0}_onProgress(t){if(void 0===t.total){const e=this._rangeReaders[0];(null==e?void 0:e.onProgress)&&e.onProgress({loaded:t.loaded})}else{const e=this._fullRequestReader;(null==e?void 0:e.onProgress)&&e.onProgress({loaded:t.loaded,total:t.total})}}_onProgressiveDone(){this._fullRequestReader&&this._fullRequestReader.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){const e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){(0,i.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new r(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new n(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(s),s}cancelAllRequests(t){this._fullRequestReader&&this._fullRequestReader.cancel(t);for(const e of this._rangeReaders.slice(0))e.cancel(t);this._pdfDataRangeTransport.abort()}};class r{constructor(t,e,s=!1,i=null){this._stream=t,this._done=s||!1,this._filename=(0,a.isPdfFile)(i)?i:null,this._queuedChunks=e||[],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=(0,i.createPromiseCapability)();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class n{constructor(t,e,s){this._stream=t,this._begin=e,this._end=s,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(0===this._requests.length)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=(0,i.createPromiseCapability)();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}},(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.XfaText=void 0;class s{static textContent(t){const e=[],i={items:e,styles:Object.create(null)};return function t(i){var a;if(!i)return;let r=null;const n=i.name;if("#text"===n)r=i.value;else{if(!s.shouldBuildText(n))return;(null==(a=null==i?void 0:i.attributes)?void 0:a.textContent)?r=i.attributes.textContent:i.value&&(r=i.value)}if(null!==r&&e.push({str:r}),i.children)for(const e of i.children)t(e)}(t),i}static shouldBuildText(t){return!("textarea"===t||"input"===t||"option"===t||"select"===t)}}e.XfaText=s},(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NodeStandardFontDataFactory=e.NodeCanvasFactory=e.NodeCMapReaderFactory=void 0;var i=s(9);const a=function(t){return new Promise((e,s)=>{require$$5.readFile(t,(t,i)=>{!t&&i?e(new Uint8Array(i)):s(new Error(t))})})};class r extends i.BaseCanvasFactory{_createCanvas(t,e){return require$$5.createCanvas(t,e)}}e.NodeCanvasFactory=r;class n extends i.BaseCMapReaderFactory{_fetchData(t,e){return a(t).then(t=>({cMapData:t,compressionType:e}))}}e.NodeCMapReaderFactory=n;class o extends i.BaseStandardFontDataFactory{_fetchData(t){return a(t)}}e.NodeStandardFontDataFactory=o},(t,e,s)=>{var i,a,r,n,o,l,c,h,d,u,p,_,f,g,m,v;Object.defineProperty(e,"__esModule",{value:!0}),e.AnnotationEditorLayer=void 0;var b=s(7),A=s(1),y=s(23),x=s(24);const S=class t{constructor(e){__privateAdd(this,d),__privateAdd(this,p),__privateAdd(this,f),__privateAdd(this,m),__privateAdd(this,i,void 0),__privateAdd(this,a,!1),__privateAdd(this,r,this.pointerup.bind(this)),__privateAdd(this,n,this.pointerdown.bind(this)),__privateAdd(this,o,new Map),__privateAdd(this,l,!1),__privateAdd(this,c,!1),__privateAdd(this,h,void 0),t._initialized||(t._initialized=!0,y.FreeTextEditor.initialize(e.l10n),x.InkEditor.initialize(e.l10n),e.uiManager.registerEditorTypes([y.FreeTextEditor,x.InkEditor])),__privateSet(this,h,e.uiManager),this.annotationStorage=e.annotationStorage,this.pageIndex=e.pageIndex,this.div=e.div,__privateSet(this,i,e.accessibilityManager),__privateGet(this,h).addLayer(this)}updateToolbar(t){__privateGet(this,h).updateToolbar(t)}updateMode(t=__privateGet(this,h).getMode()){__privateMethod(this,m,v).call(this),t===A.AnnotationEditorType.INK?(this.addInkEditorIfNeeded(!1),this.disableClick()):this.enableClick(),__privateGet(this,h).unselectAll()}addInkEditorIfNeeded(t){if(t||__privateGet(this,h).getMode()===A.AnnotationEditorType.INK){if(!t)for(const t of __privateGet(this,o).values())if(t.isEmpty())return void t.setInBackground();__privateMethod(this,f,g).call(this,{offsetX:0,offsetY:0}).setInBackground()}}setEditingState(t){__privateGet(this,h).setEditingState(t)}addCommands(t){__privateGet(this,h).addCommands(t)}enable(){this.div.style.pointerEvents="auto";for(const t of __privateGet(this,o).values())t.enableEditing()}disable(){this.div.style.pointerEvents="none";for(const t of __privateGet(this,o).values())t.disableEditing()}setActiveEditor(t){__privateGet(this,h).getActive()!==t&&__privateGet(this,h).setActiveEditor(t)}enableClick(){this.div.addEventListener("pointerdown",__privateGet(this,n)),this.div.addEventListener("pointerup",__privateGet(this,r))}disableClick(){this.div.removeEventListener("pointerdown",__privateGet(this,n)),this.div.removeEventListener("pointerup",__privateGet(this,r))}attach(t){__privateGet(this,o).set(t.id,t)}detach(t){var e;__privateGet(this,o).delete(t.id),null==(e=__privateGet(this,i))||e.removePointerInTextLayer(t.contentDiv)}remove(t){__privateGet(this,h).removeEditor(t),this.detach(t),this.annotationStorage.remove(t.id),t.div.style.display="none",setTimeout(()=>{t.div.style.display="",t.div.remove(),t.isAttachedToDOM=!1,document.activeElement===document.body&&__privateGet(this,h).focusMainContainer()},0),__privateGet(this,c)||this.addInkEditorIfNeeded(!1)}add(t){if(__privateMethod(this,d,u).call(this,t),__privateGet(this,h).addEditor(t),this.attach(t),!t.isAttachedToDOM){const e=t.render();this.div.append(e),t.isAttachedToDOM=!0}this.moveEditorInDOM(t),t.onceAdded(),this.addToAnnotationStorage(t)}moveEditorInDOM(t){var e;null==(e=__privateGet(this,i))||e.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addToAnnotationStorage(t){t.isEmpty()||this.annotationStorage.has(t.id)||this.annotationStorage.setValue(t.id,t)}addOrRebuild(t){t.needsToBeRebuilt()?t.rebuild():this.add(t)}addANewEditor(t){this.addCommands({cmd:()=>{this.addOrRebuild(t)},undo:()=>{t.remove()},mustExec:!0})}addUndoableEditor(t){this.addCommands({cmd:()=>{this.addOrRebuild(t)},undo:()=>{t.remove()},mustExec:!1})}getNextId(){return __privateGet(this,h).getId()}deserialize(t){switch(t.annotationType){case A.AnnotationEditorType.FREETEXT:return y.FreeTextEditor.deserialize(t,this);case A.AnnotationEditorType.INK:return x.InkEditor.deserialize(t,this)}return null}setSelected(t){__privateGet(this,h).setSelected(t)}toggleSelected(t){__privateGet(this,h).toggleSelected(t)}isSelected(t){return __privateGet(this,h).isSelected(t)}unselect(t){__privateGet(this,h).unselect(t)}pointerup(t){const e=b.KeyboardManager.platform.isMac;0!==t.button||t.ctrlKey&&e||t.target===this.div&&__privateGet(this,l)&&(__privateSet(this,l,!1),__privateGet(this,a)?__privateMethod(this,f,g).call(this,t):__privateSet(this,a,!0))}pointerdown(t){const e=b.KeyboardManager.platform.isMac;if(0!==t.button||t.ctrlKey&&e)return;if(t.target!==this.div)return;__privateSet(this,l,!0);const s=__privateGet(this,h).getActive();__privateSet(this,a,!s||s.isEmpty())}drop(t){const e=t.dataTransfer.getData("text/plain"),s=__privateGet(this,h).getEditor(e);if(!s)return;t.preventDefault(),t.dataTransfer.dropEffect="move",__privateMethod(this,d,u).call(this,s);const i=this.div.getBoundingClientRect(),a=t.clientX-i.x,r=t.clientY-i.y;s.translate(a-s.startX,r-s.startY),this.moveEditorInDOM(s),s.div.focus()}dragover(t){t.preventDefault()}destroy(){var t,e;(null==(t=__privateGet(this,h).getActive())?void 0:t.parent)===this&&__privateGet(this,h).setActiveEditor(null);for(const s of __privateGet(this,o).values())null==(e=__privateGet(this,i))||e.removePointerInTextLayer(s.contentDiv),s.isAttachedToDOM=!1,s.div.remove(),s.parent=null;this.div=null,__privateGet(this,o).clear(),__privateGet(this,h).removeLayer(this)}render(t){this.viewport=t.viewport,(0,b.bindEvents)(this,this.div,["dragover","drop"]),this.setDimensions();for(const e of __privateGet(this,h).getEditors(this.pageIndex))this.add(e);this.updateMode()}update(t){this.viewport=t.viewport,this.setDimensions(),this.updateMode()}get scaleFactor(){return this.viewport.scale}get pageDimensions(){const[t,e,s,i]=this.viewport.viewBox;return[s-t,i-e]}get viewportBaseDimensions(){const{width:t,height:e,rotation:s}=this.viewport;return s%180==0?[t,e]:[e,t]}setDimensions(){const{width:t,height:e,rotation:s}=this.viewport,i=s%180!=0,a=Math.floor(t)+"px",r=Math.floor(e)+"px";this.div.style.width=i?r:a,this.div.style.height=i?a:r,this.div.setAttribute("data-main-rotation",s)}};i=new WeakMap,a=new WeakMap,r=new WeakMap,n=new WeakMap,o=new WeakMap,l=new WeakMap,c=new WeakMap,h=new WeakMap,d=new WeakSet,u=function(t){var e;t.parent!==this&&(this.attach(t),t.pageIndex=this.pageIndex,null==(e=t.parent)||e.detach(t),t.parent=this,t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))},p=new WeakSet,_=function(t){switch(__privateGet(this,h).getMode()){case A.AnnotationEditorType.FREETEXT:return new y.FreeTextEditor(t);case A.AnnotationEditorType.INK:return new x.InkEditor(t)}return null},f=new WeakSet,g=function(t){const e=this.getNextId(),s=__privateMethod(this,p,_).call(this,{parent:this,id:e,x:t.offsetX,y:t.offsetY});return s&&this.add(s),s},m=new WeakSet,v=function(){__privateSet(this,c,!0);for(const t of __privateGet(this,o).values())t.isEmpty()&&t.remove();__privateSet(this,c,!1)},__publicField(S,"_initialized",!1);let w=S;e.AnnotationEditorLayer=w},(t,e,s)=>{var i,a,r,n,o,l,c,h,d,u,p,_,f,g,m;Object.defineProperty(e,"__esModule",{value:!0}),e.FreeTextEditor=void 0;var v=s(1),b=s(7),A=s(6);const y=class t extends A.AnnotationEditor{constructor(e){super({...e,name:"freeTextEditor"}),__privateAdd(this,h),__privateAdd(this,u),__privateAdd(this,_),__privateAdd(this,g),__privateAdd(this,i,this.editorDivBlur.bind(this)),__privateAdd(this,a,this.editorDivFocus.bind(this)),__privateAdd(this,r,this.editorDivKeydown.bind(this)),__privateAdd(this,n,void 0),__privateAdd(this,o,""),__privateAdd(this,l,!1),__privateAdd(this,c,void 0),__privateSet(this,n,e.color||t._defaultColor||A.AnnotationEditor._defaultLineColor),__privateSet(this,c,e.fontSize||t._defaultFontSize)}static initialize(t){this._l10nPromise=new Map(["free_text_default_content","editor_free_text_aria_label"].map(e=>[e,t.get(e)]));const e=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(e.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,s){switch(e){case v.AnnotationEditorParamsType.FREETEXT_SIZE:t._defaultFontSize=s;break;case v.AnnotationEditorParamsType.FREETEXT_COLOR:t._defaultColor=s}}updateParams(t,e){switch(t){case v.AnnotationEditorParamsType.FREETEXT_SIZE:__privateMethod(this,h,d).call(this,e);break;case v.AnnotationEditorParamsType.FREETEXT_COLOR:__privateMethod(this,u,p).call(this,e)}}static get defaultPropertiesToUpdate(){return[[v.AnnotationEditorParamsType.FREETEXT_SIZE,t._defaultFontSize],[v.AnnotationEditorParamsType.FREETEXT_COLOR,t._defaultColor||A.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[v.AnnotationEditorParamsType.FREETEXT_SIZE,__privateGet(this,c)],[v.AnnotationEditorParamsType.FREETEXT_COLOR,__privateGet(this,n)]]}getInitialTranslation(){return[-t._internalPadding*this.parent.scaleFactor,-(t._internalPadding+__privateGet(this,c))*this.parent.scaleFactor]}rebuild(){super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(v.AnnotationEditorType.FREETEXT),super.enableEditMode(),this.enableEditing(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this.div.draggable=!1,this.editorDiv.addEventListener("keydown",__privateGet(this,r)),this.editorDiv.addEventListener("focus",__privateGet(this,a)),this.editorDiv.addEventListener("blur",__privateGet(this,i)))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.disableEditing(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.draggable=!0,this.editorDiv.removeEventListener("keydown",__privateGet(this,r)),this.editorDiv.removeEventListener("focus",__privateGet(this,a)),this.editorDiv.removeEventListener("blur",__privateGet(this,i)),this.div.focus(),this.isEditing=!1)}focusin(t){super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus()}onceAdded(){this.width||(this.enableEditMode(),this.editorDiv.focus())}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1,this.parent.setEditingState(!0),super.remove()}commit(){super.commit(),__privateGet(this,l)||(__privateSet(this,l,!0),this.parent.addUndoableEditor(this)),this.disableEditMode(),__privateSet(this,o,__privateMethod(this,_,f).call(this).trimEnd()),__privateMethod(this,g,m).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}dblclick(t){this.enableEditMode(),this.editorDiv.focus()}keydown(t){t.target===this.div&&"Enter"===t.key&&(this.enableEditMode(),this.editorDiv.focus())}editorDivKeydown(e){t._keyboardManager.exec(this,e)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let e,s;this.width&&(e=this.x,s=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",`${this.id}-editor`),this.enableEditing(),t._l10nPromise.get("editor_free_text_aria_label").then(t=>{var e;return null==(e=this.editorDiv)?void 0:e.setAttribute("aria-label",t)}),t._l10nPromise.get("free_text_default_content").then(t=>{var e;return null==(e=this.editorDiv)?void 0:e.setAttribute("default-content",t)}),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize=`calc(${__privateGet(this,c)}px * var(--scale-factor))`,i.color=__privateGet(this,n),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),(0,b.bindEvents)(this,this.div,["dblclick","keydown"]),this.width){const[t,i]=this.parent.viewportBaseDimensions;this.setAt(e*t,s*i,this.width*t,this.height*i);for(const e of __privateGet(this,o).split("\n")){const t=document.createElement("div");t.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(t)}this.div.draggable=!0,this.editorDiv.contentEditable=!1}else this.div.draggable=!1,this.editorDiv.contentEditable=!0;return this.div}get contentDiv(){return this.editorDiv}static deserialize(t,e){const s=super.deserialize(t,e);return __privateSet(s,c,t.fontSize),__privateSet(s,n,v.Util.makeHexColor(...t.color)),__privateSet(s,o,t.value),s}serialize(){if(this.isEmpty())return null;const e=t._internalPadding*this.parent.scaleFactor,s=this.getRect(e,e),i=A.AnnotationEditor._colorManager.convert(getComputedStyle(this.editorDiv).color);return{annotationType:v.AnnotationEditorType.FREETEXT,color:i,fontSize:__privateGet(this,c),value:__privateGet(this,o),pageIndex:this.parent.pageIndex,rect:s,rotation:this.rotation}}};i=new WeakMap,a=new WeakMap,r=new WeakMap,n=new WeakMap,o=new WeakMap,l=new WeakMap,c=new WeakMap,h=new WeakSet,d=function(t){const e=t=>{this.editorDiv.style.fontSize=`calc(${t}px * var(--scale-factor))`,this.translate(0,-(t-__privateGet(this,c))*this.parent.scaleFactor),__privateSet(this,c,t),__privateMethod(this,g,m).call(this)},s=__privateGet(this,c);this.parent.addCommands({cmd:()=>{e(t)},undo:()=>{e(s)},mustExec:!0,type:v.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})},u=new WeakSet,p=function(t){const e=__privateGet(this,n);this.parent.addCommands({cmd:()=>{__privateSet(this,n,t),this.editorDiv.style.color=t},undo:()=>{__privateSet(this,n,e),this.editorDiv.style.color=e},mustExec:!0,type:v.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})},_=new WeakSet,f=function(){const t=this.editorDiv.getElementsByTagName("div");if(0===t.length)return this.editorDiv.innerText;const e=[];for(let s=0,i=t.length;s<i;s++){const i=t[s].firstChild;"#text"===(null==i?void 0:i.nodeName)?e.push(i.data):e.push("")}return e.join("\n")},g=new WeakSet,m=function(){const[t,e]=this.parent.viewportBaseDimensions,s=this.div.getBoundingClientRect();this.width=s.width/t,this.height=s.height/e},__publicField(y,"_freeTextDefaultContent",""),__publicField(y,"_l10nPromise"),__publicField(y,"_internalPadding",0),__publicField(y,"_defaultColor",null),__publicField(y,"_defaultFontSize",10),__publicField(y,"_keyboardManager",new b.KeyboardManager([[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],y.prototype.commitOrRemove]])),__publicField(y,"_type","freetext");let x=y;e.FreeTextEditor=x},(t,e,s)=>{var i,a,r,n,o,l,c,h,d,u,p,_,f,g,m,v,b,A,y,x,S,w,C,k,T,E,P,M,F,R,D,N,I,O,L,G,j,B,W,U,V,q,z,H,$,X,Y,K,J,Q,Z,tt,et,st,it,at,rt,nt,ot,lt;Object.defineProperty(e,"__esModule",{value:!0}),e.InkEditor=void 0,Object.defineProperty(e,"fitCurve",{enumerable:!0,get:function(){return dt.fitCurve}});var ct=s(1),ht=s(6),dt=s(25),ut=s(7);const pt=16,_t=class t extends ht.AnnotationEditor{constructor(t){super({...t,name:"inkEditor"}),__privateAdd(this,m),__privateAdd(this,b),__privateAdd(this,y),__privateAdd(this,S),__privateAdd(this,C),__privateAdd(this,T),__privateAdd(this,P),__privateAdd(this,F),__privateAdd(this,D),__privateAdd(this,I),__privateAdd(this,L),__privateAdd(this,j),__privateAdd(this,W),__privateAdd(this,V),__privateAdd(this,z),__privateAdd(this,Y),__privateAdd(this,J),__privateAdd(this,Z),__privateAdd(this,et),__privateAdd(this,it),__privateAdd(this,rt),__privateAdd(this,ot),__privateAdd(this,i,0),__privateAdd(this,a,0),__privateAdd(this,r,0),__privateAdd(this,n,this.canvasPointermove.bind(this)),__privateAdd(this,o,this.canvasPointerleave.bind(this)),__privateAdd(this,l,this.canvasPointerup.bind(this)),__privateAdd(this,c,this.canvasPointerdown.bind(this)),__privateAdd(this,h,!1),__privateAdd(this,d,!1),__privateAdd(this,u,null),__privateAdd(this,p,null),__privateAdd(this,_,0),__privateAdd(this,f,0),__privateAdd(this,g,null),this.color=t.color||null,this.thickness=t.thickness||null,this.opacity=t.opacity||null,this.paths=[],this.bezierPath2D=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0}static initialize(t){this._l10nPromise=new Map(["editor_ink_canvas_aria_label","editor_ink_aria_label"].map(e=>[e,t.get(e)]))}static updateDefaultParams(e,s){switch(e){case ct.AnnotationEditorParamsType.INK_THICKNESS:t._defaultThickness=s;break;case ct.AnnotationEditorParamsType.INK_COLOR:t._defaultColor=s;break;case ct.AnnotationEditorParamsType.INK_OPACITY:t._defaultOpacity=s/100}}updateParams(t,e){switch(t){case ct.AnnotationEditorParamsType.INK_THICKNESS:__privateMethod(this,m,v).call(this,e);break;case ct.AnnotationEditorParamsType.INK_COLOR:__privateMethod(this,b,A).call(this,e);break;case ct.AnnotationEditorParamsType.INK_OPACITY:__privateMethod(this,y,x).call(this,e)}}static get defaultPropertiesToUpdate(){return[[ct.AnnotationEditorParamsType.INK_THICKNESS,t._defaultThickness],[ct.AnnotationEditorParamsType.INK_COLOR,t._defaultColor||ht.AnnotationEditor._defaultLineColor],[ct.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*t._defaultOpacity)]]}get propertiesToUpdate(){return[[ct.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||t._defaultThickness],[ct.AnnotationEditorParamsType.INK_COLOR,this.color||t._defaultColor||ht.AnnotationEditor._defaultLineColor],[ct.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??t._defaultOpacity))]]}rebuild(){super.rebuild(),null!==this.div&&(this.canvas||(__privateMethod(this,L,G).call(this),__privateMethod(this,j,B).call(this)),this.isAttachedToDOM||(this.parent.add(this),__privateMethod(this,W,U).call(this)),__privateMethod(this,rt,nt).call(this))}remove(){null!==this.canvas&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,__privateGet(this,p).disconnect(),__privateSet(this,p,null),super.remove())}enableEditMode(){__privateGet(this,h)||null===this.canvas||(super.enableEditMode(),this.div.draggable=!1,this.canvas.addEventListener("pointerdown",__privateGet(this,c)),this.canvas.addEventListener("pointerup",__privateGet(this,l)))}disableEditMode(){this.isInEditMode()&&null!==this.canvas&&(super.disableEditMode(),this.div.draggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",__privateGet(this,c)),this.canvas.removeEventListener("pointerup",__privateGet(this,l)))}onceAdded(){this.div.draggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}commit(){__privateGet(this,h)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),__privateSet(this,h,!0),this.div.classList.add("disabled"),__privateMethod(this,rt,nt).call(this,!0),this.parent.addInkEditorIfNeeded(!0),this.parent.moveEditorInDOM(this),this.div.focus())}focusin(t){super.focusin(t),this.enableEditMode()}canvasPointerdown(t){0===t.button&&this.isInEditMode()&&!__privateGet(this,h)&&(this.setInForeground(),"mouse"!==t.type&&this.div.focus(),t.stopPropagation(),this.canvas.addEventListener("pointerleave",__privateGet(this,o)),this.canvas.addEventListener("pointermove",__privateGet(this,n)),__privateMethod(this,T,E).call(this,t.offsetX,t.offsetY))}canvasPointermove(t){t.stopPropagation(),__privateMethod(this,P,M).call(this,t.offsetX,t.offsetY)}canvasPointerup(t){0===t.button&&this.isInEditMode()&&0!==this.currentPath.length&&(t.stopPropagation(),__privateMethod(this,I,O).call(this,t),this.setInBackground())}canvasPointerleave(t){__privateMethod(this,I,O).call(this,t),this.setInBackground()}render(){if(this.div)return this.div;let e,s;this.width&&(e=this.x,s=this.y),super.render(),t._l10nPromise.get("editor_ink_aria_label").then(t=>{var e;return null==(e=this.div)?void 0:e.setAttribute("aria-label",t)});const[i,a,r,n]=__privateMethod(this,S,w).call(this);if(this.setAt(i,a,0,0),this.setDims(r,n),__privateMethod(this,L,G).call(this),this.width){const[t,i]=this.parent.viewportBaseDimensions;this.setAt(e*t,s*i,this.width*t,this.height*i),__privateSet(this,d,!0),__privateMethod(this,W,U).call(this),this.setDims(this.width*t,this.height*i),__privateMethod(this,D,N).call(this),__privateMethod(this,ot,lt).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return __privateMethod(this,j,B).call(this),this.div}setDimensions(t,e){const s=Math.round(t),a=Math.round(e);if(__privateGet(this,_)===s&&__privateGet(this,f)===a)return;__privateSet(this,_,s),__privateSet(this,f,a),this.canvas.style.visibility="hidden",__privateGet(this,i)&&Math.abs(__privateGet(this,i)-t/e)>.01&&(e=Math.ceil(t/__privateGet(this,i)),this.setDims(t,e));const[r,n]=this.parent.viewportBaseDimensions;this.width=t/r,this.height=e/n,__privateGet(this,h)&&__privateMethod(this,V,q).call(this,t,e),__privateMethod(this,W,U).call(this),__privateMethod(this,D,N).call(this),this.canvas.style.visibility="visible"}static deserialize(t,e){var s,n;const o=super.deserialize(t,e);o.thickness=t.thickness,o.color=ct.Util.makeHexColor(...t.color),o.opacity=t.opacity;const[l,c]=e.pageDimensions,d=o.width*l,u=o.height*c,p=e.scaleFactor,g=t.thickness/2;__privateSet(o,i,d/u),__privateSet(o,h,!0),__privateSet(o,_,Math.round(d)),__privateSet(o,f,Math.round(u));for(const{bezier:i}of t.paths){const t=[];o.paths.push(t);let e=p*(i[0]-g),s=p*(u-i[1]-g);for(let r=2,n=i.length;r<n;r+=6){const a=p*(i[r]-g),n=p*(u-i[r+1]-g),o=p*(i[r+2]-g),l=p*(u-i[r+3]-g),c=p*(i[r+4]-g),h=p*(u-i[r+5]-g);t.push([[e,s],[a,n],[o,l],[c,h]]),e=c,s=h}const a=__privateMethod(this,$,X).call(this,t);o.bezierPath2D.push(a)}const m=__privateMethod(s=o,et,st).call(s);return __privateSet(o,r,Math.max(pt,m[2]-m[0])),__privateSet(o,a,Math.max(pt,m[3]-m[1])),__privateMethod(n=o,V,q).call(n,d,u),o}serialize(){if(this.isEmpty())return null;const t=this.getRect(0,0),e=this.rotation%180==0?t[3]-t[1]:t[2]-t[0],s=ht.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:ct.AnnotationEditorType.INK,color:s,thickness:this.thickness,opacity:this.opacity,paths:__privateMethod(this,Y,K).call(this,this.scaleFactor/this.parent.scaleFactor,this.translationX,this.translationY,e),pageIndex:this.parent.pageIndex,rect:t,rotation:this.rotation}}};i=new WeakMap,a=new WeakMap,r=new WeakMap,n=new WeakMap,o=new WeakMap,l=new WeakMap,c=new WeakMap,h=new WeakMap,d=new WeakMap,u=new WeakMap,p=new WeakMap,_=new WeakMap,f=new WeakMap,g=new WeakMap,m=new WeakSet,v=function(t){const e=this.thickness;this.parent.addCommands({cmd:()=>{this.thickness=t,__privateMethod(this,rt,nt).call(this)},undo:()=>{this.thickness=e,__privateMethod(this,rt,nt).call(this)},mustExec:!0,type:ct.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})},b=new WeakSet,A=function(t){const e=this.color;this.parent.addCommands({cmd:()=>{this.color=t,__privateMethod(this,D,N).call(this)},undo:()=>{this.color=e,__privateMethod(this,D,N).call(this)},mustExec:!0,type:ct.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})},y=new WeakSet,x=function(t){t/=100;const e=this.opacity;this.parent.addCommands({cmd:()=>{this.opacity=t,__privateMethod(this,D,N).call(this)},undo:()=>{this.opacity=e,__privateMethod(this,D,N).call(this)},mustExec:!0,type:ct.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})},S=new WeakSet,w=function(){const{width:t,height:e,rotation:s}=this.parent.viewport;switch(s){case 90:return[0,t,t,e];case 180:return[t,e,t,e];case 270:return[e,0,t,e];default:return[0,0,t,e]}},C=new WeakSet,k=function(){this.ctx.lineWidth=this.thickness*this.parent.scaleFactor/this.scaleFactor,this.ctx.lineCap="round",this.ctx.lineJoin="round",this.ctx.miterLimit=10,this.ctx.strokeStyle=`${this.color}${(0,ut.opacityToHex)(this.opacity)}`},T=new WeakSet,E=function(t,e){this.isEditing=!0,__privateGet(this,d)||(__privateSet(this,d,!0),__privateMethod(this,W,U).call(this),this.thickness||(this.thickness=_t._defaultThickness),this.color||(this.color=_t._defaultColor||ht.AnnotationEditor._defaultLineColor),this.opacity??(this.opacity=_t._defaultOpacity)),this.currentPath.push([t,e]),__privateSet(this,u,null),__privateMethod(this,C,k).call(this),this.ctx.beginPath(),this.ctx.moveTo(t,e),__privateSet(this,g,()=>{__privateGet(this,g)&&(__privateGet(this,u)&&(this.isEmpty()?(this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)):__privateMethod(this,D,N).call(this),this.ctx.lineTo(...__privateGet(this,u)),__privateSet(this,u,null),this.ctx.stroke()),window.requestAnimationFrame(__privateGet(this,g)))}),window.requestAnimationFrame(__privateGet(this,g))},P=new WeakSet,M=function(t,e){const[s,i]=this.currentPath.at(-1);t===s&&e===i||(this.currentPath.push([t,e]),__privateSet(this,u,[t,e]))},F=new WeakSet,R=function(t,e){var s;this.ctx.closePath(),__privateSet(this,g,null),t=Math.min(Math.max(t,0),this.canvas.width),e=Math.min(Math.max(e,0),this.canvas.height);const[i,a]=this.currentPath.at(-1);let r;if(t===i&&e===a||this.currentPath.push([t,e]),1!==this.currentPath.length)r=(0,dt.fitCurve)(this.currentPath,30,null);else{const s=[t,e];r=[[s,s.slice(),s.slice(),s]]}const n=__privateMethod(s=_t,$,X).call(s,r);this.currentPath.length=0,this.parent.addCommands({cmd:()=>{this.paths.push(r),this.bezierPath2D.push(n),this.rebuild()},undo:()=>{this.paths.pop(),this.bezierPath2D.pop(),0===this.paths.length?this.remove():(this.canvas||(__privateMethod(this,L,G).call(this),__privateMethod(this,j,B).call(this)),__privateMethod(this,rt,nt).call(this))},mustExec:!0})},D=new WeakSet,N=function(){if(this.isEmpty())return void __privateMethod(this,z,H).call(this);__privateMethod(this,C,k).call(this);const{canvas:t,ctx:e}=this;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t.width,t.height),__privateMethod(this,z,H).call(this);for(const s of this.bezierPath2D)e.stroke(s)},I=new WeakSet,O=function(t){__privateMethod(this,F,R).call(this,t.offsetX,t.offsetY),this.canvas.removeEventListener("pointerleave",__privateGet(this,o)),this.canvas.removeEventListener("pointermove",__privateGet(this,n)),this.parent.addToAnnotationStorage(this)},L=new WeakSet,G=function(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",_t._l10nPromise.get("editor_ink_canvas_aria_label").then(t=>{var e;return null==(e=this.canvas)?void 0:e.setAttribute("aria-label",t)}),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")},j=new WeakSet,B=function(){__privateSet(this,p,new ResizeObserver(t=>{const e=t[0].contentRect;e.width&&e.height&&this.setDimensions(e.width,e.height)})),__privateGet(this,p).observe(this.div)},W=new WeakSet,U=function(){if(!__privateGet(this,d))return;const[t,e]=this.parent.viewportBaseDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*e),__privateMethod(this,z,H).call(this)},V=new WeakSet,q=function(t,e){const s=__privateMethod(this,it,at).call(this),i=(t-s)/__privateGet(this,r),n=(e-s)/__privateGet(this,a);this.scaleFactor=Math.min(i,n)},z=new WeakSet,H=function(){const t=__privateMethod(this,it,at).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)},$=new WeakSet,X=function(t){const e=new Path2D;for(let s=0,i=t.length;s<i;s++){const[i,a,r,n]=t[s];0===s&&e.moveTo(...i),e.bezierCurveTo(a[0],a[1],r[0],r[1],n[0],n[1])}return e},Y=new WeakSet,K=function(t,e,s,i){const a=[],r=this.thickness/2;let n,o;for(const l of this.paths){n=[],o=[];for(let a=0,c=l.length;a<c;a++){const[c,h,d,u]=l[a],p=t*(c[0]+e)+r,_=i-t*(c[1]+s)-r,f=t*(h[0]+e)+r,g=i-t*(h[1]+s)-r,m=t*(d[0]+e)+r,v=i-t*(d[1]+s)-r,b=t*(u[0]+e)+r,A=i-t*(u[1]+s)-r;0===a&&(n.push(p,_),o.push(p,_)),n.push(f,g,m,v,b,A),__privateMethod(this,J,Q).call(this,p,_,f,g,m,v,b,A,4,o)}a.push({bezier:n,points:o})}return a},J=new WeakSet,Q=function(t,e,s,i,a,r,n,o,l,c){if(__privateMethod(this,Z,tt).call(this,t,e,s,i,a,r,n,o))c.push(n,o);else{for(let h=1;h<l-1;h++){const d=h/l,u=1-d;let p=d*t+u*s,_=d*e+u*i,f=d*s+u*a,g=d*i+u*r;p=d*p+u*f,_=d*_+u*g,f=d*f+u*(d*a+u*n),g=d*g+u*(d*r+u*o),p=d*p+u*f,_=d*_+u*g,c.push(p,_)}c.push(n,o)}},Z=new WeakSet,tt=function(t,e,s,i,a,r,n,o){const l=(3*s-2*t-n)**2,c=(3*i-2*e-o)**2,h=(3*a-t-2*n)**2,d=(3*r-e-2*o)**2;return Math.max(l,h)+Math.max(c,d)<=10},et=new WeakSet,st=function(){let t=1/0,e=-1/0,s=1/0,i=-1/0;for(const a of this.paths)for(const[r,n,o,l]of a){const a=ct.Util.bezierBoundingBox(...r,...n,...o,...l);t=Math.min(t,a[0]),s=Math.min(s,a[1]),e=Math.max(e,a[2]),i=Math.max(i,a[3])}return[t,s,e,i]},it=new WeakSet,at=function(){return __privateGet(this,h)?Math.ceil(this.thickness*this.parent.scaleFactor):0},rt=new WeakSet,nt=function(t=!1){if(this.isEmpty())return;if(!__privateGet(this,h))return void __privateMethod(this,D,N).call(this);const e=__privateMethod(this,et,st).call(this),s=__privateMethod(this,it,at).call(this);__privateSet(this,r,Math.max(pt,e[2]-e[0])),__privateSet(this,a,Math.max(pt,e[3]-e[1]));const n=Math.ceil(s+__privateGet(this,r)*this.scaleFactor),o=Math.ceil(s+__privateGet(this,a)*this.scaleFactor),[l,c]=this.parent.viewportBaseDimensions;this.width=n/l,this.height=o/c,__privateSet(this,i,n/o),__privateMethod(this,ot,lt).call(this);const d=this.translationX,u=this.translationY;this.translationX=-e[0],this.translationY=-e[1],__privateMethod(this,W,U).call(this),__privateMethod(this,D,N).call(this),__privateSet(this,_,n),__privateSet(this,f,o),this.setDims(n,o);const p=t?s/this.scaleFactor/2:0;this.translate(d-this.translationX-p,u-this.translationY-p)},ot=new WeakSet,lt=function(){const{style:t}=this.div;__privateGet(this,i)>=1?(t.minHeight="16px",t.minWidth=`${Math.round(__privateGet(this,i)*pt)}px`):(t.minWidth="16px",t.minHeight=`${Math.round(pt/__privateGet(this,i))}px`)},__privateAdd(_t,$),__publicField(_t,"_defaultColor",null),__publicField(_t,"_defaultOpacity",1),__publicField(_t,"_defaultThickness",1),__publicField(_t,"_l10nPromise"),__publicField(_t,"_type","ink");let ft=_t;e.InkEditor=ft},(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.fitCurve=void 0;const i=s(26);e.fitCurve=i},t=>{function e(t,a,r,n,l){var c,h,d,u,p,_,f,g,m,v,b,A,y;if(2===t.length)return A=o.vectorLen(o.subtract(t[0],t[1]))/3,[c=[t[0],o.addArrays(t[0],o.mulItems(a,A)),o.addArrays(t[1],o.mulItems(r,A)),t[1]]];if(h=function(t){var e,s,i,a=[];return t.forEach((t,r)=>{e=r?s+o.vectorLen(o.subtract(t,i)):0,a.push(e),s=e,i=t}),a=a.map(t=>t/s)}(t),[c,u,_]=s(t,h,h,a,r,l),0===u||u<n)return[c];if(u<n*n)for(d=h,p=u,f=_,y=0;y<20;y++){if(d=i(c,t,d),[c,u,_]=s(t,h,d,a,r,l),u<n)return[c];if(_===f){let t=u/p;if(t>.9999&&t<1.0001)break}p=u,f=_}return b=[],(g=o.subtract(t[_-1],t[_+1])).every(t=>0===t)&&(g=o.subtract(t[_-1],t[_]),[g[0],g[1]]=[-g[1],g[0]]),m=o.normalize(g),v=o.mulItems(m,-1),b=(b=b.concat(e(t.slice(0,_+1),a,m,n,l))).concat(e(t.slice(_),v,r,n,l))}function s(t,e,s,i,n,c){var h,d,u;return h=function(t,e,s,i){var a,r,n,c,h,d,u,p,_,f,g,m,v,b,A,y,x,S=t[0],w=t[t.length-1];for(a=[S,null,null,w],r=o.zeros_Xx2x2(e.length),v=0,b=e.length;v<b;v++)x=1-(y=e[v]),(n=r[v])[0]=o.mulItems(s,3*y*(x*x)),n[1]=o.mulItems(i,3*x*(y*y));for(c=[[0,0],[0,0]],h=[0,0],v=0,b=t.length;v<b;v++)y=e[v],n=r[v],c[0][0]+=o.dot(n[0],n[0]),c[0][1]+=o.dot(n[0],n[1]),c[1][0]+=o.dot(n[0],n[1]),c[1][1]+=o.dot(n[1],n[1]),A=o.subtract(t[v],l.q([S,S,w,w],y)),h[0]+=o.dot(n[0],A),h[1]+=o.dot(n[1],A);return d=c[0][0]*c[1][1]-c[1][0]*c[0][1],u=c[0][0]*h[1]-c[1][0]*h[0],p=h[0]*c[1][1]-h[1]*c[0][1],_=0===d?0:p/d,f=0===d?0:u/d,m=o.vectorLen(o.subtract(S,w)),_<(g=1e-6*m)||f<g?(a[1]=o.addArrays(S,o.mulItems(s,m/3)),a[2]=o.addArrays(w,o.mulItems(i,m/3))):(a[1]=o.addArrays(S,o.mulItems(s,_)),a[2]=o.addArrays(w,o.mulItems(i,f))),a}(t,s,i,n),[d,u]=function(t,e,s){var i,n,c,h,d,u,p,_;n=0,c=Math.floor(t.length/2);const f=a(e,10);for(d=0,u=t.length;d<u;d++)p=t[d],_=r(0,s[d],f,10),(i=(h=o.subtract(l.q(e,_),p))[0]*h[0]+h[1]*h[1])>n&&(n=i,c=d);return[n,c]}(t,h,e),c&&c({bez:h,points:t,params:e,maxErr:d,maxPoint:u}),[h,d,u]}function i(t,e,s){return s.map((s,i)=>{return a=t,r=e[i],n=s,c=o.subtract(l.q(a,n),r),h=l.qprime(a,n),d=o.mulMatrix(c,h),0===(u=o.sum(o.squareItems(h))+2*o.mulMatrix(c,l.qprimeprime(a,n)))?n:n-d/u;var a,r,n,c,h,d,u})}var a=function(t,e){for(var s,i=[0],a=t[0],r=0,n=1;n<=e;n++)s=l.q(t,n/e),r+=o.vectorLen(o.subtract(s,a)),i.push(r),a=s;return i=i.map(t=>t/r)};function r(t,e,s,i){if(e<0)return 0;if(e>1)return 1;for(var a,r,n,o,l=1;l<=i;l++)if(e<=s[l]){n=(l-1)/i,r=l/i,o=(e-(a=s[l-1]))/(s[l]-a)*(r-n)+n;break}return o}function n(t,e){return o.normalize(o.subtract(t,e))}class o{static zeros_Xx2x2(t){for(var e=[];t--;)e.push([0,0]);return e}static mulItems(t,e){return t.map(t=>t*e)}static mulMatrix(t,e){return t.reduce((t,s,i)=>t+s*e[i],0)}static subtract(t,e){return t.map((t,s)=>t-e[s])}static addArrays(t,e){return t.map((t,s)=>t+e[s])}static addItems(t,e){return t.map(t=>t+e)}static sum(t){return t.reduce((t,e)=>t+e)}static dot(t,e){return o.mulMatrix(t,e)}static vectorLen(t){return Math.hypot(...t)}static divItems(t,e){return t.map(t=>t/e)}static squareItems(t){return t.map(t=>t*t)}static normalize(t){return this.divItems(t,this.vectorLen(t))}}class l{static q(t,e){var s=1-e,i=o.mulItems(t[0],s*s*s),a=o.mulItems(t[1],3*s*s*e),r=o.mulItems(t[2],3*s*e*e),n=o.mulItems(t[3],e*e*e);return o.addArrays(o.addArrays(i,a),o.addArrays(r,n))}static qprime(t,e){var s=1-e,i=o.mulItems(o.subtract(t[1],t[0]),3*s*s),a=o.mulItems(o.subtract(t[2],t[1]),6*s*e),r=o.mulItems(o.subtract(t[3],t[2]),3*e*e);return o.addArrays(o.addArrays(i,a),r)}static qprimeprime(t,e){return o.addArrays(o.mulItems(o.addArrays(o.subtract(t[2],o.mulItems(t[1],2)),t[0]),6*(1-e)),o.mulItems(o.addArrays(o.subtract(t[3],o.mulItems(t[2],2)),t[1]),6*e))}}t.exports=function(t,s,i){if(!Array.isArray(t))throw new TypeError("First argument should be an array");if(t.forEach(e=>{if(!Array.isArray(e)||e.some(t=>"number"!=typeof t)||e.length!==t[0].length)throw Error("Each point should be an array of numbers. Each point should have the same amount of numbers.")}),(t=t.filter((e,s)=>0===s||!e.every((e,i)=>e===t[s-1][i]))).length<2)return[];const a=t.length,r=n(t[1],t[0]),o=n(t[a-2],t[a-1]);return e(t,r,o,s,i)},t.exports.fitCubic=e,t.exports.createTangent=n},(t,e,s)=>{var i,a,r,n,o,l;Object.defineProperty(e,"__esModule",{value:!0}),e.AnnotationLayer=void 0;var c=s(1),h=s(8),d=s(5),u=s(28),p=s(29);const _=1e3,f=new WeakSet;function g(t){return{width:t[2]-t[0],height:t[3]-t[1]}}class m{static create(t){switch(t.data.annotationType){case c.AnnotationType.LINK:return new b(t);case c.AnnotationType.TEXT:return new A(t);case c.AnnotationType.WIDGET:switch(t.data.fieldType){case"Tx":return new x(t);case"Btn":return t.data.radioButton?new w(t):t.data.checkBox?new S(t):new C(t);case"Ch":return new k(t)}return new y(t);case c.AnnotationType.POPUP:return new T(t);case c.AnnotationType.FREETEXT:return new P(t);case c.AnnotationType.LINE:return new M(t);case c.AnnotationType.SQUARE:return new F(t);case c.AnnotationType.CIRCLE:return new R(t);case c.AnnotationType.POLYLINE:return new D(t);case c.AnnotationType.CARET:return new I(t);case c.AnnotationType.INK:return new O(t);case c.AnnotationType.POLYGON:return new N(t);case c.AnnotationType.HIGHLIGHT:return new L(t);case c.AnnotationType.UNDERLINE:return new G(t);case c.AnnotationType.SQUIGGLY:return new j(t);case c.AnnotationType.STRIKEOUT:return new B(t);case c.AnnotationType.STAMP:return new W(t);case c.AnnotationType.FILEATTACHMENT:return new U(t);default:return new v(t)}}}class v{constructor(t,{isRenderable:e=!1,ignoreBorder:s=!1,createQuadrilaterals:i=!1}={}){this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.page=t.page,this.viewport=t.viewport,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this._mouseState=t.mouseState,e&&(this.container=this._createContainer(s)),i&&(this.quadrilaterals=this._createQuadrilaterals(s))}_createContainer(t=!1){const e=this.data,s=this.page,i=this.viewport,a=document.createElement("section"),{width:r,height:n}=g(e.rect),[o,l,h,d]=i.viewBox,u=h-o,p=d-l;a.setAttribute("data-annotation-id",e.id);const _=c.Util.normalizeRect([e.rect[0],s.view[3]-e.rect[1]+s.view[1],e.rect[2],s.view[3]-e.rect[3]+s.view[1]]);if(!t&&e.borderStyle.width>0){a.style.borderWidth=`${e.borderStyle.width}px`;const t=e.borderStyle.horizontalCornerRadius,s=e.borderStyle.verticalCornerRadius;if(t>0||s>0){const e=`calc(${t}px * var(--scale-factor)) / calc(${s}px * var(--scale-factor))`;a.style.borderRadius=e}else if(this instanceof w){const t=`calc(${r}px * var(--scale-factor)) / calc(${n}px * var(--scale-factor))`;a.style.borderRadius=t}switch(e.borderStyle.style){case c.AnnotationBorderStyleType.SOLID:a.style.borderStyle="solid";break;case c.AnnotationBorderStyleType.DASHED:a.style.borderStyle="dashed";break;case c.AnnotationBorderStyleType.BEVELED:(0,c.warn)("Unimplemented border style: beveled");break;case c.AnnotationBorderStyleType.INSET:(0,c.warn)("Unimplemented border style: inset");break;case c.AnnotationBorderStyleType.UNDERLINE:a.style.borderBottomStyle="solid"}const i=e.borderColor||null;i?a.style.borderColor=c.Util.makeHexColor(0|i[0],0|i[1],0|i[2]):a.style.borderWidth=0}a.style.left=100*(_[0]-o)/u+"%",a.style.top=100*(_[1]-l)/p+"%";const{rotation:f}=e;return e.hasOwnCanvas||0===f?(a.style.width=100*r/u+"%",a.style.height=100*n/p+"%"):this.setRotation(f,a),a}setRotation(t,e=this.container){const[s,i,a,r]=this.viewport.viewBox,n=a-s,o=r-i,{width:l,height:c}=g(this.data.rect);let h,d;t%180==0?(h=100*l/n,d=100*c/o):(h=100*c/n,d=100*l/o),e.style.width=`${h}%`,e.style.height=`${d}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(t,e,s)=>{const i=s.detail[t];s.target.style[e]=u.ColorConverters[`${i[0]}_HTML`](i.slice(1))};return(0,c.shadow)(this,"_commonActions",{display:t=>{const e=t.detail.display%2==1;this.container.style.visibility=e?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{hidden:e,print:0===t.detail.display||3===t.detail.display})},print:t=>{this.annotationStorage.setValue(this.data.id,{print:t.detail.print})},hidden:t=>{this.container.style.visibility=t.detail.hidden?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{hidden:t.detail.hidden})},focus:t=>{setTimeout(()=>t.target.focus({preventScroll:!1}),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.detail.readonly?t.target.setAttribute("readonly",""):t.target.removeAttribute("readonly")},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:t=>{const e=t.detail.rotation;this.setRotation(e),this.annotationStorage.setValue(this.data.id,{rotation:e})}})}_dispatchEventFromSandbox(t,e){const s=this._commonActions;for(const i of Object.keys(e.detail)){const a=t[i]||s[i];a&&a(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const s=this._commonActions;for(const[i,a]of Object.entries(e)){const r=s[i];r&&(r({detail:{[i]:a},target:t}),delete e[i])}}_createQuadrilaterals(t=!1){if(!this.data.quadPoints)return null;const e=[],s=this.data.rect;for(const i of this.data.quadPoints)this.data.rect=[i[2].x,i[2].y,i[1].x,i[1].y],e.push(this._createContainer(t));return this.data.rect=s,e}_createPopup(t,e){let s=this.container;this.quadrilaterals&&(t=t||this.quadrilaterals,s=this.quadrilaterals[0]),t||((t=document.createElement("div")).className="popupTriggerArea",s.append(t));const i=new E({container:s,trigger:t,color:e.color,titleObj:e.titleObj,modificationDate:e.modificationDate,contentsObj:e.contentsObj,richText:e.richText,hideWrapper:!0}).render();i.style.left="100%",s.append(i)}_renderQuadrilaterals(t){for(const e of this.quadrilaterals)e.className=t;return this.quadrilaterals}render(){(0,c.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){const s=[];if(this._fieldObjects){const i=this._fieldObjects[t];if(i)for(const{page:t,id:a,exportValues:r}of i){if(-1===t)continue;if(a===e)continue;const i="string"==typeof r?r:null,n=document.querySelector(`[data-element-id="${a}"]`);!n||f.has(n)?s.push({id:a,exportValue:i,domElement:n}):(0,c.warn)(`_getElementsByName - element not allowed: ${a}`)}return s}for(const i of document.getElementsByName(t)){const{id:t,exportValue:a}=i;t!==e&&f.has(i)&&s.push({id:t,exportValue:a,domElement:i})}return s}static get platform(){const t="undefined"!=typeof navigator?navigator.platform:"";return(0,c.shadow)(this,"platform",{isWin:t.includes("Win"),isMac:t.includes("Mac")})}}class b extends v{constructor(t,e=null){super(t,{isRenderable:!0,ignoreBorder:!!(null==e?void 0:e.ignoreBorder),createQuadrilaterals:!0}),this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:e}=this,s=document.createElement("a");s.setAttribute("data-element-id",t.id);let i=!1;return t.url?(e.addLinkAttributes(s,t.url,t.newWindow),i=!0):t.action?(this._bindNamedAction(s,t.action),i=!0):t.dest?(this._bindLink(s,t.dest),i=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(s,t),i=!0),t.resetForm?(this._bindResetFormAction(s,t.resetForm),i=!0):this.isTooltipOnly&&!i&&(this._bindLink(s,""),i=!0)),this.quadrilaterals?this._renderQuadrilaterals("linkAnnotation").map((t,e)=>{const i=0===e?s:s.cloneNode();return t.append(i),t}):(this.container.className="linkAnnotation",i&&this.container.append(s),this.container)}_bindLink(t,e){t.href=this.linkService.getDestinationHash(e),t.onclick=()=>(e&&this.linkService.goToDestination(e),!1),(e||""===e)&&(t.className="internalLink")}_bindNamedAction(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),t.className="internalLink"}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");const s=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const i of Object.keys(e.actions)){const a=s.get(i);a&&(t[a]=()=>{var t;return null==(t=this.linkService.eventBus)||t.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:i}}),!1})}t.onclick||(t.onclick=()=>!1),t.className="internalLink"}_bindResetFormAction(t,e){const s=t.onclick;if(s||(t.href=this.linkService.getAnchorUrl("")),t.className="internalLink",!this._fieldObjects)return(0,c.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),void(s||(t.onclick=()=>!1));t.onclick=()=>{var t;s&&s();const{fields:i,refs:a,include:r}=e,n=[];if(0!==i.length||0!==a.length){const t=new Set(a);for(const e of i){const s=this._fieldObjects[e]||[];for(const{id:e}of s)t.add(e)}for(const e of Object.values(this._fieldObjects))for(const s of e)t.has(s.id)===r&&n.push(s)}else for(const e of Object.values(this._fieldObjects))n.push(...e);const o=this.annotationStorage,l=[];for(const e of n){const{id:t}=e;switch(l.push(t),e.type){case"text":{const s=e.defaultValue||"";o.setValue(t,{value:s});break}case"checkbox":case"radiobutton":{const s=e.defaultValue===e.exportValues;o.setValue(t,{value:s});break}case"combobox":case"listbox":{const s=e.defaultValue||"";o.setValue(t,{value:s});break}default:continue}const s=document.querySelector(`[data-element-id="${t}"]`);s&&(f.has(s)?s.dispatchEvent(new Event("resetform")):(0,c.warn)(`_bindResetFormAction - element not allowed: ${t}`))}return this.enableScripting&&(null==(t=this.linkService.eventBus)||t.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:l,name:"ResetForm"}})),!1}}}class A extends v{constructor(t){var e,s,i;super(t,{isRenderable:!!(t.data.hasPopup||(null==(e=t.data.titleObj)?void 0:e.str)||(null==(s=t.data.contentsObj)?void 0:s.str)||(null==(i=t.data.richText)?void 0:i.str))})}render(){this.container.className="textAnnotation";const t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.alt="[{{type}} Annotation]",t.dataset.l10nId="text_annotation_type",t.dataset.l10nArgs=JSON.stringify({type:this.data.name}),this.data.hasPopup||this._createPopup(t,this.data),this.container.append(t),this.container}}class y extends v{render(){return this.data.alternativeText&&(this.container.title=this.data.alternativeText),this.container}_getKeyModifier(t){const{isWin:e,isMac:s}=v.platform;return e&&t.ctrlKey||s&&t.metaKey}_setEventListener(t,e,s,i){e.includes("mouse")?t.addEventListener(e,t=>{var e;null==(e=this.linkService.eventBus)||e.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:i(t),shift:t.shiftKey,modifier:this._getKeyModifier(t)}})}):t.addEventListener(e,t=>{var e;null==(e=this.linkService.eventBus)||e.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:i(t)}})})}_setEventListeners(t,e,s){var i;for(const[a,r]of e)("Action"===r||(null==(i=this.data.actions)?void 0:i[r]))&&this._setEventListener(t,a,r,s)}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=null===e?"transparent":c.Util.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const e=["left","center","right"],{fontColor:s}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||9,a=t.style;let r;if(this.data.multiLine){const t=Math.abs(this.data.rect[3]-this.data.rect[1]),e=t/(Math.round(t/(c.LINE_FACTOR*i))||1);r=Math.min(i,Math.round(e/c.LINE_FACTOR))}else{const t=Math.abs(this.data.rect[3]-this.data.rect[1]);r=Math.min(i,Math.round(t/c.LINE_FACTOR))}a.fontSize=`calc(${r}px * var(--scale-factor))`,a.color=c.Util.makeHexColor(s[0],s[1],s[2]),null!==this.data.textAlignment&&(a.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class x extends y{constructor(t){super(t,{isRenderable:t.renderForms||!t.data.hasAppearance&&!!t.data.fieldValue})}setPropertyOnSiblings(t,e,s,i){const a=this.annotationStorage;for(const r of this._getElementsByName(t.name,t.id))r.domElement&&(r.domElement[e]=s),a.setValue(r.id,{[i]:s})}render(){var t;const e=this.annotationStorage,s=this.data.id;this.container.className="textWidgetAnnotation";let i=null;if(this.renderForms){const a=e.getValue(s,{value:this.data.fieldValue});let r=a.formattedValue||a.value||"";const n=e.getValue(s,{charLimit:this.data.maxLen}).charLimit;n&&r.length>n&&(r=r.slice(0,n));const o={userValue:r,formattedValue:null,valueOnFocus:""};this.data.multiLine?(i=document.createElement("textarea"),i.textContent=r,this.data.doNotScroll&&(i.style.overflowY="hidden")):(i=document.createElement("input"),i.type="text",i.setAttribute("value",r),this.data.doNotScroll&&(i.style.overflowX="hidden")),f.add(i),i.setAttribute("data-element-id",s),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=_,this._setRequired(i,this.data.required),n&&(i.maxLength=n),i.addEventListener("input",t=>{e.setValue(s,{value:t.target.value}),this.setPropertyOnSiblings(i,"value",t.target.value,"value")}),i.addEventListener("resetform",t=>{const e=this.data.defaultFieldValue??"";i.value=o.userValue=e,o.formattedValue=null});let l=t=>{const{formattedValue:e}=o;null!=e&&(t.target.value=e),t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",t=>{o.userValue&&(t.target.value=o.userValue),o.valueOnFocus=t.target.value}),i.addEventListener("updatefromsandbox",t=>{const i={value(t){o.userValue=t.detail.value??"",e.setValue(s,{value:o.userValue.toString()}),t.target.value=o.userValue},formattedValue(t){const{formattedValue:i}=t.detail;o.formattedValue=i,null!=i&&t.target!==document.activeElement&&(t.target.value=i),e.setValue(s,{formattedValue:i})},selRange(t){t.target.setSelectionRange(...t.detail.selRange)},charLimit:t=>{var i;const{charLimit:a}=t.detail,{target:r}=t;if(0===a)return void r.removeAttribute("maxLength");r.setAttribute("maxLength",a);let n=o.userValue;!n||n.length<=a||(n=n.slice(0,a),r.value=o.userValue=n,e.setValue(s,{value:n}),null==(i=this.linkService.eventBus)||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:s,name:"Keystroke",value:n,willCommit:!0,commitKey:1,selStart:r.selectionStart,selEnd:r.selectionEnd}}))}};this._dispatchEventFromSandbox(i,t)}),i.addEventListener("keydown",t=>{var e;let i=-1;if("Escape"===t.key?i=0:"Enter"===t.key?i=2:"Tab"===t.key&&(i=3),-1===i)return;const{value:a}=t.target;o.valueOnFocus!==a&&(o.userValue=a,null==(e=this.linkService.eventBus)||e.dispatch("dispatcheventinsandbox",{source:this,detail:{id:s,name:"Keystroke",value:a,willCommit:!0,commitKey:i,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}))});const a=l;l=null,i.addEventListener("blur",t=>{var e;const{value:i}=t.target;o.userValue=i,this._mouseState.isDown&&o.valueOnFocus!==i&&(null==(e=this.linkService.eventBus)||e.dispatch("dispatcheventinsandbox",{source:this,detail:{id:s,name:"Keystroke",value:i,willCommit:!0,commitKey:1,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}})),a(t)}),(null==(t=this.data.actions)?void 0:t.Keystroke)&&i.addEventListener("beforeinput",t=>{var e;const{data:i,target:a}=t,{value:r,selectionStart:n,selectionEnd:o}=a;let l=n,c=o;switch(t.inputType){case"deleteWordBackward":{const t=r.substring(0,n).match(/\w*[^\w]*$/);t&&(l-=t[0].length);break}case"deleteWordForward":{const t=r.substring(n).match(/^[^\w]*\w*/);t&&(c+=t[0].length);break}case"deleteContentBackward":n===o&&(l-=1);break;case"deleteContentForward":n===o&&(c+=1)}t.preventDefault(),null==(e=this.linkService.eventBus)||e.dispatch("dispatcheventinsandbox",{source:this,detail:{id:s,name:"Keystroke",value:r,change:i||"",willCommit:!1,selStart:l,selEnd:c}})}),this._setEventListeners(i,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.value)}if(l&&i.addEventListener("blur",l),this.data.comb){const t=(this.data.rect[2]-this.data.rect[0])/n;i.classList.add("comb"),i.style.letterSpacing=`calc(${t}px * var(--scale-factor) - 1ch)`}}else i=document.createElement("div"),i.textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell";return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class S extends y{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,s=e.id;let i=t.getValue(s,{value:e.exportValue===e.fieldValue}).value;"string"==typeof i&&(i="Off"!==i,t.setValue(s,{value:i})),this.container.className="buttonWidgetAnnotation checkBox";const a=document.createElement("input");return f.add(a),a.setAttribute("data-element-id",s),a.disabled=e.readOnly,this._setRequired(a,this.data.required),a.type="checkbox",a.name=e.fieldName,i&&a.setAttribute("checked",!0),a.setAttribute("exportValue",e.exportValue),a.tabIndex=_,a.addEventListener("change",i=>{const{name:a,checked:r}=i.target;for(const n of this._getElementsByName(a,s)){const s=r&&n.exportValue===e.exportValue;n.domElement&&(n.domElement.checked=s),t.setValue(n.id,{value:s})}t.setValue(s,{value:r})}),a.addEventListener("resetform",t=>{const s=e.defaultFieldValue||"Off";t.target.checked=s===e.exportValue}),this.enableScripting&&this.hasJSActions&&(a.addEventListener("updatefromsandbox",e=>{const i={value(e){e.target.checked="Off"!==e.detail.value,t.setValue(s,{value:e.target.checked})}};this._dispatchEventFromSandbox(i,e)}),this._setEventListeners(a,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)),this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}class w extends y{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.className="buttonWidgetAnnotation radioButton";const t=this.annotationStorage,e=this.data,s=e.id;let i=t.getValue(s,{value:e.fieldValue===e.buttonValue}).value;"string"==typeof i&&(i=i!==e.buttonValue,t.setValue(s,{value:i}));const a=document.createElement("input");if(f.add(a),a.setAttribute("data-element-id",s),a.disabled=e.readOnly,this._setRequired(a,this.data.required),a.type="radio",a.name=e.fieldName,i&&a.setAttribute("checked",!0),a.tabIndex=_,a.addEventListener("change",e=>{const{name:i,checked:a}=e.target;for(const r of this._getElementsByName(i,s))t.setValue(r.id,{value:!1});t.setValue(s,{value:a})}),a.addEventListener("resetform",t=>{const s=e.defaultFieldValue;t.target.checked=null!=s&&s===e.buttonValue}),this.enableScripting&&this.hasJSActions){const i=e.buttonValue;a.addEventListener("updatefromsandbox",e=>{const a={value:e=>{const a=i===e.detail.value;for(const i of this._getElementsByName(e.target.name)){const e=a&&i.id===s;i.domElement&&(i.domElement.checked=e),t.setValue(i.id,{value:e})}}};this._dispatchEventFromSandbox(a,e)}),this._setEventListeners(a,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)}return this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}}class C extends b{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){const t=super.render();t.className="buttonWidgetAnnotation pushButton",this.data.alternativeText&&(t.title=this.data.alternativeText);const e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",t=>{this._dispatchEventFromSandbox({},t)})),t}}class k extends y{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.className="choiceWidgetAnnotation";const t=this.annotationStorage,e=this.data.id,s=t.getValue(e,{value:this.data.fieldValue}),i=document.createElement("select");f.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,this._setRequired(i,this.data.required),i.name=this.data.fieldName,i.tabIndex=_;let a=this.data.combo&&this.data.options.length>0;this.data.combo||(i.size=this.data.options.length,this.data.multiSelect&&(i.multiple=!0)),i.addEventListener("resetform",t=>{const e=this.data.defaultFieldValue;for(const s of i.options)s.selected=s.value===e});for(const l of this.data.options){const t=document.createElement("option");t.textContent=l.displayValue,t.value=l.exportValue,s.value.includes(l.exportValue)&&(t.setAttribute("selected",!0),a=!1),i.append(t)}let r=null;if(a){const t=document.createElement("option");t.value=" ",t.setAttribute("hidden",!0),t.setAttribute("selected",!0),i.prepend(t),r=()=>{t.remove(),i.removeEventListener("input",r),r=null},i.addEventListener("input",r)}const n=(t,e)=>{const s=e?"value":"textContent",i=t.target.options;return t.target.multiple?Array.prototype.filter.call(i,t=>t.selected).map(t=>t[s]):-1===i.selectedIndex?null:i[i.selectedIndex][s]},o=t=>{const e=t.target.options;return Array.prototype.map.call(e,t=>({displayValue:t.textContent,exportValue:t.value}))};return this.enableScripting&&this.hasJSActions?(i.addEventListener("updatefromsandbox",s=>{const a={value(s){null==r||r();const a=s.detail.value,o=new Set(Array.isArray(a)?a:[a]);for(const t of i.options)t.selected=o.has(t.value);t.setValue(e,{value:n(s,!0)})},multipleSelection(t){i.multiple=!0},remove(s){const a=i.options,r=s.detail.remove;a[r].selected=!1,i.remove(r),a.length>0&&-1===Array.prototype.findIndex.call(a,t=>t.selected)&&(a[0].selected=!0),t.setValue(e,{value:n(s,!0),items:o(s)})},clear(s){for(;0!==i.length;)i.remove(0);t.setValue(e,{value:null,items:[]})},insert(s){const{index:a,displayValue:r,exportValue:l}=s.detail.insert,c=i.children[a],h=document.createElement("option");h.textContent=r,h.value=l,c?c.before(h):i.append(h),t.setValue(e,{value:n(s,!0),items:o(s)})},items(s){const{items:a}=s.detail;for(;0!==i.length;)i.remove(0);for(const t of a){const{displayValue:e,exportValue:s}=t,a=document.createElement("option");a.textContent=e,a.value=s,i.append(a)}i.options.length>0&&(i.options[0].selected=!0),t.setValue(e,{value:n(s,!0),items:o(s)})},indices(s){const i=new Set(s.detail.indices);for(const t of s.target.options)t.selected=i.has(t.index);t.setValue(e,{value:n(s,!0)})},editable(t){t.target.disabled=!t.detail.editable}};this._dispatchEventFromSandbox(a,s)}),i.addEventListener("input",s=>{var i;const a=n(s,!0),r=n(s,!1);t.setValue(e,{value:a}),null==(i=this.linkService.eventBus)||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:r,changeEx:a,willCommit:!0,commitKey:1,keyDown:!1}})}),this._setEventListeners(i,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"]],t=>t.target.checked)):i.addEventListener("input",function(s){t.setValue(e,{value:n(s,!0)})}),this.data.combo&&this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class T extends v{constructor(t){var e,s,i;super(t,{isRenderable:!!((null==(e=t.data.titleObj)?void 0:e.str)||(null==(s=t.data.contentsObj)?void 0:s.str)||(null==(i=t.data.richText)?void 0:i.str))})}render(){if(this.container.className="popupAnnotation",["Line","Square","Circle","PolyLine","Polygon","Ink"].includes(this.data.parentType))return this.container;const t=`[data-annotation-id="${this.data.parentId}"]`,e=this.layer.querySelectorAll(t);if(0===e.length)return this.container;const s=new E({container:this.container,trigger:Array.from(e),color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText}),i=this.page,a=c.Util.normalizeRect([this.data.parentRect[0],i.view[3]-this.data.parentRect[1]+i.view[1],this.data.parentRect[2],i.view[3]-this.data.parentRect[3]+i.view[1]]),r=a[0]+this.data.parentRect[2]-this.data.parentRect[0],n=a[1],[o,l,h,d]=this.viewport.viewBox,u=h-o,p=d-l;return this.container.style.left=100*(r-o)/u+"%",this.container.style.top=100*(n-l)/p+"%",this.container.append(s.render()),this.container}}class E{constructor(t){this.container=t.container,this.trigger=t.trigger,this.color=t.color,this.titleObj=t.titleObj,this.modificationDate=t.modificationDate,this.contentsObj=t.contentsObj,this.richText=t.richText,this.hideWrapper=t.hideWrapper||!1,this.pinned=!1}render(){var t,e;const s=document.createElement("div");s.className="popupWrapper",this.hideElement=this.hideWrapper?s:this.container,this.hideElement.hidden=!0;const i=document.createElement("div");i.className="popup";const a=this.color;if(a){const t=.7*(255-a[0])+a[0],e=.7*(255-a[1])+a[1],s=.7*(255-a[2])+a[2];i.style.backgroundColor=c.Util.makeHexColor(0|t,0|e,0|s)}const r=document.createElement("h1");r.dir=this.titleObj.dir,r.textContent=this.titleObj.str,i.append(r);const n=h.PDFDateString.toDateObject(this.modificationDate);if(n){const t=document.createElement("span");t.className="popupDate",t.textContent="{{date}}, {{time}}",t.dataset.l10nId="annotation_date_string",t.dataset.l10nArgs=JSON.stringify({date:n.toLocaleDateString(),time:n.toLocaleTimeString()}),i.append(t)}if(!(null==(t=this.richText)?void 0:t.str)||(null==(e=this.contentsObj)?void 0:e.str)&&this.contentsObj.str!==this.richText.str){const t=this._formatContents(this.contentsObj);i.append(t)}else p.XfaLayer.render({xfaHtml:this.richText.html,intent:"richText",div:i}),i.lastChild.className="richText popupContent";Array.isArray(this.trigger)||(this.trigger=[this.trigger]);for(const o of this.trigger)o.addEventListener("click",this._toggle.bind(this)),o.addEventListener("mouseover",this._show.bind(this,!1)),o.addEventListener("mouseout",this._hide.bind(this,!1));return i.addEventListener("click",this._hide.bind(this,!0)),s.append(i),s}_formatContents({str:t,dir:e}){const s=document.createElement("p");s.className="popupContent",s.dir=e;const i=t.split(/(?:\r\n?|\n)/);for(let a=0,r=i.length;a<r;++a){const t=i[a];s.append(document.createTextNode(t)),a<r-1&&s.append(document.createElement("br"))}return s}_toggle(){this.pinned?this._hide(!0):this._show(!0)}_show(t=!1){t&&(this.pinned=!0),this.hideElement.hidden&&(this.hideElement.hidden=!1,this.container.style.zIndex=parseInt(this.container.style.zIndex)+1e3)}_hide(t=!0){t&&(this.pinned=!1),this.hideElement.hidden||this.pinned||(this.hideElement.hidden=!0,this.container.style.zIndex=parseInt(this.container.style.zIndex)-1e3)}}class P extends v{constructor(t){var e,s,i;super(t,{isRenderable:!!(t.data.hasPopup||(null==(e=t.data.titleObj)?void 0:e.str)||(null==(s=t.data.contentsObj)?void 0:s.str)||(null==(i=t.data.richText)?void 0:i.str)),ignoreBorder:!0}),this.textContent=t.data.textContent}render(){if(this.container.className="freeTextAnnotation",this.textContent){const t=document.createElement("div");t.className="annotationTextContent",t.setAttribute("role","comment");for(const e of this.textContent){const s=document.createElement("span");s.textContent=e,t.append(s)}this.container.append(t)}return this.data.hasPopup||this._createPopup(null,this.data),this.container}}class M extends v{constructor(t){var e,s,i;super(t,{isRenderable:!!(t.data.hasPopup||(null==(e=t.data.titleObj)?void 0:e.str)||(null==(s=t.data.contentsObj)?void 0:s.str)||(null==(i=t.data.richText)?void 0:i.str)),ignoreBorder:!0})}render(){this.container.className="lineAnnotation";const t=this.data,{width:e,height:s}=g(t.rect),i=this.svgFactory.create(e,s,!0),a=this.svgFactory.createElement("svg:line");return a.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),a.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),a.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),a.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),a.setAttribute("stroke-width",t.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),i.append(a),this.container.append(i),this._createPopup(a,t),this.container}}class F extends v{constructor(t){var e,s,i;super(t,{isRenderable:!!(t.data.hasPopup||(null==(e=t.data.titleObj)?void 0:e.str)||(null==(s=t.data.contentsObj)?void 0:s.str)||(null==(i=t.data.richText)?void 0:i.str)),ignoreBorder:!0})}render(){this.container.className="squareAnnotation";const t=this.data,{width:e,height:s}=g(t.rect),i=this.svgFactory.create(e,s,!0),a=t.borderStyle.width,r=this.svgFactory.createElement("svg:rect");return r.setAttribute("x",a/2),r.setAttribute("y",a/2),r.setAttribute("width",e-a),r.setAttribute("height",s-a),r.setAttribute("stroke-width",a||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),i.append(r),this.container.append(i),this._createPopup(r,t),this.container}}class R extends v{constructor(t){var e,s,i;super(t,{isRenderable:!!(t.data.hasPopup||(null==(e=t.data.titleObj)?void 0:e.str)||(null==(s=t.data.contentsObj)?void 0:s.str)||(null==(i=t.data.richText)?void 0:i.str)),ignoreBorder:!0})}render(){this.container.className="circleAnnotation";const t=this.data,{width:e,height:s}=g(t.rect),i=this.svgFactory.create(e,s,!0),a=t.borderStyle.width,r=this.svgFactory.createElement("svg:ellipse");return r.setAttribute("cx",e/2),r.setAttribute("cy",s/2),r.setAttribute("rx",e/2-a/2),r.setAttribute("ry",s/2-a/2),r.setAttribute("stroke-width",a||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),i.append(r),this.container.append(i),this._createPopup(r,t),this.container}}class D extends v{constructor(t){var e,s,i;super(t,{isRenderable:!!(t.data.hasPopup||(null==(e=t.data.titleObj)?void 0:e.str)||(null==(s=t.data.contentsObj)?void 0:s.str)||(null==(i=t.data.richText)?void 0:i.str)),ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.className=this.containerClassName;const t=this.data,{width:e,height:s}=g(t.rect),i=this.svgFactory.create(e,s,!0);let a=[];for(const n of t.vertices){const e=n.x-t.rect[0],s=t.rect[3]-n.y;a.push(e+","+s)}a=a.join(" ");const r=this.svgFactory.createElement(this.svgElementName);return r.setAttribute("points",a),r.setAttribute("stroke-width",t.borderStyle.width||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),i.append(r),this.container.append(i),this._createPopup(r,t),this.container}}class N extends D{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class I extends v{constructor(t){var e,s,i;super(t,{isRenderable:!!(t.data.hasPopup||(null==(e=t.data.titleObj)?void 0:e.str)||(null==(s=t.data.contentsObj)?void 0:s.str)||(null==(i=t.data.richText)?void 0:i.str)),ignoreBorder:!0})}render(){return this.container.className="caretAnnotation",this.data.hasPopup||this._createPopup(null,this.data),this.container}}class O extends v{constructor(t){var e,s,i;super(t,{isRenderable:!!(t.data.hasPopup||(null==(e=t.data.titleObj)?void 0:e.str)||(null==(s=t.data.contentsObj)?void 0:s.str)||(null==(i=t.data.richText)?void 0:i.str)),ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline"}render(){this.container.className=this.containerClassName;const t=this.data,{width:e,height:s}=g(t.rect),i=this.svgFactory.create(e,s,!0);for(const a of t.inkLists){let e=[];for(const i of a){const s=i.x-t.rect[0],a=t.rect[3]-i.y;e.push(`${s},${a}`)}e=e.join(" ");const s=this.svgFactory.createElement(this.svgElementName);s.setAttribute("points",e),s.setAttribute("stroke-width",t.borderStyle.width||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),this._createPopup(s,t),i.append(s)}return this.container.append(i),this.container}}class L extends v{constructor(t){var e,s,i;super(t,{isRenderable:!!(t.data.hasPopup||(null==(e=t.data.titleObj)?void 0:e.str)||(null==(s=t.data.contentsObj)?void 0:s.str)||(null==(i=t.data.richText)?void 0:i.str)),ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("highlightAnnotation"):(this.container.className="highlightAnnotation",this.container)}}class G extends v{constructor(t){var e,s,i;super(t,{isRenderable:!!(t.data.hasPopup||(null==(e=t.data.titleObj)?void 0:e.str)||(null==(s=t.data.contentsObj)?void 0:s.str)||(null==(i=t.data.richText)?void 0:i.str)),ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("underlineAnnotation"):(this.container.className="underlineAnnotation",this.container)}}class j extends v{constructor(t){var e,s,i;super(t,{isRenderable:!!(t.data.hasPopup||(null==(e=t.data.titleObj)?void 0:e.str)||(null==(s=t.data.contentsObj)?void 0:s.str)||(null==(i=t.data.richText)?void 0:i.str)),ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("squigglyAnnotation"):(this.container.className="squigglyAnnotation",this.container)}}class B extends v{constructor(t){var e,s,i;super(t,{isRenderable:!!(t.data.hasPopup||(null==(e=t.data.titleObj)?void 0:e.str)||(null==(s=t.data.contentsObj)?void 0:s.str)||(null==(i=t.data.richText)?void 0:i.str)),ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("strikeoutAnnotation"):(this.container.className="strikeoutAnnotation",this.container)}}class W extends v{constructor(t){var e,s,i;super(t,{isRenderable:!!(t.data.hasPopup||(null==(e=t.data.titleObj)?void 0:e.str)||(null==(s=t.data.contentsObj)?void 0:s.str)||(null==(i=t.data.richText)?void 0:i.str)),ignoreBorder:!0})}render(){return this.container.className="stampAnnotation",this.data.hasPopup||this._createPopup(null,this.data),this.container}}class U extends v{constructor(t){var e;super(t,{isRenderable:!0});const{filename:s,content:i}=this.data.file;this.filename=(0,h.getFilenameFromUrl)(s),this.content=i,null==(e=this.linkService.eventBus)||e.dispatch("fileattachmentannotation",{source:this,filename:s,content:i})}render(){var t,e;this.container.className="fileAttachmentAnnotation";const s=document.createElement("div");return s.className="popupTriggerArea",s.addEventListener("dblclick",this._download.bind(this)),!this.data.hasPopup&&((null==(t=this.data.titleObj)?void 0:t.str)||(null==(e=this.data.contentsObj)?void 0:e.str)||this.data.richText)&&this._createPopup(s,this.data),this.container.append(s),this.container}_download(){var t;null==(t=this.downloadManager)||t.openOrDownloadData(this.container,this.content,this.filename)}}const V=class t{static render(e){var s,u;const{annotations:p,div:_,viewport:f,accessibilityManager:v}=e;__privateMethod(this,r,n).call(this,_,f);let b=0;for(const r of p){if(r.annotationType!==c.AnnotationType.POPUP){const{width:t,height:e}=g(r.rect);if(t<=0||e<=0)continue}const n=m.create({data:r,layer:_,page:e.page,viewport:f,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:!1!==e.renderForms,svgFactory:new h.DOMSVGFactory,annotationStorage:e.annotationStorage||new d.AnnotationStorage,enableScripting:e.enableScripting,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,mouseState:e.mouseState||{isDown:!1}});if(n.isRenderable){const e=n.render();if(r.hidden&&(e.style.visibility="hidden"),Array.isArray(e))for(const n of e)n.style.zIndex=b++,__privateMethod(s=t,i,a).call(s,n,r.id,_,v);else e.style.zIndex=b++,n instanceof T?_.prepend(e):__privateMethod(u=t,i,a).call(u,e,r.id,_,v)}}__privateMethod(this,o,l).call(this,_,e.annotationCanvasMap)}static update(t){const{annotationCanvasMap:e,div:s,viewport:i}=t;__privateMethod(this,r,n).call(this,s,i),__privateMethod(this,o,l).call(this,s,e),s.hidden=!1}};i=new WeakSet,a=function(t,e,s,i){const a=t.firstChild||t;a.id=`${h.AnnotationPrefix}${e}`,s.append(t),null==i||i.moveElementInDOM(s,t,a,!1)},r=new WeakSet,n=function(t,{width:e,height:s,rotation:i}){const{style:a}=t,r=i%180!=0,n=Math.floor(e)+"px",o=Math.floor(s)+"px";a.width=r?o:n,a.height=r?n:o,t.setAttribute("data-main-rotation",i)},o=new WeakSet,l=function(t,e){if(e){for(const[s,i]of e){const e=t.querySelector(`[data-annotation-id="${s}"]`);if(!e)continue;const{firstChild:a}=e;a?"CANVAS"===a.nodeName?a.replaceWith(i):a.before(i):e.append(i)}e.clear()}},__privateAdd(V,i),__privateAdd(V,r),__privateAdd(V,o);let q=V;e.AnnotationLayer=q},(t,e)=>{function s(t){return Math.floor(255*Math.max(0,Math.min(1,t))).toString(16).padStart(2,"0")}Object.defineProperty(e,"__esModule",{value:!0}),e.ColorConverters=void 0,e.ColorConverters=class{static CMYK_G([t,e,s,i]){return["G",1-Math.min(1,.3*t+.59*s+.11*e+i)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_HTML([t]){const e=s(t);return`#${e}${e}${e}`}static RGB_G([t,e,s]){return["G",.3*t+.59*e+.11*s]}static RGB_HTML([t,e,i]){return`#${s(t)}${s(e)}${s(i)}`}static T_HTML(){return"#00000000"}static CMYK_RGB([t,e,s,i]){return["RGB",1-Math.min(1,t+i),1-Math.min(1,s+i),1-Math.min(1,e+i)]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,s]){const i=1-t,a=1-e,r=1-s;return["CMYK",i,a,r,Math.min(i,a,r)]}}},(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.XfaLayer=void 0;var i=s(20);e.XfaLayer=class{static setupStorage(t,e,s,i,a){const r=i.getValue(e,{value:null});switch(s.name){case"textarea":if(null!==r.value&&(t.textContent=r.value),"print"===a)break;t.addEventListener("input",t=>{i.setValue(e,{value:t.target.value})});break;case"input":if("radio"===s.attributes.type||"checkbox"===s.attributes.type){if(r.value===s.attributes.xfaOn?t.setAttribute("checked",!0):r.value===s.attributes.xfaOff&&t.removeAttribute("checked"),"print"===a)break;t.addEventListener("change",t=>{i.setValue(e,{value:t.target.checked?t.target.getAttribute("xfaOn"):t.target.getAttribute("xfaOff")})})}else{if(null!==r.value&&t.setAttribute("value",r.value),"print"===a)break;t.addEventListener("input",t=>{i.setValue(e,{value:t.target.value})})}break;case"select":if(null!==r.value)for(const t of s.children)t.attributes.value===r.value&&(t.attributes.selected=!0);t.addEventListener("input",t=>{const s=t.target.options,a=-1===s.selectedIndex?"":s[s.selectedIndex].value;i.setValue(e,{value:a})})}}static setAttributes({html:t,element:e,storage:s=null,intent:i,linkService:a}){const{attributes:r}=e,n=t instanceof HTMLAnchorElement;"radio"===r.type&&(r.name=`${r.name}-${i}`);for(const[o,l]of Object.entries(r))if(null!=l)switch(o){case"class":l.length&&t.setAttribute(o,l.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",l);break;case"style":Object.assign(t.style,l);break;case"textContent":t.textContent=l;break;default:(!n||"href"!==o&&"newWindow"!==o)&&t.setAttribute(o,l)}n&&a.addLinkAttributes(t,r.href,r.newWindow),s&&r.dataId&&this.setupStorage(t,r.dataId,e,s)}static render(t){var e;const s=t.annotationStorage,a=t.linkService,r=t.xfaHtml,n=t.intent||"display",o=document.createElement(r.name);r.attributes&&this.setAttributes({html:o,element:r,intent:n,linkService:a});const l=[[r,-1,o]],c=t.div;if(c.append(o),t.viewport){const e=`matrix(${t.viewport.transform.join(",")})`;c.style.transform=e}"richText"!==n&&c.setAttribute("class","xfaLayer xfaFont");const h=[];for(;l.length>0;){const[t,r,o]=l.at(-1);if(r+1===t.children.length){l.pop();continue}const c=t.children[++l.at(-1)[1]];if(null===c)continue;const{name:d}=c;if("#text"===d){const t=document.createTextNode(c.value);h.push(t),o.append(t);continue}let u;if(u=(null==(e=null==c?void 0:c.attributes)?void 0:e.xmlns)?document.createElementNS(c.attributes.xmlns,d):document.createElement(d),o.append(u),c.attributes&&this.setAttributes({html:u,element:c,storage:s,intent:n,linkService:a}),c.children&&c.children.length>0)l.push([c,-1,u]);else if(c.value){const t=document.createTextNode(c.value);i.XfaText.shouldBuildText(d)&&h.push(t),u.append(t)}}for(const i of c.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))i.setAttribute("readOnly",!0);return{textDivs:h}}static update(t){const e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}}},(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TextLayerRenderTask=void 0,e.renderTextLayer=function(t){const e=new p({textContent:t.textContent,textContentStream:t.textContentStream,container:t.container,viewport:t.viewport,textDivs:t.textDivs,textContentItemsStr:t.textContentItemsStr,enhanceTextSelection:t.enhanceTextSelection});return e._render(t.timeout),e};var i=s(1),a=s(8);const r=30,n=new Map,o=/^\s+$/g;function l(t,e,s,a){const l=document.createElement("span"),c=t._enhanceTextSelection?{angle:0,canvasWidth:0,hasText:""!==e.str,hasEOL:e.hasEOL,originalTransform:null,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,scale:1,fontSize:0}:{angle:0,canvasWidth:0,hasText:""!==e.str,hasEOL:e.hasEOL,fontSize:0};t._textDivs.push(l);const h=i.Util.transform(t._viewport.transform,e.transform);let d=Math.atan2(h[1],h[0]);const u=s[e.fontName];u.vertical&&(d+=Math.PI/2);const p=Math.hypot(h[2],h[3]),_=p*function(t,e){const s=n.get(t);if(s)return s;e.save(),e.font=`30px ${t}`;const i=e.measureText("");let a=i.fontBoundingBoxAscent,o=Math.abs(i.fontBoundingBoxDescent);if(a){e.restore();const s=a/(a+o);return n.set(t,s),s}e.strokeStyle="red",e.clearRect(0,0,r,r),e.strokeText("g",0,0);let l=e.getImageData(0,0,r,r).data;o=0;for(let n=l.length-1-3;n>=0;n-=4)if(l[n]>0){o=Math.ceil(n/4/r);break}e.clearRect(0,0,r,r),e.strokeText("A",0,r),l=e.getImageData(0,0,r,r).data,a=0;for(let n=0,c=l.length;n<c;n+=4)if(l[n]>0){a=r-Math.floor(n/4/r);break}if(e.restore(),a){const e=a/(a+o);return n.set(t,e),e}return n.set(t,.8),.8}(u.fontFamily,a);let f,g;0===d?(f=h[4],g=h[5]-_):(f=h[4]+_*Math.sin(d),g=h[5]-_*Math.cos(d)),l.style.left=`${f}px`,l.style.top=`${g}px`,l.style.fontSize=`${p}px`,l.style.fontFamily=u.fontFamily,c.fontSize=p,l.setAttribute("role","presentation"),l.textContent=e.str,l.dir=e.dir,t._fontInspectorEnabled&&(l.dataset.fontName=e.fontName),0!==d&&(c.angle=d*(180/Math.PI));let m=!1;if(e.str.length>1||t._enhanceTextSelection&&o.test(e.str))m=!0;else if(" "!==e.str&&e.transform[0]!==e.transform[3]){const t=Math.abs(e.transform[0]),s=Math.abs(e.transform[3]);t!==s&&Math.max(t,s)/Math.min(t,s)>1.5&&(m=!0)}if(m&&(u.vertical?c.canvasWidth=e.height*t._viewport.scale:c.canvasWidth=e.width*t._viewport.scale),t._textDivProperties.set(l,c),t._textContentStream&&t._layoutText(l),t._enhanceTextSelection&&c.hasText){let s=1,a=0;0!==d&&(s=Math.cos(d),a=Math.sin(d));const r=(u.vertical?e.height:e.width)*t._viewport.scale,n=p;let o,c;0!==d?(o=[s,a,-a,s,f,g],c=i.Util.getAxialAlignedBoundingBox([0,0,r,n],o)):c=[f,g,f+r,g+n],t._bounds.push({left:c[0],top:c[1],right:c[2],bottom:c[3],div:l,size:[r,n],m:o})}}function c(t){if(t._canceled)return;const e=t._textDivs,s=t._capability,i=e.length;if(i>1e5)return t._renderingDone=!0,void s.resolve();if(!t._textContentStream)for(let a=0;a<i;a++)t._layoutText(e[a]);t._renderingDone=!0,s.resolve()}function h(t,e,s){let i=0;for(let a=0;a<s;a++){const s=t[e++];s>0&&(i=i?Math.min(s,i):s)}return i}function d(t){const e=t._bounds,s=t._viewport,a=function(t,e,s){const i=s.map(function(t,e){return{x1:t.left,y1:t.top,x2:t.right,y2:t.bottom,index:e,x1New:void 0,x2New:void 0}});u(t,i);const a=new Array(s.length);for(const r of i){const t=r.index;a[t]={left:r.x1New,top:0,right:r.x2New,bottom:0}}s.map(function(e,s){const r=a[s],n=i[s];n.x1=e.top,n.y1=t-r.right,n.x2=e.bottom,n.y2=t-r.left,n.index=s,n.x1New=void 0,n.x2New=void 0}),u(e,i);for(const r of i){const t=r.index;a[t].top=r.x1New,a[t].bottom=r.x2New}return a}(s.width,s.height,e);for(let r=0;r<a.length;r++){const s=e[r].div,n=t._textDivProperties.get(s);if(0===n.angle){n.paddingLeft=e[r].left-a[r].left,n.paddingTop=e[r].top-a[r].top,n.paddingRight=a[r].right-e[r].right,n.paddingBottom=a[r].bottom-e[r].bottom,t._textDivProperties.set(s,n);continue}const o=a[r],l=e[r],c=l.m,d=c[0],u=c[1],p=[[0,0],[0,l.size[1]],[l.size[0],0],l.size],_=new Float64Array(64);for(let t=0,e=p.length;t<e;t++){const e=i.Util.applyTransform(p[t],c);_[t+0]=d&&(o.left-e[0])/d,_[t+4]=u&&(o.top-e[1])/u,_[t+8]=d&&(o.right-e[0])/d,_[t+12]=u&&(o.bottom-e[1])/u,_[t+16]=u&&(o.left-e[0])/-u,_[t+20]=d&&(o.top-e[1])/d,_[t+24]=u&&(o.right-e[0])/-u,_[t+28]=d&&(o.bottom-e[1])/d,_[t+32]=d&&(o.left-e[0])/-d,_[t+36]=u&&(o.top-e[1])/-u,_[t+40]=d&&(o.right-e[0])/-d,_[t+44]=u&&(o.bottom-e[1])/-u,_[t+48]=u&&(o.left-e[0])/u,_[t+52]=d&&(o.top-e[1])/-d,_[t+56]=u&&(o.right-e[0])/u,_[t+60]=d&&(o.bottom-e[1])/-d}const f=1+Math.min(Math.abs(d),Math.abs(u));n.paddingLeft=h(_,32,16)/f,n.paddingTop=h(_,48,16)/f,n.paddingRight=h(_,0,16)/f,n.paddingBottom=h(_,16,16)/f,t._textDivProperties.set(s,n)}}function u(t,e){e.sort(function(t,e){return t.x1-e.x1||t.index-e.index});const s=[{start:-1/0,end:1/0,boundary:{x1:-1/0,y1:-1/0,x2:0,y2:1/0,index:-1,x1New:0,x2New:0}}];for(const i of e){let t=0;for(;t<s.length&&s[t].end<=i.y1;)t++;let e,a,r=s.length-1;for(;r>=0&&s[r].start>=i.y2;)r--;let n,o,l=-1/0;for(n=t;n<=r;n++){let t;e=s[n],a=e.boundary,t=a.x2>i.x1?a.index>i.index?a.x1New:i.x1:void 0===a.x2New?(a.x2+i.x1)/2:a.x2New,t>l&&(l=t)}for(i.x1New=l,n=t;n<=r;n++)e=s[n],a=e.boundary,void 0===a.x2New?a.x2>i.x1?a.index>i.index&&(a.x2New=a.x2):a.x2New=l:a.x2New>l&&(a.x2New=Math.max(l,a.x2));const c=[];let h=null;for(n=t;n<=r;n++){e=s[n],a=e.boundary;const t=a.x2>i.x2?a:i;h===t?c.at(-1).end=e.end:(c.push({start:e.start,end:e.end,boundary:t}),h=t)}for(s[t].start<i.y1&&(c[0].start=i.y1,c.unshift({start:s[t].start,end:i.y1,boundary:s[t].boundary})),i.y2<s[r].end&&(c.at(-1).end=i.y2,c.push({start:i.y2,end:s[r].end,boundary:s[r].boundary})),n=t;n<=r;n++){if(e=s[n],a=e.boundary,void 0!==a.x2New)continue;let i=!1;for(o=t-1;!i&&o>=0&&s[o].start>=a.y1;o--)i=s[o].boundary===a;for(o=r+1;!i&&o<s.length&&s[o].end<=a.y2;o++)i=s[o].boundary===a;for(o=0;!i&&o<c.length;o++)i=c[o].boundary===a;i||(a.x2New=l)}Array.prototype.splice.apply(s,[t,r-t+1,...c])}for(const i of s){const e=i.boundary;void 0===e.x2New&&(e.x2New=Math.max(t,e.x2))}}class p{constructor({textContent:t,textContentStream:e,container:s,viewport:r,textDivs:n,textContentItemsStr:o,enhanceTextSelection:l}){var c;l&&(0,a.deprecated)("The `enhanceTextSelection` functionality will be removed in the future."),this._textContent=t,this._textContentStream=e,this._container=s,this._document=s.ownerDocument,this._viewport=r,this._textDivs=n||[],this._textContentItemsStr=o||[],this._enhanceTextSelection=!!l,this._fontInspectorEnabled=!!(null==(c=globalThis.FontInspector)?void 0:c.enabled),this._reader=null,this._layoutTextLastFontSize=null,this._layoutTextLastFontFamily=null,this._layoutTextCtx=null,this._textDivProperties=new WeakMap,this._renderingDone=!1,this._canceled=!1,this._capability=(0,i.createPromiseCapability)(),this._renderTimer=null,this._bounds=[],this._devicePixelRatio=globalThis.devicePixelRatio||1,this._capability.promise.finally(()=>{this._enhanceTextSelection||(this._textDivProperties=null),this._layoutTextCtx&&(this._layoutTextCtx.canvas.width=0,this._layoutTextCtx.canvas.height=0,this._layoutTextCtx=null)}).catch(()=>{})}get promise(){return this._capability.promise}cancel(){this._canceled=!0,this._reader&&(this._reader.cancel(new i.AbortException("TextLayer task cancelled.")).catch(()=>{}),this._reader=null),null!==this._renderTimer&&(clearTimeout(this._renderTimer),this._renderTimer=null),this._capability.reject(new Error("TextLayer task cancelled."))}_processItems(t,e){for(let s=0,i=t.length;s<i;s++)if(void 0!==t[s].str)this._textContentItemsStr.push(t[s].str),l(this,t[s],e,this._layoutTextCtx);else if("beginMarkedContentProps"===t[s].type||"beginMarkedContent"===t[s].type){const e=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),null!==t[s].id&&this._container.setAttribute("id",`${t[s].id}`),e.append(this._container)}else"endMarkedContent"===t[s].type&&(this._container=this._container.parentNode)}_layoutText(t){const e=this._textDivProperties.get(t);let s="";if(0!==e.canvasWidth&&e.hasText){const{fontFamily:i}=t.style,{fontSize:a}=e;a===this._layoutTextLastFontSize&&i===this._layoutTextLastFontFamily||(this._layoutTextCtx.font=`${a*this._devicePixelRatio}px ${i}`,this._layoutTextLastFontSize=a,this._layoutTextLastFontFamily=i);const{width:r}=this._layoutTextCtx.measureText(t.textContent);if(r>0){const t=this._devicePixelRatio*e.canvasWidth/r;this._enhanceTextSelection&&(e.scale=t),s=`scaleX(${t})`}}if(0!==e.angle&&(s=`rotate(${e.angle}deg) ${s}`),s.length>0&&(this._enhanceTextSelection&&(e.originalTransform=s),t.style.transform=s),e.hasText&&this._container.append(t),e.hasEOL){const t=document.createElement("br");t.setAttribute("role","presentation"),this._container.append(t)}}_render(t=0){const e=(0,i.createPromiseCapability)();let s=Object.create(null);const a=this._document.createElement("canvas");if(a.height=a.width=r,this._layoutTextCtx=a.getContext("2d",{alpha:!1}),this._textContent){const t=this._textContent.items,s=this._textContent.styles;this._processItems(t,s),e.resolve()}else{if(!this._textContentStream)throw new Error('Neither "textContent" nor "textContentStream" parameters specified.');{const t=()=>{this._reader.read().then(({value:i,done:a})=>{a?e.resolve():(Object.assign(s,i.styles),this._processItems(i.items,s),t())},e.reject)};this._reader=this._textContentStream.getReader(),t()}}e.promise.then(()=>{s=null,t?this._renderTimer=setTimeout(()=>{c(this),this._renderTimer=null},t):c(this)},this._capability.reject)}expandTextDivs(t=!1){if(!this._enhanceTextSelection||!this._renderingDone)return;null!==this._bounds&&(d(this),this._bounds=null);const e=[],s=[];for(let i=0,a=this._textDivs.length;i<a;i++){const a=this._textDivs[i],r=this._textDivProperties.get(a);r.hasText&&(t?(e.length=0,s.length=0,r.originalTransform&&e.push(r.originalTransform),r.paddingTop>0?(s.push(`${r.paddingTop}px`),e.push(`translateY(${-r.paddingTop}px)`)):s.push(0),r.paddingRight>0?s.push(r.paddingRight/r.scale+"px"):s.push(0),r.paddingBottom>0?s.push(`${r.paddingBottom}px`):s.push(0),r.paddingLeft>0?(s.push(r.paddingLeft/r.scale+"px"),e.push(`translateX(${-r.paddingLeft/r.scale}px)`)):s.push(0),a.style.padding=s.join(" "),e.length&&(a.style.transform=e.join(" "))):(a.style.padding=null,a.style.transform=r.originalTransform))}}}e.TextLayerRenderTask=p},(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SVGGraphics=void 0;var i=s(8),a=s(1),r=s(3);let n=class{constructor(){(0,a.unreachable)("Not implemented: SVGGraphics")}};e.SVGGraphics=n;{let t=function(t){let e=[];const s=[];for(const i of t)"save"!==i.fn?"restore"===i.fn?e=s.pop():e.push(i):(e.push({fnId:92,fn:"group",items:[]}),s.push(e),e=e.at(-1).items);return e},s=function(t){if(Number.isInteger(t))return t.toString();const e=t.toFixed(10);let s=e.length-1;if("0"!==e[s])return e;do{s--}while("0"===e[s]);return e.substring(0,"."===e[s]?s:s+1)},o=function(t){if(0===t[4]&&0===t[5]){if(0===t[1]&&0===t[2])return 1===t[0]&&1===t[3]?"":`scale(${s(t[0])} ${s(t[3])})`;if(t[0]===t[3]&&t[1]===-t[2]){const e=180*Math.acos(t[0])/Math.PI;return`rotate(${s(e)})`}}else if(1===t[0]&&0===t[1]&&0===t[2]&&1===t[3])return`translate(${s(t[4])} ${s(t[5])})`;return`matrix(${s(t[0])} ${s(t[1])} ${s(t[2])} ${s(t[3])} ${s(t[4])} ${s(t[5])})`};const l={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},c="http://www.w3.org/XML/1998/namespace",h="http://www.w3.org/1999/xlink",d=["butt","round","square"],u=["miter","round","bevel"],p=function(t,e="",s=!1){if(URL.createObjectURL&&"undefined"!=typeof Blob&&!s)return URL.createObjectURL(new Blob([t],{type:e}));const i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let a=`data:${e};base64,`;for(let r=0,n=t.length;r<n;r+=3){const e=255&t[r],s=255&t[r+1],o=255&t[r+2];a+=i[e>>2]+i[(3&e)<<4|s>>4]+i[r+1<n?(15&s)<<2|o>>6:64]+i[r+2<n?63&o:64]}return a},_=function(){const t=new Uint8Array([137,80,78,71,13,10,26,10]),e=new Int32Array(256);for(let a=0;a<256;a++){let t=a;for(let e=0;e<8;e++)t=1&t?3988292384^t>>1&2147483647:t>>1&2147483647;e[a]=t}function s(t,s,i,a){let r=a;const n=s.length;i[r]=n>>24&255,i[r+1]=n>>16&255,i[r+2]=n>>8&255,i[r+3]=255&n,r+=4,i[r]=255&t.charCodeAt(0),i[r+1]=255&t.charCodeAt(1),i[r+2]=255&t.charCodeAt(2),i[r+3]=255&t.charCodeAt(3),r+=4,i.set(s,r),r+=s.length;const o=function(t,s,i){let a=-1;for(let r=s;r<i;r++){const s=255&(a^t[r]);a=a>>>8^e[s]}return-1^a}(i,a+4,r);i[r]=o>>24&255,i[r+1]=o>>16&255,i[r+2]=o>>8&255,i[r+3]=255&o}function i(t){let e=t.length;const s=65535,i=Math.ceil(e/s),a=new Uint8Array(2+e+5*i+4);let r=0;a[r++]=120,a[r++]=156;let n=0;for(;e>s;)a[r++]=0,a[r++]=255,a[r++]=255,a[r++]=0,a[r++]=0,a.set(t.subarray(n,n+s),r),r+=s,n+=s,e-=s;a[r++]=1,a[r++]=255&e,a[r++]=e>>8&255,a[r++]=255&~e,a[r++]=(65535&~e)>>8&255,a.set(t.subarray(n),r),r+=t.length-n;const o=function(t,e,s){let i=1,a=0;for(let r=e;r<s;++r)i=(i+(255&t[r]))%65521,a=(a+i)%65521;return a<<16|i}(t,0,t.length);return a[r++]=o>>24&255,a[r++]=o>>16&255,a[r++]=o>>8&255,a[r++]=255&o,a}function n(e,n,o,l){const c=e.width,h=e.height;let d,u,_;const f=e.data;switch(n){case a.ImageKind.GRAYSCALE_1BPP:u=0,d=1,_=c+7>>3;break;case a.ImageKind.RGB_24BPP:u=2,d=8,_=3*c;break;case a.ImageKind.RGBA_32BPP:u=6,d=8,_=4*c;break;default:throw new Error("invalid format")}const g=new Uint8Array((1+_)*h);let m=0,v=0;for(let t=0;t<h;++t)g[m++]=0,g.set(f.subarray(v,v+_),m),v+=_,m+=_;if(n===a.ImageKind.GRAYSCALE_1BPP&&l){m=0;for(let t=0;t<h;t++){m++;for(let t=0;t<_;t++)g[m++]^=255}}const b=new Uint8Array([c>>24&255,c>>16&255,c>>8&255,255&c,h>>24&255,h>>16&255,h>>8&255,255&h,d,u,0,0,0]),A=function(t){if(!r.isNodeJS)return i(t);try{let e;e=parseInt(process.versions.node)>=8?t:Buffer.from(t);const s=require$$5.deflateSync(e,{level:9});return s instanceof Uint8Array?s:new Uint8Array(s)}catch(e){(0,a.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+e)}return i(t)}(g),y=t.length+36+b.length+A.length,x=new Uint8Array(y);let S=0;return x.set(t,S),S+=t.length,s("IHDR",b,x,S),S+=12+b.length,s("IDATA",A,x,S),S+=12+A.length,s("IEND",new Uint8Array(0),x,S),p(x,"image/png",o)}return function(t,e,s){return n(t,void 0===t.kind?a.ImageKind.GRAYSCALE_1BPP:t.kind,e,s)}}();class f{constructor(){this.fontSizeScale=1,this.fontWeight=l.fontWeight,this.fontSize=0,this.textMatrix=a.IDENTITY_MATRIX,this.fontMatrix=a.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=a.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=l.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(t,e){this.x=t,this.y=e}}let g=0,m=0,v=0;e.SVGGraphics=n=class{constructor(t,e,s=!1){(0,i.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future."),this.svgFactory=new i.DOMSVGFactory,this.current=new f,this.transformMatrix=a.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=t,this.objs=e,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!s,this._operatorIdMapping=[];for(const i in a.OPS)this._operatorIdMapping[a.OPS[i]]=i}save(){this.transformStack.push(this.transformMatrix);const t=this.current;this.extraStack.push(t),this.current=t.clone()}restore(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}group(t){this.save(),this.executeOpTree(t),this.restore()}loadDependencies(t){const e=t.fnArray,s=t.argsArray;for(let i=0,r=e.length;i<r;i++)if(e[i]===a.OPS.dependency)for(const t of s[i]){const e=t.startsWith("g_")?this.commonObjs:this.objs,s=new Promise(s=>{e.get(t,s)});this.current.dependencies.push(s)}return Promise.all(this.current.dependencies)}transform(t,e,s,i,r,n){const o=[t,e,s,i,r,n];this.transformMatrix=a.Util.transform(this.transformMatrix,o),this.tgrp=null}getSVG(t,e){this.viewport=e;const s=this._initialize(e);return this.loadDependencies(t).then(()=>(this.transformMatrix=a.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(t)),s))}convertOpList(e){const s=this._operatorIdMapping,i=e.argsArray,a=e.fnArray,r=[];for(let t=0,n=a.length;t<n;t++){const e=a[t];r.push({fnId:e,fn:s[e],args:i[t]})}return t(r)}executeOpTree(t){for(const e of t){const t=e.fn,s=e.fnId,i=e.args;switch(0|s){case a.OPS.beginText:this.beginText();break;case a.OPS.dependency:break;case a.OPS.setLeading:this.setLeading(i);break;case a.OPS.setLeadingMoveText:this.setLeadingMoveText(i[0],i[1]);break;case a.OPS.setFont:this.setFont(i);break;case a.OPS.showText:case a.OPS.showSpacedText:this.showText(i[0]);break;case a.OPS.endText:this.endText();break;case a.OPS.moveText:this.moveText(i[0],i[1]);break;case a.OPS.setCharSpacing:this.setCharSpacing(i[0]);break;case a.OPS.setWordSpacing:this.setWordSpacing(i[0]);break;case a.OPS.setHScale:this.setHScale(i[0]);break;case a.OPS.setTextMatrix:this.setTextMatrix(i[0],i[1],i[2],i[3],i[4],i[5]);break;case a.OPS.setTextRise:this.setTextRise(i[0]);break;case a.OPS.setTextRenderingMode:this.setTextRenderingMode(i[0]);break;case a.OPS.setLineWidth:this.setLineWidth(i[0]);break;case a.OPS.setLineJoin:this.setLineJoin(i[0]);break;case a.OPS.setLineCap:this.setLineCap(i[0]);break;case a.OPS.setMiterLimit:this.setMiterLimit(i[0]);break;case a.OPS.setFillRGBColor:this.setFillRGBColor(i[0],i[1],i[2]);break;case a.OPS.setStrokeRGBColor:this.setStrokeRGBColor(i[0],i[1],i[2]);break;case a.OPS.setStrokeColorN:this.setStrokeColorN(i);break;case a.OPS.setFillColorN:this.setFillColorN(i);break;case a.OPS.shadingFill:this.shadingFill(i[0]);break;case a.OPS.setDash:this.setDash(i[0],i[1]);break;case a.OPS.setRenderingIntent:this.setRenderingIntent(i[0]);break;case a.OPS.setFlatness:this.setFlatness(i[0]);break;case a.OPS.setGState:this.setGState(i[0]);break;case a.OPS.fill:this.fill();break;case a.OPS.eoFill:this.eoFill();break;case a.OPS.stroke:this.stroke();break;case a.OPS.fillStroke:this.fillStroke();break;case a.OPS.eoFillStroke:this.eoFillStroke();break;case a.OPS.clip:this.clip("nonzero");break;case a.OPS.eoClip:this.clip("evenodd");break;case a.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case a.OPS.paintImageXObject:this.paintImageXObject(i[0]);break;case a.OPS.paintInlineImageXObject:this.paintInlineImageXObject(i[0]);break;case a.OPS.paintImageMaskXObject:this.paintImageMaskXObject(i[0]);break;case a.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(i[0],i[1]);break;case a.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case a.OPS.closePath:this.closePath();break;case a.OPS.closeStroke:this.closeStroke();break;case a.OPS.closeFillStroke:this.closeFillStroke();break;case a.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case a.OPS.nextLine:this.nextLine();break;case a.OPS.transform:this.transform(i[0],i[1],i[2],i[3],i[4],i[5]);break;case a.OPS.constructPath:this.constructPath(i[0],i[1]);break;case a.OPS.endPath:this.endPath();break;case 92:this.group(e.items);break;default:(0,a.warn)(`Unimplemented operator ${t}`)}}}setWordSpacing(t){this.current.wordSpacing=t}setCharSpacing(t){this.current.charSpacing=t}nextLine(){this.moveText(0,this.current.leading)}setTextMatrix(t,e,i,a,r,n){const o=this.current;o.textMatrix=o.lineMatrix=[t,e,i,a,r,n],o.textMatrixScale=Math.hypot(t,e),o.x=o.lineX=0,o.y=o.lineY=0,o.xcoords=[],o.ycoords=[],o.tspan=this.svgFactory.createElement("svg:tspan"),o.tspan.setAttributeNS(null,"font-family",o.fontFamily),o.tspan.setAttributeNS(null,"font-size",`${s(o.fontSize)}px`),o.tspan.setAttributeNS(null,"y",s(-o.y)),o.txtElement=this.svgFactory.createElement("svg:text"),o.txtElement.append(o.tspan)}beginText(){const t=this.current;t.x=t.lineX=0,t.y=t.lineY=0,t.textMatrix=a.IDENTITY_MATRIX,t.lineMatrix=a.IDENTITY_MATRIX,t.textMatrixScale=1,t.tspan=this.svgFactory.createElement("svg:tspan"),t.txtElement=this.svgFactory.createElement("svg:text"),t.txtgrp=this.svgFactory.createElement("svg:g"),t.xcoords=[],t.ycoords=[]}moveText(t,e){const i=this.current;i.x=i.lineX+=t,i.y=i.lineY+=e,i.xcoords=[],i.ycoords=[],i.tspan=this.svgFactory.createElement("svg:tspan"),i.tspan.setAttributeNS(null,"font-family",i.fontFamily),i.tspan.setAttributeNS(null,"font-size",`${s(i.fontSize)}px`),i.tspan.setAttributeNS(null,"y",s(-i.y))}showText(t){const e=this.current,i=e.font,r=e.fontSize;if(0===r)return;const n=e.fontSizeScale,h=e.charSpacing,d=e.wordSpacing,u=e.fontDirection,p=e.textHScale*u,_=i.vertical,f=_?1:-1,g=i.defaultVMetrics,m=r*e.fontMatrix[0];let v=0;for(const s of t){if(null===s){v+=u*d;continue}if("number"==typeof s){v+=f*s*r/1e3;continue}const t=(s.isSpace?d:0)+h,a=s.fontChar;let o,l,c,p=s.width;if(_){let t;const e=s.vmetric||g;t=s.vmetric?e[1]:.5*p,t=-t*m;const i=e[2]*m;p=e?-e[0]:p,o=t/n,l=(v+i)/n}else o=v/n,l=0;(s.isInFont||i.missingFile)&&(e.xcoords.push(e.x+o),_&&e.ycoords.push(-e.y+l),e.tspan.textContent+=a),c=_?p*m-t*u:p*m+t*u,v+=c}e.tspan.setAttributeNS(null,"x",e.xcoords.map(s).join(" ")),_?e.tspan.setAttributeNS(null,"y",e.ycoords.map(s).join(" ")):e.tspan.setAttributeNS(null,"y",s(-e.y)),_?e.y-=v:e.x+=v*p,e.tspan.setAttributeNS(null,"font-family",e.fontFamily),e.tspan.setAttributeNS(null,"font-size",`${s(e.fontSize)}px`),e.fontStyle!==l.fontStyle&&e.tspan.setAttributeNS(null,"font-style",e.fontStyle),e.fontWeight!==l.fontWeight&&e.tspan.setAttributeNS(null,"font-weight",e.fontWeight);const b=e.textRenderingMode&a.TextRenderingMode.FILL_STROKE_MASK;if(b===a.TextRenderingMode.FILL||b===a.TextRenderingMode.FILL_STROKE?(e.fillColor!==l.fillColor&&e.tspan.setAttributeNS(null,"fill",e.fillColor),e.fillAlpha<1&&e.tspan.setAttributeNS(null,"fill-opacity",e.fillAlpha)):e.textRenderingMode===a.TextRenderingMode.ADD_TO_PATH?e.tspan.setAttributeNS(null,"fill","transparent"):e.tspan.setAttributeNS(null,"fill","none"),b===a.TextRenderingMode.STROKE||b===a.TextRenderingMode.FILL_STROKE){const t=1/(e.textMatrixScale||1);this._setStrokeAttributes(e.tspan,t)}let A=e.textMatrix;0!==e.textRise&&(A=A.slice(),A[5]+=e.textRise),e.txtElement.setAttributeNS(null,"transform",`${o(A)} scale(${s(p)}, -1)`),e.txtElement.setAttributeNS(c,"xml:space","preserve"),e.txtElement.append(e.tspan),e.txtgrp.append(e.txtElement),this._ensureTransformGroup().append(e.txtElement)}setLeadingMoveText(t,e){this.setLeading(-e),this.moveText(t,e)}addFontStyle(t){if(!t.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 e=p(t.data,t.mimetype,this.forceDataSchema);this.cssStyle.textContent+=`@font-face { font-family: "${t.loadedName}"; src: url(${e}); }\n`}setFont(t){const e=this.current,i=this.commonObjs.get(t[0]);let r=t[1];e.font=i,!this.embedFonts||i.missingFile||this.embeddedFonts[i.loadedName]||(this.addFontStyle(i),this.embeddedFonts[i.loadedName]=i),e.fontMatrix=i.fontMatrix||a.FONT_IDENTITY_MATRIX;let n="normal";i.black?n="900":i.bold&&(n="bold");const o=i.italic?"italic":"normal";r<0?(r=-r,e.fontDirection=-1):e.fontDirection=1,e.fontSize=r,e.fontFamily=i.loadedName,e.fontWeight=n,e.fontStyle=o,e.tspan=this.svgFactory.createElement("svg:tspan"),e.tspan.setAttributeNS(null,"y",s(-e.y)),e.xcoords=[],e.ycoords=[]}endText(){var t;const e=this.current;e.textRenderingMode&a.TextRenderingMode.ADD_TO_PATH_FLAG&&(null==(t=e.txtElement)?void 0:t.hasChildNodes())&&(e.element=e.txtElement,this.clip("nonzero"),this.endPath())}setLineWidth(t){t>0&&(this.current.lineWidth=t)}setLineCap(t){this.current.lineCap=d[t]}setLineJoin(t){this.current.lineJoin=u[t]}setMiterLimit(t){this.current.miterLimit=t}setStrokeAlpha(t){this.current.strokeAlpha=t}setStrokeRGBColor(t,e,s){this.current.strokeColor=a.Util.makeHexColor(t,e,s)}setFillAlpha(t){this.current.fillAlpha=t}setFillRGBColor(t,e,s){this.current.fillColor=a.Util.makeHexColor(t,e,s),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(t){this.current.strokeColor=this._makeColorN_Pattern(t)}setFillColorN(t){this.current.fillColor=this._makeColorN_Pattern(t)}shadingFill(t){const e=this.viewport.width,s=this.viewport.height,i=a.Util.inverseTransform(this.transformMatrix),r=a.Util.applyTransform([0,0],i),n=a.Util.applyTransform([0,s],i),o=a.Util.applyTransform([e,0],i),l=a.Util.applyTransform([e,s],i),c=Math.min(r[0],n[0],o[0],l[0]),h=Math.min(r[1],n[1],o[1],l[1]),d=Math.max(r[0],n[0],o[0],l[0]),u=Math.max(r[1],n[1],o[1],l[1]),p=this.svgFactory.createElement("svg:rect");p.setAttributeNS(null,"x",c),p.setAttributeNS(null,"y",h),p.setAttributeNS(null,"width",d-c),p.setAttributeNS(null,"height",u-h),p.setAttributeNS(null,"fill",this._makeShadingPattern(t)),this.current.fillAlpha<1&&p.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(p)}_makeColorN_Pattern(t){return"TilingPattern"===t[0]?this._makeTilingPattern(t):this._makeShadingPattern(t)}_makeTilingPattern(t){const e=t[1],s=t[2],i=t[3]||a.IDENTITY_MATRIX,[r,n,o,l]=t[4],c=t[5],h=t[6],d=t[7],u="shading"+v++,[p,_,f,g]=a.Util.normalizeRect([...a.Util.applyTransform([r,n],i),...a.Util.applyTransform([o,l],i)]),[m,b]=a.Util.singularValueDecompose2dScale(i),A=c*m,y=h*b,x=this.svgFactory.createElement("svg:pattern");x.setAttributeNS(null,"id",u),x.setAttributeNS(null,"patternUnits","userSpaceOnUse"),x.setAttributeNS(null,"width",A),x.setAttributeNS(null,"height",y),x.setAttributeNS(null,"x",`${p}`),x.setAttributeNS(null,"y",`${_}`);const S=this.svg,w=this.transformMatrix,C=this.current.fillColor,k=this.current.strokeColor,T=this.svgFactory.create(f-p,g-_);if(this.svg=T,this.transformMatrix=i,2===d){const t=a.Util.makeHexColor(...e);this.current.fillColor=t,this.current.strokeColor=t}return this.executeOpTree(this.convertOpList(s)),this.svg=S,this.transformMatrix=w,this.current.fillColor=C,this.current.strokeColor=k,x.append(T.childNodes[0]),this.defs.append(x),`url(#${u})`}_makeShadingPattern(t){switch("string"==typeof t&&(t=this.objs.get(t)),t[0]){case"RadialAxial":const e="shading"+v++,s=t[3];let i;switch(t[1]){case"axial":const s=t[4],a=t[5];i=this.svgFactory.createElement("svg:linearGradient"),i.setAttributeNS(null,"id",e),i.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),i.setAttributeNS(null,"x1",s[0]),i.setAttributeNS(null,"y1",s[1]),i.setAttributeNS(null,"x2",a[0]),i.setAttributeNS(null,"y2",a[1]);break;case"radial":const r=t[4],n=t[5],o=t[6],l=t[7];i=this.svgFactory.createElement("svg:radialGradient"),i.setAttributeNS(null,"id",e),i.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),i.setAttributeNS(null,"cx",n[0]),i.setAttributeNS(null,"cy",n[1]),i.setAttributeNS(null,"r",l),i.setAttributeNS(null,"fx",r[0]),i.setAttributeNS(null,"fy",r[1]),i.setAttributeNS(null,"fr",o);break;default:throw new Error(`Unknown RadialAxial type: ${t[1]}`)}for(const t of s){const e=this.svgFactory.createElement("svg:stop");e.setAttributeNS(null,"offset",t[0]),e.setAttributeNS(null,"stop-color",t[1]),i.append(e)}return this.defs.append(i),`url(#${e})`;case"Mesh":return(0,a.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw new Error(`Unknown IR type: ${t[0]}`)}}setDash(t,e){this.current.dashArray=t,this.current.dashPhase=e}constructPath(t,e){const i=this.current;let r=i.x,n=i.y,o=[],l=0;for(const c of t)switch(0|c){case a.OPS.rectangle:r=e[l++],n=e[l++];const t=r+e[l++],i=n+e[l++];o.push("M",s(r),s(n),"L",s(t),s(n),"L",s(t),s(i),"L",s(r),s(i),"Z");break;case a.OPS.moveTo:r=e[l++],n=e[l++],o.push("M",s(r),s(n));break;case a.OPS.lineTo:r=e[l++],n=e[l++],o.push("L",s(r),s(n));break;case a.OPS.curveTo:r=e[l+4],n=e[l+5],o.push("C",s(e[l]),s(e[l+1]),s(e[l+2]),s(e[l+3]),s(r),s(n)),l+=6;break;case a.OPS.curveTo2:o.push("C",s(r),s(n),s(e[l]),s(e[l+1]),s(e[l+2]),s(e[l+3])),r=e[l+2],n=e[l+3],l+=4;break;case a.OPS.curveTo3:r=e[l+2],n=e[l+3],o.push("C",s(e[l]),s(e[l+1]),s(r),s(n),s(r),s(n)),l+=4;break;case a.OPS.closePath:o.push("Z")}o=o.join(" "),i.path&&t.length>0&&t[0]!==a.OPS.rectangle&&t[0]!==a.OPS.moveTo?o=i.path.getAttributeNS(null,"d")+o:(i.path=this.svgFactory.createElement("svg:path"),this._ensureTransformGroup().append(i.path)),i.path.setAttributeNS(null,"d",o),i.path.setAttributeNS(null,"fill","none"),i.element=i.path,i.setCurrentPoint(r,n)}endPath(){const t=this.current;if(t.path=null,!this.pendingClip)return;if(!t.element)return void(this.pendingClip=null);const e="clippath"+g++,s=this.svgFactory.createElement("svg:clipPath");s.setAttributeNS(null,"id",e),s.setAttributeNS(null,"transform",o(this.transformMatrix));const i=t.element.cloneNode(!0);if("evenodd"===this.pendingClip?i.setAttributeNS(null,"clip-rule","evenodd"):i.setAttributeNS(null,"clip-rule","nonzero"),this.pendingClip=null,s.append(i),this.defs.append(s),t.activeClipUrl){t.clipGroup=null;for(const t of this.extraStack)t.clipGroup=null;s.setAttributeNS(null,"clip-path",t.activeClipUrl)}t.activeClipUrl=`url(#${e})`,this.tgrp=null}clip(t){this.pendingClip=t}closePath(){const t=this.current;if(t.path){const e=`${t.path.getAttributeNS(null,"d")}Z`;t.path.setAttributeNS(null,"d",e)}}setLeading(t){this.current.leading=-t}setTextRise(t){this.current.textRise=t}setTextRenderingMode(t){this.current.textRenderingMode=t}setHScale(t){this.current.textHScale=t/100}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const[e,s]of t)switch(e){case"LW":this.setLineWidth(s);break;case"LC":this.setLineCap(s);break;case"LJ":this.setLineJoin(s);break;case"ML":this.setMiterLimit(s);break;case"D":this.setDash(s[0],s[1]);break;case"RI":this.setRenderingIntent(s);break;case"FL":this.setFlatness(s);break;case"Font":this.setFont(s);break;case"CA":this.setStrokeAlpha(s);break;case"ca":this.setFillAlpha(s);break;default:(0,a.warn)(`Unimplemented graphic state operator ${e}`)}}fill(){const t=this.current;t.element&&(t.element.setAttributeNS(null,"fill",t.fillColor),t.element.setAttributeNS(null,"fill-opacity",t.fillAlpha),this.endPath())}stroke(){const t=this.current;t.element&&(this._setStrokeAttributes(t.element),t.element.setAttributeNS(null,"fill","none"),this.endPath())}_setStrokeAttributes(t,e=1){const i=this.current;let a=i.dashArray;1!==e&&a.length>0&&(a=a.map(function(t){return e*t})),t.setAttributeNS(null,"stroke",i.strokeColor),t.setAttributeNS(null,"stroke-opacity",i.strokeAlpha),t.setAttributeNS(null,"stroke-miterlimit",s(i.miterLimit)),t.setAttributeNS(null,"stroke-linecap",i.lineCap),t.setAttributeNS(null,"stroke-linejoin",i.lineJoin),t.setAttributeNS(null,"stroke-width",s(e*i.lineWidth)+"px"),t.setAttributeNS(null,"stroke-dasharray",a.map(s).join(" ")),t.setAttributeNS(null,"stroke-dashoffset",s(e*i.dashPhase)+"px")}eoFill(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fill()}fillStroke(){this.stroke(),this.fill()}eoFillStroke(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()}closeStroke(){this.closePath(),this.stroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.closePath(),this.eoFillStroke()}paintSolidColorImageMask(){const t=this.svgFactory.createElement("svg:rect");t.setAttributeNS(null,"x","0"),t.setAttributeNS(null,"y","0"),t.setAttributeNS(null,"width","1px"),t.setAttributeNS(null,"height","1px"),t.setAttributeNS(null,"fill",this.current.fillColor),this._ensureTransformGroup().append(t)}paintImageXObject(t){const e=t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t);e?this.paintInlineImageXObject(e):(0,a.warn)(`Dependent image with object ID ${t} is not ready yet`)}paintInlineImageXObject(t,e){const i=t.width,a=t.height,r=_(t,this.forceDataSchema,!!e),n=this.svgFactory.createElement("svg:rect");n.setAttributeNS(null,"x","0"),n.setAttributeNS(null,"y","0"),n.setAttributeNS(null,"width",s(i)),n.setAttributeNS(null,"height",s(a)),this.current.element=n,this.clip("nonzero");const o=this.svgFactory.createElement("svg:image");o.setAttributeNS(h,"xlink:href",r),o.setAttributeNS(null,"x","0"),o.setAttributeNS(null,"y",s(-a)),o.setAttributeNS(null,"width",s(i)+"px"),o.setAttributeNS(null,"height",s(a)+"px"),o.setAttributeNS(null,"transform",`scale(${s(1/i)} ${s(-1/a)})`),e?e.append(o):this._ensureTransformGroup().append(o)}paintImageMaskXObject(t){const e=this.current,i=t.width,a=t.height,r=e.fillColor;e.maskId="mask"+m++;const n=this.svgFactory.createElement("svg:mask");n.setAttributeNS(null,"id",e.maskId);const o=this.svgFactory.createElement("svg:rect");o.setAttributeNS(null,"x","0"),o.setAttributeNS(null,"y","0"),o.setAttributeNS(null,"width",s(i)),o.setAttributeNS(null,"height",s(a)),o.setAttributeNS(null,"fill",r),o.setAttributeNS(null,"mask",`url(#${e.maskId})`),this.defs.append(n),this._ensureTransformGroup().append(o),this.paintInlineImageXObject(t,n)}paintFormXObjectBegin(t,e){if(Array.isArray(t)&&6===t.length&&this.transform(t[0],t[1],t[2],t[3],t[4],t[5]),e){const t=e[2]-e[0],i=e[3]-e[1],a=this.svgFactory.createElement("svg:rect");a.setAttributeNS(null,"x",e[0]),a.setAttributeNS(null,"y",e[1]),a.setAttributeNS(null,"width",s(t)),a.setAttributeNS(null,"height",s(i)),this.current.element=a,this.clip("nonzero"),this.endPath()}}paintFormXObjectEnd(){}_initialize(t){const e=this.svgFactory.create(t.width,t.height),s=this.svgFactory.createElement("svg:defs");e.append(s),this.defs=s;const i=this.svgFactory.createElement("svg:g");return i.setAttributeNS(null,"transform",o(t.transform)),e.append(i),this.svg=i,e}_ensureClipGroup(){if(!this.current.clipGroup){const t=this.svgFactory.createElement("svg:g");t.setAttributeNS(null,"clip-path",this.current.activeClipUrl),this.svg.append(t),this.current.clipGroup=t}return this.current.clipGroup}_ensureTransformGroup(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",o(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}}}},(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PDFNodeStream=void 0;var i=s(1),a=s(33);const r=require$$5,n=require$$5,o=require$$5,l=require$$5,c=/^file:\/\/\/[a-zA-Z]:\//;e.PDFNodeStream=class{constructor(t){this.source=t,this.url=function(t){const e=l.parse(t);return"file:"===e.protocol||e.host?e:/^[a-z]:[/\\]/i.test(t)?l.parse(`file:///${t}`):(e.host||(e.protocol="file:"),e)}(t.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t;return(null==(t=this._fullRequestReader)?void 0:t._loaded)??0}getFullReader(){return(0,i.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new f(this):new p(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=this.isFsUrl?new g(this,t,e):new _(this,t,e);return this._rangeRequestReaders.push(s),s}cancelAllRequests(t){this._fullRequestReader&&this._fullRequestReader.cancel(t);for(const e of this._rangeRequestReaders.slice(0))e.cancel(t)}};class h{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const e=t.source;this._contentLength=e.length,this._loaded=0,this._filename=null,this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._readableStream=null,this._readCapability=(0,i.createPromiseCapability)(),this._headersCapability=(0,i.createPromiseCapability)()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return null===t?(this._readCapability=(0,i.createPromiseCapability)(),this.read()):(this._loaded+=t.length,this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",t=>{this._error(t)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new i.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class d{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=(0,i.createPromiseCapability)();const e=t.source;this._isStreamingSupported=!e.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const t=this._readableStream.read();return null===t?(this._readCapability=(0,i.createPromiseCapability)(),this.read()):(this._loaded+=t.length,this.onProgress&&this.onProgress({loaded:this._loaded}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",t=>{this._error(t)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function u(t,e){return{protocol:t.protocol,auth:t.auth,host:t.hostname,port:t.port,path:t.path,method:"GET",headers:e}}class p extends h{constructor(t){super(t);const e=e=>{if(404===e.statusCode){const t=new i.MissingPDFException(`Missing PDF "${this._url}".`);return this._storedError=t,void this._headersCapability.reject(t)}this._headersCapability.resolve(),this._setReadableStream(e);const s=t=>this._readableStream.headers[t.toLowerCase()],{allowRangeRequests:r,suggestedLength:n}=(0,a.validateRangeRequestCapabilities)({getResponseHeader:s,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=r,this._contentLength=n||this._contentLength,this._filename=(0,a.extractFilenameFromHeader)(s)};this._request=null,"http:"===this._url.protocol?this._request=n.request(u(this._url,t.httpHeaders),e):this._request=o.request(u(this._url,t.httpHeaders),e),this._request.on("error",t=>{this._storedError=t,this._headersCapability.reject(t)}),this._request.end()}}class _ extends d{constructor(t,e,s){super(t),this._httpHeaders={};for(const i in t.httpHeaders){const e=t.httpHeaders[i];void 0!==e&&(this._httpHeaders[i]=e)}this._httpHeaders.Range=`bytes=${e}-${s-1}`;const a=t=>{if(404===t.statusCode){const t=new i.MissingPDFException(`Missing PDF "${this._url}".`);return void(this._storedError=t)}this._setReadableStream(t)};this._request=null,"http:"===this._url.protocol?this._request=n.request(u(this._url,this._httpHeaders),a):this._request=o.request(u(this._url,this._httpHeaders),a),this._request.on("error",t=>{this._storedError=t}),this._request.end()}}class f extends h{constructor(t){super(t);let e=decodeURIComponent(this._url.path);c.test(this._url.href)&&(e=e.replace(/^\//,"")),r.lstat(e,(t,s)=>{if(t)return"ENOENT"===t.code&&(t=new i.MissingPDFException(`Missing PDF "${e}".`)),this._storedError=t,void this._headersCapability.reject(t);this._contentLength=s.size,this._setReadableStream(r.createReadStream(e)),this._headersCapability.resolve()})}}class g extends d{constructor(t,e,s){super(t);let i=decodeURIComponent(this._url.path);c.test(this._url.href)&&(i=i.replace(/^\//,"")),this._setReadableStream(r.createReadStream(i,{start:e,end:s-1}))}}},(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createResponseStatusError=function(t,e){return 404===t||0===t&&e.startsWith("file:")?new i.MissingPDFException('Missing PDF "'+e+'".'):new i.UnexpectedResponseException(`Unexpected server response (${t}) while retrieving PDF "${e}".`,t)},e.extractFilenameFromHeader=function(t){const e=t("Content-Disposition");if(e){let t=(0,a.getFilenameFromContentDispositionHeader)(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch(s){}if((0,r.isPdfFile)(t))return t}return null},e.validateRangeRequestCapabilities=function({getResponseHeader:t,isHttp:e,rangeChunkSize:s,disableRange:i}){const a={allowRangeRequests:!1,suggestedLength:void 0},r=parseInt(t("Content-Length"),10);return Number.isInteger(r)?(a.suggestedLength=r,r<=2*s||i||!e||"bytes"!==t("Accept-Ranges")||"identity"!==(t("Content-Encoding")||"identity")||(a.allowRangeRequests=!0),a):a},e.validateResponseStatus=function(t){return 200===t||206===t};var i=s(1),a=s(34),r=s(8)},(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getFilenameFromContentDispositionHeader=function(t){let e=!0,s=a("filename\\*","i").exec(t);if(s){s=s[1];let t=o(s);return t=unescape(t),t=l(t),t=c(t),n(t)}if(s=function(t){const e=[];let s;const i=a("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(s=i.exec(t));){let[,t,i,a]=s;if(t=parseInt(t,10),t in e){if(0===t)break}else e[t]=[i,a]}const r=[];for(let a=0;a<e.length&&a in e;++a){let[t,s]=e[a];s=o(s),t&&(s=unescape(s),0===a&&(s=l(s))),r.push(s)}return r.join("")}(t),s)return n(c(s));if(s=a("filename","i").exec(t),s){s=s[1];let t=o(s);return t=c(t),n(t)}function a(t,e){return new RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',e)}function r(t,s){if(t){if(!/^[\x00-\xFF]+$/.test(s))return s;try{const a=new TextDecoder(t,{fatal:!0}),r=(0,i.stringToBytes)(s);s=a.decode(r),e=!1}catch(a){}}return s}function n(t){return e&&/[\x80-\xff]/.test(t)&&(t=r("utf-8",t),e&&(t=r("iso-8859-1",t))),t}function o(t){if(t.startsWith('"')){const e=t.slice(1).split('\\"');for(let t=0;t<e.length;++t){const s=e[t].indexOf('"');-1!==s&&(e[t]=e[t].slice(0,s),e.length=t+1),e[t]=e[t].replace(/\\(.)/g,"$1")}t=e.join('"')}return t}function l(t){const e=t.indexOf("'");return-1===e?t:r(t.slice(0,e),t.slice(e+1).replace(/^[^']*'/,""))}function c(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replace(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(t,e,s,i){if("q"===s||"Q"===s)return r(e,i=(i=i.replace(/_/g," ")).replace(/=([0-9a-fA-F]{2})/g,function(t,e){return String.fromCharCode(parseInt(e,16))}));try{i=atob(i)}catch(a){}return r(e,i)})}return""};var i=s(1)},(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PDFNetworkStream=void 0;var i=s(1),a=s(33);class r{constructor(t,e={}){this.url=t,this.isHttp=/^https?:/i.test(t),this.httpHeaders=this.isHttp&&e.httpHeaders||Object.create(null),this.withCredentials=e.withCredentials||!1,this.getXhr=e.getXhr||function(){return new XMLHttpRequest},this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(t,e,s){const i={begin:t,end:e};for(const a in s)i[a]=s[a];return this.request(i)}requestFull(t){return this.request(t)}request(t){const e=this.getXhr(),s=this.currXhrId++,i=this.pendingRequests[s]={xhr:e};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(const a in this.httpHeaders){const t=this.httpHeaders[a];void 0!==t&&e.setRequestHeader(a,t)}return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),i.expectedStatus=206):i.expectedStatus=200,e.responseType="arraybuffer",t.onError&&(e.onerror=function(s){t.onError(e.status)}),e.onreadystatechange=this.onStateChange.bind(this,s),e.onprogress=this.onProgress.bind(this,s),i.onHeadersReceived=t.onHeadersReceived,i.onDone=t.onDone,i.onError=t.onError,i.onProgress=t.onProgress,e.send(null),s}onProgress(t,e){var s;const i=this.pendingRequests[t];i&&(null==(s=i.onProgress)||s.call(i,e))}onStateChange(t,e){var s,a,r;const n=this.pendingRequests[t];if(!n)return;const o=n.xhr;if(o.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),4!==o.readyState)return;if(!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],0===o.status&&this.isHttp)return void(null==(s=n.onError)||s.call(n,o.status));const l=o.status||200;if((200!==l||206!==n.expectedStatus)&&l!==n.expectedStatus)return void(null==(a=n.onError)||a.call(n,o.status));const c=function(t){const e=t.response;return"string"!=typeof e?e:(0,i.stringToBytes)(e).buffer}(o);if(206===l){const t=o.getResponseHeader("Content-Range"),e=/bytes (\d+)-(\d+)\/(\d+)/.exec(t);n.onDone({begin:parseInt(e[1],10),chunk:c})}else c?n.onDone({begin:0,chunk:c}):null==(r=n.onError)||r.call(n,o.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){const e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}e.PDFNetworkStream=class{constructor(t){this._source=t,this._manager=new r(t.url,{httpHeaders:t.httpHeaders,withCredentials:t.withCredentials}),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return(0,i.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new n(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const s=new o(this._manager,t,e);return s.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(s),s}cancelAllRequests(t){var e;null==(e=this._fullRequestReader)||e.cancel(t);for(const s of this._rangeRequestReaders.slice(0))s.cancel(t)}};class n{constructor(t,e){this._manager=t;const s={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._fullRequestId=t.requestFull(s),this._headersReceivedCapability=(0,i.createPromiseCapability)(),this._disableRange=e.disableRange||!1,this._contentLength=e.length,this._rangeChunkSize=e.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 t=this._fullRequestId,e=this._manager.getRequestXhr(t),s=t=>e.getResponseHeader(t),{allowRangeRequests:i,suggestedLength:r}=(0,a.validateRangeRequestCapabilities)({getResponseHeader:s,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});i&&(this._isRangeSupported=!0),this._contentLength=r||this._contentLength,this._filename=(0,a.extractFilenameFromHeader)(s),this._isRangeSupported&&this._manager.abortRequest(t),this._headersReceivedCapability.resolve()}_onDone(t){if(t&&(this._requests.length>0?this._requests.shift().resolve({value:t.chunk,done:!1}):this._cachedChunks.push(t.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=(0,a.createResponseStatusError)(t,this._url),this._headersReceivedCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){var e;null==(e=this.onProgress)||e.call(this,{loaded:t.loaded,total:t.lengthComputable?t.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 t=(0,i.createPromiseCapability)();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersReceivedCapability.reject(t);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class o{constructor(t,e,s){this._manager=t;const i={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(e,s,i),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){var t;null==(t=this.onClosed)||t.call(this,this)}_onDone(t){const e=t.chunk;this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0;for(const s of this._requests)s.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){this._storedError=(0,a.createResponseStatusError)(t,this._url);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){var e;this.isStreamingSupported||null==(e=this.onProgress)||e.call(this,{loaded:t.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){const t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};const t=(0,i.createPromiseCapability)();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}},(t,e,s)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PDFFetchStream=void 0;var i=s(1),a=s(33);function r(t,e,s){return{method:"GET",headers:t,signal:s.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function n(t){const e=new Headers;for(const s in t){const i=t[s];void 0!==i&&e.append(s,i)}return e}e.PDFFetchStream=class{constructor(t){this.source=t,this.isHttp=/^https?:/i.test(t.url),this.httpHeaders=this.isHttp&&t.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var t;return(null==(t=this._fullRequestReader)?void 0:t._loaded)??0}getFullReader(){return(0,i.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new o(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const s=new l(this,t,e);return this._rangeRequestReaders.push(s),s}cancelAllRequests(t){this._fullRequestReader&&this._fullRequestReader.cancel(t);for(const e of this._rangeRequestReaders.slice(0))e.cancel(t)}};class o{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const e=t.source;this._withCredentials=e.withCredentials||!1,this._contentLength=e.length,this._headersCapability=(0,i.createPromiseCapability)(),this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._headers=n(this._stream.httpHeaders);const s=e.url;fetch(s,r(this._headers,this._withCredentials,this._abortController)).then(t=>{if(!(0,a.validateResponseStatus)(t.status))throw(0,a.createResponseStatusError)(t.status,s);this._reader=t.body.getReader(),this._headersCapability.resolve();const e=e=>t.headers.get(e),{allowRangeRequests:r,suggestedLength:n}=(0,a.validateRangeRequestCapabilities)({getResponseHeader:e,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=r,this._contentLength=n||this._contentLength,this._filename=(0,a.extractFilenameFromHeader)(e),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new i.AbortException("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){this._reader&&this._reader.cancel(t),this._abortController.abort()}}class l{constructor(t,e,s){this._stream=t,this._reader=null,this._loaded=0;const o=t.source;this._withCredentials=o.withCredentials||!1,this._readCapability=(0,i.createPromiseCapability)(),this._isStreamingSupported=!o.disableStream,this._abortController=new AbortController,this._headers=n(this._stream.httpHeaders),this._headers.append("Range",`bytes=${e}-${s-1}`);const l=o.url;fetch(l,r(this._headers,this._withCredentials,this._abortController)).then(t=>{if(!(0,a.validateResponseStatus)(t.status))throw(0,a.createResponseStatusError)(t.status,l);this._readCapability.resolve(),this._reader=t.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,this.onProgress&&this.onProgress({loaded:this._loaded}),{value:new Uint8Array(t).buffer,done:!1})}cancel(t){this._reader&&this._reader.cancel(t),this._abortController.abort()}}}],__webpack_module_cache__={};function __w_pdfjs_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var s=__webpack_module_cache__[t]={exports:{}};return __webpack_modules__[t](s,s.exports,__w_pdfjs_require__),s.exports}var __webpack_exports__={};return(()=>{var t=__webpack_exports__;Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"AnnotationEditorLayer",{enumerable:!0,get:function(){return a.AnnotationEditorLayer}}),Object.defineProperty(t,"AnnotationEditorParamsType",{enumerable:!0,get:function(){return e.AnnotationEditorParamsType}}),Object.defineProperty(t,"AnnotationEditorType",{enumerable:!0,get:function(){return e.AnnotationEditorType}}),Object.defineProperty(t,"AnnotationEditorUIManager",{enumerable:!0,get:function(){return r.AnnotationEditorUIManager}}),Object.defineProperty(t,"AnnotationLayer",{enumerable:!0,get:function(){return n.AnnotationLayer}}),Object.defineProperty(t,"AnnotationMode",{enumerable:!0,get:function(){return e.AnnotationMode}}),Object.defineProperty(t,"CMapCompressionType",{enumerable:!0,get:function(){return e.CMapCompressionType}}),Object.defineProperty(t,"GlobalWorkerOptions",{enumerable:!0,get:function(){return o.GlobalWorkerOptions}}),Object.defineProperty(t,"InvalidPDFException",{enumerable:!0,get:function(){return e.InvalidPDFException}}),Object.defineProperty(t,"LoopbackPort",{enumerable:!0,get:function(){return s.LoopbackPort}}),Object.defineProperty(t,"MissingPDFException",{enumerable:!0,get:function(){return e.MissingPDFException}}),Object.defineProperty(t,"OPS",{enumerable:!0,get:function(){return e.OPS}}),Object.defineProperty(t,"PDFDataRangeTransport",{enumerable:!0,get:function(){return s.PDFDataRangeTransport}}),Object.defineProperty(t,"PDFDateString",{enumerable:!0,get:function(){return i.PDFDateString}}),Object.defineProperty(t,"PDFWorker",{enumerable:!0,get:function(){return s.PDFWorker}}),Object.defineProperty(t,"PasswordResponses",{enumerable:!0,get:function(){return e.PasswordResponses}}),Object.defineProperty(t,"PermissionFlag",{enumerable:!0,get:function(){return e.PermissionFlag}}),Object.defineProperty(t,"PixelsPerInch",{enumerable:!0,get:function(){return i.PixelsPerInch}}),Object.defineProperty(t,"RenderingCancelledException",{enumerable:!0,get:function(){return i.RenderingCancelledException}}),Object.defineProperty(t,"SVGGraphics",{enumerable:!0,get:function(){return h.SVGGraphics}}),Object.defineProperty(t,"UNSUPPORTED_FEATURES",{enumerable:!0,get:function(){return e.UNSUPPORTED_FEATURES}}),Object.defineProperty(t,"UnexpectedResponseException",{enumerable:!0,get:function(){return e.UnexpectedResponseException}}),Object.defineProperty(t,"Util",{enumerable:!0,get:function(){return e.Util}}),Object.defineProperty(t,"VerbosityLevel",{enumerable:!0,get:function(){return e.VerbosityLevel}}),Object.defineProperty(t,"XfaLayer",{enumerable:!0,get:function(){return d.XfaLayer}}),Object.defineProperty(t,"build",{enumerable:!0,get:function(){return s.build}}),Object.defineProperty(t,"createPromiseCapability",{enumerable:!0,get:function(){return e.createPromiseCapability}}),Object.defineProperty(t,"createValidAbsoluteUrl",{enumerable:!0,get:function(){return e.createValidAbsoluteUrl}}),Object.defineProperty(t,"getDocument",{enumerable:!0,get:function(){return s.getDocument}}),Object.defineProperty(t,"getFilenameFromUrl",{enumerable:!0,get:function(){return i.getFilenameFromUrl}}),Object.defineProperty(t,"getPdfFilenameFromUrl",{enumerable:!0,get:function(){return i.getPdfFilenameFromUrl}}),Object.defineProperty(t,"getXfaPageViewport",{enumerable:!0,get:function(){return i.getXfaPageViewport}}),Object.defineProperty(t,"isPdfFile",{enumerable:!0,get:function(){return i.isPdfFile}}),Object.defineProperty(t,"loadScript",{enumerable:!0,get:function(){return i.loadScript}}),Object.defineProperty(t,"renderTextLayer",{enumerable:!0,get:function(){return c.renderTextLayer}}),Object.defineProperty(t,"shadow",{enumerable:!0,get:function(){return e.shadow}}),Object.defineProperty(t,"version",{enumerable:!0,get:function(){return s.version}});var e=__w_pdfjs_require__(1),s=__w_pdfjs_require__(4),i=__w_pdfjs_require__(8),a=__w_pdfjs_require__(22),r=__w_pdfjs_require__(7),n=__w_pdfjs_require__(27),o=__w_pdfjs_require__(15),l=__w_pdfjs_require__(3),c=__w_pdfjs_require__(30),h=__w_pdfjs_require__(31),d=__w_pdfjs_require__(29);if(l.isNodeJS){const{PDFNodeStream:t}=__w_pdfjs_require__(32);(0,s.setPDFNetworkStreamFactory)(e=>new t(e))}else{const{PDFNetworkStream:t}=__w_pdfjs_require__(35),{PDFFetchStream:e}=__w_pdfjs_require__(36);(0,s.setPDFNetworkStreamFactory)(s=>(0,i.isValidFetchUrl)(s.url)?new e(s):new t(s))}})(),__webpack_exports__})(),module.exports=factory()})(pdf);var pdfExports=pdf.exports;const pdfWorkerUrl="/assets/pdf.worker.min-BHSKYoqd.js",_sfc_main$1={__name:"index",props:{show:{type:Boolean,default:!1},url:{type:String,default:""},title:{type:String,default:""}},emits:["close"],setup(t,{emit:e}){pdfExports.GlobalWorkerOptions.workerSrc=pdfWorkerUrl;const s=t,i=e,a=ref(null),r=ref(!1),n=ref(""),o=ref(0),l=ref(0),c=ref(1);let h=null;const d=()=>{i("close")},u=()=>{var t;return(null==(t=a.value)?void 0:t.$el)||a.value},p=async t=>{const e=u();if(!e)return;e.innerHTML="",e.style.padding="0";const s=(e.clientWidth||window.innerWidth||375)*c.value,i=window.devicePixelRatio||1;for(let a=1;a<=t.numPages;a++){const r=await t.getPage(a),n=s/r.getViewport({scale:1}).width*i,o=r.getViewport({scale:n}),c=document.createElement("canvas");c.width=o.width,c.height=o.height,c.style.width=o.width/i+"px",c.style.height=o.height/i+"px",c.style.display="block",c.style.margin="0 auto 16px",e.appendChild(c),await r.render({canvasContext:c.getContext("2d"),viewport:o}).promise,l.value=a}},_=t=>{try{t.style.padding="0";const e=document.createElement("iframe");e.src=s.url,e.style.width="100%",e.style.height=(t.clientHeight||window.innerHeight||600)+"px",e.style.border="none",e.style.display="block",e.style.background="#fff",t.appendChild(e)}catch(e){console.error("iframe 预览失败:",e),n.value="PDF 加载失败,请稍后重试"}},f=t=>{c.value=Math.min(4,Math.max(.5,t)),h&&p(h)},g=()=>f(c.value+.25),m=()=>f(c.value-.25);return watch(()=>s.show,async t=>{t&&(c.value=1,await nextTick(),(async()=>{if(!s.url)return;const t=u();if(t){r.value=!0,n.value="",o.value=0,l.value=0,t.innerHTML="";try{const t=await pdfExports.getDocument({url:s.url}).promise;h=t,o.value=t.numPages,await p(t)}catch(e){console.warn("pdf.js 渲染失败,降级为 iframe 原生预览:",e),_(t)}finally{r.value=!1}}})())}),(e,s)=>{const i=index$i,h=index$g;return t.show?(openBlock(),createBlock(h,{key:0,class:"pdf-preview-mask"},{default:withCtx(()=>[createVNode(h,{class:"pp-header"},{default:withCtx(()=>[createVNode(i,{class:"pp-btn",onClick:d},{default:withCtx(()=>[createTextVNode("关闭")]),_:1}),createVNode(i,{class:"pp-title"},{default:withCtx(()=>[createTextVNode(toDisplayString(t.title||"文档预览"),1)]),_:1}),createVNode(h,{class:"pp-tools"},{default:withCtx(()=>[createVNode(i,{class:"pp-zoom-btn",onClick:m},{default:withCtx(()=>[createTextVNode("−")]),_:1}),createVNode(i,{class:"pp-zoom-label"},{default:withCtx(()=>[createTextVNode(toDisplayString(Math.round(100*c.value))+"%",1)]),_:1}),createVNode(i,{class:"pp-zoom-btn",onClick:g},{default:withCtx(()=>[createTextVNode("+")]),_:1}),createVNode(i,{class:"pp-page"},{default:withCtx(()=>[createTextVNode(toDisplayString(o.value?l.value+"/"+o.value:""),1)]),_:1})]),_:1})]),_:1}),createVNode(h,{ref_key:"container",ref:a,class:normalizeClass(["pp-body",{"pp-scrollable":c.value>1}])},null,8,["class"]),r.value?(openBlock(),createBlock(h,{key:0,class:"pp-tip"},{default:withCtx(()=>[createTextVNode("PDF 加载中…")]),_:1})):createCommentVNode("",!0),n.value?(openBlock(),createBlock(h,{key:1,class:"pp-tip pp-error"},{default:withCtx(()=>[createTextVNode(toDisplayString(n.value),1)]),_:1})):createCommentVNode("",!0)]),_:1})):createCommentVNode("",!0)}}},PdfPreview=_export_sfc(_sfc_main$1,[["__scopeId","data-v-ba21cff8"]]),_sfc_main={__name:"ethicalInfo",setup(t){const{showHomeButton:e,checkAutoLogin:s,goHome:i}=useHomeButton();useUserStore(),ref({});const a=ref({hospitalNo:"",donorName:"",gender:"",age:"",diagnosis:"",receiveStatus:"0",endtime:""}),r=ref(null),n=ref(null),o=ref([]),l=reactive({show:!1,url:"",title:""}),c=(()=>{try{return window.location.origin||`${window.location.protocol}//${window.location.host}`}catch{return"https://opo.qduh.cn"}})(),h=ref({expertconclusion:"",expertopinion:""}),d=ref({name:"",title:""}),u=ref(!1),p=ref("确认提交"),_=ref("确定要提交审查意见吗?提交后将无法修改。"),f=computed(()=>(new Date).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})),g=ref([{label:"不同意",value:"0"},{label:"同意",value:"1"},{label:"弃权",value:"3"},{label:"修改后同意",value:"4"}]),m=ref(!1),v=reactive({signatureUrl:"",signatureTime:"",fileName:"",serverData:null});let b=null,A=null,y=0,x=0,S={left:0,top:0},w=ref([]),C=[],k=4,T=!1;const E=[{label:"细",value:2},{label:"中",value:4},{label:"粗",value:6}],P=ref(4),M=ref(!1),F=computed(()=>w.value.length>0),R=reactive({uploadUrl:"/api/common/upload",extraParams:{caseNo:"",expertId:"",expertName:"",type:"ethics_review_signature",bizType:"expert_review"}}),D=ref(!0),N=ref(!0),I=ref("提交审查"),O=t=>({0:"待接收",1:"未接收",2:"已接收",3:"超时",4:"中止",5:"完成",6:"驳回"}[t]||"未知状态"),L=computed(()=>"3"==a.value.receiveStatus),G=computed(()=>L.value);computed(()=>!G.value&&(""!==h.value.expertconclusion&&""!==v.signatureUrl&&v.signatureUrl.startsWith("http"))),onLoad(async t=>{s(t),r.value=t.id,n.value=t.fcid,n.value&&await j(n.value)}),onShow(()=>{const t=getStorageSync("userInfo");t&&(d.value.name=t.nickName||t.userName||"")});const j=async t=>{try{showLoading({title:"加载中..."});const e={fcid:t,pageNum:1,pageSize:1},s=await uni.$uapi.get("/project/ethicalreviewopinions/listnew",e);if(200==s.code&&s.rows&&s.rows.length>0){const t=s.rows[0];if(console.log("加载的审查数据:",t),a.value={...a.value,inpatientno:t.inpatientno,name:t.name,sex:t.sex,age:t.age,ageunit:t.ageunit,expertType:t.expertType,diagnosisname:t.diagnosisname,receiveStatus:t.receiveStatus||"0",endtime:t.endtime||"",caseNo:t.caseNo||""},console.log(t.receiveStatus,"data.receiveStatus"),console.log(a.value.receiveStatus,"caseInfo.value"),null!==t.expertconclusion&&void 0!==t.expertconclusion&&""!==t.expertconclusion&&(h.value.expertconclusion=t.expertconclusion.toString()),t.expertopinion&&(h.value.expertopinion=t.expertopinion),t.expertname)d.value.name=t.expertname;else{const t=getStorageSync("userInfo");t&&(d.value.name=t.nickName||t.userName||"")}t.sigin&&(v.signatureUrl=W(t.sigin),v.signatureTime=t.conclusiontime||""),t.filePatch&&U(t.filePatch),B(t),V(t.receiveStatus),R.extraParams.caseNo=t.caseNo||"",R.extraParams.expertName=d.value.name}else showToast({title:s.msg||"未找到审查数据",icon:"none"})}catch(e){if("未登录"==e.message)return;showToast({title:"加载失败",icon:"none"})}finally{hideLoading()}},B=t=>{t.receiveStatus},W=t=>{if(!t)return"";if(t.startsWith("blob:")||t.startsWith("file://"))return t;if(t.startsWith("http://")||t.startsWith("https://"))try{const e=new URL(t);return`${c}${e.pathname}${e.search}${e.hash}`}catch{const e=t.indexOf("/",8);return-1!==e?`${c}${t.substring(e)}`:c}return`${c}${t.startsWith("/")?"":"/"}${t}`},U=t=>{if(t)try{let e=[];if(t.startsWith("[")&&t.endsWith("]")){const s=t.replace(/\\"/g,'"');e=JSON.parse(s)}else if(t.includes("fileName"))e=JSON.parse(t);else{e=t.split(";").filter(t=>t.trim()).map(t=>({fileName:t.split("/").pop()||"附件",path:t,fileUrl:t}))}o.value=e.map((t,e)=>{const s=t.fileName||`附件${e+1}`,i=W(t.fileUrl||t.path||t.url||""),a=s.split(".").pop().toLowerCase();let r="file-text",n="#909399";return["jpg","jpeg","png","gif","bmp","webp"].includes(a)?(r="photo",n="#fa8c16"):["doc","docx"].includes(a)?(r="file-text",n="#1890ff"):["xls","xlsx","csv"].includes(a)?(r="file-text",n="#52c41a"):["pdf"].includes(a)?(r="file-text",n="#f56c6c"):["txt","text"].includes(a)?(r="file-text",n="#909399"):["zip","rar","7z"].includes(a)&&(r="folder",n="#722ed1"),{id:t.infoid||e+1,name:s,icon:r,color:n,size:"--",url:i,type:a,createTime:t.createTime||""}})}catch(e){console.error("解析附件失败:",e,t);const s=t.split(";").filter(t=>t.trim());o.value=s.map((t,e)=>{const s=t.split("/").pop()||`附件${e+1}`,i=W(t),a=s.split(".").pop().toLowerCase();let r="file-text",n="#909399";return["jpg","jpeg","png","gif","bmp"].includes(a)?(r="photo",n="#fa8c16"):["doc","docx"].includes(a)?(r="file-text",n="#1890ff"):["xls","xlsx"].includes(a)?(r="file-text",n="#52c41a"):["pdf"].includes(a)&&(r="file-text",n="#f56c6c"),{id:e+1,name:s,icon:r,color:n,size:"--",url:i}})}},V=t=>{switch(t){case"3":case"4":case"5":case"6":D.value=!1,N.value=!1;break;default:D.value=!0,N.value=!0,I.value="提交审查"}},q=()=>{G.value?showToast({title:"当前任务已超时,不可操作",icon:"none"}):(m.value=!0,w.value=[],C=[],M.value=!1,T=!1,b=null,A=null,nextTick(()=>{setTimeout(()=>{H()},100)}))},z=()=>{m.value=!1,A&&(A.removeEventListener("touchstart",K),A.removeEventListener("touchmove",J),A.removeEventListener("touchend",Q),A.removeEventListener("touchcancel",Q),A.removeEventListener("mousedown",tt),A.removeEventListener("mousemove",et),A.removeEventListener("mouseup",st)),b=null,A=null},H=()=>{X()},$=ref(null),X=()=>{let t=document.getElementById("h5CanvasWrap");if(!t&&$.value&&(t=$.value.$el||$.value),!t)return void console.error("[签名] H5 画布容器获取失败(id=h5CanvasWrap 未找到)");t.innerHTML="";const e=document.createElement("canvas");e.style.display="block",e.style.background="#ffffff",e.style.touchAction="none",t.appendChild(e);const s=()=>{const s=t.getBoundingClientRect();return!(!s.width||!s.height)&&(e.style.width=s.width+"px",e.style.height=s.height+"px",!0)},i=()=>{try{const t=e.getBoundingClientRect();A=e,y=t.width,x=t.height,S={left:t.left,top:t.top};const s=window.devicePixelRatio||2;e.width=t.width*s,e.height=t.height*s,b=e.getContext("2d"),b.scale(s,s),console.log("[签名] H5 画布初始化",{cssW:y,cssH:x,dpr:s,rect:S}),it(),e.addEventListener("touchstart",K,{passive:!1}),e.addEventListener("touchmove",J,{passive:!1}),e.addEventListener("touchend",Q),e.addEventListener("touchcancel",Q),e.addEventListener("mousedown",tt),e.addEventListener("mousemove",et),e.addEventListener("mouseup",st)}catch(t){console.error("[签名] H5 画布初始化失败:",t)}};if(s())i();else{let t=0;const e=setInterval(()=>{t++,(s()||t>=10)&&(clearInterval(e),s()?i():console.error("[签名] H5 画布容器尺寸始终为 0,初始化失败"))},50)}};let Y=0;const K=t=>{if(!b||G.value)return;const e=t.touches[0];if(!e)return;const s=A.getBoundingClientRect();rt({x:e.clientX-s.left,y:e.clientY-s.top})},J=t=>{if(t.preventDefault(),!T||!b)return;const e=t.touches[0];if(!e)return;const s=A.getBoundingClientRect();nt({x:e.clientX-s.left,y:e.clientY-s.top})},Q=()=>{Y=Date.now(),ot()};let Z=!1;const tt=t=>{if(Date.now()-Y<500)return;if(!b||G.value)return;Z=!0;const e=A.getBoundingClientRect();rt({x:t.clientX-e.left,y:t.clientY-e.top})},et=t=>{if(!Z||!T||!b)return;const e=A.getBoundingClientRect();nt({x:t.clientX-e.left,y:t.clientY-e.top})},st=()=>{Z=!1,ot()},it=()=>{b&&(b.clearRect(0,0,y,x),b.fillStyle="#ffffff",b.fillRect(0,0,y,x),b.strokeStyle="#000000",b.lineCap="round",b.lineJoin="round",w.value.forEach(t=>{const e=t.points;if(b.lineWidth=t.width,1==e.length)at(e[0],t.width);else if(e.length>1){b.beginPath(),b.moveTo(e[0].x,e[0].y);for(let t=1;t<e.length;t++)b.lineTo(e[t].x,e[t].y);b.stroke()}}))},at=(t,e)=>{const s=Math.max(1,(e||3)/2);b.beginPath(),b.arc(t.x,t.y,s,0,2*Math.PI),b.fillStyle="#000000",b.fill()},rt=t=>{b&&!G.value&&(T=!0,C=[t],k=P.value,w.value.push({points:C,width:k}),M.value=!0,b.lineWidth=k,at(t,k))},nt=t=>{if(!T||!b)return;const e=C[C.length-1];e&&(b.beginPath(),b.lineWidth=k,b.moveTo(e.x,e.y),b.lineTo(t.x,t.y),b.stroke()),C.push(t)},ot=()=>{T&&(T=!1,C=[])},lt=()=>{w.value=[],C=[],M.value=!1,it()},ct=()=>{0!=w.value.length&&(w.value.pop(),M.value=w.value.length>0,it())},ht=async()=>{if(M.value)try{showLoading({title:"保存签名中..."});const t=await new Promise((t,e)=>{if(A)try{A.toBlob(s=>{if(s)if("undefined"!=typeof File){const e=new File([s],`signature_${Date.now()}.png`,{type:"image/png"});t(e)}else t(URL.createObjectURL(s));else e(new Error("生成图片失败"))},"image/png")}catch(s){e(s)}else e(new Error("画布未初始化"))}),e=await dt(t);e?(v.signatureUrl=W(e.url),v.signatureTime=(new Date).toLocaleString("zh-CN"),v.fileName=e.originalFilename||`signature_${Date.now()}.png`,v.serverData=e,ut(e),hideLoading(),showToast({title:"签名保存成功",icon:"success"}),m.value=!1,b=null,A=null):(hideLoading(),showToast({title:"签名上传失败",icon:"none"}))}catch(t){console.error("签名上传失败:",t),hideLoading(),showToast({title:"签名上传失败",icon:"none"})}else showToast({title:"请先签名",icon:"none"})},dt=t=>new Promise((e,s)=>{const i=getStorageSync("token"),r=getStorageSync("userInfo"),n=(null==r?void 0:r.nickName)||(null==r?void 0:r.userName)||d.value.name,o=t=>{console.log("签名上传成功:",t),200==t.code?e({url:t.url,fileName:t.fileName,newFileName:t.newFileName,originalFilename:t.originalFilename,filePath:t.filePath||t.fileName,size:t.size}):s(new Error(t.msg||"上传失败"))};if("undefined"!=typeof File&&t instanceof File){const e=new FormData;e.append("file",t,t.name),e.append("bizType","expert_review_signature"),e.append("caseNo",a.value.caseNo||""),e.append("expertName",n),e.append("uploadType","signature");const r=new XMLHttpRequest;return r.open("POST","/api/common/upload"),r.setRequestHeader("Authorization",`Bearer ${i}`),r.onload=()=>{if(200===r.status)try{o(JSON.parse(r.responseText))}catch(t){s(new Error("上传响应解析失败"))}else s(new Error(`上传失败,状态码: ${r.status}`))},r.onerror=()=>s(new Error("上传失败")),void r.send(e)}uploadFile({url:"/api/common/upload",filePath:t,name:"file",header:{Authorization:`Bearer ${i}`},formData:{bizType:"expert_review_signature",caseNo:a.value.caseNo||"",expertName:n,uploadType:"signature"},success:t=>{if(200==t.statusCode){const e=JSON.parse(t.data);o(e)}else s(new Error(`上传失败,状态码: ${t.statusCode}`))},fail:t=>{s(t)}})}),ut=t=>{try{const e={signatureUrl:v.signatureUrl,signatureTime:v.signatureTime,fileName:v.fileName,uploadData:t,caseNo:a.value.caseNo,timestamp:Date.now()};setStorageSync("expert_review_signature",e)}catch(e){console.error("保存签名到本地失败:",e)}},pt=()=>{G.value?showToast({title:"当前任务已超时,不可操作",icon:"none"}):showModal({title:"提示",content:"确定要删除签名吗?",success:t=>{t.confirm&&(v.signatureUrl="",v.signatureTime="",v.fileName="",v.serverData=null,removeStorageSync("expert_review_signature"))}})},_t=()=>{if(v.signatureUrl){let t=W(v.signatureUrl);previewImage({urls:[t],success:()=>{console.log("签名预览成功")},fail:t=>{console.error("签名预览失败:",t),showToast({title:"签名加载失败",icon:"none"})}})}},ft=t=>{console.log("选中结论:",t)},gt=async()=>{if(G.value)showToast({title:"当前任务已超时,不可操作",icon:"none"});else if(bt(!0))try{showLoading({title:"保存中..."});const t={fcid:n.value,expertconclusion:h.value.expertconclusion,expertopinion:h.value.expertopinion,sigin:v.signatureUrl,receiveStatus:"2",conclusiontime:dayjs().format("YYYY-MM-DD HH:mm:ss")},e=await uni.$uapi.post("/project/ethicalreviewopinions/edit",t);200==e.code?(showToast({title:"保存成功",icon:"success"}),a.value.receiveStatus="2",V("2")):showToast({title:e.msg||"保存失败",icon:"none"})}catch(t){console.error("保存草稿失败:",t),showToast({title:"保存失败",icon:"none"})}finally{hideLoading()}},mt=()=>{console.log(1),G.value?showToast({title:"当前任务已超时,不可操作",icon:"none"}):(console.log(2),bt()&&(p.value="确认提交",_.value="确定要提交审查意见吗?提交后将无法修改。",u.value=!0))},vt=async()=>{try{showLoading({title:"提交中..."}),console.log(a.value,"form.value");const t={id:n.value,expertconclusion:h.value.expertconclusion,expertopinion:h.value.expertopinion,sigin:v.signatureUrl,expertType:a.value.expertType,receiveStatus:"1"==h.value.expertconclusion||"4"==h.value.expertconclusion?"5":"6",conclusiontime:dayjs().format("YYYY-MM-DD HH:mm:ss")},e=await uni.$uapi.post("/project/ethicalreviewopinions/edit",t);200==e.code?(showToast({title:"提交成功",icon:"success",duration:2e3}),a.value.receiveStatus=t.receiveStatus,V(t.receiveStatus),u.value=!1,setTimeout(()=>{navigateBack()},1500)):showToast({title:e.msg||"提交失败",icon:"none"})}catch(t){console.error("提交失败:",t),showToast({title:"提交失败",icon:"none"})}finally{hideLoading()}},bt=(t=!1)=>h.value.expertconclusion||t?(console.log(3),console.log(v,"signatureData"),!(!v.signatureUrl&&!t)||(showToast({title:"请进行手写签名",icon:"none"}),!1)):(showToast({title:"请选择审查结论",icon:"none"}),!1);return(t,s)=>{const r=index$i,n=index$g,c=resolveEasycom(resolveDynamicComponent("up-icon"),__easycom_3),b=resolveEasycom(resolveDynamicComponent("u-radio"),__easycom_3$1),A=resolveEasycom(resolveDynamicComponent("u-radio-group"),__easycom_4),y=resolveEasycom(resolveDynamicComponent("u--textarea"),__easycom_5),x=index$q,S=index$x,w=resolveEasycom(resolveDynamicComponent("uni-icons"),__easycom_8),C=resolveEasycom(resolveDynamicComponent("u-modal"),__easycom_9);return openBlock(),createBlock(n,{class:"expert-review-page"},{default:withCtx(()=>[createVNode(n,{class:"review-overview card"},{default:withCtx(()=>[createVNode(n,{class:"overview-header"},{default:withCtx(()=>{return[createVNode(r,{class:"title"},{default:withCtx(()=>[createTextVNode("伦理审查任务")]),_:1}),createVNode(n,{class:normalizeClass(["status-badge",(t=a.value.receiveStatus,{0:"pending",1:"pending",2:"pending",3:"submitted",4:"submitted",5:"success",6:"error"}[t]||"pending")])},{default:withCtx(()=>[createTextVNode(toDisplayString(O(a.value.receiveStatus)),1)]),_:1},8,["class"])];var t}),_:1}),createVNode(n,{class:"compact-info-grid"},{default:withCtx(()=>[createVNode(n,{class:"compact-info-item"},{default:withCtx(()=>[createVNode(c,{name:"file-text",size:"14",color:"#909399"}),createVNode(r,{class:"compact-label"},{default:withCtx(()=>[createTextVNode("住院号")]),_:1}),createVNode(r,{class:"compact-value"},{default:withCtx(()=>[createTextVNode(toDisplayString(a.value.inpatientno||"--"),1)]),_:1})]),_:1}),createVNode(n,{class:"compact-info-item"},{default:withCtx(()=>[createVNode(c,{name:"account",size:"14",color:"#909399"}),createVNode(r,{class:"compact-label"},{default:withCtx(()=>[createTextVNode("捐献者")]),_:1}),createVNode(r,{class:"compact-value"},{default:withCtx(()=>[createTextVNode(toDisplayString(a.value.name||"--"),1)]),_:1})]),_:1}),createVNode(n,{class:"compact-info-item"},{default:withCtx(()=>[createVNode(c,{name:"man",size:"14",color:"#909399"}),createVNode(r,{class:"compact-label"},{default:withCtx(()=>[createTextVNode("性别/年龄")]),_:1}),createVNode(r,{class:"compact-value"},{default:withCtx(()=>[createTextVNode(toDisplayString(1==a.value.sex?"男":2==a.value.sex?"女":"未知")+"/"+toDisplayString(a.value.age||"--")+toDisplayString(a.value.ageunit||"岁"),1)]),_:1})]),_:1}),createVNode(n,{class:"compact-info-item"},{default:withCtx(()=>[createVNode(c,{name:"heart",size:"14",color:"#909399"}),createVNode(r,{class:"compact-label"},{default:withCtx(()=>[createTextVNode("疾病诊断")]),_:1}),createVNode(r,{class:"compact-value"},{default:withCtx(()=>[createTextVNode(toDisplayString(a.value.diagnosisname||"--"),1)]),_:1})]),_:1})]),_:1})]),_:1}),createVNode(n,{class:"materials-section card"},{default:withCtx(()=>[createVNode(n,{class:"section-header"},{default:withCtx(()=>[createVNode(r,{class:"section-title"},{default:withCtx(()=>[createTextVNode("审查材料")]),_:1}),createVNode(r,{class:"material-count"},{default:withCtx(()=>[createTextVNode(toDisplayString(o.value.length)+"个文件",1)]),_:1})]),_:1}),createVNode(n,{class:"compact-material-list"},{default:withCtx(()=>[(openBlock(!0),createElementBlock(Fragment,null,renderList(o.value,t=>(openBlock(),createBlock(n,{key:t.id,class:"compact-material-item",onClick:e=>(t=>{if(t.url){showLoading({title:"加载中..."});const e=t.type||t.url.split(".").pop().toLowerCase();let s=W(t.url);try{const t=new URL(s);s=t.origin+encodeURI(decodeURI(t.pathname))+(t.search||"")}catch{try{s=encodeURI(decodeURI(s))}catch{s=encodeURI(s)}}if(["jpg","jpeg","png","gif","bmp","webp"].includes(e))previewImage({urls:[s],current:0,success:()=>{console.log("图片预览成功")},fail:t=>{console.error("图片预览失败:",t),showToast({title:"图片加载失败",icon:"none"})},complete:()=>{hideLoading()}});else if(["pdf","doc","docx","xls","xlsx","ppt","pptx","txt"].includes(e))if(hideLoading(),"pdf"==e)l.url=s,l.title=t.name||"PDF 预览",l.show=!0;else{const e=document.createElement("a");e.href=s,e.download=t.name||t.url.split("/").pop(),e.target="_blank",document.body.appendChild(e),e.click(),document.body.removeChild(e)}else showToast({title:`暂不支持预览${e}格式文件`,icon:"none"}),hideLoading()}else showToast({title:`预览: ${t.name}`,icon:"none"})})(t)},{default:withCtx(()=>[createVNode(n,{class:"material-left"},{default:withCtx(()=>[createVNode(c,{name:t.icon,color:t.color,size:"18"},null,8,["name","color"]),createVNode(r,{class:"file-name"},{default:withCtx(()=>[createTextVNode(toDisplayString(t.name),1)]),_:2},1024),t.type?(openBlock(),createBlock(n,{key:0,class:"file-meta"},{default:withCtx(()=>[createVNode(r,{class:"file-type"},{default:withCtx(()=>[createTextVNode(toDisplayString(t.type||"文件"),1)]),_:2},1024)]),_:2},1024)):createCommentVNode("",!0)]),_:2},1024),createVNode(n,{class:"material-right"},{default:withCtx(()=>[createVNode(r,{class:"file-size"},{default:withCtx(()=>[createTextVNode(toDisplayString(t.size),1)]),_:2},1024),createVNode(c,{name:"arrow-right",size:"14",color:"#c0c4cc"})]),_:2},1024)]),_:2},1032,["onClick"]))),128))]),_:1})]),_:1}),createVNode(n,{class:"review-form card"},{default:withCtx(()=>[createVNode(n,{class:"section-header"},{default:withCtx(()=>[createVNode(r,{class:"section-title"},{default:withCtx(()=>[createTextVNode("审查意见")]),_:1}),L.value?(openBlock(),createBlock(n,{key:0,class:"timeout-badge"},{default:withCtx(()=>[createVNode(c,{name:"clock",size:"16"}),createVNode(r,null,{default:withCtx(()=>[createTextVNode("已超时")]),_:1})]),_:1})):createCommentVNode("",!0)]),_:1}),createVNode(n,{class:"form-content"},{default:withCtx(()=>[createVNode(n,{class:"form-group"},{default:withCtx(()=>[createVNode(r,{class:"form-label"},{default:withCtx(()=>[createTextVNode("审查结论")]),_:1}),createVNode(A,{modelValue:h.value.expertconclusion,"onUpdate:modelValue":s[0]||(s[0]=t=>h.value.expertconclusion=t),placement:"column",activeColor:"#007aff",onChange:ft,disabled:G.value},{default:withCtx(()=>[(openBlock(!0),createElementBlock(Fragment,null,renderList(g.value,t=>(openBlock(),createBlock(b,{key:t.value,name:t.value,label:t.label,customStyle:{marginBottom:"16rpx"}},null,8,["name","label"]))),128))]),_:1},8,["modelValue","disabled"])]),_:1}),createVNode(n,{class:"form-group"},{default:withCtx(()=>[createVNode(r,{class:"form-label"},{default:withCtx(()=>[createTextVNode("详细意见")]),_:1}),createVNode(y,{modelValue:h.value.expertopinion,"onUpdate:modelValue":s[1]||(s[1]=t=>h.value.expertopinion=t),placeholder:"请输入详细的审查意见和改进建议...",maxlength:"1000",count:"",height:120,border:"surround",disabled:G.value},null,8,["modelValue","disabled"])]),_:1}),createVNode(n,{class:"signature-section"},{default:withCtx(()=>[createVNode(n,{class:"expert-signature"},{default:withCtx(()=>[createVNode(c,{name:"edit-pen",size:"16",color:"#007aff"}),createVNode(r,{class:"signature-text"},{default:withCtx(()=>[createTextVNode("审查专家:"+toDisplayString(d.value.name),1)]),_:1})]),_:1}),createVNode(n,{class:"time-signature"},{default:withCtx(()=>[createVNode(c,{name:"clock",size:"16",color:"#007aff"}),createVNode(r,{class:"signature-text"},{default:withCtx(()=>[createTextVNode(toDisplayString(f.value),1)]),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),createVNode(n,{class:"signature-section card"},{default:withCtx(()=>[createVNode(n,{class:"section-header"},{default:withCtx(()=>[createVNode(r,{class:"section-title"},{default:withCtx(()=>[createTextVNode("专家签名确认")]),_:1}),L.value?(openBlock(),createBlock(n,{key:0,class:"timeout-badge"},{default:withCtx(()=>[createVNode(c,{name:"clock",size:"16"}),createVNode(r,null,{default:withCtx(()=>[createTextVNode("已超时,不可操作")]),_:1})]),_:1})):createCommentVNode("",!0)]),_:1}),createVNode(n,{class:"signature-content"},{default:withCtx(()=>[v.signatureUrl?(openBlock(),createBlock(n,{key:0,class:"signed-preview"},{default:withCtx(()=>[createVNode(x,{src:v.signatureUrl,mode:"aspectFit",class:"signature-image",onClick:_t},null,8,["src"]),createVNode(n,{class:"signature-info"},{default:withCtx(()=>[createVNode(r,{class:"signature-name"},{default:withCtx(()=>[createTextVNode("签名人:"+toDisplayString(d.value.name),1)]),_:1}),createVNode(r,{class:"signature-time"},{default:withCtx(()=>[createTextVNode(toDisplayString(v.signatureTime),1)]),_:1}),G.value?createCommentVNode("",!0):(openBlock(),createBlock(n,{key:0,class:"signature-actions"},{default:withCtx(()=>[createVNode(S,{class:"re-sign-btn",onClick:pt},{default:withCtx(()=>[createVNode(c,{name:"photo",size:"16"}),createVNode(r,null,{default:withCtx(()=>[createTextVNode("重新签名")]),_:1})]),_:1})]),_:1}))]),_:1})]),_:1})):(openBlock(),createElementBlock(Fragment,{key:1},[G.value?createCommentVNode("",!0):(openBlock(),createBlock(n,{key:0,class:"signature-upload",onClick:q},{default:withCtx(()=>[createVNode(n,{class:"signature-upload-area"},{default:withCtx(()=>[createVNode(c,{name:"edit-pen",size:"48",color:"#c0c4cc"}),createVNode(r,{class:"upload-hint"},{default:withCtx(()=>[createTextVNode("点击进行手写签名")]),_:1}),createVNode(r,{class:"upload-tip"},{default:withCtx(()=>[createTextVNode("签名将作为重要凭证")]),_:1})]),_:1})]),_:1}))],64)),G.value&&!v.signatureUrl?(openBlock(),createBlock(n,{key:2,class:"signature-disabled"},{default:withCtx(()=>[createVNode(n,{class:"signature-disabled-area"},{default:withCtx(()=>[createVNode(c,{name:"close-circle",size:"48",color:"#dcdfe6"}),createVNode(r,{class:"disabled-hint"},{default:withCtx(()=>[createTextVNode("当前任务已超时")]),_:1}),createVNode(r,{class:"disabled-tip"},{default:withCtx(()=>[createTextVNode("无法进行签名操作")]),_:1})]),_:1})]),_:1})):createCommentVNode("",!0)]),_:1})]),_:1}),G.value?createCommentVNode("",!0):(openBlock(),createBlock(n,{key:0,class:"action-bar-compact"},{default:withCtx(()=>[D.value?(openBlock(),createBlock(S,{key:0,class:"action-btn save-btn",onClick:gt},{default:withCtx(()=>[createVNode(c,{name:"file-text",size:"16",color:"#606266"}),createVNode(r,null,{default:withCtx(()=>[createTextVNode("保存草稿")]),_:1})]),_:1})):createCommentVNode("",!0),N.value?(openBlock(),createBlock(S,{key:1,class:"action-btn submit-btn",onClick:mt},{default:withCtx(()=>[createVNode(c,{name:"checkmark",size:"16",color:"#fff"}),createVNode(r,null,{default:withCtx(()=>[createTextVNode(toDisplayString(I.value),1)]),_:1})]),_:1})):createCommentVNode("",!0)]),_:1})),G.value?(openBlock(),createBlock(n,{key:1,class:"readonly-tip card"},{default:withCtx(()=>[createVNode(c,{name:"info-circle",size:"20",color:"#fa8c16"}),createVNode(r,null,{default:withCtx(()=>[createTextVNode("当前任务已超时,仅可查看,不可操作")]),_:1})]),_:1})):createCommentVNode("",!0),m.value?(openBlock(),createBlock(n,{key:2,class:"fullscreen-signature"},{default:withCtx(()=>[createVNode(n,{class:"fs-header"},{default:withCtx(()=>[createVNode(r,{class:"fs-header-btn fs-cancel",onClick:z},{default:withCtx(()=>[createTextVNode("取消")]),_:1}),createVNode(r,{class:"fs-title"},{default:withCtx(()=>[createTextVNode("手写签名")]),_:1}),createVNode(r,{class:"fs-header-btn fs-clear",onClick:lt},{default:withCtx(()=>[createTextVNode("清空")]),_:1})]),_:1}),createVNode(n,{class:"fs-body"},{default:withCtx(()=>[createVNode(n,{id:"h5CanvasWrap",ref_key:"h5CanvasWrap",ref:$,class:"fs-canvas-wrap"},null,512),M.value?createCommentVNode("",!0):(openBlock(),createBlock(n,{key:0,class:"fs-hint",onClick:s[2]||(s[2]=withModifiers(()=>{},["stop"]))},{default:withCtx(()=>[createVNode(c,{name:"edit-pen",size:"44",color:"#c0c4cc"}),createVNode(r,null,{default:withCtx(()=>[createTextVNode("请在此区域签名")]),_:1})]),_:1}))]),_:1}),createVNode(n,{class:"fs-toolbar"},{default:withCtx(()=>[(openBlock(),createElementBlock(Fragment,null,renderList(E,t=>createVNode(n,{class:"toolbar-item",key:t.value,onClick:e=>P.value=t.value},{default:withCtx(()=>[createVNode(n,{class:"size-dot",style:normalizeStyle({width:2*t.value+"px",height:2*t.value+"px",background:P.value==t.value?"#0f95b0":"#c0c4cc"})},null,8,["style"]),createVNode(r,{class:normalizeClass(["size-label",{active:P.value==t.value}])},{default:withCtx(()=>[createTextVNode(toDisplayString(t.label),1)]),_:2},1032,["class"])]),_:2},1032,["onClick"])),64))]),_:1}),createVNode(n,{class:"fs-footer"},{default:withCtx(()=>[createVNode(S,{class:"fs-btn fs-undo",disabled:!F.value,onClick:ct},{default:withCtx(()=>[createTextVNode(" 撤销 ")]),_:1},8,["disabled"]),createVNode(S,{class:"fs-btn fs-confirm",disabled:!M.value,onClick:ht},{default:withCtx(()=>[createTextVNode(" 确认签名 ")]),_:1},8,["disabled"])]),_:1})]),_:1})):createCommentVNode("",!0),unref(e)?(openBlock(),createBlock(n,{key:3,class:"home-fab",onClick:unref(i)},{default:withCtx(()=>[createVNode(w,{type:"home",size:"24",color:"#fff"}),createVNode(r,{class:"home-text"},{default:withCtx(()=>[createTextVNode("首页")]),_:1})]),_:1},8,["onClick"])):createCommentVNode("",!0),createVNode(C,{show:u.value,title:p.value,content:_.value,showCancelButton:"",onConfirm:vt,onCancel:s[3]||(s[3]=t=>u.value=!1)},null,8,["show","title","content"]),createVNode(PdfPreview,{show:l.show,url:l.url,title:l.title,onClose:s[4]||(s[4]=t=>l.show=!1)},null,8,["show","url","title"])]),_:1})}}},ethicalInfo=_export_sfc(_sfc_main,[["__scopeId","data-v-b26789f2"]]);export{ethicalInfo as default};
|