@getflip/swirl-components 0.300.0 → 0.300.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,4 +38,4 @@ License: MIT
38
38
  *
39
39
  * @licend The above is the entire license notice for the
40
40
  * JavaScript code in this page
41
- */var S;globalThis,S=()=>(()=>{var t=[,(t,e,i)=>{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=u,e.arraysToBytes=function(t){const e=t.length;if(1===e&&t[0]instanceof Uint8Array)return t[0];let i=0;for(let n=0;n<e;n++)i+=u(t[n]);let n=0;const r=new Uint8Array(i);for(let i=0;i<e;i++){let e=t[i];e instanceof Uint8Array||(e="string"==typeof e?c(e):new Uint8Array(e));const s=e.byteLength;r.set(e,n),n+=s}return r},e.assert=function(t,e){t||o(e)},e.bytesToString=function(t){"object"==typeof t&&null!==t&&void 0!==t.length||o("Invalid argument for bytesToString");const e=t.length,i=8192;if(e<i)return String.fromCharCode.apply(null,t);const n=[];for(let r=0;r<e;r+=i){const s=Math.min(r+i,e),o=t.subarray(r,s);n.push(String.fromCharCode.apply(null,o))}return n.join("")},e.createPromiseCapability=function(){const t=Object.create(null);let e=!1;return Object.defineProperty(t,"settled",{get:()=>e}),t.promise=new Promise((function(i,n){t.resolve=function(t){e=!0,i(t)},t.reject=function(t){e=!0,n(t)}})),t},e.createValidAbsoluteUrl=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!t)return null;try{if(i&&"string"==typeof t){if(i.addDefaultProtocol&&t.startsWith("www.")){const e=t.match(/\./g);e&&e.length>=2&&(t=`http://${t}`)}if(i.tryConvertEncoding)try{t=v(t)}catch(t){}}const n=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}}(n))return n}catch(t){}return null},e.escapeString=function(t){return t.replace(/([()\\\n\r])/g,(t=>"\n"===t?"\\n":"\r"===t?"\\r":`\\${t}`))},e.getModificationDate=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]: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 r},e.info=function(t){r>=n.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 i=0,n=t.length;i<n;i++)if(t[i]!==e[i])return!1;return!0},e.isAscii=function(t){return/^[\x00-\x7F]*$/.test(t)},e.objectFromMap=function(t){const e=Object.create(null);for(const[i,n]of t)e[i]=n;return e},e.objectSize=function(t){return Object.keys(t).length},e.setVerbosityLevel=function(t){Number.isInteger(t)&&(r=t)},e.shadow=a,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 i=new TextDecoder(e,{fatal:!0}),n=c(t);return i.decode(n)}catch(t){s(`stringToPDFString: "${t}".`)}}const e=[];for(let i=0,n=t.length;i<n;i++){const n=d[t.charCodeAt(i)];e.push(n?String.fromCharCode(n):t.charAt(i))}return e.join("")},e.stringToUTF16BEString=function(t){const e=["þÿ"];for(let i=0,n=t.length;i<n;i++){const n=t.charCodeAt(i);e.push(String.fromCharCode(n>>8&255),String.fromCharCode(255&n))}return e.join("")},e.stringToUTF8String=v,e.unreachable=o,e.utf8StringToString=function(t){return unescape(encodeURIComponent(t))},e.warn=s,i(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 n={ERRORS:0,WARNINGS:1,INFOS:5};e.VerbosityLevel=n,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 r=n.WARNINGS;function s(t){r>=n.WARNINGS&&console.log(`Warning: ${t}`)}function o(t){throw new Error(t)}function a(t,e,i){return Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!1}),i}const h=function(){function t(e,i){this.constructor===t&&o("Cannot initialize BaseException."),this.message=e,this.name=i}return t.prototype=new Error,t.constructor=t,t}();function c(t){"string"!=typeof t&&o("Invalid argument for stringToBytes");const e=t.length,i=new Uint8Array(e);for(let n=0;n<e;++n)i[n]=255&t.charCodeAt(n);return i}function u(t){return void 0!==t.length?t.length:void 0!==t.byteLength?t.byteLength:void o("Invalid argument for arrayByteLength")}e.BaseException=h,e.PasswordException=class extends h{constructor(t,e){super(t,"PasswordException"),this.code=e}},e.UnknownErrorException=class extends h{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}},e.InvalidPDFException=class extends h{constructor(t){super(t,"InvalidPDFException")}},e.MissingPDFException=class extends h{constructor(t){super(t,"MissingPDFException")}},e.UnexpectedResponseException=class extends h{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}},e.FormatError=class extends h{constructor(t){super(t,"FormatError")}},e.AbortException=class extends h{constructor(t){super(t,"AbortException")}},e.FeatureTest=class{static get isLittleEndian(){return a(this,"isLittleEndian",function(){const t=new Uint8Array(4);return t[0]=1,1===new Uint32Array(t.buffer,0,1)[0]}())}static get isEvalSupported(){return a(this,"isEvalSupported",!1)}static get isOffscreenCanvasSupported(){return a(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}};const l=[...Array(256).keys()].map((t=>t.toString(16).padStart(2,"0")));class f{static makeHexColor(t,e,i){return`#${l[t]}${l[e]}${l[i]}`}static scaleMinMax(t,e){let i;t[0]?(t[0]<0&&(i=e[0],e[0]=e[1],e[1]=i),e[0]*=t[0],e[1]*=t[0],t[3]<0&&(i=e[2],e[2]=e[3],e[3]=i),e[2]*=t[3],e[3]*=t[3]):(i=e[0],e[0]=e[2],e[2]=i,i=e[1],e[1]=e[3],e[3]=i,t[1]<0&&(i=e[2],e[2]=e[3],e[3]=i),e[2]*=t[1],e[3]*=t[1],t[2]<0&&(i=e[0],e[0]=e[1],e[1]=i),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 i=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])/i,(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/i]}static getAxialAlignedBoundingBox(t,e){const i=f.applyTransform(t,e),n=f.applyTransform(t.slice(2,4),e),r=f.applyTransform([t[0],t[3]],e),s=f.applyTransform([t[2],t[1]],e);return[Math.min(i[0],n[0],r[0],s[0]),Math.min(i[1],n[1],r[1],s[1]),Math.max(i[0],n[0],r[0],s[0]),Math.max(i[1],n[1],r[1],s[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]],i=t[0]*e[0]+t[1]*e[2],n=t[2]*e[1]+t[3]*e[3],r=(i+n)/2,s=Math.sqrt((i+n)**2-4*(i*n-(t[2]*e[0]+t[3]*e[2])*(t[0]*e[1]+t[1]*e[3])))/2,o=r-s||1;return[Math.sqrt(r+s||1),Math.sqrt(o)]}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 i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),n=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>n)return null;const r=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),s=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return r>s?null:[i,r,n,s]}static bezierBoundingBox(t,e,i,n,r,s,o,a){const h=[],c=[[],[]];let u,l,f,d,v,p,b,w;for(let c=0;c<2;++c)if(0===c?(l=6*t-12*i+6*r,u=-3*t+9*i-9*r+3*o,f=3*i-3*t):(l=6*e-12*n+6*s,u=-3*e+9*n-9*s+3*a,f=3*n-3*e),Math.abs(u)<1e-12){if(Math.abs(l)<1e-12)continue;d=-f/l,0<d&&d<1&&h.push(d)}else b=l*l-4*f*u,w=Math.sqrt(b),b<0||(v=(-l+w)/(2*u),0<v&&v<1&&h.push(v),p=(-l-w)/(2*u),0<p&&p<1&&h.push(p));let g,m=h.length;const A=m;for(;m--;)d=h[m],g=1-d,c[0][m]=g*g*g*t+3*g*g*d*i+3*g*d*d*r+d*d*d*o,c[1][m]=g*g*g*e+3*g*g*d*n+3*g*d*d*s+d*d*d*a;return c[0][A]=t,c[1][A]=e,c[0][A+1]=o,c[1][A+1]=a,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=f;const d=[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 v(t){return decodeURIComponent(escape(t))}},(t,e,i)=>{var n=i(3);globalThis._pdfjsCompatibilityChecked||(globalThis._pdfjsCompatibilityChecked=!0,!globalThis.btoa&&n.isNodeJS&&(globalThis.btoa=function(t){return Buffer.from(t,"binary").toString("base64")}),!globalThis.atob&&n.isNodeJS&&(globalThis.atob=function(t){return Buffer.from(t,"base64").toString("binary")}),!globalThis.DOMMatrix&&n.isNodeJS&&(globalThis.DOMMatrix=k.exports),!globalThis.ReadableStream&&n.isNodeJS&&(globalThis.ReadableStream=M.exports.ReadableStream),Array.prototype.at||i(4),Uint8Array.prototype.at||i(76),globalThis.structuredClone||i(86))},(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isNodeJS=void 0;const i=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type);e.isNodeJS=i},(t,e,i)=>{i(5);var n=i(75);t.exports=n("Array","at")},(t,e,i)=>{var n=i(6),r=i(41),s=i(65),o=i(63),a=i(70);n({target:"Array",proto:!0},{at:function(t){var e=r(this),i=s(e),n=o(t),a=n>=0?n:i+n;return a<0||a>=i?void 0:e[a]}}),a("at")},(t,e,i)=>{var n=i(7),r=i(8).f,s=i(45),o=i(49),a=i(39),h=i(57),c=i(69);t.exports=function(t,e){var i,u,l,f,d,v=t.target,p=t.global,b=t.stat;if(i=p?n:b?n[v]||a(v,{}):(n[v]||{}).prototype)for(u in e){if(f=e[u],l=t.dontCallGetSet?(d=r(i,u))&&d.value:i[u],!c(p?u:v+(b?".":"#")+u,t.forced)&&void 0!==l){if(typeof f==typeof l)continue;h(f,l)}(t.sham||l&&l.sham)&&s(f,"sham",!0),o(i,u,f,t)}}},t=>{var e=function(t){return t&&t.Math==Math&&t};t.exports=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof s&&s)||function(){return this}()},(t,e,i)=>{var n=i(9),r=i(11),s=i(13),o=i(14),a=i(15),h=i(20),c=i(40),u=i(43),l=Object.getOwnPropertyDescriptor;e.f=n?l:function(t,e){if(t=a(t),e=h(e),u)try{return l(t,e)}catch(t){}if(c(t,e))return o(!r(s.f,t,e),t[e])}},(t,e,i)=>{var n=i(10);t.exports=!n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},t=>{t.exports=function(t){try{return!!t()}catch(t){return!0}}},(t,e,i)=>{var n=i(12),r=Function.prototype.call;t.exports=n?r.bind(r):function(){return r.apply(r,arguments)}},(t,e,i)=>{var n=i(10);t.exports=!n((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},(t,e)=>{var i={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,r=n&&!i.call({1:2},1);e.f=r?function(t){var e=n(this,t);return!!e&&e.enumerable}:i},t=>{t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},(t,e,i)=>{var n=i(16),r=i(19);t.exports=function(t){return n(r(t))}},(t,e,i)=>{var n=i(17),r=i(10),s=i(18),o=Object,a=n("".split);t.exports=r((function(){return!o("z").propertyIsEnumerable(0)}))?function(t){return"String"==s(t)?a(t,""):o(t)}:o},(t,e,i)=>{var n=i(12),r=Function.prototype,s=r.call,o=n&&r.bind.bind(s,s);t.exports=n?function(t){return t&&o(t)}:function(t){return t&&function(){return s.apply(t,arguments)}}},(t,e,i)=>{var n=i(17),r=n({}.toString),s=n("".slice);t.exports=function(t){return s(r(t),8,-1)}},t=>{var e=TypeError;t.exports=function(t){if(null==t)throw e("Can't call method on "+t);return t}},(t,e,i)=>{var n=i(21),r=i(24);t.exports=function(t){var e=n(t,"string");return r(e)?e:e+""}},(t,e,i)=>{var n=i(11),r=i(22),s=i(24),o=i(31),a=i(34),h=i(35),c=TypeError,u=h("toPrimitive");t.exports=function(t,e){if(!r(t)||s(t))return t;var i,h=o(t,u);if(h){if(void 0===e&&(e="default"),i=n(h,t,e),!r(i)||s(i))return i;throw c("Can't convert object to primitive value")}return void 0===e&&(e="number"),a(t,e)}},(t,e,i)=>{var n=i(23);t.exports=function(t){return"object"==typeof t?null!==t:n(t)}},t=>{t.exports=function(t){return"function"==typeof t}},(t,e,i)=>{var n=i(25),r=i(23),s=i(26),o=i(27),a=Object;t.exports=o?function(t){return"symbol"==typeof t}:function(t){var e=n("Symbol");return r(e)&&s(e.prototype,a(t))}},(t,e,i)=>{var n=i(7),r=i(23);t.exports=function(t,e){return arguments.length<2?r(i=n[t])?i:void 0:n[t]&&n[t][e];var i}},(t,e,i)=>{var n=i(17);t.exports=n({}.isPrototypeOf)},(t,e,i)=>{var n=i(28);t.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},(t,e,i)=>{var n=i(29),r=i(10);t.exports=!!Object.getOwnPropertySymbols&&!r((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&n&&n<41}))},(t,e,i)=>{var n,r,s=i(7),o=i(30),a=s.process,h=s.Deno,c=a&&a.versions||h&&h.version,u=c&&c.v8;u&&(r=(n=u.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1])),!r&&o&&(!(n=o.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=o.match(/Chrome\/(\d+)/))&&(r=+n[1]),t.exports=r},(t,e,i)=>{var n=i(25);t.exports=n("navigator","userAgent")||""},(t,e,i)=>{var n=i(32);t.exports=function(t,e){var i=t[e];return null==i?void 0:n(i)}},(t,e,i)=>{var n=i(23),r=i(33),s=TypeError;t.exports=function(t){if(n(t))return t;throw s(r(t)+" is not a function")}},t=>{var e=String;t.exports=function(t){try{return e(t)}catch(t){return"Object"}}},(t,e,i)=>{var n=i(11),r=i(23),s=i(22),o=TypeError;t.exports=function(t,e){var i,a;if("string"===e&&r(i=t.toString)&&!s(a=n(i,t)))return a;if(r(i=t.valueOf)&&!s(a=n(i,t)))return a;if("string"!==e&&r(i=t.toString)&&!s(a=n(i,t)))return a;throw o("Can't convert object to primitive value")}},(t,e,i)=>{var n=i(7),r=i(36),s=i(40),o=i(42),a=i(28),h=i(27),c=r("wks"),u=n.Symbol,l=u&&u.for,f=h?u:u&&u.withoutSetter||o;t.exports=function(t){if(!s(c,t)||!a&&"string"!=typeof c[t]){var e="Symbol."+t;c[t]=a&&s(u,t)?u[t]:h&&l?l(e):f(e)}return c[t]}},(t,e,i)=>{var n=i(37),r=i(38);(t.exports=function(t,e){return r[t]||(r[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.24.1",mode:n?"pure":"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.24.1/LICENSE",source:"https://github.com/zloirock/core-js"})},t=>{t.exports=!1},(t,e,i)=>{var n=i(7),r=i(39),s="__core-js_shared__",o=n[s]||r(s,{});t.exports=o},(t,e,i)=>{var n=i(7),r=Object.defineProperty;t.exports=function(t,e){try{r(n,t,{value:e,configurable:!0,writable:!0})}catch(i){n[t]=e}return e}},(t,e,i)=>{var n=i(17),r=i(41),s=n({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return s(r(t),e)}},(t,e,i)=>{var n=i(19),r=Object;t.exports=function(t){return r(n(t))}},(t,e,i)=>{var n=i(17),r=0,s=Math.random(),o=n(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+o(++r+s,36)}},(t,e,i)=>{var n=i(9),r=i(10),s=i(44);t.exports=!n&&!r((function(){return 7!=Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a}))},(t,e,i)=>{var n=i(7),r=i(22),s=n.document,o=r(s)&&r(s.createElement);t.exports=function(t){return o?s.createElement(t):{}}},(t,e,i)=>{var n=i(9),r=i(46),s=i(14);t.exports=n?function(t,e,i){return r.f(t,e,s(1,i))}:function(t,e,i){return t[e]=i,t}},(t,e,i)=>{var n=i(9),r=i(43),s=i(47),o=i(48),a=i(20),h=TypeError,c=Object.defineProperty,u=Object.getOwnPropertyDescriptor,l="enumerable",f="configurable",d="writable";e.f=n?s?function(t,e,i){if(o(t),e=a(e),o(i),"function"==typeof t&&"prototype"===e&&"value"in i&&d in i&&!i[d]){var n=u(t,e);n&&n[d]&&(t[e]=i.value,i={configurable:f in i?i[f]:n[f],enumerable:l in i?i[l]:n[l],writable:!1})}return c(t,e,i)}:c:function(t,e,i){if(o(t),e=a(e),o(i),r)try{return c(t,e,i)}catch(t){}if("get"in i||"set"in i)throw h("Accessors not supported");return"value"in i&&(t[e]=i.value),t}},(t,e,i)=>{var n=i(9),r=i(10);t.exports=n&&r((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},(t,e,i)=>{var n=i(22),r=String,s=TypeError;t.exports=function(t){if(n(t))return t;throw s(r(t)+" is not an object")}},(t,e,i)=>{var n=i(23),r=i(46),s=i(50),o=i(39);t.exports=function(t,e,i,a){a||(a={});var h=a.enumerable,c=void 0!==a.name?a.name:e;if(n(i)&&s(i,c,a),a.global)h?t[e]=i:o(e,i);else{try{a.unsafe?t[e]&&(h=!0):delete t[e]}catch(t){}h?t[e]=i:r.f(t,e,{value:i,enumerable:!1,configurable:!a.nonConfigurable,writable:!a.nonWritable})}return t}},(t,e,i)=>{var n=i(10),r=i(23),s=i(40),o=i(9),a=i(51).CONFIGURABLE,h=i(52),c=i(53),u=c.enforce,l=c.get,f=Object.defineProperty,d=o&&!n((function(){return 8!==f((function(){}),"length",{value:8}).length})),v=String(String).split("String"),p=t.exports=function(t,e,i){"Symbol("===String(e).slice(0,7)&&(e="["+String(e).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!s(t,"name")||a&&t.name!==e)&&(o?f(t,"name",{value:e,configurable:!0}):t.name=e),d&&i&&s(i,"arity")&&t.length!==i.arity&&f(t,"length",{value:i.arity});try{i&&s(i,"constructor")&&i.constructor?o&&f(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=u(t);return s(n,"source")||(n.source=v.join("string"==typeof e?e:"")),t};Function.prototype.toString=p((function(){return r(this)&&l(this).source||h(this)}),"toString")},(t,e,i)=>{var n=i(9),r=i(40),s=Function.prototype,o=n&&Object.getOwnPropertyDescriptor,a=r(s,"name"),h=a&&"something"===function(){}.name,c=a&&(!n||n&&o(s,"name").configurable);t.exports={EXISTS:a,PROPER:h,CONFIGURABLE:c}},(t,e,i)=>{var n=i(17),r=i(23),s=i(38),o=n(Function.toString);r(s.inspectSource)||(s.inspectSource=function(t){return o(t)}),t.exports=s.inspectSource},(t,e,i)=>{var n,r,s,o=i(54),a=i(7),h=i(17),c=i(22),u=i(45),l=i(40),f=i(38),d=i(55),v=i(56),p="Object already initialized",b=a.TypeError;if(o||f.state){var w=f.state||(f.state=new(0,a.WeakMap)),g=h(w.get),m=h(w.has),A=h(w.set);n=function(t,e){if(m(w,t))throw new b(p);return e.facade=t,A(w,t,e),e},r=function(t){return g(w,t)||{}},s=function(t){return m(w,t)}}else{var y=d("state");v[y]=!0,n=function(t,e){if(l(t,y))throw new b(p);return e.facade=t,u(t,y,e),e},r=function(t){return l(t,y)?t[y]:{}},s=function(t){return l(t,y)}}t.exports={set:n,get:r,has:s,enforce:function(t){return s(t)?r(t):n(t,{})},getterFor:function(t){return function(e){var i;if(!c(e)||(i=r(e)).type!==t)throw b("Incompatible receiver, "+t+" required");return i}}}},(t,e,i)=>{var n=i(7),r=i(23),s=i(52),o=n.WeakMap;t.exports=r(o)&&/native code/.test(s(o))},(t,e,i)=>{var n=i(36),r=i(42),s=n("keys");t.exports=function(t){return s[t]||(s[t]=r(t))}},t=>{t.exports={}},(t,e,i)=>{var n=i(40),r=i(58),s=i(8),o=i(46);t.exports=function(t,e,i){for(var a=r(e),h=o.f,c=s.f,u=0;u<a.length;u++){var l=a[u];n(t,l)||i&&n(i,l)||h(t,l,c(e,l))}}},(t,e,i)=>{var n=i(25),r=i(17),s=i(59),o=i(68),a=i(48),h=r([].concat);t.exports=n("Reflect","ownKeys")||function(t){var e=s.f(a(t)),i=o.f;return i?h(e,i(t)):e}},(t,e,i)=>{var n=i(60),r=i(67).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return n(t,r)}},(t,e,i)=>{var n=i(17),r=i(40),s=i(15),o=i(61).indexOf,a=i(56),h=n([].push);t.exports=function(t,e){var i,n=s(t),c=0,u=[];for(i in n)!r(a,i)&&r(n,i)&&h(u,i);for(;e.length>c;)r(n,i=e[c++])&&(~o(u,i)||h(u,i));return u}},(t,e,i)=>{var n=i(15),r=i(62),s=i(65),o=function(t){return function(e,i,o){var a,h=n(e),c=s(h),u=r(o,c);if(t&&i!=i){for(;c>u;)if((a=h[u++])!=a)return!0}else for(;c>u;u++)if((t||u in h)&&h[u]===i)return t||u||0;return!t&&-1}};t.exports={includes:o(!0),indexOf:o(!1)}},(t,e,i)=>{var n=i(63),r=Math.max,s=Math.min;t.exports=function(t,e){var i=n(t);return i<0?r(i+e,0):s(i,e)}},(t,e,i)=>{var n=i(64);t.exports=function(t){var e=+t;return e!=e||0===e?0:n(e)}},t=>{var e=Math.ceil,i=Math.floor;t.exports=Math.trunc||function(t){var n=+t;return(n>0?i:e)(n)}},(t,e,i)=>{var n=i(66);t.exports=function(t){return n(t.length)}},(t,e,i)=>{var n=i(63),r=Math.min;t.exports=function(t){return t>0?r(n(t),9007199254740991):0}},t=>{t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},(t,e)=>{e.f=Object.getOwnPropertySymbols},(t,e,i)=>{var n=i(10),r=i(23),s=/#|\.prototype\./,o=function(t,e){var i=h[a(t)];return i==u||i!=c&&(r(e)?n(e):!!e)},a=o.normalize=function(t){return String(t).replace(s,".").toLowerCase()},h=o.data={},c=o.NATIVE="N",u=o.POLYFILL="P";t.exports=o},(t,e,i)=>{var n=i(35),r=i(71),s=i(46).f,o=n("unscopables"),a=Array.prototype;null==a[o]&&s(a,o,{configurable:!0,value:r(null)}),t.exports=function(t){a[o][t]=!0}},(t,e,i)=>{var n,r=i(48),s=i(72),o=i(67),a=i(56),h=i(74),c=i(44),u=i(55),l="prototype",f="script",d=u("IE_PROTO"),v=function(){},p=function(t){return"<"+f+">"+t+"</"+f+">"},b=function(t){t.write(p("")),t.close();var e=t.parentWindow.Object;return t=null,e},w=function(){try{n=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;w="undefined"!=typeof document?document.domain&&n?b(n):(e=c("iframe"),i="java"+f+":",e.style.display="none",h.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(p("document.F=Object")),t.close(),t.F):b(n);for(var r=o.length;r--;)delete w[l][o[r]];return w()};a[d]=!0,t.exports=Object.create||function(t,e){var i;return null!==t?(v[l]=r(t),i=new v,v[l]=null,i[d]=t):i=w(),void 0===e?i:s.f(i,e)}},(t,e,i)=>{var n=i(9),r=i(47),s=i(46),o=i(48),a=i(15),h=i(73);e.f=n&&!r?Object.defineProperties:function(t,e){o(t);for(var i,n=a(e),r=h(e),c=r.length,u=0;c>u;)s.f(t,i=r[u++],n[i]);return t}},(t,e,i)=>{var n=i(60),r=i(67);t.exports=Object.keys||function(t){return n(t,r)}},(t,e,i)=>{var n=i(25);t.exports=n("document","documentElement")},(t,e,i)=>{var n=i(7),r=i(17);t.exports=function(t,e){return r(n[t].prototype[e])}},(t,e,i)=>{i(77)},(t,e,i)=>{var n=i(78),r=i(65),s=i(63),o=n.aTypedArray;(0,n.exportTypedArrayMethod)("at",(function(t){var e=o(this),i=r(e),n=s(t),a=n>=0?n:i+n;return a<0||a>=i?void 0:e[a]}))},(t,e,i)=>{var n,r,s,o=i(79),a=i(9),h=i(7),c=i(23),u=i(22),l=i(40),f=i(80),d=i(33),v=i(45),p=i(49),b=i(46).f,w=i(26),g=i(82),m=i(84),A=i(35),y=i(42),k=i(53),M=k.enforce,E=k.get,S=h.Int8Array,x=S&&S.prototype,T=h.Uint8ClampedArray,_=T&&T.prototype,O=S&&g(S),C=x&&g(x),R=Object.prototype,j=h.TypeError,P=A("toStringTag"),D=y("TYPED_ARRAY_TAG"),I="TypedArrayConstructor",F=o&&!!m&&"Opera"!==f(h.opera),L=!1,W={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},N={BigInt64Array:8,BigUint64Array:8},B=function(t){var e=g(t);if(u(e)){var i=E(e);return i&&l(i,I)?i[I]:B(e)}},$=function(t){if(!u(t))return!1;var e=f(t);return l(W,e)||l(N,e)};for(n in W)(s=(r=h[n])&&r.prototype)?M(s)[I]=r:F=!1;for(n in N)(s=(r=h[n])&&r.prototype)&&(M(s)[I]=r);if((!F||!c(O)||O===Function.prototype)&&(O=function(){throw j("Incorrect invocation")},F))for(n in W)h[n]&&m(h[n],O);if((!F||!C||C===R)&&(C=O.prototype,F))for(n in W)h[n]&&m(h[n].prototype,C);if(F&&g(_)!==C&&m(_,C),a&&!l(C,P))for(n in L=!0,b(C,P,{get:function(){return u(this)?this[D]:void 0}}),W)h[n]&&v(h[n],D,n);t.exports={NATIVE_ARRAY_BUFFER_VIEWS:F,TYPED_ARRAY_TAG:L&&D,aTypedArray:function(t){if($(t))return t;throw j("Target is not a typed array")},aTypedArrayConstructor:function(t){if(c(t)&&(!m||w(O,t)))return t;throw j(d(t)+" is not a typed array constructor")},exportTypedArrayMethod:function(t,e,i,n){if(a){if(i)for(var r in W){var s=h[r];if(s&&l(s.prototype,t))try{delete s.prototype[t]}catch(i){try{s.prototype[t]=e}catch(t){}}}C[t]&&!i||p(C,t,i?e:F&&x[t]||e,n)}},exportTypedArrayStaticMethod:function(t,e,i){var n,r;if(a){if(m){if(i)for(n in W)if((r=h[n])&&l(r,t))try{delete r[t]}catch(t){}if(O[t]&&!i)return;try{return p(O,t,i?e:F&&O[t]||e)}catch(t){}}for(n in W)!(r=h[n])||r[t]&&!i||p(r,t,e)}},getTypedArrayConstructor:B,isView:function(t){if(!u(t))return!1;var e=f(t);return"DataView"===e||l(W,e)||l(N,e)},isTypedArray:$,TypedArray:O,TypedArrayPrototype:C}},t=>{t.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},(t,e,i)=>{var n=i(81),r=i(23),s=i(18),o=i(35)("toStringTag"),a=Object,h="Arguments"==s(function(){return arguments}());t.exports=n?s:function(t){var e,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(e=a(t),o))?i:h?s(e):"Object"==(n=s(e))&&r(e.callee)?"Arguments":n}},(t,e,i)=>{var n={};n[i(35)("toStringTag")]="z",t.exports="[object z]"===String(n)},(t,e,i)=>{var n=i(40),r=i(23),s=i(41),o=i(55),a=i(83),h=o("IE_PROTO"),c=Object,u=c.prototype;t.exports=a?c.getPrototypeOf:function(t){var e=s(t);if(n(e,h))return e[h];var i=e.constructor;return r(i)&&e instanceof i?i.prototype:e instanceof c?u:null}},(t,e,i)=>{var n=i(10);t.exports=!n((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}))},(t,e,i)=>{var n=i(17),r=i(48),s=i(85);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=n(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return r(i),s(n),e?t(i,n):i.__proto__=n,i}}():void 0)},(t,e,i)=>{var n=i(23),r=String,s=TypeError;t.exports=function(t){if("object"==typeof t||n(t))return t;throw s("Can't set "+r(t)+" as a prototype")}},(t,e,i)=>{i(87),i(93),i(95),i(117),i(119);var n=i(128);t.exports=n.structuredClone},(t,e,i)=>{var n=i(15),r=i(70),s=i(88),o=i(53),a=i(46).f,h=i(89),c=i(37),u=i(9),l="Array Iterator",f=o.set,d=o.getterFor(l);t.exports=h(Array,"Array",(function(t,e){f(this,{type:l,target:n(t),index:0,kind:e})}),(function(){var t=d(this),e=t.target,i=t.kind,n=t.index++;return!e||n>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==i?{value:n,done:!1}:"values"==i?{value:e[n],done:!1}:{value:[n,e[n]],done:!1}}),"values");var v=s.Arguments=s.Array;if(r("keys"),r("values"),r("entries"),!c&&u&&"values"!==v.name)try{a(v,"name",{value:"values"})}catch(t){}},t=>{t.exports={}},(t,e,i)=>{var n=i(6),r=i(11),s=i(37),o=i(51),a=i(23),h=i(90),c=i(82),u=i(84),l=i(92),f=i(45),d=i(49),v=i(35),p=i(88),b=i(91),w=o.PROPER,g=o.CONFIGURABLE,m=b.IteratorPrototype,A=b.BUGGY_SAFARI_ITERATORS,y=v("iterator"),k="keys",M="values",E="entries",S=function(){return this};t.exports=function(t,e,i,o,v,b,x){h(i,e,o);var T,_,O,C=function(t){if(t===v&&I)return I;if(!A&&t in P)return P[t];switch(t){case k:case M:case E:return function(){return new i(this,t)}}return function(){return new i(this)}},R=e+" Iterator",j=!1,P=t.prototype,D=P[y]||P["@@iterator"]||v&&P[v],I=!A&&D||C(v),F="Array"==e&&P.entries||D;if(F&&(T=c(F.call(new t)))!==Object.prototype&&T.next&&(s||c(T)===m||(u?u(T,m):a(T[y])||d(T,y,S)),l(T,R,!0,!0),s&&(p[R]=S)),w&&v==M&&D&&D.name!==M&&(!s&&g?f(P,"name",M):(j=!0,I=function(){return r(D,this)})),v)if(_={values:C(M),keys:b?I:C(k),entries:C(E)},x)for(O in _)(A||j||!(O in P))&&d(P,O,_[O]);else n({target:e,proto:!0,forced:A||j},_);return s&&!x||P[y]===I||d(P,y,I,{name:v}),p[e]=I,_}},(t,e,i)=>{var n=i(91).IteratorPrototype,r=i(71),s=i(14),o=i(92),a=i(88),h=function(){return this};t.exports=function(t,e,i,c){var u=e+" Iterator";return t.prototype=r(n,{next:s(+!c,i)}),o(t,u,!1,!0),a[u]=h,t}},(t,e,i)=>{var n,r,s,o=i(10),a=i(23),h=i(71),c=i(82),u=i(49),l=i(35),f=i(37),d=l("iterator"),v=!1;[].keys&&("next"in(s=[].keys())?(r=c(c(s)))!==Object.prototype&&(n=r):v=!0),null==n||o((function(){var t={};return n[d].call(t)!==t}))?n={}:f&&(n=h(n)),a(n[d])||u(n,d,(function(){return this})),t.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:v}},(t,e,i)=>{var n=i(46).f,r=i(40),s=i(35)("toStringTag");t.exports=function(t,e,i){t&&!i&&(t=t.prototype),t&&!r(t,s)&&n(t,s,{configurable:!0,value:e})}},(t,e,i)=>{var n=i(81),r=i(49),s=i(94);n||r(Object.prototype,"toString",s,{unsafe:!0})},(t,e,i)=>{var n=i(81),r=i(80);t.exports=n?{}.toString:function(){return"[object "+r(this)+"]"}},(t,e,i)=>{i(96)},(t,e,i)=>{i(97)("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),i(114))},(t,e,i)=>{var n=i(6),r=i(7),s=i(17),o=i(69),a=i(49),h=i(98),c=i(105),u=i(111),l=i(23),f=i(22),d=i(10),v=i(112),p=i(92),b=i(113);t.exports=function(t,e,i){var w=-1!==t.indexOf("Map"),g=-1!==t.indexOf("Weak"),m=w?"set":"add",A=r[t],y=A&&A.prototype,k=A,M={},E=function(t){var e=s(y[t]);a(y,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(g&&!f(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return g&&!f(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(g&&!f(t))&&e(this,0===t?0:t)}:function(t,i){return e(this,0===t?0:t,i),this})};if(o(t,!l(A)||!(g||y.forEach&&!d((function(){(new A).entries().next()})))))k=i.getConstructor(e,t,w,m),h.enable();else if(o(t,!0)){var S=new k,x=S[m](g?{}:-0,1)!=S,T=d((function(){S.has(1)})),_=v((function(t){new A(t)})),O=!g&&d((function(){for(var t=new A,e=5;e--;)t[m](e,e);return!t.has(-0)}));_||((k=e((function(t,e){u(t,y);var i=b(new A,t,k);return null!=e&&c(e,i[m],{that:i,AS_ENTRIES:w}),i}))).prototype=y,y.constructor=k),(T||O)&&(E("delete"),E("has"),w&&E("get")),(O||x)&&E(m),g&&y.clear&&delete y.clear}return M[t]=k,n({global:!0,constructor:!0,forced:k!=A},M),p(k,t),g||i.setStrong(k,t,w),k}},(t,e,i)=>{var n=i(6),r=i(17),s=i(56),o=i(22),a=i(40),h=i(46).f,c=i(59),u=i(99),l=i(102),f=i(42),d=i(104),v=!1,p=f("meta"),b=0,w=function(t){h(t,p,{value:{objectID:"O"+b++,weakData:{}}})},g=t.exports={enable:function(){g.enable=function(){},v=!0;var t=c.f,e=r([].splice),i={};i[p]=1,t(i).length&&(c.f=function(i){for(var n=t(i),r=0,s=n.length;r<s;r++)if(n[r]===p){e(n,r,1);break}return n},n({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:u.f}))},fastKey:function(t,e){if(!o(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!a(t,p)){if(!l(t))return"F";if(!e)return"E";w(t)}return t[p].objectID},getWeakData:function(t,e){if(!a(t,p)){if(!l(t))return!0;if(!e)return!1;w(t)}return t[p].weakData},onFreeze:function(t){return d&&v&&l(t)&&!a(t,p)&&w(t),t}};s[p]=!0},(t,e,i)=>{var n=i(18),r=i(15),s=i(59).f,o=i(100),a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return a&&"Window"==n(t)?function(t){try{return s(t)}catch(t){return o(a)}}(t):s(r(t))}},(t,e,i)=>{var n=i(62),r=i(65),s=i(101),o=Array,a=Math.max;t.exports=function(t,e,i){for(var h=r(t),c=n(e,h),u=n(void 0===i?h:i,h),l=o(a(u-c,0)),f=0;c<u;c++,f++)s(l,f,t[c]);return l.length=f,l}},(t,e,i)=>{var n=i(20),r=i(46),s=i(14);t.exports=function(t,e,i){var o=n(e);o in t?r.f(t,o,s(0,i)):t[o]=i}},(t,e,i)=>{var n=i(10),r=i(22),s=i(18),o=i(103),a=Object.isExtensible,h=n((function(){}));t.exports=h||o?function(t){return!!r(t)&&(!o||"ArrayBuffer"!=s(t))&&(!a||a(t))}:a},(t,e,i)=>{var n=i(10);t.exports=n((function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}}))},(t,e,i)=>{var n=i(10);t.exports=!n((function(){return Object.isExtensible(Object.preventExtensions({}))}))},(t,e,i)=>{var n=i(106),r=i(11),s=i(48),o=i(33),a=i(107),h=i(65),c=i(26),u=i(108),l=i(109),f=i(110),d=TypeError,v=function(t,e){this.stopped=t,this.result=e},p=v.prototype;t.exports=function(t,e,i){var b,w,g,m,A,y,k,M=!(!i||!i.AS_ENTRIES),E=!(!i||!i.IS_RECORD),S=!(!i||!i.IS_ITERATOR),x=!(!i||!i.INTERRUPTED),T=n(e,i&&i.that),_=function(t){return b&&f(b,"normal",t),new v(!0,t)},O=function(t){return M?(s(t),x?T(t[0],t[1],_):T(t[0],t[1])):x?T(t,_):T(t)};if(E)b=t.iterator;else if(S)b=t;else{if(!(w=l(t)))throw d(o(t)+" is not iterable");if(a(w)){for(g=0,m=h(t);m>g;g++)if((A=O(t[g]))&&c(p,A))return A;return new v(!1)}b=u(t,w)}for(y=E?t.next:b.next;!(k=r(y,b)).done;){try{A=O(k.value)}catch(t){f(b,"throw",t)}if("object"==typeof A&&A&&c(p,A))return A}return new v(!1)}},(t,e,i)=>{var n=i(17),r=i(32),s=i(12),o=n(n.bind);t.exports=function(t,e){return r(t),void 0===e?t:s?o(t,e):function(){return t.apply(e,arguments)}}},(t,e,i)=>{var n=i(35),r=i(88),s=n("iterator"),o=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||o[s]===t)}},(t,e,i)=>{var n=i(11),r=i(32),s=i(48),o=i(33),a=i(109),h=TypeError;t.exports=function(t,e){var i=arguments.length<2?a(t):e;if(r(i))return s(n(i,t));throw h(o(t)+" is not iterable")}},(t,e,i)=>{var n=i(80),r=i(31),s=i(88),o=i(35)("iterator");t.exports=function(t){if(null!=t)return r(t,o)||r(t,"@@iterator")||s[n(t)]}},(t,e,i)=>{var n=i(11),r=i(48),s=i(31);t.exports=function(t,e,i){var o,a;r(t);try{if(!(o=s(t,"return"))){if("throw"===e)throw i;return i}o=n(o,t)}catch(t){a=!0,o=t}if("throw"===e)throw i;if(a)throw o;return r(o),i}},(t,e,i)=>{var n=i(26),r=TypeError;t.exports=function(t,e){if(n(e,t))return t;throw r("Incorrect invocation")}},(t,e,i)=>{var n=i(35)("iterator"),r=!1;try{var s=0,o={next:function(){return{done:!!s++}},return:function(){r=!0}};o[n]=function(){return this},Array.from(o,(function(){throw 2}))}catch(t){}t.exports=function(t,e){if(!e&&!r)return!1;var i=!1;try{var s={};s[n]=function(){return{next:function(){return{done:i=!0}}}},t(s)}catch(t){}return i}},(t,e,i)=>{var n=i(23),r=i(22),s=i(84);t.exports=function(t,e,i){var o,a;return s&&n(o=e.constructor)&&o!==i&&r(a=o.prototype)&&a!==i.prototype&&s(t,a),t}},(t,e,i)=>{var n=i(46).f,r=i(71),s=i(115),o=i(106),a=i(111),h=i(105),c=i(89),u=i(116),l=i(9),f=i(98).fastKey,d=i(53),v=d.set,p=d.getterFor;t.exports={getConstructor:function(t,e,i,c){var u=t((function(t,n){a(t,d),v(t,{type:e,index:r(null),first:void 0,last:void 0,size:0}),l||(t.size=0),null!=n&&h(n,t[c],{that:t,AS_ENTRIES:i})})),d=u.prototype,b=p(e),w=function(t,e,i){var n,r,s=b(t),o=g(t,e);return o?o.value=i:(s.last=o={index:r=f(e,!0),key:e,value:i,previous:n=s.last,next:void 0,removed:!1},s.first||(s.first=o),n&&(n.next=o),l?s.size++:t.size++,"F"!==r&&(s.index[r]=o)),t},g=function(t,e){var i,n=b(t),r=f(e);if("F"!==r)return n.index[r];for(i=n.first;i;i=i.next)if(i.key==e)return i};return s(d,{clear:function(){for(var t=b(this),e=t.index,i=t.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete e[i.index],i=i.next;t.first=t.last=void 0,l?t.size=0:this.size=0},delete:function(t){var e=this,i=b(e),n=g(e,t);if(n){var r=n.next,s=n.previous;delete i.index[n.index],n.removed=!0,s&&(s.next=r),r&&(r.previous=s),i.first==n&&(i.first=r),i.last==n&&(i.last=s),l?i.size--:e.size--}return!!n},forEach:function(t){for(var e,i=b(this),n=o(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:i.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!g(this,t)}}),s(d,i?{get:function(t){var e=g(this,t);return e&&e.value},set:function(t,e){return w(this,0===t?0:t,e)}}:{add:function(t){return w(this,t=0===t?0:t,t)}}),l&&n(d,"size",{get:function(){return b(this).size}}),u},setStrong:function(t,e,i){var n=e+" Iterator",r=p(e),s=p(n);c(t,e,(function(t,e){v(this,{type:n,target:t,state:r(t),kind:e,last:void 0})}),(function(){for(var t=s(this),e=t.kind,i=t.last;i&&i.removed;)i=i.previous;return t.target&&(t.last=i=i?i.next:t.state.first)?"keys"==e?{value:i.key,done:!1}:"values"==e?{value:i.value,done:!1}:{value:[i.key,i.value],done:!1}:(t.target=void 0,{value:void 0,done:!0})}),i?"entries":"values",!i,!0),u(e)}}},(t,e,i)=>{var n=i(49);t.exports=function(t,e,i){for(var r in e)n(t,r,e[r],i);return t}},(t,e,i)=>{var n=i(25),r=i(46),s=i(35),o=i(9),a=s("species");t.exports=function(t){var e=n(t);o&&e&&!e[a]&&(0,r.f)(e,a,{configurable:!0,get:function(){return this}})}},(t,e,i)=>{i(118)},(t,e,i)=>{i(97)("Set",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),i(114))},(t,e,i)=>{var n,r=i(37),s=i(6),o=i(7),a=i(25),h=i(17),c=i(10),u=i(42),l=i(23),f=i(120),d=i(22),v=i(24),p=i(105),b=i(48),w=i(80),g=i(40),m=i(101),A=i(45),y=i(65),k=i(121),M=i(122),E=i(124),S=i(29),x=i(125),T=i(126),_=i(127),O=o.Object,C=o.Date,R=o.Error,j=o.EvalError,P=o.RangeError,D=o.ReferenceError,I=o.SyntaxError,F=o.TypeError,L=o.URIError,W=o.PerformanceMark,N=o.WebAssembly,B=N&&N.CompileError||R,$=N&&N.LinkError||R,U=N&&N.RuntimeError||R,z=a("DOMException"),G=a("Set"),Y=a("Map"),q=Y.prototype,X=h(q.has),V=h(q.get),H=h(q.set),Q=h(G.prototype.add),K=a("Object","keys"),J=h([].push),Z=h((!0).valueOf),tt=h(1..valueOf),et=h("".valueOf),it=h(C.prototype.getTime),nt=u("structuredClone"),rt="DataCloneError",st="Transferring",ot=function(t){return!c((function(){var e=new o.Set([7]),i=t(e),n=t(O(7));return i==e||!i.has(7)||"object"!=typeof n||7!=n}))&&t},at=function(t,e){return!c((function(){var i=new e,n=t({a:i,b:i});return!(n&&n.a===n.b&&n.a instanceof e&&n.a.stack===i.stack)}))},ht=o.structuredClone,ct=r||!at(ht,R)||!at(ht,z)||(n=ht,!!c((function(){var t=n(new o.AggregateError([1],nt,{cause:3}));return"AggregateError"!=t.name||1!=t.errors[0]||t.message!=nt||3!=t.cause}))),ut=!ht&&ot((function(t){return new W(nt,{detail:t}).detail})),lt=ot(ht)||ut,ft=function(t){throw new z("Uncloneable type: "+t,rt)},dt=function(t,e){throw new z((e||"Cloning")+" of "+t+" cannot be properly polyfilled in this engine",rt)},vt=function(t,e){if(v(t)&&ft("Symbol"),!d(t))return t;if(e){if(X(e,t))return V(e,t)}else e=new Y;var i,n,r,s,h,c,u,p,b,k,S=w(t),x=!1;switch(S){case"Array":r=[],x=!0;break;case"Object":r={},x=!0;break;case"Map":r=new Y,x=!0;break;case"Set":r=new G,x=!0;break;case"RegExp":r=new RegExp(t.source,M(t));break;case"Error":switch(n=t.name){case"AggregateError":r=a("AggregateError")([]);break;case"EvalError":r=j();break;case"RangeError":r=P();break;case"ReferenceError":r=D();break;case"SyntaxError":r=I();break;case"TypeError":r=F();break;case"URIError":r=L();break;case"CompileError":r=B();break;case"LinkError":r=$();break;case"RuntimeError":r=U();break;default:r=R()}x=!0;break;case"DOMException":r=new z(t.message,t.name),x=!0;break;case"DataView":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"BigInt64Array":case"BigUint64Array":d(i=o[S])||dt(S),r=new i(vt(t.buffer,e),t.byteOffset,"DataView"===S?t.byteLength:t.length);break;case"DOMQuad":try{r=new DOMQuad(vt(t.p1,e),vt(t.p2,e),vt(t.p3,e),vt(t.p4,e))}catch(e){lt?r=lt(t):dt(S)}break;case"FileList":if(f(i=o.DataTransfer)){for(s=new i,h=0,c=y(t);h<c;h++)s.items.add(vt(t[h],e));r=s.files}else lt?r=lt(t):dt(S);break;case"ImageData":try{r=new ImageData(vt(t.data,e),t.width,t.height,{colorSpace:t.colorSpace})}catch(e){lt?r=lt(t):dt(S)}break;default:if(lt)r=lt(t);else switch(S){case"BigInt":r=O(t.valueOf());break;case"Boolean":r=O(Z(t));break;case"Number":r=O(tt(t));break;case"String":r=O(et(t));break;case"Date":r=new C(it(t));break;case"ArrayBuffer":(i=o.DataView)||"function"==typeof t.slice||dt(S);try{if("function"==typeof t.slice)r=t.slice(0);else for(c=t.byteLength,r=new ArrayBuffer(c),b=new i(t),k=new i(r),h=0;h<c;h++)k.setUint8(h,b.getUint8(h))}catch(t){throw new z("ArrayBuffer is detached",rt)}break;case"SharedArrayBuffer":r=t;break;case"Blob":try{r=t.slice(0,t.size,t.type)}catch(t){dt(S)}break;case"DOMPoint":case"DOMPointReadOnly":i=o[S];try{r=i.fromPoint?i.fromPoint(t):new i(t.x,t.y,t.z,t.w)}catch(t){dt(S)}break;case"DOMRect":case"DOMRectReadOnly":i=o[S];try{r=i.fromRect?i.fromRect(t):new i(t.x,t.y,t.width,t.height)}catch(t){dt(S)}break;case"DOMMatrix":case"DOMMatrixReadOnly":i=o[S];try{r=i.fromMatrix?i.fromMatrix(t):new i(t)}catch(t){dt(S)}break;case"AudioData":case"VideoFrame":l(t.clone)||dt(S);try{r=t.clone()}catch(t){ft(S)}break;case"File":try{r=new File([t],t.name,t)}catch(t){dt(S)}break;case"CryptoKey":case"GPUCompilationMessage":case"GPUCompilationInfo":case"ImageBitmap":case"RTCCertificate":case"WebAssembly.Module":dt(S);default:ft(S)}}if(H(e,t,r),x)switch(S){case"Array":case"Object":for(u=K(t),h=0,c=y(u);h<c;h++)m(r,p=u[h],vt(t[p],e));break;case"Map":t.forEach((function(t,i){H(r,vt(i,e),vt(t,e))}));break;case"Set":t.forEach((function(t){Q(r,vt(t,e))}));break;case"Error":A(r,"message",vt(t.message,e)),g(t,"cause")&&A(r,"cause",vt(t.cause,e)),"AggregateError"==n&&(r.errors=vt(t.errors,e));case"DOMException":E&&A(r,"stack",vt(t.stack,e))}return r},pt=ht&&!c((function(){if(T&&S>92||_&&S>94||x&&S>97)return!1;var t=new ArrayBuffer(8),e=ht(t,{transfer:[t]});return 0!=t.byteLength||8!=e.byteLength}));s({global:!0,enumerable:!0,sham:!pt,forced:ct},{structuredClone:function(t){var e,i=k(arguments.length,1)>1&&null!=arguments[1]?b(arguments[1]):void 0,n=i?i.transfer:void 0;return void 0!==n&&function(t,e){if(!d(t))throw F("Transfer option cannot be converted to a sequence");var i=[];p(t,(function(t){J(i,b(t))}));var n,r,s,a,h,c,u=0,v=y(i);if(pt)for(a=ht(i,{transfer:i});u<v;)H(e,i[u],a[u++]);else for(;u<v;){if(n=i[u++],X(e,n))throw new z("Duplicate transferable",rt);switch(r=w(n)){case"ImageBitmap":f(s=o.OffscreenCanvas)||dt(r,st);try{(c=new s(n.width,n.height)).getContext("bitmaprenderer").transferFromImageBitmap(n),h=c.transferToImageBitmap()}catch(t){}break;case"AudioData":case"VideoFrame":l(n.clone)&&l(n.close)||dt(r,st);try{h=n.clone(),n.close()}catch(t){}break;case"ArrayBuffer":case"MessagePort":case"OffscreenCanvas":case"ReadableStream":case"TransformStream":case"WritableStream":dt(r,st)}if(void 0===h)throw new z("This object cannot be transferred: "+r,rt);H(e,n,h)}}(n,e=new Y),vt(t,e)}})},(t,e,i)=>{var n=i(17),r=i(10),s=i(23),o=i(80),a=i(25),h=i(52),c=function(){},u=[],l=a("Reflect","construct"),f=/^\s*(?:class|function)\b/,d=n(f.exec),v=!f.exec(c),p=function(t){if(!s(t))return!1;try{return l(c,u,t),!0}catch(t){return!1}},b=function(t){if(!s(t))return!1;switch(o(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return v||!!d(f,h(t))}catch(t){return!0}};b.sham=!0,t.exports=!l||r((function(){var t;return p(p.call)||!p(Object)||!p((function(){t=!0}))||t}))?b:p},t=>{var e=TypeError;t.exports=function(t,i){if(t<i)throw e("Not enough arguments");return t}},(t,e,i)=>{var n=i(11),r=i(40),s=i(26),o=i(123),a=RegExp.prototype;t.exports=function(t){var e=t.flags;return void 0!==e||"flags"in a||r(t,"flags")||!s(a,t)?e:n(o,t)}},(t,e,i)=>{var n=i(48);t.exports=function(){var t=n(this),e="";return t.hasIndices&&(e+="d"),t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.unicodeSets&&(e+="v"),t.sticky&&(e+="y"),e}},(t,e,i)=>{var n=i(10),r=i(14);t.exports=!n((function(){var t=Error("a");return!("stack"in t)||(Object.defineProperty(t,"stack",r(1,7)),7!==t.stack)}))},(t,e,i)=>{var n=i(126),r=i(127);t.exports=!n&&!r&&"object"==typeof window&&"object"==typeof document},t=>{t.exports="object"==typeof Deno&&Deno&&"object"==typeof Deno.version},(t,e,i)=>{var n=i(18),r=i(7);t.exports="process"==n(r.process)},(t,e,i)=>{var n=i(7);t.exports=n},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.build=e.RenderTask=e.PDFWorkerUtil=e.PDFWorker=e.PDFPageProxy=e.PDFDocumentProxy=e.PDFDocumentLoadingTask=e.PDFDataRangeTransport=e.LoopbackPort=e.DefaultStandardFontDataFactory=e.DefaultCanvasFactory=e.DefaultCMapReaderFactory=void 0,e.getDocument=function(t){const e=new j;let i;if("string"==typeof t||t instanceof URL)i={url:t};else if((0,n.isArrayBuffer)(t))i={data:t};else if(t instanceof D)i={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");i=t}const r=Object.create(null);let o=null,a=null;for(const t in i){const e=i[t];switch(t){case"url":if("undefined"!=typeof window)try{r[t]=new URL(e,window.location).href;continue}catch(t){(0,n.warn)(`Cannot create valid URL: "${t}".`)}else if("string"==typeof e||e instanceof URL){r[t]=e.toString();continue}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.");case"range":o=e;continue;case"worker":a=e;continue;case"data":if(u.isNodeJS&&"undefined"!=typeof Buffer&&e instanceof Buffer)r[t]=new Uint8Array(e);else{if(e instanceof Uint8Array)break;if("string"==typeof e)r[t]=(0,n.stringToBytes)(e);else if("object"!=typeof e||null===e||isNaN(e.length)){if(!(0,n.isArrayBuffer)(e))throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.");r[t]=new Uint8Array(e)}else r[t]=new Uint8Array(e)}continue}r[t]=e}if(r.CMapReaderFactory=r.CMapReaderFactory||O,r.StandardFontDataFactory=r.StandardFontDataFactory||R,r.ignoreErrors=!0!==r.stopAtErrors,r.fontExtraProperties=!0===r.fontExtraProperties,r.pdfBug=!0===r.pdfBug,r.enableXfa=!0===r.enableXfa,(!Number.isInteger(r.rangeChunkSize)||r.rangeChunkSize<1)&&(r.rangeChunkSize=T),("string"!=typeof r.docBaseUrl||(0,s.isDataScheme)(r.docBaseUrl))&&(r.docBaseUrl=null),(!Number.isInteger(r.maxImageSize)||r.maxImageSize<-1)&&(r.maxImageSize=-1),"string"!=typeof r.cMapUrl&&(r.cMapUrl=null),"string"!=typeof r.standardFontDataUrl&&(r.standardFontDataUrl=null),"boolean"!=typeof r.useWorkerFetch&&(r.useWorkerFetch=r.CMapReaderFactory===s.DOMCMapReaderFactory&&r.StandardFontDataFactory===s.DOMStandardFontDataFactory),"boolean"!=typeof r.isEvalSupported&&(r.isEvalSupported=!0),"boolean"!=typeof r.disableFontFace&&(r.disableFontFace=u.isNodeJS),"boolean"!=typeof r.useSystemFonts&&(r.useSystemFonts=!u.isNodeJS&&!r.disableFontFace),"object"==typeof r.ownerDocument&&null!==r.ownerDocument||(r.ownerDocument=globalThis.document),"boolean"!=typeof r.disableRange&&(r.disableRange=!1),"boolean"!=typeof r.disableStream&&(r.disableStream=!1),"boolean"!=typeof r.disableAutoFetch&&(r.disableAutoFetch=!1),(0,n.setVerbosityLevel)(r.verbosity),!a){const t={verbosity:r.verbosity,port:c.GlobalWorkerOptions.workerPort};a=t.port?$.fromPort(t):new $(t),e._worker=a}const h=e.docId;return a.promise.then((function(){if(e.destroyed)throw new Error("Loading aborted");const t=async function(t,e,i,n){if(t.destroyed)throw new Error("Worker was destroyed");i&&(e.length=i.length,e.initialData=i.initialData,e.progressiveDone=i.progressiveDone,e.contentDispositionFilename=i.contentDispositionFilename);const r=await t.messageHandler.sendWithPromise("GetDocRequest",{docId:n,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 r}(a,r,o,h),i=new Promise((function(t){let e;o?e=new v.PDFDataTransportStream({length:r.length,initialData:r.initialData,progressiveDone:r.progressiveDone,contentDispositionFilename:r.contentDispositionFilename,disableRange:r.disableRange,disableStream:r.disableStream},o):r.data||(e=C({url:r.url,length:r.length,httpHeaders:r.httpHeaders,withCredentials:r.withCredentials,rangeChunkSize:r.rangeChunkSize,disableRange:r.disableRange,disableStream:r.disableStream})),t(e)}));return Promise.all([t,i]).then((function(t){let[i,n]=t;if(e.destroyed)throw new Error("Loading aborted");const s=new l.MessageHandler(h,i,a.port),o=new X(s,e,n,r);e._transport=o,s.send("Ready",null)}))})).catch(e._capability.reject),e},e.setPDFNetworkStreamFactory=function(t){C=t},e.version=void 0;var n=i(1),r=i(130),s=i(133),o=i(136),a=i(137),c=i(140),u=i(3),l=i(141),f=i(142),d=i(143),v=i(144),p=i(145);function b(t,e,i){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return i}function w(t,e,i){g(t,e),e.set(t,i)}function g(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function m(t,e,i){return k(t,y(t,e,"set"),i),i}function A(t,e){return x(t,y(t,e,"get"))}function y(t,e,i){if(!e.has(t))throw new TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}function k(t,e,i){if(e.set)e.set.call(t,i);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=i}}function M(t,e,i){return S(t,e),E(i,"get"),x(t,i)}function E(t,e){if(void 0===t)throw new TypeError("attempted to "+e+" private static field before its declaration")}function S(t,e){if(t!==e)throw new TypeError("Private static access of wrong provenance")}function x(t,e){return e.get?e.get.call(t):e.value}const T=65536;let _=s.DOMCanvasFactory;e.DefaultCanvasFactory=_;let O=s.DOMCMapReaderFactory;e.DefaultCMapReaderFactory=O;let C,R=s.DOMStandardFontDataFactory;if(e.DefaultStandardFontDataFactory=R,u.isNodeJS){const{NodeCanvasFactory:t,NodeCMapReaderFactory:n,NodeStandardFontDataFactory:r}=i(146);e.DefaultCanvasFactory=_=t,e.DefaultCMapReaderFactory=O=n,e.DefaultStandardFontDataFactory=R=r}class j{constructor(){var t,e,i,r,s,o;this._capability=(0,n.createPromiseCapability)(),this._transport=null,this._worker=null,this.docId=`d${i=j,r=j,s=P,t=M(j,j,P),e=t++,o=t,S(i,r),E(s,"set"),k(i,s,o),e}`,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?void 0:t.destroy()),this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}e.PDFDocumentLoadingTask=j;var P={writable:!0,value:0};class D{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=r,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=(0,n.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 i of this._rangeListeners)i(t,e)}onDataProgress(t,e){this._readyCapability.promise.then((()=>{for(const i of this._progressListeners)i(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,n.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}e.PDFDataRangeTransport=D;class I{constructor(t,e){this._pdfInfo=t,this._transport=e,Object.defineProperty(this,"fingerprint",{get(){return(0,s.deprecated)("`PDFDocumentProxy.fingerprint`, please use `PDFDocumentProxy.fingerprints` instead."),this.fingerprints[0]}}),Object.defineProperty(this,"getStats",{value:async()=>((0,s.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(){return this._transport.startCleanup(arguments.length>0&&void 0!==arguments[0]&&arguments[0]||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,s.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()}}e.PDFDocumentProxy=I;class F{constructor(t,e,i,n){let r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];this._pageIndex=t,this._pageInfo=e,this._ownerDocument=n,this._transport=i,this._stats=r?new s.StatTimer:null,this._pdfBug=r,this.commonObjs=i.commonObjs,this.objs=new Q,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(){let{scale:t,rotation:e=this.rotate,offsetX:i=0,offsetY:n=0,dontFlip:r=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new s.PageViewport({viewBox:this.view,scale:t,rotation:e,offsetX:i,offsetY:n,dontFlip:r})}getAnnotations(){let{intent:t="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=this._transport.getRenderingIntent(t);let i=this._annotationPromises.get(e.cacheKey);return i||(i=this._transport.getAnnotations(this._pageIndex,e.renderingIntent),this._annotationPromises.set(e.cacheKey,i),i=i.then((t=>{for(const e of t)void 0!==e.titleObj&&Object.defineProperty(e,"title",{get:()=>((0,s.deprecated)("`title`-property on annotation, please use `titleObj` instead."),e.titleObj.str)}),void 0!==e.contentsObj&&Object.defineProperty(e,"contents",{get:()=>((0,s.deprecated)("`contents`-property on annotation, please use `contentsObj` instead."),e.contentsObj.str)});return t}))),i}getJSActions(){return this._jsActionsPromise||(this._jsActionsPromise=this._transport.getPageJSActions(this._pageIndex))}async getXfa(){var t;return(null===(t=this._transport._htmlForXfa)||void 0===t?void 0:t.children[this._pageIndex])||null}render(t){var e,i,r;let{canvasContext:o,viewport:a,intent:h="display",annotationMode:c=n.AnnotationMode.ENABLE,transform:u=null,imageLayer:l=null,canvasFactory:f=null,background:d=null,optionalContentConfigPromise:v=null,annotationCanvasMap:p=null,pageColors:b=null,printAnnotationStorage:w=null}=t;void 0!==(null===(e=arguments[0])||void 0===e?void 0:e.renderInteractiveForms)&&((0,s.deprecated)("render no longer accepts the `renderInteractiveForms`-option, please use the `annotationMode`-option instead."),!0===arguments[0].renderInteractiveForms&&c===n.AnnotationMode.ENABLE&&(c=n.AnnotationMode.ENABLE_FORMS)),void 0!==(null===(i=arguments[0])||void 0===i?void 0:i.includeAnnotationStorage)&&((0,s.deprecated)("render no longer accepts the `includeAnnotationStorage`-option, please use the `annotationMode`-option instead."),!0===arguments[0].includeAnnotationStorage&&c===n.AnnotationMode.ENABLE&&(c=n.AnnotationMode.ENABLE_STORAGE)),this._stats&&this._stats.time("Overall");const g=this._transport.getRenderingIntent(h,c,w);this.pendingCleanup=!1,v||(v=this._transport.getOptionalContentConfig());let m=this._intentStates.get(g.cacheKey);m||(m=Object.create(null),this._intentStates.set(g.cacheKey,m)),m.streamReaderCancelTimeout&&(clearTimeout(m.streamReaderCancelTimeout),m.streamReaderCancelTimeout=null);const A=f||new _({ownerDocument:this._ownerDocument}),y=!!(g.renderingIntent&n.RenderingIntentFlag.PRINT);m.displayReadyCapability||(m.displayReadyCapability=(0,n.createPromiseCapability)(),m.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats&&this._stats.time("Page Request"),this._pumpOperatorList(g));const k=t=>{m.renderTasks.delete(M),(this.cleanupAfterRender||y)&&(this.pendingCleanup=!0),this._tryCleanup(),t?(M.capability.reject(t),this._abortOperatorList({intentState:m,reason:t instanceof Error?t:new Error(t)})):M.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"))},M=new tt({callback:k,params:{canvasContext:o,viewport:a,transform:u,imageLayer:l,background:d},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:p,operatorList:m.operatorList,pageIndex:this._pageIndex,canvasFactory:A,useRequestAnimationFrame:!y,pdfBug:this._pdfBug,pageColors:b});((r=m).renderTasks||(r.renderTasks=new Set)).add(M);const E=M.task;return Promise.all([m.displayReadyCapability.promise,v]).then((t=>{let[e,i]=t;this.pendingCleanup?k():(this._stats&&this._stats.time("Rendering"),M.initializeGraphics({transparency:e,optionalContentConfig:i}),M.operatorListChanged())})).catch(k),E}getOperatorList(){let{intent:t="display",annotationMode:e=n.AnnotationMode.ENABLE,printAnnotationStorage:i=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const r=this._transport.getRenderingIntent(t,e,i,!0);let s,o=this._intentStates.get(r.cacheKey);var a;return o||(o=Object.create(null),this._intentStates.set(r.cacheKey,o)),o.opListReadCapability||(s=Object.create(null),s.operatorListChanged=function(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(s))},o.opListReadCapability=(0,n.createPromiseCapability)(),((a=o).renderTasks||(a.renderTasks=new Set)).add(s),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats&&this._stats.time("Page Request"),this._pumpOperatorList(r)),o.opListReadCapability.promise}streamTextContent(){let{disableCombineTextItems:t=!1,includeMarkedContent:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,combineTextItems:!0!==t,includeMarkedContent:!0===e},{highWaterMark:100,size:t=>t.items.length})}getTextContent(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._transport._htmlForXfa)return this.getXfa().then((t=>p.XfaText.textContent(t)));const e=this.streamTextContent(t);return new Promise((function(t,i){const n=e.getReader(),r={items:[],styles:Object.create(null)};!function e(){n.read().then((function(i){let{value:n,done:s}=i;s?t(r):(Object.assign(r.styles,n.styles),r.items.push(...n.items),e())}),i)}()}))}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 i of e.renderTasks)t.push(i.completed),i.cancel();this.objs.clear();for(const t of this._bitmaps)t.close();return this._bitmaps.clear(),this._annotationPromises.clear(),this._jsActionsPromise=null,this._structTreePromise=null,this.pendingCleanup=!1,Promise.all(t)}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.pendingCleanup=!0,this._tryCleanup(t)}_tryCleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.pendingCleanup)return!1;for(const{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;this._intentStates.clear(),this.objs.clear(),this._annotationPromises.clear(),this._jsActionsPromise=null,this._structTreePromise=null,t&&this._stats&&(this._stats=new s.StatTimer);for(const t of this._bitmaps)t.close();return this._bitmaps.clear(),this.pendingCleanup=!1,!0}_startRenderPage(t,e){const i=this._intentStates.get(e);i&&(this._stats&&this._stats.timeEnd("Page Request"),i.displayReadyCapability&&i.displayReadyCapability.resolve(t))}_renderPageChunk(t,e){for(let i=0,n=t.length;i<n;i++)e.operatorList.fnArray.push(t.fnArray[i]),e.operatorList.argsArray.push(t.argsArray[i]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(const t of e.renderTasks)t.operatorListChanged();t.lastChunk&&this._tryCleanup()}_pumpOperatorList(t){let{renderingIntent:e,cacheKey:i,annotationStorageMap:n}=t;const r=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:i,annotationStorage:n}).getReader(),s=this._intentStates.get(i);s.streamReader=r;const o=()=>{r.read().then((t=>{let{value:e,done:i}=t;i?s.streamReader=null:this._transport.destroyed||(this._renderPageChunk(e,s),o())}),(t=>{if(s.streamReader=null,!this._transport.destroyed){if(s.operatorList){s.operatorList.lastChunk=!0;for(const t of s.renderTasks)t.operatorListChanged();this._tryCleanup()}if(s.displayReadyCapability)s.displayReadyCapability.reject(t);else{if(!s.opListReadCapability)throw t;s.opListReadCapability.reject(t)}}}))};o()}_abortOperatorList(t){let{intentState:e,reason:i,force:r=!1}=t;if(e.streamReader){if(!r){if(e.renderTasks.size>0)return;if(i instanceof s.RenderingCancelledException)return void(e.streamReaderCancelTimeout=setTimeout((()=>{this._abortOperatorList({intentState:e,reason:i,force:!0}),e.streamReaderCancelTimeout=null}),100))}if(e.streamReader.cancel(new n.AbortException(i.message)).catch((()=>{})),e.streamReader=null,!this._transport.destroyed){for(const[t,i]of this._intentStates)if(i===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}}e.PDFPageProxy=F;class L{constructor(){this._listeners=[],this._deferred=Promise.resolve()}postMessage(t,e){const i={data:structuredClone(t,e)};this._deferred.then((()=>{for(const t of this._listeners)t.call(this,i)}))}addEventListener(t,e){this._listeners.push(e)}removeEventListener(t,e){const i=this._listeners.indexOf(e);this._listeners.splice(i,1)}terminate(){this._listeners.length=0}}e.LoopbackPort=L;const W={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};if(e.PDFWorkerUtil=W,u.isNodeJS&&"function"==typeof h)W.isWorkerDisabled=!0,W.fallbackWorkerSrc="./pdf.worker.js";else if("object"==typeof document){var N,B;const t=null===(N=document)||void 0===N||null===(B=N.currentScript)||void 0===B?void 0:B.src;t&&(W.fallbackWorkerSrc=t.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}W.isSameOrigin=function(t,e){let i;try{if(i=new URL(t),!i.origin||"null"===i.origin)return!1}catch(t){return!1}const n=new URL(e,i);return i.origin===n.origin},W.createCDNWrapper=function(t){return URL.createObjectURL(new Blob([`importScripts("${t}");`]))};class ${constructor(){let{name:t=null,port:e=null,verbosity:i=(0,n.getVerbosityLevel)()}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e&&M($,$,U).has(e))throw new Error("Cannot use more than one PDFWorker per port.");if(this.name=t,this.destroyed=!1,this.verbosity=i,this._readyCapability=(0,n.createPromiseCapability)(),this._port=null,this._webWorker=null,this._messageHandler=null,e)return M($,$,U).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 l.MessageHandler("main","worker",t),this._messageHandler.on("ready",(function(){})),this._readyCapability.resolve()}_initialize(){if(!W.isWorkerDisabled&&!$._mainThreadWorkerMessageHandler){let{workerSrc:t}=$;try{W.isSameOrigin(window.location.href,t)||(t=W.createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t),i=new l.MessageHandler("main","worker",e),n=()=>{e.removeEventListener("error",r),i.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},r=()=>{this._webWorker||n()};e.addEventListener("error",r),i.on("test",(t=>{e.removeEventListener("error",r),this.destroyed?n():t?(this._messageHandler=i,this._port=e,this._webWorker=e,this._readyCapability.resolve(),i.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),i.destroy(),e.terminate())})),i.on("ready",(()=>{if(e.removeEventListener("error",r),this.destroyed)n();else try{s()}catch(t){this._setupFakeWorker()}}));const s=()=>{const t=new Uint8Array;i.send("test",t,[t.buffer])};return void s()}catch(t){(0,n.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){W.isWorkerDisabled||((0,n.warn)("Setting up fake worker."),W.isWorkerDisabled=!0),$._setupFakeWorkerGlobal.then((t=>{if(this.destroyed)return void this._readyCapability.reject(new Error("Worker was destroyed"));const e=new L;this._port=e;const i="fake"+W.fakeWorkerId++,n=new l.MessageHandler(i+"_worker",i,e);t.setup(n,e);const r=new l.MessageHandler(i,i+"_worker",e);this._messageHandler=r,this._readyCapability.resolve(),r.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),M($,$,U).delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){if(null==t||!t.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return M(this,$,U).has(t.port)?M(this,$,U).get(t.port):new $(t)}static get workerSrc(){if(c.GlobalWorkerOptions.workerSrc)return c.GlobalWorkerOptions.workerSrc;if(null!==W.fallbackWorkerSrc)return u.isNodeJS||(0,s.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'),W.fallbackWorkerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _mainThreadWorkerMessageHandler(){try{var t;return(null===(t=globalThis.pdfjsWorker)||void 0===t?void 0:t.WorkerMessageHandler)||null}catch(t){return null}}static get _setupFakeWorkerGlobal(){return(0,n.shadow)(this,"_setupFakeWorkerGlobal",(async()=>this._mainThreadWorkerMessageHandler||(u.isNodeJS&&"function"==typeof h?h(this.workerSrc).WorkerMessageHandler:(await(0,s.loadScript)(this.workerSrc),window.pdfjsWorker.WorkerMessageHandler)))())}}e.PDFWorker=$;var U={writable:!0,value:new WeakMap};$.getWorkerSrc=function(){return(0,s.deprecated)("`PDFWorker.getWorkerSrc()`, please use `PDFWorker.workerSrc` instead."),this.workerSrc};var z=new WeakMap,G=new WeakMap,Y=new WeakMap,q=new WeakMap;class X{constructor(t,e,i,r){w(this,z,{writable:!0,value:null}),w(this,G,{writable:!0,value:new Map}),w(this,Y,{writable:!0,value:new Map}),w(this,q,{writable:!0,value:null}),this.messageHandler=t,this.loadingTask=e,this.commonObjs=new Q,this.fontLoader=new o.FontLoader({docId:e.docId,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),ownerDocument:r.ownerDocument,styleElement:r.styleElement}),this._params=r,r.useWorkerFetch||(this.CMapReaderFactory=new r.CMapReaderFactory({baseUrl:r.cMapUrl,isCompressed:r.cMapPacked}),this.StandardFontDataFactory=new r.StandardFontDataFactory({baseUrl:r.standardFontDataUrl})),this.destroyed=!1,this.destroyCapability=null,this._passwordCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=(0,n.createPromiseCapability)(),this.setupMessageHandler()}get annotationStorage(){return(0,n.shadow)(this,"annotationStorage",new r.AnnotationStorage)}get stats(){return A(this,z)}getRenderingIntent(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.AnnotationMode.ENABLE,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=n.RenderingIntentFlag.DISPLAY,a=null;switch(t){case"any":o=n.RenderingIntentFlag.ANY;break;case"display":break;case"print":o=n.RenderingIntentFlag.PRINT;break;default:(0,n.warn)(`getRenderingIntent - invalid intent: ${t}`)}switch(e){case n.AnnotationMode.DISABLE:o+=n.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case n.AnnotationMode.ENABLE:break;case n.AnnotationMode.ENABLE_FORMS:o+=n.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case n.AnnotationMode.ENABLE_STORAGE:o+=n.RenderingIntentFlag.ANNOTATIONS_STORAGE,a=(o&n.RenderingIntentFlag.PRINT&&i instanceof r.PrintAnnotationStorage?i:this.annotationStorage).serializable;break;default:(0,n.warn)(`getRenderingIntent - invalid annotationMode: ${e}`)}return s&&(o+=n.RenderingIntentFlag.OPLIST),{renderingIntent:o,cacheKey:`${o}_${r.AnnotationStorage.getHash(a)}`,annotationStorageMap:a}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=(0,n.createPromiseCapability)(),this._passwordCapability&&this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const e of A(this,G).values())t.push(e._destroy());A(this,G).clear(),A(this,Y).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(),m(this,q,null),this._getFieldObjectsPromise=null,this._hasJSActionsPromise=null,this._networkStream&&this._networkStream.cancelAllRequests(new n.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,n.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(t){let{value:i,done:r}=t;r?e.close():((0,n.assert)((0,n.isArrayBuffer)(i),"GetReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(i),1,[i]))})).catch((t=>{e.error(t)}))},e.onCancel=t=>{this._fullReader.cancel(t),e.ready.catch((t=>{if(!this.destroyed)throw t}))}})),t.on("ReaderHeadersReady",(()=>{const t=(0,n.createPromiseCapability)(),i=this._fullReader;return i.headersReady.then((()=>{var n;i.isStreamingSupported&&i.isRangeSupported||(this._lastProgress&&(null===(n=e.onProgress)||void 0===n||n.call(e,this._lastProgress)),i.onProgress=t=>{var i;null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded,total:t.total})}),t.resolve({isStreamingSupported:i.isStreamingSupported,isRangeSupported:i.isRangeSupported,contentLength:i.contentLength})}),t.reject),t.promise})),t.on("GetRangeReader",((t,e)=>{(0,n.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const i=this._networkStream.getRangeReader(t.begin,t.end);i?(e.onPull=()=>{i.read().then((function(t){let{value:i,done:r}=t;r?e.close():((0,n.assert)((0,n.isArrayBuffer)(i),"GetRangeReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(i),1,[i]))})).catch((t=>{e.error(t)}))},e.onCancel=t=>{i.cancel(t),e.ready.catch((t=>{if(!this.destroyed)throw t}))}):e.close()})),t.on("GetDoc",(t=>{let{pdfInfo:i}=t;this._numPages=i.numPages,this._htmlForXfa=i.htmlForXfa,delete i.htmlForXfa,e._capability.resolve(new I(i,this))})),t.on("DocException",(function(t){let i;switch(t.name){case"PasswordException":i=new n.PasswordException(t.message,t.code);break;case"InvalidPDFException":i=new n.InvalidPDFException(t.message);break;case"MissingPDFException":i=new n.MissingPDFException(t.message);break;case"UnexpectedResponseException":i=new n.UnexpectedResponseException(t.message,t.status);break;case"UnknownErrorException":i=new n.UnknownErrorException(t.message,t.details);break;default:(0,n.unreachable)("DocException - expected a valid Error.")}e._capability.reject(i)})),t.on("PasswordRequest",(t=>{if(this._passwordCapability=(0,n.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(t){this._passwordCapability.reject(t)}}else this._passwordCapability.reject(new n.PasswordException(t.message,t.code));return this._passwordCapability.promise})),t.on("DataLoaded",(t=>{var i;null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.length,total:t.length}),this.downloadInfoCapability.resolve(t)})),t.on("StartRenderPage",(t=>{this.destroyed||A(this,G).get(t.pageIndex)._startRenderPage(t.transparency,t.cacheKey)})),t.on("commonobj",(e=>{var i;let[r,s,a]=e;if(!this.destroyed&&!this.commonObjs.has(r))switch(s){case"Font":const e=this._params;if("error"in a){const t=a.error;(0,n.warn)(`Error during font loading: ${t}`),this.commonObjs.resolve(r,t);break}let h=null;e.pdfBug&&null!==(i=globalThis.FontInspector)&&void 0!==i&&i.enabled&&(h={registerFont(t,e){globalThis.FontInspector.fontAdded(t,e)}});const c=new o.FontFaceObject(a,{isEvalSupported:e.isEvalSupported,disableFontFace:e.disableFontFace,ignoreErrors:e.ignoreErrors,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),fontRegistry:h});this.fontLoader.bind(c).catch((()=>t.sendWithPromise("FontFallback",{id:r}))).finally((()=>{!e.fontExtraProperties&&c.data&&(c.data=null),this.commonObjs.resolve(r,c)}));break;case"FontPath":case"Image":this.commonObjs.resolve(r,a);break;default:throw new Error(`Got unknown common object type ${s}`)}})),t.on("obj",(t=>{let[e,i,n,r]=t;if(this.destroyed)return;const s=A(this,G).get(i);if(!s.objs.has(e))switch(n){case"Image":s.objs.resolve(e,r);const t=8e6;if(r){let e;if(r.bitmap){const{bitmap:t,width:i,height:n}=r;e=i*n*4,s._bitmaps.add(t)}else{var o;e=(null===(o=r.data)||void 0===o?void 0:o.length)||0}e>t&&(s.cleanupAfterRender=!0)}break;case"Pattern":s.objs.resolve(e,r);break;default:throw new Error(`Got unknown object type ${n}`)}})),t.on("DocProgress",(t=>{var i;this.destroyed||null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded,total:t.total})})),t.on("DocStats",(t=>{this.destroyed||m(this,z,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(t){var e,i;let{featureId:n}=t;this.destroyed||null===(e=(i=this.loadingTask).onUnsupportedFeature)||void 0===e||e.call(i,n)}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,i=A(this,Y).get(e);if(i)return i;const n=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then((t=>{if(this.destroyed)throw new Error("Transport destroyed");const i=new F(e,t,this,this._params.ownerDocument,this._params.pdfBug);return A(this,G).set(e,i),i}));return A(this,Y).set(e,n),n}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,e;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:this.annotationStorage.serializable,filename:null!==(t=null===(e=this._fullReader)||void 0===e?void 0:e.filename)&&void 0!==t?t: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 d.OptionalContentConfig(t)))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){return A(this,q)||m(this,q,this.messageHandler.sendWithPromise("GetMetadata",null).then((t=>{var e,i,n,r;return{info:t[0],metadata:t[1]?new f.Metadata(t[1]):null,contentDispositionFilename:null!==(e=null===(i=this._fullReader)||void 0===i?void 0:i.filename)&&void 0!==e?e:null,contentLength:null!==(n=null===(r=this._fullReader)||void 0===r?void 0:r.contentLength)&&void 0!==n?n:null}})))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(await this.messageHandler.sendWithPromise("Cleanup",null),!this.destroyed){for(const t of A(this,G).values())if(!t.cleanup())throw new Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),m(this,q,null),this._getFieldObjectsPromise=null,this._hasJSActionsPromise=null}}get loadingParams(){const t=this._params;return(0,n.shadow)(this,"loadingParams",{disableAutoFetch:t.disableAutoFetch,enableXfa:t.enableXfa})}}var V=new WeakMap,H=new WeakSet;class Q{constructor(){var t;g(this,t=H),t.add(this),w(this,V,{writable:!0,value:Object.create(null)})}get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e){const i=b(this,H,K).call(this,t);return i.capability.promise.then((()=>e(i.data))),null}const i=A(this,V)[t];if(null==i||!i.capability.settled)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return i.data}has(t){const e=A(this,V)[t];return(null==e?void 0:e.capability.settled)||!1}resolve(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=b(this,H,K).call(this,t);i.data=e,i.capability.resolve()}clear(){m(this,V,Object.create(null))}}function K(t){return A(this,V)[t]||(A(this,V)[t]={capability:(0,n.createPromiseCapability)(),data:null})}var J=new WeakMap;class Z{constructor(t){w(this,J,{writable:!0,value:null}),m(this,J,t),this.onContinue=null}get promise(){return A(this,J).capability.promise}cancel(){A(this,J).cancel()}get separateAnnots(){const{separateAnnots:t}=A(this,J).operatorList;if(!t)return!1;const{annotationCanvasMap:e}=A(this,J);return t.form||t.canvas&&(null==e?void 0:e.size)>0}}e.RenderTask=Z;class tt{constructor(t){let{callback:e,params:i,objs:r,commonObjs:s,annotationCanvasMap:o,operatorList:a,pageIndex:h,canvasFactory:c,useRequestAnimationFrame:u=!1,pdfBug:l=!1,pageColors:f=null}=t;this.callback=e,this.params=i,this.objs=r,this.commonObjs=s,this.annotationCanvasMap=o,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=h,this.canvasFactory=c,this._pdfBug=l,this.pageColors=f,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===u&&"undefined"!=typeof window,this.cancelled=!1,this.capability=(0,n.createPromiseCapability)(),this.task=new Z(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=i.canvasContext.canvas}get completed(){return this.capability.promise.catch((function(){}))}initializeGraphics(t){var e;let{transparency:i=!1,optionalContentConfig:n}=t;if(this.cancelled)return;if(this._canvas){if(M(tt,tt,et).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.");M(tt,tt,et).add(this._canvas)}this._pdfBug&&null!==(e=globalThis.StepperManager)&&void 0!==e&&e.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:r,viewport:s,transform:o,imageLayer:h,background:c}=this.params;this.gfx=new a.CanvasGraphics(r,this.commonObjs,this.objs,this.canvasFactory,h,n,this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:o,viewport:s,transparency:i,background:c}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback&&this.graphicsReadyCallback()}cancel(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.running=!1,this.cancelled=!0,this.gfx&&this.gfx.endDrawing(),this._canvas&&M(tt,tt,et).delete(this._canvas),this.callback(t||new s.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&&M(tt,tt,et).delete(this._canvas),this.callback())))}}var et={writable:!0,value:new WeakSet};e.version="2.16.105",e.build="172ccdbe5"},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PrintAnnotationStorage=e.AnnotationStorage=void 0;var n=i(1),r=i(131),s=i(135);function o(t,e,i){if(!e.has(t))throw new TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}function a(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}var h=new WeakSet;class c{constructor(){var t;a(this,t=h),t.add(this),this._storage=new Map,this._modified=!1,this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const i=this._storage.get(t);return void 0===i?e:Object.assign(e,i)}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 r.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(t,e){const i=this._storage.get(t);let n=!1;if(void 0!==i)for(const[t,r]of Object.entries(e))i[t]!==r&&(n=!0,i[t]=r);else n=!0,this._storage.set(t,e);n&&function(t,e,i){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return i}(this,h,u).call(this),e instanceof r.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 f(this)}get serializable(){if(0===this._storage.size)return null;const t=new Map;for(const[e,i]of this._storage){const n=i instanceof r.AnnotationEditor?i.serialize():i;n&&t.set(e,n)}return t}static getHash(t){if(!t)return"";const e=new s.MurmurHash3_64;for(const[i,n]of t)e.update(`${i}:${JSON.stringify(n)}`);return e.hexdigest()}}function u(){this._modified||(this._modified=!0,"function"==typeof this.onSetModified&&this.onSetModified())}e.AnnotationStorage=c;var l=new WeakMap;class f extends c{constructor(t){var e,i;super(),i={writable:!0,value:null},a(this,e=l),e.set(this,i),function(t,e,i){(function(t,e,i){if(e.set)e.set.call(t,i);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=i}})(t,o(t,e,"set"),i)}(this,l,structuredClone(t.serializable))}get print(){(0,n.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return function(t,e){return e.get?e.get.call(t):e.value}(this,o(this,l,"get"))}}e.PrintAnnotationStorage=f},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AnnotationEditor=void 0;var n=i(132),r=i(1);function s(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function o(t,e,i){!function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}(t,e),e.set(t,i)}function a(t,e,i){return function(t,e,i){if(e.set)e.set.call(t,i);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=i}}(t,c(t,e,"set"),i),i}function h(t,e){return function(t,e){return e.get?e.get.call(t):e.value}(t,c(t,e,"get"))}function c(t,e,i){if(!e.has(t))throw new TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}var u=new WeakMap,l=new WeakMap,f=new WeakMap,d=new WeakMap,v=new WeakMap,p=new WeakMap;class b{constructor(t){o(this,u,{writable:!0,value:this.focusin.bind(this)}),o(this,l,{writable:!0,value:this.focusout.bind(this)}),o(this,f,{writable:!0,value:!1}),o(this,d,{writable:!0,value:!1}),o(this,v,{writable:!0,value:!1}),o(this,p,{writable:!0,value:b._zIndex++}),this.constructor===b&&(0,r.unreachable)("Cannot initialize AnnotationEditor."),this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null;const[e,i]=this.parent.viewportBaseDimensions;this.x=t.x/e,this.y=t.y/i,this.rotation=this.parent.viewport.rotation,this.isAttachedToDOM=!1}static get _defaultLineColor(){return(0,r.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=h(this,p)}focusin(t){h(this,f)?a(this,f,!1):this.parent.setSelected(this)}focusout(t){if(!this.isAttachedToDOM)return;const e=t.relatedTarget;null!=e&&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,i,n){const[r,s]=this.parent.viewportBaseDimensions;[i,n]=this.screenToPageTranslation(i,n),this.x=(t+i)/r,this.y=(e+n)/s,this.div.style.left=100*this.x+"%",this.div.style.top=100*this.y+"%"}translate(t,e){const[i,n]=this.parent.viewportBaseDimensions;[t,e]=this.screenToPageTranslation(t,e),this.x+=t/i,this.y+=e/n,this.div.style.left=100*this.x+"%",this.div.style.top=100*this.y+"%"}screenToPageTranslation(t,e){const{rotation:i}=this.parent.viewport;switch(i){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}setDims(t,e){const[i,n]=this.parent.viewportBaseDimensions;this.div.style.width=100*t/i+"%",this.div.style.height=100*e/n+"%"}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",h(this,u)),this.div.addEventListener("focusout",h(this,l));const[t,e]=this.getInitialTranslation();return this.translate(t,e),(0,n.bindEvents)(this,this.div,["dragstart","pointerdown"]),this.div}pointerdown(t){const e=n.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),a(this,f,!0))}getRect(t,e){const[i,n]=this.parent.viewportBaseDimensions,[r,s]=this.parent.pageDimensions,o=r*t/i,a=s*e/n,h=this.x*r,c=this.y*s,u=this.width*r,l=this.height*s;switch(this.rotation){case 0:return[h+o,s-c-a-l,h+o+u,s-c-a];case 90:return[h+a,s-c+o,h+a+l,s-c+o+u];case 180:return[h-o-u,s-c+a,h-o,s-c+a+l];case 270:return[h-a-l,s-c-o-u,h-a,s-c-o];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[i,n,r,s]=t,o=r-i,a=s-n;switch(this.rotation){case 0:return[i,e-s,o,a];case 90:return[i,e-n,a,o];case 180:return[r,e-n,o,a];case 270:return[r,e-s,a,o];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){a(this,v,!0)}disableEditMode(){a(this,v,!1)}isInEditMode(){return h(this,v)}shouldGetKeyboardEvents(){return!1}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){var t;null===(t=this.div)||void 0===t||t.addEventListener("focusin",h(this,u))}serialize(){(0,r.unreachable)("An editor must be serializable")}static deserialize(t,e){const i=new this.prototype.constructor({parent:e,id:e.getNextId()});i.rotation=t.rotation;const[n,r]=e.pageDimensions,[s,o,a,h]=i.getRectInCurrentCoords(t.rect,r);return i.x=s/n,i.y=o/r,i.width=a/n,i.height=h/r,i}remove(){this.div.removeEventListener("focusin",h(this,u)),this.div.removeEventListener("focusout",h(this,l)),this.isEmpty()||this.commit(),this.parent.remove(this)}select(){var t;null===(t=this.div)||void 0===t||t.classList.add("selectedEditor")}unselect(){var t;null===(t=this.div)||void 0===t||t.classList.remove("selectedEditor")}updateParams(t,e){}disableEditing(){}enableEditing(){}get propertiesToUpdate(){return{}}get contentDiv(){return this.div}get isEditing(){return h(this,d)}set isEditing(t){a(this,d,t),t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null)}}e.AnnotationEditor=b,s(b,"_colorManager",new n.ColorManager),s(b,"_zIndex",1)},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.KeyboardManager=e.CommandManager=e.ColorManager=e.AnnotationEditorUIManager=void 0,e.bindEvents=function(t,e,i){for(const n of i)e.addEventListener(n,t[n].bind(t))},e.opacityToHex=function(t){return Math.round(Math.min(255,Math.max(1,255*t))).toString(16).padStart(2,"0")};var n=i(1),r=i(133);function s(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function o(t,e){c(t,e),e.add(t)}function a(t,e,i){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return i}function h(t,e,i){c(t,e),e.set(t,i)}function c(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function u(t,e,i){return function(t,e,i){if(e.set)e.set.call(t,i);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=i}}(t,f(t,e,"set"),i),i}function l(t,e){return function(t,e){return e.get?e.get.call(t):e.value}(t,f(t,e,"get"))}function f(t,e,i){if(!e.has(t))throw new TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}var d=new WeakMap;class v{constructor(){h(this,d,{writable:!0,value:0})}getId(){var t,e;return`${n.AnnotationEditorPrefix}${u(this,d,(t=l(this,d),e=t++,t)),e}`}}var p=new WeakMap,b=new WeakMap,w=new WeakMap,g=new WeakMap;class m{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:128;h(this,p,{writable:!0,value:[]}),h(this,b,{writable:!0,value:!1}),h(this,w,{writable:!0,value:void 0}),h(this,g,{writable:!0,value:-1}),u(this,w,t)}add(t){let{cmd:e,undo:i,mustExec:n,type:r=NaN,overwriteIfSameType:s=!1,keepUndo:o=!1}=t;if(n&&e(),l(this,b))return;const a={cmd:e,undo:i,type:r};if(-1===l(this,g))return l(this,p).length>0&&(l(this,p).length=0),u(this,g,0),void l(this,p).push(a);if(s&&l(this,p)[l(this,g)].type===r)return o&&(a.undo=l(this,p)[l(this,g)].undo),void(l(this,p)[l(this,g)]=a);const h=l(this,g)+1;h===l(this,w)?l(this,p).splice(0,1):(u(this,g,h),h<l(this,p).length&&l(this,p).splice(h)),l(this,p).push(a)}undo(){-1!==l(this,g)&&(u(this,b,!0),l(this,p)[l(this,g)].undo(),u(this,b,!1),u(this,g,l(this,g)-1))}redo(){l(this,g)<l(this,p).length-1&&(u(this,g,l(this,g)+1),u(this,b,!0),l(this,p)[l(this,g)].cmd(),u(this,b,!1))}hasSomethingToUndo(){return-1!==l(this,g)}hasSomethingToRedo(){return l(this,g)<l(this,p).length-1}destroy(){u(this,p,null)}}e.CommandManager=m;var A=new WeakSet;class y{constructor(t){o(this,A),this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const e=y.platform.isMac;for(const[i,n]of t)for(const t of i){const i=t.startsWith("mac+");e&&i?(this.callbacks.set(t.slice(4),n),this.allKeys.add(t.split("+").at(-1))):e||i||(this.callbacks.set(t,n),this.allKeys.add(t.split("+").at(-1)))}}static get platform(){const t="undefined"!=typeof navigator?navigator.platform:"";return(0,n.shadow)(this,"platform",{isWin:t.includes("Win"),isMac:t.includes("Mac")})}exec(t,e){if(!this.allKeys.has(e.key))return;const i=this.callbacks.get(a(this,A,k).call(this,e));i&&(i.bind(t)(),e.stopPropagation(),e.preventDefault())}}function k(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}e.KeyboardManager=y;var M=new WeakMap;class E{constructor(){h(this,M,{writable:!0,value:null})}copy(t){t&&(Array.isArray(t)?u(this,M,t.map((t=>t.serialize()))):u(this,M,[t.serialize()]),u(this,M,l(this,M).filter((t=>!!t))),0===l(this,M).length&&u(this,M,null))}paste(){return l(this,M)}isEmpty(){return null===l(this,M)}destroy(){u(this,M,null)}}class S{get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return(0,r.getColorValues)(t),(0,n.shadow)(this,"_colors",t)}convert(t){const e=(0,r.getRGB)(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[t,i]of this._colors)if(i.every(((t,i)=>t===e[i])))return S._colorsMapping.get(t);return e}getHexCode(t){const e=this._colors.get(t);return e?n.Util.makeHexColor(...e):t}}e.ColorManager=S,s(S,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));var x=new WeakMap,T=new WeakMap,_=new WeakMap,O=new WeakMap,C=new WeakMap,R=new WeakMap,j=new WeakMap,P=new WeakMap,D=new WeakMap,I=new WeakMap,F=new WeakMap,L=new WeakMap,W=new WeakMap,N=new WeakMap,B=new WeakMap,$=new WeakMap,U=new WeakMap,z=new WeakSet,G=new WeakSet,Y=new WeakSet,q=new WeakSet,X=new WeakSet,V=new WeakSet,H=new WeakSet,Q=new WeakSet,K=new WeakSet;class J{constructor(t,e){o(this,K),o(this,Q),o(this,H),o(this,V),o(this,X),o(this,q),o(this,Y),o(this,G),o(this,z),h(this,x,{writable:!0,value:null}),h(this,T,{writable:!0,value:new Map}),h(this,_,{writable:!0,value:new Map}),h(this,O,{writable:!0,value:new E}),h(this,C,{writable:!0,value:new m}),h(this,R,{writable:!0,value:0}),h(this,j,{writable:!0,value:null}),h(this,P,{writable:!0,value:null}),h(this,D,{writable:!0,value:new v}),h(this,I,{writable:!0,value:!1}),h(this,F,{writable:!0,value:n.AnnotationEditorType.NONE}),h(this,L,{writable:!0,value:new Set}),h(this,W,{writable:!0,value:this.keydown.bind(this)}),h(this,N,{writable:!0,value:this.onEditingAction.bind(this)}),h(this,B,{writable:!0,value:this.onPageChanging.bind(this)}),h(this,$,{writable:!0,value:{isEditing:!1,isEmpty:!0,hasEmptyClipboard:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1}}),h(this,U,{writable:!0,value:null}),u(this,U,t),u(this,P,e),l(this,P)._on("editingaction",l(this,N)),l(this,P)._on("pagechanging",l(this,B))}destroy(){a(this,G,tt).call(this),l(this,P)._off("editingaction",l(this,N)),l(this,P)._off("pagechanging",l(this,B));for(const t of l(this,_).values())t.destroy();l(this,_).clear(),l(this,T).clear(),u(this,x,null),l(this,L).clear(),l(this,O).destroy(),l(this,C).destroy()}onPageChanging(t){let{pageNumber:e}=t;u(this,R,e-1)}focusMainContainer(){l(this,U).focus()}keydown(t){var e;null!==(e=this.getActive())&&void 0!==e&&e.shouldGetKeyboardEvents()||J._keyboardManager.exec(this,t)}onEditingAction(t){["undo","redo","cut","copy","paste","delete","selectAll"].includes(t.name)&&this[t.name]()}setEditingState(t){t?(a(this,z,Z).call(this),a(this,Y,et).call(this,{isEditing:l(this,F)!==n.AnnotationEditorType.NONE,isEmpty:a(this,Q,ot).call(this),hasSomethingToUndo:l(this,C).hasSomethingToUndo(),hasSomethingToRedo:l(this,C).hasSomethingToRedo(),hasSelectedEditor:!1,hasEmptyClipboard:l(this,O).isEmpty()})):(a(this,G,tt).call(this),a(this,Y,et).call(this,{isEditing:!1}))}registerEditorTypes(t){u(this,j,t);for(const t of l(this,j))a(this,q,it).call(this,t.defaultPropertiesToUpdate)}getId(){return l(this,D).getId()}addLayer(t){l(this,_).set(t.pageIndex,t),l(this,I)?t.enable():t.disable()}removeLayer(t){l(this,_).delete(t.pageIndex)}updateMode(t){if(u(this,F,t),t===n.AnnotationEditorType.NONE)this.setEditingState(!1),a(this,V,rt).call(this);else{this.setEditingState(!0),a(this,X,nt).call(this);for(const e of l(this,_).values())e.updateMode(t)}}updateToolbar(t){t!==l(this,F)&&l(this,P).dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){for(const i of l(this,L))i.updateParams(t,e);for(const i of l(this,j))i.updateDefaultParams(t,e)}getEditors(t){const e=[];for(const i of l(this,T).values())i.pageIndex===t&&e.push(i);return e}getEditor(t){return l(this,T).get(t)}addEditor(t){l(this,T).set(t.id,t)}removeEditor(t){l(this,T).delete(t.id),this.unselect(t)}setActiveEditor(t){l(this,x)!==t&&(u(this,x,t),t&&a(this,q,it).call(this,t.propertiesToUpdate))}toggleSelected(t){if(l(this,L).has(t))return l(this,L).delete(t),t.unselect(),void a(this,Y,et).call(this,{hasSelectedEditor:this.hasSelection});l(this,L).add(t),t.select(),a(this,q,it).call(this,t.propertiesToUpdate),a(this,Y,et).call(this,{hasSelectedEditor:!0})}setSelected(t){for(const e of l(this,L))e!==t&&e.unselect();l(this,L).clear(),l(this,L).add(t),t.select(),a(this,q,it).call(this,t.propertiesToUpdate),a(this,Y,et).call(this,{hasSelectedEditor:!0})}isSelected(t){return l(this,L).has(t)}unselect(t){t.unselect(),l(this,L).delete(t),a(this,Y,et).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==l(this,L).size}undo(){l(this,C).undo(),a(this,Y,et).call(this,{hasSomethingToUndo:l(this,C).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:a(this,Q,ot).call(this)})}redo(){l(this,C).redo(),a(this,Y,et).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:l(this,C).hasSomethingToRedo(),isEmpty:a(this,Q,ot).call(this)})}addCommands(t){l(this,C).add(t),a(this,Y,et).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:a(this,Q,ot).call(this)})}delete(){if(l(this,x)&&l(this,x).commitOrRemove(),!this.hasSelection)return;const t=[...l(this,L)];this.addCommands({cmd:()=>{for(const e of t)e.remove()},undo:()=>{for(const e of t)a(this,H,st).call(this,e)},mustExec:!0})}copy(){if(l(this,x)&&l(this,x).commitOrRemove(),this.hasSelection){const t=[];for(const e of l(this,L))e.isEmpty()||t.push(e);if(0===t.length)return;l(this,O).copy(t),a(this,Y,et).call(this,{hasEmptyClipboard:!1})}}cut(){this.copy(),this.delete()}paste(){if(l(this,O).isEmpty())return;this.unselectAll();const t=l(this,_).get(l(this,R)),e=l(this,O).paste().map((e=>t.deserialize(e)));this.addCommands({cmd:()=>{for(const t of e)a(this,H,st).call(this,t);a(this,K,at).call(this,e)},undo:()=>{for(const t of e)t.remove()},mustExec:!0})}selectAll(){for(const t of l(this,L))t.commit();a(this,K,at).call(this,l(this,T).values())}unselectAll(){if(l(this,x))l(this,x).commitOrRemove();else if(0!==a(this,K,at).size){for(const t of l(this,L))t.unselect();l(this,L).clear(),a(this,Y,et).call(this,{hasSelectedEditor:!1})}}isActive(t){return l(this,x)===t}getActive(){return l(this,x)}getMode(){return l(this,F)}}function Z(){l(this,U).addEventListener("keydown",l(this,W))}function tt(){l(this,U).removeEventListener("keydown",l(this,W))}function et(t){Object.entries(t).some((t=>{let[e,i]=t;return l(this,$)[e]!==i}))&&l(this,P).dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(l(this,$),t)})}function it(t){l(this,P).dispatch("annotationeditorparamschanged",{source:this,details:t})}function nt(){if(!l(this,I)){u(this,I,!0);for(const t of l(this,_).values())t.enable()}}function rt(){if(this.unselectAll(),l(this,I)){u(this,I,!1);for(const t of l(this,_).values())t.disable()}}function st(t){const e=l(this,_).get(t.pageIndex);e?e.addOrRebuild(t):this.addEditor(t)}function ot(){if(0===l(this,T).size)return!0;if(1===l(this,T).size)for(const t of l(this,T).values())return t.isEmpty();return!1}function at(t){l(this,L).clear();for(const e of t)e.isEmpty()||(l(this,L).add(e),e.select());a(this,Y,et).call(this,{hasSelectedEditor:!0})}e.AnnotationEditorUIManager=J,s(J,"_keyboardManager",new y([[["ctrl+a","mac+meta+a"],J.prototype.selectAll],[["ctrl+c","mac+meta+c"],J.prototype.copy],[["ctrl+v","mac+meta+v"],J.prototype.paste],[["ctrl+x","mac+meta+x"],J.prototype.cut],[["ctrl+z","mac+meta+z"],J.prototype.undo],[["ctrl+y","ctrl+shift+Z","mac+meta+shift+Z"],J.prototype.redo],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete"],J.prototype.delete],[["Escape","mac+Escape"],J.prototype.unselectAll]]))},(t,e,i)=>{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 i of t.keys()){e.style.color=i;const n=window.getComputedStyle(e).color;t.set(i,f(n))}e.remove()},e.getCurrentTransform=function(t){const{a:e,b:i,c:n,d:r,e:s,f:o}=t.getTransform();return[e,i,n,r,s,o]},e.getCurrentTransformInverse=function(t){const{a:e,b:i,c:n,d:r,e:s,f:o}=t.getTransform().invertSelf();return[e,i,n,r,s,o]},e.getFilenameFromUrl=function(t){const e=t.indexOf("#"),i=t.indexOf("?"),n=Math.min(e>0?e:t.length,i>0?i:t.length);return t.substring(t.lastIndexOf("/",n)+1,n)},e.getPdfFilenameFromUrl=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"document.pdf";if("string"!=typeof t)return e;if(c(t))return(0,r.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const i=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,n=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(t);let s=i.exec(n[1])||i.exec(n[2])||i.exec(n[3]);if(s&&(s=s[0],s.includes("%")))try{s=i.exec(decodeURIComponent(s))[0]}catch(t){}return s||e},e.getRGB=f,e.getXfaPageViewport=function(t,e){let{scale:i=1,rotation:n=0}=e;const{width:r,height:s}=t.attributes.style,o=[0,0,parseInt(r),parseInt(s)];return new h({viewBox:o,scale:i,rotation:n})},e.isDataScheme=c,e.isPdfFile=function(t){return"string"==typeof t&&/\.pdf$/i.test(t)},e.isValidFetchUrl=u,e.loadScript=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new Promise(((i,n)=>{const r=document.createElement("script");r.src=t,r.onload=function(t){e&&r.remove(),i(t)},r.onerror=function(){n(new Error(`Cannot load script at: ${r.src}`))},(document.head||document.documentElement).append(r)}))};var n=i(134),r=i(1);function s(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}e.AnnotationPrefix="pdfjs_internal_id_";class o{}async function a(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(u(t,document.baseURI)){const i=await fetch(t);if(!i.ok)throw new Error(i.statusText);return e?new Uint8Array(await i.arrayBuffer()):(0,r.stringToBytes)(await i.text())}return new Promise(((i,n)=>{const s=new XMLHttpRequest;s.open("GET",t,!0),e&&(s.responseType="arraybuffer"),s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE){if(200===s.status||0===s.status){let t;if(e&&s.response?t=new Uint8Array(s.response):!e&&s.responseText&&(t=(0,r.stringToBytes)(s.responseText)),t)return void i(t)}n(new Error(s.statusText))}},s.send(null)}))}e.PixelsPerInch=o,s(o,"CSS",96),s(o,"PDF",72),s(o,"PDF_TO_CSS_UNITS",o.CSS/o.PDF),e.DOMCanvasFactory=class extends n.BaseCanvasFactory{constructor(){let{ownerDocument:t=globalThis.document}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this._document=t}_createCanvas(t,e){const i=this._document.createElement("canvas");return i.width=t,i.height=e,i}},e.DOMCMapReaderFactory=class extends n.BaseCMapReaderFactory{_fetchData(t,e){return a(t,this.isCompressed).then((t=>({cMapData:t,compressionType:e})))}},e.DOMStandardFontDataFactory=class extends n.BaseStandardFontDataFactory{_fetchData(t){return a(t,!0)}},e.DOMSVGFactory=class extends n.BaseSVGFactory{_createSVG(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}};class h{constructor(t){let{viewBox:e,scale:i,rotation:n,offsetX:r=0,offsetY:s=0,dontFlip:o=!1}=t;this.viewBox=e,this.scale=i,this.rotation=n,this.offsetX=r,this.offsetY=s;const a=(e[2]+e[0])/2,h=(e[3]+e[1])/2;let c,u,l,f,d,v,p,b;switch(n%=360,n<0&&(n+=360),n){case 180:c=-1,u=0,l=0,f=1;break;case 90:c=0,u=1,l=1,f=0;break;case 270:c=0,u=-1,l=-1,f=0;break;case 0:c=1,u=0,l=0,f=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(l=-l,f=-f),0===c?(d=Math.abs(h-e[1])*i+r,v=Math.abs(a-e[0])*i+s,p=Math.abs(e[3]-e[1])*i,b=Math.abs(e[2]-e[0])*i):(d=Math.abs(a-e[0])*i+r,v=Math.abs(h-e[1])*i+s,p=Math.abs(e[2]-e[0])*i,b=Math.abs(e[3]-e[1])*i),this.transform=[c*i,u*i,l*i,f*i,d-c*i*a-l*i*h,v-u*i*a-f*i*h],this.width=p,this.height=b}clone(){let{scale:t=this.scale,rotation:e=this.rotation,offsetX:i=this.offsetX,offsetY:n=this.offsetY,dontFlip:r=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new h({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:i,offsetY:n,dontFlip:r})}convertToViewportPoint(t,e){return r.Util.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){const e=r.Util.applyTransform([t[0],t[1]],this.transform),i=r.Util.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){return r.Util.applyInverseTransform([t,e],this.transform)}}function c(t){const e=t.length;let i=0;for(;i<e&&""===t[i].trim();)i++;return"data:"===t.substring(i,i+5).toLowerCase()}function u(t,e){try{const{protocol:i}=e?new URL(t,e):new URL(t);return"http:"===i||"https:"===i}catch(t){return!1}}let l;function f(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,r.warn)(`Not a valid color format: "${t}"`),[0,0,0])}e.PageViewport=h,e.RenderingCancelledException=class extends r.BaseException{constructor(t,e){super(t,"RenderingCancelledException"),this.type=e}},e.StatTimer=class{constructor(){this.started=Object.create(null),this.times=[]}time(t){t in this.started&&(0,r.warn)(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||(0,r.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 t of this.times){const i=t.name;i.length>e&&(e=i.length)}for(const i of this.times){const n=i.end-i.start;t.push(`${i.name.padEnd(e)} ${n}ms\n`)}return t.join("")}},e.PDFDateString=class{static toDateObject(t){if(!t||"string"!=typeof t)return null;l||(l=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const e=l.exec(t);if(!e)return null;const i=parseInt(e[1],10);let n=parseInt(e[2],10);n=n>=1&&n<=12?n-1:0;let r=parseInt(e[3],10);r=r>=1&&r<=31?r:1;let s=parseInt(e[4],10);s=s>=0&&s<=23?s:0;let o=parseInt(e[5],10);o=o>=0&&o<=59?o:0;let a=parseInt(e[6],10);a=a>=0&&a<=59?a:0;const h=e[7]||"Z";let c=parseInt(e[8],10);c=c>=0&&c<=23?c:0;let u=parseInt(e[9],10)||0;return u=u>=0&&u<=59?u:0,"-"===h?(s+=c,o+=u):"+"===h&&(s-=c,o-=u),new Date(Date.UTC(i,n,r,s,o,a))}}},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BaseStandardFontDataFactory=e.BaseSVGFactory=e.BaseCanvasFactory=e.BaseCMapReaderFactory=void 0;var n=i(1);class r{constructor(){this.constructor===r&&(0,n.unreachable)("Cannot initialize BaseCanvasFactory.")}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const i=this._createCanvas(t,e);return{canvas:i,context:i.getContext("2d")}}reset(t,e,i){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||i<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=i}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,n.unreachable)("Abstract method `_createCanvas` called.")}}e.BaseCanvasFactory=r;class s{constructor(t){let{baseUrl:e=null,isCompressed:i=!1}=t;this.constructor===s&&(0,n.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=e,this.isCompressed=i}async fetch(t){let{name:e}=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(!e)throw new Error("CMap name must be specified.");const i=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetchData(i,this.isCompressed?n.CMapCompressionType.BINARY:n.CMapCompressionType.NONE).catch((()=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${i}`)}))}_fetchData(t,e){(0,n.unreachable)("Abstract method `_fetchData` called.")}}e.BaseCMapReaderFactory=s;class o{constructor(t){let{baseUrl:e=null}=t;this.constructor===o&&(0,n.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=e}async fetch(t){let{filename:e}=t;if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!e)throw new Error("Font filename must be specified.");const i=`${this.baseUrl}${e}`;return this._fetchData(i).catch((()=>{throw new Error(`Unable to load font data at: ${i}`)}))}_fetchData(t){(0,n.unreachable)("Abstract method `_fetchData` called.")}}e.BaseStandardFontDataFactory=o;class a{constructor(){this.constructor===a&&(0,n.unreachable)("Cannot initialize BaseSVGFactory.")}create(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const n=this._createSVG("svg:svg");return n.setAttribute("version","1.1"),i||(n.setAttribute("width",`${t}px`),n.setAttribute("height",`${e}px`)),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("viewBox",`0 0 ${t} ${e}`),n}createElement(t){if("string"!=typeof t)throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){(0,n.unreachable)("Abstract method `_createSVG` called.")}}e.BaseSVGFactory=a},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MurmurHash3_64=void 0;var n=i(1);const r=3285377520,s=4294901760,o=65535;e.MurmurHash3_64=class{constructor(t){this.h1=t?4294967295&t:r,this.h2=t?4294967295&t:r}update(t){let e,i;if("string"==typeof t){e=new Uint8Array(2*t.length),i=0;for(let n=0,r=t.length;n<r;n++){const r=t.charCodeAt(n);r<=255?e[i++]=r:(e[i++]=r>>>8,e[i++]=255&r)}}else{if(!(0,n.isArrayBuffer)(t))throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");e=t.slice(),i=e.byteLength}const r=i>>2,a=i-4*r,h=new Uint32Array(e.buffer,0,r);let c=0,u=0,l=this.h1,f=this.h2;const d=3432918353,v=461845907,p=11601,b=13715;for(let t=0;t<r;t++)1&t?(c=h[t],c=c*d&s|c*p&o,c=c<<15|c>>>17,c=c*v&s|c*b&o,l^=c,l=l<<13|l>>>19,l=5*l+3864292196):(u=h[t],u=u*d&s|u*p&o,u=u<<15|u>>>17,u=u*v&s|u*b&o,f^=u,f=f<<13|f>>>19,f=5*f+3864292196);switch(c=0,a){case 3:c^=e[4*r+2]<<16;case 2:c^=e[4*r+1]<<8;case 1:c^=e[4*r],c=c*d&s|c*p&o,c=c<<15|c>>>17,c=c*v&s|c*b&o,1&r?l^=c:f^=c}this.h1=l,this.h2=f}hexdigest(){let t=this.h1,e=this.h2;t^=e>>>1,t=3981806797*t&s|36045*t&o,e=4283543511*e&s|(2950163797*(e<<16|t>>>16)&s)>>>16,t^=e>>>1,t=444984403*t&s|60499*t&o,e=3301882366*e&s|(3120437893*(e<<16|t>>>16)&s)>>>16,t^=e>>>1;const i=(t>>>0).toString(16),n=(e>>>0).toString(16);return i.padStart(8,"0")+n.padStart(8,"0")}}},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FontLoader=e.FontFaceObject=void 0;var n=i(1);class r{constructor(t){let{docId:e,onUnsupportedFeature:i,ownerDocument:s=globalThis.document,styleElement:o=null}=t;this.constructor===r&&(0,n.unreachable)("Cannot initialize BaseFontLoader."),this.docId=e,this._onUnsupportedFeature=i,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 i=e.sheet;i.insertRule(t,i.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(i){throw this._onUnsupportedFeature({featureId:n.UNSUPPORTED_FEATURES.errorFontLoadNative}),(0,n.warn)(`Failed to load font '${e.family}': '${i}'.`),t.disableFontFace=!0,i}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise((i=>{const n=this._queueLoadingCallback(i);this._prepareFontLoadEvent([e],[t],n)}))}}_queueLoadingCallback(t){(0,n.unreachable)("Abstract method `_queueLoadingCallback`.")}get isFontLoadingAPISupported(){var t;const e=!(null===(t=this._document)||void 0===t||!t.fonts);return(0,n.shadow)(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){(0,n.unreachable)("Abstract method `isSyncFontLoadingSupported`.")}get _loadTestFont(){(0,n.unreachable)("Abstract method `_loadTestFont`.")}_prepareFontLoadEvent(t,e,i){(0,n.unreachable)("Abstract method `_prepareFontLoadEvent`.")}}let s;e.FontLoader=s,e.FontLoader=s=class extends r{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,n.shadow)(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){const e=this.loadingContext,i={id:"pdfjs-font-loading-"+e.nextRequestId++,done:!1,complete:function(){for((0,n.assert)(!i.done,"completeRequest() cannot be called twice."),i.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(i),i}get _loadTestFont(){return(0,n.shadow)(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(t,e,i){function r(t,e){return t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|255&t.charCodeAt(e+3)}function s(t,e,i,n){return t.substring(0,e)+n+t.substring(e+i)}let o,a;const h=this._document.createElement("canvas");h.width=1,h.height=1;const c=h.getContext("2d");let u=0;const l=`lt${Date.now()}${this.loadTestFontId++}`;let f=this._loadTestFont;f=s(f,976,l.length,l);const d=1482184792;let v=r(f,16);for(o=0,a=l.length-3;o<a;o+=4)v=v-d+r(l,o)|0;o<l.length&&(v=v-d+r(l+"XXX",o)|0),f=s(f,16,4,(0,n.string32)(v));const p=`url(data:font/opentype;base64,${btoa(f)});`;this.insertRule(`@font-face {font-family:"${l}";src:${p}}`);const b=[];for(const t of e)b.push(t.loadedName);b.push(l);const w=this._document.createElement("div");w.style.visibility="hidden",w.style.width=w.style.height="10px",w.style.position="absolute",w.style.top=w.style.left="0px";for(const t of b){const e=this._document.createElement("span");e.textContent="Hi",e.style.fontFamily=t,w.append(e)}this._document.body.append(w),function t(e,i){if(u++,u>30)return(0,n.warn)("Load test font never loaded."),void i();c.font="30px "+e,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0?i():setTimeout(t.bind(null,e,i))}(l,(()=>{w.remove(),i.complete()}))}},e.FontFaceObject=class{constructor(t,e){let{isEvalSupported:i=!0,disableFontFace:n=!1,ignoreErrors:r=!1,onUnsupportedFeature:s,fontRegistry:o=null}=e;this.compiledGlyphs=Object.create(null);for(const e in t)this[e]=t[e];this.isEvalSupported=!1!==i,this.disableFontFace=!0===n,this.ignoreErrors=!0===r,this._onUnsupportedFeature=s,this.fontRegistry=o}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,n.bytesToString)(this.data),e=`url(data:${this.mimetype};base64,${btoa(t)});`;let i;if(this.cssFontInfo){let t=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(t+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),i=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${t}src:${e}}`}else i=`@font-face {font-family:"${this.loadedName}";src:${e}}`;return this.fontRegistry&&this.fontRegistry.registerFont(this,e),i}getPathGenerator(t,e){if(void 0!==this.compiledGlyphs[e])return this.compiledGlyphs[e];let i;try{i=t.get(this.loadedName+"_path_"+e)}catch(t){if(!this.ignoreErrors)throw t;return this._onUnsupportedFeature({featureId:n.UNSUPPORTED_FEATURES.errorFontGetPath}),(0,n.warn)(`getPathGenerator - ignoring character: "${t}".`),this.compiledGlyphs[e]=function(){}}return this.compiledGlyphs[e]=function(t,e){for(const n of i)"scale"===n.cmd&&(n.args=[e,-e]),t[n.cmd].apply(t,n.args)}}}},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CanvasGraphics=void 0;var n=i(133),r=i(1),s=i(138),o=i(139),a=i(3);function h(t,e,i){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return i}const c=4096,u=a.isNodeJS&&"undefined"==typeof Path2D?-1:1e3,l=16;class f{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,i){let n;return void 0!==this.cache[t]?(n=this.cache[t],this.canvasFactory.reset(n,e,i)):(n=this.canvasFactory.create(e,i),this.cache[t]=n),n}delete(t){delete this.cache[t]}clear(){for(const t in this.cache)this.canvasFactory.destroy(this.cache[t]),delete this.cache[t]}}function d(t,e,i,r,s,o,a,h,c,u){const[l,f,d,v,p,b]=(0,n.getCurrentTransform)(t);if(0===f&&0===d){const n=Math.round(a*l+p),w=Math.round(h*v+b),g=Math.abs(Math.round((a+c)*l+p)-n)||1,m=Math.abs(Math.round((h+u)*v+b)-w)||1;return t.setTransform(Math.sign(l),0,0,Math.sign(v),n,w),t.drawImage(e,i,r,s,o,0,0,g,m),t.setTransform(l,f,d,v,p,b),[g,m]}if(0===l&&0===v){const n=Math.round(h*d+p),w=Math.round(a*f+b),g=Math.abs(Math.round((h+u)*d+p)-n)||1,m=Math.abs(Math.round((a+c)*f+b)-w)||1;return t.setTransform(0,Math.sign(f),Math.sign(d),0,n,w),t.drawImage(e,i,r,s,o,0,0,m,g),t.setTransform(l,f,d,v,p,b),[m,g]}return t.drawImage(e,i,r,s,o,a,h,c,u),[Math.hypot(l,f)*c,Math.hypot(d,v)*u]}class v{constructor(t,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=r.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=r.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=r.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,i){[e,i]=r.Util.applyTransform([e,i],t),this.minX=Math.min(this.minX,e),this.minY=Math.min(this.minY,i),this.maxX=Math.max(this.maxX,e),this.maxY=Math.max(this.maxY,i)}updateRectMinMax(t,e){const i=r.Util.applyTransform(e,t),n=r.Util.applyTransform(e.slice(2),t);this.minX=Math.min(this.minX,i[0],n[0]),this.minY=Math.min(this.minY,i[1],n[1]),this.maxX=Math.max(this.maxX,i[0],n[0]),this.maxY=Math.max(this.maxY,i[1],n[1])}updateScalingPathMinMax(t,e){r.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,i,n,s,o,a,h,c,u){const l=r.Util.bezierBoundingBox(e,i,n,s,o,a,h,c);if(u)return u[0]=Math.min(u[0],l[0],l[2]),u[1]=Math.max(u[1],l[0],l[2]),u[2]=Math.min(u[2],l[1],l[3]),void(u[3]=Math.max(u[3],l[1],l[3]));this.updateRectMinMax(t,l)}getPathBoundingBox(){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const e=[this.minX,this.minY,this.maxX,this.maxY];if((arguments.length>0&&void 0!==arguments[0]?arguments[0]:s.PathType.FILL)===s.PathType.STROKE){t||(0,r.unreachable)("Stroke bounding box must include transform.");const i=r.Util.singularValueDecompose2dScale(t),n=i[0]*this.lineWidth/2,s=i[1]*this.lineWidth/2;e[0]-=n,e[1]-=s,e[2]+=n,e[3]+=s}return e}updateClipFromPath(){const t=r.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(){return r.Util.intersect(this.clipBox,this.getPathBoundingBox(arguments.length>0&&void 0!==arguments[0]?arguments[0]:s.PathType.FILL,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null))}}function p(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if("undefined"!=typeof ImageData&&e instanceof ImageData)return void t.putImageData(e,0,0);const n=e.height,s=e.width,o=n%l,a=(n-o)/l,h=0===o?a:a+1,c=t.createImageData(s,l);let u,f=0;const d=e.data,v=c.data;let p,b,w,g,m,A,y,k;if(i)switch(i.length){case 1:m=i[0],A=i[0],y=i[0],k=i[0];break;case 4:m=i[0],A=i[1],y=i[2],k=i[3]}if(e.kind===r.ImageKind.GRAYSCALE_1BPP){const e=d.byteLength,i=new Uint32Array(v.buffer,0,v.byteLength>>2),n=i.length,g=s+7>>3;let m=4294967295,A=r.FeatureTest.isLittleEndian?4278190080:255;for(k&&255===k[0]&&0===k[255]&&([m,A]=[A,m]),p=0;p<h;p++){for(w=p<a?l:o,u=0,b=0;b<w;b++){const t=e-f;let n=0;const r=t>g?s:8*t-7,o=-8&r;let a=0,h=0;for(;n<o;n+=8)h=d[f++],i[u++]=128&h?m:A,i[u++]=64&h?m:A,i[u++]=32&h?m:A,i[u++]=16&h?m:A,i[u++]=8&h?m:A,i[u++]=4&h?m:A,i[u++]=2&h?m:A,i[u++]=1&h?m:A;for(;n<r;n++)0===a&&(h=d[f++],a=128),i[u++]=h&a?m:A,a>>=1}for(;u<n;)i[u++]=0;t.putImageData(c,0,p*l)}}else if(e.kind===r.ImageKind.RGBA_32BPP){const e=!!(m||A||y);for(b=0,g=s*l*4,p=0;p<a;p++){if(v.set(d.subarray(f,f+g)),f+=g,e)for(let t=0;t<g;t+=4)m&&(v[t+0]=m[v[t+0]]),A&&(v[t+1]=A[v[t+1]]),y&&(v[t+2]=y[v[t+2]]);t.putImageData(c,0,b),b+=l}if(p<h){if(g=s*o*4,v.set(d.subarray(f,f+g)),e)for(let t=0;t<g;t+=4)m&&(v[t+0]=m[v[t+0]]),A&&(v[t+1]=A[v[t+1]]),y&&(v[t+2]=y[v[t+2]]);t.putImageData(c,0,b)}}else{if(e.kind!==r.ImageKind.RGB_24BPP)throw new Error(`bad image kind: ${e.kind}`);{const e=!!(m||A||y);for(w=l,g=s*w,p=0;p<h;p++){for(p>=a&&(w=o,g=s*w),u=0,b=g;b--;)v[u++]=d[f++],v[u++]=d[f++],v[u++]=d[f++],v[u++]=255;if(e)for(let t=0;t<u;t+=4)m&&(v[t+0]=m[v[t+0]]),A&&(v[t+1]=A[v[t+1]]),y&&(v[t+2]=y[v[t+2]]);t.putImageData(c,0,p*l)}}}}function b(t,e){if(e.bitmap)return void t.drawImage(e.bitmap,0,0);const i=e.height,n=e.width,r=i%l,s=(i-r)/l,a=0===r?s:s+1,h=t.createImageData(n,l);let c=0;const u=e.data,f=h.data;for(let e=0;e<a;e++){const i=e<s?l:r;({srcPos:c}=(0,o.applyMaskImageData)({src:u,srcPos:c,dest:f,width:n,height:i})),t.putImageData(h,0,e*l)}}function w(t,e){const i=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font"];for(let n=0,r=i.length;n<r;n++){const r=i[n];void 0!==t[r]&&(e[r]=t[r])}void 0!==t.setLineDash&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function g(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 m(t,e,i,n){const r=t.length;for(let s=3;s<r;s+=4){const r=t[s];if(0===r)t[s-3]=e,t[s-2]=i,t[s-1]=n;else if(r<255){const o=255-r;t[s-3]=t[s-3]*r+e*o>>8,t[s-2]=t[s-2]*r+i*o>>8,t[s-1]=t[s-1]*r+n*o>>8}}}function A(t,e,i){const n=t.length,r=1/255;for(let s=3;s<n;s+=4)e[s]=e[s]*(i?i[t[s]]:t[s])*r|0}function y(t,e,i){const n=t.length;for(let r=3;r<n;r+=4){const n=77*t[r-3]+152*t[r-2]+28*t[r-1];e[r]=i?e[r]*i[n>>8]>>8:e[r]*n>>16}}function k(t,e){const i=r.Util.singularValueDecompose2dScale(t);i[0]=Math.fround(i[0]),i[1]=Math.fround(i[1]);const s=Math.fround((globalThis.devicePixelRatio||1)*n.PixelsPerInch.PDF_TO_CSS_UNITS);return void 0!==e?e:i[0]<=s||i[1]<=s}const M=["butt","round","square"],E=["miter","round","bevel"],S={},x={};var T=new WeakSet;class _{constructor(t,e,i,n,r,s,o,a){var h,c;(function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")})(h=this,c=T),c.add(h),this.ctx=t,this.current=new v(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=i,this.canvasFactory=n,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=s,this.cachedCanvases=new f(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=o,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.backgroundColor=(null==a?void 0:a.background)||null,this.foregroundColor=(null==a?void 0:a.foreground)||null,this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return"string"==typeof t?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):e}beginDrawing(t){let{transform:e,viewport:i,transparency:r=!1,background:s=null}=t;const o=this.ctx.canvas.width,a=this.ctx.canvas.height,h=s||"#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 i=!0,r=h;if(this.ctx.fillStyle=h,r=this.ctx.fillStyle,i="string"==typeof r&&/^#[0-9A-Fa-f]{6}$/.test(r),"#000000"===t&&"#ffffff"===e||t===e||!i)this.foregroundColor=this.backgroundColor=null;else{const[i,s,o]=(0,n.getRGB)(r),a=t=>(t/=255)<=.03928?t/12.92:((t+.055)/1.055)**2.4,h=Math.round(.2126*a(i)+.7152*a(s)+.0722*a(o));this.selectColor=(i,n,r)=>{const s=.2126*a(i)+.7152*a(n)+.0722*a(r);return Math.round(s)===h?e:t}}}if(this.ctx.fillStyle=this.backgroundColor||h,this.ctx.fillRect(0,0,o,a),this.ctx.restore(),r){const t=this.cachedCanvases.getCanvas("transparent",o,a);this.compositeCtx=this.ctx,this.transparentCanvas=t.canvas,this.ctx=t.context,this.ctx.save(),this.ctx.transform(...(0,n.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),g(this.ctx,this.foregroundColor),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...i.transform),this.viewportScale=i.scale,this.baseTransform=(0,n.getCurrentTransform)(this.ctx),this.imageLayer&&((0,n.deprecated)("The `imageLayer` functionality will be removed in the future."),this.imageLayer.beginLayout())}executeOperatorList(t,e,i,n){const s=t.argsArray,o=t.fnArray;let a=e||0;const h=s.length;if(h===a)return a;const c=h-a>10&&"function"==typeof i,u=c?Date.now()+15:0;let l=0;const f=this.commonObjs,d=this.objs;let v;for(;;){if(void 0!==n&&a===n.nextBreakPoint)return n.breakIt(a,i),a;if(v=o[a],v!==r.OPS.dependency)this[v].apply(this,s[a]);else for(const t of s[a]){const e=t.startsWith("g_")?f:d;if(!e.has(t))return e.get(t,i),a}if(a++,a===h)return a;if(c&&++l>10){if(Date.now()>u)return i(),a;l=0}}}endDrawing(){h(this,T,O).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 i=t.width,n=t.height;let r,s,o=Math.max(Math.hypot(e[0],e[1]),1),a=Math.max(Math.hypot(e[2],e[3]),1),h=i,c=n,u="prescale1";for(;o>2&&h>1||a>2&&c>1;){let e=h,i=c;o>2&&h>1&&(e=Math.ceil(h/2),o/=h/e),a>2&&c>1&&(i=Math.ceil(c/2),a/=c/i),r=this.cachedCanvases.getCanvas(u,e,i),s=r.context,s.clearRect(0,0,e,i),s.drawImage(t,0,0,h,c,0,0,e,i),t=r.canvas,h=e,c=i,u="prescale1"===u?"prescale2":"prescale1"}return{img:t,paintWidth:h,paintHeight:c}}_createMaskCanvas(t){const e=this.ctx,{width:i,height:o}=t,a=this.current.fillColor,h=this.current.patternFill,c=(0,n.getCurrentTransform)(e);let u,l,f,v;if((t.bitmap||t.data)&&t.count>1){const e=t.bitmap||t.data.buffer,i=c.slice(0,4);l=JSON.stringify(h?i:[i,a]),u=this._cachedBitmapsMap.get(e),u||(u=new Map,this._cachedBitmapsMap.set(e,u));const n=u.get(l);if(n&&!h)return{canvas:n,offsetX:Math.round(Math.min(c[0],c[2])+c[4]),offsetY:Math.round(Math.min(c[1],c[3])+c[5])};f=n}f||(v=this.cachedCanvases.getCanvas("maskCanvas",i,o),b(v.context,t));let p=r.Util.transform(c,[1/i,0,0,-1/o,0,0]);p=r.Util.transform(p,[1,0,0,1,0,-o]);const w=r.Util.applyTransform([0,0],p),g=r.Util.applyTransform([i,o],p),m=r.Util.normalizeRect([w[0],w[1],g[0],g[1]]),A=Math.round(m[2]-m[0])||1,y=Math.round(m[3]-m[1])||1,M=this.cachedCanvases.getCanvas("fillCanvas",A,y),E=M.context,S=Math.min(w[0],g[0]),x=Math.min(w[1],g[1]);E.translate(-S,-x),E.transform(...p),f||(f=this._scaleImage(v.canvas,(0,n.getCurrentTransformInverse)(E)),f=f.img,u&&h&&u.set(l,f)),E.imageSmoothingEnabled=k((0,n.getCurrentTransform)(E),t.interpolate),d(E,f,0,0,f.width,f.height,0,0,i,o),E.globalCompositeOperation="source-in";const T=r.Util.transform((0,n.getCurrentTransformInverse)(E),[1,0,0,1,-S,-x]);return E.fillStyle=h?a.getPattern(e,this,T,s.PathType.FILL):a,E.fillRect(0,0,i,o),u&&!h&&(this.cachedCanvases.delete("fillCanvas"),u.set(l,M.canvas)),{canvas:M.canvas,offsetX:Math.round(S),offsetY:Math.round(x)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking=null),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=M[t]}setLineJoin(t){this.ctx.lineJoin=E[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){const i=this.ctx;void 0!==i.setLineDash&&(i.setLineDash(t),i.lineDashOffset=e)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(let e=0,i=t.length;e<i;e++){const i=t[e],n=i[1];switch(i[0]){case"LW":this.setLineWidth(n);break;case"LC":this.setLineCap(n);break;case"LJ":this.setLineJoin(n);break;case"ML":this.setMiterLimit(n);break;case"D":this.setDash(n[0],n[1]);break;case"RI":this.setRenderingIntent(n);break;case"FL":this.setFlatness(n);break;case"Font":this.setFont(n[0],n[1]);break;case"CA":this.current.strokeAlpha=i[1];break;case"ca":this.current.fillAlpha=i[1],this.ctx.globalAlpha=i[1];break;case"BM":this.ctx.globalCompositeOperation=n;break;case"SMask":this.current.activeSMask=n?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.current.transferMaps=n}}}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.cachedCanvases.getCanvas("smaskGroupAt"+this.groupLevel,this.ctx.canvas.width,this.ctx.canvas.height);this.suspendedCtx=this.ctx,this.ctx=t.context;const e=this.ctx;e.setTransform(...(0,n.getCurrentTransform)(this.suspendedCtx)),w(this.suspendedCtx,e),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,i){e.translate(t,i),this.__originalTranslate(t,i)},t.scale=function(t,i){e.scale(t,i),this.__originalScale(t,i)},t.transform=function(t,i,n,r,s,o){e.transform(t,i,n,r,s,o),this.__originalTransform(t,i,n,r,s,o)},t.setTransform=function(t,i,n,r,s,o){e.setTransform(t,i,n,r,s,o),this.__originalSetTransform(t,i,n,r,s,o)},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,i){e.moveTo(t,i),this.__originalMoveTo(t,i)},t.lineTo=function(t,i){e.lineTo(t,i),this.__originalLineTo(t,i)},t.bezierCurveTo=function(t,i,n,r,s,o){e.bezierCurveTo(t,i,n,r,s,o),this.__originalBezierCurveTo(t,i,n,r,s,o)},t.rect=function(t,i,n,r){e.rect(t,i,n,r),this.__originalRect(t,i,n,r)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}(e,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(),w(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){this.current.activeSMask&&(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],function(t,e,i,n){const r=n[0],s=n[1],o=n[2]-r,a=n[3]-s;0!==o&&0!==a&&(function(t,e,i,n,r,s,o,a,h,c,u){const l=!!s,f=l?s[0]:0,d=l?s[1]:0,v=l?s[2]:0;let p;p="Luminosity"===r?y:A;const b=Math.min(n,Math.ceil(1048576/i));for(let r=0;r<n;r+=b){const s=Math.min(b,n-r),w=t.getImageData(a-c,r+(h-u),i,s),g=e.getImageData(a,r+h,i,s);l&&m(w.data,f,d,v),p(w.data,g.data,o),e.putImageData(g,a,r+h)}}(e.context,i,o,a,e.subtype,e.backdrop,e.transferMap,r,s,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(i.canvas,0,0),t.restore())}(this.suspendedCtx,this.current.activeSMask,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?(w(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(),w(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null)}transform(t,e,i,n,r,s){this.ctx.transform(t,e,i,n,r,s),this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i){const s=this.ctx,o=this.current;let a,h,c=o.x,u=o.y;const l=(0,n.getCurrentTransform)(s),f=0===l[0]&&0===l[3]||0===l[1]&&0===l[2],d=f?i.slice(0):null;for(let i=0,n=0,v=t.length;i<v;i++)switch(0|t[i]){case r.OPS.rectangle:c=e[n++],u=e[n++];const t=e[n++],i=e[n++],v=c+t,p=u+i;s.moveTo(c,u),0===t||0===i?s.lineTo(v,p):(s.lineTo(v,u),s.lineTo(v,p),s.lineTo(c,p)),f||o.updateRectMinMax(l,[c,u,v,p]),s.closePath();break;case r.OPS.moveTo:c=e[n++],u=e[n++],s.moveTo(c,u),f||o.updatePathMinMax(l,c,u);break;case r.OPS.lineTo:c=e[n++],u=e[n++],s.lineTo(c,u),f||o.updatePathMinMax(l,c,u);break;case r.OPS.curveTo:a=c,h=u,c=e[n+4],u=e[n+5],s.bezierCurveTo(e[n],e[n+1],e[n+2],e[n+3],c,u),o.updateCurvePathMinMax(l,a,h,e[n],e[n+1],e[n+2],e[n+3],c,u,d),n+=6;break;case r.OPS.curveTo2:a=c,h=u,s.bezierCurveTo(c,u,e[n],e[n+1],e[n+2],e[n+3]),o.updateCurvePathMinMax(l,a,h,c,u,e[n],e[n+1],e[n+2],e[n+3],d),c=e[n+2],u=e[n+3],n+=4;break;case r.OPS.curveTo3:a=c,h=u,c=e[n+2],u=e[n+3],s.bezierCurveTo(e[n],e[n+1],c,u,c,u),o.updateCurvePathMinMax(l,a,h,e[n],e[n+1],c,u,c,u,d),n+=4;break;case r.OPS.closePath:s.closePath()}f&&o.updateScalingPathMinMax(l,d),o.setCurrentPoint(c,u)}closePath(){this.ctx.closePath()}stroke(t){t=void 0===t||t;const e=this.ctx,i=this.current.strokeColor;e.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"==typeof i&&null!=i&&i.getPattern?(e.save(),e.strokeStyle=i.getPattern(e,this,(0,n.getCurrentTransformInverse)(e),s.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,i=this.current.fillColor;let r=!1;this.current.patternFill&&(e.save(),e.fillStyle=i.getPattern(e,this,(0,n.getCurrentTransformInverse)(e),s.PathType.FILL),r=!0);const o=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==o&&(this.pendingEOFill?(e.fill("evenodd"),this.pendingEOFill=!1):e.fill()),r&&e.restore(),t&&this.consumePath(o)}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=S}eoClip(){this.pendingClip=x}beginText(){this.current.textMatrix=r.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 i of t)e.setTransform(...i.transform),e.translate(i.x,i.y),i.addToPath(e,i.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 i=this.commonObjs.get(t),n=this.current;if(!i)throw new Error(`Can't find font for ${t}`);if(n.fontMatrix=i.fontMatrix||r.FONT_IDENTITY_MATRIX,0!==n.fontMatrix[0]&&0!==n.fontMatrix[3]||(0,r.warn)("Invalid font matrix for font "+t),e<0?(e=-e,n.fontDirection=-1):n.fontDirection=1,this.current.font=i,this.current.fontSize=e,i.isType3Font)return;let s="normal";i.black?s="900":i.bold&&(s="bold");const o=i.italic?"italic":"normal",a=`"${i.loadedName||"sans-serif"}", ${i.fallbackName}`;let h=e;e<16?h=16:e>100&&(h=100),this.current.fontSizeScale=e/h,this.ctx.font=`${o} ${s} ${h}px ${a}`}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,i,n,r,s){this.current.textMatrix=[t,e,i,n,r,s],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,i,s){const o=this.ctx,a=this.current,h=a.font,c=a.textRenderingMode,u=a.fontSize/a.fontSizeScale,l=c&r.TextRenderingMode.FILL_STROKE_MASK,f=!!(c&r.TextRenderingMode.ADD_TO_PATH_FLAG),d=a.patternFill&&!h.missingFile;let v;(h.disableFontFace||f||d)&&(v=h.getPathGenerator(this.commonObjs,t)),h.disableFontFace||d?(o.save(),o.translate(e,i),o.beginPath(),v(o,u),s&&o.setTransform(...s),l!==r.TextRenderingMode.FILL&&l!==r.TextRenderingMode.FILL_STROKE||o.fill(),l!==r.TextRenderingMode.STROKE&&l!==r.TextRenderingMode.FILL_STROKE||o.stroke(),o.restore()):(l!==r.TextRenderingMode.FILL&&l!==r.TextRenderingMode.FILL_STROKE||o.fillText(t,e,i),l!==r.TextRenderingMode.STROKE&&l!==r.TextRenderingMode.FILL_STROKE||o.strokeText(t,e,i)),f&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:(0,n.getCurrentTransform)(o),x:e,y:i,fontSize:u,addToPath:v})}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 i=!1;for(let t=3;t<e.length;t+=4)if(e[t]>0&&e[t]<255){i=!0;break}return(0,r.shadow)(this,"isFontSubpixelAAEnabled",i)}showText(t){const e=this.current,i=e.font;if(i.isType3Font)return this.showType3Text(t);const o=e.fontSize;if(0===o)return;const a=this.ctx,h=e.fontSizeScale,c=e.charSpacing,u=e.wordSpacing,l=e.fontDirection,f=e.textHScale*l,d=t.length,v=i.vertical,p=v?1:-1,b=i.defaultVMetrics,w=o*e.fontMatrix[0],g=e.textRenderingMode===r.TextRenderingMode.FILL&&!i.disableFontFace&&!e.patternFill;let m;if(a.save(),a.transform(...e.textMatrix),a.translate(e.x,e.y+e.textRise),a.scale(f,l>0?-1:1),e.patternFill){a.save();const t=e.fillColor.getPattern(a,this,(0,n.getCurrentTransformInverse)(a),s.PathType.FILL);m=(0,n.getCurrentTransform)(a),a.restore(),a.fillStyle=t}let A=e.lineWidth;const y=e.textMatrixScale;if(0===y||0===A){const t=e.textRenderingMode&r.TextRenderingMode.FILL_STROKE_MASK;t!==r.TextRenderingMode.STROKE&&t!==r.TextRenderingMode.FILL_STROKE||(A=this.getSinglePixelWidth())}else A/=y;1!==h&&(a.scale(h,h),A/=h),a.lineWidth=A;let k,M=0;for(k=0;k<d;++k){const e=t[k];if("number"==typeof e){M+=p*e*o/1e3;continue}let n=!1;const r=(e.isSpace?u:0)+c,s=e.fontChar,f=e.accent;let d,A,y,E=e.width;if(v){const t=e.vmetric||b,i=-(e.vmetric?t[1]:.5*E)*w;E=t?-t[0]:E,d=i/h,A=(M+t[2]*w)/h}else d=M/h,A=0;if(i.remeasure&&E>0){const t=1e3*a.measureText(s).width/o*h;if(E<t&&this.isFontSubpixelAAEnabled){const e=E/t;n=!0,a.save(),a.scale(e,1),d/=e}else E!==t&&(d+=(E-t)/2e3*o/h)}this.contentVisible&&(e.isInFont||i.missingFile)&&(g&&!f?a.fillText(s,d,A):(this.paintChar(s,d,A,m),f&&this.paintChar(f.fontChar,d+o*f.offset.x/h,A-o*f.offset.y/h,m))),y=v?E*w-r*l:E*w+r*l,M+=y,n&&a.restore()}v?e.y-=M:e.x+=M*f,a.restore(),this.compose()}showType3Text(t){const e=this.ctx,i=this.current,n=i.font,s=i.fontSize,o=i.fontDirection,a=n.vertical?1:-1,h=i.charSpacing,c=i.wordSpacing,u=i.textHScale*o,l=i.fontMatrix||r.FONT_IDENTITY_MATRIX,f=t.length;let d,v,p,b;if(i.textRenderingMode!==r.TextRenderingMode.INVISIBLE&&0!==s){for(this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null,e.save(),e.transform(...i.textMatrix),e.translate(i.x,i.y),e.scale(u,o),d=0;d<f;++d){if(v=t[d],"number"==typeof v){b=a*v*s/1e3,this.ctx.translate(b,0),i.x+=b*u;continue}const o=(v.isSpace?c:0)+h,f=n.charProcOperatorList[v.operatorListId];f?(this.contentVisible&&(this.processingType3=v,this.save(),e.scale(s,s),e.transform(...l),this.executeOperatorList(f),this.restore()),p=r.Util.applyTransform([v.width,0],l)[0]*s+o,e.translate(p,0),i.x+=p*u):(0,r.warn)(`Type3 character "${v.operatorListId}" is not available.`)}e.restore(),this.processingType3=null}}setCharWidth(t,e){}setCharWidthAndBounds(t,e,i,n,r,s){this.ctx.rect(i,n,r-i,s-n),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let e;if("TilingPattern"===t[0]){const i=t[1],r=this.baseTransform||(0,n.getCurrentTransform)(this.ctx);e=new s.TilingPattern(t,i,this.ctx,{createCanvasGraphics:t=>new _(t,this.commonObjs,this.objs,this.canvasFactory)},r)}else e=this._getPattern(t[1],t[2]);return e}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,e,i){var n;const s=(null===(n=this.selectColor)||void 0===n?void 0:n.call(this,t,e,i))||r.Util.makeHexColor(t,e,i);this.ctx.strokeStyle=s,this.current.strokeColor=s}setFillRGBColor(t,e,i){var n;const s=(null===(n=this.selectColor)||void 0===n?void 0:n.call(this,t,e,i))||r.Util.makeHexColor(t,e,i);this.ctx.fillStyle=s,this.current.fillColor=s,this.current.patternFill=!1}_getPattern(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.cachedPatterns.has(t)?e=this.cachedPatterns.get(t):(e=(0,s.getShadingPattern)(this.objs.get(t)),this.cachedPatterns.set(t,e)),i&&(e.matrix=i),e}shadingFill(t){if(!this.contentVisible)return;const e=this.ctx;this.save();const i=this._getPattern(t);e.fillStyle=i.getPattern(e,this,(0,n.getCurrentTransformInverse)(e),s.PathType.SHADING);const o=(0,n.getCurrentTransformInverse)(e);if(o){const t=e.canvas,i=t.width,n=t.height,s=r.Util.applyTransform([0,0],o),a=r.Util.applyTransform([0,n],o),h=r.Util.applyTransform([i,0],o),c=r.Util.applyTransform([i,n],o),u=Math.min(s[0],a[0],h[0],c[0]),l=Math.min(s[1],a[1],h[1],c[1]),f=Math.max(s[0],a[0],h[0],c[0]),d=Math.max(s[1],a[1],h[1],c[1]);this.ctx.fillRect(u,l,f-u,d-l)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){(0,r.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,r.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(t,e){this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(t)&&6===t.length&&this.transform(...t),this.baseTransform=(0,n.getCurrentTransform)(this.ctx),e)&&(this.ctx.rect(e[0],e[1],e[2]-e[0],e[3]-e[1]),this.current.updateRectMinMax((0,n.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,r.info)("TODO: Support non-isolated groups."),t.knockout&&(0,r.warn)("Knockout groups not supported.");const i=(0,n.getCurrentTransform)(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let s=r.Util.getAxialAlignedBoundingBox(t.bbox,(0,n.getCurrentTransform)(e));s=r.Util.intersect(s,[0,0,e.canvas.width,e.canvas.height])||[0,0,0,0];const o=Math.floor(s[0]),a=Math.floor(s[1]);let h=Math.max(Math.ceil(s[2])-o,1),u=Math.max(Math.ceil(s[3])-a,1),l=1,f=1;h>c&&(l=h/c,h=c),u>c&&(f=u/c,u=c),this.current.startNewPathAndClipBox([0,0,h,u]);let d="groupAt"+this.groupLevel;t.smask&&(d+="_smask_"+this.smaskCounter++%2);const v=this.cachedCanvases.getCanvas(d,h,u),p=v.context;p.scale(1/l,1/f),p.translate(-o,-a),p.transform(...i),t.smask?this.smaskStack.push({canvas:v.canvas,context:p,offsetX:o,offsetY:a,scaleX:l,scaleY:f,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,a),e.scale(l,f),e.save()),w(e,p),this.ctx=p,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,i=this.groupStack.pop();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const t=(0,n.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...t);const i=r.Util.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],t);this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(i)}}beginAnnotation(t,e,i,s,o){if(h(this,T,O).call(this),g(this.ctx,this.foregroundColor),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(e)&&4===e.length){const s=e[2]-e[0],a=e[3]-e[1];if(o&&this.annotationCanvasMap){(i=i.slice())[4]-=e[0],i[5]-=e[1],(e=e.slice())[0]=e[1]=0,e[2]=s,e[3]=a;const[o,h]=r.Util.singularValueDecompose2dScale((0,n.getCurrentTransform)(this.ctx)),{viewportScale:c}=this,u=Math.ceil(s*this.outputScaleX*c),l=Math.ceil(a*this.outputScaleY*c);this.annotationCanvas=this.canvasFactory.create(u,l);const{canvas:f,context:d}=this.annotationCanvas;this.annotationCanvasMap.set(t,f),this.annotationCanvas.savedCtx=this.ctx,this.ctx=d,this.ctx.setTransform(o,0,0,-h,0,a*h),g(this.ctx,this.foregroundColor)}else g(this.ctx,this.foregroundColor),this.ctx.rect(e[0],e[1],s,a),this.ctx.clip(),this.endPath()}this.current=new v(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),this.transform(...s)}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 i=this.ctx,n=this.processingType3;if(n&&(void 0===n.compiled&&(n.compiled=function(t){const{width:e,height:i}=t;if(e>u||i>u)return null;const n=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),r=e+1;let s,o,a,h=new Uint8Array(r*(i+1));const c=e+7&-8;let l=new Uint8Array(c*i),f=0;for(const e of t.data){let t=128;for(;t>0;)l[f++]=e&t?0:255,t>>=1}let d=0;for(f=0,0!==l[f]&&(h[0]=1,++d),o=1;o<e;o++)l[f]!==l[f+1]&&(h[o]=l[f]?2:1,++d),f++;for(0!==l[f]&&(h[o]=2,++d),s=1;s<i;s++){f=s*c,a=s*r,l[f-c]!==l[f]&&(h[a]=l[f]?1:8,++d);let t=(l[f]?4:0)+(l[f-c]?8:0);for(o=1;o<e;o++)t=(t>>2)+(l[f+1]?4:0)+(l[f-c+1]?8:0),n[t]&&(h[a+o]=n[t],++d),f++;if(l[f-c]!==l[f]&&(h[a+o]=l[f]?2:4,++d),d>1e3)return null}for(f=c*(i-1),a=s*r,0!==l[f]&&(h[a]=8,++d),o=1;o<e;o++)l[f]!==l[f+1]&&(h[a+o]=l[f]?4:8,++d),f++;if(0!==l[f]&&(h[a+o]=4,++d),d>1e3)return null;const v=new Int32Array([0,r,-1,0,-r,0,0,0,1]),p=new Path2D;for(s=0;d&&s<=i;s++){let t=s*r;const i=t+e;for(;t<i&&!h[t];)t++;if(t===i)continue;p.moveTo(t%r,s);const n=t;let o=h[t];do{const e=v[o];do{t+=e}while(!h[t]);const i=h[t];5!==i&&10!==i?(o=i,h[t]=0):(o=i&51*o>>4,h[t]&=o>>2|o<<2),p.lineTo(t%r,t/r|0),h[t]||--d}while(n!==t);--s}return l=null,h=null,function(t){t.save(),t.scale(1/e,-1/i),t.translate(0,-i),t.fill(p),t.beginPath(),t.restore()}}(t)),n.compiled))return void n.compiled(i);const r=this._createMaskCanvas(t),s=r.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(s,r.offsetX,r.offsetY),i.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0;if(!this.contentVisible)return;t=this.getObject(t.data,t);const h=this.ctx;h.save();const c=(0,n.getCurrentTransform)(h);h.transform(e,i,s,o,0,0);const u=this._createMaskCanvas(t);h.setTransform(1,0,0,1,0,0);for(let t=0,n=a.length;t<n;t+=2){const n=r.Util.transform(c,[e,i,s,o,a[t],a[t+1]]),[l,f]=r.Util.applyTransform([0,0],n);h.drawImage(u.canvas,l,f)}h.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const e=this.ctx,i=this.current.fillColor,r=this.current.patternFill;for(const o of t){const{data:t,width:a,height:h,transform:c}=o,u=this.cachedCanvases.getCanvas("maskCanvas",a,h),l=u.context;l.save(),b(l,this.getObject(t,o)),l.globalCompositeOperation="source-in",l.fillStyle=r?i.getPattern(l,this,(0,n.getCurrentTransformInverse)(e),s.PathType.FILL):i,l.fillRect(0,0,a,h),l.restore(),e.save(),e.transform(...c),e.scale(1,-1),d(e,u.canvas,0,0,a,h,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const e=this.getObject(t);e?this.paintInlineImageXObject(e):(0,r.warn)("Dependent image isn't ready yet")}paintImageXObjectRepeat(t,e,i,n){if(!this.contentVisible)return;const s=this.getObject(t);if(!s)return void(0,r.warn)("Dependent image isn't ready yet");const o=s.width,a=s.height,h=[];for(let t=0,r=n.length;t<r;t+=2)h.push({transform:[e,0,0,i,n[t],n[t+1]],x:0,y:0,w:o,h:a});this.paintInlineImageXObjectGroup(s,h)}paintInlineImageXObject(t){if(!this.contentVisible)return;const e=t.width,i=t.height,s=this.ctx;let o;if(this.save(),s.scale(1/e,-1/i),"function"==typeof HTMLElement&&t instanceof HTMLElement||!t.data)o=t;else{const n=this.cachedCanvases.getCanvas("inlineImage",e,i);p(n.context,t,this.current.transferMaps),o=n.canvas}const a=this._scaleImage(o,(0,n.getCurrentTransformInverse)(s));s.imageSmoothingEnabled=k((0,n.getCurrentTransform)(s),t.interpolate);const[h,c]=d(s,a.img,0,0,a.paintWidth,a.paintHeight,0,-i,e,i);if(this.imageLayer){const[e,s]=r.Util.applyTransform([0,-i],(0,n.getCurrentTransform)(this.ctx));this.imageLayer.appendImage({imgData:t,left:e,top:s,width:h,height:c})}this.compose(),this.restore()}paintInlineImageXObjectGroup(t,e){if(!this.contentVisible)return;const i=this.ctx,s=t.width,o=t.height,a=this.cachedCanvases.getCanvas("inlineImage",s,o);p(a.context,t,this.current.transferMaps);for(const h of e){if(i.save(),i.transform(...h.transform),i.scale(1,-1),d(i,a.canvas,h.x,h.y,h.w,h.h,0,-1,1,1),this.imageLayer){const[e,i]=r.Util.applyTransform([h.x,h.y],(0,n.getCurrentTransform)(this.ctx));this.imageLayer.appendImage({imgData:t,left:e,top:i,width:s,height:o})}i.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){this.markedContentStack.push("OC"===t?{visible:this.optionalContentConfig.isVisible(e)}:{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 i=this.ctx;this.pendingClip&&(e||(this.pendingClip===x?i.clip("evenodd"):i.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),i.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=(0,n.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]),i=Math.hypot(t[0],t[2]),n=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(i,n)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(!this._cachedScaleForStroking){const{lineWidth:t}=this.current,e=(0,n.getCurrentTransform)(this.ctx);let i,r;if(0===e[1]&&0===e[2]){const n=Math.abs(e[0]),s=Math.abs(e[3]);if(0===t)i=1/n,r=1/s;else{const e=n*t,o=s*t;i=e<1?1/e:1,r=o<1?1/o:1}}else{const n=Math.abs(e[0]*e[3]-e[2]*e[1]),s=Math.hypot(e[0],e[1]),o=Math.hypot(e[2],e[3]);if(0===t)i=o/n,r=s/n;else{const e=t*n;i=o>e?o/e:1,r=s>e?s/e:1}}this._cachedScaleForStroking=[i,r]}return this._cachedScaleForStroking}rescaleAndStroke(t){const{ctx:e}=this,{lineWidth:i}=this.current,[r,s]=this.getScaleForStroking();if(e.lineWidth=i||1,1===r&&1===s)return void e.stroke();let o,a,h;t&&(o=(0,n.getCurrentTransform)(e),a=e.getLineDash().slice(),h=e.lineDashOffset),e.scale(r,s);const c=Math.max(r,s);e.setLineDash(e.getLineDash().map((t=>t/c))),e.lineDashOffset/=c,e.stroke(),t&&(e.setTransform(...o),e.setLineDash(a),e.lineDashOffset=h)}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}}function O(){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)}e.CanvasGraphics=_;for(const t in r.OPS)void 0!==_.prototype[t]&&(_.prototype[r.OPS[t]]=_.prototype[t])},(t,e,i)=>{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 f(t);case"Dummy":return new d}throw new Error(`Unknown IR type: ${t[0]}`)};var n=i(1),r=i(133),s=i(3);const o={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function a(t,e){if(!e||s.isNodeJS)return;const i=e[2]-e[0],n=e[3]-e[1],r=new Path2D;r.rect(e[0],e[1],i,n),t.clip(r)}e.PathType=o;class h{constructor(){this.constructor===h&&(0,n.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,n.unreachable)("Abstract method `getPattern` called.")}}class c extends h{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 t of this._colorStops)e.addColorStop(t[0],t[1]);return e}getPattern(t,e,i,s){let h;if(s===o.STROKE||s===o.FILL){const o=e.current.getClippedPathBoundingBox(s,(0,r.getCurrentTransform)(t))||[0,0,0,0],c=Math.ceil(o[2]-o[0])||1,u=Math.ceil(o[3]-o[1])||1,l=e.cachedCanvases.getCanvas("pattern",c,u,!0),f=l.context;f.clearRect(0,0,f.canvas.width,f.canvas.height),f.beginPath(),f.rect(0,0,f.canvas.width,f.canvas.height),f.translate(-o[0],-o[1]),i=n.Util.transform(i,[1,0,0,1,o[0],o[1]]),f.transform(...e.baseTransform),this.matrix&&f.transform(...this.matrix),a(f,this._bbox),f.fillStyle=this._createGradient(f),f.fill(),h=t.createPattern(l.canvas,"no-repeat");const d=new DOMMatrix(i);try{h.setTransform(d)}catch(t){(0,n.warn)(`RadialAxialShadingPattern.getPattern: "${null==t?void 0:t.message}".`)}}else a(t,this._bbox),h=this._createGradient(t);return h}}function u(t,e,i,n,r,s,o,a){const h=e.coords,c=e.colors,u=t.data,l=4*t.width;let f;h[i+1]>h[n+1]&&(f=i,i=n,n=f,f=s,s=o,o=f),h[n+1]>h[r+1]&&(f=n,n=r,r=f,f=o,o=a,a=f),h[i+1]>h[n+1]&&(f=i,i=n,n=f,f=s,s=o,o=f);const d=(h[i]+e.offsetX)*e.scaleX,v=(h[i+1]+e.offsetY)*e.scaleY,p=(h[n]+e.offsetX)*e.scaleX,b=(h[n+1]+e.offsetY)*e.scaleY,w=(h[r]+e.offsetX)*e.scaleX,g=(h[r+1]+e.offsetY)*e.scaleY;if(v>=g)return;const m=c[s],A=c[s+1],y=c[s+2],k=c[o],M=c[o+1],E=c[o+2],S=c[a],x=c[a+1],T=c[a+2],_=Math.round(v),O=Math.round(g);let C,R,j,P,D,I,F,L;for(let t=_;t<=O;t++){if(t<b){let e;e=t<v?0:(v-t)/(v-b),C=d-(d-p)*e,R=m-(m-k)*e,j=A-(A-M)*e,P=y-(y-E)*e}else{let e;e=t>g?1:b===g?0:(b-t)/(b-g),C=p-(p-w)*e,R=k-(k-S)*e,j=M-(M-x)*e,P=E-(E-T)*e}let e;e=t<v?0:t>g?1:(v-t)/(v-g),D=d-(d-w)*e,I=m-(m-S)*e,F=A-(A-x)*e,L=y-(y-T)*e;const i=Math.round(Math.min(C,D)),n=Math.round(Math.max(C,D));let r=l*t+4*i;for(let t=i;t<=n;t++)e=(C-t)/(C-D),e<0?e=0:e>1&&(e=1),u[r++]=R-(R-I)*e|0,u[r++]=j-(j-F)*e|0,u[r++]=P-(P-L)*e|0,u[r++]=255}}function l(t,e,i){const n=e.coords,r=e.colors;let s,o;switch(e.type){case"lattice":const a=e.verticesPerRow,h=Math.floor(n.length/a)-1,c=a-1;for(s=0;s<h;s++){let e=s*a;for(let s=0;s<c;s++,e++)u(t,i,n[e],n[e+1],n[e+a],r[e],r[e+1],r[e+a]),u(t,i,n[e+a+1],n[e+1],n[e+a],r[e+a+1],r[e+1],r[e+a])}break;case"triangles":for(s=0,o=n.length;s<o;s+=3)u(t,i,n[s],n[s+1],n[s+2],r[s],r[s+1],r[s+2]);break;default:throw new Error("illegal figure")}}class f extends h{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,i){const n=Math.floor(this._bounds[0]),r=Math.floor(this._bounds[1]),s=Math.ceil(this._bounds[2])-n,o=Math.ceil(this._bounds[3])-r,a=Math.min(Math.ceil(Math.abs(s*t[0]*1.1)),3e3),h=Math.min(Math.ceil(Math.abs(o*t[1]*1.1)),3e3),c=s/a,u=o/h,f={coords:this._coords,colors:this._colors,offsetX:-n,offsetY:-r,scaleX:1/c,scaleY:1/u},d=i.getCanvas("mesh",a+4,h+4,!1),v=d.context,p=v.createImageData(a,h);if(e){const t=p.data;for(let i=0,n=t.length;i<n;i+=4)t[i]=e[0],t[i+1]=e[1],t[i+2]=e[2],t[i+3]=255}for(const t of this._figures)l(p,t,f);return v.putImageData(p,2,2),{canvas:d.canvas,offsetX:n-2*c,offsetY:r-2*u,scaleX:c,scaleY:u}}getPattern(t,e,i,s){let h;if(a(t,this._bbox),s===o.SHADING)h=n.Util.singularValueDecompose2dScale((0,r.getCurrentTransform)(t));else if(h=n.Util.singularValueDecompose2dScale(e.baseTransform),this.matrix){const t=n.Util.singularValueDecompose2dScale(this.matrix);h=[h[0]*t[0],h[1]*t[1]]}const c=this._createMeshCanvas(h,s===o.SHADING?null:this._background,e.cachedCanvases);return s!==o.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 d extends h{getPattern(){return"hotpink"}}class v{static get MAX_PATTERN_SIZE(){return(0,n.shadow)(this,"MAX_PATTERN_SIZE",3e3)}constructor(t,e,i,n,r){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=i,this.canvasGraphicsFactory=n,this.baseTransform=r}createPatternCanvas(t){const e=this.operatorList,i=this.bbox,s=this.xstep,o=this.ystep,a=this.paintType,h=this.color,c=this.canvasGraphicsFactory;(0,n.info)("TilingType: "+this.tilingType);const u=i[0],l=i[1],f=i[2],d=i[3],v=n.Util.singularValueDecompose2dScale(this.matrix),p=n.Util.singularValueDecompose2dScale(this.baseTransform),b=[v[0]*p[0],v[1]*p[1]],w=this.getSizeAndScale(s,this.ctx.canvas.width,b[0]),g=this.getSizeAndScale(o,this.ctx.canvas.height,b[1]),m=t.cachedCanvases.getCanvas("pattern",w.size,g.size,!0),A=m.context,y=c.createCanvasGraphics(A);y.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(y,a,h);let k=u,M=l,E=f,S=d;return u<0&&(k=0,E+=Math.abs(u)),l<0&&(M=0,S+=Math.abs(l)),A.translate(-w.scale*k,-g.scale*M),y.transform(w.scale,0,0,g.scale,0,0),A.save(),this.clipBbox(y,k,M,E,S),y.baseTransform=(0,r.getCurrentTransform)(y.ctx),y.executeOperatorList(e),y.endDrawing(),{canvas:m.canvas,scaleX:w.scale,scaleY:g.scale,offsetX:k,offsetY:M}}getSizeAndScale(t,e,i){t=Math.abs(t);const n=Math.max(v.MAX_PATTERN_SIZE,e);let r=Math.ceil(t*i);return r>=n?r=n:i=r/t,{scale:i,size:r}}clipBbox(t,e,i,n,s){t.ctx.rect(e,i,n-e,s-i),t.current.updateRectMinMax((0,r.getCurrentTransform)(t.ctx),[e,i,n,s]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){const r=t.ctx,s=t.current;switch(e){case 1:const t=this.ctx;r.fillStyle=t.fillStyle,r.strokeStyle=t.strokeStyle,s.fillColor=t.fillStyle,s.strokeColor=t.strokeStyle;break;case 2:const o=n.Util.makeHexColor(i[0],i[1],i[2]);r.fillStyle=o,r.strokeStyle=o,s.fillColor=o,s.strokeColor=o;break;default:throw new n.FormatError(`Unsupported paint type: ${e}`)}}getPattern(t,e,i,r){let s=i;r!==o.SHADING&&(s=n.Util.transform(s,e.baseTransform),this.matrix&&(s=n.Util.transform(s,this.matrix)));const a=this.createPatternCanvas(e);let h=new DOMMatrix(s);h=h.translate(a.offsetX,a.offsetY),h=h.scale(1/a.scaleX,1/a.scaleY);const c=t.createPattern(a.canvas,"repeat");try{c.setTransform(h)}catch(t){(0,n.warn)(`TilingPattern.getPattern: "${null==t?void 0:t.message}".`)}return c}}e.TilingPattern=v},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.applyMaskImageData=function(t){let{src:e,srcPos:i=0,dest:r,destPos:s=0,width:o,height:a,inverseDecode:h=!1}=t;const c=n.FeatureTest.isLittleEndian?4278190080:255,[u,l]=h?[0,c]:[c,0],f=o>>3,d=7&o,v=e.length;r=new Uint32Array(r.buffer);for(let t=0;t<a;t++){for(const t=i+f;i<t;i++){const t=i<v?e[i]:255;r[s++]=128&t?l:u,r[s++]=64&t?l:u,r[s++]=32&t?l:u,r[s++]=16&t?l:u,r[s++]=8&t?l:u,r[s++]=4&t?l:u,r[s++]=2&t?l:u,r[s++]=1&t?l:u}if(0===d)continue;const t=i<v?e[i++]:255;for(let e=0;e<d;e++)r[s++]=t&1<<7-e?l:u}return{srcPos:i,destPos:s}};var n=i(1)},(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalWorkerOptions=void 0;const i=Object.create(null);e.GlobalWorkerOptions=i,i.workerPort=void 0===i.workerPort?null:i.workerPort,i.workerSrc=void 0===i.workerSrc?"":i.workerSrc},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MessageHandler=void 0;var n=i(1);function r(t){switch(t instanceof Error||"object"==typeof t&&null!==t||(0,n.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new n.AbortException(t.message);case"MissingPDFException":return new n.MissingPDFException(t.message);case"PasswordException":return new n.PasswordException(t.message,t.code);case"UnexpectedResponseException":return new n.UnexpectedResponseException(t.message,t.status);case"UnknownErrorException":return new n.UnknownErrorException(t.message,t.details);default:return new n.UnknownErrorException(t.message,t.toString())}}e.MessageHandler=class{constructor(t,e,i){this.sourceName=t,this.targetName=e,this.comObj=i,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,i=this.callbackCapabilities[t];if(!i)throw new Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],1===e.callback)i.resolve(e.data);else{if(2!==e.callback)throw new Error("Unexpected callback case");i.reject(r(e.reason))}return}const n=this.actionHandler[e.action];if(!n)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const t=this.sourceName,s=e.sourceName;new Promise((function(t){t(n(e.data))})).then((function(n){i.postMessage({sourceName:t,targetName:s,callback:1,callbackId:e.callbackId,data:n})}),(function(n){i.postMessage({sourceName:t,targetName:s,callback:2,callbackId:e.callbackId,reason:r(n)})}))}else e.streamId?this._createStreamSink(e):n(e.data)},i.addEventListener("message",this._onComObjOnMessage)}on(t,e){const i=this.actionHandler;if(i[t])throw new Error(`There is already an actionName called "${t}"`);i[t]=e}send(t,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},i)}sendWithPromise(t,e,i){const r=this.callbackId++,s=(0,n.createPromiseCapability)();this.callbackCapabilities[r]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:r,data:e},i)}catch(t){s.reject(t)}return s.promise}sendWithStream(t,e,i,s){const o=this.streamId++,a=this.sourceName,h=this.targetName,c=this.comObj;return new ReadableStream({start:i=>{const r=(0,n.createPromiseCapability)();return this.streamControllers[o]={controller:i,startCall:r,pullCall:null,cancelCall:null,isClosed:!1},c.postMessage({sourceName:a,targetName:h,action:t,streamId:o,data:e,desiredSize:i.desiredSize},s),r.promise},pull:t=>{const e=(0,n.createPromiseCapability)();return this.streamControllers[o].pullCall=e,c.postMessage({sourceName:a,targetName:h,stream:6,streamId:o,desiredSize:t.desiredSize}),e.promise},cancel:t=>{(0,n.assert)(t instanceof Error,"cancel must have a valid reason");const e=(0,n.createPromiseCapability)();return this.streamControllers[o].cancelCall=e,this.streamControllers[o].isClosed=!0,c.postMessage({sourceName:a,targetName:h,stream:1,streamId:o,reason:r(t)}),e.promise}},i)}_createStreamSink(t){const e=t.streamId,i=this.sourceName,s=t.sourceName,o=this.comObj,a=this,h=this.actionHandler[t.action],c={enqueue(t){let r=arguments.length>2?arguments[2]:void 0;if(this.isCancelled)return;const a=this.desiredSize;this.desiredSize-=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a>0&&this.desiredSize<=0&&(this.sinkCapability=(0,n.createPromiseCapability)(),this.ready=this.sinkCapability.promise),o.postMessage({sourceName:i,targetName:s,stream:4,streamId:e,chunk:t},r)},close(){this.isCancelled||(this.isCancelled=!0,o.postMessage({sourceName:i,targetName:s,stream:3,streamId:e}),delete a.streamSinks[e])},error(t){(0,n.assert)(t instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,o.postMessage({sourceName:i,targetName:s,stream:5,streamId:e,reason:r(t)}))},sinkCapability:(0,n.createPromiseCapability)(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};c.sinkCapability.resolve(),c.ready=c.sinkCapability.promise,this.streamSinks[e]=c,new Promise((function(e){e(h(t.data,c))})).then((function(){o.postMessage({sourceName:i,targetName:s,stream:8,streamId:e,success:!0})}),(function(t){o.postMessage({sourceName:i,targetName:s,stream:8,streamId:e,reason:r(t)})}))}_processStreamMessage(t){const e=t.streamId,i=this.sourceName,s=t.sourceName,o=this.comObj,a=this.streamControllers[e],h=this.streamSinks[e];switch(t.stream){case 8:t.success?a.startCall.resolve():a.startCall.reject(r(t.reason));break;case 7:t.success?a.pullCall.resolve():a.pullCall.reject(r(t.reason));break;case 6:if(!h){o.postMessage({sourceName:i,targetName:s,stream:7,streamId:e,success:!0});break}h.desiredSize<=0&&t.desiredSize>0&&h.sinkCapability.resolve(),h.desiredSize=t.desiredSize,new Promise((function(t){t(h.onPull&&h.onPull())})).then((function(){o.postMessage({sourceName:i,targetName:s,stream:7,streamId:e,success:!0})}),(function(t){o.postMessage({sourceName:i,targetName:s,stream:7,streamId:e,reason:r(t)})}));break;case 4:if((0,n.assert)(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(t.chunk);break;case 3:if((0,n.assert)(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),this._deleteStreamController(a,e);break;case 5:(0,n.assert)(a,"error should have stream controller"),a.controller.error(r(t.reason)),this._deleteStreamController(a,e);break;case 2:t.success?a.cancelCall.resolve():a.cancelCall.reject(r(t.reason)),this._deleteStreamController(a,e);break;case 1:if(!h)break;new Promise((function(e){e(h.onCancel&&h.onCancel(r(t.reason)))})).then((function(){o.postMessage({sourceName:i,targetName:s,stream:2,streamId:e,success:!0})}),(function(t){o.postMessage({sourceName:i,targetName:s,stream:2,streamId:e,reason:r(t)})})),h.sinkCapability.reject(r(t.reason)),h.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,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Metadata=void 0;var n=i(1);function r(t,e,i){!function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}(t,e),e.set(t,i)}function s(t,e){return function(t,e){return e.get?e.get.call(t):e.value}(t,a(t,e,"get"))}function o(t,e,i){return function(t,e,i){if(e.set)e.set.call(t,i);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=i}}(t,a(t,e,"set"),i),i}function a(t,e,i){if(!e.has(t))throw new TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}var h=new WeakMap,c=new WeakMap;e.Metadata=class{constructor(t){let{parsedData:e,rawData:i}=t;r(this,h,{writable:!0,value:void 0}),r(this,c,{writable:!0,value:void 0}),o(this,h,e),o(this,c,i)}getRaw(){return s(this,c)}get(t){var e;return null!==(e=s(this,h).get(t))&&void 0!==e?e:null}getAll(){return(0,n.objectFromMap)(s(this,h))}has(t){return s(this,h).has(t)}}},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OptionalContentConfig=void 0;var n=i(1);function r(t,e,i){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return i}function s(t,e,i){o(t,e),e.set(t,i)}function o(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function a(t,e,i){return function(t,e,i){if(e.set)e.set.call(t,i);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=i}}(t,c(t,e,"set"),i),i}function h(t,e){return function(t,e){return e.get?e.get.call(t):e.value}(t,c(t,e,"get"))}function c(t,e,i){if(!e.has(t))throw new TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}const u=Symbol("INTERNAL");var l=new WeakMap;class f{constructor(t,e){s(this,l,{writable:!0,value:!0}),this.name=t,this.intent=e}get visible(){return h(this,l)}_setVisible(t,e){t!==u&&(0,n.unreachable)("Internal method `_setVisible` called."),a(this,l,e)}}var d=new WeakMap,v=new WeakMap,p=new WeakMap,b=new WeakMap,w=new WeakSet;function g(t){const e=t.length;if(e<2)return!0;const i=t[0];for(let s=1;s<e;s++){const e=t[s];let o;if(Array.isArray(e))o=r(this,w,g).call(this,e);else{if(!h(this,v).has(e))return(0,n.warn)(`Optional content group not found: ${e}`),!0;o=h(this,v).get(e).visible}switch(i){case"And":if(!o)return!1;break;case"Or":if(o)return!0;break;case"Not":return!o;default:return!0}}return"And"===i}e.OptionalContentConfig=class{constructor(t){var e;if(o(this,e=w),e.add(this),s(this,d,{writable:!0,value:!0}),s(this,v,{writable:!0,value:new Map}),s(this,p,{writable:!0,value:null}),s(this,b,{writable:!0,value:null}),this.name=null,this.creator=null,null!==t){this.name=t.name,this.creator=t.creator,a(this,b,t.order);for(const e of t.groups)h(this,v).set(e.id,new f(e.name,e.intent));if("OFF"===t.baseState)for(const t of h(this,v).values())t._setVisible(u,!1);for(const e of t.on)h(this,v).get(e)._setVisible(u,!0);for(const e of t.off)h(this,v).get(e)._setVisible(u,!1);a(this,p,new Map);for(const[t,e]of h(this,v))h(this,p).set(t,e.visible)}}isVisible(t){if(0===h(this,v).size)return!0;if(!t)return(0,n.warn)("Optional content group not defined."),!0;if("OCG"===t.type)return h(this,v).has(t.id)?h(this,v).get(t.id).visible:((0,n.warn)(`Optional content group not found: ${t.id}`),!0);if("OCMD"===t.type){if(t.expression)return r(this,w,g).call(this,t.expression);if(!t.policy||"AnyOn"===t.policy){for(const e of t.ids){if(!h(this,v).has(e))return(0,n.warn)(`Optional content group not found: ${e}`),!0;if(h(this,v).get(e).visible)return!0}return!1}if("AllOn"===t.policy){for(const e of t.ids){if(!h(this,v).has(e))return(0,n.warn)(`Optional content group not found: ${e}`),!0;if(!h(this,v).get(e).visible)return!1}return!0}if("AnyOff"===t.policy){for(const e of t.ids){if(!h(this,v).has(e))return(0,n.warn)(`Optional content group not found: ${e}`),!0;if(!h(this,v).get(e).visible)return!0}return!1}if("AllOff"===t.policy){for(const e of t.ids){if(!h(this,v).has(e))return(0,n.warn)(`Optional content group not found: ${e}`),!0;if(h(this,v).get(e).visible)return!1}return!0}return(0,n.warn)(`Unknown optional content policy ${t.policy}.`),!0}return(0,n.warn)(`Unknown group type ${t.type}.`),!0}setVisibility(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];h(this,v).has(t)?(h(this,v).get(t)._setVisible(u,!!e),a(this,d,null)):(0,n.warn)(`Optional content group not found: ${t}`)}get hasInitialVisibility(){if(null!==h(this,d))return h(this,d);for(const[t,e]of h(this,v)){const i=h(this,p).get(t);if(e.visible!==i)return a(this,d,!1)}return a(this,d,!0)}getOrder(){return h(this,v).size?h(this,b)?h(this,b).slice():[...h(this,v).keys()]:null}getGroups(){return h(this,v).size>0?(0,n.objectFromMap)(h(this,v)):null}getGroup(t){return h(this,v).get(t)||null}}},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PDFDataTransportStream=void 0;var n=i(1),r=i(133);e.PDFDataTransportStream=class{constructor(t,e){(0,n.assert)(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'),this._queuedChunks=[],this._progressiveDone=t.progressiveDone||!1,this._contentDispositionFilename=t.contentDispositionFilename||null;const i=t.initialData;if((null==i?void 0:i.length)>0){const t=new Uint8Array(i).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 i=this._rangeReaders.some((function(i){return i._begin===t.begin&&(i._enqueue(e),!0)}));(0,n.assert)(i,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var t,e;return null!==(t=null===(e=this._fullRequestReader)||void 0===e?void 0:e._loaded)&&void 0!==t?t:0}_onProgress(t){if(void 0===t.total){const e=this._rangeReaders[0];null!=e&&e.onProgress&&e.onProgress({loaded:t.loaded})}else{const e=this._fullRequestReader;null!=e&&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,n.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new s(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new o(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader&&this._fullRequestReader.cancel(t);for(const e of this._rangeReaders.slice(0))e.cancel(t);this._pdfDataRangeTransport.abort()}};class s{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this._stream=t,this._done=i||!1,this._filename=(0,r.isPdfFile)(n)?n:null,this._queuedChunks=e||[],this._loaded=0;for(const t of this._queuedChunks)this._loaded+=t.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,n.createPromiseCapability)();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class o{constructor(t,e,i){this._stream=t,this._begin=e,this._end=i,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,n.createPromiseCapability)();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const t of this._requests)t.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 i{static textContent(t){const e=[],n={items:e,styles:Object.create(null)};return function t(n){var r;if(!n)return;let s=null;const o=n.name;if("#text"===o)s=n.value;else{if(!i.shouldBuildText(o))return;null!=n&&null!==(r=n.attributes)&&void 0!==r&&r.textContent?s=n.attributes.textContent:n.value&&(s=n.value)}if(null!==s&&e.push({str:s}),n.children)for(const e of n.children)t(e)}(t),n}static shouldBuildText(t){return!("textarea"===t||"input"===t||"option"===t||"select"===t)}}e.XfaText=i},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NodeStandardFontDataFactory=e.NodeCanvasFactory=e.NodeCMapReaderFactory=void 0;var n=i(134);const r=function(t){return new Promise(((e,i)=>{E.readFile(t,((t,n)=>{!t&&n?e(new Uint8Array(n)):i(new Error(t))}))}))};e.NodeCanvasFactory=class extends n.BaseCanvasFactory{_createCanvas(t,e){return E.createCanvas(t,e)}},e.NodeCMapReaderFactory=class extends n.BaseCMapReaderFactory{_fetchData(t,e){return r(t).then((t=>({cMapData:t,compressionType:e})))}},e.NodeStandardFontDataFactory=class extends n.BaseStandardFontDataFactory{_fetchData(t){return r(t)}}},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AnnotationEditorLayer=void 0;var n=i(132),r=i(1),s=i(148),o=i(149);function a(t,e){c(t,e),e.add(t)}function h(t,e,i){c(t,e),e.set(t,i)}function c(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function u(t,e,i){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return i}function l(t,e){return function(t,e){return e.get?e.get.call(t):e.value}(t,d(t,e,"get"))}function f(t,e,i){return function(t,e,i){if(e.set)e.set.call(t,i);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=i}}(t,d(t,e,"set"),i),i}function d(t,e,i){if(!e.has(t))throw new TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}var v,p,b,w=new WeakMap,g=new WeakMap,m=new WeakMap,A=new WeakMap,y=new WeakMap,k=new WeakMap,M=new WeakMap,E=new WeakMap,S=new WeakSet,x=new WeakSet,T=new WeakSet,_=new WeakSet;class O{constructor(t){a(this,_),a(this,T),a(this,x),a(this,S),h(this,w,{writable:!0,value:void 0}),h(this,g,{writable:!0,value:!1}),h(this,m,{writable:!0,value:this.pointerup.bind(this)}),h(this,A,{writable:!0,value:this.pointerdown.bind(this)}),h(this,y,{writable:!0,value:new Map}),h(this,k,{writable:!0,value:!1}),h(this,M,{writable:!0,value:!1}),h(this,E,{writable:!0,value:void 0}),O._initialized||(O._initialized=!0,s.FreeTextEditor.initialize(t.l10n),o.InkEditor.initialize(t.l10n),t.uiManager.registerEditorTypes([s.FreeTextEditor,o.InkEditor])),f(this,E,t.uiManager),this.annotationStorage=t.annotationStorage,this.pageIndex=t.pageIndex,this.div=t.div,f(this,w,t.accessibilityManager),l(this,E).addLayer(this)}updateToolbar(t){l(this,E).updateToolbar(t)}updateMode(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l(this,E).getMode();u(this,_,P).call(this),t===r.AnnotationEditorType.INK?(this.addInkEditorIfNeeded(!1),this.disableClick()):this.enableClick(),l(this,E).unselectAll()}addInkEditorIfNeeded(t){if(t||l(this,E).getMode()===r.AnnotationEditorType.INK){if(!t)for(const t of l(this,y).values())if(t.isEmpty())return void t.setInBackground();u(this,T,j).call(this,{offsetX:0,offsetY:0}).setInBackground()}}setEditingState(t){l(this,E).setEditingState(t)}addCommands(t){l(this,E).addCommands(t)}enable(){this.div.style.pointerEvents="auto";for(const t of l(this,y).values())t.enableEditing()}disable(){this.div.style.pointerEvents="none";for(const t of l(this,y).values())t.disableEditing()}setActiveEditor(t){l(this,E).getActive()!==t&&l(this,E).setActiveEditor(t)}enableClick(){this.div.addEventListener("pointerdown",l(this,A)),this.div.addEventListener("pointerup",l(this,m))}disableClick(){this.div.removeEventListener("pointerdown",l(this,A)),this.div.removeEventListener("pointerup",l(this,m))}attach(t){l(this,y).set(t.id,t)}detach(t){var e;l(this,y).delete(t.id),null===(e=l(this,w))||void 0===e||e.removePointerInTextLayer(t.contentDiv)}remove(t){l(this,E).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&&l(this,E).focusMainContainer()}),0),l(this,M)||this.addInkEditorIfNeeded(!1)}add(t){if(u(this,S,C).call(this,t),l(this,E).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=l(this,w))||void 0===e||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 l(this,E).getId()}deserialize(t){switch(t.annotationType){case r.AnnotationEditorType.FREETEXT:return s.FreeTextEditor.deserialize(t,this);case r.AnnotationEditorType.INK:return o.InkEditor.deserialize(t,this)}return null}setSelected(t){l(this,E).setSelected(t)}toggleSelected(t){l(this,E).toggleSelected(t)}isSelected(t){return l(this,E).isSelected(t)}unselect(t){l(this,E).unselect(t)}pointerup(t){0!==t.button||t.ctrlKey&&n.KeyboardManager.platform.isMac||t.target===this.div&&l(this,k)&&(f(this,k,!1),l(this,g)?u(this,T,j).call(this,t):f(this,g,!0))}pointerdown(t){if(0!==t.button||t.ctrlKey&&n.KeyboardManager.platform.isMac)return;if(t.target!==this.div)return;f(this,k,!0);const e=l(this,E).getActive();f(this,g,!e||e.isEmpty())}drop(t){const e=t.dataTransfer.getData("text/plain"),i=l(this,E).getEditor(e);if(!i)return;t.preventDefault(),t.dataTransfer.dropEffect="move",u(this,S,C).call(this,i);const n=this.div.getBoundingClientRect();i.translate(t.clientX-n.x-i.startX,t.clientY-n.y-i.startY),this.moveEditorInDOM(i),i.div.focus()}dragover(t){t.preventDefault()}destroy(){var t;(null===(t=l(this,E).getActive())||void 0===t?void 0:t.parent)===this&&l(this,E).setActiveEditor(null);for(const t of l(this,y).values()){var e;null===(e=l(this,w))||void 0===e||e.removePointerInTextLayer(t.contentDiv),t.isAttachedToDOM=!1,t.div.remove(),t.parent=null}this.div=null,l(this,y).clear(),l(this,E).removeLayer(this)}render(t){this.viewport=t.viewport,(0,n.bindEvents)(this,this.div,["dragover","drop"]),this.setDimensions();for(const t of l(this,E).getEditors(this.pageIndex))this.add(t);this.updateMode()}update(t){this.viewport=t.viewport,this.setDimensions(),this.updateMode()}get scaleFactor(){return this.viewport.scale}get pageDimensions(){const[t,e,i,n]=this.viewport.viewBox;return[i-t,n-e]}get viewportBaseDimensions(){const{width:t,height:e,rotation:i}=this.viewport;return i%180==0?[t,e]:[e,t]}setDimensions(){const{width:t,height:e,rotation:i}=this.viewport,n=i%180!=0,r=Math.floor(t)+"px",s=Math.floor(e)+"px";this.div.style.width=n?s:r,this.div.style.height=n?r:s,this.div.setAttribute("data-main-rotation",i)}}function C(t){var e;t.parent!==this&&(this.attach(t),t.pageIndex=this.pageIndex,null===(e=t.parent)||void 0===e||e.detach(t),t.parent=this,t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}function R(t){switch(l(this,E).getMode()){case r.AnnotationEditorType.FREETEXT:return new s.FreeTextEditor(t);case r.AnnotationEditorType.INK:return new o.InkEditor(t)}return null}function j(t){const e=this.getNextId(),i=u(this,x,R).call(this,{parent:this,id:e,x:t.offsetX,y:t.offsetY});return i&&this.add(i),i}function P(){f(this,M,!0);for(const t of l(this,y).values())t.isEmpty()&&t.remove();f(this,M,!1)}e.AnnotationEditorLayer=O,b=!1,(p="_initialized")in(v=O)?Object.defineProperty(v,p,{value:b,enumerable:!0,configurable:!0,writable:!0}):v[p]=b},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FreeTextEditor=void 0;var n=i(1),r=i(132),s=i(131);function o(t,e){c(t,e),e.add(t)}function a(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function h(t,e,i){c(t,e),e.set(t,i)}function c(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function u(t,e){return function(t,e){return e.get?e.get.call(t):e.value}(t,d(t,e,"get"))}function l(t,e,i){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return i}function f(t,e,i){return function(t,e,i){if(e.set)e.set.call(t,i);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=i}}(t,d(t,e,"set"),i),i}function d(t,e,i){if(!e.has(t))throw new TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}var v=new WeakMap,p=new WeakMap,b=new WeakMap,w=new WeakMap,g=new WeakMap,m=new WeakMap,A=new WeakMap,y=new WeakSet,k=new WeakSet,M=new WeakSet,E=new WeakSet;class S extends s.AnnotationEditor{constructor(t){super({...t,name:"freeTextEditor"}),o(this,E),o(this,M),o(this,k),o(this,y),h(this,v,{writable:!0,value:this.editorDivBlur.bind(this)}),h(this,p,{writable:!0,value:this.editorDivFocus.bind(this)}),h(this,b,{writable:!0,value:this.editorDivKeydown.bind(this)}),h(this,w,{writable:!0,value:void 0}),h(this,g,{writable:!0,value:""}),h(this,m,{writable:!0,value:!1}),h(this,A,{writable:!0,value:void 0}),f(this,w,t.color||S._defaultColor||s.AnnotationEditor._defaultLineColor),f(this,A,t.fontSize||S._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(t,e){switch(t){case n.AnnotationEditorParamsType.FREETEXT_SIZE:S._defaultFontSize=e;break;case n.AnnotationEditorParamsType.FREETEXT_COLOR:S._defaultColor=e}}updateParams(t,e){switch(t){case n.AnnotationEditorParamsType.FREETEXT_SIZE:l(this,y,x).call(this,e);break;case n.AnnotationEditorParamsType.FREETEXT_COLOR:l(this,k,T).call(this,e)}}static get defaultPropertiesToUpdate(){return[[n.AnnotationEditorParamsType.FREETEXT_SIZE,S._defaultFontSize],[n.AnnotationEditorParamsType.FREETEXT_COLOR,S._defaultColor||s.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[n.AnnotationEditorParamsType.FREETEXT_SIZE,u(this,A)],[n.AnnotationEditorParamsType.FREETEXT_COLOR,u(this,w)]]}getInitialTranslation(){return[-S._internalPadding*this.parent.scaleFactor,-(S._internalPadding+u(this,A))*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(n.AnnotationEditorType.FREETEXT),super.enableEditMode(),this.enableEditing(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this.div.draggable=!1,this.editorDiv.addEventListener("keydown",u(this,b)),this.editorDiv.addEventListener("focus",u(this,p)),this.editorDiv.addEventListener("blur",u(this,v)))}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",u(this,b)),this.editorDiv.removeEventListener("focus",u(this,p)),this.editorDiv.removeEventListener("blur",u(this,v)),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(),u(this,m)||(f(this,m,!0),this.parent.addUndoableEditor(this)),this.disableEditMode(),f(this,g,l(this,M,_).call(this).trimEnd()),l(this,E,O).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(t){S._keyboardManager.exec(this,t)}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 t,e;this.width&&(t=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",`${this.id}-editor`),this.enableEditing(),S._l10nPromise.get("editor_free_text_aria_label").then((t=>{var e;return null===(e=this.editorDiv)||void 0===e?void 0:e.setAttribute("aria-label",t)})),S._l10nPromise.get("free_text_default_content").then((t=>{var e;return null===(e=this.editorDiv)||void 0===e?void 0:e.setAttribute("default-content",t)})),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize=`calc(${u(this,A)}px * var(--scale-factor))`,i.color=u(this,w),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),(0,r.bindEvents)(this,this.div,["dblclick","keydown"]),this.width){const[i,n]=this.parent.viewportBaseDimensions;this.setAt(t*i,e*n,this.width*i,this.height*n);for(const t of u(this,g).split("\n")){const e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}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 i=super.deserialize(t,e);return f(i,A,t.fontSize),f(i,w,n.Util.makeHexColor(...t.color)),f(i,g,t.value),i}serialize(){if(this.isEmpty())return null;const t=S._internalPadding*this.parent.scaleFactor,e=this.getRect(t,t),i=s.AnnotationEditor._colorManager.convert(getComputedStyle(this.editorDiv).color);return{annotationType:n.AnnotationEditorType.FREETEXT,color:i,fontSize:u(this,A),value:u(this,g),pageIndex:this.parent.pageIndex,rect:e,rotation:this.rotation}}}function x(t){const e=t=>{this.editorDiv.style.fontSize=`calc(${t}px * var(--scale-factor))`,this.translate(0,-(t-u(this,A))*this.parent.scaleFactor),f(this,A,t),l(this,E,O).call(this)},i=u(this,A);this.parent.addCommands({cmd:()=>{e(t)},undo:()=>{e(i)},mustExec:!0,type:n.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}function T(t){const e=u(this,w);this.parent.addCommands({cmd:()=>{f(this,w,t),this.editorDiv.style.color=t},undo:()=>{f(this,w,e),this.editorDiv.style.color=e},mustExec:!0,type:n.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function _(){const t=this.editorDiv.getElementsByTagName("div");if(0===t.length)return this.editorDiv.innerText;const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i].firstChild;e.push("#text"===(null==n?void 0:n.nodeName)?n.data:"")}return e.join("\n")}function O(){const[t,e]=this.parent.viewportBaseDimensions,i=this.div.getBoundingClientRect();this.width=i.width/t,this.height=i.height/e}e.FreeTextEditor=S,a(S,"_freeTextDefaultContent",""),a(S,"_l10nPromise",void 0),a(S,"_internalPadding",0),a(S,"_defaultColor",null),a(S,"_defaultFontSize",10),a(S,"_keyboardManager",new r.KeyboardManager([[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],S.prototype.commitOrRemove]])),a(S,"_type","freetext")},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.InkEditor=void 0,Object.defineProperty(e,"fitCurve",{enumerable:!0,get:function(){return s.fitCurve}});var n=i(1),r=i(131),s=i(150),o=i(132);function a(t,e){u(t,e),e.add(t)}function h(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function c(t,e,i){u(t,e),e.set(t,i)}function u(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function l(t,e,i){return function(t,e){if(t!==e)throw new TypeError("Private static access of wrong provenance")}(t,e),i}function f(t,e,i){return function(t,e,i){if(e.set)e.set.call(t,i);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=i}}(t,v(t,e,"set"),i),i}function d(t,e){return function(t,e){return e.get?e.get.call(t):e.value}(t,v(t,e,"get"))}function v(t,e,i){if(!e.has(t))throw new TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}function p(t,e,i){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return i}const b=16;var w=new WeakMap,g=new WeakMap,m=new WeakMap,A=new WeakMap,y=new WeakMap,k=new WeakMap,M=new WeakMap,E=new WeakMap,S=new WeakMap,x=new WeakMap,T=new WeakMap,_=new WeakMap,O=new WeakMap,C=new WeakMap,R=new WeakSet,j=new WeakSet,P=new WeakSet,D=new WeakSet,I=new WeakSet,F=new WeakSet,L=new WeakSet,W=new WeakSet,N=new WeakSet,B=new WeakSet,$=new WeakSet,U=new WeakSet,z=new WeakSet,G=new WeakSet,Y=new WeakSet,q=new WeakSet,X=new WeakSet,V=new WeakSet,H=new WeakSet,Q=new WeakSet,K=new WeakSet,J=new WeakSet;class Z extends r.AnnotationEditor{constructor(t){super({...t,name:"inkEditor"}),a(this,J),a(this,K),a(this,Q),a(this,H),a(this,V),a(this,X),a(this,q),a(this,Y),a(this,G),a(this,z),a(this,U),a(this,$),a(this,B),a(this,N),a(this,W),a(this,L),a(this,F),a(this,I),a(this,D),a(this,P),a(this,j),a(this,R),c(this,w,{writable:!0,value:0}),c(this,g,{writable:!0,value:0}),c(this,m,{writable:!0,value:0}),c(this,A,{writable:!0,value:this.canvasPointermove.bind(this)}),c(this,y,{writable:!0,value:this.canvasPointerleave.bind(this)}),c(this,k,{writable:!0,value:this.canvasPointerup.bind(this)}),c(this,M,{writable:!0,value:this.canvasPointerdown.bind(this)}),c(this,E,{writable:!0,value:!1}),c(this,S,{writable:!0,value:!1}),c(this,x,{writable:!0,value:null}),c(this,T,{writable:!0,value:null}),c(this,_,{writable:!0,value:0}),c(this,O,{writable:!0,value:0}),c(this,C,{writable:!0,value: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(t,e){switch(t){case n.AnnotationEditorParamsType.INK_THICKNESS:Z._defaultThickness=e;break;case n.AnnotationEditorParamsType.INK_COLOR:Z._defaultColor=e;break;case n.AnnotationEditorParamsType.INK_OPACITY:Z._defaultOpacity=e/100}}updateParams(t,e){switch(t){case n.AnnotationEditorParamsType.INK_THICKNESS:p(this,R,tt).call(this,e);break;case n.AnnotationEditorParamsType.INK_COLOR:p(this,j,et).call(this,e);break;case n.AnnotationEditorParamsType.INK_OPACITY:p(this,P,it).call(this,e)}}static get defaultPropertiesToUpdate(){return[[n.AnnotationEditorParamsType.INK_THICKNESS,Z._defaultThickness],[n.AnnotationEditorParamsType.INK_COLOR,Z._defaultColor||r.AnnotationEditor._defaultLineColor],[n.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*Z._defaultOpacity)]]}get propertiesToUpdate(){var t;return[[n.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||Z._defaultThickness],[n.AnnotationEditorParamsType.INK_COLOR,this.color||Z._defaultColor||r.AnnotationEditor._defaultLineColor],[n.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(null!==(t=this.opacity)&&void 0!==t?t:Z._defaultOpacity))]]}rebuild(){super.rebuild(),null!==this.div&&(this.canvas||(p(this,$,ut).call(this),p(this,U,lt).call(this)),this.isAttachedToDOM||(this.parent.add(this),p(this,z,ft).call(this)),p(this,K,yt).call(this))}remove(){null!==this.canvas&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,d(this,T).disconnect(),f(this,T,null),super.remove())}enableEditMode(){d(this,E)||null===this.canvas||(super.enableEditMode(),this.div.draggable=!1,this.canvas.addEventListener("pointerdown",d(this,M)),this.canvas.addEventListener("pointerup",d(this,k)))}disableEditMode(){this.isInEditMode()&&null!==this.canvas&&(super.disableEditMode(),this.div.draggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",d(this,M)),this.canvas.removeEventListener("pointerup",d(this,k)))}onceAdded(){this.div.draggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}commit(){d(this,E)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),f(this,E,!0),this.div.classList.add("disabled"),p(this,K,yt).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()&&!d(this,E)&&(this.setInForeground(),"mouse"!==t.type&&this.div.focus(),t.stopPropagation(),this.canvas.addEventListener("pointerleave",d(this,y)),this.canvas.addEventListener("pointermove",d(this,A)),p(this,F,st).call(this,t.offsetX,t.offsetY))}canvasPointermove(t){t.stopPropagation(),p(this,L,ot).call(this,t.offsetX,t.offsetY)}canvasPointerup(t){0===t.button&&this.isInEditMode()&&0!==this.currentPath.length&&(t.stopPropagation(),p(this,B,ct).call(this,t),this.setInBackground())}canvasPointerleave(t){p(this,B,ct).call(this,t),this.setInBackground()}render(){if(this.div)return this.div;let t,e;this.width&&(t=this.x,e=this.y),super.render(),Z._l10nPromise.get("editor_ink_aria_label").then((t=>{var e;return null===(e=this.div)||void 0===e?void 0:e.setAttribute("aria-label",t)}));const[i,n,r,s]=p(this,D,nt).call(this);if(this.setAt(i,n,0,0),this.setDims(r,s),p(this,$,ut).call(this),this.width){const[i,n]=this.parent.viewportBaseDimensions;this.setAt(t*i,e*n,this.width*i,this.height*n),f(this,S,!0),p(this,z,ft).call(this),this.setDims(this.width*i,this.height*n),p(this,N,ht).call(this),p(this,J,kt).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return p(this,U,lt).call(this),this.div}setDimensions(t,e){const i=Math.round(t),n=Math.round(e);if(d(this,_)===i&&d(this,O)===n)return;f(this,_,i),f(this,O,n),this.canvas.style.visibility="hidden",d(this,w)&&Math.abs(d(this,w)-t/e)>.01&&(e=Math.ceil(t/d(this,w)),this.setDims(t,e));const[r,s]=this.parent.viewportBaseDimensions;this.width=t/r,this.height=e/s,d(this,E)&&p(this,G,dt).call(this,t,e),p(this,z,ft).call(this),p(this,N,ht).call(this),this.canvas.style.visibility="visible"}static deserialize(t,e){const i=super.deserialize(t,e);i.thickness=t.thickness,i.color=n.Util.makeHexColor(...t.color),i.opacity=t.opacity;const[r,s]=e.pageDimensions,o=i.width*r,a=i.height*s,h=e.scaleFactor,c=t.thickness/2;f(i,w,o/a),f(i,E,!0),f(i,_,Math.round(o)),f(i,O,Math.round(a));for(const{bezier:e}of t.paths){const t=[];i.paths.push(t);let n=h*(e[0]-c),r=h*(a-e[1]-c);for(let i=2,s=e.length;i<s;i+=6){const s=h*(e[i+4]-c),o=h*(a-e[i+5]-c);t.push([[n,r],[h*(e[i]-c),h*(a-e[i+1]-c)],[h*(e[i+2]-c),h*(a-e[i+3]-c)],[s,o]]),n=s,r=o}const s=l(this,Z,pt).call(this,t);i.bezierPath2D.push(s)}const u=p(i,H,mt).call(i);return f(i,m,Math.max(b,u[2]-u[0])),f(i,g,Math.max(b,u[3]-u[1])),p(i,G,dt).call(i,o,a),i}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],i=r.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:n.AnnotationEditorType.INK,color:i,thickness:this.thickness,opacity:this.opacity,paths:p(this,q,bt).call(this,this.scaleFactor/this.parent.scaleFactor,this.translationX,this.translationY,e),pageIndex:this.parent.pageIndex,rect:t,rotation:this.rotation}}}function tt(t){const e=this.thickness;this.parent.addCommands({cmd:()=>{this.thickness=t,p(this,K,yt).call(this)},undo:()=>{this.thickness=e,p(this,K,yt).call(this)},mustExec:!0,type:n.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}function et(t){const e=this.color;this.parent.addCommands({cmd:()=>{this.color=t,p(this,N,ht).call(this)},undo:()=>{this.color=e,p(this,N,ht).call(this)},mustExec:!0,type:n.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function it(t){t/=100;const e=this.opacity;this.parent.addCommands({cmd:()=>{this.opacity=t,p(this,N,ht).call(this)},undo:()=>{this.opacity=e,p(this,N,ht).call(this)},mustExec:!0,type:n.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}function nt(){const{width:t,height:e,rotation:i}=this.parent.viewport;switch(i){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]}}function rt(){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,o.opacityToHex)(this.opacity)}`}function st(t,e){var i;this.isEditing=!0,d(this,S)||(f(this,S,!0),p(this,z,ft).call(this),this.thickness||(this.thickness=Z._defaultThickness),this.color||(this.color=Z._defaultColor||r.AnnotationEditor._defaultLineColor),null!==(i=this.opacity)&&void 0!==i||(this.opacity=Z._defaultOpacity)),this.currentPath.push([t,e]),f(this,x,null),p(this,I,rt).call(this),this.ctx.beginPath(),this.ctx.moveTo(t,e),f(this,C,(()=>{d(this,C)&&(d(this,x)&&(this.isEmpty()?(this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)):p(this,N,ht).call(this),this.ctx.lineTo(...d(this,x)),f(this,x,null),this.ctx.stroke()),window.requestAnimationFrame(d(this,C)))})),window.requestAnimationFrame(d(this,C))}function ot(t,e){const[i,n]=this.currentPath.at(-1);t===i&&e===n||(this.currentPath.push([t,e]),f(this,x,[t,e]))}function at(t,e){this.ctx.closePath(),f(this,C,null),t=Math.min(Math.max(t,0),this.canvas.width),e=Math.min(Math.max(e,0),this.canvas.height);const[i,n]=this.currentPath.at(-1);let r;if(t===i&&e===n||this.currentPath.push([t,e]),1!==this.currentPath.length)r=(0,s.fitCurve)(this.currentPath,30,null);else{const i=[t,e];r=[[i,i.slice(),i.slice(),i]]}const o=l(Z,Z,pt).call(Z,r);this.currentPath.length=0,this.parent.addCommands({cmd:()=>{this.paths.push(r),this.bezierPath2D.push(o),this.rebuild()},undo:()=>{this.paths.pop(),this.bezierPath2D.pop(),0===this.paths.length?this.remove():(this.canvas||(p(this,$,ut).call(this),p(this,U,lt).call(this)),p(this,K,yt).call(this))},mustExec:!0})}function ht(){if(this.isEmpty())return void p(this,Y,vt).call(this);p(this,I,rt).call(this);const{canvas:t,ctx:e}=this;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t.width,t.height),p(this,Y,vt).call(this);for(const t of this.bezierPath2D)e.stroke(t)}function ct(t){p(this,W,at).call(this,t.offsetX,t.offsetY),this.canvas.removeEventListener("pointerleave",d(this,y)),this.canvas.removeEventListener("pointermove",d(this,A)),this.parent.addToAnnotationStorage(this)}function ut(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",Z._l10nPromise.get("editor_ink_canvas_aria_label").then((t=>{var e;return null===(e=this.canvas)||void 0===e?void 0:e.setAttribute("aria-label",t)})),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")}function lt(){f(this,T,new ResizeObserver((t=>{const e=t[0].contentRect;e.width&&e.height&&this.setDimensions(e.width,e.height)}))),d(this,T).observe(this.div)}function ft(){if(!d(this,S))return;const[t,e]=this.parent.viewportBaseDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*e),p(this,Y,vt).call(this)}function dt(t,e){const i=p(this,Q,At).call(this),n=(t-i)/d(this,m),r=(e-i)/d(this,g);this.scaleFactor=Math.min(n,r)}function vt(){const t=p(this,Q,At).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)}function pt(t){const e=new Path2D;for(let i=0,n=t.length;i<n;i++){const[n,r,s,o]=t[i];0===i&&e.moveTo(...n),e.bezierCurveTo(r[0],r[1],s[0],s[1],o[0],o[1])}return e}function bt(t,e,i,n){const r=[],s=this.thickness/2;let o,a;for(const h of this.paths){o=[],a=[];for(let r=0,c=h.length;r<c;r++){const[c,u,l,f]=h[r],d=t*(c[0]+e)+s,v=n-t*(c[1]+i)-s,b=t*(u[0]+e)+s,w=n-t*(u[1]+i)-s,g=t*(l[0]+e)+s,m=n-t*(l[1]+i)-s,A=t*(f[0]+e)+s,y=n-t*(f[1]+i)-s;0===r&&(o.push(d,v),a.push(d,v)),o.push(b,w,g,m,A,y),p(this,X,wt).call(this,d,v,b,w,g,m,A,y,4,a)}r.push({bezier:o,points:a})}return r}function wt(t,e,i,n,r,s,o,a,h,c){if(p(this,V,gt).call(this,t,e,i,n,r,s,o,a))c.push(o,a);else{for(let u=1;u<h-1;u++){const l=u/h,f=1-l;let d=l*t+f*i,v=l*e+f*n,p=l*i+f*r,b=l*n+f*s;d=l*d+f*p,v=l*v+f*b,p=l*p+f*(l*r+f*o),b=l*b+f*(l*s+f*a),d=l*d+f*p,v=l*v+f*b,c.push(d,v)}c.push(o,a)}}function gt(t,e,i,n,r,s,o,a){const h=(3*n-2*e-a)**2,c=(3*s-e-2*a)**2;return Math.max((3*i-2*t-o)**2,(3*r-t-2*o)**2)+Math.max(h,c)<=10}function mt(){let t=1/0,e=-1/0,i=1/0,r=-1/0;for(const s of this.paths)for(const[o,a,h,c]of s){const s=n.Util.bezierBoundingBox(...o,...a,...h,...c);t=Math.min(t,s[0]),i=Math.min(i,s[1]),e=Math.max(e,s[2]),r=Math.max(r,s[3])}return[t,i,e,r]}function At(){return d(this,E)?Math.ceil(this.thickness*this.parent.scaleFactor):0}function yt(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return;if(!d(this,E))return void p(this,N,ht).call(this);const e=p(this,H,mt).call(this),i=p(this,Q,At).call(this);f(this,m,Math.max(b,e[2]-e[0])),f(this,g,Math.max(b,e[3]-e[1]));const n=Math.ceil(i+d(this,m)*this.scaleFactor),r=Math.ceil(i+d(this,g)*this.scaleFactor),[s,o]=this.parent.viewportBaseDimensions;this.width=n/s,this.height=r/o,f(this,w,n/r),p(this,J,kt).call(this);const a=this.translationX,h=this.translationY;this.translationX=-e[0],this.translationY=-e[1],p(this,z,ft).call(this),p(this,N,ht).call(this),f(this,_,n),f(this,O,r),this.setDims(n,r);const c=t?i/this.scaleFactor/2:0;this.translate(a-this.translationX-c,h-this.translationY-c)}function kt(){const{style:t}=this.div;d(this,w)>=1?(t.minHeight=`${b}px`,t.minWidth=`${Math.round(d(this,w)*b)}px`):(t.minWidth=`${b}px`,t.minHeight=`${Math.round(b/d(this,w))}px`)}e.InkEditor=Z,h(Z,"_defaultColor",null),h(Z,"_defaultOpacity",1),h(Z,"_defaultThickness",1),h(Z,"_l10nPromise",void 0),h(Z,"_type","ink")},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.fitCurve=void 0;const n=i(151);e.fitCurve=n},t=>{function e(t,r,s,o,a){var c,u,l,f,d,v,p,b,w,g,m,A,y;if(2===t.length)return A=h.vectorLen(h.subtract(t[0],t[1]))/3,[c=[t[0],h.addArrays(t[0],h.mulItems(r,A)),h.addArrays(t[1],h.mulItems(s,A)),t[1]]];if(u=function(t){var e,i,n,r=[];return t.forEach(((t,s)=>{e=s?i+h.vectorLen(h.subtract(t,n)):0,r.push(e),i=e,n=t})),r=r.map((t=>t/i))}(t),[c,f,v]=i(t,u,u,r,s,a),0===f||f<o)return[c];if(f<o*o)for(l=u,d=f,p=v,y=0;y<20;y++){if(l=n(c,t,l),[c,f,v]=i(t,u,l,r,s,a),f<o)return[c];if(v===p){let t=f/d;if(t>.9999&&t<1.0001)break}d=f,p=v}return m=[],(b=h.subtract(t[v-1],t[v+1])).every((t=>0===t))&&(b=h.subtract(t[v-1],t[v]),[b[0],b[1]]=[-b[1],b[0]]),w=h.normalize(b),g=h.mulItems(w,-1),(m=m.concat(e(t.slice(0,v+1),r,w,o,a))).concat(e(t.slice(v),g,s,o,a))}function i(t,e,i,n,r,a){var u,l,f;return u=function(t,e,i,n){var r,s,o,a,u,l,f,d,v,p,b,w,g,m,A,y=t[0],k=t[t.length-1];for(r=[y,null,null,k],s=h.zeros_Xx2x2(e.length),b=0,w=e.length;b<w;b++)(o=s[b])[0]=h.mulItems(i,3*(m=e[b])*((A=1-m)*A)),o[1]=h.mulItems(n,3*A*(m*m));for(a=[[0,0],[0,0]],u=[0,0],b=0,w=t.length;b<w;b++)m=e[b],a[0][0]+=h.dot((o=s[b])[0],o[0]),a[0][1]+=h.dot(o[0],o[1]),a[1][0]+=h.dot(o[0],o[1]),a[1][1]+=h.dot(o[1],o[1]),g=h.subtract(t[b],c.q([y,y,k,k],m)),u[0]+=h.dot(o[0],g),u[1]+=h.dot(o[1],g);return f=0==(l=a[0][0]*a[1][1]-a[1][0]*a[0][1])?0:(u[0]*a[1][1]-u[1]*a[0][1])/l,d=0===l?0:(a[0][0]*u[1]-a[1][0]*u[0])/l,f<(v=1e-6*(p=h.vectorLen(h.subtract(y,k))))||d<v?(r[1]=h.addArrays(y,h.mulItems(i,p/3)),r[2]=h.addArrays(k,h.mulItems(n,p/3))):(r[1]=h.addArrays(y,h.mulItems(i,f)),r[2]=h.addArrays(k,h.mulItems(n,d))),r}(t,i,n,r),[l,f]=function(t,e,i){var n,r,a,u,l,f,d,v;r=0,a=Math.floor(t.length/2);const p=s(e,10);for(l=0,f=t.length;l<f;l++)d=t[l],v=o(0,i[l],p,10),(n=(u=h.subtract(c.q(e,v),d))[0]*u[0]+u[1]*u[1])>r&&(r=n,a=l);return[r,a]}(t,u,e),a&&a({bez:u,points:t,params:e,maxErr:l,maxPoint:f}),[u,l,f]}function n(t,e,i){return i.map(((i,n)=>r(t,e[n],i)))}function r(t,e,i){var n=h.subtract(c.q(t,i),e),r=c.qprime(t,i),s=h.mulMatrix(n,r),o=h.sum(h.squareItems(r))+2*h.mulMatrix(n,c.qprimeprime(t,i));return 0===o?i:i-s/o}var s=function(t,e){for(var i,n=[0],r=t[0],s=0,o=1;o<=e;o++)i=c.q(t,o/e),s+=h.vectorLen(h.subtract(i,r)),n.push(s),r=i;return n.map((t=>t/s))};function o(t,e,i,n){if(e<0)return 0;if(e>1)return 1;for(var r,s,o,a=1;a<=n;a++)if(e<=i[a]){o=(e-(r=i[a-1]))/(i[a]-r)*(a/n-(s=(a-1)/n))+s;break}return o}function a(t,e){return h.normalize(h.subtract(t,e))}class h{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,i,n)=>t+i*e[n]),0)}static subtract(t,e){return t.map(((t,i)=>t-e[i]))}static addArrays(t,e){return t.map(((t,i)=>t+e[i]))}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 h.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 c{static q(t,e){var i=1-e,n=h.mulItems(t[0],i*i*i),r=h.mulItems(t[1],3*i*i*e),s=h.mulItems(t[2],3*i*e*e),o=h.mulItems(t[3],e*e*e);return h.addArrays(h.addArrays(n,r),h.addArrays(s,o))}static qprime(t,e){var i=1-e,n=h.mulItems(h.subtract(t[1],t[0]),3*i*i),r=h.mulItems(h.subtract(t[2],t[1]),6*i*e),s=h.mulItems(h.subtract(t[3],t[2]),3*e*e);return h.addArrays(h.addArrays(n,r),s)}static qprimeprime(t,e){return h.addArrays(h.mulItems(h.addArrays(h.subtract(t[2],h.mulItems(t[1],2)),t[0]),6*(1-e)),h.mulItems(h.addArrays(h.subtract(t[3],h.mulItems(t[2],2)),t[1]),6*e))}}t.exports=function(t,i,n){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,i)=>0===i||!e.every(((e,n)=>e===t[i-1][n]))))).length<2)return[];const r=t.length,s=a(t[1],t[0]),o=a(t[r-2],t[r-1]);return e(t,s,o,i,n)},t.exports.fitCubic=e,t.exports.createTangent=a},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AnnotationLayer=void 0;var n=i(1),r=i(133),s=i(130),o=i(153),a=i(154);function h(t,e,i){return function(t,e){if(t!==e)throw new TypeError("Private static access of wrong provenance")}(t,e),i}const c=1e3,u=new WeakSet;function l(t){return{width:t[2]-t[0],height:t[3]-t[1]}}class f{static create(t){switch(t.data.annotationType){case n.AnnotationType.LINK:return new v(t);case n.AnnotationType.TEXT:return new p(t);case n.AnnotationType.WIDGET:switch(t.data.fieldType){case"Tx":return new w(t);case"Btn":return t.data.radioButton?new m(t):t.data.checkBox?new g(t):new A(t);case"Ch":return new y(t)}return new b(t);case n.AnnotationType.POPUP:return new k(t);case n.AnnotationType.FREETEXT:return new E(t);case n.AnnotationType.LINE:return new S(t);case n.AnnotationType.SQUARE:return new x(t);case n.AnnotationType.CIRCLE:return new T(t);case n.AnnotationType.POLYLINE:return new _(t);case n.AnnotationType.CARET:return new C(t);case n.AnnotationType.INK:return new R(t);case n.AnnotationType.POLYGON:return new O(t);case n.AnnotationType.HIGHLIGHT:return new j(t);case n.AnnotationType.UNDERLINE:return new P(t);case n.AnnotationType.SQUIGGLY:return new D(t);case n.AnnotationType.STRIKEOUT:return new I(t);case n.AnnotationType.STAMP:return new F(t);case n.AnnotationType.FILEATTACHMENT:return new L(t);default:return new d(t)}}}class d{constructor(t){let{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:n=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[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(i)),n&&(this.quadrilaterals=this._createQuadrilaterals(i))}_createContainer(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=this.data,i=this.page,r=this.viewport,s=document.createElement("section"),{width:o,height:a}=l(e.rect),[h,c,u,f]=r.viewBox,d=u-h,v=f-c;s.setAttribute("data-annotation-id",e.id);const p=n.Util.normalizeRect([e.rect[0],i.view[3]-e.rect[1]+i.view[1],e.rect[2],i.view[3]-e.rect[3]+i.view[1]]);if(!t&&e.borderStyle.width>0){s.style.borderWidth=`${e.borderStyle.width}px`;const t=e.borderStyle.horizontalCornerRadius,i=e.borderStyle.verticalCornerRadius;switch(t>0||i>0?s.style.borderRadius=`calc(${t}px * var(--scale-factor)) / calc(${i}px * var(--scale-factor))`:this instanceof m&&(s.style.borderRadius=`calc(${o}px * var(--scale-factor)) / calc(${a}px * var(--scale-factor))`),e.borderStyle.style){case n.AnnotationBorderStyleType.SOLID:s.style.borderStyle="solid";break;case n.AnnotationBorderStyleType.DASHED:s.style.borderStyle="dashed";break;case n.AnnotationBorderStyleType.BEVELED:(0,n.warn)("Unimplemented border style: beveled");break;case n.AnnotationBorderStyleType.INSET:(0,n.warn)("Unimplemented border style: inset");break;case n.AnnotationBorderStyleType.UNDERLINE:s.style.borderBottomStyle="solid"}const r=e.borderColor||null;r?s.style.borderColor=n.Util.makeHexColor(0|r[0],0|r[1],0|r[2]):s.style.borderWidth=0}s.style.left=100*(p[0]-h)/d+"%",s.style.top=100*(p[1]-c)/v+"%";const{rotation:b}=e;return e.hasOwnCanvas||0===b?(s.style.width=100*o/d+"%",s.style.height=100*a/v+"%"):this.setRotation(b,s),s}setRotation(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.container;const[i,n,r,s]=this.viewport.viewBox,o=r-i,a=s-n,{width:h,height:c}=l(this.data.rect);let u,f;t%180==0?(u=100*h/o,f=100*c/a):(u=100*c/o,f=100*h/a),e.style.width=`${u}%`,e.style.height=`${f}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(t,e,i)=>{const n=i.detail[t];i.target.style[e]=o.ColorConverters[`${n[0]}_HTML`](n.slice(1))};return(0,n.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 i=this._commonActions;for(const n of Object.keys(e.detail)){const r=t[n]||i[n];r&&r(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const i=this._commonActions;for(const[n,r]of Object.entries(e)){const s=i[n];s&&(s({detail:{[n]:r},target:t}),delete e[n])}}_createQuadrilaterals(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.data.quadPoints)return null;const e=[],i=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=i,e}_createPopup(t,e){let i=this.container;this.quadrilaterals&&(t=t||this.quadrilaterals,i=this.quadrilaterals[0]),t||((t=document.createElement("div")).className="popupTriggerArea",i.append(t));const n=new M({container:i,trigger:t,color:e.color,titleObj:e.titleObj,modificationDate:e.modificationDate,contentsObj:e.contentsObj,richText:e.richText,hideWrapper:!0}).render();n.style.left="100%",i.append(n)}_renderQuadrilaterals(t){for(const e of this.quadrilaterals)e.className=t;return this.quadrilaterals}render(){(0,n.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=[];if(this._fieldObjects){const r=this._fieldObjects[t];if(r)for(const{page:t,id:s,exportValues:o}of r){if(-1===t)continue;if(s===e)continue;const r="string"==typeof o?o:null,a=document.querySelector(`[data-element-id="${s}"]`);!a||u.has(a)?i.push({id:s,exportValue:r,domElement:a}):(0,n.warn)(`_getElementsByName - element not allowed: ${s}`)}return i}for(const n of document.getElementsByName(t)){const{id:t,exportValue:r}=n;t!==e&&u.has(n)&&i.push({id:t,exportValue:r,domElement:n})}return i}static get platform(){const t="undefined"!=typeof navigator?navigator.platform:"";return(0,n.shadow)(this,"platform",{isWin:t.includes("Win"),isMac:t.includes("Mac")})}}class v extends d{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;super(t,{isRenderable:!0,ignoreBorder:!(null==e||!e.ignoreBorder),createQuadrilaterals:!0}),this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:e}=this,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let n=!1;return t.url?(e.addLinkAttributes(i,t.url,t.newWindow),n=!0):t.action?(this._bindNamedAction(i,t.action),n=!0):t.dest?(this._bindLink(i,t.dest),n=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),n=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(i,""),n=!0)),this.quadrilaterals?this._renderQuadrilaterals("linkAnnotation").map(((t,e)=>{const n=0===e?i:i.cloneNode();return t.append(n),t})):(this.container.className="linkAnnotation",n&&this.container.append(i),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 i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(e.actions)){const r=i.get(n);r&&(t[r]=()=>{var t;return null===(t=this.linkService.eventBus)||void 0===t||t.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:n}}),!1})}t.onclick||(t.onclick=()=>!1),t.className="internalLink"}_bindResetFormAction(t,e){const i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),t.className="internalLink",!this._fieldObjects)return(0,n.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),void(i||(t.onclick=()=>!1));t.onclick=()=>{i&&i();const{fields:t,refs:r,include:s}=e,o=[];if(0!==t.length||0!==r.length){const e=new Set(r);for(const i of t){const t=this._fieldObjects[i]||[];for(const{id:i}of t)e.add(i)}for(const t of Object.values(this._fieldObjects))for(const i of t)e.has(i.id)===s&&o.push(i)}else for(const t of Object.values(this._fieldObjects))o.push(...t);const a=this.annotationStorage,h=[];for(const t of o){const{id:e}=t;switch(h.push(e),t.type){case"text":case"combobox":case"listbox":a.setValue(e,{value:t.defaultValue||""});break;case"checkbox":case"radiobutton":a.setValue(e,{value:t.defaultValue===t.exportValues});break;default:continue}const i=document.querySelector(`[data-element-id="${e}"]`);i&&(u.has(i)?i.dispatchEvent(new Event("resetform")):(0,n.warn)(`_bindResetFormAction - element not allowed: ${e}`))}var c;return this.enableScripting&&(null===(c=this.linkService.eventBus)||void 0===c||c.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:h,name:"ResetForm"}})),!1}}}class p extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.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 b extends d{render(){return this.data.alternativeText&&(this.container.title=this.data.alternativeText),this.container}_getKeyModifier(t){const{isWin:e,isMac:i}=d.platform;return e&&t.ctrlKey||i&&t.metaKey}_setEventListener(t,e,i,n){e.includes("mouse")?t.addEventListener(e,(t=>{var e;null===(e=this.linkService.eventBus)||void 0===e||e.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(t),shift:t.shiftKey,modifier:this._getKeyModifier(t)}})})):t.addEventListener(e,(t=>{var e;null===(e=this.linkService.eventBus)||void 0===e||e.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(t)}})}))}_setEventListeners(t,e,i){for(const[r,s]of e){var n;("Action"===s||null!==(n=this.data.actions)&&void 0!==n&&n[s])&&this._setEventListener(t,r,s,i)}}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=null===e?"transparent":n.Util.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const{fontColor:e}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||9,r=t.style;let s;if(this.data.multiLine){const t=Math.abs(this.data.rect[3]-this.data.rect[1]),e=Math.round(t/(n.LINE_FACTOR*i))||1;s=Math.min(i,Math.round(t/e/n.LINE_FACTOR))}else{const t=Math.abs(this.data.rect[3]-this.data.rect[1]);s=Math.min(i,Math.round(t/n.LINE_FACTOR))}r.fontSize=`calc(${s}px * var(--scale-factor))`,r.color=n.Util.makeHexColor(e[0],e[1],e[2]),null!==this.data.textAlignment&&(r.textAlign=["left","center","right"][this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class w extends b{constructor(t){super(t,{isRenderable:t.renderForms||!t.data.hasAppearance&&!!t.data.fieldValue})}setPropertyOnSiblings(t,e,i,n){const r=this.annotationStorage;for(const s of this._getElementsByName(t.name,t.id))s.domElement&&(s.domElement[e]=i),r.setValue(s.id,{[n]:i})}render(){const t=this.annotationStorage,e=this.data.id;this.container.className="textWidgetAnnotation";let i=null;if(this.renderForms){const r=t.getValue(e,{value:this.data.fieldValue});let s=r.formattedValue||r.value||"";const o=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;o&&s.length>o&&(s=s.slice(0,o));const a={userValue:s,formattedValue:null,valueOnFocus:""};this.data.multiLine?(i=document.createElement("textarea"),i.textContent=s,this.data.doNotScroll&&(i.style.overflowY="hidden")):(i=document.createElement("input"),i.type="text",i.setAttribute("value",s),this.data.doNotScroll&&(i.style.overflowX="hidden")),u.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=c,this._setRequired(i,this.data.required),o&&(i.maxLength=o),i.addEventListener("input",(n=>{t.setValue(e,{value:n.target.value}),this.setPropertyOnSiblings(i,"value",n.target.value,"value")})),i.addEventListener("resetform",(()=>{var t;const e=null!==(t=this.data.defaultFieldValue)&&void 0!==t?t:"";i.value=a.userValue=e,a.formattedValue=null}));let h=t=>{const{formattedValue:e}=a;null!=e&&(t.target.value=e),t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){var n;i.addEventListener("focus",(t=>{a.userValue&&(t.target.value=a.userValue),a.valueOnFocus=t.target.value})),i.addEventListener("updatefromsandbox",(i=>{this._dispatchEventFromSandbox({value(i){var n;a.userValue=null!==(n=i.detail.value)&&void 0!==n?n:"",t.setValue(e,{value:a.userValue.toString()}),i.target.value=a.userValue},formattedValue(i){const{formattedValue:n}=i.detail;a.formattedValue=n,null!=n&&i.target!==document.activeElement&&(i.target.value=n),t.setValue(e,{formattedValue:n})},selRange(t){t.target.setSelectionRange(...t.detail.selRange)},charLimit:i=>{var n;const{charLimit:r}=i.detail,{target:s}=i;if(0===r)return void s.removeAttribute("maxLength");s.setAttribute("maxLength",r);let o=a.userValue;!o||o.length<=r||(o=o.slice(0,r),s.value=a.userValue=o,t.setValue(e,{value:o}),null===(n=this.linkService.eventBus)||void 0===n||n.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:o,willCommit:!0,commitKey:1,selStart:s.selectionStart,selEnd:s.selectionEnd}}))}},i)})),i.addEventListener("keydown",(t=>{var i;let n=-1;if("Escape"===t.key?n=0:"Enter"===t.key?n=2:"Tab"===t.key&&(n=3),-1===n)return;const{value:r}=t.target;a.valueOnFocus!==r&&(a.userValue=r,null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:r,willCommit:!0,commitKey:n,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}))}));const r=h;h=null,i.addEventListener("blur",(t=>{const{value:i}=t.target;var n;a.userValue=i,this._mouseState.isDown&&a.valueOnFocus!==i&&(null===(n=this.linkService.eventBus)||void 0===n||n.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:i,willCommit:!0,commitKey:1,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}})),r(t)})),null!==(n=this.data.actions)&&void 0!==n&&n.Keystroke&&i.addEventListener("beforeinput",(t=>{var i;const{data:n,target:r}=t,{value:s,selectionStart:o,selectionEnd:a}=r;let h=o,c=a;switch(t.inputType){case"deleteWordBackward":{const t=s.substring(0,o).match(/\w*[^\w]*$/);t&&(h-=t[0].length);break}case"deleteWordForward":{const t=s.substring(o).match(/^[^\w]*\w*/);t&&(c+=t[0].length);break}case"deleteContentBackward":o===a&&(h-=1);break;case"deleteContentForward":o===a&&(c+=1)}t.preventDefault(),null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:s,change:n||"",willCommit:!1,selStart:h,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(h&&i.addEventListener("blur",h),this.data.comb){const t=(this.data.rect[2]-this.data.rect[0])/o;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 g extends b{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,i=e.id;let n=t.getValue(i,{value:e.exportValue===e.fieldValue}).value;"string"==typeof n&&(n="Off"!==n,t.setValue(i,{value:n})),this.container.className="buttonWidgetAnnotation checkBox";const r=document.createElement("input");return u.add(r),r.setAttribute("data-element-id",i),r.disabled=e.readOnly,this._setRequired(r,this.data.required),r.type="checkbox",r.name=e.fieldName,n&&r.setAttribute("checked",!0),r.setAttribute("exportValue",e.exportValue),r.tabIndex=c,r.addEventListener("change",(n=>{const{name:r,checked:s}=n.target;for(const n of this._getElementsByName(r,i)){const i=s&&n.exportValue===e.exportValue;n.domElement&&(n.domElement.checked=i),t.setValue(n.id,{value:i})}t.setValue(i,{value:s})})),r.addEventListener("resetform",(t=>{t.target.checked=(e.defaultFieldValue||"Off")===e.exportValue})),this.enableScripting&&this.hasJSActions&&(r.addEventListener("updatefromsandbox",(e=>{this._dispatchEventFromSandbox({value(e){e.target.checked="Off"!==e.detail.value,t.setValue(i,{value:e.target.checked})}},e)})),this._setEventListeners(r,[["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(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class m extends b{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.className="buttonWidgetAnnotation radioButton";const t=this.annotationStorage,e=this.data,i=e.id;let n=t.getValue(i,{value:e.fieldValue===e.buttonValue}).value;"string"==typeof n&&(n=n!==e.buttonValue,t.setValue(i,{value:n}));const r=document.createElement("input");if(u.add(r),r.setAttribute("data-element-id",i),r.disabled=e.readOnly,this._setRequired(r,this.data.required),r.type="radio",r.name=e.fieldName,n&&r.setAttribute("checked",!0),r.tabIndex=c,r.addEventListener("change",(e=>{const{name:n,checked:r}=e.target;for(const e of this._getElementsByName(n,i))t.setValue(e.id,{value:!1});t.setValue(i,{value:r})})),r.addEventListener("resetform",(t=>{const i=e.defaultFieldValue;t.target.checked=null!=i&&i===e.buttonValue})),this.enableScripting&&this.hasJSActions){const n=e.buttonValue;r.addEventListener("updatefromsandbox",(e=>{this._dispatchEventFromSandbox({value:e=>{const r=n===e.detail.value;for(const n of this._getElementsByName(e.target.name)){const e=r&&n.id===i;n.domElement&&(n.domElement.checked=e),t.setValue(n.id,{value:e})}}},e)})),this._setEventListeners(r,[["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(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class A extends v{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 y extends b{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.className="choiceWidgetAnnotation";const t=this.annotationStorage,e=this.data.id,i=t.getValue(e,{value:this.data.fieldValue}),n=document.createElement("select");u.add(n),n.setAttribute("data-element-id",e),n.disabled=this.data.readOnly,this._setRequired(n,this.data.required),n.name=this.data.fieldName,n.tabIndex=c;let r=this.data.combo&&this.data.options.length>0;this.data.combo||(n.size=this.data.options.length,this.data.multiSelect&&(n.multiple=!0)),n.addEventListener("resetform",(()=>{const t=this.data.defaultFieldValue;for(const e of n.options)e.selected=e.value===t}));for(const t of this.data.options){const e=document.createElement("option");e.textContent=t.displayValue,e.value=t.exportValue,i.value.includes(t.exportValue)&&(e.setAttribute("selected",!0),r=!1),n.append(e)}let s=null;if(r){const t=document.createElement("option");t.value=" ",t.setAttribute("hidden",!0),t.setAttribute("selected",!0),n.prepend(t),s=()=>{t.remove(),n.removeEventListener("input",s),s=null},n.addEventListener("input",s)}const o=(t,e)=>{const i=e?"value":"textContent",n=t.target.options;return t.target.multiple?Array.prototype.filter.call(n,(t=>t.selected)).map((t=>t[i])):-1===n.selectedIndex?null:n[n.selectedIndex][i]},a=t=>Array.prototype.map.call(t.target.options,(t=>({displayValue:t.textContent,exportValue:t.value})));return this.enableScripting&&this.hasJSActions?(n.addEventListener("updatefromsandbox",(i=>{this._dispatchEventFromSandbox({value(i){var r;null===(r=s)||void 0===r||r();const a=i.detail.value,h=new Set(Array.isArray(a)?a:[a]);for(const t of n.options)t.selected=h.has(t.value);t.setValue(e,{value:o(i,!0)})},multipleSelection(t){n.multiple=!0},remove(i){const r=n.options,s=i.detail.remove;r[s].selected=!1,n.remove(s),r.length>0&&-1===Array.prototype.findIndex.call(r,(t=>t.selected))&&(r[0].selected=!0),t.setValue(e,{value:o(i,!0),items:a(i)})},clear(i){for(;0!==n.length;)n.remove(0);t.setValue(e,{value:null,items:[]})},insert(i){const{index:r,displayValue:s,exportValue:h}=i.detail.insert,c=n.children[r],u=document.createElement("option");u.textContent=s,u.value=h,c?c.before(u):n.append(u),t.setValue(e,{value:o(i,!0),items:a(i)})},items(i){const{items:r}=i.detail;for(;0!==n.length;)n.remove(0);for(const t of r){const{displayValue:e,exportValue:i}=t,r=document.createElement("option");r.textContent=e,r.value=i,n.append(r)}n.options.length>0&&(n.options[0].selected=!0),t.setValue(e,{value:o(i,!0),items:a(i)})},indices(i){const n=new Set(i.detail.indices);for(const t of i.target.options)t.selected=n.has(t.index);t.setValue(e,{value:o(i,!0)})},editable(t){t.target.disabled=!t.detail.editable}},i)})),n.addEventListener("input",(i=>{var n;const r=o(i,!0),s=o(i,!1);t.setValue(e,{value:r}),null===(n=this.linkService.eventBus)||void 0===n||n.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:s,changeEx:r,willCommit:!0,commitKey:1,keyDown:!1}})})),this._setEventListeners(n,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"]],(t=>t.target.checked))):n.addEventListener("input",(function(i){t.setValue(e,{value:o(i,!0)})})),this.data.combo&&this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class k extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.str)})}render(){if(this.container.className="popupAnnotation",["Line","Square","Circle","PolyLine","Polygon","Ink"].includes(this.data.parentType))return this.container;const t=this.layer.querySelectorAll(`[data-annotation-id="${this.data.parentId}"]`);if(0===t.length)return this.container;const e=new M({container:this.container,trigger:Array.from(t),color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText}),i=this.page,r=n.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]]),s=r[0]+this.data.parentRect[2]-this.data.parentRect[0],o=r[1],[a,h,c,u]=this.viewport.viewBox,l=u-h;return this.container.style.left=100*(s-a)/(c-a)+"%",this.container.style.top=100*(o-h)/l+"%",this.container.append(e.render()),this.container}}class M{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 i=document.createElement("div");i.className="popupWrapper",this.hideElement=this.hideWrapper?i:this.container,this.hideElement.hidden=!0;const s=document.createElement("div");s.className="popup";const o=this.color;o&&(s.style.backgroundColor=n.Util.makeHexColor(0|.7*(255-o[0])+o[0],0|.7*(255-o[1])+o[1],0|.7*(255-o[2])+o[2]));const h=document.createElement("h1");h.dir=this.titleObj.dir,h.textContent=this.titleObj.str,s.append(h);const c=r.PDFDateString.toDateObject(this.modificationDate);if(c){const t=document.createElement("span");t.className="popupDate",t.textContent="{{date}}, {{time}}",t.dataset.l10nId="annotation_date_string",t.dataset.l10nArgs=JSON.stringify({date:c.toLocaleDateString(),time:c.toLocaleTimeString()}),s.append(t)}if(null===(t=this.richText)||void 0===t||!t.str||null!==(e=this.contentsObj)&&void 0!==e&&e.str&&this.contentsObj.str!==this.richText.str){const t=this._formatContents(this.contentsObj);s.append(t)}else a.XfaLayer.render({xfaHtml:this.richText.html,intent:"richText",div:s}),s.lastChild.className="richText popupContent";Array.isArray(this.trigger)||(this.trigger=[this.trigger]);for(const t of this.trigger)t.addEventListener("click",this._toggle.bind(this)),t.addEventListener("mouseover",this._show.bind(this,!1)),t.addEventListener("mouseout",this._hide.bind(this,!1));return s.addEventListener("click",this._hide.bind(this,!0)),i.append(s),i}_formatContents(t){let{str:e,dir:i}=t;const n=document.createElement("p");n.className="popupContent",n.dir=i;const r=e.split(/(?:\r\n?|\n)/);for(let t=0,e=r.length;t<e;++t)n.append(document.createTextNode(r[t])),t<e-1&&n.append(document.createElement("br"));return n}_toggle(){this.pinned?this._hide(!0):this._show(!0)}_show(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this.pinned=!0),this.hideElement.hidden&&(this.hideElement.hidden=!1,this.container.style.zIndex=parseInt(this.container.style.zIndex)+1e3)}_hide(){(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&(this.pinned=!1),this.hideElement.hidden||this.pinned||(this.hideElement.hidden=!0,this.container.style.zIndex=parseInt(this.container.style.zIndex)-1e3)}}class E extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.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 i=document.createElement("span");i.textContent=e,t.append(i)}this.container.append(t)}return this.data.hasPopup||this._createPopup(null,this.data),this.container}}class S extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0})}render(){this.container.className="lineAnnotation";const t=this.data,{width:e,height:i}=l(t.rect),n=this.svgFactory.create(e,i,!0),r=this.svgFactory.createElement("svg:line");return r.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),r.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),r.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),r.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),r.setAttribute("stroke-width",t.borderStyle.width||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),this._createPopup(r,t),this.container}}class x extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0})}render(){this.container.className="squareAnnotation";const t=this.data,{width:e,height:i}=l(t.rect),n=this.svgFactory.create(e,i,!0),r=t.borderStyle.width,s=this.svgFactory.createElement("svg:rect");return s.setAttribute("x",r/2),s.setAttribute("y",r/2),s.setAttribute("width",e-r),s.setAttribute("height",i-r),s.setAttribute("stroke-width",r||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),n.append(s),this.container.append(n),this._createPopup(s,t),this.container}}class T extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0})}render(){this.container.className="circleAnnotation";const t=this.data,{width:e,height:i}=l(t.rect),n=this.svgFactory.create(e,i,!0),r=t.borderStyle.width,s=this.svgFactory.createElement("svg:ellipse");return s.setAttribute("cx",e/2),s.setAttribute("cy",i/2),s.setAttribute("rx",e/2-r/2),s.setAttribute("ry",i/2-r/2),s.setAttribute("stroke-width",r||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),n.append(s),this.container.append(n),this._createPopup(s,t),this.container}}class _ extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.className=this.containerClassName;const t=this.data,{width:e,height:i}=l(t.rect),n=this.svgFactory.create(e,i,!0);let r=[];for(const e of t.vertices)r.push(e.x-t.rect[0]+","+(t.rect[3]-e.y));r=r.join(" ");const s=this.svgFactory.createElement(this.svgElementName);return s.setAttribute("points",r),s.setAttribute("stroke-width",t.borderStyle.width||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),n.append(s),this.container.append(n),this._createPopup(s,t),this.container}}class O extends _{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class C extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0})}render(){return this.container.className="caretAnnotation",this.data.hasPopup||this._createPopup(null,this.data),this.container}}class R extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline"}render(){this.container.className=this.containerClassName;const t=this.data,{width:e,height:i}=l(t.rect),n=this.svgFactory.create(e,i,!0);for(const e of t.inkLists){let i=[];for(const n of e)i.push(`${n.x-t.rect[0]},${t.rect[3]-n.y}`);i=i.join(" ");const r=this.svgFactory.createElement(this.svgElementName);r.setAttribute("points",i),r.setAttribute("stroke-width",t.borderStyle.width||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),this._createPopup(r,t),n.append(r)}return this.container.append(n),this.container}}class j extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.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 P extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.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 D extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.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 I extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.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 F extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0})}render(){return this.container.className="stampAnnotation",this.data.hasPopup||this._createPopup(null,this.data),this.container}}class L extends d{constructor(t){var e;super(t,{isRenderable:!0});const{filename:i,content:n}=this.data.file;this.filename=(0,r.getFilenameFromUrl)(i),this.content=n,null===(e=this.linkService.eventBus)||void 0===e||e.dispatch("fileattachmentannotation",{source:this,filename:i,content:n})}render(){var t,e;this.container.className="fileAttachmentAnnotation";const i=document.createElement("div");return i.className="popupTriggerArea",i.addEventListener("dblclick",this._download.bind(this)),!this.data.hasPopup&&(null!==(t=this.data.titleObj)&&void 0!==t&&t.str||null!==(e=this.data.contentsObj)&&void 0!==e&&e.str||this.data.richText)&&this._createPopup(i,this.data),this.container.append(i),this.container}_download(){var t;null===(t=this.downloadManager)||void 0===t||t.openOrDownloadData(this.container,this.content,this.filename)}}class W{static render(t){const{annotations:e,div:i,viewport:o,accessibilityManager:a}=t;h(this,W,B).call(this,i,o);let c=0;for(const u of e){if(u.annotationType!==n.AnnotationType.POPUP){const{width:t,height:e}=l(u.rect);if(t<=0||e<=0)continue}const e=f.create({data:u,layer:i,page:t.page,viewport:o,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new r.DOMSVGFactory,annotationStorage:t.annotationStorage||new s.AnnotationStorage,enableScripting:t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,mouseState:t.mouseState||{isDown:!1}});if(e.isRenderable){const t=e.render();if(u.hidden&&(t.style.visibility="hidden"),Array.isArray(t))for(const e of t)e.style.zIndex=c++,h(W,W,N).call(W,e,u.id,i,a);else t.style.zIndex=c++,e instanceof k?i.prepend(t):h(W,W,N).call(W,t,u.id,i,a)}}h(this,W,$).call(this,i,t.annotationCanvasMap)}static update(t){const{annotationCanvasMap:e,div:i,viewport:n}=t;h(this,W,B).call(this,i,n),h(this,W,$).call(this,i,e),i.hidden=!1}}function N(t,e,i,n){const s=t.firstChild||t;s.id=`${r.AnnotationPrefix}${e}`,i.append(t),null==n||n.moveElementInDOM(i,t,s,!1)}function B(t,e){let{width:i,height:n,rotation:r}=e;const{style:s}=t,o=r%180!=0,a=Math.floor(i)+"px",h=Math.floor(n)+"px";s.width=o?h:a,s.height=o?a:h,t.setAttribute("data-main-rotation",r)}function $(t,e){if(e){for(const[i,n]of e){const e=t.querySelector(`[data-annotation-id="${i}"]`);if(!e)continue;const{firstChild:r}=e;r?"CANVAS"===r.nodeName?r.replaceWith(n):r.before(n):e.append(n)}e.clear()}}e.AnnotationLayer=W},(t,e)=>{function i(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){let[e,i,n,r]=t;return["G",1-Math.min(1,.3*e+.59*n+.11*i+r)]}static G_CMYK(t){let[e]=t;return["CMYK",0,0,0,1-e]}static G_RGB(t){let[e]=t;return["RGB",e,e,e]}static G_HTML(t){let[e]=t;const n=i(e);return`#${n}${n}${n}`}static RGB_G(t){let[e,i,n]=t;return["G",.3*e+.59*i+.11*n]}static RGB_HTML(t){let[e,n,r]=t;return`#${i(e)}${i(n)}${i(r)}`}static T_HTML(){return"#00000000"}static CMYK_RGB(t){let[e,i,n,r]=t;return["RGB",1-Math.min(1,e+r),1-Math.min(1,n+r),1-Math.min(1,i+r)]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK(t){let[e,i,n]=t;const r=1-e,s=1-i,o=1-n;return["CMYK",r,s,o,Math.min(r,s,o)]}}},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.XfaLayer=void 0;var n=i(145);e.XfaLayer=class{static setupStorage(t,e,i,n,r){const s=n.getValue(e,{value:null});switch(i.name){case"textarea":if(null!==s.value&&(t.textContent=s.value),"print"===r)break;t.addEventListener("input",(t=>{n.setValue(e,{value:t.target.value})}));break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){if(s.value===i.attributes.xfaOn?t.setAttribute("checked",!0):s.value===i.attributes.xfaOff&&t.removeAttribute("checked"),"print"===r)break;t.addEventListener("change",(t=>{n.setValue(e,{value:t.target.getAttribute(t.target.checked?"xfaOn":"xfaOff")})}))}else{if(null!==s.value&&t.setAttribute("value",s.value),"print"===r)break;t.addEventListener("input",(t=>{n.setValue(e,{value:t.target.value})}))}break;case"select":if(null!==s.value)for(const t of i.children)t.attributes.value===s.value&&(t.attributes.selected=!0);t.addEventListener("input",(t=>{const i=t.target.options;n.setValue(e,{value:-1===i.selectedIndex?"":i[i.selectedIndex].value})}))}}static setAttributes(t){let{html:e,element:i,storage:n=null,intent:r,linkService:s}=t;const{attributes:o}=i,a=e instanceof HTMLAnchorElement;"radio"===o.type&&(o.name=`${o.name}-${r}`);for(const[t,i]of Object.entries(o))if(null!=i)switch(t){case"class":i.length&&e.setAttribute(t,i.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",i);break;case"style":Object.assign(e.style,i);break;case"textContent":e.textContent=i;break;default:(!a||"href"!==t&&"newWindow"!==t)&&e.setAttribute(t,i)}a&&s.addLinkAttributes(e,o.href,o.newWindow),n&&o.dataId&&this.setupStorage(e,o.dataId,i,n)}static render(t){const e=t.annotationStorage,i=t.linkService,r=t.xfaHtml,s=t.intent||"display",o=document.createElement(r.name);r.attributes&&this.setAttributes({html:o,element:r,intent:s,linkService:i});const a=[[r,-1,o]],h=t.div;if(h.append(o),t.viewport){const e=`matrix(${t.viewport.transform.join(",")})`;h.style.transform=e}"richText"!==s&&h.setAttribute("class","xfaLayer xfaFont");const c=[];for(;a.length>0;){var u;const[t,r,o]=a.at(-1);if(r+1===t.children.length){a.pop();continue}const h=t.children[++a.at(-1)[1]];if(null===h)continue;const{name:l}=h;if("#text"===l){const t=document.createTextNode(h.value);c.push(t),o.append(t);continue}let f;if(f=null!=h&&null!==(u=h.attributes)&&void 0!==u&&u.xmlns?document.createElementNS(h.attributes.xmlns,l):document.createElement(l),o.append(f),h.attributes&&this.setAttributes({html:f,element:h,storage:e,intent:s,linkService:i}),h.children&&h.children.length>0)a.push([h,-1,f]);else if(h.value){const t=document.createTextNode(h.value);n.XfaText.shouldBuildText(l)&&c.push(t),f.append(t)}}for(const t of h.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))t.setAttribute("readOnly",!0);return{textDivs:c}}static update(t){const e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}}},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TextLayerRenderTask=void 0,e.renderTextLayer=function(t){const e=new f({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 n=i(1),r=i(133);const s=30,o=new Map,a=/^\s+$/g;function h(t,e,i,r){const h=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(h);const u=n.Util.transform(t._viewport.transform,e.transform);let l=Math.atan2(u[1],u[0]);const f=i[e.fontName];f.vertical&&(l+=Math.PI/2);const d=Math.hypot(u[2],u[3]),v=d*function(t,e){const i=o.get(t);if(i)return i;e.save(),e.font=`30px ${t}`;const n=e.measureText("");let r=n.fontBoundingBoxAscent,a=Math.abs(n.fontBoundingBoxDescent);if(r){e.restore();const i=r/(r+a);return o.set(t,i),i}e.strokeStyle="red",e.clearRect(0,0,s,s),e.strokeText("g",0,0);let h=e.getImageData(0,0,s,s).data;a=0;for(let t=h.length-1-3;t>=0;t-=4)if(h[t]>0){a=Math.ceil(t/4/s);break}e.clearRect(0,0,s,s),e.strokeText("A",0,s),h=e.getImageData(0,0,s,s).data,r=0;for(let t=0,e=h.length;t<e;t+=4)if(h[t]>0){r=s-Math.floor(t/4/s);break}if(e.restore(),r){const e=r/(r+a);return o.set(t,e),e}return o.set(t,.8),.8}(f.fontFamily,r);let p,b;0===l?(p=u[4],b=u[5]-v):(p=u[4]+v*Math.sin(l),b=u[5]-v*Math.cos(l)),h.style.left=`${p}px`,h.style.top=`${b}px`,h.style.fontSize=`${d}px`,h.style.fontFamily=f.fontFamily,c.fontSize=d,h.setAttribute("role","presentation"),h.textContent=e.str,h.dir=e.dir,t._fontInspectorEnabled&&(h.dataset.fontName=e.fontName),0!==l&&(c.angle=l*(180/Math.PI));let w=!1;if(e.str.length>1||t._enhanceTextSelection&&a.test(e.str))w=!0;else if(" "!==e.str&&e.transform[0]!==e.transform[3]){const t=Math.abs(e.transform[0]),i=Math.abs(e.transform[3]);t!==i&&Math.max(t,i)/Math.min(t,i)>1.5&&(w=!0)}if(w&&(c.canvasWidth=f.vertical?e.height*t._viewport.scale:e.width*t._viewport.scale),t._textDivProperties.set(h,c),t._textContentStream&&t._layoutText(h),t._enhanceTextSelection&&c.hasText){let i=1,r=0;0!==l&&(i=Math.cos(l),r=Math.sin(l));const s=(f.vertical?e.height:e.width)*t._viewport.scale,o=d;let a,c;0!==l?(a=[i,r,-r,i,p,b],c=n.Util.getAxialAlignedBoundingBox([0,0,s,o],a)):c=[p,b,p+s,b+o],t._bounds.push({left:c[0],top:c[1],right:c[2],bottom:c[3],div:h,size:[s,o],m:a})}}function c(t){if(t._canceled)return;const e=t._textDivs,i=t._capability,n=e.length;if(n>1e5)return t._renderingDone=!0,void i.resolve();if(!t._textContentStream)for(let i=0;i<n;i++)t._layoutText(e[i]);t._renderingDone=!0,i.resolve()}function u(t,e,i){let n=0;for(let r=0;r<i;r++){const i=t[e++];i>0&&(n=n?Math.min(i,n):i)}return n}function l(t,e){e.sort((function(t,e){return t.x1-e.x1||t.index-e.index}));const i=[{start:-1/0,end:1/0,boundary:{x1:-1/0,y1:-1/0,x2:0,y2:1/0,index:-1,x1New:0,x2New:0}}];for(const t of e){let e=0;for(;e<i.length&&i[e].end<=t.y1;)e++;let n,r,s=i.length-1;for(;s>=0&&i[s].start>=t.y2;)s--;let o,a,h=-1/0;for(o=e;o<=s;o++){let e;n=i[o],r=n.boundary,e=r.x2>t.x1?r.index>t.index?r.x1New:t.x1:void 0===r.x2New?(r.x2+t.x1)/2:r.x2New,e>h&&(h=e)}for(t.x1New=h,o=e;o<=s;o++)n=i[o],r=n.boundary,void 0===r.x2New?r.x2>t.x1?r.index>t.index&&(r.x2New=r.x2):r.x2New=h:r.x2New>h&&(r.x2New=Math.max(h,r.x2));const c=[];let u=null;for(o=e;o<=s;o++){n=i[o],r=n.boundary;const e=r.x2>t.x2?r:t;u===e?c.at(-1).end=n.end:(c.push({start:n.start,end:n.end,boundary:e}),u=e)}for(i[e].start<t.y1&&(c[0].start=t.y1,c.unshift({start:i[e].start,end:t.y1,boundary:i[e].boundary})),t.y2<i[s].end&&(c.at(-1).end=t.y2,c.push({start:t.y2,end:i[s].end,boundary:i[s].boundary})),o=e;o<=s;o++){if(n=i[o],r=n.boundary,void 0!==r.x2New)continue;let t=!1;for(a=e-1;!t&&a>=0&&i[a].start>=r.y1;a--)t=i[a].boundary===r;for(a=s+1;!t&&a<i.length&&i[a].end<=r.y2;a++)t=i[a].boundary===r;for(a=0;!t&&a<c.length;a++)t=c[a].boundary===r;t||(r.x2New=h)}Array.prototype.splice.apply(i,[e,s-e+1,...c])}for(const e of i){const i=e.boundary;void 0===i.x2New&&(i.x2New=Math.max(t,i.x2))}}class f{constructor(t){var e;let{textContent:i,textContentStream:s,container:o,viewport:a,textDivs:h,textContentItemsStr:c,enhanceTextSelection:u}=t;u&&(0,r.deprecated)("The `enhanceTextSelection` functionality will be removed in the future."),this._textContent=i,this._textContentStream=s,this._container=o,this._document=o.ownerDocument,this._viewport=a,this._textDivs=h||[],this._textContentItemsStr=c||[],this._enhanceTextSelection=!!u,this._fontInspectorEnabled=!(null===(e=globalThis.FontInspector)||void 0===e||!e.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,n.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 n.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 i=0,n=t.length;i<n;i++)if(void 0!==t[i].str)this._textContentItemsStr.push(t[i].str),h(this,t[i],e,this._layoutTextCtx);else if("beginMarkedContentProps"===t[i].type||"beginMarkedContent"===t[i].type){const e=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),null!==t[i].id&&this._container.setAttribute("id",`${t[i].id}`),e.append(this._container)}else"endMarkedContent"===t[i].type&&(this._container=this._container.parentNode)}_layoutText(t){const e=this._textDivProperties.get(t);let i="";if(0!==e.canvasWidth&&e.hasText){const{fontFamily:n}=t.style,{fontSize:r}=e;r===this._layoutTextLastFontSize&&n===this._layoutTextLastFontFamily||(this._layoutTextCtx.font=`${r*this._devicePixelRatio}px ${n}`,this._layoutTextLastFontSize=r,this._layoutTextLastFontFamily=n);const{width:s}=this._layoutTextCtx.measureText(t.textContent);if(s>0){const t=this._devicePixelRatio*e.canvasWidth/s;this._enhanceTextSelection&&(e.scale=t),i=`scaleX(${t})`}}if(0!==e.angle&&(i=`rotate(${e.angle}deg) ${i}`),i.length>0&&(this._enhanceTextSelection&&(e.originalTransform=i),t.style.transform=i),e.hasText&&this._container.append(t),e.hasEOL){const t=document.createElement("br");t.setAttribute("role","presentation"),this._container.append(t)}}_render(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const e=(0,n.createPromiseCapability)();let i=Object.create(null);const r=this._document.createElement("canvas");if(r.height=r.width=s,this._layoutTextCtx=r.getContext("2d",{alpha:!1}),this._textContent)this._processItems(this._textContent.items,this._textContent.styles),e.resolve();else{if(!this._textContentStream)throw new Error('Neither "textContent" nor "textContentStream" parameters specified.');{const t=()=>{this._reader.read().then((n=>{let{value:r,done:s}=n;s?e.resolve():(Object.assign(i,r.styles),this._processItems(r.items,i),t())}),e.reject)};this._reader=this._textContentStream.getReader(),t()}}e.promise.then((()=>{i=null,t?this._renderTimer=setTimeout((()=>{c(this),this._renderTimer=null}),t):c(this)}),this._capability.reject)}expandTextDivs(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this._enhanceTextSelection||!this._renderingDone)return;null!==this._bounds&&(function(t){const e=t._bounds,i=t._viewport,r=function(t,e,i){const n=i.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}}));l(t,n);const r=new Array(i.length);for(const t of n)r[t.index]={left:t.x1New,top:0,right:t.x2New,bottom:0};i.map((function(e,i){const s=r[i],o=n[i];o.x1=e.top,o.y1=t-s.right,o.x2=e.bottom,o.y2=t-s.left,o.index=i,o.x1New=void 0,o.x2New=void 0})),l(e,n);for(const t of n){const e=t.index;r[e].top=t.x1New,r[e].bottom=t.x2New}return r}(i.width,i.height,e);for(let i=0;i<r.length;i++){const s=e[i].div,o=t._textDivProperties.get(s);if(0===o.angle){o.paddingLeft=e[i].left-r[i].left,o.paddingTop=e[i].top-r[i].top,o.paddingRight=r[i].right-e[i].right,o.paddingBottom=r[i].bottom-e[i].bottom,t._textDivProperties.set(s,o);continue}const a=r[i],h=e[i],c=h.m,l=c[0],f=c[1],d=[[0,0],[0,h.size[1]],[h.size[0],0],h.size],v=new Float64Array(64);for(let t=0,e=d.length;t<e;t++){const e=n.Util.applyTransform(d[t],c);v[t+0]=l&&(a.left-e[0])/l,v[t+4]=f&&(a.top-e[1])/f,v[t+8]=l&&(a.right-e[0])/l,v[t+12]=f&&(a.bottom-e[1])/f,v[t+16]=f&&(a.left-e[0])/-f,v[t+20]=l&&(a.top-e[1])/l,v[t+24]=f&&(a.right-e[0])/-f,v[t+28]=l&&(a.bottom-e[1])/l,v[t+32]=l&&(a.left-e[0])/-l,v[t+36]=f&&(a.top-e[1])/-f,v[t+40]=l&&(a.right-e[0])/-l,v[t+44]=f&&(a.bottom-e[1])/-f,v[t+48]=f&&(a.left-e[0])/f,v[t+52]=l&&(a.top-e[1])/-l,v[t+56]=f&&(a.right-e[0])/f,v[t+60]=l&&(a.bottom-e[1])/-l}const p=1+Math.min(Math.abs(l),Math.abs(f));o.paddingLeft=u(v,32,16)/p,o.paddingTop=u(v,48,16)/p,o.paddingRight=u(v,0,16)/p,o.paddingBottom=u(v,16,16)/p,t._textDivProperties.set(s,o)}}(this),this._bounds=null);const e=[],i=[];for(let n=0,r=this._textDivs.length;n<r;n++){const r=this._textDivs[n],s=this._textDivProperties.get(r);s.hasText&&(t?(e.length=0,i.length=0,s.originalTransform&&e.push(s.originalTransform),s.paddingTop>0?(i.push(`${s.paddingTop}px`),e.push(`translateY(${-s.paddingTop}px)`)):i.push(0),i.push(s.paddingRight>0?s.paddingRight/s.scale+"px":0),i.push(s.paddingBottom>0?`${s.paddingBottom}px`:0),s.paddingLeft>0?(i.push(s.paddingLeft/s.scale+"px"),e.push(`translateX(${-s.paddingLeft/s.scale}px)`)):i.push(0),r.style.padding=i.join(" "),e.length&&(r.style.transform=e.join(" "))):(r.style.padding=null,r.style.transform=s.originalTransform))}}}e.TextLayerRenderTask=f},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SVGGraphics=void 0;var n=i(133),r=i(1),s=i(3);let o=class{constructor(){(0,r.unreachable)("Not implemented: SVGGraphics")}};e.SVGGraphics=o;{const a={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},h="http://www.w3.org/XML/1998/namespace",c="http://www.w3.org/1999/xlink",u=["butt","round","square"],l=["miter","round","bevel"],f=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(URL.createObjectURL&&"undefined"!=typeof Blob&&!(arguments.length>2&&void 0!==arguments[2]&&arguments[2]))return URL.createObjectURL(new Blob([t],{type:e}));const i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let n=`data:${e};base64,`;for(let e=0,r=t.length;e<r;e+=3){const s=255&t[e],o=255&t[e+1],a=255&t[e+2];n+=i[s>>2]+i[(3&s)<<4|o>>4]+i[e+1<r?(15&o)<<2|a>>6:64]+i[e+2<r?63&a:64]}return n},d=function(){const t=new Uint8Array([137,80,78,71,13,10,26,10]),e=new Int32Array(256);for(let t=0;t<256;t++){let i=t;for(let t=0;t<8;t++)i=1&i?3988292384^i>>1&2147483647:i>>1&2147483647;e[t]=i}function i(t,i,n,r){let s=r;const o=i.length;n[s]=o>>24&255,n[s+1]=o>>16&255,n[s+2]=o>>8&255,n[s+3]=255&o,s+=4,n[s]=255&t.charCodeAt(0),n[s+1]=255&t.charCodeAt(1),n[s+2]=255&t.charCodeAt(2),n[s+3]=255&t.charCodeAt(3),s+=4,n.set(i,s),s+=i.length;const a=function(t,i,n){let r=-1;for(let s=i;s<n;s++)r=r>>>8^e[255&(r^t[s])];return~r}(n,r+4,s);n[s]=a>>24&255,n[s+1]=a>>16&255,n[s+2]=a>>8&255,n[s+3]=255&a}function n(t){let e=t.length;const i=65535,n=Math.ceil(e/i),r=new Uint8Array(2+e+5*n+4);let s=0;r[s++]=120,r[s++]=156;let o=0;for(;e>i;)r[s++]=0,r[s++]=255,r[s++]=255,r[s++]=0,r[s++]=0,r.set(t.subarray(o,o+i),s),s+=i,o+=i,e-=i;r[s++]=1,r[s++]=255&e,r[s++]=e>>8&255,r[s++]=255&~e,r[s++]=(65535&~e)>>8&255,r.set(t.subarray(o),s),s+=t.length-o;const a=function(t,e,i){let n=1,r=0;for(let e=0;e<i;++e)n=(n+(255&t[e]))%65521,r=(r+n)%65521;return r<<16|n}(t,0,t.length);return r[s++]=a>>24&255,r[s++]=a>>16&255,r[s++]=a>>8&255,r[s++]=255&a,r}return function(e,o,a){return function(e,o,a,h){const c=e.width,u=e.height;let l,d,v;const p=e.data;switch(o){case r.ImageKind.GRAYSCALE_1BPP:d=0,l=1,v=c+7>>3;break;case r.ImageKind.RGB_24BPP:d=2,l=8,v=3*c;break;case r.ImageKind.RGBA_32BPP:d=6,l=8,v=4*c;break;default:throw new Error("invalid format")}const b=new Uint8Array((1+v)*u);let w=0,g=0;for(let t=0;t<u;++t)b[w++]=0,b.set(p.subarray(g,g+v),w),g+=v,w+=v;if(o===r.ImageKind.GRAYSCALE_1BPP&&h){w=0;for(let t=0;t<u;t++){w++;for(let t=0;t<v;t++)b[w++]^=255}}const m=new Uint8Array([c>>24&255,c>>16&255,c>>8&255,255&c,u>>24&255,u>>16&255,u>>8&255,255&u,l,d,0,0,0]),A=function(t){if(!s.isNodeJS)return n(t);try{let e;e=parseInt(process.versions.node)>=8?t:Buffer.from(t);const i=require("zlib").deflateSync(e,{level:9});return i instanceof Uint8Array?i:new Uint8Array(i)}catch(t){(0,r.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+t)}return n(t)}(b),y=new Uint8Array(t.length+36+m.length+A.length);let k=0;return y.set(t,k),k+=t.length,i("IHDR",m,y,k),k+=12+m.length,i("IDATA",A,y,k),k+=12+A.length,i("IEND",new Uint8Array(0),y,k),f(y,"image/png",a)}(e,void 0===e.kind?r.ImageKind.GRAYSCALE_1BPP:e.kind,o,a)}}();class v{constructor(){this.fontSizeScale=1,this.fontWeight=a.fontWeight,this.fontSize=0,this.textMatrix=r.IDENTITY_MATRIX,this.fontMatrix=r.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=r.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=a.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}}function p(t){let e=[];const i=[];for(const n of t)"save"!==n.fn?"restore"===n.fn?e=i.pop():e.push(n):(e.push({fnId:92,fn:"group",items:[]}),i.push(e),e=e.at(-1).items);return e}function b(t){if(Number.isInteger(t))return t.toString();const e=t.toFixed(10);let i=e.length-1;if("0"!==e[i])return e;do{i--}while("0"===e[i]);return e.substring(0,"."===e[i]?i:i+1)}function w(t){if(0===t[4]&&0===t[5]){if(0===t[1]&&0===t[2])return 1===t[0]&&1===t[3]?"":`scale(${b(t[0])} ${b(t[3])})`;if(t[0]===t[3]&&t[1]===-t[2])return`rotate(${b(180*Math.acos(t[0])/Math.PI)})`}else if(1===t[0]&&0===t[1]&&0===t[2]&&1===t[3])return`translate(${b(t[4])} ${b(t[5])})`;return`matrix(${b(t[0])} ${b(t[1])} ${b(t[2])} ${b(t[3])} ${b(t[4])} ${b(t[5])})`}let g=0,m=0,A=0;e.SVGGraphics=o=class{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];(0,n.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future."),this.svgFactory=new n.DOMSVGFactory,this.current=new v,this.transformMatrix=r.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=!!i,this._operatorIdMapping=[];for(const t in r.OPS)this._operatorIdMapping[r.OPS[t]]=t}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,i=t.argsArray;for(let t=0,n=e.length;t<n;t++)if(e[t]===r.OPS.dependency)for(const e of i[t]){const t=e.startsWith("g_")?this.commonObjs:this.objs,i=new Promise((i=>{t.get(e,i)}));this.current.dependencies.push(i)}return Promise.all(this.current.dependencies)}transform(t,e,i,n,s,o){this.transformMatrix=r.Util.transform(this.transformMatrix,[t,e,i,n,s,o]),this.tgrp=null}getSVG(t,e){this.viewport=e;const i=this._initialize(e);return this.loadDependencies(t).then((()=>(this.transformMatrix=r.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(t)),i)))}convertOpList(t){const e=this._operatorIdMapping,i=t.argsArray,n=t.fnArray,r=[];for(let t=0,s=n.length;t<s;t++){const s=n[t];r.push({fnId:s,fn:e[s],args:i[t]})}return p(r)}executeOpTree(t){for(const e of t){const t=e.fn,i=e.args;switch(0|e.fnId){case r.OPS.beginText:this.beginText();break;case r.OPS.dependency:break;case r.OPS.setLeading:this.setLeading(i);break;case r.OPS.setLeadingMoveText:this.setLeadingMoveText(i[0],i[1]);break;case r.OPS.setFont:this.setFont(i);break;case r.OPS.showText:case r.OPS.showSpacedText:this.showText(i[0]);break;case r.OPS.endText:this.endText();break;case r.OPS.moveText:this.moveText(i[0],i[1]);break;case r.OPS.setCharSpacing:this.setCharSpacing(i[0]);break;case r.OPS.setWordSpacing:this.setWordSpacing(i[0]);break;case r.OPS.setHScale:this.setHScale(i[0]);break;case r.OPS.setTextMatrix:this.setTextMatrix(i[0],i[1],i[2],i[3],i[4],i[5]);break;case r.OPS.setTextRise:this.setTextRise(i[0]);break;case r.OPS.setTextRenderingMode:this.setTextRenderingMode(i[0]);break;case r.OPS.setLineWidth:this.setLineWidth(i[0]);break;case r.OPS.setLineJoin:this.setLineJoin(i[0]);break;case r.OPS.setLineCap:this.setLineCap(i[0]);break;case r.OPS.setMiterLimit:this.setMiterLimit(i[0]);break;case r.OPS.setFillRGBColor:this.setFillRGBColor(i[0],i[1],i[2]);break;case r.OPS.setStrokeRGBColor:this.setStrokeRGBColor(i[0],i[1],i[2]);break;case r.OPS.setStrokeColorN:this.setStrokeColorN(i);break;case r.OPS.setFillColorN:this.setFillColorN(i);break;case r.OPS.shadingFill:this.shadingFill(i[0]);break;case r.OPS.setDash:this.setDash(i[0],i[1]);break;case r.OPS.setRenderingIntent:this.setRenderingIntent(i[0]);break;case r.OPS.setFlatness:this.setFlatness(i[0]);break;case r.OPS.setGState:this.setGState(i[0]);break;case r.OPS.fill:this.fill();break;case r.OPS.eoFill:this.eoFill();break;case r.OPS.stroke:this.stroke();break;case r.OPS.fillStroke:this.fillStroke();break;case r.OPS.eoFillStroke:this.eoFillStroke();break;case r.OPS.clip:this.clip("nonzero");break;case r.OPS.eoClip:this.clip("evenodd");break;case r.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case r.OPS.paintImageXObject:this.paintImageXObject(i[0]);break;case r.OPS.paintInlineImageXObject:this.paintInlineImageXObject(i[0]);break;case r.OPS.paintImageMaskXObject:this.paintImageMaskXObject(i[0]);break;case r.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(i[0],i[1]);break;case r.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case r.OPS.closePath:this.closePath();break;case r.OPS.closeStroke:this.closeStroke();break;case r.OPS.closeFillStroke:this.closeFillStroke();break;case r.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case r.OPS.nextLine:this.nextLine();break;case r.OPS.transform:this.transform(i[0],i[1],i[2],i[3],i[4],i[5]);break;case r.OPS.constructPath:this.constructPath(i[0],i[1]);break;case r.OPS.endPath:this.endPath();break;case 92:this.group(e.items);break;default:(0,r.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,n,r,s){const o=this.current;o.textMatrix=o.lineMatrix=[t,e,i,n,r,s],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",`${b(o.fontSize)}px`),o.tspan.setAttributeNS(null,"y",b(-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=r.IDENTITY_MATRIX,t.lineMatrix=r.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",`${b(i.fontSize)}px`),i.tspan.setAttributeNS(null,"y",b(-i.y))}showText(t){const e=this.current,i=e.font,n=e.fontSize;if(0===n)return;const s=e.fontSizeScale,o=e.charSpacing,c=e.wordSpacing,u=e.fontDirection,l=e.textHScale*u,f=i.vertical,d=f?1:-1,v=i.defaultVMetrics,p=n*e.fontMatrix[0];let g=0;for(const r of t){if(null===r){g+=u*c;continue}if("number"==typeof r){g+=d*r*n/1e3;continue}const t=(r.isSpace?c:0)+o,a=r.fontChar;let h,l,b,w=r.width;if(f){let t;const e=r.vmetric||v;t=r.vmetric?e[1]:.5*w,t=-t*p,w=e?-e[0]:w,h=t/s,l=(g+e[2]*p)/s}else h=g/s,l=0;(r.isInFont||i.missingFile)&&(e.xcoords.push(e.x+h),f&&e.ycoords.push(-e.y+l),e.tspan.textContent+=a),b=f?w*p-t*u:w*p+t*u,g+=b}e.tspan.setAttributeNS(null,"x",e.xcoords.map(b).join(" ")),e.tspan.setAttributeNS(null,"y",f?e.ycoords.map(b).join(" "):b(-e.y)),f?e.y-=g:e.x+=g*l,e.tspan.setAttributeNS(null,"font-family",e.fontFamily),e.tspan.setAttributeNS(null,"font-size",`${b(e.fontSize)}px`),e.fontStyle!==a.fontStyle&&e.tspan.setAttributeNS(null,"font-style",e.fontStyle),e.fontWeight!==a.fontWeight&&e.tspan.setAttributeNS(null,"font-weight",e.fontWeight);const m=e.textRenderingMode&r.TextRenderingMode.FILL_STROKE_MASK;m===r.TextRenderingMode.FILL||m===r.TextRenderingMode.FILL_STROKE?(e.fillColor!==a.fillColor&&e.tspan.setAttributeNS(null,"fill",e.fillColor),e.fillAlpha<1&&e.tspan.setAttributeNS(null,"fill-opacity",e.fillAlpha)):e.tspan.setAttributeNS(null,"fill",e.textRenderingMode===r.TextRenderingMode.ADD_TO_PATH?"transparent":"none"),(m===r.TextRenderingMode.STROKE||m===r.TextRenderingMode.FILL_STROKE)&&this._setStrokeAttributes(e.tspan,1/(e.textMatrixScale||1));let A=e.textMatrix;0!==e.textRise&&(A=A.slice(),A[5]+=e.textRise),e.txtElement.setAttributeNS(null,"transform",`${w(A)} scale(${b(l)}, -1)`),e.txtElement.setAttributeNS(h,"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=f(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 n=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||r.FONT_IDENTITY_MATRIX;let s="normal";i.black?s="900":i.bold&&(s="bold");const o=i.italic?"italic":"normal";n<0?(n=-n,e.fontDirection=-1):e.fontDirection=1,e.fontSize=n,e.fontFamily=i.loadedName,e.fontWeight=s,e.fontStyle=o,e.tspan=this.svgFactory.createElement("svg:tspan"),e.tspan.setAttributeNS(null,"y",b(-e.y)),e.xcoords=[],e.ycoords=[]}endText(){var t;const e=this.current;e.textRenderingMode&r.TextRenderingMode.ADD_TO_PATH_FLAG&&null!==(t=e.txtElement)&&void 0!==t&&t.hasChildNodes()&&(e.element=e.txtElement,this.clip("nonzero"),this.endPath())}setLineWidth(t){t>0&&(this.current.lineWidth=t)}setLineCap(t){this.current.lineCap=u[t]}setLineJoin(t){this.current.lineJoin=l[t]}setMiterLimit(t){this.current.miterLimit=t}setStrokeAlpha(t){this.current.strokeAlpha=t}setStrokeRGBColor(t,e,i){this.current.strokeColor=r.Util.makeHexColor(t,e,i)}setFillAlpha(t){this.current.fillAlpha=t}setFillRGBColor(t,e,i){this.current.fillColor=r.Util.makeHexColor(t,e,i),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,i=this.viewport.height,n=r.Util.inverseTransform(this.transformMatrix),s=r.Util.applyTransform([0,0],n),o=r.Util.applyTransform([0,i],n),a=r.Util.applyTransform([e,0],n),h=r.Util.applyTransform([e,i],n),c=Math.min(s[0],o[0],a[0],h[0]),u=Math.min(s[1],o[1],a[1],h[1]),l=Math.max(s[0],o[0],a[0],h[0]),f=Math.max(s[1],o[1],a[1],h[1]),d=this.svgFactory.createElement("svg:rect");d.setAttributeNS(null,"x",c),d.setAttributeNS(null,"y",u),d.setAttributeNS(null,"width",l-c),d.setAttributeNS(null,"height",f-u),d.setAttributeNS(null,"fill",this._makeShadingPattern(t)),this.current.fillAlpha<1&&d.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(d)}_makeColorN_Pattern(t){return"TilingPattern"===t[0]?this._makeTilingPattern(t):this._makeShadingPattern(t)}_makeTilingPattern(t){const e=t[1],i=t[2],n=t[3]||r.IDENTITY_MATRIX,[s,o,a,h]=t[4],c=t[5],u=t[6],l=t[7],f="shading"+A++,[d,v,p,b]=r.Util.normalizeRect([...r.Util.applyTransform([s,o],n),...r.Util.applyTransform([a,h],n)]),[w,g]=r.Util.singularValueDecompose2dScale(n),m=c*w,y=u*g,k=this.svgFactory.createElement("svg:pattern");k.setAttributeNS(null,"id",f),k.setAttributeNS(null,"patternUnits","userSpaceOnUse"),k.setAttributeNS(null,"width",m),k.setAttributeNS(null,"height",y),k.setAttributeNS(null,"x",`${d}`),k.setAttributeNS(null,"y",`${v}`);const M=this.svg,E=this.transformMatrix,S=this.current.fillColor,x=this.current.strokeColor,T=this.svgFactory.create(p-d,b-v);if(this.svg=T,this.transformMatrix=n,2===l){const t=r.Util.makeHexColor(...e);this.current.fillColor=t,this.current.strokeColor=t}return this.executeOpTree(this.convertOpList(i)),this.svg=M,this.transformMatrix=E,this.current.fillColor=S,this.current.strokeColor=x,k.append(T.childNodes[0]),this.defs.append(k),`url(#${f})`}_makeShadingPattern(t){switch("string"==typeof t&&(t=this.objs.get(t)),t[0]){case"RadialAxial":const e="shading"+A++,i=t[3];let n;switch(t[1]){case"axial":const i=t[4],r=t[5];n=this.svgFactory.createElement("svg:linearGradient"),n.setAttributeNS(null,"id",e),n.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),n.setAttributeNS(null,"x1",i[0]),n.setAttributeNS(null,"y1",i[1]),n.setAttributeNS(null,"x2",r[0]),n.setAttributeNS(null,"y2",r[1]);break;case"radial":const s=t[4],o=t[5],a=t[6],h=t[7];n=this.svgFactory.createElement("svg:radialGradient"),n.setAttributeNS(null,"id",e),n.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),n.setAttributeNS(null,"cx",o[0]),n.setAttributeNS(null,"cy",o[1]),n.setAttributeNS(null,"r",h),n.setAttributeNS(null,"fx",s[0]),n.setAttributeNS(null,"fy",s[1]),n.setAttributeNS(null,"fr",a);break;default:throw new Error(`Unknown RadialAxial type: ${t[1]}`)}for(const t of i){const e=this.svgFactory.createElement("svg:stop");e.setAttributeNS(null,"offset",t[0]),e.setAttributeNS(null,"stop-color",t[1]),n.append(e)}return this.defs.append(n),`url(#${e})`;case"Mesh":return(0,r.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 n=i.x,s=i.y,o=[],a=0;for(const i of t)switch(0|i){case r.OPS.rectangle:n=e[a++],s=e[a++];const t=n+e[a++],i=s+e[a++];o.push("M",b(n),b(s),"L",b(t),b(s),"L",b(t),b(i),"L",b(n),b(i),"Z");break;case r.OPS.moveTo:n=e[a++],s=e[a++],o.push("M",b(n),b(s));break;case r.OPS.lineTo:n=e[a++],s=e[a++],o.push("L",b(n),b(s));break;case r.OPS.curveTo:n=e[a+4],s=e[a+5],o.push("C",b(e[a]),b(e[a+1]),b(e[a+2]),b(e[a+3]),b(n),b(s)),a+=6;break;case r.OPS.curveTo2:o.push("C",b(n),b(s),b(e[a]),b(e[a+1]),b(e[a+2]),b(e[a+3])),n=e[a+2],s=e[a+3],a+=4;break;case r.OPS.curveTo3:n=e[a+2],s=e[a+3],o.push("C",b(e[a]),b(e[a+1]),b(n),b(s),b(n),b(s)),a+=4;break;case r.OPS.closePath:o.push("Z")}o=o.join(" "),i.path&&t.length>0&&t[0]!==r.OPS.rectangle&&t[0]!==r.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(n,s)}endPath(){const t=this.current;if(t.path=null,!this.pendingClip)return;if(!t.element)return void(this.pendingClip=null);const e="clippath"+g++,i=this.svgFactory.createElement("svg:clipPath");i.setAttributeNS(null,"id",e),i.setAttributeNS(null,"transform",w(this.transformMatrix));const n=t.element.cloneNode(!0);if(n.setAttributeNS(null,"clip-rule","evenodd"===this.pendingClip?"evenodd":"nonzero"),this.pendingClip=null,i.append(n),this.defs.append(i),t.activeClipUrl){t.clipGroup=null;for(const t of this.extraStack)t.clipGroup=null;i.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,i]of t)switch(e){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i);break;case"CA":this.setStrokeAlpha(i);break;case"ca":this.setFillAlpha(i);break;default:(0,r.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){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.current;let n=i.dashArray;1!==e&&n.length>0&&(n=n.map((function(t){return e*t}))),t.setAttributeNS(null,"stroke",i.strokeColor),t.setAttributeNS(null,"stroke-opacity",i.strokeAlpha),t.setAttributeNS(null,"stroke-miterlimit",b(i.miterLimit)),t.setAttributeNS(null,"stroke-linecap",i.lineCap),t.setAttributeNS(null,"stroke-linejoin",i.lineJoin),t.setAttributeNS(null,"stroke-width",b(e*i.lineWidth)+"px"),t.setAttributeNS(null,"stroke-dasharray",n.map(b).join(" ")),t.setAttributeNS(null,"stroke-dashoffset",b(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,r.warn)(`Dependent image with object ID ${t} is not ready yet`)}paintInlineImageXObject(t,e){const i=t.width,n=t.height,r=d(t,this.forceDataSchema,!!e),s=this.svgFactory.createElement("svg:rect");s.setAttributeNS(null,"x","0"),s.setAttributeNS(null,"y","0"),s.setAttributeNS(null,"width",b(i)),s.setAttributeNS(null,"height",b(n)),this.current.element=s,this.clip("nonzero");const o=this.svgFactory.createElement("svg:image");o.setAttributeNS(c,"xlink:href",r),o.setAttributeNS(null,"x","0"),o.setAttributeNS(null,"y",b(-n)),o.setAttributeNS(null,"width",b(i)+"px"),o.setAttributeNS(null,"height",b(n)+"px"),o.setAttributeNS(null,"transform",`scale(${b(1/i)} ${b(-1/n)})`),e?e.append(o):this._ensureTransformGroup().append(o)}paintImageMaskXObject(t){const e=this.current,i=t.width,n=t.height,r=e.fillColor;e.maskId="mask"+m++;const s=this.svgFactory.createElement("svg:mask");s.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",b(i)),o.setAttributeNS(null,"height",b(n)),o.setAttributeNS(null,"fill",r),o.setAttributeNS(null,"mask",`url(#${e.maskId})`),this.defs.append(s),this._ensureTransformGroup().append(o),this.paintInlineImageXObject(t,s)}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],n=this.svgFactory.createElement("svg:rect");n.setAttributeNS(null,"x",e[0]),n.setAttributeNS(null,"y",e[1]),n.setAttributeNS(null,"width",b(t)),n.setAttributeNS(null,"height",b(i)),this.current.element=n,this.clip("nonzero"),this.endPath()}}paintFormXObjectEnd(){}_initialize(t){const e=this.svgFactory.create(t.width,t.height),i=this.svgFactory.createElement("svg:defs");e.append(i),this.defs=i;const n=this.svgFactory.createElement("svg:g");return n.setAttributeNS(null,"transform",w(t.transform)),e.append(n),this.svg=n,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",w(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}}}},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PDFNodeStream=void 0;var n=i(1),r=i(158);const s=E,o=E,a=E,h=E,c=/^file:\/\/\/[a-zA-Z]:\//;e.PDFNodeStream=class{constructor(t){this.source=t,this.url=function(t){const e=h.parse(t);return"file:"===e.protocol||e.host?e:/^[a-z]:[/\\]/i.test(t)?h.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,e;return null!==(t=null===(e=this._fullRequestReader)||void 0===e?void 0:e._loaded)&&void 0!==t?t:0}getFullReader(){return(0,n.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new p(this):new d(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=this.isFsUrl?new b(this,t,e):new v(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader&&this._fullRequestReader.cancel(t);for(const e of this._rangeRequestReaders.slice(0))e.cancel(t)}};class u{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,n.createPromiseCapability)(),this._headersCapability=(0,n.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,n.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 n.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class l{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=(0,n.createPromiseCapability)(),this._isStreamingSupported=!t.source.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,n.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 f(t,e){return{protocol:t.protocol,auth:t.auth,host:t.hostname,port:t.port,path:t.path,method:"GET",headers:e}}class d extends u{constructor(t){super(t);const e=e=>{if(404===e.statusCode){const t=new n.MissingPDFException(`Missing PDF "${this._url}".`);return this._storedError=t,void this._headersCapability.reject(t)}this._headersCapability.resolve(),this._setReadableStream(e);const i=t=>this._readableStream.headers[t.toLowerCase()],{allowRangeRequests:s,suggestedLength:o}=(0,r.validateRangeRequestCapabilities)({getResponseHeader:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=o||this._contentLength,this._filename=(0,r.extractFilenameFromHeader)(i)};this._request=null,this._request="http:"===this._url.protocol?o.request(f(this._url,t.httpHeaders),e):a.request(f(this._url,t.httpHeaders),e),this._request.on("error",(t=>{this._storedError=t,this._headersCapability.reject(t)})),this._request.end()}}class v extends l{constructor(t,e,i){super(t),this._httpHeaders={};for(const e in t.httpHeaders){const i=t.httpHeaders[e];void 0!==i&&(this._httpHeaders[e]=i)}this._httpHeaders.Range=`bytes=${e}-${i-1}`;const r=t=>{if(404!==t.statusCode)this._setReadableStream(t);else{const t=new n.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=t}};this._request=null,this._request="http:"===this._url.protocol?o.request(f(this._url,this._httpHeaders),r):a.request(f(this._url,this._httpHeaders),r),this._request.on("error",(t=>{this._storedError=t})),this._request.end()}}class p extends u{constructor(t){super(t);let e=decodeURIComponent(this._url.path);c.test(this._url.href)&&(e=e.replace(/^\//,"")),s.lstat(e,((t,i)=>{if(t)return"ENOENT"===t.code&&(t=new n.MissingPDFException(`Missing PDF "${e}".`)),this._storedError=t,void this._headersCapability.reject(t);this._contentLength=i.size,this._setReadableStream(s.createReadStream(e)),this._headersCapability.resolve()}))}}class b extends l{constructor(t,e,i){super(t);let n=decodeURIComponent(this._url.path);c.test(this._url.href)&&(n=n.replace(/^\//,"")),this._setReadableStream(s.createReadStream(n,{start:e,end:i-1}))}}},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createResponseStatusError=function(t,e){return 404===t||0===t&&e.startsWith("file:")?new n.MissingPDFException('Missing PDF "'+e+'".'):new n.UnexpectedResponseException(`Unexpected server response (${t}) while retrieving PDF "${e}".`,t)},e.extractFilenameFromHeader=function(t){const e=t("Content-Disposition");if(e){let t=(0,r.getFilenameFromContentDispositionHeader)(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch(t){}if((0,s.isPdfFile)(t))return t}return null},e.validateRangeRequestCapabilities=function(t){let{getResponseHeader:e,isHttp:i,rangeChunkSize:n,disableRange:r}=t;const s={allowRangeRequests:!1,suggestedLength:void 0},o=parseInt(e("Content-Length"),10);return Number.isInteger(o)?(s.suggestedLength=o,o<=2*n||r||!i||"bytes"!==e("Accept-Ranges")||"identity"!==(e("Content-Encoding")||"identity")||(s.allowRangeRequests=!0),s):s},e.validateResponseStatus=function(t){return 200===t||206===t};var n=i(1),r=i(159),s=i(133)},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getFilenameFromContentDispositionHeader=function(t){let e=!0,i=r("filename\\*","i").exec(t);if(i){i=i[1];let t=a(i);return t=unescape(t),t=h(t),t=c(t),o(t)}if(i=function(t){const e=[];let i;const n=r("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(i=n.exec(t));){let[,t,n,r]=i;if(t=parseInt(t,10),t in e){if(0===t)break}else e[t]=[n,r]}const s=[];for(let t=0;t<e.length&&t in e;++t){let[i,n]=e[t];n=a(n),i&&(n=unescape(n),0===t&&(n=h(n))),s.push(n)}return s.join("")}(t),i)return o(c(i));if(i=r("filename","i").exec(t),i){i=i[1];let t=a(i);return t=c(t),o(t)}function r(t,e){return new RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',e)}function s(t,i){if(t){if(!/^[\x00-\xFF]+$/.test(i))return i;try{const r=new TextDecoder(t,{fatal:!0}),s=(0,n.stringToBytes)(i);i=r.decode(s),e=!1}catch(t){}}return i}function o(t){return e&&/[\x80-\xff]/.test(t)&&(t=s("utf-8",t),e&&(t=s("iso-8859-1",t))),t}function a(t){if(t.startsWith('"')){const e=t.slice(1).split('\\"');for(let t=0;t<e.length;++t){const i=e[t].indexOf('"');-1!==i&&(e[t]=e[t].slice(0,i),e.length=t+1),e[t]=e[t].replace(/\\(.)/g,"$1")}t=e.join('"')}return t}function h(t){const e=t.indexOf("'");return-1===e?t:s(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,i,n){if("q"===i||"Q"===i)return s(e,n=(n=n.replace(/_/g," ")).replace(/=([0-9a-fA-F]{2})/g,(function(t,e){return String.fromCharCode(parseInt(e,16))})));try{n=atob(n)}catch(t){}return s(e,n)}))}return""};var n=i(1)},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PDFNetworkStream=void 0;var n=i(1),r=i(158);class s{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};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,i){const n={begin:t,end:e};for(const t in i)n[t]=i[t];return this.request(n)}requestFull(t){return this.request(t)}request(t){const e=this.getXhr(),i=this.currXhrId++,n=this.pendingRequests[i]={xhr:e};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(const t in this.httpHeaders){const i=this.httpHeaders[t];void 0!==i&&e.setRequestHeader(t,i)}return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),n.expectedStatus=206):n.expectedStatus=200,e.responseType="arraybuffer",t.onError&&(e.onerror=function(){t.onError(e.status)}),e.onreadystatechange=this.onStateChange.bind(this,i),e.onprogress=this.onProgress.bind(this,i),n.onHeadersReceived=t.onHeadersReceived,n.onDone=t.onDone,n.onError=t.onError,n.onProgress=t.onProgress,e.send(null),i}onProgress(t,e){var i;const n=this.pendingRequests[t];n&&(null===(i=n.onProgress)||void 0===i||i.call(n,e))}onStateChange(t,e){const i=this.pendingRequests[t];if(!i)return;const r=i.xhr;if(r.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),4!==r.readyState)return;if(!(t in this.pendingRequests))return;var s;if(delete this.pendingRequests[t],0===r.status&&this.isHttp)return void(null===(s=i.onError)||void 0===s||s.call(i,r.status));const o=r.status||200;var a;if((200!==o||206!==i.expectedStatus)&&o!==i.expectedStatus)return void(null===(a=i.onError)||void 0===a||a.call(i,r.status));const h=function(t){const e=t.response;return"string"!=typeof e?e:(0,n.stringToBytes)(e).buffer}(r);if(206===o){const t=r.getResponseHeader("Content-Range"),e=/bytes (\d+)-(\d+)\/(\d+)/.exec(t);i.onDone({begin:parseInt(e[1],10),chunk:h})}else if(h)i.onDone({begin:0,chunk:h});else{var c;null===(c=i.onError)||void 0===c||c.call(i,r.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 s(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,n.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new o(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const i=new a(this._manager,t,e);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const e of this._rangeRequestReaders.slice(0))e.cancel(t)}};class o{constructor(t,e){this._manager=t;const i={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(i),this._headersReceivedCapability=(0,n.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),i=t=>e.getResponseHeader(t),{allowRangeRequests:n,suggestedLength:s}=(0,r.validateRangeRequestCapabilities)({getResponseHeader:i,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});n&&(this._isRangeSupported=!0),this._contentLength=s||this._contentLength,this._filename=(0,r.extractFilenameFromHeader)(i),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,r.createResponseStatusError)(t,this._url),this._headersReceivedCapability.reject(this._storedError);for(const t of this._requests)t.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){var e;null===(e=this.onProgress)||void 0===e||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,n.createPromiseCapability)();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersReceivedCapability.reject(t);for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class a{constructor(t,e,i){this._manager=t;const n={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(e,i,n),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)||void 0===t||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 t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){this._storedError=(0,r.createResponseStatusError)(t,this._url);for(const t of this._requests)t.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){var e;this.isStreamingSupported||null===(e=this.onProgress)||void 0===e||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,n.createPromiseCapability)();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PDFFetchStream=void 0;var n=i(1),r=i(158);function s(t,e,i){return{method:"GET",headers:t,signal:i.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function o(t){const e=new Headers;for(const i in t){const n=t[i];void 0!==n&&e.append(i,n)}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,e;return null!==(t=null===(e=this._fullRequestReader)||void 0===e?void 0:e._loaded)&&void 0!==t?t:0}getFullReader(){return(0,n.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new a(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new h(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader&&this._fullRequestReader.cancel(t);for(const e of this._rangeRequestReaders.slice(0))e.cancel(t)}};class a{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,n.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=o(this._stream.httpHeaders);const i=e.url;fetch(i,s(this._headers,this._withCredentials,this._abortController)).then((t=>{if(!(0,r.validateResponseStatus)(t.status))throw(0,r.createResponseStatusError)(t.status,i);this._reader=t.body.getReader(),this._headersCapability.resolve();const e=e=>t.headers.get(e),{allowRangeRequests:s,suggestedLength:o}=(0,r.validateRangeRequestCapabilities)({getResponseHeader:e,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=o||this._contentLength,this._filename=(0,r.extractFilenameFromHeader)(e),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new n.AbortException("Streaming is disabled."))})).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){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 h{constructor(t,e,i){this._stream=t,this._reader=null,this._loaded=0;const a=t.source;this._withCredentials=a.withCredentials||!1,this._readCapability=(0,n.createPromiseCapability)(),this._isStreamingSupported=!a.disableStream,this._abortController=new AbortController,this._headers=o(this._stream.httpHeaders),this._headers.append("Range",`bytes=${e}-${i-1}`);const h=a.url;fetch(h,s(this._headers,this._withCredentials,this._abortController)).then((t=>{if(!(0,r.validateResponseStatus)(t.status))throw(0,r.createResponseStatusError)(t.status,h);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()}}}],e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var s=e[n]={exports:{}};return t[n](s,s.exports,i),s.exports}var n={};return(()=>{var t=n;Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"AnnotationEditorLayer",{enumerable:!0,get:function(){return o.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 a.AnnotationEditorUIManager}}),Object.defineProperty(t,"AnnotationLayer",{enumerable:!0,get:function(){return h.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 c.GlobalWorkerOptions}}),Object.defineProperty(t,"InvalidPDFException",{enumerable:!0,get:function(){return e.InvalidPDFException}}),Object.defineProperty(t,"LoopbackPort",{enumerable:!0,get:function(){return r.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 r.PDFDataRangeTransport}}),Object.defineProperty(t,"PDFDateString",{enumerable:!0,get:function(){return s.PDFDateString}}),Object.defineProperty(t,"PDFWorker",{enumerable:!0,get:function(){return r.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 s.PixelsPerInch}}),Object.defineProperty(t,"RenderingCancelledException",{enumerable:!0,get:function(){return s.RenderingCancelledException}}),Object.defineProperty(t,"SVGGraphics",{enumerable:!0,get:function(){return f.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 r.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 r.getDocument}}),Object.defineProperty(t,"getFilenameFromUrl",{enumerable:!0,get:function(){return s.getFilenameFromUrl}}),Object.defineProperty(t,"getPdfFilenameFromUrl",{enumerable:!0,get:function(){return s.getPdfFilenameFromUrl}}),Object.defineProperty(t,"getXfaPageViewport",{enumerable:!0,get:function(){return s.getXfaPageViewport}}),Object.defineProperty(t,"isPdfFile",{enumerable:!0,get:function(){return s.isPdfFile}}),Object.defineProperty(t,"loadScript",{enumerable:!0,get:function(){return s.loadScript}}),Object.defineProperty(t,"renderTextLayer",{enumerable:!0,get:function(){return l.renderTextLayer}}),Object.defineProperty(t,"shadow",{enumerable:!0,get:function(){return e.shadow}}),Object.defineProperty(t,"version",{enumerable:!0,get:function(){return r.version}});var e=i(1),r=i(129),s=i(133),o=i(147),a=i(132),h=i(152),c=i(140),u=i(3),l=i(155),f=i(156),d=i(154);if(u.isNodeJS){const{PDFNodeStream:t}=i(157);(0,r.setPDFNetworkStreamFactory)((e=>new t(e)))}else{const{PDFNetworkStream:t}=i(160),{PDFFetchStream:e}=i(161);(0,r.setPDFNetworkStreamFactory)((i=>(0,s.isValidFetchUrl)(i.url)?new e(i):new t(i)))}})(),n})(),y.exports=S(),window.pdf=a(y.exports);const x=class{constructor(i){t(this,i),this.activate=e(this,"activate",7),this.visiblePagesChange=e(this,"visiblePagesChange",7),this.pages=[],this.renderingPageNumbers=[],this.recentScrollPosition={x:0,y:0},this.storeRecentScrollPosition=()=>{this.recentScrollPosition={x:Math.round(this.scrollContainer?.scrollLeft/this.scrollContainer?.scrollWidth*100)/100,y:Math.round(this.scrollContainer?.scrollTop/this.scrollContainer?.scrollHeight*100)/100}},this.onScroll=u((()=>{this.updateVisiblePages(),this.storeRecentScrollPosition()}),60),this.errorMessage="File could not be loaded.",this.file=void 0,this.singlePageMode=void 0,this.viewMode="single",this.workerSrc="/pdfjs/pdf.worker.min.js",this.zoom=1,this.currentPage=null,this.doc=void 0,this.error=void 0,this.loading=!0,this.renderedPages=[],this.singlePageModePage=1,this.visiblePages=[]}componentWillLoad(){window.pdf.GlobalWorkerOptions.workerSrc=this.workerSrc}async componentDidLoad(){await this.getPages(),await this.updateVisiblePages(),this.activate.emit(this.el)}componentDidRender(){this.updateVisiblePages()}disconnectedCallback(){this.doc?.destroy()}async onWindowResize(){this.visiblePages=[],this.renderedPages=[],await this.updateVisiblePages()}async watchProps(){await this.getPages(),await this.updateVisiblePages()}async watchViewMode(){queueMicrotask((async()=>{this.visiblePages=[],this.renderedPages=[],await this.updateVisiblePages()}))}watchZoom(){queueMicrotask((async()=>{this.restoreScrollPosition(),this.visiblePages=[],this.renderedPages=[],await this.updateVisiblePages()}))}async getThumbnails(){return await Promise.all(this.pages.filter(Boolean).map((t=>{const e=t.getViewport({scale:1}),i=document.createElement("canvas");i.width=e.width,i.height=e.height;const n=Math.min(i.width/e.width,i.height/e.height);return t.render({canvasContext:i.getContext("2d"),viewport:t.getViewport({scale:n})}).promise.then((function(){return i}))})))}async print(){this.loading=!0,await this.updateVisiblePages(!0),await this.openPrintDialog(),this.loading=!1}async nextPage(){await this.setPage(this.singlePageModePage+1),await this.updateVisiblePages()}async previousPage(){await this.setPage(this.singlePageModePage-1),await this.updateVisiblePages()}async setPage(t){this.singlePageModePage=Math.min(Math.max(t,1),this.pages.length-1),await this.updateVisiblePages()}async getPages(){this.error=!1,this.loading=!0;try{Boolean(this.doc)&&this.doc.destroy(),this.doc=await y.exports.getDocument({isEvalSupported:!1,url:this.file}).promise;const t=[];for(let e=1;e<=this.doc.numPages;e++)t.push(this.doc.getPage(e));this.pages=await Promise.all(t),this.loading=!1}catch(t){this.error=!0,this.loading=!1}}async renderVisiblePages(t){const e=Array.from(this.el.shadowRoot.querySelectorAll("canvas")),i=[];for(const n of e){const e=n.closest(".file-viewer-pdf__page"),r=this.pages.find((t=>t?.pageNumber===+e?.dataset.pageNumber));Boolean(r)&&!this.renderingPageNumbers.includes(r.pageNumber)&&(this.visiblePages.includes(r.pageNumber)||t?!this.renderedPages.includes(r.pageNumber)||t?(await this.renderPage(r,n,t),i.push(r.pageNumber)):i.push(r.pageNumber):this.destroyPage(r))}this.renderedPages=i}async renderPage(t,e,i){const n=e.closest(".file-viewer-pdf__page"),r=n?.querySelector(".file-viewer-pdf__text-container");this.renderingPageNumbers=[...this.renderingPageNumbers,t.pageNumber];const s=i?2:this.getScale(t),o=window.devicePixelRatio||1,a=1!==o?[o,0,0,o,0,0]:null,h=t.getViewport({scale:s}),c=e.getContext("2d");e.height=Math.floor(h.height*o),e.width=Math.floor(h.width*o);const u={canvasContext:c,transform:a,viewport:h};try{await t.render(u).promise,t.cleanup(),r.innerHTML="",this.renderTextLayer(t,r).catch(),this.renderingPageNumbers=this.renderingPageNumbers.filter((e=>e!==t.pageNumber))}catch(t){}}destroyPage(t){const e=this.el.shadowRoot.querySelector(`[data-page-number="${t.pageNumber}"]`),i=e.querySelector("canvas"),n=e.querySelector(".file-viewer-pdf__text-container");i.width=1,i.height=1,i.getContext("2d").clearRect(0,0,i.width,i.height),n.innerHTML=""}async updateVisiblePages(t){const e=Array.from(this.el.shadowRoot.querySelectorAll(".file-viewer-pdf__page"));let i=[],n=null;if(this.singlePageMode)i=[this.singlePageModePage],n=this.singlePageModePage;else if(t)i=e.map((t=>+t.dataset.pageNumber));else{const t=e.map((t=>({pageNumber:+t.dataset.pageNumber,visibleHeight:l(t,this.scrollContainer)}))).filter((({visibleHeight:t})=>t>0));i=t.map((t=>t.pageNumber)),t.length>0&&(n=t.reduce(((t,e)=>e.visibleHeight>t.visibleHeight?e:t),void 0).pageNumber)}this.visiblePages.length===i.length&&this.visiblePages.every((t=>i.includes(t)))&&this.currentPage===n||(this.visiblePages=i,this.currentPage=n,await this.renderVisiblePages(t),this.visiblePagesChange.emit(this.visiblePages))}async renderTextLayer(t,e){y.exports.renderTextLayer({container:e,textContent:await t.getTextContent(),viewport:t.getViewport({scale:this.getScale(t)})})}async openPrintDialog(){const t=Array.from(this.scrollContainer.querySelectorAll("canvas"));let e=`\n <!DOCTYPE html>\n <html lang="en">\n <head>\n <meta charset="UTF-8">\n <meta http-equiv="X-UA-Compatible" content="IE=edge">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>${this.file}</title>\n <style>\n *, *:before, *:after {\n margin: 0;\n padding: 0;\n outline: 0;\n }\n\n @page {\n size: a4 !important;\n margin: 0;\n padding: 0;\n }\n\n html, body {\n width: 210mm;\n height: 297mm;\n }\n\n img {\n display: block;\n max-width: 100%;\n max-height: 100%;\n page-break-after: always;\n }\n </style>\n </head>\n <body>\n `;for(const i of t)e+=`<img src="${i.toDataURL()}">`;e+="\n </body>\n </html>\n ";const i=document.createElement("iframe");this.el.append(i);const n=i.contentWindow;n.document.write(e),n.focus(),await new Promise((t=>setTimeout(t,100))),n.print(),i.remove()}getScale(t){const e=f()?0:32;return"auto"===this.zoom?(this.scrollContainer?.clientWidth-e)/t.view[2]:isNaN(this.zoom)?1:this.zoom}restoreScrollPosition(){this.scrollContainer.scrollTop=this.recentScrollPosition.y*this.scrollContainer?.scrollHeight,this.scrollContainer.scrollLeft=this.recentScrollPosition.x*this.scrollContainer?.scrollWidth}render(){const t=!this.error&&!this.loading&&this.visiblePages.length>0,e=this.loading,r=c("file-viewer-pdf",`file-viewer-pdf--view-mode-${this.viewMode}`);return i(n,{key:"1d3dc1cafdc8be24848eb1549e2ad34598acc36a",class:r,exportparts:"file-viewer-pdf__pagination"},this.error&&i("swirl-inline-error",{key:"2c3aab82aa87b4206729bc60cf4d24687b518a93",class:"file-viewer-pdf__error",message:this.errorMessage}),i("div",{key:"4531eac7ee983b0a383de43da7948b7e8494dc39","aria-describedby":"pagination",class:"file-viewer-pdf__pages",onScroll:this.onScroll,ref:t=>this.scrollContainer=t},this.pages.map((t=>{const e=t.getViewport({scale:this.getScale(t)}),n=e.height,r=e.width,s=this.renderedPages.includes(t.pageNumber);return i("div",{"aria-label":t.pageNumber,class:"file-viewer-pdf__page","data-page-number":t.pageNumber,hidden:!(!this.singlePageMode||t.pageNumber===this.singlePageModePage)||void 0,id:`page-${t.pageNumber}`,key:t.pageNumber,role:"region",style:{width:`${r}px`,height:`${n}px`},tabIndex:0},!s&&i("swirl-spinner",{class:"file-viewer-pdf__page-spinner"}),i("canvas",{class:"file-viewer-pdf__canvas",style:{opacity:s?"1":"0"}}),i("div",{class:"file-viewer-pdf__text-container"}))}))),t&&i("span",{key:"14e3ddf6e83d01858a8ab3bc1ae7770de2dbe619",class:"file-viewer-pdf__pagination",id:"pagination",part:"file-viewer-pdf__pagination"},i("span",{key:"a814c965764d051c09cdf75cd45118e080044c22","aria-current":"page"},this.currentPage)," /"," ",this.doc.numPages),e&&i("div",{key:"659799cb5334277cb74077d58bfc698c6abc7079",class:"file-viewer-pdf__spinner"},i("swirl-spinner",{key:"a738004bb01a29571b7898d497bc24ed6f9197f3"})))}get el(){return r(this)}static get watchers(){return{file:["watchProps"],viewMode:["watchViewMode"],zoom:["watchZoom"]}}};x.style=":host{position:relative;display:inline-flex;width:100%;height:100%;pointer-events:auto}:host(.file-viewer-pdf--view-mode-side-by-side) .file-viewer-pdf__pages{display:grid;grid-template-columns:repeat(2, 1fr);grid-row-gap:var(--s-space-8);grid-column-gap:var(--s-space-8);grid-auto-rows:auto}:host(.file-viewer-pdf--view-mode-side-by-side) .file-viewer-pdf__page{margin:0}:host(.file-viewer-pdf--view-mode-side-by-side) .file-viewer-pdf__page:nth-child(odd){justify-self:end}:host(.file-viewer-pdf--view-mode-side-by-side) .file-viewer-pdf__page:nth-child(even){justify-self:start}:host *{box-sizing:border-box}.file-viewer-pdf__pages{overflow:auto;width:100%;height:100%}@media (min-width: 768px){.file-viewer-pdf__pages{padding:var(--s-space-16)}}.file-viewer-pdf__page{position:relative;margin-right:auto;margin-left:auto;border-bottom:var(--s-border-width-default) solid var(--s-border-default);background-color:#fff}@media (min-width: 768px){.file-viewer-pdf__page{border:var(--s-border-width-default) solid var(--s-border-default)}.file-viewer-pdf__page:not(:last-of-type){margin-bottom:var(--s-space-8)}}.file-viewer-pdf__page-spinner{position:absolute;top:50%;left:50%;transform:translate3d(-50%, -50%, 0)}.file-viewer-pdf__canvas{display:flex;width:100%;height:100%;margin-right:auto;margin-left:auto}.file-viewer-pdf__text-container{position:absolute;overflow:hidden;line-height:1;text-align:initial;-webkit-user-select:none;-moz-user-select:none;user-select:none;inset:0;-webkit-text-size-adjust:none;-moz-text-size-adjust:none;text-size-adjust:none;forced-color-adjust:none}.file-viewer-pdf__text-container>*{position:absolute;color:transparent;white-space:pre;cursor:text;transform-origin:0% 0%}.file-viewer-pdf__text-container>*.markedContent{top:0;height:0}.file-viewer-pdf__text-container>*.highlight{margin:-1px;padding:1px;border-radius:4px;background-color:rgba(180, 0, 170, 1)}.file-viewer-pdf__text-container>*.highlight.appended{position:initial}.file-viewer-pdf__text-container>*.highlight.begin{border-radius:4px 0 0 4px}.file-viewer-pdf__text-container>*.highlight.end{border-radius:0 4px 4px 0}.file-viewer-pdf__text-container>*.highlight.middle{border-radius:0}.file-viewer-pdf__text-container>*.highlight.selected{background-color:rgba(0, 100, 0, 1)}.file-viewer-pdf__text-container>*.endOfContent{position:absolute;z-index:-1;top:100%;right:0;bottom:0;left:0;display:block;cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none}.file-viewer-pdf__text-container>*.endOfContent.active{top:0}.file-viewer-pdf__text-container>br::-moz-selection{background:transparent}.file-viewer-pdf__text-container>br::selection{background:transparent}@media (min-width: 768px){.file-viewer-pdf__text-container{-webkit-user-select:auto;-moz-user-select:auto;user-select:auto}}.file-viewer-pdf__spinner{position:absolute;display:flex;justify-content:center;align-items:center;background-color:rgba(0, 0, 0, 0.2);inset:0}.file-viewer-pdf__error{position:absolute;top:50%;left:50%;transform:translate3d(-50%, -50%, 0)}.file-viewer-pdf__pagination{position:absolute;bottom:var(--s-space-16);left:50%;padding:var(--s-space-4) var(--s-space-12);border-radius:var(--s-border-radius-base);color:var(--s-text-on-image);background-color:rgba(0, 0, 0, 0.6);font-weight:var(--s-font-weight-medium);line-height:var(--s-line-height-base);transform:translateX(-50%);pointer-events:none}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.file-viewer-pdf__pagination{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}";const T=class{constructor(i){t(this,i),this.activate=e(this,"activate",7),this.errorMessage="File could not be loaded.",this.file=void 0,this.error=void 0,this.loading=void 0,this.text=void 0}componentWillLoad(){this.updateText()}componentDidLoad(){this.activate.emit(this.el)}async updateText(){this.error=!1,this.loading=!0;try{const t=await fetch(this.file);this.text=await t.text(),this.loading=!1}catch(t){this.loading=!1,this.error=!0}}render(){return i(n,{key:"906e67ca66d8243b8ea1a9012462d2635c341b18",class:"file-viewer-text",exportparts:"file-viewer-text__text"},this.error&&i("swirl-inline-error",{key:"1adff96153d849dcf93a885f33e1d4dd7eefaa67",class:"file-viewer-text__error",message:this.errorMessage}),i("pre",{key:"5a05947f405f6452dc674782b38945570d7a2847",class:"file-viewer-text__text",part:"file-viewer-text__text",tabIndex:0},this.text),this.loading&&i("div",{key:"922c8419088bc441761226aac66d644240689d1a",class:"file-viewer-text__spinner"},i("swirl-spinner",{key:"cc183ed9ecd4582bb6c5b7c84c9a0e23bd6cc72b"})))}get el(){return r(this)}static get watchers(){return{file:["updateText"]}}};T.style=":host{position:relative;display:inline-flex;width:100%;max-height:100%;pointer-events:auto}:host *{box-sizing:border-box}.file-viewer-text__text{overflow:auto;width:100%;max-height:100%;margin:0;padding:0;padding:var(--s-space-16);background-color:var(--s-background-default);font-family:var(--s-font-family-code)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.file-viewer-text__text{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.file-viewer-text__spinner{position:absolute;display:flex;justify-content:center;align-items:center;background-color:rgba(0, 0, 0, 0.2);inset:0}.file-viewer-text__error{position:absolute;top:50%;left:50%;transform:translate3d(-50%, -50%, 0)}";const _=class{constructor(i){t(this,i),this.activate=e(this,"activate",7),this.autoplay=void 0,this.disableDownload=void 0,this.file=void 0,this.type=void 0}componentDidLoad(){this.activate.emit(this.el),this.disableDownload&&this.videoEl.setAttribute("controlsList","nodownload")}watchDisableDownload(){this.disableDownload?this.videoEl.setAttribute("controlsList","nodownload"):this.videoEl.removeAttribute("controlsList")}render(){return i(n,{key:"f8f2bef246a6df61c0e35566651ea8b348d6a9f4",class:"file-viewer-video"},i("video",{key:"51a0ac1e270cb96fa80e46a327be080989e07f25",autoplay:this.autoplay,class:"file-viewer-video__video",controls:!0,ref:t=>this.videoEl=t},i("source",{key:"86fa6c072078272c9801e33444891521043fe9c6",src:this.file,type:this.type})))}get el(){return r(this)}static get watchers(){return{disableDownload:["watchDisableDownload"]}}};_.style=":host{display:inline-flex;width:100%;max-height:100%;pointer-events:auto}:host *{box-sizing:border-box}.file-viewer-video__video{width:100%;background-color:rgba(0, 0, 0, 1)}";export{p as swirl_file_viewer,b as swirl_file_viewer_audio,g as swirl_file_viewer_csv,m as swirl_file_viewer_fallback,A as swirl_file_viewer_image,x as swirl_file_viewer_pdf,T as swirl_file_viewer_text,_ as swirl_file_viewer_video}
41
+ */var S;globalThis,S=()=>(()=>{var t=[,(t,e,i)=>{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=u,e.arraysToBytes=function(t){const e=t.length;if(1===e&&t[0]instanceof Uint8Array)return t[0];let i=0;for(let n=0;n<e;n++)i+=u(t[n]);let n=0;const r=new Uint8Array(i);for(let i=0;i<e;i++){let e=t[i];e instanceof Uint8Array||(e="string"==typeof e?c(e):new Uint8Array(e));const s=e.byteLength;r.set(e,n),n+=s}return r},e.assert=function(t,e){t||o(e)},e.bytesToString=function(t){"object"==typeof t&&null!==t&&void 0!==t.length||o("Invalid argument for bytesToString");const e=t.length,i=8192;if(e<i)return String.fromCharCode.apply(null,t);const n=[];for(let r=0;r<e;r+=i){const s=Math.min(r+i,e),o=t.subarray(r,s);n.push(String.fromCharCode.apply(null,o))}return n.join("")},e.createPromiseCapability=function(){const t=Object.create(null);let e=!1;return Object.defineProperty(t,"settled",{get:()=>e}),t.promise=new Promise((function(i,n){t.resolve=function(t){e=!0,i(t)},t.reject=function(t){e=!0,n(t)}})),t},e.createValidAbsoluteUrl=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!t)return null;try{if(i&&"string"==typeof t){if(i.addDefaultProtocol&&t.startsWith("www.")){const e=t.match(/\./g);e&&e.length>=2&&(t=`http://${t}`)}if(i.tryConvertEncoding)try{t=v(t)}catch(t){}}const n=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}}(n))return n}catch(t){}return null},e.escapeString=function(t){return t.replace(/([()\\\n\r])/g,(t=>"\n"===t?"\\n":"\r"===t?"\\r":`\\${t}`))},e.getModificationDate=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]: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 r},e.info=function(t){r>=n.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 i=0,n=t.length;i<n;i++)if(t[i]!==e[i])return!1;return!0},e.isAscii=function(t){return/^[\x00-\x7F]*$/.test(t)},e.objectFromMap=function(t){const e=Object.create(null);for(const[i,n]of t)e[i]=n;return e},e.objectSize=function(t){return Object.keys(t).length},e.setVerbosityLevel=function(t){Number.isInteger(t)&&(r=t)},e.shadow=a,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 i=new TextDecoder(e,{fatal:!0}),n=c(t);return i.decode(n)}catch(t){s(`stringToPDFString: "${t}".`)}}const e=[];for(let i=0,n=t.length;i<n;i++){const n=d[t.charCodeAt(i)];e.push(n?String.fromCharCode(n):t.charAt(i))}return e.join("")},e.stringToUTF16BEString=function(t){const e=["þÿ"];for(let i=0,n=t.length;i<n;i++){const n=t.charCodeAt(i);e.push(String.fromCharCode(n>>8&255),String.fromCharCode(255&n))}return e.join("")},e.stringToUTF8String=v,e.unreachable=o,e.utf8StringToString=function(t){return unescape(encodeURIComponent(t))},e.warn=s,i(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 n={ERRORS:0,WARNINGS:1,INFOS:5};e.VerbosityLevel=n,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 r=n.WARNINGS;function s(t){r>=n.WARNINGS&&console.log(`Warning: ${t}`)}function o(t){throw new Error(t)}function a(t,e,i){return Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!1}),i}const h=function(){function t(e,i){this.constructor===t&&o("Cannot initialize BaseException."),this.message=e,this.name=i}return t.prototype=new Error,t.constructor=t,t}();function c(t){"string"!=typeof t&&o("Invalid argument for stringToBytes");const e=t.length,i=new Uint8Array(e);for(let n=0;n<e;++n)i[n]=255&t.charCodeAt(n);return i}function u(t){return void 0!==t.length?t.length:void 0!==t.byteLength?t.byteLength:void o("Invalid argument for arrayByteLength")}e.BaseException=h,e.PasswordException=class extends h{constructor(t,e){super(t,"PasswordException"),this.code=e}},e.UnknownErrorException=class extends h{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}},e.InvalidPDFException=class extends h{constructor(t){super(t,"InvalidPDFException")}},e.MissingPDFException=class extends h{constructor(t){super(t,"MissingPDFException")}},e.UnexpectedResponseException=class extends h{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}},e.FormatError=class extends h{constructor(t){super(t,"FormatError")}},e.AbortException=class extends h{constructor(t){super(t,"AbortException")}},e.FeatureTest=class{static get isLittleEndian(){return a(this,"isLittleEndian",function(){const t=new Uint8Array(4);return t[0]=1,1===new Uint32Array(t.buffer,0,1)[0]}())}static get isEvalSupported(){return a(this,"isEvalSupported",!1)}static get isOffscreenCanvasSupported(){return a(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}};const l=[...Array(256).keys()].map((t=>t.toString(16).padStart(2,"0")));class f{static makeHexColor(t,e,i){return`#${l[t]}${l[e]}${l[i]}`}static scaleMinMax(t,e){let i;t[0]?(t[0]<0&&(i=e[0],e[0]=e[1],e[1]=i),e[0]*=t[0],e[1]*=t[0],t[3]<0&&(i=e[2],e[2]=e[3],e[3]=i),e[2]*=t[3],e[3]*=t[3]):(i=e[0],e[0]=e[2],e[2]=i,i=e[1],e[1]=e[3],e[3]=i,t[1]<0&&(i=e[2],e[2]=e[3],e[3]=i),e[2]*=t[1],e[3]*=t[1],t[2]<0&&(i=e[0],e[0]=e[1],e[1]=i),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 i=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])/i,(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/i]}static getAxialAlignedBoundingBox(t,e){const i=f.applyTransform(t,e),n=f.applyTransform(t.slice(2,4),e),r=f.applyTransform([t[0],t[3]],e),s=f.applyTransform([t[2],t[1]],e);return[Math.min(i[0],n[0],r[0],s[0]),Math.min(i[1],n[1],r[1],s[1]),Math.max(i[0],n[0],r[0],s[0]),Math.max(i[1],n[1],r[1],s[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]],i=t[0]*e[0]+t[1]*e[2],n=t[2]*e[1]+t[3]*e[3],r=(i+n)/2,s=Math.sqrt((i+n)**2-4*(i*n-(t[2]*e[0]+t[3]*e[2])*(t[0]*e[1]+t[1]*e[3])))/2,o=r-s||1;return[Math.sqrt(r+s||1),Math.sqrt(o)]}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 i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),n=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>n)return null;const r=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),s=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return r>s?null:[i,r,n,s]}static bezierBoundingBox(t,e,i,n,r,s,o,a){const h=[],c=[[],[]];let u,l,f,d,v,p,b,w;for(let c=0;c<2;++c)if(0===c?(l=6*t-12*i+6*r,u=-3*t+9*i-9*r+3*o,f=3*i-3*t):(l=6*e-12*n+6*s,u=-3*e+9*n-9*s+3*a,f=3*n-3*e),Math.abs(u)<1e-12){if(Math.abs(l)<1e-12)continue;d=-f/l,0<d&&d<1&&h.push(d)}else b=l*l-4*f*u,w=Math.sqrt(b),b<0||(v=(-l+w)/(2*u),0<v&&v<1&&h.push(v),p=(-l-w)/(2*u),0<p&&p<1&&h.push(p));let g,m=h.length;const A=m;for(;m--;)d=h[m],g=1-d,c[0][m]=g*g*g*t+3*g*g*d*i+3*g*d*d*r+d*d*d*o,c[1][m]=g*g*g*e+3*g*g*d*n+3*g*d*d*s+d*d*d*a;return c[0][A]=t,c[1][A]=e,c[0][A+1]=o,c[1][A+1]=a,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=f;const d=[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 v(t){return decodeURIComponent(escape(t))}},(t,e,i)=>{var n=i(3);globalThis._pdfjsCompatibilityChecked||(globalThis._pdfjsCompatibilityChecked=!0,!globalThis.btoa&&n.isNodeJS&&(globalThis.btoa=function(t){return Buffer.from(t,"binary").toString("base64")}),!globalThis.atob&&n.isNodeJS&&(globalThis.atob=function(t){return Buffer.from(t,"base64").toString("binary")}),!globalThis.DOMMatrix&&n.isNodeJS&&(globalThis.DOMMatrix=k.exports),!globalThis.ReadableStream&&n.isNodeJS&&(globalThis.ReadableStream=M.exports.ReadableStream),Array.prototype.at||i(4),Uint8Array.prototype.at||i(76),globalThis.structuredClone||i(86))},(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isNodeJS=void 0;const i=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type);e.isNodeJS=i},(t,e,i)=>{i(5);var n=i(75);t.exports=n("Array","at")},(t,e,i)=>{var n=i(6),r=i(41),s=i(65),o=i(63),a=i(70);n({target:"Array",proto:!0},{at:function(t){var e=r(this),i=s(e),n=o(t),a=n>=0?n:i+n;return a<0||a>=i?void 0:e[a]}}),a("at")},(t,e,i)=>{var n=i(7),r=i(8).f,s=i(45),o=i(49),a=i(39),h=i(57),c=i(69);t.exports=function(t,e){var i,u,l,f,d,v=t.target,p=t.global,b=t.stat;if(i=p?n:b?n[v]||a(v,{}):(n[v]||{}).prototype)for(u in e){if(f=e[u],l=t.dontCallGetSet?(d=r(i,u))&&d.value:i[u],!c(p?u:v+(b?".":"#")+u,t.forced)&&void 0!==l){if(typeof f==typeof l)continue;h(f,l)}(t.sham||l&&l.sham)&&s(f,"sham",!0),o(i,u,f,t)}}},t=>{var e=function(t){return t&&t.Math==Math&&t};t.exports=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof s&&s)||function(){return this}()},(t,e,i)=>{var n=i(9),r=i(11),s=i(13),o=i(14),a=i(15),h=i(20),c=i(40),u=i(43),l=Object.getOwnPropertyDescriptor;e.f=n?l:function(t,e){if(t=a(t),e=h(e),u)try{return l(t,e)}catch(t){}if(c(t,e))return o(!r(s.f,t,e),t[e])}},(t,e,i)=>{var n=i(10);t.exports=!n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},t=>{t.exports=function(t){try{return!!t()}catch(t){return!0}}},(t,e,i)=>{var n=i(12),r=Function.prototype.call;t.exports=n?r.bind(r):function(){return r.apply(r,arguments)}},(t,e,i)=>{var n=i(10);t.exports=!n((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},(t,e)=>{var i={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,r=n&&!i.call({1:2},1);e.f=r?function(t){var e=n(this,t);return!!e&&e.enumerable}:i},t=>{t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},(t,e,i)=>{var n=i(16),r=i(19);t.exports=function(t){return n(r(t))}},(t,e,i)=>{var n=i(17),r=i(10),s=i(18),o=Object,a=n("".split);t.exports=r((function(){return!o("z").propertyIsEnumerable(0)}))?function(t){return"String"==s(t)?a(t,""):o(t)}:o},(t,e,i)=>{var n=i(12),r=Function.prototype,s=r.call,o=n&&r.bind.bind(s,s);t.exports=n?function(t){return t&&o(t)}:function(t){return t&&function(){return s.apply(t,arguments)}}},(t,e,i)=>{var n=i(17),r=n({}.toString),s=n("".slice);t.exports=function(t){return s(r(t),8,-1)}},t=>{var e=TypeError;t.exports=function(t){if(null==t)throw e("Can't call method on "+t);return t}},(t,e,i)=>{var n=i(21),r=i(24);t.exports=function(t){var e=n(t,"string");return r(e)?e:e+""}},(t,e,i)=>{var n=i(11),r=i(22),s=i(24),o=i(31),a=i(34),h=i(35),c=TypeError,u=h("toPrimitive");t.exports=function(t,e){if(!r(t)||s(t))return t;var i,h=o(t,u);if(h){if(void 0===e&&(e="default"),i=n(h,t,e),!r(i)||s(i))return i;throw c("Can't convert object to primitive value")}return void 0===e&&(e="number"),a(t,e)}},(t,e,i)=>{var n=i(23);t.exports=function(t){return"object"==typeof t?null!==t:n(t)}},t=>{t.exports=function(t){return"function"==typeof t}},(t,e,i)=>{var n=i(25),r=i(23),s=i(26),o=i(27),a=Object;t.exports=o?function(t){return"symbol"==typeof t}:function(t){var e=n("Symbol");return r(e)&&s(e.prototype,a(t))}},(t,e,i)=>{var n=i(7),r=i(23);t.exports=function(t,e){return arguments.length<2?r(i=n[t])?i:void 0:n[t]&&n[t][e];var i}},(t,e,i)=>{var n=i(17);t.exports=n({}.isPrototypeOf)},(t,e,i)=>{var n=i(28);t.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},(t,e,i)=>{var n=i(29),r=i(10);t.exports=!!Object.getOwnPropertySymbols&&!r((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&n&&n<41}))},(t,e,i)=>{var n,r,s=i(7),o=i(30),a=s.process,h=s.Deno,c=a&&a.versions||h&&h.version,u=c&&c.v8;u&&(r=(n=u.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1])),!r&&o&&(!(n=o.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=o.match(/Chrome\/(\d+)/))&&(r=+n[1]),t.exports=r},(t,e,i)=>{var n=i(25);t.exports=n("navigator","userAgent")||""},(t,e,i)=>{var n=i(32);t.exports=function(t,e){var i=t[e];return null==i?void 0:n(i)}},(t,e,i)=>{var n=i(23),r=i(33),s=TypeError;t.exports=function(t){if(n(t))return t;throw s(r(t)+" is not a function")}},t=>{var e=String;t.exports=function(t){try{return e(t)}catch(t){return"Object"}}},(t,e,i)=>{var n=i(11),r=i(23),s=i(22),o=TypeError;t.exports=function(t,e){var i,a;if("string"===e&&r(i=t.toString)&&!s(a=n(i,t)))return a;if(r(i=t.valueOf)&&!s(a=n(i,t)))return a;if("string"!==e&&r(i=t.toString)&&!s(a=n(i,t)))return a;throw o("Can't convert object to primitive value")}},(t,e,i)=>{var n=i(7),r=i(36),s=i(40),o=i(42),a=i(28),h=i(27),c=r("wks"),u=n.Symbol,l=u&&u.for,f=h?u:u&&u.withoutSetter||o;t.exports=function(t){if(!s(c,t)||!a&&"string"!=typeof c[t]){var e="Symbol."+t;c[t]=a&&s(u,t)?u[t]:h&&l?l(e):f(e)}return c[t]}},(t,e,i)=>{var n=i(37),r=i(38);(t.exports=function(t,e){return r[t]||(r[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.24.1",mode:n?"pure":"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.24.1/LICENSE",source:"https://github.com/zloirock/core-js"})},t=>{t.exports=!1},(t,e,i)=>{var n=i(7),r=i(39),s="__core-js_shared__",o=n[s]||r(s,{});t.exports=o},(t,e,i)=>{var n=i(7),r=Object.defineProperty;t.exports=function(t,e){try{r(n,t,{value:e,configurable:!0,writable:!0})}catch(i){n[t]=e}return e}},(t,e,i)=>{var n=i(17),r=i(41),s=n({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return s(r(t),e)}},(t,e,i)=>{var n=i(19),r=Object;t.exports=function(t){return r(n(t))}},(t,e,i)=>{var n=i(17),r=0,s=Math.random(),o=n(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+o(++r+s,36)}},(t,e,i)=>{var n=i(9),r=i(10),s=i(44);t.exports=!n&&!r((function(){return 7!=Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a}))},(t,e,i)=>{var n=i(7),r=i(22),s=n.document,o=r(s)&&r(s.createElement);t.exports=function(t){return o?s.createElement(t):{}}},(t,e,i)=>{var n=i(9),r=i(46),s=i(14);t.exports=n?function(t,e,i){return r.f(t,e,s(1,i))}:function(t,e,i){return t[e]=i,t}},(t,e,i)=>{var n=i(9),r=i(43),s=i(47),o=i(48),a=i(20),h=TypeError,c=Object.defineProperty,u=Object.getOwnPropertyDescriptor,l="enumerable",f="configurable",d="writable";e.f=n?s?function(t,e,i){if(o(t),e=a(e),o(i),"function"==typeof t&&"prototype"===e&&"value"in i&&d in i&&!i[d]){var n=u(t,e);n&&n[d]&&(t[e]=i.value,i={configurable:f in i?i[f]:n[f],enumerable:l in i?i[l]:n[l],writable:!1})}return c(t,e,i)}:c:function(t,e,i){if(o(t),e=a(e),o(i),r)try{return c(t,e,i)}catch(t){}if("get"in i||"set"in i)throw h("Accessors not supported");return"value"in i&&(t[e]=i.value),t}},(t,e,i)=>{var n=i(9),r=i(10);t.exports=n&&r((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},(t,e,i)=>{var n=i(22),r=String,s=TypeError;t.exports=function(t){if(n(t))return t;throw s(r(t)+" is not an object")}},(t,e,i)=>{var n=i(23),r=i(46),s=i(50),o=i(39);t.exports=function(t,e,i,a){a||(a={});var h=a.enumerable,c=void 0!==a.name?a.name:e;if(n(i)&&s(i,c,a),a.global)h?t[e]=i:o(e,i);else{try{a.unsafe?t[e]&&(h=!0):delete t[e]}catch(t){}h?t[e]=i:r.f(t,e,{value:i,enumerable:!1,configurable:!a.nonConfigurable,writable:!a.nonWritable})}return t}},(t,e,i)=>{var n=i(10),r=i(23),s=i(40),o=i(9),a=i(51).CONFIGURABLE,h=i(52),c=i(53),u=c.enforce,l=c.get,f=Object.defineProperty,d=o&&!n((function(){return 8!==f((function(){}),"length",{value:8}).length})),v=String(String).split("String"),p=t.exports=function(t,e,i){"Symbol("===String(e).slice(0,7)&&(e="["+String(e).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!s(t,"name")||a&&t.name!==e)&&(o?f(t,"name",{value:e,configurable:!0}):t.name=e),d&&i&&s(i,"arity")&&t.length!==i.arity&&f(t,"length",{value:i.arity});try{i&&s(i,"constructor")&&i.constructor?o&&f(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var n=u(t);return s(n,"source")||(n.source=v.join("string"==typeof e?e:"")),t};Function.prototype.toString=p((function(){return r(this)&&l(this).source||h(this)}),"toString")},(t,e,i)=>{var n=i(9),r=i(40),s=Function.prototype,o=n&&Object.getOwnPropertyDescriptor,a=r(s,"name"),h=a&&"something"===function(){}.name,c=a&&(!n||n&&o(s,"name").configurable);t.exports={EXISTS:a,PROPER:h,CONFIGURABLE:c}},(t,e,i)=>{var n=i(17),r=i(23),s=i(38),o=n(Function.toString);r(s.inspectSource)||(s.inspectSource=function(t){return o(t)}),t.exports=s.inspectSource},(t,e,i)=>{var n,r,s,o=i(54),a=i(7),h=i(17),c=i(22),u=i(45),l=i(40),f=i(38),d=i(55),v=i(56),p="Object already initialized",b=a.TypeError;if(o||f.state){var w=f.state||(f.state=new(0,a.WeakMap)),g=h(w.get),m=h(w.has),A=h(w.set);n=function(t,e){if(m(w,t))throw new b(p);return e.facade=t,A(w,t,e),e},r=function(t){return g(w,t)||{}},s=function(t){return m(w,t)}}else{var y=d("state");v[y]=!0,n=function(t,e){if(l(t,y))throw new b(p);return e.facade=t,u(t,y,e),e},r=function(t){return l(t,y)?t[y]:{}},s=function(t){return l(t,y)}}t.exports={set:n,get:r,has:s,enforce:function(t){return s(t)?r(t):n(t,{})},getterFor:function(t){return function(e){var i;if(!c(e)||(i=r(e)).type!==t)throw b("Incompatible receiver, "+t+" required");return i}}}},(t,e,i)=>{var n=i(7),r=i(23),s=i(52),o=n.WeakMap;t.exports=r(o)&&/native code/.test(s(o))},(t,e,i)=>{var n=i(36),r=i(42),s=n("keys");t.exports=function(t){return s[t]||(s[t]=r(t))}},t=>{t.exports={}},(t,e,i)=>{var n=i(40),r=i(58),s=i(8),o=i(46);t.exports=function(t,e,i){for(var a=r(e),h=o.f,c=s.f,u=0;u<a.length;u++){var l=a[u];n(t,l)||i&&n(i,l)||h(t,l,c(e,l))}}},(t,e,i)=>{var n=i(25),r=i(17),s=i(59),o=i(68),a=i(48),h=r([].concat);t.exports=n("Reflect","ownKeys")||function(t){var e=s.f(a(t)),i=o.f;return i?h(e,i(t)):e}},(t,e,i)=>{var n=i(60),r=i(67).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return n(t,r)}},(t,e,i)=>{var n=i(17),r=i(40),s=i(15),o=i(61).indexOf,a=i(56),h=n([].push);t.exports=function(t,e){var i,n=s(t),c=0,u=[];for(i in n)!r(a,i)&&r(n,i)&&h(u,i);for(;e.length>c;)r(n,i=e[c++])&&(~o(u,i)||h(u,i));return u}},(t,e,i)=>{var n=i(15),r=i(62),s=i(65),o=function(t){return function(e,i,o){var a,h=n(e),c=s(h),u=r(o,c);if(t&&i!=i){for(;c>u;)if((a=h[u++])!=a)return!0}else for(;c>u;u++)if((t||u in h)&&h[u]===i)return t||u||0;return!t&&-1}};t.exports={includes:o(!0),indexOf:o(!1)}},(t,e,i)=>{var n=i(63),r=Math.max,s=Math.min;t.exports=function(t,e){var i=n(t);return i<0?r(i+e,0):s(i,e)}},(t,e,i)=>{var n=i(64);t.exports=function(t){var e=+t;return e!=e||0===e?0:n(e)}},t=>{var e=Math.ceil,i=Math.floor;t.exports=Math.trunc||function(t){var n=+t;return(n>0?i:e)(n)}},(t,e,i)=>{var n=i(66);t.exports=function(t){return n(t.length)}},(t,e,i)=>{var n=i(63),r=Math.min;t.exports=function(t){return t>0?r(n(t),9007199254740991):0}},t=>{t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},(t,e)=>{e.f=Object.getOwnPropertySymbols},(t,e,i)=>{var n=i(10),r=i(23),s=/#|\.prototype\./,o=function(t,e){var i=h[a(t)];return i==u||i!=c&&(r(e)?n(e):!!e)},a=o.normalize=function(t){return String(t).replace(s,".").toLowerCase()},h=o.data={},c=o.NATIVE="N",u=o.POLYFILL="P";t.exports=o},(t,e,i)=>{var n=i(35),r=i(71),s=i(46).f,o=n("unscopables"),a=Array.prototype;null==a[o]&&s(a,o,{configurable:!0,value:r(null)}),t.exports=function(t){a[o][t]=!0}},(t,e,i)=>{var n,r=i(48),s=i(72),o=i(67),a=i(56),h=i(74),c=i(44),u=i(55),l="prototype",f="script",d=u("IE_PROTO"),v=function(){},p=function(t){return"<"+f+">"+t+"</"+f+">"},b=function(t){t.write(p("")),t.close();var e=t.parentWindow.Object;return t=null,e},w=function(){try{n=new ActiveXObject("htmlfile")}catch(t){}var t,e,i;w="undefined"!=typeof document?document.domain&&n?b(n):(e=c("iframe"),i="java"+f+":",e.style.display="none",h.appendChild(e),e.src=String(i),(t=e.contentWindow.document).open(),t.write(p("document.F=Object")),t.close(),t.F):b(n);for(var r=o.length;r--;)delete w[l][o[r]];return w()};a[d]=!0,t.exports=Object.create||function(t,e){var i;return null!==t?(v[l]=r(t),i=new v,v[l]=null,i[d]=t):i=w(),void 0===e?i:s.f(i,e)}},(t,e,i)=>{var n=i(9),r=i(47),s=i(46),o=i(48),a=i(15),h=i(73);e.f=n&&!r?Object.defineProperties:function(t,e){o(t);for(var i,n=a(e),r=h(e),c=r.length,u=0;c>u;)s.f(t,i=r[u++],n[i]);return t}},(t,e,i)=>{var n=i(60),r=i(67);t.exports=Object.keys||function(t){return n(t,r)}},(t,e,i)=>{var n=i(25);t.exports=n("document","documentElement")},(t,e,i)=>{var n=i(7),r=i(17);t.exports=function(t,e){return r(n[t].prototype[e])}},(t,e,i)=>{i(77)},(t,e,i)=>{var n=i(78),r=i(65),s=i(63),o=n.aTypedArray;(0,n.exportTypedArrayMethod)("at",(function(t){var e=o(this),i=r(e),n=s(t),a=n>=0?n:i+n;return a<0||a>=i?void 0:e[a]}))},(t,e,i)=>{var n,r,s,o=i(79),a=i(9),h=i(7),c=i(23),u=i(22),l=i(40),f=i(80),d=i(33),v=i(45),p=i(49),b=i(46).f,w=i(26),g=i(82),m=i(84),A=i(35),y=i(42),k=i(53),M=k.enforce,E=k.get,S=h.Int8Array,x=S&&S.prototype,T=h.Uint8ClampedArray,_=T&&T.prototype,O=S&&g(S),C=x&&g(x),R=Object.prototype,j=h.TypeError,P=A("toStringTag"),D=y("TYPED_ARRAY_TAG"),I="TypedArrayConstructor",F=o&&!!m&&"Opera"!==f(h.opera),L=!1,W={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},N={BigInt64Array:8,BigUint64Array:8},B=function(t){var e=g(t);if(u(e)){var i=E(e);return i&&l(i,I)?i[I]:B(e)}},$=function(t){if(!u(t))return!1;var e=f(t);return l(W,e)||l(N,e)};for(n in W)(s=(r=h[n])&&r.prototype)?M(s)[I]=r:F=!1;for(n in N)(s=(r=h[n])&&r.prototype)&&(M(s)[I]=r);if((!F||!c(O)||O===Function.prototype)&&(O=function(){throw j("Incorrect invocation")},F))for(n in W)h[n]&&m(h[n],O);if((!F||!C||C===R)&&(C=O.prototype,F))for(n in W)h[n]&&m(h[n].prototype,C);if(F&&g(_)!==C&&m(_,C),a&&!l(C,P))for(n in L=!0,b(C,P,{get:function(){return u(this)?this[D]:void 0}}),W)h[n]&&v(h[n],D,n);t.exports={NATIVE_ARRAY_BUFFER_VIEWS:F,TYPED_ARRAY_TAG:L&&D,aTypedArray:function(t){if($(t))return t;throw j("Target is not a typed array")},aTypedArrayConstructor:function(t){if(c(t)&&(!m||w(O,t)))return t;throw j(d(t)+" is not a typed array constructor")},exportTypedArrayMethod:function(t,e,i,n){if(a){if(i)for(var r in W){var s=h[r];if(s&&l(s.prototype,t))try{delete s.prototype[t]}catch(i){try{s.prototype[t]=e}catch(t){}}}C[t]&&!i||p(C,t,i?e:F&&x[t]||e,n)}},exportTypedArrayStaticMethod:function(t,e,i){var n,r;if(a){if(m){if(i)for(n in W)if((r=h[n])&&l(r,t))try{delete r[t]}catch(t){}if(O[t]&&!i)return;try{return p(O,t,i?e:F&&O[t]||e)}catch(t){}}for(n in W)!(r=h[n])||r[t]&&!i||p(r,t,e)}},getTypedArrayConstructor:B,isView:function(t){if(!u(t))return!1;var e=f(t);return"DataView"===e||l(W,e)||l(N,e)},isTypedArray:$,TypedArray:O,TypedArrayPrototype:C}},t=>{t.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},(t,e,i)=>{var n=i(81),r=i(23),s=i(18),o=i(35)("toStringTag"),a=Object,h="Arguments"==s(function(){return arguments}());t.exports=n?s:function(t){var e,i,n;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=function(t,e){try{return t[e]}catch(t){}}(e=a(t),o))?i:h?s(e):"Object"==(n=s(e))&&r(e.callee)?"Arguments":n}},(t,e,i)=>{var n={};n[i(35)("toStringTag")]="z",t.exports="[object z]"===String(n)},(t,e,i)=>{var n=i(40),r=i(23),s=i(41),o=i(55),a=i(83),h=o("IE_PROTO"),c=Object,u=c.prototype;t.exports=a?c.getPrototypeOf:function(t){var e=s(t);if(n(e,h))return e[h];var i=e.constructor;return r(i)&&e instanceof i?i.prototype:e instanceof c?u:null}},(t,e,i)=>{var n=i(10);t.exports=!n((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype}))},(t,e,i)=>{var n=i(17),r=i(48),s=i(85);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=n(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(i,[]),e=i instanceof Array}catch(t){}return function(i,n){return r(i),s(n),e?t(i,n):i.__proto__=n,i}}():void 0)},(t,e,i)=>{var n=i(23),r=String,s=TypeError;t.exports=function(t){if("object"==typeof t||n(t))return t;throw s("Can't set "+r(t)+" as a prototype")}},(t,e,i)=>{i(87),i(93),i(95),i(117),i(119);var n=i(128);t.exports=n.structuredClone},(t,e,i)=>{var n=i(15),r=i(70),s=i(88),o=i(53),a=i(46).f,h=i(89),c=i(37),u=i(9),l="Array Iterator",f=o.set,d=o.getterFor(l);t.exports=h(Array,"Array",(function(t,e){f(this,{type:l,target:n(t),index:0,kind:e})}),(function(){var t=d(this),e=t.target,i=t.kind,n=t.index++;return!e||n>=e.length?(t.target=void 0,{value:void 0,done:!0}):"keys"==i?{value:n,done:!1}:"values"==i?{value:e[n],done:!1}:{value:[n,e[n]],done:!1}}),"values");var v=s.Arguments=s.Array;if(r("keys"),r("values"),r("entries"),!c&&u&&"values"!==v.name)try{a(v,"name",{value:"values"})}catch(t){}},t=>{t.exports={}},(t,e,i)=>{var n=i(6),r=i(11),s=i(37),o=i(51),a=i(23),h=i(90),c=i(82),u=i(84),l=i(92),f=i(45),d=i(49),v=i(35),p=i(88),b=i(91),w=o.PROPER,g=o.CONFIGURABLE,m=b.IteratorPrototype,A=b.BUGGY_SAFARI_ITERATORS,y=v("iterator"),k="keys",M="values",E="entries",S=function(){return this};t.exports=function(t,e,i,o,v,b,x){h(i,e,o);var T,_,O,C=function(t){if(t===v&&I)return I;if(!A&&t in P)return P[t];switch(t){case k:case M:case E:return function(){return new i(this,t)}}return function(){return new i(this)}},R=e+" Iterator",j=!1,P=t.prototype,D=P[y]||P["@@iterator"]||v&&P[v],I=!A&&D||C(v),F="Array"==e&&P.entries||D;if(F&&(T=c(F.call(new t)))!==Object.prototype&&T.next&&(s||c(T)===m||(u?u(T,m):a(T[y])||d(T,y,S)),l(T,R,!0,!0),s&&(p[R]=S)),w&&v==M&&D&&D.name!==M&&(!s&&g?f(P,"name",M):(j=!0,I=function(){return r(D,this)})),v)if(_={values:C(M),keys:b?I:C(k),entries:C(E)},x)for(O in _)(A||j||!(O in P))&&d(P,O,_[O]);else n({target:e,proto:!0,forced:A||j},_);return s&&!x||P[y]===I||d(P,y,I,{name:v}),p[e]=I,_}},(t,e,i)=>{var n=i(91).IteratorPrototype,r=i(71),s=i(14),o=i(92),a=i(88),h=function(){return this};t.exports=function(t,e,i,c){var u=e+" Iterator";return t.prototype=r(n,{next:s(+!c,i)}),o(t,u,!1,!0),a[u]=h,t}},(t,e,i)=>{var n,r,s,o=i(10),a=i(23),h=i(71),c=i(82),u=i(49),l=i(35),f=i(37),d=l("iterator"),v=!1;[].keys&&("next"in(s=[].keys())?(r=c(c(s)))!==Object.prototype&&(n=r):v=!0),null==n||o((function(){var t={};return n[d].call(t)!==t}))?n={}:f&&(n=h(n)),a(n[d])||u(n,d,(function(){return this})),t.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:v}},(t,e,i)=>{var n=i(46).f,r=i(40),s=i(35)("toStringTag");t.exports=function(t,e,i){t&&!i&&(t=t.prototype),t&&!r(t,s)&&n(t,s,{configurable:!0,value:e})}},(t,e,i)=>{var n=i(81),r=i(49),s=i(94);n||r(Object.prototype,"toString",s,{unsafe:!0})},(t,e,i)=>{var n=i(81),r=i(80);t.exports=n?{}.toString:function(){return"[object "+r(this)+"]"}},(t,e,i)=>{i(96)},(t,e,i)=>{i(97)("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),i(114))},(t,e,i)=>{var n=i(6),r=i(7),s=i(17),o=i(69),a=i(49),h=i(98),c=i(105),u=i(111),l=i(23),f=i(22),d=i(10),v=i(112),p=i(92),b=i(113);t.exports=function(t,e,i){var w=-1!==t.indexOf("Map"),g=-1!==t.indexOf("Weak"),m=w?"set":"add",A=r[t],y=A&&A.prototype,k=A,M={},E=function(t){var e=s(y[t]);a(y,t,"add"==t?function(t){return e(this,0===t?0:t),this}:"delete"==t?function(t){return!(g&&!f(t))&&e(this,0===t?0:t)}:"get"==t?function(t){return g&&!f(t)?void 0:e(this,0===t?0:t)}:"has"==t?function(t){return!(g&&!f(t))&&e(this,0===t?0:t)}:function(t,i){return e(this,0===t?0:t,i),this})};if(o(t,!l(A)||!(g||y.forEach&&!d((function(){(new A).entries().next()})))))k=i.getConstructor(e,t,w,m),h.enable();else if(o(t,!0)){var S=new k,x=S[m](g?{}:-0,1)!=S,T=d((function(){S.has(1)})),_=v((function(t){new A(t)})),O=!g&&d((function(){for(var t=new A,e=5;e--;)t[m](e,e);return!t.has(-0)}));_||((k=e((function(t,e){u(t,y);var i=b(new A,t,k);return null!=e&&c(e,i[m],{that:i,AS_ENTRIES:w}),i}))).prototype=y,y.constructor=k),(T||O)&&(E("delete"),E("has"),w&&E("get")),(O||x)&&E(m),g&&y.clear&&delete y.clear}return M[t]=k,n({global:!0,constructor:!0,forced:k!=A},M),p(k,t),g||i.setStrong(k,t,w),k}},(t,e,i)=>{var n=i(6),r=i(17),s=i(56),o=i(22),a=i(40),h=i(46).f,c=i(59),u=i(99),l=i(102),f=i(42),d=i(104),v=!1,p=f("meta"),b=0,w=function(t){h(t,p,{value:{objectID:"O"+b++,weakData:{}}})},g=t.exports={enable:function(){g.enable=function(){},v=!0;var t=c.f,e=r([].splice),i={};i[p]=1,t(i).length&&(c.f=function(i){for(var n=t(i),r=0,s=n.length;r<s;r++)if(n[r]===p){e(n,r,1);break}return n},n({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:u.f}))},fastKey:function(t,e){if(!o(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!a(t,p)){if(!l(t))return"F";if(!e)return"E";w(t)}return t[p].objectID},getWeakData:function(t,e){if(!a(t,p)){if(!l(t))return!0;if(!e)return!1;w(t)}return t[p].weakData},onFreeze:function(t){return d&&v&&l(t)&&!a(t,p)&&w(t),t}};s[p]=!0},(t,e,i)=>{var n=i(18),r=i(15),s=i(59).f,o=i(100),a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return a&&"Window"==n(t)?function(t){try{return s(t)}catch(t){return o(a)}}(t):s(r(t))}},(t,e,i)=>{var n=i(62),r=i(65),s=i(101),o=Array,a=Math.max;t.exports=function(t,e,i){for(var h=r(t),c=n(e,h),u=n(void 0===i?h:i,h),l=o(a(u-c,0)),f=0;c<u;c++,f++)s(l,f,t[c]);return l.length=f,l}},(t,e,i)=>{var n=i(20),r=i(46),s=i(14);t.exports=function(t,e,i){var o=n(e);o in t?r.f(t,o,s(0,i)):t[o]=i}},(t,e,i)=>{var n=i(10),r=i(22),s=i(18),o=i(103),a=Object.isExtensible,h=n((function(){}));t.exports=h||o?function(t){return!!r(t)&&(!o||"ArrayBuffer"!=s(t))&&(!a||a(t))}:a},(t,e,i)=>{var n=i(10);t.exports=n((function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}}))},(t,e,i)=>{var n=i(10);t.exports=!n((function(){return Object.isExtensible(Object.preventExtensions({}))}))},(t,e,i)=>{var n=i(106),r=i(11),s=i(48),o=i(33),a=i(107),h=i(65),c=i(26),u=i(108),l=i(109),f=i(110),d=TypeError,v=function(t,e){this.stopped=t,this.result=e},p=v.prototype;t.exports=function(t,e,i){var b,w,g,m,A,y,k,M=!(!i||!i.AS_ENTRIES),E=!(!i||!i.IS_RECORD),S=!(!i||!i.IS_ITERATOR),x=!(!i||!i.INTERRUPTED),T=n(e,i&&i.that),_=function(t){return b&&f(b,"normal",t),new v(!0,t)},O=function(t){return M?(s(t),x?T(t[0],t[1],_):T(t[0],t[1])):x?T(t,_):T(t)};if(E)b=t.iterator;else if(S)b=t;else{if(!(w=l(t)))throw d(o(t)+" is not iterable");if(a(w)){for(g=0,m=h(t);m>g;g++)if((A=O(t[g]))&&c(p,A))return A;return new v(!1)}b=u(t,w)}for(y=E?t.next:b.next;!(k=r(y,b)).done;){try{A=O(k.value)}catch(t){f(b,"throw",t)}if("object"==typeof A&&A&&c(p,A))return A}return new v(!1)}},(t,e,i)=>{var n=i(17),r=i(32),s=i(12),o=n(n.bind);t.exports=function(t,e){return r(t),void 0===e?t:s?o(t,e):function(){return t.apply(e,arguments)}}},(t,e,i)=>{var n=i(35),r=i(88),s=n("iterator"),o=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||o[s]===t)}},(t,e,i)=>{var n=i(11),r=i(32),s=i(48),o=i(33),a=i(109),h=TypeError;t.exports=function(t,e){var i=arguments.length<2?a(t):e;if(r(i))return s(n(i,t));throw h(o(t)+" is not iterable")}},(t,e,i)=>{var n=i(80),r=i(31),s=i(88),o=i(35)("iterator");t.exports=function(t){if(null!=t)return r(t,o)||r(t,"@@iterator")||s[n(t)]}},(t,e,i)=>{var n=i(11),r=i(48),s=i(31);t.exports=function(t,e,i){var o,a;r(t);try{if(!(o=s(t,"return"))){if("throw"===e)throw i;return i}o=n(o,t)}catch(t){a=!0,o=t}if("throw"===e)throw i;if(a)throw o;return r(o),i}},(t,e,i)=>{var n=i(26),r=TypeError;t.exports=function(t,e){if(n(e,t))return t;throw r("Incorrect invocation")}},(t,e,i)=>{var n=i(35)("iterator"),r=!1;try{var s=0,o={next:function(){return{done:!!s++}},return:function(){r=!0}};o[n]=function(){return this},Array.from(o,(function(){throw 2}))}catch(t){}t.exports=function(t,e){if(!e&&!r)return!1;var i=!1;try{var s={};s[n]=function(){return{next:function(){return{done:i=!0}}}},t(s)}catch(t){}return i}},(t,e,i)=>{var n=i(23),r=i(22),s=i(84);t.exports=function(t,e,i){var o,a;return s&&n(o=e.constructor)&&o!==i&&r(a=o.prototype)&&a!==i.prototype&&s(t,a),t}},(t,e,i)=>{var n=i(46).f,r=i(71),s=i(115),o=i(106),a=i(111),h=i(105),c=i(89),u=i(116),l=i(9),f=i(98).fastKey,d=i(53),v=d.set,p=d.getterFor;t.exports={getConstructor:function(t,e,i,c){var u=t((function(t,n){a(t,d),v(t,{type:e,index:r(null),first:void 0,last:void 0,size:0}),l||(t.size=0),null!=n&&h(n,t[c],{that:t,AS_ENTRIES:i})})),d=u.prototype,b=p(e),w=function(t,e,i){var n,r,s=b(t),o=g(t,e);return o?o.value=i:(s.last=o={index:r=f(e,!0),key:e,value:i,previous:n=s.last,next:void 0,removed:!1},s.first||(s.first=o),n&&(n.next=o),l?s.size++:t.size++,"F"!==r&&(s.index[r]=o)),t},g=function(t,e){var i,n=b(t),r=f(e);if("F"!==r)return n.index[r];for(i=n.first;i;i=i.next)if(i.key==e)return i};return s(d,{clear:function(){for(var t=b(this),e=t.index,i=t.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete e[i.index],i=i.next;t.first=t.last=void 0,l?t.size=0:this.size=0},delete:function(t){var e=this,i=b(e),n=g(e,t);if(n){var r=n.next,s=n.previous;delete i.index[n.index],n.removed=!0,s&&(s.next=r),r&&(r.previous=s),i.first==n&&(i.first=r),i.last==n&&(i.last=s),l?i.size--:e.size--}return!!n},forEach:function(t){for(var e,i=b(this),n=o(t,arguments.length>1?arguments[1]:void 0);e=e?e.next:i.first;)for(n(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!g(this,t)}}),s(d,i?{get:function(t){var e=g(this,t);return e&&e.value},set:function(t,e){return w(this,0===t?0:t,e)}}:{add:function(t){return w(this,t=0===t?0:t,t)}}),l&&n(d,"size",{get:function(){return b(this).size}}),u},setStrong:function(t,e,i){var n=e+" Iterator",r=p(e),s=p(n);c(t,e,(function(t,e){v(this,{type:n,target:t,state:r(t),kind:e,last:void 0})}),(function(){for(var t=s(this),e=t.kind,i=t.last;i&&i.removed;)i=i.previous;return t.target&&(t.last=i=i?i.next:t.state.first)?"keys"==e?{value:i.key,done:!1}:"values"==e?{value:i.value,done:!1}:{value:[i.key,i.value],done:!1}:(t.target=void 0,{value:void 0,done:!0})}),i?"entries":"values",!i,!0),u(e)}}},(t,e,i)=>{var n=i(49);t.exports=function(t,e,i){for(var r in e)n(t,r,e[r],i);return t}},(t,e,i)=>{var n=i(25),r=i(46),s=i(35),o=i(9),a=s("species");t.exports=function(t){var e=n(t);o&&e&&!e[a]&&(0,r.f)(e,a,{configurable:!0,get:function(){return this}})}},(t,e,i)=>{i(118)},(t,e,i)=>{i(97)("Set",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),i(114))},(t,e,i)=>{var n,r=i(37),s=i(6),o=i(7),a=i(25),h=i(17),c=i(10),u=i(42),l=i(23),f=i(120),d=i(22),v=i(24),p=i(105),b=i(48),w=i(80),g=i(40),m=i(101),A=i(45),y=i(65),k=i(121),M=i(122),E=i(124),S=i(29),x=i(125),T=i(126),_=i(127),O=o.Object,C=o.Date,R=o.Error,j=o.EvalError,P=o.RangeError,D=o.ReferenceError,I=o.SyntaxError,F=o.TypeError,L=o.URIError,W=o.PerformanceMark,N=o.WebAssembly,B=N&&N.CompileError||R,$=N&&N.LinkError||R,U=N&&N.RuntimeError||R,z=a("DOMException"),G=a("Set"),Y=a("Map"),q=Y.prototype,X=h(q.has),V=h(q.get),H=h(q.set),Q=h(G.prototype.add),K=a("Object","keys"),J=h([].push),Z=h((!0).valueOf),tt=h(1..valueOf),et=h("".valueOf),it=h(C.prototype.getTime),nt=u("structuredClone"),rt="DataCloneError",st="Transferring",ot=function(t){return!c((function(){var e=new o.Set([7]),i=t(e),n=t(O(7));return i==e||!i.has(7)||"object"!=typeof n||7!=n}))&&t},at=function(t,e){return!c((function(){var i=new e,n=t({a:i,b:i});return!(n&&n.a===n.b&&n.a instanceof e&&n.a.stack===i.stack)}))},ht=o.structuredClone,ct=r||!at(ht,R)||!at(ht,z)||(n=ht,!!c((function(){var t=n(new o.AggregateError([1],nt,{cause:3}));return"AggregateError"!=t.name||1!=t.errors[0]||t.message!=nt||3!=t.cause}))),ut=!ht&&ot((function(t){return new W(nt,{detail:t}).detail})),lt=ot(ht)||ut,ft=function(t){throw new z("Uncloneable type: "+t,rt)},dt=function(t,e){throw new z((e||"Cloning")+" of "+t+" cannot be properly polyfilled in this engine",rt)},vt=function(t,e){if(v(t)&&ft("Symbol"),!d(t))return t;if(e){if(X(e,t))return V(e,t)}else e=new Y;var i,n,r,s,h,c,u,p,b,k,S=w(t),x=!1;switch(S){case"Array":r=[],x=!0;break;case"Object":r={},x=!0;break;case"Map":r=new Y,x=!0;break;case"Set":r=new G,x=!0;break;case"RegExp":r=new RegExp(t.source,M(t));break;case"Error":switch(n=t.name){case"AggregateError":r=a("AggregateError")([]);break;case"EvalError":r=j();break;case"RangeError":r=P();break;case"ReferenceError":r=D();break;case"SyntaxError":r=I();break;case"TypeError":r=F();break;case"URIError":r=L();break;case"CompileError":r=B();break;case"LinkError":r=$();break;case"RuntimeError":r=U();break;default:r=R()}x=!0;break;case"DOMException":r=new z(t.message,t.name),x=!0;break;case"DataView":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"BigInt64Array":case"BigUint64Array":d(i=o[S])||dt(S),r=new i(vt(t.buffer,e),t.byteOffset,"DataView"===S?t.byteLength:t.length);break;case"DOMQuad":try{r=new DOMQuad(vt(t.p1,e),vt(t.p2,e),vt(t.p3,e),vt(t.p4,e))}catch(e){lt?r=lt(t):dt(S)}break;case"FileList":if(f(i=o.DataTransfer)){for(s=new i,h=0,c=y(t);h<c;h++)s.items.add(vt(t[h],e));r=s.files}else lt?r=lt(t):dt(S);break;case"ImageData":try{r=new ImageData(vt(t.data,e),t.width,t.height,{colorSpace:t.colorSpace})}catch(e){lt?r=lt(t):dt(S)}break;default:if(lt)r=lt(t);else switch(S){case"BigInt":r=O(t.valueOf());break;case"Boolean":r=O(Z(t));break;case"Number":r=O(tt(t));break;case"String":r=O(et(t));break;case"Date":r=new C(it(t));break;case"ArrayBuffer":(i=o.DataView)||"function"==typeof t.slice||dt(S);try{if("function"==typeof t.slice)r=t.slice(0);else for(c=t.byteLength,r=new ArrayBuffer(c),b=new i(t),k=new i(r),h=0;h<c;h++)k.setUint8(h,b.getUint8(h))}catch(t){throw new z("ArrayBuffer is detached",rt)}break;case"SharedArrayBuffer":r=t;break;case"Blob":try{r=t.slice(0,t.size,t.type)}catch(t){dt(S)}break;case"DOMPoint":case"DOMPointReadOnly":i=o[S];try{r=i.fromPoint?i.fromPoint(t):new i(t.x,t.y,t.z,t.w)}catch(t){dt(S)}break;case"DOMRect":case"DOMRectReadOnly":i=o[S];try{r=i.fromRect?i.fromRect(t):new i(t.x,t.y,t.width,t.height)}catch(t){dt(S)}break;case"DOMMatrix":case"DOMMatrixReadOnly":i=o[S];try{r=i.fromMatrix?i.fromMatrix(t):new i(t)}catch(t){dt(S)}break;case"AudioData":case"VideoFrame":l(t.clone)||dt(S);try{r=t.clone()}catch(t){ft(S)}break;case"File":try{r=new File([t],t.name,t)}catch(t){dt(S)}break;case"CryptoKey":case"GPUCompilationMessage":case"GPUCompilationInfo":case"ImageBitmap":case"RTCCertificate":case"WebAssembly.Module":dt(S);default:ft(S)}}if(H(e,t,r),x)switch(S){case"Array":case"Object":for(u=K(t),h=0,c=y(u);h<c;h++)m(r,p=u[h],vt(t[p],e));break;case"Map":t.forEach((function(t,i){H(r,vt(i,e),vt(t,e))}));break;case"Set":t.forEach((function(t){Q(r,vt(t,e))}));break;case"Error":A(r,"message",vt(t.message,e)),g(t,"cause")&&A(r,"cause",vt(t.cause,e)),"AggregateError"==n&&(r.errors=vt(t.errors,e));case"DOMException":E&&A(r,"stack",vt(t.stack,e))}return r},pt=ht&&!c((function(){if(T&&S>92||_&&S>94||x&&S>97)return!1;var t=new ArrayBuffer(8),e=ht(t,{transfer:[t]});return 0!=t.byteLength||8!=e.byteLength}));s({global:!0,enumerable:!0,sham:!pt,forced:ct},{structuredClone:function(t){var e,i=k(arguments.length,1)>1&&null!=arguments[1]?b(arguments[1]):void 0,n=i?i.transfer:void 0;return void 0!==n&&function(t,e){if(!d(t))throw F("Transfer option cannot be converted to a sequence");var i=[];p(t,(function(t){J(i,b(t))}));var n,r,s,a,h,c,u=0,v=y(i);if(pt)for(a=ht(i,{transfer:i});u<v;)H(e,i[u],a[u++]);else for(;u<v;){if(n=i[u++],X(e,n))throw new z("Duplicate transferable",rt);switch(r=w(n)){case"ImageBitmap":f(s=o.OffscreenCanvas)||dt(r,st);try{(c=new s(n.width,n.height)).getContext("bitmaprenderer").transferFromImageBitmap(n),h=c.transferToImageBitmap()}catch(t){}break;case"AudioData":case"VideoFrame":l(n.clone)&&l(n.close)||dt(r,st);try{h=n.clone(),n.close()}catch(t){}break;case"ArrayBuffer":case"MessagePort":case"OffscreenCanvas":case"ReadableStream":case"TransformStream":case"WritableStream":dt(r,st)}if(void 0===h)throw new z("This object cannot be transferred: "+r,rt);H(e,n,h)}}(n,e=new Y),vt(t,e)}})},(t,e,i)=>{var n=i(17),r=i(10),s=i(23),o=i(80),a=i(25),h=i(52),c=function(){},u=[],l=a("Reflect","construct"),f=/^\s*(?:class|function)\b/,d=n(f.exec),v=!f.exec(c),p=function(t){if(!s(t))return!1;try{return l(c,u,t),!0}catch(t){return!1}},b=function(t){if(!s(t))return!1;switch(o(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return v||!!d(f,h(t))}catch(t){return!0}};b.sham=!0,t.exports=!l||r((function(){var t;return p(p.call)||!p(Object)||!p((function(){t=!0}))||t}))?b:p},t=>{var e=TypeError;t.exports=function(t,i){if(t<i)throw e("Not enough arguments");return t}},(t,e,i)=>{var n=i(11),r=i(40),s=i(26),o=i(123),a=RegExp.prototype;t.exports=function(t){var e=t.flags;return void 0!==e||"flags"in a||r(t,"flags")||!s(a,t)?e:n(o,t)}},(t,e,i)=>{var n=i(48);t.exports=function(){var t=n(this),e="";return t.hasIndices&&(e+="d"),t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.unicodeSets&&(e+="v"),t.sticky&&(e+="y"),e}},(t,e,i)=>{var n=i(10),r=i(14);t.exports=!n((function(){var t=Error("a");return!("stack"in t)||(Object.defineProperty(t,"stack",r(1,7)),7!==t.stack)}))},(t,e,i)=>{var n=i(126),r=i(127);t.exports=!n&&!r&&"object"==typeof window&&"object"==typeof document},t=>{t.exports="object"==typeof Deno&&Deno&&"object"==typeof Deno.version},(t,e,i)=>{var n=i(18),r=i(7);t.exports="process"==n(r.process)},(t,e,i)=>{var n=i(7);t.exports=n},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.build=e.RenderTask=e.PDFWorkerUtil=e.PDFWorker=e.PDFPageProxy=e.PDFDocumentProxy=e.PDFDocumentLoadingTask=e.PDFDataRangeTransport=e.LoopbackPort=e.DefaultStandardFontDataFactory=e.DefaultCanvasFactory=e.DefaultCMapReaderFactory=void 0,e.getDocument=function(t){const e=new j;let i;if("string"==typeof t||t instanceof URL)i={url:t};else if((0,n.isArrayBuffer)(t))i={data:t};else if(t instanceof D)i={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");i=t}const r=Object.create(null);let o=null,a=null;for(const t in i){const e=i[t];switch(t){case"url":if("undefined"!=typeof window)try{r[t]=new URL(e,window.location).href;continue}catch(t){(0,n.warn)(`Cannot create valid URL: "${t}".`)}else if("string"==typeof e||e instanceof URL){r[t]=e.toString();continue}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.");case"range":o=e;continue;case"worker":a=e;continue;case"data":if(u.isNodeJS&&"undefined"!=typeof Buffer&&e instanceof Buffer)r[t]=new Uint8Array(e);else{if(e instanceof Uint8Array)break;if("string"==typeof e)r[t]=(0,n.stringToBytes)(e);else if("object"!=typeof e||null===e||isNaN(e.length)){if(!(0,n.isArrayBuffer)(e))throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.");r[t]=new Uint8Array(e)}else r[t]=new Uint8Array(e)}continue}r[t]=e}if(r.CMapReaderFactory=r.CMapReaderFactory||O,r.StandardFontDataFactory=r.StandardFontDataFactory||R,r.ignoreErrors=!0!==r.stopAtErrors,r.fontExtraProperties=!0===r.fontExtraProperties,r.pdfBug=!0===r.pdfBug,r.enableXfa=!0===r.enableXfa,(!Number.isInteger(r.rangeChunkSize)||r.rangeChunkSize<1)&&(r.rangeChunkSize=T),("string"!=typeof r.docBaseUrl||(0,s.isDataScheme)(r.docBaseUrl))&&(r.docBaseUrl=null),(!Number.isInteger(r.maxImageSize)||r.maxImageSize<-1)&&(r.maxImageSize=-1),"string"!=typeof r.cMapUrl&&(r.cMapUrl=null),"string"!=typeof r.standardFontDataUrl&&(r.standardFontDataUrl=null),"boolean"!=typeof r.useWorkerFetch&&(r.useWorkerFetch=r.CMapReaderFactory===s.DOMCMapReaderFactory&&r.StandardFontDataFactory===s.DOMStandardFontDataFactory),"boolean"!=typeof r.isEvalSupported&&(r.isEvalSupported=!0),"boolean"!=typeof r.disableFontFace&&(r.disableFontFace=u.isNodeJS),"boolean"!=typeof r.useSystemFonts&&(r.useSystemFonts=!u.isNodeJS&&!r.disableFontFace),"object"==typeof r.ownerDocument&&null!==r.ownerDocument||(r.ownerDocument=globalThis.document),"boolean"!=typeof r.disableRange&&(r.disableRange=!1),"boolean"!=typeof r.disableStream&&(r.disableStream=!1),"boolean"!=typeof r.disableAutoFetch&&(r.disableAutoFetch=!1),(0,n.setVerbosityLevel)(r.verbosity),!a){const t={verbosity:r.verbosity,port:c.GlobalWorkerOptions.workerPort};a=t.port?$.fromPort(t):new $(t),e._worker=a}const h=e.docId;return a.promise.then((function(){if(e.destroyed)throw new Error("Loading aborted");const t=async function(t,e,i,n){if(t.destroyed)throw new Error("Worker was destroyed");i&&(e.length=i.length,e.initialData=i.initialData,e.progressiveDone=i.progressiveDone,e.contentDispositionFilename=i.contentDispositionFilename);const r=await t.messageHandler.sendWithPromise("GetDocRequest",{docId:n,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 r}(a,r,o,h),i=new Promise((function(t){let e;o?e=new v.PDFDataTransportStream({length:r.length,initialData:r.initialData,progressiveDone:r.progressiveDone,contentDispositionFilename:r.contentDispositionFilename,disableRange:r.disableRange,disableStream:r.disableStream},o):r.data||(e=C({url:r.url,length:r.length,httpHeaders:r.httpHeaders,withCredentials:r.withCredentials,rangeChunkSize:r.rangeChunkSize,disableRange:r.disableRange,disableStream:r.disableStream})),t(e)}));return Promise.all([t,i]).then((function(t){let[i,n]=t;if(e.destroyed)throw new Error("Loading aborted");const s=new l.MessageHandler(h,i,a.port),o=new X(s,e,n,r);e._transport=o,s.send("Ready",null)}))})).catch(e._capability.reject),e},e.setPDFNetworkStreamFactory=function(t){C=t},e.version=void 0;var n=i(1),r=i(130),s=i(133),o=i(136),a=i(137),c=i(140),u=i(3),l=i(141),f=i(142),d=i(143),v=i(144),p=i(145);function b(t,e,i){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return i}function w(t,e,i){g(t,e),e.set(t,i)}function g(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function m(t,e,i){return k(t,y(t,e,"set"),i),i}function A(t,e){return x(t,y(t,e,"get"))}function y(t,e,i){if(!e.has(t))throw new TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}function k(t,e,i){if(e.set)e.set.call(t,i);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=i}}function M(t,e,i){return S(t,e),E(i,"get"),x(t,i)}function E(t,e){if(void 0===t)throw new TypeError("attempted to "+e+" private static field before its declaration")}function S(t,e){if(t!==e)throw new TypeError("Private static access of wrong provenance")}function x(t,e){return e.get?e.get.call(t):e.value}const T=65536;let _=s.DOMCanvasFactory;e.DefaultCanvasFactory=_;let O=s.DOMCMapReaderFactory;e.DefaultCMapReaderFactory=O;let C,R=s.DOMStandardFontDataFactory;if(e.DefaultStandardFontDataFactory=R,u.isNodeJS){const{NodeCanvasFactory:t,NodeCMapReaderFactory:n,NodeStandardFontDataFactory:r}=i(146);e.DefaultCanvasFactory=_=t,e.DefaultCMapReaderFactory=O=n,e.DefaultStandardFontDataFactory=R=r}class j{constructor(){var t,e,i,r,s,o;this._capability=(0,n.createPromiseCapability)(),this._transport=null,this._worker=null,this.docId=`d${i=j,r=j,s=P,t=M(j,j,P),e=t++,o=t,S(i,r),E(s,"set"),k(i,s,o),e}`,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?void 0:t.destroy()),this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}e.PDFDocumentLoadingTask=j;var P={writable:!0,value:0};class D{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=r,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=(0,n.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 i of this._rangeListeners)i(t,e)}onDataProgress(t,e){this._readyCapability.promise.then((()=>{for(const i of this._progressListeners)i(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,n.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}e.PDFDataRangeTransport=D;class I{constructor(t,e){this._pdfInfo=t,this._transport=e,Object.defineProperty(this,"fingerprint",{get(){return(0,s.deprecated)("`PDFDocumentProxy.fingerprint`, please use `PDFDocumentProxy.fingerprints` instead."),this.fingerprints[0]}}),Object.defineProperty(this,"getStats",{value:async()=>((0,s.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(){return this._transport.startCleanup(arguments.length>0&&void 0!==arguments[0]&&arguments[0]||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,s.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()}}e.PDFDocumentProxy=I;class F{constructor(t,e,i,n){let r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];this._pageIndex=t,this._pageInfo=e,this._ownerDocument=n,this._transport=i,this._stats=r?new s.StatTimer:null,this._pdfBug=r,this.commonObjs=i.commonObjs,this.objs=new Q,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(){let{scale:t,rotation:e=this.rotate,offsetX:i=0,offsetY:n=0,dontFlip:r=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new s.PageViewport({viewBox:this.view,scale:t,rotation:e,offsetX:i,offsetY:n,dontFlip:r})}getAnnotations(){let{intent:t="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const e=this._transport.getRenderingIntent(t);let i=this._annotationPromises.get(e.cacheKey);return i||(i=this._transport.getAnnotations(this._pageIndex,e.renderingIntent),this._annotationPromises.set(e.cacheKey,i),i=i.then((t=>{for(const e of t)void 0!==e.titleObj&&Object.defineProperty(e,"title",{get:()=>((0,s.deprecated)("`title`-property on annotation, please use `titleObj` instead."),e.titleObj.str)}),void 0!==e.contentsObj&&Object.defineProperty(e,"contents",{get:()=>((0,s.deprecated)("`contents`-property on annotation, please use `contentsObj` instead."),e.contentsObj.str)});return t}))),i}getJSActions(){return this._jsActionsPromise||(this._jsActionsPromise=this._transport.getPageJSActions(this._pageIndex))}async getXfa(){var t;return(null===(t=this._transport._htmlForXfa)||void 0===t?void 0:t.children[this._pageIndex])||null}render(t){var e,i,r;let{canvasContext:o,viewport:a,intent:h="display",annotationMode:c=n.AnnotationMode.ENABLE,transform:u=null,imageLayer:l=null,canvasFactory:f=null,background:d=null,optionalContentConfigPromise:v=null,annotationCanvasMap:p=null,pageColors:b=null,printAnnotationStorage:w=null}=t;void 0!==(null===(e=arguments[0])||void 0===e?void 0:e.renderInteractiveForms)&&((0,s.deprecated)("render no longer accepts the `renderInteractiveForms`-option, please use the `annotationMode`-option instead."),!0===arguments[0].renderInteractiveForms&&c===n.AnnotationMode.ENABLE&&(c=n.AnnotationMode.ENABLE_FORMS)),void 0!==(null===(i=arguments[0])||void 0===i?void 0:i.includeAnnotationStorage)&&((0,s.deprecated)("render no longer accepts the `includeAnnotationStorage`-option, please use the `annotationMode`-option instead."),!0===arguments[0].includeAnnotationStorage&&c===n.AnnotationMode.ENABLE&&(c=n.AnnotationMode.ENABLE_STORAGE)),this._stats&&this._stats.time("Overall");const g=this._transport.getRenderingIntent(h,c,w);this.pendingCleanup=!1,v||(v=this._transport.getOptionalContentConfig());let m=this._intentStates.get(g.cacheKey);m||(m=Object.create(null),this._intentStates.set(g.cacheKey,m)),m.streamReaderCancelTimeout&&(clearTimeout(m.streamReaderCancelTimeout),m.streamReaderCancelTimeout=null);const A=f||new _({ownerDocument:this._ownerDocument}),y=!!(g.renderingIntent&n.RenderingIntentFlag.PRINT);m.displayReadyCapability||(m.displayReadyCapability=(0,n.createPromiseCapability)(),m.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats&&this._stats.time("Page Request"),this._pumpOperatorList(g));const k=t=>{m.renderTasks.delete(M),(this.cleanupAfterRender||y)&&(this.pendingCleanup=!0),this._tryCleanup(),t?(M.capability.reject(t),this._abortOperatorList({intentState:m,reason:t instanceof Error?t:new Error(t)})):M.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"))},M=new tt({callback:k,params:{canvasContext:o,viewport:a,transform:u,imageLayer:l,background:d},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:p,operatorList:m.operatorList,pageIndex:this._pageIndex,canvasFactory:A,useRequestAnimationFrame:!y,pdfBug:this._pdfBug,pageColors:b});((r=m).renderTasks||(r.renderTasks=new Set)).add(M);const E=M.task;return Promise.all([m.displayReadyCapability.promise,v]).then((t=>{let[e,i]=t;this.pendingCleanup?k():(this._stats&&this._stats.time("Rendering"),M.initializeGraphics({transparency:e,optionalContentConfig:i}),M.operatorListChanged())})).catch(k),E}getOperatorList(){let{intent:t="display",annotationMode:e=n.AnnotationMode.ENABLE,printAnnotationStorage:i=null}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const r=this._transport.getRenderingIntent(t,e,i,!0);let s,o=this._intentStates.get(r.cacheKey);var a;return o||(o=Object.create(null),this._intentStates.set(r.cacheKey,o)),o.opListReadCapability||(s=Object.create(null),s.operatorListChanged=function(){o.operatorList.lastChunk&&(o.opListReadCapability.resolve(o.operatorList),o.renderTasks.delete(s))},o.opListReadCapability=(0,n.createPromiseCapability)(),((a=o).renderTasks||(a.renderTasks=new Set)).add(s),o.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats&&this._stats.time("Page Request"),this._pumpOperatorList(r)),o.opListReadCapability.promise}streamTextContent(){let{disableCombineTextItems:t=!1,includeMarkedContent:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,combineTextItems:!0!==t,includeMarkedContent:!0===e},{highWaterMark:100,size:t=>t.items.length})}getTextContent(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._transport._htmlForXfa)return this.getXfa().then((t=>p.XfaText.textContent(t)));const e=this.streamTextContent(t);return new Promise((function(t,i){const n=e.getReader(),r={items:[],styles:Object.create(null)};!function e(){n.read().then((function(i){let{value:n,done:s}=i;s?t(r):(Object.assign(r.styles,n.styles),r.items.push(...n.items),e())}),i)}()}))}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 i of e.renderTasks)t.push(i.completed),i.cancel();this.objs.clear();for(const t of this._bitmaps)t.close();return this._bitmaps.clear(),this._annotationPromises.clear(),this._jsActionsPromise=null,this._structTreePromise=null,this.pendingCleanup=!1,Promise.all(t)}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.pendingCleanup=!0,this._tryCleanup(t)}_tryCleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.pendingCleanup)return!1;for(const{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;this._intentStates.clear(),this.objs.clear(),this._annotationPromises.clear(),this._jsActionsPromise=null,this._structTreePromise=null,t&&this._stats&&(this._stats=new s.StatTimer);for(const t of this._bitmaps)t.close();return this._bitmaps.clear(),this.pendingCleanup=!1,!0}_startRenderPage(t,e){const i=this._intentStates.get(e);i&&(this._stats&&this._stats.timeEnd("Page Request"),i.displayReadyCapability&&i.displayReadyCapability.resolve(t))}_renderPageChunk(t,e){for(let i=0,n=t.length;i<n;i++)e.operatorList.fnArray.push(t.fnArray[i]),e.operatorList.argsArray.push(t.argsArray[i]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(const t of e.renderTasks)t.operatorListChanged();t.lastChunk&&this._tryCleanup()}_pumpOperatorList(t){let{renderingIntent:e,cacheKey:i,annotationStorageMap:n}=t;const r=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:i,annotationStorage:n}).getReader(),s=this._intentStates.get(i);s.streamReader=r;const o=()=>{r.read().then((t=>{let{value:e,done:i}=t;i?s.streamReader=null:this._transport.destroyed||(this._renderPageChunk(e,s),o())}),(t=>{if(s.streamReader=null,!this._transport.destroyed){if(s.operatorList){s.operatorList.lastChunk=!0;for(const t of s.renderTasks)t.operatorListChanged();this._tryCleanup()}if(s.displayReadyCapability)s.displayReadyCapability.reject(t);else{if(!s.opListReadCapability)throw t;s.opListReadCapability.reject(t)}}}))};o()}_abortOperatorList(t){let{intentState:e,reason:i,force:r=!1}=t;if(e.streamReader){if(!r){if(e.renderTasks.size>0)return;if(i instanceof s.RenderingCancelledException)return void(e.streamReaderCancelTimeout=setTimeout((()=>{this._abortOperatorList({intentState:e,reason:i,force:!0}),e.streamReaderCancelTimeout=null}),100))}if(e.streamReader.cancel(new n.AbortException(i.message)).catch((()=>{})),e.streamReader=null,!this._transport.destroyed){for(const[t,i]of this._intentStates)if(i===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}}e.PDFPageProxy=F;class L{constructor(){this._listeners=[],this._deferred=Promise.resolve()}postMessage(t,e){const i={data:structuredClone(t,e)};this._deferred.then((()=>{for(const t of this._listeners)t.call(this,i)}))}addEventListener(t,e){this._listeners.push(e)}removeEventListener(t,e){const i=this._listeners.indexOf(e);this._listeners.splice(i,1)}terminate(){this._listeners.length=0}}e.LoopbackPort=L;const W={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};if(e.PDFWorkerUtil=W,u.isNodeJS&&"function"==typeof h)W.isWorkerDisabled=!0,W.fallbackWorkerSrc="./pdf.worker.js";else if("object"==typeof document){var N,B;const t=null===(N=document)||void 0===N||null===(B=N.currentScript)||void 0===B?void 0:B.src;t&&(W.fallbackWorkerSrc=t.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}W.isSameOrigin=function(t,e){let i;try{if(i=new URL(t),!i.origin||"null"===i.origin)return!1}catch(t){return!1}const n=new URL(e,i);return i.origin===n.origin},W.createCDNWrapper=function(t){return URL.createObjectURL(new Blob([`importScripts("${t}");`]))};class ${constructor(){let{name:t=null,port:e=null,verbosity:i=(0,n.getVerbosityLevel)()}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(e&&M($,$,U).has(e))throw new Error("Cannot use more than one PDFWorker per port.");if(this.name=t,this.destroyed=!1,this.verbosity=i,this._readyCapability=(0,n.createPromiseCapability)(),this._port=null,this._webWorker=null,this._messageHandler=null,e)return M($,$,U).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 l.MessageHandler("main","worker",t),this._messageHandler.on("ready",(function(){})),this._readyCapability.resolve()}_initialize(){if(!W.isWorkerDisabled&&!$._mainThreadWorkerMessageHandler){let{workerSrc:t}=$;try{W.isSameOrigin(window.location.href,t)||(t=W.createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t),i=new l.MessageHandler("main","worker",e),n=()=>{e.removeEventListener("error",r),i.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},r=()=>{this._webWorker||n()};e.addEventListener("error",r),i.on("test",(t=>{e.removeEventListener("error",r),this.destroyed?n():t?(this._messageHandler=i,this._port=e,this._webWorker=e,this._readyCapability.resolve(),i.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),i.destroy(),e.terminate())})),i.on("ready",(()=>{if(e.removeEventListener("error",r),this.destroyed)n();else try{s()}catch(t){this._setupFakeWorker()}}));const s=()=>{const t=new Uint8Array;i.send("test",t,[t.buffer])};return void s()}catch(t){(0,n.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){W.isWorkerDisabled||((0,n.warn)("Setting up fake worker."),W.isWorkerDisabled=!0),$._setupFakeWorkerGlobal.then((t=>{if(this.destroyed)return void this._readyCapability.reject(new Error("Worker was destroyed"));const e=new L;this._port=e;const i="fake"+W.fakeWorkerId++,n=new l.MessageHandler(i+"_worker",i,e);t.setup(n,e);const r=new l.MessageHandler(i,i+"_worker",e);this._messageHandler=r,this._readyCapability.resolve(),r.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),M($,$,U).delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){if(null==t||!t.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return M(this,$,U).has(t.port)?M(this,$,U).get(t.port):new $(t)}static get workerSrc(){if(c.GlobalWorkerOptions.workerSrc)return c.GlobalWorkerOptions.workerSrc;if(null!==W.fallbackWorkerSrc)return u.isNodeJS||(0,s.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'),W.fallbackWorkerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _mainThreadWorkerMessageHandler(){try{var t;return(null===(t=globalThis.pdfjsWorker)||void 0===t?void 0:t.WorkerMessageHandler)||null}catch(t){return null}}static get _setupFakeWorkerGlobal(){return(0,n.shadow)(this,"_setupFakeWorkerGlobal",(async()=>this._mainThreadWorkerMessageHandler||(u.isNodeJS&&"function"==typeof h?h(this.workerSrc).WorkerMessageHandler:(await(0,s.loadScript)(this.workerSrc),window.pdfjsWorker.WorkerMessageHandler)))())}}e.PDFWorker=$;var U={writable:!0,value:new WeakMap};$.getWorkerSrc=function(){return(0,s.deprecated)("`PDFWorker.getWorkerSrc()`, please use `PDFWorker.workerSrc` instead."),this.workerSrc};var z=new WeakMap,G=new WeakMap,Y=new WeakMap,q=new WeakMap;class X{constructor(t,e,i,r){w(this,z,{writable:!0,value:null}),w(this,G,{writable:!0,value:new Map}),w(this,Y,{writable:!0,value:new Map}),w(this,q,{writable:!0,value:null}),this.messageHandler=t,this.loadingTask=e,this.commonObjs=new Q,this.fontLoader=new o.FontLoader({docId:e.docId,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),ownerDocument:r.ownerDocument,styleElement:r.styleElement}),this._params=r,r.useWorkerFetch||(this.CMapReaderFactory=new r.CMapReaderFactory({baseUrl:r.cMapUrl,isCompressed:r.cMapPacked}),this.StandardFontDataFactory=new r.StandardFontDataFactory({baseUrl:r.standardFontDataUrl})),this.destroyed=!1,this.destroyCapability=null,this._passwordCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=(0,n.createPromiseCapability)(),this.setupMessageHandler()}get annotationStorage(){return(0,n.shadow)(this,"annotationStorage",new r.AnnotationStorage)}get stats(){return A(this,z)}getRenderingIntent(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.AnnotationMode.ENABLE,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=n.RenderingIntentFlag.DISPLAY,a=null;switch(t){case"any":o=n.RenderingIntentFlag.ANY;break;case"display":break;case"print":o=n.RenderingIntentFlag.PRINT;break;default:(0,n.warn)(`getRenderingIntent - invalid intent: ${t}`)}switch(e){case n.AnnotationMode.DISABLE:o+=n.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case n.AnnotationMode.ENABLE:break;case n.AnnotationMode.ENABLE_FORMS:o+=n.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case n.AnnotationMode.ENABLE_STORAGE:o+=n.RenderingIntentFlag.ANNOTATIONS_STORAGE,a=(o&n.RenderingIntentFlag.PRINT&&i instanceof r.PrintAnnotationStorage?i:this.annotationStorage).serializable;break;default:(0,n.warn)(`getRenderingIntent - invalid annotationMode: ${e}`)}return s&&(o+=n.RenderingIntentFlag.OPLIST),{renderingIntent:o,cacheKey:`${o}_${r.AnnotationStorage.getHash(a)}`,annotationStorageMap:a}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=(0,n.createPromiseCapability)(),this._passwordCapability&&this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const e of A(this,G).values())t.push(e._destroy());A(this,G).clear(),A(this,Y).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(),m(this,q,null),this._getFieldObjectsPromise=null,this._hasJSActionsPromise=null,this._networkStream&&this._networkStream.cancelAllRequests(new n.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,n.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(t){let{value:i,done:r}=t;r?e.close():((0,n.assert)((0,n.isArrayBuffer)(i),"GetReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(i),1,[i]))})).catch((t=>{e.error(t)}))},e.onCancel=t=>{this._fullReader.cancel(t),e.ready.catch((t=>{if(!this.destroyed)throw t}))}})),t.on("ReaderHeadersReady",(()=>{const t=(0,n.createPromiseCapability)(),i=this._fullReader;return i.headersReady.then((()=>{var n;i.isStreamingSupported&&i.isRangeSupported||(this._lastProgress&&(null===(n=e.onProgress)||void 0===n||n.call(e,this._lastProgress)),i.onProgress=t=>{var i;null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded,total:t.total})}),t.resolve({isStreamingSupported:i.isStreamingSupported,isRangeSupported:i.isRangeSupported,contentLength:i.contentLength})}),t.reject),t.promise})),t.on("GetRangeReader",((t,e)=>{(0,n.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const i=this._networkStream.getRangeReader(t.begin,t.end);i?(e.onPull=()=>{i.read().then((function(t){let{value:i,done:r}=t;r?e.close():((0,n.assert)((0,n.isArrayBuffer)(i),"GetRangeReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(i),1,[i]))})).catch((t=>{e.error(t)}))},e.onCancel=t=>{i.cancel(t),e.ready.catch((t=>{if(!this.destroyed)throw t}))}):e.close()})),t.on("GetDoc",(t=>{let{pdfInfo:i}=t;this._numPages=i.numPages,this._htmlForXfa=i.htmlForXfa,delete i.htmlForXfa,e._capability.resolve(new I(i,this))})),t.on("DocException",(function(t){let i;switch(t.name){case"PasswordException":i=new n.PasswordException(t.message,t.code);break;case"InvalidPDFException":i=new n.InvalidPDFException(t.message);break;case"MissingPDFException":i=new n.MissingPDFException(t.message);break;case"UnexpectedResponseException":i=new n.UnexpectedResponseException(t.message,t.status);break;case"UnknownErrorException":i=new n.UnknownErrorException(t.message,t.details);break;default:(0,n.unreachable)("DocException - expected a valid Error.")}e._capability.reject(i)})),t.on("PasswordRequest",(t=>{if(this._passwordCapability=(0,n.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(t){this._passwordCapability.reject(t)}}else this._passwordCapability.reject(new n.PasswordException(t.message,t.code));return this._passwordCapability.promise})),t.on("DataLoaded",(t=>{var i;null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.length,total:t.length}),this.downloadInfoCapability.resolve(t)})),t.on("StartRenderPage",(t=>{this.destroyed||A(this,G).get(t.pageIndex)._startRenderPage(t.transparency,t.cacheKey)})),t.on("commonobj",(e=>{var i;let[r,s,a]=e;if(!this.destroyed&&!this.commonObjs.has(r))switch(s){case"Font":const e=this._params;if("error"in a){const t=a.error;(0,n.warn)(`Error during font loading: ${t}`),this.commonObjs.resolve(r,t);break}let h=null;e.pdfBug&&null!==(i=globalThis.FontInspector)&&void 0!==i&&i.enabled&&(h={registerFont(t,e){globalThis.FontInspector.fontAdded(t,e)}});const c=new o.FontFaceObject(a,{isEvalSupported:e.isEvalSupported,disableFontFace:e.disableFontFace,ignoreErrors:e.ignoreErrors,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),fontRegistry:h});this.fontLoader.bind(c).catch((()=>t.sendWithPromise("FontFallback",{id:r}))).finally((()=>{!e.fontExtraProperties&&c.data&&(c.data=null),this.commonObjs.resolve(r,c)}));break;case"FontPath":case"Image":this.commonObjs.resolve(r,a);break;default:throw new Error(`Got unknown common object type ${s}`)}})),t.on("obj",(t=>{let[e,i,n,r]=t;if(this.destroyed)return;const s=A(this,G).get(i);if(!s.objs.has(e))switch(n){case"Image":s.objs.resolve(e,r);const t=8e6;if(r){let e;if(r.bitmap){const{bitmap:t,width:i,height:n}=r;e=i*n*4,s._bitmaps.add(t)}else{var o;e=(null===(o=r.data)||void 0===o?void 0:o.length)||0}e>t&&(s.cleanupAfterRender=!0)}break;case"Pattern":s.objs.resolve(e,r);break;default:throw new Error(`Got unknown object type ${n}`)}})),t.on("DocProgress",(t=>{var i;this.destroyed||null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded,total:t.total})})),t.on("DocStats",(t=>{this.destroyed||m(this,z,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(t){var e,i;let{featureId:n}=t;this.destroyed||null===(e=(i=this.loadingTask).onUnsupportedFeature)||void 0===e||e.call(i,n)}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,i=A(this,Y).get(e);if(i)return i;const n=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then((t=>{if(this.destroyed)throw new Error("Transport destroyed");const i=new F(e,t,this,this._params.ownerDocument,this._params.pdfBug);return A(this,G).set(e,i),i}));return A(this,Y).set(e,n),n}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,e;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:this.annotationStorage.serializable,filename:null!==(t=null===(e=this._fullReader)||void 0===e?void 0:e.filename)&&void 0!==t?t: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 d.OptionalContentConfig(t)))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){return A(this,q)||m(this,q,this.messageHandler.sendWithPromise("GetMetadata",null).then((t=>{var e,i,n,r;return{info:t[0],metadata:t[1]?new f.Metadata(t[1]):null,contentDispositionFilename:null!==(e=null===(i=this._fullReader)||void 0===i?void 0:i.filename)&&void 0!==e?e:null,contentLength:null!==(n=null===(r=this._fullReader)||void 0===r?void 0:r.contentLength)&&void 0!==n?n:null}})))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(await this.messageHandler.sendWithPromise("Cleanup",null),!this.destroyed){for(const t of A(this,G).values())if(!t.cleanup())throw new Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),m(this,q,null),this._getFieldObjectsPromise=null,this._hasJSActionsPromise=null}}get loadingParams(){const t=this._params;return(0,n.shadow)(this,"loadingParams",{disableAutoFetch:t.disableAutoFetch,enableXfa:t.enableXfa})}}var V=new WeakMap,H=new WeakSet;class Q{constructor(){var t;g(this,t=H),t.add(this),w(this,V,{writable:!0,value:Object.create(null)})}get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e){const i=b(this,H,K).call(this,t);return i.capability.promise.then((()=>e(i.data))),null}const i=A(this,V)[t];if(null==i||!i.capability.settled)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return i.data}has(t){const e=A(this,V)[t];return(null==e?void 0:e.capability.settled)||!1}resolve(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=b(this,H,K).call(this,t);i.data=e,i.capability.resolve()}clear(){m(this,V,Object.create(null))}}function K(t){return A(this,V)[t]||(A(this,V)[t]={capability:(0,n.createPromiseCapability)(),data:null})}var J=new WeakMap;class Z{constructor(t){w(this,J,{writable:!0,value:null}),m(this,J,t),this.onContinue=null}get promise(){return A(this,J).capability.promise}cancel(){A(this,J).cancel()}get separateAnnots(){const{separateAnnots:t}=A(this,J).operatorList;if(!t)return!1;const{annotationCanvasMap:e}=A(this,J);return t.form||t.canvas&&(null==e?void 0:e.size)>0}}e.RenderTask=Z;class tt{constructor(t){let{callback:e,params:i,objs:r,commonObjs:s,annotationCanvasMap:o,operatorList:a,pageIndex:h,canvasFactory:c,useRequestAnimationFrame:u=!1,pdfBug:l=!1,pageColors:f=null}=t;this.callback=e,this.params=i,this.objs=r,this.commonObjs=s,this.annotationCanvasMap=o,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=h,this.canvasFactory=c,this._pdfBug=l,this.pageColors=f,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===u&&"undefined"!=typeof window,this.cancelled=!1,this.capability=(0,n.createPromiseCapability)(),this.task=new Z(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=i.canvasContext.canvas}get completed(){return this.capability.promise.catch((function(){}))}initializeGraphics(t){var e;let{transparency:i=!1,optionalContentConfig:n}=t;if(this.cancelled)return;if(this._canvas){if(M(tt,tt,et).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.");M(tt,tt,et).add(this._canvas)}this._pdfBug&&null!==(e=globalThis.StepperManager)&&void 0!==e&&e.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:r,viewport:s,transform:o,imageLayer:h,background:c}=this.params;this.gfx=new a.CanvasGraphics(r,this.commonObjs,this.objs,this.canvasFactory,h,n,this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:o,viewport:s,transparency:i,background:c}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback&&this.graphicsReadyCallback()}cancel(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;this.running=!1,this.cancelled=!0,this.gfx&&this.gfx.endDrawing(),this._canvas&&M(tt,tt,et).delete(this._canvas),this.callback(t||new s.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&&M(tt,tt,et).delete(this._canvas),this.callback())))}}var et={writable:!0,value:new WeakSet};e.version="2.16.105",e.build="172ccdbe5"},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PrintAnnotationStorage=e.AnnotationStorage=void 0;var n=i(1),r=i(131),s=i(135);function o(t,e,i){if(!e.has(t))throw new TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}function a(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}var h=new WeakSet;class c{constructor(){var t;a(this,t=h),t.add(this),this._storage=new Map,this._modified=!1,this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const i=this._storage.get(t);return void 0===i?e:Object.assign(e,i)}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 r.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(t,e){const i=this._storage.get(t);let n=!1;if(void 0!==i)for(const[t,r]of Object.entries(e))i[t]!==r&&(n=!0,i[t]=r);else n=!0,this._storage.set(t,e);n&&function(t,e,i){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return i}(this,h,u).call(this),e instanceof r.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 f(this)}get serializable(){if(0===this._storage.size)return null;const t=new Map;for(const[e,i]of this._storage){const n=i instanceof r.AnnotationEditor?i.serialize():i;n&&t.set(e,n)}return t}static getHash(t){if(!t)return"";const e=new s.MurmurHash3_64;for(const[i,n]of t)e.update(`${i}:${JSON.stringify(n)}`);return e.hexdigest()}}function u(){this._modified||(this._modified=!0,"function"==typeof this.onSetModified&&this.onSetModified())}e.AnnotationStorage=c;var l=new WeakMap;class f extends c{constructor(t){var e,i;super(),i={writable:!0,value:null},a(this,e=l),e.set(this,i),function(t,e,i){(function(t,e,i){if(e.set)e.set.call(t,i);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=i}})(t,o(t,e,"set"),i)}(this,l,structuredClone(t.serializable))}get print(){(0,n.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return function(t,e){return e.get?e.get.call(t):e.value}(this,o(this,l,"get"))}}e.PrintAnnotationStorage=f},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AnnotationEditor=void 0;var n=i(132),r=i(1);function s(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function o(t,e,i){!function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}(t,e),e.set(t,i)}function a(t,e,i){return function(t,e,i){if(e.set)e.set.call(t,i);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=i}}(t,c(t,e,"set"),i),i}function h(t,e){return function(t,e){return e.get?e.get.call(t):e.value}(t,c(t,e,"get"))}function c(t,e,i){if(!e.has(t))throw new TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}var u=new WeakMap,l=new WeakMap,f=new WeakMap,d=new WeakMap,v=new WeakMap,p=new WeakMap;class b{constructor(t){o(this,u,{writable:!0,value:this.focusin.bind(this)}),o(this,l,{writable:!0,value:this.focusout.bind(this)}),o(this,f,{writable:!0,value:!1}),o(this,d,{writable:!0,value:!1}),o(this,v,{writable:!0,value:!1}),o(this,p,{writable:!0,value:b._zIndex++}),this.constructor===b&&(0,r.unreachable)("Cannot initialize AnnotationEditor."),this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null;const[e,i]=this.parent.viewportBaseDimensions;this.x=t.x/e,this.y=t.y/i,this.rotation=this.parent.viewport.rotation,this.isAttachedToDOM=!1}static get _defaultLineColor(){return(0,r.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=h(this,p)}focusin(t){h(this,f)?a(this,f,!1):this.parent.setSelected(this)}focusout(t){if(!this.isAttachedToDOM)return;const e=t.relatedTarget;null!=e&&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,i,n){const[r,s]=this.parent.viewportBaseDimensions;[i,n]=this.screenToPageTranslation(i,n),this.x=(t+i)/r,this.y=(e+n)/s,this.div.style.left=100*this.x+"%",this.div.style.top=100*this.y+"%"}translate(t,e){const[i,n]=this.parent.viewportBaseDimensions;[t,e]=this.screenToPageTranslation(t,e),this.x+=t/i,this.y+=e/n,this.div.style.left=100*this.x+"%",this.div.style.top=100*this.y+"%"}screenToPageTranslation(t,e){const{rotation:i}=this.parent.viewport;switch(i){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}setDims(t,e){const[i,n]=this.parent.viewportBaseDimensions;this.div.style.width=100*t/i+"%",this.div.style.height=100*e/n+"%"}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",h(this,u)),this.div.addEventListener("focusout",h(this,l));const[t,e]=this.getInitialTranslation();return this.translate(t,e),(0,n.bindEvents)(this,this.div,["dragstart","pointerdown"]),this.div}pointerdown(t){const e=n.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),a(this,f,!0))}getRect(t,e){const[i,n]=this.parent.viewportBaseDimensions,[r,s]=this.parent.pageDimensions,o=r*t/i,a=s*e/n,h=this.x*r,c=this.y*s,u=this.width*r,l=this.height*s;switch(this.rotation){case 0:return[h+o,s-c-a-l,h+o+u,s-c-a];case 90:return[h+a,s-c+o,h+a+l,s-c+o+u];case 180:return[h-o-u,s-c+a,h-o,s-c+a+l];case 270:return[h-a-l,s-c-o-u,h-a,s-c-o];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[i,n,r,s]=t,o=r-i,a=s-n;switch(this.rotation){case 0:return[i,e-s,o,a];case 90:return[i,e-n,a,o];case 180:return[r,e-n,o,a];case 270:return[r,e-s,a,o];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){a(this,v,!0)}disableEditMode(){a(this,v,!1)}isInEditMode(){return h(this,v)}shouldGetKeyboardEvents(){return!1}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){var t;null===(t=this.div)||void 0===t||t.addEventListener("focusin",h(this,u))}serialize(){(0,r.unreachable)("An editor must be serializable")}static deserialize(t,e){const i=new this.prototype.constructor({parent:e,id:e.getNextId()});i.rotation=t.rotation;const[n,r]=e.pageDimensions,[s,o,a,h]=i.getRectInCurrentCoords(t.rect,r);return i.x=s/n,i.y=o/r,i.width=a/n,i.height=h/r,i}remove(){this.div.removeEventListener("focusin",h(this,u)),this.div.removeEventListener("focusout",h(this,l)),this.isEmpty()||this.commit(),this.parent.remove(this)}select(){var t;null===(t=this.div)||void 0===t||t.classList.add("selectedEditor")}unselect(){var t;null===(t=this.div)||void 0===t||t.classList.remove("selectedEditor")}updateParams(t,e){}disableEditing(){}enableEditing(){}get propertiesToUpdate(){return{}}get contentDiv(){return this.div}get isEditing(){return h(this,d)}set isEditing(t){a(this,d,t),t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null)}}e.AnnotationEditor=b,s(b,"_colorManager",new n.ColorManager),s(b,"_zIndex",1)},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.KeyboardManager=e.CommandManager=e.ColorManager=e.AnnotationEditorUIManager=void 0,e.bindEvents=function(t,e,i){for(const n of i)e.addEventListener(n,t[n].bind(t))},e.opacityToHex=function(t){return Math.round(Math.min(255,Math.max(1,255*t))).toString(16).padStart(2,"0")};var n=i(1),r=i(133);function s(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function o(t,e){c(t,e),e.add(t)}function a(t,e,i){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return i}function h(t,e,i){c(t,e),e.set(t,i)}function c(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function u(t,e,i){return function(t,e,i){if(e.set)e.set.call(t,i);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=i}}(t,f(t,e,"set"),i),i}function l(t,e){return function(t,e){return e.get?e.get.call(t):e.value}(t,f(t,e,"get"))}function f(t,e,i){if(!e.has(t))throw new TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}var d=new WeakMap;class v{constructor(){h(this,d,{writable:!0,value:0})}getId(){var t,e;return`${n.AnnotationEditorPrefix}${u(this,d,(t=l(this,d),e=t++,t)),e}`}}var p=new WeakMap,b=new WeakMap,w=new WeakMap,g=new WeakMap;class m{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:128;h(this,p,{writable:!0,value:[]}),h(this,b,{writable:!0,value:!1}),h(this,w,{writable:!0,value:void 0}),h(this,g,{writable:!0,value:-1}),u(this,w,t)}add(t){let{cmd:e,undo:i,mustExec:n,type:r=NaN,overwriteIfSameType:s=!1,keepUndo:o=!1}=t;if(n&&e(),l(this,b))return;const a={cmd:e,undo:i,type:r};if(-1===l(this,g))return l(this,p).length>0&&(l(this,p).length=0),u(this,g,0),void l(this,p).push(a);if(s&&l(this,p)[l(this,g)].type===r)return o&&(a.undo=l(this,p)[l(this,g)].undo),void(l(this,p)[l(this,g)]=a);const h=l(this,g)+1;h===l(this,w)?l(this,p).splice(0,1):(u(this,g,h),h<l(this,p).length&&l(this,p).splice(h)),l(this,p).push(a)}undo(){-1!==l(this,g)&&(u(this,b,!0),l(this,p)[l(this,g)].undo(),u(this,b,!1),u(this,g,l(this,g)-1))}redo(){l(this,g)<l(this,p).length-1&&(u(this,g,l(this,g)+1),u(this,b,!0),l(this,p)[l(this,g)].cmd(),u(this,b,!1))}hasSomethingToUndo(){return-1!==l(this,g)}hasSomethingToRedo(){return l(this,g)<l(this,p).length-1}destroy(){u(this,p,null)}}e.CommandManager=m;var A=new WeakSet;class y{constructor(t){o(this,A),this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const e=y.platform.isMac;for(const[i,n]of t)for(const t of i){const i=t.startsWith("mac+");e&&i?(this.callbacks.set(t.slice(4),n),this.allKeys.add(t.split("+").at(-1))):e||i||(this.callbacks.set(t,n),this.allKeys.add(t.split("+").at(-1)))}}static get platform(){const t="undefined"!=typeof navigator?navigator.platform:"";return(0,n.shadow)(this,"platform",{isWin:t.includes("Win"),isMac:t.includes("Mac")})}exec(t,e){if(!this.allKeys.has(e.key))return;const i=this.callbacks.get(a(this,A,k).call(this,e));i&&(i.bind(t)(),e.stopPropagation(),e.preventDefault())}}function k(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}e.KeyboardManager=y;var M=new WeakMap;class E{constructor(){h(this,M,{writable:!0,value:null})}copy(t){t&&(Array.isArray(t)?u(this,M,t.map((t=>t.serialize()))):u(this,M,[t.serialize()]),u(this,M,l(this,M).filter((t=>!!t))),0===l(this,M).length&&u(this,M,null))}paste(){return l(this,M)}isEmpty(){return null===l(this,M)}destroy(){u(this,M,null)}}class S{get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return(0,r.getColorValues)(t),(0,n.shadow)(this,"_colors",t)}convert(t){const e=(0,r.getRGB)(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[t,i]of this._colors)if(i.every(((t,i)=>t===e[i])))return S._colorsMapping.get(t);return e}getHexCode(t){const e=this._colors.get(t);return e?n.Util.makeHexColor(...e):t}}e.ColorManager=S,s(S,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));var x=new WeakMap,T=new WeakMap,_=new WeakMap,O=new WeakMap,C=new WeakMap,R=new WeakMap,j=new WeakMap,P=new WeakMap,D=new WeakMap,I=new WeakMap,F=new WeakMap,L=new WeakMap,W=new WeakMap,N=new WeakMap,B=new WeakMap,$=new WeakMap,U=new WeakMap,z=new WeakSet,G=new WeakSet,Y=new WeakSet,q=new WeakSet,X=new WeakSet,V=new WeakSet,H=new WeakSet,Q=new WeakSet,K=new WeakSet;class J{constructor(t,e){o(this,K),o(this,Q),o(this,H),o(this,V),o(this,X),o(this,q),o(this,Y),o(this,G),o(this,z),h(this,x,{writable:!0,value:null}),h(this,T,{writable:!0,value:new Map}),h(this,_,{writable:!0,value:new Map}),h(this,O,{writable:!0,value:new E}),h(this,C,{writable:!0,value:new m}),h(this,R,{writable:!0,value:0}),h(this,j,{writable:!0,value:null}),h(this,P,{writable:!0,value:null}),h(this,D,{writable:!0,value:new v}),h(this,I,{writable:!0,value:!1}),h(this,F,{writable:!0,value:n.AnnotationEditorType.NONE}),h(this,L,{writable:!0,value:new Set}),h(this,W,{writable:!0,value:this.keydown.bind(this)}),h(this,N,{writable:!0,value:this.onEditingAction.bind(this)}),h(this,B,{writable:!0,value:this.onPageChanging.bind(this)}),h(this,$,{writable:!0,value:{isEditing:!1,isEmpty:!0,hasEmptyClipboard:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1}}),h(this,U,{writable:!0,value:null}),u(this,U,t),u(this,P,e),l(this,P)._on("editingaction",l(this,N)),l(this,P)._on("pagechanging",l(this,B))}destroy(){a(this,G,tt).call(this),l(this,P)._off("editingaction",l(this,N)),l(this,P)._off("pagechanging",l(this,B));for(const t of l(this,_).values())t.destroy();l(this,_).clear(),l(this,T).clear(),u(this,x,null),l(this,L).clear(),l(this,O).destroy(),l(this,C).destroy()}onPageChanging(t){let{pageNumber:e}=t;u(this,R,e-1)}focusMainContainer(){l(this,U).focus()}keydown(t){var e;null!==(e=this.getActive())&&void 0!==e&&e.shouldGetKeyboardEvents()||J._keyboardManager.exec(this,t)}onEditingAction(t){["undo","redo","cut","copy","paste","delete","selectAll"].includes(t.name)&&this[t.name]()}setEditingState(t){t?(a(this,z,Z).call(this),a(this,Y,et).call(this,{isEditing:l(this,F)!==n.AnnotationEditorType.NONE,isEmpty:a(this,Q,ot).call(this),hasSomethingToUndo:l(this,C).hasSomethingToUndo(),hasSomethingToRedo:l(this,C).hasSomethingToRedo(),hasSelectedEditor:!1,hasEmptyClipboard:l(this,O).isEmpty()})):(a(this,G,tt).call(this),a(this,Y,et).call(this,{isEditing:!1}))}registerEditorTypes(t){u(this,j,t);for(const t of l(this,j))a(this,q,it).call(this,t.defaultPropertiesToUpdate)}getId(){return l(this,D).getId()}addLayer(t){l(this,_).set(t.pageIndex,t),l(this,I)?t.enable():t.disable()}removeLayer(t){l(this,_).delete(t.pageIndex)}updateMode(t){if(u(this,F,t),t===n.AnnotationEditorType.NONE)this.setEditingState(!1),a(this,V,rt).call(this);else{this.setEditingState(!0),a(this,X,nt).call(this);for(const e of l(this,_).values())e.updateMode(t)}}updateToolbar(t){t!==l(this,F)&&l(this,P).dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){for(const i of l(this,L))i.updateParams(t,e);for(const i of l(this,j))i.updateDefaultParams(t,e)}getEditors(t){const e=[];for(const i of l(this,T).values())i.pageIndex===t&&e.push(i);return e}getEditor(t){return l(this,T).get(t)}addEditor(t){l(this,T).set(t.id,t)}removeEditor(t){l(this,T).delete(t.id),this.unselect(t)}setActiveEditor(t){l(this,x)!==t&&(u(this,x,t),t&&a(this,q,it).call(this,t.propertiesToUpdate))}toggleSelected(t){if(l(this,L).has(t))return l(this,L).delete(t),t.unselect(),void a(this,Y,et).call(this,{hasSelectedEditor:this.hasSelection});l(this,L).add(t),t.select(),a(this,q,it).call(this,t.propertiesToUpdate),a(this,Y,et).call(this,{hasSelectedEditor:!0})}setSelected(t){for(const e of l(this,L))e!==t&&e.unselect();l(this,L).clear(),l(this,L).add(t),t.select(),a(this,q,it).call(this,t.propertiesToUpdate),a(this,Y,et).call(this,{hasSelectedEditor:!0})}isSelected(t){return l(this,L).has(t)}unselect(t){t.unselect(),l(this,L).delete(t),a(this,Y,et).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==l(this,L).size}undo(){l(this,C).undo(),a(this,Y,et).call(this,{hasSomethingToUndo:l(this,C).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:a(this,Q,ot).call(this)})}redo(){l(this,C).redo(),a(this,Y,et).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:l(this,C).hasSomethingToRedo(),isEmpty:a(this,Q,ot).call(this)})}addCommands(t){l(this,C).add(t),a(this,Y,et).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:a(this,Q,ot).call(this)})}delete(){if(l(this,x)&&l(this,x).commitOrRemove(),!this.hasSelection)return;const t=[...l(this,L)];this.addCommands({cmd:()=>{for(const e of t)e.remove()},undo:()=>{for(const e of t)a(this,H,st).call(this,e)},mustExec:!0})}copy(){if(l(this,x)&&l(this,x).commitOrRemove(),this.hasSelection){const t=[];for(const e of l(this,L))e.isEmpty()||t.push(e);if(0===t.length)return;l(this,O).copy(t),a(this,Y,et).call(this,{hasEmptyClipboard:!1})}}cut(){this.copy(),this.delete()}paste(){if(l(this,O).isEmpty())return;this.unselectAll();const t=l(this,_).get(l(this,R)),e=l(this,O).paste().map((e=>t.deserialize(e)));this.addCommands({cmd:()=>{for(const t of e)a(this,H,st).call(this,t);a(this,K,at).call(this,e)},undo:()=>{for(const t of e)t.remove()},mustExec:!0})}selectAll(){for(const t of l(this,L))t.commit();a(this,K,at).call(this,l(this,T).values())}unselectAll(){if(l(this,x))l(this,x).commitOrRemove();else if(0!==a(this,K,at).size){for(const t of l(this,L))t.unselect();l(this,L).clear(),a(this,Y,et).call(this,{hasSelectedEditor:!1})}}isActive(t){return l(this,x)===t}getActive(){return l(this,x)}getMode(){return l(this,F)}}function Z(){l(this,U).addEventListener("keydown",l(this,W))}function tt(){l(this,U).removeEventListener("keydown",l(this,W))}function et(t){Object.entries(t).some((t=>{let[e,i]=t;return l(this,$)[e]!==i}))&&l(this,P).dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(l(this,$),t)})}function it(t){l(this,P).dispatch("annotationeditorparamschanged",{source:this,details:t})}function nt(){if(!l(this,I)){u(this,I,!0);for(const t of l(this,_).values())t.enable()}}function rt(){if(this.unselectAll(),l(this,I)){u(this,I,!1);for(const t of l(this,_).values())t.disable()}}function st(t){const e=l(this,_).get(t.pageIndex);e?e.addOrRebuild(t):this.addEditor(t)}function ot(){if(0===l(this,T).size)return!0;if(1===l(this,T).size)for(const t of l(this,T).values())return t.isEmpty();return!1}function at(t){l(this,L).clear();for(const e of t)e.isEmpty()||(l(this,L).add(e),e.select());a(this,Y,et).call(this,{hasSelectedEditor:!0})}e.AnnotationEditorUIManager=J,s(J,"_keyboardManager",new y([[["ctrl+a","mac+meta+a"],J.prototype.selectAll],[["ctrl+c","mac+meta+c"],J.prototype.copy],[["ctrl+v","mac+meta+v"],J.prototype.paste],[["ctrl+x","mac+meta+x"],J.prototype.cut],[["ctrl+z","mac+meta+z"],J.prototype.undo],[["ctrl+y","ctrl+shift+Z","mac+meta+shift+Z"],J.prototype.redo],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete"],J.prototype.delete],[["Escape","mac+Escape"],J.prototype.unselectAll]]))},(t,e,i)=>{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 i of t.keys()){e.style.color=i;const n=window.getComputedStyle(e).color;t.set(i,f(n))}e.remove()},e.getCurrentTransform=function(t){const{a:e,b:i,c:n,d:r,e:s,f:o}=t.getTransform();return[e,i,n,r,s,o]},e.getCurrentTransformInverse=function(t){const{a:e,b:i,c:n,d:r,e:s,f:o}=t.getTransform().invertSelf();return[e,i,n,r,s,o]},e.getFilenameFromUrl=function(t){const e=t.indexOf("#"),i=t.indexOf("?"),n=Math.min(e>0?e:t.length,i>0?i:t.length);return t.substring(t.lastIndexOf("/",n)+1,n)},e.getPdfFilenameFromUrl=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"document.pdf";if("string"!=typeof t)return e;if(c(t))return(0,r.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const i=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,n=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(t);let s=i.exec(n[1])||i.exec(n[2])||i.exec(n[3]);if(s&&(s=s[0],s.includes("%")))try{s=i.exec(decodeURIComponent(s))[0]}catch(t){}return s||e},e.getRGB=f,e.getXfaPageViewport=function(t,e){let{scale:i=1,rotation:n=0}=e;const{width:r,height:s}=t.attributes.style,o=[0,0,parseInt(r),parseInt(s)];return new h({viewBox:o,scale:i,rotation:n})},e.isDataScheme=c,e.isPdfFile=function(t){return"string"==typeof t&&/\.pdf$/i.test(t)},e.isValidFetchUrl=u,e.loadScript=function(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new Promise(((i,n)=>{const r=document.createElement("script");r.src=t,r.onload=function(t){e&&r.remove(),i(t)},r.onerror=function(){n(new Error(`Cannot load script at: ${r.src}`))},(document.head||document.documentElement).append(r)}))};var n=i(134),r=i(1);function s(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}e.AnnotationPrefix="pdfjs_internal_id_";class o{}async function a(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(u(t,document.baseURI)){const i=await fetch(t);if(!i.ok)throw new Error(i.statusText);return e?new Uint8Array(await i.arrayBuffer()):(0,r.stringToBytes)(await i.text())}return new Promise(((i,n)=>{const s=new XMLHttpRequest;s.open("GET",t,!0),e&&(s.responseType="arraybuffer"),s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE){if(200===s.status||0===s.status){let t;if(e&&s.response?t=new Uint8Array(s.response):!e&&s.responseText&&(t=(0,r.stringToBytes)(s.responseText)),t)return void i(t)}n(new Error(s.statusText))}},s.send(null)}))}e.PixelsPerInch=o,s(o,"CSS",96),s(o,"PDF",72),s(o,"PDF_TO_CSS_UNITS",o.CSS/o.PDF),e.DOMCanvasFactory=class extends n.BaseCanvasFactory{constructor(){let{ownerDocument:t=globalThis.document}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};super(),this._document=t}_createCanvas(t,e){const i=this._document.createElement("canvas");return i.width=t,i.height=e,i}},e.DOMCMapReaderFactory=class extends n.BaseCMapReaderFactory{_fetchData(t,e){return a(t,this.isCompressed).then((t=>({cMapData:t,compressionType:e})))}},e.DOMStandardFontDataFactory=class extends n.BaseStandardFontDataFactory{_fetchData(t){return a(t,!0)}},e.DOMSVGFactory=class extends n.BaseSVGFactory{_createSVG(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}};class h{constructor(t){let{viewBox:e,scale:i,rotation:n,offsetX:r=0,offsetY:s=0,dontFlip:o=!1}=t;this.viewBox=e,this.scale=i,this.rotation=n,this.offsetX=r,this.offsetY=s;const a=(e[2]+e[0])/2,h=(e[3]+e[1])/2;let c,u,l,f,d,v,p,b;switch(n%=360,n<0&&(n+=360),n){case 180:c=-1,u=0,l=0,f=1;break;case 90:c=0,u=1,l=1,f=0;break;case 270:c=0,u=-1,l=-1,f=0;break;case 0:c=1,u=0,l=0,f=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}o&&(l=-l,f=-f),0===c?(d=Math.abs(h-e[1])*i+r,v=Math.abs(a-e[0])*i+s,p=Math.abs(e[3]-e[1])*i,b=Math.abs(e[2]-e[0])*i):(d=Math.abs(a-e[0])*i+r,v=Math.abs(h-e[1])*i+s,p=Math.abs(e[2]-e[0])*i,b=Math.abs(e[3]-e[1])*i),this.transform=[c*i,u*i,l*i,f*i,d-c*i*a-l*i*h,v-u*i*a-f*i*h],this.width=p,this.height=b}clone(){let{scale:t=this.scale,rotation:e=this.rotation,offsetX:i=this.offsetX,offsetY:n=this.offsetY,dontFlip:r=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new h({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:i,offsetY:n,dontFlip:r})}convertToViewportPoint(t,e){return r.Util.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){const e=r.Util.applyTransform([t[0],t[1]],this.transform),i=r.Util.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){return r.Util.applyInverseTransform([t,e],this.transform)}}function c(t){const e=t.length;let i=0;for(;i<e&&""===t[i].trim();)i++;return"data:"===t.substring(i,i+5).toLowerCase()}function u(t,e){try{const{protocol:i}=e?new URL(t,e):new URL(t);return"http:"===i||"https:"===i}catch(t){return!1}}let l;function f(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,r.warn)(`Not a valid color format: "${t}"`),[0,0,0])}e.PageViewport=h,e.RenderingCancelledException=class extends r.BaseException{constructor(t,e){super(t,"RenderingCancelledException"),this.type=e}},e.StatTimer=class{constructor(){this.started=Object.create(null),this.times=[]}time(t){t in this.started&&(0,r.warn)(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||(0,r.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 t of this.times){const i=t.name;i.length>e&&(e=i.length)}for(const i of this.times){const n=i.end-i.start;t.push(`${i.name.padEnd(e)} ${n}ms\n`)}return t.join("")}},e.PDFDateString=class{static toDateObject(t){if(!t||"string"!=typeof t)return null;l||(l=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const e=l.exec(t);if(!e)return null;const i=parseInt(e[1],10);let n=parseInt(e[2],10);n=n>=1&&n<=12?n-1:0;let r=parseInt(e[3],10);r=r>=1&&r<=31?r:1;let s=parseInt(e[4],10);s=s>=0&&s<=23?s:0;let o=parseInt(e[5],10);o=o>=0&&o<=59?o:0;let a=parseInt(e[6],10);a=a>=0&&a<=59?a:0;const h=e[7]||"Z";let c=parseInt(e[8],10);c=c>=0&&c<=23?c:0;let u=parseInt(e[9],10)||0;return u=u>=0&&u<=59?u:0,"-"===h?(s+=c,o+=u):"+"===h&&(s-=c,o-=u),new Date(Date.UTC(i,n,r,s,o,a))}}},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BaseStandardFontDataFactory=e.BaseSVGFactory=e.BaseCanvasFactory=e.BaseCMapReaderFactory=void 0;var n=i(1);class r{constructor(){this.constructor===r&&(0,n.unreachable)("Cannot initialize BaseCanvasFactory.")}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const i=this._createCanvas(t,e);return{canvas:i,context:i.getContext("2d")}}reset(t,e,i){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||i<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=i}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,n.unreachable)("Abstract method `_createCanvas` called.")}}e.BaseCanvasFactory=r;class s{constructor(t){let{baseUrl:e=null,isCompressed:i=!1}=t;this.constructor===s&&(0,n.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=e,this.isCompressed=i}async fetch(t){let{name:e}=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(!e)throw new Error("CMap name must be specified.");const i=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetchData(i,this.isCompressed?n.CMapCompressionType.BINARY:n.CMapCompressionType.NONE).catch((()=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${i}`)}))}_fetchData(t,e){(0,n.unreachable)("Abstract method `_fetchData` called.")}}e.BaseCMapReaderFactory=s;class o{constructor(t){let{baseUrl:e=null}=t;this.constructor===o&&(0,n.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=e}async fetch(t){let{filename:e}=t;if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!e)throw new Error("Font filename must be specified.");const i=`${this.baseUrl}${e}`;return this._fetchData(i).catch((()=>{throw new Error(`Unable to load font data at: ${i}`)}))}_fetchData(t){(0,n.unreachable)("Abstract method `_fetchData` called.")}}e.BaseStandardFontDataFactory=o;class a{constructor(){this.constructor===a&&(0,n.unreachable)("Cannot initialize BaseSVGFactory.")}create(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const n=this._createSVG("svg:svg");return n.setAttribute("version","1.1"),i||(n.setAttribute("width",`${t}px`),n.setAttribute("height",`${e}px`)),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("viewBox",`0 0 ${t} ${e}`),n}createElement(t){if("string"!=typeof t)throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){(0,n.unreachable)("Abstract method `_createSVG` called.")}}e.BaseSVGFactory=a},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MurmurHash3_64=void 0;var n=i(1);const r=3285377520,s=4294901760,o=65535;e.MurmurHash3_64=class{constructor(t){this.h1=t?4294967295&t:r,this.h2=t?4294967295&t:r}update(t){let e,i;if("string"==typeof t){e=new Uint8Array(2*t.length),i=0;for(let n=0,r=t.length;n<r;n++){const r=t.charCodeAt(n);r<=255?e[i++]=r:(e[i++]=r>>>8,e[i++]=255&r)}}else{if(!(0,n.isArrayBuffer)(t))throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");e=t.slice(),i=e.byteLength}const r=i>>2,a=i-4*r,h=new Uint32Array(e.buffer,0,r);let c=0,u=0,l=this.h1,f=this.h2;const d=3432918353,v=461845907,p=11601,b=13715;for(let t=0;t<r;t++)1&t?(c=h[t],c=c*d&s|c*p&o,c=c<<15|c>>>17,c=c*v&s|c*b&o,l^=c,l=l<<13|l>>>19,l=5*l+3864292196):(u=h[t],u=u*d&s|u*p&o,u=u<<15|u>>>17,u=u*v&s|u*b&o,f^=u,f=f<<13|f>>>19,f=5*f+3864292196);switch(c=0,a){case 3:c^=e[4*r+2]<<16;case 2:c^=e[4*r+1]<<8;case 1:c^=e[4*r],c=c*d&s|c*p&o,c=c<<15|c>>>17,c=c*v&s|c*b&o,1&r?l^=c:f^=c}this.h1=l,this.h2=f}hexdigest(){let t=this.h1,e=this.h2;t^=e>>>1,t=3981806797*t&s|36045*t&o,e=4283543511*e&s|(2950163797*(e<<16|t>>>16)&s)>>>16,t^=e>>>1,t=444984403*t&s|60499*t&o,e=3301882366*e&s|(3120437893*(e<<16|t>>>16)&s)>>>16,t^=e>>>1;const i=(t>>>0).toString(16),n=(e>>>0).toString(16);return i.padStart(8,"0")+n.padStart(8,"0")}}},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FontLoader=e.FontFaceObject=void 0;var n=i(1);class r{constructor(t){let{docId:e,onUnsupportedFeature:i,ownerDocument:s=globalThis.document,styleElement:o=null}=t;this.constructor===r&&(0,n.unreachable)("Cannot initialize BaseFontLoader."),this.docId=e,this._onUnsupportedFeature=i,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 i=e.sheet;i.insertRule(t,i.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(i){throw this._onUnsupportedFeature({featureId:n.UNSUPPORTED_FEATURES.errorFontLoadNative}),(0,n.warn)(`Failed to load font '${e.family}': '${i}'.`),t.disableFontFace=!0,i}}return}const e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise((i=>{const n=this._queueLoadingCallback(i);this._prepareFontLoadEvent([e],[t],n)}))}}_queueLoadingCallback(t){(0,n.unreachable)("Abstract method `_queueLoadingCallback`.")}get isFontLoadingAPISupported(){var t;const e=!(null===(t=this._document)||void 0===t||!t.fonts);return(0,n.shadow)(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){(0,n.unreachable)("Abstract method `isSyncFontLoadingSupported`.")}get _loadTestFont(){(0,n.unreachable)("Abstract method `_loadTestFont`.")}_prepareFontLoadEvent(t,e,i){(0,n.unreachable)("Abstract method `_prepareFontLoadEvent`.")}}let s;e.FontLoader=s,e.FontLoader=s=class extends r{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,n.shadow)(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){const e=this.loadingContext,i={id:"pdfjs-font-loading-"+e.nextRequestId++,done:!1,complete:function(){for((0,n.assert)(!i.done,"completeRequest() cannot be called twice."),i.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(i),i}get _loadTestFont(){return(0,n.shadow)(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(t,e,i){function r(t,e){return t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|255&t.charCodeAt(e+3)}function s(t,e,i,n){return t.substring(0,e)+n+t.substring(e+i)}let o,a;const h=this._document.createElement("canvas");h.width=1,h.height=1;const c=h.getContext("2d");let u=0;const l=`lt${Date.now()}${this.loadTestFontId++}`;let f=this._loadTestFont;f=s(f,976,l.length,l);const d=1482184792;let v=r(f,16);for(o=0,a=l.length-3;o<a;o+=4)v=v-d+r(l,o)|0;o<l.length&&(v=v-d+r(l+"XXX",o)|0),f=s(f,16,4,(0,n.string32)(v));const p=`url(data:font/opentype;base64,${btoa(f)});`;this.insertRule(`@font-face {font-family:"${l}";src:${p}}`);const b=[];for(const t of e)b.push(t.loadedName);b.push(l);const w=this._document.createElement("div");w.style.visibility="hidden",w.style.width=w.style.height="10px",w.style.position="absolute",w.style.top=w.style.left="0px";for(const t of b){const e=this._document.createElement("span");e.textContent="Hi",e.style.fontFamily=t,w.append(e)}this._document.body.append(w),function t(e,i){if(u++,u>30)return(0,n.warn)("Load test font never loaded."),void i();c.font="30px "+e,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0?i():setTimeout(t.bind(null,e,i))}(l,(()=>{w.remove(),i.complete()}))}},e.FontFaceObject=class{constructor(t,e){let{isEvalSupported:i=!0,disableFontFace:n=!1,ignoreErrors:r=!1,onUnsupportedFeature:s,fontRegistry:o=null}=e;this.compiledGlyphs=Object.create(null);for(const e in t)this[e]=t[e];this.isEvalSupported=!1!==i,this.disableFontFace=!0===n,this.ignoreErrors=!0===r,this._onUnsupportedFeature=s,this.fontRegistry=o}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,n.bytesToString)(this.data),e=`url(data:${this.mimetype};base64,${btoa(t)});`;let i;if(this.cssFontInfo){let t=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(t+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),i=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${t}src:${e}}`}else i=`@font-face {font-family:"${this.loadedName}";src:${e}}`;return this.fontRegistry&&this.fontRegistry.registerFont(this,e),i}getPathGenerator(t,e){if(void 0!==this.compiledGlyphs[e])return this.compiledGlyphs[e];let i;try{i=t.get(this.loadedName+"_path_"+e)}catch(t){if(!this.ignoreErrors)throw t;return this._onUnsupportedFeature({featureId:n.UNSUPPORTED_FEATURES.errorFontGetPath}),(0,n.warn)(`getPathGenerator - ignoring character: "${t}".`),this.compiledGlyphs[e]=function(){}}return this.compiledGlyphs[e]=function(t,e){for(const n of i)"scale"===n.cmd&&(n.args=[e,-e]),t[n.cmd].apply(t,n.args)}}}},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CanvasGraphics=void 0;var n=i(133),r=i(1),s=i(138),o=i(139),a=i(3);function h(t,e,i){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return i}const c=4096,u=a.isNodeJS&&"undefined"==typeof Path2D?-1:1e3,l=16;class f{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,i){let n;return void 0!==this.cache[t]?(n=this.cache[t],this.canvasFactory.reset(n,e,i)):(n=this.canvasFactory.create(e,i),this.cache[t]=n),n}delete(t){delete this.cache[t]}clear(){for(const t in this.cache)this.canvasFactory.destroy(this.cache[t]),delete this.cache[t]}}function d(t,e,i,r,s,o,a,h,c,u){const[l,f,d,v,p,b]=(0,n.getCurrentTransform)(t);if(0===f&&0===d){const n=Math.round(a*l+p),w=Math.round(h*v+b),g=Math.abs(Math.round((a+c)*l+p)-n)||1,m=Math.abs(Math.round((h+u)*v+b)-w)||1;return t.setTransform(Math.sign(l),0,0,Math.sign(v),n,w),t.drawImage(e,i,r,s,o,0,0,g,m),t.setTransform(l,f,d,v,p,b),[g,m]}if(0===l&&0===v){const n=Math.round(h*d+p),w=Math.round(a*f+b),g=Math.abs(Math.round((h+u)*d+p)-n)||1,m=Math.abs(Math.round((a+c)*f+b)-w)||1;return t.setTransform(0,Math.sign(f),Math.sign(d),0,n,w),t.drawImage(e,i,r,s,o,0,0,m,g),t.setTransform(l,f,d,v,p,b),[m,g]}return t.drawImage(e,i,r,s,o,a,h,c,u),[Math.hypot(l,f)*c,Math.hypot(d,v)*u]}class v{constructor(t,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=r.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=r.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=r.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,i){[e,i]=r.Util.applyTransform([e,i],t),this.minX=Math.min(this.minX,e),this.minY=Math.min(this.minY,i),this.maxX=Math.max(this.maxX,e),this.maxY=Math.max(this.maxY,i)}updateRectMinMax(t,e){const i=r.Util.applyTransform(e,t),n=r.Util.applyTransform(e.slice(2),t);this.minX=Math.min(this.minX,i[0],n[0]),this.minY=Math.min(this.minY,i[1],n[1]),this.maxX=Math.max(this.maxX,i[0],n[0]),this.maxY=Math.max(this.maxY,i[1],n[1])}updateScalingPathMinMax(t,e){r.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,i,n,s,o,a,h,c,u){const l=r.Util.bezierBoundingBox(e,i,n,s,o,a,h,c);if(u)return u[0]=Math.min(u[0],l[0],l[2]),u[1]=Math.max(u[1],l[0],l[2]),u[2]=Math.min(u[2],l[1],l[3]),void(u[3]=Math.max(u[3],l[1],l[3]));this.updateRectMinMax(t,l)}getPathBoundingBox(){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const e=[this.minX,this.minY,this.maxX,this.maxY];if((arguments.length>0&&void 0!==arguments[0]?arguments[0]:s.PathType.FILL)===s.PathType.STROKE){t||(0,r.unreachable)("Stroke bounding box must include transform.");const i=r.Util.singularValueDecompose2dScale(t),n=i[0]*this.lineWidth/2,s=i[1]*this.lineWidth/2;e[0]-=n,e[1]-=s,e[2]+=n,e[3]+=s}return e}updateClipFromPath(){const t=r.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(){return r.Util.intersect(this.clipBox,this.getPathBoundingBox(arguments.length>0&&void 0!==arguments[0]?arguments[0]:s.PathType.FILL,arguments.length>1&&void 0!==arguments[1]?arguments[1]:null))}}function p(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if("undefined"!=typeof ImageData&&e instanceof ImageData)return void t.putImageData(e,0,0);const n=e.height,s=e.width,o=n%l,a=(n-o)/l,h=0===o?a:a+1,c=t.createImageData(s,l);let u,f=0;const d=e.data,v=c.data;let p,b,w,g,m,A,y,k;if(i)switch(i.length){case 1:m=i[0],A=i[0],y=i[0],k=i[0];break;case 4:m=i[0],A=i[1],y=i[2],k=i[3]}if(e.kind===r.ImageKind.GRAYSCALE_1BPP){const e=d.byteLength,i=new Uint32Array(v.buffer,0,v.byteLength>>2),n=i.length,g=s+7>>3;let m=4294967295,A=r.FeatureTest.isLittleEndian?4278190080:255;for(k&&255===k[0]&&0===k[255]&&([m,A]=[A,m]),p=0;p<h;p++){for(w=p<a?l:o,u=0,b=0;b<w;b++){const t=e-f;let n=0;const r=t>g?s:8*t-7,o=-8&r;let a=0,h=0;for(;n<o;n+=8)h=d[f++],i[u++]=128&h?m:A,i[u++]=64&h?m:A,i[u++]=32&h?m:A,i[u++]=16&h?m:A,i[u++]=8&h?m:A,i[u++]=4&h?m:A,i[u++]=2&h?m:A,i[u++]=1&h?m:A;for(;n<r;n++)0===a&&(h=d[f++],a=128),i[u++]=h&a?m:A,a>>=1}for(;u<n;)i[u++]=0;t.putImageData(c,0,p*l)}}else if(e.kind===r.ImageKind.RGBA_32BPP){const e=!!(m||A||y);for(b=0,g=s*l*4,p=0;p<a;p++){if(v.set(d.subarray(f,f+g)),f+=g,e)for(let t=0;t<g;t+=4)m&&(v[t+0]=m[v[t+0]]),A&&(v[t+1]=A[v[t+1]]),y&&(v[t+2]=y[v[t+2]]);t.putImageData(c,0,b),b+=l}if(p<h){if(g=s*o*4,v.set(d.subarray(f,f+g)),e)for(let t=0;t<g;t+=4)m&&(v[t+0]=m[v[t+0]]),A&&(v[t+1]=A[v[t+1]]),y&&(v[t+2]=y[v[t+2]]);t.putImageData(c,0,b)}}else{if(e.kind!==r.ImageKind.RGB_24BPP)throw new Error(`bad image kind: ${e.kind}`);{const e=!!(m||A||y);for(w=l,g=s*w,p=0;p<h;p++){for(p>=a&&(w=o,g=s*w),u=0,b=g;b--;)v[u++]=d[f++],v[u++]=d[f++],v[u++]=d[f++],v[u++]=255;if(e)for(let t=0;t<u;t+=4)m&&(v[t+0]=m[v[t+0]]),A&&(v[t+1]=A[v[t+1]]),y&&(v[t+2]=y[v[t+2]]);t.putImageData(c,0,p*l)}}}}function b(t,e){if(e.bitmap)return void t.drawImage(e.bitmap,0,0);const i=e.height,n=e.width,r=i%l,s=(i-r)/l,a=0===r?s:s+1,h=t.createImageData(n,l);let c=0;const u=e.data,f=h.data;for(let e=0;e<a;e++){const i=e<s?l:r;({srcPos:c}=(0,o.applyMaskImageData)({src:u,srcPos:c,dest:f,width:n,height:i})),t.putImageData(h,0,e*l)}}function w(t,e){const i=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font"];for(let n=0,r=i.length;n<r;n++){const r=i[n];void 0!==t[r]&&(e[r]=t[r])}void 0!==t.setLineDash&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function g(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 m(t,e,i,n){const r=t.length;for(let s=3;s<r;s+=4){const r=t[s];if(0===r)t[s-3]=e,t[s-2]=i,t[s-1]=n;else if(r<255){const o=255-r;t[s-3]=t[s-3]*r+e*o>>8,t[s-2]=t[s-2]*r+i*o>>8,t[s-1]=t[s-1]*r+n*o>>8}}}function A(t,e,i){const n=t.length,r=1/255;for(let s=3;s<n;s+=4)e[s]=e[s]*(i?i[t[s]]:t[s])*r|0}function y(t,e,i){const n=t.length;for(let r=3;r<n;r+=4){const n=77*t[r-3]+152*t[r-2]+28*t[r-1];e[r]=i?e[r]*i[n>>8]>>8:e[r]*n>>16}}function k(t,e){const i=r.Util.singularValueDecompose2dScale(t);i[0]=Math.fround(i[0]),i[1]=Math.fround(i[1]);const s=Math.fround((globalThis.devicePixelRatio||1)*n.PixelsPerInch.PDF_TO_CSS_UNITS);return void 0!==e?e:i[0]<=s||i[1]<=s}const M=["butt","round","square"],E=["miter","round","bevel"],S={},x={};var T=new WeakSet;class _{constructor(t,e,i,n,r,s,o,a){var h,c;(function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")})(h=this,c=T),c.add(h),this.ctx=t,this.current=new v(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=i,this.canvasFactory=n,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=s,this.cachedCanvases=new f(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=o,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.backgroundColor=(null==a?void 0:a.background)||null,this.foregroundColor=(null==a?void 0:a.foreground)||null,this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return"string"==typeof t?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):e}beginDrawing(t){let{transform:e,viewport:i,transparency:r=!1,background:s=null}=t;const o=this.ctx.canvas.width,a=this.ctx.canvas.height,h=s||"#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 i=!0,r=h;if(this.ctx.fillStyle=h,r=this.ctx.fillStyle,i="string"==typeof r&&/^#[0-9A-Fa-f]{6}$/.test(r),"#000000"===t&&"#ffffff"===e||t===e||!i)this.foregroundColor=this.backgroundColor=null;else{const[i,s,o]=(0,n.getRGB)(r),a=t=>(t/=255)<=.03928?t/12.92:((t+.055)/1.055)**2.4,h=Math.round(.2126*a(i)+.7152*a(s)+.0722*a(o));this.selectColor=(i,n,r)=>{const s=.2126*a(i)+.7152*a(n)+.0722*a(r);return Math.round(s)===h?e:t}}}if(this.ctx.fillStyle=this.backgroundColor||h,this.ctx.fillRect(0,0,o,a),this.ctx.restore(),r){const t=this.cachedCanvases.getCanvas("transparent",o,a);this.compositeCtx=this.ctx,this.transparentCanvas=t.canvas,this.ctx=t.context,this.ctx.save(),this.ctx.transform(...(0,n.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),g(this.ctx,this.foregroundColor),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...i.transform),this.viewportScale=i.scale,this.baseTransform=(0,n.getCurrentTransform)(this.ctx),this.imageLayer&&((0,n.deprecated)("The `imageLayer` functionality will be removed in the future."),this.imageLayer.beginLayout())}executeOperatorList(t,e,i,n){const s=t.argsArray,o=t.fnArray;let a=e||0;const h=s.length;if(h===a)return a;const c=h-a>10&&"function"==typeof i,u=c?Date.now()+15:0;let l=0;const f=this.commonObjs,d=this.objs;let v;for(;;){if(void 0!==n&&a===n.nextBreakPoint)return n.breakIt(a,i),a;if(v=o[a],v!==r.OPS.dependency)this[v].apply(this,s[a]);else for(const t of s[a]){const e=t.startsWith("g_")?f:d;if(!e.has(t))return e.get(t,i),a}if(a++,a===h)return a;if(c&&++l>10){if(Date.now()>u)return i(),a;l=0}}}endDrawing(){h(this,T,O).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 i=t.width,n=t.height;let r,s,o=Math.max(Math.hypot(e[0],e[1]),1),a=Math.max(Math.hypot(e[2],e[3]),1),h=i,c=n,u="prescale1";for(;o>2&&h>1||a>2&&c>1;){let e=h,i=c;o>2&&h>1&&(e=Math.ceil(h/2),o/=h/e),a>2&&c>1&&(i=Math.ceil(c/2),a/=c/i),r=this.cachedCanvases.getCanvas(u,e,i),s=r.context,s.clearRect(0,0,e,i),s.drawImage(t,0,0,h,c,0,0,e,i),t=r.canvas,h=e,c=i,u="prescale1"===u?"prescale2":"prescale1"}return{img:t,paintWidth:h,paintHeight:c}}_createMaskCanvas(t){const e=this.ctx,{width:i,height:o}=t,a=this.current.fillColor,h=this.current.patternFill,c=(0,n.getCurrentTransform)(e);let u,l,f,v;if((t.bitmap||t.data)&&t.count>1){const e=t.bitmap||t.data.buffer,i=c.slice(0,4);l=JSON.stringify(h?i:[i,a]),u=this._cachedBitmapsMap.get(e),u||(u=new Map,this._cachedBitmapsMap.set(e,u));const n=u.get(l);if(n&&!h)return{canvas:n,offsetX:Math.round(Math.min(c[0],c[2])+c[4]),offsetY:Math.round(Math.min(c[1],c[3])+c[5])};f=n}f||(v=this.cachedCanvases.getCanvas("maskCanvas",i,o),b(v.context,t));let p=r.Util.transform(c,[1/i,0,0,-1/o,0,0]);p=r.Util.transform(p,[1,0,0,1,0,-o]);const w=r.Util.applyTransform([0,0],p),g=r.Util.applyTransform([i,o],p),m=r.Util.normalizeRect([w[0],w[1],g[0],g[1]]),A=Math.round(m[2]-m[0])||1,y=Math.round(m[3]-m[1])||1,M=this.cachedCanvases.getCanvas("fillCanvas",A,y),E=M.context,S=Math.min(w[0],g[0]),x=Math.min(w[1],g[1]);E.translate(-S,-x),E.transform(...p),f||(f=this._scaleImage(v.canvas,(0,n.getCurrentTransformInverse)(E)),f=f.img,u&&h&&u.set(l,f)),E.imageSmoothingEnabled=k((0,n.getCurrentTransform)(E),t.interpolate),d(E,f,0,0,f.width,f.height,0,0,i,o),E.globalCompositeOperation="source-in";const T=r.Util.transform((0,n.getCurrentTransformInverse)(E),[1,0,0,1,-S,-x]);return E.fillStyle=h?a.getPattern(e,this,T,s.PathType.FILL):a,E.fillRect(0,0,i,o),u&&!h&&(this.cachedCanvases.delete("fillCanvas"),u.set(l,M.canvas)),{canvas:M.canvas,offsetX:Math.round(S),offsetY:Math.round(x)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking=null),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=M[t]}setLineJoin(t){this.ctx.lineJoin=E[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){const i=this.ctx;void 0!==i.setLineDash&&(i.setLineDash(t),i.lineDashOffset=e)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(let e=0,i=t.length;e<i;e++){const i=t[e],n=i[1];switch(i[0]){case"LW":this.setLineWidth(n);break;case"LC":this.setLineCap(n);break;case"LJ":this.setLineJoin(n);break;case"ML":this.setMiterLimit(n);break;case"D":this.setDash(n[0],n[1]);break;case"RI":this.setRenderingIntent(n);break;case"FL":this.setFlatness(n);break;case"Font":this.setFont(n[0],n[1]);break;case"CA":this.current.strokeAlpha=i[1];break;case"ca":this.current.fillAlpha=i[1],this.ctx.globalAlpha=i[1];break;case"BM":this.ctx.globalCompositeOperation=n;break;case"SMask":this.current.activeSMask=n?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.current.transferMaps=n}}}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.cachedCanvases.getCanvas("smaskGroupAt"+this.groupLevel,this.ctx.canvas.width,this.ctx.canvas.height);this.suspendedCtx=this.ctx,this.ctx=t.context;const e=this.ctx;e.setTransform(...(0,n.getCurrentTransform)(this.suspendedCtx)),w(this.suspendedCtx,e),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,i){e.translate(t,i),this.__originalTranslate(t,i)},t.scale=function(t,i){e.scale(t,i),this.__originalScale(t,i)},t.transform=function(t,i,n,r,s,o){e.transform(t,i,n,r,s,o),this.__originalTransform(t,i,n,r,s,o)},t.setTransform=function(t,i,n,r,s,o){e.setTransform(t,i,n,r,s,o),this.__originalSetTransform(t,i,n,r,s,o)},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,i){e.moveTo(t,i),this.__originalMoveTo(t,i)},t.lineTo=function(t,i){e.lineTo(t,i),this.__originalLineTo(t,i)},t.bezierCurveTo=function(t,i,n,r,s,o){e.bezierCurveTo(t,i,n,r,s,o),this.__originalBezierCurveTo(t,i,n,r,s,o)},t.rect=function(t,i,n,r){e.rect(t,i,n,r),this.__originalRect(t,i,n,r)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}(e,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(),w(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){this.current.activeSMask&&(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],function(t,e,i,n){const r=n[0],s=n[1],o=n[2]-r,a=n[3]-s;0!==o&&0!==a&&(function(t,e,i,n,r,s,o,a,h,c,u){const l=!!s,f=l?s[0]:0,d=l?s[1]:0,v=l?s[2]:0;let p;p="Luminosity"===r?y:A;const b=Math.min(n,Math.ceil(1048576/i));for(let r=0;r<n;r+=b){const s=Math.min(b,n-r),w=t.getImageData(a-c,r+(h-u),i,s),g=e.getImageData(a,r+h,i,s);l&&m(w.data,f,d,v),p(w.data,g.data,o),e.putImageData(g,a,r+h)}}(e.context,i,o,a,e.subtype,e.backdrop,e.transferMap,r,s,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(i.canvas,0,0),t.restore())}(this.suspendedCtx,this.current.activeSMask,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?(w(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(),w(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null)}transform(t,e,i,n,r,s){this.ctx.transform(t,e,i,n,r,s),this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i){const s=this.ctx,o=this.current;let a,h,c=o.x,u=o.y;const l=(0,n.getCurrentTransform)(s),f=0===l[0]&&0===l[3]||0===l[1]&&0===l[2],d=f?i.slice(0):null;for(let i=0,n=0,v=t.length;i<v;i++)switch(0|t[i]){case r.OPS.rectangle:c=e[n++],u=e[n++];const t=e[n++],i=e[n++],v=c+t,p=u+i;s.moveTo(c,u),0===t||0===i?s.lineTo(v,p):(s.lineTo(v,u),s.lineTo(v,p),s.lineTo(c,p)),f||o.updateRectMinMax(l,[c,u,v,p]),s.closePath();break;case r.OPS.moveTo:c=e[n++],u=e[n++],s.moveTo(c,u),f||o.updatePathMinMax(l,c,u);break;case r.OPS.lineTo:c=e[n++],u=e[n++],s.lineTo(c,u),f||o.updatePathMinMax(l,c,u);break;case r.OPS.curveTo:a=c,h=u,c=e[n+4],u=e[n+5],s.bezierCurveTo(e[n],e[n+1],e[n+2],e[n+3],c,u),o.updateCurvePathMinMax(l,a,h,e[n],e[n+1],e[n+2],e[n+3],c,u,d),n+=6;break;case r.OPS.curveTo2:a=c,h=u,s.bezierCurveTo(c,u,e[n],e[n+1],e[n+2],e[n+3]),o.updateCurvePathMinMax(l,a,h,c,u,e[n],e[n+1],e[n+2],e[n+3],d),c=e[n+2],u=e[n+3],n+=4;break;case r.OPS.curveTo3:a=c,h=u,c=e[n+2],u=e[n+3],s.bezierCurveTo(e[n],e[n+1],c,u,c,u),o.updateCurvePathMinMax(l,a,h,e[n],e[n+1],c,u,c,u,d),n+=4;break;case r.OPS.closePath:s.closePath()}f&&o.updateScalingPathMinMax(l,d),o.setCurrentPoint(c,u)}closePath(){this.ctx.closePath()}stroke(t){t=void 0===t||t;const e=this.ctx,i=this.current.strokeColor;e.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"==typeof i&&null!=i&&i.getPattern?(e.save(),e.strokeStyle=i.getPattern(e,this,(0,n.getCurrentTransformInverse)(e),s.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,i=this.current.fillColor;let r=!1;this.current.patternFill&&(e.save(),e.fillStyle=i.getPattern(e,this,(0,n.getCurrentTransformInverse)(e),s.PathType.FILL),r=!0);const o=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==o&&(this.pendingEOFill?(e.fill("evenodd"),this.pendingEOFill=!1):e.fill()),r&&e.restore(),t&&this.consumePath(o)}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=S}eoClip(){this.pendingClip=x}beginText(){this.current.textMatrix=r.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 i of t)e.setTransform(...i.transform),e.translate(i.x,i.y),i.addToPath(e,i.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 i=this.commonObjs.get(t),n=this.current;if(!i)throw new Error(`Can't find font for ${t}`);if(n.fontMatrix=i.fontMatrix||r.FONT_IDENTITY_MATRIX,0!==n.fontMatrix[0]&&0!==n.fontMatrix[3]||(0,r.warn)("Invalid font matrix for font "+t),e<0?(e=-e,n.fontDirection=-1):n.fontDirection=1,this.current.font=i,this.current.fontSize=e,i.isType3Font)return;let s="normal";i.black?s="900":i.bold&&(s="bold");const o=i.italic?"italic":"normal",a=`"${i.loadedName||"sans-serif"}", ${i.fallbackName}`;let h=e;e<16?h=16:e>100&&(h=100),this.current.fontSizeScale=e/h,this.ctx.font=`${o} ${s} ${h}px ${a}`}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,i,n,r,s){this.current.textMatrix=[t,e,i,n,r,s],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,i,s){const o=this.ctx,a=this.current,h=a.font,c=a.textRenderingMode,u=a.fontSize/a.fontSizeScale,l=c&r.TextRenderingMode.FILL_STROKE_MASK,f=!!(c&r.TextRenderingMode.ADD_TO_PATH_FLAG),d=a.patternFill&&!h.missingFile;let v;(h.disableFontFace||f||d)&&(v=h.getPathGenerator(this.commonObjs,t)),h.disableFontFace||d?(o.save(),o.translate(e,i),o.beginPath(),v(o,u),s&&o.setTransform(...s),l!==r.TextRenderingMode.FILL&&l!==r.TextRenderingMode.FILL_STROKE||o.fill(),l!==r.TextRenderingMode.STROKE&&l!==r.TextRenderingMode.FILL_STROKE||o.stroke(),o.restore()):(l!==r.TextRenderingMode.FILL&&l!==r.TextRenderingMode.FILL_STROKE||o.fillText(t,e,i),l!==r.TextRenderingMode.STROKE&&l!==r.TextRenderingMode.FILL_STROKE||o.strokeText(t,e,i)),f&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:(0,n.getCurrentTransform)(o),x:e,y:i,fontSize:u,addToPath:v})}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 i=!1;for(let t=3;t<e.length;t+=4)if(e[t]>0&&e[t]<255){i=!0;break}return(0,r.shadow)(this,"isFontSubpixelAAEnabled",i)}showText(t){const e=this.current,i=e.font;if(i.isType3Font)return this.showType3Text(t);const o=e.fontSize;if(0===o)return;const a=this.ctx,h=e.fontSizeScale,c=e.charSpacing,u=e.wordSpacing,l=e.fontDirection,f=e.textHScale*l,d=t.length,v=i.vertical,p=v?1:-1,b=i.defaultVMetrics,w=o*e.fontMatrix[0],g=e.textRenderingMode===r.TextRenderingMode.FILL&&!i.disableFontFace&&!e.patternFill;let m;if(a.save(),a.transform(...e.textMatrix),a.translate(e.x,e.y+e.textRise),a.scale(f,l>0?-1:1),e.patternFill){a.save();const t=e.fillColor.getPattern(a,this,(0,n.getCurrentTransformInverse)(a),s.PathType.FILL);m=(0,n.getCurrentTransform)(a),a.restore(),a.fillStyle=t}let A=e.lineWidth;const y=e.textMatrixScale;if(0===y||0===A){const t=e.textRenderingMode&r.TextRenderingMode.FILL_STROKE_MASK;t!==r.TextRenderingMode.STROKE&&t!==r.TextRenderingMode.FILL_STROKE||(A=this.getSinglePixelWidth())}else A/=y;1!==h&&(a.scale(h,h),A/=h),a.lineWidth=A;let k,M=0;for(k=0;k<d;++k){const e=t[k];if("number"==typeof e){M+=p*e*o/1e3;continue}let n=!1;const r=(e.isSpace?u:0)+c,s=e.fontChar,f=e.accent;let d,A,y,E=e.width;if(v){const t=e.vmetric||b,i=-(e.vmetric?t[1]:.5*E)*w;E=t?-t[0]:E,d=i/h,A=(M+t[2]*w)/h}else d=M/h,A=0;if(i.remeasure&&E>0){const t=1e3*a.measureText(s).width/o*h;if(E<t&&this.isFontSubpixelAAEnabled){const e=E/t;n=!0,a.save(),a.scale(e,1),d/=e}else E!==t&&(d+=(E-t)/2e3*o/h)}this.contentVisible&&(e.isInFont||i.missingFile)&&(g&&!f?a.fillText(s,d,A):(this.paintChar(s,d,A,m),f&&this.paintChar(f.fontChar,d+o*f.offset.x/h,A-o*f.offset.y/h,m))),y=v?E*w-r*l:E*w+r*l,M+=y,n&&a.restore()}v?e.y-=M:e.x+=M*f,a.restore(),this.compose()}showType3Text(t){const e=this.ctx,i=this.current,n=i.font,s=i.fontSize,o=i.fontDirection,a=n.vertical?1:-1,h=i.charSpacing,c=i.wordSpacing,u=i.textHScale*o,l=i.fontMatrix||r.FONT_IDENTITY_MATRIX,f=t.length;let d,v,p,b;if(i.textRenderingMode!==r.TextRenderingMode.INVISIBLE&&0!==s){for(this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null,e.save(),e.transform(...i.textMatrix),e.translate(i.x,i.y),e.scale(u,o),d=0;d<f;++d){if(v=t[d],"number"==typeof v){b=a*v*s/1e3,this.ctx.translate(b,0),i.x+=b*u;continue}const o=(v.isSpace?c:0)+h,f=n.charProcOperatorList[v.operatorListId];f?(this.contentVisible&&(this.processingType3=v,this.save(),e.scale(s,s),e.transform(...l),this.executeOperatorList(f),this.restore()),p=r.Util.applyTransform([v.width,0],l)[0]*s+o,e.translate(p,0),i.x+=p*u):(0,r.warn)(`Type3 character "${v.operatorListId}" is not available.`)}e.restore(),this.processingType3=null}}setCharWidth(t,e){}setCharWidthAndBounds(t,e,i,n,r,s){this.ctx.rect(i,n,r-i,s-n),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let e;if("TilingPattern"===t[0]){const i=t[1],r=this.baseTransform||(0,n.getCurrentTransform)(this.ctx);e=new s.TilingPattern(t,i,this.ctx,{createCanvasGraphics:t=>new _(t,this.commonObjs,this.objs,this.canvasFactory)},r)}else e=this._getPattern(t[1],t[2]);return e}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,e,i){var n;const s=(null===(n=this.selectColor)||void 0===n?void 0:n.call(this,t,e,i))||r.Util.makeHexColor(t,e,i);this.ctx.strokeStyle=s,this.current.strokeColor=s}setFillRGBColor(t,e,i){var n;const s=(null===(n=this.selectColor)||void 0===n?void 0:n.call(this,t,e,i))||r.Util.makeHexColor(t,e,i);this.ctx.fillStyle=s,this.current.fillColor=s,this.current.patternFill=!1}_getPattern(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.cachedPatterns.has(t)?e=this.cachedPatterns.get(t):(e=(0,s.getShadingPattern)(this.objs.get(t)),this.cachedPatterns.set(t,e)),i&&(e.matrix=i),e}shadingFill(t){if(!this.contentVisible)return;const e=this.ctx;this.save();const i=this._getPattern(t);e.fillStyle=i.getPattern(e,this,(0,n.getCurrentTransformInverse)(e),s.PathType.SHADING);const o=(0,n.getCurrentTransformInverse)(e);if(o){const t=e.canvas,i=t.width,n=t.height,s=r.Util.applyTransform([0,0],o),a=r.Util.applyTransform([0,n],o),h=r.Util.applyTransform([i,0],o),c=r.Util.applyTransform([i,n],o),u=Math.min(s[0],a[0],h[0],c[0]),l=Math.min(s[1],a[1],h[1],c[1]),f=Math.max(s[0],a[0],h[0],c[0]),d=Math.max(s[1],a[1],h[1],c[1]);this.ctx.fillRect(u,l,f-u,d-l)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){(0,r.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,r.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(t,e){this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(t)&&6===t.length&&this.transform(...t),this.baseTransform=(0,n.getCurrentTransform)(this.ctx),e)&&(this.ctx.rect(e[0],e[1],e[2]-e[0],e[3]-e[1]),this.current.updateRectMinMax((0,n.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,r.info)("TODO: Support non-isolated groups."),t.knockout&&(0,r.warn)("Knockout groups not supported.");const i=(0,n.getCurrentTransform)(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let s=r.Util.getAxialAlignedBoundingBox(t.bbox,(0,n.getCurrentTransform)(e));s=r.Util.intersect(s,[0,0,e.canvas.width,e.canvas.height])||[0,0,0,0];const o=Math.floor(s[0]),a=Math.floor(s[1]);let h=Math.max(Math.ceil(s[2])-o,1),u=Math.max(Math.ceil(s[3])-a,1),l=1,f=1;h>c&&(l=h/c,h=c),u>c&&(f=u/c,u=c),this.current.startNewPathAndClipBox([0,0,h,u]);let d="groupAt"+this.groupLevel;t.smask&&(d+="_smask_"+this.smaskCounter++%2);const v=this.cachedCanvases.getCanvas(d,h,u),p=v.context;p.scale(1/l,1/f),p.translate(-o,-a),p.transform(...i),t.smask?this.smaskStack.push({canvas:v.canvas,context:p,offsetX:o,offsetY:a,scaleX:l,scaleY:f,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,a),e.scale(l,f),e.save()),w(e,p),this.ctx=p,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,i=this.groupStack.pop();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const t=(0,n.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...t);const i=r.Util.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],t);this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(i)}}beginAnnotation(t,e,i,s,o){if(h(this,T,O).call(this),g(this.ctx,this.foregroundColor),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(e)&&4===e.length){const s=e[2]-e[0],a=e[3]-e[1];if(o&&this.annotationCanvasMap){(i=i.slice())[4]-=e[0],i[5]-=e[1],(e=e.slice())[0]=e[1]=0,e[2]=s,e[3]=a;const[o,h]=r.Util.singularValueDecompose2dScale((0,n.getCurrentTransform)(this.ctx)),{viewportScale:c}=this,u=Math.ceil(s*this.outputScaleX*c),l=Math.ceil(a*this.outputScaleY*c);this.annotationCanvas=this.canvasFactory.create(u,l);const{canvas:f,context:d}=this.annotationCanvas;this.annotationCanvasMap.set(t,f),this.annotationCanvas.savedCtx=this.ctx,this.ctx=d,this.ctx.setTransform(o,0,0,-h,0,a*h),g(this.ctx,this.foregroundColor)}else g(this.ctx,this.foregroundColor),this.ctx.rect(e[0],e[1],s,a),this.ctx.clip(),this.endPath()}this.current=new v(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),this.transform(...s)}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 i=this.ctx,n=this.processingType3;if(n&&(void 0===n.compiled&&(n.compiled=function(t){const{width:e,height:i}=t;if(e>u||i>u)return null;const n=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),r=e+1;let s,o,a,h=new Uint8Array(r*(i+1));const c=e+7&-8;let l=new Uint8Array(c*i),f=0;for(const e of t.data){let t=128;for(;t>0;)l[f++]=e&t?0:255,t>>=1}let d=0;for(f=0,0!==l[f]&&(h[0]=1,++d),o=1;o<e;o++)l[f]!==l[f+1]&&(h[o]=l[f]?2:1,++d),f++;for(0!==l[f]&&(h[o]=2,++d),s=1;s<i;s++){f=s*c,a=s*r,l[f-c]!==l[f]&&(h[a]=l[f]?1:8,++d);let t=(l[f]?4:0)+(l[f-c]?8:0);for(o=1;o<e;o++)t=(t>>2)+(l[f+1]?4:0)+(l[f-c+1]?8:0),n[t]&&(h[a+o]=n[t],++d),f++;if(l[f-c]!==l[f]&&(h[a+o]=l[f]?2:4,++d),d>1e3)return null}for(f=c*(i-1),a=s*r,0!==l[f]&&(h[a]=8,++d),o=1;o<e;o++)l[f]!==l[f+1]&&(h[a+o]=l[f]?4:8,++d),f++;if(0!==l[f]&&(h[a+o]=4,++d),d>1e3)return null;const v=new Int32Array([0,r,-1,0,-r,0,0,0,1]),p=new Path2D;for(s=0;d&&s<=i;s++){let t=s*r;const i=t+e;for(;t<i&&!h[t];)t++;if(t===i)continue;p.moveTo(t%r,s);const n=t;let o=h[t];do{const e=v[o];do{t+=e}while(!h[t]);const i=h[t];5!==i&&10!==i?(o=i,h[t]=0):(o=i&51*o>>4,h[t]&=o>>2|o<<2),p.lineTo(t%r,t/r|0),h[t]||--d}while(n!==t);--s}return l=null,h=null,function(t){t.save(),t.scale(1/e,-1/i),t.translate(0,-i),t.fill(p),t.beginPath(),t.restore()}}(t)),n.compiled))return void n.compiled(i);const r=this._createMaskCanvas(t),s=r.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(s,r.offsetX,r.offsetY),i.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4?arguments[4]:void 0,a=arguments.length>5?arguments[5]:void 0;if(!this.contentVisible)return;t=this.getObject(t.data,t);const h=this.ctx;h.save();const c=(0,n.getCurrentTransform)(h);h.transform(e,i,s,o,0,0);const u=this._createMaskCanvas(t);h.setTransform(1,0,0,1,0,0);for(let t=0,n=a.length;t<n;t+=2){const n=r.Util.transform(c,[e,i,s,o,a[t],a[t+1]]),[l,f]=r.Util.applyTransform([0,0],n);h.drawImage(u.canvas,l,f)}h.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const e=this.ctx,i=this.current.fillColor,r=this.current.patternFill;for(const o of t){const{data:t,width:a,height:h,transform:c}=o,u=this.cachedCanvases.getCanvas("maskCanvas",a,h),l=u.context;l.save(),b(l,this.getObject(t,o)),l.globalCompositeOperation="source-in",l.fillStyle=r?i.getPattern(l,this,(0,n.getCurrentTransformInverse)(e),s.PathType.FILL):i,l.fillRect(0,0,a,h),l.restore(),e.save(),e.transform(...c),e.scale(1,-1),d(e,u.canvas,0,0,a,h,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const e=this.getObject(t);e?this.paintInlineImageXObject(e):(0,r.warn)("Dependent image isn't ready yet")}paintImageXObjectRepeat(t,e,i,n){if(!this.contentVisible)return;const s=this.getObject(t);if(!s)return void(0,r.warn)("Dependent image isn't ready yet");const o=s.width,a=s.height,h=[];for(let t=0,r=n.length;t<r;t+=2)h.push({transform:[e,0,0,i,n[t],n[t+1]],x:0,y:0,w:o,h:a});this.paintInlineImageXObjectGroup(s,h)}paintInlineImageXObject(t){if(!this.contentVisible)return;const e=t.width,i=t.height,s=this.ctx;let o;if(this.save(),s.scale(1/e,-1/i),"function"==typeof HTMLElement&&t instanceof HTMLElement||!t.data)o=t;else{const n=this.cachedCanvases.getCanvas("inlineImage",e,i);p(n.context,t,this.current.transferMaps),o=n.canvas}const a=this._scaleImage(o,(0,n.getCurrentTransformInverse)(s));s.imageSmoothingEnabled=k((0,n.getCurrentTransform)(s),t.interpolate);const[h,c]=d(s,a.img,0,0,a.paintWidth,a.paintHeight,0,-i,e,i);if(this.imageLayer){const[e,s]=r.Util.applyTransform([0,-i],(0,n.getCurrentTransform)(this.ctx));this.imageLayer.appendImage({imgData:t,left:e,top:s,width:h,height:c})}this.compose(),this.restore()}paintInlineImageXObjectGroup(t,e){if(!this.contentVisible)return;const i=this.ctx,s=t.width,o=t.height,a=this.cachedCanvases.getCanvas("inlineImage",s,o);p(a.context,t,this.current.transferMaps);for(const h of e){if(i.save(),i.transform(...h.transform),i.scale(1,-1),d(i,a.canvas,h.x,h.y,h.w,h.h,0,-1,1,1),this.imageLayer){const[e,i]=r.Util.applyTransform([h.x,h.y],(0,n.getCurrentTransform)(this.ctx));this.imageLayer.appendImage({imgData:t,left:e,top:i,width:s,height:o})}i.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){this.markedContentStack.push("OC"===t?{visible:this.optionalContentConfig.isVisible(e)}:{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 i=this.ctx;this.pendingClip&&(e||(this.pendingClip===x?i.clip("evenodd"):i.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),i.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=(0,n.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]),i=Math.hypot(t[0],t[2]),n=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(i,n)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(!this._cachedScaleForStroking){const{lineWidth:t}=this.current,e=(0,n.getCurrentTransform)(this.ctx);let i,r;if(0===e[1]&&0===e[2]){const n=Math.abs(e[0]),s=Math.abs(e[3]);if(0===t)i=1/n,r=1/s;else{const e=n*t,o=s*t;i=e<1?1/e:1,r=o<1?1/o:1}}else{const n=Math.abs(e[0]*e[3]-e[2]*e[1]),s=Math.hypot(e[0],e[1]),o=Math.hypot(e[2],e[3]);if(0===t)i=o/n,r=s/n;else{const e=t*n;i=o>e?o/e:1,r=s>e?s/e:1}}this._cachedScaleForStroking=[i,r]}return this._cachedScaleForStroking}rescaleAndStroke(t){const{ctx:e}=this,{lineWidth:i}=this.current,[r,s]=this.getScaleForStroking();if(e.lineWidth=i||1,1===r&&1===s)return void e.stroke();let o,a,h;t&&(o=(0,n.getCurrentTransform)(e),a=e.getLineDash().slice(),h=e.lineDashOffset),e.scale(r,s);const c=Math.max(r,s);e.setLineDash(e.getLineDash().map((t=>t/c))),e.lineDashOffset/=c,e.stroke(),t&&(e.setTransform(...o),e.setLineDash(a),e.lineDashOffset=h)}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}}function O(){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)}e.CanvasGraphics=_;for(const t in r.OPS)void 0!==_.prototype[t]&&(_.prototype[r.OPS[t]]=_.prototype[t])},(t,e,i)=>{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 f(t);case"Dummy":return new d}throw new Error(`Unknown IR type: ${t[0]}`)};var n=i(1),r=i(133),s=i(3);const o={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function a(t,e){if(!e||s.isNodeJS)return;const i=e[2]-e[0],n=e[3]-e[1],r=new Path2D;r.rect(e[0],e[1],i,n),t.clip(r)}e.PathType=o;class h{constructor(){this.constructor===h&&(0,n.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,n.unreachable)("Abstract method `getPattern` called.")}}class c extends h{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 t of this._colorStops)e.addColorStop(t[0],t[1]);return e}getPattern(t,e,i,s){let h;if(s===o.STROKE||s===o.FILL){const o=e.current.getClippedPathBoundingBox(s,(0,r.getCurrentTransform)(t))||[0,0,0,0],c=Math.ceil(o[2]-o[0])||1,u=Math.ceil(o[3]-o[1])||1,l=e.cachedCanvases.getCanvas("pattern",c,u,!0),f=l.context;f.clearRect(0,0,f.canvas.width,f.canvas.height),f.beginPath(),f.rect(0,0,f.canvas.width,f.canvas.height),f.translate(-o[0],-o[1]),i=n.Util.transform(i,[1,0,0,1,o[0],o[1]]),f.transform(...e.baseTransform),this.matrix&&f.transform(...this.matrix),a(f,this._bbox),f.fillStyle=this._createGradient(f),f.fill(),h=t.createPattern(l.canvas,"no-repeat");const d=new DOMMatrix(i);try{h.setTransform(d)}catch(t){(0,n.warn)(`RadialAxialShadingPattern.getPattern: "${null==t?void 0:t.message}".`)}}else a(t,this._bbox),h=this._createGradient(t);return h}}function u(t,e,i,n,r,s,o,a){const h=e.coords,c=e.colors,u=t.data,l=4*t.width;let f;h[i+1]>h[n+1]&&(f=i,i=n,n=f,f=s,s=o,o=f),h[n+1]>h[r+1]&&(f=n,n=r,r=f,f=o,o=a,a=f),h[i+1]>h[n+1]&&(f=i,i=n,n=f,f=s,s=o,o=f);const d=(h[i]+e.offsetX)*e.scaleX,v=(h[i+1]+e.offsetY)*e.scaleY,p=(h[n]+e.offsetX)*e.scaleX,b=(h[n+1]+e.offsetY)*e.scaleY,w=(h[r]+e.offsetX)*e.scaleX,g=(h[r+1]+e.offsetY)*e.scaleY;if(v>=g)return;const m=c[s],A=c[s+1],y=c[s+2],k=c[o],M=c[o+1],E=c[o+2],S=c[a],x=c[a+1],T=c[a+2],_=Math.round(v),O=Math.round(g);let C,R,j,P,D,I,F,L;for(let t=_;t<=O;t++){if(t<b){let e;e=t<v?0:(v-t)/(v-b),C=d-(d-p)*e,R=m-(m-k)*e,j=A-(A-M)*e,P=y-(y-E)*e}else{let e;e=t>g?1:b===g?0:(b-t)/(b-g),C=p-(p-w)*e,R=k-(k-S)*e,j=M-(M-x)*e,P=E-(E-T)*e}let e;e=t<v?0:t>g?1:(v-t)/(v-g),D=d-(d-w)*e,I=m-(m-S)*e,F=A-(A-x)*e,L=y-(y-T)*e;const i=Math.round(Math.min(C,D)),n=Math.round(Math.max(C,D));let r=l*t+4*i;for(let t=i;t<=n;t++)e=(C-t)/(C-D),e<0?e=0:e>1&&(e=1),u[r++]=R-(R-I)*e|0,u[r++]=j-(j-F)*e|0,u[r++]=P-(P-L)*e|0,u[r++]=255}}function l(t,e,i){const n=e.coords,r=e.colors;let s,o;switch(e.type){case"lattice":const a=e.verticesPerRow,h=Math.floor(n.length/a)-1,c=a-1;for(s=0;s<h;s++){let e=s*a;for(let s=0;s<c;s++,e++)u(t,i,n[e],n[e+1],n[e+a],r[e],r[e+1],r[e+a]),u(t,i,n[e+a+1],n[e+1],n[e+a],r[e+a+1],r[e+1],r[e+a])}break;case"triangles":for(s=0,o=n.length;s<o;s+=3)u(t,i,n[s],n[s+1],n[s+2],r[s],r[s+1],r[s+2]);break;default:throw new Error("illegal figure")}}class f extends h{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,i){const n=Math.floor(this._bounds[0]),r=Math.floor(this._bounds[1]),s=Math.ceil(this._bounds[2])-n,o=Math.ceil(this._bounds[3])-r,a=Math.min(Math.ceil(Math.abs(s*t[0]*1.1)),3e3),h=Math.min(Math.ceil(Math.abs(o*t[1]*1.1)),3e3),c=s/a,u=o/h,f={coords:this._coords,colors:this._colors,offsetX:-n,offsetY:-r,scaleX:1/c,scaleY:1/u},d=i.getCanvas("mesh",a+4,h+4,!1),v=d.context,p=v.createImageData(a,h);if(e){const t=p.data;for(let i=0,n=t.length;i<n;i+=4)t[i]=e[0],t[i+1]=e[1],t[i+2]=e[2],t[i+3]=255}for(const t of this._figures)l(p,t,f);return v.putImageData(p,2,2),{canvas:d.canvas,offsetX:n-2*c,offsetY:r-2*u,scaleX:c,scaleY:u}}getPattern(t,e,i,s){let h;if(a(t,this._bbox),s===o.SHADING)h=n.Util.singularValueDecompose2dScale((0,r.getCurrentTransform)(t));else if(h=n.Util.singularValueDecompose2dScale(e.baseTransform),this.matrix){const t=n.Util.singularValueDecompose2dScale(this.matrix);h=[h[0]*t[0],h[1]*t[1]]}const c=this._createMeshCanvas(h,s===o.SHADING?null:this._background,e.cachedCanvases);return s!==o.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 d extends h{getPattern(){return"hotpink"}}class v{static get MAX_PATTERN_SIZE(){return(0,n.shadow)(this,"MAX_PATTERN_SIZE",3e3)}constructor(t,e,i,n,r){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=i,this.canvasGraphicsFactory=n,this.baseTransform=r}createPatternCanvas(t){const e=this.operatorList,i=this.bbox,s=this.xstep,o=this.ystep,a=this.paintType,h=this.color,c=this.canvasGraphicsFactory;(0,n.info)("TilingType: "+this.tilingType);const u=i[0],l=i[1],f=i[2],d=i[3],v=n.Util.singularValueDecompose2dScale(this.matrix),p=n.Util.singularValueDecompose2dScale(this.baseTransform),b=[v[0]*p[0],v[1]*p[1]],w=this.getSizeAndScale(s,this.ctx.canvas.width,b[0]),g=this.getSizeAndScale(o,this.ctx.canvas.height,b[1]),m=t.cachedCanvases.getCanvas("pattern",w.size,g.size,!0),A=m.context,y=c.createCanvasGraphics(A);y.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(y,a,h);let k=u,M=l,E=f,S=d;return u<0&&(k=0,E+=Math.abs(u)),l<0&&(M=0,S+=Math.abs(l)),A.translate(-w.scale*k,-g.scale*M),y.transform(w.scale,0,0,g.scale,0,0),A.save(),this.clipBbox(y,k,M,E,S),y.baseTransform=(0,r.getCurrentTransform)(y.ctx),y.executeOperatorList(e),y.endDrawing(),{canvas:m.canvas,scaleX:w.scale,scaleY:g.scale,offsetX:k,offsetY:M}}getSizeAndScale(t,e,i){t=Math.abs(t);const n=Math.max(v.MAX_PATTERN_SIZE,e);let r=Math.ceil(t*i);return r>=n?r=n:i=r/t,{scale:i,size:r}}clipBbox(t,e,i,n,s){t.ctx.rect(e,i,n-e,s-i),t.current.updateRectMinMax((0,r.getCurrentTransform)(t.ctx),[e,i,n,s]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){const r=t.ctx,s=t.current;switch(e){case 1:const t=this.ctx;r.fillStyle=t.fillStyle,r.strokeStyle=t.strokeStyle,s.fillColor=t.fillStyle,s.strokeColor=t.strokeStyle;break;case 2:const o=n.Util.makeHexColor(i[0],i[1],i[2]);r.fillStyle=o,r.strokeStyle=o,s.fillColor=o,s.strokeColor=o;break;default:throw new n.FormatError(`Unsupported paint type: ${e}`)}}getPattern(t,e,i,r){let s=i;r!==o.SHADING&&(s=n.Util.transform(s,e.baseTransform),this.matrix&&(s=n.Util.transform(s,this.matrix)));const a=this.createPatternCanvas(e);let h=new DOMMatrix(s);h=h.translate(a.offsetX,a.offsetY),h=h.scale(1/a.scaleX,1/a.scaleY);const c=t.createPattern(a.canvas,"repeat");try{c.setTransform(h)}catch(t){(0,n.warn)(`TilingPattern.getPattern: "${null==t?void 0:t.message}".`)}return c}}e.TilingPattern=v},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.applyMaskImageData=function(t){let{src:e,srcPos:i=0,dest:r,destPos:s=0,width:o,height:a,inverseDecode:h=!1}=t;const c=n.FeatureTest.isLittleEndian?4278190080:255,[u,l]=h?[0,c]:[c,0],f=o>>3,d=7&o,v=e.length;r=new Uint32Array(r.buffer);for(let t=0;t<a;t++){for(const t=i+f;i<t;i++){const t=i<v?e[i]:255;r[s++]=128&t?l:u,r[s++]=64&t?l:u,r[s++]=32&t?l:u,r[s++]=16&t?l:u,r[s++]=8&t?l:u,r[s++]=4&t?l:u,r[s++]=2&t?l:u,r[s++]=1&t?l:u}if(0===d)continue;const t=i<v?e[i++]:255;for(let e=0;e<d;e++)r[s++]=t&1<<7-e?l:u}return{srcPos:i,destPos:s}};var n=i(1)},(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.GlobalWorkerOptions=void 0;const i=Object.create(null);e.GlobalWorkerOptions=i,i.workerPort=void 0===i.workerPort?null:i.workerPort,i.workerSrc=void 0===i.workerSrc?"":i.workerSrc},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MessageHandler=void 0;var n=i(1);function r(t){switch(t instanceof Error||"object"==typeof t&&null!==t||(0,n.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new n.AbortException(t.message);case"MissingPDFException":return new n.MissingPDFException(t.message);case"PasswordException":return new n.PasswordException(t.message,t.code);case"UnexpectedResponseException":return new n.UnexpectedResponseException(t.message,t.status);case"UnknownErrorException":return new n.UnknownErrorException(t.message,t.details);default:return new n.UnknownErrorException(t.message,t.toString())}}e.MessageHandler=class{constructor(t,e,i){this.sourceName=t,this.targetName=e,this.comObj=i,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,i=this.callbackCapabilities[t];if(!i)throw new Error(`Cannot resolve callback ${t}`);if(delete this.callbackCapabilities[t],1===e.callback)i.resolve(e.data);else{if(2!==e.callback)throw new Error("Unexpected callback case");i.reject(r(e.reason))}return}const n=this.actionHandler[e.action];if(!n)throw new Error(`Unknown action from worker: ${e.action}`);if(e.callbackId){const t=this.sourceName,s=e.sourceName;new Promise((function(t){t(n(e.data))})).then((function(n){i.postMessage({sourceName:t,targetName:s,callback:1,callbackId:e.callbackId,data:n})}),(function(n){i.postMessage({sourceName:t,targetName:s,callback:2,callbackId:e.callbackId,reason:r(n)})}))}else e.streamId?this._createStreamSink(e):n(e.data)},i.addEventListener("message",this._onComObjOnMessage)}on(t,e){const i=this.actionHandler;if(i[t])throw new Error(`There is already an actionName called "${t}"`);i[t]=e}send(t,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},i)}sendWithPromise(t,e,i){const r=this.callbackId++,s=(0,n.createPromiseCapability)();this.callbackCapabilities[r]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:r,data:e},i)}catch(t){s.reject(t)}return s.promise}sendWithStream(t,e,i,s){const o=this.streamId++,a=this.sourceName,h=this.targetName,c=this.comObj;return new ReadableStream({start:i=>{const r=(0,n.createPromiseCapability)();return this.streamControllers[o]={controller:i,startCall:r,pullCall:null,cancelCall:null,isClosed:!1},c.postMessage({sourceName:a,targetName:h,action:t,streamId:o,data:e,desiredSize:i.desiredSize},s),r.promise},pull:t=>{const e=(0,n.createPromiseCapability)();return this.streamControllers[o].pullCall=e,c.postMessage({sourceName:a,targetName:h,stream:6,streamId:o,desiredSize:t.desiredSize}),e.promise},cancel:t=>{(0,n.assert)(t instanceof Error,"cancel must have a valid reason");const e=(0,n.createPromiseCapability)();return this.streamControllers[o].cancelCall=e,this.streamControllers[o].isClosed=!0,c.postMessage({sourceName:a,targetName:h,stream:1,streamId:o,reason:r(t)}),e.promise}},i)}_createStreamSink(t){const e=t.streamId,i=this.sourceName,s=t.sourceName,o=this.comObj,a=this,h=this.actionHandler[t.action],c={enqueue(t){let r=arguments.length>2?arguments[2]:void 0;if(this.isCancelled)return;const a=this.desiredSize;this.desiredSize-=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,a>0&&this.desiredSize<=0&&(this.sinkCapability=(0,n.createPromiseCapability)(),this.ready=this.sinkCapability.promise),o.postMessage({sourceName:i,targetName:s,stream:4,streamId:e,chunk:t},r)},close(){this.isCancelled||(this.isCancelled=!0,o.postMessage({sourceName:i,targetName:s,stream:3,streamId:e}),delete a.streamSinks[e])},error(t){(0,n.assert)(t instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,o.postMessage({sourceName:i,targetName:s,stream:5,streamId:e,reason:r(t)}))},sinkCapability:(0,n.createPromiseCapability)(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};c.sinkCapability.resolve(),c.ready=c.sinkCapability.promise,this.streamSinks[e]=c,new Promise((function(e){e(h(t.data,c))})).then((function(){o.postMessage({sourceName:i,targetName:s,stream:8,streamId:e,success:!0})}),(function(t){o.postMessage({sourceName:i,targetName:s,stream:8,streamId:e,reason:r(t)})}))}_processStreamMessage(t){const e=t.streamId,i=this.sourceName,s=t.sourceName,o=this.comObj,a=this.streamControllers[e],h=this.streamSinks[e];switch(t.stream){case 8:t.success?a.startCall.resolve():a.startCall.reject(r(t.reason));break;case 7:t.success?a.pullCall.resolve():a.pullCall.reject(r(t.reason));break;case 6:if(!h){o.postMessage({sourceName:i,targetName:s,stream:7,streamId:e,success:!0});break}h.desiredSize<=0&&t.desiredSize>0&&h.sinkCapability.resolve(),h.desiredSize=t.desiredSize,new Promise((function(t){t(h.onPull&&h.onPull())})).then((function(){o.postMessage({sourceName:i,targetName:s,stream:7,streamId:e,success:!0})}),(function(t){o.postMessage({sourceName:i,targetName:s,stream:7,streamId:e,reason:r(t)})}));break;case 4:if((0,n.assert)(a,"enqueue should have stream controller"),a.isClosed)break;a.controller.enqueue(t.chunk);break;case 3:if((0,n.assert)(a,"close should have stream controller"),a.isClosed)break;a.isClosed=!0,a.controller.close(),this._deleteStreamController(a,e);break;case 5:(0,n.assert)(a,"error should have stream controller"),a.controller.error(r(t.reason)),this._deleteStreamController(a,e);break;case 2:t.success?a.cancelCall.resolve():a.cancelCall.reject(r(t.reason)),this._deleteStreamController(a,e);break;case 1:if(!h)break;new Promise((function(e){e(h.onCancel&&h.onCancel(r(t.reason)))})).then((function(){o.postMessage({sourceName:i,targetName:s,stream:2,streamId:e,success:!0})}),(function(t){o.postMessage({sourceName:i,targetName:s,stream:2,streamId:e,reason:r(t)})})),h.sinkCapability.reject(r(t.reason)),h.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,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Metadata=void 0;var n=i(1);function r(t,e,i){!function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}(t,e),e.set(t,i)}function s(t,e){return function(t,e){return e.get?e.get.call(t):e.value}(t,a(t,e,"get"))}function o(t,e,i){return function(t,e,i){if(e.set)e.set.call(t,i);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=i}}(t,a(t,e,"set"),i),i}function a(t,e,i){if(!e.has(t))throw new TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}var h=new WeakMap,c=new WeakMap;e.Metadata=class{constructor(t){let{parsedData:e,rawData:i}=t;r(this,h,{writable:!0,value:void 0}),r(this,c,{writable:!0,value:void 0}),o(this,h,e),o(this,c,i)}getRaw(){return s(this,c)}get(t){var e;return null!==(e=s(this,h).get(t))&&void 0!==e?e:null}getAll(){return(0,n.objectFromMap)(s(this,h))}has(t){return s(this,h).has(t)}}},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.OptionalContentConfig=void 0;var n=i(1);function r(t,e,i){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return i}function s(t,e,i){o(t,e),e.set(t,i)}function o(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function a(t,e,i){return function(t,e,i){if(e.set)e.set.call(t,i);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=i}}(t,c(t,e,"set"),i),i}function h(t,e){return function(t,e){return e.get?e.get.call(t):e.value}(t,c(t,e,"get"))}function c(t,e,i){if(!e.has(t))throw new TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}const u=Symbol("INTERNAL");var l=new WeakMap;class f{constructor(t,e){s(this,l,{writable:!0,value:!0}),this.name=t,this.intent=e}get visible(){return h(this,l)}_setVisible(t,e){t!==u&&(0,n.unreachable)("Internal method `_setVisible` called."),a(this,l,e)}}var d=new WeakMap,v=new WeakMap,p=new WeakMap,b=new WeakMap,w=new WeakSet;function g(t){const e=t.length;if(e<2)return!0;const i=t[0];for(let s=1;s<e;s++){const e=t[s];let o;if(Array.isArray(e))o=r(this,w,g).call(this,e);else{if(!h(this,v).has(e))return(0,n.warn)(`Optional content group not found: ${e}`),!0;o=h(this,v).get(e).visible}switch(i){case"And":if(!o)return!1;break;case"Or":if(o)return!0;break;case"Not":return!o;default:return!0}}return"And"===i}e.OptionalContentConfig=class{constructor(t){var e;if(o(this,e=w),e.add(this),s(this,d,{writable:!0,value:!0}),s(this,v,{writable:!0,value:new Map}),s(this,p,{writable:!0,value:null}),s(this,b,{writable:!0,value:null}),this.name=null,this.creator=null,null!==t){this.name=t.name,this.creator=t.creator,a(this,b,t.order);for(const e of t.groups)h(this,v).set(e.id,new f(e.name,e.intent));if("OFF"===t.baseState)for(const t of h(this,v).values())t._setVisible(u,!1);for(const e of t.on)h(this,v).get(e)._setVisible(u,!0);for(const e of t.off)h(this,v).get(e)._setVisible(u,!1);a(this,p,new Map);for(const[t,e]of h(this,v))h(this,p).set(t,e.visible)}}isVisible(t){if(0===h(this,v).size)return!0;if(!t)return(0,n.warn)("Optional content group not defined."),!0;if("OCG"===t.type)return h(this,v).has(t.id)?h(this,v).get(t.id).visible:((0,n.warn)(`Optional content group not found: ${t.id}`),!0);if("OCMD"===t.type){if(t.expression)return r(this,w,g).call(this,t.expression);if(!t.policy||"AnyOn"===t.policy){for(const e of t.ids){if(!h(this,v).has(e))return(0,n.warn)(`Optional content group not found: ${e}`),!0;if(h(this,v).get(e).visible)return!0}return!1}if("AllOn"===t.policy){for(const e of t.ids){if(!h(this,v).has(e))return(0,n.warn)(`Optional content group not found: ${e}`),!0;if(!h(this,v).get(e).visible)return!1}return!0}if("AnyOff"===t.policy){for(const e of t.ids){if(!h(this,v).has(e))return(0,n.warn)(`Optional content group not found: ${e}`),!0;if(!h(this,v).get(e).visible)return!0}return!1}if("AllOff"===t.policy){for(const e of t.ids){if(!h(this,v).has(e))return(0,n.warn)(`Optional content group not found: ${e}`),!0;if(h(this,v).get(e).visible)return!1}return!0}return(0,n.warn)(`Unknown optional content policy ${t.policy}.`),!0}return(0,n.warn)(`Unknown group type ${t.type}.`),!0}setVisibility(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];h(this,v).has(t)?(h(this,v).get(t)._setVisible(u,!!e),a(this,d,null)):(0,n.warn)(`Optional content group not found: ${t}`)}get hasInitialVisibility(){if(null!==h(this,d))return h(this,d);for(const[t,e]of h(this,v)){const i=h(this,p).get(t);if(e.visible!==i)return a(this,d,!1)}return a(this,d,!0)}getOrder(){return h(this,v).size?h(this,b)?h(this,b).slice():[...h(this,v).keys()]:null}getGroups(){return h(this,v).size>0?(0,n.objectFromMap)(h(this,v)):null}getGroup(t){return h(this,v).get(t)||null}}},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PDFDataTransportStream=void 0;var n=i(1),r=i(133);e.PDFDataTransportStream=class{constructor(t,e){(0,n.assert)(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'),this._queuedChunks=[],this._progressiveDone=t.progressiveDone||!1,this._contentDispositionFilename=t.contentDispositionFilename||null;const i=t.initialData;if((null==i?void 0:i.length)>0){const t=new Uint8Array(i).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 i=this._rangeReaders.some((function(i){return i._begin===t.begin&&(i._enqueue(e),!0)}));(0,n.assert)(i,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var t,e;return null!==(t=null===(e=this._fullRequestReader)||void 0===e?void 0:e._loaded)&&void 0!==t?t:0}_onProgress(t){if(void 0===t.total){const e=this._rangeReaders[0];null!=e&&e.onProgress&&e.onProgress({loaded:t.loaded})}else{const e=this._fullRequestReader;null!=e&&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,n.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new s(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new o(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader&&this._fullRequestReader.cancel(t);for(const e of this._rangeReaders.slice(0))e.cancel(t);this._pdfDataRangeTransport.abort()}};class s{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this._stream=t,this._done=i||!1,this._filename=(0,r.isPdfFile)(n)?n:null,this._queuedChunks=e||[],this._loaded=0;for(const t of this._queuedChunks)this._loaded+=t.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,n.createPromiseCapability)();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class o{constructor(t,e,i){this._stream=t,this._begin=e,this._end=i,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,n.createPromiseCapability)();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const t of this._requests)t.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 i{static textContent(t){const e=[],n={items:e,styles:Object.create(null)};return function t(n){var r;if(!n)return;let s=null;const o=n.name;if("#text"===o)s=n.value;else{if(!i.shouldBuildText(o))return;null!=n&&null!==(r=n.attributes)&&void 0!==r&&r.textContent?s=n.attributes.textContent:n.value&&(s=n.value)}if(null!==s&&e.push({str:s}),n.children)for(const e of n.children)t(e)}(t),n}static shouldBuildText(t){return!("textarea"===t||"input"===t||"option"===t||"select"===t)}}e.XfaText=i},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.NodeStandardFontDataFactory=e.NodeCanvasFactory=e.NodeCMapReaderFactory=void 0;var n=i(134);const r=function(t){return new Promise(((e,i)=>{E.readFile(t,((t,n)=>{!t&&n?e(new Uint8Array(n)):i(new Error(t))}))}))};e.NodeCanvasFactory=class extends n.BaseCanvasFactory{_createCanvas(t,e){return E.createCanvas(t,e)}},e.NodeCMapReaderFactory=class extends n.BaseCMapReaderFactory{_fetchData(t,e){return r(t).then((t=>({cMapData:t,compressionType:e})))}},e.NodeStandardFontDataFactory=class extends n.BaseStandardFontDataFactory{_fetchData(t){return r(t)}}},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AnnotationEditorLayer=void 0;var n=i(132),r=i(1),s=i(148),o=i(149);function a(t,e){c(t,e),e.add(t)}function h(t,e,i){c(t,e),e.set(t,i)}function c(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function u(t,e,i){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return i}function l(t,e){return function(t,e){return e.get?e.get.call(t):e.value}(t,d(t,e,"get"))}function f(t,e,i){return function(t,e,i){if(e.set)e.set.call(t,i);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=i}}(t,d(t,e,"set"),i),i}function d(t,e,i){if(!e.has(t))throw new TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}var v,p,b,w=new WeakMap,g=new WeakMap,m=new WeakMap,A=new WeakMap,y=new WeakMap,k=new WeakMap,M=new WeakMap,E=new WeakMap,S=new WeakSet,x=new WeakSet,T=new WeakSet,_=new WeakSet;class O{constructor(t){a(this,_),a(this,T),a(this,x),a(this,S),h(this,w,{writable:!0,value:void 0}),h(this,g,{writable:!0,value:!1}),h(this,m,{writable:!0,value:this.pointerup.bind(this)}),h(this,A,{writable:!0,value:this.pointerdown.bind(this)}),h(this,y,{writable:!0,value:new Map}),h(this,k,{writable:!0,value:!1}),h(this,M,{writable:!0,value:!1}),h(this,E,{writable:!0,value:void 0}),O._initialized||(O._initialized=!0,s.FreeTextEditor.initialize(t.l10n),o.InkEditor.initialize(t.l10n),t.uiManager.registerEditorTypes([s.FreeTextEditor,o.InkEditor])),f(this,E,t.uiManager),this.annotationStorage=t.annotationStorage,this.pageIndex=t.pageIndex,this.div=t.div,f(this,w,t.accessibilityManager),l(this,E).addLayer(this)}updateToolbar(t){l(this,E).updateToolbar(t)}updateMode(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:l(this,E).getMode();u(this,_,P).call(this),t===r.AnnotationEditorType.INK?(this.addInkEditorIfNeeded(!1),this.disableClick()):this.enableClick(),l(this,E).unselectAll()}addInkEditorIfNeeded(t){if(t||l(this,E).getMode()===r.AnnotationEditorType.INK){if(!t)for(const t of l(this,y).values())if(t.isEmpty())return void t.setInBackground();u(this,T,j).call(this,{offsetX:0,offsetY:0}).setInBackground()}}setEditingState(t){l(this,E).setEditingState(t)}addCommands(t){l(this,E).addCommands(t)}enable(){this.div.style.pointerEvents="auto";for(const t of l(this,y).values())t.enableEditing()}disable(){this.div.style.pointerEvents="none";for(const t of l(this,y).values())t.disableEditing()}setActiveEditor(t){l(this,E).getActive()!==t&&l(this,E).setActiveEditor(t)}enableClick(){this.div.addEventListener("pointerdown",l(this,A)),this.div.addEventListener("pointerup",l(this,m))}disableClick(){this.div.removeEventListener("pointerdown",l(this,A)),this.div.removeEventListener("pointerup",l(this,m))}attach(t){l(this,y).set(t.id,t)}detach(t){var e;l(this,y).delete(t.id),null===(e=l(this,w))||void 0===e||e.removePointerInTextLayer(t.contentDiv)}remove(t){l(this,E).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&&l(this,E).focusMainContainer()}),0),l(this,M)||this.addInkEditorIfNeeded(!1)}add(t){if(u(this,S,C).call(this,t),l(this,E).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=l(this,w))||void 0===e||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 l(this,E).getId()}deserialize(t){switch(t.annotationType){case r.AnnotationEditorType.FREETEXT:return s.FreeTextEditor.deserialize(t,this);case r.AnnotationEditorType.INK:return o.InkEditor.deserialize(t,this)}return null}setSelected(t){l(this,E).setSelected(t)}toggleSelected(t){l(this,E).toggleSelected(t)}isSelected(t){return l(this,E).isSelected(t)}unselect(t){l(this,E).unselect(t)}pointerup(t){0!==t.button||t.ctrlKey&&n.KeyboardManager.platform.isMac||t.target===this.div&&l(this,k)&&(f(this,k,!1),l(this,g)?u(this,T,j).call(this,t):f(this,g,!0))}pointerdown(t){if(0!==t.button||t.ctrlKey&&n.KeyboardManager.platform.isMac)return;if(t.target!==this.div)return;f(this,k,!0);const e=l(this,E).getActive();f(this,g,!e||e.isEmpty())}drop(t){const e=t.dataTransfer.getData("text/plain"),i=l(this,E).getEditor(e);if(!i)return;t.preventDefault(),t.dataTransfer.dropEffect="move",u(this,S,C).call(this,i);const n=this.div.getBoundingClientRect();i.translate(t.clientX-n.x-i.startX,t.clientY-n.y-i.startY),this.moveEditorInDOM(i),i.div.focus()}dragover(t){t.preventDefault()}destroy(){var t;(null===(t=l(this,E).getActive())||void 0===t?void 0:t.parent)===this&&l(this,E).setActiveEditor(null);for(const t of l(this,y).values()){var e;null===(e=l(this,w))||void 0===e||e.removePointerInTextLayer(t.contentDiv),t.isAttachedToDOM=!1,t.div.remove(),t.parent=null}this.div=null,l(this,y).clear(),l(this,E).removeLayer(this)}render(t){this.viewport=t.viewport,(0,n.bindEvents)(this,this.div,["dragover","drop"]),this.setDimensions();for(const t of l(this,E).getEditors(this.pageIndex))this.add(t);this.updateMode()}update(t){this.viewport=t.viewport,this.setDimensions(),this.updateMode()}get scaleFactor(){return this.viewport.scale}get pageDimensions(){const[t,e,i,n]=this.viewport.viewBox;return[i-t,n-e]}get viewportBaseDimensions(){const{width:t,height:e,rotation:i}=this.viewport;return i%180==0?[t,e]:[e,t]}setDimensions(){const{width:t,height:e,rotation:i}=this.viewport,n=i%180!=0,r=Math.floor(t)+"px",s=Math.floor(e)+"px";this.div.style.width=n?s:r,this.div.style.height=n?r:s,this.div.setAttribute("data-main-rotation",i)}}function C(t){var e;t.parent!==this&&(this.attach(t),t.pageIndex=this.pageIndex,null===(e=t.parent)||void 0===e||e.detach(t),t.parent=this,t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}function R(t){switch(l(this,E).getMode()){case r.AnnotationEditorType.FREETEXT:return new s.FreeTextEditor(t);case r.AnnotationEditorType.INK:return new o.InkEditor(t)}return null}function j(t){const e=this.getNextId(),i=u(this,x,R).call(this,{parent:this,id:e,x:t.offsetX,y:t.offsetY});return i&&this.add(i),i}function P(){f(this,M,!0);for(const t of l(this,y).values())t.isEmpty()&&t.remove();f(this,M,!1)}e.AnnotationEditorLayer=O,b=!1,(p="_initialized")in(v=O)?Object.defineProperty(v,p,{value:b,enumerable:!0,configurable:!0,writable:!0}):v[p]=b},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.FreeTextEditor=void 0;var n=i(1),r=i(132),s=i(131);function o(t,e){c(t,e),e.add(t)}function a(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function h(t,e,i){c(t,e),e.set(t,i)}function c(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function u(t,e){return function(t,e){return e.get?e.get.call(t):e.value}(t,d(t,e,"get"))}function l(t,e,i){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return i}function f(t,e,i){return function(t,e,i){if(e.set)e.set.call(t,i);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=i}}(t,d(t,e,"set"),i),i}function d(t,e,i){if(!e.has(t))throw new TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}var v=new WeakMap,p=new WeakMap,b=new WeakMap,w=new WeakMap,g=new WeakMap,m=new WeakMap,A=new WeakMap,y=new WeakSet,k=new WeakSet,M=new WeakSet,E=new WeakSet;class S extends s.AnnotationEditor{constructor(t){super({...t,name:"freeTextEditor"}),o(this,E),o(this,M),o(this,k),o(this,y),h(this,v,{writable:!0,value:this.editorDivBlur.bind(this)}),h(this,p,{writable:!0,value:this.editorDivFocus.bind(this)}),h(this,b,{writable:!0,value:this.editorDivKeydown.bind(this)}),h(this,w,{writable:!0,value:void 0}),h(this,g,{writable:!0,value:""}),h(this,m,{writable:!0,value:!1}),h(this,A,{writable:!0,value:void 0}),f(this,w,t.color||S._defaultColor||s.AnnotationEditor._defaultLineColor),f(this,A,t.fontSize||S._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(t,e){switch(t){case n.AnnotationEditorParamsType.FREETEXT_SIZE:S._defaultFontSize=e;break;case n.AnnotationEditorParamsType.FREETEXT_COLOR:S._defaultColor=e}}updateParams(t,e){switch(t){case n.AnnotationEditorParamsType.FREETEXT_SIZE:l(this,y,x).call(this,e);break;case n.AnnotationEditorParamsType.FREETEXT_COLOR:l(this,k,T).call(this,e)}}static get defaultPropertiesToUpdate(){return[[n.AnnotationEditorParamsType.FREETEXT_SIZE,S._defaultFontSize],[n.AnnotationEditorParamsType.FREETEXT_COLOR,S._defaultColor||s.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[n.AnnotationEditorParamsType.FREETEXT_SIZE,u(this,A)],[n.AnnotationEditorParamsType.FREETEXT_COLOR,u(this,w)]]}getInitialTranslation(){return[-S._internalPadding*this.parent.scaleFactor,-(S._internalPadding+u(this,A))*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(n.AnnotationEditorType.FREETEXT),super.enableEditMode(),this.enableEditing(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this.div.draggable=!1,this.editorDiv.addEventListener("keydown",u(this,b)),this.editorDiv.addEventListener("focus",u(this,p)),this.editorDiv.addEventListener("blur",u(this,v)))}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",u(this,b)),this.editorDiv.removeEventListener("focus",u(this,p)),this.editorDiv.removeEventListener("blur",u(this,v)),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(),u(this,m)||(f(this,m,!0),this.parent.addUndoableEditor(this)),this.disableEditMode(),f(this,g,l(this,M,_).call(this).trimEnd()),l(this,E,O).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(t){S._keyboardManager.exec(this,t)}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 t,e;this.width&&(t=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",`${this.id}-editor`),this.enableEditing(),S._l10nPromise.get("editor_free_text_aria_label").then((t=>{var e;return null===(e=this.editorDiv)||void 0===e?void 0:e.setAttribute("aria-label",t)})),S._l10nPromise.get("free_text_default_content").then((t=>{var e;return null===(e=this.editorDiv)||void 0===e?void 0:e.setAttribute("default-content",t)})),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize=`calc(${u(this,A)}px * var(--scale-factor))`,i.color=u(this,w),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),(0,r.bindEvents)(this,this.div,["dblclick","keydown"]),this.width){const[i,n]=this.parent.viewportBaseDimensions;this.setAt(t*i,e*n,this.width*i,this.height*n);for(const t of u(this,g).split("\n")){const e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}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 i=super.deserialize(t,e);return f(i,A,t.fontSize),f(i,w,n.Util.makeHexColor(...t.color)),f(i,g,t.value),i}serialize(){if(this.isEmpty())return null;const t=S._internalPadding*this.parent.scaleFactor,e=this.getRect(t,t),i=s.AnnotationEditor._colorManager.convert(getComputedStyle(this.editorDiv).color);return{annotationType:n.AnnotationEditorType.FREETEXT,color:i,fontSize:u(this,A),value:u(this,g),pageIndex:this.parent.pageIndex,rect:e,rotation:this.rotation}}}function x(t){const e=t=>{this.editorDiv.style.fontSize=`calc(${t}px * var(--scale-factor))`,this.translate(0,-(t-u(this,A))*this.parent.scaleFactor),f(this,A,t),l(this,E,O).call(this)},i=u(this,A);this.parent.addCommands({cmd:()=>{e(t)},undo:()=>{e(i)},mustExec:!0,type:n.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}function T(t){const e=u(this,w);this.parent.addCommands({cmd:()=>{f(this,w,t),this.editorDiv.style.color=t},undo:()=>{f(this,w,e),this.editorDiv.style.color=e},mustExec:!0,type:n.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function _(){const t=this.editorDiv.getElementsByTagName("div");if(0===t.length)return this.editorDiv.innerText;const e=[];for(let i=0,n=t.length;i<n;i++){const n=t[i].firstChild;e.push("#text"===(null==n?void 0:n.nodeName)?n.data:"")}return e.join("\n")}function O(){const[t,e]=this.parent.viewportBaseDimensions,i=this.div.getBoundingClientRect();this.width=i.width/t,this.height=i.height/e}e.FreeTextEditor=S,a(S,"_freeTextDefaultContent",""),a(S,"_l10nPromise",void 0),a(S,"_internalPadding",0),a(S,"_defaultColor",null),a(S,"_defaultFontSize",10),a(S,"_keyboardManager",new r.KeyboardManager([[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],S.prototype.commitOrRemove]])),a(S,"_type","freetext")},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.InkEditor=void 0,Object.defineProperty(e,"fitCurve",{enumerable:!0,get:function(){return s.fitCurve}});var n=i(1),r=i(131),s=i(150),o=i(132);function a(t,e){u(t,e),e.add(t)}function h(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function c(t,e,i){u(t,e),e.set(t,i)}function u(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function l(t,e,i){return function(t,e){if(t!==e)throw new TypeError("Private static access of wrong provenance")}(t,e),i}function f(t,e,i){return function(t,e,i){if(e.set)e.set.call(t,i);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=i}}(t,v(t,e,"set"),i),i}function d(t,e){return function(t,e){return e.get?e.get.call(t):e.value}(t,v(t,e,"get"))}function v(t,e,i){if(!e.has(t))throw new TypeError("attempted to "+i+" private field on non-instance");return e.get(t)}function p(t,e,i){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return i}const b=16;var w=new WeakMap,g=new WeakMap,m=new WeakMap,A=new WeakMap,y=new WeakMap,k=new WeakMap,M=new WeakMap,E=new WeakMap,S=new WeakMap,x=new WeakMap,T=new WeakMap,_=new WeakMap,O=new WeakMap,C=new WeakMap,R=new WeakSet,j=new WeakSet,P=new WeakSet,D=new WeakSet,I=new WeakSet,F=new WeakSet,L=new WeakSet,W=new WeakSet,N=new WeakSet,B=new WeakSet,$=new WeakSet,U=new WeakSet,z=new WeakSet,G=new WeakSet,Y=new WeakSet,q=new WeakSet,X=new WeakSet,V=new WeakSet,H=new WeakSet,Q=new WeakSet,K=new WeakSet,J=new WeakSet;class Z extends r.AnnotationEditor{constructor(t){super({...t,name:"inkEditor"}),a(this,J),a(this,K),a(this,Q),a(this,H),a(this,V),a(this,X),a(this,q),a(this,Y),a(this,G),a(this,z),a(this,U),a(this,$),a(this,B),a(this,N),a(this,W),a(this,L),a(this,F),a(this,I),a(this,D),a(this,P),a(this,j),a(this,R),c(this,w,{writable:!0,value:0}),c(this,g,{writable:!0,value:0}),c(this,m,{writable:!0,value:0}),c(this,A,{writable:!0,value:this.canvasPointermove.bind(this)}),c(this,y,{writable:!0,value:this.canvasPointerleave.bind(this)}),c(this,k,{writable:!0,value:this.canvasPointerup.bind(this)}),c(this,M,{writable:!0,value:this.canvasPointerdown.bind(this)}),c(this,E,{writable:!0,value:!1}),c(this,S,{writable:!0,value:!1}),c(this,x,{writable:!0,value:null}),c(this,T,{writable:!0,value:null}),c(this,_,{writable:!0,value:0}),c(this,O,{writable:!0,value:0}),c(this,C,{writable:!0,value: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(t,e){switch(t){case n.AnnotationEditorParamsType.INK_THICKNESS:Z._defaultThickness=e;break;case n.AnnotationEditorParamsType.INK_COLOR:Z._defaultColor=e;break;case n.AnnotationEditorParamsType.INK_OPACITY:Z._defaultOpacity=e/100}}updateParams(t,e){switch(t){case n.AnnotationEditorParamsType.INK_THICKNESS:p(this,R,tt).call(this,e);break;case n.AnnotationEditorParamsType.INK_COLOR:p(this,j,et).call(this,e);break;case n.AnnotationEditorParamsType.INK_OPACITY:p(this,P,it).call(this,e)}}static get defaultPropertiesToUpdate(){return[[n.AnnotationEditorParamsType.INK_THICKNESS,Z._defaultThickness],[n.AnnotationEditorParamsType.INK_COLOR,Z._defaultColor||r.AnnotationEditor._defaultLineColor],[n.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*Z._defaultOpacity)]]}get propertiesToUpdate(){var t;return[[n.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||Z._defaultThickness],[n.AnnotationEditorParamsType.INK_COLOR,this.color||Z._defaultColor||r.AnnotationEditor._defaultLineColor],[n.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(null!==(t=this.opacity)&&void 0!==t?t:Z._defaultOpacity))]]}rebuild(){super.rebuild(),null!==this.div&&(this.canvas||(p(this,$,ut).call(this),p(this,U,lt).call(this)),this.isAttachedToDOM||(this.parent.add(this),p(this,z,ft).call(this)),p(this,K,yt).call(this))}remove(){null!==this.canvas&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,d(this,T).disconnect(),f(this,T,null),super.remove())}enableEditMode(){d(this,E)||null===this.canvas||(super.enableEditMode(),this.div.draggable=!1,this.canvas.addEventListener("pointerdown",d(this,M)),this.canvas.addEventListener("pointerup",d(this,k)))}disableEditMode(){this.isInEditMode()&&null!==this.canvas&&(super.disableEditMode(),this.div.draggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",d(this,M)),this.canvas.removeEventListener("pointerup",d(this,k)))}onceAdded(){this.div.draggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}commit(){d(this,E)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),f(this,E,!0),this.div.classList.add("disabled"),p(this,K,yt).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()&&!d(this,E)&&(this.setInForeground(),"mouse"!==t.type&&this.div.focus(),t.stopPropagation(),this.canvas.addEventListener("pointerleave",d(this,y)),this.canvas.addEventListener("pointermove",d(this,A)),p(this,F,st).call(this,t.offsetX,t.offsetY))}canvasPointermove(t){t.stopPropagation(),p(this,L,ot).call(this,t.offsetX,t.offsetY)}canvasPointerup(t){0===t.button&&this.isInEditMode()&&0!==this.currentPath.length&&(t.stopPropagation(),p(this,B,ct).call(this,t),this.setInBackground())}canvasPointerleave(t){p(this,B,ct).call(this,t),this.setInBackground()}render(){if(this.div)return this.div;let t,e;this.width&&(t=this.x,e=this.y),super.render(),Z._l10nPromise.get("editor_ink_aria_label").then((t=>{var e;return null===(e=this.div)||void 0===e?void 0:e.setAttribute("aria-label",t)}));const[i,n,r,s]=p(this,D,nt).call(this);if(this.setAt(i,n,0,0),this.setDims(r,s),p(this,$,ut).call(this),this.width){const[i,n]=this.parent.viewportBaseDimensions;this.setAt(t*i,e*n,this.width*i,this.height*n),f(this,S,!0),p(this,z,ft).call(this),this.setDims(this.width*i,this.height*n),p(this,N,ht).call(this),p(this,J,kt).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return p(this,U,lt).call(this),this.div}setDimensions(t,e){const i=Math.round(t),n=Math.round(e);if(d(this,_)===i&&d(this,O)===n)return;f(this,_,i),f(this,O,n),this.canvas.style.visibility="hidden",d(this,w)&&Math.abs(d(this,w)-t/e)>.01&&(e=Math.ceil(t/d(this,w)),this.setDims(t,e));const[r,s]=this.parent.viewportBaseDimensions;this.width=t/r,this.height=e/s,d(this,E)&&p(this,G,dt).call(this,t,e),p(this,z,ft).call(this),p(this,N,ht).call(this),this.canvas.style.visibility="visible"}static deserialize(t,e){const i=super.deserialize(t,e);i.thickness=t.thickness,i.color=n.Util.makeHexColor(...t.color),i.opacity=t.opacity;const[r,s]=e.pageDimensions,o=i.width*r,a=i.height*s,h=e.scaleFactor,c=t.thickness/2;f(i,w,o/a),f(i,E,!0),f(i,_,Math.round(o)),f(i,O,Math.round(a));for(const{bezier:e}of t.paths){const t=[];i.paths.push(t);let n=h*(e[0]-c),r=h*(a-e[1]-c);for(let i=2,s=e.length;i<s;i+=6){const s=h*(e[i+4]-c),o=h*(a-e[i+5]-c);t.push([[n,r],[h*(e[i]-c),h*(a-e[i+1]-c)],[h*(e[i+2]-c),h*(a-e[i+3]-c)],[s,o]]),n=s,r=o}const s=l(this,Z,pt).call(this,t);i.bezierPath2D.push(s)}const u=p(i,H,mt).call(i);return f(i,m,Math.max(b,u[2]-u[0])),f(i,g,Math.max(b,u[3]-u[1])),p(i,G,dt).call(i,o,a),i}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],i=r.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:n.AnnotationEditorType.INK,color:i,thickness:this.thickness,opacity:this.opacity,paths:p(this,q,bt).call(this,this.scaleFactor/this.parent.scaleFactor,this.translationX,this.translationY,e),pageIndex:this.parent.pageIndex,rect:t,rotation:this.rotation}}}function tt(t){const e=this.thickness;this.parent.addCommands({cmd:()=>{this.thickness=t,p(this,K,yt).call(this)},undo:()=>{this.thickness=e,p(this,K,yt).call(this)},mustExec:!0,type:n.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}function et(t){const e=this.color;this.parent.addCommands({cmd:()=>{this.color=t,p(this,N,ht).call(this)},undo:()=>{this.color=e,p(this,N,ht).call(this)},mustExec:!0,type:n.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function it(t){t/=100;const e=this.opacity;this.parent.addCommands({cmd:()=>{this.opacity=t,p(this,N,ht).call(this)},undo:()=>{this.opacity=e,p(this,N,ht).call(this)},mustExec:!0,type:n.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}function nt(){const{width:t,height:e,rotation:i}=this.parent.viewport;switch(i){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]}}function rt(){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,o.opacityToHex)(this.opacity)}`}function st(t,e){var i;this.isEditing=!0,d(this,S)||(f(this,S,!0),p(this,z,ft).call(this),this.thickness||(this.thickness=Z._defaultThickness),this.color||(this.color=Z._defaultColor||r.AnnotationEditor._defaultLineColor),null!==(i=this.opacity)&&void 0!==i||(this.opacity=Z._defaultOpacity)),this.currentPath.push([t,e]),f(this,x,null),p(this,I,rt).call(this),this.ctx.beginPath(),this.ctx.moveTo(t,e),f(this,C,(()=>{d(this,C)&&(d(this,x)&&(this.isEmpty()?(this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)):p(this,N,ht).call(this),this.ctx.lineTo(...d(this,x)),f(this,x,null),this.ctx.stroke()),window.requestAnimationFrame(d(this,C)))})),window.requestAnimationFrame(d(this,C))}function ot(t,e){const[i,n]=this.currentPath.at(-1);t===i&&e===n||(this.currentPath.push([t,e]),f(this,x,[t,e]))}function at(t,e){this.ctx.closePath(),f(this,C,null),t=Math.min(Math.max(t,0),this.canvas.width),e=Math.min(Math.max(e,0),this.canvas.height);const[i,n]=this.currentPath.at(-1);let r;if(t===i&&e===n||this.currentPath.push([t,e]),1!==this.currentPath.length)r=(0,s.fitCurve)(this.currentPath,30,null);else{const i=[t,e];r=[[i,i.slice(),i.slice(),i]]}const o=l(Z,Z,pt).call(Z,r);this.currentPath.length=0,this.parent.addCommands({cmd:()=>{this.paths.push(r),this.bezierPath2D.push(o),this.rebuild()},undo:()=>{this.paths.pop(),this.bezierPath2D.pop(),0===this.paths.length?this.remove():(this.canvas||(p(this,$,ut).call(this),p(this,U,lt).call(this)),p(this,K,yt).call(this))},mustExec:!0})}function ht(){if(this.isEmpty())return void p(this,Y,vt).call(this);p(this,I,rt).call(this);const{canvas:t,ctx:e}=this;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t.width,t.height),p(this,Y,vt).call(this);for(const t of this.bezierPath2D)e.stroke(t)}function ct(t){p(this,W,at).call(this,t.offsetX,t.offsetY),this.canvas.removeEventListener("pointerleave",d(this,y)),this.canvas.removeEventListener("pointermove",d(this,A)),this.parent.addToAnnotationStorage(this)}function ut(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",Z._l10nPromise.get("editor_ink_canvas_aria_label").then((t=>{var e;return null===(e=this.canvas)||void 0===e?void 0:e.setAttribute("aria-label",t)})),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")}function lt(){f(this,T,new ResizeObserver((t=>{const e=t[0].contentRect;e.width&&e.height&&this.setDimensions(e.width,e.height)}))),d(this,T).observe(this.div)}function ft(){if(!d(this,S))return;const[t,e]=this.parent.viewportBaseDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*e),p(this,Y,vt).call(this)}function dt(t,e){const i=p(this,Q,At).call(this),n=(t-i)/d(this,m),r=(e-i)/d(this,g);this.scaleFactor=Math.min(n,r)}function vt(){const t=p(this,Q,At).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)}function pt(t){const e=new Path2D;for(let i=0,n=t.length;i<n;i++){const[n,r,s,o]=t[i];0===i&&e.moveTo(...n),e.bezierCurveTo(r[0],r[1],s[0],s[1],o[0],o[1])}return e}function bt(t,e,i,n){const r=[],s=this.thickness/2;let o,a;for(const h of this.paths){o=[],a=[];for(let r=0,c=h.length;r<c;r++){const[c,u,l,f]=h[r],d=t*(c[0]+e)+s,v=n-t*(c[1]+i)-s,b=t*(u[0]+e)+s,w=n-t*(u[1]+i)-s,g=t*(l[0]+e)+s,m=n-t*(l[1]+i)-s,A=t*(f[0]+e)+s,y=n-t*(f[1]+i)-s;0===r&&(o.push(d,v),a.push(d,v)),o.push(b,w,g,m,A,y),p(this,X,wt).call(this,d,v,b,w,g,m,A,y,4,a)}r.push({bezier:o,points:a})}return r}function wt(t,e,i,n,r,s,o,a,h,c){if(p(this,V,gt).call(this,t,e,i,n,r,s,o,a))c.push(o,a);else{for(let u=1;u<h-1;u++){const l=u/h,f=1-l;let d=l*t+f*i,v=l*e+f*n,p=l*i+f*r,b=l*n+f*s;d=l*d+f*p,v=l*v+f*b,p=l*p+f*(l*r+f*o),b=l*b+f*(l*s+f*a),d=l*d+f*p,v=l*v+f*b,c.push(d,v)}c.push(o,a)}}function gt(t,e,i,n,r,s,o,a){const h=(3*n-2*e-a)**2,c=(3*s-e-2*a)**2;return Math.max((3*i-2*t-o)**2,(3*r-t-2*o)**2)+Math.max(h,c)<=10}function mt(){let t=1/0,e=-1/0,i=1/0,r=-1/0;for(const s of this.paths)for(const[o,a,h,c]of s){const s=n.Util.bezierBoundingBox(...o,...a,...h,...c);t=Math.min(t,s[0]),i=Math.min(i,s[1]),e=Math.max(e,s[2]),r=Math.max(r,s[3])}return[t,i,e,r]}function At(){return d(this,E)?Math.ceil(this.thickness*this.parent.scaleFactor):0}function yt(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return;if(!d(this,E))return void p(this,N,ht).call(this);const e=p(this,H,mt).call(this),i=p(this,Q,At).call(this);f(this,m,Math.max(b,e[2]-e[0])),f(this,g,Math.max(b,e[3]-e[1]));const n=Math.ceil(i+d(this,m)*this.scaleFactor),r=Math.ceil(i+d(this,g)*this.scaleFactor),[s,o]=this.parent.viewportBaseDimensions;this.width=n/s,this.height=r/o,f(this,w,n/r),p(this,J,kt).call(this);const a=this.translationX,h=this.translationY;this.translationX=-e[0],this.translationY=-e[1],p(this,z,ft).call(this),p(this,N,ht).call(this),f(this,_,n),f(this,O,r),this.setDims(n,r);const c=t?i/this.scaleFactor/2:0;this.translate(a-this.translationX-c,h-this.translationY-c)}function kt(){const{style:t}=this.div;d(this,w)>=1?(t.minHeight=`${b}px`,t.minWidth=`${Math.round(d(this,w)*b)}px`):(t.minWidth=`${b}px`,t.minHeight=`${Math.round(b/d(this,w))}px`)}e.InkEditor=Z,h(Z,"_defaultColor",null),h(Z,"_defaultOpacity",1),h(Z,"_defaultThickness",1),h(Z,"_l10nPromise",void 0),h(Z,"_type","ink")},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.fitCurve=void 0;const n=i(151);e.fitCurve=n},t=>{function e(t,r,s,o,a){var c,u,l,f,d,v,p,b,w,g,m,A,y;if(2===t.length)return A=h.vectorLen(h.subtract(t[0],t[1]))/3,[c=[t[0],h.addArrays(t[0],h.mulItems(r,A)),h.addArrays(t[1],h.mulItems(s,A)),t[1]]];if(u=function(t){var e,i,n,r=[];return t.forEach(((t,s)=>{e=s?i+h.vectorLen(h.subtract(t,n)):0,r.push(e),i=e,n=t})),r=r.map((t=>t/i))}(t),[c,f,v]=i(t,u,u,r,s,a),0===f||f<o)return[c];if(f<o*o)for(l=u,d=f,p=v,y=0;y<20;y++){if(l=n(c,t,l),[c,f,v]=i(t,u,l,r,s,a),f<o)return[c];if(v===p){let t=f/d;if(t>.9999&&t<1.0001)break}d=f,p=v}return m=[],(b=h.subtract(t[v-1],t[v+1])).every((t=>0===t))&&(b=h.subtract(t[v-1],t[v]),[b[0],b[1]]=[-b[1],b[0]]),w=h.normalize(b),g=h.mulItems(w,-1),(m=m.concat(e(t.slice(0,v+1),r,w,o,a))).concat(e(t.slice(v),g,s,o,a))}function i(t,e,i,n,r,a){var u,l,f;return u=function(t,e,i,n){var r,s,o,a,u,l,f,d,v,p,b,w,g,m,A,y=t[0],k=t[t.length-1];for(r=[y,null,null,k],s=h.zeros_Xx2x2(e.length),b=0,w=e.length;b<w;b++)(o=s[b])[0]=h.mulItems(i,3*(m=e[b])*((A=1-m)*A)),o[1]=h.mulItems(n,3*A*(m*m));for(a=[[0,0],[0,0]],u=[0,0],b=0,w=t.length;b<w;b++)m=e[b],a[0][0]+=h.dot((o=s[b])[0],o[0]),a[0][1]+=h.dot(o[0],o[1]),a[1][0]+=h.dot(o[0],o[1]),a[1][1]+=h.dot(o[1],o[1]),g=h.subtract(t[b],c.q([y,y,k,k],m)),u[0]+=h.dot(o[0],g),u[1]+=h.dot(o[1],g);return f=0==(l=a[0][0]*a[1][1]-a[1][0]*a[0][1])?0:(u[0]*a[1][1]-u[1]*a[0][1])/l,d=0===l?0:(a[0][0]*u[1]-a[1][0]*u[0])/l,f<(v=1e-6*(p=h.vectorLen(h.subtract(y,k))))||d<v?(r[1]=h.addArrays(y,h.mulItems(i,p/3)),r[2]=h.addArrays(k,h.mulItems(n,p/3))):(r[1]=h.addArrays(y,h.mulItems(i,f)),r[2]=h.addArrays(k,h.mulItems(n,d))),r}(t,i,n,r),[l,f]=function(t,e,i){var n,r,a,u,l,f,d,v;r=0,a=Math.floor(t.length/2);const p=s(e,10);for(l=0,f=t.length;l<f;l++)d=t[l],v=o(0,i[l],p,10),(n=(u=h.subtract(c.q(e,v),d))[0]*u[0]+u[1]*u[1])>r&&(r=n,a=l);return[r,a]}(t,u,e),a&&a({bez:u,points:t,params:e,maxErr:l,maxPoint:f}),[u,l,f]}function n(t,e,i){return i.map(((i,n)=>r(t,e[n],i)))}function r(t,e,i){var n=h.subtract(c.q(t,i),e),r=c.qprime(t,i),s=h.mulMatrix(n,r),o=h.sum(h.squareItems(r))+2*h.mulMatrix(n,c.qprimeprime(t,i));return 0===o?i:i-s/o}var s=function(t,e){for(var i,n=[0],r=t[0],s=0,o=1;o<=e;o++)i=c.q(t,o/e),s+=h.vectorLen(h.subtract(i,r)),n.push(s),r=i;return n.map((t=>t/s))};function o(t,e,i,n){if(e<0)return 0;if(e>1)return 1;for(var r,s,o,a=1;a<=n;a++)if(e<=i[a]){o=(e-(r=i[a-1]))/(i[a]-r)*(a/n-(s=(a-1)/n))+s;break}return o}function a(t,e){return h.normalize(h.subtract(t,e))}class h{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,i,n)=>t+i*e[n]),0)}static subtract(t,e){return t.map(((t,i)=>t-e[i]))}static addArrays(t,e){return t.map(((t,i)=>t+e[i]))}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 h.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 c{static q(t,e){var i=1-e,n=h.mulItems(t[0],i*i*i),r=h.mulItems(t[1],3*i*i*e),s=h.mulItems(t[2],3*i*e*e),o=h.mulItems(t[3],e*e*e);return h.addArrays(h.addArrays(n,r),h.addArrays(s,o))}static qprime(t,e){var i=1-e,n=h.mulItems(h.subtract(t[1],t[0]),3*i*i),r=h.mulItems(h.subtract(t[2],t[1]),6*i*e),s=h.mulItems(h.subtract(t[3],t[2]),3*e*e);return h.addArrays(h.addArrays(n,r),s)}static qprimeprime(t,e){return h.addArrays(h.mulItems(h.addArrays(h.subtract(t[2],h.mulItems(t[1],2)),t[0]),6*(1-e)),h.mulItems(h.addArrays(h.subtract(t[3],h.mulItems(t[2],2)),t[1]),6*e))}}t.exports=function(t,i,n){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,i)=>0===i||!e.every(((e,n)=>e===t[i-1][n]))))).length<2)return[];const r=t.length,s=a(t[1],t[0]),o=a(t[r-2],t[r-1]);return e(t,s,o,i,n)},t.exports.fitCubic=e,t.exports.createTangent=a},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.AnnotationLayer=void 0;var n=i(1),r=i(133),s=i(130),o=i(153),a=i(154);function h(t,e,i){return function(t,e){if(t!==e)throw new TypeError("Private static access of wrong provenance")}(t,e),i}const c=1e3,u=new WeakSet;function l(t){return{width:t[2]-t[0],height:t[3]-t[1]}}class f{static create(t){switch(t.data.annotationType){case n.AnnotationType.LINK:return new v(t);case n.AnnotationType.TEXT:return new p(t);case n.AnnotationType.WIDGET:switch(t.data.fieldType){case"Tx":return new w(t);case"Btn":return t.data.radioButton?new m(t):t.data.checkBox?new g(t):new A(t);case"Ch":return new y(t)}return new b(t);case n.AnnotationType.POPUP:return new k(t);case n.AnnotationType.FREETEXT:return new E(t);case n.AnnotationType.LINE:return new S(t);case n.AnnotationType.SQUARE:return new x(t);case n.AnnotationType.CIRCLE:return new T(t);case n.AnnotationType.POLYLINE:return new _(t);case n.AnnotationType.CARET:return new C(t);case n.AnnotationType.INK:return new R(t);case n.AnnotationType.POLYGON:return new O(t);case n.AnnotationType.HIGHLIGHT:return new j(t);case n.AnnotationType.UNDERLINE:return new P(t);case n.AnnotationType.SQUIGGLY:return new D(t);case n.AnnotationType.STRIKEOUT:return new I(t);case n.AnnotationType.STAMP:return new F(t);case n.AnnotationType.FILEATTACHMENT:return new L(t);default:return new d(t)}}}class d{constructor(t){let{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:n=!1}=arguments.length>1&&void 0!==arguments[1]?arguments[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(i)),n&&(this.quadrilaterals=this._createQuadrilaterals(i))}_createContainer(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const e=this.data,i=this.page,r=this.viewport,s=document.createElement("section"),{width:o,height:a}=l(e.rect),[h,c,u,f]=r.viewBox,d=u-h,v=f-c;s.setAttribute("data-annotation-id",e.id);const p=n.Util.normalizeRect([e.rect[0],i.view[3]-e.rect[1]+i.view[1],e.rect[2],i.view[3]-e.rect[3]+i.view[1]]);if(!t&&e.borderStyle.width>0){s.style.borderWidth=`${e.borderStyle.width}px`;const t=e.borderStyle.horizontalCornerRadius,i=e.borderStyle.verticalCornerRadius;switch(t>0||i>0?s.style.borderRadius=`calc(${t}px * var(--scale-factor)) / calc(${i}px * var(--scale-factor))`:this instanceof m&&(s.style.borderRadius=`calc(${o}px * var(--scale-factor)) / calc(${a}px * var(--scale-factor))`),e.borderStyle.style){case n.AnnotationBorderStyleType.SOLID:s.style.borderStyle="solid";break;case n.AnnotationBorderStyleType.DASHED:s.style.borderStyle="dashed";break;case n.AnnotationBorderStyleType.BEVELED:(0,n.warn)("Unimplemented border style: beveled");break;case n.AnnotationBorderStyleType.INSET:(0,n.warn)("Unimplemented border style: inset");break;case n.AnnotationBorderStyleType.UNDERLINE:s.style.borderBottomStyle="solid"}const r=e.borderColor||null;r?s.style.borderColor=n.Util.makeHexColor(0|r[0],0|r[1],0|r[2]):s.style.borderWidth=0}s.style.left=100*(p[0]-h)/d+"%",s.style.top=100*(p[1]-c)/v+"%";const{rotation:b}=e;return e.hasOwnCanvas||0===b?(s.style.width=100*o/d+"%",s.style.height=100*a/v+"%"):this.setRotation(b,s),s}setRotation(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.container;const[i,n,r,s]=this.viewport.viewBox,o=r-i,a=s-n,{width:h,height:c}=l(this.data.rect);let u,f;t%180==0?(u=100*h/o,f=100*c/a):(u=100*c/o,f=100*h/a),e.style.width=`${u}%`,e.style.height=`${f}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(t,e,i)=>{const n=i.detail[t];i.target.style[e]=o.ColorConverters[`${n[0]}_HTML`](n.slice(1))};return(0,n.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 i=this._commonActions;for(const n of Object.keys(e.detail)){const r=t[n]||i[n];r&&r(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const i=this._commonActions;for(const[n,r]of Object.entries(e)){const s=i[n];s&&(s({detail:{[n]:r},target:t}),delete e[n])}}_createQuadrilaterals(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.data.quadPoints)return null;const e=[],i=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=i,e}_createPopup(t,e){let i=this.container;this.quadrilaterals&&(t=t||this.quadrilaterals,i=this.quadrilaterals[0]),t||((t=document.createElement("div")).className="popupTriggerArea",i.append(t));const n=new M({container:i,trigger:t,color:e.color,titleObj:e.titleObj,modificationDate:e.modificationDate,contentsObj:e.contentsObj,richText:e.richText,hideWrapper:!0}).render();n.style.left="100%",i.append(n)}_renderQuadrilaterals(t){for(const e of this.quadrilaterals)e.className=t;return this.quadrilaterals}render(){(0,n.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const i=[];if(this._fieldObjects){const r=this._fieldObjects[t];if(r)for(const{page:t,id:s,exportValues:o}of r){if(-1===t)continue;if(s===e)continue;const r="string"==typeof o?o:null,a=document.querySelector(`[data-element-id="${s}"]`);!a||u.has(a)?i.push({id:s,exportValue:r,domElement:a}):(0,n.warn)(`_getElementsByName - element not allowed: ${s}`)}return i}for(const n of document.getElementsByName(t)){const{id:t,exportValue:r}=n;t!==e&&u.has(n)&&i.push({id:t,exportValue:r,domElement:n})}return i}static get platform(){const t="undefined"!=typeof navigator?navigator.platform:"";return(0,n.shadow)(this,"platform",{isWin:t.includes("Win"),isMac:t.includes("Mac")})}}class v extends d{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;super(t,{isRenderable:!0,ignoreBorder:!(null==e||!e.ignoreBorder),createQuadrilaterals:!0}),this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:e}=this,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let n=!1;return t.url?(e.addLinkAttributes(i,t.url,t.newWindow),n=!0):t.action?(this._bindNamedAction(i,t.action),n=!0):t.dest?(this._bindLink(i,t.dest),n=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),n=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(i,""),n=!0)),this.quadrilaterals?this._renderQuadrilaterals("linkAnnotation").map(((t,e)=>{const n=0===e?i:i.cloneNode();return t.append(n),t})):(this.container.className="linkAnnotation",n&&this.container.append(i),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 i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(e.actions)){const r=i.get(n);r&&(t[r]=()=>{var t;return null===(t=this.linkService.eventBus)||void 0===t||t.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:n}}),!1})}t.onclick||(t.onclick=()=>!1),t.className="internalLink"}_bindResetFormAction(t,e){const i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),t.className="internalLink",!this._fieldObjects)return(0,n.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),void(i||(t.onclick=()=>!1));t.onclick=()=>{i&&i();const{fields:t,refs:r,include:s}=e,o=[];if(0!==t.length||0!==r.length){const e=new Set(r);for(const i of t){const t=this._fieldObjects[i]||[];for(const{id:i}of t)e.add(i)}for(const t of Object.values(this._fieldObjects))for(const i of t)e.has(i.id)===s&&o.push(i)}else for(const t of Object.values(this._fieldObjects))o.push(...t);const a=this.annotationStorage,h=[];for(const t of o){const{id:e}=t;switch(h.push(e),t.type){case"text":case"combobox":case"listbox":a.setValue(e,{value:t.defaultValue||""});break;case"checkbox":case"radiobutton":a.setValue(e,{value:t.defaultValue===t.exportValues});break;default:continue}const i=document.querySelector(`[data-element-id="${e}"]`);i&&(u.has(i)?i.dispatchEvent(new Event("resetform")):(0,n.warn)(`_bindResetFormAction - element not allowed: ${e}`))}var c;return this.enableScripting&&(null===(c=this.linkService.eventBus)||void 0===c||c.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:h,name:"ResetForm"}})),!1}}}class p extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.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 b extends d{render(){return this.data.alternativeText&&(this.container.title=this.data.alternativeText),this.container}_getKeyModifier(t){const{isWin:e,isMac:i}=d.platform;return e&&t.ctrlKey||i&&t.metaKey}_setEventListener(t,e,i,n){e.includes("mouse")?t.addEventListener(e,(t=>{var e;null===(e=this.linkService.eventBus)||void 0===e||e.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(t),shift:t.shiftKey,modifier:this._getKeyModifier(t)}})})):t.addEventListener(e,(t=>{var e;null===(e=this.linkService.eventBus)||void 0===e||e.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:i,value:n(t)}})}))}_setEventListeners(t,e,i){for(const[r,s]of e){var n;("Action"===s||null!==(n=this.data.actions)&&void 0!==n&&n[s])&&this._setEventListener(t,r,s,i)}}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=null===e?"transparent":n.Util.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const{fontColor:e}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||9,r=t.style;let s;if(this.data.multiLine){const t=Math.abs(this.data.rect[3]-this.data.rect[1]),e=Math.round(t/(n.LINE_FACTOR*i))||1;s=Math.min(i,Math.round(t/e/n.LINE_FACTOR))}else{const t=Math.abs(this.data.rect[3]-this.data.rect[1]);s=Math.min(i,Math.round(t/n.LINE_FACTOR))}r.fontSize=`calc(${s}px * var(--scale-factor))`,r.color=n.Util.makeHexColor(e[0],e[1],e[2]),null!==this.data.textAlignment&&(r.textAlign=["left","center","right"][this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class w extends b{constructor(t){super(t,{isRenderable:t.renderForms||!t.data.hasAppearance&&!!t.data.fieldValue})}setPropertyOnSiblings(t,e,i,n){const r=this.annotationStorage;for(const s of this._getElementsByName(t.name,t.id))s.domElement&&(s.domElement[e]=i),r.setValue(s.id,{[n]:i})}render(){const t=this.annotationStorage,e=this.data.id;this.container.className="textWidgetAnnotation";let i=null;if(this.renderForms){const r=t.getValue(e,{value:this.data.fieldValue});let s=r.formattedValue||r.value||"";const o=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;o&&s.length>o&&(s=s.slice(0,o));const a={userValue:s,formattedValue:null,valueOnFocus:""};this.data.multiLine?(i=document.createElement("textarea"),i.textContent=s,this.data.doNotScroll&&(i.style.overflowY="hidden")):(i=document.createElement("input"),i.type="text",i.setAttribute("value",s),this.data.doNotScroll&&(i.style.overflowX="hidden")),u.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=c,this._setRequired(i,this.data.required),o&&(i.maxLength=o),i.addEventListener("input",(n=>{t.setValue(e,{value:n.target.value}),this.setPropertyOnSiblings(i,"value",n.target.value,"value")})),i.addEventListener("resetform",(()=>{var t;const e=null!==(t=this.data.defaultFieldValue)&&void 0!==t?t:"";i.value=a.userValue=e,a.formattedValue=null}));let h=t=>{const{formattedValue:e}=a;null!=e&&(t.target.value=e),t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){var n;i.addEventListener("focus",(t=>{a.userValue&&(t.target.value=a.userValue),a.valueOnFocus=t.target.value})),i.addEventListener("updatefromsandbox",(i=>{this._dispatchEventFromSandbox({value(i){var n;a.userValue=null!==(n=i.detail.value)&&void 0!==n?n:"",t.setValue(e,{value:a.userValue.toString()}),i.target.value=a.userValue},formattedValue(i){const{formattedValue:n}=i.detail;a.formattedValue=n,null!=n&&i.target!==document.activeElement&&(i.target.value=n),t.setValue(e,{formattedValue:n})},selRange(t){t.target.setSelectionRange(...t.detail.selRange)},charLimit:i=>{var n;const{charLimit:r}=i.detail,{target:s}=i;if(0===r)return void s.removeAttribute("maxLength");s.setAttribute("maxLength",r);let o=a.userValue;!o||o.length<=r||(o=o.slice(0,r),s.value=a.userValue=o,t.setValue(e,{value:o}),null===(n=this.linkService.eventBus)||void 0===n||n.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:o,willCommit:!0,commitKey:1,selStart:s.selectionStart,selEnd:s.selectionEnd}}))}},i)})),i.addEventListener("keydown",(t=>{var i;let n=-1;if("Escape"===t.key?n=0:"Enter"===t.key?n=2:"Tab"===t.key&&(n=3),-1===n)return;const{value:r}=t.target;a.valueOnFocus!==r&&(a.userValue=r,null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:r,willCommit:!0,commitKey:n,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}))}));const r=h;h=null,i.addEventListener("blur",(t=>{const{value:i}=t.target;var n;a.userValue=i,this._mouseState.isDown&&a.valueOnFocus!==i&&(null===(n=this.linkService.eventBus)||void 0===n||n.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:i,willCommit:!0,commitKey:1,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}})),r(t)})),null!==(n=this.data.actions)&&void 0!==n&&n.Keystroke&&i.addEventListener("beforeinput",(t=>{var i;const{data:n,target:r}=t,{value:s,selectionStart:o,selectionEnd:a}=r;let h=o,c=a;switch(t.inputType){case"deleteWordBackward":{const t=s.substring(0,o).match(/\w*[^\w]*$/);t&&(h-=t[0].length);break}case"deleteWordForward":{const t=s.substring(o).match(/^[^\w]*\w*/);t&&(c+=t[0].length);break}case"deleteContentBackward":o===a&&(h-=1);break;case"deleteContentForward":o===a&&(c+=1)}t.preventDefault(),null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:s,change:n||"",willCommit:!1,selStart:h,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(h&&i.addEventListener("blur",h),this.data.comb){const t=(this.data.rect[2]-this.data.rect[0])/o;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 g extends b{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,i=e.id;let n=t.getValue(i,{value:e.exportValue===e.fieldValue}).value;"string"==typeof n&&(n="Off"!==n,t.setValue(i,{value:n})),this.container.className="buttonWidgetAnnotation checkBox";const r=document.createElement("input");return u.add(r),r.setAttribute("data-element-id",i),r.disabled=e.readOnly,this._setRequired(r,this.data.required),r.type="checkbox",r.name=e.fieldName,n&&r.setAttribute("checked",!0),r.setAttribute("exportValue",e.exportValue),r.tabIndex=c,r.addEventListener("change",(n=>{const{name:r,checked:s}=n.target;for(const n of this._getElementsByName(r,i)){const i=s&&n.exportValue===e.exportValue;n.domElement&&(n.domElement.checked=i),t.setValue(n.id,{value:i})}t.setValue(i,{value:s})})),r.addEventListener("resetform",(t=>{t.target.checked=(e.defaultFieldValue||"Off")===e.exportValue})),this.enableScripting&&this.hasJSActions&&(r.addEventListener("updatefromsandbox",(e=>{this._dispatchEventFromSandbox({value(e){e.target.checked="Off"!==e.detail.value,t.setValue(i,{value:e.target.checked})}},e)})),this._setEventListeners(r,[["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(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class m extends b{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.className="buttonWidgetAnnotation radioButton";const t=this.annotationStorage,e=this.data,i=e.id;let n=t.getValue(i,{value:e.fieldValue===e.buttonValue}).value;"string"==typeof n&&(n=n!==e.buttonValue,t.setValue(i,{value:n}));const r=document.createElement("input");if(u.add(r),r.setAttribute("data-element-id",i),r.disabled=e.readOnly,this._setRequired(r,this.data.required),r.type="radio",r.name=e.fieldName,n&&r.setAttribute("checked",!0),r.tabIndex=c,r.addEventListener("change",(e=>{const{name:n,checked:r}=e.target;for(const e of this._getElementsByName(n,i))t.setValue(e.id,{value:!1});t.setValue(i,{value:r})})),r.addEventListener("resetform",(t=>{const i=e.defaultFieldValue;t.target.checked=null!=i&&i===e.buttonValue})),this.enableScripting&&this.hasJSActions){const n=e.buttonValue;r.addEventListener("updatefromsandbox",(e=>{this._dispatchEventFromSandbox({value:e=>{const r=n===e.detail.value;for(const n of this._getElementsByName(e.target.name)){const e=r&&n.id===i;n.domElement&&(n.domElement.checked=e),t.setValue(n.id,{value:e})}}},e)})),this._setEventListeners(r,[["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(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class A extends v{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 y extends b{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.className="choiceWidgetAnnotation";const t=this.annotationStorage,e=this.data.id,i=t.getValue(e,{value:this.data.fieldValue}),n=document.createElement("select");u.add(n),n.setAttribute("data-element-id",e),n.disabled=this.data.readOnly,this._setRequired(n,this.data.required),n.name=this.data.fieldName,n.tabIndex=c;let r=this.data.combo&&this.data.options.length>0;this.data.combo||(n.size=this.data.options.length,this.data.multiSelect&&(n.multiple=!0)),n.addEventListener("resetform",(()=>{const t=this.data.defaultFieldValue;for(const e of n.options)e.selected=e.value===t}));for(const t of this.data.options){const e=document.createElement("option");e.textContent=t.displayValue,e.value=t.exportValue,i.value.includes(t.exportValue)&&(e.setAttribute("selected",!0),r=!1),n.append(e)}let s=null;if(r){const t=document.createElement("option");t.value=" ",t.setAttribute("hidden",!0),t.setAttribute("selected",!0),n.prepend(t),s=()=>{t.remove(),n.removeEventListener("input",s),s=null},n.addEventListener("input",s)}const o=(t,e)=>{const i=e?"value":"textContent",n=t.target.options;return t.target.multiple?Array.prototype.filter.call(n,(t=>t.selected)).map((t=>t[i])):-1===n.selectedIndex?null:n[n.selectedIndex][i]},a=t=>Array.prototype.map.call(t.target.options,(t=>({displayValue:t.textContent,exportValue:t.value})));return this.enableScripting&&this.hasJSActions?(n.addEventListener("updatefromsandbox",(i=>{this._dispatchEventFromSandbox({value(i){var r;null===(r=s)||void 0===r||r();const a=i.detail.value,h=new Set(Array.isArray(a)?a:[a]);for(const t of n.options)t.selected=h.has(t.value);t.setValue(e,{value:o(i,!0)})},multipleSelection(t){n.multiple=!0},remove(i){const r=n.options,s=i.detail.remove;r[s].selected=!1,n.remove(s),r.length>0&&-1===Array.prototype.findIndex.call(r,(t=>t.selected))&&(r[0].selected=!0),t.setValue(e,{value:o(i,!0),items:a(i)})},clear(i){for(;0!==n.length;)n.remove(0);t.setValue(e,{value:null,items:[]})},insert(i){const{index:r,displayValue:s,exportValue:h}=i.detail.insert,c=n.children[r],u=document.createElement("option");u.textContent=s,u.value=h,c?c.before(u):n.append(u),t.setValue(e,{value:o(i,!0),items:a(i)})},items(i){const{items:r}=i.detail;for(;0!==n.length;)n.remove(0);for(const t of r){const{displayValue:e,exportValue:i}=t,r=document.createElement("option");r.textContent=e,r.value=i,n.append(r)}n.options.length>0&&(n.options[0].selected=!0),t.setValue(e,{value:o(i,!0),items:a(i)})},indices(i){const n=new Set(i.detail.indices);for(const t of i.target.options)t.selected=n.has(t.index);t.setValue(e,{value:o(i,!0)})},editable(t){t.target.disabled=!t.detail.editable}},i)})),n.addEventListener("input",(i=>{var n;const r=o(i,!0),s=o(i,!1);t.setValue(e,{value:r}),null===(n=this.linkService.eventBus)||void 0===n||n.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:s,changeEx:r,willCommit:!0,commitKey:1,keyDown:!1}})})),this._setEventListeners(n,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"]],(t=>t.target.checked))):n.addEventListener("input",(function(i){t.setValue(e,{value:o(i,!0)})})),this.data.combo&&this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class k extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.str)})}render(){if(this.container.className="popupAnnotation",["Line","Square","Circle","PolyLine","Polygon","Ink"].includes(this.data.parentType))return this.container;const t=this.layer.querySelectorAll(`[data-annotation-id="${this.data.parentId}"]`);if(0===t.length)return this.container;const e=new M({container:this.container,trigger:Array.from(t),color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText}),i=this.page,r=n.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]]),s=r[0]+this.data.parentRect[2]-this.data.parentRect[0],o=r[1],[a,h,c,u]=this.viewport.viewBox,l=u-h;return this.container.style.left=100*(s-a)/(c-a)+"%",this.container.style.top=100*(o-h)/l+"%",this.container.append(e.render()),this.container}}class M{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 i=document.createElement("div");i.className="popupWrapper",this.hideElement=this.hideWrapper?i:this.container,this.hideElement.hidden=!0;const s=document.createElement("div");s.className="popup";const o=this.color;o&&(s.style.backgroundColor=n.Util.makeHexColor(0|.7*(255-o[0])+o[0],0|.7*(255-o[1])+o[1],0|.7*(255-o[2])+o[2]));const h=document.createElement("h1");h.dir=this.titleObj.dir,h.textContent=this.titleObj.str,s.append(h);const c=r.PDFDateString.toDateObject(this.modificationDate);if(c){const t=document.createElement("span");t.className="popupDate",t.textContent="{{date}}, {{time}}",t.dataset.l10nId="annotation_date_string",t.dataset.l10nArgs=JSON.stringify({date:c.toLocaleDateString(),time:c.toLocaleTimeString()}),s.append(t)}if(null===(t=this.richText)||void 0===t||!t.str||null!==(e=this.contentsObj)&&void 0!==e&&e.str&&this.contentsObj.str!==this.richText.str){const t=this._formatContents(this.contentsObj);s.append(t)}else a.XfaLayer.render({xfaHtml:this.richText.html,intent:"richText",div:s}),s.lastChild.className="richText popupContent";Array.isArray(this.trigger)||(this.trigger=[this.trigger]);for(const t of this.trigger)t.addEventListener("click",this._toggle.bind(this)),t.addEventListener("mouseover",this._show.bind(this,!1)),t.addEventListener("mouseout",this._hide.bind(this,!1));return s.addEventListener("click",this._hide.bind(this,!0)),i.append(s),i}_formatContents(t){let{str:e,dir:i}=t;const n=document.createElement("p");n.className="popupContent",n.dir=i;const r=e.split(/(?:\r\n?|\n)/);for(let t=0,e=r.length;t<e;++t)n.append(document.createTextNode(r[t])),t<e-1&&n.append(document.createElement("br"));return n}_toggle(){this.pinned?this._hide(!0):this._show(!0)}_show(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this.pinned=!0),this.hideElement.hidden&&(this.hideElement.hidden=!1,this.container.style.zIndex=parseInt(this.container.style.zIndex)+1e3)}_hide(){(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&(this.pinned=!1),this.hideElement.hidden||this.pinned||(this.hideElement.hidden=!0,this.container.style.zIndex=parseInt(this.container.style.zIndex)-1e3)}}class E extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.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 i=document.createElement("span");i.textContent=e,t.append(i)}this.container.append(t)}return this.data.hasPopup||this._createPopup(null,this.data),this.container}}class S extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0})}render(){this.container.className="lineAnnotation";const t=this.data,{width:e,height:i}=l(t.rect),n=this.svgFactory.create(e,i,!0),r=this.svgFactory.createElement("svg:line");return r.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),r.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),r.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),r.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),r.setAttribute("stroke-width",t.borderStyle.width||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),this._createPopup(r,t),this.container}}class x extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0})}render(){this.container.className="squareAnnotation";const t=this.data,{width:e,height:i}=l(t.rect),n=this.svgFactory.create(e,i,!0),r=t.borderStyle.width,s=this.svgFactory.createElement("svg:rect");return s.setAttribute("x",r/2),s.setAttribute("y",r/2),s.setAttribute("width",e-r),s.setAttribute("height",i-r),s.setAttribute("stroke-width",r||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),n.append(s),this.container.append(n),this._createPopup(s,t),this.container}}class T extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0})}render(){this.container.className="circleAnnotation";const t=this.data,{width:e,height:i}=l(t.rect),n=this.svgFactory.create(e,i,!0),r=t.borderStyle.width,s=this.svgFactory.createElement("svg:ellipse");return s.setAttribute("cx",e/2),s.setAttribute("cy",i/2),s.setAttribute("rx",e/2-r/2),s.setAttribute("ry",i/2-r/2),s.setAttribute("stroke-width",r||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),n.append(s),this.container.append(n),this._createPopup(s,t),this.container}}class _ extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.className=this.containerClassName;const t=this.data,{width:e,height:i}=l(t.rect),n=this.svgFactory.create(e,i,!0);let r=[];for(const e of t.vertices)r.push(e.x-t.rect[0]+","+(t.rect[3]-e.y));r=r.join(" ");const s=this.svgFactory.createElement(this.svgElementName);return s.setAttribute("points",r),s.setAttribute("stroke-width",t.borderStyle.width||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),n.append(s),this.container.append(n),this._createPopup(s,t),this.container}}class O extends _{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class C extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0})}render(){return this.container.className="caretAnnotation",this.data.hasPopup||this._createPopup(null,this.data),this.container}}class R extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline"}render(){this.container.className=this.containerClassName;const t=this.data,{width:e,height:i}=l(t.rect),n=this.svgFactory.create(e,i,!0);for(const e of t.inkLists){let i=[];for(const n of e)i.push(`${n.x-t.rect[0]},${t.rect[3]-n.y}`);i=i.join(" ");const r=this.svgFactory.createElement(this.svgElementName);r.setAttribute("points",i),r.setAttribute("stroke-width",t.borderStyle.width||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),this._createPopup(r,t),n.append(r)}return this.container.append(n),this.container}}class j extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.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 P extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.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 D extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.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 I extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.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 F extends d{constructor(t){var e,i,n;super(t,{isRenderable:!!(t.data.hasPopup||null!==(e=t.data.titleObj)&&void 0!==e&&e.str||null!==(i=t.data.contentsObj)&&void 0!==i&&i.str||null!==(n=t.data.richText)&&void 0!==n&&n.str),ignoreBorder:!0})}render(){return this.container.className="stampAnnotation",this.data.hasPopup||this._createPopup(null,this.data),this.container}}class L extends d{constructor(t){var e;super(t,{isRenderable:!0});const{filename:i,content:n}=this.data.file;this.filename=(0,r.getFilenameFromUrl)(i),this.content=n,null===(e=this.linkService.eventBus)||void 0===e||e.dispatch("fileattachmentannotation",{source:this,filename:i,content:n})}render(){var t,e;this.container.className="fileAttachmentAnnotation";const i=document.createElement("div");return i.className="popupTriggerArea",i.addEventListener("dblclick",this._download.bind(this)),!this.data.hasPopup&&(null!==(t=this.data.titleObj)&&void 0!==t&&t.str||null!==(e=this.data.contentsObj)&&void 0!==e&&e.str||this.data.richText)&&this._createPopup(i,this.data),this.container.append(i),this.container}_download(){var t;null===(t=this.downloadManager)||void 0===t||t.openOrDownloadData(this.container,this.content,this.filename)}}class W{static render(t){const{annotations:e,div:i,viewport:o,accessibilityManager:a}=t;h(this,W,B).call(this,i,o);let c=0;for(const u of e){if(u.annotationType!==n.AnnotationType.POPUP){const{width:t,height:e}=l(u.rect);if(t<=0||e<=0)continue}const e=f.create({data:u,layer:i,page:t.page,viewport:o,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new r.DOMSVGFactory,annotationStorage:t.annotationStorage||new s.AnnotationStorage,enableScripting:t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,mouseState:t.mouseState||{isDown:!1}});if(e.isRenderable){const t=e.render();if(u.hidden&&(t.style.visibility="hidden"),Array.isArray(t))for(const e of t)e.style.zIndex=c++,h(W,W,N).call(W,e,u.id,i,a);else t.style.zIndex=c++,e instanceof k?i.prepend(t):h(W,W,N).call(W,t,u.id,i,a)}}h(this,W,$).call(this,i,t.annotationCanvasMap)}static update(t){const{annotationCanvasMap:e,div:i,viewport:n}=t;h(this,W,B).call(this,i,n),h(this,W,$).call(this,i,e),i.hidden=!1}}function N(t,e,i,n){const s=t.firstChild||t;s.id=`${r.AnnotationPrefix}${e}`,i.append(t),null==n||n.moveElementInDOM(i,t,s,!1)}function B(t,e){let{width:i,height:n,rotation:r}=e;const{style:s}=t,o=r%180!=0,a=Math.floor(i)+"px",h=Math.floor(n)+"px";s.width=o?h:a,s.height=o?a:h,t.setAttribute("data-main-rotation",r)}function $(t,e){if(e){for(const[i,n]of e){const e=t.querySelector(`[data-annotation-id="${i}"]`);if(!e)continue;const{firstChild:r}=e;r?"CANVAS"===r.nodeName?r.replaceWith(n):r.before(n):e.append(n)}e.clear()}}e.AnnotationLayer=W},(t,e)=>{function i(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){let[e,i,n,r]=t;return["G",1-Math.min(1,.3*e+.59*n+.11*i+r)]}static G_CMYK(t){let[e]=t;return["CMYK",0,0,0,1-e]}static G_RGB(t){let[e]=t;return["RGB",e,e,e]}static G_HTML(t){let[e]=t;const n=i(e);return`#${n}${n}${n}`}static RGB_G(t){let[e,i,n]=t;return["G",.3*e+.59*i+.11*n]}static RGB_HTML(t){let[e,n,r]=t;return`#${i(e)}${i(n)}${i(r)}`}static T_HTML(){return"#00000000"}static CMYK_RGB(t){let[e,i,n,r]=t;return["RGB",1-Math.min(1,e+r),1-Math.min(1,n+r),1-Math.min(1,i+r)]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK(t){let[e,i,n]=t;const r=1-e,s=1-i,o=1-n;return["CMYK",r,s,o,Math.min(r,s,o)]}}},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.XfaLayer=void 0;var n=i(145);e.XfaLayer=class{static setupStorage(t,e,i,n,r){const s=n.getValue(e,{value:null});switch(i.name){case"textarea":if(null!==s.value&&(t.textContent=s.value),"print"===r)break;t.addEventListener("input",(t=>{n.setValue(e,{value:t.target.value})}));break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){if(s.value===i.attributes.xfaOn?t.setAttribute("checked",!0):s.value===i.attributes.xfaOff&&t.removeAttribute("checked"),"print"===r)break;t.addEventListener("change",(t=>{n.setValue(e,{value:t.target.getAttribute(t.target.checked?"xfaOn":"xfaOff")})}))}else{if(null!==s.value&&t.setAttribute("value",s.value),"print"===r)break;t.addEventListener("input",(t=>{n.setValue(e,{value:t.target.value})}))}break;case"select":if(null!==s.value)for(const t of i.children)t.attributes.value===s.value&&(t.attributes.selected=!0);t.addEventListener("input",(t=>{const i=t.target.options;n.setValue(e,{value:-1===i.selectedIndex?"":i[i.selectedIndex].value})}))}}static setAttributes(t){let{html:e,element:i,storage:n=null,intent:r,linkService:s}=t;const{attributes:o}=i,a=e instanceof HTMLAnchorElement;"radio"===o.type&&(o.name=`${o.name}-${r}`);for(const[t,i]of Object.entries(o))if(null!=i)switch(t){case"class":i.length&&e.setAttribute(t,i.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",i);break;case"style":Object.assign(e.style,i);break;case"textContent":e.textContent=i;break;default:(!a||"href"!==t&&"newWindow"!==t)&&e.setAttribute(t,i)}a&&s.addLinkAttributes(e,o.href,o.newWindow),n&&o.dataId&&this.setupStorage(e,o.dataId,i,n)}static render(t){const e=t.annotationStorage,i=t.linkService,r=t.xfaHtml,s=t.intent||"display",o=document.createElement(r.name);r.attributes&&this.setAttributes({html:o,element:r,intent:s,linkService:i});const a=[[r,-1,o]],h=t.div;if(h.append(o),t.viewport){const e=`matrix(${t.viewport.transform.join(",")})`;h.style.transform=e}"richText"!==s&&h.setAttribute("class","xfaLayer xfaFont");const c=[];for(;a.length>0;){var u;const[t,r,o]=a.at(-1);if(r+1===t.children.length){a.pop();continue}const h=t.children[++a.at(-1)[1]];if(null===h)continue;const{name:l}=h;if("#text"===l){const t=document.createTextNode(h.value);c.push(t),o.append(t);continue}let f;if(f=null!=h&&null!==(u=h.attributes)&&void 0!==u&&u.xmlns?document.createElementNS(h.attributes.xmlns,l):document.createElement(l),o.append(f),h.attributes&&this.setAttributes({html:f,element:h,storage:e,intent:s,linkService:i}),h.children&&h.children.length>0)a.push([h,-1,f]);else if(h.value){const t=document.createTextNode(h.value);n.XfaText.shouldBuildText(l)&&c.push(t),f.append(t)}}for(const t of h.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))t.setAttribute("readOnly",!0);return{textDivs:c}}static update(t){const e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}}},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TextLayerRenderTask=void 0,e.renderTextLayer=function(t){const e=new f({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 n=i(1),r=i(133);const s=30,o=new Map,a=/^\s+$/g;function h(t,e,i,r){const h=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(h);const u=n.Util.transform(t._viewport.transform,e.transform);let l=Math.atan2(u[1],u[0]);const f=i[e.fontName];f.vertical&&(l+=Math.PI/2);const d=Math.hypot(u[2],u[3]),v=d*function(t,e){const i=o.get(t);if(i)return i;e.save(),e.font=`30px ${t}`;const n=e.measureText("");let r=n.fontBoundingBoxAscent,a=Math.abs(n.fontBoundingBoxDescent);if(r){e.restore();const i=r/(r+a);return o.set(t,i),i}e.strokeStyle="red",e.clearRect(0,0,s,s),e.strokeText("g",0,0);let h=e.getImageData(0,0,s,s).data;a=0;for(let t=h.length-1-3;t>=0;t-=4)if(h[t]>0){a=Math.ceil(t/4/s);break}e.clearRect(0,0,s,s),e.strokeText("A",0,s),h=e.getImageData(0,0,s,s).data,r=0;for(let t=0,e=h.length;t<e;t+=4)if(h[t]>0){r=s-Math.floor(t/4/s);break}if(e.restore(),r){const e=r/(r+a);return o.set(t,e),e}return o.set(t,.8),.8}(f.fontFamily,r);let p,b;0===l?(p=u[4],b=u[5]-v):(p=u[4]+v*Math.sin(l),b=u[5]-v*Math.cos(l)),h.style.left=`${p}px`,h.style.top=`${b}px`,h.style.fontSize=`${d}px`,h.style.fontFamily=f.fontFamily,c.fontSize=d,h.setAttribute("role","presentation"),h.textContent=e.str,h.dir=e.dir,t._fontInspectorEnabled&&(h.dataset.fontName=e.fontName),0!==l&&(c.angle=l*(180/Math.PI));let w=!1;if(e.str.length>1||t._enhanceTextSelection&&a.test(e.str))w=!0;else if(" "!==e.str&&e.transform[0]!==e.transform[3]){const t=Math.abs(e.transform[0]),i=Math.abs(e.transform[3]);t!==i&&Math.max(t,i)/Math.min(t,i)>1.5&&(w=!0)}if(w&&(c.canvasWidth=f.vertical?e.height*t._viewport.scale:e.width*t._viewport.scale),t._textDivProperties.set(h,c),t._textContentStream&&t._layoutText(h),t._enhanceTextSelection&&c.hasText){let i=1,r=0;0!==l&&(i=Math.cos(l),r=Math.sin(l));const s=(f.vertical?e.height:e.width)*t._viewport.scale,o=d;let a,c;0!==l?(a=[i,r,-r,i,p,b],c=n.Util.getAxialAlignedBoundingBox([0,0,s,o],a)):c=[p,b,p+s,b+o],t._bounds.push({left:c[0],top:c[1],right:c[2],bottom:c[3],div:h,size:[s,o],m:a})}}function c(t){if(t._canceled)return;const e=t._textDivs,i=t._capability,n=e.length;if(n>1e5)return t._renderingDone=!0,void i.resolve();if(!t._textContentStream)for(let i=0;i<n;i++)t._layoutText(e[i]);t._renderingDone=!0,i.resolve()}function u(t,e,i){let n=0;for(let r=0;r<i;r++){const i=t[e++];i>0&&(n=n?Math.min(i,n):i)}return n}function l(t,e){e.sort((function(t,e){return t.x1-e.x1||t.index-e.index}));const i=[{start:-1/0,end:1/0,boundary:{x1:-1/0,y1:-1/0,x2:0,y2:1/0,index:-1,x1New:0,x2New:0}}];for(const t of e){let e=0;for(;e<i.length&&i[e].end<=t.y1;)e++;let n,r,s=i.length-1;for(;s>=0&&i[s].start>=t.y2;)s--;let o,a,h=-1/0;for(o=e;o<=s;o++){let e;n=i[o],r=n.boundary,e=r.x2>t.x1?r.index>t.index?r.x1New:t.x1:void 0===r.x2New?(r.x2+t.x1)/2:r.x2New,e>h&&(h=e)}for(t.x1New=h,o=e;o<=s;o++)n=i[o],r=n.boundary,void 0===r.x2New?r.x2>t.x1?r.index>t.index&&(r.x2New=r.x2):r.x2New=h:r.x2New>h&&(r.x2New=Math.max(h,r.x2));const c=[];let u=null;for(o=e;o<=s;o++){n=i[o],r=n.boundary;const e=r.x2>t.x2?r:t;u===e?c.at(-1).end=n.end:(c.push({start:n.start,end:n.end,boundary:e}),u=e)}for(i[e].start<t.y1&&(c[0].start=t.y1,c.unshift({start:i[e].start,end:t.y1,boundary:i[e].boundary})),t.y2<i[s].end&&(c.at(-1).end=t.y2,c.push({start:t.y2,end:i[s].end,boundary:i[s].boundary})),o=e;o<=s;o++){if(n=i[o],r=n.boundary,void 0!==r.x2New)continue;let t=!1;for(a=e-1;!t&&a>=0&&i[a].start>=r.y1;a--)t=i[a].boundary===r;for(a=s+1;!t&&a<i.length&&i[a].end<=r.y2;a++)t=i[a].boundary===r;for(a=0;!t&&a<c.length;a++)t=c[a].boundary===r;t||(r.x2New=h)}Array.prototype.splice.apply(i,[e,s-e+1,...c])}for(const e of i){const i=e.boundary;void 0===i.x2New&&(i.x2New=Math.max(t,i.x2))}}class f{constructor(t){var e;let{textContent:i,textContentStream:s,container:o,viewport:a,textDivs:h,textContentItemsStr:c,enhanceTextSelection:u}=t;u&&(0,r.deprecated)("The `enhanceTextSelection` functionality will be removed in the future."),this._textContent=i,this._textContentStream=s,this._container=o,this._document=o.ownerDocument,this._viewport=a,this._textDivs=h||[],this._textContentItemsStr=c||[],this._enhanceTextSelection=!!u,this._fontInspectorEnabled=!(null===(e=globalThis.FontInspector)||void 0===e||!e.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,n.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 n.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 i=0,n=t.length;i<n;i++)if(void 0!==t[i].str)this._textContentItemsStr.push(t[i].str),h(this,t[i],e,this._layoutTextCtx);else if("beginMarkedContentProps"===t[i].type||"beginMarkedContent"===t[i].type){const e=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),null!==t[i].id&&this._container.setAttribute("id",`${t[i].id}`),e.append(this._container)}else"endMarkedContent"===t[i].type&&(this._container=this._container.parentNode)}_layoutText(t){const e=this._textDivProperties.get(t);let i="";if(0!==e.canvasWidth&&e.hasText){const{fontFamily:n}=t.style,{fontSize:r}=e;r===this._layoutTextLastFontSize&&n===this._layoutTextLastFontFamily||(this._layoutTextCtx.font=`${r*this._devicePixelRatio}px ${n}`,this._layoutTextLastFontSize=r,this._layoutTextLastFontFamily=n);const{width:s}=this._layoutTextCtx.measureText(t.textContent);if(s>0){const t=this._devicePixelRatio*e.canvasWidth/s;this._enhanceTextSelection&&(e.scale=t),i=`scaleX(${t})`}}if(0!==e.angle&&(i=`rotate(${e.angle}deg) ${i}`),i.length>0&&(this._enhanceTextSelection&&(e.originalTransform=i),t.style.transform=i),e.hasText&&this._container.append(t),e.hasEOL){const t=document.createElement("br");t.setAttribute("role","presentation"),this._container.append(t)}}_render(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;const e=(0,n.createPromiseCapability)();let i=Object.create(null);const r=this._document.createElement("canvas");if(r.height=r.width=s,this._layoutTextCtx=r.getContext("2d",{alpha:!1}),this._textContent)this._processItems(this._textContent.items,this._textContent.styles),e.resolve();else{if(!this._textContentStream)throw new Error('Neither "textContent" nor "textContentStream" parameters specified.');{const t=()=>{this._reader.read().then((n=>{let{value:r,done:s}=n;s?e.resolve():(Object.assign(i,r.styles),this._processItems(r.items,i),t())}),e.reject)};this._reader=this._textContentStream.getReader(),t()}}e.promise.then((()=>{i=null,t?this._renderTimer=setTimeout((()=>{c(this),this._renderTimer=null}),t):c(this)}),this._capability.reject)}expandTextDivs(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this._enhanceTextSelection||!this._renderingDone)return;null!==this._bounds&&(function(t){const e=t._bounds,i=t._viewport,r=function(t,e,i){const n=i.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}}));l(t,n);const r=new Array(i.length);for(const t of n)r[t.index]={left:t.x1New,top:0,right:t.x2New,bottom:0};i.map((function(e,i){const s=r[i],o=n[i];o.x1=e.top,o.y1=t-s.right,o.x2=e.bottom,o.y2=t-s.left,o.index=i,o.x1New=void 0,o.x2New=void 0})),l(e,n);for(const t of n){const e=t.index;r[e].top=t.x1New,r[e].bottom=t.x2New}return r}(i.width,i.height,e);for(let i=0;i<r.length;i++){const s=e[i].div,o=t._textDivProperties.get(s);if(0===o.angle){o.paddingLeft=e[i].left-r[i].left,o.paddingTop=e[i].top-r[i].top,o.paddingRight=r[i].right-e[i].right,o.paddingBottom=r[i].bottom-e[i].bottom,t._textDivProperties.set(s,o);continue}const a=r[i],h=e[i],c=h.m,l=c[0],f=c[1],d=[[0,0],[0,h.size[1]],[h.size[0],0],h.size],v=new Float64Array(64);for(let t=0,e=d.length;t<e;t++){const e=n.Util.applyTransform(d[t],c);v[t+0]=l&&(a.left-e[0])/l,v[t+4]=f&&(a.top-e[1])/f,v[t+8]=l&&(a.right-e[0])/l,v[t+12]=f&&(a.bottom-e[1])/f,v[t+16]=f&&(a.left-e[0])/-f,v[t+20]=l&&(a.top-e[1])/l,v[t+24]=f&&(a.right-e[0])/-f,v[t+28]=l&&(a.bottom-e[1])/l,v[t+32]=l&&(a.left-e[0])/-l,v[t+36]=f&&(a.top-e[1])/-f,v[t+40]=l&&(a.right-e[0])/-l,v[t+44]=f&&(a.bottom-e[1])/-f,v[t+48]=f&&(a.left-e[0])/f,v[t+52]=l&&(a.top-e[1])/-l,v[t+56]=f&&(a.right-e[0])/f,v[t+60]=l&&(a.bottom-e[1])/-l}const p=1+Math.min(Math.abs(l),Math.abs(f));o.paddingLeft=u(v,32,16)/p,o.paddingTop=u(v,48,16)/p,o.paddingRight=u(v,0,16)/p,o.paddingBottom=u(v,16,16)/p,t._textDivProperties.set(s,o)}}(this),this._bounds=null);const e=[],i=[];for(let n=0,r=this._textDivs.length;n<r;n++){const r=this._textDivs[n],s=this._textDivProperties.get(r);s.hasText&&(t?(e.length=0,i.length=0,s.originalTransform&&e.push(s.originalTransform),s.paddingTop>0?(i.push(`${s.paddingTop}px`),e.push(`translateY(${-s.paddingTop}px)`)):i.push(0),i.push(s.paddingRight>0?s.paddingRight/s.scale+"px":0),i.push(s.paddingBottom>0?`${s.paddingBottom}px`:0),s.paddingLeft>0?(i.push(s.paddingLeft/s.scale+"px"),e.push(`translateX(${-s.paddingLeft/s.scale}px)`)):i.push(0),r.style.padding=i.join(" "),e.length&&(r.style.transform=e.join(" "))):(r.style.padding=null,r.style.transform=s.originalTransform))}}}e.TextLayerRenderTask=f},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SVGGraphics=void 0;var n=i(133),r=i(1),s=i(3);let o=class{constructor(){(0,r.unreachable)("Not implemented: SVGGraphics")}};e.SVGGraphics=o;{const a={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},h="http://www.w3.org/XML/1998/namespace",c="http://www.w3.org/1999/xlink",u=["butt","round","square"],l=["miter","round","bevel"],f=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(URL.createObjectURL&&"undefined"!=typeof Blob&&!(arguments.length>2&&void 0!==arguments[2]&&arguments[2]))return URL.createObjectURL(new Blob([t],{type:e}));const i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let n=`data:${e};base64,`;for(let e=0,r=t.length;e<r;e+=3){const s=255&t[e],o=255&t[e+1],a=255&t[e+2];n+=i[s>>2]+i[(3&s)<<4|o>>4]+i[e+1<r?(15&o)<<2|a>>6:64]+i[e+2<r?63&a:64]}return n},d=function(){const t=new Uint8Array([137,80,78,71,13,10,26,10]),e=new Int32Array(256);for(let t=0;t<256;t++){let i=t;for(let t=0;t<8;t++)i=1&i?3988292384^i>>1&2147483647:i>>1&2147483647;e[t]=i}function i(t,i,n,r){let s=r;const o=i.length;n[s]=o>>24&255,n[s+1]=o>>16&255,n[s+2]=o>>8&255,n[s+3]=255&o,s+=4,n[s]=255&t.charCodeAt(0),n[s+1]=255&t.charCodeAt(1),n[s+2]=255&t.charCodeAt(2),n[s+3]=255&t.charCodeAt(3),s+=4,n.set(i,s),s+=i.length;const a=function(t,i,n){let r=-1;for(let s=i;s<n;s++)r=r>>>8^e[255&(r^t[s])];return~r}(n,r+4,s);n[s]=a>>24&255,n[s+1]=a>>16&255,n[s+2]=a>>8&255,n[s+3]=255&a}function n(t){let e=t.length;const i=65535,n=Math.ceil(e/i),r=new Uint8Array(2+e+5*n+4);let s=0;r[s++]=120,r[s++]=156;let o=0;for(;e>i;)r[s++]=0,r[s++]=255,r[s++]=255,r[s++]=0,r[s++]=0,r.set(t.subarray(o,o+i),s),s+=i,o+=i,e-=i;r[s++]=1,r[s++]=255&e,r[s++]=e>>8&255,r[s++]=255&~e,r[s++]=(65535&~e)>>8&255,r.set(t.subarray(o),s),s+=t.length-o;const a=function(t,e,i){let n=1,r=0;for(let e=0;e<i;++e)n=(n+(255&t[e]))%65521,r=(r+n)%65521;return r<<16|n}(t,0,t.length);return r[s++]=a>>24&255,r[s++]=a>>16&255,r[s++]=a>>8&255,r[s++]=255&a,r}return function(e,o,a){return function(e,o,a,h){const c=e.width,u=e.height;let l,d,v;const p=e.data;switch(o){case r.ImageKind.GRAYSCALE_1BPP:d=0,l=1,v=c+7>>3;break;case r.ImageKind.RGB_24BPP:d=2,l=8,v=3*c;break;case r.ImageKind.RGBA_32BPP:d=6,l=8,v=4*c;break;default:throw new Error("invalid format")}const b=new Uint8Array((1+v)*u);let w=0,g=0;for(let t=0;t<u;++t)b[w++]=0,b.set(p.subarray(g,g+v),w),g+=v,w+=v;if(o===r.ImageKind.GRAYSCALE_1BPP&&h){w=0;for(let t=0;t<u;t++){w++;for(let t=0;t<v;t++)b[w++]^=255}}const m=new Uint8Array([c>>24&255,c>>16&255,c>>8&255,255&c,u>>24&255,u>>16&255,u>>8&255,255&u,l,d,0,0,0]),A=function(t){if(!s.isNodeJS)return n(t);try{let e;e=parseInt(process.versions.node)>=8?t:Buffer.from(t);const i=require("zlib").deflateSync(e,{level:9});return i instanceof Uint8Array?i:new Uint8Array(i)}catch(t){(0,r.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+t)}return n(t)}(b),y=new Uint8Array(t.length+36+m.length+A.length);let k=0;return y.set(t,k),k+=t.length,i("IHDR",m,y,k),k+=12+m.length,i("IDATA",A,y,k),k+=12+A.length,i("IEND",new Uint8Array(0),y,k),f(y,"image/png",a)}(e,void 0===e.kind?r.ImageKind.GRAYSCALE_1BPP:e.kind,o,a)}}();class v{constructor(){this.fontSizeScale=1,this.fontWeight=a.fontWeight,this.fontSize=0,this.textMatrix=r.IDENTITY_MATRIX,this.fontMatrix=r.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=r.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=a.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}}function p(t){let e=[];const i=[];for(const n of t)"save"!==n.fn?"restore"===n.fn?e=i.pop():e.push(n):(e.push({fnId:92,fn:"group",items:[]}),i.push(e),e=e.at(-1).items);return e}function b(t){if(Number.isInteger(t))return t.toString();const e=t.toFixed(10);let i=e.length-1;if("0"!==e[i])return e;do{i--}while("0"===e[i]);return e.substring(0,"."===e[i]?i:i+1)}function w(t){if(0===t[4]&&0===t[5]){if(0===t[1]&&0===t[2])return 1===t[0]&&1===t[3]?"":`scale(${b(t[0])} ${b(t[3])})`;if(t[0]===t[3]&&t[1]===-t[2])return`rotate(${b(180*Math.acos(t[0])/Math.PI)})`}else if(1===t[0]&&0===t[1]&&0===t[2]&&1===t[3])return`translate(${b(t[4])} ${b(t[5])})`;return`matrix(${b(t[0])} ${b(t[1])} ${b(t[2])} ${b(t[3])} ${b(t[4])} ${b(t[5])})`}let g=0,m=0,A=0;e.SVGGraphics=o=class{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];(0,n.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future."),this.svgFactory=new n.DOMSVGFactory,this.current=new v,this.transformMatrix=r.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=!!i,this._operatorIdMapping=[];for(const t in r.OPS)this._operatorIdMapping[r.OPS[t]]=t}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,i=t.argsArray;for(let t=0,n=e.length;t<n;t++)if(e[t]===r.OPS.dependency)for(const e of i[t]){const t=e.startsWith("g_")?this.commonObjs:this.objs,i=new Promise((i=>{t.get(e,i)}));this.current.dependencies.push(i)}return Promise.all(this.current.dependencies)}transform(t,e,i,n,s,o){this.transformMatrix=r.Util.transform(this.transformMatrix,[t,e,i,n,s,o]),this.tgrp=null}getSVG(t,e){this.viewport=e;const i=this._initialize(e);return this.loadDependencies(t).then((()=>(this.transformMatrix=r.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(t)),i)))}convertOpList(t){const e=this._operatorIdMapping,i=t.argsArray,n=t.fnArray,r=[];for(let t=0,s=n.length;t<s;t++){const s=n[t];r.push({fnId:s,fn:e[s],args:i[t]})}return p(r)}executeOpTree(t){for(const e of t){const t=e.fn,i=e.args;switch(0|e.fnId){case r.OPS.beginText:this.beginText();break;case r.OPS.dependency:break;case r.OPS.setLeading:this.setLeading(i);break;case r.OPS.setLeadingMoveText:this.setLeadingMoveText(i[0],i[1]);break;case r.OPS.setFont:this.setFont(i);break;case r.OPS.showText:case r.OPS.showSpacedText:this.showText(i[0]);break;case r.OPS.endText:this.endText();break;case r.OPS.moveText:this.moveText(i[0],i[1]);break;case r.OPS.setCharSpacing:this.setCharSpacing(i[0]);break;case r.OPS.setWordSpacing:this.setWordSpacing(i[0]);break;case r.OPS.setHScale:this.setHScale(i[0]);break;case r.OPS.setTextMatrix:this.setTextMatrix(i[0],i[1],i[2],i[3],i[4],i[5]);break;case r.OPS.setTextRise:this.setTextRise(i[0]);break;case r.OPS.setTextRenderingMode:this.setTextRenderingMode(i[0]);break;case r.OPS.setLineWidth:this.setLineWidth(i[0]);break;case r.OPS.setLineJoin:this.setLineJoin(i[0]);break;case r.OPS.setLineCap:this.setLineCap(i[0]);break;case r.OPS.setMiterLimit:this.setMiterLimit(i[0]);break;case r.OPS.setFillRGBColor:this.setFillRGBColor(i[0],i[1],i[2]);break;case r.OPS.setStrokeRGBColor:this.setStrokeRGBColor(i[0],i[1],i[2]);break;case r.OPS.setStrokeColorN:this.setStrokeColorN(i);break;case r.OPS.setFillColorN:this.setFillColorN(i);break;case r.OPS.shadingFill:this.shadingFill(i[0]);break;case r.OPS.setDash:this.setDash(i[0],i[1]);break;case r.OPS.setRenderingIntent:this.setRenderingIntent(i[0]);break;case r.OPS.setFlatness:this.setFlatness(i[0]);break;case r.OPS.setGState:this.setGState(i[0]);break;case r.OPS.fill:this.fill();break;case r.OPS.eoFill:this.eoFill();break;case r.OPS.stroke:this.stroke();break;case r.OPS.fillStroke:this.fillStroke();break;case r.OPS.eoFillStroke:this.eoFillStroke();break;case r.OPS.clip:this.clip("nonzero");break;case r.OPS.eoClip:this.clip("evenodd");break;case r.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case r.OPS.paintImageXObject:this.paintImageXObject(i[0]);break;case r.OPS.paintInlineImageXObject:this.paintInlineImageXObject(i[0]);break;case r.OPS.paintImageMaskXObject:this.paintImageMaskXObject(i[0]);break;case r.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(i[0],i[1]);break;case r.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case r.OPS.closePath:this.closePath();break;case r.OPS.closeStroke:this.closeStroke();break;case r.OPS.closeFillStroke:this.closeFillStroke();break;case r.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case r.OPS.nextLine:this.nextLine();break;case r.OPS.transform:this.transform(i[0],i[1],i[2],i[3],i[4],i[5]);break;case r.OPS.constructPath:this.constructPath(i[0],i[1]);break;case r.OPS.endPath:this.endPath();break;case 92:this.group(e.items);break;default:(0,r.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,n,r,s){const o=this.current;o.textMatrix=o.lineMatrix=[t,e,i,n,r,s],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",`${b(o.fontSize)}px`),o.tspan.setAttributeNS(null,"y",b(-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=r.IDENTITY_MATRIX,t.lineMatrix=r.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",`${b(i.fontSize)}px`),i.tspan.setAttributeNS(null,"y",b(-i.y))}showText(t){const e=this.current,i=e.font,n=e.fontSize;if(0===n)return;const s=e.fontSizeScale,o=e.charSpacing,c=e.wordSpacing,u=e.fontDirection,l=e.textHScale*u,f=i.vertical,d=f?1:-1,v=i.defaultVMetrics,p=n*e.fontMatrix[0];let g=0;for(const r of t){if(null===r){g+=u*c;continue}if("number"==typeof r){g+=d*r*n/1e3;continue}const t=(r.isSpace?c:0)+o,a=r.fontChar;let h,l,b,w=r.width;if(f){let t;const e=r.vmetric||v;t=r.vmetric?e[1]:.5*w,t=-t*p,w=e?-e[0]:w,h=t/s,l=(g+e[2]*p)/s}else h=g/s,l=0;(r.isInFont||i.missingFile)&&(e.xcoords.push(e.x+h),f&&e.ycoords.push(-e.y+l),e.tspan.textContent+=a),b=f?w*p-t*u:w*p+t*u,g+=b}e.tspan.setAttributeNS(null,"x",e.xcoords.map(b).join(" ")),e.tspan.setAttributeNS(null,"y",f?e.ycoords.map(b).join(" "):b(-e.y)),f?e.y-=g:e.x+=g*l,e.tspan.setAttributeNS(null,"font-family",e.fontFamily),e.tspan.setAttributeNS(null,"font-size",`${b(e.fontSize)}px`),e.fontStyle!==a.fontStyle&&e.tspan.setAttributeNS(null,"font-style",e.fontStyle),e.fontWeight!==a.fontWeight&&e.tspan.setAttributeNS(null,"font-weight",e.fontWeight);const m=e.textRenderingMode&r.TextRenderingMode.FILL_STROKE_MASK;m===r.TextRenderingMode.FILL||m===r.TextRenderingMode.FILL_STROKE?(e.fillColor!==a.fillColor&&e.tspan.setAttributeNS(null,"fill",e.fillColor),e.fillAlpha<1&&e.tspan.setAttributeNS(null,"fill-opacity",e.fillAlpha)):e.tspan.setAttributeNS(null,"fill",e.textRenderingMode===r.TextRenderingMode.ADD_TO_PATH?"transparent":"none"),(m===r.TextRenderingMode.STROKE||m===r.TextRenderingMode.FILL_STROKE)&&this._setStrokeAttributes(e.tspan,1/(e.textMatrixScale||1));let A=e.textMatrix;0!==e.textRise&&(A=A.slice(),A[5]+=e.textRise),e.txtElement.setAttributeNS(null,"transform",`${w(A)} scale(${b(l)}, -1)`),e.txtElement.setAttributeNS(h,"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=f(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 n=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||r.FONT_IDENTITY_MATRIX;let s="normal";i.black?s="900":i.bold&&(s="bold");const o=i.italic?"italic":"normal";n<0?(n=-n,e.fontDirection=-1):e.fontDirection=1,e.fontSize=n,e.fontFamily=i.loadedName,e.fontWeight=s,e.fontStyle=o,e.tspan=this.svgFactory.createElement("svg:tspan"),e.tspan.setAttributeNS(null,"y",b(-e.y)),e.xcoords=[],e.ycoords=[]}endText(){var t;const e=this.current;e.textRenderingMode&r.TextRenderingMode.ADD_TO_PATH_FLAG&&null!==(t=e.txtElement)&&void 0!==t&&t.hasChildNodes()&&(e.element=e.txtElement,this.clip("nonzero"),this.endPath())}setLineWidth(t){t>0&&(this.current.lineWidth=t)}setLineCap(t){this.current.lineCap=u[t]}setLineJoin(t){this.current.lineJoin=l[t]}setMiterLimit(t){this.current.miterLimit=t}setStrokeAlpha(t){this.current.strokeAlpha=t}setStrokeRGBColor(t,e,i){this.current.strokeColor=r.Util.makeHexColor(t,e,i)}setFillAlpha(t){this.current.fillAlpha=t}setFillRGBColor(t,e,i){this.current.fillColor=r.Util.makeHexColor(t,e,i),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,i=this.viewport.height,n=r.Util.inverseTransform(this.transformMatrix),s=r.Util.applyTransform([0,0],n),o=r.Util.applyTransform([0,i],n),a=r.Util.applyTransform([e,0],n),h=r.Util.applyTransform([e,i],n),c=Math.min(s[0],o[0],a[0],h[0]),u=Math.min(s[1],o[1],a[1],h[1]),l=Math.max(s[0],o[0],a[0],h[0]),f=Math.max(s[1],o[1],a[1],h[1]),d=this.svgFactory.createElement("svg:rect");d.setAttributeNS(null,"x",c),d.setAttributeNS(null,"y",u),d.setAttributeNS(null,"width",l-c),d.setAttributeNS(null,"height",f-u),d.setAttributeNS(null,"fill",this._makeShadingPattern(t)),this.current.fillAlpha<1&&d.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(d)}_makeColorN_Pattern(t){return"TilingPattern"===t[0]?this._makeTilingPattern(t):this._makeShadingPattern(t)}_makeTilingPattern(t){const e=t[1],i=t[2],n=t[3]||r.IDENTITY_MATRIX,[s,o,a,h]=t[4],c=t[5],u=t[6],l=t[7],f="shading"+A++,[d,v,p,b]=r.Util.normalizeRect([...r.Util.applyTransform([s,o],n),...r.Util.applyTransform([a,h],n)]),[w,g]=r.Util.singularValueDecompose2dScale(n),m=c*w,y=u*g,k=this.svgFactory.createElement("svg:pattern");k.setAttributeNS(null,"id",f),k.setAttributeNS(null,"patternUnits","userSpaceOnUse"),k.setAttributeNS(null,"width",m),k.setAttributeNS(null,"height",y),k.setAttributeNS(null,"x",`${d}`),k.setAttributeNS(null,"y",`${v}`);const M=this.svg,E=this.transformMatrix,S=this.current.fillColor,x=this.current.strokeColor,T=this.svgFactory.create(p-d,b-v);if(this.svg=T,this.transformMatrix=n,2===l){const t=r.Util.makeHexColor(...e);this.current.fillColor=t,this.current.strokeColor=t}return this.executeOpTree(this.convertOpList(i)),this.svg=M,this.transformMatrix=E,this.current.fillColor=S,this.current.strokeColor=x,k.append(T.childNodes[0]),this.defs.append(k),`url(#${f})`}_makeShadingPattern(t){switch("string"==typeof t&&(t=this.objs.get(t)),t[0]){case"RadialAxial":const e="shading"+A++,i=t[3];let n;switch(t[1]){case"axial":const i=t[4],r=t[5];n=this.svgFactory.createElement("svg:linearGradient"),n.setAttributeNS(null,"id",e),n.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),n.setAttributeNS(null,"x1",i[0]),n.setAttributeNS(null,"y1",i[1]),n.setAttributeNS(null,"x2",r[0]),n.setAttributeNS(null,"y2",r[1]);break;case"radial":const s=t[4],o=t[5],a=t[6],h=t[7];n=this.svgFactory.createElement("svg:radialGradient"),n.setAttributeNS(null,"id",e),n.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),n.setAttributeNS(null,"cx",o[0]),n.setAttributeNS(null,"cy",o[1]),n.setAttributeNS(null,"r",h),n.setAttributeNS(null,"fx",s[0]),n.setAttributeNS(null,"fy",s[1]),n.setAttributeNS(null,"fr",a);break;default:throw new Error(`Unknown RadialAxial type: ${t[1]}`)}for(const t of i){const e=this.svgFactory.createElement("svg:stop");e.setAttributeNS(null,"offset",t[0]),e.setAttributeNS(null,"stop-color",t[1]),n.append(e)}return this.defs.append(n),`url(#${e})`;case"Mesh":return(0,r.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 n=i.x,s=i.y,o=[],a=0;for(const i of t)switch(0|i){case r.OPS.rectangle:n=e[a++],s=e[a++];const t=n+e[a++],i=s+e[a++];o.push("M",b(n),b(s),"L",b(t),b(s),"L",b(t),b(i),"L",b(n),b(i),"Z");break;case r.OPS.moveTo:n=e[a++],s=e[a++],o.push("M",b(n),b(s));break;case r.OPS.lineTo:n=e[a++],s=e[a++],o.push("L",b(n),b(s));break;case r.OPS.curveTo:n=e[a+4],s=e[a+5],o.push("C",b(e[a]),b(e[a+1]),b(e[a+2]),b(e[a+3]),b(n),b(s)),a+=6;break;case r.OPS.curveTo2:o.push("C",b(n),b(s),b(e[a]),b(e[a+1]),b(e[a+2]),b(e[a+3])),n=e[a+2],s=e[a+3],a+=4;break;case r.OPS.curveTo3:n=e[a+2],s=e[a+3],o.push("C",b(e[a]),b(e[a+1]),b(n),b(s),b(n),b(s)),a+=4;break;case r.OPS.closePath:o.push("Z")}o=o.join(" "),i.path&&t.length>0&&t[0]!==r.OPS.rectangle&&t[0]!==r.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(n,s)}endPath(){const t=this.current;if(t.path=null,!this.pendingClip)return;if(!t.element)return void(this.pendingClip=null);const e="clippath"+g++,i=this.svgFactory.createElement("svg:clipPath");i.setAttributeNS(null,"id",e),i.setAttributeNS(null,"transform",w(this.transformMatrix));const n=t.element.cloneNode(!0);if(n.setAttributeNS(null,"clip-rule","evenodd"===this.pendingClip?"evenodd":"nonzero"),this.pendingClip=null,i.append(n),this.defs.append(i),t.activeClipUrl){t.clipGroup=null;for(const t of this.extraStack)t.clipGroup=null;i.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,i]of t)switch(e){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i);break;case"CA":this.setStrokeAlpha(i);break;case"ca":this.setFillAlpha(i);break;default:(0,r.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){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.current;let n=i.dashArray;1!==e&&n.length>0&&(n=n.map((function(t){return e*t}))),t.setAttributeNS(null,"stroke",i.strokeColor),t.setAttributeNS(null,"stroke-opacity",i.strokeAlpha),t.setAttributeNS(null,"stroke-miterlimit",b(i.miterLimit)),t.setAttributeNS(null,"stroke-linecap",i.lineCap),t.setAttributeNS(null,"stroke-linejoin",i.lineJoin),t.setAttributeNS(null,"stroke-width",b(e*i.lineWidth)+"px"),t.setAttributeNS(null,"stroke-dasharray",n.map(b).join(" ")),t.setAttributeNS(null,"stroke-dashoffset",b(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,r.warn)(`Dependent image with object ID ${t} is not ready yet`)}paintInlineImageXObject(t,e){const i=t.width,n=t.height,r=d(t,this.forceDataSchema,!!e),s=this.svgFactory.createElement("svg:rect");s.setAttributeNS(null,"x","0"),s.setAttributeNS(null,"y","0"),s.setAttributeNS(null,"width",b(i)),s.setAttributeNS(null,"height",b(n)),this.current.element=s,this.clip("nonzero");const o=this.svgFactory.createElement("svg:image");o.setAttributeNS(c,"xlink:href",r),o.setAttributeNS(null,"x","0"),o.setAttributeNS(null,"y",b(-n)),o.setAttributeNS(null,"width",b(i)+"px"),o.setAttributeNS(null,"height",b(n)+"px"),o.setAttributeNS(null,"transform",`scale(${b(1/i)} ${b(-1/n)})`),e?e.append(o):this._ensureTransformGroup().append(o)}paintImageMaskXObject(t){const e=this.current,i=t.width,n=t.height,r=e.fillColor;e.maskId="mask"+m++;const s=this.svgFactory.createElement("svg:mask");s.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",b(i)),o.setAttributeNS(null,"height",b(n)),o.setAttributeNS(null,"fill",r),o.setAttributeNS(null,"mask",`url(#${e.maskId})`),this.defs.append(s),this._ensureTransformGroup().append(o),this.paintInlineImageXObject(t,s)}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],n=this.svgFactory.createElement("svg:rect");n.setAttributeNS(null,"x",e[0]),n.setAttributeNS(null,"y",e[1]),n.setAttributeNS(null,"width",b(t)),n.setAttributeNS(null,"height",b(i)),this.current.element=n,this.clip("nonzero"),this.endPath()}}paintFormXObjectEnd(){}_initialize(t){const e=this.svgFactory.create(t.width,t.height),i=this.svgFactory.createElement("svg:defs");e.append(i),this.defs=i;const n=this.svgFactory.createElement("svg:g");return n.setAttributeNS(null,"transform",w(t.transform)),e.append(n),this.svg=n,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",w(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}}}},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PDFNodeStream=void 0;var n=i(1),r=i(158);const s=E,o=E,a=E,h=E,c=/^file:\/\/\/[a-zA-Z]:\//;e.PDFNodeStream=class{constructor(t){this.source=t,this.url=function(t){const e=h.parse(t);return"file:"===e.protocol||e.host?e:/^[a-z]:[/\\]/i.test(t)?h.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,e;return null!==(t=null===(e=this._fullRequestReader)||void 0===e?void 0:e._loaded)&&void 0!==t?t:0}getFullReader(){return(0,n.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new p(this):new d(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=this.isFsUrl?new b(this,t,e):new v(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader&&this._fullRequestReader.cancel(t);for(const e of this._rangeRequestReaders.slice(0))e.cancel(t)}};class u{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,n.createPromiseCapability)(),this._headersCapability=(0,n.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,n.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 n.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class l{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=(0,n.createPromiseCapability)(),this._isStreamingSupported=!t.source.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,n.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 f(t,e){return{protocol:t.protocol,auth:t.auth,host:t.hostname,port:t.port,path:t.path,method:"GET",headers:e}}class d extends u{constructor(t){super(t);const e=e=>{if(404===e.statusCode){const t=new n.MissingPDFException(`Missing PDF "${this._url}".`);return this._storedError=t,void this._headersCapability.reject(t)}this._headersCapability.resolve(),this._setReadableStream(e);const i=t=>this._readableStream.headers[t.toLowerCase()],{allowRangeRequests:s,suggestedLength:o}=(0,r.validateRangeRequestCapabilities)({getResponseHeader:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=o||this._contentLength,this._filename=(0,r.extractFilenameFromHeader)(i)};this._request=null,this._request="http:"===this._url.protocol?o.request(f(this._url,t.httpHeaders),e):a.request(f(this._url,t.httpHeaders),e),this._request.on("error",(t=>{this._storedError=t,this._headersCapability.reject(t)})),this._request.end()}}class v extends l{constructor(t,e,i){super(t),this._httpHeaders={};for(const e in t.httpHeaders){const i=t.httpHeaders[e];void 0!==i&&(this._httpHeaders[e]=i)}this._httpHeaders.Range=`bytes=${e}-${i-1}`;const r=t=>{if(404!==t.statusCode)this._setReadableStream(t);else{const t=new n.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=t}};this._request=null,this._request="http:"===this._url.protocol?o.request(f(this._url,this._httpHeaders),r):a.request(f(this._url,this._httpHeaders),r),this._request.on("error",(t=>{this._storedError=t})),this._request.end()}}class p extends u{constructor(t){super(t);let e=decodeURIComponent(this._url.path);c.test(this._url.href)&&(e=e.replace(/^\//,"")),s.lstat(e,((t,i)=>{if(t)return"ENOENT"===t.code&&(t=new n.MissingPDFException(`Missing PDF "${e}".`)),this._storedError=t,void this._headersCapability.reject(t);this._contentLength=i.size,this._setReadableStream(s.createReadStream(e)),this._headersCapability.resolve()}))}}class b extends l{constructor(t,e,i){super(t);let n=decodeURIComponent(this._url.path);c.test(this._url.href)&&(n=n.replace(/^\//,"")),this._setReadableStream(s.createReadStream(n,{start:e,end:i-1}))}}},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createResponseStatusError=function(t,e){return 404===t||0===t&&e.startsWith("file:")?new n.MissingPDFException('Missing PDF "'+e+'".'):new n.UnexpectedResponseException(`Unexpected server response (${t}) while retrieving PDF "${e}".`,t)},e.extractFilenameFromHeader=function(t){const e=t("Content-Disposition");if(e){let t=(0,r.getFilenameFromContentDispositionHeader)(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch(t){}if((0,s.isPdfFile)(t))return t}return null},e.validateRangeRequestCapabilities=function(t){let{getResponseHeader:e,isHttp:i,rangeChunkSize:n,disableRange:r}=t;const s={allowRangeRequests:!1,suggestedLength:void 0},o=parseInt(e("Content-Length"),10);return Number.isInteger(o)?(s.suggestedLength=o,o<=2*n||r||!i||"bytes"!==e("Accept-Ranges")||"identity"!==(e("Content-Encoding")||"identity")||(s.allowRangeRequests=!0),s):s},e.validateResponseStatus=function(t){return 200===t||206===t};var n=i(1),r=i(159),s=i(133)},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getFilenameFromContentDispositionHeader=function(t){let e=!0,i=r("filename\\*","i").exec(t);if(i){i=i[1];let t=a(i);return t=unescape(t),t=h(t),t=c(t),o(t)}if(i=function(t){const e=[];let i;const n=r("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(i=n.exec(t));){let[,t,n,r]=i;if(t=parseInt(t,10),t in e){if(0===t)break}else e[t]=[n,r]}const s=[];for(let t=0;t<e.length&&t in e;++t){let[i,n]=e[t];n=a(n),i&&(n=unescape(n),0===t&&(n=h(n))),s.push(n)}return s.join("")}(t),i)return o(c(i));if(i=r("filename","i").exec(t),i){i=i[1];let t=a(i);return t=c(t),o(t)}function r(t,e){return new RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',e)}function s(t,i){if(t){if(!/^[\x00-\xFF]+$/.test(i))return i;try{const r=new TextDecoder(t,{fatal:!0}),s=(0,n.stringToBytes)(i);i=r.decode(s),e=!1}catch(t){}}return i}function o(t){return e&&/[\x80-\xff]/.test(t)&&(t=s("utf-8",t),e&&(t=s("iso-8859-1",t))),t}function a(t){if(t.startsWith('"')){const e=t.slice(1).split('\\"');for(let t=0;t<e.length;++t){const i=e[t].indexOf('"');-1!==i&&(e[t]=e[t].slice(0,i),e.length=t+1),e[t]=e[t].replace(/\\(.)/g,"$1")}t=e.join('"')}return t}function h(t){const e=t.indexOf("'");return-1===e?t:s(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,i,n){if("q"===i||"Q"===i)return s(e,n=(n=n.replace(/_/g," ")).replace(/=([0-9a-fA-F]{2})/g,(function(t,e){return String.fromCharCode(parseInt(e,16))})));try{n=atob(n)}catch(t){}return s(e,n)}))}return""};var n=i(1)},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PDFNetworkStream=void 0;var n=i(1),r=i(158);class s{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};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,i){const n={begin:t,end:e};for(const t in i)n[t]=i[t];return this.request(n)}requestFull(t){return this.request(t)}request(t){const e=this.getXhr(),i=this.currXhrId++,n=this.pendingRequests[i]={xhr:e};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(const t in this.httpHeaders){const i=this.httpHeaders[t];void 0!==i&&e.setRequestHeader(t,i)}return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),n.expectedStatus=206):n.expectedStatus=200,e.responseType="arraybuffer",t.onError&&(e.onerror=function(){t.onError(e.status)}),e.onreadystatechange=this.onStateChange.bind(this,i),e.onprogress=this.onProgress.bind(this,i),n.onHeadersReceived=t.onHeadersReceived,n.onDone=t.onDone,n.onError=t.onError,n.onProgress=t.onProgress,e.send(null),i}onProgress(t,e){var i;const n=this.pendingRequests[t];n&&(null===(i=n.onProgress)||void 0===i||i.call(n,e))}onStateChange(t,e){const i=this.pendingRequests[t];if(!i)return;const r=i.xhr;if(r.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),4!==r.readyState)return;if(!(t in this.pendingRequests))return;var s;if(delete this.pendingRequests[t],0===r.status&&this.isHttp)return void(null===(s=i.onError)||void 0===s||s.call(i,r.status));const o=r.status||200;var a;if((200!==o||206!==i.expectedStatus)&&o!==i.expectedStatus)return void(null===(a=i.onError)||void 0===a||a.call(i,r.status));const h=function(t){const e=t.response;return"string"!=typeof e?e:(0,n.stringToBytes)(e).buffer}(r);if(206===o){const t=r.getResponseHeader("Content-Range"),e=/bytes (\d+)-(\d+)\/(\d+)/.exec(t);i.onDone({begin:parseInt(e[1],10),chunk:h})}else if(h)i.onDone({begin:0,chunk:h});else{var c;null===(c=i.onError)||void 0===c||c.call(i,r.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 s(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,n.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new o(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const i=new a(this._manager,t,e);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;null===(e=this._fullRequestReader)||void 0===e||e.cancel(t);for(const e of this._rangeRequestReaders.slice(0))e.cancel(t)}};class o{constructor(t,e){this._manager=t;const i={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(i),this._headersReceivedCapability=(0,n.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),i=t=>e.getResponseHeader(t),{allowRangeRequests:n,suggestedLength:s}=(0,r.validateRangeRequestCapabilities)({getResponseHeader:i,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});n&&(this._isRangeSupported=!0),this._contentLength=s||this._contentLength,this._filename=(0,r.extractFilenameFromHeader)(i),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,r.createResponseStatusError)(t,this._url),this._headersReceivedCapability.reject(this._storedError);for(const t of this._requests)t.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){var e;null===(e=this.onProgress)||void 0===e||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,n.createPromiseCapability)();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersReceivedCapability.reject(t);for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class a{constructor(t,e,i){this._manager=t;const n={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(e,i,n),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)||void 0===t||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 t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){this._storedError=(0,r.createResponseStatusError)(t,this._url);for(const t of this._requests)t.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){var e;this.isStreamingSupported||null===(e=this.onProgress)||void 0===e||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,n.createPromiseCapability)();return this._requests.push(t),t.promise}cancel(t){this._done=!0;for(const t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}},(t,e,i)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.PDFFetchStream=void 0;var n=i(1),r=i(158);function s(t,e,i){return{method:"GET",headers:t,signal:i.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function o(t){const e=new Headers;for(const i in t){const n=t[i];void 0!==n&&e.append(i,n)}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,e;return null!==(t=null===(e=this._fullRequestReader)||void 0===e?void 0:e._loaded)&&void 0!==t?t:0}getFullReader(){return(0,n.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new a(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new h(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader&&this._fullRequestReader.cancel(t);for(const e of this._rangeRequestReaders.slice(0))e.cancel(t)}};class a{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,n.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=o(this._stream.httpHeaders);const i=e.url;fetch(i,s(this._headers,this._withCredentials,this._abortController)).then((t=>{if(!(0,r.validateResponseStatus)(t.status))throw(0,r.createResponseStatusError)(t.status,i);this._reader=t.body.getReader(),this._headersCapability.resolve();const e=e=>t.headers.get(e),{allowRangeRequests:s,suggestedLength:o}=(0,r.validateRangeRequestCapabilities)({getResponseHeader:e,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=o||this._contentLength,this._filename=(0,r.extractFilenameFromHeader)(e),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new n.AbortException("Streaming is disabled."))})).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){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 h{constructor(t,e,i){this._stream=t,this._reader=null,this._loaded=0;const a=t.source;this._withCredentials=a.withCredentials||!1,this._readCapability=(0,n.createPromiseCapability)(),this._isStreamingSupported=!a.disableStream,this._abortController=new AbortController,this._headers=o(this._stream.httpHeaders),this._headers.append("Range",`bytes=${e}-${i-1}`);const h=a.url;fetch(h,s(this._headers,this._withCredentials,this._abortController)).then((t=>{if(!(0,r.validateResponseStatus)(t.status))throw(0,r.createResponseStatusError)(t.status,h);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()}}}],e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var s=e[n]={exports:{}};return t[n](s,s.exports,i),s.exports}var n={};return(()=>{var t=n;Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"AnnotationEditorLayer",{enumerable:!0,get:function(){return o.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 a.AnnotationEditorUIManager}}),Object.defineProperty(t,"AnnotationLayer",{enumerable:!0,get:function(){return h.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 c.GlobalWorkerOptions}}),Object.defineProperty(t,"InvalidPDFException",{enumerable:!0,get:function(){return e.InvalidPDFException}}),Object.defineProperty(t,"LoopbackPort",{enumerable:!0,get:function(){return r.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 r.PDFDataRangeTransport}}),Object.defineProperty(t,"PDFDateString",{enumerable:!0,get:function(){return s.PDFDateString}}),Object.defineProperty(t,"PDFWorker",{enumerable:!0,get:function(){return r.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 s.PixelsPerInch}}),Object.defineProperty(t,"RenderingCancelledException",{enumerable:!0,get:function(){return s.RenderingCancelledException}}),Object.defineProperty(t,"SVGGraphics",{enumerable:!0,get:function(){return f.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 r.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 r.getDocument}}),Object.defineProperty(t,"getFilenameFromUrl",{enumerable:!0,get:function(){return s.getFilenameFromUrl}}),Object.defineProperty(t,"getPdfFilenameFromUrl",{enumerable:!0,get:function(){return s.getPdfFilenameFromUrl}}),Object.defineProperty(t,"getXfaPageViewport",{enumerable:!0,get:function(){return s.getXfaPageViewport}}),Object.defineProperty(t,"isPdfFile",{enumerable:!0,get:function(){return s.isPdfFile}}),Object.defineProperty(t,"loadScript",{enumerable:!0,get:function(){return s.loadScript}}),Object.defineProperty(t,"renderTextLayer",{enumerable:!0,get:function(){return l.renderTextLayer}}),Object.defineProperty(t,"shadow",{enumerable:!0,get:function(){return e.shadow}}),Object.defineProperty(t,"version",{enumerable:!0,get:function(){return r.version}});var e=i(1),r=i(129),s=i(133),o=i(147),a=i(132),h=i(152),c=i(140),u=i(3),l=i(155),f=i(156),d=i(154);if(u.isNodeJS){const{PDFNodeStream:t}=i(157);(0,r.setPDFNetworkStreamFactory)((e=>new t(e)))}else{const{PDFNetworkStream:t}=i(160),{PDFFetchStream:e}=i(161);(0,r.setPDFNetworkStreamFactory)((i=>(0,s.isValidFetchUrl)(i.url)?new e(i):new t(i)))}})(),n})(),y.exports=S(),window.pdf=a(y.exports);const x=class{constructor(i){t(this,i),this.activate=e(this,"activate",7),this.visiblePagesChange=e(this,"visiblePagesChange",7),this.pages=[],this.renderingPageNumbers=[],this.recentScrollPosition={x:0,y:0},this.storeRecentScrollPosition=()=>{this.recentScrollPosition={x:Math.round(this.scrollContainer?.scrollLeft/this.scrollContainer?.scrollWidth*100)/100,y:Math.round(this.scrollContainer?.scrollTop/this.scrollContainer?.scrollHeight*100)/100}},this.onScroll=u((()=>{this.updateVisiblePages(),this.storeRecentScrollPosition()}),60),this.errorMessage="File could not be loaded.",this.file=void 0,this.singlePageMode=void 0,this.viewMode="single",this.workerSrc="/pdfjs/pdf.worker.min.js",this.zoom=1,this.currentPage=null,this.doc=void 0,this.error=void 0,this.loading=!0,this.renderedPages=[],this.singlePageModePage=1,this.visiblePages=[]}componentWillLoad(){window.pdf.GlobalWorkerOptions.workerSrc=this.workerSrc}async componentDidLoad(){await this.getPages(),await this.updateVisiblePages(),this.activate.emit(this.el)}componentDidRender(){this.updateVisiblePages()}disconnectedCallback(){this.doc?.destroy()}async onWindowResize(){this.visiblePages=[],this.renderedPages=[],await this.updateVisiblePages()}async watchProps(){await this.getPages(),await this.updateVisiblePages()}async watchViewMode(){queueMicrotask((async()=>{this.visiblePages=[],this.renderedPages=[],await this.updateVisiblePages()}))}watchZoom(){queueMicrotask((async()=>{this.restoreScrollPosition(),this.visiblePages=[],this.renderedPages=[],await this.updateVisiblePages()}))}async getThumbnails(){return await Promise.all(this.pages.filter(Boolean).map((t=>{const e=t.getViewport({scale:1}),i=document.createElement("canvas");i.width=e.width,i.height=e.height;const n=Math.min(i.width/e.width,i.height/e.height);return t.render({canvasContext:i.getContext("2d"),viewport:t.getViewport({scale:n})}).promise.then((function(){return i}))})))}async print(){this.loading=!0,await this.updateVisiblePages(!0),await this.openPrintDialog(),this.loading=!1}async nextPage(){await this.setPage(this.singlePageModePage+1),await this.updateVisiblePages()}async previousPage(){await this.setPage(this.singlePageModePage-1),await this.updateVisiblePages()}async setPage(t){this.singlePageModePage=Math.min(Math.max(t,1),this.pages.length-1),await this.updateVisiblePages()}async getPages(){this.error=!1,this.loading=!0;try{Boolean(this.doc)&&this.doc.destroy(),this.doc=await y.exports.getDocument({isEvalSupported:!1,url:this.file}).promise;const t=[];for(let e=1;e<=this.doc.numPages;e++)t.push(this.doc.getPage(e));this.pages=await Promise.all(t),this.loading=!1}catch(t){this.error=!0,this.loading=!1}}async renderVisiblePages(t){const e=Array.from(this.el.shadowRoot.querySelectorAll("canvas")),i=[];for(const n of e){const e=n.closest(".file-viewer-pdf__page"),r=this.pages.find((t=>t?.pageNumber===+e?.dataset.pageNumber));Boolean(r)&&!this.renderingPageNumbers.includes(r.pageNumber)&&(this.visiblePages.includes(r.pageNumber)||t?!this.renderedPages.includes(r.pageNumber)||t?(await this.renderPage(r,n,t),i.push(r.pageNumber)):i.push(r.pageNumber):this.destroyPage(r))}this.renderedPages=i}async renderPage(t,e,i){const n=e.closest(".file-viewer-pdf__page"),r=n?.querySelector(".file-viewer-pdf__text-container");this.renderingPageNumbers=[...this.renderingPageNumbers,t.pageNumber];const s=i?2:this.getScale(t),o=window.devicePixelRatio||1,a=1!==o?[o,0,0,o,0,0]:null,h=t.getViewport({scale:s}),c=e.getContext("2d");e.height=Math.floor(h.height*o),e.width=Math.floor(h.width*o);const u={canvasContext:c,transform:a,viewport:h};try{await t.render(u).promise,t.cleanup(),r.innerHTML="",this.renderTextLayer(t,r).catch(),this.renderingPageNumbers=this.renderingPageNumbers.filter((e=>e!==t.pageNumber))}catch(t){}}destroyPage(t){const e=this.el.shadowRoot.querySelector(`[data-page-number="${t.pageNumber}"]`),i=e.querySelector("canvas"),n=e.querySelector(".file-viewer-pdf__text-container");i.width=1,i.height=1,i.getContext("2d").clearRect(0,0,i.width,i.height),n.innerHTML=""}async updateVisiblePages(t){const e=Array.from(this.el.shadowRoot.querySelectorAll(".file-viewer-pdf__page"));let i=[],n=null;if(this.singlePageMode)i=[this.singlePageModePage],n=this.singlePageModePage;else if(t)i=e.map((t=>+t.dataset.pageNumber));else{const t=e.map((t=>({pageNumber:+t.dataset.pageNumber,visibleHeight:l(t,this.scrollContainer)}))).filter((({visibleHeight:t})=>t>0));i=t.map((t=>t.pageNumber)),t.length>0&&(n=t.reduce(((t,e)=>e.visibleHeight>t.visibleHeight?e:t),t[0]).pageNumber)}this.visiblePages.length===i.length&&this.visiblePages.every((t=>i.includes(t)))&&this.currentPage===n||(this.visiblePages=i,this.currentPage=n,await this.renderVisiblePages(t),this.visiblePagesChange.emit(this.visiblePages))}async renderTextLayer(t,e){y.exports.renderTextLayer({container:e,textContent:await t.getTextContent(),viewport:t.getViewport({scale:this.getScale(t)})})}async openPrintDialog(){const t=Array.from(this.scrollContainer.querySelectorAll("canvas"));let e=`\n <!DOCTYPE html>\n <html lang="en">\n <head>\n <meta charset="UTF-8">\n <meta http-equiv="X-UA-Compatible" content="IE=edge">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>${this.file}</title>\n <style>\n *, *:before, *:after {\n margin: 0;\n padding: 0;\n outline: 0;\n }\n\n @page {\n size: a4 !important;\n margin: 0;\n padding: 0;\n }\n\n html, body {\n width: 210mm;\n height: 297mm;\n }\n\n img {\n display: block;\n max-width: 100%;\n max-height: 100%;\n page-break-after: always;\n }\n </style>\n </head>\n <body>\n `;for(const i of t)e+=`<img src="${i.toDataURL()}">`;e+="\n </body>\n </html>\n ";const i=document.createElement("iframe");this.el.append(i);const n=i.contentWindow;n.document.write(e),n.focus(),await new Promise((t=>setTimeout(t,100))),n.print(),i.remove()}getScale(t){const e=f()?0:32;return"auto"===this.zoom?(this.scrollContainer?.clientWidth-e)/t.view[2]:isNaN(this.zoom)?1:this.zoom}restoreScrollPosition(){this.scrollContainer.scrollTop=this.recentScrollPosition.y*this.scrollContainer?.scrollHeight,this.scrollContainer.scrollLeft=this.recentScrollPosition.x*this.scrollContainer?.scrollWidth}render(){const t=!this.error&&!this.loading&&this.visiblePages.length>0,e=this.loading,r=c("file-viewer-pdf",`file-viewer-pdf--view-mode-${this.viewMode}`);return i(n,{key:"fc44bde6b49ee1fcf3283f03cd92a0ca2df2fd89",class:r,exportparts:"file-viewer-pdf__pagination"},this.error&&i("swirl-inline-error",{key:"51731c3e8a10fc9c23f617948af158eef59a7c71",class:"file-viewer-pdf__error",message:this.errorMessage}),i("div",{key:"f3a1c104d2bd73bd9271310b53c333f9a69695e3","aria-describedby":"pagination",class:"file-viewer-pdf__pages",onScroll:this.onScroll,ref:t=>this.scrollContainer=t},this.pages.map((t=>{const e=t.getViewport({scale:this.getScale(t)}),n=e.height,r=e.width,s=this.renderedPages.includes(t.pageNumber);return i("div",{"aria-label":t.pageNumber,class:"file-viewer-pdf__page","data-page-number":t.pageNumber,hidden:!(!this.singlePageMode||t.pageNumber===this.singlePageModePage)||void 0,id:`page-${t.pageNumber}`,key:t.pageNumber,role:"region",style:{width:`${r}px`,height:`${n}px`},tabIndex:0},!s&&i("swirl-spinner",{class:"file-viewer-pdf__page-spinner"}),i("canvas",{class:"file-viewer-pdf__canvas",style:{opacity:s?"1":"0"}}),i("div",{class:"file-viewer-pdf__text-container"}))}))),t&&i("span",{key:"6c21f44b36b998d10beb38b9c758b1931c3f0bab",class:"file-viewer-pdf__pagination",id:"pagination",part:"file-viewer-pdf__pagination"},i("span",{key:"3629ad2f2da41395d4089a20174ec815ffb45c1d","aria-current":"page"},this.currentPage)," /"," ",this.doc.numPages),e&&i("div",{key:"4e41abc8439c59dcc389a6bdd47538b4592c7915",class:"file-viewer-pdf__spinner"},i("swirl-spinner",{key:"a391c38d897af60076a0d30977a2c82434a88c71"})))}get el(){return r(this)}static get watchers(){return{file:["watchProps"],viewMode:["watchViewMode"],zoom:["watchZoom"]}}};x.style=":host{position:relative;display:inline-flex;width:100%;height:100%;pointer-events:auto}:host(.file-viewer-pdf--view-mode-side-by-side) .file-viewer-pdf__pages{display:grid;grid-template-columns:repeat(2, 1fr);grid-row-gap:var(--s-space-8);grid-column-gap:var(--s-space-8);grid-auto-rows:auto}:host(.file-viewer-pdf--view-mode-side-by-side) .file-viewer-pdf__page{margin:0}:host(.file-viewer-pdf--view-mode-side-by-side) .file-viewer-pdf__page:nth-child(odd){justify-self:end}:host(.file-viewer-pdf--view-mode-side-by-side) .file-viewer-pdf__page:nth-child(even){justify-self:start}:host *{box-sizing:border-box}.file-viewer-pdf__pages{overflow:auto;width:100%;height:100%}@media (min-width: 768px){.file-viewer-pdf__pages{padding:var(--s-space-16)}}.file-viewer-pdf__page{position:relative;margin-right:auto;margin-left:auto;border-bottom:var(--s-border-width-default) solid var(--s-border-default);background-color:#fff}@media (min-width: 768px){.file-viewer-pdf__page{border:var(--s-border-width-default) solid var(--s-border-default)}.file-viewer-pdf__page:not(:last-of-type){margin-bottom:var(--s-space-8)}}.file-viewer-pdf__page-spinner{position:absolute;top:50%;left:50%;transform:translate3d(-50%, -50%, 0)}.file-viewer-pdf__canvas{display:flex;width:100%;height:100%;margin-right:auto;margin-left:auto}.file-viewer-pdf__text-container{position:absolute;overflow:hidden;line-height:1;text-align:initial;-webkit-user-select:none;-moz-user-select:none;user-select:none;inset:0;-webkit-text-size-adjust:none;-moz-text-size-adjust:none;text-size-adjust:none;forced-color-adjust:none}.file-viewer-pdf__text-container>*{position:absolute;color:transparent;white-space:pre;cursor:text;transform-origin:0% 0%}.file-viewer-pdf__text-container>*.markedContent{top:0;height:0}.file-viewer-pdf__text-container>*.highlight{margin:-1px;padding:1px;border-radius:4px;background-color:rgba(180, 0, 170, 1)}.file-viewer-pdf__text-container>*.highlight.appended{position:initial}.file-viewer-pdf__text-container>*.highlight.begin{border-radius:4px 0 0 4px}.file-viewer-pdf__text-container>*.highlight.end{border-radius:0 4px 4px 0}.file-viewer-pdf__text-container>*.highlight.middle{border-radius:0}.file-viewer-pdf__text-container>*.highlight.selected{background-color:rgba(0, 100, 0, 1)}.file-viewer-pdf__text-container>*.endOfContent{position:absolute;z-index:-1;top:100%;right:0;bottom:0;left:0;display:block;cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none}.file-viewer-pdf__text-container>*.endOfContent.active{top:0}.file-viewer-pdf__text-container>br::-moz-selection{background:transparent}.file-viewer-pdf__text-container>br::selection{background:transparent}@media (min-width: 768px){.file-viewer-pdf__text-container{-webkit-user-select:auto;-moz-user-select:auto;user-select:auto}}.file-viewer-pdf__spinner{position:absolute;display:flex;justify-content:center;align-items:center;background-color:rgba(0, 0, 0, 0.2);inset:0}.file-viewer-pdf__error{position:absolute;top:50%;left:50%;transform:translate3d(-50%, -50%, 0)}.file-viewer-pdf__pagination{position:absolute;bottom:var(--s-space-16);left:50%;padding:var(--s-space-4) var(--s-space-12);border-radius:var(--s-border-radius-base);color:var(--s-text-on-image);background-color:rgba(0, 0, 0, 0.6);font-weight:var(--s-font-weight-medium);line-height:var(--s-line-height-base);transform:translateX(-50%);pointer-events:none}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.file-viewer-pdf__pagination{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}";const T=class{constructor(i){t(this,i),this.activate=e(this,"activate",7),this.errorMessage="File could not be loaded.",this.file=void 0,this.error=void 0,this.loading=void 0,this.text=void 0}componentWillLoad(){this.updateText()}componentDidLoad(){this.activate.emit(this.el)}async updateText(){this.error=!1,this.loading=!0;try{const t=await fetch(this.file);this.text=await t.text(),this.loading=!1}catch(t){this.loading=!1,this.error=!0}}render(){return i(n,{key:"906e67ca66d8243b8ea1a9012462d2635c341b18",class:"file-viewer-text",exportparts:"file-viewer-text__text"},this.error&&i("swirl-inline-error",{key:"1adff96153d849dcf93a885f33e1d4dd7eefaa67",class:"file-viewer-text__error",message:this.errorMessage}),i("pre",{key:"5a05947f405f6452dc674782b38945570d7a2847",class:"file-viewer-text__text",part:"file-viewer-text__text",tabIndex:0},this.text),this.loading&&i("div",{key:"922c8419088bc441761226aac66d644240689d1a",class:"file-viewer-text__spinner"},i("swirl-spinner",{key:"cc183ed9ecd4582bb6c5b7c84c9a0e23bd6cc72b"})))}get el(){return r(this)}static get watchers(){return{file:["updateText"]}}};T.style=":host{position:relative;display:inline-flex;width:100%;max-height:100%;pointer-events:auto}:host *{box-sizing:border-box}.file-viewer-text__text{overflow:auto;width:100%;max-height:100%;margin:0;padding:0;padding:var(--s-space-16);background-color:var(--s-background-default);font-family:var(--s-font-family-code)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.file-viewer-text__text{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.file-viewer-text__spinner{position:absolute;display:flex;justify-content:center;align-items:center;background-color:rgba(0, 0, 0, 0.2);inset:0}.file-viewer-text__error{position:absolute;top:50%;left:50%;transform:translate3d(-50%, -50%, 0)}";const _=class{constructor(i){t(this,i),this.activate=e(this,"activate",7),this.autoplay=void 0,this.disableDownload=void 0,this.file=void 0,this.type=void 0}componentDidLoad(){this.activate.emit(this.el),this.disableDownload&&this.videoEl.setAttribute("controlsList","nodownload")}watchDisableDownload(){this.disableDownload?this.videoEl.setAttribute("controlsList","nodownload"):this.videoEl.removeAttribute("controlsList")}render(){return i(n,{key:"f8f2bef246a6df61c0e35566651ea8b348d6a9f4",class:"file-viewer-video"},i("video",{key:"51a0ac1e270cb96fa80e46a327be080989e07f25",autoplay:this.autoplay,class:"file-viewer-video__video",controls:!0,ref:t=>this.videoEl=t},i("source",{key:"86fa6c072078272c9801e33444891521043fe9c6",src:this.file,type:this.type})))}get el(){return r(this)}static get watchers(){return{disableDownload:["watchDisableDownload"]}}};_.style=":host{display:inline-flex;width:100%;max-height:100%;pointer-events:auto}:host *{box-sizing:border-box}.file-viewer-video__video{width:100%;background-color:rgba(0, 0, 0, 1)}";export{p as swirl_file_viewer,b as swirl_file_viewer_audio,g as swirl_file_viewer_csv,m as swirl_file_viewer_fallback,A as swirl_file_viewer_image,x as swirl_file_viewer_pdf,T as swirl_file_viewer_text,_ as swirl_file_viewer_video}