ai-helper-agent 2.3.1 → 2.4.0

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.
Files changed (74) hide show
  1. package/README.md +13 -3
  2. package/dist/assets/__vite-browser-external-CM3Eme-n.js +1 -0
  3. package/dist/assets/agent-store-Ce3f4Ya3.js +1 -0
  4. package/dist/assets/background.js +104 -80
  5. package/dist/assets/chat-export-BNCkL6fS.js +37 -0
  6. package/dist/assets/chunk-CMxvf4Kt.js +1 -0
  7. package/dist/assets/content.js +159 -156
  8. package/dist/assets/{dist-BQOFgIxk.js → dist-DhUTa_WT.js} +5 -6
  9. package/dist/assets/dist-LQPh1k0y.js +24 -0
  10. package/dist/assets/i18n-ouMgDZ2t.js +49 -0
  11. package/dist/assets/jszip.min-Bm_16osY.js +2 -0
  12. package/dist/assets/lib-33nIefF6.js +220 -0
  13. package/dist/assets/{marked.min.js-08SGy6CO.js → marked.min.js-D2rXgLAQ.js} +7 -8
  14. package/dist/assets/{marked.min.js-loader-4kRZ9iCP.js → marked.min.js-loader-tKH5SQVQ.js} +1 -1
  15. package/dist/assets/model-profiles-6dzdrSS4.js +24 -0
  16. package/dist/assets/network-scope-CNRYXk74.js +1 -0
  17. package/dist/assets/options-Cp1UMkjK.css +1 -0
  18. package/dist/assets/options.js +108 -102
  19. package/dist/assets/{page-snapshot-renderer-CVL6r6Kf.js → page-snapshot-renderer-j72q92KH.js} +2 -3
  20. package/dist/assets/pdf-DnVqBaAN.js +6 -0
  21. package/dist/assets/session-store-CmGs_rhh.js +76 -0
  22. package/dist/assets/side_panel.css +1 -1
  23. package/dist/assets/side_panel.js +958 -1124
  24. package/dist/assets/theme-BRAX5X2F.css +1 -0
  25. package/dist/assets/{modulepreload-polyfill-P2Xu9kJm.js → theme-CLwYsx9o.js} +1 -1
  26. package/dist/assets/utils-9i9g8vW8.js +112 -0
  27. package/dist/assets/version-t8HzLv3V.js +1 -0
  28. package/dist/assets/xlsx-DGkz7cnk.js +105 -0
  29. package/dist/manifest.json +2 -5
  30. package/dist/offscreen/offscreen.js +7 -7
  31. package/dist/options.html +151 -75
  32. package/dist/side_panel.html +167 -137
  33. package/package.json +1 -1
  34. package/src/config.js +3 -2
  35. package/src/executor.js +99 -18
  36. package/src/locales/en.json +16 -2
  37. package/src/locales/zh.json +16 -2
  38. package/src/memory/injection.js +12 -2
  39. package/src/memory/routes.js +6 -0
  40. package/src/memory/service.js +57 -2
  41. package/src/rag/manager.js +1 -1
  42. package/src/rag/url-guard.js +27 -12
  43. package/src/security.js +433 -31
  44. package/src/server.js +28 -8
  45. package/dist/assets/agent-store-DcAs6YyA.js +0 -2
  46. package/dist/assets/agent-store-DcAs6YyA.js.map +0 -1
  47. package/dist/assets/background.js.map +0 -1
  48. package/dist/assets/dist-BQOFgIxk.js.map +0 -1
  49. package/dist/assets/i18n-C4jSRoCH.js +0 -50
  50. package/dist/assets/i18n-C4jSRoCH.js.map +0 -1
  51. package/dist/assets/jszip.min-BXqW2-9v.js +0 -3
  52. package/dist/assets/jszip.min-BXqW2-9v.js.map +0 -1
  53. package/dist/assets/lib-Bi7BFuND.js +0 -221
  54. package/dist/assets/lib-Bi7BFuND.js.map +0 -1
  55. package/dist/assets/marked.min.js-08SGy6CO.js.map +0 -1
  56. package/dist/assets/model-profiles-Dl_MsXWa.js +0 -25
  57. package/dist/assets/model-profiles-Dl_MsXWa.js.map +0 -1
  58. package/dist/assets/options-8-nu3P5K.css +0 -1
  59. package/dist/assets/options.js.map +0 -1
  60. package/dist/assets/page-snapshot-renderer-CVL6r6Kf.js.map +0 -1
  61. package/dist/assets/pdf-HiJ0icvU.js +0 -7
  62. package/dist/assets/pdf-HiJ0icvU.js.map +0 -1
  63. package/dist/assets/rolldown-runtime-C0FnF6B9.js +0 -1
  64. package/dist/assets/session-store-CzVQCgQ_.js +0 -77
  65. package/dist/assets/session-store-CzVQCgQ_.js.map +0 -1
  66. package/dist/assets/side_panel.js.map +0 -1
  67. package/dist/assets/version-CNG2KGnJ.js +0 -2
  68. package/dist/assets/version-CNG2KGnJ.js.map +0 -1
  69. package/dist/assets/xlsx-BHKh7vjA.js +0 -106
  70. package/dist/assets/xlsx-BHKh7vjA.js.map +0 -1
  71. package/dist/icons/badges/license-MIT.svg +0 -21
  72. package/dist/icons/badges/platform.svg +0 -21
  73. package/dist/icons/badges/prs-welcome.svg +0 -21
  74. package/dist/icons/badges/version.svg +0 -21
@@ -1,7 +0,0 @@
1
- import{i as __require,t as __commonJSMin}from"./rolldown-runtime-C0FnF6B9.js";var require___vite_browser_external=__commonJSMin(((e,t)=>{t.exports={}})),require_pdf=__commonJSMin(((exports,module)=>{(function(e,t){typeof exports==`object`&&typeof module==`object`?module.exports=e.pdfjsLib=t():typeof define==`function`&&define.amd?define(`pdfjs-dist/build/pdf`,[],()=>e.pdfjsLib=t()):typeof exports==`object`?exports["pdfjs-dist/build/pdf"]=e.pdfjsLib=t():e[`pdfjs-dist/build/pdf`]=e.pdfjsLib=t()})(globalThis,()=>(()=>{var __webpack_modules__=[,((e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.VerbosityLevel=t.Util=t.UnknownErrorException=t.UnexpectedResponseException=t.TextRenderingMode=t.RenderingIntentFlag=t.PromiseCapability=t.PermissionFlag=t.PasswordResponses=t.PasswordException=t.PageActionEventType=t.OPS=t.MissingPDFException=t.MAX_IMAGE_SIZE_TO_CACHE=t.LINE_FACTOR=t.LINE_DESCENT_FACTOR=t.InvalidPDFException=t.ImageKind=t.IDENTITY_MATRIX=t.FormatError=t.FeatureTest=t.FONT_IDENTITY_MATRIX=t.DocumentActionEventType=t.CMapCompressionType=t.BaseException=t.BASELINE_FACTOR=t.AnnotationType=t.AnnotationReplyType=t.AnnotationPrefix=t.AnnotationMode=t.AnnotationFlag=t.AnnotationFieldFlag=t.AnnotationEditorType=t.AnnotationEditorPrefix=t.AnnotationEditorParamsType=t.AnnotationBorderStyleType=t.AnnotationActionEventType=t.AbortException=void 0,t.assert=d,t.bytesToString=C,t.createValidAbsoluteUrl=p,t.getModificationDate=z,t.getUuid=W,t.getVerbosityLevel=s,t.info=c,t.isArrayBuffer=L,t.isArrayEqual=R,t.isNodeJS=void 0,t.normalizeUnicode=U,t.objectFromMap=D,t.objectSize=E,t.setVerbosityLevel=o,t.shadow=m,t.string32=T,t.stringToBytes=w,t.stringToPDFString=P,t.stringToUTF8String=F,t.unreachable=u,t.utf8StringToString=I,t.warn=l,t.isNodeJS=typeof process==`object`&&process+``==`[object process]`&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!==`browser`),t.IDENTITY_MATRIX=[1,0,0,1,0,0],t.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0],t.MAX_IMAGE_SIZE_TO_CACHE=1e7;let n=1.35;t.LINE_FACTOR=n;let r=.35;t.LINE_DESCENT_FACTOR=r,t.BASELINE_FACTOR=r/n,t.RenderingIntentFlag={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256},t.AnnotationMode={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},t.AnnotationEditorPrefix=`pdfjs_internal_editor_`,t.AnnotationEditorType={DISABLE:-1,NONE:0,FREETEXT:3,STAMP:13,INK:15},t.AnnotationEditorParamsType={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23},t.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},t.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},t.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},t.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},t.AnnotationReplyType={GROUP:`Group`,REPLY:`R`},t.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512},t.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},t.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},t.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`},t.DocumentActionEventType={WC:`WillClose`,WS:`WillSave`,DS:`DidSave`,WP:`WillPrint`,DP:`DidPrint`},t.PageActionEventType={O:`PageOpen`,C:`PageClose`};let i={ERRORS:0,WARNINGS:1,INFOS:5};t.VerbosityLevel=i,t.CMapCompressionType={NONE:0,BINARY:1},t.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,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91},t.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let a=i.WARNINGS;function o(e){Number.isInteger(e)&&(a=e)}function s(){return a}function c(e){a>=i.INFOS&&console.log(`Info: ${e}`)}function l(e){a>=i.WARNINGS&&console.log(`Warning: ${e}`)}function u(e){throw Error(e)}function d(e,t){e||u(t)}function f(e){switch(e?.protocol){case`http:`:case`https:`:case`ftp:`:case`mailto:`:case`tel:`:return!0;default:return!1}}function p(e,t=null,n=null){if(!e)return null;try{if(n&&typeof e==`string`&&(n.addDefaultProtocol&&e.startsWith(`www.`)&&e.match(/\./g)?.length>=2&&(e=`http://${e}`),n.tryConvertEncoding))try{e=F(e)}catch{}let r=t?new URL(e,t):new URL(e);if(f(r))return r}catch{}return null}function m(e,t,n,r=!1){return Object.defineProperty(e,t,{value:n,enumerable:!r,configurable:!0,writable:!1}),n}let h=function(){function e(t,n){this.constructor===e&&u(`Cannot initialize BaseException.`),this.message=t,this.name=n}return e.prototype=Error(),e.constructor=e,e}();t.BaseException=h;class g extends h{constructor(e,t){super(e,`PasswordException`),this.code=t}}t.PasswordException=g;class _ extends h{constructor(e,t){super(e,`UnknownErrorException`),this.details=t}}t.UnknownErrorException=_;class v extends h{constructor(e){super(e,`InvalidPDFException`)}}t.InvalidPDFException=v;class y extends h{constructor(e){super(e,`MissingPDFException`)}}t.MissingPDFException=y;class b extends h{constructor(e,t){super(e,`UnexpectedResponseException`),this.status=t}}t.UnexpectedResponseException=b;class x extends h{constructor(e){super(e,`FormatError`)}}t.FormatError=x;class S extends h{constructor(e){super(e,`AbortException`)}}t.AbortException=S;function C(e){(typeof e!=`object`||e?.length===void 0)&&u(`Invalid argument for bytesToString`);let t=e.length,n=8192;if(t<n)return String.fromCharCode.apply(null,e);let r=[];for(let i=0;i<t;i+=n){let a=Math.min(i+n,t),o=e.subarray(i,a);r.push(String.fromCharCode.apply(null,o))}return r.join(``)}function w(e){typeof e!=`string`&&u(`Invalid argument for stringToBytes`);let t=e.length,n=new Uint8Array(t);for(let r=0;r<t;++r)n[r]=e.charCodeAt(r)&255;return n}function T(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,e&255)}function E(e){return Object.keys(e).length}function D(e){let t=Object.create(null);for(let[n,r]of e)t[n]=r;return t}function O(){let e=new Uint8Array(4);return e[0]=1,new Uint32Array(e.buffer,0,1)[0]===1}function k(){try{return Function(``),!0}catch{return!1}}class A{static get isLittleEndian(){return m(this,`isLittleEndian`,O())}static get isEvalSupported(){return m(this,`isEvalSupported`,k())}static get isOffscreenCanvasSupported(){return m(this,`isOffscreenCanvasSupported`,typeof OffscreenCanvas<`u`)}static get platform(){return typeof navigator>`u`?m(this,`platform`,{isWin:!1,isMac:!1}):m(this,`platform`,{isWin:navigator.platform.includes(`Win`),isMac:navigator.platform.includes(`Mac`)})}static get isCSSRoundSupported(){return m(this,`isCSSRoundSupported`,globalThis.CSS?.supports?.(`width: round(1.5px, 1px)`))}}t.FeatureTest=A;let j=[...Array(256).keys()].map(e=>e.toString(16).padStart(2,`0`));class M{static makeHexColor(e,t,n){return`#${j[e]}${j[t]}${j[n]}`}static scaleMinMax(e,t){let n;e[0]?(e[0]<0&&(n=t[0],t[0]=t[1],t[1]=n),t[0]*=e[0],t[1]*=e[0],e[3]<0&&(n=t[2],t[2]=t[3],t[3]=n),t[2]*=e[3],t[3]*=e[3]):(n=t[0],t[0]=t[2],t[2]=n,n=t[1],t[1]=t[3],t[3]=n,e[1]<0&&(n=t[2],t[2]=t[3],t[3]=n),t[2]*=e[1],t[3]*=e[1],e[2]<0&&(n=t[0],t[0]=t[1],t[1]=n),t[0]*=e[2],t[1]*=e[2]),t[0]+=e[4],t[1]+=e[4],t[2]+=e[5],t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]}static applyInverseTransform(e,t){let n=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/n,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/n]}static getAxialAlignedBoundingBox(e,t){let n=this.applyTransform(e,t),r=this.applyTransform(e.slice(2,4),t),i=this.applyTransform([e[0],e[3]],t),a=this.applyTransform([e[2],e[1]],t);return[Math.min(n[0],r[0],i[0],a[0]),Math.min(n[1],r[1],i[1],a[1]),Math.max(n[0],r[0],i[0],a[0]),Math.max(n[1],r[1],i[1],a[1])]}static inverseTransform(e){let t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static singularValueDecompose2dScale(e){let t=[e[0],e[2],e[1],e[3]],n=e[0]*t[0]+e[1]*t[2],r=e[0]*t[1]+e[1]*t[3],i=e[2]*t[0]+e[3]*t[2],a=e[2]*t[1]+e[3]*t[3],o=(n+a)/2,s=Math.sqrt((n+a)**2-4*(n*a-i*r))/2,c=o+s||1,l=o-s||1;return[Math.sqrt(c),Math.sqrt(l)]}static normalizeRect(e){let t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){let n=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),r=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(n>r)return null;let i=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),a=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return i>a?null:[n,i,r,a]}static bezierBoundingBox(e,t,n,r,i,a,o,s){let c=[],l=[[],[]],u,d,f,p,m,h,g,_;for(let l=0;l<2;++l){if(l===0?(d=6*e-12*n+6*i,u=-3*e+9*n-9*i+3*o,f=3*n-3*e):(d=6*t-12*r+6*a,u=-3*t+9*r-9*a+3*s,f=3*r-3*t),Math.abs(u)<1e-12){if(Math.abs(d)<1e-12)continue;p=-f/d,0<p&&p<1&&c.push(p);continue}g=d*d-4*f*u,_=Math.sqrt(g),!(g<0)&&(m=(-d+_)/(2*u),0<m&&m<1&&c.push(m),h=(-d-_)/(2*u),0<h&&h<1&&c.push(h))}let v=c.length,y,b=v;for(;v--;)p=c[v],y=1-p,l[0][v]=y*y*y*e+3*y*y*p*n+3*y*p*p*i+p*p*p*o,l[1][v]=y*y*y*t+3*y*y*p*r+3*y*p*p*a+p*p*p*s;return l[0][b]=e,l[1][b]=t,l[0][b+1]=o,l[1][b+1]=s,l[0].length=l[1].length=b+2,[Math.min(...l[0]),Math.min(...l[1]),Math.max(...l[0]),Math.max(...l[1])]}}t.Util=M;let N=[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 P(e){if(e[0]>=`ï`){let t;if(e[0]===`þ`&&e[1]===`ÿ`?t=`utf-16be`:e[0]===`ÿ`&&e[1]===`þ`?t=`utf-16le`:e[0]===`ï`&&e[1]===`»`&&e[2]===`¿`&&(t=`utf-8`),t)try{let n=new TextDecoder(t,{fatal:!0}),r=w(e);return n.decode(r)}catch(e){l(`stringToPDFString: "${e}".`)}}let t=[];for(let n=0,r=e.length;n<r;n++){let r=N[e.charCodeAt(n)];t.push(r?String.fromCharCode(r):e.charAt(n))}return t.join(``)}function F(e){return decodeURIComponent(escape(e))}function I(e){return unescape(encodeURIComponent(e))}function L(e){return typeof e==`object`&&e?.byteLength!==void 0}function R(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}function z(e=new Date){return[e.getUTCFullYear().toString(),(e.getUTCMonth()+1).toString().padStart(2,`0`),e.getUTCDate().toString().padStart(2,`0`),e.getUTCHours().toString().padStart(2,`0`),e.getUTCMinutes().toString().padStart(2,`0`),e.getUTCSeconds().toString().padStart(2,`0`)].join(``)}class B{#e=!1;constructor(){this.promise=new Promise((e,t)=>{this.resolve=t=>{this.#e=!0,e(t)},this.reject=e=>{this.#e=!0,t(e)}})}get settled(){return this.#e}}t.PromiseCapability=B;let V=null,H=null;function U(e){return V||(V=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,H=new Map([[`ſt`,`ſt`]])),e.replaceAll(V,(e,t,n)=>t?t.normalize(`NFKC`):H.get(n))}function W(){if(typeof crypto<`u`&&typeof crypto?.randomUUID==`function`)return crypto.randomUUID();let e=new Uint8Array(32);if(typeof crypto<`u`&&typeof crypto?.getRandomValues==`function`)crypto.getRandomValues(e);else for(let t=0;t<32;t++)e[t]=Math.floor(Math.random()*255);return C(e)}t.AnnotationPrefix=`pdfjs_internal_id_`}),((__unused_webpack_module,exports$2,__w_pdfjs_require__)=>{Object.defineProperty(exports$2,"__esModule",{value:!0}),exports$2.RenderTask=exports$2.PDFWorkerUtil=exports$2.PDFWorker=exports$2.PDFPageProxy=exports$2.PDFDocumentProxy=exports$2.PDFDocumentLoadingTask=exports$2.PDFDataRangeTransport=exports$2.LoopbackPort=exports$2.DefaultStandardFontDataFactory=exports$2.DefaultFilterFactory=exports$2.DefaultCanvasFactory=exports$2.DefaultCMapReaderFactory=void 0,Object.defineProperty(exports$2,"SVGGraphics",{enumerable:!0,get:function(){return _displaySvg.SVGGraphics}}),exports$2.build=void 0,exports$2.getDocument=getDocument,exports$2.version=void 0;var _util=__w_pdfjs_require__(1),_annotation_storage=__w_pdfjs_require__(3),_display_utils=__w_pdfjs_require__(6),_font_loader=__w_pdfjs_require__(9),_displayNode_utils=__w_pdfjs_require__(10),_canvas=__w_pdfjs_require__(11),_worker_options=__w_pdfjs_require__(14),_message_handler=__w_pdfjs_require__(15),_metadata=__w_pdfjs_require__(16),_optional_content_config=__w_pdfjs_require__(17),_transport_stream=__w_pdfjs_require__(18),_displayFetch_stream=__w_pdfjs_require__(19),_displayNetwork=__w_pdfjs_require__(22),_displayNode_stream=__w_pdfjs_require__(23),_displaySvg=__w_pdfjs_require__(24),_xfa_text=__w_pdfjs_require__(25);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100,DELAYED_CLEANUP_TIMEOUT=5e3,DefaultCanvasFactory=_util.isNodeJS?_displayNode_utils.NodeCanvasFactory:_display_utils.DOMCanvasFactory;exports$2.DefaultCanvasFactory=DefaultCanvasFactory;const DefaultCMapReaderFactory=_util.isNodeJS?_displayNode_utils.NodeCMapReaderFactory:_display_utils.DOMCMapReaderFactory;exports$2.DefaultCMapReaderFactory=DefaultCMapReaderFactory;const DefaultFilterFactory=_util.isNodeJS?_displayNode_utils.NodeFilterFactory:_display_utils.DOMFilterFactory;exports$2.DefaultFilterFactory=DefaultFilterFactory;const DefaultStandardFontDataFactory=_util.isNodeJS?_displayNode_utils.NodeStandardFontDataFactory:_display_utils.DOMStandardFontDataFactory;exports$2.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory;function getDocument(e){if(typeof e==`string`||e instanceof URL?e={url:e}:(0,_util.isArrayBuffer)(e)&&(e={data:e}),typeof e!=`object`)throw Error(`Invalid parameter in getDocument, need parameter object.`);if(!e.url&&!e.data&&!e.range)throw Error(`Invalid parameter object: need either .data, .range or .url`);let t=new PDFDocumentLoadingTask,{docId:n}=t,r=e.url?getUrlProp(e.url):null,i=e.data?getDataProp(e.data):null,a=e.httpHeaders||null,o=e.withCredentials===!0,s=e.password??null,c=e.range instanceof PDFDataRangeTransport?e.range:null,l=Number.isInteger(e.rangeChunkSize)&&e.rangeChunkSize>0?e.rangeChunkSize:DEFAULT_RANGE_CHUNK_SIZE,u=e.worker instanceof PDFWorker?e.worker:null,d=e.verbosity,f=typeof e.docBaseUrl==`string`&&!(0,_display_utils.isDataScheme)(e.docBaseUrl)?e.docBaseUrl:null,p=typeof e.cMapUrl==`string`?e.cMapUrl:null,m=e.cMapPacked!==!1,h=e.CMapReaderFactory||DefaultCMapReaderFactory,g=typeof e.standardFontDataUrl==`string`?e.standardFontDataUrl:null,_=e.StandardFontDataFactory||DefaultStandardFontDataFactory,v=e.stopAtErrors!==!0,y=Number.isInteger(e.maxImageSize)&&e.maxImageSize>-1?e.maxImageSize:-1,b=e.isEvalSupported!==!1,x=typeof e.isOffscreenCanvasSupported==`boolean`?e.isOffscreenCanvasSupported:!_util.isNodeJS,S=Number.isInteger(e.canvasMaxAreaInBytes)?e.canvasMaxAreaInBytes:-1,C=typeof e.disableFontFace==`boolean`?e.disableFontFace:_util.isNodeJS,w=e.fontExtraProperties===!0,T=e.enableXfa===!0,E=e.ownerDocument||globalThis.document,D=e.disableRange===!0,O=e.disableStream===!0,k=e.disableAutoFetch===!0,A=e.pdfBug===!0,j=c?c.length:e.length??NaN,M=typeof e.useSystemFonts==`boolean`?e.useSystemFonts:!_util.isNodeJS&&!C,N=typeof e.useWorkerFetch==`boolean`?e.useWorkerFetch:h===_display_utils.DOMCMapReaderFactory&&_===_display_utils.DOMStandardFontDataFactory&&p&&g&&(0,_display_utils.isValidFetchUrl)(p,document.baseURI)&&(0,_display_utils.isValidFetchUrl)(g,document.baseURI),P=e.canvasFactory||new DefaultCanvasFactory({ownerDocument:E}),F=e.filterFactory||new DefaultFilterFactory({docId:n,ownerDocument:E}),I=null;(0,_util.setVerbosityLevel)(d);let L={canvasFactory:P,filterFactory:F};if(N||(L.cMapReaderFactory=new h({baseUrl:p,isCompressed:m}),L.standardFontDataFactory=new _({baseUrl:g})),!u){let e={verbosity:d,port:_worker_options.GlobalWorkerOptions.workerPort};u=e.port?PDFWorker.fromPort(e):new PDFWorker(e),t._worker=u}let R={docId:n,apiVersion:`3.11.174`,data:i,password:s,disableAutoFetch:k,rangeChunkSize:l,length:j,docBaseUrl:f,enableXfa:T,evaluatorOptions:{maxImageSize:y,disableFontFace:C,ignoreErrors:v,isEvalSupported:b,isOffscreenCanvasSupported:x,canvasMaxAreaInBytes:S,fontExtraProperties:w,useSystemFonts:M,cMapUrl:N?p:null,standardFontDataUrl:N?g:null}},z={ignoreErrors:v,isEvalSupported:b,disableFontFace:C,fontExtraProperties:w,enableXfa:T,ownerDocument:E,disableAutoFetch:k,pdfBug:A,styleElement:null};return u.promise.then(function(){if(t.destroyed)throw Error(`Loading aborted`);let e=_fetchDocument(u,R),s=new Promise(function(e){let t;c?t=new _transport_stream.PDFDataTransportStream({length:j,initialData:c.initialData,progressiveDone:c.progressiveDone,contentDispositionFilename:c.contentDispositionFilename,disableRange:D,disableStream:O},c):i||(t=(e=>_util.isNodeJS?new _displayNode_stream.PDFNodeStream(e):(0,_display_utils.isValidFetchUrl)(e.url)?new _displayFetch_stream.PDFFetchStream(e):new _displayNetwork.PDFNetworkStream(e))({url:r,length:j,httpHeaders:a,withCredentials:o,rangeChunkSize:l,disableRange:D,disableStream:O})),e(t)});return Promise.all([e,s]).then(function([e,r]){if(t.destroyed)throw Error(`Loading aborted`);let i=new _message_handler.MessageHandler(n,e,u.port),a=new WorkerTransport(i,t,r,z,L);t._transport=a,i.send(`Ready`,null)})}).catch(t._capability.reject),t}async function _fetchDocument(e,t){if(e.destroyed)throw Error(`Worker was destroyed`);let n=await e.messageHandler.sendWithPromise(`GetDocRequest`,t,t.data?[t.data.buffer]:null);if(e.destroyed)throw Error(`Worker was destroyed`);return n}function getUrlProp(e){if(e instanceof URL)return e.href;try{return new URL(e,window.location).href}catch{if(_util.isNodeJS&&typeof e==`string`)return e}throw Error(`Invalid PDF url data: either string or URL-object is expected in the url property.`)}function getDataProp(e){if(_util.isNodeJS&&typeof Buffer<`u`&&e instanceof Buffer)throw Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength)return e;if(typeof e==`string`)return(0,_util.stringToBytes)(e);if(typeof e==`object`&&!isNaN(e?.length)||(0,_util.isArrayBuffer)(e))return new Uint8Array(e);throw Error(`Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.`)}class PDFDocumentLoadingTask{static#e=0;constructor(){this._capability=new _util.PromiseCapability,this._transport=null,this._worker=null,this.docId=`d${PDFDocumentLoadingTask.#e++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._transport?.destroy()}catch(e){throw this._worker?.port&&delete this._worker._pendingDestroy,e}this._transport=null,this._worker&&=(this._worker.destroy(),null)}}exports$2.PDFDocumentLoadingTask=PDFDocumentLoadingTask;class PDFDataRangeTransport{constructor(e,t,n=!1,r=null){this.length=e,this.initialData=t,this.progressiveDone=n,this.contentDispositionFilename=r,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=new _util.PromiseCapability}addRangeListener(e){this._rangeListeners.push(e)}addProgressListener(e){this._progressListeners.push(e)}addProgressiveReadListener(e){this._progressiveReadListeners.push(e)}addProgressiveDoneListener(e){this._progressiveDoneListeners.push(e)}onDataRange(e,t){for(let n of this._rangeListeners)n(e,t)}onDataProgress(e,t){this._readyCapability.promise.then(()=>{for(let n of this._progressListeners)n(e,t)})}onDataProgressiveRead(e){this._readyCapability.promise.then(()=>{for(let t of this._progressiveReadListeners)t(e)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(let e of this._progressiveDoneListeners)e()})}transportReady(){this._readyCapability.resolve()}requestDataRange(e,t){(0,_util.unreachable)(`Abstract method PDFDataRangeTransport.requestDataRange`)}abort(){}}exports$2.PDFDataRangeTransport=PDFDataRangeTransport;class PDFDocumentProxy{constructor(e,t){this._pdfInfo=e,this._transport=t,Object.defineProperty(this,"getJavaScript",{value:()=>((0,_display_utils.deprecated)("`PDFDocumentProxy.getJavaScript`, please use `PDFDocumentProxy.getJSActions` instead."),this.getJSActions().then(e=>{if(!e)return e;let t=[];for(let n in e)t.push(...e[n]);return t}))})}get annotationStorage(){return this._transport.annotationStorage}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return(0,_util.shadow)(this,`isPureXfa`,!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){return this._transport.getOptionalContentConfig()}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}exports$2.PDFDocumentProxy=PDFDocumentProxy;class PDFPageProxy{#e=null;#t=!1;constructor(e,t,n,r=!1){this._pageIndex=e,this._pageInfo=t,this._transport=n,this._stats=r?new _display_utils.StatTimer:null,this._pdfBug=r,this.commonObjs=n.commonObjs,this.objs=new PDFObjects,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:e,rotation:t=this.rotate,offsetX:n=0,offsetY:r=0,dontFlip:i=!1}={}){return new _display_utils.PageViewport({viewBox:this.view,scale:e,rotation:t,offsetX:n,offsetY:r,dontFlip:i})}getAnnotations({intent:e=`display`}={}){let t=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,t.renderingIntent)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return(0,_util.shadow)(this,`isPureXfa`,!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:e,viewport:t,intent:n=`display`,annotationMode:r=_util.AnnotationMode.ENABLE,transform:i=null,background:a=null,optionalContentConfigPromise:o=null,annotationCanvasMap:s=null,pageColors:c=null,printAnnotationStorage:l=null}){this._stats?.time(`Overall`);let u=this._transport.getRenderingIntent(n,r,l);this.#t=!1,this.#r(),o||=this._transport.getOptionalContentConfig();let d=this._intentStates.get(u.cacheKey);d||(d=Object.create(null),this._intentStates.set(u.cacheKey,d)),d.streamReaderCancelTimeout&&(clearTimeout(d.streamReaderCancelTimeout),d.streamReaderCancelTimeout=null);let f=!!(u.renderingIntent&_util.RenderingIntentFlag.PRINT);d.displayReadyCapability||(d.displayReadyCapability=new _util.PromiseCapability,d.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time(`Page Request`),this._pumpOperatorList(u));let p=e=>{d.renderTasks.delete(m),(this._maybeCleanupAfterRender||f)&&(this.#t=!0),this.#n(!f),e?(m.capability.reject(e),this._abortOperatorList({intentState:d,reason:e instanceof Error?e:Error(e)})):m.capability.resolve(),this._stats?.timeEnd(`Rendering`),this._stats?.timeEnd(`Overall`)},m=new InternalRenderTask({callback:p,params:{canvasContext:e,viewport:t,transform:i,background:a},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:s,operatorList:d.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!f,pdfBug:this._pdfBug,pageColors:c});(d.renderTasks||=new Set).add(m);let h=m.task;return Promise.all([d.displayReadyCapability.promise,o]).then(([e,t])=>{if(this.destroyed){p();return}this._stats?.time(`Rendering`),m.initializeGraphics({transparency:e,optionalContentConfig:t}),m.operatorListChanged()}).catch(p),h}getOperatorList({intent:e=`display`,annotationMode:t=_util.AnnotationMode.ENABLE,printAnnotationStorage:n=null}={}){function r(){a.operatorList.lastChunk&&(a.opListReadCapability.resolve(a.operatorList),a.renderTasks.delete(o))}let i=this._transport.getRenderingIntent(e,t,n,!0),a=this._intentStates.get(i.cacheKey);a||(a=Object.create(null),this._intentStates.set(i.cacheKey,a));let o;return a.opListReadCapability||(o=Object.create(null),o.operatorListChanged=r,a.opListReadCapability=new _util.PromiseCapability,(a.renderTasks||=new Set).add(o),a.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time(`Page Request`),this._pumpOperatorList(i)),a.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:t=!1}={}){return this._transport.messageHandler.sendWithStream(`GetTextContent`,{pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:t===!0},{highWaterMark:100,size(e){return e.items.length}})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(e=>_xfa_text.XfaText.textContent(e));let t=this.streamTextContent(e);return new Promise(function(e,n){function r(){i.read().then(function({value:t,done:n}){if(n){e(a);return}Object.assign(a.styles,t.styles),a.items.push(...t.items),r()},n)}let i=t.getReader(),a={items:[],styles:Object.create(null)};r()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let e=[];for(let t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:Error(`Page was destroyed.`),force:!0}),!t.opListReadCapability)for(let n of t.renderTasks)e.push(n.completed),n.cancel();return this.objs.clear(),this.#t=!1,this.#r(),Promise.all(e)}cleanup(e=!1){this.#t=!0;let t=this.#n(!1);return e&&t&&(this._stats&&=new _display_utils.StatTimer),t}#n(e=!1){if(this.#r(),!this.#t||this.destroyed)return!1;if(e)return this.#e=setTimeout(()=>{this.#e=null,this.#n(!1)},DELAYED_CLEANUP_TIMEOUT),!1;for(let{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#t=!1,!0}#r(){this.#e&&=(clearTimeout(this.#e),null)}_startRenderPage(e,t){let n=this._intentStates.get(t);n&&(this._stats?.timeEnd(`Page Request`),n.displayReadyCapability?.resolve(e))}_renderPageChunk(e,t){for(let n=0,r=e.length;n<r;n++)t.operatorList.fnArray.push(e.fnArray[n]),t.operatorList.argsArray.push(e.argsArray[n]);t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots;for(let e of t.renderTasks)e.operatorListChanged();e.lastChunk&&this.#n(!0)}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageSerializable:n}){let{map:r,transfers:i}=n,a=this._transport.messageHandler.sendWithStream(`GetOperatorList`,{pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:r},i).getReader(),o=this._intentStates.get(t);o.streamReader=a;let s=()=>{a.read().then(({value:e,done:t})=>{if(t){o.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(e,o),s())},e=>{if(o.streamReader=null,!this._transport.destroyed){if(o.operatorList){o.operatorList.lastChunk=!0;for(let e of o.renderTasks)e.operatorListChanged();this.#n(!0)}if(o.displayReadyCapability)o.displayReadyCapability.reject(e);else if(o.opListReadCapability)o.opListReadCapability.reject(e);else throw e}})};s()}_abortOperatorList({intentState:e,reason:t,force:n=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&=(clearTimeout(e.streamReaderCancelTimeout),null),!n){if(e.renderTasks.size>0)return;if(t instanceof _display_utils.RenderingCancelledException){let n=RENDERING_CANCELLED_TIMEOUT;t.extraDelay>0&&t.extraDelay<1e3&&(n+=t.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:t,force:!0})},n);return}}if(e.streamReader.cancel(new _util.AbortException(t.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(let[t,n]of this._intentStates)if(n===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}}exports$2.PDFPageProxy=PDFPageProxy;class LoopbackPort{#e=new Set;#t=Promise.resolve();postMessage(e,t){let n={data:structuredClone(e,t?{transfer:t}:null)};this.#t.then(()=>{for(let e of this.#e)e.call(this,n)})}addEventListener(e,t){this.#e.add(t)}removeEventListener(e,t){this.#e.delete(t)}terminate(){this.#e.clear()}}exports$2.LoopbackPort=LoopbackPort;const PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};if(exports$2.PDFWorkerUtil=PDFWorkerUtil,_util.isNodeJS&&typeof __require==`function`)PDFWorkerUtil.isWorkerDisabled=!0,PDFWorkerUtil.fallbackWorkerSrc=`./pdf.worker.js`;else if(typeof document==`object`){let e=document?.currentScript?.src;e&&(PDFWorkerUtil.fallbackWorkerSrc=e.replace(/(\.(?:min\.)?js)(\?.*)?$/i,`.worker$1$2`))}PDFWorkerUtil.isSameOrigin=function(e,t){let n;try{if(n=new URL(e),!n.origin||n.origin===`null`)return!1}catch{return!1}let r=new URL(t,n);return n.origin===r.origin},PDFWorkerUtil.createCDNWrapper=function(e){let t=`importScripts("${e}");`;return URL.createObjectURL(new Blob([t]))};class PDFWorker{static#e;constructor({name:e=null,port:t=null,verbosity:n=(0,_util.getVerbosityLevel)()}={}){if(this.name=e,this.destroyed=!1,this.verbosity=n,this._readyCapability=new _util.PromiseCapability,this._port=null,this._webWorker=null,this._messageHandler=null,t){if(PDFWorker.#e?.has(t))throw Error(`Cannot use more than one PDFWorker per port.`);(PDFWorker.#e||=new WeakMap).set(t,this),this._initializeFromPort(t);return}this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(e){this._port=e,this._messageHandler=new _message_handler.MessageHandler(`main`,`worker`,e),this._messageHandler.on(`ready`,function(){}),this._readyCapability.resolve(),this._messageHandler.send(`configure`,{verbosity:this.verbosity})}_initialize(){if(!PDFWorkerUtil.isWorkerDisabled&&!PDFWorker._mainThreadWorkerMessageHandler){let{workerSrc:e}=PDFWorker;try{PDFWorkerUtil.isSameOrigin(window.location.href,e)||(e=PDFWorkerUtil.createCDNWrapper(new URL(e,window.location).href));let t=new Worker(e),n=new _message_handler.MessageHandler(`main`,`worker`,t),r=()=>{t.removeEventListener(`error`,i),n.destroy(),t.terminate(),this.destroyed?this._readyCapability.reject(Error(`Worker was destroyed`)):this._setupFakeWorker()},i=()=>{this._webWorker||r()};t.addEventListener(`error`,i),n.on(`test`,e=>{if(t.removeEventListener(`error`,i),this.destroyed){r();return}e?(this._messageHandler=n,this._port=t,this._webWorker=t,this._readyCapability.resolve(),n.send(`configure`,{verbosity:this.verbosity})):(this._setupFakeWorker(),n.destroy(),t.terminate())}),n.on(`ready`,e=>{if(t.removeEventListener(`error`,i),this.destroyed){r();return}try{a()}catch{this._setupFakeWorker()}});let a=()=>{let e=new Uint8Array;n.send(`test`,e,[e.buffer])};a();return}catch{(0,_util.info)(`The worker has been disabled.`)}}this._setupFakeWorker()}_setupFakeWorker(){PDFWorkerUtil.isWorkerDisabled||=((0,_util.warn)(`Setting up fake worker.`),!0),PDFWorker._setupFakeWorkerGlobal.then(e=>{if(this.destroyed){this._readyCapability.reject(Error(`Worker was destroyed`));return}let t=new LoopbackPort;this._port=t;let n=`fake${PDFWorkerUtil.fakeWorkerId++}`,r=new _message_handler.MessageHandler(n+`_worker`,n,t);e.setup(r,t);let i=new _message_handler.MessageHandler(n,n+`_worker`,t);this._messageHandler=i,this._readyCapability.resolve(),i.send(`configure`,{verbosity:this.verbosity})}).catch(e=>{this._readyCapability.reject(Error(`Setting up fake worker failed: "${e.message}".`))})}destroy(){this.destroyed=!0,this._webWorker&&=(this._webWorker.terminate(),null),PDFWorker.#e?.delete(this._port),this._port=null,this._messageHandler&&=(this._messageHandler.destroy(),null)}static fromPort(e){if(!e?.port)throw Error(`PDFWorker.fromPort - invalid method signature.`);let t=this.#e?.get(e.port);if(t){if(t._pendingDestroy)throw Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return t}return new PDFWorker(e)}static get workerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(PDFWorkerUtil.fallbackWorkerSrc!==null)return _util.isNodeJS||(0,_display_utils.deprecated)(`No "GlobalWorkerOptions.workerSrc" specified.`),PDFWorkerUtil.fallbackWorkerSrc;throw Error(`No "GlobalWorkerOptions.workerSrc" specified.`)}static get _mainThreadWorkerMessageHandler(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){const loader=async()=>{const mainWorkerMessageHandler=this._mainThreadWorkerMessageHandler;if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_util.isNodeJS&&typeof __require==`function`){const worker=eval(`require`)(this.workerSrc);return worker.WorkerMessageHandler}return await(0,_display_utils.loadScript)(this.workerSrc),window.pdfjsWorker.WorkerMessageHandler};return(0,_util.shadow)(this,`_setupFakeWorkerGlobal`,loader())}}exports$2.PDFWorker=PDFWorker;class WorkerTransport{#e=new Map;#t=new Map;#n=new Map;#r=null;constructor(e,t,n,r,i){this.messageHandler=e,this.loadingTask=t,this.commonObjs=new PDFObjects,this.fontLoader=new _font_loader.FontLoader({ownerDocument:r.ownerDocument,styleElement:r.styleElement}),this._params=r,this.canvasFactory=i.canvasFactory,this.filterFactory=i.filterFactory,this.cMapReaderFactory=i.cMapReaderFactory,this.standardFontDataFactory=i.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=n,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=new _util.PromiseCapability,this.setupMessageHandler()}#i(e,t=null){let n=this.#e.get(e);if(n)return n;let r=this.messageHandler.sendWithPromise(e,t);return this.#e.set(e,r),r}get annotationStorage(){return(0,_util.shadow)(this,`annotationStorage`,new _annotation_storage.AnnotationStorage)}getRenderingIntent(e,t=_util.AnnotationMode.ENABLE,n=null,r=!1){let i=_util.RenderingIntentFlag.DISPLAY,a=_annotation_storage.SerializableEmpty;switch(e){case`any`:i=_util.RenderingIntentFlag.ANY;break;case`display`:break;case`print`:i=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${e}`)}switch(t){case _util.AnnotationMode.DISABLE:i+=_util.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case _util.AnnotationMode.ENABLE:break;case _util.AnnotationMode.ENABLE_FORMS:i+=_util.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case _util.AnnotationMode.ENABLE_STORAGE:i+=_util.RenderingIntentFlag.ANNOTATIONS_STORAGE,a=(i&_util.RenderingIntentFlag.PRINT&&n instanceof _annotation_storage.PrintAnnotationStorage?n:this.annotationStorage).serializable;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${t}`)}return r&&(i+=_util.RenderingIntentFlag.OPLIST),{renderingIntent:i,cacheKey:`${i}_${a.hash}`,annotationStorageSerializable:a}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=new _util.PromiseCapability,this.#r?.reject(Error(`Worker was destroyed during onPassword callback`));let e=[];for(let t of this.#t.values())e.push(t._destroy());this.#t.clear(),this.#n.clear(),this.hasOwnProperty(`annotationStorage`)&&this.annotationStorage.resetModified();let t=this.messageHandler.sendWithPromise(`Terminate`,null);return e.push(t),Promise.all(e).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(),this._networkStream?.cancelAllRequests(new _util.AbortException(`Worker was terminated.`)),this.messageHandler&&=(this.messageHandler.destroy(),null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){let{messageHandler:e,loadingTask:t}=this;e.on(`GetReader`,(e,t)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=e=>{this._lastProgress={loaded:e.loaded,total:e.total}},t.onPull=()=>{this._fullReader.read().then(function({value:e,done:n}){if(n){t.close();return}(0,_util.assert)(e instanceof ArrayBuffer,`GetReader - expected an ArrayBuffer.`),t.enqueue(new Uint8Array(e),1,[e])}).catch(e=>{t.error(e)})},t.onCancel=e=>{this._fullReader.cancel(e),t.ready.catch(e=>{if(!this.destroyed)throw e})}}),e.on(`ReaderHeadersReady`,e=>{let n=new _util.PromiseCapability,r=this._fullReader;return r.headersReady.then(()=>{(!r.isStreamingSupported||!r.isRangeSupported)&&(this._lastProgress&&t.onProgress?.(this._lastProgress),r.onProgress=e=>{t.onProgress?.({loaded:e.loaded,total:e.total})}),n.resolve({isStreamingSupported:r.isStreamingSupported,isRangeSupported:r.isRangeSupported,contentLength:r.contentLength})},n.reject),n.promise}),e.on(`GetRangeReader`,(e,t)=>{(0,_util.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");let n=this._networkStream.getRangeReader(e.begin,e.end);if(!n){t.close();return}t.onPull=()=>{n.read().then(function({value:e,done:n}){if(n){t.close();return}(0,_util.assert)(e instanceof ArrayBuffer,`GetRangeReader - expected an ArrayBuffer.`),t.enqueue(new Uint8Array(e),1,[e])}).catch(e=>{t.error(e)})},t.onCancel=e=>{n.cancel(e),t.ready.catch(e=>{if(!this.destroyed)throw e})}}),e.on(`GetDoc`,({pdfInfo:e})=>{this._numPages=e.numPages,this._htmlForXfa=e.htmlForXfa,delete e.htmlForXfa,t._capability.resolve(new PDFDocumentProxy(e,this))}),e.on(`DocException`,function(e){let n;switch(e.name){case`PasswordException`:n=new _util.PasswordException(e.message,e.code);break;case`InvalidPDFException`:n=new _util.InvalidPDFException(e.message);break;case`MissingPDFException`:n=new _util.MissingPDFException(e.message);break;case`UnexpectedResponseException`:n=new _util.UnexpectedResponseException(e.message,e.status);break;case`UnknownErrorException`:n=new _util.UnknownErrorException(e.message,e.details);break;default:(0,_util.unreachable)(`DocException - expected a valid Error.`)}t._capability.reject(n)}),e.on(`PasswordRequest`,e=>{if(this.#r=new _util.PromiseCapability,t.onPassword){let n=e=>{e instanceof Error?this.#r.reject(e):this.#r.resolve({password:e})};try{t.onPassword(n,e.code)}catch(e){this.#r.reject(e)}}else this.#r.reject(new _util.PasswordException(e.message,e.code));return this.#r.promise}),e.on(`DataLoaded`,e=>{t.onProgress?.({loaded:e.length,total:e.length}),this.downloadInfoCapability.resolve(e)}),e.on(`StartRenderPage`,e=>{this.destroyed||this.#t.get(e.pageIndex)._startRenderPage(e.transparency,e.cacheKey)}),e.on(`commonobj`,([t,n,r])=>{if(!this.destroyed&&!this.commonObjs.has(t))switch(n){case`Font`:let i=this._params;if(`error`in r){let e=r.error;(0,_util.warn)(`Error during font loading: ${e}`),this.commonObjs.resolve(t,e);break}let a=i.pdfBug&&globalThis.FontInspector?.enabled?(e,t)=>globalThis.FontInspector.fontAdded(e,t):null,o=new _font_loader.FontFaceObject(r,{isEvalSupported:i.isEvalSupported,disableFontFace:i.disableFontFace,ignoreErrors:i.ignoreErrors,inspectFont:a});this.fontLoader.bind(o).catch(n=>e.sendWithPromise(`FontFallback`,{id:t})).finally(()=>{!i.fontExtraProperties&&o.data&&(o.data=null),this.commonObjs.resolve(t,o)});break;case`FontPath`:case`Image`:case`Pattern`:this.commonObjs.resolve(t,r);break;default:throw Error(`Got unknown common object type ${n}`)}}),e.on(`obj`,([e,t,n,r])=>{if(this.destroyed)return;let i=this.#t.get(t);if(!i.objs.has(e))switch(n){case`Image`:if(i.objs.resolve(e,r),r){let e;if(r.bitmap){let{width:t,height:n}=r;e=t*n*4}else e=r.data?.length||0;e>_util.MAX_IMAGE_SIZE_TO_CACHE&&(i._maybeCleanupAfterRender=!0)}break;case`Pattern`:i.objs.resolve(e,r);break;default:throw Error(`Got unknown object type ${n}`)}}),e.on(`DocProgress`,e=>{this.destroyed||t.onProgress?.({loaded:e.loaded,total:e.total})}),e.on(`FetchBuiltInCMap`,e=>this.destroyed?Promise.reject(Error(`Worker was destroyed.`)):this.cMapReaderFactory?this.cMapReaderFactory.fetch(e):Promise.reject(Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),e.on(`FetchStandardFontData`,e=>this.destroyed?Promise.reject(Error(`Worker was destroyed.`)):this.standardFontDataFactory?this.standardFontDataFactory.fetch(e):Promise.reject(Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise(`GetData`,null)}saveDocument(){this.annotationStorage.size<=0&&(0,_util.warn)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:e,transfers:t}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise(`SaveDocument`,{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:this._fullReader?.filename??null},t).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(Error(`Invalid page request.`));let t=e-1,n=this.#n.get(t);if(n)return n;let r=this.messageHandler.sendWithPromise(`GetPage`,{pageIndex:t}).then(e=>{if(this.destroyed)throw Error(`Transport destroyed`);let n=new PDFPageProxy(t,e,this,this._params.pdfBug);return this.#t.set(t,n),n});return this.#n.set(t,r),r}getPageIndex(e){return typeof e!=`object`||!e||!Number.isInteger(e.num)||e.num<0||!Number.isInteger(e.gen)||e.gen<0?Promise.reject(Error(`Invalid pageIndex request.`)):this.messageHandler.sendWithPromise(`GetPageIndex`,{num:e.num,gen:e.gen})}getAnnotations(e,t){return this.messageHandler.sendWithPromise(`GetAnnotations`,{pageIndex:e,intent:t})}getFieldObjects(){return this.#i(`GetFieldObjects`)}hasJSActions(){return this.#i(`HasJSActions`)}getCalculationOrderIds(){return this.messageHandler.sendWithPromise(`GetCalculationOrderIds`,null)}getDestinations(){return this.messageHandler.sendWithPromise(`GetDestinations`,null)}getDestination(e){return typeof e==`string`?this.messageHandler.sendWithPromise(`GetDestination`,{id:e}):Promise.reject(Error(`Invalid destination request.`))}getPageLabels(){return this.messageHandler.sendWithPromise(`GetPageLabels`,null)}getPageLayout(){return this.messageHandler.sendWithPromise(`GetPageLayout`,null)}getPageMode(){return this.messageHandler.sendWithPromise(`GetPageMode`,null)}getViewerPreferences(){return this.messageHandler.sendWithPromise(`GetViewerPreferences`,null)}getOpenAction(){return this.messageHandler.sendWithPromise(`GetOpenAction`,null)}getAttachments(){return this.messageHandler.sendWithPromise(`GetAttachments`,null)}getDocJSActions(){return this.#i(`GetDocJSActions`)}getPageJSActions(e){return this.messageHandler.sendWithPromise(`GetPageJSActions`,{pageIndex:e})}getStructTree(e){return this.messageHandler.sendWithPromise(`GetStructTree`,{pageIndex:e})}getOutline(){return this.messageHandler.sendWithPromise(`GetOutline`,null)}getOptionalContentConfig(){return this.messageHandler.sendWithPromise(`GetOptionalContentConfig`,null).then(e=>new _optional_content_config.OptionalContentConfig(e))}getPermissions(){return this.messageHandler.sendWithPromise(`GetPermissions`,null)}getMetadata(){let e=`GetMetadata`,t=this.#e.get(e);if(t)return t;let n=this.messageHandler.sendWithPromise(e,null).then(e=>({info:e[0],metadata:e[1]?new _metadata.Metadata(e[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#e.set(e,n),n}getMarkInfo(){return this.messageHandler.sendWithPromise(`GetMarkInfo`,null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise(`Cleanup`,null);for(let e of this.#t.values())if(!e.cleanup())throw Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(!0)}}get loadingParams(){let{disableAutoFetch:e,enableXfa:t}=this._params;return(0,_util.shadow)(this,`loadingParams`,{disableAutoFetch:e,enableXfa:t})}}class PDFObjects{#e=Object.create(null);#t(e){return this.#e[e]||={capability:new _util.PromiseCapability,data:null}}get(e,t=null){if(t){let n=this.#t(e);return n.capability.promise.then(()=>t(n.data)),null}let n=this.#e[e];if(!n?.capability.settled)throw Error(`Requesting object that isn't resolved yet ${e}.`);return n.data}has(e){return this.#e[e]?.capability.settled||!1}resolve(e,t=null){let n=this.#t(e);n.data=t,n.capability.resolve()}clear(){for(let e in this.#e){let{data:t}=this.#e[e];t?.bitmap?.close()}this.#e=Object.create(null)}}class RenderTask{#e=null;constructor(e){this.#e=e,this.onContinue=null}get promise(){return this.#e.capability.promise}cancel(e=0){this.#e.cancel(null,e)}get separateAnnots(){let{separateAnnots:e}=this.#e.operatorList;if(!e)return!1;let{annotationCanvasMap:t}=this.#e;return e.form||e.canvas&&t?.size>0}}exports$2.RenderTask=RenderTask;class InternalRenderTask{static#e=new WeakSet;constructor({callback:e,params:t,objs:n,commonObjs:r,annotationCanvasMap:i,operatorList:a,pageIndex:o,canvasFactory:s,filterFactory:c,useRequestAnimationFrame:l=!1,pdfBug:u=!1,pageColors:d=null}){this.callback=e,this.params=t,this.objs=n,this.commonObjs=r,this.annotationCanvasMap=i,this.operatorListIdx=null,this.operatorList=a,this._pageIndex=o,this.canvasFactory=s,this.filterFactory=c,this._pdfBug=u,this.pageColors=d,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=l===!0&&typeof window<`u`,this.cancelled=!1,this.capability=new _util.PromiseCapability,this.task=new RenderTask(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=t.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:t}){if(this.cancelled)return;if(this._canvas){if(InternalRenderTask.#e.has(this._canvas))throw Error(`Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.`);InternalRenderTask.#e.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());let{canvasContext:n,viewport:r,transform:i,background:a}=this.params;this.gfx=new _canvas.CanvasGraphics(n,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:t},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:i,viewport:r,transparency:e,background:a}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(e=null,t=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),InternalRenderTask.#e.delete(this._canvas),this.callback(e||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,t))}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}this.stepper?.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?window.requestAnimationFrame(()=>{this._nextBound().catch(this._cancelBound)}):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){this.cancelled||(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),InternalRenderTask.#e.delete(this._canvas),this.callback())))}}const version=`3.11.174`;exports$2.version=version;const build=`ce8716743`;exports$2.build=build}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SerializableEmpty=t.PrintAnnotationStorage=t.AnnotationStorage=void 0;var r=n(1),i=n(4),a=n(8);let o=Object.freeze({map:null,hash:``,transfers:void 0});t.SerializableEmpty=o;class s{#e=!1;#t=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,t){let n=this.#t.get(e);return n===void 0?t:Object.assign(t,n)}getRawValue(e){return this.#t.get(e)}remove(e){if(this.#t.delete(e),this.#t.size===0&&this.resetModified(),typeof this.onAnnotationEditor==`function`){for(let e of this.#t.values())if(e instanceof i.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(e,t){let n=this.#t.get(e),r=!1;if(n!==void 0)for(let[e,i]of Object.entries(t))n[e]!==i&&(r=!0,n[e]=i);else r=!0,this.#t.set(e,t);r&&this.#n(),t instanceof i.AnnotationEditor&&typeof this.onAnnotationEditor==`function`&&this.onAnnotationEditor(t.constructor._type)}has(e){return this.#t.has(e)}getAll(){return this.#t.size>0?(0,r.objectFromMap)(this.#t):null}setAll(e){for(let[t,n]of Object.entries(e))this.setValue(t,n)}get size(){return this.#t.size}#n(){this.#e||(this.#e=!0,typeof this.onSetModified==`function`&&this.onSetModified())}resetModified(){this.#e&&(this.#e=!1,typeof this.onResetModified==`function`&&this.onResetModified())}get print(){return new c(this)}get serializable(){if(this.#t.size===0)return o;let e=new Map,t=new a.MurmurHash3_64,n=[],r=Object.create(null),s=!1;for(let[n,a]of this.#t){let o=a instanceof i.AnnotationEditor?a.serialize(!1,r):a;o&&(e.set(n,o),t.update(`${n}:${JSON.stringify(o)}`),s||=!!o.bitmap)}if(s)for(let t of e.values())t.bitmap&&n.push(t.bitmap);return e.size>0?{map:e,hash:t.hexdigest(),transfers:n}:o}}t.AnnotationStorage=s;class c extends s{#e;constructor(e){super();let{map:t,hash:n,transfers:r}=e.serializable,i=structuredClone(t,r?{transfer:r}:null);this.#e={map:i,hash:n,transfers:r}}get print(){(0,r.unreachable)(`Should not call PrintAnnotationStorage.print`)}get serializable(){return this.#e}}t.PrintAnnotationStorage=c}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationEditor=void 0;var r=n(5),i=n(1),a=n(6);class o{#e=``;#t=!1;#n=null;#r=null;#i=null;#a=!1;#o=null;#s=this.focusin.bind(this);#c=this.focusout.bind(this);#l=!1;#u=!1;#d=!1;_initialOptions=Object.create(null);_uiManager=null;_focusEventsAllowed=!0;_l10nPromise=null;#f=!1;#p=o._zIndex++;static _borderLineWidth=-1;static _colorManager=new r.ColorManager;static _zIndex=1;static SMALL_EDITOR_SIZE=0;constructor(e){this.constructor===o&&(0,i.unreachable)(`Cannot initialize AnnotationEditor.`),this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null;let{rotation:t,rawDims:{pageWidth:n,pageHeight:r,pageX:a,pageY:s}}=this.parent.viewport;this.rotation=t,this.pageRotation=(360+t-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[n,r],this.pageTranslation=[a,s];let[c,l]=this.parentDimensions;this.x=e.x/c,this.y=e.y/l,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return(0,i.shadow)(this,`_defaultLineColor`,this._colorManager.getHexCode(`CanvasText`))}static deleteAnnotationElement(e){let t=new s({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});t.annotationElementId=e.annotationElementId,t.deleted=!0,t._uiManager.addToAnnotationStorage(t)}static initialize(e,t=null){if(o._l10nPromise||=new Map([`editor_alt_text_button_label`,`editor_alt_text_edit_button_label`,`editor_alt_text_decorative_tooltip`].map(t=>[t,e.get(t)])),t?.strings)for(let n of t.strings)o._l10nPromise.set(n,e.get(n));if(o._borderLineWidth!==-1)return;let n=getComputedStyle(document.documentElement);o._borderLineWidth=parseFloat(n.getPropertyValue(`--outline-width`))||0}static updateDefaultParams(e,t){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,t){(0,i.unreachable)(`Not implemented`)}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#f}set _isDraggable(e){this.#f=e,this.div?.classList.toggle(`draggable`,e)}center(){let[e,t]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*t/(e*2),this.y+=this.width*e/(t*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*t/(e*2),this.y-=this.width*e/(t*2);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#p}setParent(e){e!==null&&(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions),this.parent=e}focusin(e){this._focusEventsAllowed&&(this.#l?this.#l=!1:this.parent.setSelected(this))}focusout(e){this._focusEventsAllowed&&this.isAttachedToDOM&&(e.relatedTarget?.closest(`#${this.id}`)||(e.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove()))}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,t,n,r){let[i,a]=this.parentDimensions;[n,r]=this.screenToPageTranslation(n,r),this.x=(e+n)/i,this.y=(t+r)/a,this.fixAndSetPosition()}#m([e,t],n,r){[n,r]=this.screenToPageTranslation(n,r),this.x+=n/e,this.y+=r/t,this.fixAndSetPosition()}translate(e,t){this.#m(this.parentDimensions,e,t)}translateInPage(e,t){this.#m(this.pageDimensions,e,t),this.div.scrollIntoView({block:`nearest`})}drag(e,t){let[n,r]=this.parentDimensions;if(this.x+=e/n,this.y+=t/r,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:e,y:t}=this.div.getBoundingClientRect();this.parent.findNewParent(this,e,t)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:i,y:a}=this,[o,s]=this.#h();i+=o,a+=s,this.div.style.left=`${(100*i).toFixed(2)}%`,this.div.style.top=`${(100*a).toFixed(2)}%`,this.div.scrollIntoView({block:`nearest`})}#h(){let[e,t]=this.parentDimensions,{_borderLineWidth:n}=o,r=n/e,i=n/t;switch(this.rotation){case 90:return[-r,i];case 180:return[r,i];case 270:return[r,-i];default:return[-r,-i]}}fixAndSetPosition(){let[e,t]=this.pageDimensions,{x:n,y:r,width:i,height:a}=this;switch(i*=e,a*=t,n*=e,r*=t,this.rotation){case 0:n=Math.max(0,Math.min(e-i,n)),r=Math.max(0,Math.min(t-a,r));break;case 90:n=Math.max(0,Math.min(e-a,n)),r=Math.min(t,Math.max(i,r));break;case 180:n=Math.min(e,Math.max(i,n)),r=Math.min(t,Math.max(a,r));break;case 270:n=Math.min(e,Math.max(a,n)),r=Math.max(0,Math.min(t-i,r))}this.x=n/=e,this.y=r/=t;let[o,s]=this.#h();n+=o,r+=s;let{style:c}=this.div;c.left=`${(100*n).toFixed(2)}%`,c.top=`${(100*r).toFixed(2)}%`,this.moveInDOM()}static#g(e,t,n){switch(n){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}}screenToPageTranslation(e,t){return o.#g(e,t,this.parentRotation)}pageTranslationToScreen(e,t){return o.#g(e,t,360-this.parentRotation)}#_(e){switch(e){case 90:{let[e,t]=this.pageDimensions;return[0,-e/t,t/e,0]}case 180:return[-1,0,0,-1];case 270:{let[e,t]=this.pageDimensions;return[0,e/t,-t/e,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{parentScale:e,pageDimensions:[t,n]}=this,r=t*e,a=n*e;return i.FeatureTest.isCSSRoundSupported?[Math.round(r),Math.round(a)]:[r,a]}setDims(e,t){let[n,r]=this.parentDimensions;this.div.style.width=`${(100*e/n).toFixed(2)}%`,this.#a||(this.div.style.height=`${(100*t/r).toFixed(2)}%`),this.#n?.classList.toggle(`small`,e<o.SMALL_EDITOR_SIZE||t<o.SMALL_EDITOR_SIZE)}fixDims(){let{style:e}=this.div,{height:t,width:n}=e,r=n.endsWith(`%`),i=!this.#a&&t.endsWith(`%`);if(r&&i)return;let[a,o]=this.parentDimensions;r||(e.width=`${(100*parseFloat(n)/a).toFixed(2)}%`),!this.#a&&!i&&(e.height=`${(100*parseFloat(t)/o).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#v(){if(this.#o)return;this.#o=document.createElement(`div`),this.#o.classList.add(`resizers`);let e=[`topLeft`,`topRight`,`bottomRight`,`bottomLeft`];this._willKeepAspectRatio||e.push(`topMiddle`,`middleRight`,`bottomMiddle`,`middleLeft`);for(let t of e){let e=document.createElement(`div`);this.#o.append(e),e.classList.add(`resizer`,t),e.addEventListener(`pointerdown`,this.#y.bind(this,t)),e.addEventListener(`contextmenu`,a.noContextMenu)}this.div.prepend(this.#o)}#y(e,t){t.preventDefault();let{isMac:n}=i.FeatureTest.platform;if(t.button!==0||t.ctrlKey&&n)return;let r=this.#b.bind(this,e),a=this._isDraggable;this._isDraggable=!1;let o={passive:!0,capture:!0};window.addEventListener(`pointermove`,r,o);let s=this.x,c=this.y,l=this.width,u=this.height,d=this.parent.div.style.cursor,f=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(t.target).cursor;let p=()=>{this._isDraggable=a,window.removeEventListener(`pointerup`,p),window.removeEventListener(`blur`,p),window.removeEventListener(`pointermove`,r,o),this.parent.div.style.cursor=d,this.div.style.cursor=f;let e=this.x,t=this.y,n=this.width,i=this.height;(e!==s||t!==c||n!==l||i!==u)&&this.addCommands({cmd:()=>{this.width=n,this.height=i,this.x=e,this.y=t;let[r,a]=this.parentDimensions;this.setDims(r*n,a*i),this.fixAndSetPosition()},undo:()=>{this.width=l,this.height=u,this.x=s,this.y=c;let[e,t]=this.parentDimensions;this.setDims(e*l,t*u),this.fixAndSetPosition()},mustExec:!0})};window.addEventListener(`pointerup`,p),window.addEventListener(`blur`,p)}#b(e,t){let[n,r]=this.parentDimensions,i=this.x,a=this.y,s=this.width,c=this.height,l=o.MIN_SIZE/n,u=o.MIN_SIZE/r,d=e=>Math.round(e*1e4)/1e4,f=this.#_(this.rotation),p=(e,t)=>[f[0]*e+f[2]*t,f[1]*e+f[3]*t],m=this.#_(360-this.rotation),h=(e,t)=>[m[0]*e+m[2]*t,m[1]*e+m[3]*t],g,_,v=!1,y=!1;switch(e){case`topLeft`:v=!0,g=(e,t)=>[0,0],_=(e,t)=>[e,t];break;case`topMiddle`:g=(e,t)=>[e/2,0],_=(e,t)=>[e/2,t];break;case`topRight`:v=!0,g=(e,t)=>[e,0],_=(e,t)=>[0,t];break;case`middleRight`:y=!0,g=(e,t)=>[e,t/2],_=(e,t)=>[0,t/2];break;case`bottomRight`:v=!0,g=(e,t)=>[e,t],_=(e,t)=>[0,0];break;case`bottomMiddle`:g=(e,t)=>[e/2,t],_=(e,t)=>[e/2,0];break;case`bottomLeft`:v=!0,g=(e,t)=>[0,t],_=(e,t)=>[e,0];break;case`middleLeft`:y=!0,g=(e,t)=>[0,t/2],_=(e,t)=>[e,t/2]}let b=g(s,c),x=_(s,c),S=p(...x),C=d(i+S[0]),w=d(a+S[1]),T=1,E=1,[D,O]=this.screenToPageTranslation(t.movementX,t.movementY);if([D,O]=h(D/n,O/r),v){let e=Math.hypot(s,c);T=E=Math.max(Math.min(Math.hypot(x[0]-b[0]-D,x[1]-b[1]-O)/e,1/s,1/c),l/s,u/c)}else y?T=Math.max(l,Math.min(1,Math.abs(x[0]-b[0]-D)))/s:E=Math.max(u,Math.min(1,Math.abs(x[1]-b[1]-O)))/c;let k=d(s*T),A=d(c*E);S=p(..._(k,A));let j=C-S[0],M=w-S[1];this.width=k,this.height=A,this.x=j,this.y=M,this.setDims(n*k,r*A),this.fixAndSetPosition()}async addAltTextButton(){if(this.#n)return;let e=this.#n=document.createElement(`button`);e.className=`altText`;let t=await o._l10nPromise.get(`editor_alt_text_button_label`);if(e.textContent=t,e.setAttribute(`aria-label`,t),e.tabIndex=`0`,e.addEventListener(`contextmenu`,a.noContextMenu),e.addEventListener(`pointerdown`,e=>e.stopPropagation()),e.addEventListener(`click`,e=>{e.preventDefault(),this._uiManager.editAltText(this)},{capture:!0}),e.addEventListener(`keydown`,t=>{t.target===e&&t.key===`Enter`&&(t.preventDefault(),this._uiManager.editAltText(this))}),this.#x(),this.div.append(e),!o.SMALL_EDITOR_SIZE){let t=40;o.SMALL_EDITOR_SIZE=Math.min(128,Math.round(e.getBoundingClientRect().width*1.4))}}async#x(){let e=this.#n;if(!e)return;if(!this.#e&&!this.#t){e.classList.remove(`done`),this.#r?.remove();return}o._l10nPromise.get(`editor_alt_text_edit_button_label`).then(t=>{e.setAttribute(`aria-label`,t)});let t=this.#r;if(!t){this.#r=t=document.createElement(`span`),t.className=`tooltip`,t.setAttribute(`role`,`tooltip`);let n=t.id=`alt-text-tooltip-${this.id}`;e.setAttribute(`aria-describedby`,n);let r=100;e.addEventListener(`mouseenter`,()=>{this.#i=setTimeout(()=>{this.#i=null,this.#r.classList.add(`show`),this._uiManager._eventBus.dispatch(`reporttelemetry`,{source:this,details:{type:`editing`,subtype:this.editorType,data:{action:`alt_text_tooltip`}}})},100)}),e.addEventListener(`mouseleave`,()=>{clearTimeout(this.#i),this.#i=null,this.#r?.classList.remove(`show`)})}e.classList.add(`done`),t.innerText=this.#t?await o._l10nPromise.get(`editor_alt_text_decorative_tooltip`):this.#e,t.parentNode||e.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}get altTextData(){return{altText:this.#e,decorative:this.#t}}set altTextData({altText:e,decorative:t}){(this.#e!==e||this.#t!==t)&&(this.#e=e,this.#t=t,this.#x())}render(){this.div=document.createElement(`div`),this.div.setAttribute(`data-editor-rotation`,(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute(`id`,this.id),this.div.setAttribute(`tabIndex`,0),this.setInForeground(),this.div.addEventListener(`focusin`,this.#s),this.div.addEventListener(`focusout`,this.#c);let[e,t]=this.parentDimensions;this.parentRotation%180!=0&&(this.div.style.maxWidth=`${(100*t/e).toFixed(2)}%`,this.div.style.maxHeight=`${(100*e/t).toFixed(2)}%`);let[n,i]=this.getInitialTranslation();return this.translate(n,i),(0,r.bindEvents)(this,this.div,[`pointerdown`]),this.div}pointerdown(e){let{isMac:t}=i.FeatureTest.platform;if(e.button!==0||e.ctrlKey&&t){e.preventDefault();return}this.#l=!0,this.#S(e)}#S(e){if(!this._isDraggable)return;let t=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();let n,r;t&&(n={passive:!0,capture:!0},r=e=>{let[t,n]=this.screenToPageTranslation(e.movementX,e.movementY);this._uiManager.dragSelectedEditors(t,n)},window.addEventListener(`pointermove`,r,n));let a=()=>{if(window.removeEventListener(`pointerup`,a),window.removeEventListener(`blur`,a),t&&window.removeEventListener(`pointermove`,r,n),this.#l=!1,!this._uiManager.endDragSession()){let{isMac:t}=i.FeatureTest.platform;e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this)}};window.addEventListener(`pointerup`,a),window.addEventListener(`blur`,a)}moveInDOM(){this.parent?.moveEditorInDOM(this)}_setParentAndPosition(e,t,n){e.changeParent(this),this.x=t,this.y=n,this.fixAndSetPosition()}getRect(e,t){let n=this.parentScale,[r,i]=this.pageDimensions,[a,o]=this.pageTranslation,s=e/n,c=t/n,l=this.x*r,u=this.y*i,d=this.width*r,f=this.height*i;switch(this.rotation){case 0:return[l+s+a,i-u-c-f+o,l+s+d+a,i-u-c+o];case 90:return[l+c+a,i-u+s+o,l+c+f+a,i-u+s+d+o];case 180:return[l-s-d+a,i-u+c+o,l-s+a,i-u+c+f+o];case 270:return[l-c-f+a,i-u-s-d+o,l-c+a,i-u-s+o];default:throw Error(`Invalid rotation`)}}getRectInCurrentCoords(e,t){let[n,r,i,a]=e,o=i-n,s=a-r;switch(this.rotation){case 0:return[n,t-a,o,s];case 90:return[n,t-r,s,o];case 180:return[i,t-r,o,s];case 270:return[i,t-a,s,o];default:throw Error(`Invalid rotation`)}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#d=!0}disableEditMode(){this.#d=!1}isInEditMode(){return this.#d}shouldGetKeyboardEvents(){return!1}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){this.div?.addEventListener(`focusin`,this.#s),this.div?.addEventListener(`focusout`,this.#c)}serialize(e=!1,t=null){(0,i.unreachable)(`An editor must be serializable`)}static deserialize(e,t,n){let r=new this.prototype.constructor({parent:t,id:t.getNextId(),uiManager:n});r.rotation=e.rotation;let[i,a]=r.pageDimensions,[o,s,c,l]=r.getRectInCurrentCoords(e.rect,a);return r.x=o/i,r.y=s/a,r.width=c/i,r.height=l/a,r}remove(){this.div.removeEventListener(`focusin`,this.#s),this.div.removeEventListener(`focusout`,this.#c),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#n?.remove(),this.#n=null,this.#r=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#v(),this.#o.classList.remove(`hidden`))}select(){this.makeResizable(),this.div?.classList.add(`selectedEditor`)}unselect(){this.#o?.classList.add(`hidden`),this.div?.classList.remove(`selectedEditor`),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus()}updateParams(e,t){}disableEditing(){this.#n&&(this.#n.hidden=!0)}enableEditing(){this.#n&&(this.#n.hidden=!1)}enterInEditMode(){}get contentDiv(){return this.div}get isEditing(){return this.#u}set isEditing(e){this.#u=e,this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(e,t){this.#a=!0;let n=e/t,{style:r}=this.div;r.aspectRatio=n,r.height=`auto`}static get MIN_SIZE(){return 16}}t.AnnotationEditor=o;class s extends o{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.KeyboardManager=t.CommandManager=t.ColorManager=t.AnnotationEditorUIManager=void 0,t.bindEvents=a,t.opacityToHex=o;var r=n(1),i=n(6);function a(e,t,n){for(let r of n)t.addEventListener(r,e[r].bind(e))}function o(e){return Math.round(Math.min(255,Math.max(1,255*e))).toString(16).padStart(2,`0`)}class s{#e=0;getId(){return`${r.AnnotationEditorPrefix}${this.#e++}`}}class c{#e=(0,r.getUuid)();#t=0;#n=null;static get _isSVGFittingCanvas(){let e=`data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>`,t=new OffscreenCanvas(1,3).getContext(`2d`),n=new Image;n.src=`data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>`;let i=n.decode().then(()=>(t.drawImage(n,0,0,1,1,0,0,1,3),new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0]===0));return(0,r.shadow)(this,`_isSVGFittingCanvas`,i)}async#r(e,t){this.#n||=new Map;let n=this.#n.get(e);if(n===null)return null;if(n?.bitmap)return n.refCounter+=1,n;try{n||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let e;if(typeof t==`string`){n.url=t;let r=await fetch(t);if(!r.ok)throw Error(r.statusText);e=await r.blob()}else e=n.file=t;if(e.type===`image/svg+xml`){let t=c._isSVGFittingCanvas,r=new FileReader,i=new Image,a=new Promise((e,a)=>{i.onload=()=>{n.bitmap=i,n.isSvg=!0,e()},r.onload=async()=>{let e=n.svgUrl=r.result;i.src=await t?`${e}#svgView(preserveAspectRatio(none))`:e},i.onerror=r.onerror=a});r.readAsDataURL(e),await a}else n.bitmap=await createImageBitmap(e);n.refCounter=1}catch(e){console.error(e),n=null}return this.#n.set(e,n),n&&this.#n.set(n.id,n),n}async getFromFile(e){let{lastModified:t,name:n,size:r,type:i}=e;return this.#r(`${t}_${n}_${r}_${i}`,e)}async getFromUrl(e){return this.#r(e,e)}async getFromId(e){this.#n||=new Map;let t=this.#n.get(e);return t?t.bitmap?(t.refCounter+=1,t):t.file?this.getFromFile(t.file):this.getFromUrl(t.url):null}getSvgUrl(e){let t=this.#n.get(e);return t?.isSvg?t.svgUrl:null}deleteId(e){this.#n||=new Map;let t=this.#n.get(e);t&&(--t.refCounter,t.refCounter===0&&(t.bitmap=null))}isValidId(e){return e.startsWith(`image_${this.#e}_`)}}class l{#e=[];#t=!1;#n;#r=-1;constructor(e=128){this.#n=e}add({cmd:e,undo:t,mustExec:n,type:r=NaN,overwriteIfSameType:i=!1,keepUndo:a=!1}){if(n&&e(),this.#t)return;let o={cmd:e,undo:t,type:r};if(this.#r===-1){this.#e.length>0&&(this.#e.length=0),this.#r=0,this.#e.push(o);return}if(i&&this.#e[this.#r].type===r){a&&(o.undo=this.#e[this.#r].undo),this.#e[this.#r]=o;return}let s=this.#r+1;s===this.#n?this.#e.splice(0,1):(this.#r=s,s<this.#e.length&&this.#e.splice(s)),this.#e.push(o)}undo(){this.#r!==-1&&(this.#t=!0,this.#e[this.#r].undo(),this.#t=!1,--this.#r)}redo(){this.#r<this.#e.length-1&&(this.#r+=1,this.#t=!0,this.#e[this.#r].cmd(),this.#t=!1)}hasSomethingToUndo(){return this.#r!==-1}hasSomethingToRedo(){return this.#r<this.#e.length-1}destroy(){this.#e=null}}t.CommandManager=l;class u{constructor(e){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;let{isMac:t}=r.FeatureTest.platform;for(let[n,r,i={}]of e)for(let e of n){let n=e.startsWith(`mac+`);t&&n?(this.callbacks.set(e.slice(4),{callback:r,options:i}),this.allKeys.add(e.split(`+`).at(-1))):!t&&!n&&(this.callbacks.set(e,{callback:r,options:i}),this.allKeys.add(e.split(`+`).at(-1)))}}#e(e){e.altKey&&this.buffer.push(`alt`),e.ctrlKey&&this.buffer.push(`ctrl`),e.metaKey&&this.buffer.push(`meta`),e.shiftKey&&this.buffer.push(`shift`),this.buffer.push(e.key);let t=this.buffer.join(`+`);return this.buffer.length=0,t}exec(e,t){if(!this.allKeys.has(t.key))return;let n=this.callbacks.get(this.#e(t));if(!n)return;let{callback:r,options:{bubbles:i=!1,args:a=[],checker:o=null}}=n;o&&!o(e,t)||(r.bind(e,...a)(),i||(t.stopPropagation(),t.preventDefault()))}}t.KeyboardManager=u;class d{static _colorsMapping=new Map([[`CanvasText`,[0,0,0]],[`Canvas`,[255,255,255]]]);get _colors(){let e=new Map([[`CanvasText`,null],[`Canvas`,null]]);return(0,i.getColorValues)(e),(0,r.shadow)(this,`_colors`,e)}convert(e){let t=(0,i.getRGB)(e);if(!window.matchMedia(`(forced-colors: active)`).matches)return t;for(let[e,n]of this._colors)if(n.every((e,n)=>e===t[n]))return d._colorsMapping.get(e);return t}getHexCode(e){let t=this._colors.get(e);return t?r.Util.makeHexColor(...t):e}}t.ColorManager=d;class f{#e=null;#t=new Map;#n=new Map;#r=null;#i=null;#a=new l;#o=0;#s=new Set;#c=null;#l=null;#u=new Set;#d=null;#f=new s;#p=!1;#m=!1;#h=null;#g=r.AnnotationEditorType.NONE;#_=new Set;#v=null;#y=this.blur.bind(this);#b=this.focus.bind(this);#x=this.copy.bind(this);#S=this.cut.bind(this);#C=this.paste.bind(this);#w=this.keydown.bind(this);#T=this.onEditingAction.bind(this);#E=this.onPageChanging.bind(this);#D=this.onScaleChanging.bind(this);#O=this.onRotationChanging.bind(this);#k={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1};#A=[0,0];#j=null;#M=null;#N=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){let e=f.prototype,t=e=>{let{activeElement:t}=document;return t&&e.#M.contains(t)&&e.hasSomethingToControl()},n=this.TRANSLATE_SMALL,i=this.TRANSLATE_BIG;return(0,r.shadow)(this,`_keyboardManager`,new u([[[`ctrl+a`,`mac+meta+a`],e.selectAll],[[`ctrl+z`,`mac+meta+z`],e.undo],[[`ctrl+y`,`ctrl+shift+z`,`mac+meta+shift+z`,`ctrl+shift+Z`,`mac+meta+shift+Z`],e.redo],[[`Backspace`,`alt+Backspace`,`ctrl+Backspace`,`shift+Backspace`,`mac+Backspace`,`mac+alt+Backspace`,`mac+ctrl+Backspace`,`Delete`,`ctrl+Delete`,`shift+Delete`,`mac+Delete`],e.delete],[[`Escape`,`mac+Escape`],e.unselectAll],[[`ArrowLeft`,`mac+ArrowLeft`],e.translateSelectedEditors,{args:[-n,0],checker:t}],[[`ctrl+ArrowLeft`,`mac+shift+ArrowLeft`],e.translateSelectedEditors,{args:[-i,0],checker:t}],[[`ArrowRight`,`mac+ArrowRight`],e.translateSelectedEditors,{args:[n,0],checker:t}],[[`ctrl+ArrowRight`,`mac+shift+ArrowRight`],e.translateSelectedEditors,{args:[i,0],checker:t}],[[`ArrowUp`,`mac+ArrowUp`],e.translateSelectedEditors,{args:[0,-n],checker:t}],[[`ctrl+ArrowUp`,`mac+shift+ArrowUp`],e.translateSelectedEditors,{args:[0,-i],checker:t}],[[`ArrowDown`,`mac+ArrowDown`],e.translateSelectedEditors,{args:[0,n],checker:t}],[[`ctrl+ArrowDown`,`mac+shift+ArrowDown`],e.translateSelectedEditors,{args:[0,i],checker:t}]]))}constructor(e,t,n,r,a,o){this.#M=e,this.#N=t,this.#r=n,this._eventBus=r,this._eventBus._on(`editingaction`,this.#T),this._eventBus._on(`pagechanging`,this.#E),this._eventBus._on(`scalechanging`,this.#D),this._eventBus._on(`rotationchanging`,this.#O),this.#i=a.annotationStorage,this.#d=a.filterFactory,this.#v=o,this.viewParameters={realScale:i.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:0}}destroy(){this.#L(),this.#F(),this._eventBus._off(`editingaction`,this.#T),this._eventBus._off(`pagechanging`,this.#E),this._eventBus._off(`scalechanging`,this.#D),this._eventBus._off(`rotationchanging`,this.#O);for(let e of this.#n.values())e.destroy();this.#n.clear(),this.#t.clear(),this.#u.clear(),this.#e=null,this.#_.clear(),this.#a.destroy(),this.#r.destroy()}get hcmFilter(){return(0,r.shadow)(this,`hcmFilter`,this.#v?this.#d.addHCMFilter(this.#v.foreground,this.#v.background):`none`)}get direction(){return(0,r.shadow)(this,`direction`,getComputedStyle(this.#M).direction)}editAltText(e){this.#r?.editAltText(this,e)}onPageChanging({pageNumber:e}){this.#o=e-1}focusMainContainer(){this.#M.focus()}findParent(e,t){for(let n of this.#n.values()){let{x:r,y:i,width:a,height:o}=n.div.getBoundingClientRect();if(e>=r&&e<=r+a&&t>=i&&t<=i+o)return n}return null}disableUserSelect(e=!1){this.#N.classList.toggle(`noUserSelect`,e)}addShouldRescale(e){this.#u.add(e)}removeShouldRescale(e){this.#u.delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*i.PixelsPerInch.PDF_TO_CSS_UNITS;for(let e of this.#u)e.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}addToAnnotationStorage(e){!e.isEmpty()&&this.#i&&!this.#i.has(e.id)&&this.#i.setValue(e.id,e)}#P(){window.addEventListener(`focus`,this.#b),window.addEventListener(`blur`,this.#y)}#F(){window.removeEventListener(`focus`,this.#b),window.removeEventListener(`blur`,this.#y)}blur(){if(!this.hasSelection)return;let{activeElement:e}=document;for(let t of this.#_)if(t.div.contains(e)){this.#h=[t,e],t._focusEventsAllowed=!1;break}}focus(){if(!this.#h)return;let[e,t]=this.#h;this.#h=null,t.addEventListener(`focusin`,()=>{e._focusEventsAllowed=!0},{once:!0}),t.focus()}#I(){window.addEventListener(`keydown`,this.#w,{capture:!0})}#L(){window.removeEventListener(`keydown`,this.#w,{capture:!0})}#R(){document.addEventListener(`copy`,this.#x),document.addEventListener(`cut`,this.#S),document.addEventListener(`paste`,this.#C)}#z(){document.removeEventListener(`copy`,this.#x),document.removeEventListener(`cut`,this.#S),document.removeEventListener(`paste`,this.#C)}addEditListeners(){this.#I(),this.#R()}removeEditListeners(){this.#L(),this.#z()}copy(e){if(e.preventDefault(),this.#e?.commitOrRemove(),!this.hasSelection)return;let t=[];for(let e of this.#_){let n=e.serialize(!0);n&&t.push(n)}t.length!==0&&e.clipboardData.setData(`application/pdfjs`,JSON.stringify(t))}cut(e){this.copy(e),this.delete()}paste(e){e.preventDefault();let{clipboardData:t}=e;for(let e of t.items)for(let t of this.#l)if(t.isHandlingMimeForPasting(e.type)){t.paste(e,this.currentLayer);return}let n=t.getData(`application/pdfjs`);if(!n)return;try{n=JSON.parse(n)}catch(e){(0,r.warn)(`paste: "${e.message}".`);return}if(!Array.isArray(n))return;this.unselectAll();let i=this.currentLayer;try{let e=[];for(let t of n){let n=i.deserialize(t);if(!n)return;e.push(n)}this.addCommands({cmd:()=>{for(let t of e)this.#W(t);this.#K(e)},undo:()=>{for(let t of e)t.remove()},mustExec:!0})}catch(e){(0,r.warn)(`paste: "${e.message}".`)}}keydown(e){this.getActive()?.shouldGetKeyboardEvents()||f._keyboardManager.exec(this,e)}onEditingAction(e){[`undo`,`redo`,`delete`,`selectAll`].includes(e.name)&&this[e.name]()}#B(e){Object.entries(e).some(([e,t])=>this.#k[e]!==t)&&this._eventBus.dispatch(`annotationeditorstateschanged`,{source:this,details:Object.assign(this.#k,e)})}#V(e){this._eventBus.dispatch(`annotationeditorparamschanged`,{source:this,details:e})}setEditingState(e){e?(this.#P(),this.#I(),this.#R(),this.#B({isEditing:this.#g!==r.AnnotationEditorType.NONE,isEmpty:this.#G(),hasSomethingToUndo:this.#a.hasSomethingToUndo(),hasSomethingToRedo:this.#a.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#F(),this.#L(),this.#z(),this.#B({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!this.#l){this.#l=e;for(let e of this.#l)this.#V(e.defaultPropertiesToUpdate)}}getId(){return this.#f.getId()}get currentLayer(){return this.#n.get(this.#o)}getLayer(e){return this.#n.get(e)}get currentPageIndex(){return this.#o}addLayer(e){this.#n.set(e.pageIndex,e),this.#p?e.enable():e.disable()}removeLayer(e){this.#n.delete(e.pageIndex)}updateMode(e,t=null){if(this.#g!==e){if(this.#g=e,e===r.AnnotationEditorType.NONE){this.setEditingState(!1),this.#U();return}this.setEditingState(!0),this.#H(),this.unselectAll();for(let t of this.#n.values())t.updateMode(e);if(t){for(let e of this.#t.values())if(e.annotationElementId===t){this.setSelected(e),e.enterInEditMode();break}}}}updateToolbar(e){e!==this.#g&&this._eventBus.dispatch(`switchannotationeditormode`,{source:this,mode:e})}updateParams(e,t){if(this.#l){if(e===r.AnnotationEditorParamsType.CREATE){this.currentLayer.addNewEditor(e);return}for(let n of this.#_)n.updateParams(e,t);for(let n of this.#l)n.updateDefaultParams(e,t)}}enableWaiting(e=!1){if(this.#m!==e){this.#m=e;for(let t of this.#n.values())e?t.disableClick():t.enableClick(),t.div.classList.toggle(`waiting`,e)}}#H(){if(!this.#p){this.#p=!0;for(let e of this.#n.values())e.enable()}}#U(){if(this.unselectAll(),this.#p){this.#p=!1;for(let e of this.#n.values())e.disable()}}getEditors(e){let t=[];for(let n of this.#t.values())n.pageIndex===e&&t.push(n);return t}getEditor(e){return this.#t.get(e)}addEditor(e){this.#t.set(e.id,e)}removeEditor(e){this.#t.delete(e.id),this.unselect(e),(!e.annotationElementId||!this.#s.has(e.annotationElementId))&&this.#i?.remove(e.id)}addDeletedAnnotationElement(e){this.#s.add(e.annotationElementId),e.deleted=!0}isDeletedAnnotationElement(e){return this.#s.has(e)}removeDeletedAnnotationElement(e){this.#s.delete(e.annotationElementId),e.deleted=!1}#W(e){let t=this.#n.get(e.pageIndex);t?t.addOrRebuild(e):this.addEditor(e)}setActiveEditor(e){this.#e!==e&&(this.#e=e,e&&this.#V(e.propertiesToUpdate))}toggleSelected(e){if(this.#_.has(e)){this.#_.delete(e),e.unselect(),this.#B({hasSelectedEditor:this.hasSelection});return}this.#_.add(e),e.select(),this.#V(e.propertiesToUpdate),this.#B({hasSelectedEditor:!0})}setSelected(e){for(let t of this.#_)t!==e&&t.unselect();this.#_.clear(),this.#_.add(e),e.select(),this.#V(e.propertiesToUpdate),this.#B({hasSelectedEditor:!0})}isSelected(e){return this.#_.has(e)}unselect(e){e.unselect(),this.#_.delete(e),this.#B({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#_.size!==0}undo(){this.#a.undo(),this.#B({hasSomethingToUndo:this.#a.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#G()})}redo(){this.#a.redo(),this.#B({hasSomethingToUndo:!0,hasSomethingToRedo:this.#a.hasSomethingToRedo(),isEmpty:this.#G()})}addCommands(e){this.#a.add(e),this.#B({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#G()})}#G(){if(this.#t.size===0)return!0;if(this.#t.size===1)for(let e of this.#t.values())return e.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;let e=[...this.#_];this.addCommands({cmd:()=>{for(let t of e)t.remove()},undo:()=>{for(let t of e)this.#W(t)},mustExec:!0})}commitOrRemove(){this.#e?.commitOrRemove()}hasSomethingToControl(){return this.#e||this.hasSelection}#K(e){this.#_.clear();for(let t of e)t.isEmpty()||(this.#_.add(t),t.select());this.#B({hasSelectedEditor:!0})}selectAll(){for(let e of this.#_)e.commit();this.#K(this.#t.values())}unselectAll(){if(this.#e){this.#e.commitOrRemove();return}if(this.hasSelection){for(let e of this.#_)e.unselect();this.#_.clear(),this.#B({hasSelectedEditor:!1})}}translateSelectedEditors(e,t,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;this.#A[0]+=e,this.#A[1]+=t;let[r,i]=this.#A,a=[...this.#_],o=1e3;this.#j&&clearTimeout(this.#j),this.#j=setTimeout(()=>{this.#j=null,this.#A[0]=this.#A[1]=0,this.addCommands({cmd:()=>{for(let e of a)this.#t.has(e.id)&&e.translateInPage(r,i)},undo:()=>{for(let e of a)this.#t.has(e.id)&&e.translateInPage(-r,-i)},mustExec:!1})},1e3);for(let n of a)n.translateInPage(e,t)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#c=new Map;for(let e of this.#_)this.#c.set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#c)return!1;this.disableUserSelect(!1);let e=this.#c;this.#c=null;let t=!1;for(let[{x:n,y:r,pageIndex:i},a]of e)a.newX=n,a.newY=r,a.newPageIndex=i,t||=n!==a.savedX||r!==a.savedY||i!==a.savedPageIndex;if(!t)return!1;let n=(e,t,n,r)=>{if(this.#t.has(e.id)){let i=this.#n.get(r);i?e._setParentAndPosition(i,t,n):(e.pageIndex=r,e.x=t,e.y=n)}};return this.addCommands({cmd:()=>{for(let[t,{newX:r,newY:i,newPageIndex:a}]of e)n(t,r,i,a)},undo:()=>{for(let[t,{savedX:r,savedY:i,savedPageIndex:a}]of e)n(t,r,i,a)},mustExec:!0}),!0}dragSelectedEditors(e,t){if(this.#c)for(let n of this.#c.keys())n.drag(e,t)}rebuild(e){if(e.parent===null){let t=this.getLayer(e.pageIndex);t?(t.changeParent(e),t.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}isActive(e){return this.#e===e}getActive(){return this.#e}getMode(){return this.#g}get imageManager(){return(0,r.shadow)(this,`imageManager`,new c)}}t.AnnotationEditorUIManager=f}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StatTimer=t.RenderingCancelledException=t.PixelsPerInch=t.PageViewport=t.PDFDateString=t.DOMStandardFontDataFactory=t.DOMSVGFactory=t.DOMFilterFactory=t.DOMCanvasFactory=t.DOMCMapReaderFactory=void 0,t.deprecated=C,t.getColorValues=O,t.getCurrentTransform=k,t.getCurrentTransformInverse=A,t.getFilenameFromUrl=_,t.getPdfFilenameFromUrl=v,t.getRGB=D,t.getXfaPageViewport=E,t.isDataScheme=h,t.isPdfFile=g,t.isValidFetchUrl=b,t.loadScript=S,t.noContextMenu=x,t.setLayerDimensions=j;var r=n(7),i=n(1);let a=`http://www.w3.org/2000/svg`;class o{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}t.PixelsPerInch=o;class s extends r.BaseFilterFactory{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u=0;constructor({docId:e,ownerDocument:t=globalThis.document}={}){super(),this.#n=e,this.#r=t}get#d(){return this.#e||=new Map}get#f(){if(!this.#t){let e=this.#r.createElement(`div`),{style:t}=e;t.visibility=`hidden`,t.contain=`strict`,t.width=t.height=0,t.position=`absolute`,t.top=t.left=0,t.zIndex=-1;let n=this.#r.createElementNS(a,`svg`);n.setAttribute(`width`,0),n.setAttribute(`height`,0),this.#t=this.#r.createElementNS(a,`defs`),e.append(n),n.append(this.#t),this.#r.body.append(e)}return this.#t}addFilter(e){if(!e)return`none`;let t=this.#d.get(e);if(t)return t;let n,r,i,a;if(e.length===1){let t=e[0],o=Array(256);for(let e=0;e<256;e++)o[e]=t[e]/255;a=n=r=i=o.join(`,`)}else{let[t,o,s]=e,c=Array(256),l=Array(256),u=Array(256);for(let e=0;e<256;e++)c[e]=t[e]/255,l[e]=o[e]/255,u[e]=s[e]/255;n=c.join(`,`),r=l.join(`,`),i=u.join(`,`),a=`${n}${r}${i}`}if(t=this.#d.get(a),t)return this.#d.set(e,t),t;let o=`g_${this.#n}_transfer_map_${this.#u++}`,s=`url(#${o})`;this.#d.set(e,s),this.#d.set(a,s);let c=this.#m(o);return this.#g(n,r,i,c),s}addHCMFilter(e,t){let n=`${e}-${t}`;if(this.#a===n||(this.#a=n,this.#o=`none`,this.#i?.remove(),!e||!t))return this.#o;let r=this.#_(e);e=i.Util.makeHexColor(...r);let a=this.#_(t);if(t=i.Util.makeHexColor(...a),this.#f.style.color=``,e===`#000000`&&t===`#ffffff`||e===t)return this.#o;let o=Array(256);for(let e=0;e<=255;e++){let t=e/255;o[e]=t<=.03928?t/12.92:((t+.055)/1.055)**2.4}let s=o.join(`,`),c=`g_${this.#n}_hcm_filter`,l=this.#s=this.#m(c);this.#g(s,s,s,l),this.#p(l);let u=(e,t)=>{let n=r[e]/255,i=a[e]/255,o=Array(t+1);for(let e=0;e<=t;e++)o[e]=n+e/t*(i-n);return o.join(`,`)};return this.#g(u(0,5),u(1,5),u(2,5),l),this.#o=`url(#${c})`,this.#o}addHighlightHCMFilter(e,t,n,r){let i=`${e}-${t}-${n}-${r}`;if(this.#c===i||(this.#c=i,this.#l=`none`,this.#s?.remove(),!e||!t))return this.#l;let[a,o]=[e,t].map(this.#_.bind(this)),s=Math.round(.2126*a[0]+.7152*a[1]+.0722*a[2]),c=Math.round(.2126*o[0]+.7152*o[1]+.0722*o[2]),[l,u]=[n,r].map(this.#_.bind(this));c<s&&([s,c,l,u]=[c,s,u,l]),this.#f.style.color=``;let d=(e,t,n)=>{let r=Array(256),i=(c-s)/n,a=e/255,o=(t-e)/(255*n),l=0;for(let e=0;e<=n;e++){let t=Math.round(s+e*i),n=a+e*o;for(let e=l;e<=t;e++)r[e]=n;l=t+1}for(let e=l;e<256;e++)r[e]=r[l-1];return r.join(`,`)},f=`g_${this.#n}_hcm_highlight_filter`,p=this.#s=this.#m(f);return this.#p(p),this.#g(d(l[0],u[0],5),d(l[1],u[1],5),d(l[2],u[2],5),p),this.#l=`url(#${f})`,this.#l}destroy(e=!1){e&&(this.#o||this.#l)||(this.#t&&=(this.#t.parentNode.parentNode.remove(),null),this.#e&&=(this.#e.clear(),null),this.#u=0)}#p(e){let t=this.#r.createElementNS(a,`feColorMatrix`);t.setAttribute(`type`,`matrix`),t.setAttribute(`values`,`0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0`),e.append(t)}#m(e){let t=this.#r.createElementNS(a,`filter`);return t.setAttribute(`color-interpolation-filters`,`sRGB`),t.setAttribute(`id`,e),this.#f.append(t),t}#h(e,t,n){let r=this.#r.createElementNS(a,t);r.setAttribute(`type`,`discrete`),r.setAttribute(`tableValues`,n),e.append(r)}#g(e,t,n,r){let i=this.#r.createElementNS(a,`feComponentTransfer`);r.append(i),this.#h(i,`feFuncR`,e),this.#h(i,`feFuncG`,t),this.#h(i,`feFuncB`,n)}#_(e){return this.#f.style.color=e,D(getComputedStyle(this.#f).getPropertyValue(`color`))}}t.DOMFilterFactory=s;class c extends r.BaseCanvasFactory{constructor({ownerDocument:e=globalThis.document}={}){super(),this._document=e}_createCanvas(e,t){let n=this._document.createElement(`canvas`);return n.width=e,n.height=t,n}}t.DOMCanvasFactory=c;async function l(e,t=!1){if(b(e,document.baseURI)){let n=await fetch(e);if(!n.ok)throw Error(n.statusText);return t?new Uint8Array(await n.arrayBuffer()):(0,i.stringToBytes)(await n.text())}return new Promise((n,r)=>{let a=new XMLHttpRequest;a.open(`GET`,e,!0),t&&(a.responseType=`arraybuffer`),a.onreadystatechange=()=>{if(a.readyState===XMLHttpRequest.DONE){if(a.status===200||a.status===0){let e;if(t&&a.response?e=new Uint8Array(a.response):!t&&a.responseText&&(e=(0,i.stringToBytes)(a.responseText)),e){n(e);return}}r(Error(a.statusText))}},a.send(null)})}class u extends r.BaseCMapReaderFactory{_fetchData(e,t){return l(e,this.isCompressed).then(e=>({cMapData:e,compressionType:t}))}}t.DOMCMapReaderFactory=u;class d extends r.BaseStandardFontDataFactory{_fetchData(e){return l(e,!0)}}t.DOMStandardFontDataFactory=d;class f extends r.BaseSVGFactory{_createSVG(e){return document.createElementNS(a,e)}}t.DOMSVGFactory=f;class p{constructor({viewBox:e,scale:t,rotation:n,offsetX:r=0,offsetY:i=0,dontFlip:a=!1}){this.viewBox=e,this.scale=t,this.rotation=n,this.offsetX=r,this.offsetY=i;let o=(e[2]+e[0])/2,s=(e[3]+e[1])/2,c,l,u,d;switch(n%=360,n<0&&(n+=360),n){case 180:c=-1,l=0,u=0,d=1;break;case 90:c=0,l=1,u=1,d=0;break;case 270:c=0,l=-1,u=-1,d=0;break;case 0:c=1,l=0,u=0,d=-1;break;default:throw Error(`PageViewport: Invalid rotation, must be a multiple of 90 degrees.`)}a&&(u=-u,d=-d);let f,p,m,h;c===0?(f=Math.abs(s-e[1])*t+r,p=Math.abs(o-e[0])*t+i,m=(e[3]-e[1])*t,h=(e[2]-e[0])*t):(f=Math.abs(o-e[0])*t+r,p=Math.abs(s-e[1])*t+i,m=(e[2]-e[0])*t,h=(e[3]-e[1])*t),this.transform=[c*t,l*t,u*t,d*t,f-c*t*o-u*t*s,p-l*t*o-d*t*s],this.width=m,this.height=h}get rawDims(){let{viewBox:e}=this;return(0,i.shadow)(this,`rawDims`,{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:n=this.offsetX,offsetY:r=this.offsetY,dontFlip:i=!1}={}){return new p({viewBox:this.viewBox.slice(),scale:e,rotation:t,offsetX:n,offsetY:r,dontFlip:i})}convertToViewportPoint(e,t){return i.Util.applyTransform([e,t],this.transform)}convertToViewportRectangle(e){let t=i.Util.applyTransform([e[0],e[1]],this.transform),n=i.Util.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],n[0],n[1]]}convertToPdfPoint(e,t){return i.Util.applyInverseTransform([e,t],this.transform)}}t.PageViewport=p;class m extends i.BaseException{constructor(e,t=0){super(e,`RenderingCancelledException`),this.extraDelay=t}}t.RenderingCancelledException=m;function h(e){let t=e.length,n=0;for(;n<t&&e[n].trim()===``;)n++;return e.substring(n,n+5).toLowerCase()===`data:`}function g(e){return typeof e==`string`&&/\.pdf$/i.test(e)}function _(e,t=!1){return t||([e]=e.split(/[#?]/,1)),e.substring(e.lastIndexOf(`/`)+1)}function v(e,t=`document.pdf`){if(typeof e!=`string`)return t;if(h(e))return(0,i.warn)(`getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.`),t;let n=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,r=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,a=n.exec(e),o=r.exec(a[1])||r.exec(a[2])||r.exec(a[3]);if(o&&(o=o[0],o.includes(`%`)))try{o=r.exec(decodeURIComponent(o))[0]}catch{}return o||t}class y{started=Object.create(null);times=[];time(e){e in this.started&&(0,i.warn)(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||(0,i.warn)(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){let e=[],t=0;for(let{name:e}of this.times)t=Math.max(e.length,t);for(let{name:n,start:r,end:i}of this.times)e.push(`${n.padEnd(t)} ${i-r}ms\n`);return e.join(``)}}t.StatTimer=y;function b(e,t){try{let{protocol:n}=t?new URL(e,t):new URL(e);return n===`http:`||n===`https:`}catch{return!1}}function x(e){e.preventDefault()}function S(e,t=!1){return new Promise((n,r)=>{let i=document.createElement(`script`);i.src=e,i.onload=function(e){t&&i.remove(),n(e)},i.onerror=function(){r(Error(`Cannot load script at: ${i.src}`))},(document.head||document.documentElement).append(i)})}function C(e){console.log(`Deprecated API usage: `+e)}let w;class T{static toDateObject(e){if(!e||typeof e!=`string`)return null;w||=RegExp(`^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?`);let t=w.exec(e);if(!t)return null;let n=parseInt(t[1],10),r=parseInt(t[2],10);r=r>=1&&r<=12?r-1:0;let i=parseInt(t[3],10);i=i>=1&&i<=31?i:1;let a=parseInt(t[4],10);a=a>=0&&a<=23?a:0;let o=parseInt(t[5],10);o=o>=0&&o<=59?o:0;let s=parseInt(t[6],10);s=s>=0&&s<=59?s:0;let c=t[7]||`Z`,l=parseInt(t[8],10);l=l>=0&&l<=23?l:0;let u=parseInt(t[9],10)||0;return u=u>=0&&u<=59?u:0,c===`-`?(a+=l,o+=u):c===`+`&&(a-=l,o-=u),new Date(Date.UTC(n,r,i,a,o,s))}}t.PDFDateString=T;function E(e,{scale:t=1,rotation:n=0}){let{width:r,height:i}=e.attributes.style;return new p({viewBox:[0,0,parseInt(r),parseInt(i)],scale:t,rotation:n})}function D(e){if(e.startsWith(`#`)){let t=parseInt(e.slice(1),16);return[(t&16711680)>>16,(t&65280)>>8,t&255]}return e.startsWith(`rgb(`)?e.slice(4,-1).split(`,`).map(e=>parseInt(e)):e.startsWith(`rgba(`)?e.slice(5,-1).split(`,`).map(e=>parseInt(e)).slice(0,3):((0,i.warn)(`Not a valid color format: "${e}"`),[0,0,0])}function O(e){let t=document.createElement(`span`);t.style.visibility=`hidden`,document.body.append(t);for(let n of e.keys()){t.style.color=n;let r=window.getComputedStyle(t).color;e.set(n,D(r))}t.remove()}function k(e){let{a:t,b:n,c:r,d:i,e:a,f:o}=e.getTransform();return[t,n,r,i,a,o]}function A(e){let{a:t,b:n,c:r,d:i,e:a,f:o}=e.getTransform().invertSelf();return[t,n,r,i,a,o]}function j(e,t,n=!1,r=!0){if(t instanceof p){let{pageWidth:r,pageHeight:a}=t.rawDims,{style:o}=e,s=i.FeatureTest.isCSSRoundSupported,c=`var(--scale-factor) * ${r}px`,l=`var(--scale-factor) * ${a}px`,u=s?`round(${c}, 1px)`:`calc(${c})`,d=s?`round(${l}, 1px)`:`calc(${l})`;!n||t.rotation%180==0?(o.width=u,o.height=d):(o.width=d,o.height=u)}r&&e.setAttribute(`data-main-rotation`,t.rotation)}}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseStandardFontDataFactory=t.BaseSVGFactory=t.BaseFilterFactory=t.BaseCanvasFactory=t.BaseCMapReaderFactory=void 0;var r=n(1);class i{constructor(){this.constructor===i&&(0,r.unreachable)(`Cannot initialize BaseFilterFactory.`)}addFilter(e){return`none`}addHCMFilter(e,t){return`none`}addHighlightHCMFilter(e,t,n,r){return`none`}destroy(e=!1){}}t.BaseFilterFactory=i;class a{constructor(){this.constructor===a&&(0,r.unreachable)(`Cannot initialize BaseCanvasFactory.`)}create(e,t){if(e<=0||t<=0)throw Error(`Invalid canvas size`);let n=this._createCanvas(e,t);return{canvas:n,context:n.getContext(`2d`)}}reset(e,t,n){if(!e.canvas)throw Error(`Canvas is not specified`);if(t<=0||n<=0)throw Error(`Invalid canvas size`);e.canvas.width=t,e.canvas.height=n}destroy(e){if(!e.canvas)throw Error(`Canvas is not specified`);e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){(0,r.unreachable)("Abstract method `_createCanvas` called.")}}t.BaseCanvasFactory=a;class o{constructor({baseUrl:e=null,isCompressed:t=!0}){this.constructor===o&&(0,r.unreachable)(`Cannot initialize BaseCMapReaderFactory.`),this.baseUrl=e,this.isCompressed=t}async fetch({name:e}){if(!this.baseUrl)throw Error(`The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.`);if(!e)throw Error(`CMap name must be specified.`);let t=this.baseUrl+e+(this.isCompressed?`.bcmap`:``),n=this.isCompressed?r.CMapCompressionType.BINARY:r.CMapCompressionType.NONE;return this._fetchData(t,n).catch(e=>{throw Error(`Unable to load ${this.isCompressed?`binary `:``}CMap at: ${t}`)})}_fetchData(e,t){(0,r.unreachable)("Abstract method `_fetchData` called.")}}t.BaseCMapReaderFactory=o;class s{constructor({baseUrl:e=null}){this.constructor===s&&(0,r.unreachable)(`Cannot initialize BaseStandardFontDataFactory.`),this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw Error(`The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.`);if(!e)throw Error(`Font filename must be specified.`);let t=`${this.baseUrl}${e}`;return this._fetchData(t).catch(e=>{throw Error(`Unable to load font data at: ${t}`)})}_fetchData(e){(0,r.unreachable)("Abstract method `_fetchData` called.")}}t.BaseStandardFontDataFactory=s;class c{constructor(){this.constructor===c&&(0,r.unreachable)(`Cannot initialize BaseSVGFactory.`)}create(e,t,n=!1){if(e<=0||t<=0)throw Error(`Invalid SVG dimensions`);let r=this._createSVG(`svg:svg`);return r.setAttribute(`version`,`1.1`),n||(r.setAttribute(`width`,`${e}px`),r.setAttribute(`height`,`${t}px`)),r.setAttribute(`preserveAspectRatio`,`none`),r.setAttribute(`viewBox`,`0 0 ${e} ${t}`),r}createElement(e){if(typeof e!=`string`)throw Error(`Invalid SVG element type`);return this._createSVG(e)}_createSVG(e){(0,r.unreachable)("Abstract method `_createSVG` called.")}}t.BaseSVGFactory=c}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MurmurHash3_64=void 0;var r=n(1);let i=3285377520,a=4294901760,o=65535;class s{constructor(e){this.h1=e?e&4294967295:i,this.h2=e?e&4294967295:i}update(e){let t,n;if(typeof e==`string`){t=new Uint8Array(e.length*2),n=0;for(let r=0,i=e.length;r<i;r++){let i=e.charCodeAt(r);i<=255?t[n++]=i:(t[n++]=i>>>8,t[n++]=i&255)}}else if((0,r.isArrayBuffer)(e))t=e.slice(),n=t.byteLength;else throw Error(`Wrong data format in MurmurHash3_64_update. Input must be a string or array.`);let i=n>>2,s=n-i*4,c=new Uint32Array(t.buffer,0,i),l=0,u=0,d=this.h1,f=this.h2,p=3432918353,m=461845907,h=11601,g=13715;for(let e=0;e<i;e++)e&1?(l=c[e],l=l*p&a|l*h&o,l=l<<15|l>>>17,l=l*m&a|l*g&o,d^=l,d=d<<13|d>>>19,d=d*5+3864292196):(u=c[e],u=u*p&a|u*h&o,u=u<<15|u>>>17,u=u*m&a|u*g&o,f^=u,f=f<<13|f>>>19,f=f*5+3864292196);switch(l=0,s){case 3:l^=t[i*4+2]<<16;case 2:l^=t[i*4+1]<<8;case 1:l^=t[i*4],l=l*p&a|l*h&o,l=l<<15|l>>>17,l=l*m&a|l*g&o,i&1?d^=l:f^=l}this.h1=d,this.h2=f}hexdigest(){let e=this.h1,t=this.h2;return e^=t>>>1,e=e*3981806797&a|e*36045&o,t=t*4283543511&a|((t<<16|e>>>16)*2950163797&a)>>>16,e^=t>>>1,e=e*444984403&a|e*60499&o,t=t*3301882366&a|((t<<16|e>>>16)*3120437893&a)>>>16,e^=t>>>1,(e>>>0).toString(16).padStart(8,`0`)+(t>>>0).toString(16).padStart(8,`0`)}}t.MurmurHash3_64=s}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FontLoader=t.FontFaceObject=void 0;var r=n(1);class i{#e=new Set;constructor({ownerDocument:e=globalThis.document,styleElement:t=null}){this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){this.styleElement||(this.styleElement=this._document.createElement(`style`),this._document.documentElement.getElementsByTagName(`head`)[0].append(this.styleElement));let t=this.styleElement.sheet;t.insertRule(e,t.cssRules.length)}clear(){for(let e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),this.#e.clear(),this.styleElement&&=(this.styleElement.remove(),null)}async loadSystemFont(e){if(!(!e||this.#e.has(e.loadedName))){if((0,r.assert)(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:t,src:n,style:i}=e,a=new FontFace(t,n,i);this.addNativeFontFace(a);try{await a.load(),this.#e.add(t)}catch{(0,r.warn)(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(a)}return}(0,r.unreachable)(`Not implemented: loadSystemFont without the Font Loading API.`)}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e.systemFontInfo);return}if(this.isFontLoadingAPISupported){let t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(n){throw(0,r.warn)(`Failed to load font '${t.family}': '${n}'.`),e.disableFontFace=!0,n}}return}let t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise(t=>{let n=this._queueLoadingCallback(t);this._prepareFontLoadEvent(e,n)})}}get isFontLoadingAPISupported(){let e=!!this._document?.fonts;return(0,r.shadow)(this,`isFontLoadingAPISupported`,e)}get isSyncFontLoadingSupported(){let e=!1;return(r.isNodeJS||typeof navigator<`u`&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(e=!0),(0,r.shadow)(this,`isSyncFontLoadingSupported`,e)}_queueLoadingCallback(e){function t(){for((0,r.assert)(!i.done,`completeRequest() cannot be called twice.`),i.done=!0;n.length>0&&n[0].done;){let e=n.shift();setTimeout(e.callback,0)}}let{loadingRequests:n}=this,i={done:!1,complete:t,callback:e};return n.push(i),i}get _loadTestFont(){let e=atob(`T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==`);return(0,r.shadow)(this,`_loadTestFont`,e)}_prepareFontLoadEvent(e,t){function n(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3)&255}function i(e,t,n,r){let i=e.substring(0,t),a=e.substring(t+n);return i+r+a}let a,o,s=this._document.createElement(`canvas`);s.width=1,s.height=1;let c=s.getContext(`2d`),l=0;function u(e,t){if(++l>30){(0,r.warn)(`Load test font never loaded.`),t();return}if(c.font=`30px `+e,c.fillText(`.`,0,20),c.getImageData(0,0,1,1).data[3]>0){t();return}setTimeout(u.bind(null,e,t))}let d=`lt${Date.now()}${this.loadTestFontId++}`,f=this._loadTestFont;f=i(f,976,d.length,d);let p=16,m=1482184792,h=n(f,16);for(a=0,o=d.length-3;a<o;a+=4)h=h-m+n(d,a)|0;a<d.length&&(h=h-m+n(d+`XXX`,a)|0),f=i(f,16,4,(0,r.string32)(h));let g=`@font-face {font-family:"${d}";src:${`url(data:font/opentype;base64,${btoa(f)});`}}`;this.insertRule(g);let _=this._document.createElement(`div`);_.style.visibility=`hidden`,_.style.width=_.style.height=`10px`,_.style.position=`absolute`,_.style.top=_.style.left=`0px`;for(let t of[e.loadedName,d]){let e=this._document.createElement(`span`);e.textContent=`Hi`,e.style.fontFamily=t,_.append(e)}this._document.body.append(_),u(d,()=>{_.remove(),t.complete()})}}t.FontLoader=i;class a{constructor(e,{isEvalSupported:t=!0,disableFontFace:n=!1,ignoreErrors:r=!1,inspectFont:i=null}){this.compiledGlyphs=Object.create(null);for(let t in e)this[t]=e[t];this.isEvalSupported=t!==!1,this.disableFontFace=n===!0,this.ignoreErrors=r===!0,this._inspectFont=i}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{let t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}return this._inspectFont?.(this),e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;let e=(0,r.bytesToString)(this.data),t=`url(data:${this.mimetype};base64,${btoa(e)});`,n;if(!this.cssFontInfo)n=`@font-face {font-family:"${this.loadedName}";src:${t}}`;else{let e=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(e+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),n=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${e}src:${t}}`}return this._inspectFont?.(this,t),n}getPathGenerator(e,t){if(this.compiledGlyphs[t]!==void 0)return this.compiledGlyphs[t];let n;try{n=e.get(this.loadedName+`_path_`+t)}catch(e){if(!this.ignoreErrors)throw e;return(0,r.warn)(`getPathGenerator - ignoring character: "${e}".`),this.compiledGlyphs[t]=function(e,t){}}if(this.isEvalSupported&&r.FeatureTest.isEvalSupported){let e=[];for(let t of n){let n=t.args===void 0?``:t.args.join(`,`);e.push(`c.`,t.cmd,`(`,n,`);
2
- `)}return this.compiledGlyphs[t]=Function(`c`,`size`,e.join(``))}return this.compiledGlyphs[t]=function(e,t){for(let r of n)r.cmd===`scale`&&(r.args=[t,-t]),e[r.cmd].apply(e,r.args)}}}t.FontFaceObject=a}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NodeStandardFontDataFactory=t.NodeFilterFactory=t.NodeCanvasFactory=t.NodeCMapReaderFactory=void 0;var r=n(7),i=n(1);let a=function(e){return new Promise((t,n)=>{require___vite_browser_external().readFile(e,(e,r)=>{if(e||!r){n(Error(e));return}t(new Uint8Array(r))})})};class o extends r.BaseFilterFactory{}t.NodeFilterFactory=o;class s extends r.BaseCanvasFactory{_createCanvas(e,t){return require___vite_browser_external().createCanvas(e,t)}}t.NodeCanvasFactory=s;class c extends r.BaseCMapReaderFactory{_fetchData(e,t){return a(e).then(e=>({cMapData:e,compressionType:t}))}}t.NodeCMapReaderFactory=c;class l extends r.BaseStandardFontDataFactory{_fetchData(e){return a(e)}}t.NodeStandardFontDataFactory=l}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CanvasGraphics=void 0;var r=n(1),i=n(6),a=n(12),o=n(13);let s=16,c=100,l=4096,u=15,d=10,f=1e3,p=16;function m(e,t){if(e._removeMirroring)throw Error(`Context is already forwarding operations.`);e.__originalSave=e.save,e.__originalRestore=e.restore,e.__originalRotate=e.rotate,e.__originalScale=e.scale,e.__originalTranslate=e.translate,e.__originalTransform=e.transform,e.__originalSetTransform=e.setTransform,e.__originalResetTransform=e.resetTransform,e.__originalClip=e.clip,e.__originalMoveTo=e.moveTo,e.__originalLineTo=e.lineTo,e.__originalBezierCurveTo=e.bezierCurveTo,e.__originalRect=e.rect,e.__originalClosePath=e.closePath,e.__originalBeginPath=e.beginPath,e._removeMirroring=()=>{e.save=e.__originalSave,e.restore=e.__originalRestore,e.rotate=e.__originalRotate,e.scale=e.__originalScale,e.translate=e.__originalTranslate,e.transform=e.__originalTransform,e.setTransform=e.__originalSetTransform,e.resetTransform=e.__originalResetTransform,e.clip=e.__originalClip,e.moveTo=e.__originalMoveTo,e.lineTo=e.__originalLineTo,e.bezierCurveTo=e.__originalBezierCurveTo,e.rect=e.__originalRect,e.closePath=e.__originalClosePath,e.beginPath=e.__originalBeginPath,delete e._removeMirroring},e.save=function(){t.save(),this.__originalSave()},e.restore=function(){t.restore(),this.__originalRestore()},e.translate=function(e,n){t.translate(e,n),this.__originalTranslate(e,n)},e.scale=function(e,n){t.scale(e,n),this.__originalScale(e,n)},e.transform=function(e,n,r,i,a,o){t.transform(e,n,r,i,a,o),this.__originalTransform(e,n,r,i,a,o)},e.setTransform=function(e,n,r,i,a,o){t.setTransform(e,n,r,i,a,o),this.__originalSetTransform(e,n,r,i,a,o)},e.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},e.rotate=function(e){t.rotate(e),this.__originalRotate(e)},e.clip=function(e){t.clip(e),this.__originalClip(e)},e.moveTo=function(e,n){t.moveTo(e,n),this.__originalMoveTo(e,n)},e.lineTo=function(e,n){t.lineTo(e,n),this.__originalLineTo(e,n)},e.bezierCurveTo=function(e,n,r,i,a,o){t.bezierCurveTo(e,n,r,i,a,o),this.__originalBezierCurveTo(e,n,r,i,a,o)},e.rect=function(e,n,r,i){t.rect(e,n,r,i),this.__originalRect(e,n,r,i)},e.closePath=function(){t.closePath(),this.__originalClosePath()},e.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}class h{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,t,n){let r;return this.cache[e]===void 0?(r=this.canvasFactory.create(t,n),this.cache[e]=r):(r=this.cache[e],this.canvasFactory.reset(r,t,n)),r}delete(e){delete this.cache[e]}clear(){for(let e in this.cache){let t=this.cache[e];this.canvasFactory.destroy(t),delete this.cache[e]}}}function g(e,t,n,r,a,o,s,c,l,u){let[d,f,p,m,h,g]=(0,i.getCurrentTransform)(e);if(f===0&&p===0){let i=s*d+h,_=Math.round(i),v=c*m+g,y=Math.round(v),b=(s+l)*d+h,x=Math.abs(Math.round(b)-_)||1,S=(c+u)*m+g,C=Math.abs(Math.round(S)-y)||1;return e.setTransform(Math.sign(d),0,0,Math.sign(m),_,y),e.drawImage(t,n,r,a,o,0,0,x,C),e.setTransform(d,f,p,m,h,g),[x,C]}if(d===0&&m===0){let i=c*p+h,_=Math.round(i),v=s*f+g,y=Math.round(v),b=(c+u)*p+h,x=Math.abs(Math.round(b)-_)||1,S=(s+l)*f+g,C=Math.abs(Math.round(S)-y)||1;return e.setTransform(0,Math.sign(f),Math.sign(p),0,_,y),e.drawImage(t,n,r,a,o,0,0,C,x),e.setTransform(d,f,p,m,h,g),[C,x]}e.drawImage(t,n,r,a,o,s,c,l,u);let _=Math.hypot(d,f),v=Math.hypot(p,m);return[_*l,v*u]}function _(e){let{width:t,height:n}=e;if(t>f||n>f)return null;let r=1e3,i=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),a=t+1,o=new Uint8Array(a*(n+1)),s,c,l,u=t+7&-8,d=new Uint8Array(u*n),p=0;for(let t of e.data){let e=128;for(;e>0;)d[p++]=t&e?0:255,e>>=1}let m=0;for(p=0,d[p]!==0&&(o[0]=1,++m),c=1;c<t;c++)d[p]!==d[p+1]&&(o[c]=d[p]?2:1,++m),p++;for(d[p]!==0&&(o[c]=2,++m),s=1;s<n;s++){p=s*u,l=s*a,d[p-u]!==d[p]&&(o[l]=d[p]?1:8,++m);let e=(d[p]?4:0)+(d[p-u]?8:0);for(c=1;c<t;c++)e=(e>>2)+(d[p+1]?4:0)+(d[p-u+1]?8:0),i[e]&&(o[l+c]=i[e],++m),p++;if(d[p-u]!==d[p]&&(o[l+c]=d[p]?2:4,++m),m>r)return null}for(p=u*(n-1),l=s*a,d[p]!==0&&(o[l]=8,++m),c=1;c<t;c++)d[p]!==d[p+1]&&(o[l+c]=d[p]?4:8,++m),p++;if(d[p]!==0&&(o[l+c]=4,++m),m>r)return null;let h=new Int32Array([0,a,-1,0,-a,0,0,0,1]),g=new Path2D;for(s=0;m&&s<=n;s++){let e=s*a,n=e+t;for(;e<n&&!o[e];)e++;if(e===n)continue;g.moveTo(e%a,s);let r=e,i=o[e];do{let t=h[i];do e+=t;while(!o[e]);let n=o[e];n!==5&&n!==10?(i=n,o[e]=0):(i=n&51*i>>4,o[e]&=i>>2|i<<2),g.lineTo(e%a,e/a|0),o[e]||--m}while(r!==e);--s}return d=null,o=null,function(e){e.save(),e.scale(1/t,-1/n),e.translate(0,-n),e.fill(g),e.beginPath(),e.restore()}}class v{constructor(e,t){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=`none`,this.startNewPathAndClipBox([0,0,e,t])}clone(){let e=Object.create(this);return e.clipBox=this.clipBox.slice(),e}setCurrentPoint(e,t){this.x=e,this.y=t}updatePathMinMax(e,t,n){[t,n]=r.Util.applyTransform([t,n],e),this.minX=Math.min(this.minX,t),this.minY=Math.min(this.minY,n),this.maxX=Math.max(this.maxX,t),this.maxY=Math.max(this.maxY,n)}updateRectMinMax(e,t){let n=r.Util.applyTransform(t,e),i=r.Util.applyTransform(t.slice(2),e);this.minX=Math.min(this.minX,n[0],i[0]),this.minY=Math.min(this.minY,n[1],i[1]),this.maxX=Math.max(this.maxX,n[0],i[0]),this.maxY=Math.max(this.maxY,n[1],i[1])}updateScalingPathMinMax(e,t){r.Util.scaleMinMax(e,t),this.minX=Math.min(this.minX,t[0]),this.maxX=Math.max(this.maxX,t[1]),this.minY=Math.min(this.minY,t[2]),this.maxY=Math.max(this.maxY,t[3])}updateCurvePathMinMax(e,t,n,i,a,o,s,c,l,u){let d=r.Util.bezierBoundingBox(t,n,i,a,o,s,c,l);if(u){u[0]=Math.min(u[0],d[0],d[2]),u[1]=Math.max(u[1],d[0],d[2]),u[2]=Math.min(u[2],d[1],d[3]),u[3]=Math.max(u[3],d[1],d[3]);return}this.updateRectMinMax(e,d)}getPathBoundingBox(e=a.PathType.FILL,t=null){let n=[this.minX,this.minY,this.maxX,this.maxY];if(e===a.PathType.STROKE){t||(0,r.unreachable)(`Stroke bounding box must include transform.`);let e=r.Util.singularValueDecompose2dScale(t),i=e[0]*this.lineWidth/2,a=e[1]*this.lineWidth/2;n[0]-=i,n[1]-=a,n[2]+=i,n[3]+=a}return n}updateClipFromPath(){let e=r.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(e){this.clipBox=e,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(e=a.PathType.FILL,t=null){return r.Util.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function y(e,t){if(typeof ImageData<`u`&&t instanceof ImageData){e.putImageData(t,0,0);return}let n=t.height,i=t.width,a=n%16,o=(n-a)/16,s=a===0?o:o+1,c=e.createImageData(i,16),l=0,u,d=t.data,f=c.data,p,m,h,g;if(t.kind===r.ImageKind.GRAYSCALE_1BPP){let t=d.byteLength,n=new Uint32Array(f.buffer,0,f.byteLength>>2),g=n.length,_=i+7>>3,v=4294967295,y=r.FeatureTest.isLittleEndian?4278190080:255;for(p=0;p<s;p++){for(h=p<o?16:a,u=0,m=0;m<h;m++){let e=t-l,r=0,a=e>_?i:e*8-7,o=a&-8,s=0,c=0;for(;r<o;r+=8)c=d[l++],n[u++]=c&128?v:y,n[u++]=c&64?v:y,n[u++]=c&32?v:y,n[u++]=c&16?v:y,n[u++]=c&8?v:y,n[u++]=c&4?v:y,n[u++]=c&2?v:y,n[u++]=c&1?v:y;for(;r<a;r++)s===0&&(c=d[l++],s=128),n[u++]=c&s?v:y,s>>=1}for(;u<g;)n[u++]=0;e.putImageData(c,0,p*16)}}else if(t.kind===r.ImageKind.RGBA_32BPP){for(m=0,g=i*16*4,p=0;p<o;p++)f.set(d.subarray(l,l+g)),l+=g,e.putImageData(c,0,m),m+=16;p<s&&(g=i*a*4,f.set(d.subarray(l,l+g)),e.putImageData(c,0,m))}else if(t.kind===r.ImageKind.RGB_24BPP)for(h=16,g=i*h,p=0;p<s;p++){for(p>=o&&(h=a,g=i*h),u=0,m=g;m--;)f[u++]=d[l++],f[u++]=d[l++],f[u++]=d[l++],f[u++]=255;e.putImageData(c,0,p*16)}else throw Error(`bad image kind: ${t.kind}`)}function b(e,t){if(t.bitmap){e.drawImage(t.bitmap,0,0);return}let n=t.height,r=t.width,i=n%16,a=(n-i)/16,s=i===0?a:a+1,c=e.createImageData(r,16),l=0,u=t.data,d=c.data;for(let t=0;t<s;t++){let n=t<a?16:i;({srcPos:l}=(0,o.convertBlackAndWhiteToRGBA)({src:u,srcPos:l,dest:d,width:r,height:n,nonBlackColor:0})),e.putImageData(c,0,t*16)}}function x(e,t){for(let n of[`strokeStyle`,`fillStyle`,`fillRule`,`globalAlpha`,`lineWidth`,`lineCap`,`lineJoin`,`miterLimit`,`globalCompositeOperation`,`font`,`filter`])e[n]!==void 0&&(t[n]=e[n]);e.setLineDash!==void 0&&(t.setLineDash(e.getLineDash()),t.lineDashOffset=e.lineDashOffset)}function S(e){if(e.strokeStyle=e.fillStyle=`#000000`,e.fillRule=`nonzero`,e.globalAlpha=1,e.lineWidth=1,e.lineCap=`butt`,e.lineJoin=`miter`,e.miterLimit=10,e.globalCompositeOperation=`source-over`,e.font=`10px sans-serif`,e.setLineDash!==void 0&&(e.setLineDash([]),e.lineDashOffset=0),!r.isNodeJS){let{filter:t}=e;t!==`none`&&t!==``&&(e.filter=`none`)}}function C(e,t,n,r){let i=e.length;for(let a=3;a<i;a+=4){let i=e[a];if(i===0)e[a-3]=t,e[a-2]=n,e[a-1]=r;else if(i<255){let o=255-i;e[a-3]=e[a-3]*i+t*o>>8,e[a-2]=e[a-2]*i+n*o>>8,e[a-1]=e[a-1]*i+r*o>>8}}}function w(e,t,n){let r=e.length,i=1/255;for(let i=3;i<r;i+=4){let r=n?n[e[i]]:e[i];t[i]=t[i]*r*.00392156862745098|0}}function T(e,t,n){let r=e.length;for(let i=3;i<r;i+=4){let r=e[i-3]*77+e[i-2]*152+e[i-1]*28;t[i]=n?t[i]*n[r>>8]>>8:t[i]*r>>16}}function E(e,t,n,r,i,a,o,s,c,l,u){let d=!!a,f=d?a[0]:0,p=d?a[1]:0,m=d?a[2]:0,h=i===`Luminosity`?T:w,g=Math.min(r,Math.ceil(1048576/n));for(let i=0;i<r;i+=g){let a=Math.min(g,r-i),_=e.getImageData(s-l,i+(c-u),n,a),v=t.getImageData(s,i+c,n,a);d&&C(_.data,f,p,m),h(_.data,v.data,o),t.putImageData(v,s,i+c)}}function D(e,t,n,r){let i=r[0],a=r[1],o=r[2]-i,s=r[3]-a;o!==0&&s!==0&&(E(t.context,n,o,s,t.subtype,t.backdrop,t.transferMap,i,a,t.offsetX,t.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation=`source-over`,e.setTransform(1,0,0,1,0,0),e.drawImage(n.canvas,0,0),e.restore())}function O(e,t){let n=r.Util.singularValueDecompose2dScale(e);n[0]=Math.fround(n[0]),n[1]=Math.fround(n[1]);let a=Math.fround((globalThis.devicePixelRatio||1)*i.PixelsPerInch.PDF_TO_CSS_UNITS);return t===void 0?n[0]<=a||n[1]<=a:t}let k=[`butt`,`round`,`square`],A=[`miter`,`round`,`bevel`],j={},M={};class N{constructor(e,t,n,r,i,{optionalContentConfig:a,markedContentStack:o=null},s,c){this.ctx=e,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=t,this.objs=n,this.canvasFactory=r,this.filterFactory=i,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=o||[],this.optionalContentConfig=a,this.cachedCanvases=new h(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=s,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=c,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(e,t=null){return typeof e==`string`?e.startsWith(`g_`)?this.commonObjs.get(e):this.objs.get(e):t}beginDrawing({transform:e,viewport:t,transparency:n=!1,background:r=null}){let a=this.ctx.canvas.width,o=this.ctx.canvas.height,s=this.ctx.fillStyle;if(this.ctx.fillStyle=r||`#ffffff`,this.ctx.fillRect(0,0,a,o),this.ctx.fillStyle=s,n){let e=this.cachedCanvases.getCanvas(`transparent`,a,o);this.compositeCtx=this.ctx,this.transparentCanvas=e.canvas,this.ctx=e.context,this.ctx.save(),this.ctx.transform(...(0,i.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),S(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=(0,i.getCurrentTransform)(this.ctx)}executeOperatorList(e,t,n,i){let a=e.argsArray,o=e.fnArray,s=t||0,c=a.length;if(c===s)return s;let l=c-s>10&&typeof n==`function`,u=l?Date.now()+15:0,d=0,f=this.commonObjs,p=this.objs,m;for(;;){if(i!==void 0&&s===i.nextBreakPoint)return i.breakIt(s,n),s;if(m=o[s],m!==r.OPS.dependency)this[m].apply(this,a[s]);else for(let e of a[s]){let t=e.startsWith(`g_`)?f:p;if(!t.has(e))return t.get(e,n),s}if(s++,s===c)return s;if(l&&++d>10){if(Date.now()>u)return n(),s;d=0}}}#e(){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(),null)}endDrawing(){this.#e(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(let e of this._cachedBitmapsMap.values()){for(let t of e.values())typeof HTMLCanvasElement<`u`&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),this.#t()}#t(){if(this.pageColors){let e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!==`none`){let t=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=t}}}_scaleImage(e,t){let n=e.width,r=e.height,i=Math.max(Math.hypot(t[0],t[1]),1),a=Math.max(Math.hypot(t[2],t[3]),1),o=n,s=r,c=`prescale1`,l,u;for(;i>2&&o>1||a>2&&s>1;){let t=o,n=s;i>2&&o>1&&(t=o>=16384?Math.floor(o/2)-1||1:Math.ceil(o/2),i/=o/t),a>2&&s>1&&(n=s>=16384?Math.floor(s/2)-1||1:Math.ceil(s)/2,a/=s/n),l=this.cachedCanvases.getCanvas(c,t,n),u=l.context,u.clearRect(0,0,t,n),u.drawImage(e,0,0,o,s,0,0,t,n),e=l.canvas,o=t,s=n,c=c===`prescale1`?`prescale2`:`prescale1`}return{img:e,paintWidth:o,paintHeight:s}}_createMaskCanvas(e){let t=this.ctx,{width:n,height:o}=e,s=this.current.fillColor,c=this.current.patternFill,l=(0,i.getCurrentTransform)(t),u,d,f,p;if((e.bitmap||e.data)&&e.count>1){let t=e.bitmap||e.data.buffer;d=JSON.stringify(c?l:[l.slice(0,4),s]),u=this._cachedBitmapsMap.get(t),u||(u=new Map,this._cachedBitmapsMap.set(t,u));let n=u.get(d);if(n&&!c)return{canvas:n,offsetX:Math.round(Math.min(l[0],l[2])+l[4]),offsetY:Math.round(Math.min(l[1],l[3])+l[5])};f=n}f||(p=this.cachedCanvases.getCanvas(`maskCanvas`,n,o),b(p.context,e));let m=r.Util.transform(l,[1/n,0,0,-1/o,0,0]);m=r.Util.transform(m,[1,0,0,1,0,-o]);let h=r.Util.applyTransform([0,0],m),_=r.Util.applyTransform([n,o],m),v=r.Util.normalizeRect([h[0],h[1],_[0],_[1]]),y=Math.round(v[2]-v[0])||1,x=Math.round(v[3]-v[1])||1,S=this.cachedCanvases.getCanvas(`fillCanvas`,y,x),C=S.context,w=Math.min(h[0],_[0]),T=Math.min(h[1],_[1]);C.translate(-w,-T),C.transform(...m),f||(f=this._scaleImage(p.canvas,(0,i.getCurrentTransformInverse)(C)),f=f.img,u&&c&&u.set(d,f)),C.imageSmoothingEnabled=O((0,i.getCurrentTransform)(C),e.interpolate),g(C,f,0,0,f.width,f.height,0,0,n,o),C.globalCompositeOperation=`source-in`;let E=r.Util.transform((0,i.getCurrentTransformInverse)(C),[1,0,0,1,-w,-T]);return C.fillStyle=c?s.getPattern(t,this,E,a.PathType.FILL):s,C.fillRect(0,0,n,o),u&&!c&&(this.cachedCanvases.delete(`fillCanvas`),u.set(d,S.canvas)),{canvas:S.canvas,offsetX:Math.round(w),offsetY:Math.round(T)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=k[e]}setLineJoin(e){this.ctx.lineJoin=A[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,t){let n=this.ctx;n.setLineDash!==void 0&&(n.setLineDash(e),n.lineDashOffset=t)}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(let[t,n]of e)switch(t){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=n;break;case`ca`:this.current.fillAlpha=n,this.ctx.globalAlpha=n;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.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(n)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){let e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw Error(`beginSMaskMode called while already in smask mode`);let e=this.ctx.canvas.width,t=this.ctx.canvas.height,n=`smaskGroupAt`+this.groupLevel,r=this.cachedCanvases.getCanvas(n,e,t);this.suspendedCtx=this.ctx,this.ctx=r.context;let a=this.ctx;a.setTransform(...(0,i.getCurrentTransform)(this.suspendedCtx)),x(this.suspendedCtx,a),m(a,this.suspendedCtx),this.setGState([[`BM`,`source-over`],[`ca`,1],[`CA`,1]])}endSMaskMode(){if(!this.inSMaskMode)throw Error(`endSMaskMode called while not in smask mode`);this.ctx._removeMirroring(),x(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;e?(e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let t=this.current.activeSMask,n=this.suspendedCtx;D(n,t,this.ctx,e),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}save(){this.inSMaskMode?(x(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();let e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),x(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(e,t,n,r,i,a){this.ctx.transform(e,t,n,r,i,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,t,n){let a=this.ctx,o=this.current,s=o.x,c=o.y,l,u,d=(0,i.getCurrentTransform)(a),f=d[0]===0&&d[3]===0||d[1]===0&&d[2]===0,p=f?n.slice(0):null;for(let n=0,i=0,m=e.length;n<m;n++)switch(e[n]|0){case r.OPS.rectangle:s=t[i++],c=t[i++];let e=t[i++],n=t[i++],m=s+e,h=c+n;a.moveTo(s,c),e===0||n===0?a.lineTo(m,h):(a.lineTo(m,c),a.lineTo(m,h),a.lineTo(s,h)),f||o.updateRectMinMax(d,[s,c,m,h]),a.closePath();break;case r.OPS.moveTo:s=t[i++],c=t[i++],a.moveTo(s,c),f||o.updatePathMinMax(d,s,c);break;case r.OPS.lineTo:s=t[i++],c=t[i++],a.lineTo(s,c),f||o.updatePathMinMax(d,s,c);break;case r.OPS.curveTo:l=s,u=c,s=t[i+4],c=t[i+5],a.bezierCurveTo(t[i],t[i+1],t[i+2],t[i+3],s,c),o.updateCurvePathMinMax(d,l,u,t[i],t[i+1],t[i+2],t[i+3],s,c,p),i+=6;break;case r.OPS.curveTo2:l=s,u=c,a.bezierCurveTo(s,c,t[i],t[i+1],t[i+2],t[i+3]),o.updateCurvePathMinMax(d,l,u,s,c,t[i],t[i+1],t[i+2],t[i+3],p),s=t[i+2],c=t[i+3],i+=4;break;case r.OPS.curveTo3:l=s,u=c,s=t[i+2],c=t[i+3],a.bezierCurveTo(t[i],t[i+1],s,c,s,c),o.updateCurvePathMinMax(d,l,u,t[i],t[i+1],s,c,s,c,p),i+=4;break;case r.OPS.closePath:a.closePath()}f&&o.updateScalingPathMinMax(d,p),o.setCurrentPoint(s,c)}closePath(){this.ctx.closePath()}stroke(e=!0){let t=this.ctx,n=this.current.strokeColor;t.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof n==`object`&&n?.getPattern?(t.save(),t.strokeStyle=n.getPattern(t,this,(0,i.getCurrentTransformInverse)(t),a.PathType.STROKE),this.rescaleAndStroke(!1),t.restore()):this.rescaleAndStroke(!0)),e&&this.consumePath(this.current.getClippedPathBoundingBox()),t.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(e=!0){let t=this.ctx,n=this.current.fillColor,r=this.current.patternFill,o=!1;r&&(t.save(),t.fillStyle=n.getPattern(t,this,(0,i.getCurrentTransformInverse)(t),a.PathType.FILL),o=!0);let s=this.current.getClippedPathBoundingBox();this.contentVisible&&s!==null&&(this.pendingEOFill?(t.fill(`evenodd`),this.pendingEOFill=!1):t.fill()),o&&t.restore(),e&&this.consumePath(s)}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=j}eoClip(){this.pendingClip=M}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(){let e=this.pendingTextPaths,t=this.ctx;if(e===void 0){t.beginPath();return}t.save(),t.beginPath();for(let n of e)t.setTransform(...n.transform),t.translate(n.x,n.y),n.addToPath(t,n.fontSize);t.restore(),t.clip(),t.beginPath(),delete this.pendingTextPaths}setCharSpacing(e){this.current.charSpacing=e}setWordSpacing(e){this.current.wordSpacing=e}setHScale(e){this.current.textHScale=e/100}setLeading(e){this.current.leading=-e}setFont(e,t){let n=this.commonObjs.get(e),i=this.current;if(!n)throw Error(`Can't find font for ${e}`);if(i.fontMatrix=n.fontMatrix||r.FONT_IDENTITY_MATRIX,(i.fontMatrix[0]===0||i.fontMatrix[3]===0)&&(0,r.warn)(`Invalid font matrix for font `+e),t<0?(t=-t,i.fontDirection=-1):i.fontDirection=1,this.current.font=n,this.current.fontSize=t,n.isType3Font)return;let a=n.loadedName||`sans-serif`,o=n.systemFontInfo?.css||`"${a}", ${n.fallbackName}`,s=`normal`;n.black?s=`900`:n.bold&&(s=`bold`);let c=n.italic?`italic`:`normal`,l=t;t<16?l=16:t>100&&(l=100),this.current.fontSizeScale=t/l,this.ctx.font=`${c} ${s} ${l}px ${o}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,t){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=t}setLeadingMoveText(e,t){this.setLeading(-t),this.moveText(e,t)}setTextMatrix(e,t,n,r,i,a){this.current.textMatrix=[e,t,n,r,i,a],this.current.textMatrixScale=Math.hypot(e,t),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(e,t,n,a){let o=this.ctx,s=this.current,c=s.font,l=s.textRenderingMode,u=s.fontSize/s.fontSizeScale,d=l&r.TextRenderingMode.FILL_STROKE_MASK,f=!!(l&r.TextRenderingMode.ADD_TO_PATH_FLAG),p=s.patternFill&&!c.missingFile,m;(c.disableFontFace||f||p)&&(m=c.getPathGenerator(this.commonObjs,e)),c.disableFontFace||p?(o.save(),o.translate(t,n),o.beginPath(),m(o,u),a&&o.setTransform(...a),(d===r.TextRenderingMode.FILL||d===r.TextRenderingMode.FILL_STROKE)&&o.fill(),(d===r.TextRenderingMode.STROKE||d===r.TextRenderingMode.FILL_STROKE)&&o.stroke(),o.restore()):((d===r.TextRenderingMode.FILL||d===r.TextRenderingMode.FILL_STROKE)&&o.fillText(e,t,n),(d===r.TextRenderingMode.STROKE||d===r.TextRenderingMode.FILL_STROKE)&&o.strokeText(e,t,n)),f&&(this.pendingTextPaths||=[]).push({transform:(0,i.getCurrentTransform)(o),x:t,y:n,fontSize:u,addToPath:m})}get isFontSubpixelAAEnabled(){let{context:e}=this.cachedCanvases.getCanvas(`isFontSubpixelAAEnabled`,10,10);e.scale(1.5,1),e.fillText(`I`,0,10);let t=e.getImageData(0,0,10,10).data,n=!1;for(let e=3;e<t.length;e+=4)if(t[e]>0&&t[e]<255){n=!0;break}return(0,r.shadow)(this,`isFontSubpixelAAEnabled`,n)}showText(e){let t=this.current,n=t.font;if(n.isType3Font)return this.showType3Text(e);let o=t.fontSize;if(o===0)return;let s=this.ctx,c=t.fontSizeScale,l=t.charSpacing,u=t.wordSpacing,d=t.fontDirection,f=t.textHScale*d,p=e.length,m=n.vertical,h=m?1:-1,g=n.defaultVMetrics,_=o*t.fontMatrix[0],v=t.textRenderingMode===r.TextRenderingMode.FILL&&!n.disableFontFace&&!t.patternFill;s.save(),s.transform(...t.textMatrix),s.translate(t.x,t.y+t.textRise),d>0?s.scale(f,-1):s.scale(f,1);let y;if(t.patternFill){s.save();let e=t.fillColor.getPattern(s,this,(0,i.getCurrentTransformInverse)(s),a.PathType.FILL);y=(0,i.getCurrentTransform)(s),s.restore(),s.fillStyle=e}let b=t.lineWidth,x=t.textMatrixScale;if(x===0||b===0){let e=t.textRenderingMode&r.TextRenderingMode.FILL_STROKE_MASK;(e===r.TextRenderingMode.STROKE||e===r.TextRenderingMode.FILL_STROKE)&&(b=this.getSinglePixelWidth())}else b/=x;if(c!==1&&(s.scale(c,c),b/=c),s.lineWidth=b,n.isInvalidPDFjsFont){let n=[],r=0;for(let t of e)n.push(t.unicode),r+=t.width;s.fillText(n.join(``),0,0),t.x+=r*_*f,s.restore(),this.compose();return}let S=0,C;for(C=0;C<p;++C){let t=e[C];if(typeof t==`number`){S+=h*t*o/1e3;continue}let r=!1,i=(t.isSpace?u:0)+l,a=t.fontChar,f=t.accent,p,b,x=t.width;if(m){let e=t.vmetric||g,n=-(t.vmetric?e[1]:x*.5)*_,r=e[2]*_;x=e?-e[0]:x,p=n/c,b=(S+r)/c}else p=S/c,b=0;if(n.remeasure&&x>0){let e=s.measureText(a).width*1e3/o*c;if(x<e&&this.isFontSubpixelAAEnabled){let t=x/e;r=!0,s.save(),s.scale(t,1),p/=t}else x!==e&&(p+=(x-e)/2e3*o/c)}if(this.contentVisible&&(t.isInFont||n.missingFile)){if(v&&!f)s.fillText(a,p,b);else if(this.paintChar(a,p,b,y),f){let e=p+o*f.offset.x/c,t=b-o*f.offset.y/c;this.paintChar(f.fontChar,e,t,y)}}let w=m?x*_-i*d:x*_+i*d;S+=w,r&&s.restore()}m?t.y-=S:t.x+=S*f,s.restore(),this.compose()}showType3Text(e){let t=this.ctx,n=this.current,i=n.font,a=n.fontSize,o=n.fontDirection,s=i.vertical?1:-1,c=n.charSpacing,l=n.wordSpacing,u=n.textHScale*o,d=n.fontMatrix||r.FONT_IDENTITY_MATRIX,f=e.length,p=n.textRenderingMode===r.TextRenderingMode.INVISIBLE,m,h,g,_;if(!(p||a===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,t.save(),t.transform(...n.textMatrix),t.translate(n.x,n.y),t.scale(u,o),m=0;m<f;++m){if(h=e[m],typeof h==`number`){_=s*h*a/1e3,this.ctx.translate(_,0),n.x+=_*u;continue}let o=(h.isSpace?l:0)+c,f=i.charProcOperatorList[h.operatorListId];if(!f){(0,r.warn)(`Type3 character "${h.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=h,this.save(),t.scale(a,a),t.transform(...d),this.executeOperatorList(f),this.restore()),g=r.Util.applyTransform([h.width,0],d)[0]*a+o,t.translate(g,0),n.x+=g*u}t.restore(),this.processingType3=null}}setCharWidth(e,t){}setCharWidthAndBounds(e,t,n,r,i,a){this.ctx.rect(n,r,i-n,a-r),this.ctx.clip(),this.endPath()}getColorN_Pattern(e){let t;if(e[0]===`TilingPattern`){let n=e[1],r=this.baseTransform||(0,i.getCurrentTransform)(this.ctx);t=new a.TilingPattern(e,n,this.ctx,{createCanvasGraphics:e=>new N(e,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})},r)}else t=this._getPattern(e[1],e[2]);return t}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(e,t,n){let i=r.Util.makeHexColor(e,t,n);this.ctx.strokeStyle=i,this.current.strokeColor=i}setFillRGBColor(e,t,n){let i=r.Util.makeHexColor(e,t,n);this.ctx.fillStyle=i,this.current.fillColor=i,this.current.patternFill=!1}_getPattern(e,t=null){let n;return this.cachedPatterns.has(e)?n=this.cachedPatterns.get(e):(n=(0,a.getShadingPattern)(this.getObject(e)),this.cachedPatterns.set(e,n)),t&&(n.matrix=t),n}shadingFill(e){if(!this.contentVisible)return;let t=this.ctx;this.save(),t.fillStyle=this._getPattern(e).getPattern(t,this,(0,i.getCurrentTransformInverse)(t),a.PathType.SHADING);let n=(0,i.getCurrentTransformInverse)(t);if(n){let{width:e,height:i}=t.canvas,[a,o,s,c]=r.Util.getAxialAlignedBoundingBox([0,0,e,i],n);this.ctx.fillRect(a,o,s-a,c-o)}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(e,t){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(e)&&e.length===6&&this.transform(...e),this.baseTransform=(0,i.getCurrentTransform)(this.ctx),t)){let e=t[2]-t[0],n=t[3]-t[1];this.ctx.rect(t[0],t[1],e,n),this.current.updateRectMinMax((0,i.getCurrentTransform)(this.ctx),t),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);let t=this.ctx;e.isolated||(0,r.info)(`TODO: Support non-isolated groups.`),e.knockout&&(0,r.warn)(`Knockout groups not supported.`);let n=(0,i.getCurrentTransform)(t);if(e.matrix&&t.transform(...e.matrix),!e.bbox)throw Error(`Bounding box is required.`);let a=r.Util.getAxialAlignedBoundingBox(e.bbox,(0,i.getCurrentTransform)(t)),o=[0,0,t.canvas.width,t.canvas.height];a=r.Util.intersect(a,o)||[0,0,0,0];let s=Math.floor(a[0]),c=Math.floor(a[1]),u=Math.max(Math.ceil(a[2])-s,1),d=Math.max(Math.ceil(a[3])-c,1),f=1,p=1;u>l&&(f=u/l,u=l),d>l&&(p=d/l,d=l),this.current.startNewPathAndClipBox([0,0,u,d]);let m=`groupAt`+this.groupLevel;e.smask&&(m+=`_smask_`+this.smaskCounter++%2);let h=this.cachedCanvases.getCanvas(m,u,d),g=h.context;g.scale(1/f,1/p),g.translate(-s,-c),g.transform(...n),e.smask?this.smaskStack.push({canvas:h.canvas,context:g,offsetX:s,offsetY:c,scaleX:f,scaleY:p,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(s,c),t.scale(f,p),t.save()),x(t,g),this.ctx=g,this.setGState([[`BM`,`source-over`],[`ca`,1],[`CA`,1]]),this.groupStack.push(t),this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;let t=this.ctx,n=this.groupStack.pop();if(this.ctx=n,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();let e=(0,i.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...e);let n=r.Util.getAxialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],e);this.ctx.drawImage(t.canvas,0,0),this.ctx.restore(),this.compose(n)}}beginAnnotation(e,t,n,a,o){if(this.#e(),S(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(t)&&t.length===4){let a=t[2]-t[0],s=t[3]-t[1];if(o&&this.annotationCanvasMap){n=n.slice(),n[4]-=t[0],n[5]-=t[1],t=t.slice(),t[0]=t[1]=0,t[2]=a,t[3]=s;let[o,c]=r.Util.singularValueDecompose2dScale((0,i.getCurrentTransform)(this.ctx)),{viewportScale:l}=this,u=Math.ceil(a*this.outputScaleX*l),d=Math.ceil(s*this.outputScaleY*l);this.annotationCanvas=this.canvasFactory.create(u,d);let{canvas:f,context:p}=this.annotationCanvas;this.annotationCanvasMap.set(e,f),this.annotationCanvas.savedCtx=this.ctx,this.ctx=p,this.ctx.save(),this.ctx.setTransform(o,0,0,-c,0,s*c),S(this.ctx)}else S(this.ctx),this.ctx.rect(t[0],t[1],a,s),this.ctx.clip(),this.endPath()}this.current=new v(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...n),this.transform(...a)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#t(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e){if(!this.contentVisible)return;let t=e.count;e=this.getObject(e.data,e),e.count=t;let n=this.ctx,r=this.processingType3;if(r&&(r.compiled===void 0&&(r.compiled=_(e)),r.compiled)){r.compiled(n);return}let i=this._createMaskCanvas(e),a=i.canvas;n.save(),n.setTransform(1,0,0,1,0,0),n.drawImage(a,i.offsetX,i.offsetY),n.restore(),this.compose()}paintImageMaskXObjectRepeat(e,t,n=0,a=0,o,s){if(!this.contentVisible)return;e=this.getObject(e.data,e);let c=this.ctx;c.save();let l=(0,i.getCurrentTransform)(c);c.transform(t,n,a,o,0,0);let u=this._createMaskCanvas(e);c.setTransform(1,0,0,1,u.offsetX-l[4],u.offsetY-l[5]);for(let e=0,i=s.length;e<i;e+=2){let i=r.Util.transform(l,[t,n,a,o,s[e],s[e+1]]),[d,f]=r.Util.applyTransform([0,0],i);c.drawImage(u.canvas,d,f)}c.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;let t=this.ctx,n=this.current.fillColor,r=this.current.patternFill;for(let o of e){let{data:e,width:s,height:c,transform:l}=o,u=this.cachedCanvases.getCanvas(`maskCanvas`,s,c),d=u.context;d.save(),b(d,this.getObject(e,o)),d.globalCompositeOperation=`source-in`,d.fillStyle=r?n.getPattern(d,this,(0,i.getCurrentTransformInverse)(t),a.PathType.FILL):n,d.fillRect(0,0,s,c),d.restore(),t.save(),t.transform(...l),t.scale(1,-1),g(t,u.canvas,0,0,s,c,0,-1,1,1),t.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;let t=this.getObject(e);if(!t){(0,r.warn)(`Dependent image isn't ready yet`);return}this.paintInlineImageXObject(t)}paintImageXObjectRepeat(e,t,n,i){if(!this.contentVisible)return;let a=this.getObject(e);if(!a){(0,r.warn)(`Dependent image isn't ready yet`);return}let o=a.width,s=a.height,c=[];for(let e=0,r=i.length;e<r;e+=2)c.push({transform:[t,0,0,n,i[e],i[e+1]],x:0,y:0,w:o,h:s});this.paintInlineImageXObjectGroup(a,c)}applyTransferMapsToCanvas(e){return this.current.transferMaps!==`none`&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter=`none`),e.canvas}applyTransferMapsToBitmap(e){if(this.current.transferMaps===`none`)return e.bitmap;let{bitmap:t,width:n,height:r}=e,i=this.cachedCanvases.getCanvas(`inlineImage`,n,r),a=i.context;return a.filter=this.current.transferMaps,a.drawImage(t,0,0),a.filter=`none`,i.canvas}paintInlineImageXObject(e){if(!this.contentVisible)return;let t=e.width,n=e.height,a=this.ctx;if(this.save(),!r.isNodeJS){let{filter:e}=a;e!==`none`&&e!==``&&(a.filter=`none`)}a.scale(1/t,-1/n);let o;if(e.bitmap)o=this.applyTransferMapsToBitmap(e);else if(typeof HTMLElement==`function`&&e instanceof HTMLElement||!e.data)o=e;else{let r=this.cachedCanvases.getCanvas(`inlineImage`,t,n).context;y(r,e),o=this.applyTransferMapsToCanvas(r)}let s=this._scaleImage(o,(0,i.getCurrentTransformInverse)(a));a.imageSmoothingEnabled=O((0,i.getCurrentTransform)(a),e.interpolate),g(a,s.img,0,0,s.paintWidth,s.paintHeight,0,-n,t,n),this.compose(),this.restore()}paintInlineImageXObjectGroup(e,t){if(!this.contentVisible)return;let n=this.ctx,r;if(e.bitmap)r=e.bitmap;else{let t=e.width,n=e.height,i=this.cachedCanvases.getCanvas(`inlineImage`,t,n).context;y(i,e),r=this.applyTransferMapsToCanvas(i)}for(let e of t)n.save(),n.transform(...e.transform),n.scale(1,-1),g(n,r,e.x,e.y,e.w,e.h,0,-1,1,1),n.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e){}markPointProps(e,t){}beginMarkedContent(e){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t){e===`OC`?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(t)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(e){let t=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(e);let n=this.ctx;this.pendingClip&&=(t||(this.pendingClip===M?n.clip(`evenodd`):n.clip()),null),this.current.startNewPathAndClipBox(this.current.clipBox),n.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let e=(0,i.getCurrentTransform)(this.ctx);if(e[1]===0&&e[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{let t=Math.abs(e[0]*e[3]-e[2]*e[1]),n=Math.hypot(e[0],e[2]),r=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(n,r)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){let{lineWidth:e}=this.current,{a:t,b:n,c:r,d:i}=this.ctx.getTransform(),a,o;if(n===0&&r===0){let n=Math.abs(t),r=Math.abs(i);if(n===r){if(e===0)a=o=1/n;else{let t=n*e;a=o=t<1?1/t:1}}else if(e===0)a=1/n,o=1/r;else{let t=n*e,i=r*e;a=t<1?1/t:1,o=i<1?1/i:1}}else{let s=Math.abs(t*i-n*r),c=Math.hypot(t,n),l=Math.hypot(r,i);if(e===0)a=l/s,o=c/s;else{let t=e*s;a=l>t?l/t:1,o=c>t?c/t:1}}this._cachedScaleForStroking[0]=a,this._cachedScaleForStroking[1]=o}return this._cachedScaleForStroking}rescaleAndStroke(e){let{ctx:t}=this,{lineWidth:n}=this.current,[r,i]=this.getScaleForStroking();if(t.lineWidth=n||1,r===1&&i===1){t.stroke();return}let a=t.getLineDash();if(e&&t.save(),t.scale(r,i),a.length>0){let e=Math.max(r,i);t.setLineDash(a.map(t=>t/e)),t.lineDashOffset/=e}t.stroke(),e&&t.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}}t.CanvasGraphics=N;for(let e in r.OPS)N.prototype[e]!==void 0&&(N.prototype[r.OPS[e]]=N.prototype[e])}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TilingPattern=t.PathType=void 0,t.getShadingPattern=p;var r=n(1),i=n(6);let a={FILL:`Fill`,STROKE:`Stroke`,SHADING:`Shading`};t.PathType=a;function o(e,t){if(!t)return;let n=t[2]-t[0],r=t[3]-t[1],i=new Path2D;i.rect(t[0],t[1],n,r),e.clip(i)}class s{constructor(){this.constructor===s&&(0,r.unreachable)(`Cannot initialize BaseShadingPattern.`)}getPattern(){(0,r.unreachable)("Abstract method `getPattern` called.")}}class c extends s{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7],this.matrix=null}_createGradient(e){let t;this._type===`axial`?t=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type===`radial`&&(t=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(let e of this._colorStops)t.addColorStop(e[0],e[1]);return t}getPattern(e,t,n,s){let c;if(s===a.STROKE||s===a.FILL){let a=t.current.getClippedPathBoundingBox(s,(0,i.getCurrentTransform)(e))||[0,0,0,0],l=Math.ceil(a[2]-a[0])||1,u=Math.ceil(a[3]-a[1])||1,d=t.cachedCanvases.getCanvas(`pattern`,l,u,!0),f=d.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(-a[0],-a[1]),n=r.Util.transform(n,[1,0,0,1,a[0],a[1]]),f.transform(...t.baseTransform),this.matrix&&f.transform(...this.matrix),o(f,this._bbox),f.fillStyle=this._createGradient(f),f.fill(),c=e.createPattern(d.canvas,`no-repeat`);let p=new DOMMatrix(n);c.setTransform(p)}else o(e,this._bbox),c=this._createGradient(e);return c}}function l(e,t,n,r,i,a,o,s){let c=t.coords,l=t.colors,u=e.data,d=e.width*4,f;c[n+1]>c[r+1]&&(f=n,n=r,r=f,f=a,a=o,o=f),c[r+1]>c[i+1]&&(f=r,r=i,i=f,f=o,o=s,s=f),c[n+1]>c[r+1]&&(f=n,n=r,r=f,f=a,a=o,o=f);let p=(c[n]+t.offsetX)*t.scaleX,m=(c[n+1]+t.offsetY)*t.scaleY,h=(c[r]+t.offsetX)*t.scaleX,g=(c[r+1]+t.offsetY)*t.scaleY,_=(c[i]+t.offsetX)*t.scaleX,v=(c[i+1]+t.offsetY)*t.scaleY;if(m>=v)return;let y=l[a],b=l[a+1],x=l[a+2],S=l[o],C=l[o+1],w=l[o+2],T=l[s],E=l[s+1],D=l[s+2],O=Math.round(m),k=Math.round(v),A,j,M,N,P,F,I,L;for(let e=O;e<=k;e++){if(e<g){let t=e<m?0:(m-e)/(m-g);A=p-(p-h)*t,j=y-(y-S)*t,M=b-(b-C)*t,N=x-(x-w)*t}else{let t;t=e>v?1:g===v?0:(g-e)/(g-v),A=h-(h-_)*t,j=S-(S-T)*t,M=C-(C-E)*t,N=w-(w-D)*t}let t;t=e<m?0:e>v?1:(m-e)/(m-v),P=p-(p-_)*t,F=y-(y-T)*t,I=b-(b-E)*t,L=x-(x-D)*t;let n=Math.round(Math.min(A,P)),r=Math.round(Math.max(A,P)),i=d*e+n*4;for(let e=n;e<=r;e++)t=(A-e)/(A-P),t<0?t=0:t>1&&(t=1),u[i++]=j-(j-F)*t|0,u[i++]=M-(M-I)*t|0,u[i++]=N-(N-L)*t|0,u[i++]=255}}function u(e,t,n){let r=t.coords,i=t.colors,a,o;switch(t.type){case`lattice`:let s=t.verticesPerRow,c=Math.floor(r.length/s)-1,u=s-1;for(a=0;a<c;a++){let t=a*s;for(let a=0;a<u;a++,t++)l(e,n,r[t],r[t+1],r[t+s],i[t],i[t+1],i[t+s]),l(e,n,r[t+s+1],r[t+1],r[t+s],i[t+s+1],i[t+1],i[t+s])}break;case`triangles`:for(a=0,o=r.length;a<o;a+=3)l(e,n,r[a],r[a+1],r[a+2],i[a],i[a+1],i[a+2]);break;default:throw Error(`illegal figure`)}}class d extends s{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[7],this._background=e[8],this.matrix=null}_createMeshCanvas(e,t,n){let r=1.1,i=3e3,a=2,o=Math.floor(this._bounds[0]),s=Math.floor(this._bounds[1]),c=Math.ceil(this._bounds[2])-o,l=Math.ceil(this._bounds[3])-s,d=Math.min(Math.ceil(Math.abs(c*e[0]*r)),i),f=Math.min(Math.ceil(Math.abs(l*e[1]*r)),i),p=c/d,m=l/f,h={coords:this._coords,colors:this._colors,offsetX:-o,offsetY:-s,scaleX:1/p,scaleY:1/m},g=d+4,_=f+4,v=n.getCanvas(`mesh`,g,_,!1),y=v.context,b=y.createImageData(d,f);if(t){let e=b.data;for(let n=0,r=e.length;n<r;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2],e[n+3]=255}for(let e of this._figures)u(b,e,h);return y.putImageData(b,2,2),{canvas:v.canvas,offsetX:o-2*p,offsetY:s-2*m,scaleX:p,scaleY:m}}getPattern(e,t,n,s){o(e,this._bbox);let c;if(s===a.SHADING)c=r.Util.singularValueDecompose2dScale((0,i.getCurrentTransform)(e));else if(c=r.Util.singularValueDecompose2dScale(t.baseTransform),this.matrix){let e=r.Util.singularValueDecompose2dScale(this.matrix);c=[c[0]*e[0],c[1]*e[1]]}let l=this._createMeshCanvas(c,s===a.SHADING?null:this._background,t.cachedCanvases);return s!==a.SHADING&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(l.offsetX,l.offsetY),e.scale(l.scaleX,l.scaleY),e.createPattern(l.canvas,`no-repeat`)}}class f extends s{getPattern(){return`hotpink`}}function p(e){switch(e[0]){case`RadialAxial`:return new c(e);case`Mesh`:return new d(e);case`Dummy`:return new f}throw Error(`Unknown IR type: ${e[0]}`)}let m={COLORED:1,UNCOLORED:2};class h{static MAX_PATTERN_SIZE=3e3;constructor(e,t,n,r,i){this.operatorList=e[2],this.matrix=e[3]||[1,0,0,1,0,0],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.color=t,this.ctx=n,this.canvasGraphicsFactory=r,this.baseTransform=i}createPatternCanvas(e){let t=this.operatorList,n=this.bbox,a=this.xstep,o=this.ystep,s=this.paintType,c=this.tilingType,l=this.color,u=this.canvasGraphicsFactory;(0,r.info)(`TilingType: `+c);let d=n[0],f=n[1],p=n[2],m=n[3],h=r.Util.singularValueDecompose2dScale(this.matrix),g=r.Util.singularValueDecompose2dScale(this.baseTransform),_=[h[0]*g[0],h[1]*g[1]],v=this.getSizeAndScale(a,this.ctx.canvas.width,_[0]),y=this.getSizeAndScale(o,this.ctx.canvas.height,_[1]),b=e.cachedCanvases.getCanvas(`pattern`,v.size,y.size,!0),x=b.context,S=u.createCanvasGraphics(x);S.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(S,s,l);let C=d,w=f,T=p,E=m;return d<0&&(C=0,T+=Math.abs(d)),f<0&&(w=0,E+=Math.abs(f)),x.translate(-(v.scale*C),-(y.scale*w)),S.transform(v.scale,0,0,y.scale,0,0),x.save(),this.clipBbox(S,C,w,T,E),S.baseTransform=(0,i.getCurrentTransform)(S.ctx),S.executeOperatorList(t),S.endDrawing(),{canvas:b.canvas,scaleX:v.scale,scaleY:y.scale,offsetX:C,offsetY:w}}getSizeAndScale(e,t,n){e=Math.abs(e);let r=Math.max(h.MAX_PATTERN_SIZE,t),i=Math.ceil(e*n);return i>=r?i=r:n=i/e,{scale:n,size:i}}clipBbox(e,t,n,r,a){let o=r-t,s=a-n;e.ctx.rect(t,n,o,s),e.current.updateRectMinMax((0,i.getCurrentTransform)(e.ctx),[t,n,r,a]),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,t,n){let i=e.ctx,a=e.current;switch(t){case m.COLORED:let e=this.ctx;i.fillStyle=e.fillStyle,i.strokeStyle=e.strokeStyle,a.fillColor=e.fillStyle,a.strokeColor=e.strokeStyle;break;case m.UNCOLORED:let o=r.Util.makeHexColor(n[0],n[1],n[2]);i.fillStyle=o,i.strokeStyle=o,a.fillColor=o,a.strokeColor=o;break;default:throw new r.FormatError(`Unsupported paint type: ${t}`)}}getPattern(e,t,n,i){let o=n;i!==a.SHADING&&(o=r.Util.transform(o,t.baseTransform),this.matrix&&(o=r.Util.transform(o,this.matrix)));let s=this.createPatternCanvas(t),c=new DOMMatrix(o);c=c.translate(s.offsetX,s.offsetY),c=c.scale(1/s.scaleX,1/s.scaleY);let l=e.createPattern(s.canvas,`repeat`);return l.setTransform(c),l}}t.TilingPattern=h}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertBlackAndWhiteToRGBA=a,t.convertToRGBA=i,t.grayToRGBA=s;var r=n(1);function i(e){switch(e.kind){case r.ImageKind.GRAYSCALE_1BPP:return a(e);case r.ImageKind.RGB_24BPP:return o(e)}return null}function a({src:e,srcPos:t=0,dest:n,width:i,height:a,nonBlackColor:o=4294967295,inverseDecode:s=!1}){let c=r.FeatureTest.isLittleEndian?4278190080:255,[l,u]=s?[o,c]:[c,o],d=i>>3,f=i&7,p=e.length;n=new Uint32Array(n.buffer);let m=0;for(let r=0;r<a;r++){for(let r=t+d;t<r;t++){let r=t<p?e[t]:255;n[m++]=r&128?u:l,n[m++]=r&64?u:l,n[m++]=r&32?u:l,n[m++]=r&16?u:l,n[m++]=r&8?u:l,n[m++]=r&4?u:l,n[m++]=r&2?u:l,n[m++]=r&1?u:l}if(f===0)continue;let r=t<p?e[t++]:255;for(let e=0;e<f;e++)n[m++]=r&1<<7-e?u:l}return{srcPos:t,destPos:m}}function o({src:e,srcPos:t=0,dest:n,destPos:i=0,width:a,height:o}){let s=0,c=e.length>>2,l=new Uint32Array(e.buffer,t,c);if(r.FeatureTest.isLittleEndian){for(;s<c-2;s+=3,i+=4){let e=l[s],t=l[s+1],r=l[s+2];n[i]=e|4278190080,n[i+1]=e>>>24|t<<8|4278190080,n[i+2]=t>>>16|r<<16|4278190080,n[i+3]=r>>>8|4278190080}for(let t=s*4,r=e.length;t<r;t+=3)n[i++]=e[t]|e[t+1]<<8|e[t+2]<<16|4278190080}else{for(;s<c-2;s+=3,i+=4){let e=l[s],t=l[s+1],r=l[s+2];n[i]=e|255,n[i+1]=e<<24|t>>>8|255,n[i+2]=t<<16|r>>>16|255,n[i+3]=r<<8|255}for(let t=s*4,r=e.length;t<r;t+=3)n[i++]=e[t]<<24|e[t+1]<<16|e[t+2]<<8|255}return{srcPos:t,destPos:i}}function s(e,t){if(r.FeatureTest.isLittleEndian)for(let n=0,r=e.length;n<r;n++)t[n]=e[n]*65793|4278190080;else for(let n=0,r=e.length;n<r;n++)t[n]=e[n]*16843008|255}}),((e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalWorkerOptions=void 0;let n=Object.create(null);t.GlobalWorkerOptions=n,n.workerPort=null,n.workerSrc=``}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MessageHandler=void 0;var r=n(1);let i={UNKNOWN:0,DATA:1,ERROR:2},a={UNKNOWN:0,CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function o(e){switch(e instanceof Error||typeof e==`object`&&e||(0,r.unreachable)(`wrapReason: Expected "reason" to be a (possibly cloned) Error.`),e.name){case`AbortException`:return new r.AbortException(e.message);case`MissingPDFException`:return new r.MissingPDFException(e.message);case`PasswordException`:return new r.PasswordException(e.message,e.code);case`UnexpectedResponseException`:return new r.UnexpectedResponseException(e.message,e.status);case`UnknownErrorException`:return new r.UnknownErrorException(e.message,e.details);default:return new r.UnknownErrorException(e.message,e.toString())}}class s{constructor(e,t,n){this.sourceName=e,this.targetName=t,this.comObj=n,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=e=>{let t=e.data;if(t.targetName!==this.sourceName)return;if(t.stream){this.#t(t);return}if(t.callback){let e=t.callbackId,n=this.callbackCapabilities[e];if(!n)throw Error(`Cannot resolve callback ${e}`);if(delete this.callbackCapabilities[e],t.callback===i.DATA)n.resolve(t.data);else if(t.callback===i.ERROR)n.reject(o(t.reason));else throw Error(`Unexpected callback case`);return}let r=this.actionHandler[t.action];if(!r)throw Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){let e=this.sourceName,a=t.sourceName;new Promise(function(e){e(r(t.data))}).then(function(r){n.postMessage({sourceName:e,targetName:a,callback:i.DATA,callbackId:t.callbackId,data:r})},function(r){n.postMessage({sourceName:e,targetName:a,callback:i.ERROR,callbackId:t.callbackId,reason:o(r)})});return}if(t.streamId){this.#e(t);return}r(t.data)},n.addEventListener(`message`,this._onComObjOnMessage)}on(e,t){let n=this.actionHandler;if(n[e])throw Error(`There is already an actionName called "${e}"`);n[e]=t}send(e,t,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},n)}sendWithPromise(e,t,n){let i=this.callbackId++,a=new r.PromiseCapability;this.callbackCapabilities[i]=a;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:i,data:t},n)}catch(e){a.reject(e)}return a.promise}sendWithStream(e,t,n,i){let s=this.streamId++,c=this.sourceName,l=this.targetName,u=this.comObj;return new ReadableStream({start:n=>{let a=new r.PromiseCapability;return this.streamControllers[s]={controller:n,startCall:a,pullCall:null,cancelCall:null,isClosed:!1},u.postMessage({sourceName:c,targetName:l,action:e,streamId:s,data:t,desiredSize:n.desiredSize},i),a.promise},pull:e=>{let t=new r.PromiseCapability;return this.streamControllers[s].pullCall=t,u.postMessage({sourceName:c,targetName:l,stream:a.PULL,streamId:s,desiredSize:e.desiredSize}),t.promise},cancel:e=>{(0,r.assert)(e instanceof Error,`cancel must have a valid reason`);let t=new r.PromiseCapability;return this.streamControllers[s].cancelCall=t,this.streamControllers[s].isClosed=!0,u.postMessage({sourceName:c,targetName:l,stream:a.CANCEL,streamId:s,reason:o(e)}),t.promise}},n)}#e(e){let t=e.streamId,n=this.sourceName,i=e.sourceName,s=this.comObj,c=this,l=this.actionHandler[e.action],u={enqueue(e,o=1,c){if(this.isCancelled)return;let l=this.desiredSize;this.desiredSize-=o,l>0&&this.desiredSize<=0&&(this.sinkCapability=new r.PromiseCapability,this.ready=this.sinkCapability.promise),s.postMessage({sourceName:n,targetName:i,stream:a.ENQUEUE,streamId:t,chunk:e},c)},close(){this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:n,targetName:i,stream:a.CLOSE,streamId:t}),delete c.streamSinks[t])},error(e){(0,r.assert)(e instanceof Error,`error must have a valid reason`),!this.isCancelled&&(this.isCancelled=!0,s.postMessage({sourceName:n,targetName:i,stream:a.ERROR,streamId:t,reason:o(e)}))},sinkCapability:new r.PromiseCapability,onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};u.sinkCapability.resolve(),u.ready=u.sinkCapability.promise,this.streamSinks[t]=u,new Promise(function(t){t(l(e.data,u))}).then(function(){s.postMessage({sourceName:n,targetName:i,stream:a.START_COMPLETE,streamId:t,success:!0})},function(e){s.postMessage({sourceName:n,targetName:i,stream:a.START_COMPLETE,streamId:t,reason:o(e)})})}#t(e){let t=e.streamId,n=this.sourceName,i=e.sourceName,s=this.comObj,c=this.streamControllers[t],l=this.streamSinks[t];switch(e.stream){case a.START_COMPLETE:e.success?c.startCall.resolve():c.startCall.reject(o(e.reason));break;case a.PULL_COMPLETE:e.success?c.pullCall.resolve():c.pullCall.reject(o(e.reason));break;case a.PULL:if(!l){s.postMessage({sourceName:n,targetName:i,stream:a.PULL_COMPLETE,streamId:t,success:!0});break}l.desiredSize<=0&&e.desiredSize>0&&l.sinkCapability.resolve(),l.desiredSize=e.desiredSize,new Promise(function(e){e(l.onPull?.())}).then(function(){s.postMessage({sourceName:n,targetName:i,stream:a.PULL_COMPLETE,streamId:t,success:!0})},function(e){s.postMessage({sourceName:n,targetName:i,stream:a.PULL_COMPLETE,streamId:t,reason:o(e)})});break;case a.ENQUEUE:if((0,r.assert)(c,`enqueue should have stream controller`),c.isClosed)break;c.controller.enqueue(e.chunk);break;case a.CLOSE:if((0,r.assert)(c,`close should have stream controller`),c.isClosed)break;c.isClosed=!0,c.controller.close(),this.#n(c,t);break;case a.ERROR:(0,r.assert)(c,`error should have stream controller`),c.controller.error(o(e.reason)),this.#n(c,t);break;case a.CANCEL_COMPLETE:e.success?c.cancelCall.resolve():c.cancelCall.reject(o(e.reason)),this.#n(c,t);break;case a.CANCEL:if(!l)break;new Promise(function(t){t(l.onCancel?.(o(e.reason)))}).then(function(){s.postMessage({sourceName:n,targetName:i,stream:a.CANCEL_COMPLETE,streamId:t,success:!0})},function(e){s.postMessage({sourceName:n,targetName:i,stream:a.CANCEL_COMPLETE,streamId:t,reason:o(e)})}),l.sinkCapability.reject(o(e.reason)),l.isCancelled=!0,delete this.streamSinks[t];break;default:throw Error(`Unexpected stream case`)}}async#n(e,t){await Promise.allSettled([e.startCall?.promise,e.pullCall?.promise,e.cancelCall?.promise]),delete this.streamControllers[t]}destroy(){this.comObj.removeEventListener(`message`,this._onComObjOnMessage)}}t.MessageHandler=s}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Metadata=void 0;var r=n(1);class i{#e;#t;constructor({parsedData:e,rawData:t}){this.#e=e,this.#t=t}getRaw(){return this.#t}get(e){return this.#e.get(e)??null}getAll(){return(0,r.objectFromMap)(this.#e)}has(e){return this.#e.has(e)}}t.Metadata=i}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionalContentConfig=void 0;var r=n(1),i=n(8);let a=Symbol(`INTERNAL`);class o{#e=!0;constructor(e,t){this.name=e,this.intent=t}get visible(){return this.#e}_setVisible(e,t){e!==a&&(0,r.unreachable)("Internal method `_setVisible` called."),this.#e=t}}class s{#e=null;#t=new Map;#n=null;#r=null;constructor(e){if(this.name=null,this.creator=null,e!==null){this.name=e.name,this.creator=e.creator,this.#r=e.order;for(let t of e.groups)this.#t.set(t.id,new o(t.name,t.intent));if(e.baseState===`OFF`)for(let e of this.#t.values())e._setVisible(a,!1);for(let t of e.on)this.#t.get(t)._setVisible(a,!0);for(let t of e.off)this.#t.get(t)._setVisible(a,!1);this.#n=this.getHash()}}#i(e){let t=e.length;if(t<2)return!0;let n=e[0];for(let i=1;i<t;i++){let t=e[i],a;if(Array.isArray(t))a=this.#i(t);else if(this.#t.has(t))a=this.#t.get(t).visible;else return(0,r.warn)(`Optional content group not found: ${t}`),!0;switch(n){case`And`:if(!a)return!1;break;case`Or`:if(a)return!0;break;case`Not`:return!a;default:return!0}}return n===`And`}isVisible(e){if(this.#t.size===0)return!0;if(!e)return(0,r.warn)(`Optional content group not defined.`),!0;if(e.type===`OCG`)return this.#t.has(e.id)?this.#t.get(e.id).visible:((0,r.warn)(`Optional content group not found: ${e.id}`),!0);if(e.type===`OCMD`){if(e.expression)return this.#i(e.expression);if(!e.policy||e.policy===`AnyOn`){for(let t of e.ids){if(!this.#t.has(t))return(0,r.warn)(`Optional content group not found: ${t}`),!0;if(this.#t.get(t).visible)return!0}return!1}if(e.policy===`AllOn`){for(let t of e.ids){if(!this.#t.has(t))return(0,r.warn)(`Optional content group not found: ${t}`),!0;if(!this.#t.get(t).visible)return!1}return!0}if(e.policy===`AnyOff`){for(let t of e.ids){if(!this.#t.has(t))return(0,r.warn)(`Optional content group not found: ${t}`),!0;if(!this.#t.get(t).visible)return!0}return!1}if(e.policy===`AllOff`){for(let t of e.ids){if(!this.#t.has(t))return(0,r.warn)(`Optional content group not found: ${t}`),!0;if(this.#t.get(t).visible)return!1}return!0}return(0,r.warn)(`Unknown optional content policy ${e.policy}.`),!0}return(0,r.warn)(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0){if(!this.#t.has(e)){(0,r.warn)(`Optional content group not found: ${e}`);return}this.#t.get(e)._setVisible(a,!!t),this.#e=null}get hasInitialVisibility(){return this.#n===null||this.getHash()===this.#n}getOrder(){return this.#t.size?this.#r?this.#r.slice():[...this.#t.keys()]:null}getGroups(){return this.#t.size>0?(0,r.objectFromMap)(this.#t):null}getGroup(e){return this.#t.get(e)||null}getHash(){if(this.#e!==null)return this.#e;let e=new i.MurmurHash3_64;for(let[t,n]of this.#t)e.update(`${t}:${n.visible}`);return this.#e=e.hexdigest()}}t.OptionalContentConfig=s}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFDataTransportStream=void 0;var r=n(1),i=n(6);class a{constructor({length:e,initialData:t,progressiveDone:n=!1,contentDispositionFilename:i=null,disableRange:a=!1,disableStream:o=!1},s){if((0,r.assert)(s,`PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.`),this._queuedChunks=[],this._progressiveDone=n,this._contentDispositionFilename=i,t?.length>0){let e=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;this._queuedChunks.push(e)}this._pdfDataRangeTransport=s,this._isStreamingSupported=!o,this._isRangeSupported=!a,this._contentLength=e,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener((e,t)=>{this._onReceiveData({begin:e,chunk:t})}),this._pdfDataRangeTransport.addProgressListener((e,t)=>{this._onProgress({loaded:e,total:t})}),this._pdfDataRangeTransport.addProgressiveReadListener(e=>{this._onReceiveData({chunk:e})}),this._pdfDataRangeTransport.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),this._pdfDataRangeTransport.transportReady()}_onReceiveData({begin:e,chunk:t}){let n=t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer;if(e===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(n):this._queuedChunks.push(n);else{let t=this._rangeReaders.some(function(t){return t._begin===e&&(t._enqueue(n),!0)});(0,r.assert)(t,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(e){e.total===void 0?this._rangeReaders[0]?.onProgress?.({loaded:e.loaded}):this._fullRequestReader?.onProgress?.({loaded:e.loaded,total:e.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){let t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){(0,r.assert)(!this._fullRequestReader,`PDFDataTransportStream.getFullReader can only be called once.`);let e=this._queuedChunks;return this._queuedChunks=null,new o(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;let n=new s(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(let t of this._rangeReaders.slice(0))t.cancel(e);this._pdfDataRangeTransport.abort()}}t.PDFDataTransportStream=a;class o{constructor(e,t,n=!1,r=null){this._stream=e,this._done=n||!1,this._filename=(0,i.isPdfFile)(r)?r:null,this._queuedChunks=t||[],this._loaded=0;for(let e of this._queuedChunks)this._loaded+=e.byteLength;this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let e=new r.PromiseCapability;return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||=!0}}class s{constructor(e,t,n){this._stream=e,this._begin=t,this._end=n,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(e){if(!this._done){if(this._requests.length===0)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){let e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};let e=new r.PromiseCapability;return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFFetchStream=void 0;var r=n(1),i=n(20);function a(e,t,n){return{method:`GET`,headers:e,signal:n.signal,mode:`cors`,credentials:t?`include`:`same-origin`,redirect:`follow`}}function o(e){let t=new Headers;for(let n in e){let r=e[n];r!==void 0&&t.append(n,r)}return t}function s(e){return e instanceof Uint8Array?e.buffer:e instanceof ArrayBuffer?e:((0,r.warn)(`getArrayBuffer - unexpected data format: ${e}`),new Uint8Array(e).buffer)}class c{constructor(e){this.source=e,this.isHttp=/^https?:/i.test(e.url),this.httpHeaders=this.isHttp&&e.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,r.assert)(!this._fullRequestReader,`PDFFetchStream.getFullReader can only be called once.`),this._fullRequestReader=new l(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;let n=new u(this,e,t);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(let t of this._rangeRequestReaders.slice(0))t.cancel(e)}}t.PDFFetchStream=c;class l{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;let t=e.source;this._withCredentials=t.withCredentials||!1,this._contentLength=t.length,this._headersCapability=new r.PromiseCapability,this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._headers=o(this._stream.httpHeaders);let n=t.url;fetch(n,a(this._headers,this._withCredentials,this._abortController)).then(e=>{if(!(0,i.validateResponseStatus)(e.status))throw(0,i.createResponseStatusError)(e.status,n);this._reader=e.body.getReader(),this._headersCapability.resolve();let t=t=>e.headers.get(t),{allowRangeRequests:a,suggestedLength:o}=(0,i.validateRangeRequestCapabilities)({getResponseHeader:t,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=a,this._contentLength=o||this._contentLength,this._filename=(0,i.extractFilenameFromHeader)(t),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new r.AbortException(`Streaming is disabled.`))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;let{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:s(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}class u{constructor(e,t,n){this._stream=e,this._reader=null,this._loaded=0;let s=e.source;this._withCredentials=s.withCredentials||!1,this._readCapability=new r.PromiseCapability,this._isStreamingSupported=!s.disableStream,this._abortController=new AbortController,this._headers=o(this._stream.httpHeaders),this._headers.append(`Range`,`bytes=${t}-${n-1}`);let c=s.url;fetch(c,a(this._headers,this._withCredentials,this._abortController)).then(e=>{if(!(0,i.validateResponseStatus)(e.status))throw(0,i.createResponseStatusError)(e.status,c);this._readCapability.resolve(),this._reader=e.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;let{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded}),{value:s(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createResponseStatusError=c,t.extractFilenameFromHeader=s,t.validateRangeRequestCapabilities=o,t.validateResponseStatus=l;var r=n(1),i=n(21),a=n(6);function o({getResponseHeader:e,isHttp:t,rangeChunkSize:n,disableRange:r}){let i={allowRangeRequests:!1,suggestedLength:void 0},a=parseInt(e(`Content-Length`),10);return!Number.isInteger(a)||(i.suggestedLength=a,a<=2*n)||r||!t||e(`Accept-Ranges`)!==`bytes`||(e(`Content-Encoding`)||`identity`)!==`identity`||(i.allowRangeRequests=!0),i}function s(e){let t=e(`Content-Disposition`);if(t){let e=(0,i.getFilenameFromContentDispositionHeader)(t);if(e.includes(`%`))try{e=decodeURIComponent(e)}catch{}if((0,a.isPdfFile)(e))return e}return null}function c(e,t){return e===404||e===0&&t.startsWith(`file:`)?new r.MissingPDFException(`Missing PDF "`+t+`".`):new r.UnexpectedResponseException(`Unexpected server response (${e}) while retrieving PDF "${t}".`,e)}function l(e){return e===200||e===206}}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getFilenameFromContentDispositionHeader=i;var r=n(1);function i(e){let t=!0,n=i(`filename\\*`,`i`).exec(e);if(n){n=n[1];let e=c(n);return e=unescape(e),e=l(e),e=u(e),o(e)}if(n=s(e),n)return o(u(n));if(n=i(`filename`,`i`).exec(e),n){n=n[1];let e=c(n);return e=u(e),o(e)}function i(e,t){return RegExp(`(?:^|;)\\s*`+e+`\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)`,t)}function a(e,n){if(e){if(!/^[\x00-\xFF]+$/.test(n))return n;try{let i=new TextDecoder(e,{fatal:!0}),a=(0,r.stringToBytes)(n);n=i.decode(a),t=!1}catch{}}return n}function o(e){return t&&/[\x80-\xff]/.test(e)&&(e=a(`utf-8`,e),t&&(e=a(`iso-8859-1`,e))),e}function s(e){let t=[],n,r=i(`filename\\*((?!0\\d)\\d+)(\\*?)`,`ig`);for(;(n=r.exec(e))!==null;){let[,e,r,i]=n;if(e=parseInt(e,10),e in t){if(e===0)break;continue}t[e]=[r,i]}let a=[];for(let e=0;e<t.length&&e in t;++e){let[n,r]=t[e];r=c(r),n&&(r=unescape(r),e===0&&(r=l(r))),a.push(r)}return a.join(``)}function c(e){if(e.startsWith(`"`)){let t=e.slice(1).split(`\\"`);for(let e=0;e<t.length;++e){let n=t[e].indexOf(`"`);n!==-1&&(t[e]=t[e].slice(0,n),t.length=e+1),t[e]=t[e].replaceAll(/\\(.)/g,`$1`)}e=t.join(`"`)}return e}function l(e){let t=e.indexOf(`'`);return t===-1?e:a(e.slice(0,t),e.slice(t+1).replace(/^[^']*'/,``))}function u(e){return!e.startsWith(`=?`)||/[\x00-\x19\x80-\xff]/.test(e)?e:e.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(e,t,n,r){if(n===`q`||n===`Q`)return r=r.replaceAll(`_`,` `),r=r.replaceAll(/=([0-9a-fA-F]{2})/g,function(e,t){return String.fromCharCode(parseInt(t,16))}),a(t,r);try{r=atob(r)}catch{}return a(t,r)})}return``}}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFNetworkStream=void 0;var r=n(1),i=n(20);let a=200,o=206;function s(e){let t=e.response;return typeof t==`string`?(0,r.stringToBytes)(t).buffer:t}class c{constructor(e,t={}){this.url=e,this.isHttp=/^https?:/i.test(e),this.httpHeaders=this.isHttp&&t.httpHeaders||Object.create(null),this.withCredentials=t.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(e,t,n){let r={begin:e,end:t};for(let e in n)r[e]=n[e];return this.request(r)}requestFull(e){return this.request(e)}request(e){let t=new XMLHttpRequest,n=this.currXhrId++,r=this.pendingRequests[n]={xhr:t};t.open(`GET`,this.url),t.withCredentials=this.withCredentials;for(let e in this.httpHeaders){let n=this.httpHeaders[e];n!==void 0&&t.setRequestHeader(e,n)}return this.isHttp&&`begin`in e&&`end`in e?(t.setRequestHeader(`Range`,`bytes=${e.begin}-${e.end-1}`),r.expectedStatus=206):r.expectedStatus=200,t.responseType=`arraybuffer`,e.onError&&(t.onerror=function(n){e.onError(t.status)}),t.onreadystatechange=this.onStateChange.bind(this,n),t.onprogress=this.onProgress.bind(this,n),r.onHeadersReceived=e.onHeadersReceived,r.onDone=e.onDone,r.onError=e.onError,r.onProgress=e.onProgress,t.send(null),n}onProgress(e,t){let n=this.pendingRequests[e];n&&n.onProgress?.(t)}onStateChange(e,t){let n=this.pendingRequests[e];if(!n)return;let r=n.xhr;if(r.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),r.readyState!==4||!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],r.status===0&&this.isHttp){n.onError?.(r.status);return}let i=r.status||200;if((i!==200||n.expectedStatus!==206)&&i!==n.expectedStatus){n.onError?.(r.status);return}let a=s(r);if(i===206){let e=r.getResponseHeader(`Content-Range`),t=/bytes (\d+)-(\d+)\/(\d+)/.exec(e);n.onDone({begin:parseInt(t[1],10),chunk:a})}else a?n.onDone({begin:0,chunk:a}):n.onError?.(r.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){let t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}}class l{constructor(e){this._source=e,this._manager=new c(e.url,{httpHeaders:e.httpHeaders,withCredentials:e.withCredentials}),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){let t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)}getFullReader(){return(0,r.assert)(!this._fullRequestReader,`PDFNetworkStream.getFullReader can only be called once.`),this._fullRequestReader=new u(this._manager,this._source),this._fullRequestReader}getRangeReader(e,t){let n=new d(this._manager,e,t);return n.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(let t of this._rangeRequestReaders.slice(0))t.cancel(e)}}t.PDFNetworkStream=l;class u{constructor(e,t){this._manager=e;let n={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._fullRequestId=e.requestFull(n),this._headersReceivedCapability=new r.PromiseCapability,this._disableRange=t.disableRange||!1,this._contentLength=t.length,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){let e=this._fullRequestId,t=this._manager.getRequestXhr(e),n=e=>t.getResponseHeader(e),{allowRangeRequests:r,suggestedLength:a}=(0,i.validateRangeRequestCapabilities)({getResponseHeader:n,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});r&&(this._isRangeSupported=!0),this._contentLength=a||this._contentLength,this._filename=(0,i.extractFilenameFromHeader)(n),this._isRangeSupported&&this._manager.abortRequest(e),this._headersReceivedCapability.resolve()}_onDone(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=(0,i.createResponseStatusError)(e,this._url),this._headersReceivedCapability.reject(this._storedError);for(let e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let e=new r.PromiseCapability;return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersReceivedCapability.reject(e);for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class d{constructor(e,t,n){this._manager=e;let r={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._requestId=e.requestRange(t,n,r),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(e){let t=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0;for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError=(0,i.createResponseStatusError)(e,this._url);for(let e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){this.isStreamingSupported||this.onProgress?.({loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){let e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};let e=new r.PromiseCapability;return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFNodeStream=void 0;var r=n(1),i=n(20);let a=/^file:\/\/\/[a-zA-Z]:\//;function o(e){let t=require___vite_browser_external(),n=t.parse(e);return n.protocol===`file:`||n.host?n:/^[a-z]:[/\\]/i.test(e)?t.parse(`file:///${e}`):(n.host||(n.protocol=`file:`),n)}class s{constructor(e){this.source=e,this.url=o(e.url),this.isHttp=this.url.protocol===`http:`||this.url.protocol===`https:`,this.isFsUrl=this.url.protocol===`file:`,this.httpHeaders=this.isHttp&&e.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,r.assert)(!this._fullRequestReader,`PDFNodeStream.getFullReader can only be called once.`),this._fullRequestReader=this.isFsUrl?new p(this):new d(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;let n=this.isFsUrl?new m(this,e,t):new f(this,e,t);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(let t of this._rangeRequestReaders.slice(0))t.cancel(e)}}t.PDFNodeStream=s;class c{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;let t=e.source;this._contentLength=t.length,this._loaded=0,this._filename=null,this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._readableStream=null,this._readCapability=new r.PromiseCapability,this._headersCapability=new r.PromiseCapability}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;let e=this._readableStream.read();return e===null?(this._readCapability=new r.PromiseCapability,this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on(`readable`,()=>{this._readCapability.resolve()}),e.on(`end`,()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on(`error`,e=>{this._error(e)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new r.AbortException(`streaming is disabled`)),this._storedError&&this._readableStream.destroy(this._storedError)}}class l{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=new r.PromiseCapability;let t=e.source;this._isStreamingSupported=!t.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;let e=this._readableStream.read();return e===null?(this._readCapability=new r.PromiseCapability,this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on(`readable`,()=>{this._readCapability.resolve()}),e.on(`end`,()=>{e.destroy(),this._done=!0,this._readCapability.resolve()}),e.on(`error`,e=>{this._error(e)}),this._storedError&&this._readableStream.destroy(this._storedError)}}function u(e,t){return{protocol:e.protocol,auth:e.auth,host:e.hostname,port:e.port,path:e.path,method:`GET`,headers:t}}class d extends c{constructor(e){super(e);let t=t=>{if(t.statusCode===404){let e=new r.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=e,this._headersCapability.reject(e);return}this._headersCapability.resolve(),this._setReadableStream(t);let n=e=>this._readableStream.headers[e.toLowerCase()],{allowRangeRequests:a,suggestedLength:o}=(0,i.validateRangeRequestCapabilities)({getResponseHeader:n,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=a,this._contentLength=o||this._contentLength,this._filename=(0,i.extractFilenameFromHeader)(n)};if(this._request=null,this._url.protocol===`http:`){let n=require___vite_browser_external();this._request=n.request(u(this._url,e.httpHeaders),t)}else{let n=require___vite_browser_external();this._request=n.request(u(this._url,e.httpHeaders),t)}this._request.on(`error`,e=>{this._storedError=e,this._headersCapability.reject(e)}),this._request.end()}}class f extends l{constructor(e,t,n){super(e),this._httpHeaders={};for(let t in e.httpHeaders){let n=e.httpHeaders[t];n!==void 0&&(this._httpHeaders[t]=n)}this._httpHeaders.Range=`bytes=${t}-${n-1}`;let i=e=>{if(e.statusCode===404){let e=new r.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=e;return}this._setReadableStream(e)};if(this._request=null,this._url.protocol===`http:`){let e=require___vite_browser_external();this._request=e.request(u(this._url,this._httpHeaders),i)}else{let e=require___vite_browser_external();this._request=e.request(u(this._url,this._httpHeaders),i)}this._request.on(`error`,e=>{this._storedError=e}),this._request.end()}}class p extends c{constructor(e){super(e);let t=decodeURIComponent(this._url.path);a.test(this._url.href)&&(t=t.replace(/^\//,``));let n=require___vite_browser_external();n.lstat(t,(e,i)=>{if(e){e.code===`ENOENT`&&(e=new r.MissingPDFException(`Missing PDF "${t}".`)),this._storedError=e,this._headersCapability.reject(e);return}this._contentLength=i.size,this._setReadableStream(n.createReadStream(t)),this._headersCapability.resolve()})}}class m extends l{constructor(e,t,n){super(e);let r=decodeURIComponent(this._url.path);a.test(this._url.href)&&(r=r.replace(/^\//,``));let i=require___vite_browser_external();this._setReadableStream(i.createReadStream(r,{start:t,end:n-1}))}}}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SVGGraphics=void 0;var r=n(6),i=n(1);let a={fontStyle:`normal`,fontWeight:`normal`,fillColor:`#000000`},o=`http://www.w3.org/XML/1998/namespace`,s=`http://www.w3.org/1999/xlink`,c=[`butt`,`round`,`square`],l=[`miter`,`round`,`bevel`],u=function(e,t=``,n=!1){if(URL.createObjectURL&&typeof Blob<`u`&&!n)return URL.createObjectURL(new Blob([e],{type:t}));let r=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`,i=`data:${t};base64,`;for(let t=0,n=e.length;t<n;t+=3){let a=e[t]&255,o=e[t+1]&255,s=e[t+2]&255,c=a>>2,l=(a&3)<<4|o>>4,u=t+1<n?(o&15)<<2|s>>6:64,d=t+2<n?s&63:64;i+=r[c]+r[l]+r[u]+r[d]}return i},d=function(){let e=new Uint8Array([137,80,78,71,13,10,26,10]),t=12,n=new Int32Array(256);for(let e=0;e<256;e++){let t=e;for(let e=0;e<8;e++)t=t&1?3988292384^t>>1&2147483647:t>>1&2147483647;n[e]=t}function r(e,t,r){let i=-1;for(let a=t;a<r;a++){let t=(i^e[a])&255,r=n[t];i=i>>>8^r}return i^-1}function a(e,t,n,i){let a=i,o=t.length;n[a]=o>>24&255,n[a+1]=o>>16&255,n[a+2]=o>>8&255,n[a+3]=o&255,a+=4,n[a]=e.charCodeAt(0)&255,n[a+1]=e.charCodeAt(1)&255,n[a+2]=e.charCodeAt(2)&255,n[a+3]=e.charCodeAt(3)&255,a+=4,n.set(t,a),a+=t.length;let s=r(n,i+4,a);n[a]=s>>24&255,n[a+1]=s>>16&255,n[a+2]=s>>8&255,n[a+3]=s&255}function o(e,t,n){let r=1,i=0;for(let a=t;a<n;++a)r=(r+(e[a]&255))%65521,i=(i+r)%65521;return i<<16|r}function s(e){if(!i.isNodeJS)return c(e);try{let t=parseInt(process.versions.node)>=8?e:Buffer.from(e),n=require___vite_browser_external().deflateSync(t,{level:9});return n instanceof Uint8Array?n:new Uint8Array(n)}catch(e){(0,i.warn)(`Not compressing PNG because zlib.deflateSync is unavailable: `+e)}return c(e)}function c(e){let t=e.length,n=65535,r=Math.ceil(t/n),i=new Uint8Array(2+t+r*5+4),a=0;i[a++]=120,i[a++]=156;let s=0;for(;t>n;)i[a++]=0,i[a++]=255,i[a++]=255,i[a++]=0,i[a++]=0,i.set(e.subarray(s,s+n),a),a+=n,s+=n,t-=n;i[a++]=1,i[a++]=t&255,i[a++]=t>>8&255,i[a++]=~t&255,i[a++]=(~t&65535)>>8&255,i.set(e.subarray(s),a),a+=e.length-s;let c=o(e,0,e.length);return i[a++]=c>>24&255,i[a++]=c>>16&255,i[a++]=c>>8&255,i[a++]=c&255,i}function l(t,n,r,o){let c=t.width,l=t.height,d,f,p,m=t.data;switch(n){case i.ImageKind.GRAYSCALE_1BPP:f=0,d=1,p=c+7>>3;break;case i.ImageKind.RGB_24BPP:f=2,d=8,p=c*3;break;case i.ImageKind.RGBA_32BPP:f=6,d=8,p=c*4;break;default:throw Error(`invalid format`)}let h=new Uint8Array((1+p)*l),g=0,_=0;for(let e=0;e<l;++e)h[g++]=0,h.set(m.subarray(_,_+p),g),_+=p,g+=p;if(n===i.ImageKind.GRAYSCALE_1BPP&&o){g=0;for(let e=0;e<l;e++){g++;for(let e=0;e<p;e++)h[g++]^=255}}let v=new Uint8Array([c>>24&255,c>>16&255,c>>8&255,c&255,l>>24&255,l>>16&255,l>>8&255,l&255,d,f,0,0,0]),y=s(h),b=e.length+36+v.length+y.length,x=new Uint8Array(b),S=0;return x.set(e,S),S+=e.length,a(`IHDR`,v,x,S),S+=12+v.length,a(`IDATA`,y,x,S),S+=12+y.length,a(`IEND`,new Uint8Array,x,S),u(x,`image/png`,r)}return function(e,t,n){return l(e,e.kind===void 0?i.ImageKind.GRAYSCALE_1BPP:e.kind,t,n)}}();class f{constructor(){this.fontSizeScale=1,this.fontWeight=a.fontWeight,this.fontSize=0,this.textMatrix=i.IDENTITY_MATRIX,this.fontMatrix=i.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=i.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(e,t){this.x=e,this.y=t}}function p(e){let t=[],n=[];for(let r of e){if(r.fn===`save`){t.push({fnId:92,fn:`group`,items:[]}),n.push(t),t=t.at(-1).items;continue}r.fn===`restore`?t=n.pop():t.push(r)}return t}function m(e){if(Number.isInteger(e))return e.toString();let t=e.toFixed(10),n=t.length-1;if(t[n]!==`0`)return t;do n--;while(t[n]===`0`);return t.substring(0,t[n]===`.`?n:n+1)}function h(e){if(e[4]===0&&e[5]===0){if(e[1]===0&&e[2]===0)return e[0]===1&&e[3]===1?``:`scale(${m(e[0])} ${m(e[3])})`;if(e[0]===e[3]&&e[1]===-e[2])return`rotate(${m(Math.acos(e[0])*180/Math.PI)})`}else if(e[0]===1&&e[1]===0&&e[2]===0&&e[3]===1)return`translate(${m(e[4])} ${m(e[5])})`;return`matrix(${m(e[0])} ${m(e[1])} ${m(e[2])} ${m(e[3])} ${m(e[4])} ${m(e[5])})`}let g=0,_=0,v=0;class y{constructor(e,t,n=!1){(0,r.deprecated)(`The SVG back-end is no longer maintained and *may* be removed in the future.`),this.svgFactory=new r.DOMSVGFactory,this.current=new f,this.transformMatrix=i.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=e,this.objs=t,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!n,this._operatorIdMapping=[];for(let e in i.OPS)this._operatorIdMapping[i.OPS[e]]=e}getObject(e,t=null){return typeof e==`string`?e.startsWith(`g_`)?this.commonObjs.get(e):this.objs.get(e):t}save(){this.transformStack.push(this.transformMatrix);let e=this.current;this.extraStack.push(e),this.current=e.clone()}restore(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}group(e){this.save(),this.executeOpTree(e),this.restore()}loadDependencies(e){let t=e.fnArray,n=e.argsArray;for(let e=0,r=t.length;e<r;e++)if(t[e]===i.OPS.dependency)for(let t of n[e]){let e=t.startsWith(`g_`)?this.commonObjs:this.objs,n=new Promise(n=>{e.get(t,n)});this.current.dependencies.push(n)}return Promise.all(this.current.dependencies)}transform(e,t,n,r,a,o){let s=[e,t,n,r,a,o];this.transformMatrix=i.Util.transform(this.transformMatrix,s),this.tgrp=null}getSVG(e,t){this.viewport=t;let n=this._initialize(t);return this.loadDependencies(e).then(()=>(this.transformMatrix=i.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(e)),n))}convertOpList(e){let t=this._operatorIdMapping,n=e.argsArray,r=e.fnArray,i=[];for(let e=0,a=r.length;e<a;e++){let a=r[e];i.push({fnId:a,fn:t[a],args:n[e]})}return p(i)}executeOpTree(e){for(let t of e){let e=t.fn,n=t.fnId,r=t.args;switch(n|0){case i.OPS.beginText:this.beginText();break;case i.OPS.dependency:break;case i.OPS.setLeading:this.setLeading(r);break;case i.OPS.setLeadingMoveText:this.setLeadingMoveText(r[0],r[1]);break;case i.OPS.setFont:this.setFont(r);break;case i.OPS.showText:this.showText(r[0]);break;case i.OPS.showSpacedText:this.showText(r[0]);break;case i.OPS.endText:this.endText();break;case i.OPS.moveText:this.moveText(r[0],r[1]);break;case i.OPS.setCharSpacing:this.setCharSpacing(r[0]);break;case i.OPS.setWordSpacing:this.setWordSpacing(r[0]);break;case i.OPS.setHScale:this.setHScale(r[0]);break;case i.OPS.setTextMatrix:this.setTextMatrix(r[0],r[1],r[2],r[3],r[4],r[5]);break;case i.OPS.setTextRise:this.setTextRise(r[0]);break;case i.OPS.setTextRenderingMode:this.setTextRenderingMode(r[0]);break;case i.OPS.setLineWidth:this.setLineWidth(r[0]);break;case i.OPS.setLineJoin:this.setLineJoin(r[0]);break;case i.OPS.setLineCap:this.setLineCap(r[0]);break;case i.OPS.setMiterLimit:this.setMiterLimit(r[0]);break;case i.OPS.setFillRGBColor:this.setFillRGBColor(r[0],r[1],r[2]);break;case i.OPS.setStrokeRGBColor:this.setStrokeRGBColor(r[0],r[1],r[2]);break;case i.OPS.setStrokeColorN:this.setStrokeColorN(r);break;case i.OPS.setFillColorN:this.setFillColorN(r);break;case i.OPS.shadingFill:this.shadingFill(r[0]);break;case i.OPS.setDash:this.setDash(r[0],r[1]);break;case i.OPS.setRenderingIntent:this.setRenderingIntent(r[0]);break;case i.OPS.setFlatness:this.setFlatness(r[0]);break;case i.OPS.setGState:this.setGState(r[0]);break;case i.OPS.fill:this.fill();break;case i.OPS.eoFill:this.eoFill();break;case i.OPS.stroke:this.stroke();break;case i.OPS.fillStroke:this.fillStroke();break;case i.OPS.eoFillStroke:this.eoFillStroke();break;case i.OPS.clip:this.clip(`nonzero`);break;case i.OPS.eoClip:this.clip(`evenodd`);break;case i.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case i.OPS.paintImageXObject:this.paintImageXObject(r[0]);break;case i.OPS.paintInlineImageXObject:this.paintInlineImageXObject(r[0]);break;case i.OPS.paintImageMaskXObject:this.paintImageMaskXObject(r[0]);break;case i.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(r[0],r[1]);break;case i.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case i.OPS.closePath:this.closePath();break;case i.OPS.closeStroke:this.closeStroke();break;case i.OPS.closeFillStroke:this.closeFillStroke();break;case i.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case i.OPS.nextLine:this.nextLine();break;case i.OPS.transform:this.transform(r[0],r[1],r[2],r[3],r[4],r[5]);break;case i.OPS.constructPath:this.constructPath(r[0],r[1]);break;case i.OPS.endPath:this.endPath();break;case 92:this.group(t.items);break;default:(0,i.warn)(`Unimplemented operator ${e}`)}}}setWordSpacing(e){this.current.wordSpacing=e}setCharSpacing(e){this.current.charSpacing=e}nextLine(){this.moveText(0,this.current.leading)}setTextMatrix(e,t,n,r,i,a){let o=this.current;o.textMatrix=o.lineMatrix=[e,t,n,r,i,a],o.textMatrixScale=Math.hypot(e,t),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`,`${m(o.fontSize)}px`),o.tspan.setAttributeNS(null,`y`,m(-o.y)),o.txtElement=this.svgFactory.createElement(`svg:text`),o.txtElement.append(o.tspan)}beginText(){let e=this.current;e.x=e.lineX=0,e.y=e.lineY=0,e.textMatrix=i.IDENTITY_MATRIX,e.lineMatrix=i.IDENTITY_MATRIX,e.textMatrixScale=1,e.tspan=this.svgFactory.createElement(`svg:tspan`),e.txtElement=this.svgFactory.createElement(`svg:text`),e.txtgrp=this.svgFactory.createElement(`svg:g`),e.xcoords=[],e.ycoords=[]}moveText(e,t){let n=this.current;n.x=n.lineX+=e,n.y=n.lineY+=t,n.xcoords=[],n.ycoords=[],n.tspan=this.svgFactory.createElement(`svg:tspan`),n.tspan.setAttributeNS(null,`font-family`,n.fontFamily),n.tspan.setAttributeNS(null,`font-size`,`${m(n.fontSize)}px`),n.tspan.setAttributeNS(null,`y`,m(-n.y))}showText(e){let t=this.current,n=t.font,r=t.fontSize;if(r===0)return;let o=t.fontSizeScale,s=t.charSpacing,c=t.wordSpacing,l=t.fontDirection,u=t.textHScale*l,d=n.vertical,f=d?1:-1,p=n.defaultVMetrics,g=r*t.fontMatrix[0],_=0;for(let i of e){if(i===null){_+=l*c;continue}if(typeof i==`number`){_+=f*i*r/1e3;continue}let e=(i.isSpace?c:0)+s,a=i.fontChar,u,m,h=i.width;if(d){let e,t=i.vmetric||p;e=i.vmetric?t[1]:h*.5,e=-e*g;let n=t[2]*g;h=t?-t[0]:h,u=e/o,m=(_+n)/o}else u=_/o,m=0;(i.isInFont||n.missingFile)&&(t.xcoords.push(t.x+u),d&&t.ycoords.push(-t.y+m),t.tspan.textContent+=a);let v=d?h*g-e*l:h*g+e*l;_+=v}t.tspan.setAttributeNS(null,`x`,t.xcoords.map(m).join(` `)),d?t.tspan.setAttributeNS(null,`y`,t.ycoords.map(m).join(` `)):t.tspan.setAttributeNS(null,`y`,m(-t.y)),d?t.y-=_:t.x+=_*u,t.tspan.setAttributeNS(null,`font-family`,t.fontFamily),t.tspan.setAttributeNS(null,`font-size`,`${m(t.fontSize)}px`),t.fontStyle!==a.fontStyle&&t.tspan.setAttributeNS(null,`font-style`,t.fontStyle),t.fontWeight!==a.fontWeight&&t.tspan.setAttributeNS(null,`font-weight`,t.fontWeight);let v=t.textRenderingMode&i.TextRenderingMode.FILL_STROKE_MASK;if(v===i.TextRenderingMode.FILL||v===i.TextRenderingMode.FILL_STROKE?(t.fillColor!==a.fillColor&&t.tspan.setAttributeNS(null,`fill`,t.fillColor),t.fillAlpha<1&&t.tspan.setAttributeNS(null,`fill-opacity`,t.fillAlpha)):t.textRenderingMode===i.TextRenderingMode.ADD_TO_PATH?t.tspan.setAttributeNS(null,`fill`,`transparent`):t.tspan.setAttributeNS(null,`fill`,`none`),v===i.TextRenderingMode.STROKE||v===i.TextRenderingMode.FILL_STROKE){let e=1/(t.textMatrixScale||1);this._setStrokeAttributes(t.tspan,e)}let y=t.textMatrix;t.textRise!==0&&(y=y.slice(),y[5]+=t.textRise),t.txtElement.setAttributeNS(null,`transform`,`${h(y)} scale(${m(u)}, -1)`),t.txtElement.setAttributeNS(`http://www.w3.org/XML/1998/namespace`,`xml:space`,`preserve`),t.txtElement.append(t.tspan),t.txtgrp.append(t.txtElement),this._ensureTransformGroup().append(t.txtElement)}setLeadingMoveText(e,t){this.setLeading(-t),this.moveText(e,t)}addFontStyle(e){if(!e.data)throw Error(`addFontStyle: No font data available, ensure that the "fontExtraProperties" API parameter is set.`);this.cssStyle||(this.cssStyle=this.svgFactory.createElement(`svg:style`),this.cssStyle.setAttributeNS(null,`type`,`text/css`),this.defs.append(this.cssStyle));let t=u(e.data,e.mimetype,this.forceDataSchema);this.cssStyle.textContent+=`@font-face { font-family: "${e.loadedName}"; src: url(${t}); }\n`}setFont(e){let t=this.current,n=this.commonObjs.get(e[0]),r=e[1];t.font=n,this.embedFonts&&!n.missingFile&&!this.embeddedFonts[n.loadedName]&&(this.addFontStyle(n),this.embeddedFonts[n.loadedName]=n),t.fontMatrix=n.fontMatrix||i.FONT_IDENTITY_MATRIX;let a=`normal`;n.black?a=`900`:n.bold&&(a=`bold`);let o=n.italic?`italic`:`normal`;r<0?(r=-r,t.fontDirection=-1):t.fontDirection=1,t.fontSize=r,t.fontFamily=n.loadedName,t.fontWeight=a,t.fontStyle=o,t.tspan=this.svgFactory.createElement(`svg:tspan`),t.tspan.setAttributeNS(null,`y`,m(-t.y)),t.xcoords=[],t.ycoords=[]}endText(){let e=this.current;e.textRenderingMode&i.TextRenderingMode.ADD_TO_PATH_FLAG&&e.txtElement?.hasChildNodes()&&(e.element=e.txtElement,this.clip(`nonzero`),this.endPath())}setLineWidth(e){e>0&&(this.current.lineWidth=e)}setLineCap(e){this.current.lineCap=c[e]}setLineJoin(e){this.current.lineJoin=l[e]}setMiterLimit(e){this.current.miterLimit=e}setStrokeAlpha(e){this.current.strokeAlpha=e}setStrokeRGBColor(e,t,n){this.current.strokeColor=i.Util.makeHexColor(e,t,n)}setFillAlpha(e){this.current.fillAlpha=e}setFillRGBColor(e,t,n){this.current.fillColor=i.Util.makeHexColor(e,t,n),this.current.tspan=this.svgFactory.createElement(`svg:tspan`),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(e){this.current.strokeColor=this._makeColorN_Pattern(e)}setFillColorN(e){this.current.fillColor=this._makeColorN_Pattern(e)}shadingFill(e){let{width:t,height:n}=this.viewport,r=i.Util.inverseTransform(this.transformMatrix),[a,o,s,c]=i.Util.getAxialAlignedBoundingBox([0,0,t,n],r),l=this.svgFactory.createElement(`svg:rect`);l.setAttributeNS(null,`x`,a),l.setAttributeNS(null,`y`,o),l.setAttributeNS(null,`width`,s-a),l.setAttributeNS(null,`height`,c-o),l.setAttributeNS(null,`fill`,this._makeShadingPattern(e)),this.current.fillAlpha<1&&l.setAttributeNS(null,`fill-opacity`,this.current.fillAlpha),this._ensureTransformGroup().append(l)}_makeColorN_Pattern(e){return e[0]===`TilingPattern`?this._makeTilingPattern(e):this._makeShadingPattern(e)}_makeTilingPattern(e){let t=e[1],n=e[2],r=e[3]||i.IDENTITY_MATRIX,[a,o,s,c]=e[4],l=e[5],u=e[6],d=e[7],f=`shading${v++}`,[p,m,h,g]=i.Util.normalizeRect([...i.Util.applyTransform([a,o],r),...i.Util.applyTransform([s,c],r)]),[_,y]=i.Util.singularValueDecompose2dScale(r),b=l*_,x=u*y,S=this.svgFactory.createElement(`svg:pattern`);S.setAttributeNS(null,`id`,f),S.setAttributeNS(null,`patternUnits`,`userSpaceOnUse`),S.setAttributeNS(null,`width`,b),S.setAttributeNS(null,`height`,x),S.setAttributeNS(null,`x`,`${p}`),S.setAttributeNS(null,`y`,`${m}`);let C=this.svg,w=this.transformMatrix,T=this.current.fillColor,E=this.current.strokeColor,D=this.svgFactory.create(h-p,g-m);if(this.svg=D,this.transformMatrix=r,d===2){let e=i.Util.makeHexColor(...t);this.current.fillColor=e,this.current.strokeColor=e}return this.executeOpTree(this.convertOpList(n)),this.svg=C,this.transformMatrix=w,this.current.fillColor=T,this.current.strokeColor=E,S.append(D.childNodes[0]),this.defs.append(S),`url(#${f})`}_makeShadingPattern(e){switch(typeof e==`string`&&(e=this.objs.get(e)),e[0]){case`RadialAxial`:let t=`shading${v++}`,n=e[3],r;switch(e[1]){case`axial`:let n=e[4],i=e[5];r=this.svgFactory.createElement(`svg:linearGradient`),r.setAttributeNS(null,`id`,t),r.setAttributeNS(null,`gradientUnits`,`userSpaceOnUse`),r.setAttributeNS(null,`x1`,n[0]),r.setAttributeNS(null,`y1`,n[1]),r.setAttributeNS(null,`x2`,i[0]),r.setAttributeNS(null,`y2`,i[1]);break;case`radial`:let a=e[4],o=e[5],s=e[6],c=e[7];r=this.svgFactory.createElement(`svg:radialGradient`),r.setAttributeNS(null,`id`,t),r.setAttributeNS(null,`gradientUnits`,`userSpaceOnUse`),r.setAttributeNS(null,`cx`,o[0]),r.setAttributeNS(null,`cy`,o[1]),r.setAttributeNS(null,`r`,c),r.setAttributeNS(null,`fx`,a[0]),r.setAttributeNS(null,`fy`,a[1]),r.setAttributeNS(null,`fr`,s);break;default:throw Error(`Unknown RadialAxial type: ${e[1]}`)}for(let e of n){let t=this.svgFactory.createElement(`svg:stop`);t.setAttributeNS(null,`offset`,e[0]),t.setAttributeNS(null,`stop-color`,e[1]),r.append(t)}return this.defs.append(r),`url(#${t})`;case`Mesh`:return(0,i.warn)(`Unimplemented pattern Mesh`),null;case`Dummy`:return`hotpink`;default:throw Error(`Unknown IR type: ${e[0]}`)}}setDash(e,t){this.current.dashArray=e,this.current.dashPhase=t}constructPath(e,t){let n=this.current,r=n.x,a=n.y,o=[],s=0;for(let n of e)switch(n|0){case i.OPS.rectangle:r=t[s++],a=t[s++];let e=t[s++],n=t[s++],c=r+e,l=a+n;o.push(`M`,m(r),m(a),`L`,m(c),m(a),`L`,m(c),m(l),`L`,m(r),m(l),`Z`);break;case i.OPS.moveTo:r=t[s++],a=t[s++],o.push(`M`,m(r),m(a));break;case i.OPS.lineTo:r=t[s++],a=t[s++],o.push(`L`,m(r),m(a));break;case i.OPS.curveTo:r=t[s+4],a=t[s+5],o.push(`C`,m(t[s]),m(t[s+1]),m(t[s+2]),m(t[s+3]),m(r),m(a)),s+=6;break;case i.OPS.curveTo2:o.push(`C`,m(r),m(a),m(t[s]),m(t[s+1]),m(t[s+2]),m(t[s+3])),r=t[s+2],a=t[s+3],s+=4;break;case i.OPS.curveTo3:r=t[s+2],a=t[s+3],o.push(`C`,m(t[s]),m(t[s+1]),m(r),m(a),m(r),m(a)),s+=4;break;case i.OPS.closePath:o.push(`Z`)}o=o.join(` `),n.path&&e.length>0&&e[0]!==i.OPS.rectangle&&e[0]!==i.OPS.moveTo?o=n.path.getAttributeNS(null,`d`)+o:(n.path=this.svgFactory.createElement(`svg:path`),this._ensureTransformGroup().append(n.path)),n.path.setAttributeNS(null,`d`,o),n.path.setAttributeNS(null,`fill`,`none`),n.element=n.path,n.setCurrentPoint(r,a)}endPath(){let e=this.current;if(e.path=null,!this.pendingClip)return;if(!e.element){this.pendingClip=null;return}let t=`clippath${g++}`,n=this.svgFactory.createElement(`svg:clipPath`);n.setAttributeNS(null,`id`,t),n.setAttributeNS(null,`transform`,h(this.transformMatrix));let r=e.element.cloneNode(!0);if(this.pendingClip===`evenodd`?r.setAttributeNS(null,`clip-rule`,`evenodd`):r.setAttributeNS(null,`clip-rule`,`nonzero`),this.pendingClip=null,n.append(r),this.defs.append(n),e.activeClipUrl){e.clipGroup=null;for(let e of this.extraStack)e.clipGroup=null;n.setAttributeNS(null,`clip-path`,e.activeClipUrl)}e.activeClipUrl=`url(#${t})`,this.tgrp=null}clip(e){this.pendingClip=e}closePath(){let e=this.current;if(e.path){let t=`${e.path.getAttributeNS(null,`d`)}Z`;e.path.setAttributeNS(null,`d`,t)}}setLeading(e){this.current.leading=-e}setTextRise(e){this.current.textRise=e}setTextRenderingMode(e){this.current.textRenderingMode=e}setHScale(e){this.current.textHScale=e/100}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(let[t,n]of e)switch(t){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);break;case`CA`:this.setStrokeAlpha(n);break;case`ca`:this.setFillAlpha(n);break;default:(0,i.warn)(`Unimplemented graphic state operator ${t}`)}}fill(){let e=this.current;e.element&&(e.element.setAttributeNS(null,`fill`,e.fillColor),e.element.setAttributeNS(null,`fill-opacity`,e.fillAlpha),this.endPath())}stroke(){let e=this.current;e.element&&(this._setStrokeAttributes(e.element),e.element.setAttributeNS(null,`fill`,`none`),this.endPath())}_setStrokeAttributes(e,t=1){let n=this.current,r=n.dashArray;t!==1&&r.length>0&&(r=r.map(function(e){return t*e})),e.setAttributeNS(null,`stroke`,n.strokeColor),e.setAttributeNS(null,`stroke-opacity`,n.strokeAlpha),e.setAttributeNS(null,`stroke-miterlimit`,m(n.miterLimit)),e.setAttributeNS(null,`stroke-linecap`,n.lineCap),e.setAttributeNS(null,`stroke-linejoin`,n.lineJoin),e.setAttributeNS(null,`stroke-width`,m(t*n.lineWidth)+`px`),e.setAttributeNS(null,`stroke-dasharray`,r.map(m).join(` `)),e.setAttributeNS(null,`stroke-dashoffset`,m(t*n.dashPhase)+`px`)}eoFill(){this.current.element?.setAttributeNS(null,`fill-rule`,`evenodd`),this.fill()}fillStroke(){this.stroke(),this.fill()}eoFillStroke(){this.current.element?.setAttributeNS(null,`fill-rule`,`evenodd`),this.fillStroke()}closeStroke(){this.closePath(),this.stroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.closePath(),this.eoFillStroke()}paintSolidColorImageMask(){let e=this.svgFactory.createElement(`svg:rect`);e.setAttributeNS(null,`x`,`0`),e.setAttributeNS(null,`y`,`0`),e.setAttributeNS(null,`width`,`1px`),e.setAttributeNS(null,`height`,`1px`),e.setAttributeNS(null,`fill`,this.current.fillColor),this._ensureTransformGroup().append(e)}paintImageXObject(e){let t=this.getObject(e);if(!t){(0,i.warn)(`Dependent image with object ID ${e} is not ready yet`);return}this.paintInlineImageXObject(t)}paintInlineImageXObject(e,t){let n=e.width,r=e.height,i=d(e,this.forceDataSchema,!!t),a=this.svgFactory.createElement(`svg:rect`);a.setAttributeNS(null,`x`,`0`),a.setAttributeNS(null,`y`,`0`),a.setAttributeNS(null,`width`,m(n)),a.setAttributeNS(null,`height`,m(r)),this.current.element=a,this.clip(`nonzero`);let o=this.svgFactory.createElement(`svg:image`);o.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,i),o.setAttributeNS(null,`x`,`0`),o.setAttributeNS(null,`y`,m(-r)),o.setAttributeNS(null,`width`,m(n)+`px`),o.setAttributeNS(null,`height`,m(r)+`px`),o.setAttributeNS(null,`transform`,`scale(${m(1/n)} ${m(-1/r)})`),t?t.append(o):this._ensureTransformGroup().append(o)}paintImageMaskXObject(e){let t=this.getObject(e.data,e);if(t.bitmap){(0,i.warn)("paintImageMaskXObject: ImageBitmap support is not implemented, ensure that the `isOffscreenCanvasSupported` API parameter is disabled.");return}let n=this.current,r=t.width,a=t.height,o=n.fillColor;n.maskId=`mask${_++}`;let s=this.svgFactory.createElement(`svg:mask`);s.setAttributeNS(null,`id`,n.maskId);let c=this.svgFactory.createElement(`svg:rect`);c.setAttributeNS(null,`x`,`0`),c.setAttributeNS(null,`y`,`0`),c.setAttributeNS(null,`width`,m(r)),c.setAttributeNS(null,`height`,m(a)),c.setAttributeNS(null,`fill`,o),c.setAttributeNS(null,`mask`,`url(#${n.maskId})`),this.defs.append(s),this._ensureTransformGroup().append(c),this.paintInlineImageXObject(t,s)}paintFormXObjectBegin(e,t){if(Array.isArray(e)&&e.length===6&&this.transform(e[0],e[1],e[2],e[3],e[4],e[5]),t){let e=t[2]-t[0],n=t[3]-t[1],r=this.svgFactory.createElement(`svg:rect`);r.setAttributeNS(null,`x`,t[0]),r.setAttributeNS(null,`y`,t[1]),r.setAttributeNS(null,`width`,m(e)),r.setAttributeNS(null,`height`,m(n)),this.current.element=r,this.clip(`nonzero`),this.endPath()}}paintFormXObjectEnd(){}_initialize(e){let t=this.svgFactory.create(e.width,e.height),n=this.svgFactory.createElement(`svg:defs`);t.append(n),this.defs=n;let r=this.svgFactory.createElement(`svg:g`);return r.setAttributeNS(null,`transform`,h(e.transform)),t.append(r),this.svg=r,t}_ensureClipGroup(){if(!this.current.clipGroup){let e=this.svgFactory.createElement(`svg:g`);e.setAttributeNS(null,`clip-path`,this.current.activeClipUrl),this.svg.append(e),this.current.clipGroup=e}return this.current.clipGroup}_ensureTransformGroup(){return this.tgrp||(this.tgrp=this.svgFactory.createElement(`svg:g`),this.tgrp.setAttributeNS(null,`transform`,h(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}}t.SVGGraphics=y}),((e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.XfaText=void 0;class n{static textContent(e){let t=[],r={items:t,styles:Object.create(null)};function i(e){if(!e)return;let r=null,a=e.name;if(a===`#text`)r=e.value;else if(n.shouldBuildText(a))e?.attributes?.textContent?r=e.attributes.textContent:e.value&&(r=e.value);else return;if(r!==null&&t.push({str:r}),e.children)for(let t of e.children)i(t)}return i(e),r}static shouldBuildText(e){return e!==`textarea`&&e!==`input`&&e!==`option`&&e!==`select`}}t.XfaText=n}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextLayerRenderTask=void 0,t.renderTextLayer=h,t.updateTextLayer=g;var r=n(1),i=n(6);let a=1e5,o=30,s=.8,c=new Map;function l(e,t){let n;if(t&&r.FeatureTest.isOffscreenCanvasSupported)n=new OffscreenCanvas(e,e).getContext(`2d`,{alpha:!1});else{let t=document.createElement(`canvas`);t.width=t.height=e,n=t.getContext(`2d`,{alpha:!1})}return n}function u(e,t){let n=c.get(e);if(n)return n;let r=l(30,t);r.font=`30px ${e}`;let i=r.measureText(``),a=i.fontBoundingBoxAscent,o=Math.abs(i.fontBoundingBoxDescent);if(a){let t=a/(a+o);return c.set(e,t),r.canvas.width=r.canvas.height=0,t}r.strokeStyle=`red`,r.clearRect(0,0,30,30),r.strokeText(`g`,0,0);let u=r.getImageData(0,0,30,30).data;o=0;for(let e=u.length-1-3;e>=0;e-=4)if(u[e]>0){o=Math.ceil(e/4/30);break}r.clearRect(0,0,30,30),r.strokeText(`A`,0,30),u=r.getImageData(0,0,30,30).data,a=0;for(let e=0,t=u.length;e<t;e+=4)if(u[e]>0){a=30-Math.floor(e/4/30);break}if(r.canvas.width=r.canvas.height=0,a){let t=a/(a+o);return c.set(e,t),t}return c.set(e,s),s}function d(e,t,n){let i=document.createElement(`span`),a={angle:0,canvasWidth:0,hasText:t.str!==``,hasEOL:t.hasEOL,fontSize:0};e._textDivs.push(i);let o=r.Util.transform(e._transform,t.transform),s=Math.atan2(o[1],o[0]),c=n[t.fontName];c.vertical&&(s+=Math.PI/2);let l=Math.hypot(o[2],o[3]),d=l*u(c.fontFamily,e._isOffscreenCanvasSupported),f,p;s===0?(f=o[4],p=o[5]-d):(f=o[4]+d*Math.sin(s),p=o[5]-d*Math.cos(s));let m=`calc(var(--scale-factor)*`,h=i.style;e._container===e._rootContainer?(h.left=`${(100*f/e._pageWidth).toFixed(2)}%`,h.top=`${(100*p/e._pageHeight).toFixed(2)}%`):(h.left=`${m}${f.toFixed(2)}px)`,h.top=`${m}${p.toFixed(2)}px)`),h.fontSize=`${m}${l.toFixed(2)}px)`,h.fontFamily=c.fontFamily,a.fontSize=l,i.setAttribute(`role`,`presentation`),i.textContent=t.str,i.dir=t.dir,e._fontInspectorEnabled&&(i.dataset.fontName=t.fontName),s!==0&&(a.angle=180/Math.PI*s);let g=!1;if(t.str.length>1)g=!0;else if(t.str!==` `&&t.transform[0]!==t.transform[3]){let e=Math.abs(t.transform[0]),n=Math.abs(t.transform[3]);e!==n&&Math.max(e,n)/Math.min(e,n)>1.5&&(g=!0)}g&&(a.canvasWidth=c.vertical?t.height:t.width),e._textDivProperties.set(i,a),e._isReadableStream&&e._layoutText(i)}function f(e){let{div:t,scale:n,properties:r,ctx:i,prevFontSize:a,prevFontFamily:o}=e,{style:s}=t,c=``;if(r.canvasWidth!==0&&r.hasText){let{fontFamily:l}=s,{canvasWidth:u,fontSize:d}=r;(a!==d||o!==l)&&(i.font=`${d*n}px ${l}`,e.prevFontSize=d,e.prevFontFamily=l);let{width:f}=i.measureText(t.textContent);f>0&&(c=`scaleX(${u*n/f})`)}r.angle!==0&&(c=`rotate(${r.angle}deg) ${c}`),c.length>0&&(s.transform=c)}function p(e){if(e._canceled)return;let t=e._textDivs,n=e._capability;if(t.length>1e5){n.resolve();return}if(!e._isReadableStream)for(let n of t)e._layoutText(n);n.resolve()}class m{constructor({textContentSource:e,container:t,viewport:n,textDivs:a,textDivProperties:o,textContentItemsStr:s,isOffscreenCanvasSupported:c}){this._textContentSource=e,this._isReadableStream=e instanceof ReadableStream,this._container=this._rootContainer=t,this._textDivs=a||[],this._textContentItemsStr=s||[],this._isOffscreenCanvasSupported=c,this._fontInspectorEnabled=!!globalThis.FontInspector?.enabled,this._reader=null,this._textDivProperties=o||new WeakMap,this._canceled=!1,this._capability=new r.PromiseCapability,this._layoutTextParams={prevFontSize:null,prevFontFamily:null,div:null,scale:n.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:l(0,c)};let{pageWidth:u,pageHeight:d,pageX:f,pageY:p}=n.rawDims;this._transform=[1,0,0,-1,-f,p+d],this._pageWidth=u,this._pageHeight=d,(0,i.setLayerDimensions)(t,n),this._capability.promise.finally(()=>{this._layoutTextParams=null}).catch(()=>{})}get promise(){return this._capability.promise}cancel(){this._canceled=!0,this._reader&&=(this._reader.cancel(new r.AbortException(`TextLayer task cancelled.`)).catch(()=>{}),null),this._capability.reject(new r.AbortException(`TextLayer task cancelled.`))}_processItems(e,t){for(let n of e){if(n.str===void 0){if(n.type===`beginMarkedContentProps`||n.type===`beginMarkedContent`){let e=this._container;this._container=document.createElement(`span`),this._container.classList.add(`markedContent`),n.id!==null&&this._container.setAttribute(`id`,`${n.id}`),e.append(this._container)}else n.type===`endMarkedContent`&&(this._container=this._container.parentNode);continue}this._textContentItemsStr.push(n.str),d(this,n,t)}}_layoutText(e){let t=this._layoutTextParams.properties=this._textDivProperties.get(e);if(this._layoutTextParams.div=e,f(this._layoutTextParams),t.hasText&&this._container.append(e),t.hasEOL){let e=document.createElement(`br`);e.setAttribute(`role`,`presentation`),this._container.append(e)}}_render(){let e=new r.PromiseCapability,t=Object.create(null);if(this._isReadableStream){let n=()=>{this._reader.read().then(({value:r,done:i})=>{if(i){e.resolve();return}Object.assign(t,r.styles),this._processItems(r.items,t),n()},e.reject)};this._reader=this._textContentSource.getReader(),n()}else if(this._textContentSource){let{items:t,styles:n}=this._textContentSource;this._processItems(t,n),e.resolve()}else throw Error(`No "textContentSource" parameter specified.`);e.promise.then(()=>{t=null,p(this)},this._capability.reject)}}t.TextLayerRenderTask=m;function h(e){!e.textContentSource&&(e.textContent||e.textContentStream)&&((0,i.deprecated)("The TextLayerRender `textContent`/`textContentStream` parameters will be removed in the future, please use `textContentSource` instead."),e.textContentSource=e.textContent||e.textContentStream);let{container:t,viewport:n}=e,r=getComputedStyle(t),a=r.getPropertyValue(`visibility`),o=parseFloat(r.getPropertyValue(`--scale-factor`));a===`visible`&&(!o||Math.abs(o-n.scale)>1e-5)&&console.error("The `--scale-factor` CSS-variable must be set, to the same value as `viewport.scale`, either on the `container`-element itself or higher up in the DOM.");let s=new m(e);return s._render(),s}function g({container:e,viewport:t,textDivs:n,textDivProperties:r,isOffscreenCanvasSupported:a,mustRotate:o=!0,mustRescale:s=!0}){if(o&&(0,i.setLayerDimensions)(e,{rotation:t.rotation}),s){let e=l(0,a),i={prevFontSize:null,prevFontFamily:null,div:null,scale:t.scale*(globalThis.devicePixelRatio||1),properties:null,ctx:e};for(let e of n)i.properties=r.get(e),i.div=e,f(i)}}}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationEditorLayer=void 0;var r=n(1),i=n(4),a=n(28),o=n(33),s=n(6),c=n(34);class l{#e;#t=!1;#n=null;#r=this.pointerup.bind(this);#i=this.pointerdown.bind(this);#a=new Map;#o=!1;#s=!1;#c=!1;#l;static _initialized=!1;constructor({uiManager:e,pageIndex:t,div:n,accessibilityManager:r,annotationLayer:i,viewport:s,l10n:u}){let d=[a.FreeTextEditor,o.InkEditor,c.StampEditor];if(!l._initialized){l._initialized=!0;for(let e of d)e.initialize(u)}e.registerEditorTypes(d),this.#l=e,this.pageIndex=t,this.div=n,this.#e=r,this.#n=i,this.viewport=s,this.#l.addLayer(this)}get isEmpty(){return this.#a.size===0}updateToolbar(e){this.#l.updateToolbar(e)}updateMode(e=this.#l.getMode()){this.#p(),e===r.AnnotationEditorType.INK?(this.addInkEditorIfNeeded(!1),this.disableClick()):this.enableClick(),e!==r.AnnotationEditorType.NONE&&(this.div.classList.toggle(`freeTextEditing`,e===r.AnnotationEditorType.FREETEXT),this.div.classList.toggle(`inkEditing`,e===r.AnnotationEditorType.INK),this.div.classList.toggle(`stampEditing`,e===r.AnnotationEditorType.STAMP),this.div.hidden=!1)}addInkEditorIfNeeded(e){if(!(!e&&this.#l.getMode()!==r.AnnotationEditorType.INK)){if(!e){for(let e of this.#a.values())if(e.isEmpty()){e.setInBackground();return}}this.#d({offsetX:0,offsetY:0},!1).setInBackground()}}setEditingState(e){this.#l.setEditingState(e)}addCommands(e){this.#l.addCommands(e)}enable(){this.div.style.pointerEvents=`auto`;let e=new Set;for(let t of this.#a.values())t.enableEditing(),t.annotationElementId&&e.add(t.annotationElementId);if(!this.#n)return;let t=this.#n.getEditableAnnotations();for(let n of t){if(n.hide(),this.#l.isDeletedAnnotationElement(n.data.id)||e.has(n.data.id))continue;let t=this.deserialize(n);t&&(this.addOrRebuild(t),t.enableEditing())}}disable(){this.#c=!0,this.div.style.pointerEvents=`none`;let e=new Set;for(let t of this.#a.values()){if(t.disableEditing(),!t.annotationElementId||t.serialize()!==null){e.add(t.annotationElementId);continue}this.getEditableAnnotation(t.annotationElementId)?.show(),t.remove()}if(this.#n){let t=this.#n.getEditableAnnotations();for(let n of t){let{id:t}=n.data;e.has(t)||this.#l.isDeletedAnnotationElement(t)||n.show()}}this.#p(),this.isEmpty&&(this.div.hidden=!0),this.#c=!1}getEditableAnnotation(e){return this.#n?.getEditableAnnotation(e)||null}setActiveEditor(e){this.#l.getActive()!==e&&this.#l.setActiveEditor(e)}enableClick(){this.div.addEventListener(`pointerdown`,this.#i),this.div.addEventListener(`pointerup`,this.#r)}disableClick(){this.div.removeEventListener(`pointerdown`,this.#i),this.div.removeEventListener(`pointerup`,this.#r)}attach(e){this.#a.set(e.id,e);let{annotationElementId:t}=e;t&&this.#l.isDeletedAnnotationElement(t)&&this.#l.removeDeletedAnnotationElement(e)}detach(e){this.#a.delete(e.id),this.#e?.removePointerInTextLayer(e.contentDiv),!this.#c&&e.annotationElementId&&this.#l.addDeletedAnnotationElement(e)}remove(e){this.detach(e),this.#l.removeEditor(e),e.div.contains(document.activeElement)&&setTimeout(()=>{this.#l.focusMainContainer()},0),e.div.remove(),e.isAttachedToDOM=!1,this.#s||this.addInkEditorIfNeeded(!1)}changeParent(e){e.parent!==this&&(e.annotationElementId&&=(this.#l.addDeletedAnnotationElement(e.annotationElementId),i.AnnotationEditor.deleteAnnotationElement(e),null),this.attach(e),e.parent?.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(this.changeParent(e),this.#l.addEditor(e),this.attach(e),!e.isAttachedToDOM){let t=e.render();this.div.append(t),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(),this.#l.addToAnnotationStorage(e)}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;let{activeElement:t}=document;e.div.contains(t)&&(e._focusEventsAllowed=!1,setTimeout(()=>{e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener(`focusin`,()=>{e._focusEventsAllowed=!0},{once:!0}),t.focus())},0)),e._structTreeParentId=this.#e?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?e.rebuild():this.add(e)}addUndoableEditor(e){this.addCommands({cmd:()=>e._uiManager.rebuild(e),undo:()=>{e.remove()},mustExec:!1})}getNextId(){return this.#l.getId()}#u(e){switch(this.#l.getMode()){case r.AnnotationEditorType.FREETEXT:return new a.FreeTextEditor(e);case r.AnnotationEditorType.INK:return new o.InkEditor(e);case r.AnnotationEditorType.STAMP:return new c.StampEditor(e)}return null}pasteEditor(e,t){this.#l.updateToolbar(e),this.#l.updateMode(e);let{offsetX:n,offsetY:r}=this.#f(),i=this.getNextId(),a=this.#u({parent:this,id:i,x:n,y:r,uiManager:this.#l,isCentered:!0,...t});a&&this.add(a)}deserialize(e){switch(e.annotationType??e.annotationEditorType){case r.AnnotationEditorType.FREETEXT:return a.FreeTextEditor.deserialize(e,this,this.#l);case r.AnnotationEditorType.INK:return o.InkEditor.deserialize(e,this,this.#l);case r.AnnotationEditorType.STAMP:return c.StampEditor.deserialize(e,this,this.#l)}return null}#d(e,t){let n=this.getNextId(),r=this.#u({parent:this,id:n,x:e.offsetX,y:e.offsetY,uiManager:this.#l,isCentered:t});return r&&this.add(r),r}#f(){let{x:e,y:t,width:n,height:r}=this.div.getBoundingClientRect(),i=Math.max(0,e),a=Math.max(0,t),o=Math.min(window.innerWidth,e+n),s=Math.min(window.innerHeight,t+r),c=(i+o)/2-e,l=(a+s)/2-t,[u,d]=this.viewport.rotation%180==0?[c,l]:[l,c];return{offsetX:u,offsetY:d}}addNewEditor(){this.#d(this.#f(),!0)}setSelected(e){this.#l.setSelected(e)}toggleSelected(e){this.#l.toggleSelected(e)}isSelected(e){return this.#l.isSelected(e)}unselect(e){this.#l.unselect(e)}pointerup(e){let{isMac:t}=r.FeatureTest.platform;if(!(e.button!==0||e.ctrlKey&&t)&&e.target===this.div&&this.#o){if(this.#o=!1,!this.#t){this.#t=!0;return}if(this.#l.getMode()===r.AnnotationEditorType.STAMP){this.#l.unselectAll();return}this.#d(e,!1)}}pointerdown(e){if(this.#o){this.#o=!1;return}let{isMac:t}=r.FeatureTest.platform;if(e.button!==0||e.ctrlKey&&t||e.target!==this.div)return;this.#o=!0;let n=this.#l.getActive();this.#t=!n||n.isEmpty()}findNewParent(e,t,n){let r=this.#l.findParent(t,n);return r===null||r===this?!1:(r.changeParent(e),!0)}destroy(){this.#l.getActive()?.parent===this&&(this.#l.commitOrRemove(),this.#l.setActiveEditor(null));for(let e of this.#a.values())this.#e?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#a.clear(),this.#l.removeLayer(this)}#p(){this.#s=!0;for(let e of this.#a.values())e.isEmpty()&&e.remove();this.#s=!1}render({viewport:e}){this.viewport=e,(0,s.setLayerDimensions)(this.div,e);for(let e of this.#l.getEditors(this.pageIndex))this.add(e);this.updateMode()}update({viewport:e}){this.#l.commitOrRemove(),this.viewport=e,(0,s.setLayerDimensions)(this.div,{rotation:e.rotation}),this.updateMode()}get pageDimensions(){let{pageWidth:e,pageHeight:t}=this.viewport.rawDims;return[e,t]}}t.AnnotationEditorLayer=l}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FreeTextEditor=void 0;var r=n(1),i=n(5),a=n(4),o=n(29);class s extends a.AnnotationEditor{#e=this.editorDivBlur.bind(this);#t=this.editorDivFocus.bind(this);#n=this.editorDivInput.bind(this);#r=this.editorDivKeydown.bind(this);#i;#a=``;#o=`${this.id}-editor`;#s;#c=null;static _freeTextDefaultContent=``;static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){let e=s.prototype,t=e=>e.isEmpty(),n=i.AnnotationEditorUIManager.TRANSLATE_SMALL,a=i.AnnotationEditorUIManager.TRANSLATE_BIG;return(0,r.shadow)(this,`_keyboardManager`,new i.KeyboardManager([[[`ctrl+s`,`mac+meta+s`,`ctrl+p`,`mac+meta+p`],e.commitOrRemove,{bubbles:!0}],[[`ctrl+Enter`,`mac+meta+Enter`,`Escape`,`mac+Escape`],e.commitOrRemove],[[`ArrowLeft`,`mac+ArrowLeft`],e._translateEmpty,{args:[-n,0],checker:t}],[[`ctrl+ArrowLeft`,`mac+shift+ArrowLeft`],e._translateEmpty,{args:[-a,0],checker:t}],[[`ArrowRight`,`mac+ArrowRight`],e._translateEmpty,{args:[n,0],checker:t}],[[`ctrl+ArrowRight`,`mac+shift+ArrowRight`],e._translateEmpty,{args:[a,0],checker:t}],[[`ArrowUp`,`mac+ArrowUp`],e._translateEmpty,{args:[0,-n],checker:t}],[[`ctrl+ArrowUp`,`mac+shift+ArrowUp`],e._translateEmpty,{args:[0,-a],checker:t}],[[`ArrowDown`,`mac+ArrowDown`],e._translateEmpty,{args:[0,n],checker:t}],[[`ctrl+ArrowDown`,`mac+shift+ArrowDown`],e._translateEmpty,{args:[0,a],checker:t}]]))}static _type=`freetext`;constructor(e){super({...e,name:`freeTextEditor`}),this.#i=e.color||s._defaultColor||a.AnnotationEditor._defaultLineColor,this.#s=e.fontSize||s._defaultFontSize}static initialize(e){a.AnnotationEditor.initialize(e,{strings:[`free_text2_default_content`,`editor_free_text2_aria_label`]});let t=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(t.getPropertyValue(`--freetext-padding`))}static updateDefaultParams(e,t){switch(e){case r.AnnotationEditorParamsType.FREETEXT_SIZE:s._defaultFontSize=t;break;case r.AnnotationEditorParamsType.FREETEXT_COLOR:s._defaultColor=t}}updateParams(e,t){switch(e){case r.AnnotationEditorParamsType.FREETEXT_SIZE:this.#l(t);break;case r.AnnotationEditorParamsType.FREETEXT_COLOR:this.#u(t)}}static get defaultPropertiesToUpdate(){return[[r.AnnotationEditorParamsType.FREETEXT_SIZE,s._defaultFontSize],[r.AnnotationEditorParamsType.FREETEXT_COLOR,s._defaultColor||a.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[r.AnnotationEditorParamsType.FREETEXT_SIZE,this.#s],[r.AnnotationEditorParamsType.FREETEXT_COLOR,this.#i]]}#l(e){let t=e=>{this.editorDiv.style.fontSize=`calc(${e}px * var(--scale-factor))`,this.translate(0,-(e-this.#s)*this.parentScale),this.#s=e,this.#f()},n=this.#s;this.addCommands({cmd:()=>{t(e)},undo:()=>{t(n)},mustExec:!0,type:r.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#u(e){let t=this.#i;this.addCommands({cmd:()=>{this.#i=this.editorDiv.style.color=e},undo:()=>{this.#i=this.editorDiv.style.color=t},mustExec:!0,type:r.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(e,t){this._uiManager.translateSelectedEditors(e,t,!0)}getInitialTranslation(){let e=this.parentScale;return[-s._internalPadding*e,-(s._internalPadding+this.#s)*e]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(r.AnnotationEditorType.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove(`enabled`),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute(`aria-activedescendant`),this.editorDiv.addEventListener(`keydown`,this.#r),this.editorDiv.addEventListener(`focus`,this.#t),this.editorDiv.addEventListener(`blur`,this.#e),this.editorDiv.addEventListener(`input`,this.#n))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add(`enabled`),this.editorDiv.contentEditable=!1,this.div.setAttribute(`aria-activedescendant`,this.#o),this._isDraggable=!0,this.editorDiv.removeEventListener(`keydown`,this.#r),this.editorDiv.removeEventListener(`focus`,this.#t),this.editorDiv.removeEventListener(`blur`,this.#e),this.editorDiv.removeEventListener(`input`,this.#n),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add(`freeTextEditing`))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){if(this.width){this.#h();return}this.enableEditMode(),this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===``}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add(`freeTextEditing`)),super.remove()}#d(){let e=this.editorDiv.getElementsByTagName(`div`);if(e.length===0)return this.editorDiv.innerText;let t=[];for(let n of e)t.push(n.innerText.replace(/\r\n?|\n/,``));return t.join(`
3
- `)}#f(){let[e,t]=this.parentDimensions,n;if(this.isAttachedToDOM)n=this.div.getBoundingClientRect();else{let{currentLayer:e,div:t}=this,r=t.style.display;t.style.display=`hidden`,e.div.append(this.div),n=t.getBoundingClientRect(),t.remove(),t.style.display=r}this.rotation%180==this.parentRotation%180?(this.width=n.width/e,this.height=n.height/t):(this.width=n.height/e,this.height=n.width/t),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();let e=this.#a,t=this.#a=this.#d().trimEnd();if(e===t)return;let n=e=>{if(this.#a=e,!e){this.remove();return}this.#p(),this._uiManager.rebuild(this),this.#f()};this.addCommands({cmd:()=>{n(t)},undo:()=>{n(e)},mustExec:!1}),this.#f()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(e){this.enterInEditMode()}keydown(e){e.target===this.div&&e.key===`Enter`&&(this.enterInEditMode(),e.preventDefault())}editorDivKeydown(e){s._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}editorDivInput(e){this.parent.div.classList.toggle(`freeTextEditing`,this.isEmpty())}disableEditing(){this.editorDiv.setAttribute(`role`,`comment`),this.editorDiv.removeAttribute(`aria-multiline`)}enableEditing(){this.editorDiv.setAttribute(`role`,`textbox`),this.editorDiv.setAttribute(`aria-multiline`,!0)}render(){if(this.div)return this.div;let e,t;this.width&&(e=this.x,t=this.y),super.render(),this.editorDiv=document.createElement(`div`),this.editorDiv.className=`internal`,this.editorDiv.setAttribute(`id`,this.#o),this.enableEditing(),a.AnnotationEditor._l10nPromise.get(`editor_free_text2_aria_label`).then(e=>this.editorDiv?.setAttribute(`aria-label`,e)),a.AnnotationEditor._l10nPromise.get(`free_text2_default_content`).then(e=>this.editorDiv?.setAttribute(`default-content`,e)),this.editorDiv.contentEditable=!0;let{style:n}=this.editorDiv;if(n.fontSize=`calc(${this.#s}px * var(--scale-factor))`,n.color=this.#i,this.div.append(this.editorDiv),this.overlayDiv=document.createElement(`div`),this.overlayDiv.classList.add(`overlay`,`enabled`),this.div.append(this.overlayDiv),(0,i.bindEvents)(this,this.div,[`dblclick`,`keydown`]),this.width){let[n,r]=this.parentDimensions;if(this.annotationElementId){let{position:i}=this.#c,[a,o]=this.getInitialTranslation();[a,o]=this.pageTranslationToScreen(a,o);let[s,c]=this.pageDimensions,[l,u]=this.pageTranslation,d,f;switch(this.rotation){case 0:d=e+(i[0]-l)/s,f=t+this.height-(i[1]-u)/c;break;case 90:d=e+(i[0]-l)/s,f=t-(i[1]-u)/c,[a,o]=[o,-a];break;case 180:d=e-this.width+(i[0]-l)/s,f=t-(i[1]-u)/c,[a,o]=[-a,-o];break;case 270:d=e+(i[0]-l-this.height*c)/s,f=t+(i[1]-u-this.width*s)/c,[a,o]=[-o,a]}this.setAt(d*n,f*r,a,o)}else this.setAt(e*n,t*r,this.width*n,this.height*r);this.#p(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}#p(){if(this.editorDiv.replaceChildren(),this.#a)for(let e of this.#a.split(`
4
- `)){let t=document.createElement(`div`);t.append(e?document.createTextNode(e):document.createElement(`br`)),this.editorDiv.append(t)}}get contentDiv(){return this.editorDiv}static deserialize(e,t,n){let i=null;if(e instanceof o.FreeTextAnnotationElement){let{data:{defaultAppearanceData:{fontSize:t,fontColor:n},rect:a,rotation:o,id:s},textContent:c,textPosition:l,parent:{page:{pageNumber:u}}}=e;if(!c||c.length===0)return null;i=e={annotationType:r.AnnotationEditorType.FREETEXT,color:Array.from(n),fontSize:t,value:c.join(`
5
- `),position:l,pageIndex:u-1,rect:a,rotation:o,id:s,deleted:!1}}let a=super.deserialize(e,t,n);return a.#s=e.fontSize,a.#i=r.Util.makeHexColor(...e.color),a.#a=e.value,a.annotationElementId=e.id||null,a.#c=i,a}serialize(e=!1){if(this.isEmpty())return null;if(this.deleted)return{pageIndex:this.pageIndex,id:this.annotationElementId,deleted:!0};let t=s._internalPadding*this.parentScale,n=this.getRect(t,t),i=a.AnnotationEditor._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#i),o={annotationType:r.AnnotationEditorType.FREETEXT,color:i,fontSize:this.#s,value:this.#a,pageIndex:this.pageIndex,rect:n,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return e?o:this.annotationElementId&&!this.#m(o)?null:(o.id=this.annotationElementId,o)}#m(e){let{value:t,fontSize:n,color:r,rect:i,pageIndex:a}=this.#c;return e.value!==t||e.fontSize!==n||e.rect.some((e,t)=>Math.abs(e-i[t])>=1)||e.color.some((e,t)=>e!==r[t])||e.pageIndex!==a}#h(e=!1){if(!this.annotationElementId)return;if(this.#f(),!e&&(this.width===0||this.height===0)){setTimeout(()=>this.#h(!0),0);return}let t=s._internalPadding*this.parentScale;this.#c.rect=this.getRect(t,t)}}t.FreeTextEditor=s}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StampAnnotationElement=t.InkAnnotationElement=t.FreeTextAnnotationElement=t.AnnotationLayer=void 0;var r=n(1),i=n(6),a=n(3),o=n(30),s=n(31),c=n(32);let l=1e3,u=9,d=new WeakSet;function f(e){return{width:e[2]-e[0],height:e[3]-e[1]}}class p{static create(e){switch(e.data.annotationType){case r.AnnotationType.LINK:return new h(e);case r.AnnotationType.TEXT:return new g(e);case r.AnnotationType.WIDGET:switch(e.data.fieldType){case`Tx`:return new v(e);case`Btn`:return e.data.radioButton?new x(e):e.data.checkBox?new b(e):new S(e);case`Ch`:return new C(e);case`Sig`:return new y(e)}return new _(e);case r.AnnotationType.POPUP:return new w(e);case r.AnnotationType.FREETEXT:return new E(e);case r.AnnotationType.LINE:return new D(e);case r.AnnotationType.SQUARE:return new O(e);case r.AnnotationType.CIRCLE:return new k(e);case r.AnnotationType.POLYLINE:return new A(e);case r.AnnotationType.CARET:return new M(e);case r.AnnotationType.INK:return new N(e);case r.AnnotationType.POLYGON:return new j(e);case r.AnnotationType.HIGHLIGHT:return new P(e);case r.AnnotationType.UNDERLINE:return new F(e);case r.AnnotationType.SQUIGGLY:return new I(e);case r.AnnotationType.STRIKEOUT:return new L(e);case r.AnnotationType.STAMP:return new R(e);case r.AnnotationType.FILEATTACHMENT:return new z(e);default:return new m(e)}}}class m{#e=!1;constructor(e,{isRenderable:t=!1,ignoreBorder:n=!1,createQuadrilaterals:r=!1}={}){this.isRenderable=t,this.data=e.data,this.layer=e.layer,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this.parent=e.parent,t&&(this.container=this._createContainer(n)),r&&this._createQuadrilaterals()}static _hasPopupData({titleObj:e,contentsObj:t,richText:n}){return!!(e?.str||t?.str||n?.str)}get hasPopupData(){return m._hasPopupData(this.data)}_createContainer(e){let{data:t,parent:{page:n,viewport:i}}=this,a=document.createElement(`section`);a.setAttribute(`data-annotation-id`,t.id),this instanceof _||(a.tabIndex=l),a.style.zIndex=this.parent.zIndex++,this.data.popupRef&&a.setAttribute(`aria-haspopup`,`dialog`),t.noRotate&&a.classList.add(`norotate`);let{pageWidth:o,pageHeight:s,pageX:c,pageY:u}=i.rawDims;if(!t.rect||this instanceof w){let{rotation:e}=t;return!t.hasOwnCanvas&&e!==0&&this.setRotation(e,a),a}let{width:d,height:p}=f(t.rect),m=r.Util.normalizeRect([t.rect[0],n.view[3]-t.rect[1]+n.view[1],t.rect[2],n.view[3]-t.rect[3]+n.view[1]]);if(!e&&t.borderStyle.width>0){a.style.borderWidth=`${t.borderStyle.width}px`;let e=t.borderStyle.horizontalCornerRadius,n=t.borderStyle.verticalCornerRadius;if(e>0||n>0){let t=`calc(${e}px * var(--scale-factor)) / calc(${n}px * var(--scale-factor))`;a.style.borderRadius=t}else if(this instanceof x){let e=`calc(${d}px * var(--scale-factor)) / calc(${p}px * var(--scale-factor))`;a.style.borderRadius=e}switch(t.borderStyle.style){case r.AnnotationBorderStyleType.SOLID:a.style.borderStyle=`solid`;break;case r.AnnotationBorderStyleType.DASHED:a.style.borderStyle=`dashed`;break;case r.AnnotationBorderStyleType.BEVELED:(0,r.warn)(`Unimplemented border style: beveled`);break;case r.AnnotationBorderStyleType.INSET:(0,r.warn)(`Unimplemented border style: inset`);break;case r.AnnotationBorderStyleType.UNDERLINE:a.style.borderBottomStyle=`solid`}let i=t.borderColor||null;i?(this.#e=!0,a.style.borderColor=r.Util.makeHexColor(i[0]|0,i[1]|0,i[2]|0)):a.style.borderWidth=0}a.style.left=`${100*(m[0]-c)/o}%`,a.style.top=`${100*(m[1]-u)/s}%`;let{rotation:h}=t;return t.hasOwnCanvas||h===0?(a.style.width=`${100*d/o}%`,a.style.height=`${100*p/s}%`):this.setRotation(h,a),a}setRotation(e,t=this.container){if(!this.data.rect)return;let{pageWidth:n,pageHeight:r}=this.parent.viewport.rawDims,{width:i,height:a}=f(this.data.rect),o,s;e%180==0?(o=100*i/n,s=100*a/r):(o=100*a/n,s=100*i/r),t.style.width=`${o}%`,t.style.height=`${s}%`,t.setAttribute(`data-main-rotation`,(360-e)%360)}get _commonActions(){let e=(e,t,n)=>{let r=n.detail[e],i=r[0],a=r.slice(1);n.target.style[t]=o.ColorConverters[`${i}_HTML`](a),this.annotationStorage.setValue(this.data.id,{[t]:o.ColorConverters[`${i}_rgb`](a)})};return(0,r.shadow)(this,`_commonActions`,{display:e=>{let{display:t}=e.detail,n=t%2==1;this.container.style.visibility=n?`hidden`:`visible`,this.annotationStorage.setValue(this.data.id,{noView:n,noPrint:t===1||t===2})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{let{hidden:t}=e.detail;this.container.style.visibility=t?`hidden`:`visible`,this.annotationStorage.setValue(this.data.id,{noPrint:t,noView:t})},focus:e=>{setTimeout(()=>e.target.focus({preventScroll:!1}),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:t=>{e(`bgColor`,`backgroundColor`,t)},fillColor:t=>{e(`fillColor`,`backgroundColor`,t)},fgColor:t=>{e(`fgColor`,`color`,t)},textColor:t=>{e(`textColor`,`color`,t)},borderColor:t=>{e(`borderColor`,`borderColor`,t)},strokeColor:t=>{e(`strokeColor`,`borderColor`,t)},rotation:e=>{let t=e.detail.rotation;this.setRotation(t),this.annotationStorage.setValue(this.data.id,{rotation:t})}})}_dispatchEventFromSandbox(e,t){let n=this._commonActions;for(let r of Object.keys(t.detail))(e[r]||n[r])?.(t)}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;let t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;let n=this._commonActions;for(let[r,i]of Object.entries(t)){let a=n[r];a&&(a({detail:{[r]:i},target:e}),delete t[r])}}_createQuadrilaterals(){if(!this.container)return;let{quadPoints:e}=this.data;if(!e)return;let[t,n,r,i]=this.data.rect;if(e.length===1){let[,{x:a,y:o},{x:s,y:c}]=e[0];if(r===a&&i===o&&t===s&&n===c)return}let{style:a}=this.container,o;if(this.#e){let{borderColor:e,borderWidth:t}=a;a.borderWidth=0,o=[`url('data:image/svg+xml;utf8,`,`<svg xmlns="http://www.w3.org/2000/svg"`,` preserveAspectRatio="none" viewBox="0 0 1 1">`,`<g fill="transparent" stroke="${e}" stroke-width="${t}">`],this.container.classList.add(`hasBorder`)}let s=r-t,c=i-n,{svgFactory:l}=this,u=l.createElement(`svg`);u.classList.add(`quadrilateralsContainer`),u.setAttribute(`width`,0),u.setAttribute(`height`,0);let d=l.createElement(`defs`);u.append(d);let f=l.createElement(`clipPath`),p=`clippath_${this.data.id}`;f.setAttribute(`id`,p),f.setAttribute(`clipPathUnits`,`objectBoundingBox`),d.append(f);for(let[,{x:n,y:r},{x:a,y:u}]of e){let e=l.createElement(`rect`),d=(a-t)/s,p=(i-r)/c,m=(n-a)/s,h=(r-u)/c;e.setAttribute(`x`,d),e.setAttribute(`y`,p),e.setAttribute(`width`,m),e.setAttribute(`height`,h),f.append(e),o?.push(`<rect vector-effect="non-scaling-stroke" x="${d}" y="${p}" width="${m}" height="${h}"/>`)}this.#e&&(o.push(`</g></svg>')`),a.backgroundImage=o.join(``)),this.container.append(u),this.container.style.clipPath=`url(#${p})`}_createPopup(){let{container:e,data:t}=this;e.setAttribute(`aria-haspopup`,`dialog`);let n=new w({data:{color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,richText:t.richText,parentRect:t.rect,borderStyle:0,id:`popup_${t.id}`,rotation:t.rotation},parent:this.parent,elements:[this]});this.parent.div.append(n.render())}render(){(0,r.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){let n=[];if(this._fieldObjects){let i=this._fieldObjects[e];if(i)for(let{page:e,id:a,exportValues:o}of i){if(e===-1||a===t)continue;let i=typeof o==`string`?o:null,s=document.querySelector(`[data-element-id="${a}"]`);if(s&&!d.has(s)){(0,r.warn)(`_getElementsByName - element not allowed: ${a}`);continue}n.push({id:a,exportValue:i,domElement:s})}return n}for(let r of document.getElementsByName(e)){let{exportValue:e}=r,i=r.getAttribute(`data-element-id`);i!==t&&d.has(r)&&n.push({id:i,exportValue:e,domElement:r})}return n}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){let e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(let t of e)t.classList.add(`highlightArea`);else e.classList.add(`highlightArea`)}_editOnDoubleClick(){let{annotationEditorType:e,data:{id:t}}=this;this.container.addEventListener(`dblclick`,()=>{this.linkService.eventBus?.dispatch(`switchannotationeditormode`,{source:this,mode:e,editId:t})})}}class h extends m{constructor(e,t=null){super(e,{isRenderable:!0,ignoreBorder:!!t?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=e.data.isTooltipOnly}render(){let{data:e,linkService:t}=this,n=document.createElement(`a`);n.setAttribute(`data-element-id`,e.id);let r=!1;return e.url?(t.addLinkAttributes(n,e.url,e.newWindow),r=!0):e.action?(this._bindNamedAction(n,e.action),r=!0):e.attachment?(this._bindAttachment(n,e.attachment),r=!0):e.setOCGState?(this.#t(n,e.setOCGState),r=!0):e.dest?(this._bindLink(n,e.dest),r=!0):(e.actions&&(e.actions.Action||e.actions[`Mouse Up`]||e.actions[`Mouse Down`])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(n,e),r=!0),e.resetForm?(this._bindResetFormAction(n,e.resetForm),r=!0):this.isTooltipOnly&&!r&&(this._bindLink(n,``),r=!0)),this.container.classList.add(`linkAnnotation`),r&&this.container.append(n),this.container}#e(){this.container.setAttribute(`data-internal-link`,``)}_bindLink(e,t){e.href=this.linkService.getDestinationHash(t),e.onclick=()=>(t&&this.linkService.goToDestination(t),!1),(t||t===``)&&this.#e()}_bindNamedAction(e,t){e.href=this.linkService.getAnchorUrl(``),e.onclick=()=>(this.linkService.executeNamedAction(t),!1),this.#e()}_bindAttachment(e,t){e.href=this.linkService.getAnchorUrl(``),e.onclick=()=>(this.downloadManager?.openOrDownloadData(this.container,t.content,t.filename),!1),this.#e()}#t(e,t){e.href=this.linkService.getAnchorUrl(``),e.onclick=()=>(this.linkService.executeSetOCGState(t),!1),this.#e()}_bindJSAction(e,t){e.href=this.linkService.getAnchorUrl(``);let n=new Map([[`Action`,`onclick`],[`Mouse Up`,`onmouseup`],[`Mouse Down`,`onmousedown`]]);for(let r of Object.keys(t.actions)){let i=n.get(r);i&&(e[i]=()=>(this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t.id,name:r}}),!1))}e.onclick||=()=>!1,this.#e()}_bindResetFormAction(e,t){let n=e.onclick;if(n||(e.href=this.linkService.getAnchorUrl(``)),this.#e(),!this._fieldObjects){(0,r.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),n||(e.onclick=()=>!1);return}e.onclick=()=>{n?.();let{fields:e,refs:i,include:a}=t,o=[];if(e.length!==0||i.length!==0){let t=new Set(i);for(let n of e){let e=this._fieldObjects[n]||[];for(let{id:n}of e)t.add(n)}for(let e of Object.values(this._fieldObjects))for(let n of e)t.has(n.id)===a&&o.push(n)}else for(let e of Object.values(this._fieldObjects))o.push(...e);let s=this.annotationStorage,c=[];for(let e of o){let{id:t}=e;switch(c.push(t),e.type){case`text`:{let n=e.defaultValue||``;s.setValue(t,{value:n});break}case`checkbox`:case`radiobutton`:{let n=e.defaultValue===e.exportValues;s.setValue(t,{value:n});break}case`combobox`:case`listbox`:{let n=e.defaultValue||``;s.setValue(t,{value:n});break}default:continue}let n=document.querySelector(`[data-element-id="${t}"]`);if(n){if(!d.has(n)){(0,r.warn)(`_bindResetFormAction - element not allowed: ${t}`);continue}n.dispatchEvent(new Event(`resetform`))}}return this.enableScripting&&this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:`app`,ids:c,name:`ResetForm`}}),!1}}}class g extends m{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add(`textAnnotation`);let e=document.createElement(`img`);return e.src=this.imageResourcesPath+`annotation-`+this.data.name.toLowerCase()+`.svg`,e.alt=`[{{type}} Annotation]`,e.dataset.l10nId=`text_annotation_type`,e.dataset.l10nArgs=JSON.stringify({type:this.data.name}),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(e),this.container}}class _ extends m{render(){return this.data.alternativeText&&(this.container.title=this.data.alternativeText),this.container}showElementAndHideCanvas(e){this.data.hasOwnCanvas&&(e.previousSibling?.nodeName===`CANVAS`&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){let{isWin:t,isMac:n}=r.FeatureTest.platform;return t&&e.ctrlKey||n&&e.metaKey}_setEventListener(e,t,n,r,i){n.includes(`mouse`)?e.addEventListener(n,e=>{this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:this.data.id,name:r,value:i(e),shift:e.shiftKey,modifier:this._getKeyModifier(e)}})}):e.addEventListener(n,e=>{if(n===`blur`){if(!t.focused||!e.relatedTarget)return;t.focused=!1}else if(n===`focus`){if(t.focused)return;t.focused=!0}i&&this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:this.data.id,name:r,value:i(e)}})})}_setEventListeners(e,t,n,r){for(let[i,a]of n)(a===`Action`||this.data.actions?.[a])&&((a===`Focus`||a===`Blur`)&&(t||={focused:!1}),this._setEventListener(e,t,i,a,r),a===`Focus`&&!this.data.actions?.Blur?this._setEventListener(e,t,`blur`,`Blur`,null):a===`Blur`&&!this.data.actions?.Focus&&this._setEventListener(e,t,`focus`,`Focus`,null))}_setBackgroundColor(e){let t=this.data.backgroundColor||null;e.style.backgroundColor=t===null?`transparent`:r.Util.makeHexColor(t[0],t[1],t[2])}_setTextStyle(e){let t=[`left`,`center`,`right`],{fontColor:n}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||9,a=e.style,o,s=2,c=e=>Math.round(10*e)/10;if(this.data.multiLine){let e=Math.abs(this.data.rect[3]-this.data.rect[1]-2),t=e/(Math.round(e/(r.LINE_FACTOR*i))||1);o=Math.min(i,c(t/r.LINE_FACTOR))}else{let e=Math.abs(this.data.rect[3]-this.data.rect[1]-2);o=Math.min(i,c(e/r.LINE_FACTOR))}a.fontSize=`calc(${o}px * var(--scale-factor))`,a.color=r.Util.makeHexColor(n[0],n[1],n[2]),this.data.textAlignment!==null&&(a.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute(`required`,!0):e.removeAttribute(`required`),e.setAttribute(`aria-required`,t)}}class v extends _{constructor(e){let t=e.renderForms||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:t})}setPropertyOnSiblings(e,t,n,r){let i=this.annotationStorage;for(let a of this._getElementsByName(e.name,e.id))a.domElement&&(a.domElement[t]=n),i.setValue(a.id,{[r]:n})}render(){let e=this.annotationStorage,t=this.data.id;this.container.classList.add(`textWidgetAnnotation`);let n=null;if(this.renderForms){let r=e.getValue(t,{value:this.data.fieldValue}),i=r.value||``,a=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;a&&i.length>a&&(i=i.slice(0,a));let o=r.formattedValue||this.data.textContent?.join(`
6
- `)||null;o&&this.data.comb&&(o=o.replaceAll(/\s+/g,``));let s={userValue:i,formattedValue:o,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(n=document.createElement(`textarea`),n.textContent=o??i,this.data.doNotScroll&&(n.style.overflowY=`hidden`)):(n=document.createElement(`input`),n.type=`text`,n.setAttribute(`value`,o??i),this.data.doNotScroll&&(n.style.overflowX=`hidden`)),this.data.hasOwnCanvas&&(n.hidden=!0),d.add(n),n.setAttribute(`data-element-id`,t),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=l,this._setRequired(n,this.data.required),a&&(n.maxLength=a),n.addEventListener(`input`,r=>{e.setValue(t,{value:r.target.value}),this.setPropertyOnSiblings(n,`value`,r.target.value,`value`),s.formattedValue=null}),n.addEventListener(`resetform`,e=>{let t=this.data.defaultFieldValue??``;n.value=s.userValue=t,s.formattedValue=null});let c=e=>{let{formattedValue:t}=s;t!=null&&(e.target.value=t),e.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener(`focus`,e=>{if(s.focused)return;let{target:t}=e;s.userValue&&(t.value=s.userValue),s.lastCommittedValue=t.value,s.commitKey=1,s.focused=!0}),n.addEventListener(`updatefromsandbox`,n=>{this.showElementAndHideCanvas(n.target),this._dispatchEventFromSandbox({value(n){s.userValue=n.detail.value??``,e.setValue(t,{value:s.userValue.toString()}),n.target.value=s.userValue},formattedValue(n){let{formattedValue:r}=n.detail;s.formattedValue=r,r!=null&&n.target!==document.activeElement&&(n.target.value=r),e.setValue(t,{formattedValue:r})},selRange(e){e.target.setSelectionRange(...e.detail.selRange)},charLimit:n=>{let{charLimit:r}=n.detail,{target:i}=n;if(r===0){i.removeAttribute(`maxLength`);return}i.setAttribute(`maxLength`,r);let a=s.userValue;!a||a.length<=r||(a=a.slice(0,r),i.value=s.userValue=a,e.setValue(t,{value:a}),this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:a,willCommit:!0,commitKey:1,selStart:i.selectionStart,selEnd:i.selectionEnd}}))}},n)}),n.addEventListener(`keydown`,e=>{s.commitKey=1;let n=-1;if(e.key===`Escape`?n=0:e.key===`Enter`&&!this.data.multiLine?n=2:e.key===`Tab`&&(s.commitKey=3),n===-1)return;let{value:r}=e.target;s.lastCommittedValue!==r&&(s.lastCommittedValue=r,s.userValue=r,this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:r,willCommit:!0,commitKey:n,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}))});let r=c;c=null,n.addEventListener(`blur`,e=>{if(!s.focused||!e.relatedTarget)return;s.focused=!1;let{value:n}=e.target;s.userValue=n,s.lastCommittedValue!==n&&this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:n,willCommit:!0,commitKey:s.commitKey,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}),r(e)}),this.data.actions?.Keystroke&&n.addEventListener(`beforeinput`,e=>{s.lastCommittedValue=null;let{data:n,target:r}=e,{value:i,selectionStart:a,selectionEnd:o}=r,c=a,l=o;switch(e.inputType){case`deleteWordBackward`:{let e=i.substring(0,a).match(/\w*[^\w]*$/);e&&(c-=e[0].length);break}case`deleteWordForward`:{let e=i.substring(a).match(/^[^\w]*\w*/);e&&(l+=e[0].length);break}case`deleteContentBackward`:a===o&&--c;break;case`deleteContentForward`:a===o&&(l+=1)}e.preventDefault(),this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:i,change:n||``,willCommit:!1,selStart:c,selEnd:l}})}),this._setEventListeners(n,s,[[`focus`,`Focus`],[`blur`,`Blur`],[`mousedown`,`Mouse Down`],[`mouseenter`,`Mouse Enter`],[`mouseleave`,`Mouse Exit`],[`mouseup`,`Mouse Up`]],e=>e.target.value)}if(c&&n.addEventListener(`blur`,c),this.data.comb){let e=(this.data.rect[2]-this.data.rect[0])/a;n.classList.add(`comb`),n.style.letterSpacing=`calc(${e}px * var(--scale-factor) - 1ch)`}}else n=document.createElement(`div`),n.textContent=this.data.fieldValue,n.style.verticalAlign=`middle`,n.style.display=`table-cell`;return this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class y extends _{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class b extends _{constructor(e){super(e,{isRenderable:e.renderForms})}render(){let e=this.annotationStorage,t=this.data,n=t.id,r=e.getValue(n,{value:t.exportValue===t.fieldValue}).value;typeof r==`string`&&(r=r!==`Off`,e.setValue(n,{value:r})),this.container.classList.add(`buttonWidgetAnnotation`,`checkBox`);let i=document.createElement(`input`);return d.add(i),i.setAttribute(`data-element-id`,n),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type=`checkbox`,i.name=t.fieldName,r&&i.setAttribute(`checked`,!0),i.setAttribute(`exportValue`,t.exportValue),i.tabIndex=l,i.addEventListener(`change`,r=>{let{name:i,checked:a}=r.target;for(let r of this._getElementsByName(i,n)){let n=a&&r.exportValue===t.exportValue;r.domElement&&(r.domElement.checked=n),e.setValue(r.id,{value:n})}e.setValue(n,{value:a})}),i.addEventListener(`resetform`,e=>{let n=t.defaultFieldValue||`Off`;e.target.checked=n===t.exportValue}),this.enableScripting&&this.hasJSActions&&(i.addEventListener(`updatefromsandbox`,t=>{this._dispatchEventFromSandbox({value(t){t.target.checked=t.detail.value!==`Off`,e.setValue(n,{value:t.target.checked})}},t)}),this._setEventListeners(i,null,[[`change`,`Validate`],[`change`,`Action`],[`focus`,`Focus`],[`blur`,`Blur`],[`mousedown`,`Mouse Down`],[`mouseenter`,`Mouse Enter`],[`mouseleave`,`Mouse Exit`],[`mouseup`,`Mouse Up`]],e=>e.target.checked)),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class x extends _{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add(`buttonWidgetAnnotation`,`radioButton`);let e=this.annotationStorage,t=this.data,n=t.id,r=e.getValue(n,{value:t.fieldValue===t.buttonValue}).value;typeof r==`string`&&(r=r!==t.buttonValue,e.setValue(n,{value:r}));let i=document.createElement(`input`);if(d.add(i),i.setAttribute(`data-element-id`,n),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type=`radio`,i.name=t.fieldName,r&&i.setAttribute(`checked`,!0),i.tabIndex=l,i.addEventListener(`change`,t=>{let{name:r,checked:i}=t.target;for(let t of this._getElementsByName(r,n))e.setValue(t.id,{value:!1});e.setValue(n,{value:i})}),i.addEventListener(`resetform`,e=>{let n=t.defaultFieldValue;e.target.checked=n!=null&&n===t.buttonValue}),this.enableScripting&&this.hasJSActions){let r=t.buttonValue;i.addEventListener(`updatefromsandbox`,t=>{this._dispatchEventFromSandbox({value:t=>{let i=r===t.detail.value;for(let r of this._getElementsByName(t.target.name)){let t=i&&r.id===n;r.domElement&&(r.domElement.checked=t),e.setValue(r.id,{value:t})}}},t)}),this._setEventListeners(i,null,[[`change`,`Validate`],[`change`,`Action`],[`focus`,`Focus`],[`blur`,`Blur`],[`mousedown`,`Mouse Down`],[`mouseenter`,`Mouse Enter`],[`mouseleave`,`Mouse Exit`],[`mouseup`,`Mouse Up`]],e=>e.target.checked)}return this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class S extends h{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){let e=super.render();e.classList.add(`buttonWidgetAnnotation`,`pushButton`),this.data.alternativeText&&(e.title=this.data.alternativeText);let t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener(`updatefromsandbox`,e=>{this._dispatchEventFromSandbox({},e)})),e}}class C extends _{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add(`choiceWidgetAnnotation`);let e=this.annotationStorage,t=this.data.id,n=e.getValue(t,{value:this.data.fieldValue}),r=document.createElement(`select`);d.add(r),r.setAttribute(`data-element-id`,t),r.disabled=this.data.readOnly,this._setRequired(r,this.data.required),r.name=this.data.fieldName,r.tabIndex=l;let i=this.data.combo&&this.data.options.length>0;this.data.combo||(r.size=this.data.options.length,this.data.multiSelect&&(r.multiple=!0)),r.addEventListener(`resetform`,e=>{let t=this.data.defaultFieldValue;for(let e of r.options)e.selected=e.value===t});for(let e of this.data.options){let t=document.createElement(`option`);t.textContent=e.displayValue,t.value=e.exportValue,n.value.includes(e.exportValue)&&(t.setAttribute(`selected`,!0),i=!1),r.append(t)}let a=null;if(i){let e=document.createElement(`option`);e.value=` `,e.setAttribute(`hidden`,!0),e.setAttribute(`selected`,!0),r.prepend(e),a=()=>{e.remove(),r.removeEventListener(`input`,a),a=null},r.addEventListener(`input`,a)}let o=e=>{let t=e?`value`:`textContent`,{options:n,multiple:i}=r;return i?Array.prototype.filter.call(n,e=>e.selected).map(e=>e[t]):n.selectedIndex===-1?null:n[n.selectedIndex][t]},s=o(!1),c=e=>{let t=e.target.options;return Array.prototype.map.call(t,e=>({displayValue:e.textContent,exportValue:e.value}))};return this.enableScripting&&this.hasJSActions?(r.addEventListener(`updatefromsandbox`,n=>{this._dispatchEventFromSandbox({value(n){a?.();let i=n.detail.value,c=new Set(Array.isArray(i)?i:[i]);for(let e of r.options)e.selected=c.has(e.value);e.setValue(t,{value:o(!0)}),s=o(!1)},multipleSelection(e){r.multiple=!0},remove(n){let i=r.options,a=n.detail.remove;i[a].selected=!1,r.remove(a),i.length>0&&Array.prototype.findIndex.call(i,e=>e.selected)===-1&&(i[0].selected=!0),e.setValue(t,{value:o(!0),items:c(n)}),s=o(!1)},clear(n){for(;r.length!==0;)r.remove(0);e.setValue(t,{value:null,items:[]}),s=o(!1)},insert(n){let{index:i,displayValue:a,exportValue:l}=n.detail.insert,u=r.children[i],d=document.createElement(`option`);d.textContent=a,d.value=l,u?u.before(d):r.append(d),e.setValue(t,{value:o(!0),items:c(n)}),s=o(!1)},items(n){let{items:i}=n.detail;for(;r.length!==0;)r.remove(0);for(let e of i){let{displayValue:t,exportValue:n}=e,i=document.createElement(`option`);i.textContent=t,i.value=n,r.append(i)}r.options.length>0&&(r.options[0].selected=!0),e.setValue(t,{value:o(!0),items:c(n)}),s=o(!1)},indices(n){let r=new Set(n.detail.indices);for(let e of n.target.options)e.selected=r.has(e.index);e.setValue(t,{value:o(!0)}),s=o(!1)},editable(e){e.target.disabled=!e.detail.editable}},n)}),r.addEventListener(`input`,n=>{let r=o(!0);e.setValue(t,{value:r}),n.preventDefault(),this.linkService.eventBus?.dispatch(`dispatcheventinsandbox`,{source:this,detail:{id:t,name:`Keystroke`,value:s,changeEx:r,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(r,null,[[`focus`,`Focus`],[`blur`,`Blur`],[`mousedown`,`Mouse Down`],[`mouseenter`,`Mouse Enter`],[`mouseleave`,`Mouse Exit`],[`mouseup`,`Mouse Up`],[`input`,`Action`],[`input`,`Validate`]],e=>e.target.value)):r.addEventListener(`input`,function(n){e.setValue(t,{value:o(!0)})}),this.data.combo&&this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class w extends m{constructor(e){let{data:t,elements:n}=e;super(e,{isRenderable:m._hasPopupData(t)}),this.elements=n}render(){this.container.classList.add(`popupAnnotation`);let e=new T({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),t=[];for(let n of this.elements)n.popup=e,t.push(n.data.id),n.addHighlightArea();return this.container.setAttribute(`aria-controls`,t.map(e=>`${r.AnnotationPrefix}${e}`).join(`,`)),this.container}}class T{#e=null;#t=this.#_.bind(this);#n=this.#b.bind(this);#r=this.#y.bind(this);#i=this.#v.bind(this);#a=null;#o=null;#s=null;#c=null;#l=null;#u=null;#d=!1;#f=null;#p=null;#m=null;#h=null;#g=!1;constructor({container:e,color:t,elements:n,titleObj:r,modificationDate:a,contentsObj:o,richText:s,parent:c,rect:l,parentRect:u,open:d}){this.#o=e,this.#h=r,this.#s=o,this.#m=s,this.#l=c,this.#a=t,this.#p=l,this.#u=u,this.#c=n;let f=i.PDFDateString.toDateObject(a);f&&(this.#e=c.l10n.get(`annotation_date_string`,{date:f.toLocaleDateString(),time:f.toLocaleTimeString()})),this.trigger=n.flatMap(e=>e.getElementsToTriggerPopup());for(let e of this.trigger)e.addEventListener(`click`,this.#i),e.addEventListener(`mouseenter`,this.#r),e.addEventListener(`mouseleave`,this.#n),e.classList.add(`popupTriggerArea`);for(let e of n)e.container?.addEventListener(`keydown`,this.#t);this.#o.hidden=!0,d&&this.#v()}render(){if(this.#f)return;let{page:{view:e},viewport:{rawDims:{pageWidth:t,pageHeight:n,pageX:i,pageY:a}}}=this.#l,o=this.#f=document.createElement(`div`);if(o.className=`popup`,this.#a){let e=o.style.outlineColor=r.Util.makeHexColor(...this.#a);if(CSS.supports(`background-color`,`color-mix(in srgb, red 30%, white)`))o.style.backgroundColor=`color-mix(in srgb, ${e} 30%, white)`;else{let e=.7;o.style.backgroundColor=r.Util.makeHexColor(...this.#a.map(e=>Math.floor(.7*(255-e)+e)))}}let s=document.createElement(`span`);s.className=`header`;let l=document.createElement(`h1`);if(s.append(l),{dir:l.dir,str:l.textContent}=this.#h,o.append(s),this.#e){let e=document.createElement(`span`);e.classList.add(`popupDate`),this.#e.then(t=>{e.textContent=t}),s.append(e)}let u=this.#s,d=this.#m;if(d?.str&&(!u?.str||u.str===d.str))c.XfaLayer.render({xfaHtml:d.html,intent:`richText`,div:o}),o.lastChild.classList.add(`richText`,`popupContent`);else{let e=this._formatContents(u);o.append(e)}let f=!!this.#u,p=f?this.#u:this.#p;for(let e of this.#c)if(!p||r.Util.intersect(e.data.rect,p)!==null){p=e.data.rect,f=!0;break}let m=r.Util.normalizeRect([p[0],e[3]-p[1]+e[1],p[2],e[3]-p[3]+e[1]]),h=f?p[2]-p[0]+5:0,g=m[0]+h,_=m[1],{style:v}=this.#o;v.left=`${100*(g-i)/t}%`,v.top=`${100*(_-a)/n}%`,this.#o.append(o)}_formatContents({str:e,dir:t}){let n=document.createElement(`p`);n.classList.add(`popupContent`),n.dir=t;let r=e.split(/(?:\r\n?|\n)/);for(let e=0,t=r.length;e<t;++e){let i=r[e];n.append(document.createTextNode(i)),e<t-1&&n.append(document.createElement(`br`))}return n}#_(e){e.altKey||e.shiftKey||e.ctrlKey||e.metaKey||(e.key===`Enter`||e.key===`Escape`&&this.#d)&&this.#v()}#v(){this.#d=!this.#d,this.#d?(this.#y(),this.#o.addEventListener(`click`,this.#i),this.#o.addEventListener(`keydown`,this.#t)):(this.#b(),this.#o.removeEventListener(`click`,this.#i),this.#o.removeEventListener(`keydown`,this.#t))}#y(){this.#f||this.render(),this.isVisible?this.#d&&this.#o.classList.add(`focused`):(this.#o.hidden=!1,this.#o.style.zIndex=parseInt(this.#o.style.zIndex)+1e3)}#b(){this.#o.classList.remove(`focused`),!(this.#d||!this.isVisible)&&(this.#o.hidden=!0,this.#o.style.zIndex=parseInt(this.#o.style.zIndex)-1e3)}forceHide(){this.#g=this.isVisible,this.#g&&(this.#o.hidden=!0)}maybeShow(){this.#g&&(this.#g=!1,this.#o.hidden=!1)}get isVisible(){return this.#o.hidden===!1}}class E extends m{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.textContent=e.data.textContent,this.textPosition=e.data.textPosition,this.annotationEditorType=r.AnnotationEditorType.FREETEXT}render(){if(this.container.classList.add(`freeTextAnnotation`),this.textContent){let e=document.createElement(`div`);e.classList.add(`annotationTextContent`),e.setAttribute(`role`,`comment`);for(let t of this.textContent){let n=document.createElement(`span`);n.textContent=t,e.append(n)}this.container.append(e)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}t.FreeTextAnnotationElement=E;class D extends m{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add(`lineAnnotation`);let e=this.data,{width:t,height:n}=f(e.rect),r=this.svgFactory.create(t,n,!0),i=this.#e=this.svgFactory.createElement(`svg:line`);return i.setAttribute(`x1`,e.rect[2]-e.lineCoordinates[0]),i.setAttribute(`y1`,e.rect[3]-e.lineCoordinates[1]),i.setAttribute(`x2`,e.rect[2]-e.lineCoordinates[2]),i.setAttribute(`y2`,e.rect[3]-e.lineCoordinates[3]),i.setAttribute(`stroke-width`,e.borderStyle.width||1),i.setAttribute(`stroke`,`transparent`),i.setAttribute(`fill`,`transparent`),r.append(i),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}}class O extends m{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add(`squareAnnotation`);let e=this.data,{width:t,height:n}=f(e.rect),r=this.svgFactory.create(t,n,!0),i=e.borderStyle.width,a=this.#e=this.svgFactory.createElement(`svg:rect`);return a.setAttribute(`x`,i/2),a.setAttribute(`y`,i/2),a.setAttribute(`width`,t-i),a.setAttribute(`height`,n-i),a.setAttribute(`stroke-width`,i||1),a.setAttribute(`stroke`,`transparent`),a.setAttribute(`fill`,`transparent`),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}}class k extends m{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add(`circleAnnotation`);let e=this.data,{width:t,height:n}=f(e.rect),r=this.svgFactory.create(t,n,!0),i=e.borderStyle.width,a=this.#e=this.svgFactory.createElement(`svg:ellipse`);return a.setAttribute(`cx`,t/2),a.setAttribute(`cy`,n/2),a.setAttribute(`rx`,t/2-i/2),a.setAttribute(`ry`,n/2-i/2),a.setAttribute(`stroke-width`,i||1),a.setAttribute(`stroke`,`transparent`),a.setAttribute(`fill`,`transparent`),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}}class A extends m{#e=null;constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName=`polylineAnnotation`,this.svgElementName=`svg:polyline`}render(){this.container.classList.add(this.containerClassName);let e=this.data,{width:t,height:n}=f(e.rect),r=this.svgFactory.create(t,n,!0),i=[];for(let t of e.vertices){let n=t.x-e.rect[0],r=e.rect[3]-t.y;i.push(n+`,`+r)}i=i.join(` `);let a=this.#e=this.svgFactory.createElement(this.svgElementName);return a.setAttribute(`points`,i),a.setAttribute(`stroke-width`,e.borderStyle.width||1),a.setAttribute(`stroke`,`transparent`),a.setAttribute(`fill`,`transparent`),r.append(a),this.container.append(r),!e.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}}class j extends A{constructor(e){super(e),this.containerClassName=`polygonAnnotation`,this.svgElementName=`svg:polygon`}}class M extends m{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add(`caretAnnotation`),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class N extends m{#e=[];constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName=`inkAnnotation`,this.svgElementName=`svg:polyline`,this.annotationEditorType=r.AnnotationEditorType.INK}render(){this.container.classList.add(this.containerClassName);let e=this.data,{width:t,height:n}=f(e.rect),r=this.svgFactory.create(t,n,!0);for(let t of e.inkLists){let n=[];for(let r of t){let t=r.x-e.rect[0],i=e.rect[3]-r.y;n.push(`${t},${i}`)}n=n.join(` `);let i=this.svgFactory.createElement(this.svgElementName);this.#e.push(i),i.setAttribute(`points`,n),i.setAttribute(`stroke-width`,e.borderStyle.width||1),i.setAttribute(`stroke`,`transparent`),i.setAttribute(`fill`,`transparent`),!e.popupRef&&this.hasPopupData&&this._createPopup(),r.append(i)}return this.container.append(r),this.container}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}}t.InkAnnotationElement=N;class P extends m{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add(`highlightAnnotation`),this.container}}class F extends m{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add(`underlineAnnotation`),this.container}}class I extends m{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add(`squigglyAnnotation`),this.container}}class L extends m{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add(`strikeoutAnnotation`),this.container}}class R extends m{constructor(e){super(e,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add(`stampAnnotation`),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}t.StampAnnotationElement=R;class z extends m{#e=null;constructor(e){super(e,{isRenderable:!0});let{filename:t,content:n}=this.data.file;this.filename=(0,i.getFilenameFromUrl)(t,!0),this.content=n,this.linkService.eventBus?.dispatch(`fileattachmentannotation`,{source:this,filename:t,content:n})}render(){this.container.classList.add(`fileAttachmentAnnotation`);let{container:e,data:t}=this,n;t.hasAppearance||t.fillAlpha===0?n=document.createElement(`div`):(n=document.createElement(`img`),n.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(t.name)?`paperclip`:`pushpin`}.svg`,t.fillAlpha&&t.fillAlpha<1&&(n.style=`filter: opacity(${Math.round(t.fillAlpha*100)}%);`)),n.addEventListener(`dblclick`,this.#t.bind(this)),this.#e=n;let{isMac:i}=r.FeatureTest.platform;return e.addEventListener(`keydown`,e=>{e.key===`Enter`&&(i?e.metaKey:e.ctrlKey)&&this.#t()}),!t.popupRef&&this.hasPopupData?this._createPopup():n.classList.add(`popupTriggerArea`),e.append(n),e}getElementsToTriggerPopup(){return this.#e}addHighlightArea(){this.container.classList.add(`highlightArea`)}#t(){this.downloadManager?.openOrDownloadData(this.container,this.content,this.filename)}}class B{#e=null;#t=null;#n=new Map;constructor({div:e,accessibilityManager:t,annotationCanvasMap:n,l10n:r,page:i,viewport:a}){this.div=e,this.#e=t,this.#t=n,this.l10n=r,this.page=i,this.viewport=a,this.zIndex=0,this.l10n||=s.NullL10n}#r(e,t){let n=e.firstChild||e;n.id=`${r.AnnotationPrefix}${t}`,this.div.append(e),this.#e?.moveElementInDOM(this.div,e,n,!1)}async render(e){let{annotations:t}=e,n=this.div;(0,i.setLayerDimensions)(n,this.viewport);let o=new Map,s={data:null,layer:n,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||``,renderForms:e.renderForms!==!1,svgFactory:new i.DOMSVGFactory,annotationStorage:e.annotationStorage||new a.AnnotationStorage,enableScripting:e.enableScripting===!0,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,parent:this,elements:null};for(let e of t){if(e.noHTML)continue;let t=e.annotationType===r.AnnotationType.POPUP;if(t){let t=o.get(e.id);if(!t)continue;s.elements=t}else{let{width:t,height:n}=f(e.rect);if(t<=0||n<=0)continue}s.data=e;let n=p.create(s);if(!n.isRenderable)continue;if(!t&&e.popupRef){let t=o.get(e.popupRef);t?t.push(n):o.set(e.popupRef,[n])}n.annotationEditorType>0&&this.#n.set(n.data.id,n);let i=n.render();e.hidden&&(i.style.visibility=`hidden`),this.#r(i,e.id)}this.#i(),await this.l10n.translate(n)}update({viewport:e}){let t=this.div;this.viewport=e,(0,i.setLayerDimensions)(t,{rotation:e.rotation}),this.#i(),t.hidden=!1}#i(){if(!this.#t)return;let e=this.div;for(let[t,n]of this.#t){let r=e.querySelector(`[data-annotation-id="${t}"]`);if(!r)continue;let{firstChild:i}=r;i?i.nodeName===`CANVAS`?i.replaceWith(n):i.before(n):r.append(n)}this.#t.clear()}getEditableAnnotations(){return Array.from(this.#n.values())}getEditableAnnotation(e){return this.#n.get(e)}}t.AnnotationLayer=B}),((e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ColorConverters=void 0;function n(e){return Math.floor(Math.max(0,Math.min(1,e))*255).toString(16).padStart(2,`0`)}function r(e){return Math.max(0,Math.min(255,255*e))}class i{static CMYK_G([e,t,n,r]){return[`G`,1-Math.min(1,.3*e+.59*n+.11*t+r)]}static G_CMYK([e]){return[`CMYK`,0,0,0,1-e]}static G_RGB([e]){return[`RGB`,e,e,e]}static G_rgb([e]){return e=r(e),[e,e,e]}static G_HTML([e]){let t=n(e);return`#${t}${t}${t}`}static RGB_G([e,t,n]){return[`G`,.3*e+.59*t+.11*n]}static RGB_rgb(e){return e.map(r)}static RGB_HTML(e){return`#${e.map(n).join(``)}`}static T_HTML(){return`#00000000`}static T_rgb(){return[null]}static CMYK_RGB([e,t,n,r]){return[`RGB`,1-Math.min(1,e+r),1-Math.min(1,n+r),1-Math.min(1,t+r)]}static CMYK_rgb([e,t,n,i]){return[r(1-Math.min(1,e+i)),r(1-Math.min(1,n+i)),r(1-Math.min(1,t+i))]}static CMYK_HTML(e){let t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,n]){let r=1-e,i=1-t,a=1-n;return[`CMYK`,r,i,a,Math.min(r,i,a)]}}t.ColorConverters=i}),((e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NullL10n=void 0,t.getL10nFallback=r;let n={of_pages:`of {{pagesCount}}`,page_of_pages:`({{pageNumber}} of {{pagesCount}})`,document_properties_kb:`{{size_kb}} KB ({{size_b}} bytes)`,document_properties_mb:`{{size_mb}} MB ({{size_b}} bytes)`,document_properties_date_string:`{{date}}, {{time}}`,document_properties_page_size_unit_inches:`in`,document_properties_page_size_unit_millimeters:`mm`,document_properties_page_size_orientation_portrait:`portrait`,document_properties_page_size_orientation_landscape:`landscape`,document_properties_page_size_name_a3:`A3`,document_properties_page_size_name_a4:`A4`,document_properties_page_size_name_letter:`Letter`,document_properties_page_size_name_legal:`Legal`,document_properties_page_size_dimension_string:`{{width}} × {{height}} {{unit}} ({{orientation}})`,document_properties_page_size_dimension_name_string:`{{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})`,document_properties_linearized_yes:`Yes`,document_properties_linearized_no:`No`,additional_layers:`Additional Layers`,page_landmark:`Page {{page}}`,thumb_page_title:`Page {{page}}`,thumb_page_canvas:`Thumbnail of Page {{page}}`,find_reached_top:`Reached top of document, continued from bottom`,find_reached_bottom:`Reached end of document, continued from top`,"find_match_count[one]":`{{current}} of {{total}} match`,"find_match_count[other]":`{{current}} of {{total}} matches`,"find_match_count_limit[one]":`More than {{limit}} match`,"find_match_count_limit[other]":`More than {{limit}} matches`,find_not_found:`Phrase not found`,page_scale_width:`Page Width`,page_scale_fit:`Page Fit`,page_scale_auto:`Automatic Zoom`,page_scale_actual:`Actual Size`,page_scale_percent:`{{scale}}%`,loading_error:`An error occurred while loading the PDF.`,invalid_file_error:`Invalid or corrupted PDF file.`,missing_file_error:`Missing PDF file.`,unexpected_response_error:`Unexpected server response.`,rendering_error:`An error occurred while rendering the page.`,annotation_date_string:`{{date}}, {{time}}`,printing_not_supported:`Warning: Printing is not fully supported by this browser.`,printing_not_ready:`Warning: The PDF is not fully loaded for printing.`,web_fonts_disabled:`Web fonts are disabled: unable to use embedded PDF fonts.`,free_text2_default_content:`Start typing…`,editor_free_text2_aria_label:`Text Editor`,editor_ink2_aria_label:`Draw Editor`,editor_ink_canvas_aria_label:`User-created image`,editor_alt_text_button_label:`Alt text`,editor_alt_text_edit_button_label:`Edit alt text`,editor_alt_text_decorative_tooltip:`Marked as decorative`};n.print_progress_percent=`{{progress}}%`;function r(e,t){switch(e){case`find_match_count`:e=`find_match_count[${t.total===1?`one`:`other`}]`;break;case`find_match_count_limit`:e=`find_match_count_limit[${t.limit===1?`one`:`other`}]`}return n[e]||``}function i(e,t){return t?e.replaceAll(/\{\{\s*(\w+)\s*\}\}/g,(e,n)=>n in t?t[n]:`{{`+n+`}}`):e}t.NullL10n={async getLanguage(){return`en-us`},async getDirection(){return`ltr`},async get(e,t=null,n=r(e,t)){return i(n,t)},async translate(e){}}}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.XfaLayer=void 0;var r=n(25);class i{static setupStorage(e,t,n,r,i){let a=r.getValue(t,{value:null});switch(n.name){case`textarea`:if(a.value!==null&&(e.textContent=a.value),i===`print`)break;e.addEventListener(`input`,e=>{r.setValue(t,{value:e.target.value})});break;case`input`:if(n.attributes.type===`radio`||n.attributes.type===`checkbox`){if(a.value===n.attributes.xfaOn?e.setAttribute(`checked`,!0):a.value===n.attributes.xfaOff&&e.removeAttribute(`checked`),i===`print`)break;e.addEventListener(`change`,e=>{r.setValue(t,{value:e.target.checked?e.target.getAttribute(`xfaOn`):e.target.getAttribute(`xfaOff`)})})}else{if(a.value!==null&&e.setAttribute(`value`,a.value),i===`print`)break;e.addEventListener(`input`,e=>{r.setValue(t,{value:e.target.value})})}break;case`select`:if(a.value!==null){e.setAttribute(`value`,a.value);for(let e of n.children)e.attributes.value===a.value?e.attributes.selected=!0:e.attributes.hasOwnProperty(`selected`)&&delete e.attributes.selected}e.addEventListener(`input`,e=>{let n=e.target.options,i=n.selectedIndex===-1?``:n[n.selectedIndex].value;r.setValue(t,{value:i})})}}static setAttributes({html:e,element:t,storage:n=null,intent:r,linkService:i}){let{attributes:a}=t,o=e instanceof HTMLAnchorElement;a.type===`radio`&&(a.name=`${a.name}-${r}`);for(let[t,n]of Object.entries(a))if(n!=null)switch(t){case`class`:n.length&&e.setAttribute(t,n.join(` `));break;case`dataId`:break;case`id`:e.setAttribute(`data-element-id`,n);break;case`style`:Object.assign(e.style,n);break;case`textContent`:e.textContent=n;break;default:(!o||t!==`href`&&t!==`newWindow`)&&e.setAttribute(t,n)}o&&i.addLinkAttributes(e,a.href,a.newWindow),n&&a.dataId&&this.setupStorage(e,a.dataId,t,n)}static render(e){let t=e.annotationStorage,n=e.linkService,i=e.xfaHtml,a=e.intent||`display`,o=document.createElement(i.name);i.attributes&&this.setAttributes({html:o,element:i,intent:a,linkService:n});let s=[[i,-1,o]],c=e.div;if(c.append(o),e.viewport){let t=`matrix(${e.viewport.transform.join(`,`)})`;c.style.transform=t}a!==`richText`&&c.setAttribute(`class`,`xfaLayer xfaFont`);let l=[];for(;s.length>0;){let[e,i,o]=s.at(-1);if(i+1===e.children.length){s.pop();continue}let c=e.children[++s.at(-1)[1]];if(c===null)continue;let{name:u}=c;if(u===`#text`){let e=document.createTextNode(c.value);l.push(e),o.append(e);continue}let d=c?.attributes?.xmlns?document.createElementNS(c.attributes.xmlns,u):document.createElement(u);if(o.append(d),c.attributes&&this.setAttributes({html:d,element:c,storage:t,intent:a,linkService:n}),c.children&&c.children.length>0)s.push([c,-1,d]);else if(c.value){let e=document.createTextNode(c.value);r.XfaText.shouldBuildText(u)&&l.push(e),d.append(e)}}for(let e of c.querySelectorAll(`.xfaNonInteractive input, .xfaNonInteractive textarea`))e.setAttribute(`readOnly`,!0);return{textDivs:l}}static update(e){let t=`matrix(${e.viewport.transform.join(`,`)})`;e.div.style.transform=t,e.div.hidden=!1}}t.XfaLayer=i}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InkEditor=void 0;var r=n(1),i=n(4),a=n(29),o=n(6),s=n(5);class c extends i.AnnotationEditor{#e=0;#t=0;#n=this.canvasPointermove.bind(this);#r=this.canvasPointerleave.bind(this);#i=this.canvasPointerup.bind(this);#a=this.canvasPointerdown.bind(this);#o=new Path2D;#s=!1;#c=!1;#l=!1;#u=null;#d=0;#f=0;#p=null;static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=1;static _type=`ink`;constructor(e){super({...e,name:`inkEditor`}),this.color=e.color||null,this.thickness=e.thickness||null,this.opacity=e.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(e){i.AnnotationEditor.initialize(e,{strings:[`editor_ink_canvas_aria_label`,`editor_ink2_aria_label`]})}static updateDefaultParams(e,t){switch(e){case r.AnnotationEditorParamsType.INK_THICKNESS:c._defaultThickness=t;break;case r.AnnotationEditorParamsType.INK_COLOR:c._defaultColor=t;break;case r.AnnotationEditorParamsType.INK_OPACITY:c._defaultOpacity=t/100}}updateParams(e,t){switch(e){case r.AnnotationEditorParamsType.INK_THICKNESS:this.#m(t);break;case r.AnnotationEditorParamsType.INK_COLOR:this.#h(t);break;case r.AnnotationEditorParamsType.INK_OPACITY:this.#g(t)}}static get defaultPropertiesToUpdate(){return[[r.AnnotationEditorParamsType.INK_THICKNESS,c._defaultThickness],[r.AnnotationEditorParamsType.INK_COLOR,c._defaultColor||i.AnnotationEditor._defaultLineColor],[r.AnnotationEditorParamsType.INK_OPACITY,Math.round(c._defaultOpacity*100)]]}get propertiesToUpdate(){return[[r.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||c._defaultThickness],[r.AnnotationEditorParamsType.INK_COLOR,this.color||c._defaultColor||i.AnnotationEditor._defaultLineColor],[r.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??c._defaultOpacity))]]}#m(e){let t=this.thickness;this.addCommands({cmd:()=>{this.thickness=e,this.#z()},undo:()=>{this.thickness=t,this.#z()},mustExec:!0,type:r.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#h(e){let t=this.color;this.addCommands({cmd:()=>{this.color=e,this.#E()},undo:()=>{this.color=t,this.#E()},mustExec:!0,type:r.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#g(e){e/=100;let t=this.opacity;this.addCommands({cmd:()=>{this.opacity=e,this.#E()},undo:()=>{this.opacity=t,this.#E()},mustExec:!0,type:r.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(this.#O(),this.#k()),this.isAttachedToDOM||(this.parent.add(this),this.#A()),this.#z()))}remove(){this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.#u.disconnect(),this.#u=null,super.remove())}setParent(e){!this.parent&&e?this._uiManager.removeShouldRescale(this):this.parent&&e===null&&this._uiManager.addShouldRescale(this),super.setParent(e)}onScaleChanging(){let[e,t]=this.parentDimensions,n=this.width*e,r=this.height*t;this.setDimensions(n,r)}enableEditMode(){this.#s||this.canvas===null||(super.enableEditMode(),this._isDraggable=!1,this.canvas.addEventListener(`pointerdown`,this.#a))}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove(`editing`),this.canvas.removeEventListener(`pointerdown`,this.#a))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}#_(){let{parentRotation:e,parentDimensions:[t,n]}=this;switch(e){case 90:return[0,n,n,t];case 180:return[t,n,t,n];case 270:return[t,0,n,t];default:return[0,0,t,n]}}#v(){let{ctx:e,color:t,opacity:n,thickness:r,parentScale:i,scaleFactor:a}=this;e.lineWidth=r*i/a,e.lineCap=`round`,e.lineJoin=`round`,e.miterLimit=10,e.strokeStyle=`${t}${(0,s.opacityToHex)(n)}`}#y(e,t){this.canvas.addEventListener(`contextmenu`,o.noContextMenu),this.canvas.addEventListener(`pointerleave`,this.#r),this.canvas.addEventListener(`pointermove`,this.#n),this.canvas.addEventListener(`pointerup`,this.#i),this.canvas.removeEventListener(`pointerdown`,this.#a),this.isEditing=!0,this.#l||(this.#l=!0,this.#A(),this.thickness||=c._defaultThickness,this.color||=c._defaultColor||i.AnnotationEditor._defaultLineColor,this.opacity??=c._defaultOpacity),this.currentPath.push([e,t]),this.#c=!1,this.#v(),this.#p=()=>{this.#C(),this.#p&&window.requestAnimationFrame(this.#p)},window.requestAnimationFrame(this.#p)}#b(e,t){let[n,r]=this.currentPath.at(-1);if(this.currentPath.length>1&&e===n&&t===r)return;let i=this.currentPath,a=this.#o;if(i.push([e,t]),this.#c=!0,i.length<=2){a.moveTo(...i[0]),a.lineTo(e,t);return}i.length===3&&(this.#o=a=new Path2D,a.moveTo(...i[0])),this.#w(a,...i.at(-3),...i.at(-2),e,t)}#x(){if(this.currentPath.length===0)return;let e=this.currentPath.at(-1);this.#o.lineTo(...e)}#S(e,t){this.#p=null,e=Math.min(Math.max(e,0),this.canvas.width),t=Math.min(Math.max(t,0),this.canvas.height),this.#b(e,t),this.#x();let n;if(this.currentPath.length!==1)n=this.#T();else{let r=[e,t];n=[[r,r.slice(),r.slice(),r]]}let r=this.#o,i=this.currentPath;this.currentPath=[],this.#o=new Path2D,this.addCommands({cmd:()=>{this.allRawPaths.push(i),this.paths.push(n),this.bezierPath2D.push(r),this.rebuild()},undo:()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(this.#O(),this.#k()),this.#z())},mustExec:!0})}#C(){if(!this.#c)return;this.#c=!1;let e=Math.ceil(this.thickness*this.parentScale),t=this.currentPath.slice(-3),n=t.map(e=>e[0]),r=t.map(e=>e[1]),i=Math.min(...n)-e,a=Math.max(...n)+e,o=Math.min(...r)-e,s=Math.max(...r)+e,{ctx:c}=this;c.save(),c.clearRect(0,0,this.canvas.width,this.canvas.height);for(let e of this.bezierPath2D)c.stroke(e);c.stroke(this.#o),c.restore()}#w(e,t,n,r,i,a,o){let s=(t+r)/2,c=(n+i)/2,l=(r+a)/2,u=(i+o)/2;e.bezierCurveTo(s+2*(r-s)/3,c+2*(i-c)/3,l+2*(r-l)/3,u+2*(i-u)/3,l,u)}#T(){let e=this.currentPath;if(e.length<=2)return[[e[0],e[0],e.at(-1),e.at(-1)]];let t=[],n,[r,i]=e[0];for(n=1;n<e.length-2;n++){let[a,o]=e[n],[s,c]=e[n+1],l=(a+s)/2,u=(o+c)/2,d=[r+2*(a-r)/3,i+2*(o-i)/3],f=[l+2*(a-l)/3,u+2*(o-u)/3];t.push([[r,i],d,f,[l,u]]),[r,i]=[l,u]}let[a,o]=e[n],[s,c]=e[n+1],l=[r+2*(a-r)/3,i+2*(o-i)/3],u=[s+2*(a-s)/3,c+2*(o-c)/3];return t.push([[r,i],l,u,[s,c]]),t}#E(){if(this.isEmpty()){this.#M();return}this.#v();let{canvas:e,ctx:t}=this;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.width,e.height),this.#M();for(let e of this.bezierPath2D)t.stroke(e)}commit(){this.#s||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),this.#s=!0,this.div.classList.add(`disabled`),this.#z(!0),this.makeResizable(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(e){this._focusEventsAllowed&&(super.focusin(e),this.enableEditMode())}canvasPointerdown(e){e.button!==0||!this.isInEditMode()||this.#s||(this.setInForeground(),e.preventDefault(),e.type!==`mouse`&&this.div.focus(),this.#y(e.offsetX,e.offsetY))}canvasPointermove(e){e.preventDefault(),this.#b(e.offsetX,e.offsetY)}canvasPointerup(e){e.preventDefault(),this.#D(e)}canvasPointerleave(e){this.#D(e)}#D(e){this.canvas.removeEventListener(`pointerleave`,this.#r),this.canvas.removeEventListener(`pointermove`,this.#n),this.canvas.removeEventListener(`pointerup`,this.#i),this.canvas.addEventListener(`pointerdown`,this.#a),setTimeout(()=>{this.canvas.removeEventListener(`contextmenu`,o.noContextMenu)},10),this.#S(e.offsetX,e.offsetY),this.addToAnnotationStorage(),this.setInBackground()}#O(){this.canvas=document.createElement(`canvas`),this.canvas.width=this.canvas.height=0,this.canvas.className=`inkEditorCanvas`,i.AnnotationEditor._l10nPromise.get(`editor_ink_canvas_aria_label`).then(e=>this.canvas?.setAttribute(`aria-label`,e)),this.div.append(this.canvas),this.ctx=this.canvas.getContext(`2d`)}#k(){this.#u=new ResizeObserver(e=>{let t=e[0].contentRect;t.width&&t.height&&this.setDimensions(t.width,t.height)}),this.#u.observe(this.div)}get isResizable(){return!this.isEmpty()&&this.#s}render(){if(this.div)return this.div;let e,t;this.width&&(e=this.x,t=this.y),super.render(),i.AnnotationEditor._l10nPromise.get(`editor_ink2_aria_label`).then(e=>this.div?.setAttribute(`aria-label`,e));let[n,r,a,o]=this.#_();if(this.setAt(n,r,0,0),this.setDims(a,o),this.#O(),this.width){let[n,r]=this.parentDimensions;this.setAspectRatio(this.width*n,this.height*r),this.setAt(e*n,t*r,this.width*n,this.height*r),this.#l=!0,this.#A(),this.setDims(this.width*n,this.height*r),this.#E(),this.div.classList.add(`disabled`)}else this.div.classList.add(`editing`),this.enableEditMode();return this.#k(),this.div}#A(){if(!this.#l)return;let[e,t]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*e),this.canvas.height=Math.ceil(this.height*t),this.#M()}setDimensions(e,t){let n=Math.round(e),r=Math.round(t);if(this.#d===n&&this.#f===r)return;this.#d=n,this.#f=r,this.canvas.style.visibility=`hidden`;let[i,a]=this.parentDimensions;this.width=e/i,this.height=t/a,this.fixAndSetPosition(),this.#s&&this.#j(e,t),this.#A(),this.#E(),this.canvas.style.visibility=`visible`,this.fixDims()}#j(e,t){let n=this.#R(),r=(e-n)/this.#t,i=(t-n)/this.#e;this.scaleFactor=Math.min(r,i)}#M(){let e=this.#R()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+e,this.translationY*this.scaleFactor+e)}static#N(e){let t=new Path2D;for(let n=0,r=e.length;n<r;n++){let[r,i,a,o]=e[n];n===0&&t.moveTo(...r),t.bezierCurveTo(i[0],i[1],a[0],a[1],o[0],o[1])}return t}static#P(e,t,n){let[r,i,a,o]=t;switch(n){case 0:for(let t=0,n=e.length;t<n;t+=2)e[t]+=r,e[t+1]=o-e[t+1];break;case 90:for(let t=0,n=e.length;t<n;t+=2){let n=e[t];e[t]=e[t+1]+r,e[t+1]=n+i}break;case 180:for(let t=0,n=e.length;t<n;t+=2)e[t]=a-e[t],e[t+1]+=i;break;case 270:for(let t=0,n=e.length;t<n;t+=2){let n=e[t];e[t]=a-e[t+1],e[t+1]=o-n}break;default:throw Error(`Invalid rotation`)}return e}static#F(e,t,n){let[r,i,a,o]=t;switch(n){case 0:for(let t=0,n=e.length;t<n;t+=2)e[t]-=r,e[t+1]=o-e[t+1];break;case 90:for(let t=0,n=e.length;t<n;t+=2){let n=e[t];e[t]=e[t+1]-i,e[t+1]=n-r}break;case 180:for(let t=0,n=e.length;t<n;t+=2)e[t]=a-e[t],e[t+1]-=i;break;case 270:for(let t=0,n=e.length;t<n;t+=2){let n=e[t];e[t]=o-e[t+1],e[t+1]=a-n}break;default:throw Error(`Invalid rotation`)}return e}#I(e,t,n,r){let i=[],a=this.thickness/2,o=e*t+a,s=e*n+a;for(let t of this.paths){let n=[],a=[];for(let r=0,i=t.length;r<i;r++){let[c,l,u,d]=t[r],f=e*c[0]+o,p=e*c[1]+s,m=e*l[0]+o,h=e*l[1]+s,g=e*u[0]+o,_=e*u[1]+s,v=e*d[0]+o,y=e*d[1]+s;r===0&&(n.push(f,p),a.push(f,p)),n.push(m,h,g,_,v,y),a.push(m,h),r===i-1&&a.push(v,y)}i.push({bezier:c.#P(n,r,this.rotation),points:c.#P(a,r,this.rotation)})}return i}#L(){let e=1/0,t=-1/0,n=1/0,i=-1/0;for(let a of this.paths)for(let[o,s,c,l]of a){let a=r.Util.bezierBoundingBox(...o,...s,...c,...l);e=Math.min(e,a[0]),n=Math.min(n,a[1]),t=Math.max(t,a[2]),i=Math.max(i,a[3])}return[e,n,t,i]}#R(){return this.#s?Math.ceil(this.thickness*this.parentScale):0}#z(e=!1){if(this.isEmpty())return;if(!this.#s){this.#E();return}let t=this.#L(),n=this.#R();this.#t=Math.max(i.AnnotationEditor.MIN_SIZE,t[2]-t[0]),this.#e=Math.max(i.AnnotationEditor.MIN_SIZE,t[3]-t[1]);let r=Math.ceil(n+this.#t*this.scaleFactor),a=Math.ceil(n+this.#e*this.scaleFactor),[o,s]=this.parentDimensions;this.width=r/o,this.height=a/s,this.setAspectRatio(r,a);let c=this.translationX,l=this.translationY;this.translationX=-t[0],this.translationY=-t[1],this.#A(),this.#E(),this.#d=r,this.#f=a,this.setDims(r,a);let u=e?n/this.scaleFactor/2:0;this.translate(c-this.translationX-u,l-this.translationY-u)}static deserialize(e,t,n){if(e instanceof a.InkAnnotationElement)return null;let o=super.deserialize(e,t,n);o.thickness=e.thickness,o.color=r.Util.makeHexColor(...e.color),o.opacity=e.opacity;let[s,l]=o.pageDimensions,u=o.width*s,d=o.height*l,f=o.parentScale,p=e.thickness/2;o.#s=!0,o.#d=Math.round(u),o.#f=Math.round(d);let{paths:m,rect:h,rotation:g}=e;for(let{bezier:e}of m){e=c.#F(e,h,g);let t=[];o.paths.push(t);let n=f*(e[0]-p),r=f*(e[1]-p);for(let i=2,a=e.length;i<a;i+=6){let a=f*(e[i]-p),o=f*(e[i+1]-p),s=f*(e[i+2]-p),c=f*(e[i+3]-p),l=f*(e[i+4]-p),u=f*(e[i+5]-p);t.push([[n,r],[a,o],[s,c],[l,u]]),n=l,r=u}let i=this.#N(t);o.bezierPath2D.push(i)}let _=o.#L();return o.#t=Math.max(i.AnnotationEditor.MIN_SIZE,_[2]-_[0]),o.#e=Math.max(i.AnnotationEditor.MIN_SIZE,_[3]-_[1]),o.#j(u,d),o}serialize(){if(this.isEmpty())return null;let e=this.getRect(0,0),t=i.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:r.AnnotationEditorType.INK,color:t,thickness:this.thickness,opacity:this.opacity,paths:this.#I(this.scaleFactor/this.parentScale,this.translationX,this.translationY,e),pageIndex:this.pageIndex,rect:e,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}}t.InkEditor=c}),((e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StampEditor=void 0;var r=n(1),i=n(4),a=n(6),o=n(29);class s extends i.AnnotationEditor{#e=null;#t=null;#n=null;#r=null;#i=null;#a=null;#o=null;#s=null;#c=!1;#l=!1;static _type=`stamp`;constructor(e){super({...e,name:`stampEditor`}),this.#r=e.bitmapUrl,this.#i=e.bitmapFile}static initialize(e){i.AnnotationEditor.initialize(e)}static get supportedTypes(){return(0,r.shadow)(this,`supportedTypes`,[`apng`,`avif`,`bmp`,`gif`,`jpeg`,`png`,`svg+xml`,`webp`,`x-icon`].map(e=>`image/${e}`))}static get supportedTypesStr(){return(0,r.shadow)(this,`supportedTypesStr`,this.supportedTypes.join(`,`))}static isHandlingMimeForPasting(e){return this.supportedTypes.includes(e)}static paste(e,t){t.pasteEditor(r.AnnotationEditorType.STAMP,{bitmapFile:e.getAsFile()})}#u(e,t=!1){if(!e){this.remove();return}this.#e=e.bitmap,t||(this.#t=e.id,this.#c=e.isSvg),this.#p()}#d(){this.#n=null,this._uiManager.enableWaiting(!1),this.#a&&this.div.focus()}#f(){if(this.#t){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#t).then(e=>this.#u(e,!0)).finally(()=>this.#d());return}if(this.#r){let e=this.#r;this.#r=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromUrl(e).then(e=>this.#u(e)).finally(()=>this.#d());return}if(this.#i){let e=this.#i;this.#i=null,this._uiManager.enableWaiting(!0),this.#n=this._uiManager.imageManager.getFromFile(e).then(e=>this.#u(e)).finally(()=>this.#d());return}let e=document.createElement(`input`);e.type=`file`,e.accept=s.supportedTypesStr,this.#n=new Promise(t=>{e.addEventListener(`change`,async()=>{if(!e.files||e.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);let t=await this._uiManager.imageManager.getFromFile(e.files[0]);this.#u(t)}t()}),e.addEventListener(`cancel`,()=>{this.remove(),t()})}).finally(()=>this.#d()),e.click()}remove(){this.#t&&(this.#e=null,this._uiManager.imageManager.deleteId(this.#t),this.#a?.remove(),this.#a=null,this.#o?.disconnect(),this.#o=null),super.remove()}rebuild(){if(!this.parent){this.#t&&this.#f();return}super.rebuild(),this.div!==null&&(this.#t&&this.#f(),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(this.#n||this.#e||this.#r||this.#i)}get isResizable(){return!0}render(){if(this.div)return this.div;let e,t;if(this.width&&(e=this.x,t=this.y),super.render(),this.div.hidden=!0,this.#e?this.#p():this.#f(),this.width){let[n,r]=this.parentDimensions;this.setAt(e*n,t*r,this.width*n,this.height*r)}return this.div}#p(){let{div:e}=this,{width:t,height:n}=this.#e,[r,i]=this.pageDimensions,a=.75;if(this.width)t=this.width*r,n=this.height*i;else if(t>a*r||n>a*i){let e=Math.min(a*r/t,a*i/n);t*=e,n*=e}let[o,s]=this.parentDimensions;this.setDims(t*o/r,n*s/i),this._uiManager.enableWaiting(!1);let c=this.#a=document.createElement(`canvas`);e.append(c),e.hidden=!1,this.#g(t,n),this.#v(),this.#l||=(this.parent.addUndoableEditor(this),!0),this._uiManager._eventBus.dispatch(`reporttelemetry`,{source:this,details:{type:`editing`,subtype:this.editorType,data:{action:`inserted_image`}}}),this.addAltTextButton()}#m(e,t){let[n,r]=this.parentDimensions;this.width=e/n,this.height=t/r,this.setDims(e,t),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,this.#s!==null&&clearTimeout(this.#s);let i=200;this.#s=setTimeout(()=>{this.#s=null,this.#g(e,t)},200)}#h(e,t){let{width:n,height:r}=this.#e,i=n,a=r,o=this.#e;for(;i>2*e||a>2*t;){let n=i,r=a;i>2*e&&(i=i>=16384?Math.floor(i/2)-1:Math.ceil(i/2)),a>2*t&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2));let s=new OffscreenCanvas(i,a);s.getContext(`2d`).drawImage(o,0,0,n,r,0,0,i,a),o=s.transferToImageBitmap()}return o}#g(e,t){e=Math.ceil(e),t=Math.ceil(t);let n=this.#a;if(!n||n.width===e&&n.height===t)return;n.width=e,n.height=t;let r=this.#c?this.#e:this.#h(e,t),i=n.getContext(`2d`);i.filter=this._uiManager.hcmFilter,i.drawImage(r,0,0,r.width,r.height,0,0,e,t)}#_(e){if(e){if(this.#c){let e=this._uiManager.imageManager.getSvgUrl(this.#t);if(e)return e}let e=document.createElement(`canvas`);return{width:e.width,height:e.height}=this.#e,e.getContext(`2d`).drawImage(this.#e,0,0),e.toDataURL()}if(this.#c){let[e,t]=this.pageDimensions,n=Math.round(this.width*e*a.PixelsPerInch.PDF_TO_CSS_UNITS),r=Math.round(this.height*t*a.PixelsPerInch.PDF_TO_CSS_UNITS),i=new OffscreenCanvas(n,r);return i.getContext(`2d`).drawImage(this.#e,0,0,this.#e.width,this.#e.height,0,0,n,r),i.transferToImageBitmap()}return structuredClone(this.#e)}#v(){this.#o=new ResizeObserver(e=>{let t=e[0].contentRect;t.width&&t.height&&this.#m(t.width,t.height)}),this.#o.observe(this.div)}static deserialize(e,t,n){if(e instanceof o.StampAnnotationElement)return null;let r=super.deserialize(e,t,n),{rect:i,bitmapUrl:a,bitmapId:s,isSvg:c,accessibilityData:l}=e;s&&n.imageManager.isValidId(s)?r.#t=s:r.#r=a,r.#c=c;let[u,d]=r.pageDimensions;return r.width=(i[2]-i[0])/u,r.height=(i[3]-i[1])/d,l&&(r.altTextData=l),r}serialize(e=!1,t=null){if(this.isEmpty())return null;let n={annotationType:r.AnnotationEditorType.STAMP,bitmapId:this.#t,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#c,structTreeParentId:this._structTreeParentId};if(e)return n.bitmapUrl=this.#_(!0),n.accessibilityData=this.altTextData,n;let{decorative:i,altText:a}=this.altTextData;if(!i&&a&&(n.accessibilityData={type:`Figure`,alt:a}),t===null)return n;t.stamps||=new Map;let o=this.#c?(n.rect[2]-n.rect[0])*(n.rect[3]-n.rect[1]):null;if(!t.stamps.has(this.#t))t.stamps.set(this.#t,{area:o,serialized:n}),n.bitmap=this.#_(!1);else if(this.#c){let e=t.stamps.get(this.#t);o>e.area&&(e.area=o,e.serialized.bitmap.close(),e.serialized.bitmap=this.#_(!1))}return n}}t.StampEditor=s})],__webpack_module_cache__={};function __w_pdfjs_require__(e){var t=__webpack_module_cache__[e];if(t!==void 0)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](n,n.exports,__w_pdfjs_require__),n.exports}var __webpack_exports__={};return(()=>{var e=__webpack_exports__;Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"AbortException",{enumerable:!0,get:function(){return t.AbortException}}),Object.defineProperty(e,"AnnotationEditorLayer",{enumerable:!0,get:function(){return a.AnnotationEditorLayer}}),Object.defineProperty(e,"AnnotationEditorParamsType",{enumerable:!0,get:function(){return t.AnnotationEditorParamsType}}),Object.defineProperty(e,"AnnotationEditorType",{enumerable:!0,get:function(){return t.AnnotationEditorType}}),Object.defineProperty(e,"AnnotationEditorUIManager",{enumerable:!0,get:function(){return o.AnnotationEditorUIManager}}),Object.defineProperty(e,"AnnotationLayer",{enumerable:!0,get:function(){return s.AnnotationLayer}}),Object.defineProperty(e,"AnnotationMode",{enumerable:!0,get:function(){return t.AnnotationMode}}),Object.defineProperty(e,"CMapCompressionType",{enumerable:!0,get:function(){return t.CMapCompressionType}}),Object.defineProperty(e,"DOMSVGFactory",{enumerable:!0,get:function(){return r.DOMSVGFactory}}),Object.defineProperty(e,"FeatureTest",{enumerable:!0,get:function(){return t.FeatureTest}}),Object.defineProperty(e,"GlobalWorkerOptions",{enumerable:!0,get:function(){return c.GlobalWorkerOptions}}),Object.defineProperty(e,"ImageKind",{enumerable:!0,get:function(){return t.ImageKind}}),Object.defineProperty(e,"InvalidPDFException",{enumerable:!0,get:function(){return t.InvalidPDFException}}),Object.defineProperty(e,"MissingPDFException",{enumerable:!0,get:function(){return t.MissingPDFException}}),Object.defineProperty(e,"OPS",{enumerable:!0,get:function(){return t.OPS}}),Object.defineProperty(e,"PDFDataRangeTransport",{enumerable:!0,get:function(){return n.PDFDataRangeTransport}}),Object.defineProperty(e,"PDFDateString",{enumerable:!0,get:function(){return r.PDFDateString}}),Object.defineProperty(e,"PDFWorker",{enumerable:!0,get:function(){return n.PDFWorker}}),Object.defineProperty(e,"PasswordResponses",{enumerable:!0,get:function(){return t.PasswordResponses}}),Object.defineProperty(e,"PermissionFlag",{enumerable:!0,get:function(){return t.PermissionFlag}}),Object.defineProperty(e,"PixelsPerInch",{enumerable:!0,get:function(){return r.PixelsPerInch}}),Object.defineProperty(e,"PromiseCapability",{enumerable:!0,get:function(){return t.PromiseCapability}}),Object.defineProperty(e,"RenderingCancelledException",{enumerable:!0,get:function(){return r.RenderingCancelledException}}),Object.defineProperty(e,"SVGGraphics",{enumerable:!0,get:function(){return n.SVGGraphics}}),Object.defineProperty(e,"UnexpectedResponseException",{enumerable:!0,get:function(){return t.UnexpectedResponseException}}),Object.defineProperty(e,"Util",{enumerable:!0,get:function(){return t.Util}}),Object.defineProperty(e,"VerbosityLevel",{enumerable:!0,get:function(){return t.VerbosityLevel}}),Object.defineProperty(e,"XfaLayer",{enumerable:!0,get:function(){return l.XfaLayer}}),Object.defineProperty(e,"build",{enumerable:!0,get:function(){return n.build}}),Object.defineProperty(e,"createValidAbsoluteUrl",{enumerable:!0,get:function(){return t.createValidAbsoluteUrl}}),Object.defineProperty(e,"getDocument",{enumerable:!0,get:function(){return n.getDocument}}),Object.defineProperty(e,"getFilenameFromUrl",{enumerable:!0,get:function(){return r.getFilenameFromUrl}}),Object.defineProperty(e,"getPdfFilenameFromUrl",{enumerable:!0,get:function(){return r.getPdfFilenameFromUrl}}),Object.defineProperty(e,"getXfaPageViewport",{enumerable:!0,get:function(){return r.getXfaPageViewport}}),Object.defineProperty(e,"isDataScheme",{enumerable:!0,get:function(){return r.isDataScheme}}),Object.defineProperty(e,"isPdfFile",{enumerable:!0,get:function(){return r.isPdfFile}}),Object.defineProperty(e,"loadScript",{enumerable:!0,get:function(){return r.loadScript}}),Object.defineProperty(e,"noContextMenu",{enumerable:!0,get:function(){return r.noContextMenu}}),Object.defineProperty(e,"normalizeUnicode",{enumerable:!0,get:function(){return t.normalizeUnicode}}),Object.defineProperty(e,"renderTextLayer",{enumerable:!0,get:function(){return i.renderTextLayer}}),Object.defineProperty(e,"setLayerDimensions",{enumerable:!0,get:function(){return r.setLayerDimensions}}),Object.defineProperty(e,"shadow",{enumerable:!0,get:function(){return t.shadow}}),Object.defineProperty(e,"updateTextLayer",{enumerable:!0,get:function(){return i.updateTextLayer}}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return n.version}});var t=__w_pdfjs_require__(1),n=__w_pdfjs_require__(2),r=__w_pdfjs_require__(6),i=__w_pdfjs_require__(26),a=__w_pdfjs_require__(27),o=__w_pdfjs_require__(5),s=__w_pdfjs_require__(29),c=__w_pdfjs_require__(14),l=__w_pdfjs_require__(32);let u=`3.11.174`,d=`ce8716743`})(),__webpack_exports__})())}));export default require_pdf();
7
- //# sourceMappingURL=pdf-HiJ0icvU.js.map