@qaecy/cue-ui 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +254 -0
  2. package/document-viewer/130.js +1 -0
  3. package/document-viewer/160.js +1 -0
  4. package/document-viewer/241.js +1 -0
  5. package/document-viewer/266.js +1 -0
  6. package/document-viewer/315.js +1 -0
  7. package/document-viewer/344.js +1 -0
  8. package/document-viewer/376.js +1 -0
  9. package/document-viewer/3rdpartylicenses.txt +2153 -0
  10. package/document-viewer/523.js +1 -0
  11. package/document-viewer/560.js +1 -0
  12. package/document-viewer/734.js +1 -0
  13. package/document-viewer/829.js +1 -0
  14. package/document-viewer/83.js +1 -0
  15. package/document-viewer/843.js +1 -0
  16. package/document-viewer/888.js +1 -0
  17. package/document-viewer/common.js +1 -0
  18. package/document-viewer/index.html +54 -0
  19. package/document-viewer/main.js +1 -0
  20. package/document-viewer/polyfills.js +1 -0
  21. package/document-viewer/poppins-latin-400-normal.woff +0 -0
  22. package/document-viewer/poppins-latin-400-normal.woff2 +0 -0
  23. package/document-viewer/poppins-latin-ext-400-normal.woff +0 -0
  24. package/document-viewer/poppins-latin-ext-400-normal.woff2 +0 -0
  25. package/document-viewer/runtime.js +1 -0
  26. package/document-viewer/styles.css +1 -0
  27. package/id-builder/3rdpartylicenses.txt +505 -0
  28. package/id-builder/index.html +13 -0
  29. package/id-builder/main.js +1 -0
  30. package/id-builder/polyfills.js +1 -0
  31. package/id-builder/poppins-latin-400-normal.woff +0 -0
  32. package/id-builder/poppins-latin-400-normal.woff2 +0 -0
  33. package/id-builder/poppins-latin-ext-400-normal.woff +0 -0
  34. package/id-builder/poppins-latin-ext-400-normal.woff2 +0 -0
  35. package/id-builder/runtime.js +1 -0
  36. package/id-builder/styles.css +1 -0
  37. package/logo/3rdpartylicenses.txt +346 -0
  38. package/logo/index.html +13 -0
  39. package/logo/main.js +1 -0
  40. package/logo/polyfills.js +1 -0
  41. package/logo/runtime.js +1 -0
  42. package/package.json +35 -0
  43. package/project-documents/3rdpartylicenses.txt +830 -0
  44. package/project-documents/index.html +88 -0
  45. package/project-documents/main.js +1 -0
  46. package/project-documents/polyfills.js +1 -0
  47. package/project-documents/poppins-latin-400-normal.woff +0 -0
  48. package/project-documents/poppins-latin-400-normal.woff2 +0 -0
  49. package/project-documents/poppins-latin-ext-400-normal.woff +0 -0
  50. package/project-documents/poppins-latin-ext-400-normal.woff2 +0 -0
  51. package/project-documents/runtime.js +1 -0
  52. package/project-documents/styles.css +1 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunkcue_ui=self.webpackChunkcue_ui||[]).push([[83],{6117(Vr,yi,F){F.d(yi,{W:()=>Ei});var wt=F(7705),ee=F(7023),x=F(5547);const R=["contextMenuDirective"],_=[[["","trigger",""]],[["","menu",""]],[["","menu",""]]],Q=["[trigger]","[menu]","[menu]"];function It(Ot,xi){1&Ot&&x.SdG(0,1)}function wi(Ot,xi){1&Ot&&x.SdG(0,2)}let Ei=(()=>{class Ot{contextMenuData=(0,wt.hFB)({});trigger=(0,wt.hFB)("leftclick");positioning=(0,wt.hFB)(void 0);contextEnabled=(0,wt.hFB)(!0);menuClosed=(0,wt.CGW)();contextMenuDirective=(0,wt.ebz)("contextMenuDirective",{read:ee.Q});onMenuClose(){this.menuClosed.emit()}closeMenu(){const Et=this.contextMenuDirective();Et&&Et.closeContextMenu()}static \u0275fac=function(Vt){return new(Vt||Ot)};static \u0275cmp=x.VBU({type:Ot,selectors:[["cue-menu"]],viewQuery:function(Vt,jt){1&Vt&&x.wEZ(jt.contextMenuDirective,R,5,ee.Q),2&Vt&&x.NyB()},inputs:{contextMenuData:[1,"contextMenuData"],trigger:[1,"trigger"],positioning:[1,"positioning"],contextEnabled:[1,"contextEnabled"]},outputs:{menuClosed:"menuClosed"},ngContentSelectors:Q,decls:7,vars:5,consts:[["contextMenuDirective",""],["menuTemplate",""],[3,"contextMenuClose","cueContextMenu","contextMenuData","cueContextEnabled","trigger","positioning"]],template:function(Vt,jt){if(1&Vt&&(x.NAR(_),x.j41(0,"div",2,0),x.bIt("contextMenuClose",function(){return jt.onMenuClose()}),x.SdG(2),x.k0s(),x.DNE(3,It,1,0,"ng-template",null,1,x.C5r)(5,wi,1,0,"ng-template",null,1,x.C5r)),2&Vt){const Ue=x.sdS(4);x.Y8G("cueContextMenu",Ue)("contextMenuData",jt.contextMenuData)("cueContextEnabled",jt.contextEnabled())("trigger",jt.trigger())("positioning",jt.positioning())}},dependencies:[ee.Q],styles:["[_nghost-%COMP%]{display:block}"]})}return Ot})()},4311(Vr,yi,F){F.d(yi,{PDFViewer:()=>kd});var wt={};F.r(wt),F.d(wt,{AbortException:()=>tl,AnnotationEditorLayer:()=>el,AnnotationEditorParamsType:()=>il,AnnotationEditorType:()=>Cs,AnnotationEditorUIManager:()=>nl,AnnotationLayer:()=>sl,AnnotationMode:()=>rl,ColorPicker:()=>al,DOMSVGFactory:()=>ol,DrawLayer:()=>ll,FeatureTest:()=>hl,GlobalWorkerOptions:()=>Ss,ImageKind:()=>cl,InvalidPDFException:()=>dl,MissingPDFException:()=>ul,OPS:()=>fl,OutputScale:()=>pl,PDFDataRangeTransport:()=>gl,PDFDateString:()=>ml,PDFWorker:()=>bl,PasswordResponses:()=>_l,PermissionFlag:()=>vl,PixelsPerInch:()=>Al,RenderingCancelledException:()=>yl,TextLayer:()=>wl,UnexpectedResponseException:()=>El,Util:()=>xl,VerbosityLevel:()=>Ps,XfaLayer:()=>Cl,build:()=>Sl,createValidAbsoluteUrl:()=>Pl,fetchData:()=>Tl,getDocument:()=>Ts,getFilenameFromUrl:()=>Ml,getPdfFilenameFromUrl:()=>Ll,getXfaPageViewport:()=>Rl,isDataScheme:()=>Il,isPdfFile:()=>kl,noContextMenu:()=>Dl,normalizeUnicode:()=>Ol,setLayerDimensions:()=>Fl,shadow:()=>Nl,version:()=>oi});var ee={};F.r(ee),F.d(ee,{AnnotationLayerBuilder:()=>Xc,DownloadManager:()=>Yc,EventBus:()=>Kc,FindState:()=>qc,GenericL10n:()=>Er,LinkTarget:()=>Ae,PDFFindController:()=>xr,PDFHistory:()=>Qc,PDFLinkService:()=>Cr,PDFPageView:()=>Zc,PDFScriptingManager:()=>Jc,PDFSinglePageViewer:()=>Sr,PDFViewer:()=>Pr,ProgressBar:()=>td,RenderingStates:()=>ed,ScrollMode:()=>id,SimpleLinkService:()=>nd,SpreadMode:()=>sd,StructTreeLayerBuilder:()=>rd,TextLayerBuilder:()=>ad,XfaLayerBuilder:()=>od,parseQueryString:()=>ld});var x=F(467),R=F(5802),_=F(5547),Q=F(7705),It=F(2271),wi=F(8750),Ei=F(4226),Ot=F(1397),xi=F(7441),Et=F(8071),Vt=F(6450);const jt=["addListener","removeListener"],Ue=["addEventListener","removeEventListener"],jr=["on","off"];function Z(o,t,e,i){if((0,Et.T)(e)&&(i=e,e=void 0),i)return Z(o,t,e).pipe((0,Vt.I)(i));const[n,s]=function Wr(o){return(0,Et.T)(o.addEventListener)&&(0,Et.T)(o.removeEventListener)}(o)?Ue.map(r=>a=>o[r](t,a,e)):function Hr(o){return(0,Et.T)(o.addListener)&&(0,Et.T)(o.removeListener)}(o)?jt.map(Sn(o,t)):function zr(o){return(0,Et.T)(o.on)&&(0,Et.T)(o.off)}(o)?jr.map(Sn(o,t)):[];if(!n&&(0,xi.X)(o))return(0,Ot.Z)(r=>Z(r,t,e))((0,wi.Tg)(o));if(!n)throw new TypeError("Invalid event target");return new Ei.c(r=>{const a=(...l)=>r.next(1<l.length?l:l[0]);return n(a),()=>s(a)})}function Sn(o,t){return e=>i=>o[e](t,i)}var Ur=F(1413),Pn=F(6648),J=F(6977),Gr=F(3236),$r=F(9974),Xr=F(4360),Kr=F(5964),we={d:(o,t)=>{for(var e in t)we.o(t,e)&&!we.o(o,e)&&Object.defineProperty(o,e,{enumerable:!0,get:t[e]})},o:(o,t)=>Object.prototype.hasOwnProperty.call(o,t)},N=globalThis.pdfjsLib={};we.d(N,{AbortException:()=>ne,AnnotationEditorLayer:()=>Jo,AnnotationEditorParamsType:()=>D,AnnotationEditorType:()=>B,AnnotationEditorUIManager:()=>Te,AnnotationLayer:()=>qo,AnnotationMode:()=>qt,ColorPicker:()=>Mt,DOMSVGFactory:()=>Zi,DrawLayer:()=>gt,FeatureTest:()=>bt,GlobalWorkerOptions:()=>Le,ImageKind:()=>$e,InvalidPDFException:()=>Mn,MissingPDFException:()=>ie,OPS:()=>kt,OutputScale:()=>Oi,PDFDataRangeTransport:()=>ds,PDFDateString:()=>Dn,PDFWorker:()=>ct,PasswordResponses:()=>Jr,PermissionFlag:()=>Zr,PixelsPerInch:()=>ue,RenderingCancelledException:()=>Ii,TextLayer:()=>vt,UnexpectedResponseException:()=>qe,Util:()=>I,VerbosityLevel:()=>Xe,XfaLayer:()=>gs,build:()=>Lo,createValidAbsoluteUrl:()=>na,fetchData:()=>Ze,getDocument:()=>yo,getFilenameFromUrl:()=>fa,getPdfFilenameFromUrl:()=>pa,getXfaPageViewport:()=>ga,isDataScheme:()=>Je,isPdfFile:()=>ki,noContextMenu:()=>Pt,normalizeUnicode:()=>ca,setLayerDimensions:()=>se,shadow:()=>U,version:()=>Mo});const ft=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type),Tn=[1,0,0,1,0,0],Ci=[.001,0,0,.001,0,0],qt={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},B={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},D={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35},Zr={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},$e={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Xe={ERRORS:0,WARNINGS:1,INFOS:5},kt={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,setStrokeTransparent:92,setFillTransparent:93},Jr={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let Ye=Xe.WARNINGS;function ea(){return Ye}function Ke(o){Ye>=Xe.INFOS&&console.log(`Info: ${o}`)}function V(o){Ye>=Xe.WARNINGS&&console.log(`Warning: ${o}`)}function X(o){throw new Error(o)}function lt(o,t){o||X(t)}function na(o,t=null,e=null){if(!o)return null;try{if(e&&"string"==typeof o&&(e.addDefaultProtocol&&o.startsWith("www.")&&o.match(/\./g)?.length>=2&&(o=`http://${o}`),e.tryConvertEncoding))try{o=function ha(o){return decodeURIComponent(escape(o))}(o)}catch{}const i=t?new URL(o,t):new URL(o);if(function ia(o){switch(o?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(i))return i}catch{}return null}function U(o,t,e,i=!1){return Object.defineProperty(o,t,{value:e,enumerable:!i,configurable:!0,writable:!1}),e}const Qt=function(){function t(e,i){this.message=e,this.name=i}return t.prototype=new Error,t.constructor=t,t}();class Si extends Qt{constructor(t,e){super(t,"PasswordException"),this.code=e}}class Pi extends Qt{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class Mn extends Qt{constructor(t){super(t,"InvalidPDFException")}}class ie extends Qt{constructor(t){super(t,"MissingPDFException")}}class qe extends Qt{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class sa extends Qt{constructor(t){super(t,"FormatError")}}class ne extends Qt{constructor(t){super(t,"AbortException")}}function Ln(o){("object"!=typeof o||void 0===o?.length)&&X("Invalid argument for bytesToString");const t=o.length,e=8192;if(t<e)return String.fromCharCode.apply(null,o);const i=[];for(let n=0;n<t;n+=e){const s=Math.min(n+e,t),r=o.subarray(n,s);i.push(String.fromCharCode.apply(null,r))}return i.join("")}function de(o){"string"!=typeof o&&X("Invalid argument for stringToBytes");const t=o.length,e=new Uint8Array(t);for(let i=0;i<t;++i)e[i]=255&o.charCodeAt(i);return e}function Ti(o){const t=Object.create(null);for(const[e,i]of o)t[e]=i;return t}class bt{static get isLittleEndian(){return U(this,"isLittleEndian",function aa(){const o=new Uint8Array(4);return o[0]=1,1===new Uint32Array(o.buffer,0,1)[0]}())}static get isEvalSupported(){return U(this,"isEvalSupported",function oa(){try{return new Function(""),!0}catch{return!1}}())}static get isOffscreenCanvasSupported(){return U(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator<"u"&&"string"==typeof navigator?.platform?U(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:"string"==typeof navigator?.userAgent&&navigator.userAgent.includes("Firefox")}):U(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){return U(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const Qe=Array.from(Array(256).keys(),o=>o.toString(16).padStart(2,"0"));class I{static makeHexColor(t,e,i){return`#${Qe[t]}${Qe[e]}${Qe[i]}`}static scaleMinMax(t,e){let i;t[0]?(t[0]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[3],e[3]*=t[3]):(i=e[0],e[0]=e[1],e[1]=i,i=e[2],e[2]=e[3],e[3]=i,t[1]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static applyTransform(t,e){return[t[0]*e[0]+t[1]*e[2]+e[4],t[0]*e[1]+t[1]*e[3]+e[5]]}static applyInverseTransform(t,e){const i=e[0]*e[3]-e[1]*e[2];return[(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/i,(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/i]}static getAxialAlignedBoundingBox(t,e){const i=this.applyTransform(t,e),n=this.applyTransform(t.slice(2,4),e),s=this.applyTransform([t[0],t[3]],e),r=this.applyTransform([t[2],t[1]],e);return[Math.min(i[0],n[0],s[0],r[0]),Math.min(i[1],n[1],s[1],r[1]),Math.max(i[0],n[0],s[0],r[0]),Math.max(i[1],n[1],s[1],r[1])]}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t){const e=[t[0],t[2],t[1],t[3]],i=t[0]*e[0]+t[1]*e[2],r=t[2]*e[1]+t[3]*e[3],a=(i+r)/2,l=Math.sqrt((i+r)**2-4*(i*r-(t[2]*e[0]+t[3]*e[2])*(t[0]*e[1]+t[1]*e[3])))/2,c=a-l||1;return[Math.sqrt(a+l||1),Math.sqrt(c)]}static normalizeRect(t){const e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){const i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),n=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>n)return null;const s=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),r=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return s>r?null:[i,s,n,r]}static#t(t,e,i,n,s,r,a,l,h,c){if(h<=0||h>=1)return;const d=1-h,u=h*h,f=u*h,p=d*(d*(d*t+3*h*e)+3*u*i)+f*n,g=d*(d*(d*s+3*h*r)+3*u*a)+f*l;c[0]=Math.min(c[0],p),c[1]=Math.min(c[1],g),c[2]=Math.max(c[2],p),c[3]=Math.max(c[3],g)}static#e(t,e,i,n,s,r,a,l,h,c,d,u){if(Math.abs(h)<1e-12)return void(Math.abs(c)>=1e-12&&this.#t(t,e,i,n,s,r,a,l,-d/c,u));const f=c**2-4*d*h;if(f<0)return;const p=Math.sqrt(f),g=2*h;this.#t(t,e,i,n,s,r,a,l,(-c+p)/g,u),this.#t(t,e,i,n,s,r,a,l,(-c-p)/g,u)}static bezierBoundingBox(t,e,i,n,s,r,a,l,h){return h?(h[0]=Math.min(h[0],t,a),h[1]=Math.min(h[1],e,l),h[2]=Math.max(h[2],t,a),h[3]=Math.max(h[3],e,l)):h=[Math.min(t,a),Math.min(e,l),Math.max(t,a),Math.max(e,l)],this.#e(t,i,s,a,e,n,r,l,3*(3*(i-s)-t+a),6*(t-2*i+s),3*(i-t),h),this.#e(t,i,s,a,e,n,r,l,3*(3*(n-r)-e+l),6*(e-2*n+r),3*(n-e),h),h}}let Mi=null,Rn=null;function ca(o){return Mi||(Mi=/([\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,Rn=new Map([["\ufb05","\u017ft"]])),o.replaceAll(Mi,(t,e,i)=>e?e.normalize("NFKC"):Rn.get(i))}const Li="pdfjs_internal_id_",zt="http://www.w3.org/2000/svg";class ue{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}function Ze(o){return Ri.apply(this,arguments)}function Ri(){return(Ri=(0,x.A)(function*(o,t="text"){if(Ce(o,document.baseURI)){const e=yield fetch(o);if(!e.ok)throw new Error(e.statusText);switch(t){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"json":return e.json()}return e.text()}return new Promise((e,i)=>{const n=new XMLHttpRequest;n.open("GET",o,!0),n.responseType=t,n.onreadystatechange=()=>{if(n.readyState===XMLHttpRequest.DONE){if(200===n.status||0===n.status){switch(t){case"arraybuffer":case"blob":case"json":return void e(n.response)}return void e(n.responseText)}i(new Error(n.statusText))}},n.send(null)})})).apply(this,arguments)}class xe{constructor({viewBox:t,scale:e,rotation:i,offsetX:n=0,offsetY:s=0,dontFlip:r=!1}){this.viewBox=t,this.scale=e,this.rotation=i,this.offsetX=n,this.offsetY=s;const a=(t[2]+t[0])/2,l=(t[3]+t[1])/2;let h,c,d,u,f,p,g,b;switch((i%=360)<0&&(i+=360),i){case 180:h=-1,c=0,d=0,u=1;break;case 90:h=0,c=1,d=1,u=0;break;case 270:h=0,c=-1,d=-1,u=0;break;case 0:h=1,c=0,d=0,u=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}r&&(d=-d,u=-u),0===h?(f=Math.abs(l-t[1])*e+n,p=Math.abs(a-t[0])*e+s,g=(t[3]-t[1])*e,b=(t[2]-t[0])*e):(f=Math.abs(a-t[0])*e+n,p=Math.abs(l-t[1])*e+s,g=(t[2]-t[0])*e,b=(t[3]-t[1])*e),this.transform=[h*e,c*e,d*e,u*e,f-h*e*a-d*e*l,p-c*e*a-u*e*l],this.width=g,this.height=b}get rawDims(){const{viewBox:t}=this;return U(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:i=this.offsetX,offsetY:n=this.offsetY,dontFlip:s=!1}={}){return new xe({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:i,offsetY:n,dontFlip:s})}convertToViewportPoint(t,e){return I.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){const e=I.applyTransform([t[0],t[1]],this.transform),i=I.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){return I.applyInverseTransform([t,e],this.transform)}}class Ii extends Qt{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function Je(o){const t=o.length;let e=0;for(;e<t&&""===o[e].trim();)e++;return"data:"===o.substring(e,e+5).toLowerCase()}function ki(o){return"string"==typeof o&&/\.pdf$/i.test(o)}function fa(o){return[o]=o.split(/[#?]/,1),o.substring(o.lastIndexOf("/")+1)}function pa(o,t="document.pdf"){if("string"!=typeof o)return t;if(Je(o))return V('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const i=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,n=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(o);let s=i.exec(n[1])||i.exec(n[2])||i.exec(n[3]);if(s&&(s=s[0],s.includes("%")))try{s=i.exec(decodeURIComponent(s))[0]}catch{}return s||t}class In{started=Object.create(null);times=[];time(t){t in this.started&&V(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||V(`Timer has not been started for ${t}`),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){const t=[];let e=0;for(const{name:i}of this.times)e=Math.max(i.length,e);for(const{name:i,start:n,end:s}of this.times)t.push(`${i.padEnd(e)} ${s-n}ms\n`);return t.join("")}}function Ce(o,t){try{const{protocol:e}=t?new URL(o,t):new URL(o);return"http:"===e||"https:"===e}catch{return!1}}function Pt(o){o.preventDefault()}function kn(o){console.log("Deprecated API usage: "+o)}class Dn{static#t;static toDateObject(t){if(!t||"string"!=typeof t)return null;this.#t||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const e=this.#t.exec(t);if(!e)return null;const i=parseInt(e[1],10);let n=parseInt(e[2],10);n=n>=1&&n<=12?n-1:0;let s=parseInt(e[3],10);s=s>=1&&s<=31?s:1;let r=parseInt(e[4],10);r=r>=0&&r<=23?r:0;let a=parseInt(e[5],10);a=a>=0&&a<=59?a:0;let l=parseInt(e[6],10);l=l>=0&&l<=59?l:0;const h=e[7]||"Z";let c=parseInt(e[8],10);c=c>=0&&c<=23?c:0;let d=parseInt(e[9],10)||0;return d=d>=0&&d<=59?d:0,"-"===h?(r+=c,a+=d):"+"===h&&(r-=c,a-=d),new Date(Date.UTC(i,n,s,r,a,l))}}function ga(o,{scale:t=1,rotation:e=0}){const{width:i,height:n}=o.attributes.style,s=[0,0,parseInt(i),parseInt(n)];return new xe({viewBox:s,scale:t,rotation:e})}function Di(o){if(o.startsWith("#")){const t=parseInt(o.slice(1),16);return[(16711680&t)>>16,(65280&t)>>8,255&t]}return o.startsWith("rgb(")?o.slice(4,-1).split(",").map(t=>parseInt(t)):o.startsWith("rgba(")?o.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(V(`Not a valid color format: "${o}"`),[0,0,0])}function K(o){const{a:t,b:e,c:i,d:n,e:s,f:r}=o.getTransform();return[t,e,i,n,s,r]}function Wt(o){const{a:t,b:e,c:i,d:n,e:s,f:r}=o.getTransform().invertSelf();return[t,e,i,n,s,r]}function se(o,t,e=!1,i=!0){if(t instanceof xe){const{pageWidth:n,pageHeight:s}=t.rawDims,{style:r}=o,a=bt.isCSSRoundSupported,l=`var(--scale-factor) * ${n}px`,h=`var(--scale-factor) * ${s}px`,c=a?`round(down, ${l}, var(--scale-round-x, 1px))`:`calc(${l})`,d=a?`round(down, ${h}, var(--scale-round-y, 1px))`:`calc(${h})`;e&&t.rotation%180!=0?(r.width=d,r.height=c):(r.width=c,r.height=d)}i&&o.setAttribute("data-main-rotation",t.rotation)}class Oi{constructor(){const t=window.devicePixelRatio||1;this.sx=t,this.sy=t}get scaled(){return 1!==this.sx||1!==this.sy}get symmetric(){return this.sx===this.sy}}class Se{#t=null;#e=null;#i;#n=null;#s=null;static#r=null;constructor(t){this.#i=t,Se.#r||=Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button"})}render(){const t=this.#t=document.createElement("div");t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");const e=this.#i._uiManager._signal;t.addEventListener("contextmenu",Pt,{signal:e}),t.addEventListener("pointerdown",Se.#l,{signal:e});const i=this.#n=document.createElement("div");i.className="buttons",t.append(i);const n=this.#i.toolbarPosition;if(n){const{style:s}=t,r="ltr"===this.#i._uiManager.direction?1-n[0]:n[0];s.insetInlineEnd=100*r+"%",s.top=`calc(${100*n[1]}% + var(--editor-toolbar-vert-offset))`}return this.#d(),t}get div(){return this.#t}static#l(t){t.stopPropagation()}#h(t){this.#i._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()}#c(t){this.#i._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()}#o(t){const e=this.#i._uiManager._signal;t.addEventListener("focusin",this.#h.bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",this.#c.bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",Pt,{signal:e})}hide(){this.#t.classList.add("hidden"),this.#e?.hideDropdown()}show(){this.#t.classList.remove("hidden"),this.#s?.shown()}#d(){const{editorType:t,_uiManager:e}=this.#i,i=document.createElement("button");i.className="delete",i.tabIndex=0,i.setAttribute("data-l10n-id",Se.#r[t]),this.#o(i),i.addEventListener("click",n=>{e.delete()},{signal:e._signal}),this.#n.append(i)}get#a(){const t=document.createElement("div");return t.className="divider",t}addAltText(t){var e=this;return(0,x.A)(function*(){const i=yield t.render();e.#o(i),e.#n.prepend(i,e.#a),e.#s=t})()}addColorPicker(t){this.#e=t;const e=t.renderButton();this.#o(e),this.#n.prepend(e,this.#a)}remove(){this.#t.remove(),this.#e?.destroy(),this.#e=null}}class ba{#t=null;#e=null;#i;constructor(t){this.#i=t}#n(){const t=this.#e=document.createElement("div");t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",Pt,{signal:this.#i._signal});const e=this.#t=document.createElement("div");return e.className="buttons",t.append(e),this.#r(),t}#s(t,e){let i=0,n=0;for(const s of t){const r=s.y+s.height;if(r<i)continue;const a=s.x+(e?s.width:0);r>i?(n=a,i=r):e?a>n&&(n=a):a<n&&(n=a)}return[e?1-n:n,i]}show(t,e,i){const[n,s]=this.#s(e,i),{style:r}=this.#e||=this.#n();t.append(this.#e),r.insetInlineEnd=100*n+"%",r.top=`calc(${100*s}% + var(--editor-toolbar-vert-offset))`}hide(){this.#e.remove()}#r(){const t=document.createElement("button");t.className="highlightButton",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const e=document.createElement("span");t.append(e),e.className="visuallyHidden",e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const i=this.#i._signal;t.addEventListener("contextmenu",Pt,{signal:i}),t.addEventListener("click",()=>{this.#i.highlightSelection("floating_button")},{signal:i}),this.#t.append(t)}}function ti(o,t,e){for(const i of e)t.addEventListener(i,o[i].bind(o))}class va{#t=0;get id(){return"pdfjs_internal_editor_"+this.#t++}}class Fi{#t=function da(){if(typeof crypto<"u"&&"function"==typeof crypto?.randomUUID)return crypto.randomUUID();const o=new Uint8Array(32);if(typeof crypto<"u"&&"function"==typeof crypto?.getRandomValues)crypto.getRandomValues(o);else for(let t=0;t<32;t++)o[t]=Math.floor(255*Math.random());return Ln(o)}();#e=0;#i=null;static get _isSVGFittingCanvas(){const i=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),n=new Image;return 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>',U(this,"_isSVGFittingCanvas",n.decode().then(()=>(i.drawImage(n,0,0,1,1,0,0,1,3),0===new Uint32Array(i.getImageData(0,0,1,1).data.buffer)[0])))}#n(t,e){var i=this;return(0,x.A)(function*(){i.#i||=new Map;let n=i.#i.get(t);if(null===n)return null;if(n?.bitmap)return n.refCounter+=1,n;try{let s;if(n||={bitmap:null,id:`image_${i.#t}_${i.#e++}`,refCounter:0,isSvg:!1},"string"==typeof e?(n.url=e,s=yield Ze(e,"blob")):e instanceof File?s=n.file=e:e instanceof Blob&&(s=e),"image/svg+xml"===s.type){const r=Fi._isSVGFittingCanvas,a=new FileReader,l=new Image,h=new Promise((c,d)=>{l.onload=()=>{n.bitmap=l,n.isSvg=!0,c()},a.onload=(0,x.A)(function*(){const u=n.svgUrl=a.result;l.src=(yield r)?`${u}#svgView(preserveAspectRatio(none))`:u}),l.onerror=a.onerror=d});a.readAsDataURL(s),yield h}else n.bitmap=yield createImageBitmap(s);n.refCounter=1}catch(s){console.error(s),n=null}return i.#i.set(t,n),n&&i.#i.set(n.id,n),n})()}getFromFile(t){var e=this;return(0,x.A)(function*(){const{lastModified:i,name:n,size:s,type:r}=t;return e.#n(`${i}_${n}_${s}_${r}`,t)})()}getFromUrl(t){var e=this;return(0,x.A)(function*(){return e.#n(t,t)})()}getFromBlob(t,e){var i=this;return(0,x.A)(function*(){const n=yield e;return i.#n(t,n)})()}getFromId(t){var e=this;return(0,x.A)(function*(){e.#i||=new Map;const i=e.#i.get(t);if(!i)return null;if(i.bitmap)return i.refCounter+=1,i;if(i.file)return e.getFromFile(i.file);if(i.blobPromise){const{blobPromise:n}=i;return delete i.blobPromise,e.getFromBlob(i.id,n)}return e.getFromUrl(i.url)})()}getFromCanvas(t,e){this.#i||=new Map;let i=this.#i.get(t);if(i?.bitmap)return i.refCounter+=1,i;const n=new OffscreenCanvas(e.width,e.height);return n.getContext("2d").drawImage(e,0,0),i={bitmap:n.transferToImageBitmap(),id:`image_${this.#t}_${this.#e++}`,refCounter:1,isSvg:!1},this.#i.set(t,i),this.#i.set(i.id,i),i}getSvgUrl(t){const e=this.#i.get(t);return e?.isSvg?e.svgUrl:null}deleteId(t){this.#i||=new Map;const e=this.#i.get(t);if(!e||(e.refCounter-=1,0!==e.refCounter))return;const{bitmap:i}=e;if(!e.url&&!e.file){const n=new OffscreenCanvas(i.width,i.height);n.getContext("bitmaprenderer").transferFromImageBitmap(i),e.blobPromise=n.convertToBlob()}i.close?.(),e.bitmap=null}isValidId(t){return t.startsWith(`image_${this.#t}_`)}}class Aa{#t=[];#e=!1;#i;#n=-1;constructor(t=128){this.#i=t}add({cmd:t,undo:e,post:i,mustExec:n,type:s=NaN,overwriteIfSameType:r=!1,keepUndo:a=!1}){if(n&&t(),this.#e)return;const l={cmd:t,undo:e,post:i,type:s};if(-1===this.#n)return this.#t.length>0&&(this.#t.length=0),this.#n=0,void this.#t.push(l);if(r&&this.#t[this.#n].type===s)return a&&(l.undo=this.#t[this.#n].undo),void(this.#t[this.#n]=l);const h=this.#n+1;h===this.#i?this.#t.splice(0,1):(this.#n=h,h<this.#t.length&&this.#t.splice(h)),this.#t.push(l)}undo(){if(-1===this.#n)return;this.#e=!0;const{undo:t,post:e}=this.#t[this.#n];t(),e?.(),this.#e=!1,this.#n-=1}redo(){if(this.#n<this.#t.length-1){this.#n+=1,this.#e=!0;const{cmd:t,post:e}=this.#t[this.#n];t(),e?.(),this.#e=!1}}hasSomethingToUndo(){return-1!==this.#n}hasSomethingToRedo(){return this.#n<this.#t.length-1}destroy(){this.#t=null}}class Pe{constructor(t){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:e}=bt.platform;for(const[i,n,s={}]of t)for(const r of i){const a=r.startsWith("mac+");e&&a?(this.callbacks.set(r.slice(4),{callback:n,options:s}),this.allKeys.add(r.split("+").at(-1))):!e&&!a&&(this.callbacks.set(r,{callback:n,options:s}),this.allKeys.add(r.split("+").at(-1)))}}#t(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);const e=this.buffer.join("+");return this.buffer.length=0,e}exec(t,e){if(!this.allKeys.has(e.key))return;const i=this.callbacks.get(this.#t(e));if(!i)return;const{callback:n,options:{bubbles:s=!1,args:r=[],checker:a=null}}=i;a&&!a(t,e)||(n.bind(t,...r,e)(),s||(e.stopPropagation(),e.preventDefault()))}}class Ni{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const t=new Map([["CanvasText",null],["Canvas",null]]);return function ma(o){const t=document.createElement("span");t.style.visibility="hidden",document.body.append(t);for(const e of o.keys()){t.style.color=e;const i=window.getComputedStyle(t).color;o.set(e,Di(i))}t.remove()}(t),U(this,"_colors",t)}convert(t){const e=Di(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(const[i,n]of this._colors)if(n.every((s,r)=>s===e[r]))return Ni._colorsMapping.get(i);return e}getHexCode(t){const e=this._colors.get(t);return e?I.makeHexColor(...e):t}}let Te=(()=>{class o{#t=new AbortController;#e=null;#i=new Map;#n=new Map;#s=null;#r=null;#l=null;#h=new Aa;#c=null;#o=0;#d=new Set;#a=null;#u=null;#p=new Set;#f=!1;#g=!1;#b=!1;#m=null;#_=null;#A=null;#E=null;#y=!1;#w=null;#L=new va;#P=!1;#x=!1;#T=null;#S=null;#R=null;#k=null;#C=B.NONE;#v=new Set;#M=null;#I=null;#N=null;#H={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#j=[0,0];#F=null;#B=null;#V=null;#D=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const e=o.prototype,i=a=>a.#B.contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&a.hasSomethingToControl(),n=(a,{target:l})=>{if(l instanceof HTMLInputElement){const{type:h}=l;return"text"!==h&&"number"!==h}return!0},s=this.TRANSLATE_SMALL,r=this.TRANSLATE_BIG;return U(this,"_keyboardManager",new Pe([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:n}],[["ctrl+z","mac+meta+z"],e.undo,{checker:n}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:n}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete,{checker:n}],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(a,{target:l})=>!(l instanceof HTMLButtonElement)&&a.#B.contains(l)&&!a.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(a,{target:l})=>!(l instanceof HTMLButtonElement)&&a.#B.contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-s,0],checker:i}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-r,0],checker:i}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[s,0],checker:i}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[r,0],checker:i}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-s],checker:i}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-r],checker:i}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,s],checker:i}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,r],checker:i}]]))}constructor(e,i,n,s,r,a,l,h,c,d,u){const f=this._signal=this.#t.signal;this.#B=e,this.#V=i,this.#s=n,this._eventBus=s,s._on("editingaction",this.onEditingAction.bind(this),{signal:f}),s._on("pagechanging",this.onPageChanging.bind(this),{signal:f}),s._on("scalechanging",this.onScaleChanging.bind(this),{signal:f}),s._on("rotationchanging",this.onRotationChanging.bind(this),{signal:f}),s._on("setpreference",this.onSetPreference.bind(this),{signal:f}),s._on("switchannotationeditorparams",p=>this.updateParams(p.type,p.value),{signal:f}),this.#tt(),this.#st(),this.#X(),this.#r=r.annotationStorage,this.#m=r.filterFactory,this.#I=a,this.#E=l||null,this.#f=h,this.#g=c,this.#b=d,this.#k=u||null,this.viewParameters={realScale:ue.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}destroy(){this.#D?.resolve(),this.#D=null,this.#t?.abort(),this.#t=null,this._signal=null;for(const e of this.#n.values())e.destroy();this.#n.clear(),this.#i.clear(),this.#p.clear(),this.#e=null,this.#v.clear(),this.#h.destroy(),this.#s?.destroy(),this.#w?.hide(),this.#w=null,this.#_&&(clearTimeout(this.#_),this.#_=null),this.#F&&(clearTimeout(this.#F),this.#F=null)}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return this.#k}get useNewAltTextFlow(){return this.#g}get useNewAltTextWhenAddingImage(){return this.#b}get hcmFilter(){return U(this,"hcmFilter",this.#I?this.#m.addHCMFilter(this.#I.foreground,this.#I.background):"none")}get direction(){return U(this,"direction",getComputedStyle(this.#B).direction)}get highlightColors(){return U(this,"highlightColors",this.#E?new Map(this.#E.split(",").map(e=>e.split("=").map(i=>i.trim()))):null)}get highlightColorNames(){return U(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}setMainHighlightColorPicker(e){this.#R=e}editAltText(e,i=!1){this.#s?.editAltText(this,e,i)}switchToMode(e,i){this._eventBus.on("annotationeditormodechanged",i,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,i){this._eventBus.dispatch("setpreference",{source:this,name:e,value:i})}onSetPreference({name:e,value:i}){"enableNewAltTextWhenAddingImage"===e&&(this.#b=i)}onPageChanging({pageNumber:e}){this.#o=e-1}focusMainContainer(){this.#B.focus()}findParent(e,i){for(const n of this.#n.values()){const{x:s,y:r,width:a,height:l}=n.div.getBoundingClientRect();if(e>=s&&e<=s+a&&i>=r&&i<=r+l)return n}return null}disableUserSelect(e=!1){this.#V.classList.toggle("noUserSelect",e)}addShouldRescale(e){this.#p.add(e)}removeShouldRescale(e){this.#p.delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*ue.PDF_TO_CSS_UNITS;for(const i of this.#p)i.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}#U({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e}#$(e){const{currentLayer:i}=this;if(i.hasTextLayer(e))return i;for(const n of this.#n.values())if(n.hasTextLayer(e))return n;return null}highlightSelection(e=""){const i=document.getSelection();if(!i||i.isCollapsed)return;const{anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:a}=i,l=i.toString(),c=this.#U(i).closest(".textLayer"),d=this.getSelectionBoxes(c);if(!d)return;i.empty();const u=this.#$(c),f=this.#C===B.NONE,p=()=>{u?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:d,anchorNode:n,anchorOffset:s,focusNode:r,focusOffset:a,text:l}),f&&this.showAllEditors("highlight",!0,!0)};f?this.switchToMode(B.HIGHLIGHT,p):p()}#Z(){const e=document.getSelection();if(!e||e.isCollapsed)return;const n=this.#U(e).closest(".textLayer"),s=this.getSelectionBoxes(n);s&&(this.#w||=new ba(this),this.#w.show(n,s,"ltr"===this.direction))}addToAnnotationStorage(e){!e.isEmpty()&&this.#r&&!this.#r.has(e.id)&&this.#r.setValue(e.id,e)}#J(){const e=document.getSelection();if(!e||e.isCollapsed)return void(this.#M&&(this.#w?.hide(),this.#M=null,this.#O({hasSelectedText:!1})));const{anchorNode:i}=e;if(i===this.#M)return;const s=this.#U(e).closest(".textLayer");if(s){if(this.#w?.hide(),this.#M=i,this.#O({hasSelectedText:!0}),(this.#C===B.HIGHLIGHT||this.#C===B.NONE)&&(this.#C===B.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#y=this.isShiftKeyDown,!this.isShiftKeyDown)){const r=this.#C===B.HIGHLIGHT?this.#$(s):null;r?.toggleDrawing();const a=new AbortController,l=this.combinedSignal(a),h=c=>{"pointerup"===c.type&&0!==c.button||(a.abort(),r?.toggleDrawing(!0),"pointerup"===c.type&&this.#G("main_toolbar"))};window.addEventListener("pointerup",h,{signal:l}),window.addEventListener("blur",h,{signal:l})}}else this.#M&&(this.#w?.hide(),this.#M=null,this.#O({hasSelectedText:!1}))}#G(e=""){this.#C===B.HIGHLIGHT?this.highlightSelection(e):this.#f&&this.#Z()}#tt(){document.addEventListener("selectionchange",this.#J.bind(this),{signal:this._signal})}#et(){if(this.#A)return;this.#A=new AbortController;const e=this.combinedSignal(this.#A);window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})}#it(){this.#A?.abort(),this.#A=null}blur(){if(this.isShiftKeyDown=!1,this.#y&&(this.#y=!1,this.#G("main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const i of this.#v)if(i.div.contains(e)){this.#S=[i,e],i._focusEventsAllowed=!1;break}}focus(){if(!this.#S)return;const[e,i]=this.#S;this.#S=null,i.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),i.focus()}#X(){if(this.#T)return;this.#T=new AbortController;const e=this.combinedSignal(this.#T);window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})}#nt(){this.#T?.abort(),this.#T=null}#Y(){if(this.#c)return;this.#c=new AbortController;const e=this.combinedSignal(this.#c);document.addEventListener("copy",this.copy.bind(this),{signal:e}),document.addEventListener("cut",this.cut.bind(this),{signal:e}),document.addEventListener("paste",this.paste.bind(this),{signal:e})}#K(){this.#c?.abort(),this.#c=null}#st(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})}addEditListeners(){this.#X(),this.#Y()}removeEditListeners(){this.#nt(),this.#K()}dragOver(e){for(const{type:i}of e.dataTransfer.items)for(const n of this.#u)if(n.isHandlingMimeForPasting(i))return e.dataTransfer.dropEffect="copy",void e.preventDefault()}drop(e){for(const i of e.dataTransfer.items)for(const n of this.#u)if(n.isHandlingMimeForPasting(i.type))return n.paste(i,this.currentLayer),void e.preventDefault()}copy(e){if(e.preventDefault(),this.#e?.commitOrRemove(),!this.hasSelection)return;const i=[];for(const n of this.#v){const s=n.serialize(!0);s&&i.push(s)}0!==i.length&&e.clipboardData.setData("application/pdfjs",JSON.stringify(i))}cut(e){this.copy(e),this.delete()}paste(e){var i=this;return(0,x.A)(function*(){e.preventDefault();const{clipboardData:n}=e;for(const a of n.items)for(const l of i.#u)if(l.isHandlingMimeForPasting(a.type))return void l.paste(a,i.currentLayer);let s=n.getData("application/pdfjs");if(!s)return;try{s=JSON.parse(s)}catch(a){return void V(`paste: "${a.message}".`)}if(!Array.isArray(s))return;i.unselectAll();const r=i.currentLayer;try{const a=[];for(const c of s){const d=yield r.deserialize(c);if(!d)return;a.push(d)}const l=()=>{for(const c of a)i.#q(c);i.#Q(a)};i.addCommands({cmd:l,undo:()=>{for(const c of a)c.remove()},mustExec:!0})}catch(a){V(`paste: "${a.message}".`)}})()}keydown(e){!this.isShiftKeyDown&&"Shift"===e.key&&(this.isShiftKeyDown=!0),this.#C!==B.NONE&&!this.isEditorHandlingKeyboard&&o._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&"Shift"===e.key&&(this.isShiftKeyDown=!1,this.#y&&(this.#y=!1,this.#G("main_toolbar")))}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu")}}#O(e){Object.entries(e).some(([n,s])=>this.#H[n]!==s)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#H,e)}),this.#C===B.HIGHLIGHT&&!1===e.hasSelectedEditor&&this.#z([[D.HIGHLIGHT_FREE,!0]]))}#z(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})}setEditingState(e){e?(this.#et(),this.#Y(),this.#O({isEditing:this.#C!==B.NONE,isEmpty:this.#W(),hasSomethingToUndo:this.#h.hasSomethingToUndo(),hasSomethingToRedo:this.#h.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#it(),this.#K(),this.#O({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!this.#u){this.#u=e;for(const i of this.#u)this.#z(i.defaultPropertiesToUpdate)}}getId(){return this.#L.id}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){var i=this;return(0,x.A)(function*(n,s=null,r=!1){if(i.#C!==n&&(!i.#D||(yield i.#D.promise,i.#D))){if(i.#D=Promise.withResolvers(),i.#C=n,n===B.NONE)return i.setEditingState(!1),i.#at(),void i.#D.resolve();i.setEditingState(!0),yield i.#rt(),i.unselectAll();for(const a of i.#n.values())a.updateMode(n);if(!s)return r&&i.addNewEditorFromKeyboard(),void i.#D.resolve();for(const a of i.#i.values())a.annotationElementId===s?(i.setSelected(a),a.enterInEditMode()):a.unselect();i.#D.resolve()}}).apply(this,arguments)}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e!==this.#C&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:e})}updateParams(e,i){if(this.#u){switch(e){case D.CREATE:return void this.currentLayer.addNewEditor();case D.HIGHLIGHT_DEFAULT_COLOR:this.#R?.updateColor(i);break;case D.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#N||=new Map).set(e,i),this.showAllEditors("highlight",i)}for(const n of this.#v)n.updateParams(e,i);for(const n of this.#u)n.updateDefaultParams(e,i)}}showAllEditors(e,i,n=!1){for(const r of this.#i.values())r.editorType===e&&r.show(i);(this.#N?.get(D.HIGHLIGHT_SHOW_ALL)??!0)!==i&&this.#z([[D.HIGHLIGHT_SHOW_ALL,i]])}enableWaiting(e=!1){if(this.#x!==e){this.#x=e;for(const i of this.#n.values())e?i.disableClick():i.enableClick(),i.div.classList.toggle("waiting",e)}}#rt(){var e=this;return(0,x.A)(function*(){if(!e.#P){e.#P=!0;const i=[];for(const n of e.#n.values())i.push(n.enable());yield Promise.all(i);for(const n of e.#i.values())n.enable()}})()}#at(){if(this.unselectAll(),this.#P){this.#P=!1;for(const e of this.#n.values())e.disable();for(const e of this.#i.values())e.disable()}}getEditors(e){const i=[];for(const n of this.#i.values())n.pageIndex===e&&i.push(n);return i}getEditor(e){return this.#i.get(e)}addEditor(e){this.#i.set(e.id,e)}removeEditor(e){e.div.contains(document.activeElement)&&(this.#_&&clearTimeout(this.#_),this.#_=setTimeout(()=>{this.focusMainContainer(),this.#_=null},0)),this.#i.delete(e.id),this.unselect(e),(!e.annotationElementId||!this.#d.has(e.annotationElementId))&&this.#r?.remove(e.id)}addDeletedAnnotationElement(e){this.#d.add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return this.#d.has(e)}removeDeletedAnnotationElement(e){this.#d.delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}#q(e){const i=this.#n.get(e.pageIndex);i?i.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))}setActiveEditor(e){this.#e!==e&&(this.#e=e,e&&this.#z(e.propertiesToUpdate))}get#ot(){let e=null;for(e of this.#v);return e}updateUI(e){this.#ot===e&&this.#z(e.propertiesToUpdate)}toggleSelected(e){if(this.#v.has(e))return this.#v.delete(e),e.unselect(),void this.#O({hasSelectedEditor:this.hasSelection});this.#v.add(e),e.select(),this.#z(e.propertiesToUpdate),this.#O({hasSelectedEditor:!0})}setSelected(e){for(const i of this.#v)i!==e&&i.unselect();this.#v.clear(),this.#v.add(e),e.select(),this.#z(e.propertiesToUpdate),this.#O({hasSelectedEditor:!0})}isSelected(e){return this.#v.has(e)}get firstSelectedEditor(){return this.#v.values().next().value}unselect(e){e.unselect(),this.#v.delete(e),this.#O({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#v.size}get isEnterHandled(){return 1===this.#v.size&&this.firstSelectedEditor.isEnterHandled}undo(){this.#h.undo(),this.#O({hasSomethingToUndo:this.#h.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#W()})}redo(){this.#h.redo(),this.#O({hasSomethingToUndo:!0,hasSomethingToRedo:this.#h.hasSomethingToRedo(),isEmpty:this.#W()})}addCommands(e){this.#h.add(e),this.#O({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#W()})}#W(){if(0===this.#i.size)return!0;if(1===this.#i.size)for(const e of this.#i.values())return e.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const e=[...this.#v];this.addCommands({cmd:()=>{for(const s of e)s.remove()},undo:()=>{for(const s of e)this.#q(s)},mustExec:!0})}commitOrRemove(){this.#e?.commitOrRemove()}hasSomethingToControl(){return this.#e||this.hasSelection}#Q(e){for(const i of this.#v)i.unselect();this.#v.clear();for(const i of e)i.isEmpty()||(this.#v.add(i),i.select());this.#O({hasSelectedEditor:this.hasSelection})}selectAll(){for(const e of this.#v)e.commit();this.#Q(this.#i.values())}unselectAll(){if((!this.#e||(this.#e.commitOrRemove(),this.#C===B.NONE))&&this.hasSelection){for(const e of this.#v)e.unselect();this.#v.clear(),this.#O({hasSelectedEditor:!1})}}translateSelectedEditors(e,i,n=!1){if(n||this.commitOrRemove(),!this.hasSelection)return;this.#j[0]+=e,this.#j[1]+=i;const[s,r]=this.#j,a=[...this.#v];this.#F&&clearTimeout(this.#F),this.#F=setTimeout(()=>{this.#F=null,this.#j[0]=this.#j[1]=0,this.addCommands({cmd:()=>{for(const h of a)this.#i.has(h.id)&&h.translateInPage(s,r)},undo:()=>{for(const h of a)this.#i.has(h.id)&&h.translateInPage(-s,-r)},mustExec:!1})},1e3);for(const h of a)h.translateInPage(e,i)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#a=new Map;for(const e of this.#v)this.#a.set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#a)return!1;this.disableUserSelect(!1);const e=this.#a;this.#a=null;let i=!1;for(const[{x:s,y:r,pageIndex:a},l]of e)l.newX=s,l.newY=r,l.newPageIndex=a,i||=s!==l.savedX||r!==l.savedY||a!==l.savedPageIndex;if(!i)return!1;const n=(s,r,a,l)=>{if(this.#i.has(s.id)){const h=this.#n.get(l);h?s._setParentAndPosition(h,r,a):(s.pageIndex=l,s.x=r,s.y=a)}};return this.addCommands({cmd:()=>{for(const[s,{newX:r,newY:a,newPageIndex:l}]of e)n(s,r,a,l)},undo:()=>{for(const[s,{savedX:r,savedY:a,savedPageIndex:l}]of e)n(s,r,a,l)},mustExec:!0}),!0}dragSelectedEditors(e,i){if(this.#a)for(const n of this.#a.keys())n.drag(e,i)}rebuild(e){if(null===e.parent){const i=this.getLayer(e.pageIndex);i?(i.changeParent(e),i.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||1===this.#v.size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return this.#e===e}getActive(){return this.#e}getMode(){return this.#C}get imageManager(){return U(this,"imageManager",new Fi)}getSelectionBoxes(e){if(!e)return null;const i=document.getSelection();for(let c=0,d=i.rangeCount;c<d;c++)if(!e.contains(i.getRangeAt(c).commonAncestorContainer))return null;const{x:n,y:s,width:r,height:a}=e.getBoundingClientRect();let l;switch(e.getAttribute("data-main-rotation")){case"90":l=(c,d,u,f)=>({x:(d-s)/a,y:1-(c+u-n)/r,width:f/a,height:u/r});break;case"180":l=(c,d,u,f)=>({x:1-(c+u-n)/r,y:1-(d+f-s)/a,width:u/r,height:f/a});break;case"270":l=(c,d,u,f)=>({x:1-(d+f-s)/a,y:(c-n)/r,width:f/a,height:u/r});break;default:l=(c,d,u,f)=>({x:(c-n)/r,y:(d-s)/a,width:u/r,height:f/a})}const h=[];for(let c=0,d=i.rangeCount;c<d;c++){const u=i.getRangeAt(c);if(!u.collapsed)for(const{x:f,y:p,width:g,height:b}of u.getClientRects())0===g||0===b||h.push(l(f,p,g,b))}return 0===h.length?null:h}addChangedExistingAnnotation({annotationElementId:e,id:i}){(this.#l||=new Map).set(e,i)}removeChangedExistingAnnotation({annotationElementId:e}){this.#l?.delete(e)}renderAnnotationElement(e){const i=this.#l?.get(e.data.id);if(!i)return;const n=this.#r.getRawValue(i);n&&(this.#C===B.NONE&&!n.hasBeenModified||n.renderAnnotationElement(e))}}return o})(),On=(()=>{class o{#t=null;#e=!1;#i=null;#n=null;#s=null;#r=null;#l=!1;#h=null;#c=null;#o=null;#d=null;#a=!1;static#u=null;static _l10n=null;constructor(e){this.#c=e,this.#a=e._uiManager.useNewAltTextFlow,o.#u||=Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"})}static initialize(e){o._l10n??=e}render(){var e=this;return(0,x.A)(function*(){const i=e.#i=document.createElement("button");i.className="altText",i.tabIndex="0";const n=e.#n=document.createElement("span");i.append(n),e.#a?(i.classList.add("new"),i.setAttribute("data-l10n-id",o.#u.missing),n.setAttribute("data-l10n-id",o.#u["missing-label"])):(i.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),n.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const s=e.#c._uiManager._signal;i.addEventListener("contextmenu",Pt,{signal:s}),i.addEventListener("pointerdown",a=>a.stopPropagation(),{signal:s});const r=a=>{a.preventDefault(),e.#c._uiManager.editAltText(e.#c),e.#a&&e.#c._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:e.#p}})};return i.addEventListener("click",r,{capture:!0,signal:s}),i.addEventListener("keydown",a=>{a.target===i&&"Enter"===a.key&&(e.#l=!0,r(a))},{signal:s}),yield e.#f(),i})()}get#p(){return(this.#t?"added":null===this.#t&&this.guessedText&&"review")||"missing"}finish(){this.#i&&(this.#i.focus({focusVisible:this.#l}),this.#l=!1)}isEmpty(){return this.#a?null===this.#t:!this.#t&&!this.#e}hasData(){return this.#a?null!==this.#t||!!this.#o:this.isEmpty()}get guessedText(){return this.#o}setGuessedText(e){var i=this;return(0,x.A)(function*(){null===i.#t&&(i.#o=e,i.#d=yield o._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e}),i.#f())})()}toggleAltTextBadge(e=!1){if(!this.#a||this.#t)return this.#h?.remove(),void(this.#h=null);if(!this.#h){const i=this.#h=document.createElement("div");i.className="noAltTextBadge",this.#c.div.append(i)}this.#h.classList.toggle("hidden",!e)}serialize(e){let i=this.#t;return!e&&this.#o===i&&(i=this.#d),{altText:i,decorative:this.#e,guessedText:this.#o,textWithDisclaimer:this.#d}}get data(){return{altText:this.#t,decorative:this.#e}}set data({altText:e,decorative:i,guessedText:n,textWithDisclaimer:s,cancel:r=!1}){n&&(this.#o=n,this.#d=s),(this.#t!==e||this.#e!==i)&&(r||(this.#t=e,this.#e=i),this.#f())}toggle(e=!1){this.#i&&(!e&&this.#r&&(clearTimeout(this.#r),this.#r=null),this.#i.disabled=!e)}shown(){this.#c._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:this.#p}})}destroy(){this.#i?.remove(),this.#i=null,this.#n=null,this.#s=null,this.#h?.remove(),this.#h=null}#f(){var e=this;return(0,x.A)(function*(){const i=e.#i;if(!i)return;if(e.#a){if(i.classList.toggle("done",!!e.#t),i.setAttribute("data-l10n-id",o.#u[e.#p]),e.#n?.setAttribute("data-l10n-id",o.#u[`${e.#p}-label`]),!e.#t)return void e.#s?.remove()}else{if(!e.#t&&!e.#e)return i.classList.remove("done"),void e.#s?.remove();i.classList.add("done"),i.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let n=e.#s;if(!n){e.#s=n=document.createElement("span"),n.className="tooltip",n.setAttribute("role","tooltip"),n.id=`alt-text-tooltip-${e.#c.id}`;const r=100,a=e.#c._uiManager._signal;a.addEventListener("abort",()=>{clearTimeout(e.#r),e.#r=null},{once:!0}),i.addEventListener("mouseenter",()=>{e.#r=setTimeout(()=>{e.#r=null,e.#s.classList.add("show"),e.#c._reportTelemetry({action:"alt_text_tooltip"})},r)},{signal:a}),i.addEventListener("mouseleave",()=>{e.#r&&(clearTimeout(e.#r),e.#r=null),e.#s?.classList.remove("show")},{signal:a})}e.#e?n.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(n.removeAttribute("data-l10n-id"),n.textContent=e.#t),n.parentNode||i.append(n),e.#c.getImageForAltText()?.setAttribute("aria-describedby",n.id)})()}}return o})();class O{#t=null;#e=null;#i=null;#n=!1;#s=!1;#r=null;#l=null;#h=null;#c="";#o=!1;#d=null;#a=!1;#u=!1;#p=!1;#f=null;#g=0;#b=0;#m=null;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nResizer=null;#_=!1;#A=O._zIndex++;static _borderLineWidth=-1;static _colorManager=new Ni;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){const t=O.prototype._resizeWithKeyboard,e=Te.TRANSLATE_SMALL,i=Te.TRANSLATE_BIG;return U(this,"_resizerKeyboardManager",new Pe([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-i,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[i,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-i]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,i]}],[["Escape","mac+Escape"],O.prototype._stopResizingWithKeyboard]]))}constructor(t){this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null;const{rotation:e,rawDims:{pageWidth:i,pageHeight:n,pageX:s,pageY:r}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,n],this.pageTranslation=[s,r];const[a,l]=this.parentDimensions;this.x=t.x/a,this.y=t.y/l,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return U(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){const e=new ya({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){if(O._l10n??=t,O._l10nResizer||=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"}),-1!==O._borderLineWidth)return;const i=getComputedStyle(document.documentElement);O._borderLineWidth=parseFloat(i.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){X("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#_}set _isDraggable(t){this.#_=t,this.div?.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){const[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(2*t),this.y+=this.width*t/(2*e);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(2*t),this.y-=this.width*t/(2*e);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#A}setParent(t){null!==t?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):this.#N(),this.parent=t}focusin(t){this._focusEventsAllowed&&(this.#o?this.#o=!1:this.parent.setSelected(this))}focusout(t){!this._focusEventsAllowed||!this.isAttachedToDOM||t.relatedTarget?.closest(`#${this.id}`)||(t.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,i,n){const[s,r]=this.parentDimensions;[i,n]=this.screenToPageTranslation(i,n),this.x=(t+i)/s,this.y=(e+n)/r,this.fixAndSetPosition()}#E([t,e],i,n){[i,n]=this.screenToPageTranslation(i,n),this.x+=i/t,this.y+=n/e,this.fixAndSetPosition()}translate(t,e){this.#E(this.parentDimensions,t,e)}translateInPage(t,e){this.#d||=[this.x,this.y],this.#E(this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){this.#d||=[this.x,this.y];const[i,n]=this.parentDimensions;if(this.x+=t/i,this.y+=e/n,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:h,y:c}=this.div.getBoundingClientRect();this.parent.findNewParent(this,h,c)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:s,y:r}=this;const[a,l]=this.getBaseTranslation();s+=a,r+=l,this.div.style.left=`${(100*s).toFixed(2)}%`,this.div.style.top=`${(100*r).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!this.#d&&(this.#d[0]!==this.x||this.#d[1]!==this.y)}getBaseTranslation(){const[t,e]=this.parentDimensions,{_borderLineWidth:i}=O,n=i/t,s=i/e;switch(this.rotation){case 90:return[-n,s];case 180:return[n,s];case 270:return[n,-s];default:return[-n,-s]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){const[e,i]=this.pageDimensions;let{x:n,y:s,width:r,height:a}=this;if(r*=e,a*=i,n*=e,s*=i,this._mustFixPosition)switch(t){case 0:n=Math.max(0,Math.min(e-r,n)),s=Math.max(0,Math.min(i-a,s));break;case 90:n=Math.max(0,Math.min(e-a,n)),s=Math.min(i,Math.max(r,s));break;case 180:n=Math.min(e,Math.max(r,n)),s=Math.min(i,Math.max(a,s));break;case 270:n=Math.min(e,Math.max(a,n)),s=Math.max(0,Math.min(i-r,s))}this.x=n/=e,this.y=s/=i;const[l,h]=this.getBaseTranslation();n+=l,s+=h;const{style:c}=this.div;c.left=`${(100*n).toFixed(2)}%`,c.top=`${(100*s).toFixed(2)}%`,this.moveInDOM()}static#y(t,e,i){switch(i){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}screenToPageTranslation(t,e){return O.#y(t,e,this.parentRotation)}pageTranslationToScreen(t,e){return O.#y(t,e,360-this.parentRotation)}#w(t){switch(t){case 90:{const[e,i]=this.pageDimensions;return[0,-e/i,i/e,0]}case 180:return[-1,0,0,-1];case 270:{const[e,i]=this.pageDimensions;return[0,e/i,-i/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(){const{parentScale:t,pageDimensions:[e,i]}=this;return[e*t,i*t]}setDims(t,e){const[i,n]=this.parentDimensions;this.div.style.width=`${(100*t/i).toFixed(2)}%`,this.#s||(this.div.style.height=`${(100*e/n).toFixed(2)}%`)}fixDims(){const{style:t}=this.div,{height:e,width:i}=t,n=i.endsWith("%"),s=!this.#s&&e.endsWith("%");if(n&&s)return;const[r,a]=this.parentDimensions;n||(t.width=`${(100*parseFloat(i)/r).toFixed(2)}%`),!this.#s&&!s&&(t.height=`${(100*parseFloat(e)/a).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#L(){if(this.#r)return;this.#r=document.createElement("div"),this.#r.classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(const i of t){const n=document.createElement("div");this.#r.append(n),n.classList.add("resizer",i),n.setAttribute("data-resizer-name",i),n.addEventListener("pointerdown",this.#P.bind(this,i),{signal:e}),n.addEventListener("contextmenu",Pt,{signal:e}),n.tabIndex=-1}this.div.prepend(this.#r)}#P(t,e){e.preventDefault();const{isMac:i}=bt.platform;if(0!==e.button||e.ctrlKey&&i)return;this.#i?.toggle(!1);const n=this._isDraggable;this._isDraggable=!1;const s=new AbortController,r=this._uiManager.combinedSignal(s);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",this.#T.bind(this,t),{passive:!0,capture:!0,signal:r}),window.addEventListener("contextmenu",Pt,{signal:r});const a=this.x,l=this.y,h=this.width,c=this.height,d=this.parent.div.style.cursor,u=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const f=()=>{s.abort(),this.parent.togglePointerEvents(!0),this.#i?.toggle(!0),this._isDraggable=n,this.parent.div.style.cursor=d,this.div.style.cursor=u,this.#x(a,l,h,c)};window.addEventListener("pointerup",f,{signal:r}),window.addEventListener("blur",f,{signal:r})}#x(t,e,i,n){const s=this.x,r=this.y,a=this.width,l=this.height;s===t&&r===e&&a===i&&l===n||this.addCommands({cmd:()=>{this.width=a,this.height=l,this.x=s,this.y=r;const[h,c]=this.parentDimensions;this.setDims(h*a,c*l),this.fixAndSetPosition()},undo:()=>{this.width=i,this.height=n,this.x=t,this.y=e;const[h,c]=this.parentDimensions;this.setDims(h*i,c*n),this.fixAndSetPosition()},mustExec:!0})}#T(t,e){const[i,n]=this.parentDimensions,s=this.x,r=this.y,a=this.width,l=this.height,h=O.MIN_SIZE/i,c=O.MIN_SIZE/n,d=k=>Math.round(1e4*k)/1e4,u=this.#w(this.rotation),f=(k,j)=>[u[0]*k+u[2]*j,u[1]*k+u[3]*j],p=this.#w(360-this.rotation);let b,m,v=!1,A=!1;switch(t){case"topLeft":v=!0,b=(k,j)=>[0,0],m=(k,j)=>[k,j];break;case"topMiddle":b=(k,j)=>[k/2,0],m=(k,j)=>[k/2,j];break;case"topRight":v=!0,b=(k,j)=>[k,0],m=(k,j)=>[0,j];break;case"middleRight":A=!0,b=(k,j)=>[k,j/2],m=(k,j)=>[0,j/2];break;case"bottomRight":v=!0,b=(k,j)=>[k,j],m=(k,j)=>[0,0];break;case"bottomMiddle":b=(k,j)=>[k/2,j],m=(k,j)=>[k/2,0];break;case"bottomLeft":v=!0,b=(k,j)=>[0,j],m=(k,j)=>[k,0];break;case"middleLeft":A=!0,b=(k,j)=>[0,j/2],m=(k,j)=>[k,j/2]}const w=b(a,l),E=m(a,l);let C=f(...E);const M=d(s+C[0]),T=d(r+C[1]);let y=1,S=1,[L,z]=this.screenToPageTranslation(e.movementX,e.movementY);if([L,z]=[p[0]*(k=L/i)+p[2]*(j=z/n),p[1]*k+p[3]*j],v){const k=Math.hypot(a,l);y=S=Math.max(Math.min(Math.hypot(E[0]-w[0]-L,E[1]-w[1]-z)/k,1/a,1/l),h/a,c/l)}else A?y=Math.max(h,Math.min(1,Math.abs(E[0]-w[0]-L)))/a:S=Math.max(c,Math.min(1,Math.abs(E[1]-w[1]-z)))/l;var k,j;const H=d(a*y),W=d(l*S);C=f(...m(H,W));const $=M-C[0],et=T-C[1];this.width=H,this.height=W,this.x=$,this.y=et,this.setDims(i*H,n*W),this.fixAndSetPosition()}altTextFinish(){this.#i?.finish()}addEditToolbar(){var t=this;return(0,x.A)(function*(){return t._editToolbar||t.#u||(t._editToolbar=new Se(t),t.div.append(t._editToolbar.render()),t.#i&&(yield t._editToolbar.addAltText(t.#i))),t._editToolbar})()}removeEditToolbar(){this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,this.#i?.destroy())}addContainer(t){const e=this._editToolbar?.div;e?e.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}addAltTextButton(){var t=this;return(0,x.A)(function*(){t.#i||(On.initialize(O._l10n),t.#i=new On(t),t.#t&&(t.#i.data=t.#t,t.#t=null),yield t.addEditToolbar())})()}get altTextData(){return this.#i?.data}set altTextData(t){this.#i&&(this.#i.data=t)}get guessedAltText(){return this.#i?.guessedText}setGuessedAltText(t){var e=this;return(0,x.A)(function*(){yield e.#i?.setGuessedText(t)})()}serializeAltText(t){return this.#i?.serialize(t)}hasAltText(){return!!this.#i&&!this.#i.isEmpty()}hasAltTextData(){return this.#i?.hasData()??!1}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.tabIndex=this.#n?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),this.#k();const[t,e]=this.parentDimensions;this.parentRotation%180!=0&&(this.div.style.maxWidth=`${(100*e/t).toFixed(2)}%`,this.div.style.maxHeight=`${(100*t/e).toFixed(2)}%`);const[i,n]=this.getInitialTranslation();return this.translate(i,n),ti(this,this.div,["pointerdown"]),this.div}pointerdown(t){const{isMac:e}=bt.platform;0!==t.button||t.ctrlKey&&e?t.preventDefault():(this.#o=!0,this._isDraggable?this.#R(t):this.#S(t))}get isSelected(){return this._uiManager.isSelected(this)}#S(t){const{isMac:e}=bt.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}#R(t){const{isSelected:e}=this;this._uiManager.setUpDragSession();const i=new AbortController,n=this._uiManager.combinedSignal(i);e&&(this.div.classList.add("moving"),this.#g=t.clientX,this.#b=t.clientY,window.addEventListener("pointermove",a=>{const{clientX:l,clientY:h}=a,[c,d]=this.screenToPageTranslation(l-this.#g,h-this.#b);this.#g=l,this.#b=h,this._uiManager.dragSelectedEditors(c,d)},{passive:!0,capture:!0,signal:n}));const s=()=>{i.abort(),e&&this.div.classList.remove("moving"),this.#o=!1,this._uiManager.endDragSession()||this.#S(t)};window.addEventListener("pointerup",s,{signal:n}),window.addEventListener("blur",s,{signal:n})}moveInDOM(){this.#f&&clearTimeout(this.#f),this.#f=setTimeout(()=>{this.#f=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(t,e,i){t.changeParent(this),this.x=e,this.y=i,this.fixAndSetPosition()}getRect(t,e,i=this.rotation){const n=this.parentScale,[s,r]=this.pageDimensions,[a,l]=this.pageTranslation,h=t/n,c=e/n,d=this.x*s,u=this.y*r,f=this.width*s,p=this.height*r;switch(i){case 0:return[d+h+a,r-u-c-p+l,d+h+f+a,r-u-c+l];case 90:return[d+c+a,r-u+h+l,d+c+p+a,r-u+h+f+l];case 180:return[d-h-f+a,r-u+c+l,d-h+a,r-u+c+p+l];case 270:return[d-c-p+a,r-u-h-f+l,d-c+a,r-u-h+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){const[i,n,s,r]=t,a=s-i,l=r-n;switch(this.rotation){case 0:return[i,e-r,a,l];case 90:return[i,e-n,l,a];case 180:return[s,e-n,a,l];case 270:return[s,e-r,l,a];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#u=!0}disableEditMode(){this.#u=!1}isInEditMode(){return this.#u}shouldGetKeyboardEvents(){return this.#p}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}#k(){if(this.#h||!this.div)return;this.#h=new AbortController;const t=this._uiManager.combinedSignal(this.#h);this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})}rebuild(){this.#k()}rotate(t){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(t=!1,e=null){X("An editor must be serializable")}static deserialize(t,e,i){var n=this;return(0,x.A)(function*(){const s=new n.prototype.constructor({parent:e,id:e.getNextId(),uiManager:i});s.rotation=t.rotation,s.#t=t.accessibilityData;const[r,a]=s.pageDimensions,[l,h,c,d]=s.getRectInCurrentCoords(t.rect,a);return s.x=l/r,s.y=h/a,s.width=c/r,s.height=d/a,s})()}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}remove(){if(this.#h?.abort(),this.#h=null,this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#f&&(clearTimeout(this.#f),this.#f=null),this.#N(),this.removeEditToolbar(),this.#m){for(const t of this.#m.values())clearTimeout(t);this.#m=null}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#L(),this.#r.classList.remove("hidden"),ti(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||"Enter"!==t.key)return;this._uiManager.setSelected(this),this.#l={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const e=this.#r.children;if(!this.#e){this.#e=Array.from(e);const r=this.#C.bind(this),a=this.#v.bind(this),l=this._uiManager._signal;for(const h of this.#e){const c=h.getAttribute("data-resizer-name");h.setAttribute("role","spinbutton"),h.addEventListener("keydown",r,{signal:l}),h.addEventListener("blur",a,{signal:l}),h.addEventListener("focus",this.#M.bind(this,c),{signal:l}),h.setAttribute("data-l10n-id",O._l10nResizer[c])}}const i=this.#e[0];let n=0;for(const r of e){if(r===i)break;n++}const s=(360-this.rotation+this.parentRotation)%360/90*(this.#e.length/4);if(s!==n){if(s<n)for(let a=0;a<n-s;a++)this.#r.append(this.#r.firstChild);else if(s>n)for(let a=0;a<s-n;a++)this.#r.firstChild.before(this.#r.lastChild);let r=0;for(const a of e){const h=this.#e[r++].getAttribute("data-resizer-name");a.setAttribute("data-l10n-id",O._l10nResizer[h])}}this.#I(0),this.#p=!0,this.#r.firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#C(t){O._resizerKeyboardManager.exec(this,t)}#v(t){this.#p&&t.relatedTarget?.parentNode!==this.#r&&this.#N()}#M(t){this.#c=this.#p?t:""}#I(t){if(this.#e)for(const e of this.#e)e.tabIndex=t}_resizeWithKeyboard(t,e){this.#p&&this.#T(this.#c,{movementX:t,movementY:e})}#N(){if(this.#p=!1,this.#I(-1),this.#l){const{savedX:t,savedY:e,savedWidth:i,savedHeight:n}=this.#l;this.#x(t,e,i,n),this.#l=null}}_stopResizingWithKeyboard(){this.#N(),this.div.focus()}select(){this.makeResizable(),this.div?.classList.add("selectedEditor"),this._editToolbar?(this._editToolbar?.show(),this.#i?.toggleAltTextBadge(!1)):this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()})}unselect(){this.#r?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),this.#i?.toggleAltTextBadge(!0)}updateParams(t,e){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return this.#a}set isEditing(t){this.#a=t,this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){this.#s=!0;const i=t/e,{style:n}=this.div;n.aspectRatio=i,n.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t,e=!1){if(e){this.#m||=new Map;const{action:i}=t;let n=this.#m.get(i);return n&&clearTimeout(n),n=setTimeout(()=>{this._reportTelemetry(t),this.#m.delete(i),0===this.#m.size&&(this.#m=null)},O._telemetryTimeout),void this.#m.set(i,n)}t.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),this.#n=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#n=!0}renderAnnotationElement(t){let e=t.container.querySelector(".annotationContent");if(e){if("CANVAS"===e.nodeName){const i=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),i.before(e)}}else e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);return e}resetAnnotationElement(t){const{firstChild:e}=t.container;"DIV"===e?.nodeName&&e.classList.contains("annotationContent")&&e.remove()}}class ya extends O{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const Fn=3285377520,Tt=4294901760,Ft=65535;class Nn{constructor(t){this.h1=t?4294967295&t:Fn,this.h2=t?4294967295&t:Fn}update(t){let e,i;if("string"==typeof t){e=new Uint8Array(2*t.length),i=0;for(let g=0,b=t.length;g<b;g++){const m=t.charCodeAt(g);m<=255?e[i++]=m:(e[i++]=m>>>8,e[i++]=255&m)}}else{if(!ArrayBuffer.isView(t))throw new Error("Invalid data format, must be a string or TypedArray.");e=t.slice(),i=e.byteLength}const n=i>>2,s=i-4*n,r=new Uint32Array(e.buffer,0,n);let a=0,l=0,h=this.h1,c=this.h2;const d=3432918353,u=461845907,f=d&Ft,p=u&Ft;for(let g=0;g<n;g++)1&g?(a=r[g],a=a*d&Tt|a*f&Ft,a=a<<15|a>>>17,a=a*u&Tt|a*p&Ft,h^=a,h=h<<13|h>>>19,h=5*h+3864292196):(l=r[g],l=l*d&Tt|l*f&Ft,l=l<<15|l>>>17,l=l*u&Tt|l*p&Ft,c^=l,c=c<<13|c>>>19,c=5*c+3864292196);switch(a=0,s){case 3:a^=e[4*n+2]<<16;case 2:a^=e[4*n+1]<<8;case 1:a^=e[4*n],a=a*d&Tt|a*f&Ft,a=a<<15|a>>>17,a=a*u&Tt|a*p&Ft,1&n?h^=a:c^=a}this.h1=h,this.h2=c}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=3981806797*t&Tt|36045*t&Ft,e=4283543511*e&Tt|(2950163797*(e<<16|t>>>16)&Tt)>>>16,t^=e>>>1,t=444984403*t&Tt|60499*t&Ft,e=3301882366*e&Tt|(3120437893*(e<<16|t>>>16)&Tt)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}const Bi=Object.freeze({map:null,hash:"",transfer:void 0});class Vi{#t=!1;#e=null;#i=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){const i=this.#i.get(t);return void 0===i?e:Object.assign(e,i)}getRawValue(t){return this.#i.get(t)}remove(t){if(this.#i.delete(t),0===this.#i.size&&this.resetModified(),"function"==typeof this.onAnnotationEditor){for(const e of this.#i.values())if(e instanceof O)return;this.onAnnotationEditor(null)}}setValue(t,e){const i=this.#i.get(t);let n=!1;if(void 0!==i)for(const[s,r]of Object.entries(e))i[s]!==r&&(n=!0,i[s]=r);else n=!0,this.#i.set(t,e);n&&this.#n(),e instanceof O&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(e.constructor._type)}has(t){return this.#i.has(t)}getAll(){return this.#i.size>0?Ti(this.#i):null}setAll(t){for(const[e,i]of Object.entries(t))this.setValue(e,i)}get size(){return this.#i.size}#n(){this.#t||(this.#t=!0,"function"==typeof this.onSetModified&&this.onSetModified())}resetModified(){this.#t&&(this.#t=!1,"function"==typeof this.onResetModified&&this.onResetModified())}get print(){return new Bn(this)}get serializable(){if(0===this.#i.size)return Bi;const t=new Map,e=new Nn,i=[],n=Object.create(null);let s=!1;for(const[r,a]of this.#i){const l=a instanceof O?a.serialize(!1,n):a;l&&(t.set(r,l),e.update(`${r}:${JSON.stringify(l)}`),s||=!!l.bitmap)}if(s)for(const r of t.values())r.bitmap&&i.push(r.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:i}:Bi}get editorStats(){let t=null;const e=new Map;for(const i of this.#i.values()){if(!(i instanceof O))continue;const n=i.telemetryFinalData;if(!n)continue;const{type:s}=n;e.has(s)||e.set(s,Object.getPrototypeOf(i).constructor),t||=Object.create(null);const r=t[s]||=new Map;for(const[a,l]of Object.entries(n)){if("type"===a)continue;let h=r.get(a);h||(h=new Map,r.set(a,h));const c=h.get(l)??0;h.set(l,c+1)}}for(const[i,n]of e)t[i]=n.computeTelemetryFinalData(t[i]);return t}resetModifiedIds(){this.#e=null}get modifiedIds(){if(this.#e)return this.#e;const t=[];for(const e of this.#i.values())!(e instanceof O)||!e.annotationElementId||!e.serialize()||t.push(e.annotationElementId);return this.#e={ids:new Set(t),hash:t.join(",")}}}class Bn extends Vi{#t;constructor(t){super();const{map:e,hash:i,transfer:n}=t.serializable,s=structuredClone(e,n?{transfer:n}:null);this.#t={map:s,hash:i,transfer:n}}get print(){X("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#t}get modifiedIds(){return U(this,"modifiedIds",{ids:new Set,hash:""})}}class wa{#t=new Set;constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(const t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),this.#t.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}loadSystemFont(t){var e=this;return(0,x.A)(function*({systemFontInfo:i,_inspectFont:n}){if(i&&!e.#t.has(i.loadedName)){if(lt(!e.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),e.isFontLoadingAPISupported){const{loadedName:s,src:r,style:a}=i,l=new FontFace(s,r,a);e.addNativeFontFace(l);try{yield l.load(),e.#t.add(s),n?.(i)}catch{V(`Cannot load system font: ${i.baseFontName}, installing it could help to improve PDF rendering.`),e.removeNativeFontFace(l)}return}X("Not implemented: loadSystemFont without the Font Loading API.")}}).apply(this,arguments)}bind(t){var e=this;return(0,x.A)(function*(){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo)return void(yield e.loadSystemFont(t));if(e.isFontLoadingAPISupported){const n=t.createNativeFontFace();if(n){e.addNativeFontFace(n);try{yield n.loaded}catch(s){throw V(`Failed to load font '${n.family}': '${s}'.`),t.disableFontFace=!0,s}}return}const i=t.createFontFaceRule();if(i){if(e.insertRule(i),e.isSyncFontLoadingSupported)return;yield new Promise(n=>{const s=e._queueLoadingCallback(n);e._prepareFontLoadEvent(t,s)})}})()}get isFontLoadingAPISupported(){return U(this,"isFontLoadingAPISupported",!!this._document?.fonts)}get isSyncFontLoadingSupported(){let t=!1;return(ft||typeof navigator<"u"&&"string"==typeof navigator?.userAgent&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(t=!0),U(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){const{loadingRequests:i}=this,n={done:!1,complete:function e(){for(lt(!n.done,"completeRequest() cannot be called twice."),n.done=!0;i.length>0&&i[0].done;){const s=i.shift();setTimeout(s.callback,0)}},callback:t};return i.push(n),n}get _loadTestFont(){return U(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(t,e){function i(w,E){return w.charCodeAt(E)<<24|w.charCodeAt(E+1)<<16|w.charCodeAt(E+2)<<8|255&w.charCodeAt(E+3)}function n(w,E,C,M){return w.substring(0,E)+M+w.substring(E+C)}let s,r;const a=this._document.createElement("canvas");a.width=1,a.height=1;const l=a.getContext("2d");let h=0;const d=`lt${Date.now()}${this.loadTestFontId++}`;let u=this._loadTestFont;u=n(u,976,d.length,d);const g=1482184792;let b=i(u,16);for(s=0,r=d.length-3;s<r;s+=4)b=b-g+i(d,s)|0;s<d.length&&(b=b-g+i(d+"XXX",s)|0),u=n(u,16,4,function ra(o){return String.fromCharCode(o>>24&255,o>>16&255,o>>8&255,255&o)}(b));const m=`url(data:font/opentype;base64,${btoa(u)});`;this.insertRule(`@font-face {font-family:"${d}";src:${m}}`);const A=this._document.createElement("div");A.style.visibility="hidden",A.style.width=A.style.height="10px",A.style.position="absolute",A.style.top=A.style.left="0px";for(const w of[t.loadedName,d]){const E=this._document.createElement("span");E.textContent="Hi",E.style.fontFamily=w,A.append(E)}this._document.body.append(A),function c(w,E){if(++h>30)return V("Load test font never loaded."),void E();l.font="30px "+w,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0?E():setTimeout(c.bind(null,w,E))}(d,()=>{A.remove(),e.complete()})}}class Ea{constructor(t,{disableFontFace:e=!1,inspectFont:i=null}){this.compiledGlyphs=Object.create(null);for(const n in t)this[n]=t[n];this.disableFontFace=!0===e,this._inspectFont=i}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let t;if(this.cssFontInfo){const e={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(e.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,e)}else t=new FontFace(this.loadedName,this.data,{});return this._inspectFont?.(this),t}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const t=`url(data:${this.mimetype};base64,${function ua(o){return Uint8Array.prototype.toBase64?o.toBase64():btoa(Ln(o))}(this.data)});`;let e;if(this.cssFontInfo){let i=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(i+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),e=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${i}src:${t}}`}else e=`@font-face {font-family:"${this.loadedName}";src:${t}}`;return this._inspectFont?.(this,t),e}getPathGenerator(t,e){if(void 0!==this.compiledGlyphs[e])return this.compiledGlyphs[e];let i;try{i=t.get(this.loadedName+"_path_"+e)}catch(s){V(`getPathGenerator - ignoring character: "${s}".`)}if(!Array.isArray(i)||0===i.length)return this.compiledGlyphs[e]=function(s,r){};const n=[];for(let s=0,r=i.length;s<r;)switch(i[s++]){case 0:{const[a,l,h,c,d,u]=i.slice(s,s+6);n.push(f=>f.bezierCurveTo(a,l,h,c,d,u)),s+=6}break;case 1:{const[a,l]=i.slice(s,s+2);n.push(h=>h.moveTo(a,l)),s+=2}break;case 2:{const[a,l]=i.slice(s,s+2);n.push(h=>h.lineTo(a,l)),s+=2}break;case 3:{const[a,l,h,c]=i.slice(s,s+4);n.push(d=>d.quadraticCurveTo(a,l,h,c)),s+=4}break;case 4:n.push(a=>a.restore());break;case 5:n.push(a=>a.save());break;case 6:lt(2===n.length,"Scale command is only valid at the third position.");break;case 7:{const[a,l,h,c,d,u]=i.slice(s,s+6);n.push(f=>f.transform(a,l,h,c,d,u)),s+=6}break;case 8:{const[a,l]=i.slice(s,s+2);n.push(h=>h.translate(a,l)),s+=2}}return this.compiledGlyphs[e]=function(r,a){n[0](r),n[1](r),r.scale(a,-a);for(let l=2,h=n.length;l<h;l++)n[l](r)}}}class Vn{#t=!1;constructor({enableHWA:t=!1}){this.#t=t}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");const i=this._createCanvas(t,e);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!this.#t})}}reset(t,e,i){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||i<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=i}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){X("Abstract method `_createCanvas` called.")}}class jn{constructor({baseUrl:t=null,isCompressed:e=!0}){this.baseUrl=t,this.isCompressed=e}fetch(t){var e=this;return(0,x.A)(function*({name:i}){if(!e.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!i)throw new Error("CMap name must be specified.");const n=e.baseUrl+i+(e.isCompressed?".bcmap":"");return e._fetch(n).then(s=>({cMapData:s,isCompressed:e.isCompressed})).catch(s=>{throw new Error(`Unable to load ${e.isCompressed?"binary ":""}CMap at: ${n}`)})}).apply(this,arguments)}_fetch(t){return(0,x.A)(function*(){X("Abstract method `_fetch` called.")})()}}class Hn extends jn{_fetch(t){var e=this;return(0,x.A)(function*(){const i=yield Ze(t,e.isCompressed?"arraybuffer":"text");return i instanceof ArrayBuffer?new Uint8Array(i):de(i)})()}}class zn{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,i,n,s){return"none"}destroy(t=!1){}}class Wn{constructor({baseUrl:t=null}){this.baseUrl=t}fetch(t){var e=this;return(0,x.A)(function*({filename:i}){if(!e.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!i)throw new Error("Font filename must be specified.");const n=`${e.baseUrl}${i}`;return e._fetch(n).catch(s=>{throw new Error(`Unable to load font data at: ${n}`)})}).apply(this,arguments)}_fetch(t){return(0,x.A)(function*(){X("Abstract method `_fetch` called.")})()}}class Un extends Wn{_fetch(t){return(0,x.A)(function*(){const e=yield Ze(t,"arraybuffer");return new Uint8Array(e)})()}}if(ft){var ji=Promise.withResolvers(),Hi=null;(function(){var t=(0,x.A)(function*(){const e=yield import("fs"),i=yield import("http"),n=yield import("https"),s=yield import("url");return new Map(Object.entries({fs:e,http:i,https:n,url:s,canvas:void 0,path2d:void 0}))});return function(){return t.apply(this,arguments)}})()().then(t=>{Hi=t,ji.resolve()},t=>{V(`loadPackages: ${t}`),Hi=new Map,ji.resolve()})}class Zt{static get promise(){return ji.promise}static get(t){return Hi?.get(t)}}function Gn(o){return zi.apply(this,arguments)}function zi(){return(zi=(0,x.A)(function*(o){const e=yield Zt.get("fs").promises.readFile(o);return new Uint8Array(e)})).apply(this,arguments)}function Wi(o,t){if(!t)return;const e=t[2]-t[0],i=t[3]-t[1],n=new Path2D;n.rect(t[0],t[1],e,i),o.clip(n)}class Ui{getPattern(){X("Abstract method `getPattern` called.")}}class La extends Ui{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}_createGradient(t){let e;"axial"===this._type?e=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(e=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const i of this._colorStops)e.addColorStop(i[0],i[1]);return e}getPattern(t,e,i,n){let s;if("Stroke"===n||"Fill"===n){const r=e.current.getClippedPathBoundingBox(n,K(t))||[0,0,0,0],a=Math.ceil(r[2]-r[0])||1,l=Math.ceil(r[3]-r[1])||1,h=e.cachedCanvases.getCanvas("pattern",a,l),c=h.context;c.clearRect(0,0,c.canvas.width,c.canvas.height),c.beginPath(),c.rect(0,0,c.canvas.width,c.canvas.height),c.translate(-r[0],-r[1]),i=I.transform(i,[1,0,0,1,r[0],r[1]]),c.transform(...e.baseTransform),this.matrix&&c.transform(...this.matrix),Wi(c,this._bbox),c.fillStyle=this._createGradient(c),c.fill(),s=t.createPattern(h.canvas,"no-repeat");const d=new DOMMatrix(i);s.setTransform(d)}else Wi(t,this._bbox),s=this._createGradient(t);return s}}function Gi(o,t,e,i,n,s,r,a){const l=t.coords,h=t.colors,c=o.data,d=4*o.width;let u;l[e+1]>l[i+1]&&(u=e,e=i,i=u,u=s,s=r,r=u),l[i+1]>l[n+1]&&(u=i,i=n,n=u,u=r,r=a,a=u),l[e+1]>l[i+1]&&(u=e,e=i,i=u,u=s,s=r,r=u);const f=(l[e]+t.offsetX)*t.scaleX,p=(l[e+1]+t.offsetY)*t.scaleY,g=(l[i]+t.offsetX)*t.scaleX,b=(l[i+1]+t.offsetY)*t.scaleY,m=(l[n]+t.offsetX)*t.scaleX,v=(l[n+1]+t.offsetY)*t.scaleY;if(p>=v)return;const A=h[s],w=h[s+1],E=h[s+2],C=h[r],M=h[r+1],T=h[r+2],y=h[a],S=h[a+1],L=h[a+2],z=Math.round(p),H=Math.round(v);let W,$,et,k,j,te,ce,Lt;for(let dt=z;dt<=H;dt++){if(dt<b){const Y=dt<p?0:(p-dt)/(p-b);W=f-(f-g)*Y,$=A-(A-C)*Y,et=w-(w-M)*Y,k=E-(E-T)*Y}else{let Y;Y=dt>v?1:b===v?0:(b-dt)/(b-v),W=g-(g-m)*Y,$=C-(C-y)*Y,et=M-(M-S)*Y,k=T-(T-L)*Y}let at;at=dt<p?0:dt>v?1:(p-dt)/(p-v),j=f-(f-m)*at,te=A-(A-y)*at,ce=w-(w-S)*at,Lt=E-(E-L)*at;const ye=Math.round(Math.min(W,j)),We=Math.round(Math.max(W,j));let Rt=d*dt+4*ye;for(let Y=ye;Y<=We;Y++)at=(W-Y)/(W-j),at<0?at=0:at>1&&(at=1),c[Rt++]=$-($-te)*at|0,c[Rt++]=et-(et-ce)*at|0,c[Rt++]=k-(k-Lt)*at|0,c[Rt++]=255}}function Ra(o,t,e){const i=t.coords,n=t.colors;let s,r;switch(t.type){case"lattice":const a=t.verticesPerRow,l=Math.floor(i.length/a)-1,h=a-1;for(s=0;s<l;s++){let c=s*a;for(let d=0;d<h;d++,c++)Gi(o,e,i[c],i[c+1],i[c+a],n[c],n[c+1],n[c+a]),Gi(o,e,i[c+a+1],i[c+1],i[c+a],n[c+a+1],n[c+1],n[c+a])}break;case"triangles":for(s=0,r=i.length;s<r;s+=3)Gi(o,e,i[s],i[s+1],i[s+2],n[s],n[s+1],n[s+2]);break;default:throw new Error("illegal figure")}}class Ia extends Ui{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[7],this._background=t[8],this.matrix=null}_createMeshCanvas(t,e,i){const a=Math.floor(this._bounds[0]),l=Math.floor(this._bounds[1]),h=Math.ceil(this._bounds[2])-a,c=Math.ceil(this._bounds[3])-l,d=Math.min(Math.ceil(Math.abs(h*t[0]*1.1)),3e3),u=Math.min(Math.ceil(Math.abs(c*t[1]*1.1)),3e3),f=h/d,p=c/u,g={coords:this._coords,colors:this._colors,offsetX:-a,offsetY:-l,scaleX:1/f,scaleY:1/p},v=i.getCanvas("mesh",d+4,u+4),A=v.context,w=A.createImageData(d,u);if(e){const C=w.data;for(let M=0,T=C.length;M<T;M+=4)C[M]=e[0],C[M+1]=e[1],C[M+2]=e[2],C[M+3]=255}for(const C of this._figures)Ra(w,C,g);return A.putImageData(w,2,2),{canvas:v.canvas,offsetX:a-2*f,offsetY:l-2*p,scaleX:f,scaleY:p}}getPattern(t,e,i,n){let s;if(Wi(t,this._bbox),"Shading"===n)s=I.singularValueDecompose2dScale(K(t));else if(s=I.singularValueDecompose2dScale(e.baseTransform),this.matrix){const a=I.singularValueDecompose2dScale(this.matrix);s=[s[0]*a[0],s[1]*a[1]]}const r=this._createMeshCanvas(s,"Shading"===n?null:this._background,e.cachedCanvases);return"Shading"!==n&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(r.offsetX,r.offsetY),t.scale(r.scaleX,r.scaleY),t.createPattern(r.canvas,"no-repeat")}}class ka extends Ui{getPattern(){return"hotpink"}}let Oa=(()=>{class o{static MAX_PATTERN_SIZE=3e3;constructor(e,i,n,s,r){this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.color=i,this.ctx=n,this.canvasGraphicsFactory=s,this.baseTransform=r}createPatternCanvas(e){const{bbox:i,operatorList:n,paintType:s,tilingType:r,color:a,canvasGraphicsFactory:l}=this;let{xstep:h,ystep:c}=this;h=Math.abs(h),c=Math.abs(c),Ke("TilingType: "+r);const d=i[0],u=i[1],f=i[2],p=i[3],g=f-d,b=p-u,m=I.singularValueDecompose2dScale(this.matrix),v=I.singularValueDecompose2dScale(this.baseTransform),A=m[0]*v[0],w=m[1]*v[1];let E=g,C=b,M=!1,T=!1;const y=Math.ceil(h*A),S=Math.ceil(c*w);y>=Math.ceil(g*A)?E=h:M=!0,S>=Math.ceil(b*w)?C=c:T=!0;const H=this.getSizeAndScale(E,this.ctx.canvas.width,A),W=this.getSizeAndScale(C,this.ctx.canvas.height,w),$=e.cachedCanvases.getCanvas("pattern",H.size,W.size),et=$.context,k=l.createCanvasGraphics(et);if(k.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(k,s,a),et.translate(-H.scale*d,-W.scale*u),k.transform(H.scale,0,0,W.scale,0,0),et.save(),this.clipBbox(k,d,u,f,p),k.baseTransform=K(k.ctx),k.executeOperatorList(n),k.endDrawing(),et.restore(),M||T){const j=$.canvas;M&&(E=h),T&&(C=c);const te=this.getSizeAndScale(E,this.ctx.canvas.width,A),ce=this.getSizeAndScale(C,this.ctx.canvas.height,w),Lt=te.size,dt=ce.size,at=e.cachedCanvases.getCanvas("pattern-workaround",Lt,dt),ye=at.context,We=M?Math.floor(g/h):0,Rt=T?Math.floor(b/c):0;for(let Y=0;Y<=We;Y++)for(let Kt=0;Kt<=Rt;Kt++)ye.drawImage(j,Lt*Y,dt*Kt,Lt,dt,0,0,Lt,dt);return{canvas:at.canvas,scaleX:te.scale,scaleY:ce.scale,offsetX:d,offsetY:u}}return{canvas:$.canvas,scaleX:H.scale,scaleY:W.scale,offsetX:d,offsetY:u}}getSizeAndScale(e,i,n){const s=Math.max(o.MAX_PATTERN_SIZE,i);let r=Math.ceil(e*n);return r>=s?r=s:n=r/e,{scale:n,size:r}}clipBbox(e,i,n,s,r){e.ctx.rect(i,n,s-i,r-n),e.current.updateRectMinMax(K(e.ctx),[i,n,s,r]),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,i,n){const s=e.ctx,r=e.current;switch(i){case 1:const a=this.ctx;s.fillStyle=a.fillStyle,s.strokeStyle=a.strokeStyle,r.fillColor=a.fillStyle,r.strokeColor=a.strokeStyle;break;case 2:const l=I.makeHexColor(n[0],n[1],n[2]);s.fillStyle=l,s.strokeStyle=l,r.fillColor=l,r.strokeColor=l;break;default:throw new sa(`Unsupported paint type: ${i}`)}}getPattern(e,i,n,s){let r=n;"Shading"!==s&&(r=I.transform(r,i.baseTransform),this.matrix&&(r=I.transform(r,this.matrix)));const a=this.createPatternCanvas(i);let l=new DOMMatrix(r);l=l.translate(a.offsetX,a.offsetY),l=l.scale(1/a.scaleX,1/a.scaleY);const h=e.createPattern(a.canvas,"repeat");return h.setTransform(l),h}}return o})();function Xn({src:o,srcPos:t=0,dest:e,width:i,height:n,nonBlackColor:s=4294967295,inverseDecode:r=!1}){const a=bt.isLittleEndian?4278190080:255,[l,h]=r?[s,a]:[a,s],c=i>>3,d=7&i,u=o.length;e=new Uint32Array(e.buffer);let f=0;for(let p=0;p<n;p++){for(const b=t+c;t<b;t++){const m=t<u?o[t]:255;e[f++]=128&m?h:l,e[f++]=64&m?h:l,e[f++]=32&m?h:l,e[f++]=16&m?h:l,e[f++]=8&m?h:l,e[f++]=4&m?h:l,e[f++]=2&m?h:l,e[f++]=1&m?h:l}if(0===d)continue;const g=t<u?o[t++]:255;for(let b=0;b<d;b++)e[f++]=g&1<<7-b?h:l}return{srcPos:t,destPos:f}}class Va{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,i){let n;return void 0!==this.cache[t]?(n=this.cache[t],this.canvasFactory.reset(n,e,i)):(n=this.canvasFactory.create(e,i),this.cache[t]=n),n}delete(t){delete this.cache[t]}clear(){for(const t in this.cache)this.canvasFactory.destroy(this.cache[t]),delete this.cache[t]}}function ei(o,t,e,i,n,s,r,a,l,h){const[c,d,u,f,p,g]=K(o);if(0===d&&0===u){const A=Math.round(r*c+p),E=Math.round(a*f+g),M=Math.abs(Math.round((r+l)*c+p)-A)||1,y=Math.abs(Math.round((a+h)*f+g)-E)||1;return o.setTransform(Math.sign(c),0,0,Math.sign(f),A,E),o.drawImage(t,e,i,n,s,0,0,M,y),o.setTransform(c,d,u,f,p,g),[M,y]}if(0===c&&0===f){const A=Math.round(a*u+p),E=Math.round(r*d+g),M=Math.abs(Math.round((a+h)*u+p)-A)||1,y=Math.abs(Math.round((r+l)*d+g)-E)||1;return o.setTransform(0,Math.sign(d),Math.sign(u),0,A,E),o.drawImage(t,e,i,n,s,0,0,y,M),o.setTransform(c,d,u,f,p,g),[y,M]}return o.drawImage(t,e,i,n,s,r,a,l,h),[Math.hypot(c,d)*l,Math.hypot(u,f)*h]}class Zn{constructor(t,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=Tn,this.textMatrixScale=1,this.fontMatrix=Ci,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=0,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,t,e])}clone(){const t=Object.create(this);return t.clipBox=this.clipBox.slice(),t}setCurrentPoint(t,e){this.x=t,this.y=e}updatePathMinMax(t,e,i){[e,i]=I.applyTransform([e,i],t),this.minX=Math.min(this.minX,e),this.minY=Math.min(this.minY,i),this.maxX=Math.max(this.maxX,e),this.maxY=Math.max(this.maxY,i)}updateRectMinMax(t,e){const i=I.applyTransform(e,t),n=I.applyTransform(e.slice(2),t),s=I.applyTransform([e[0],e[3]],t),r=I.applyTransform([e[2],e[1]],t);this.minX=Math.min(this.minX,i[0],n[0],s[0],r[0]),this.minY=Math.min(this.minY,i[1],n[1],s[1],r[1]),this.maxX=Math.max(this.maxX,i[0],n[0],s[0],r[0]),this.maxY=Math.max(this.maxY,i[1],n[1],s[1],r[1])}updateScalingPathMinMax(t,e){I.scaleMinMax(t,e),this.minX=Math.min(this.minX,e[0]),this.minY=Math.min(this.minY,e[1]),this.maxX=Math.max(this.maxX,e[2]),this.maxY=Math.max(this.maxY,e[3])}updateCurvePathMinMax(t,e,i,n,s,r,a,l,h,c){const d=I.bezierBoundingBox(e,i,n,s,r,a,l,h,c);c||this.updateRectMinMax(t,d)}getPathBoundingBox(t="Fill",e=null){const i=[this.minX,this.minY,this.maxX,this.maxY];if("Stroke"===t){e||X("Stroke bounding box must include transform.");const n=I.singularValueDecompose2dScale(e),s=n[0]*this.lineWidth/2,r=n[1]*this.lineWidth/2;i[0]-=s,i[1]-=r,i[2]+=s,i[3]+=r}return i}updateClipFromPath(){const t=I.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(t){this.clipBox=t,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(t="Fill",e=null){return I.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function Jn(o,t){if(typeof ImageData<"u"&&t instanceof ImageData)return void o.putImageData(t,0,0);const e=t.height,i=t.width,n=e%16,s=(e-n)/16,r=0===n?s:s+1,a=o.createImageData(i,16);let h,l=0;const c=t.data,d=a.data;let u,f,p,g;if(t.kind===$e.GRAYSCALE_1BPP){const b=c.byteLength,m=new Uint32Array(d.buffer,0,d.byteLength>>2),v=m.length,A=i+7>>3,w=4294967295,E=bt.isLittleEndian?4278190080:255;for(u=0;u<r;u++){for(p=u<s?16:n,h=0,f=0;f<p;f++){const C=b-l;let M=0;const T=C>A?i:8*C-7,y=-8&T;let S=0,L=0;for(;M<y;M+=8)L=c[l++],m[h++]=128&L?w:E,m[h++]=64&L?w:E,m[h++]=32&L?w:E,m[h++]=16&L?w:E,m[h++]=8&L?w:E,m[h++]=4&L?w:E,m[h++]=2&L?w:E,m[h++]=1&L?w:E;for(;M<T;M++)0===S&&(L=c[l++],S=128),m[h++]=L&S?w:E,S>>=1}for(;h<v;)m[h++]=0;o.putImageData(a,0,16*u)}}else if(t.kind===$e.RGBA_32BPP){for(f=0,g=16*i*4,u=0;u<s;u++)d.set(c.subarray(l,l+g)),l+=g,o.putImageData(a,0,f),f+=16;u<r&&(g=i*n*4,d.set(c.subarray(l,l+g)),o.putImageData(a,0,f))}else{if(t.kind!==$e.RGB_24BPP)throw new Error(`bad image kind: ${t.kind}`);for(p=16,g=i*p,u=0;u<r;u++){for(u>=s&&(p=n,g=i*p),h=0,f=g;f--;)d[h++]=c[l++],d[h++]=c[l++],d[h++]=c[l++],d[h++]=255;o.putImageData(a,0,16*u)}}}function ts(o,t){if(t.bitmap)return void o.drawImage(t.bitmap,0,0);const e=t.height,i=t.width,n=e%16,s=(e-n)/16,r=0===n?s:s+1,a=o.createImageData(i,16);let l=0;const h=t.data,c=a.data;for(let d=0;d<r;d++){const u=d<s?16:n;({srcPos:l}=Xn({src:h,srcPos:l,dest:c,width:i,height:u,nonBlackColor:0})),o.putImageData(a,0,16*d)}}function Me(o,t){const e=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const i of e)void 0!==o[i]&&(t[i]=o[i]);void 0!==o.setLineDash&&(t.setLineDash(o.getLineDash()),t.lineDashOffset=o.lineDashOffset)}function ii(o){if(o.strokeStyle=o.fillStyle="#000000",o.fillRule="nonzero",o.globalAlpha=1,o.lineWidth=1,o.lineCap="butt",o.lineJoin="miter",o.miterLimit=10,o.globalCompositeOperation="source-over",o.font="10px sans-serif",void 0!==o.setLineDash&&(o.setLineDash([]),o.lineDashOffset=0),!ft){const{filter:t}=o;"none"!==t&&""!==t&&(o.filter="none")}}function es(o,t){if(t)return!0;const e=I.singularValueDecompose2dScale(o);e[0]=Math.fround(e[0]),e[1]=Math.fround(e[1]);const i=Math.fround((globalThis.devicePixelRatio||1)*ue.PDF_TO_CSS_UNITS);return e[0]<=i&&e[1]<=i}const Ha=["butt","round","square"],za=["miter","round","bevel"],Wa={},is={};class fe{constructor(t,e,i,n,s,{optionalContentConfig:r,markedContentStack:a=null},l,h){this.ctx=t,this.current=new Zn(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=e,this.objs=i,this.canvasFactory=n,this.filterFactory=s,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=a||[],this.optionalContentConfig=r,this.cachedCanvases=new Va(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=l,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=h,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(t,e=null){return"string"==typeof t?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):e}beginDrawing({transform:t,viewport:e,transparency:i=!1,background:n=null}){const s=this.ctx.canvas.width,r=this.ctx.canvas.height,a=this.ctx.fillStyle;if(this.ctx.fillStyle=n||"#ffffff",this.ctx.fillRect(0,0,s,r),this.ctx.fillStyle=a,i){const l=this.cachedCanvases.getCanvas("transparent",s,r);this.compositeCtx=this.ctx,this.transparentCanvas=l.canvas,this.ctx=l.context,this.ctx.save(),this.ctx.transform(...K(this.compositeCtx))}this.ctx.save(),ii(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[0]),this.ctx.transform(...e.transform),this.viewportScale=e.scale,this.baseTransform=K(this.ctx)}executeOperatorList(t,e,i,n){const s=t.argsArray,r=t.fnArray;let a=e||0;const l=s.length;if(l===a)return a;const h=l-a>10&&"function"==typeof i,c=h?Date.now()+15:0;let d=0;const u=this.commonObjs,f=this.objs;let p;for(;;){if(void 0!==n&&a===n.nextBreakPoint)return n.breakIt(a,i),a;if(p=r[a],p!==kt.dependency)this[p].apply(this,s[a]);else for(const g of s[a]){const b=g.startsWith("g_")?u:f;if(!b.has(g))return b.get(g,i),a}if(a++,a===l)return a;if(h&&++d>10){if(Date.now()>c)return i(),a;d=0}}}#t(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}endDrawing(){this.#t(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const t of this._cachedBitmapsMap.values()){for(const e of t.values())typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),this.#e()}#e(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==t){const e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}}_scaleImage(t,e){const i=t.width??t.displayWidth,n=t.height??t.displayHeight;let c,d,s=Math.max(Math.hypot(e[0],e[1]),1),r=Math.max(Math.hypot(e[2],e[3]),1),a=i,l=n,h="prescale1";for(;s>2&&a>1||r>2&&l>1;){let u=a,f=l;s>2&&a>1&&(u=a>=16384?Math.floor(a/2)-1||1:Math.ceil(a/2),s/=a/u),r>2&&l>1&&(f=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l)/2,r/=l/f),c=this.cachedCanvases.getCanvas(h,u,f),d=c.context,d.clearRect(0,0,u,f),d.drawImage(t,0,0,a,l,0,0,u,f),t=c.canvas,a=u,l=f,h="prescale1"===h?"prescale2":"prescale1"}return{img:t,paintWidth:a,paintHeight:l}}_createMaskCanvas(t){const e=this.ctx,{width:i,height:n}=t,s=this.current.fillColor,r=this.current.patternFill,a=K(e);let l,h,c,d;if((t.bitmap||t.data)&&t.count>1){const T=t.bitmap||t.data.buffer;h=JSON.stringify(r?a:[a.slice(0,4),s]),l=this._cachedBitmapsMap.get(T),l||(l=new Map,this._cachedBitmapsMap.set(T,l));const y=l.get(h);if(y&&!r)return{canvas:y,offsetX:Math.round(Math.min(a[0],a[2])+a[4]),offsetY:Math.round(Math.min(a[1],a[3])+a[5])};c=y}c||(d=this.cachedCanvases.getCanvas("maskCanvas",i,n),ts(d.context,t));let u=I.transform(a,[1/i,0,0,-1/n,0,0]);u=I.transform(u,[1,0,0,1,0,-n]);const[f,p,g,b]=I.getAxialAlignedBoundingBox([0,0,i,n],u),m=Math.round(g-f)||1,v=Math.round(b-p)||1,A=this.cachedCanvases.getCanvas("fillCanvas",m,v),w=A.context,E=f,C=p;w.translate(-E,-C),w.transform(...u),c||(c=this._scaleImage(d.canvas,Wt(w)),c=c.img,l&&r&&l.set(h,c)),w.imageSmoothingEnabled=es(K(w),t.interpolate),ei(w,c,0,0,c.width,c.height,0,0,i,n),w.globalCompositeOperation="source-in";const M=I.transform(Wt(w),[1,0,0,1,-E,-C]);return w.fillStyle=r?s.getPattern(e,this,M,"Fill"):s,w.fillRect(0,0,i,n),l&&!r&&(this.cachedCanvases.delete("fillCanvas"),l.set(h,A.canvas)),{canvas:A.canvas,offsetX:Math.round(E),offsetY:Math.round(C)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=Ha[t]}setLineJoin(t){this.ctx.lineJoin=za[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){const i=this.ctx;void 0!==i.setLineDash&&(i.setLineDash(t),i.lineDashOffset=e)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(const[e,i]of t)switch(e){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i[0],i[1]);break;case"CA":this.current.strokeAlpha=i;break;case"ca":this.current.fillAlpha=i,this.ctx.globalAlpha=i;break;case"BM":this.ctx.globalCompositeOperation=i;break;case"SMask":this.current.activeSMask=i?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(i)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const n=this.cachedCanvases.getCanvas("smaskGroupAt"+this.groupLevel,this.ctx.canvas.width,this.ctx.canvas.height);this.suspendedCtx=this.ctx,this.ctx=n.context;const s=this.ctx;s.setTransform(...K(this.suspendedCtx)),Me(this.suspendedCtx,s),function Ba(o,t){if(o._removeMirroring)throw new Error("Context is already forwarding operations.");o.__originalSave=o.save,o.__originalRestore=o.restore,o.__originalRotate=o.rotate,o.__originalScale=o.scale,o.__originalTranslate=o.translate,o.__originalTransform=o.transform,o.__originalSetTransform=o.setTransform,o.__originalResetTransform=o.resetTransform,o.__originalClip=o.clip,o.__originalMoveTo=o.moveTo,o.__originalLineTo=o.lineTo,o.__originalBezierCurveTo=o.bezierCurveTo,o.__originalRect=o.rect,o.__originalClosePath=o.closePath,o.__originalBeginPath=o.beginPath,o._removeMirroring=()=>{o.save=o.__originalSave,o.restore=o.__originalRestore,o.rotate=o.__originalRotate,o.scale=o.__originalScale,o.translate=o.__originalTranslate,o.transform=o.__originalTransform,o.setTransform=o.__originalSetTransform,o.resetTransform=o.__originalResetTransform,o.clip=o.__originalClip,o.moveTo=o.__originalMoveTo,o.lineTo=o.__originalLineTo,o.bezierCurveTo=o.__originalBezierCurveTo,o.rect=o.__originalRect,o.closePath=o.__originalClosePath,o.beginPath=o.__originalBeginPath,delete o._removeMirroring},o.save=function(){t.save(),this.__originalSave()},o.restore=function(){t.restore(),this.__originalRestore()},o.translate=function(i,n){t.translate(i,n),this.__originalTranslate(i,n)},o.scale=function(i,n){t.scale(i,n),this.__originalScale(i,n)},o.transform=function(i,n,s,r,a,l){t.transform(i,n,s,r,a,l),this.__originalTransform(i,n,s,r,a,l)},o.setTransform=function(i,n,s,r,a,l){t.setTransform(i,n,s,r,a,l),this.__originalSetTransform(i,n,s,r,a,l)},o.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},o.rotate=function(i){t.rotate(i),this.__originalRotate(i)},o.clip=function(i){t.clip(i),this.__originalClip(i)},o.moveTo=function(e,i){t.moveTo(e,i),this.__originalMoveTo(e,i)},o.lineTo=function(e,i){t.lineTo(e,i),this.__originalLineTo(e,i)},o.bezierCurveTo=function(e,i,n,s,r,a){t.bezierCurveTo(e,i,n,s,r,a),this.__originalBezierCurveTo(e,i,n,s,r,a)},o.rect=function(e,i,n,s){t.rect(e,i,n,s),this.__originalRect(e,i,n,s)},o.closePath=function(){t.closePath(),this.__originalClosePath()},o.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}(s,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),Me(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){this.current.activeSMask&&(t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height],this.composeSMask(this.suspendedCtx,this.current.activeSMask,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore())}composeSMask(t,e,i,n){const s=n[0],r=n[1],a=n[2]-s,l=n[3]-r;0===a||0===l||(this.genericComposeSMask(e.context,i,a,l,e.subtype,e.backdrop,e.transferMap,s,r,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(i.canvas,0,0),t.restore())}genericComposeSMask(t,e,i,n,s,r,a,l,h,c,d){let u=t.canvas,f=l-c,p=h-d;if(r){const b=I.makeHexColor(...r);if(f<0||p<0||f+i>u.width||p+n>u.height){const m=this.cachedCanvases.getCanvas("maskExtension",i,n),v=m.context;v.drawImage(u,-f,-p),v.globalCompositeOperation="destination-atop",v.fillStyle=b,v.fillRect(0,0,i,n),v.globalCompositeOperation="source-over",u=m.canvas,f=p=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);const m=new Path2D;m.rect(f,p,i,n),t.clip(m),t.globalCompositeOperation="destination-atop",t.fillStyle=b,t.fillRect(f,p,i,n),t.restore()}}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),"Alpha"===s&&a?e.filter=this.filterFactory.addAlphaFilter(a):"Luminosity"===s&&(e.filter=this.filterFactory.addLuminosityFilter(a));const g=new Path2D;g.rect(l,h,i,n),e.clip(g),e.globalCompositeOperation="destination-in",e.drawImage(u,f,p,i,n,l,h,i,n),e.restore()}save(){this.inSMaskMode?(Me(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const t=this.current;this.stateStack.push(t),this.current=t.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),Me(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,e,i,n,s,r){this.ctx.transform(t,e,i,n,s,r),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i){const n=this.ctx,s=this.current;let l,h,r=s.x,a=s.y;const c=K(n),d=0===c[0]&&0===c[3]||0===c[1]&&0===c[2],u=d?i.slice(0):null;for(let f=0,p=0,g=t.length;f<g;f++)switch(0|t[f]){case kt.rectangle:r=e[p++],a=e[p++];const b=e[p++],m=e[p++],v=r+b,A=a+m;n.moveTo(r,a),0===b||0===m?n.lineTo(v,A):(n.lineTo(v,a),n.lineTo(v,A),n.lineTo(r,A)),d||s.updateRectMinMax(c,[r,a,v,A]),n.closePath();break;case kt.moveTo:r=e[p++],a=e[p++],n.moveTo(r,a),d||s.updatePathMinMax(c,r,a);break;case kt.lineTo:r=e[p++],a=e[p++],n.lineTo(r,a),d||s.updatePathMinMax(c,r,a);break;case kt.curveTo:l=r,h=a,r=e[p+4],a=e[p+5],n.bezierCurveTo(e[p],e[p+1],e[p+2],e[p+3],r,a),s.updateCurvePathMinMax(c,l,h,e[p],e[p+1],e[p+2],e[p+3],r,a,u),p+=6;break;case kt.curveTo2:l=r,h=a,n.bezierCurveTo(r,a,e[p],e[p+1],e[p+2],e[p+3]),s.updateCurvePathMinMax(c,l,h,r,a,e[p],e[p+1],e[p+2],e[p+3],u),r=e[p+2],a=e[p+3],p+=4;break;case kt.curveTo3:l=r,h=a,r=e[p+2],a=e[p+3],n.bezierCurveTo(e[p],e[p+1],r,a,r,a),s.updateCurvePathMinMax(c,l,h,e[p],e[p+1],r,a,r,a,u),p+=4;break;case kt.closePath:n.closePath()}d&&s.updateScalingPathMinMax(c,u),s.setCurrentPoint(r,a)}closePath(){this.ctx.closePath()}stroke(t=!0){const e=this.ctx,i=this.current.strokeColor;e.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"==typeof i&&i?.getPattern?(e.save(),e.strokeStyle=i.getPattern(e,this,Wt(e),"Stroke"),this.rescaleAndStroke(!1),e.restore()):this.rescaleAndStroke(!0)),t&&this.consumePath(this.current.getClippedPathBoundingBox()),e.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(t=!0){const e=this.ctx,i=this.current.fillColor;let s=!1;this.current.patternFill&&(e.save(),e.fillStyle=i.getPattern(e,this,Wt(e),"Fill"),s=!0);const r=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==r&&(this.pendingEOFill?(e.fill("evenodd"),this.pendingEOFill=!1):e.fill()),s&&e.restore(),t&&this.consumePath(r)}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=Wa}eoClip(){this.pendingClip=is}beginText(){this.current.textMatrix=Tn,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const t=this.pendingTextPaths,e=this.ctx;if(void 0!==t){e.save(),e.beginPath();for(const i of t)e.setTransform(...i.transform),e.translate(i.x,i.y),i.addToPath(e,i.fontSize);e.restore(),e.clip(),e.beginPath(),delete this.pendingTextPaths}else e.beginPath()}setCharSpacing(t){this.current.charSpacing=t}setWordSpacing(t){this.current.wordSpacing=t}setHScale(t){this.current.textHScale=t/100}setLeading(t){this.current.leading=-t}setFont(t,e){const i=this.commonObjs.get(t),n=this.current;if(!i)throw new Error(`Can't find font for ${t}`);if(n.fontMatrix=i.fontMatrix||Ci,(0===n.fontMatrix[0]||0===n.fontMatrix[3])&&V("Invalid font matrix for font "+t),e<0?(e=-e,n.fontDirection=-1):n.fontDirection=1,this.current.font=i,this.current.fontSize=e,i.isType3Font)return;const s=i.loadedName||"sans-serif",r=i.systemFontInfo?.css||`"${s}", ${i.fallbackName}`;let a="normal";i.black?a="900":i.bold&&(a="bold");const l=i.italic?"italic":"normal";let h=e;e<16?h=16:e>100&&(h=100),this.current.fontSizeScale=e/h,this.ctx.font=`${l} ${a} ${h}px ${r}`}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,e){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=e}setLeadingMoveText(t,e){this.setLeading(-e),this.moveText(t,e)}setTextMatrix(t,e,i,n,s,r){this.current.textMatrix=[t,e,i,n,s,r],this.current.textMatrixScale=Math.hypot(t,e),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,e,i,n){const s=this.ctx,r=this.current,a=r.font,l=r.textRenderingMode,h=r.fontSize/r.fontSizeScale,c=3&l,d=!!(4&l),u=r.patternFill&&!a.missingFile;let f;(a.disableFontFace||d||u)&&(f=a.getPathGenerator(this.commonObjs,t)),a.disableFontFace||u?(s.save(),s.translate(e,i),s.beginPath(),f(s,h),n&&s.setTransform(...n),(0===c||2===c)&&s.fill(),(1===c||2===c)&&s.stroke(),s.restore()):((0===c||2===c)&&s.fillText(t,e,i),(1===c||2===c)&&s.strokeText(t,e,i)),d&&(this.pendingTextPaths||=[]).push({transform:K(s),x:e,y:i,fontSize:h,addToPath:f})}get isFontSubpixelAAEnabled(){const{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);const e=t.getImageData(0,0,10,10).data;let i=!1;for(let n=3;n<e.length;n+=4)if(e[n]>0&&e[n]<255){i=!0;break}return U(this,"isFontSubpixelAAEnabled",i)}showText(t){const e=this.current,i=e.font;if(i.isType3Font)return this.showType3Text(t);const n=e.fontSize;if(0===n)return;const s=this.ctx,r=e.fontSizeScale,a=e.charSpacing,l=e.wordSpacing,h=e.fontDirection,c=e.textHScale*h,d=t.length,u=i.vertical,f=u?1:-1,p=i.defaultVMetrics,g=n*e.fontMatrix[0],b=0===e.textRenderingMode&&!i.disableFontFace&&!e.patternFill;let m;if(s.save(),s.transform(...e.textMatrix),s.translate(e.x,e.y+e.textRise),s.scale(c,h>0?-1:1),e.patternFill){s.save();const C=e.fillColor.getPattern(s,this,Wt(s),"Fill");m=K(s),s.restore(),s.fillStyle=C}let v=e.lineWidth;const A=e.textMatrixScale;if(0===A||0===v){const C=3&e.textRenderingMode;(1===C||2===C)&&(v=this.getSinglePixelWidth())}else v/=A;if(1!==r&&(s.scale(r,r),v/=r),s.lineWidth=v,i.isInvalidPDFjsFont){const C=[];let M=0;for(const T of t)C.push(T.unicode),M+=T.width;return s.fillText(C.join(""),0,0),e.x+=M*g*c,s.restore(),void this.compose()}let E,w=0;for(E=0;E<d;++E){const C=t[E];if("number"==typeof C){w+=f*C*n/1e3;continue}let M=!1;const T=(C.isSpace?l:0)+a,y=C.fontChar,S=C.accent;let L,z,H=C.width;if(u){const $=C.vmetric||p,et=-(C.vmetric?$[1]:.5*H)*g;H=$?-$[0]:H,L=et/r,z=(w+$[2]*g)/r}else L=w/r,z=0;if(i.remeasure&&H>0){const $=1e3*s.measureText(y).width/n*r;if(H<$&&this.isFontSubpixelAAEnabled){const et=H/$;M=!0,s.save(),s.scale(et,1),L/=et}else H!==$&&(L+=(H-$)/2e3*n/r)}this.contentVisible&&(C.isInFont||i.missingFile)&&(b&&!S?s.fillText(y,L,z):(this.paintChar(y,L,z,m),S&&this.paintChar(S.fontChar,L+n*S.offset.x/r,z-n*S.offset.y/r,m))),w+=u?H*g-T*h:H*g+T*h,M&&s.restore()}u?e.y-=w:e.x+=w*c,s.restore(),this.compose()}showType3Text(t){const e=this.ctx,i=this.current,n=i.font,s=i.fontSize,r=i.fontDirection,a=n.vertical?1:-1,l=i.charSpacing,h=i.wordSpacing,c=i.textHScale*r,d=i.fontMatrix||Ci,u=t.length;let p,g,b,m;if(3!==i.textRenderingMode&&0!==s){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,e.save(),e.transform(...i.textMatrix),e.translate(i.x,i.y),e.scale(c,r),p=0;p<u;++p){if(g=t[p],"number"==typeof g){m=a*g*s/1e3,this.ctx.translate(m,0),i.x+=m*c;continue}const v=(g.isSpace?h:0)+l,A=n.charProcOperatorList[g.operatorListId];A?(this.contentVisible&&(this.processingType3=g,this.save(),e.scale(s,s),e.transform(...d),this.executeOperatorList(A),this.restore()),b=I.applyTransform([g.width,0],d)[0]*s+v,e.translate(b,0),i.x+=b*c):V(`Type3 character "${g.operatorListId}" is not available.`)}e.restore(),this.processingType3=null}}setCharWidth(t,e){}setCharWidthAndBounds(t,e,i,n,s,r){this.ctx.rect(i,n,s-i,r-n),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let e;if("TilingPattern"===t[0]){const i=t[1],n=this.baseTransform||K(this.ctx);e=new Oa(t,i,this.ctx,{createCanvasGraphics:r=>new fe(r,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})},n)}else e=this._getPattern(t[1],t[2]);return e}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,e,i){this.ctx.strokeStyle=this.current.strokeColor=I.makeHexColor(t,e,i)}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent"}setFillRGBColor(t,e,i){this.ctx.fillStyle=this.current.fillColor=I.makeHexColor(t,e,i),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(t,e=null){let i;return this.cachedPatterns.has(t)?i=this.cachedPatterns.get(t):(i=function Da(o){switch(o[0]){case"RadialAxial":return new La(o);case"Mesh":return new Ia(o);case"Dummy":return new ka}throw new Error(`Unknown IR type: ${o[0]}`)}(this.getObject(t)),this.cachedPatterns.set(t,i)),e&&(i.matrix=e),i}shadingFill(t){if(!this.contentVisible)return;const e=this.ctx;this.save();const i=this._getPattern(t);e.fillStyle=i.getPattern(e,this,Wt(e),"Shading");const n=Wt(e);if(n){const{width:s,height:r}=e.canvas,[a,l,h,c]=I.getAxialAlignedBoundingBox([0,0,s,r],n);this.ctx.fillRect(a,l,h-a,c-l)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){X("Should not call beginInlineImage")}beginImageData(){X("Should not call beginImageData")}paintFormXObjectBegin(t,e){this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=K(this.ctx),e)&&(this.ctx.rect(e[0],e[1],e[2]-e[0],e[3]-e[1]),this.current.updateRectMinMax(K(this.ctx),e),this.clip(),this.endPath())}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const e=this.ctx;t.isolated||Ke("TODO: Support non-isolated groups."),t.knockout&&V("Knockout groups not supported.");const i=K(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let n=I.getAxialAlignedBoundingBox(t.bbox,K(e));n=I.intersect(n,[0,0,e.canvas.width,e.canvas.height])||[0,0,0,0];const r=Math.floor(n[0]),a=Math.floor(n[1]),l=Math.max(Math.ceil(n[2])-r,1),h=Math.max(Math.ceil(n[3])-a,1);this.current.startNewPathAndClipBox([0,0,l,h]);let c="groupAt"+this.groupLevel;t.smask&&(c+="_smask_"+this.smaskCounter++%2);const d=this.cachedCanvases.getCanvas(c,l,h),u=d.context;u.translate(-r,-a),u.transform(...i),t.smask?this.smaskStack.push({canvas:d.canvas,context:u,offsetX:r,offsetY:a,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(e.setTransform(1,0,0,1,0,0),e.translate(r,a),e.save()),Me(e,u),this.ctx=u,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(e),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;const e=this.ctx,i=this.groupStack.pop();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const n=K(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...n);const s=I.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],n);this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(s)}}beginAnnotation(t,e,i,n,s){if(this.#t(),ii(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),e){const r=e[2]-e[0],a=e[3]-e[1];if(s&&this.annotationCanvasMap){(i=i.slice())[4]-=e[0],i[5]-=e[1],(e=e.slice())[0]=e[1]=0,e[2]=r,e[3]=a;const[l,h]=I.singularValueDecompose2dScale(K(this.ctx)),{viewportScale:c}=this,d=Math.ceil(r*this.outputScaleX*c),u=Math.ceil(a*this.outputScaleY*c);this.annotationCanvas=this.canvasFactory.create(d,u);const{canvas:f,context:p}=this.annotationCanvas;this.annotationCanvasMap.set(t,f),this.annotationCanvas.savedCtx=this.ctx,this.ctx=p,this.ctx.save(),this.ctx.setTransform(l,0,0,-h,0,a*h),ii(this.ctx)}else ii(this.ctx),this.endPath(),this.ctx.rect(e[0],e[1],r,a),this.ctx.clip(),this.ctx.beginPath()}this.current=new Zn(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),this.transform(...n)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#e(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t){if(!this.contentVisible)return;const e=t.count;(t=this.getObject(t.data,t)).count=e;const i=this.ctx,n=this.processingType3;if(n&&(void 0===n.compiled&&(n.compiled=function ja(o){const{width:t,height:e}=o;if(t>1e3||e>1e3)return null;const n=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),s=t+1;let a,l,h,r=new Uint8Array(s*(e+1));const c=t+7&-8;let d=new Uint8Array(c*e),u=0;for(const m of o.data){let v=128;for(;v>0;)d[u++]=m&v?0:255,v>>=1}let f=0;for(u=0,0!==d[u]&&(r[0]=1,++f),l=1;l<t;l++)d[u]!==d[u+1]&&(r[l]=d[u]?2:1,++f),u++;for(0!==d[u]&&(r[l]=2,++f),a=1;a<e;a++){u=a*c,h=a*s,d[u-c]!==d[u]&&(r[h]=d[u]?1:8,++f);let m=(d[u]?4:0)+(d[u-c]?8:0);for(l=1;l<t;l++)m=(m>>2)+(d[u+1]?4:0)+(d[u-c+1]?8:0),n[m]&&(r[h+l]=n[m],++f),u++;if(d[u-c]!==d[u]&&(r[h+l]=d[u]?2:4,++f),f>1e3)return null}for(u=c*(e-1),h=a*s,0!==d[u]&&(r[h]=8,++f),l=1;l<t;l++)d[u]!==d[u+1]&&(r[h+l]=d[u]?4:8,++f),u++;if(0!==d[u]&&(r[h+l]=4,++f),f>1e3)return null;const p=new Int32Array([0,s,-1,0,-s,0,0,0,1]),g=new Path2D;for(a=0;f&&a<=e;a++){let m=a*s;const v=m+t;for(;m<v&&!r[m];)m++;if(m===v)continue;g.moveTo(m%s,a);const A=m;let w=r[m];do{const E=p[w];do{m+=E}while(!r[m]);const C=r[m];5!==C&&10!==C?(w=C,r[m]=0):(w=C&51*w>>4,r[m]&=w>>2|w<<2),g.lineTo(m%s,m/s|0),r[m]||--f}while(A!==m);--a}return d=null,r=null,function(m){m.save(),m.scale(1/t,-1/e),m.translate(0,-e),m.fill(g),m.beginPath(),m.restore()}}(t)),n.compiled))return void n.compiled(i);const s=this._createMaskCanvas(t),r=s.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(r,s.offsetX,s.offsetY),i.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,i=0,n=0,s,r){if(!this.contentVisible)return;t=this.getObject(t.data,t);const a=this.ctx;a.save();const l=K(a);a.transform(e,i,n,s,0,0);const h=this._createMaskCanvas(t);a.setTransform(1,0,0,1,h.offsetX-l[4],h.offsetY-l[5]);for(let c=0,d=r.length;c<d;c+=2){const u=I.transform(l,[e,i,n,s,r[c],r[c+1]]),[f,p]=I.applyTransform([0,0],u);a.drawImage(h.canvas,f,p)}a.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;const e=this.ctx,i=this.current.fillColor,n=this.current.patternFill;for(const s of t){const{data:r,width:a,height:l,transform:h}=s,c=this.cachedCanvases.getCanvas("maskCanvas",a,l),d=c.context;d.save(),ts(d,this.getObject(r,s)),d.globalCompositeOperation="source-in",d.fillStyle=n?i.getPattern(d,this,Wt(e),"Fill"):i,d.fillRect(0,0,a,l),d.restore(),e.save(),e.transform(...h),e.scale(1,-1),ei(e,c.canvas,0,0,a,l,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;const e=this.getObject(t);e?this.paintInlineImageXObject(e):V("Dependent image isn't ready yet")}paintImageXObjectRepeat(t,e,i,n){if(!this.contentVisible)return;const s=this.getObject(t);if(!s)return void V("Dependent image isn't ready yet");const r=s.width,a=s.height,l=[];for(let h=0,c=n.length;h<c;h+=2)l.push({transform:[e,0,0,i,n[h],n[h+1]],x:0,y:0,w:r,h:a});this.paintInlineImageXObjectGroup(s,l)}applyTransferMapsToCanvas(t){return"none"!==this.current.transferMaps&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if("none"===this.current.transferMaps)return t.bitmap;const{bitmap:e,width:i,height:n}=t,s=this.cachedCanvases.getCanvas("inlineImage",i,n),r=s.context;return r.filter=this.current.transferMaps,r.drawImage(e,0,0),r.filter="none",s.canvas}paintInlineImageXObject(t){if(!this.contentVisible)return;const e=t.width,i=t.height,n=this.ctx;if(this.save(),!ft){const{filter:a}=n;"none"!==a&&""!==a&&(n.filter="none")}let s;if(n.scale(1/e,-1/i),t.bitmap)s=this.applyTransferMapsToBitmap(t);else if("function"==typeof HTMLElement&&t instanceof HTMLElement||!t.data)s=t;else{const l=this.cachedCanvases.getCanvas("inlineImage",e,i).context;Jn(l,t),s=this.applyTransferMapsToCanvas(l)}const r=this._scaleImage(s,Wt(n));n.imageSmoothingEnabled=es(K(n),t.interpolate),ei(n,r.img,0,0,r.paintWidth,r.paintHeight,0,-i,e,i),this.compose(),this.restore()}paintInlineImageXObjectGroup(t,e){if(!this.contentVisible)return;const i=this.ctx;let n;if(t.bitmap)n=t.bitmap;else{const l=this.cachedCanvases.getCanvas("inlineImage",t.width,t.height).context;Jn(l,t),n=this.applyTransferMapsToCanvas(l)}for(const s of e)i.save(),i.transform(...s.transform),i.scale(1,-1),ei(i,n,s.x,s.y,s.w,s.h,0,-1,1,1),i.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t){}markPointProps(t,e){}beginMarkedContent(t){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e){this.markedContentStack.push("OC"===t?{visible:this.optionalContentConfig.isVisible(e)}:{visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(t){const e=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);const i=this.ctx;this.pendingClip&&(e||(this.pendingClip===is?i.clip("evenodd"):i.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),i.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const t=K(this.ctx);if(0===t[1]&&0===t[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{const e=Math.abs(t[0]*t[3]-t[2]*t[1]),i=Math.hypot(t[0],t[2]),n=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(i,n)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){const{lineWidth:t}=this.current,{a:e,b:i,c:n,d:s}=this.ctx.getTransform();let r,a;if(0===i&&0===n){const l=Math.abs(e),h=Math.abs(s);if(l===h)if(0===t)r=a=1/l;else{const c=l*t;r=a=c<1?1/c:1}else if(0===t)r=1/l,a=1/h;else{const c=l*t,d=h*t;r=c<1?1/c:1,a=d<1?1/d:1}}else{const l=Math.abs(e*s-i*n),h=Math.hypot(e,i),c=Math.hypot(n,s);if(0===t)r=c/l,a=h/l;else{const d=t*l;r=c>d?c/d:1,a=h>d?h/d:1}}this._cachedScaleForStroking[0]=r,this._cachedScaleForStroking[1]=a}return this._cachedScaleForStroking}rescaleAndStroke(t){const{ctx:e}=this,{lineWidth:i}=this.current,[n,s]=this.getScaleForStroking();if(e.lineWidth=i||1,1===n&&1===s)return void e.stroke();const r=e.getLineDash();if(t&&e.save(),e.scale(n,s),r.length>0){const a=Math.max(n,s);e.setLineDash(r.map(l=>l/a)),e.lineDashOffset/=a}e.stroke(),t&&e.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}}for(const o in kt)void 0!==fe.prototype[o]&&(fe.prototype[kt[o]]=fe.prototype[o]);class Le{static#t=null;static#e="";static get workerPort(){return this.#t}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&null!==t)throw new Error("Invalid `workerPort` type.");this.#t=t}static get workerSrc(){return this.#e}static set workerSrc(t){if("string"!=typeof t)throw new Error("Invalid `workerSrc` type.");this.#e=t}}function Ct(o){switch(o instanceof Error||"object"==typeof o&&null!==o||X('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),o.name){case"AbortException":return new ne(o.message);case"MissingPDFException":return new ie(o.message);case"PasswordException":return new Si(o.message,o.code);case"UnexpectedResponseException":return new qe(o.message,o.status);case"UnknownErrorException":return new Pi(o.message,o.details);default:return new Pi(o.message,o.toString())}}class Re{#t=new AbortController;constructor(t,e,i){this.sourceName=t,this.targetName=e,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),i.addEventListener("message",this.#e.bind(this),{signal:this.#t.signal})}#e({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream)return void this.#n(t);if(t.callback){const i=t.callbackId,n=this.callbackCapabilities[i];if(!n)throw new Error(`Cannot resolve callback ${i}`);if(delete this.callbackCapabilities[i],1===t.callback)n.resolve(t.data);else{if(2!==t.callback)throw new Error("Unexpected callback case");n.reject(Ct(t.reason))}return}const e=this.actionHandler[t.action];if(!e)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){const i=this.sourceName,n=t.sourceName,s=this.comObj;return void new Promise(function(r){r(e(t.data))}).then(function(r){s.postMessage({sourceName:i,targetName:n,callback:1,callbackId:t.callbackId,data:r})},function(r){s.postMessage({sourceName:i,targetName:n,callback:2,callbackId:t.callbackId,reason:Ct(r)})})}t.streamId?this.#i(t):e(t.data)}on(t,e){const i=this.actionHandler;if(i[t])throw new Error(`There is already an actionName called "${t}"`);i[t]=e}send(t,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},i)}sendWithPromise(t,e,i){const n=this.callbackId++,s=Promise.withResolvers();this.callbackCapabilities[n]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:n,data:e},i)}catch(r){s.reject(r)}return s.promise}sendWithStream(t,e,i,n){const s=this.streamId++,r=this.sourceName,a=this.targetName,l=this.comObj;return new ReadableStream({start:h=>{const c=Promise.withResolvers();return this.streamControllers[s]={controller:h,startCall:c,pullCall:null,cancelCall:null,isClosed:!1},l.postMessage({sourceName:r,targetName:a,action:t,streamId:s,data:e,desiredSize:h.desiredSize},n),c.promise},pull:h=>{const c=Promise.withResolvers();return this.streamControllers[s].pullCall=c,l.postMessage({sourceName:r,targetName:a,stream:6,streamId:s,desiredSize:h.desiredSize}),c.promise},cancel:h=>{lt(h instanceof Error,"cancel must have a valid reason");const c=Promise.withResolvers();return this.streamControllers[s].cancelCall=c,this.streamControllers[s].isClosed=!0,l.postMessage({sourceName:r,targetName:a,stream:1,streamId:s,reason:Ct(h)}),c.promise}},i)}#i(t){const e=t.streamId,i=this.sourceName,n=t.sourceName,s=this.comObj,r=this,a=this.actionHandler[t.action],l={enqueue(h,c=1,d){if(this.isCancelled)return;const u=this.desiredSize;this.desiredSize-=c,u>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),s.postMessage({sourceName:i,targetName:n,stream:4,streamId:e,chunk:h},d)},close(){this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:n,stream:3,streamId:e}),delete r.streamSinks[e])},error(h){lt(h instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,s.postMessage({sourceName:i,targetName:n,stream:5,streamId:e,reason:Ct(h)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};l.sinkCapability.resolve(),l.ready=l.sinkCapability.promise,this.streamSinks[e]=l,new Promise(function(h){h(a(t.data,l))}).then(function(){s.postMessage({sourceName:i,targetName:n,stream:8,streamId:e,success:!0})},function(h){s.postMessage({sourceName:i,targetName:n,stream:8,streamId:e,reason:Ct(h)})})}#n(t){const e=t.streamId,i=this.sourceName,n=t.sourceName,s=this.comObj,r=this.streamControllers[e],a=this.streamSinks[e];switch(t.stream){case 8:t.success?r.startCall.resolve():r.startCall.reject(Ct(t.reason));break;case 7:t.success?r.pullCall.resolve():r.pullCall.reject(Ct(t.reason));break;case 6:if(!a){s.postMessage({sourceName:i,targetName:n,stream:7,streamId:e,success:!0});break}a.desiredSize<=0&&t.desiredSize>0&&a.sinkCapability.resolve(),a.desiredSize=t.desiredSize,new Promise(function(l){l(a.onPull?.())}).then(function(){s.postMessage({sourceName:i,targetName:n,stream:7,streamId:e,success:!0})},function(l){s.postMessage({sourceName:i,targetName:n,stream:7,streamId:e,reason:Ct(l)})});break;case 4:if(lt(r,"enqueue should have stream controller"),r.isClosed)break;r.controller.enqueue(t.chunk);break;case 3:if(lt(r,"close should have stream controller"),r.isClosed)break;r.isClosed=!0,r.controller.close(),this.#s(r,e);break;case 5:lt(r,"error should have stream controller"),r.controller.error(Ct(t.reason)),this.#s(r,e);break;case 2:t.success?r.cancelCall.resolve():r.cancelCall.reject(Ct(t.reason)),this.#s(r,e);break;case 1:if(!a)break;new Promise(function(l){l(a.onCancel?.(Ct(t.reason)))}).then(function(){s.postMessage({sourceName:i,targetName:n,stream:2,streamId:e,success:!0})},function(l){s.postMessage({sourceName:i,targetName:n,stream:2,streamId:e,reason:Ct(l)})}),a.sinkCapability.reject(Ct(t.reason)),a.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}#s(t,e){var i=this;return(0,x.A)(function*(){yield Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete i.streamControllers[e]})()}destroy(){this.#t?.abort(),this.#t=null}}class Ua{#t;#e;constructor({parsedData:t,rawData:e}){this.#t=t,this.#e=e}getRaw(){return this.#e}get(t){return this.#t.get(t)??null}getAll(){return Ti(this.#t)}has(t){return this.#t.has(t)}}const pe=Symbol("INTERNAL");class Ga{#t=!1;#e=!1;#i=!1;#n=!0;constructor(t,{name:e,intent:i,usage:n,rbGroups:s}){this.#t=!!(2&t),this.#e=!!(4&t),this.name=e,this.intent=i,this.usage=n,this.rbGroups=s}get visible(){if(this.#i)return this.#n;if(!this.#n)return!1;const{print:t,view:e}=this.usage;return this.#t?"OFF"!==e?.viewState:!this.#e||"OFF"!==t?.printState}_setVisible(t,e,i=!1){t!==pe&&X("Internal method `_setVisible` called."),this.#i=i,this.#n=e}}class $a{#t=null;#e=new Map;#i=null;#n=null;constructor(t,e=2){if(this.renderingIntent=e,this.name=null,this.creator=null,null!==t){this.name=t.name,this.creator=t.creator,this.#n=t.order;for(const i of t.groups)this.#e.set(i.id,new Ga(e,i));if("OFF"===t.baseState)for(const i of this.#e.values())i._setVisible(pe,!1);for(const i of t.on)this.#e.get(i)._setVisible(pe,!0);for(const i of t.off)this.#e.get(i)._setVisible(pe,!1);this.#i=this.getHash()}}#s(t){const e=t.length;if(e<2)return!0;const i=t[0];for(let n=1;n<e;n++){const s=t[n];let r;if(Array.isArray(s))r=this.#s(s);else{if(!this.#e.has(s))return V(`Optional content group not found: ${s}`),!0;r=this.#e.get(s).visible}switch(i){case"And":if(!r)return!1;break;case"Or":if(r)return!0;break;case"Not":return!r;default:return!0}}return"And"===i}isVisible(t){if(0===this.#e.size)return!0;if(!t)return Ke("Optional content group not defined."),!0;if("OCG"===t.type)return this.#e.has(t.id)?this.#e.get(t.id).visible:(V(`Optional content group not found: ${t.id}`),!0);if("OCMD"===t.type){if(t.expression)return this.#s(t.expression);if(!t.policy||"AnyOn"===t.policy){for(const e of t.ids){if(!this.#e.has(e))return V(`Optional content group not found: ${e}`),!0;if(this.#e.get(e).visible)return!0}return!1}if("AllOn"===t.policy){for(const e of t.ids){if(!this.#e.has(e))return V(`Optional content group not found: ${e}`),!0;if(!this.#e.get(e).visible)return!1}return!0}if("AnyOff"===t.policy){for(const e of t.ids){if(!this.#e.has(e))return V(`Optional content group not found: ${e}`),!0;if(!this.#e.get(e).visible)return!0}return!1}if("AllOff"===t.policy){for(const e of t.ids){if(!this.#e.has(e))return V(`Optional content group not found: ${e}`),!0;if(this.#e.get(e).visible)return!1}return!0}return V(`Unknown optional content policy ${t.policy}.`),!0}return V(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,i=!0){const n=this.#e.get(t);if(n){if(i&&e&&n.rbGroups.length)for(const s of n.rbGroups)for(const r of s)r!==t&&this.#e.get(r)?._setVisible(pe,!1,!0);n._setVisible(pe,!!e,!0),this.#t=null}else V(`Optional content group not found: ${t}`)}setOCGState({state:t,preserveRB:e}){let i;for(const n of t){switch(n){case"ON":case"OFF":case"Toggle":i=n;continue}const s=this.#e.get(n);if(s)switch(i){case"ON":this.setVisibility(n,!0,e);break;case"OFF":this.setVisibility(n,!1,e);break;case"Toggle":this.setVisibility(n,!s.visible,e)}}this.#t=null}get hasInitialVisibility(){return null===this.#i||this.getHash()===this.#i}getOrder(){return this.#e.size?this.#n?this.#n.slice():[...this.#e.keys()]:null}getGroups(){return this.#e.size>0?Ti(this.#e):null}getGroup(t){return this.#e.get(t)||null}getHash(){if(null!==this.#t)return this.#t;const t=new Nn;for(const[e,i]of this.#e)t.update(`${e}:${i.visible}`);return this.#t=t.hexdigest()}}class Xa{constructor(t,{disableRange:e=!1,disableStream:i=!1}){lt(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:n,initialData:s,progressiveDone:r,contentDispositionFilename:a}=t;if(this._queuedChunks=[],this._progressiveDone=r,this._contentDispositionFilename=a,s?.length>0){const l=s instanceof Uint8Array&&s.byteLength===s.buffer.byteLength?s.buffer:new Uint8Array(s).buffer;this._queuedChunks.push(l)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!i,this._isRangeSupported=!e,this._contentLength=n,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((l,h)=>{this._onReceiveData({begin:l,chunk:h})}),t.addProgressListener((l,h)=>{this._onProgress({loaded:l,total:h})}),t.addProgressiveReadListener(l=>{this._onReceiveData({chunk:l})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData({begin:t,chunk:e}){const i=e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer;void 0===t?this._fullRequestReader?this._fullRequestReader._enqueue(i):this._queuedChunks.push(i):lt(this._rangeReaders.some(function(s){return s._begin===t&&(s._enqueue(i),!0)}),"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(t){void 0===t.total?this._rangeReaders[0]?.onProgress?.({loaded:t.loaded}):this._fullRequestReader?.onProgress?.({loaded:t.loaded,total:t.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){const e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){lt(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const t=this._queuedChunks;return this._queuedChunks=null,new Ya(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new Ka(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const e of this._rangeReaders.slice(0))e.cancel(t);this._pdfDataRangeTransport.abort()}}class Ya{constructor(t,e,i=!1,n=null){this._stream=t,this._done=i||!1,this._filename=ki(n)?n:null,this._queuedChunks=e||[],this._loaded=0;for(const s of this._queuedChunks)this._loaded+=s.byteLength;this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}read(){var t=this;return(0,x.A)(function*(){if(t._queuedChunks.length>0)return{value:t._queuedChunks.shift(),done:!1};if(t._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return t._requests.push(e),e.promise})()}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class Ka{constructor(t,e,i){this._stream=t,this._begin=e,this._end=i,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(0===this._requests.length)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}read(){var t=this;return(0,x.A)(function*(){if(t._queuedChunk){const i=t._queuedChunk;return t._queuedChunk=null,{value:i,done:!1}}if(t._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return t._requests.push(e),e.promise})()}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function $i(o,t){const e=new Headers;if(!o||!t||"object"!=typeof t)return e;for(const i in t){const n=t[i];void 0!==n&&e.append(i,n)}return e}function Xi({responseHeaders:o,isHttp:t,rangeChunkSize:e,disableRange:i}){const n={allowRangeRequests:!1,suggestedLength:void 0},s=parseInt(o.get("Content-Length"),10);return!Number.isInteger(s)||(n.suggestedLength=s,s<=2*e)||i||!t||"bytes"!==o.get("Accept-Ranges")||"identity"!==(o.get("Content-Encoding")||"identity")||(n.allowRangeRequests=!0),n}function Yi(o){const t=o.get("Content-Disposition");if(t){let e=function qa(o){let t=!0,e=i("filename\\*","i").exec(o);if(e){e=e[1];let c=a(e);return c=unescape(c),c=l(c),c=h(c),s(c)}if(e=function r(c){const d=[];let u;const f=i("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(u=f.exec(c));){let[,g,b,m]=u;if(g=parseInt(g,10),g in d){if(0===g)break}else d[g]=[b,m]}const p=[];for(let g=0;g<d.length&&g in d;++g){let[b,m]=d[g];m=a(m),b&&(m=unescape(m),0===g&&(m=l(m))),p.push(m)}return p.join("")}(o),e)return s(h(e));if(e=i("filename","i").exec(o),e){e=e[1];let c=a(e);return c=h(c),s(c)}function i(c,d){return new RegExp("(?:^|;)\\s*"+c+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',d)}function n(c,d){if(c){if(!/^[\x00-\xFF]+$/.test(d))return d;try{const u=new TextDecoder(c,{fatal:!0}),f=de(d);d=u.decode(f),t=!1}catch{}}return d}function s(c){return t&&/[\x80-\xff]/.test(c)&&(c=n("utf-8",c),t&&(c=n("iso-8859-1",c))),c}function a(c){if(c.startsWith('"')){const d=c.slice(1).split('\\"');for(let u=0;u<d.length;++u){const f=d[u].indexOf('"');-1!==f&&(d[u]=d[u].slice(0,f),d.length=u+1),d[u]=d[u].replaceAll(/\\(.)/g,"$1")}c=d.join('"')}return c}function l(c){const d=c.indexOf("'");return-1===d?c:n(c.slice(0,d),c.slice(d+1).replace(/^[^']*'/,""))}function h(c){return!c.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(c)?c:c.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(d,u,f,p){if("q"===f||"Q"===f)return n(u,p=(p=p.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,function(g,b){return String.fromCharCode(parseInt(b,16))}));try{p=atob(p)}catch{}return n(u,p)})}return""}(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(ki(e))return e}return null}function si(o,t){return 404===o||0===o&&t.startsWith("file:")?new ie('Missing PDF "'+t+'".'):new qe(`Unexpected server response (${o}) while retrieving PDF "${t}".`,o)}function ns(o){return 200===o||206===o}function ss(o,t,e){return{method:"GET",headers:o,signal:e.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function rs(o){return o instanceof Uint8Array?o.buffer:o instanceof ArrayBuffer?o:(V(`getArrayBuffer - unexpected data format: ${o}`),new Uint8Array(o).buffer)}class as{constructor(t){this.source=t,this.isHttp=/^https?:/i.test(t.url),this.headers=$i(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return lt(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new Qa(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=new Za(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const e of this._rangeRequestReaders.slice(0))e.cancel(t)}}class Qa{constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;const e=t.source;this._withCredentials=e.withCredentials||!1,this._contentLength=e.length,this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange;const i=new Headers(t.headers),n=e.url;fetch(n,ss(i,this._withCredentials,this._abortController)).then(s=>{if(!ns(s.status))throw si(s.status,n);this._reader=s.body.getReader(),this._headersCapability.resolve();const r=s.headers,{allowRangeRequests:a,suggestedLength:l}=Xi({responseHeaders:r,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=a,this._contentLength=l||this._contentLength,this._filename=Yi(r),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new ne("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}read(){var t=this;return(0,x.A)(function*(){yield t._headersCapability.promise;const{value:e,done:i}=yield t._reader.read();return i?{value:e,done:i}:(t._loaded+=e.byteLength,t.onProgress?.({loaded:t._loaded,total:t._contentLength}),{value:rs(e),done:!1})})()}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}class Za{constructor(t,e,i){this._stream=t,this._reader=null,this._loaded=0;const n=t.source;this._withCredentials=n.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!n.disableStream,this._abortController=new AbortController;const s=new Headers(t.headers);s.append("Range",`bytes=${e}-${i-1}`);const r=n.url;fetch(r,ss(s,this._withCredentials,this._abortController)).then(a=>{if(!ns(a.status))throw si(a.status,r);this._readCapability.resolve(),this._reader=a.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}read(){var t=this;return(0,x.A)(function*(){yield t._readCapability.promise;const{value:e,done:i}=yield t._reader.read();return i?{value:e,done:i}:(t._loaded+=e.byteLength,t.onProgress?.({loaded:t._loaded}),{value:rs(e),done:!1})})()}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}class to{constructor({url:t,httpHeaders:e,withCredentials:i}){this.url=t,this.isHttp=/^https?:/i.test(t),this.headers=$i(this.isHttp,e),this.withCredentials=i||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(t,e,i){const n={begin:t,end:e};for(const s in i)n[s]=i[s];return this.request(n)}requestFull(t){return this.request(t)}request(t){const e=new XMLHttpRequest,i=this.currXhrId++,n=this.pendingRequests[i]={xhr:e};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(const[s,r]of this.headers)e.setRequestHeader(s,r);return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),n.expectedStatus=206):n.expectedStatus=200,e.responseType="arraybuffer",t.onError&&(e.onerror=function(s){t.onError(e.status)}),e.onreadystatechange=this.onStateChange.bind(this,i),e.onprogress=this.onProgress.bind(this,i),n.onHeadersReceived=t.onHeadersReceived,n.onDone=t.onDone,n.onError=t.onError,n.onProgress=t.onProgress,e.send(null),i}onProgress(t,e){const i=this.pendingRequests[t];i&&i.onProgress?.(e)}onStateChange(t,e){const i=this.pendingRequests[t];if(!i)return;const n=i.xhr;if(n.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),4!==n.readyState||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],0===n.status&&this.isHttp)return void i.onError?.(n.status);const s=n.status||200;if((200!==s||206!==i.expectedStatus)&&s!==i.expectedStatus)return void i.onError?.(n.status);const a=function Ja(o){const t=o.response;return"string"!=typeof t?t:de(t).buffer}(n);if(206===s){const l=n.getResponseHeader("Content-Range"),h=/bytes (\d+)-(\d+)\/(\d+)/.exec(l);i.onDone({begin:parseInt(h[1],10),chunk:a})}else a?i.onDone({begin:0,chunk:a}):i.onError?.(n.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){const e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}}class eo{constructor(t){this._source=t,this._manager=new to(t),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){const e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return lt(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new io(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){const i=new no(this._manager,t,e);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const e of this._rangeRequestReaders.slice(0))e.cancel(t)}}class io{constructor(t,e){this._manager=t;const i={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._fullRequestId=t.requestFull(i),this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._contentLength=e.length,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const t=this._fullRequestId,e=this._manager.getRequestXhr(t),i=new Headers(e.getAllResponseHeaders().trim().split(/[\r\n]+/).map(r=>{const[a,...l]=r.split(": ");return[a,l.join(": ")]})),{allowRangeRequests:n,suggestedLength:s}=Xi({responseHeaders:i,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});n&&(this._isRangeSupported=!0),this._contentLength=s||this._contentLength,this._filename=Yi(i),this._isRangeSupported&&this._manager.abortRequest(t),this._headersCapability.resolve()}_onDone(t){if(t&&(this._requests.length>0?this._requests.shift().resolve({value:t.chunk,done:!1}):this._cachedChunks.push(t.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=si(t,this._url),this._headersCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){this.onProgress?.({loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}read(){var t=this;return(0,x.A)(function*(){if(t._storedError)throw t._storedError;if(t._cachedChunks.length>0)return{value:t._cachedChunks.shift(),done:!1};if(t._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return t._requests.push(e),e.promise})()}cancel(t){this._done=!0,this._headersCapability.reject(t);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class no{constructor(t,e,i){this._manager=t;const n={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(e,i,n),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(t){const e=t.chunk;this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0;for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){this._storedError=si(t,this._url);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){this.isStreamingSupported||this.onProgress?.({loaded:t.loaded})}get isStreamingSupported(){return!1}read(){var t=this;return(0,x.A)(function*(){if(t._storedError)throw t._storedError;if(null!==t._queuedChunk){const i=t._queuedChunk;return t._queuedChunk=null,{value:i,done:!1}}if(t._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return t._requests.push(e),e.promise})()}cancel(t){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const so=/^[a-z][a-z0-9\-+.]+:/i;function os(o,t,e){return"http:"===o.protocol?Zt.get("http").request(o,{headers:t},e):Zt.get("https").request(o,{headers:t},e)}class ao{constructor(t){this.source=t,this.url=function ro(o){if(so.test(o))return new URL(o);const t=Zt.get("url");return new URL(t.pathToFileURL(o))}(t.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.headers=$i(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return lt(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new ho(this):new oo(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;const i=this.isFsUrl?new co(this,t,e):new lo(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(const e of this._rangeRequestReaders.slice(0))e.cancel(t)}}class ls{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;const e=t.source;this._contentLength=e.length,this._loaded=0,this._filename=null,this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}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}read(){var t=this;return(0,x.A)(function*(){if(yield t._readCapability.promise,t._done)return{value:void 0,done:!0};if(t._storedError)throw t._storedError;const e=t._readableStream.read();return null===e?(t._readCapability=Promise.withResolvers(),t.read()):(t._loaded+=e.length,t.onProgress?.({loaded:t._loaded,total:t._contentLength}),{value:new Uint8Array(e).buffer,done:!1})})()}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",e=>{this._error(e)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new ne("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class hs{constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!t.source.disableStream}get isStreamingSupported(){return this._isStreamingSupported}read(){var t=this;return(0,x.A)(function*(){if(yield t._readCapability.promise,t._done)return{value:void 0,done:!0};if(t._storedError)throw t._storedError;const e=t._readableStream.read();return null===e?(t._readCapability=Promise.withResolvers(),t.read()):(t._loaded+=e.length,t.onProgress?.({loaded:t._loaded}),{value:new Uint8Array(e).buffer,done:!1})})()}cancel(t){this._readableStream?this._readableStream.destroy(t):this._error(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",e=>{this._error(e)}),this._storedError&&this._readableStream.destroy(this._storedError)}}class oo extends ls{constructor(t){super(t);const e=Object.fromEntries(t.headers);this._request=os(this._url,e,n=>{if(404===n.statusCode){const l=new ie(`Missing PDF "${this._url}".`);return this._storedError=l,void this._headersCapability.reject(l)}this._headersCapability.resolve(),this._setReadableStream(n);const s=new Headers(this._readableStream.headers),{allowRangeRequests:r,suggestedLength:a}=Xi({responseHeaders:s,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=r,this._contentLength=a||this._contentLength,this._filename=Yi(s)}),this._request.on("error",n=>{this._storedError=n,this._headersCapability.reject(n)}),this._request.end()}}class lo extends hs{constructor(t,e,i){super(t);const n=Object.fromEntries(t.headers);n.Range=`bytes=${e}-${i-1}`,this._request=os(this._url,n,r=>{if(404===r.statusCode){const a=new ie(`Missing PDF "${this._url}".`);return void(this._storedError=a)}this._setReadableStream(r)}),this._request.on("error",r=>{this._storedError=r}),this._request.end()}}class ho extends ls{constructor(t){super(t);const e=Zt.get("fs");e.promises.lstat(this._url).then(i=>{this._contentLength=i.size,this._setReadableStream(e.createReadStream(this._url)),this._headersCapability.resolve()},i=>{"ENOENT"===i.code&&(i=new ie(`Missing PDF "${this._url}".`)),this._storedError=i,this._headersCapability.reject(i)})}}class co extends hs{constructor(t,e,i){super(t);const n=Zt.get("fs");this._setReadableStream(n.createReadStream(this._url,{start:e,end:i-1}))}}class vt{#t=Promise.withResolvers();#e=null;#i=!1;#n=!!globalThis.FontInspector?.enabled;#s=null;#r=null;#l=0;#h=0;#c=null;#o=null;#d=0;#a=0;#u=Object.create(null);#p=[];#f=null;#g=[];#b=new WeakMap;#m=null;static#_=new Map;static#A=new Map;static#E=new WeakMap;static#y=null;static#w=new Set;constructor({textContentSource:t,container:e,viewport:i}){if(t instanceof ReadableStream)this.#f=t;else{if("object"!=typeof t)throw new Error('No "textContentSource" parameter specified.');this.#f=new ReadableStream({start(l){l.enqueue(t),l.close()}})}this.#e=this.#o=e,this.#a=i.scale*(globalThis.devicePixelRatio||1),this.#d=i.rotation,this.#r={div:null,properties:null,ctx:null};const{pageWidth:n,pageHeight:s,pageX:r,pageY:a}=i.rawDims;this.#m=[1,0,0,-1,-r,a+s],this.#h=n,this.#l=s,vt.#R(),se(e,i),this.#t.promise.finally(()=>{vt.#w.delete(this),this.#r=null,this.#u=null}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:t,isFirefox:e}=bt.platform;return U(this,"fontFamilyMap",new Map([["sans-serif",(t&&e?"Calibri, ":"")+"sans-serif"],["monospace",(t&&e?"Lucida Console, ":"")+"monospace"]]))}render(){const t=()=>{this.#c.read().then(({value:e,done:i})=>{i?this.#t.resolve():(this.#s??=e.lang,Object.assign(this.#u,e.styles),this.#L(e.items),t())},this.#t.reject)};return this.#c=this.#f.getReader(),vt.#w.add(this),t(),this.#t.promise}update({viewport:t,onBefore:e=null}){const i=t.scale*(globalThis.devicePixelRatio||1),n=t.rotation;if(n!==this.#d&&(e?.(),this.#d=n,se(this.#o,{rotation:n})),i!==this.#a){e?.(),this.#a=i;const s={div:null,properties:null,ctx:vt.#T(this.#s)};for(const r of this.#g)s.properties=this.#b.get(r),s.div=r,this.#x(s)}}cancel(){const t=new ne("TextLayer task cancelled.");this.#c?.cancel(t).catch(()=>{}),this.#c=null,this.#t.reject(t)}get textDivs(){return this.#g}get textContentItemsStr(){return this.#p}#L(t){if(this.#i)return;this.#r.ctx??=vt.#T(this.#s);const e=this.#g,i=this.#p;for(const n of t){if(e.length>1e5)return V("Ignoring additional textDivs for performance reasons."),void(this.#i=!0);if(void 0!==n.str)i.push(n.str),this.#P(n);else if("beginMarkedContentProps"===n.type||"beginMarkedContent"===n.type){const s=this.#e;this.#e=document.createElement("span"),this.#e.classList.add("markedContent"),null!==n.id&&this.#e.setAttribute("id",`${n.id}`),s.append(this.#e)}else"endMarkedContent"===n.type&&(this.#e=this.#e.parentNode)}}#P(t){const e=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};this.#g.push(e);const n=I.transform(this.#m,t.transform);let s=Math.atan2(n[1],n[0]);const r=this.#u[t.fontName];r.vertical&&(s+=Math.PI/2);let a=this.#n&&r.fontSubstitution||r.fontFamily;a=vt.fontFamilyMap.get(a)||a;const l=Math.hypot(n[2],n[3]),h=l*vt.#k(a,this.#s);let c,d;0===s?(c=n[4],d=n[5]-h):(c=n[4]+h*Math.sin(s),d=n[5]-h*Math.cos(s));const u="calc(var(--scale-factor)*",f=e.style;this.#e===this.#o?(f.left=`${(100*c/this.#h).toFixed(2)}%`,f.top=`${(100*d/this.#l).toFixed(2)}%`):(f.left=`${u}${c.toFixed(2)}px)`,f.top=`${u}${d.toFixed(2)}px)`),f.fontSize=`${u}${(vt.#y*l).toFixed(2)}px)`,f.fontFamily=a,i.fontSize=l,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,this.#n&&(e.dataset.fontName=r.fontSubstitutionLoadedName||t.fontName),0!==s&&(i.angle=s*(180/Math.PI));let p=!1;if(t.str.length>1)p=!0;else if(" "!==t.str&&t.transform[0]!==t.transform[3]){const g=Math.abs(t.transform[0]),b=Math.abs(t.transform[3]);g!==b&&Math.max(g,b)/Math.min(g,b)>1.5&&(p=!0)}if(p&&(i.canvasWidth=r.vertical?t.height:t.width),this.#b.set(e,i),this.#r.div=e,this.#r.properties=i,this.#x(this.#r),i.hasText&&this.#e.append(e),i.hasEOL){const g=document.createElement("br");g.setAttribute("role","presentation"),this.#e.append(g)}}#x(t){const{div:e,properties:i,ctx:n}=t,{style:s}=e;let r="";if(vt.#y>1&&(r=`scale(${1/vt.#y})`),0!==i.canvasWidth&&i.hasText){const{fontFamily:a}=s,{canvasWidth:l,fontSize:h}=i;vt.#S(n,h*this.#a,a);const{width:c}=n.measureText(e.textContent);c>0&&(r=`scaleX(${l*this.#a/c}) ${r}`)}0!==i.angle&&(r=`rotate(${i.angle}deg) ${r}`),r.length>0&&(s.transform=r)}static cleanup(){if(!(this.#w.size>0)){this.#_.clear();for(const{canvas:t}of this.#A.values())t.remove();this.#A.clear()}}static#T(t=null){let e=this.#A.get(t||="");if(!e){const i=document.createElement("canvas");i.className="hiddenCanvasElement",i.lang=t,document.body.append(i),e=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#A.set(t,e),this.#E.set(e,{size:0,family:""})}return e}static#S(t,e,i){const n=this.#E.get(t);e===n.size&&i===n.family||(t.font=`${e}px ${i}`,n.size=e,n.family=i)}static#R(){if(null!==this.#y)return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),this.#y=t.getBoundingClientRect().height,t.remove()}static#k(t,e){const i=this.#_.get(t);if(i)return i;const n=this.#T(e);n.canvas.width=n.canvas.height=30,this.#S(n,30,t);const s=n.measureText("");let r=s.fontBoundingBoxAscent,a=Math.abs(s.fontBoundingBoxDescent);if(r){const c=r/(r+a);return this.#_.set(t,c),n.canvas.width=n.canvas.height=0,c}n.strokeStyle="red",n.clearRect(0,0,30,30),n.strokeText("g",0,0);let l=n.getImageData(0,0,30,30).data;a=0;for(let c=l.length-1-3;c>=0;c-=4)if(l[c]>0){a=Math.ceil(c/4/30);break}n.clearRect(0,0,30,30),n.strokeText("A",0,30),l=n.getImageData(0,0,30,30).data,r=0;for(let c=0,d=l.length;c<d;c+=4)if(l[c]>0){r=30-Math.floor(c/4/30);break}n.canvas.width=n.canvas.height=0;const h=r?r/(r+a):.8;return this.#_.set(t,h),h}}class Ie{static textContent(t){const e=[],i={items:e,styles:Object.create(null)};return function n(s){if(!s)return;let r=null;const a=s.name;if("#text"===a)r=s.value;else{if(!Ie.shouldBuildText(a))return;s?.attributes?.textContent?r=s.attributes.textContent:s.value&&(r=s.value)}if(null!==r&&e.push({str:r}),s.children)for(const l of s.children)n(l)}(t),i}static shouldBuildText(t){return!("textarea"===t||"input"===t||"option"===t||"select"===t)}}const bo=ft?class Pa extends Vn{_createCanvas(t,e){return Zt.get("canvas").createCanvas(t,e)}}:class xa extends Vn{constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}_createCanvas(t,e){const i=this._document.createElement("canvas");return i.width=t,i.height=e,i}},_o=ft?class Ta extends jn{_fetch(t){return(0,x.A)(function*(){return Gn(t)})()}}:Hn,vo=ft?class Sa extends zn{}:class Ca extends zn{#t;#e;#i;#n;#s;#r;#l=0;constructor({docId:t,ownerDocument:e=globalThis.document}){super(),this.#n=t,this.#s=e}get#h(){return this.#e||=new Map}get#c(){return this.#r||=new Map}get#o(){if(!this.#i){const t=this.#s.createElement("div"),{style:e}=t;e.visibility="hidden",e.contain="strict",e.width=e.height=0,e.position="absolute",e.top=e.left=0,e.zIndex=-1;const i=this.#s.createElementNS(zt,"svg");i.setAttribute("width",0),i.setAttribute("height",0),this.#i=this.#s.createElementNS(zt,"defs"),t.append(i),i.append(this.#i),this.#s.body.append(t)}return this.#i}#d(t){if(1===t.length){const l=t[0],h=new Array(256);for(let d=0;d<256;d++)h[d]=l[d]/255;const c=h.join(",");return[c,c,c]}const[e,i,n]=t,s=new Array(256),r=new Array(256),a=new Array(256);for(let l=0;l<256;l++)s[l]=e[l]/255,r[l]=i[l]/255,a[l]=n[l]/255;return[s.join(","),r.join(","),a.join(",")]}#a(t){if(void 0===this.#t){this.#t="";const e=this.#s.URL;e!==this.#s.baseURI&&(Je(e)?V('#createUrl: ignore "data:"-URL for performance reasons.'):this.#t=e.split("#",1)[0])}return`url(${this.#t}#${t})`}addFilter(t){if(!t)return"none";let e=this.#h.get(t);if(e)return e;const[i,n,s]=this.#d(t),r=1===t.length?i:`${i}${n}${s}`;if(e=this.#h.get(r),e)return this.#h.set(t,e),e;const a=`g_${this.#n}_transfer_map_${this.#l++}`,l=this.#a(a);this.#h.set(t,l),this.#h.set(r,l);const h=this.#f(a);return this.#b(i,n,s,h),l}addHCMFilter(t,e){const i=`${t}-${e}`,n="base";let s=this.#c.get(n);if(s?.key===i||(s?(s.filter?.remove(),s.key=i,s.url="none",s.filter=null):(s={key:i,url:"none",filter:null},this.#c.set(n,s)),!t||!e))return s.url;const r=this.#_(t);t=I.makeHexColor(...r);const a=this.#_(e);if(e=I.makeHexColor(...a),this.#o.style.color="","#000000"===t&&"#ffffff"===e||t===e)return s.url;const l=new Array(256);for(let f=0;f<=255;f++){const p=f/255;l[f]=p<=.03928?p/12.92:((p+.055)/1.055)**2.4}const h=l.join(","),c=`g_${this.#n}_hcm_filter`,d=s.filter=this.#f(c);this.#b(h,h,h,d),this.#p(d);const u=(f,p)=>{const g=r[f]/255,b=a[f]/255,m=new Array(p+1);for(let v=0;v<=p;v++)m[v]=g+v/p*(b-g);return m.join(",")};return this.#b(u(0,5),u(1,5),u(2,5),d),s.url=this.#a(c),s.url}addAlphaFilter(t){let e=this.#h.get(t);if(e)return e;const[i]=this.#d([t]),n=`alpha_${i}`;if(e=this.#h.get(n),e)return this.#h.set(t,e),e;const s=`g_${this.#n}_alpha_map_${this.#l++}`,r=this.#a(s);this.#h.set(t,r),this.#h.set(n,r);const a=this.#f(s);return this.#m(i,a),r}addLuminosityFilter(t){let i,n,e=this.#h.get(t||"luminosity");if(e)return e;if(t?([i]=this.#d([t]),n=`luminosity_${i}`):n="luminosity",e=this.#h.get(n),e)return this.#h.set(t,e),e;const s=`g_${this.#n}_luminosity_map_${this.#l++}`,r=this.#a(s);this.#h.set(t,r),this.#h.set(n,r);const a=this.#f(s);return this.#u(a),t&&this.#m(i,a),r}addHighlightHCMFilter(t,e,i,n,s){const r=`${e}-${i}-${n}-${s}`;let a=this.#c.get(t);if(a?.key===r||(a?(a.filter?.remove(),a.key=r,a.url="none",a.filter=null):(a={key:r,url:"none",filter:null},this.#c.set(t,a)),!e||!i))return a.url;const[l,h]=[e,i].map(this.#_.bind(this));let c=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),d=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),[u,f]=[n,s].map(this.#_.bind(this));d<c&&([c,d,u,f]=[d,c,f,u]),this.#o.style.color="";const p=(m,v,A)=>{const w=new Array(256),E=(d-c)/A,C=m/255,M=(v-m)/(255*A);let T=0;for(let y=0;y<=A;y++){const S=Math.round(c+y*E),L=C+y*M;for(let z=T;z<=S;z++)w[z]=L;T=S+1}for(let y=T;y<256;y++)w[y]=w[T-1];return w.join(",")},g=`g_${this.#n}_hcm_${t}_filter`,b=a.filter=this.#f(g);return this.#p(b),this.#b(p(u[0],f[0],5),p(u[1],f[1],5),p(u[2],f[2],5),b),a.url=this.#a(g),a.url}destroy(t=!1){t&&0!==this.#c.size||(this.#i&&(this.#i.parentNode.parentNode.remove(),this.#i=null),this.#e&&(this.#e.clear(),this.#e=null),this.#l=0)}#u(t){const e=this.#s.createElementNS(zt,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),t.append(e)}#p(t){const e=this.#s.createElementNS(zt,"feColorMatrix");e.setAttribute("type","matrix"),e.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"),t.append(e)}#f(t){const e=this.#s.createElementNS(zt,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),this.#o.append(e),e}#g(t,e,i){const n=this.#s.createElementNS(zt,e);n.setAttribute("type","discrete"),n.setAttribute("tableValues",i),t.append(n)}#b(t,e,i,n){const s=this.#s.createElementNS(zt,"feComponentTransfer");n.append(s),this.#g(s,"feFuncR",t),this.#g(s,"feFuncG",e),this.#g(s,"feFuncB",i)}#m(t,e){const i=this.#s.createElementNS(zt,"feComponentTransfer");e.append(i),this.#g(i,"feFuncA",t)}#_(t){return this.#o.style.color=t,Di(getComputedStyle(this.#o).getPropertyValue("color"))}},Ao=ft?class Ma extends Wn{_fetch(t){return(0,x.A)(function*(){return Gn(t)})()}}:Un;function yo(o={}){"string"==typeof o||o instanceof URL?o={url:o}:(o instanceof ArrayBuffer||ArrayBuffer.isView(o))&&(o={data:o});const t=new Qi,{docId:e}=t,i=o.url?function wo(o){if(o instanceof URL)return o.href;try{return new URL(o,window.location).href}catch{if(ft&&"string"==typeof o)return o}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(o.url):null,n=o.data?function Eo(o){if(ft&&typeof Buffer<"u"&&o instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(o instanceof Uint8Array&&o.byteLength===o.buffer.byteLength)return o;if("string"==typeof o)return de(o);if(o instanceof ArrayBuffer||ArrayBuffer.isView(o)||"object"==typeof o&&!isNaN(o?.length))return new Uint8Array(o);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(o.data):null,s=o.httpHeaders||null,r=!0===o.withCredentials,a=o.password??null,l=o.range instanceof ds?o.range:null,h=Number.isInteger(o.rangeChunkSize)&&o.rangeChunkSize>0?o.rangeChunkSize:65536;let c=o.worker instanceof ct?o.worker:null;const d=o.verbosity,u="string"!=typeof o.docBaseUrl||Je(o.docBaseUrl)?null:o.docBaseUrl,f="string"==typeof o.cMapUrl?o.cMapUrl:null,p=!1!==o.cMapPacked,g=o.CMapReaderFactory||_o,b="string"==typeof o.standardFontDataUrl?o.standardFontDataUrl:null,m=o.StandardFontDataFactory||Ao,v=!0!==o.stopAtErrors,A=Number.isInteger(o.maxImageSize)&&o.maxImageSize>-1?o.maxImageSize:-1,w=!1!==o.isEvalSupported,E="boolean"==typeof o.isOffscreenCanvasSupported?o.isOffscreenCanvasSupported:!ft,C="boolean"==typeof o.isChrome?o.isChrome:!bt.platform.isFirefox&&typeof window<"u"&&!!window?.chrome,M=Number.isInteger(o.canvasMaxAreaInBytes)?o.canvasMaxAreaInBytes:-1,T="boolean"==typeof o.disableFontFace?o.disableFontFace:ft,y=!0===o.fontExtraProperties,S=!0===o.enableXfa,L=o.ownerDocument||globalThis.document,z=!0===o.disableRange,H=!0===o.disableStream,W=!0===o.disableAutoFetch,$=!0===o.pdfBug,et=o.CanvasFactory||bo,k=o.FilterFactory||vo,j=!0===o.enableHWA,te=l?l.length:o.length??NaN,ce="boolean"==typeof o.useSystemFonts?o.useSystemFonts:!ft&&!T,Lt="boolean"==typeof o.useWorkerFetch?o.useWorkerFetch:g===Hn&&m===Un&&f&&b&&Ce(f,document.baseURI)&&Ce(b,document.baseURI);o.canvasFactory&&kn("`canvasFactory`-instance option, please use `CanvasFactory` instead."),o.filterFactory&&kn("`filterFactory`-instance option, please use `FilterFactory` instead."),function ta(o){Number.isInteger(o)&&(Ye=o)}(d);const at={canvasFactory:new et({ownerDocument:L,enableHWA:j}),filterFactory:new k({docId:e,ownerDocument:L}),cMapReaderFactory:Lt?null:new g({baseUrl:f,isCompressed:p}),standardFontDataFactory:Lt?null:new m({baseUrl:b})};if(!c){const Rt={verbosity:d,port:Le.workerPort};c=Rt.port?ct.fromPort(Rt):new ct(Rt),t._worker=c}const ye={docId:e,apiVersion:"4.8.69",data:n,password:a,disableAutoFetch:W,rangeChunkSize:h,length:te,docBaseUrl:u,enableXfa:S,evaluatorOptions:{maxImageSize:A,disableFontFace:T,ignoreErrors:v,isEvalSupported:w,isOffscreenCanvasSupported:E,isChrome:C,canvasMaxAreaInBytes:M,fontExtraProperties:y,useSystemFonts:ce,cMapUrl:Lt?f:null,standardFontDataUrl:Lt?b:null}},We={disableFontFace:T,fontExtraProperties:y,ownerDocument:L,pdfBug:$,styleElement:null,loadingParams:{disableAutoFetch:W,enableXfa:S}};return c.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(c.destroyed)throw new Error("Worker was destroyed");const Rt=c.messageHandler.sendWithPromise("GetDocRequest",ye,n?[n.buffer]:null);let Y;if(l)Y=new Xa(l,{disableRange:z,disableStream:H});else if(!n){if(!i)throw new Error("getDocument - no `url` parameter provided.");let Kt;Kt=ft?typeof fetch<"u"&&typeof Response<"u"&&"body"in Response.prototype&&Ce(i)?as:ao:Ce(i)?as:eo,Y=new Kt({url:i,length:te,httpHeaders:s,withCredentials:r,rangeChunkSize:h,disableRange:z,disableStream:H})}return Rt.then(Kt=>{if(t.destroyed)throw new Error("Loading aborted");if(c.destroyed)throw new Error("Worker was destroyed");const Cn=new Re(e,Kt,c.port),Dd=new Po(Cn,t,Y,We,at);t._transport=Dd,Cn.send("Ready",null)})}).catch(t._capability.reject),t}function cs(o){return"object"==typeof o&&Number.isInteger(o?.num)&&o.num>=0&&Number.isInteger(o?.gen)&&o.gen>=0}class Qi{static#t=0;constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId="d"+Qi.#t++,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}destroy(){var t=this;return(0,x.A)(function*(){t.destroyed=!0;try{t._worker?.port&&(t._worker._pendingDestroy=!0),yield t._transport?.destroy()}catch(e){throw t._worker?.port&&delete t._worker._pendingDestroy,e}t._transport=null,t._worker&&(t._worker.destroy(),t._worker=null)})()}}class ds{constructor(t,e,i=!1,n=null){this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=n,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}addRangeListener(t){this._rangeListeners.push(t)}addProgressListener(t){this._progressListeners.push(t)}addProgressiveReadListener(t){this._progressiveReadListeners.push(t)}addProgressiveDoneListener(t){this._progressiveDoneListeners.push(t)}onDataRange(t,e){for(const i of this._rangeListeners)i(t,e)}onDataProgress(t,e){this._readyCapability.promise.then(()=>{for(const i of this._progressListeners)i(t,e)})}onDataProgressiveRead(t){this._readyCapability.promise.then(()=>{for(const e of this._progressiveReadListeners)e(t)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const t of this._progressiveDoneListeners)t()})}transportReady(){this._readyCapability.resolve()}requestDataRange(t,e){X("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class xo{constructor(t,e){this._pdfInfo=t,this._transport=e}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return U(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}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(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}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()}}class Co{#t=null;#e=!1;constructor(t,e,i,n=!1){this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=n?new In:null,this._pdfBug=n,this.commonObjs=i.commonObjs,this.objs=new us,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:t,rotation:e=this.rotate,offsetX:i=0,offsetY:n=0,dontFlip:s=!1}={}){return new xe({viewBox:this.view,scale:t,rotation:e,offsetX:i,offsetY:n,dontFlip:s})}getAnnotations({intent:t="display"}={}){const{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return U(this,"isPureXfa",!!this._transport._htmlForXfa)}getXfa(){var t=this;return(0,x.A)(function*(){return t._transport._htmlForXfa?.children[t._pageIndex]||null})()}render({canvasContext:t,viewport:e,intent:i="display",annotationMode:n=qt.ENABLE,transform:s=null,background:r=null,optionalContentConfigPromise:a=null,annotationCanvasMap:l=null,pageColors:h=null,printAnnotationStorage:c=null,isEditing:d=!1}){this._stats?.time("Overall");const u=this._transport.getRenderingIntent(i,n,c,d),{renderingIntent:f,cacheKey:p}=u;this.#e=!1,this.#n(),a||=this._transport.getOptionalContentConfig(f);let g=this._intentStates.get(p);g||(g=Object.create(null),this._intentStates.set(p,g)),g.streamReaderCancelTimeout&&(clearTimeout(g.streamReaderCancelTimeout),g.streamReaderCancelTimeout=null);const b=!!(4&f);g.displayReadyCapability||(g.displayReadyCapability=Promise.withResolvers(),g.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(u));const m=w=>{g.renderTasks.delete(v),(this._maybeCleanupAfterRender||b)&&(this.#e=!0),this.#i(!b),w?(v.capability.reject(w),this._abortOperatorList({intentState:g,reason:w instanceof Error?w:new Error(w)})):v.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},v=new ge({callback:m,params:{canvasContext:t,viewport:e,transform:s,background:r},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:l,operatorList:g.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!b,pdfBug:this._pdfBug,pageColors:h});(g.renderTasks||=new Set).add(v);const A=v.task;return Promise.all([g.displayReadyCapability.promise,a]).then(([w,E])=>{if(this.destroyed)m();else{if(this._stats?.time("Rendering"),!(E.renderingIntent&f))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");v.initializeGraphics({transparency:w,optionalContentConfig:E}),v.operatorListChanged()}}).catch(m),A}getOperatorList({intent:t="display",annotationMode:e=qt.ENABLE,printAnnotationStorage:i=null,isEditing:n=!1}={}){const r=this._transport.getRenderingIntent(t,e,i,n,!0);let l,a=this._intentStates.get(r.cacheKey);return a||(a=Object.create(null),this._intentStates.set(r.cacheKey,a)),a.opListReadCapability||(l=Object.create(null),l.operatorListChanged=function s(){a.operatorList.lastChunk&&(a.opListReadCapability.resolve(a.operatorList),a.renderTasks.delete(l))},a.opListReadCapability=Promise.withResolvers(),(a.renderTasks||=new Set).add(l),a.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(r)),a.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===t,disableNormalization:!0===e},{highWaterMark:100,size:n=>n.items.length})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(i=>Ie.textContent(i));const e=this.streamTextContent(t);return new Promise(function(i,n){const r=e.getReader(),a={items:[],styles:Object.create(null),lang:null};!function s(){r.read().then(function({value:l,done:h}){h?i(a):(a.lang??=l.lang,Object.assign(a.styles,l.styles),a.items.push(...l.items),s())},n)}()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const t=[];for(const e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(const i of e.renderTasks)t.push(i.completed),i.cancel();return this.objs.clear(),this.#e=!1,this.#n(),Promise.all(t)}cleanup(t=!1){this.#e=!0;const e=this.#i(!1);return t&&e&&(this._stats&&=new In),e}#i(t=!1){if(this.#n(),!this.#e||this.destroyed)return!1;if(t)return this.#t=setTimeout(()=>{this.#t=null,this.#i(!1)},5e3),!1;for(const{renderTasks:e,operatorList:i}of this._intentStates.values())if(e.size>0||!i.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#e=!1,!0}#n(){this.#t&&(clearTimeout(this.#t),this.#t=null)}_startRenderPage(t,e){const i=this._intentStates.get(e);i&&(this._stats?.timeEnd("Page Request"),i.displayReadyCapability?.resolve(t))}_renderPageChunk(t,e){for(let i=0,n=t.length;i<n;i++)e.operatorList.fnArray.push(t.fnArray[i]),e.operatorList.argsArray.push(t.argsArray[i]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(const i of e.renderTasks)i.operatorListChanged();t.lastChunk&&this.#i(!0)}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:i,modifiedIds:n}){const{map:s,transfer:r}=i,l=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:s,modifiedIds:n},r).getReader(),h=this._intentStates.get(e);h.streamReader=l;const c=()=>{l.read().then(({value:d,done:u})=>{u?h.streamReader=null:this._transport.destroyed||(this._renderPageChunk(d,h),c())},d=>{if(h.streamReader=null,!this._transport.destroyed){if(h.operatorList){h.operatorList.lastChunk=!0;for(const u of h.renderTasks)u.operatorListChanged();this.#i(!0)}if(h.displayReadyCapability)h.displayReadyCapability.reject(d);else{if(!h.opListReadCapability)throw d;h.opListReadCapability.reject(d)}}})};c()}_abortOperatorList({intentState:t,reason:e,force:i=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!i){if(t.renderTasks.size>0)return;if(e instanceof Ii){let n=100;return e.extraDelay>0&&e.extraDelay<1e3&&(n+=e.extraDelay),void(t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},n))}}if(t.streamReader.cancel(new ne(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(const[n,s]of this._intentStates)if(s===t){this._intentStates.delete(n);break}this.cleanup()}}}get stats(){return this._stats}}class So{#t=new Map;#e=Promise.resolve();postMessage(t,e){const i={data:structuredClone(t,e?{transfer:e}:null)};this.#e.then(()=>{for(const[n]of this.#t)n.call(this,i)})}addEventListener(t,e,i=null){let n=null;if(i?.signal instanceof AbortSignal){const{signal:s}=i;if(s.aborted)return void V("LoopbackPort - cannot use an `aborted` signal.");const r=()=>this.removeEventListener(t,e);n=()=>s.removeEventListener("abort",r),s.addEventListener("abort",r)}this.#t.set(e,n)}removeEventListener(t,e){this.#t.get(e)?.(),this.#t.delete(e)}terminate(){for(const[,t]of this.#t)t?.();this.#t.clear()}}class ct{static#t=0;static#e=!1;static#i;static{ft&&(this.#e=!0,Le.workerSrc||="./pdf.worker.mjs"),this._isSameOrigin=(t,e)=>{let i;try{if(i=new URL(t),!i.origin||"null"===i.origin)return!1}catch{return!1}const n=new URL(e,i);return i.origin===n.origin},this._createCDNWrapper=t=>URL.createObjectURL(new Blob([`await import("${t}");`],{type:"text/javascript"}))}constructor({name:t=null,port:e=null,verbosity:i=ea()}={}){if(this.name=t,this.destroyed=!1,this.verbosity=i,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,e){if(ct.#i?.has(e))throw new Error("Cannot use more than one PDFWorker per port.");return(ct.#i||=new WeakMap).set(e,this),void this._initializeFromPort(e)}this._initialize()}get promise(){return ft?Promise.all([Zt.promise,this._readyCapability.promise]):this._readyCapability.promise}#n(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(t){this._port=t,this._messageHandler=new Re("main","worker",t),this._messageHandler.on("ready",function(){}),this.#n()}_initialize(){if(ct.#e||ct.#s)return void this._setupFakeWorker();let{workerSrc:t}=ct;try{ct._isSameOrigin(window.location.href,t)||(t=ct._createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),i=new Re("main","worker",e),n=()=>{s.abort(),i.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},s=new AbortController;e.addEventListener("error",()=>{this._webWorker||n()},{signal:s.signal}),i.on("test",a=>{s.abort(),!this.destroyed&&a?(this._messageHandler=i,this._port=e,this._webWorker=e,this.#n()):n()}),i.on("ready",a=>{if(s.abort(),this.destroyed)n();else try{r()}catch{this._setupFakeWorker()}});const r=()=>{const a=new Uint8Array;i.send("test",a,[a.buffer])};return void r()}catch{Ke("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){ct.#e||(V("Setting up fake worker."),ct.#e=!0),ct._setupFakeWorkerGlobal.then(t=>{if(this.destroyed)return void this._readyCapability.reject(new Error("Worker was destroyed"));const e=new So;this._port=e;const i="fake"+ct.#t++,n=new Re(i+"_worker",i,e);t.setup(n,e),this._messageHandler=new Re(i,i+"_worker",e),this.#n()}).catch(t=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),ct.#i?.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){if(!t?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");const e=this.#i?.get(t.port);if(e){if(e._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new ct(t)}static get workerSrc(){if(Le.workerSrc)return Le.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get#s(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){var t=this;return U(this,"_setupFakeWorkerGlobal",function(){var i=(0,x.A)(function*(){return t.#s?t.#s:(yield import(t.workerSrc)).WorkerMessageHandler});return function(){return i.apply(this,arguments)}}()())}}class Po{#t=new Map;#e=new Map;#i=new Map;#n=new Map;#s=null;constructor(t,e,i,n,s){this.messageHandler=t,this.loadingTask=e,this.commonObjs=new us,this.fontLoader=new wa({ownerDocument:n.ownerDocument,styleElement:n.styleElement}),this.loadingParams=n.loadingParams,this._params=n,this.canvasFactory=s.canvasFactory,this.filterFactory=s.filterFactory,this.cMapReaderFactory=s.cMapReaderFactory,this.standardFontDataFactory=s.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}#r(t,e=null){const i=this.#t.get(t);if(i)return i;const n=this.messageHandler.sendWithPromise(t,e);return this.#t.set(t,n),n}get annotationStorage(){return U(this,"annotationStorage",new Vi)}getRenderingIntent(t,e=qt.ENABLE,i=null,n=!1,s=!1){let r=2,a=Bi;switch(t){case"any":r=1;break;case"display":break;case"print":r=4;break;default:V(`getRenderingIntent - invalid intent: ${t}`)}const l=4&r&&i instanceof Bn?i:this.annotationStorage;switch(e){case qt.DISABLE:r+=64;break;case qt.ENABLE:break;case qt.ENABLE_FORMS:r+=16;break;case qt.ENABLE_STORAGE:r+=32,a=l.serializable;break;default:V(`getRenderingIntent - invalid annotationMode: ${e}`)}n&&(r+=128),s&&(r+=256);const{ids:h,hash:c}=l.modifiedIds;return{renderingIntent:r,cacheKey:[r,a.hash,c].join("_"),annotationStorageSerializable:a,modifiedIds:h}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#s?.reject(new Error("Worker was destroyed during onPassword callback"));const t=[];for(const i of this.#e.values())t.push(i._destroy());this.#e.clear(),this.#i.clear(),this.#n.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#t.clear(),this.filterFactory.destroy(),vt.cleanup(),this._networkStream?.cancelAllRequests(new ne("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){var t=this;const{messageHandler:e,loadingTask:i}=this;e.on("GetReader",(n,s)=>{lt(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=r=>{this._lastProgress={loaded:r.loaded,total:r.total}},s.onPull=()=>{this._fullReader.read().then(function({value:r,done:a}){a?s.close():(lt(r instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(r),1,[r]))}).catch(r=>{s.error(r)})},s.onCancel=r=>{this._fullReader.cancel(r),s.ready.catch(a=>{if(!this.destroyed)throw a})}}),e.on("ReaderHeadersReady",function(){var n=(0,x.A)(function*(s){yield t._fullReader.headersReady;const{isStreamingSupported:r,isRangeSupported:a,contentLength:l}=t._fullReader;return(!r||!a)&&(t._lastProgress&&i.onProgress?.(t._lastProgress),t._fullReader.onProgress=h=>{i.onProgress?.({loaded:h.loaded,total:h.total})}),{isStreamingSupported:r,isRangeSupported:a,contentLength:l}});return function(s){return n.apply(this,arguments)}}()),e.on("GetRangeReader",(n,s)=>{lt(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const r=this._networkStream.getRangeReader(n.begin,n.end);r?(s.onPull=()=>{r.read().then(function({value:a,done:l}){l?s.close():(lt(a instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(a),1,[a]))}).catch(a=>{s.error(a)})},s.onCancel=a=>{r.cancel(a),s.ready.catch(l=>{if(!this.destroyed)throw l})}):s.close()}),e.on("GetDoc",({pdfInfo:n})=>{this._numPages=n.numPages,this._htmlForXfa=n.htmlForXfa,delete n.htmlForXfa,i._capability.resolve(new xo(n,this))}),e.on("DocException",function(n){let s;switch(n.name){case"PasswordException":s=new Si(n.message,n.code);break;case"InvalidPDFException":s=new Mn(n.message);break;case"MissingPDFException":s=new ie(n.message);break;case"UnexpectedResponseException":s=new qe(n.message,n.status);break;case"UnknownErrorException":s=new Pi(n.message,n.details);break;default:X("DocException - expected a valid Error.")}i._capability.reject(s)}),e.on("PasswordRequest",n=>{if(this.#s=Promise.withResolvers(),i.onPassword){const s=r=>{r instanceof Error?this.#s.reject(r):this.#s.resolve({password:r})};try{i.onPassword(s,n.code)}catch(r){this.#s.reject(r)}}else this.#s.reject(new Si(n.message,n.code));return this.#s.promise}),e.on("DataLoaded",n=>{i.onProgress?.({loaded:n.length,total:n.length}),this.downloadInfoCapability.resolve(n)}),e.on("StartRenderPage",n=>{this.destroyed||this.#e.get(n.pageIndex)._startRenderPage(n.transparency,n.cacheKey)}),e.on("commonobj",([n,s,r])=>{if(this.destroyed||this.commonObjs.has(n))return null;switch(s){case"Font":const{disableFontFace:a,fontExtraProperties:l,pdfBug:h}=this._params;if("error"in r){const f=r.error;V(`Error during font loading: ${f}`),this.commonObjs.resolve(n,f);break}const c=h&&globalThis.FontInspector?.enabled?(f,p)=>globalThis.FontInspector.fontAdded(f,p):null,d=new Ea(r,{disableFontFace:a,inspectFont:c});this.fontLoader.bind(d).catch(()=>e.sendWithPromise("FontFallback",{id:n})).finally(()=>{!l&&d.data&&(d.data=null),this.commonObjs.resolve(n,d)});break;case"CopyLocalImage":const{imageRef:u}=r;lt(u,"The imageRef must be defined.");for(const f of this.#e.values())for(const[,p]of f.objs)if(p?.ref===u)return p.dataLen?(this.commonObjs.resolve(n,structuredClone(p)),p.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(n,r);break;default:throw new Error(`Got unknown common object type ${s}`)}return null}),e.on("obj",([n,s,r,a])=>{if(this.destroyed)return;const l=this.#e.get(s);if(!l.objs.has(n)){if(0===l._intentStates.size)return void a?.bitmap?.close();switch(r){case"Image":l.objs.resolve(n,a),a?.dataLen>1e7&&(l._maybeCleanupAfterRender=!0);break;case"Pattern":l.objs.resolve(n,a);break;default:throw new Error(`Got unknown object type ${r}`)}}}),e.on("DocProgress",n=>{this.destroyed||i.onProgress?.({loaded:n.loaded,total:n.total})}),e.on("FetchBuiltInCMap",function(){var n=(0,x.A)(function*(s){if(t.destroyed)throw new Error("Worker was destroyed.");if(!t.cMapReaderFactory)throw new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");return t.cMapReaderFactory.fetch(s)});return function(s){return n.apply(this,arguments)}}()),e.on("FetchStandardFontData",function(){var n=(0,x.A)(function*(s){if(t.destroyed)throw new Error("Worker was destroyed.");if(!t.standardFontDataFactory)throw new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");return t.standardFontDataFactory.fetch(s)});return function(s){return n.apply(this,arguments)}}())}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&V("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:t,transfer:e}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:this._fullReader?.filename??null},e).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));const e=t-1,i=this.#i.get(e);if(i)return i;const n=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(s=>{if(this.destroyed)throw new Error("Transport destroyed");s.refStr&&this.#n.set(s.refStr,t);const r=new Co(e,s,this,this._params.pdfBug);return this.#e.set(e,r),r});return this.#i.set(e,n),n}getPageIndex(t){return cs(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getFieldObjects(){return this.#r("GetFieldObjects")}hasJSActions(){return this.#r("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return"string"!=typeof t?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return this.#r("GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return this.#r("GetOptionalContentConfig").then(e=>new $a(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const t="GetMetadata",e=this.#t.get(t);if(e)return e;const i=this.messageHandler.sendWithPromise(t,null).then(n=>({info:n[0],metadata:n[1]?new Ua(n[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#t.set(t,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}startCleanup(){var t=this;return(0,x.A)(function*(e=!1){if(!t.destroyed){yield t.messageHandler.sendWithPromise("Cleanup",null);for(const i of t.#e.values())if(!i.cleanup())throw new Error(`startCleanup: Page ${i.pageNumber} is currently rendering.`);t.commonObjs.clear(),e||t.fontLoader.clear(),t.#t.clear(),t.filterFactory.destroy(!0),vt.cleanup()}}).apply(this,arguments)}cachedPageNumber(t){return cs(t)?this.#n.get(0===t.gen?`${t.num}R`:`${t.num}R${t.gen}`)??null:null}}const ri=Symbol("INITIAL_DATA");class us{#t=Object.create(null);#e(t){return this.#t[t]||={...Promise.withResolvers(),data:ri}}get(t,e=null){if(e){const n=this.#e(t);return n.promise.then(()=>e(n.data)),null}const i=this.#t[t];if(!i||i.data===ri)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return i.data}has(t){const e=this.#t[t];return!!e&&e.data!==ri}resolve(t,e=null){const i=this.#e(t);i.data=e,i.resolve()}clear(){for(const t in this.#t){const{data:e}=this.#t[t];e?.bitmap?.close()}this.#t=Object.create(null)}*[Symbol.iterator](){for(const t in this.#t){const{data:e}=this.#t[t];e!==ri&&(yield[t,e])}}}class To{#t=null;constructor(t){this.#t=t,this.onContinue=null}get promise(){return this.#t.capability.promise}cancel(t=0){this.#t.cancel(null,t)}get separateAnnots(){const{separateAnnots:t}=this.#t.operatorList;if(!t)return!1;const{annotationCanvasMap:e}=this.#t;return t.form||t.canvas&&e?.size>0}}class ge{#t=null;static#e=new WeakSet;constructor({callback:t,params:e,objs:i,commonObjs:n,annotationCanvasMap:s,operatorList:r,pageIndex:a,canvasFactory:l,filterFactory:h,useRequestAnimationFrame:c=!1,pdfBug:d=!1,pageColors:u=null}){this.callback=t,this.params=e,this.objs=i,this.commonObjs=n,this.annotationCanvasMap=s,this.operatorListIdx=null,this.operatorList=r,this._pageIndex=a,this.canvasFactory=l,this.filterFactory=h,this._pdfBug=d,this.pageColors=u,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===c&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new To(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=e.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){if(this.cancelled)return;if(this._canvas){if(ge.#e.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");ge.#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());const{canvasContext:i,viewport:n,transform:s,background:r}=this.params;this.gfx=new fe(i,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:s,viewport:n,transparency:t,background:r}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(t=null,e=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#t&&(window.cancelAnimationFrame(this.#t),this.#t=null),ge.#e.delete(this._canvas),this.callback(t||new Ii(`Rendering cancelled, page ${this._pageIndex+1}`,e))}operatorListChanged(){this.graphicsReady?(this.stepper?.updateOperatorList(this.operatorList),!this.running&&this._continue()):this.graphicsReadyCallback||=this._continueBound}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?this.#t=window.requestAnimationFrame(()=>{this.#t=null,this._nextBound().catch(this._cancelBound)}):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}_next(){var t=this;return(0,x.A)(function*(){t.cancelled||(t.operatorListIdx=t.gfx.executeOperatorList(t.operatorList,t.operatorListIdx,t._continueBound,t.stepper),t.operatorListIdx===t.operatorList.argsArray.length&&(t.running=!1,t.operatorList.lastChunk&&(t.gfx.endDrawing(),ge.#e.delete(t._canvas),t.callback())))})()}}const Mo="4.8.69",Lo="3634dab10";function fs(o){return Math.floor(255*Math.max(0,Math.min(1,o))).toString(16).padStart(2,"0")}function ke(o){return Math.max(0,Math.min(255,255*o))}class ps{static CMYK_G([t,e,i,n]){return["G",1-Math.min(1,.3*t+.59*i+.11*e+n)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return[t=ke(t),t,t]}static G_HTML([t]){const e=fs(t);return`#${e}${e}${e}`}static RGB_G([t,e,i]){return["G",.3*t+.59*e+.11*i]}static RGB_rgb(t){return t.map(ke)}static RGB_HTML(t){return`#${t.map(fs).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,i,n]){return["RGB",1-Math.min(1,t+n),1-Math.min(1,i+n),1-Math.min(1,e+n)]}static CMYK_rgb([t,e,i,n]){return[ke(1-Math.min(1,t+n)),ke(1-Math.min(1,i+n)),ke(1-Math.min(1,e+n))]}static CMYK_HTML(t){const e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,i]){const n=1-t,s=1-e,r=1-i;return["CMYK",n,s,r,Math.min(n,s,r)]}}class Ro{create(t,e,i=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");const n=this._createSVG("svg:svg");return n.setAttribute("version","1.1"),i||(n.setAttribute("width",`${t}px`),n.setAttribute("height",`${e}px`)),n.setAttribute("preserveAspectRatio","none"),n.setAttribute("viewBox",`0 0 ${t} ${e}`),n}createElement(t){if("string"!=typeof t)throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){X("Abstract method `_createSVG` called.")}}class Zi extends Ro{_createSVG(t){return document.createElementNS(zt,t)}}class gs{static setupStorage(t,e,i,n,s){const r=n.getValue(e,{value:null});switch(i.name){case"textarea":if(null!==r.value&&(t.textContent=r.value),"print"===s)break;t.addEventListener("input",a=>{n.setValue(e,{value:a.target.value})});break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){if(r.value===i.attributes.xfaOn?t.setAttribute("checked",!0):r.value===i.attributes.xfaOff&&t.removeAttribute("checked"),"print"===s)break;t.addEventListener("change",a=>{n.setValue(e,{value:a.target.getAttribute(a.target.checked?"xfaOn":"xfaOff")})})}else{if(null!==r.value&&t.setAttribute("value",r.value),"print"===s)break;t.addEventListener("input",a=>{n.setValue(e,{value:a.target.value})})}break;case"select":if(null!==r.value){t.setAttribute("value",r.value);for(const a of i.children)a.attributes.value===r.value?a.attributes.selected=!0:a.attributes.hasOwnProperty("selected")&&delete a.attributes.selected}t.addEventListener("input",a=>{const l=a.target.options;n.setValue(e,{value:-1===l.selectedIndex?"":l[l.selectedIndex].value})})}}static setAttributes({html:t,element:e,storage:i=null,intent:n,linkService:s}){const{attributes:r}=e,a=t instanceof HTMLAnchorElement;"radio"===r.type&&(r.name=`${r.name}-${n}`);for(const[l,h]of Object.entries(r))if(null!=h)switch(l){case"class":h.length&&t.setAttribute(l,h.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",h);break;case"style":Object.assign(t.style,h);break;case"textContent":t.textContent=h;break;default:(!a||"href"!==l&&"newWindow"!==l)&&t.setAttribute(l,h)}a&&s.addLinkAttributes(t,r.href,r.newWindow),i&&r.dataId&&this.setupStorage(t,r.dataId,e,i)}static render(t){const e=t.annotationStorage,i=t.linkService,n=t.xfaHtml,s=t.intent||"display",r=document.createElement(n.name);n.attributes&&this.setAttributes({html:r,element:n,intent:s,linkService:i});const a="richText"!==s,l=t.div;if(l.append(r),t.viewport){const d=`matrix(${t.viewport.transform.join(",")})`;l.style.transform=d}a&&l.setAttribute("class","xfaLayer xfaFont");const h=[];if(0===n.children.length){if(n.value){const d=document.createTextNode(n.value);r.append(d),a&&Ie.shouldBuildText(n.name)&&h.push(d)}return{textDivs:h}}const c=[[n,-1,r]];for(;c.length>0;){const[d,u,f]=c.at(-1);if(u+1===d.children.length){c.pop();continue}const p=d.children[++c.at(-1)[1]];if(null===p)continue;const{name:g}=p;if("#text"===g){const m=document.createTextNode(p.value);h.push(m),f.append(m);continue}const b=p?.attributes?.xmlns?document.createElementNS(p.attributes.xmlns,g):document.createElement(g);if(f.append(b),p.attributes&&this.setAttributes({html:b,element:p,storage:e,intent:s,linkService:i}),p.children?.length>0)c.push([p,-1,b]);else if(p.value){const m=document.createTextNode(p.value);a&&Ie.shouldBuildText(g)&&h.push(m),b.append(m)}}for(const d of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))d.setAttribute("readOnly",!0);return{textDivs:h}}static update(t){const e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}}const De=1e3,re=new WeakSet;function Ut(o){return{width:o[2]-o[0],height:o[3]-o[1]}}class ko{static create(t){switch(t.data.annotationType){case 2:return new ms(t);case 1:return new Do(t);case 20:switch(t.data.fieldType){case"Tx":return new Oo(t);case"Btn":return t.data.radioButton?new bs(t):t.data.checkBox?new No(t):new Bo(t);case"Ch":return new Vo(t);case"Sig":return new Fo(t)}return new ae(t);case 16:return new Ji(t);case 3:return new _s(t);case 4:return new Ho(t);case 5:return new zo(t);case 6:return new Wo(t);case 8:return new vs(t);case 14:return new Go(t);case 15:return new tn(t);case 7:return new Uo(t);case 9:return new As(t);case 10:return new $o(t);case 11:return new Xo(t);case 12:return new Yo(t);case 13:return new ys(t);case 17:return new Ko(t);default:return new it(t)}}}class it{#t=null;#e=!1;#i=null;constructor(t,{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:n=!1}={}){this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,e&&(this.container=this._createContainer(i)),n&&this._createQuadrilaterals()}static _hasPopupData({titleObj:t,contentsObj:e,richText:i}){return!!(t?.str||e?.str||i?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return it._hasPopupData(this.data)}updateEdited(t){if(!this.container)return;this.#t||={rect:this.data.rect.slice(0)};const{rect:e}=t;e&&this.#n(e),this.#i?.popup.updateEdited(t)}resetEdited(){this.#t&&(this.#n(this.#t.rect),this.#i?.popup.resetEdited(),this.#t=null)}#n(t){const{container:{style:e},data:{rect:i,rotation:n},parent:{viewport:{rawDims:{pageWidth:s,pageHeight:r,pageX:a,pageY:l}}}}=this;i?.splice(0,4,...t);const{width:h,height:c}=Ut(t);e.left=100*(t[0]-a)/s+"%",e.top=100*(r-t[3]+l)/r+"%",0===n?(e.width=100*h/s+"%",e.height=100*c/r+"%"):this.setRotation(n)}_createContainer(t){const{data:e,parent:{page:i,viewport:n}}=this,s=document.createElement("section");s.setAttribute("data-annotation-id",e.id),this instanceof ae||(s.tabIndex=De);const{style:r}=s;if(r.zIndex=this.parent.zIndex++,e.alternativeText&&(s.title=e.alternativeText),e.noRotate&&s.classList.add("norotate"),!e.rect||this instanceof Ji){const{rotation:g}=e;return!e.hasOwnCanvas&&0!==g&&this.setRotation(g,s),s}const{width:a,height:l}=Ut(e.rect);if(!t&&e.borderStyle.width>0){r.borderWidth=`${e.borderStyle.width}px`;const g=e.borderStyle.horizontalCornerRadius,b=e.borderStyle.verticalCornerRadius;switch(g>0||b>0?r.borderRadius=`calc(${g}px * var(--scale-factor)) / calc(${b}px * var(--scale-factor))`:this instanceof bs&&(r.borderRadius=`calc(${a}px * var(--scale-factor)) / calc(${l}px * var(--scale-factor))`),e.borderStyle.style){case 1:r.borderStyle="solid";break;case 2:r.borderStyle="dashed";break;case 3:V("Unimplemented border style: beveled");break;case 4:V("Unimplemented border style: inset");break;case 5:r.borderBottomStyle="solid"}const m=e.borderColor||null;m?(this.#e=!0,r.borderColor=I.makeHexColor(0|m[0],0|m[1],0|m[2])):r.borderWidth=0}const h=I.normalizeRect([e.rect[0],i.view[3]-e.rect[1]+i.view[1],e.rect[2],i.view[3]-e.rect[3]+i.view[1]]),{pageWidth:c,pageHeight:d,pageX:u,pageY:f}=n.rawDims;r.left=100*(h[0]-u)/c+"%",r.top=100*(h[1]-f)/d+"%";const{rotation:p}=e;return e.hasOwnCanvas||0===p?(r.width=100*a/c+"%",r.height=100*l/d+"%"):this.setRotation(p,s),s}setRotation(t,e=this.container){if(!this.data.rect)return;const{pageWidth:i,pageHeight:n}=this.parent.viewport.rawDims,{width:s,height:r}=Ut(this.data.rect);let a,l;t%180==0?(a=100*s/i,l=100*r/n):(a=100*r/i,l=100*s/n),e.style.width=`${a}%`,e.style.height=`${l}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){const t=(e,i,n)=>{const s=n.detail[e],r=s[0],a=s.slice(1);n.target.style[i]=ps[`${r}_HTML`](a),this.annotationStorage.setValue(this.data.id,{[i]:ps[`${r}_rgb`](a)})};return U(this,"_commonActions",{display:e=>{const{display:i}=e.detail,n=i%2==1;this.container.style.visibility=n?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:n,noPrint:1===i||2===i})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{const{hidden:i}=e.detail;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:i,noView:i})},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:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:e=>{const i=e.detail.rotation;this.setRotation(i),this.annotationStorage.setValue(this.data.id,{rotation:i})}})}_dispatchEventFromSandbox(t,e){const i=this._commonActions;for(const n of Object.keys(e.detail))(t[n]||i[n])?.(e)}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;const e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;const i=this._commonActions;for(const[n,s]of Object.entries(e)){const r=i[n];r&&(r({detail:{[n]:s},target:t}),delete e[n])}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:t}=this.data;if(!t)return;const[e,i,n,s]=this.data.rect.map(g=>Math.fround(g));if(8===t.length){const[g,b,m,v]=t.subarray(2,6);if(n===g&&s===b&&e===m&&i===v)return}const{style:r}=this.container;let a;if(this.#e){const{borderColor:g,borderWidth:b}=r;r.borderWidth=0,a=["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="${g}" stroke-width="${b}">`],this.container.classList.add("hasBorder")}const l=n-e,h=s-i,{svgFactory:c}=this,d=c.createElement("svg");d.classList.add("quadrilateralsContainer"),d.setAttribute("width",0),d.setAttribute("height",0);const u=c.createElement("defs");d.append(u);const f=c.createElement("clipPath"),p=`clippath_${this.data.id}`;f.setAttribute("id",p),f.setAttribute("clipPathUnits","objectBoundingBox"),u.append(f);for(let g=2,b=t.length;g<b;g+=8){const m=t[g],v=t[g+1],A=t[g+2],w=t[g+3],E=c.createElement("rect"),C=(A-e)/l,M=(s-v)/h,T=(m-A)/l,y=(v-w)/h;E.setAttribute("x",C),E.setAttribute("y",M),E.setAttribute("width",T),E.setAttribute("height",y),f.append(E),a?.push(`<rect vector-effect="non-scaling-stroke" x="${C}" y="${M}" width="${T}" height="${y}"/>`)}this.#e&&(a.push("</g></svg>')"),r.backgroundImage=a.join("")),this.container.append(d),this.container.style.clipPath=`url(#${p})`}_createPopup(){const{data:t}=this,e=this.#i=new Ji({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(e.render())}render(){X("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){const i=[];if(this._fieldObjects){const n=this._fieldObjects[t];if(n)for(const{page:s,id:r,exportValues:a}of n){if(-1===s||r===e)continue;const l="string"==typeof a?a:null,h=document.querySelector(`[data-element-id="${r}"]`);!h||re.has(h)?i.push({id:r,exportValue:l,domElement:h}):V(`_getElementsByName - element not allowed: ${r}`)}return i}for(const n of document.getElementsByName(t)){const{exportValue:s}=n,r=n.getAttribute("data-element-id");r!==e&&re.has(n)&&i.push({id:r,exportValue:s,domElement:n})}return i}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(){const t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(const e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e})})}}class ms extends it{constructor(t,e=null){super(t,{isRenderable:!0,ignoreBorder:!!e?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=t.data.isTooltipOnly}render(){const{data:t,linkService:e}=this,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let n=!1;return t.url?(e.addLinkAttributes(i,t.url,t.newWindow),n=!0):t.action?(this._bindNamedAction(i,t.action),n=!0):t.attachment?(this.#e(i,t.attachment,t.attachmentDest),n=!0):t.setOCGState?(this.#i(i,t.setOCGState),n=!0):t.dest?(this._bindLink(i,t.dest),n=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),n=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),n=!0):this.isTooltipOnly&&!n&&(this._bindLink(i,""),n=!0)),this.container.classList.add("linkAnnotation"),n&&this.container.append(i),this.container}#t(){this.container.setAttribute("data-internal-link","")}_bindLink(t,e){t.href=this.linkService.getDestinationHash(e),t.onclick=()=>(e&&this.linkService.goToDestination(e),!1),(e||""===e)&&this.#t()}_bindNamedAction(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),this.#t()}#e(t,e,i=null){t.href=this.linkService.getAnchorUrl(""),e.description&&(t.title=e.description),t.onclick=()=>(this.downloadManager?.openOrDownloadData(e.content,e.filename,i),!1),this.#t()}#i(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),this.#t()}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");const i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const n of Object.keys(e.actions)){const s=i.get(n);s&&(t[s]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:n}}),!1))}t.onclick||(t.onclick=()=>!1),this.#t()}_bindResetFormAction(t,e){const i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),this.#t(),!this._fieldObjects)return V('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),void(i||(t.onclick=()=>!1));t.onclick=()=>{i?.();const{fields:n,refs:s,include:r}=e,a=[];if(0!==n.length||0!==s.length){const c=new Set(s);for(const d of n){const u=this._fieldObjects[d]||[];for(const{id:f}of u)c.add(f)}for(const d of Object.values(this._fieldObjects))for(const u of d)c.has(u.id)===r&&a.push(u)}else for(const c of Object.values(this._fieldObjects))a.push(...c);const l=this.annotationStorage,h=[];for(const c of a){const{id:d}=c;switch(h.push(d),c.type){case"text":case"combobox":case"listbox":l.setValue(d,{value:c.defaultValue||""});break;case"checkbox":case"radiobutton":l.setValue(d,{value:c.defaultValue===c.exportValues});break;default:continue}const u=document.querySelector(`[data-element-id="${d}"]`);u&&(re.has(u)?u.dispatchEvent(new Event("resetform")):V(`_bindResetFormAction - element not allowed: ${d}`))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:h,name:"ResetForm"}}),!1}}}class Do extends it{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(t),this.container}}class ae extends it{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&("CANVAS"===t.previousSibling?.nodeName&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return bt.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,i,n,s){i.includes("mouse")?t.addEventListener(i,r=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:s(r),shift:r.shiftKey,modifier:this._getKeyModifier(r)}})}):t.addEventListener(i,r=>{if("blur"===i){if(!e.focused||!r.relatedTarget)return;e.focused=!1}else if("focus"===i){if(e.focused)return;e.focused=!0}s&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:s(r)}})})}_setEventListeners(t,e,i,n){for(const[s,r]of i)("Action"===r||this.data.actions?.[r])&&(("Focus"===r||"Blur"===r)&&(e||={focused:!1}),this._setEventListener(t,e,s,r,n),"Focus"!==r||this.data.actions?.Blur?"Blur"===r&&!this.data.actions?.Focus&&this._setEventListener(t,e,"focus","Focus",null):this._setEventListener(t,e,"blur","Blur",null))}_setBackgroundColor(t){const e=this.data.backgroundColor||null;t.style.backgroundColor=null===e?"transparent":I.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){const{fontColor:i}=this.data.defaultAppearanceData,n=this.data.defaultAppearanceData.fontSize||9,s=t.style;let r;const l=h=>Math.round(10*h)/10;if(this.data.multiLine){const h=Math.abs(this.data.rect[3]-this.data.rect[1]-2),c=Math.round(h/(1.35*n))||1;r=Math.min(n,l(h/c/1.35))}else{const h=Math.abs(this.data.rect[3]-this.data.rect[1]-2);r=Math.min(n,l(h/1.35))}s.fontSize=`calc(${r}px * var(--scale-factor))`,s.color=I.makeHexColor(i[0],i[1],i[2]),null!==this.data.textAlignment&&(s.textAlign=["left","center","right"][this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class Oo extends ae{constructor(t){super(t,{isRenderable:t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue})}setPropertyOnSiblings(t,e,i,n){const s=this.annotationStorage;for(const r of this._getElementsByName(t.name,t.id))r.domElement&&(r.domElement[e]=i),s.setValue(r.id,{[n]:i})}render(){const t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){const n=t.getValue(e,{value:this.data.fieldValue});let s=n.value||"";const r=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;r&&s.length>r&&(s=s.slice(0,r));let a=n.formattedValue||this.data.textContent?.join("\n")||null;a&&this.data.comb&&(a=a.replaceAll(/\s+/g,""));const l={userValue:s,formattedValue:a,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(i=document.createElement("textarea"),i.textContent=a??s,this.data.doNotScroll&&(i.style.overflowY="hidden")):(i=document.createElement("input"),i.type="text",i.setAttribute("value",a??s),this.data.doNotScroll&&(i.style.overflowX="hidden")),this.data.hasOwnCanvas&&(i.hidden=!0),re.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=De,this._setRequired(i,this.data.required),r&&(i.maxLength=r),i.addEventListener("input",c=>{t.setValue(e,{value:c.target.value}),this.setPropertyOnSiblings(i,"value",c.target.value,"value"),l.formattedValue=null}),i.addEventListener("resetform",c=>{i.value=l.userValue=this.data.defaultFieldValue??"",l.formattedValue=null});let h=c=>{const{formattedValue:d}=l;null!=d&&(c.target.value=d),c.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",d=>{if(l.focused)return;const{target:u}=d;l.userValue&&(u.value=l.userValue),l.lastCommittedValue=u.value,l.commitKey=1,this.data.actions?.Focus||(l.focused=!0)}),i.addEventListener("updatefromsandbox",d=>{this.showElementAndHideCanvas(d.target),this._dispatchEventFromSandbox({value(f){l.userValue=f.detail.value??"",t.setValue(e,{value:l.userValue.toString()}),f.target.value=l.userValue},formattedValue(f){const{formattedValue:p}=f.detail;l.formattedValue=p,null!=p&&f.target!==document.activeElement&&(f.target.value=p),t.setValue(e,{formattedValue:p})},selRange(f){f.target.setSelectionRange(...f.detail.selRange)},charLimit:f=>{const{charLimit:p}=f.detail,{target:g}=f;if(0===p)return void g.removeAttribute("maxLength");g.setAttribute("maxLength",p);let b=l.userValue;!b||b.length<=p||(b=b.slice(0,p),g.value=l.userValue=b,t.setValue(e,{value:b}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:b,willCommit:!0,commitKey:1,selStart:g.selectionStart,selEnd:g.selectionEnd}}))}},d)}),i.addEventListener("keydown",d=>{l.commitKey=1;let u=-1;if("Escape"===d.key?u=0:"Enter"!==d.key||this.data.multiLine?"Tab"===d.key&&(l.commitKey=3):u=2,-1===u)return;const{value:f}=d.target;l.lastCommittedValue!==f&&(l.lastCommittedValue=f,l.userValue=f,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:f,willCommit:!0,commitKey:u,selStart:d.target.selectionStart,selEnd:d.target.selectionEnd}}))});const c=h;h=null,i.addEventListener("blur",d=>{if(!l.focused||!d.relatedTarget)return;this.data.actions?.Blur||(l.focused=!1);const{value:u}=d.target;l.userValue=u,l.lastCommittedValue!==u&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:u,willCommit:!0,commitKey:l.commitKey,selStart:d.target.selectionStart,selEnd:d.target.selectionEnd}}),c(d)}),this.data.actions?.Keystroke&&i.addEventListener("beforeinput",d=>{l.lastCommittedValue=null;const{data:u,target:f}=d,{value:p,selectionStart:g,selectionEnd:b}=f;let m=g,v=b;switch(d.inputType){case"deleteWordBackward":{const A=p.substring(0,g).match(/\w*[^\w]*$/);A&&(m-=A[0].length);break}case"deleteWordForward":{const A=p.substring(g).match(/^[^\w]*\w*/);A&&(v+=A[0].length);break}case"deleteContentBackward":g===b&&(m-=1);break;case"deleteContentForward":g===b&&(v+=1)}d.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:p,change:u||"",willCommit:!1,selStart:m,selEnd:v}})}),this._setEventListeners(i,l,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],d=>d.target.value)}if(h&&i.addEventListener("blur",h),this.data.comb){const d=(this.data.rect[2]-this.data.rect[0])/r;i.classList.add("comb"),i.style.letterSpacing=`calc(${d}px * var(--scale-factor) - 1ch)`}}else i=document.createElement("div"),i.textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell",this.data.hasOwnCanvas&&(i.hidden=!0);return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class Fo extends ae{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class No extends ae{constructor(t){super(t,{isRenderable:t.renderForms})}render(){const t=this.annotationStorage,e=this.data,i=e.id;let n=t.getValue(i,{value:e.exportValue===e.fieldValue}).value;"string"==typeof n&&(n="Off"!==n,t.setValue(i,{value:n})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const s=document.createElement("input");return re.add(s),s.setAttribute("data-element-id",i),s.disabled=e.readOnly,this._setRequired(s,this.data.required),s.type="checkbox",s.name=e.fieldName,n&&s.setAttribute("checked",!0),s.setAttribute("exportValue",e.exportValue),s.tabIndex=De,s.addEventListener("change",r=>{const{name:a,checked:l}=r.target;for(const h of this._getElementsByName(a,i)){const c=l&&h.exportValue===e.exportValue;h.domElement&&(h.domElement.checked=c),t.setValue(h.id,{value:c})}t.setValue(i,{value:l})}),s.addEventListener("resetform",r=>{r.target.checked=(e.defaultFieldValue||"Off")===e.exportValue}),this.enableScripting&&this.hasJSActions&&(s.addEventListener("updatefromsandbox",r=>{this._dispatchEventFromSandbox({value(l){l.target.checked="Off"!==l.detail.value,t.setValue(i,{value:l.target.checked})}},r)}),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],r=>r.target.checked)),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class bs extends ae{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const t=this.annotationStorage,e=this.data,i=e.id;let n=t.getValue(i,{value:e.fieldValue===e.buttonValue}).value;if("string"==typeof n&&(n=n!==e.buttonValue,t.setValue(i,{value:n})),n)for(const r of this._getElementsByName(e.fieldName,i))t.setValue(r.id,{value:!1});const s=document.createElement("input");if(re.add(s),s.setAttribute("data-element-id",i),s.disabled=e.readOnly,this._setRequired(s,this.data.required),s.type="radio",s.name=e.fieldName,n&&s.setAttribute("checked",!0),s.tabIndex=De,s.addEventListener("change",r=>{const{name:a,checked:l}=r.target;for(const h of this._getElementsByName(a,i))t.setValue(h.id,{value:!1});t.setValue(i,{value:l})}),s.addEventListener("resetform",r=>{const a=e.defaultFieldValue;r.target.checked=null!=a&&a===e.buttonValue}),this.enableScripting&&this.hasJSActions){const r=e.buttonValue;s.addEventListener("updatefromsandbox",a=>{this._dispatchEventFromSandbox({value:h=>{const c=r===h.detail.value;for(const d of this._getElementsByName(h.target.name)){const u=c&&d.id===i;d.domElement&&(d.domElement.checked=u),t.setValue(d.id,{value:u})}}},a)}),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],a=>a.target.checked)}return this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class Bo extends ms{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){const t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");const e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",i=>{this._dispatchEventFromSandbox({},i)})),t}}class Vo extends ae{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const t=this.annotationStorage,e=this.data.id,i=t.getValue(e,{value:this.data.fieldValue}),n=document.createElement("select");re.add(n),n.setAttribute("data-element-id",e),n.disabled=this.data.readOnly,this._setRequired(n,this.data.required),n.name=this.data.fieldName,n.tabIndex=De;let s=this.data.combo&&this.data.options.length>0;this.data.combo||(n.size=this.data.options.length,this.data.multiSelect&&(n.multiple=!0)),n.addEventListener("resetform",c=>{const d=this.data.defaultFieldValue;for(const u of n.options)u.selected=u.value===d});for(const c of this.data.options){const d=document.createElement("option");d.textContent=c.displayValue,d.value=c.exportValue,i.value.includes(c.exportValue)&&(d.setAttribute("selected",!0),s=!1),n.append(d)}let r=null;if(s){const c=document.createElement("option");c.value=" ",c.setAttribute("hidden",!0),c.setAttribute("selected",!0),n.prepend(c),r=()=>{c.remove(),n.removeEventListener("input",r),r=null},n.addEventListener("input",r)}const a=c=>{const d=c?"value":"textContent",{options:u,multiple:f}=n;return f?Array.prototype.filter.call(u,p=>p.selected).map(p=>p[d]):-1===u.selectedIndex?null:u[u.selectedIndex][d]};let l=a(!1);const h=c=>Array.prototype.map.call(c.target.options,u=>({displayValue:u.textContent,exportValue:u.value}));return this.enableScripting&&this.hasJSActions?(n.addEventListener("updatefromsandbox",c=>{this._dispatchEventFromSandbox({value(u){r?.();const f=u.detail.value,p=new Set(Array.isArray(f)?f:[f]);for(const g of n.options)g.selected=p.has(g.value);t.setValue(e,{value:a(!0)}),l=a(!1)},multipleSelection(u){n.multiple=!0},remove(u){const f=n.options,p=u.detail.remove;f[p].selected=!1,n.remove(p),f.length>0&&-1===Array.prototype.findIndex.call(f,b=>b.selected)&&(f[0].selected=!0),t.setValue(e,{value:a(!0),items:h(u)}),l=a(!1)},clear(u){for(;0!==n.length;)n.remove(0);t.setValue(e,{value:null,items:[]}),l=a(!1)},insert(u){const{index:f,displayValue:p,exportValue:g}=u.detail.insert,b=n.children[f],m=document.createElement("option");m.textContent=p,m.value=g,b?b.before(m):n.append(m),t.setValue(e,{value:a(!0),items:h(u)}),l=a(!1)},items(u){const{items:f}=u.detail;for(;0!==n.length;)n.remove(0);for(const p of f){const{displayValue:g,exportValue:b}=p,m=document.createElement("option");m.textContent=g,m.value=b,n.append(m)}n.options.length>0&&(n.options[0].selected=!0),t.setValue(e,{value:a(!0),items:h(u)}),l=a(!1)},indices(u){const f=new Set(u.detail.indices);for(const p of u.target.options)p.selected=f.has(p.index);t.setValue(e,{value:a(!0)}),l=a(!1)},editable(u){u.target.disabled=!u.detail.editable}},c)}),n.addEventListener("input",c=>{const d=a(!0),u=a(!1);t.setValue(e,{value:d}),c.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:l,change:u,changeEx:d,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(n,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],c=>c.target.value)):n.addEventListener("input",function(c){t.setValue(e,{value:a(!0)})}),this.data.combo&&this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class Ji extends it{constructor(t){const{data:e,elements:i}=t;super(t,{isRenderable:it._hasPopupData(e)}),this.elements=i,this.popup=null}render(){this.container.classList.add("popupAnnotation");const t=this.popup=new jo({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}),e=[];for(const i of this.elements)i.popup=t,i.container.ariaHasPopup="dialog",e.push(i.data.id),i.addHighlightArea();return this.container.setAttribute("aria-controls",e.map(i=>`${Li}${i}`).join(",")),this.container}}class jo{#t=this.#L.bind(this);#e=this.#S.bind(this);#i=this.#T.bind(this);#n=this.#x.bind(this);#s=null;#r=null;#l=null;#h=null;#c=null;#o=null;#d=null;#a=!1;#u=null;#p=null;#f=null;#g=null;#b=null;#m=null;#_=!1;constructor({container:t,color:e,elements:i,titleObj:n,modificationDate:s,contentsObj:r,richText:a,parent:l,rect:h,parentRect:c,open:d}){this.#r=t,this.#b=n,this.#l=r,this.#g=a,this.#o=l,this.#s=e,this.#f=h,this.#d=c,this.#c=i,this.#h=Dn.toDateObject(s),this.trigger=i.flatMap(u=>u.getElementsToTriggerPopup());for(const u of this.trigger)u.addEventListener("click",this.#n),u.addEventListener("mouseenter",this.#i),u.addEventListener("mouseleave",this.#e),u.classList.add("popupTriggerArea");for(const u of i)u.container?.addEventListener("keydown",this.#t);this.#r.hidden=!0,d&&this.#x()}render(){if(this.#u)return;const t=this.#u=document.createElement("div");if(t.className="popup",this.#s){const s=t.style.outlineColor=I.makeHexColor(...this.#s);t.style.backgroundColor=CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?`color-mix(in srgb, ${s} 30%, white)`:I.makeHexColor(...this.#s.map(a=>Math.floor(.7*(255-a)+a)))}const e=document.createElement("span");e.className="header";const i=document.createElement("h1");if(e.append(i),({dir:i.dir,str:i.textContent}=this.#b),t.append(e),this.#h){const s=document.createElement("span");s.classList.add("popupDate"),s.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),s.setAttribute("data-l10n-args",JSON.stringify({dateObj:this.#h.valueOf()})),e.append(s)}const n=this.#A;if(n)gs.render({xfaHtml:n,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{const s=this._formatContents(this.#l);t.append(s)}this.#r.append(t)}get#A(){const t=this.#g,e=this.#l;return t?.str&&(!e?.str||e.str===t.str)&&this.#g.html||null}get#E(){return this.#A?.attributes?.style?.fontSize||0}get#y(){return this.#A?.attributes?.style?.color||null}#w(t){const e=[],i={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},n={style:{color:this.#y,fontSize:this.#E?`calc(${this.#E}px * var(--scale-factor))`:""}};for(const s of t.split("\n"))e.push({name:"span",value:s,attributes:n});return i}_formatContents({str:t,dir:e}){const i=document.createElement("p");i.classList.add("popupContent"),i.dir=e;const n=t.split(/(?:\r\n?|\n)/);for(let s=0,r=n.length;s<r;++s)i.append(document.createTextNode(n[s])),s<r-1&&i.append(document.createElement("br"));return i}#L(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||("Enter"===t.key||"Escape"===t.key&&this.#a)&&this.#x()}updateEdited({rect:t,popupContent:e}){this.#m||={contentsObj:this.#l,richText:this.#g},t&&(this.#p=null),e&&(this.#g=this.#w(e),this.#l=null),this.#u?.remove(),this.#u=null}resetEdited(){this.#m&&(({contentsObj:this.#l,richText:this.#g}=this.#m),this.#m=null,this.#u?.remove(),this.#u=null,this.#p=null)}#P(){if(null!==this.#p)return;const{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:n,pageY:s}}}=this.#o;let r=!!this.#d,a=r?this.#d:this.#f;for(const p of this.#c)if(!a||null!==I.intersect(p.data.rect,a)){a=p.data.rect,r=!0;break}const l=I.normalizeRect([a[0],t[3]-a[1]+t[1],a[2],t[3]-a[3]+t[1]]);this.#p=[100*(l[0]+(r?a[2]-a[0]+5:0)-n)/e,100*(l[1]-s)/i];const{style:f}=this.#r;f.left=`${this.#p[0]}%`,f.top=`${this.#p[1]}%`}#x(){this.#a=!this.#a,this.#a?(this.#T(),this.#r.addEventListener("click",this.#n),this.#r.addEventListener("keydown",this.#t)):(this.#S(),this.#r.removeEventListener("click",this.#n),this.#r.removeEventListener("keydown",this.#t))}#T(){this.#u||this.render(),this.isVisible?this.#a&&this.#r.classList.add("focused"):(this.#P(),this.#r.hidden=!1,this.#r.style.zIndex=parseInt(this.#r.style.zIndex)+1e3)}#S(){this.#r.classList.remove("focused"),!this.#a&&this.isVisible&&(this.#r.hidden=!0,this.#r.style.zIndex=parseInt(this.#r.style.zIndex)-1e3)}forceHide(){this.#_=this.isVisible,this.#_&&(this.#r.hidden=!0)}maybeShow(){this.#_&&(this.#u||this.#T(),this.#_=!1,this.#r.hidden=!1)}get isVisible(){return!1===this.#r.hidden}}class _s extends it{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=B.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){const t=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(const e of this.textContent){const i=document.createElement("span");i.textContent=e,t.append(i)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}class Ho extends it{#t=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");const t=this.data,{width:e,height:i}=Ut(t.rect),n=this.svgFactory.create(e,i,!0),s=this.#t=this.svgFactory.createElement("svg:line");return s.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),s.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),s.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),s.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),s.setAttribute("stroke-width",t.borderStyle.width||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),n.append(s),this.container.append(n),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}}class zo extends it{#t=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");const t=this.data,{width:e,height:i}=Ut(t.rect),n=this.svgFactory.create(e,i,!0),s=t.borderStyle.width,r=this.#t=this.svgFactory.createElement("svg:rect");return r.setAttribute("x",s/2),r.setAttribute("y",s/2),r.setAttribute("width",e-s),r.setAttribute("height",i-s),r.setAttribute("stroke-width",s||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}}class Wo extends it{#t=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");const t=this.data,{width:e,height:i}=Ut(t.rect),n=this.svgFactory.create(e,i,!0),s=t.borderStyle.width,r=this.#t=this.svgFactory.createElement("svg:ellipse");return r.setAttribute("cx",e/2),r.setAttribute("cy",i/2),r.setAttribute("rx",e/2-s/2),r.setAttribute("ry",i/2-s/2),r.setAttribute("stroke-width",s||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),n.append(r),this.container.append(n),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}}class vs extends it{#t=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,vertices:e,borderStyle:i,popupRef:n}}=this;if(!e)return this.container;const{width:s,height:r}=Ut(t),a=this.svgFactory.create(s,r,!0);let l=[];for(let c=0,d=e.length;c<d;c+=2)l.push(`${e[c]-t[0]},${t[3]-e[c+1]}`);l=l.join(" ");const h=this.#t=this.svgFactory.createElement(this.svgElementName);return h.setAttribute("points",l),h.setAttribute("stroke-width",i.width||1),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),a.append(h),this.container.append(a),!n&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}}class Uo extends vs{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class Go extends it{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}}class tn extends it{#t=[];constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType="InkHighlight"===this.data.it?B.HIGHLIGHT:B.INK}render(){this.container.classList.add(this.containerClassName);const{data:{rect:t,inkLists:e,borderStyle:i,popupRef:n}}=this,{width:s,height:r}=Ut(t),a=this.svgFactory.create(s,r,!0);for(const l of e){let h=[];for(let d=0,u=l.length;d<u;d+=2)h.push(`${l[d]-t[0]},${t[3]-l[d+1]}`);h=h.join(" ");const c=this.svgFactory.createElement(this.svgElementName);this.#t.push(c),c.setAttribute("points",h),c.setAttribute("stroke-width",i.width||1),c.setAttribute("stroke","transparent"),c.setAttribute("fill","transparent"),a.append(c)}return!n&&this.hasPopupData&&this._createPopup(),this.container.append(a),this._editOnDoubleClick(),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}}class As extends it{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=B.HIGHLIGHT}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),this.container}}class $o extends it{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}}class Xo extends it{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}}class Yo extends it{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}}class ys extends it{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=B.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}}class Ko extends it{#t=null;constructor(t){super(t,{isRenderable:!0});const{file:e}=this.data;this.filename=e.filename,this.content=e.content,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,...e})}render(){this.container.classList.add("fileAttachmentAnnotation");const{container:t,data:e}=this;let i;e.hasAppearance||0===e.fillAlpha?i=document.createElement("div"):(i=document.createElement("img"),i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(e.name)?"paperclip":"pushpin"}.svg`,e.fillAlpha&&e.fillAlpha<1&&(i.style=`filter: opacity(${Math.round(100*e.fillAlpha)}%);`)),i.addEventListener("dblclick",this.#e.bind(this)),this.#t=i;const{isMac:n}=bt.platform;return t.addEventListener("keydown",s=>{"Enter"===s.key&&(n?s.metaKey:s.ctrlKey)&&this.#e()}),!e.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),t.append(i),t}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}#e(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}}class qo{#t=null;#e=null;#i=new Map;#n=null;constructor({div:t,accessibilityManager:e,annotationCanvasMap:i,annotationEditorUIManager:n,page:s,viewport:r,structTreeLayer:a}){this.div=t,this.#t=e,this.#e=i,this.#n=a||null,this.page=s,this.viewport=r,this.zIndex=0,this._annotationEditorUIManager=n}hasEditableAnnotations(){return this.#i.size>0}#s(t,e){var i=this;return(0,x.A)(function*(){const n=t.firstChild||t,s=n.id=`${Li}${e}`,r=yield i.#n?.getAriaAttributes(s);if(r)for(const[a,l]of r)n.setAttribute(a,l);i.div.append(t),i.#t?.moveElementInDOM(i.div,t,n,!1)})()}render(t){var e=this;return(0,x.A)(function*(){const{annotations:i}=t,n=e.div;se(n,e.viewport);const s=new Map,r={data:null,layer:n,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new Zi,annotationStorage:t.annotationStorage||new Vi,enableScripting:!0===t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:e,elements:null};for(const a of i){if(a.noHTML)continue;const l=16===a.annotationType;if(l){const d=s.get(a.id);if(!d)continue;r.elements=d}else{const{width:d,height:u}=Ut(a.rect);if(d<=0||u<=0)continue}r.data=a;const h=ko.create(r);if(!h.isRenderable)continue;if(!l&&a.popupRef){const d=s.get(a.popupRef);d?d.push(h):s.set(a.popupRef,[h])}const c=h.render();a.hidden&&(c.style.visibility="hidden"),yield e.#s(c,a.id),h._isEditable&&(e.#i.set(h.data.id,h),e._annotationEditorUIManager?.renderAnnotationElement(h))}e.#r()})()}update({viewport:t}){const e=this.div;this.viewport=t,se(e,{rotation:t.rotation}),this.#r(),e.hidden=!1}#r(){if(!this.#e)return;const t=this.div;for(const[e,i]of this.#e){const n=t.querySelector(`[data-annotation-id="${e}"]`);if(!n)continue;i.className="annotationContent";const{firstChild:s}=n;s?"CANVAS"===s.nodeName?s.replaceWith(i):s.classList.contains("annotationContent")?s.after(i):s.before(i):n.append(i)}this.#e.clear()}getEditableAnnotations(){return Array.from(this.#i.values())}getEditableAnnotation(t){return this.#i.get(t)}}const ai=/\r\n?|\n/g;class ht extends O{#t;#e="";#i=`${this.id}-editor`;#n=null;#s;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){const t=ht.prototype,e=s=>s.isEmpty(),i=Te.TRANSLATE_SMALL,n=Te.TRANSLATE_BIG;return U(this,"_keyboardManager",new Pe([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-n,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[n,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-n],checker:e}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,n],checker:e}]]))}static _type="freetext";static _editorType=B.FREETEXT;constructor(t){super({...t,name:"freeTextEditor"}),this.#t=t.color||ht._defaultColor||O._defaultLineColor,this.#s=t.fontSize||ht._defaultFontSize}static initialize(t,e){O.initialize(t,e);const i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,e){switch(t){case D.FREETEXT_SIZE:ht._defaultFontSize=e;break;case D.FREETEXT_COLOR:ht._defaultColor=e}}updateParams(t,e){switch(t){case D.FREETEXT_SIZE:this.#r(e);break;case D.FREETEXT_COLOR:this.#l(e)}}static get defaultPropertiesToUpdate(){return[[D.FREETEXT_SIZE,ht._defaultFontSize],[D.FREETEXT_COLOR,ht._defaultColor||O._defaultLineColor]]}get propertiesToUpdate(){return[[D.FREETEXT_SIZE,this.#s],[D.FREETEXT_COLOR,this.#t]]}#r(t){const e=n=>{this.editorDiv.style.fontSize=`calc(${n}px * var(--scale-factor))`,this.translate(0,-(n-this.#s)*this.parentScale),this.#s=n,this.#c()},i=this.#s;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:D.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#l(t){const e=n=>{this.#t=this.editorDiv.style.color=n},i=this.#t;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:D.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){const t=this.parentScale;return[-ht._internalPadding*t,-(ht._internalPadding+this.#s)*t]}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(B.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.#n=new AbortController;const t=this._uiManager.combinedSignal(this.#n);this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:t}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:t}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:t}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:t}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:t})}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#i),this._isDraggable=!0,this.#n?.abort(),this.#n=null,this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){this.width||(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()}#h(){const t=[];this.editorDiv.normalize();let e=null;for(const i of this.editorDiv.childNodes)e?.nodeType===Node.TEXT_NODE&&"BR"===i.nodeName||(t.push(ht.#o(i)),e=i);return t.join("\n")}#c(){const[t,e]=this.parentDimensions;let i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{const{currentLayer:n,div:s}=this,r=s.style.display,a=s.classList.contains("hidden");s.classList.remove("hidden"),s.style.display="hidden",n.div.append(this.div),i=s.getBoundingClientRect(),s.remove(),s.style.display=r,s.classList.toggle("hidden",a)}this.rotation%180==this.parentRotation%180?(this.width=i.width/t,this.height=i.height/e):(this.width=i.height/t,this.height=i.width/e),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();const t=this.#e,e=this.#e=this.#h().trimEnd();if(t===e)return;const i=n=>{this.#e=n,n?(this.#d(),this._uiManager.rebuild(this),this.#c()):this.remove()};this.addCommands({cmd:()=>{i(e)},undo:()=>{i(t)},mustExec:!1}),this.#c()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(t){this.enterInEditMode()}keydown(t){t.target===this.div&&"Enter"===t.key&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){ht._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){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 t,e;this.width&&(t=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#i),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;const{style:i}=this.editorDiv;if(i.fontSize=`calc(${this.#s}px * var(--scale-factor))`,i.color=this.#t,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),ti(this,this.div,["dblclick","keydown"]),this.width){const[n,s]=this.parentDimensions;if(this.annotationElementId){const{position:r}=this._initialData;let[a,l]=this.getInitialTranslation();[a,l]=this.pageTranslationToScreen(a,l);const[h,c]=this.pageDimensions,[d,u]=this.pageTranslation;let f,p;switch(this.rotation){case 0:f=t+(r[0]-d)/h,p=e+this.height-(r[1]-u)/c;break;case 90:f=t+(r[0]-d)/h,p=e-(r[1]-u)/c,[a,l]=[l,-a];break;case 180:f=t-this.width+(r[0]-d)/h,p=e-(r[1]-u)/c,[a,l]=[-a,-l];break;case 270:f=t+(r[0]-d-this.height*c)/h,p=e+(r[1]-u-this.width*h)/c,[a,l]=[-l,a]}this.setAt(f*n,p*s,a,l)}else this.setAt(t*n,e*s,this.width*n,this.height*s);this.#d(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static#o(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(ai,"")}editorDivPaste(t){const e=t.clipboardData||window.clipboardData,{types:i}=e;if(1===i.length&&"text/plain"===i[0])return;t.preventDefault();const n=ht.#u(e.getData("text")||"").replaceAll(ai,"\n");if(!n)return;const s=window.getSelection();if(!s.rangeCount)return;this.editorDiv.normalize(),s.deleteFromDocument();const r=s.getRangeAt(0);if(!n.includes("\n"))return r.insertNode(document.createTextNode(n)),this.editorDiv.normalize(),void s.collapseToStart();const{startContainer:a,startOffset:l}=r,h=[],c=[];if(a.nodeType===Node.TEXT_NODE){const f=a.parentElement;if(c.push(a.nodeValue.slice(l).replaceAll(ai,"")),f!==this.editorDiv){let p=h;for(const g of this.editorDiv.childNodes)g!==f?p.push(ht.#o(g)):p=c}h.push(a.nodeValue.slice(0,l).replaceAll(ai,""))}else if(a===this.editorDiv){let f=h,p=0;for(const g of this.editorDiv.childNodes)p++===l&&(f=c),f.push(ht.#o(g))}this.#e=`${h.join("\n")}${n}${c.join("\n")}`,this.#d();const d=new Range;let u=h.reduce((f,p)=>f+p.length,0);for(const{firstChild:f}of this.editorDiv.childNodes)if(f.nodeType===Node.TEXT_NODE){const p=f.nodeValue.length;if(u<=p){d.setStart(f,u),d.setEnd(f,u);break}u-=p}s.removeAllRanges(),s.addRange(d)}#d(){if(this.editorDiv.replaceChildren(),this.#e)for(const t of this.#e.split("\n")){const e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}#a(){return this.#e.replaceAll("\xa0"," ")}static#u(t){return t.replaceAll(" ","\xa0")}get contentDiv(){return this.editorDiv}static deserialize(t,e,i){var n=()=>super.deserialize,s=this;return(0,x.A)(function*(){let r=null;if(t instanceof _s){const{data:{defaultAppearanceData:{fontSize:l,fontColor:h},rect:c,rotation:d,id:u,popupRef:f},textContent:p,textPosition:g,parent:{page:{pageNumber:b}}}=t;if(!p||0===p.length)return null;r=t={annotationType:B.FREETEXT,color:Array.from(h),fontSize:l,value:p.join("\n"),position:g,pageIndex:b-1,rect:c.slice(0),rotation:d,id:u,deleted:!1,popupRef:f}}const a=yield n().call(s,t,e,i);return a.#s=t.fontSize,a.#t=I.makeHexColor(...t.color),a.#e=ht.#u(t.value),a.annotationElementId=t.id||null,a._initialData=r,a})()}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const e=ht._internalPadding*this.parentScale,i=this.getRect(e,e),n=O._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#t),s={annotationType:B.FREETEXT,color:n,fontSize:this.#s,value:this.#a(),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?s:this.annotationElementId&&!this.#p(s)?null:(s.id=this.annotationElementId,s)}#p(t){const{value:e,fontSize:i,color:n,pageIndex:s}=this._initialData;return this._hasBeenMoved||t.value!==e||t.fontSize!==i||t.color.some((r,a)=>r!==n[a])||t.pageIndex!==s}renderAnnotationElement(t){const e=super.renderAnnotationElement(t);if(this.deleted)return e;const{style:i}=e;i.fontSize=`calc(${this.#s}px * var(--scale-factor))`,i.color=this.#t,e.replaceChildren();for(const s of this.#e.split("\n")){const r=document.createElement("div");r.append(s?document.createTextNode(s):document.createElement("br")),e.append(r)}const n=ht._internalPadding*this.parentScale;return t.updateEdited({rect:this.getRect(n,n),popupContent:this.#e}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}}class ws{toSVGPath(){X("Abstract method `toSVGPath` must be implemented.")}get box(){X("Abstract getter `box` must be implemented.")}serialize(t,e){X("Abstract method `serialize` must be implemented.")}get classNamesForDrawing(){X("Abstract getter `classNamesForDrawing` must be implemented.")}get classNamesForOutlining(){X("Abstract getter `classNamesForOutlining` must be implemented.")}get mustRemoveSelfIntersections(){return!1}}class oe{#t;#e=[];#i;#n;#s=[];#r=new Float64Array(18);#l;#h;#c;#o;#d;#a;#u=[];static#p=8;static#f=2;static#g=oe.#p+oe.#f;constructor({x:t,y:e},i,n,s,r,a=0){this.#t=i,this.#a=s*n,this.#n=r,this.#r.set([NaN,NaN,NaN,NaN,t,e],6),this.#i=a,this.#o=oe.#p*n,this.#c=oe.#g*n,this.#d=n,this.#u.push(t,e)}isEmpty(){return isNaN(this.#r[8])}#b(){const t=this.#r.subarray(4,6),e=this.#r.subarray(16,18),[i,n,s,r]=this.#t;return[(this.#l+(t[0]-e[0])/2-i)/s,(this.#h+(t[1]-e[1])/2-n)/r,(this.#l+(e[0]-t[0])/2-i)/s,(this.#h+(e[1]-t[1])/2-n)/r]}add({x:t,y:e}){this.#l=t,this.#h=e;const[i,n,s,r]=this.#t;let[a,l,h,c]=this.#r.subarray(8,12);const d=t-h,u=e-c,f=Math.hypot(d,u);if(f<this.#c)return!1;const p=f-this.#o,g=p/f,b=g*d,m=g*u;let v=a,A=l;a=h,l=c,h+=b,c+=m,this.#u?.push(t,e);const C=-m/p*this.#a,M=b/p*this.#a;return this.#r.set(this.#r.subarray(2,8),0),this.#r.set([h+C,c+M],4),this.#r.set(this.#r.subarray(14,18),12),this.#r.set([h-C,c-M],16),isNaN(this.#r[6])?(0===this.#s.length&&(this.#r.set([a+C,l+M],2),this.#s.push(NaN,NaN,NaN,NaN,(a+C-i)/s,(l+M-n)/r),this.#r.set([a-C,l-M],14),this.#e.push(NaN,NaN,NaN,NaN,(a-C-i)/s,(l-M-n)/r)),this.#r.set([v,A,a,l,h,c],6),!this.isEmpty()):(this.#r.set([v,A,a,l,h,c],6),Math.abs(Math.atan2(A-l,v-a)-Math.atan2(m,b))<Math.PI/2?([a,l,h,c]=this.#r.subarray(2,6),this.#s.push(NaN,NaN,NaN,NaN,((a+h)/2-i)/s,((l+c)/2-n)/r),[a,l,v,A]=this.#r.subarray(14,18),this.#e.push(NaN,NaN,NaN,NaN,((v+a)/2-i)/s,((A+l)/2-n)/r),!0):([v,A,a,l,h,c]=this.#r.subarray(0,6),this.#s.push(((v+5*a)/6-i)/s,((A+5*l)/6-n)/r,((5*a+h)/6-i)/s,((5*l+c)/6-n)/r,((a+h)/2-i)/s,((l+c)/2-n)/r),[h,c,a,l,v,A]=this.#r.subarray(12,18),this.#e.push(((v+5*a)/6-i)/s,((A+5*l)/6-n)/r,((5*a+h)/6-i)/s,((5*l+c)/6-n)/r,((a+h)/2-i)/s,((l+c)/2-n)/r),!0))}toSVGPath(){if(this.isEmpty())return"";const t=this.#s,e=this.#e;if(isNaN(this.#r[6])&&!this.isEmpty())return this.#m();const i=[];i.push(`M${t[4]} ${t[5]}`);for(let n=6;n<t.length;n+=6)isNaN(t[n])?i.push(`L${t[n+4]} ${t[n+5]}`):i.push(`C${t[n]} ${t[n+1]} ${t[n+2]} ${t[n+3]} ${t[n+4]} ${t[n+5]}`);this.#A(i);for(let n=e.length-6;n>=6;n-=6)isNaN(e[n])?i.push(`L${e[n+4]} ${e[n+5]}`):i.push(`C${e[n]} ${e[n+1]} ${e[n+2]} ${e[n+3]} ${e[n+4]} ${e[n+5]}`);return this.#_(i),i.join(" ")}#m(){const[t,e,i,n]=this.#t,[s,r,a,l]=this.#b();return`M${(this.#r[2]-t)/i} ${(this.#r[3]-e)/n} L${(this.#r[4]-t)/i} ${(this.#r[5]-e)/n} L${s} ${r} L${a} ${l} L${(this.#r[16]-t)/i} ${(this.#r[17]-e)/n} L${(this.#r[14]-t)/i} ${(this.#r[15]-e)/n} Z`}#_(t){const e=this.#e;t.push(`L${e[4]} ${e[5]} Z`)}#A(t){const[e,i,n,s]=this.#t,r=this.#r.subarray(4,6),a=this.#r.subarray(16,18),[l,h,c,d]=this.#b();t.push(`L${(r[0]-e)/n} ${(r[1]-i)/s} L${l} ${h} L${c} ${d} L${(a[0]-e)/n} ${(a[1]-i)/s}`)}newFreeDrawOutline(t,e,i,n,s,r){return new Es(t,e,i,n,s,r)}getOutlines(){const t=this.#s,e=this.#e,i=this.#r,[n,s,r,a]=this.#t,l=new Float64Array((this.#u?.length??0)+2);for(let d=0,u=l.length-2;d<u;d+=2)l[d]=(this.#u[d]-n)/r,l[d+1]=(this.#u[d+1]-s)/a;if(l[l.length-2]=(this.#l-n)/r,l[l.length-1]=(this.#h-s)/a,isNaN(i[6])&&!this.isEmpty())return this.#E(l);const h=new Float64Array(this.#s.length+24+this.#e.length);let c=t.length;for(let d=0;d<c;d+=2)isNaN(t[d])?h[d]=h[d+1]=NaN:(h[d]=t[d],h[d+1]=t[d+1]);c=this.#w(h,c);for(let d=e.length-6;d>=6;d-=6)for(let u=0;u<6;u+=2)isNaN(e[d+u])?(h[c]=h[c+1]=NaN,c+=2):(h[c]=e[d+u],h[c+1]=e[d+u+1],c+=2);return this.#y(h,c),this.newFreeDrawOutline(h,l,this.#t,this.#d,this.#i,this.#n)}#E(t){const e=this.#r,[i,n,s,r]=this.#t,[a,l,h,c]=this.#b(),d=new Float64Array(36);return d.set([NaN,NaN,NaN,NaN,(e[2]-i)/s,(e[3]-n)/r,NaN,NaN,NaN,NaN,(e[4]-i)/s,(e[5]-n)/r,NaN,NaN,NaN,NaN,a,l,NaN,NaN,NaN,NaN,h,c,NaN,NaN,NaN,NaN,(e[16]-i)/s,(e[17]-n)/r,NaN,NaN,NaN,NaN,(e[14]-i)/s,(e[15]-n)/r],0),this.newFreeDrawOutline(d,t,this.#t,this.#d,this.#i,this.#n)}#y(t,e){const i=this.#e;return t.set([NaN,NaN,NaN,NaN,i[4],i[5]],e),e+6}#w(t,e){const i=this.#r.subarray(4,6),n=this.#r.subarray(16,18),[s,r,a,l]=this.#t,[h,c,d,u]=this.#b();return t.set([NaN,NaN,NaN,NaN,(i[0]-s)/a,(i[1]-r)/l,NaN,NaN,NaN,NaN,h,c,NaN,NaN,NaN,NaN,d,u,NaN,NaN,NaN,NaN,(n[0]-s)/a,(n[1]-r)/l],e),e+24}}class Es extends ws{#t;#e=null;#i;#n;#s;#r;#l;constructor(t,e,i,n,s,r){super(),this.#l=t,this.#s=e,this.#t=i,this.#r=n,this.#i=s,this.#n=r,this.#o(r);const{x:a,y:l,width:h,height:c}=this.#e;for(let d=0,u=t.length;d<u;d+=2)t[d]=(t[d]-a)/h,t[d+1]=(t[d+1]-l)/c;for(let d=0,u=e.length;d<u;d+=2)e[d]=(e[d]-a)/h,e[d+1]=(e[d+1]-l)/c}toSVGPath(){const t=[`M${this.#l[4]} ${this.#l[5]}`];for(let e=6,i=this.#l.length;e<i;e+=6)isNaN(this.#l[e])?t.push(`L${this.#l[e+4]} ${this.#l[e+5]}`):t.push(`C${this.#l[e]} ${this.#l[e+1]} ${this.#l[e+2]} ${this.#l[e+3]} ${this.#l[e+4]} ${this.#l[e+5]}`);return t.push("Z"),t.join(" ")}serialize([t,e,i,n],s){const r=i-t,a=n-e;let l,h;switch(s){case 0:l=this.#h(this.#l,t,n,r,-a),h=this.#h(this.#s,t,n,r,-a);break;case 90:l=this.#c(this.#l,t,e,r,a),h=this.#c(this.#s,t,e,r,a);break;case 180:l=this.#h(this.#l,i,e,-r,a),h=this.#h(this.#s,i,e,-r,a);break;case 270:l=this.#c(this.#l,i,n,-r,-a),h=this.#c(this.#s,i,n,-r,-a)}return{outline:Array.from(l),points:[Array.from(h)]}}#h(t,e,i,n,s){const r=new Float64Array(t.length);for(let a=0,l=t.length;a<l;a+=2)r[a]=e+t[a]*n,r[a+1]=i+t[a+1]*s;return r}#c(t,e,i,n,s){const r=new Float64Array(t.length);for(let a=0,l=t.length;a<l;a+=2)r[a]=e+t[a+1]*n,r[a+1]=i+t[a]*s;return r}#o(t){const e=this.#l;let i=e[4],n=e[5],s=i,r=n,a=i,l=n,h=i,c=n;const d=t?Math.max:Math.min;for(let b=6,m=e.length;b<m;b+=6){if(isNaN(e[b]))s=Math.min(s,e[b+4]),r=Math.min(r,e[b+5]),a=Math.max(a,e[b+4]),l=Math.max(l,e[b+5]),c<e[b+5]?(h=e[b+4],c=e[b+5]):c===e[b+5]&&(h=d(h,e[b+4]));else{const v=I.bezierBoundingBox(i,n,...e.slice(b,b+6));s=Math.min(s,v[0]),r=Math.min(r,v[1]),a=Math.max(a,v[2]),l=Math.max(l,v[3]),c<v[3]?(h=v[2],c=v[3]):c===v[3]&&(h=d(h,v[2]))}i=e[b+4],n=e[b+5]}const u=s-this.#i,f=r-this.#i,p=a-s+2*this.#i,g=l-r+2*this.#i;this.#e={x:u,y:f,width:p,height:g,lastPoint:[h,c]}}get box(){return this.#e}newOutliner(t,e,i,n,s,r=0){return new oe(t,e,i,n,s,r)}getNewOutline(t,e){const{x:i,y:n,width:s,height:r}=this.#e,[a,l,h,c]=this.#t,d=s*h,u=r*c,f=i*h+a,p=n*c+l,g=this.newOutliner({x:this.#s[0]*d+f,y:this.#s[1]*u+p},this.#t,this.#r,t,this.#n,e??this.#i);for(let b=2;b<this.#s.length;b+=2)g.add({x:this.#s[b]*d+f,y:this.#s[b+1]*u+p});return g.getOutlines()}get mustRemoveSelfIntersections(){return!0}}class xs{#t;#e=[];#i=[];constructor(t,e=0,i=0,n=!0){let s=1/0,r=-1/0,a=1/0,l=-1/0;const c=10**-4;for(const{x:m,y:v,width:A,height:w}of t){const E=Math.floor((m-e)/c)*c,C=Math.ceil((m+A+e)/c)*c,M=Math.floor((v-e)/c)*c,T=Math.ceil((v+w+e)/c)*c;this.#e.push([E,M,T,!0],[C,M,T,!1]),s=Math.min(s,E),r=Math.max(r,C),a=Math.min(a,M),l=Math.max(l,T)}const d=r-s+2*i,u=l-a+2*i,f=s-i,p=a-i,g=this.#e.at(n?-1:-2),b=[g[0],g[2]];for(const m of this.#e){const[v,A,w]=m;m[0]=(v-f)/d,m[1]=(A-p)/u,m[2]=(w-p)/u}this.#t={x:f,y:p,width:d,height:u,lastPoint:b}}getOutlines(){this.#e.sort((e,i)=>e[0]-i[0]||e[1]-i[1]||e[2]-i[2]);const t=[];for(const e of this.#e)e[3]?(t.push(...this.#h(e)),this.#r(e)):(this.#l(e),t.push(...this.#h(e)));return this.#n(t)}#n(t){const e=[],i=new Set;for(const r of t){const[a,l,h]=r;e.push([a,l,r],[a,h,r])}e.sort((r,a)=>r[1]-a[1]||r[0]-a[0]);for(let r=0,a=e.length;r<a;r+=2){const l=e[r][2],h=e[r+1][2];l.push(h),h.push(l),i.add(l),i.add(h)}const n=[];let s;for(;i.size>0;){const r=i.values().next().value;let[a,l,h,c,d]=r;i.delete(r);let u=a,f=l;for(s=[a,h],n.push(s);;){let p;if(i.has(c))p=c;else{if(!i.has(d))break;p=d}i.delete(p),[a,l,h,c,d]=p,u!==a&&(s.push(u,f,a,f===l?l:h),u=a),f=f===l?h:l}s.push(u,f)}return new Qo(n,this.#t)}#s(t){const e=this.#i;let i=0,n=e.length-1;for(;i<=n;){const s=i+n>>1,r=e[s][0];if(r===t)return s;r<t?i=s+1:n=s-1}return n+1}#r([,t,e]){const i=this.#s(t);this.#i.splice(i,0,[t,e])}#l([,t,e]){const i=this.#s(t);for(let n=i;n<this.#i.length;n++){const[s,r]=this.#i[n];if(s!==t)break;if(s===t&&r===e)return void this.#i.splice(n,1)}for(let n=i-1;n>=0;n--){const[s,r]=this.#i[n];if(s!==t)break;if(s===t&&r===e)return void this.#i.splice(n,1)}}#h(t){const[e,i,n]=t,s=[[e,i,n]],r=this.#s(n);for(let a=0;a<r;a++){const[l,h]=this.#i[a];for(let c=0,d=s.length;c<d;c++){const[,u,f]=s[c];if(!(h<=u||f<=l)){if(u>=l){if(f>h)s[c][1]=h;else{if(1===d)return[];s.splice(c,1),c--,d--}continue}s[c][2]=l,f>h&&s.push([e,h,f])}}}return s}}class Qo extends ws{#t;#e;constructor(t,e){super(),this.#e=t,this.#t=e}toSVGPath(){const t=[];for(const e of this.#e){let[i,n]=e;t.push(`M${i} ${n}`);for(let s=2;s<e.length;s+=2){const r=e[s],a=e[s+1];r===i?(t.push(`V${a}`),n=a):a===n&&(t.push(`H${r}`),i=r)}t.push("Z")}return t.join(" ")}serialize([t,e,i,n],s){const r=[],a=i-t,l=n-e;for(const h of this.#e){const c=new Array(h.length);for(let d=0;d<h.length;d+=2)c[d]=t+h[d]*a,c[d+1]=n-h[d+1]*l;r.push(c)}return r}get box(){return this.#t}get classNamesForDrawing(){return["highlight"]}get classNamesForOutlining(){return["highlightOutline"]}}class en extends oe{newFreeDrawOutline(t,e,i,n,s,r){return new Zo(t,e,i,n,s,r)}get classNamesForDrawing(){return["highlight","free"]}}class Zo extends Es{get classNamesForDrawing(){return["highlight","free"]}get classNamesForOutlining(){return["highlightOutline","free"]}newOutliner(t,e,i,n,s,r=0){return new en(t,e,i,n,s,r)}}class Mt{#t=null;#e=null;#i;#n=null;#s=!1;#r=!1;#l=null;#h;#c=null;#o=null;#d;static#a=null;static get _keyboardManager(){return U(this,"_keyboardManager",new Pe([[["Escape","mac+Escape"],Mt.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],Mt.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],Mt.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],Mt.prototype._moveToPrevious],[["Home","mac+Home"],Mt.prototype._moveToBeginning],[["End","mac+End"],Mt.prototype._moveToEnd]]))}constructor({editor:t=null,uiManager:e=null}){t?(this.#r=!1,this.#d=D.HIGHLIGHT_COLOR,this.#l=t):(this.#r=!0,this.#d=D.HIGHLIGHT_DEFAULT_COLOR),this.#o=t?._uiManager||e,this.#h=this.#o._eventBus,this.#i=t?.color||this.#o?.highlightColors.values().next().value||"#FFFF98",Mt.#a||=Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"})}renderButton(){const t=this.#t=document.createElement("button");t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.setAttribute("aria-haspopup",!0);const e=this.#o._signal;t.addEventListener("click",this.#g.bind(this),{signal:e}),t.addEventListener("keydown",this.#f.bind(this),{signal:e});const i=this.#e=document.createElement("span");return i.className="swatch",i.setAttribute("aria-hidden",!0),i.style.backgroundColor=this.#i,t.append(i),t}renderMainDropdown(){const t=this.#n=this.#u();return t.setAttribute("aria-orientation","horizontal"),t.setAttribute("aria-labelledby","highlightColorPickerLabel"),t}#u(){const t=document.createElement("div"),e=this.#o._signal;t.addEventListener("contextmenu",Pt,{signal:e}),t.className="dropdown",t.role="listbox",t.setAttribute("aria-multiselectable",!1),t.setAttribute("aria-orientation","vertical"),t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(const[i,n]of this.#o.highlightColors){const s=document.createElement("button");s.tabIndex="0",s.role="option",s.setAttribute("data-color",n),s.title=i,s.setAttribute("data-l10n-id",Mt.#a[i]);const r=document.createElement("span");s.append(r),r.className="swatch",r.style.backgroundColor=n,s.setAttribute("aria-selected",n===this.#i),s.addEventListener("click",this.#p.bind(this,n),{signal:e}),t.append(s)}return t.addEventListener("keydown",this.#f.bind(this),{signal:e}),t}#p(t,e){e.stopPropagation(),this.#h.dispatch("switchannotationeditorparams",{source:this,type:this.#d,value:t})}_colorSelectFromKeyboard(t){if(t.target===this.#t)return void this.#g(t);const e=t.target.getAttribute("data-color");e&&this.#p(e,t)}_moveToNext(t){this.#m?t.target!==this.#t?t.target.nextSibling?.focus():this.#n.firstChild?.focus():this.#g(t)}_moveToPrevious(t){t.target!==this.#n?.firstChild&&t.target!==this.#t?(this.#m||this.#g(t),t.target.previousSibling?.focus()):this.#m&&this._hideDropdownFromKeyboard()}_moveToBeginning(t){this.#m?this.#n.firstChild?.focus():this.#g(t)}_moveToEnd(t){this.#m?this.#n.lastChild?.focus():this.#g(t)}#f(t){Mt._keyboardManager.exec(this,t)}#g(t){if(this.#m)return void this.hideDropdown();if(this.#s=0===t.detail,this.#c||(this.#c=new AbortController,window.addEventListener("pointerdown",this.#b.bind(this),{signal:this.#o.combinedSignal(this.#c)})),this.#n)return void this.#n.classList.remove("hidden");const e=this.#n=this.#u();this.#t.append(e)}#b(t){this.#n?.contains(t.target)||this.hideDropdown()}hideDropdown(){this.#n?.classList.add("hidden"),this.#c?.abort(),this.#c=null}get#m(){return this.#n&&!this.#n.classList.contains("hidden")}_hideDropdownFromKeyboard(){if(!this.#r){if(!this.#m)return void this.#l?.unselect();this.hideDropdown(),this.#t.focus({preventScroll:!0,focusVisible:this.#s})}}updateColor(t){if(this.#e&&(this.#e.style.backgroundColor=t),!this.#n)return;const e=this.#o.highlightColors.values();for(const i of this.#n.children)i.setAttribute("aria-selected",e.next().value===t)}destroy(){this.#t?.remove(),this.#t=null,this.#e=null,this.#n?.remove(),this.#n=null}}class nt extends O{#t=null;#e=0;#i;#n=null;#s=null;#r=null;#l=null;#h=0;#c=null;#o=null;#d=null;#a=!1;#u=null;#p;#f=null;#g="";#b;#m="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _type="highlight";static _editorType=B.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";static get _keyboardManager(){const t=nt.prototype;return U(this,"_keyboardManager",new Pe([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}constructor(t){super({...t,name:"highlightEditor"}),this.color=t.color||nt._defaultColor,this.#b=t.thickness||nt._defaultThickness,this.#p=t.opacity||nt._defaultOpacity,this.#i=t.boxes||null,this.#m=t.methodOfCreation||"",this.#g=t.text||"",this._isDraggable=!1,t.highlightId>-1?(this.#a=!0,this.#A(t),this.#P()):this.#i&&(this.#t=t.anchorNode,this.#e=t.anchorOffset,this.#l=t.focusNode,this.#h=t.focusOffset,this.#_(),this.#P(),this.rotate(this.rotation))}get telemetryInitialData(){return{action:"added",type:this.#a?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:this.#b,methodOfCreation:this.#m}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}#_(){const t=new xs(this.#i,.001);this.#o=t.getOutlines(),({x:this.x,y:this.y,width:this.width,height:this.height}=this.#o.box);const e=new xs(this.#i,.0025,.001,"ltr"===this._uiManager.direction);this.#r=e.getOutlines();const{lastPoint:i}=this.#r.box;this.#u=[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height]}#A({highlightOutlines:t,highlightId:e,clipPathId:i}){if(this.#o=t,this.#r=t.getNewOutline(this.#b/2+1.5,.0025),e>=0)this.#d=e,this.#n=i,this.parent.drawLayer.finalizeLine(e,t),this.#f=this.parent.drawLayer.drawOutline(this.#r);else if(this.parent){const c=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(this.#d,t),this.parent.drawLayer.updateBox(this.#d,nt.#x(this.#o.box,(c-this.rotation+360)%360)),this.parent.drawLayer.updateLine(this.#f,this.#r),this.parent.drawLayer.updateBox(this.#f,nt.#x(this.#r.box,c))}const{x:s,y:r,width:a,height:l}=t.box;switch(this.rotation){case 0:this.x=s,this.y=r,this.width=a,this.height=l;break;case 90:{const[c,d]=this.parentDimensions;this.x=r,this.y=1-s,this.width=a*d/c,this.height=l*c/d;break}case 180:this.x=1-s,this.y=1-r,this.width=a,this.height=l;break;case 270:{const[c,d]=this.parentDimensions;this.x=1-r,this.y=s,this.width=a*d/c,this.height=l*c/d;break}}const{lastPoint:h}=this.#r.box;this.#u=[(h[0]-s)/a,(h[1]-r)/l]}static initialize(t,e){O.initialize(t,e),nt._defaultColor||=e.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(t,e){switch(t){case D.HIGHLIGHT_DEFAULT_COLOR:nt._defaultColor=e;break;case D.HIGHLIGHT_THICKNESS:nt._defaultThickness=e}}translateInPage(t,e){}get toolbarPosition(){return this.#u}updateParams(t,e){switch(t){case D.HIGHLIGHT_COLOR:this.#E(e);break;case D.HIGHLIGHT_THICKNESS:this.#y(e)}}static get defaultPropertiesToUpdate(){return[[D.HIGHLIGHT_DEFAULT_COLOR,nt._defaultColor],[D.HIGHLIGHT_THICKNESS,nt._defaultThickness]]}get propertiesToUpdate(){return[[D.HIGHLIGHT_COLOR,this.color||nt._defaultColor],[D.HIGHLIGHT_THICKNESS,this.#b||nt._defaultThickness],[D.HIGHLIGHT_FREE,this.#a]]}#E(t){const e=(s,r)=>{this.color=s,this.parent?.drawLayer.changeColor(this.#d,s),this.#s?.updateColor(s),this.#p=r,this.parent?.drawLayer.changeOpacity(this.#d,r)},i=this.color,n=this.#p;this.addCommands({cmd:e.bind(this,t,nt._defaultOpacity),undo:e.bind(this,i,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:D.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(t)},!0)}#y(t){const e=this.#b,i=n=>{this.#b=n,this.#w(n)};this.addCommands({cmd:i.bind(this,t),undo:i.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:D.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}addEditToolbar(){var t=()=>super.addEditToolbar,e=this;return(0,x.A)(function*(){const i=yield t().call(e);return i?(e._uiManager.highlightColors&&(e.#s=new Mt({editor:e}),i.addColorPicker(e.#s)),i):null})()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#R())}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,this.#R())}onceAdded(){this.annotationElementId||this.parent.addUndoableEditor(this),this.div.focus()}remove(){this.#L(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.#P(),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;this.parent&&!t?this.#L():t&&(this.#P(t),e=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),this.show(this._isVisible),e&&this.select()}#w(t){if(!this.#a)return;this.#A({highlightOutlines:this.#o.getNewOutline(t/2)}),this.fixAndSetPosition();const[e,i]=this.parentDimensions;this.setDims(this.width*e,this.height*i)}#L(){null===this.#d||!this.parent||(this.parent.drawLayer.remove(this.#d),this.#d=null,this.parent.drawLayer.remove(this.#f),this.#f=null)}#P(t=this.parent){null===this.#d&&(({id:this.#d,clipPathId:this.#n}=t.drawLayer.draw(this.#o,this.color,this.#p)),this.#f=t.drawLayer.drawOutline(this.#r),this.#c&&(this.#c.style.clipPath=this.#n))}static#x({x:t,y:e,width:i,height:n},s){switch(s){case 90:return{x:1-e-n,y:t,width:n,height:i};case 180:return{x:1-t-i,y:1-e-n,width:i,height:n};case 270:return{x:e,y:1-t-i,width:n,height:i}}return{x:t,y:e,width:i,height:n}}rotate(t){const{drawLayer:e}=this.parent;let i;i=this.#a?nt.#x(this.#o.box,t=(t-this.rotation+360)%360):nt.#x(this,t),e.rotate(this.#d,t),e.rotate(this.#f,t),e.updateBox(this.#d,i),e.updateBox(this.#f,nt.#x(this.#r.box,t))}render(){if(this.div)return this.div;const t=super.render();this.#g&&(t.setAttribute("aria-label",this.#g),t.setAttribute("role","mark")),this.#a?t.classList.add("free"):this.div.addEventListener("keydown",this.#T.bind(this),{signal:this._uiManager._signal});const e=this.#c=document.createElement("div");t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=this.#n;const[i,n]=this.parentDimensions;return this.setDims(this.width*i,this.height*n),ti(this,this.#c,["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.isSelected||this.parent.drawLayer.addClass(this.#f,"hovered")}pointerleave(){this.isSelected||this.parent.drawLayer.removeClass(this.#f,"hovered")}#T(t){nt._keyboardManager.exec(this,t)}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:this.#S(!0);break;case 1:case 3:this.#S(!1)}}#S(t){if(!this.#t)return;const e=window.getSelection();t?e.setPosition(this.#t,this.#e):e.setPosition(this.#l,this.#h)}select(){super.select(),this.#f&&(this.parent?.drawLayer.removeClass(this.#f,"hovered"),this.parent?.drawLayer.addClass(this.#f,"selected"))}unselect(){super.unselect(),this.#f&&(this.parent?.drawLayer.removeClass(this.#f,"selected"),this.#a||this.#S(!1))}get _mustFixPosition(){return!this.#a}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.show(this.#d,t),this.parent.drawLayer.show(this.#f,t))}#R(){return this.#a?this.rotation:0}#k(){if(this.#a)return null;const[t,e]=this.pageDimensions,[i,n]=this.pageTranslation,s=this.#i,r=new Float32Array(8*s.length);let a=0;for(const{x:l,y:h,width:c,height:d}of s){const u=l*t+i,f=(1-h-d)*e+n;r[a]=r[a+4]=u,r[a+1]=r[a+3]=f,r[a+2]=r[a+6]=u+c*t,r[a+5]=r[a+7]=f+d*e,a+=8}return r}#C(t){return this.#o.serialize(t,this.#R())}static startHighlighting(t,e,{target:i,x:n,y:s}){const{x:r,y:a,width:l,height:h}=i.getBoundingClientRect(),c=new AbortController,d=t.combinedSignal(c),f=p=>{c.abort(),this.#M(t,p)};window.addEventListener("blur",f,{signal:d}),window.addEventListener("pointerup",f,{signal:d}),window.addEventListener("pointerdown",p=>{p.preventDefault(),p.stopPropagation()},{capture:!0,passive:!1,signal:d}),window.addEventListener("contextmenu",Pt,{signal:d}),i.addEventListener("pointermove",this.#v.bind(this,t),{signal:d}),this._freeHighlight=new en({x:n,y:s},[r,a,l,h],t.scale,this._defaultThickness/2,e,.001),({id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.draw(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0))}static#v(t,e){this._freeHighlight.add(e)&&t.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)}static#M(t,e){this._freeHighlight.isEmpty()?t.drawLayer.remove(this._freeHighlightId):t.createAndAddNewEditor(e,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static deserialize(t,e,i){var n=()=>super.deserialize,s=this;return(0,x.A)(function*(){let r=null;if(t instanceof As){const{data:{quadPoints:b,rect:m,rotation:v,id:A,color:w,opacity:E,popupRef:C},parent:{page:{pageNumber:M}}}=t;r=t={annotationType:B.HIGHLIGHT,color:Array.from(w),opacity:E,quadPoints:b,boxes:null,pageIndex:M-1,rect:m.slice(0),rotation:v,id:A,deleted:!1,popupRef:C}}else if(t instanceof tn){const{data:{inkLists:b,rect:m,rotation:v,id:A,color:w,borderStyle:{rawWidth:E},popupRef:C},parent:{page:{pageNumber:M}}}=t;r=t={annotationType:B.HIGHLIGHT,color:Array.from(w),thickness:E,inkLists:b,boxes:null,pageIndex:M-1,rect:m.slice(0),rotation:v,id:A,deleted:!1,popupRef:C}}const{color:a,quadPoints:l,inkLists:h,opacity:c}=t,d=yield n().call(s,t,e,i);d.color=I.makeHexColor(...a),d.#p=c||1,h&&(d.#b=t.thickness),d.annotationElementId=t.id||null,d._initialData=r;const[u,f]=d.pageDimensions,[p,g]=d.pageTranslation;if(l){const b=d.#i=[];for(let m=0;m<l.length;m+=8)b.push({x:(l[m]-p)/u,y:1-(l[m+1]-g)/f,width:(l[m+2]-l[m])/u,height:(l[m+1]-l[m+5])/f});d.#_(),d.#P(),d.rotate(d.rotation)}else if(h){d.#a=!0;const b=h[0],m={x:b[0]-p,y:f-(b[1]-g)},v=new en(m,[0,0,u,f],1,d.#b/2,!0,.001);for(let E=0,C=b.length;E<C;E+=2)m.x=b[E]-p,m.y=f-(b[E+1]-g),v.add(m);const{id:A,clipPathId:w}=e.drawLayer.draw(v,d.color,d._defaultOpacity,!0);d.#A({highlightOutlines:v.getOutlines(),highlightId:A,clipPathId:w}),d.#P()}return d})()}serialize(t=!1){if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();const e=this.getRect(0,0),i=O._colorManager.convert(this.color),n={annotationType:B.HIGHLIGHT,color:i,opacity:this.#p,thickness:this.#b,quadPoints:this.#k(),outlines:this.#C(e),pageIndex:this.pageIndex,rect:e,rotation:this.#R(),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!this.#I(n)?null:(n.id=this.annotationElementId,n)}#I(t){const{color:e}=this._initialData;return t.color.some((i,n)=>i!==e[n])}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}}class ut extends O{#t=0;#e=0;#i=null;#n=new Path2D;#s=!1;#r=null;#l=!1;#h=!1;#c=null;#o=null;#d=0;#a=0;#u=null;static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=1;static _type="ink";static _editorType=B.INK;constructor(t){super({...t,name:"inkEditor"}),this.color=t.color||null,this.thickness=t.thickness||null,this.opacity=t.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(t,e){O.initialize(t,e)}static updateDefaultParams(t,e){switch(t){case D.INK_THICKNESS:ut._defaultThickness=e;break;case D.INK_COLOR:ut._defaultColor=e;break;case D.INK_OPACITY:ut._defaultOpacity=e/100}}updateParams(t,e){switch(t){case D.INK_THICKNESS:this.#p(e);break;case D.INK_COLOR:this.#f(e);break;case D.INK_OPACITY:this.#g(e)}}static get defaultPropertiesToUpdate(){return[[D.INK_THICKNESS,ut._defaultThickness],[D.INK_COLOR,ut._defaultColor||O._defaultLineColor],[D.INK_OPACITY,Math.round(100*ut._defaultOpacity)]]}get propertiesToUpdate(){return[[D.INK_THICKNESS,this.thickness||ut._defaultThickness],[D.INK_COLOR,this.color||ut._defaultColor||O._defaultLineColor],[D.INK_OPACITY,Math.round(100*(this.opacity??ut._defaultOpacity))]]}#p(t){const e=n=>{this.thickness=n,this.#D()},i=this.thickness;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:D.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#f(t){const e=n=>{this.color=n,this.#x()},i=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:D.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#g(t){const e=n=>{this.opacity=n,this.#x()},i=this.opacity;this.addCommands({cmd:e.bind(this,t/=100),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:D.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.canvas||(this.#k(),this.#C()),this.isAttachedToDOM||(this.parent.add(this),this.#v()),this.#D()))}remove(){null!==this.canvas&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.#i&&(clearTimeout(this.#i),this.#i=null),this.#c?.disconnect(),this.#c=null,super.remove())}setParent(t){!this.parent&&t?this._uiManager.removeShouldRescale(this):this.parent&&null===t&&this._uiManager.addShouldRescale(this),super.setParent(t)}onScaleChanging(){const[t,e]=this.parentDimensions;this.setDimensions(this.width*t,this.height*e)}enableEditMode(){this.#s||null===this.canvas||(super.enableEditMode(),this._isDraggable=!1,this.#T())}disableEditMode(){!this.isInEditMode()||null===this.canvas||(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.#S())}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}#b(){const{parentRotation:t,parentDimensions:[e,i]}=this;switch(t){case 90:return[0,i,i,e];case 180:return[e,i,e,i];case 270:return[e,0,i,e];default:return[0,0,e,i]}}#m(){const{ctx:t,color:e,opacity:i,thickness:n,parentScale:s,scaleFactor:r}=this;t.lineWidth=n*s/r,t.lineCap="round",t.lineJoin="round",t.miterLimit=10,t.strokeStyle=`${e}${function _a(o){return Math.round(Math.min(255,Math.max(1,255*o))).toString(16).padStart(2,"0")}(i)}`}#_(t,e){this.canvas.addEventListener("contextmenu",Pt,{signal:this._uiManager._signal}),this.#S(),this.#r=new AbortController;const i=this._uiManager.combinedSignal(this.#r);this.canvas.addEventListener("pointerleave",this.canvasPointerleave.bind(this),{signal:i}),this.canvas.addEventListener("pointermove",this.canvasPointermove.bind(this),{signal:i}),this.canvas.addEventListener("pointerup",this.canvasPointerup.bind(this),{signal:i}),this.isEditing=!0,this.#h||(this.#h=!0,this.#v(),this.thickness||=ut._defaultThickness,this.color||=ut._defaultColor||O._defaultLineColor,this.opacity??=ut._defaultOpacity),this.currentPath.push([t,e]),this.#l=!1,this.#m(),this.#u=()=>{this.#w(),this.#u&&window.requestAnimationFrame(this.#u)},window.requestAnimationFrame(this.#u)}#A(t,e){const[i,n]=this.currentPath.at(-1);if(this.currentPath.length>1&&t===i&&e===n)return;const s=this.currentPath;let r=this.#n;if(s.push([t,e]),this.#l=!0,s.length<=2)return r.moveTo(...s[0]),void r.lineTo(t,e);3===s.length&&(this.#n=r=new Path2D,r.moveTo(...s[0])),this.#L(r,...s.at(-3),...s.at(-2),t,e)}#E(){if(0===this.currentPath.length)return;const t=this.currentPath.at(-1);this.#n.lineTo(...t)}#y(t,e){let i;if(this.#u=null,t=Math.min(Math.max(t,0),this.canvas.width),e=Math.min(Math.max(e,0),this.canvas.height),this.#A(t,e),this.#E(),1!==this.currentPath.length)i=this.#P();else{const l=[t,e];i=[[l,l.slice(),l.slice(),l]]}const n=this.#n,s=this.currentPath;this.currentPath=[],this.#n=new Path2D,this.addCommands({cmd:()=>{this.allRawPaths.push(s),this.paths.push(i),this.bezierPath2D.push(n),this._uiManager.rebuild(this)},undo:()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),0===this.paths.length?this.remove():(this.canvas||(this.#k(),this.#C()),this.#D())},mustExec:!0})}#w(){if(!this.#l)return;this.#l=!1;Math.ceil(this.thickness*this.parentScale);const e=this.currentPath.slice(-3),i=e.map(c=>c[0]),n=e.map(c=>c[1]),{ctx:h}=(Math.min(...i),Math.max(...i),Math.min(...n),Math.max(...n),this);h.save(),h.clearRect(0,0,this.canvas.width,this.canvas.height);for(const c of this.bezierPath2D)h.stroke(c);h.stroke(this.#n),h.restore()}#L(t,e,i,n,s,r,a){const l=(e+n)/2,h=(i+s)/2,c=(n+r)/2,d=(s+a)/2;t.bezierCurveTo(l+2*(n-l)/3,h+2*(s-h)/3,c+2*(n-c)/3,d+2*(s-d)/3,c,d)}#P(){const t=this.currentPath;if(t.length<=2)return[[t[0],t[0],t.at(-1),t.at(-1)]];const e=[];let i,[n,s]=t[0];for(i=1;i<t.length-2;i++){const[u,f]=t[i],[p,g]=t[i+1],b=(u+p)/2,m=(f+g)/2;e.push([[n,s],[n+2*(u-n)/3,s+2*(f-s)/3],[b+2*(u-b)/3,m+2*(f-m)/3],[b,m]]),[n,s]=[b,m]}const[r,a]=t[i],[l,h]=t[i+1];return e.push([[n,s],[n+2*(r-n)/3,s+2*(a-s)/3],[l+2*(r-l)/3,h+2*(a-h)/3],[l,h]]),e}#x(){if(this.isEmpty())return void this.#I();this.#m();const{canvas:t,ctx:e}=this;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t.width,t.height),this.#I();for(const i of this.bezierPath2D)e.stroke(i)}commit(){this.#s||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),this.#s=!0,this.div.classList.add("disabled"),this.#D(!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),this.enableEditMode())}#T(){if(this.#o)return;this.#o=new AbortController;const t=this._uiManager.combinedSignal(this.#o);this.canvas.addEventListener("pointerdown",this.canvasPointerdown.bind(this),{signal:t})}#S(){this.pointerdownAC?.abort(),this.pointerdownAC=null}canvasPointerdown(t){0!==t.button||!this.isInEditMode()||this.#s||(this.setInForeground(),t.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),this.#_(t.offsetX,t.offsetY))}canvasPointermove(t){t.preventDefault(),this.#A(t.offsetX,t.offsetY)}canvasPointerup(t){t.preventDefault(),this.#R(t)}canvasPointerleave(t){this.#R(t)}#R(t){this.#r?.abort(),this.#r=null,this.#T(),this.#i&&clearTimeout(this.#i),this.#i=setTimeout(()=>{this.#i=null,this.canvas.removeEventListener("contextmenu",Pt)},10),this.#y(t.offsetX,t.offsetY),this.addToAnnotationStorage(),this.setInBackground()}#k(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")}#C(){this.#c=new ResizeObserver(t=>{const e=t[0].contentRect;e.width&&e.height&&this.setDimensions(e.width,e.height)}),this.#c.observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{this.#c?.disconnect(),this.#c=null},{once:!0})}get isResizable(){return!this.isEmpty()&&this.#s}render(){if(this.div)return this.div;let t,e;this.width&&(t=this.x,e=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");const[i,n,s,r]=this.#b();if(this.setAt(i,n,0,0),this.setDims(s,r),this.#k(),this.width){const[a,l]=this.parentDimensions;this.setAspectRatio(this.width*a,this.height*l),this.setAt(t*a,e*l,this.width*a,this.height*l),this.#h=!0,this.#v(),this.setDims(this.width*a,this.height*l),this.#x(),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return this.#C(),this.div}#v(){if(!this.#h)return;const[t,e]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*e),this.#I()}setDimensions(t,e){const i=Math.round(t),n=Math.round(e);if(this.#d===i&&this.#a===n)return;this.#d=i,this.#a=n,this.canvas.style.visibility="hidden";const[s,r]=this.parentDimensions;this.width=t/s,this.height=e/r,this.fixAndSetPosition(),this.#s&&this.#M(t,e),this.#v(),this.#x(),this.canvas.style.visibility="visible",this.fixDims()}#M(t,e){const i=this.#V(),n=(t-i)/this.#e,s=(e-i)/this.#t;this.scaleFactor=Math.min(n,s)}#I(){const t=this.#V()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)}static#N(t){const e=new Path2D;for(let i=0,n=t.length;i<n;i++){const[s,r,a,l]=t[i];0===i&&e.moveTo(...s),e.bezierCurveTo(r[0],r[1],a[0],a[1],l[0],l[1])}return e}static#H(t,e,i){const[n,s,r,a]=e;switch(i){case 0:for(let l=0,h=t.length;l<h;l+=2)t[l]+=n,t[l+1]=a-t[l+1];break;case 90:for(let l=0,h=t.length;l<h;l+=2){const c=t[l];t[l]=t[l+1]+n,t[l+1]=c+s}break;case 180:for(let l=0,h=t.length;l<h;l+=2)t[l]=r-t[l],t[l+1]+=s;break;case 270:for(let l=0,h=t.length;l<h;l+=2){const c=t[l];t[l]=r-t[l+1],t[l+1]=a-c}break;default:throw new Error("Invalid rotation")}return t}static#j(t,e,i){const[n,s,r,a]=e;switch(i){case 0:for(let l=0,h=t.length;l<h;l+=2)t[l]-=n,t[l+1]=a-t[l+1];break;case 90:for(let l=0,h=t.length;l<h;l+=2){const c=t[l];t[l]=t[l+1]-s,t[l+1]=c-n}break;case 180:for(let l=0,h=t.length;l<h;l+=2)t[l]=r-t[l],t[l+1]-=s;break;case 270:for(let l=0,h=t.length;l<h;l+=2){const c=t[l];t[l]=a-t[l+1],t[l+1]=r-c}break;default:throw new Error("Invalid rotation")}return t}#F(t,e,i,n){const s=[],r=this.thickness/2,a=t*e+r,l=t*i+r;for(const h of this.paths){const c=[],d=[];for(let u=0,f=h.length;u<f;u++){const[p,g,b,m]=h[u];if(p[0]===m[0]&&p[1]===m[1]&&1===f){const S=t*p[0]+a,L=t*p[1]+l;c.push(S,L),d.push(S,L);break}const v=t*p[0]+a,A=t*p[1]+l,w=t*g[0]+a,E=t*g[1]+l,C=t*b[0]+a,M=t*b[1]+l,T=t*m[0]+a,y=t*m[1]+l;0===u&&(c.push(v,A),d.push(v,A)),c.push(w,E,C,M,T,y),d.push(w,E),u===f-1&&d.push(T,y)}s.push({bezier:ut.#H(c,n,this.rotation),points:ut.#H(d,n,this.rotation)})}return s}#B(){let t=1/0,e=-1/0,i=1/0,n=-1/0;for(const s of this.paths)for(const[r,a,l,h]of s){const c=I.bezierBoundingBox(...r,...a,...l,...h);t=Math.min(t,c[0]),i=Math.min(i,c[1]),e=Math.max(e,c[2]),n=Math.max(n,c[3])}return[t,i,e,n]}#V(){return this.#s?Math.ceil(this.thickness*this.parentScale):0}#D(t=!1){if(this.isEmpty())return;if(!this.#s)return void this.#x();const e=this.#B(),i=this.#V();this.#e=Math.max(O.MIN_SIZE,e[2]-e[0]),this.#t=Math.max(O.MIN_SIZE,e[3]-e[1]);const n=Math.ceil(i+this.#e*this.scaleFactor),s=Math.ceil(i+this.#t*this.scaleFactor),[r,a]=this.parentDimensions;this.width=n/r,this.height=s/a,this.setAspectRatio(n,s);const l=this.translationX,h=this.translationY;this.translationX=-e[0],this.translationY=-e[1],this.#v(),this.#x(),this.#d=n,this.#a=s,this.setDims(n,s);const c=t?i/this.scaleFactor/2:0;this.translate(l-this.translationX-c,h-this.translationY-c)}static deserialize(t,e,i){var n=()=>super.deserialize,s=this;return(0,x.A)(function*(){if(t instanceof tn)return null;const r=yield n().call(s,t,e,i);r.thickness=t.thickness,r.color=I.makeHexColor(...t.color),r.opacity=t.opacity;const[a,l]=r.pageDimensions,h=r.width*a,c=r.height*l,d=r.parentScale,u=t.thickness/2;r.#s=!0,r.#d=Math.round(h),r.#a=Math.round(c);const{paths:f,rect:p,rotation:g}=t;for(let{bezier:m}of f){m=ut.#j(m,p,g);const v=[];r.paths.push(v);let A=d*(m[0]-u),w=d*(m[1]-u);for(let C=2,M=m.length;C<M;C+=6){const z=d*(m[C+4]-u),H=d*(m[C+5]-u);v.push([[A,w],[d*(m[C]-u),d*(m[C+1]-u)],[d*(m[C+2]-u),d*(m[C+3]-u)],[z,H]]),A=z,w=H}const E=s.#N(v);r.bezierPath2D.push(E)}const b=r.#B();return r.#e=Math.max(O.MIN_SIZE,b[2]-b[0]),r.#t=Math.max(O.MIN_SIZE,b[3]-b[1]),r.#M(h,c),r})()}serialize(){if(this.isEmpty())return null;const t=this.getRect(0,0),e=O._colorManager.convert(this.ctx.strokeStyle);return{annotationType:B.INK,color:e,thickness:this.thickness,opacity:this.opacity,paths:this.#F(this.scaleFactor/this.parentScale,this.translationX,this.translationY,t),pageIndex:this.pageIndex,rect:t,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}}class nn extends O{#t=null;#e=null;#i=null;#n=null;#s=null;#r="";#l=null;#h=null;#c=null;#o=!1;#d=!1;static _type="stamp";static _editorType=B.STAMP;constructor(t){super({...t,name:"stampEditor"}),this.#n=t.bitmapUrl,this.#s=t.bitmapFile}static initialize(t,e){O.initialize(t,e)}static get supportedTypes(){return U(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map(e=>`image/${e}`))}static get supportedTypesStr(){return U(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(t){return this.supportedTypes.includes(t)}static paste(t,e){e.pasteEditor(B.STAMP,{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(t){const e=t.get("hasAltText");return{hasAltText:e.get(!0)??0,hasNoAltText:e.get(!1)??0}}#a(t,e=!1){t?(this.#t=t.bitmap,e||(this.#e=t.id,this.#o=t.isSvg),t.file&&(this.#r=t.file.name),this.#f()):this.remove()}#u(){if(this.#i=null,this._uiManager.enableWaiting(!1),this.#l){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#t)return this._editToolbar.hide(),void this._uiManager.editAltText(this,!0);if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#t){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}mlGuessAltText(){var t=this;return(0,x.A)(function*(e=null,i=!0){if(t.hasAltTextData())return null;const{mlManager:n}=t._uiManager;if(!n)throw new Error("No ML.");if(!(yield n.isEnabledFor("altText")))throw new Error("ML isn't enabled for alt text.");const{data:s,width:r,height:a}=e||t.copyCanvas(null,null,!0).imageData,l=yield n.guess({name:"altText",request:{data:s,width:r,height:a,channels:s.length/(r*a)}});if(!l)throw new Error("No response from the AI service.");if(l.error)throw new Error("Error from the AI service.");if(l.cancel)return null;if(!l.output)throw new Error("No valid response from the AI service.");const h=l.output;return yield t.setGuessedAltText(h),i&&!t.hasAltTextData()&&(t.altTextData={alt:h,decorative:!1}),h}).apply(this,arguments)}#p(){var t=this;if(this.#e)return this._uiManager.enableWaiting(!0),void this._uiManager.imageManager.getFromId(this.#e).then(n=>this.#a(n,!0)).finally(()=>this.#u());if(this.#n){const n=this.#n;return this.#n=null,this._uiManager.enableWaiting(!0),void(this.#i=this._uiManager.imageManager.getFromUrl(n).then(s=>this.#a(s)).finally(()=>this.#u()))}if(this.#s){const n=this.#s;return this.#s=null,this._uiManager.enableWaiting(!0),void(this.#i=this._uiManager.imageManager.getFromFile(n).then(s=>this.#a(s)).finally(()=>this.#u()))}const e=document.createElement("input");e.type="file",e.accept=nn.supportedTypesStr;const i=this._uiManager._signal;this.#i=new Promise(n=>{e.addEventListener("change",(0,x.A)(function*(){if(e.files&&0!==e.files.length){t._uiManager.enableWaiting(!0);const s=yield t._uiManager.imageManager.getFromFile(e.files[0]);t._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:t._uiManager.useNewAltTextFlow}}),t.#a(s)}else t.remove();n()}),{signal:i}),e.addEventListener("cancel",()=>{this.remove(),n()},{signal:i})}).finally(()=>this.#u()),e.click()}remove(){this.#e&&(this.#t=null,this._uiManager.imageManager.deleteId(this.#e),this.#l?.remove(),this.#l=null,this.#h?.disconnect(),this.#h=null,this.#c&&(clearTimeout(this.#c),this.#c=null)),super.remove()}rebuild(){this.parent?(super.rebuild(),null!==this.div&&(this.#e&&null===this.#l&&this.#p(),this.isAttachedToDOM||this.parent.add(this))):this.#e&&this.#p()}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(this.#i||this.#t||this.#n||this.#s||this.#e)}get isResizable(){return!0}render(){if(this.div)return this.div;let t,e;if(this.width&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.div.setAttribute("role","figure"),this.addAltTextButton(),this.#t?this.#f():this.#p(),this.width&&!this.annotationElementId){const[i,n]=this.parentDimensions;this.setAt(t*i,e*n,this.width*i,this.height*n)}return this.div}#f(){const{div:t}=this;let{width:e,height:i}=this.#t;const[n,s]=this.pageDimensions,r=.75;if(this.width)e=this.width*n,i=this.height*s;else if(e>r*n||i>r*s){const c=Math.min(r*n/e,r*s/i);e*=c,i*=c}const[a,l]=this.parentDimensions;this.setDims(e*a/n,i*l/s),this._uiManager.enableWaiting(!1);const h=this.#l=document.createElement("canvas");h.setAttribute("role","img"),this.addContainer(h),(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(t.hidden=!1),this.#m(e,i),this.#A(),this.#d||(this.parent.addUndoableEditor(this),this.#d=!0),this._reportTelemetry({action:"inserted_image"}),this.#r&&h.setAttribute("aria-label",this.#r)}copyCanvas(t,e,i=!1){t||(t=224);const{width:n,height:s}=this.#t,r=new Oi;let a=this.#t,l=n,h=s,c=null;if(e){if(n>e||s>e){const C=Math.min(e/n,e/s);l=Math.floor(n*C),h=Math.floor(s*C)}c=document.createElement("canvas");const u=c.width=Math.ceil(l*r.sx),f=c.height=Math.ceil(h*r.sy);this.#o||(a=this.#b(u,f));const p=c.getContext("2d");p.filter=this._uiManager.hcmFilter;let g="white",b="#cfcfd8";"none"!==this._uiManager.hcmFilter?b="black":window.matchMedia?.("(prefers-color-scheme: dark)").matches&&(g="#8f8f9d",b="#42414d");const m=15,v=m*r.sx,A=m*r.sy,w=new OffscreenCanvas(2*v,2*A),E=w.getContext("2d");E.fillStyle=g,E.fillRect(0,0,2*v,2*A),E.fillStyle=b,E.fillRect(0,0,v,A),E.fillRect(v,A,v,A),p.fillStyle=p.createPattern(w,"repeat"),p.fillRect(0,0,u,f),p.drawImage(a,0,0,a.width,a.height,0,0,u,f)}let d=null;if(i){let u,f;if(r.symmetric&&a.width<t&&a.height<t)u=a.width,f=a.height;else if(a=this.#t,n>t||s>t){const b=Math.min(t/n,t/s);u=Math.floor(n*b),f=Math.floor(s*b),this.#o||(a=this.#b(u,f))}const g=new OffscreenCanvas(u,f).getContext("2d",{willReadFrequently:!0});g.drawImage(a,0,0,a.width,a.height,0,0,u,f),d={width:u,height:f,data:g.getImageData(0,0,u,f).data}}return{canvas:c,width:l,height:h,imageData:d}}#g(t,e){const[i,n]=this.parentDimensions;this.width=t/i,this.height=e/n,this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,null!==this.#c&&clearTimeout(this.#c),this.#c=setTimeout(()=>{this.#c=null,this.#m(t,e)},200)}#b(t,e){const{width:i,height:n}=this.#t;let s=i,r=n,a=this.#t;for(;s>2*t||r>2*e;){const l=s,h=r;s>2*t&&(s=s>=16384?Math.floor(s/2)-1:Math.ceil(s/2)),r>2*e&&(r=r>=16384?Math.floor(r/2)-1:Math.ceil(r/2));const c=new OffscreenCanvas(s,r);c.getContext("2d").drawImage(a,0,0,l,h,0,0,s,r),a=c.transferToImageBitmap()}return a}#m(t,e){const i=new Oi,n=Math.ceil(t*i.sx),s=Math.ceil(e*i.sy),r=this.#l;if(!r||r.width===n&&r.height===s)return;r.width=n,r.height=s;const a=this.#o?this.#t:this.#b(n,s),l=r.getContext("2d");l.filter=this._uiManager.hcmFilter,l.drawImage(a,0,0,a.width,a.height,0,0,n,s)}getImageForAltText(){return this.#l}#_(t){if(t){if(this.#o){const n=this._uiManager.imageManager.getSvgUrl(this.#e);if(n)return n}const e=document.createElement("canvas");return({width:e.width,height:e.height}=this.#t),e.getContext("2d").drawImage(this.#t,0,0),e.toDataURL()}if(this.#o){const[e,i]=this.pageDimensions,n=Math.round(this.width*e*ue.PDF_TO_CSS_UNITS),s=Math.round(this.height*i*ue.PDF_TO_CSS_UNITS),r=new OffscreenCanvas(n,s);return r.getContext("2d").drawImage(this.#t,0,0,this.#t.width,this.#t.height,0,0,n,s),r.transferToImageBitmap()}return structuredClone(this.#t)}#A(){this._uiManager._signal&&(this.#h=new ResizeObserver(t=>{const e=t[0].contentRect;e.width&&e.height&&this.#g(e.width,e.height)}),this.#h.observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{this.#h?.disconnect(),this.#h=null},{once:!0}))}static deserialize(t,e,i){var n=()=>super.deserialize,s=this;return(0,x.A)(function*(){let r=null;if(t instanceof ys){const{data:{rect:b,rotation:m,id:v,structParent:A,popupRef:w},container:E,parent:{page:{pageNumber:C}}}=t,M=E.querySelector("canvas"),T=i.imageManager.getFromCanvas(E.id,M);M.remove();const y=(yield e._structTree.getAriaAttributes(`${Li}${v}`))?.get("aria-label")||"";r=t={annotationType:B.STAMP,bitmapId:T.id,bitmap:T.bitmap,pageIndex:C-1,rect:b.slice(0),rotation:m,id:v,deleted:!1,accessibilityData:{decorative:!1,altText:y},isSvg:!1,structParent:A,popupRef:w}}const a=yield n().call(s,t,e,i),{rect:l,bitmap:h,bitmapUrl:c,bitmapId:d,isSvg:u,accessibilityData:f}=t;d&&i.imageManager.isValidId(d)?(a.#e=d,h&&(a.#t=h)):a.#n=c,a.#o=u;const[p,g]=a.pageDimensions;return a.width=(l[2]-l[0])/p,a.height=(l[3]-l[1])/g,a.annotationElementId=t.id||null,f&&(a.altTextData=f),a._initialData=r,a.#d=!!r,a})()}serialize(t=!1,e=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();const i={annotationType:B.STAMP,bitmapId:this.#e,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#o,structTreeParentId:this._structTreeParentId};if(t)return i.bitmapUrl=this.#_(!0),i.accessibilityData=this.serializeAltText(!0),i;const{decorative:n,altText:s}=this.serializeAltText(!1);if(!n&&s&&(i.accessibilityData={type:"Figure",alt:s}),this.annotationElementId){const a=this.#E(i);if(a.isSame)return null;a.isSameAltText?delete i.accessibilityData:i.accessibilityData.structParent=this._initialData.structParent??-1}if(i.id=this.annotationElementId,null===e)return i;e.stamps||=new Map;const r=this.#o?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(e.stamps.has(this.#e)){if(this.#o){const a=e.stamps.get(this.#e);r>a.area&&(a.area=r,a.serialized.bitmap.close(),a.serialized.bitmap=this.#_(!1))}}else e.stamps.set(this.#e,{area:r,serialized:i}),i.bitmap=this.#_(!1);return i}#E(t){const{rect:e,pageIndex:i,accessibilityData:{altText:n}}=this._initialData,s=t.rect.every((l,h)=>Math.abs(l-e[h])<1),r=t.pageIndex===i,a=(t.accessibilityData?.alt||"")===n;return{isSame:s&&r&&a,isSameAltText:a}}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}}let Jo=(()=>{class o{#t;#e=!1;#i=null;#n=null;#s=null;#r=new Map;#l=!1;#h=!1;#c=!1;#o=null;#d=null;#a;static _initialized=!1;static#u=new Map([ht,ut,nn,nt].map(e=>[e._editorType,e]));constructor({uiManager:e,pageIndex:i,div:n,structTreeLayer:s,accessibilityManager:r,annotationLayer:a,drawLayer:l,textLayer:h,viewport:c,l10n:d}){const u=[...o.#u.values()];if(!o._initialized){o._initialized=!0;for(const f of u)f.initialize(d,e)}e.registerEditorTypes(u),this.#a=e,this.pageIndex=i,this.div=n,this.#t=r,this.#i=a,this.viewport=c,this.#o=h,this.drawLayer=l,this._structTree=s,this.#a.addLayer(this)}get isEmpty(){return 0===this.#r.size}get isInvisible(){return this.isEmpty&&this.#a.getMode()===B.NONE}updateToolbar(e){this.#a.updateToolbar(e)}updateMode(e=this.#a.getMode()){switch(this.#m(),e){case B.NONE:return this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),void this.disableClick();case B.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case B.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);const{classList:i}=this.div;for(const n of o.#u.values())i.toggle(`${n._type}Editing`,e===n._editorType);this.div.hidden=!1}hasTextLayer(e){return e===this.#o?.div}addInkEditorIfNeeded(e){if(this.#a.getMode()===B.INK){if(!e)for(const n of this.#r.values())if(n.isEmpty())return void n.setInBackground();this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}}setEditingState(e){this.#a.setEditingState(e)}addCommands(e){this.#a.addCommands(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){this.#i?.div.classList.toggle("disabled",!e)}enable(){var e=this;return(0,x.A)(function*(){e.div.tabIndex=0,e.togglePointerEvents(!0);const i=new Set;for(const s of e.#r.values())s.enableEditing(),s.show(!0),s.annotationElementId&&(e.#a.removeChangedExistingAnnotation(s),i.add(s.annotationElementId));if(!e.#i)return;const n=e.#i.getEditableAnnotations();for(const s of n){if(s.hide(),e.#a.isDeletedAnnotationElement(s.data.id)||i.has(s.data.id))continue;const r=yield e.deserialize(s);r&&(e.addOrRebuild(r),r.enableEditing())}})()}disable(){this.#c=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1);const e=new Map,i=new Map;for(const s of this.#r.values())if(s.disableEditing(),s.annotationElementId){if(null!==s.serialize()){e.set(s.annotationElementId,s);continue}i.set(s.annotationElementId,s),this.getEditableAnnotation(s.annotationElementId)?.show(),s.remove()}if(this.#i){const s=this.#i.getEditableAnnotations();for(const r of s){const{id:a}=r.data;if(this.#a.isDeletedAnnotationElement(a))continue;let l=i.get(a);l?(l.resetAnnotationElement(r),l.show(!1),r.show()):(l=e.get(a),l&&(this.#a.addChangedExistingAnnotation(l),l.renderAnnotationElement(r)&&l.show(!1)),r.show())}}this.#m(),this.isEmpty&&(this.div.hidden=!0);const{classList:n}=this.div;for(const s of o.#u.values())n.remove(`${s._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),this.#c=!1}getEditableAnnotation(e){return this.#i?.getEditableAnnotation(e)||null}setActiveEditor(e){this.#a.getActive()!==e&&this.#a.setActiveEditor(e)}enableTextSelection(){if(this.div.tabIndex=-1,this.#o?.div&&!this.#d){this.#d=new AbortController;const e=this.#a.combinedSignal(this.#d);this.#o.div.addEventListener("pointerdown",this.#p.bind(this),{signal:e}),this.#o.div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,this.#o?.div&&this.#d&&(this.#d.abort(),this.#d=null,this.#o.div.classList.remove("highlighting"))}#p(e){this.#a.unselectAll();const{target:i}=e;if(i===this.#o.div||("img"===i.getAttribute("role")||i.classList.contains("endOfContent"))&&this.#o.div.contains(i)){const{isMac:n}=bt.platform;if(0!==e.button||e.ctrlKey&&n)return;this.#a.showAllEditors("highlight",!0,!0),this.#o.div.classList.add("free"),this.toggleDrawing(),nt.startHighlighting(this,"ltr"===this.#a.direction,{target:this.#o.div,x:e.x,y:e.y}),this.#o.div.addEventListener("pointerup",()=>{this.#o.div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:this.#a._signal}),e.preventDefault()}}enableClick(){if(this.#n)return;this.#n=new AbortController;const e=this.#a.combinedSignal(this.#n);this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e}),this.div.addEventListener("pointerup",this.pointerup.bind(this),{signal:e})}disableClick(){this.#n?.abort(),this.#n=null}attach(e){this.#r.set(e.id,e);const{annotationElementId:i}=e;i&&this.#a.isDeletedAnnotationElement(i)&&this.#a.removeDeletedAnnotationElement(e)}detach(e){this.#r.delete(e.id),this.#t?.removePointerInTextLayer(e.contentDiv),!this.#c&&e.annotationElementId&&this.#a.addDeletedAnnotationElement(e)}remove(e){this.detach(e),this.#a.removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1,this.#h||this.addInkEditorIfNeeded(!1)}changeParent(e){e.parent!==this&&(e.parent&&e.annotationElementId&&(this.#a.addDeletedAnnotationElement(e.annotationElementId),O.deleteAnnotationElement(e),e.annotationElementId=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(e.parent!==this||!e.isAttachedToDOM){if(this.changeParent(e),this.#a.addEditor(e),this.attach(e),!e.isAttachedToDOM){const i=e.render();this.div.append(i),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(),this.#a.addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;const{activeElement:i}=document;e.div.contains(i)&&!this.#s&&(e._focusEventsAllowed=!1,this.#s=setTimeout(()=>{this.#s=null,e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this.#a._signal}),i.focus())},0)),e._structTreeParentId=this.#t?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||=this,e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){this.addCommands({cmd:()=>e._uiManager.rebuild(e),undo:()=>{e.remove()},mustExec:!1})}getNextId(){return this.#a.getId()}get#f(){return o.#u.get(this.#a.getMode())}combinedSignal(e){return this.#a.combinedSignal(e)}#g(e){const i=this.#f;return i?new i.prototype.constructor(e):null}canCreateNewEmptyEditor(){return this.#f?.canCreateNewEmptyEditor()}pasteEditor(e,i){this.#a.updateToolbar(e),this.#a.updateMode(e);const{offsetX:n,offsetY:s}=this.#b(),r=this.getNextId(),a=this.#g({parent:this,id:r,x:n,y:s,uiManager:this.#a,isCentered:!0,...i});a&&this.add(a)}deserialize(e){var i=this;return(0,x.A)(function*(){return(yield o.#u.get(e.annotationType??e.annotationEditorType)?.deserialize(e,i,i.#a))||null})()}createAndAddNewEditor(e,i,n={}){const s=this.getNextId(),r=this.#g({parent:this,id:s,x:e.offsetX,y:e.offsetY,uiManager:this.#a,isCentered:i,...n});return r&&this.add(r),r}#b(){const{x:e,y:i,width:n,height:s}=this.div.getBoundingClientRect(),r=Math.max(0,e),a=Math.max(0,i),c=(r+Math.min(window.innerWidth,e+n))/2-e,d=(a+Math.min(window.innerHeight,i+s))/2-i,[u,f]=this.viewport.rotation%180==0?[c,d]:[d,c];return{offsetX:u,offsetY:f}}addNewEditor(){this.createAndAddNewEditor(this.#b(),!0)}setSelected(e){this.#a.setSelected(e)}toggleSelected(e){this.#a.toggleSelected(e)}unselect(e){this.#a.unselect(e)}pointerup(e){const{isMac:i}=bt.platform;if(!(0!==e.button||e.ctrlKey&&i)&&e.target===this.div&&this.#l){if(this.#l=!1,!this.#e)return void(this.#e=!0);if(this.#a.getMode()===B.STAMP)return void this.#a.unselectAll();this.createAndAddNewEditor(e,!1)}}pointerdown(e){if(this.#a.getMode()===B.HIGHLIGHT&&this.enableTextSelection(),this.#l)return void(this.#l=!1);const{isMac:i}=bt.platform;if(0!==e.button||e.ctrlKey&&i||e.target!==this.div)return;this.#l=!0;const n=this.#a.getActive();this.#e=!n||n.isEmpty()}findNewParent(e,i,n){const s=this.#a.findParent(i,n);return null!==s&&s!==this&&(s.changeParent(e),!0)}destroy(){this.#a.getActive()?.parent===this&&(this.#a.commitOrRemove(),this.#a.setActiveEditor(null)),this.#s&&(clearTimeout(this.#s),this.#s=null);for(const e of this.#r.values())this.#t?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#r.clear(),this.#a.removeLayer(this)}#m(){this.#h=!0;for(const e of this.#r.values())e.isEmpty()&&e.remove();this.#h=!1}render({viewport:e}){this.viewport=e,se(this.div,e);for(const i of this.#a.getEditors(this.pageIndex))this.add(i),i.rebuild();this.updateMode()}update({viewport:e}){this.#a.commitOrRemove(),this.#m();const i=this.viewport.rotation,n=e.rotation;if(this.viewport=e,se(this.div,{rotation:n}),i!==n)for(const s of this.#r.values())s.rotate(n);this.addInkEditorIfNeeded(!1)}get pageDimensions(){const{pageWidth:e,pageHeight:i}=this.viewport.rawDims;return[e,i]}get scale(){return this.#a.viewParameters.realScale}}return o})();class gt{#t=null;#e=0;#i=new Map;#n=new Map;constructor({pageIndex:t}){this.pageIndex=t}setParent(t){if(this.#t){if(this.#t!==t){if(this.#i.size>0)for(const e of this.#i.values())e.remove(),t.append(e);this.#t=t}}else this.#t=t}static get _svgFactory(){return U(this,"_svgFactory",new Zi)}static#s(t,{x:e=0,y:i=0,width:n=1,height:s=1}={}){const{style:r}=t;r.top=100*i+"%",r.left=100*e+"%",r.width=100*n+"%",r.height=100*s+"%"}#r(t){const e=gt._svgFactory.create(1,1,!0);return this.#t.append(e),e.setAttribute("aria-hidden",!0),gt.#s(e,t),e}#l(t,e){const i=gt._svgFactory.createElement("clipPath");t.append(i);const n=`clip_${e}`;i.setAttribute("id",n),i.setAttribute("clipPathUnits","objectBoundingBox");const s=gt._svgFactory.createElement("use");return i.append(s),s.setAttribute("href",`#${e}`),s.classList.add("clip"),n}draw(t,e,i,n=!1){const s=this.#e++,r=this.#r(t.box);r.classList.add(...t.classNamesForDrawing);const a=gt._svgFactory.createElement("defs");r.append(a);const l=gt._svgFactory.createElement("path");a.append(l);const h=`path_p${this.pageIndex}_${s}`;l.setAttribute("id",h),l.setAttribute("d",t.toSVGPath()),n&&this.#n.set(s,l);const c=this.#l(a,h),d=gt._svgFactory.createElement("use");return r.append(d),r.setAttribute("fill",e),r.setAttribute("fill-opacity",i),d.setAttribute("href",`#${h}`),this.#i.set(s,r),{id:s,clipPathId:`url(#${c})`}}drawOutline(t){const e=this.#e++,i=this.#r(t.box);i.classList.add(...t.classNamesForOutlining);const n=gt._svgFactory.createElement("defs");i.append(n);const s=gt._svgFactory.createElement("path");n.append(s);const r=`path_p${this.pageIndex}_${e}`;let a;if(s.setAttribute("id",r),s.setAttribute("d",t.toSVGPath()),s.setAttribute("vector-effect","non-scaling-stroke"),t.mustRemoveSelfIntersections){const c=gt._svgFactory.createElement("mask");n.append(c),a=`mask_p${this.pageIndex}_${e}`,c.setAttribute("id",a),c.setAttribute("maskUnits","objectBoundingBox");const d=gt._svgFactory.createElement("rect");c.append(d),d.setAttribute("width","1"),d.setAttribute("height","1"),d.setAttribute("fill","white");const u=gt._svgFactory.createElement("use");c.append(u),u.setAttribute("href",`#${r}`),u.setAttribute("stroke","none"),u.setAttribute("fill","black"),u.setAttribute("fill-rule","nonzero"),u.classList.add("mask")}const l=gt._svgFactory.createElement("use");i.append(l),l.setAttribute("href",`#${r}`),a&&l.setAttribute("mask",`url(#${a})`);const h=l.cloneNode();return i.append(h),l.classList.add("mainOutline"),h.classList.add("secondaryOutline"),this.#i.set(e,i),e}finalizeLine(t,e){const i=this.#n.get(t);this.#n.delete(t),this.updateBox(t,e.box),i.setAttribute("d",e.toSVGPath())}updateLine(t,e){this.#i.get(t).firstChild.firstChild.setAttribute("d",e.toSVGPath())}updatePath(t,e){this.#n.get(t).setAttribute("d",e.toSVGPath())}updateBox(t,e){gt.#s(this.#i.get(t),e)}show(t,e){this.#i.get(t).classList.toggle("hidden",!e)}rotate(t,e){this.#i.get(t).setAttribute("data-main-rotation",e)}changeColor(t,e){this.#i.get(t).setAttribute("fill",e)}changeOpacity(t,e){this.#i.get(t).setAttribute("fill-opacity",e)}addClass(t,e){this.#i.get(t).classList.add(e)}removeClass(t,e){this.#i.get(t).classList.remove(e)}getSVGRoot(t){return this.#i.get(t)}remove(t){this.#n.delete(t),null!==this.#t&&(this.#i.get(t).remove(),this.#i.delete(t))}destroy(){this.#t=null;for(const t of this.#i.values())t.remove();this.#i.clear(),this.#n.clear()}}var tl=N.AbortException,el=N.AnnotationEditorLayer,il=N.AnnotationEditorParamsType,Cs=N.AnnotationEditorType,nl=N.AnnotationEditorUIManager,sl=N.AnnotationLayer,rl=N.AnnotationMode,al=N.ColorPicker,ol=N.DOMSVGFactory,ll=N.DrawLayer,hl=N.FeatureTest,Ss=N.GlobalWorkerOptions,cl=N.ImageKind,dl=N.InvalidPDFException,ul=N.MissingPDFException,fl=N.OPS,pl=N.OutputScale,gl=N.PDFDataRangeTransport,ml=N.PDFDateString,bl=N.PDFWorker,_l=N.PasswordResponses,vl=N.PermissionFlag,Al=N.PixelsPerInch,yl=N.RenderingCancelledException,wl=N.TextLayer,El=N.UnexpectedResponseException,xl=N.Util,Ps=N.VerbosityLevel,Cl=N.XfaLayer,Sl=N.build,Pl=N.createValidAbsoluteUrl,Tl=N.fetchData,Ts=N.getDocument,Ml=N.getFilenameFromUrl,Ll=N.getPdfFilenameFromUrl,Rl=N.getXfaPageViewport,Il=N.isDataScheme,kl=N.isPdfFile,Dl=N.noContextMenu,Ol=N.normalizeUnicode,Fl=N.setLayerDimensions,Nl=N.shadow,oi=N.version,Bl=F(7106);function Ms(o){return new Bl.A(o,0)}var Ls=F(600);function li(o){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var i=e.done;return Promise.resolve(e.value).then(function(n){return{value:n,done:i}})}return(li=function(i){this.s=i,this.n=i.next}).prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(i){var n=this.s.return;return void 0===n?Promise.resolve({value:i,done:!0}):t(n.apply(this.s,arguments))},throw:function(i){var n=this.s.return;return void 0===n?Promise.reject(i):t(n.apply(this.s,arguments))}},new li(o)}var Oe={d:(o,t)=>{for(var e in t)Oe.o(t,e)&&!Oe.o(o,e)&&Object.defineProperty(o,e,{enumerable:!0,get:t[e]})},o:(o,t)=>Object.prototype.hasOwnProperty.call(o,t)},q=globalThis.pdfjsViewer={};Oe.d(q,{AnnotationLayerBuilder:()=>Ys,DownloadManager:()=>Oh,EventBus:()=>un,FindState:()=>Jt,GenericL10n:()=>Yt,LinkTarget:()=>le,PDFFindController:()=>yh,PDFHistory:()=>Mc,PDFLinkService:()=>fi,PDFPageView:()=>vr,PDFScriptingManager:()=>zc,PDFSinglePageViewer:()=>$c,PDFViewer:()=>wr,ProgressBar:()=>Zl,RenderingStates:()=>tt,ScrollMode:()=>G,SimpleLinkService:()=>ln,SpreadMode:()=>mt,StructTreeLayerBuilder:()=>br,TextLayerBuilder:()=>ve,XfaLayerBuilder:()=>_r,parseQueryString:()=>hi});const tt={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},G={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3},mt={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2};function Os(o,t,e=!1){let i=o.offsetParent;if(!i)return void console.error("offsetParent is not set -- cannot scroll");let n=o.offsetTop+o.clientTop,s=o.offsetLeft+o.clientLeft;for(;i.clientHeight===i.scrollHeight&&i.clientWidth===i.scrollWidth||e&&(i.classList.contains("markedContent")||"hidden"===getComputedStyle(i).overflow);)if(n+=i.offsetTop,s+=i.offsetLeft,i=i.offsetParent,!i)return;t&&(void 0!==t.top&&(n+=t.top),void 0!==t.left&&(s+=t.left,i.scrollLeft=s)),i.scrollTop=n}function hi(o){const t=new Map;for(const[e,i]of new URLSearchParams(o))t.set(e.toLowerCase(),i);return t}const Fs=/[\x00-\x1F]/g;function Fe(o,t=!1){return Fs.test(o)?t?o.replaceAll(Fs,e=>"\0"===e?"":" "):o.replaceAll("\0",""):o}function Ne(o,t,e=0){let i=e,n=o.length-1;if(n<0||!t(o[n]))return o.length;if(t(o[i]))return i;for(;i<n;){const s=i+n>>1;t(o[s])?n=s:i=s+1}return i}function Ns(o){if(Math.floor(o)===o)return[o,1];const t=1/o;if(t>8)return[1,8];if(Math.floor(t)===t)return[1,t];const i=o>1?t:o;let l,n=0,s=1,r=1,a=1;for(;;){const h=n+r,c=s+a;if(c>8)break;i<=h/c?(r=h,a=c):(n=h,s=c)}return l=i-n/s<r/a-i?i===o?[n,s]:[s,n]:i===o?[r,a]:[a,r],l}function ci(o,t){return o-o%t}function Bs(o){return Number.isInteger(o)&&o%90==0}function Vs(o){return o.width<=o.height}new Promise(function(o){window.requestAnimationFrame(o)});const ql=document.documentElement.style;class Zl{#t=null;#e=null;#i=0;#n=null;#s=!0;constructor(t){this.#t=t.classList,this.#n=t.style}get percent(){return this.#i}set percent(t){this.#i=function Ql(o,t,e){return Math.min(Math.max(o,t),e)}(t,0,100),isNaN(t)?this.#t.add("indeterminate"):(this.#t.remove("indeterminate"),this.#n.setProperty("--progressBar-percent",`${this.#i}%`))}setWidth(t){if(!t)return;const i=t.parentNode.offsetWidth-t.offsetWidth;i>0&&this.#n.setProperty("--progressBar-end-offset",`${i}px`)}setDisableAutoFetch(t=5e3){100===this.#i||isNaN(this.#i)||(this.#e&&clearTimeout(this.#e),this.show(),this.#e=setTimeout(()=>{this.#e=null,this.hide()},t))}hide(){this.#s&&(this.#s=!1,this.#t.add("hidden"))}show(){this.#s||(this.#s=!0,this.#t.remove("hidden"))}}const di=function(){const o=document.createElement("div");return o.style.width="round(down, calc(1.6666666666666665 * 792px), 1px)","calc(1320px)"===o.style.width?Math.fround:t=>t}();function ui(o){return function th(o){return o<11904}(o)?function eh(o){return!(65408&o)}(o)?function sh(o){return 32===o||9===o||13===o||10===o}(o)?0:function ih(o){return o>=97&&o<=122||o>=65&&o<=90}(o)||function nh(o){return o>=48&&o<=57}(o)||95===o?1:2:function hh(o){return 3584==(65408&o)}(o)?7:160===o?0:1:function rh(o){return o>=13312&&o<=40959||o>=63744&&o<=64255}(o)?3:function ah(o){return o>=12448&&o<=12543}(o)?4:function oh(o){return o>=12352&&o<=12447}(o)?5:function lh(o){return o>=65376&&o<=65439}(o)?6:1}let js;const Jt={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3},Hs={"\u2010":"-","\u2018":"'","\u2019":"'","\u201a":"'","\u201b":"'","\u201c":'"',"\u201d":'"',"\u201e":'"',"\u201f":'"',"\xbc":"1/4","\xbd":"1/2","\xbe":"3/4"},zs=new Set([12441,12442,2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,3642,3770,3972,4153,4154,5908,5940,6098,6752,6980,7082,7083,7154,7155,11647,43014,43052,43204,43347,43456,43766,44013,3158,3953,3954,3962,3963,3964,3965,3968,3956]);let Ws;const ph=new RegExp("\\p{M}+","gu"),gh=new RegExp("([.*+?^${}()|[\\]\\\\])|(\\p{P})|(\\s+)|(\\p{M})|(\\p{L})","gu"),mh=new RegExp("([^\\p{M}])\\p{M}*$","u"),bh=new RegExp("^\\p{M}*([^\\p{M}])","u"),_h=/[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g,Us=new Map,Gs=new Map;let rn=null,an=null;function on(o){const t=[];let e,i;for(;null!==(e=_h.exec(o));){let{index:f}=e;for(const p of e[0]){let g=Us.get(p);g||(g=p.normalize("NFD").length,Us.set(p,g)),t.push([g,f++])}}if(0===t.length&&rn)i=rn;else if(t.length>0&&an)i=an;else{const v=`([${Object.keys(Hs).join("")}])|([${function ch(){return js||="\xa0\xa8\xaa\xaf\xb2-\xb5\xb8-\xba\xbc-\xbe\u0132-\u0133\u013f-\u0140\u0149\u017f\u01c4-\u01cc\u01f1-\u01f3\u02b0-\u02b8\u02d8-\u02dd\u02e0-\u02e4\u0374\u037a\u037e\u0384-\u0385\u0387\u03d0-\u03d6\u03f0-\u03f2\u03f4-\u03f5\u03f9\u0587\u0675-\u0678\u0958-\u095f\u09dc-\u09dd\u09df\u0a33\u0a36\u0a59-\u0a5b\u0a5e\u0b5c-\u0b5d\u0e33\u0eb3\u0edc-\u0edd\u0f0c\u0f43\u0f4d\u0f52\u0f57\u0f5c\u0f69\u10fc\u1d2c-\u1d2e\u1d30-\u1d3a\u1d3c-\u1d4d\u1d4f-\u1d6a\u1d78\u1d9b-\u1dbf\u1e9a-\u1e9b\u1f71\u1f73\u1f75\u1f77\u1f79\u1f7b\u1f7d\u1fbb\u1fbd-\u1fc1\u1fc9\u1fcb\u1fcd-\u1fcf\u1fd3\u1fdb\u1fdd-\u1fdf\u1fe3\u1feb\u1fed-\u1fef\u1ff9\u1ffb\u1ffd-\u1ffe\u2000-\u200a\u2011\u2017\u2024-\u2026\u202f\u2033-\u2034\u2036-\u2037\u203c\u203e\u2047-\u2049\u2057\u205f\u2070-\u2071\u2074-\u208e\u2090-\u209c\u20a8\u2100-\u2103\u2105-\u2107\u2109-\u2113\u2115-\u2116\u2119-\u211d\u2120-\u2122\u2124\u2126\u2128\u212a-\u212d\u212f-\u2131\u2133-\u2139\u213b-\u2140\u2145-\u2149\u2150-\u217f\u2189\u222c-\u222d\u222f-\u2230\u2329-\u232a\u2460-\u24ea\u2a0c\u2a74-\u2a76\u2adc\u2c7c-\u2c7d\u2d6f\u2e9f\u2ef3\u2f00-\u2fd5\u3000\u3036\u3038-\u303a\u309b-\u309c\u309f\u30ff\u3131-\u318e\u3192-\u319f\u3200-\u321e\u3220-\u3247\u3250-\u327e\u3280-\u33ff\ua69c-\ua69d\ua770\ua7f2-\ua7f4\ua7f8-\ua7f9\uab5c-\uab5f\uab69\uf900-\ufa0d\ufa10\ufa12\ufa15-\ufa1e\ufa20\ufa22\ufa25-\ufa26\ufa2a-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfc\ufe10-\ufe19\ufe30-\ufe44\ufe47-\ufe52\ufe54-\ufe66\ufe68-\ufe6b\ufe70-\ufe72\ufe74\ufe76-\ufefc\uff01-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc\uffe0-\uffe6",js}()}])|((?:\u3099|\u309a)\\n)|(\\p{M}+(?:-\\n)?)|(\\p{Ll}-\\n\\p{Lu})|(\\S-\\n)|((?:\\p{Ideographic}|[\u3040-\u30ff])\\n)|(\\n)`;i=0===t.length?rn=new RegExp(v+"|(\\u0000)","gum"):an=new RegExp(v+"|([\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f])","gum")}const n=[];for(;null!==(e=ph.exec(o));)n.push([e[0].length,e.index]);let s=o.normalize("NFD");const r=[[0,0]];let a=0,l=0,h=0,c=0,d=0,u=!1;return s=s.replace(i,(f,p,g,b,m,v,A,w,E,C,M)=>{if(M-=c,p){const T=Hs[p],y=T.length;for(let S=1;S<y;S++)r.push([M-h+S,h-S]);return h-=y-1,T}if(g){let T=Gs.get(g);T||(T=g.normalize("NFKC"),Gs.set(g,T));const y=T.length;for(let S=1;S<y;S++)r.push([M-h+S,h-S]);return h-=y-1,T}if(b)return u=!0,M+d===n[a]?.[1]?++a:(r.push([M-1-h+1,h-1]),h-=1,c+=1),r.push([M-h+1,h]),c+=1,d+=1,b.charAt(0);if(m){const T=m.endsWith("\n"),y=T?m.length-2:m.length;u=!0;let S=y;M+d===n[a]?.[1]&&(S-=n[a][0],++a);for(let L=1;L<=S;L++)r.push([M-1-h+L,h-L]);return h-=S,c+=S,T?(r.push([(M+=y-1)-h+1,1+h]),h+=1,c+=1,d+=1,m.slice(0,y)):m}if(v)return r.push([M-h+3,1+h]),h+=1,c+=1,d+=1,v.replace("\n","");if(A)return r.push([M-h+(A.length-2),1+h]),h+=1,c+=1,d+=1,A.slice(0,-2);if(w)return r.push([M-h+(w.length-1),h]),c+=1,d+=1,w.slice(0,-1);if(E)return r.push([M-h+1,h-1]),h-=1,c+=1,d+=1," ";if(M+d===t[l]?.[1]){const T=t[l][0]-1;++l;for(let y=1;y<=T;y++)r.push([M-(h-y),h-y]);h-=T,c+=T}return C}),r.push([s.length,h]),[s,r,u]}class yh{#t=null;#e=!0;#i=0;constructor({linkService:t,eventBus:e,updateMatchesCountOnProgress:i=!0}){this._linkService=t,this._eventBus=e,this.#e=i,this.onIsPageVisible=null,this.#s(),e._on("find",this.#n.bind(this)),e._on("findbarclose",this.#_.bind(this))}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return this.#t}setDocument(t){this._pdfDocument&&this.#s(),t&&(this._pdfDocument=t,this._firstPageCapability.resolve())}#n(t){if(!t)return;const e=this._pdfDocument,{type:i}=t;(null===this.#t||this.#l(t))&&(this._dirtyMatch=!0),this.#t=t,"highlightallchange"!==i&&this.#y(Jt.PENDING),this._firstPageCapability.promise.then(()=>{if(!this._pdfDocument||e&&this._pdfDocument!==e)return;this.#d();const n=!this._highlightMatches,s=!!this._findTimeout;this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),i?this._dirtyMatch?this.#p():"again"===i?(this.#p(),n&&this.#t.highlightAll&&this.#u()):"highlightallchange"===i?(s?this.#p():this._highlightMatches=!0,this.#u()):this.#p():this._findTimeout=setTimeout(()=>{this.#p(),this._findTimeout=null},250)})}scrollMatchIntoView({element:t=null,selectedLeft:e=0,pageIndex:i=-1,matchIndex:n=-1}){this._scrollMatches&&t&&-1!==n&&n===this._selected.matchIdx&&-1!==i&&i===this._selected.pageIdx&&(this._scrollMatches=!1,Os(t,{top:-50,left:e+-400},!0))}#s(){this._highlightMatches=!1,this._scrollMatches=!1,this._pdfDocument=null,this._pageMatches=[],this._pageMatchesLength=[],this.#i=0,this.#t=null,this._selected={pageIdx:-1,matchIdx:-1},this._offset={pageIdx:null,matchIdx:null,wrapped:!1},this._extractTextPromises=[],this._pageContents=[],this._pageDiffs=[],this._hasDiacritics=[],this._matchesCountTotal=0,this._pagesToSearch=null,this._pendingFindMatches=new Set,this._resumePageIdx=null,this._dirtyMatch=!1,clearTimeout(this._findTimeout),this._findTimeout=null,this._firstPageCapability=Promise.withResolvers()}get#r(){const{query:t}=this.#t;return"string"==typeof t?(t!==this._rawQuery&&(this._rawQuery=t,[this._normalizedQuery]=on(t)),this._normalizedQuery):(t||[]).filter(e=>!!e).map(e=>on(e)[0])}#l(t){const e=t.query,i=this.#t.query,n=typeof e;if(n!==typeof i)return!0;if("string"===n){if(e!==i)return!0}else if(JSON.stringify(e)!==JSON.stringify(i))return!0;switch(t.type){case"again":const r=this._selected.pageIdx+1,a=this._linkService;return r>=1&&r<=a.pagesCount&&r!==a.page&&!(this.onIsPageVisible?.(r)??1);case"highlightallchange":return!1}return!0}#h(t,e,i){let n=t.slice(0,e).match(mh);if(n){const s=t.charCodeAt(e),r=n[1].charCodeAt(0);if(ui(s)===ui(r))return!1}if(n=t.slice(e+i).match(bh),n){const s=t.charCodeAt(e+i-1),r=n[1].charCodeAt(0);if(ui(s)===ui(r))return!1}return!0}#c(t,e){const{matchDiacritics:i}=this.#t;let n=!1;return(t=t.replaceAll(gh,(r,a,l,h,c,d)=>a?`[ ]*\\${a}[ ]*`:l?`[ ]*${l}[ ]*`:h?"[ ]+":i?c||d:c?zs.has(c.charCodeAt(0))?c:"":e?(n=!0,`${d}\\p{M}*`):d)).endsWith("[ ]*")&&(t=t.slice(0,t.length-4)),i&&e&&(Ws||=String.fromCharCode(...zs),n=!0,t=`${t}(?=[${Ws}]|[^\\p{M}]|$)`),[n,t]}#o(t){const e=this.#r;if(0===e.length)return;const n=this.match(e,this._pageContents[t],t),s=this._pageMatches[t]=[],r=this._pageMatchesLength[t]=[],a=this._pageDiffs[t];n?.forEach(({index:h,length:c})=>{const[d,u]=function Ah(o,t,e){if(!o)return[t,e];const i=t,n=t+e-1;let s=Ne(o,c=>c[0]>=i);o[s][0]>i&&--s;let r=Ne(o,c=>c[0]>=n,s);o[r][0]>n&&--r;const a=i+o[s][1];return[a,n+o[r][1]+1-a]}(a,h,c);u&&(s.push(d),r.push(u))}),this.#t.highlightAll&&this.#a(t),this._resumePageIdx===t&&(this._resumePageIdx=null,this.#g());const l=s.length;this._matchesCountTotal+=l,this.#e?l>0&&this.#E():++this.#i===this._linkService.pagesCount&&this.#E()}match(t,e,i){const n=this._hasDiacritics[i];let s=!1;if("string"==typeof t?[s,t]=this.#c(t,n):t=t.sort().reverse().map(d=>{const[u,f]=this.#c(d,n);return s||=u,`(${f})`}).join("|"),!t)return;const{caseSensitive:r,entireWord:a}=this.#t;t=new RegExp(t,`g${s?"u":""}${r?"":"i"}`);const h=[];let c;for(;null!==(c=t.exec(e));)a&&!this.#h(e,c.index,c[0].length)||h.push({index:c.index,length:c[0].length});return h}#d(){if(this._extractTextPromises.length>0)return;let t=Promise.resolve();const e={disableNormalization:!0};for(let i=0,n=this._linkService.pagesCount;i<n;i++){const{promise:s,resolve:r}=Promise.withResolvers();this._extractTextPromises[i]=s,t=t.then(()=>this._pdfDocument.getPage(i+1).then(a=>a.getTextContent(e)).then(a=>{const l=[];for(const h of a.items)l.push(h.str),h.hasEOL&&l.push("\n");[this._pageContents[i],this._pageDiffs[i],this._hasDiacritics[i]]=on(l.join("")),r()},a=>{console.error(`Unable to get text content for page ${i+1}`,a),this._pageContents[i]="",this._pageDiffs[i]=null,this._hasDiacritics[i]=!1,r()}))}}#a(t){this._scrollMatches&&this._selected.pageIdx===t&&(this._linkService.page=t+1),this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:t})}#u(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})}#p(){const t=this.#t.findPrevious,e=this._linkService.page-1,i=this._linkService.pagesCount;if(this._highlightMatches=!0,this._dirtyMatch){this._dirtyMatch=!1,this._selected.pageIdx=this._selected.matchIdx=-1,this._offset.pageIdx=e,this._offset.matchIdx=null,this._offset.wrapped=!1,this._resumePageIdx=null,this._pageMatches.length=0,this._pageMatchesLength.length=0,this.#i=0,this._matchesCountTotal=0,this.#u();for(let r=0;r<i;r++)this._pendingFindMatches.has(r)||(this._pendingFindMatches.add(r),this._extractTextPromises[r].then(()=>{this._pendingFindMatches.delete(r),this.#o(r)}))}if(0===this.#r.length)return void this.#y(Jt.FOUND);if(this._resumePageIdx)return;const s=this._offset;if(this._pagesToSearch=i,null!==s.matchIdx){if(!t&&s.matchIdx+1<this._pageMatches[s.pageIdx].length||t&&s.matchIdx>0)return s.matchIdx=t?s.matchIdx-1:s.matchIdx+1,void this.#m(!0);this.#b(t)}this.#g()}#f(t){const e=this._offset,i=t.length,n=this.#t.findPrevious;return i?(e.matchIdx=n?i-1:0,this.#m(!0),!0):(this.#b(n),!!(e.wrapped&&(e.matchIdx=null,this._pagesToSearch<0))&&(this.#m(!1),!0))}#g(){null!==this._resumePageIdx&&console.error("There can only be one pending page.");let t=null;do{const e=this._offset.pageIdx;if(t=this._pageMatches[e],!t){this._resumePageIdx=e;break}}while(!this.#f(t))}#b(t){const e=this._offset,i=this._linkService.pagesCount;e.pageIdx=t?e.pageIdx-1:e.pageIdx+1,e.matchIdx=null,this._pagesToSearch--,(e.pageIdx>=i||e.pageIdx<0)&&(e.pageIdx=t?i-1:0,e.wrapped=!0)}#m(t=!1){let e=Jt.NOT_FOUND;const i=this._offset.wrapped;if(this._offset.wrapped=!1,t){const n=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx,this._selected.matchIdx=this._offset.matchIdx,e=i?Jt.WRAPPED:Jt.FOUND,-1!==n&&n!==this._selected.pageIdx&&this.#a(n)}this.#y(e,this.#t.findPrevious),-1!==this._selected.pageIdx&&(this._scrollMatches=!0,this.#a(this._selected.pageIdx))}#_(t){const e=this._pdfDocument;this._firstPageCapability.promise.then(()=>{!this._pdfDocument||e&&this._pdfDocument!==e||(this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),this._resumePageIdx&&(this._resumePageIdx=null,this._dirtyMatch=!0),this.#y(Jt.FOUND),this._highlightMatches=!1,this.#u())})}#A(){const{pageIdx:t,matchIdx:e}=this._selected;let i=0,n=this._matchesCountTotal;if(-1!==e){for(let s=0;s<t;s++)i+=this._pageMatches[s]?.length||0;i+=e+1}return(i<1||i>n)&&(i=n=0),{current:i,total:n}}#E(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:this.#A()})}#y(t,e=!1){!this.#e&&(this.#i!==this._linkService.pagesCount||t===Jt.PENDING)||this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:t,previous:e,entireWord:this.#t?.entireWord??null,matchesCount:this.#A(),rawQuery:this.#t?.query??null})}}const le={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};class fi{externalLinkEnabled=!0;constructor({eventBus:t,externalLinkTarget:e=null,externalLinkRel:i=null,ignoreDestinationZoom:n=!1}={}){this.eventBus=t,this.externalLinkTarget=e,this.externalLinkRel=i,this._ignoreDestinationZoom=n,this.baseUrl=null,this.pdfDocument=null,this.pdfViewer=null,this.pdfHistory=null}setDocument(t,e=null){this.baseUrl=e,this.pdfDocument=t}setViewer(t){this.pdfViewer=t}setHistory(t){this.pdfHistory=t}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return this.pdfDocument?this.pdfViewer.currentPageNumber:1}set page(t){this.pdfDocument&&(this.pdfViewer.currentPageNumber=t)}get rotation(){return this.pdfDocument?this.pdfViewer.pagesRotation:0}set rotation(t){this.pdfDocument&&(this.pdfViewer.pagesRotation=t)}get isInPresentationMode(){return!!this.pdfDocument&&this.pdfViewer.isInPresentationMode}goToDestination(t){var e=this;return(0,x.A)(function*(){if(!e.pdfDocument)return;let i,n,s;if("string"==typeof t?(i=t,n=yield e.pdfDocument.getDestination(t)):(i=null,n=yield t),!Array.isArray(n))return void console.error(`goToDestination: "${n}" is not a valid destination array, for dest="${t}".`);const[r]=n;if(r&&"object"==typeof r){if(s=e.pdfDocument.cachedPageNumber(r),!s)try{s=(yield e.pdfDocument.getPageIndex(r))+1}catch{return void console.error(`goToDestination: "${r}" is not a valid page reference, for dest="${t}".`)}}else Number.isInteger(r)&&(s=r+1);!s||s<1||s>e.pagesCount?console.error(`goToDestination: "${s}" is not a valid page number, for dest="${t}".`):(e.pdfHistory&&(e.pdfHistory.pushCurrentPosition(),e.pdfHistory.push({namedDest:i,explicitDest:n,pageNumber:s})),e.pdfViewer.scrollPageIntoView({pageNumber:s,destArray:n,ignoreDestinationZoom:e._ignoreDestinationZoom}))})()}goToPage(t){if(!this.pdfDocument)return;const e="string"==typeof t&&this.pdfViewer.pageLabelToPageNumber(t)||0|t;Number.isInteger(e)&&e>0&&e<=this.pagesCount?(this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.pushPage(e)),this.pdfViewer.scrollPageIntoView({pageNumber:e})):console.error(`PDFLinkService.goToPage: "${t}" is not a valid page.`)}addLinkAttributes(t,e,i=!1){if(!e||"string"!=typeof e)throw new Error('A valid "url" parameter must provided.');const n=i?le.BLANK:this.externalLinkTarget,s=this.externalLinkRel;this.externalLinkEnabled?t.href=t.title=e:(t.href="",t.title=`Disabled: ${e}`,t.onclick=()=>!1);let r="";switch(n){case le.NONE:break;case le.SELF:r="_self";break;case le.BLANK:r="_blank";break;case le.PARENT:r="_parent";break;case le.TOP:r="_top"}t.target=r,t.rel="string"==typeof s?s:"noopener noreferrer nofollow"}getDestinationHash(t){if("string"==typeof t){if(t.length>0)return this.getAnchorUrl("#"+escape(t))}else if(Array.isArray(t)){const e=JSON.stringify(t);if(e.length>0)return this.getAnchorUrl("#"+escape(e))}return this.getAnchorUrl("")}getAnchorUrl(t){return this.baseUrl?this.baseUrl+t:t}setHash(t){if(!this.pdfDocument)return;let e,i;if(t.includes("=")){const n=hi(t);if(n.has("search")){const s=n.get("search").replaceAll('"',""),r="true"===n.get("phrase");this.eventBus.dispatch("findfromurlhash",{source:this,query:r?s:s.match(/\S+/g)})}if(n.has("page")&&(e=0|n.get("page")||1),n.has("zoom")){const s=n.get("zoom").split(","),r=s[0],a=parseFloat(r);r.includes("Fit")?"Fit"===r||"FitB"===r?i=[null,{name:r}]:"FitH"===r||"FitBH"===r||"FitV"===r||"FitBV"===r?i=[null,{name:r},s.length>1?0|s[1]:null]:"FitR"===r?5!==s.length?console.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):i=[null,{name:r},0|s[1],0|s[2],0|s[3],0|s[4]]:console.error(`PDFLinkService.setHash: "${r}" is not a valid zoom value.`):i=[null,{name:"XYZ"},s.length>1?0|s[1]:null,s.length>2?0|s[2]:null,a?a/100:r]}return i?this.pdfViewer.scrollPageIntoView({pageNumber:e||this.page,destArray:i,allowNegativeOffset:!0}):e&&(this.page=e),n.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:n.get("pagemode")}),void(n.has("nameddest")&&this.goToDestination(n.get("nameddest")))}i=unescape(t);try{i=JSON.parse(i),Array.isArray(i)||(i=i.toString())}catch{}"string"==typeof i||fi.#t(i)?this.goToDestination(i):console.error(`PDFLinkService.setHash: "${unescape(t)}" is not a valid destination.`)}executeNamedAction(t){if(this.pdfDocument){switch(t){case"GoBack":this.pdfHistory?.back();break;case"GoForward":this.pdfHistory?.forward();break;case"NextPage":this.pdfViewer.nextPage();break;case"PrevPage":this.pdfViewer.previousPage();break;case"LastPage":this.page=this.pagesCount;break;case"FirstPage":this.page=1}this.eventBus.dispatch("namedaction",{source:this,action:t})}}executeSetOCGState(t){var e=this;return(0,x.A)(function*(){if(!e.pdfDocument)return;const i=e.pdfDocument,n=yield e.pdfViewer.optionalContentConfigPromise;i===e.pdfDocument&&(n.setOCGState(t),e.pdfViewer.optionalContentConfigPromise=Promise.resolve(n))})()}static#t(t){if(!Array.isArray(t)||t.length<2)return!1;const[e,i,...n]=t;if(("object"!=typeof e||!Number.isInteger(e?.num)||!Number.isInteger(e?.gen))&&!Number.isInteger(e)||"object"!=typeof i||"string"!=typeof i?.name)return!1;const s=n.length;let r=!0;switch(i.name){case"XYZ":if(s<2||s>3)return!1;break;case"Fit":case"FitB":return 0===s;case"FitH":case"FitBH":case"FitV":case"FitBV":if(s>1)return!1;break;case"FitR":if(4!==s)return!1;r=!1;break;default:return!1}for(const a of n)if(!("number"==typeof a||r&&null===a))return!1;return!0}}class ln extends fi{setDocument(t,e=null){}}const{AbortException:Eh,AnnotationEditorLayer:xh,AnnotationEditorType:St,AnnotationEditorUIManager:Ch,AnnotationLayer:Sh,AnnotationMode:Gt,createValidAbsoluteUrl:Ph,DrawLayer:Th,fetchData:$s,getPdfFilenameFromUrl:Mh,isPdfFile:Lh,normalizeUnicode:Rh,OutputScale:Ih,PermissionFlag:pi,PixelsPerInch:$t,RenderingCancelledException:hn,setLayerDimensions:kh,shadow:gi,TextLayer:Dh,version:Xs,XfaLayer:cn}=globalThis.pdfjsLib;class Ys{#t=null;#e=null;constructor({pdfPage:t,linkService:e,downloadManager:i,annotationStorage:n=null,imageResourcesPath:s="",renderForms:r=!0,enableScripting:a=!1,hasJSActionsPromise:l=null,fieldObjectsPromise:h=null,annotationCanvasMap:c=null,accessibilityManager:d=null,annotationEditorUIManager:u=null,onAppend:f=null}){this.pdfPage=t,this.linkService=e,this.downloadManager=i,this.imageResourcesPath=s,this.renderForms=r,this.annotationStorage=n,this.enableScripting=a,this._hasJSActionsPromise=l||Promise.resolve(!1),this._fieldObjectsPromise=h||Promise.resolve(null),this._annotationCanvasMap=c,this._accessibilityManager=d,this._annotationEditorUIManager=u,this.#t=f,this.annotationLayer=null,this.div=null,this._cancelled=!1,this._eventBus=e.eventBus}render(t,e){var i=this;return(0,x.A)(function*(n,s,r="display"){if(i.div){if(i._cancelled||!i.annotationLayer)return;return void i.annotationLayer.update({viewport:n.clone({dontFlip:!0})})}const[a,l,h]=yield Promise.all([i.pdfPage.getAnnotations({intent:r}),i._hasJSActionsPromise,i._fieldObjectsPromise]);if(i._cancelled)return;const c=i.div=document.createElement("div");c.className="annotationLayer",i.#t?.(c),0!==a.length?(i.annotationLayer=new Sh({div:c,accessibilityManager:i._accessibilityManager,annotationCanvasMap:i._annotationCanvasMap,annotationEditorUIManager:i._annotationEditorUIManager,page:i.pdfPage,viewport:n.clone({dontFlip:!0}),structTreeLayer:s?.structTreeLayer||null}),yield i.annotationLayer.render({annotations:a,imageResourcesPath:i.imageResourcesPath,renderForms:i.renderForms,linkService:i.linkService,downloadManager:i.downloadManager,annotationStorage:i.annotationStorage,enableScripting:i.enableScripting,hasJSActions:l,fieldObjects:h}),i.linkService.isInPresentationMode&&i.#i(3),i.#e||(i.#e=new AbortController,i._eventBus?._on("presentationmodechanged",d=>{i.#i(d.state)},{signal:i.#e.signal}))):i.hide()}).apply(this,arguments)}cancel(){this._cancelled=!0,this.#e?.abort(),this.#e=null}hide(){this.div&&(this.div.hidden=!0)}hasEditableAnnotations(){return!!this.annotationLayer?.hasEditableAnnotations()}#i(t){if(!this.div)return;let e=!1;switch(t){case 3:e=!0;break;case 1:break;default:return}for(const i of this.div.childNodes)i.hasAttribute("data-internal-link")||(i.inert=e)}}function Ks(o,t){const e=document.createElement("a");if(!e.click)throw new Error('DownloadManager: "a.click()" is not supported.');e.href=o,e.target="_parent","download"in e&&(e.download=t),(document.body||document.documentElement).append(e),e.click(),e.remove()}class Oh{#t=new WeakMap;downloadData(t,e,i){Ks(URL.createObjectURL(new Blob([t],{type:i})),e)}openOrDownloadData(t,e,i=null){const s=Lh(e)?"application/pdf":"";return this.downloadData(t,e,s),!1}download(t,e,i){let n;if(t)n=URL.createObjectURL(new Blob([t],{type:"application/pdf"}));else{if(!Ph(e,"http://example.com"))return void console.error(`download - not a valid URL: ${e}`);n=e+"#pdfjs.action=download"}Ks(n,i)}}function dn(){return(dn=(0,x.A)(function*({target:o,name:t,delay:e=0}){if("object"!=typeof o||!t||"string"!=typeof t||!(Number.isInteger(e)&&e>=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");const{promise:i,resolve:n}=Promise.withResolvers(),s=new AbortController;function r(h){s.abort(),clearTimeout(l),n(h)}o[o instanceof un?"_on":"addEventListener"](t,r.bind(null,"event"),{signal:s.signal});const l=setTimeout(r.bind(null,"timeout"),e);return i})).apply(this,arguments)}class un{#t=Object.create(null);on(t,e,i=null){this._on(t,e,{external:!0,once:i?.once,signal:i?.signal})}off(t,e,i=null){this._off(t,e)}dispatch(t,e){const i=this.#t[t];if(!i||0===i.length)return;let n;for(const{listener:s,external:r,once:a}of i.slice(0))a&&this._off(t,s),r?(n||=[]).push(s):s(e);if(n){for(const s of n)s(e);n=null}}_on(t,e,i=null){let n=null;if(i?.signal instanceof AbortSignal){const{signal:r}=i;if(r.aborted)return void console.error("Cannot use an `aborted` signal.");const a=()=>this._off(t,e);n=()=>r.removeEventListener("abort",a),r.addEventListener("abort",a)}(this.#t[t]||=[]).push({listener:e,external:!0===i?.external,once:!0===i?.once,rmAbort:n})}_off(t,e,i=null){const n=this.#t[t];if(n)for(let s=0,r=n.length;s<r;s++){const a=n[s];if(a.listener===e)return a.rmAbort?.(),void n.splice(s,1)}}}class mi{constructor(t){this.value=t}valueOf(){return this.value}}class rt extends mi{constructor(t="???"){super(t)}toString(t){return`{${this.value}}`}}class Xt extends mi{constructor(t,e={}){super(t),this.opts=e}toString(t){try{return t.memoizeIntlObject(Intl.NumberFormat,this.opts).format(this.value)}catch(e){return t.reportError(e),this.value.toString(10)}}}class Be extends mi{constructor(t,e={}){super(t),this.opts=e}toString(t){try{return t.memoizeIntlObject(Intl.DateTimeFormat,this.opts).format(this.value)}catch(e){return t.reportError(e),new Date(this.value).toISOString()}}}function Vh(o,t,e){return e===t||e instanceof Xt&&t instanceof Xt&&e.value===t.value||t instanceof Xt&&"string"==typeof e&&e===o.memoizeIntlObject(Intl.PluralRules,t.opts).select(t.value)}function Zs(o,t,e){return t[e]?_e(o,t[e].value):(o.reportError(new RangeError("No default")),new rt)}function fn(o,t){const e=[],i=Object.create(null);for(const n of t)"narg"===n.type?i[n.name]=Ve(o,n.value):e.push(Ve(o,n));return{positional:e,named:i}}function Ve(o,t){switch(t.type){case"str":return t.value;case"num":return new Xt(t.value,{minimumFractionDigits:t.precision});case"var":return function jh(o,{name:t}){let e;if(o.params){if(!Object.prototype.hasOwnProperty.call(o.params,t))return new rt(`$${t}`);e=o.params[t]}else{if(!o.args||!Object.prototype.hasOwnProperty.call(o.args,t))return o.reportError(new ReferenceError(`Unknown variable: $${t}`)),new rt(`$${t}`);e=o.args[t]}if(e instanceof mi)return e;switch(typeof e){case"string":return e;case"number":return new Xt(e);case"object":if(e instanceof Date)return new Be(e.getTime());default:return o.reportError(new TypeError(`Variable type not supported: $${t}, ${typeof e}`)),new rt(`$${t}`)}}(o,t);case"mesg":return function Hh(o,{name:t,attr:e}){const i=o.bundle._messages.get(t);if(!i)return o.reportError(new ReferenceError(`Unknown message: ${t}`)),new rt(t);if(e){const n=i.attributes[e];return n?_e(o,n):(o.reportError(new ReferenceError(`Unknown attribute: ${e}`)),new rt(`${t}.${e}`))}return i.value?_e(o,i.value):(o.reportError(new ReferenceError(`No value: ${t}`)),new rt(t))}(o,t);case"term":return function zh(o,{name:t,attr:e,args:i}){const n=`-${t}`,s=o.bundle._terms.get(n);if(!s)return o.reportError(new ReferenceError(`Unknown term: ${n}`)),new rt(n);if(e){const a=s.attributes[e];if(a){o.params=fn(o,i).named;const l=_e(o,a);return o.params=null,l}return o.reportError(new ReferenceError(`Unknown attribute: ${e}`)),new rt(`${n}.${e}`)}o.params=fn(o,i).named;const r=_e(o,s.value);return o.params=null,r}(o,t);case"func":return function Wh(o,{name:t,args:e}){let i=o.bundle._functions[t];if(!i)return o.reportError(new ReferenceError(`Unknown function: ${t}()`)),new rt(`${t}()`);if("function"!=typeof i)return o.reportError(new TypeError(`Function ${t}() is not callable`)),new rt(`${t}()`);try{let n=fn(o,e);return i(n.positional,n.named)}catch(n){return o.reportError(n),new rt(`${t}()`)}}(o,t);case"select":return function Uh(o,{selector:t,variants:e,star:i}){let n=Ve(o,t);if(n instanceof rt)return Zs(o,e,i);for(const s of e)if(Vh(o,n,Ve(o,s.key)))return _e(o,s.value);return Zs(o,e,i)}(o,t);default:return new rt}}function Js(o,t){if(o.dirty.has(t))return o.reportError(new RangeError("Cyclic reference")),new rt;o.dirty.add(t);const e=[],i=o.bundle._useIsolating&&t.length>1;for(const n of t)if("string"!=typeof n){if(o.placeables++,o.placeables>100)throw o.dirty.delete(t),new RangeError(`Too many placeables expanded: ${o.placeables}, max allowed is 100`);i&&e.push("\u2068"),e.push(Ve(o,n).toString(o)),i&&e.push("\u2069")}else e.push(o.bundle._transform(n));return o.dirty.delete(t),e.join("")}function _e(o,t){return"string"==typeof t?o.bundle._transform(t):Js(o,t)}class Gh{constructor(t,e,i){this.dirty=new WeakSet,this.params=null,this.placeables=0,this.bundle=t,this.errors=e,this.args=i}reportError(t){if(!(this.errors&&t instanceof Error))throw t;this.errors.push(t)}memoizeIntlObject(t,e){let i=this.bundle._intls.get(t);i||(i={},this.bundle._intls.set(t,i));let n=JSON.stringify(e);return i[n]||(i[n]=new t(this.bundle.locales,e)),i[n]}}function bi(o,t){const e=Object.create(null);for(const[i,n]of Object.entries(o))t.includes(i)&&(e[i]=n.valueOf());return e}const tr=["unitDisplay","currencyDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits"];function $h(o,t){let e=o[0];if(e instanceof rt)return new rt(`NUMBER(${e.valueOf()})`);if(e instanceof Xt)return new Xt(e.valueOf(),{...e.opts,...bi(t,tr)});if(e instanceof Be)return new Xt(e.valueOf(),{...bi(t,tr)});throw new TypeError("Invalid argument to NUMBER")}const er=["dateStyle","timeStyle","fractionalSecondDigits","dayPeriod","hour12","weekday","era","year","month","day","hour","minute","second","timeZoneName"];function Xh(o,t){let e=o[0];if(e instanceof rt)return new rt(`DATETIME(${e.valueOf()})`);if(e instanceof Be)return new Be(e.valueOf(),{...e.opts,...bi(t,er)});if(e instanceof Xt)return new Be(e.valueOf(),{...bi(t,er)});throw new TypeError("Invalid argument to DATETIME")}const ir=new Map;class Kh{constructor(t,{functions:e,useIsolating:i=!0,transform:n=s=>s}={}){this._terms=new Map,this._messages=new Map,this.locales=Array.isArray(t)?t:[t],this._functions={NUMBER:$h,DATETIME:Xh,...e},this._useIsolating=i,this._transform=n,this._intls=function Yh(o){const t=Array.isArray(o)?o.join(" "):o;let e=ir.get(t);return void 0===e&&(e=new Map,ir.set(t,e)),e}(t)}hasMessage(t){return this._messages.has(t)}getMessage(t){return this._messages.get(t)}addResource(t,{allowOverrides:e=!1}={}){const i=[];for(let n=0;n<t.body.length;n++){let s=t.body[n];if(s.id.startsWith("-")){if(!1===e&&this._terms.has(s.id)){i.push(new Error(`Attempt to override an existing term: "${s.id}"`));continue}this._terms.set(s.id,s)}else{if(!1===e&&this._messages.has(s.id)){i.push(new Error(`Attempt to override an existing message: "${s.id}"`));continue}this._messages.set(s.id,s)}}return i}formatPattern(t,e=null,i=null){if("string"==typeof t)return this._transform(t);let n=new Gh(this,i,e);try{return Js(n,t).toString(n)}catch(s){if(n.errors&&s instanceof Error)return n.errors.push(s),(new rt).toString(n);throw s}}}const pn=/^(-?[a-zA-Z][\w-]*) *= */gm,nr=/\.([a-zA-Z][\w-]*) *= */y,qh=/\*?\[/y,gn=/(-?[0-9]+(?:\.([0-9]+))?)/y,Qh=/([a-zA-Z][\w-]*)/y,sr=/([$-])?([a-zA-Z][\w-]*)(?:\.([a-zA-Z][\w-]*))?/y,Zh=/^[A-Z][A-Z0-9_-]*$/,_i=/([^{}\n\r]+)/y,Jh=/([^\\"\n\r]*)/y,rr=/\\([\\"])/y,ar=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{6})/y,tc=/^\n+/,or=/ +$/,ec=/ *\r?\n/g,ic=/( *)$/,nc=/{\s*/y,lr=/\s*}/y,sc=/\[\s*/y,rc=/\s*] */y,ac=/\s*\(\s*/y,oc=/\s*->\s*/y,lc=/\s*:\s*/y,hc=/\s*,?\s*/y,cc=/\s+/y;class dc{constructor(t){this.body=[],pn.lastIndex=0;let e=0;for(;;){let y=pn.exec(t);if(null===y)break;e=pn.lastIndex;try{this.body.push(l(y[1]))}catch(S){if(S instanceof SyntaxError)continue;throw S}}function i(y){return y.lastIndex=e,y.test(t)}function n(y,S){if(t[e]===y)return e++,!0;if(S)throw new S(`Expected ${y}`);return!1}function s(y,S){if(i(y))return e=y.lastIndex,!0;if(S)throw new S(`Expected ${y.toString()}`);return!1}function r(y){y.lastIndex=e;let S=y.exec(t);if(null===S)throw new SyntaxError(`Expected ${y.toString()}`);return e=y.lastIndex,S}function a(y){return r(y)[1]}function l(y){let S=c(),L=function h(){let y=Object.create(null);for(;i(nr);){let S=a(nr),L=c();if(null===L)throw new SyntaxError("Expected attribute value");y[S]=L}return y}();if(null===S&&0===Object.keys(L).length)throw new SyntaxError("Expected message value or attributes");return{id:y,value:S,attributes:L}}function c(){let y;if(i(_i)&&(y=a(_i)),"{"===t[e]||"}"===t[e])return d(y?[y]:[],1/0);let S=C();return S?y?d([y,S],S.length):(S.value=M(S.value,tc),d([S],S.length)):y?M(y,or):null}function d(y=[],S){for(;;){if(i(_i)){y.push(a(_i));continue}if("{"===t[e]){y.push(u());continue}if("}"===t[e])throw new SyntaxError("Unbalanced closing brace");let W=C();if(!W)break;y.push(W),S=Math.min(S,W.length)}let L=y.length-1,z=y[L];"string"==typeof z&&(y[L]=M(z,or));let H=[];for(let W of y)W instanceof hr&&(W=W.value.slice(0,W.value.length-S)),W&&H.push(W);return H}function u(){s(nc,SyntaxError);let y=f();if(s(lr))return y;if(s(oc)){let S=function b(){let L,y=[],S=0;for(;i(qh);){n("*")&&(L=S);let z=m(),H=c();if(null===H)throw new SyntaxError("Expected variant value");y[S++]={key:z,value:H}}if(0===S)return null;if(void 0===L)throw new SyntaxError("Expected default variant");return{variants:y,star:L}}();return s(lr,SyntaxError),{type:"select",selector:y,...S}}throw new SyntaxError("Unclosed placeable")}function f(){if("{"===t[e])return u();if(i(sr)){let[,y,S,L=null]=r(sr);if("$"===y)return{type:"var",name:S};if(s(ac)){let z=function p(){let y=[];for(;;){switch(t[e]){case")":return e++,y;case void 0:throw new SyntaxError("Unclosed argument list")}y.push(g()),s(hc)}}();if("-"===y)return{type:"term",name:S,attr:L,args:z};if(Zh.test(S))return{type:"func",name:S,args:z};throw new SyntaxError("Function names must be all upper-case")}return"-"===y?{type:"term",name:S,attr:L,args:[]}:{type:"mesg",name:S,attr:L}}return v()}function g(){let y=f();return"mesg"!==y.type?y:s(lc)?{type:"narg",name:y.name,value:v()}:y}function m(){let y;return s(sc,SyntaxError),y=i(gn)?A():{type:"str",value:a(Qh)},s(rc,SyntaxError),y}function v(){if(i(gn))return A();if('"'===t[e])return function w(){n('"',SyntaxError);let y="";for(;;){if(y+=a(Jh),"\\"!==t[e]){if(n('"'))return{type:"str",value:y};throw new SyntaxError("Unclosed string literal")}y+=E()}}();throw new SyntaxError("Invalid expression")}function A(){let[,y,S=""]=r(gn),L=S.length;return{type:"num",value:parseFloat(y),precision:L}}function E(){if(i(rr))return a(rr);if(i(ar)){let[,y,S]=r(ar),L=parseInt(y||S,16);return L<=55295||57344<=L?String.fromCodePoint(L):"\ufffd"}throw new SyntaxError("Unknown escape sequence")}function C(){let y=e;switch(s(cc),t[e]){case".":case"[":case"*":case"}":case void 0:return!1;case"{":return T(t.slice(y,e))}return" "===t[e-1]&&T(t.slice(y,e))}function M(y,S){return y.replace(S,"")}function T(y){let S=y.replace(ec,"\n"),L=ic.exec(y)[1].length;return new hr(S,L)}}}class hr{constructor(t,e){this.value=t,this.length=e}}const uc=/<|&#?\w+;/,fc={"http://www.w3.org/1999/xhtml":["em","strong","small","s","cite","q","dfn","abbr","data","time","code","var","samp","kbd","sub","sup","i","b","u","mark","bdi","bdo","span","br","wbr"]},pc={"http://www.w3.org/1999/xhtml":{global:["title","aria-label","aria-valuetext"],a:["download"],area:["download","alt"],input:["alt","placeholder"],menuitem:["label"],menu:["label"],optgroup:["label"],option:["label"],track:["label"],img:["alt"],textarea:["placeholder"],th:["abbr"]},"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul":{global:["accesskey","aria-label","aria-valuetext","label","title","tooltiptext"],description:["value"],key:["key","keycode"],label:["value"],textbox:["placeholder","value"]}};function gc(o,t){const{value:e}=t;if("string"==typeof e)if("title"===o.localName&&"http://www.w3.org/1999/xhtml"===o.namespaceURI)o.textContent=e;else if(uc.test(e)){const i=o.ownerDocument.createElementNS("http://www.w3.org/1999/xhtml","template");i.innerHTML=e,function mc(o,t){for(const e of o.childNodes)if(e.nodeType!==e.TEXT_NODE){if(e.hasAttribute("data-l10n-name")){const i=_c(t,e);o.replaceChild(i,e);continue}if(Ac(e)){const i=vc(e);o.replaceChild(i,e);continue}console.warn(`An element of forbidden type "${e.localName}" was found in the translation. Only safe text-level elements and elements with data-l10n-name are allowed.`),o.replaceChild(mn(e),e)}t.textContent="",t.appendChild(o)}(i.content,o)}else o.textContent=e;cr(t,o)}function bc(o,t){if(!o)return!1;for(let e of o)if(e.name===t)return!0;return!1}function cr(o,t){const e=t.hasAttribute("data-l10n-attrs")?t.getAttribute("data-l10n-attrs").split(",").map(i=>i.trim()):null;for(const i of Array.from(t.attributes))dr(i.name,t,e)&&!bc(o.attributes,i.name)&&t.removeAttribute(i.name);if(o.attributes)for(const i of Array.from(o.attributes))dr(i.name,t,e)&&t.getAttribute(i.name)!==i.value&&t.setAttribute(i.name,i.value)}function _c(o,t){const e=t.getAttribute("data-l10n-name"),i=o.querySelector(`[data-l10n-name="${e}"]`);return i?i.localName!==t.localName?(console.warn(`An element named "${e}" was found in the translation but its type ${t.localName} didn't match the element found in the source (${i.localName}).`),mn(t)):(o.removeChild(i),ur(t,i.cloneNode(!1))):(console.warn(`An element named "${e}" wasn't found in the source.`),mn(t))}function vc(o){const t=o.ownerDocument.createElement(o.localName);return ur(o,t)}function mn(o){return o.ownerDocument.createTextNode(o.textContent)}function Ac(o){const t=fc[o.namespaceURI];return t&&t.includes(o.localName)}function dr(o,t,e=null){if(e&&e.includes(o))return!0;const i=pc[t.namespaceURI];if(!i)return!1;const n=o.toLowerCase(),s=t.localName;if(i.global.includes(n))return!0;if(!i[s])return!1;if(i[s].includes(n))return!0;if("http://www.w3.org/1999/xhtml"===t.namespaceURI&&"input"===s&&"value"===n){const r=t.type.toLowerCase();if("submit"===r||"button"===r||"reset"===r)return!0}return!1}function ur(o,t){return t.textContent=o.textContent,cr(o,t),t}class fr extends Array{static from(t){return t instanceof this?t:new this(t)}}Symbol;class yc extends fr{constructor(t){if(super(),Symbol.asyncIterator in Object(t))this.iterator=t[Symbol.asyncIterator]();else{if(!(Symbol.iterator in Object(t)))throw new TypeError("Argument must implement the iteration protocol.");this.iterator=t[Symbol.iterator]()}}[Symbol.asyncIterator](){const t=this;let e=0;return{next:()=>(0,x.A)(function*(){return t.length<=e&&t.push(t.iterator.next()),t[e++]})()}}touchNext(){var t=this;return(0,x.A)(function*(e=1){let i=0;for(;i++<e;){const n=t[t.length-1];if(n&&(yield n).done)break;t.push(t.iterator.next())}return t[t.length-1]}).apply(this,arguments)}}class wc{constructor(t=[],e){this.resourceIds=t,this.generateBundles=e,this.onChange(!0)}addResourceIds(t,e=!1){return this.resourceIds.push(...t),this.onChange(e),this.resourceIds.length}removeResourceIds(t){return this.resourceIds=this.resourceIds.filter(e=>!t.includes(e)),this.onChange(),this.resourceIds.length}formatWithFallback(t,e){var i=this;return(0,x.A)(function*(){const n=[];let s=!1;var l,r=!1,a=!1;try{for(var c,h=function Vl(o){var t,e,i,n=2;for(typeof Symbol<"u"&&(e=Symbol.asyncIterator,i=Symbol.iterator);n--;){if(e&&null!=(t=o[e]))return t.call(o);if(i&&null!=(t=o[i]))return new li(t.call(o));e="@@asyncIterator",i="@@iterator"}throw new TypeError("Object is not async iterable")}(i.bundles);r=!(c=yield h.next()).done;r=!1){const d=c.value;{s=!0;const u=Cc(e,d,t,n);if(0===u.size)break;if(typeof console<"u"){const f=d.locales[0],p=Array.from(u).join(", ");console.warn(`[fluent] Missing translations in ${f}: ${p}`)}}}}catch(d){a=!0,l=d}finally{try{r&&null!=h.return&&(yield h.return())}finally{if(a)throw l}}return!s&&typeof console<"u"&&console.warn(`[fluent] Request for keys failed because no resource bundles got generated.\n keys: ${JSON.stringify(t)}.\n resourceIds: ${JSON.stringify(i.resourceIds)}.`),n})()}formatMessages(t){return this.formatWithFallback(t,xc)}formatValues(t){return this.formatWithFallback(t,Ec)}formatValue(t,e){var i=this;return(0,x.A)(function*(){const[n]=yield i.formatValues([{id:t,args:e}]);return n})()}handleEvent(){this.onChange()}onChange(t=!1){this.bundles=yc.from(this.generateBundles(this.resourceIds)),t&&this.bundles.touchNext(2)}}function Ec(o,t,e,i){return e.value?o.formatPattern(e.value,i,t):null}function xc(o,t,e,i){const n={value:null,attributes:null};e.value&&(n.value=o.formatPattern(e.value,i,t));let s=Object.keys(e.attributes);if(s.length>0){n.attributes=new Array(s.length);for(let[r,a]of s.entries()){let l=o.formatPattern(e.attributes[a],i,t);n.attributes[r]={name:a,value:l}}}return n}function Cc(o,t,e,i){const n=[],s=new Set;return e.forEach(({id:r,args:a},l)=>{if(void 0!==i[l])return;let h=t.getMessage(r);if(h){if(n.length=0,i[l]=o(t,n,h,a),n.length>0&&typeof console<"u"){const c=t.locales[0],d=n.join(", ");console.warn(`[fluent][resolver] errors in ${c}/${r}: ${d}.`)}}else s.add(r)}),s}const he="data-l10n-id",je="data-l10n-args",Sc=`[${he}]`;class Pc extends wc{constructor(t,e){super(t,e),this.roots=new Set,this.pendingrAF=null,this.pendingElements=new Set,this.windowElement=null,this.mutationObserver=null,this.observerConfig={attributes:!0,characterData:!1,childList:!0,subtree:!0,attributeFilter:[he,je]}}onChange(t=!1){super.onChange(t),this.roots&&this.translateRoots()}setAttributes(t,e,i){return t.setAttribute(he,e),i?t.setAttribute(je,JSON.stringify(i)):t.removeAttribute(je),t}getAttributes(t){return{id:t.getAttribute(he),args:JSON.parse(t.getAttribute(je)||null)}}connectRoot(t){for(const e of this.roots)if(e===t||e.contains(t)||t.contains(e))throw new Error("Cannot add a root that overlaps with existing root.");if(this.windowElement){if(this.windowElement!==t.ownerDocument.defaultView)throw new Error("Cannot connect a root:\n DOMLocalization already has a root from a different window.")}else this.windowElement=t.ownerDocument.defaultView,this.mutationObserver=new this.windowElement.MutationObserver(e=>this.translateMutations(e));this.roots.add(t),this.mutationObserver.observe(t,this.observerConfig)}disconnectRoot(t){return this.roots.delete(t),this.pauseObserving(),0===this.roots.size?(this.mutationObserver=null,this.windowElement&&this.pendingrAF&&this.windowElement.cancelAnimationFrame(this.pendingrAF),this.windowElement=null,this.pendingrAF=null,this.pendingElements.clear(),!0):(this.resumeObserving(),!1)}translateRoots(){const t=Array.from(this.roots);return Promise.all(t.map(e=>this.translateFragment(e)))}pauseObserving(){this.mutationObserver&&(this.translateMutations(this.mutationObserver.takeRecords()),this.mutationObserver.disconnect())}resumeObserving(){if(this.mutationObserver)for(const t of this.roots)this.mutationObserver.observe(t,this.observerConfig)}translateMutations(t){for(const e of t)switch(e.type){case"attributes":e.target.hasAttribute("data-l10n-id")&&this.pendingElements.add(e.target);break;case"childList":for(const i of e.addedNodes)if(i.nodeType===i.ELEMENT_NODE)if(i.childElementCount)for(const n of this.getTranslatables(i))this.pendingElements.add(n);else i.hasAttribute(he)&&this.pendingElements.add(i)}this.pendingElements.size>0&&null===this.pendingrAF&&(this.pendingrAF=this.windowElement.requestAnimationFrame(()=>{this.translateElements(Array.from(this.pendingElements)),this.pendingElements.clear(),this.pendingrAF=null}))}translateFragment(t){return this.translateElements(this.getTranslatables(t))}translateElements(t){var e=this;return(0,x.A)(function*(){if(!t.length)return;const i=t.map(e.getKeysForElement),n=yield e.formatMessages(i);return e.applyTranslations(t,n)})()}applyTranslations(t,e){this.pauseObserving();for(let i=0;i<t.length;i++)void 0!==e[i]&&gc(t[i],e[i]);this.resumeObserving()}getTranslatables(t){const e=Array.from(t.querySelectorAll(Sc));return"function"==typeof t.hasAttribute&&t.hasAttribute(he)&&e.push(t),e}getKeysForElement(t){return{id:t.getAttribute(he),args:JSON.parse(t.getAttribute(je)||null)}}}class vi{#t;#e;#i;#n;constructor({lang:t,isRTL:e},i=null){this.#i=vi.#s(t),this.#n=i,this.#t=e??vi.#r(this.#i)?"rtl":"ltr"}_setL10n(t){this.#n=t}getLanguage(){return this.#i}getDirection(){return this.#t}get(t){var e=this;return(0,x.A)(function*(i,n=null,s){return Array.isArray(i)?(i=i.map(l=>({id:l})),(yield e.#n.formatMessages(i)).map(l=>l.value)):(yield e.#n.formatMessages([{id:i,args:n}]))[0]?.value||s}).apply(this,arguments)}translate(t){var e=this;return(0,x.A)(function*(){(e.#e||=new Set).add(t);try{e.#n.connectRoot(t),yield e.#n.translateRoots()}catch{}})()}translateOnce(t){var e=this;return(0,x.A)(function*(){try{yield e.#n.translateElements([t])}catch(i){console.error(`translateOnce: "${i}".`)}})()}destroy(){var t=this;return(0,x.A)(function*(){if(t.#e){for(const e of t.#e)t.#n.disconnectRoot(e);t.#e.clear(),t.#e=null}t.#n.pauseObserving()})()}pause(){this.#n.pauseObserving()}resume(){this.#n.resumeObserving()}static#s(t){return{en:"en-us",es:"es-es",fy:"fy-nl",ga:"ga-ie",gu:"gu-in",hi:"hi-in",hy:"hy-am",nb:"nb-no",ne:"ne-np",nn:"nn-no",pa:"pa-in",pt:"pt-pt",sv:"sv-se",zh:"zh-cn"}[t=t?.toLowerCase()||"en-us"]||t}static#r(t){const e=t.split("-",1)[0];return["ar","he","fa","ps","ur"].includes(e)}}function pr(o,t){const e=new dc(t),i=new Kh(o),n=i.addResource(e);return n.length&&console.error("L10n errors",n),i}class Yt extends vi{constructor(t){super({lang:t});const e=t?Yt.#t.bind(Yt,"en-us",this.getLanguage()):Yt.#n.bind(Yt,this.getLanguage());this._setL10n(new Pc([],e))}static#t(t,e){var i=this;return(0,Ls.A)(function*(){const{baseURL:n,paths:s}=yield Ms(i.#i()),r=[e];if(t!==e){const a=e.split("-",1)[0];a!==e&&r.push(a),r.push(t)}for(const a of r){const l=yield Ms(i.#e(a,n,s));l?yield l:"en-us"===a&&(yield i.#s(a))}})()}static#e(t,e,i){return(0,x.A)(function*(){const n=i[t];if(!n)return null;const s=new URL(n,e),r=yield $s(s,"text");return pr(t,r)})()}static#i(){return(0,x.A)(function*(){try{const{href:t}=document.querySelector('link[type="application/l10n"]'),e=yield $s(t,"json");return{baseURL:t.replace(/[^/]*$/,"")||"./",paths:e}}catch{}return{baseURL:"./",paths:Object.create(null)}})()}static#n(t){var e=this;return(0,Ls.A)(function*(){yield e.#s(t)})()}static#s(t){return(0,x.A)(function*(){return pr(t,'pdfjs-previous-button =\n .title = Previous Page\npdfjs-previous-button-label = Previous\npdfjs-next-button =\n .title = Next Page\npdfjs-next-button-label = Next\npdfjs-page-input =\n .title = Page\npdfjs-of-pages = of { $pagesCount }\npdfjs-page-of-pages = ({ $pageNumber } of { $pagesCount })\npdfjs-zoom-out-button =\n .title = Zoom Out\npdfjs-zoom-out-button-label = Zoom Out\npdfjs-zoom-in-button =\n .title = Zoom In\npdfjs-zoom-in-button-label = Zoom In\npdfjs-zoom-select =\n .title = Zoom\npdfjs-presentation-mode-button =\n .title = Switch to Presentation Mode\npdfjs-presentation-mode-button-label = Presentation Mode\npdfjs-open-file-button =\n .title = Open File\npdfjs-open-file-button-label = Open\npdfjs-print-button =\n .title = Print\npdfjs-print-button-label = Print\npdfjs-save-button =\n .title = Save\npdfjs-save-button-label = Save\npdfjs-download-button =\n .title = Download\npdfjs-download-button-label = Download\npdfjs-bookmark-button =\n .title = Current Page (View URL from Current Page)\npdfjs-bookmark-button-label = Current Page\npdfjs-tools-button =\n .title = Tools\npdfjs-tools-button-label = Tools\npdfjs-first-page-button =\n .title = Go to First Page\npdfjs-first-page-button-label = Go to First Page\npdfjs-last-page-button =\n .title = Go to Last Page\npdfjs-last-page-button-label = Go to Last Page\npdfjs-page-rotate-cw-button =\n .title = Rotate Clockwise\npdfjs-page-rotate-cw-button-label = Rotate Clockwise\npdfjs-page-rotate-ccw-button =\n .title = Rotate Counterclockwise\npdfjs-page-rotate-ccw-button-label = Rotate Counterclockwise\npdfjs-cursor-text-select-tool-button =\n .title = Enable Text Selection Tool\npdfjs-cursor-text-select-tool-button-label = Text Selection Tool\npdfjs-cursor-hand-tool-button =\n .title = Enable Hand Tool\npdfjs-cursor-hand-tool-button-label = Hand Tool\npdfjs-scroll-page-button =\n .title = Use Page Scrolling\npdfjs-scroll-page-button-label = Page Scrolling\npdfjs-scroll-vertical-button =\n .title = Use Vertical Scrolling\npdfjs-scroll-vertical-button-label = Vertical Scrolling\npdfjs-scroll-horizontal-button =\n .title = Use Horizontal Scrolling\npdfjs-scroll-horizontal-button-label = Horizontal Scrolling\npdfjs-scroll-wrapped-button =\n .title = Use Wrapped Scrolling\npdfjs-scroll-wrapped-button-label = Wrapped Scrolling\npdfjs-spread-none-button =\n .title = Do not join page spreads\npdfjs-spread-none-button-label = No Spreads\npdfjs-spread-odd-button =\n .title = Join page spreads starting with odd-numbered pages\npdfjs-spread-odd-button-label = Odd Spreads\npdfjs-spread-even-button =\n .title = Join page spreads starting with even-numbered pages\npdfjs-spread-even-button-label = Even Spreads\npdfjs-document-properties-button =\n .title = Document Properties\u2026\npdfjs-document-properties-button-label = Document Properties\u2026\npdfjs-document-properties-file-name = File name:\npdfjs-document-properties-file-size = File size:\npdfjs-document-properties-size-kb = { NUMBER($kb, maximumSignificantDigits: 3) } KB ({ $b } bytes)\npdfjs-document-properties-size-mb = { NUMBER($mb, maximumSignificantDigits: 3) } MB ({ $b } bytes)\npdfjs-document-properties-title = Title:\npdfjs-document-properties-author = Author:\npdfjs-document-properties-subject = Subject:\npdfjs-document-properties-keywords = Keywords:\npdfjs-document-properties-creation-date = Creation Date:\npdfjs-document-properties-modification-date = Modification Date:\npdfjs-document-properties-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }\npdfjs-document-properties-creator = Creator:\npdfjs-document-properties-producer = PDF Producer:\npdfjs-document-properties-version = PDF Version:\npdfjs-document-properties-page-count = Page Count:\npdfjs-document-properties-page-size = Page Size:\npdfjs-document-properties-page-size-unit-inches = in\npdfjs-document-properties-page-size-unit-millimeters = mm\npdfjs-document-properties-page-size-orientation-portrait = portrait\npdfjs-document-properties-page-size-orientation-landscape = landscape\npdfjs-document-properties-page-size-name-a-three = A3\npdfjs-document-properties-page-size-name-a-four = A4\npdfjs-document-properties-page-size-name-letter = Letter\npdfjs-document-properties-page-size-name-legal = Legal\npdfjs-document-properties-page-size-dimension-string = { $width } \xd7 { $height } { $unit } ({ $orientation })\npdfjs-document-properties-page-size-dimension-name-string = { $width } \xd7 { $height } { $unit } ({ $name }, { $orientation })\npdfjs-document-properties-linearized = Fast Web View:\npdfjs-document-properties-linearized-yes = Yes\npdfjs-document-properties-linearized-no = No\npdfjs-document-properties-close-button = Close\npdfjs-print-progress-message = Preparing document for printing\u2026\npdfjs-print-progress-percent = { $progress }%\npdfjs-print-progress-close-button = Cancel\npdfjs-printing-not-supported = Warning: Printing is not fully supported by this browser.\npdfjs-printing-not-ready = Warning: The PDF is not fully loaded for printing.\npdfjs-toggle-sidebar-button =\n .title = Toggle Sidebar\npdfjs-toggle-sidebar-notification-button =\n .title = Toggle Sidebar (document contains outline/attachments/layers)\npdfjs-toggle-sidebar-button-label = Toggle Sidebar\npdfjs-document-outline-button =\n .title = Show Document Outline (double-click to expand/collapse all items)\npdfjs-document-outline-button-label = Document Outline\npdfjs-attachments-button =\n .title = Show Attachments\npdfjs-attachments-button-label = Attachments\npdfjs-layers-button =\n .title = Show Layers (double-click to reset all layers to the default state)\npdfjs-layers-button-label = Layers\npdfjs-thumbs-button =\n .title = Show Thumbnails\npdfjs-thumbs-button-label = Thumbnails\npdfjs-current-outline-item-button =\n .title = Find Current Outline Item\npdfjs-current-outline-item-button-label = Current Outline Item\npdfjs-findbar-button =\n .title = Find in Document\npdfjs-findbar-button-label = Find\npdfjs-additional-layers = Additional Layers\npdfjs-thumb-page-title =\n .title = Page { $page }\npdfjs-thumb-page-canvas =\n .aria-label = Thumbnail of Page { $page }\npdfjs-find-input =\n .title = Find\n .placeholder = Find in document\u2026\npdfjs-find-previous-button =\n .title = Find the previous occurrence of the phrase\npdfjs-find-previous-button-label = Previous\npdfjs-find-next-button =\n .title = Find the next occurrence of the phrase\npdfjs-find-next-button-label = Next\npdfjs-find-highlight-checkbox = Highlight All\npdfjs-find-match-case-checkbox-label = Match Case\npdfjs-find-match-diacritics-checkbox-label = Match Diacritics\npdfjs-find-entire-word-checkbox-label = Whole Words\npdfjs-find-reached-top = Reached top of document, continued from bottom\npdfjs-find-reached-bottom = Reached end of document, continued from top\npdfjs-find-match-count =\n { $total ->\n [one] { $current } of { $total } match\n *[other] { $current } of { $total } matches\n }\npdfjs-find-match-count-limit =\n { $limit ->\n [one] More than { $limit } match\n *[other] More than { $limit } matches\n }\npdfjs-find-not-found = Phrase not found\npdfjs-page-scale-width = Page Width\npdfjs-page-scale-fit = Page Fit\npdfjs-page-scale-auto = Automatic Zoom\npdfjs-page-scale-actual = Actual Size\npdfjs-page-scale-percent = { $scale }%\npdfjs-page-landmark =\n .aria-label = Page { $page }\npdfjs-loading-error = An error occurred while loading the PDF.\npdfjs-invalid-file-error = Invalid or corrupted PDF file.\npdfjs-missing-file-error = Missing PDF file.\npdfjs-unexpected-response-error = Unexpected server response.\npdfjs-rendering-error = An error occurred while rendering the page.\npdfjs-annotation-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }\npdfjs-text-annotation-type =\n .alt = [{ $type } Annotation]\npdfjs-password-label = Enter the password to open this PDF file.\npdfjs-password-invalid = Invalid password. Please try again.\npdfjs-password-ok-button = OK\npdfjs-password-cancel-button = Cancel\npdfjs-web-fonts-disabled = Web fonts are disabled: unable to use embedded PDF fonts.\npdfjs-editor-free-text-button =\n .title = Text\npdfjs-editor-free-text-button-label = Text\npdfjs-editor-ink-button =\n .title = Draw\npdfjs-editor-ink-button-label = Draw\npdfjs-editor-stamp-button =\n .title = Add or edit images\npdfjs-editor-stamp-button-label = Add or edit images\npdfjs-editor-highlight-button =\n .title = Highlight\npdfjs-editor-highlight-button-label = Highlight\npdfjs-highlight-floating-button1 =\n .title = Highlight\n .aria-label = Highlight\npdfjs-highlight-floating-button-label = Highlight\npdfjs-editor-remove-ink-button =\n .title = Remove drawing\npdfjs-editor-remove-freetext-button =\n .title = Remove text\npdfjs-editor-remove-stamp-button =\n .title = Remove image\npdfjs-editor-remove-highlight-button =\n .title = Remove highlight\npdfjs-editor-free-text-color-input = Color\npdfjs-editor-free-text-size-input = Size\npdfjs-editor-ink-color-input = Color\npdfjs-editor-ink-thickness-input = Thickness\npdfjs-editor-ink-opacity-input = Opacity\npdfjs-editor-stamp-add-image-button =\n .title = Add image\npdfjs-editor-stamp-add-image-button-label = Add image\npdfjs-editor-free-highlight-thickness-input = Thickness\npdfjs-editor-free-highlight-thickness-title =\n .title = Change thickness when highlighting items other than text\npdfjs-free-text2 =\n .aria-label = Text Editor\n .default-content = Start typing\u2026\npdfjs-ink =\n .aria-label = Draw Editor\npdfjs-ink-canvas =\n .aria-label = User-created image\npdfjs-editor-alt-text-button =\n .aria-label = Alt text\npdfjs-editor-alt-text-button-label = Alt text\npdfjs-editor-alt-text-edit-button =\n .aria-label = Edit alt text\npdfjs-editor-alt-text-dialog-label = Choose an option\npdfjs-editor-alt-text-dialog-description = Alt text (alternative text) helps when people can\u2019t see the image or when it doesn\u2019t load.\npdfjs-editor-alt-text-add-description-label = Add a description\npdfjs-editor-alt-text-add-description-description = Aim for 1-2 sentences that describe the subject, setting, or actions.\npdfjs-editor-alt-text-mark-decorative-label = Mark as decorative\npdfjs-editor-alt-text-mark-decorative-description = This is used for ornamental images, like borders or watermarks.\npdfjs-editor-alt-text-cancel-button = Cancel\npdfjs-editor-alt-text-save-button = Save\npdfjs-editor-alt-text-decorative-tooltip = Marked as decorative\npdfjs-editor-alt-text-textarea =\n .placeholder = For example, \u201cA young man sits down at a table to eat a meal\u201d\npdfjs-editor-resizer-top-left =\n .aria-label = Top left corner \u2014 resize\npdfjs-editor-resizer-top-middle =\n .aria-label = Top middle \u2014 resize\npdfjs-editor-resizer-top-right =\n .aria-label = Top right corner \u2014 resize\npdfjs-editor-resizer-middle-right =\n .aria-label = Middle right \u2014 resize\npdfjs-editor-resizer-bottom-right =\n .aria-label = Bottom right corner \u2014 resize\npdfjs-editor-resizer-bottom-middle =\n .aria-label = Bottom middle \u2014 resize\npdfjs-editor-resizer-bottom-left =\n .aria-label = Bottom left corner \u2014 resize\npdfjs-editor-resizer-middle-left =\n .aria-label = Middle left \u2014 resize\npdfjs-editor-highlight-colorpicker-label = Highlight color\npdfjs-editor-colorpicker-button =\n .title = Change color\npdfjs-editor-colorpicker-dropdown =\n .aria-label = Color choices\npdfjs-editor-colorpicker-yellow =\n .title = Yellow\npdfjs-editor-colorpicker-green =\n .title = Green\npdfjs-editor-colorpicker-blue =\n .title = Blue\npdfjs-editor-colorpicker-pink =\n .title = Pink\npdfjs-editor-colorpicker-red =\n .title = Red\npdfjs-editor-highlight-show-all-button-label = Show all\npdfjs-editor-highlight-show-all-button =\n .title = Show all\npdfjs-editor-new-alt-text-dialog-edit-label = Edit alt text (image description)\npdfjs-editor-new-alt-text-dialog-add-label = Add alt text (image description)\npdfjs-editor-new-alt-text-textarea =\n .placeholder = Write your description here\u2026\npdfjs-editor-new-alt-text-description = Short description for people who can\u2019t see the image or when the image doesn\u2019t load.\npdfjs-editor-new-alt-text-disclaimer1 = This alt text was created automatically and may be inaccurate.\npdfjs-editor-new-alt-text-disclaimer-learn-more-url = Learn more\npdfjs-editor-new-alt-text-create-automatically-button-label = Create alt text automatically\npdfjs-editor-new-alt-text-not-now-button = Not now\npdfjs-editor-new-alt-text-error-title = Couldn\u2019t create alt text automatically\npdfjs-editor-new-alt-text-error-description = Please write your own alt text or try again later.\npdfjs-editor-new-alt-text-error-close-button = Close\npdfjs-editor-new-alt-text-ai-model-downloading-progress = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)\n .aria-valuetext = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)\npdfjs-editor-new-alt-text-added-button =\n .aria-label = Alt text added\npdfjs-editor-new-alt-text-added-button-label = Alt text added\npdfjs-editor-new-alt-text-missing-button =\n .aria-label = Missing alt text\npdfjs-editor-new-alt-text-missing-button-label = Missing alt text\npdfjs-editor-new-alt-text-to-review-button =\n .aria-label = Review alt text\npdfjs-editor-new-alt-text-to-review-button-label = Review alt text\npdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer = Created automatically: { $generatedAltText }\npdfjs-image-alt-text-settings-button =\n .title = Image alt text settings\npdfjs-image-alt-text-settings-button-label = Image alt text settings\npdfjs-editor-alt-text-settings-dialog-label = Image alt text settings\npdfjs-editor-alt-text-settings-automatic-title = Automatic alt text\npdfjs-editor-alt-text-settings-create-model-button-label = Create alt text automatically\npdfjs-editor-alt-text-settings-create-model-description = Suggests descriptions to help people who can\u2019t see the image or when the image doesn\u2019t load.\npdfjs-editor-alt-text-settings-download-model-label = Alt text AI model ({ $totalSize } MB)\npdfjs-editor-alt-text-settings-ai-model-description = Runs locally on your device so your data stays private. Required for automatic alt text.\npdfjs-editor-alt-text-settings-delete-model-button = Delete\npdfjs-editor-alt-text-settings-download-model-button = Download\npdfjs-editor-alt-text-settings-downloading-model-button = Downloading\u2026\npdfjs-editor-alt-text-settings-editor-title = Alt text editor\npdfjs-editor-alt-text-settings-show-dialog-button-label = Show alt text editor right away when adding an image\npdfjs-editor-alt-text-settings-show-dialog-description = Helps you make sure all your images have alt text.\npdfjs-editor-alt-text-settings-close-button = Close')})()}}function _n(){return document.location.hash}class Mc{#t=null;constructor({linkService:t,eventBus:e}){this.linkService=t,this.eventBus=e,this._initialized=!1,this._fingerprint="",this.reset(),this.eventBus._on("pagesinit",()=>{this._isPagesLoaded=!1,this.eventBus._on("pagesloaded",i=>{this._isPagesLoaded=!!i.pagesCount},{once:!0})})}initialize({fingerprint:t,resetHistory:e=!1,updateUrl:i=!1}){if(!t||"string"!=typeof t)return void console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');this._initialized&&this.reset();const n=""!==this._fingerprint&&this._fingerprint!==t;this._fingerprint=t,this._updateUrl=!0===i,this._initialized=!0,this.#d();const s=window.history.state;if(this._popStateInProgress=!1,this._blockHashChange=0,this._currentHash=_n(),this._numPositionUpdates=0,this._uid=this._maxUid=0,this._destination=null,this._position=null,!this.#s(s,!0)||e){const{hash:a,page:l,rotation:h}=this.#l(!0);return!a||n||e?void this.#e(null,!0):void this.#e({hash:a,page:l,rotation:h},!0)}const r=s.destination;this.#r(r,s.uid,!0),void 0!==r.rotation&&(this._initialRotation=r.rotation),r.dest?(this._initialBookmark=JSON.stringify(r.dest),this._destination.page=null):r.hash?this._initialBookmark=r.hash:r.page&&(this._initialBookmark=`page=${r.page}`)}reset(){this._initialized&&(this.#o(),this._initialized=!1,this.#a()),this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._initialBookmark=null,this._initialRotation=null}push({namedDest:t=null,explicitDest:e,pageNumber:i}){if(!this._initialized)return;if(t&&"string"!=typeof t)return void console.error(`PDFHistory.push: "${t}" is not a valid namedDest parameter.`);if(!Array.isArray(e))return void console.error(`PDFHistory.push: "${e}" is not a valid explicitDest parameter.`);if(!this.#n(i)&&(null!==i||this._destination))return void console.error(`PDFHistory.push: "${i}" is not a valid pageNumber parameter.`);const n=t||JSON.stringify(e);if(!n)return;let s=!1;if(this._destination&&(function Lc(o,t){return"string"==typeof o&&"string"==typeof t&&(o===t||hi(o).get("nameddest")===t)}(this._destination.hash,n)||function Rc(o,t){function e(i,n){if(typeof i!=typeof n||Array.isArray(i)||Array.isArray(n))return!1;if(null!==i&&"object"==typeof i&&null!==n){if(Object.keys(i).length!==Object.keys(n).length)return!1;for(const s in i)if(!e(i[s],n[s]))return!1;return!0}return i===n||Number.isNaN(i)&&Number.isNaN(n)}if(!Array.isArray(o)||!Array.isArray(t)||o.length!==t.length)return!1;for(let i=0,n=o.length;i<n;i++)if(!e(o[i],t[i]))return!1;return!0}(this._destination.dest,e))){if(this._destination.page)return;s=!0}this._popStateInProgress&&!s||(this.#e({dest:e,hash:n,page:i,rotation:this.linkService.rotation},s),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1})))}pushPage(t){if(this._initialized){if(!this.#n(t))return void console.error(`PDFHistory.pushPage: "${t}" is not a valid page number.`);this._destination?.page!==t&&(this._popStateInProgress||(this.#e({dest:null,hash:`page=${t}`,page:t,rotation:this.linkService.rotation}),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1}))))}}pushCurrentPosition(){!this._initialized||this._popStateInProgress||this.#i()}back(){if(!this._initialized||this._popStateInProgress)return;const t=window.history.state;this.#s(t)&&t.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;const t=window.history.state;this.#s(t)&&t.uid<this._maxUid&&window.history.forward()}get popStateInProgress(){return this._initialized&&(this._popStateInProgress||this._blockHashChange>0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}#e(t,e=!1){const i=e||!this._destination,n={fingerprint:this._fingerprint,uid:i?this._uid:this._uid+1,destination:t};let s;if(this.#r(t,n.uid),this._updateUrl&&t?.hash){const r=document.location.href.split("#",1)[0];r.startsWith("file://")||(s=`${r}#${t.hash}`)}i?window.history.replaceState(n,"",s):window.history.pushState(n,"",s)}#i(t=!1){if(!this._position)return;let e=this._position;if(t&&(e=Object.assign(Object.create(null),this._position),e.temporary=!0),!this._destination)return void this.#e(e);if(this._destination.temporary)return void this.#e(e,!0);if(this._destination.hash===e.hash||!this._destination.page&&this._numPositionUpdates<=50)return;let i=!1;if(this._destination.page>=e.first&&this._destination.page<=e.page){if(void 0!==this._destination.dest||!this._destination.first)return;i=!0}this.#e(e,i)}#n(t){return Number.isInteger(t)&&t>0&&t<=this.linkService.pagesCount}#s(t,e=!1){if(!t)return!1;if(t.fingerprint!==this._fingerprint){if(!e)return!1;{if("string"!=typeof t.fingerprint||t.fingerprint.length!==this._fingerprint.length)return!1;const[i]=performance.getEntriesByType("navigation");if("reload"!==i?.type)return!1}}return!(!Number.isInteger(t.uid)||t.uid<0||null===t.destination||"object"!=typeof t.destination)}#r(t,e,i=!1){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),i&&t?.temporary&&delete t.temporary,this._destination=t,this._uid=e,this._maxUid=Math.max(this._maxUid,e),this._numPositionUpdates=0}#l(t=!1){const e=unescape(_n()).substring(1),i=hi(e),n=i.get("nameddest")||"";let s=0|i.get("page");return(!this.#n(s)||t&&n.length>0)&&(s=null),{hash:e,page:s,rotation:this.linkService.rotation}}#h({location:t}){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._position={hash:t.pdfOpenParams.substring(1),page:this.linkService.page,first:t.pageNumber,rotation:t.rotation},!this._popStateInProgress&&(this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++,this._updateViewareaTimeout=setTimeout(()=>{this._popStateInProgress||this.#i(!0),this._updateViewareaTimeout=null},1e3))}#c({state:t}){const e=_n(),i=this._currentHash!==e;if(this._currentHash=e,!t){this._uid++;const{hash:s,page:r,rotation:a}=this.#l();return void this.#e({hash:s,page:r,rotation:a},!0)}if(!this.#s(t))return;this._popStateInProgress=!0,i&&(this._blockHashChange++,function Fh(o){return dn.apply(this,arguments)}({target:window,name:"hashchange",delay:1e3}).then(()=>{this._blockHashChange--}));const n=t.destination;this.#r(n,t.uid,!0),Bs(n.rotation)&&(this.linkService.rotation=n.rotation),n.dest?this.linkService.goToDestination(n.dest):n.hash?this.linkService.setHash(n.hash):n.page&&(this.linkService.page=n.page),Promise.resolve().then(()=>{this._popStateInProgress=!1})}#o(){(!this._destination||this._destination.temporary)&&this.#i()}#d(){if(this.#t)return;this.#t=new AbortController;const{signal:t}=this.#t;this.eventBus._on("updateviewarea",this.#h.bind(this),{signal:t}),window.addEventListener("popstate",this.#c.bind(this),{signal:t}),window.addEventListener("pagehide",this.#o.bind(this),{signal:t})}#a(){this.#t?.abort(),this.#t=null}}class Ic{#t=null;#e=null;#i=null;#n=null;#s=null;#r;constructor(t){this.pdfPage=t.pdfPage,this.accessibilityManager=t.accessibilityManager,this.l10n=t.l10n,this.l10n||=new Yt,this.annotationEditorLayer=null,this.div=null,this._cancelled=!1,this.#r=t.uiManager,this.#t=t.annotationLayer||null,this.#s=t.textLayer||null,this.#e=t.drawLayer||null,this.#i=t.onAppend||null,this.#n=t.structTreeLayer||null}render(t){var e=this;return(0,x.A)(function*(i,n="display"){if("display"!==n||e._cancelled)return;const s=i.clone({dontFlip:!0});if(e.div)return e.annotationEditorLayer.update({viewport:s}),void e.show();const r=e.div=document.createElement("div");r.className="annotationEditorLayer",r.hidden=!0,r.dir=e.#r.direction,e.#i?.(r),e.annotationEditorLayer=new xh({uiManager:e.#r,div:r,structTreeLayer:e.#n,accessibilityManager:e.accessibilityManager,pageIndex:e.pdfPage.pageNumber-1,l10n:e.l10n,viewport:s,annotationLayer:e.#t,textLayer:e.#s,drawLayer:e.#e}),e.annotationEditorLayer.render({viewport:s,div:r,annotations:null,intent:n}),e.show()}).apply(this,arguments)}cancel(){this._cancelled=!0,this.div&&this.annotationEditorLayer.destroy()}hide(){this.div&&(this.div.hidden=!0)}show(){!this.div||this.annotationEditorLayer.isInvisible||(this.div.hidden=!1)}}{var vn=new Map;const o=navigator.userAgent||"",t=navigator.platform||"",e=navigator.maxTouchPoints||1,i=/Android/.test(o);(/\b(iPad|iPhone|iPod)(?=;)/.test(o)||"MacIntel"===t&&e>1||i)&&vn.set("maxCanvasPixels",5242880),i&&vn.set("useSystemFonts",!1)}const An={BOOLEAN:1,NUMBER:2,OBJECT:4,STRING:8,UNDEFINED:16},Bt={allowedGlobalEvents:{value:null,kind:1},canvasMaxAreaInBytes:{value:-1,kind:5},isInAutomation:{value:!1,kind:1},localeProperties:{value:{lang:navigator.language||"en-US"},kind:1},nimbusDataStr:{value:"",kind:1},supportsCaretBrowsingMode:{value:!1,kind:1},supportsDocumentFonts:{value:!0,kind:1},supportsIntegratedFind:{value:!1,kind:1},supportsMouseWheelZoomCtrlKey:{value:!0,kind:1},supportsMouseWheelZoomMetaKey:{value:!0,kind:1},supportsPinchToZoom:{value:!0,kind:1},toolbarDensity:{value:0,kind:17},altTextLearnMoreUrl:{value:"",kind:130},annotationEditorMode:{value:0,kind:130},annotationMode:{value:2,kind:130},cursorToolOnLoad:{value:0,kind:130},debuggerSrc:{value:"./debugger.mjs",kind:2},defaultZoomDelay:{value:400,kind:130},defaultZoomValue:{value:"",kind:130},disableHistory:{value:!1,kind:2},disablePageLabels:{value:!1,kind:130},enableAltText:{value:!1,kind:130},enableAltTextModelDownload:{value:!0,kind:146},enableGuessAltText:{value:!0,kind:146},enableHighlightFloatingButton:{value:!1,kind:130},enableNewAltTextWhenAddingImage:{value:!0,kind:130},enablePermissions:{value:!1,kind:130},enablePrintAutoRotate:{value:!0,kind:130},enableScripting:{value:!0,kind:130},enableUpdatedAddImage:{value:!1,kind:130},externalLinkRel:{value:"noopener noreferrer nofollow",kind:2},externalLinkTarget:{value:0,kind:130},highlightEditorColors:{value:"yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F",kind:130},historyUpdateUrl:{value:!1,kind:130},ignoreDestinationZoom:{value:!1,kind:130},imageResourcesPath:{value:"./images/",kind:2},maxCanvasPixels:{value:2**25,kind:2},forcePageColors:{value:!1,kind:130},pageColorsBackground:{value:"Canvas",kind:130},pageColorsForeground:{value:"CanvasText",kind:130},pdfBugEnabled:{value:!1,kind:130},printResolution:{value:150,kind:2},sidebarViewOnLoad:{value:-1,kind:130},scrollModeOnLoad:{value:-1,kind:130},spreadModeOnLoad:{value:-1,kind:130},textLayerMode:{value:1,kind:130},viewOnLoad:{value:0,kind:130},cMapPacked:{value:!0,kind:4},cMapUrl:{value:"../web/cmaps/",kind:4},disableAutoFetch:{value:!1,kind:132},disableFontFace:{value:!1,kind:132},disableRange:{value:!1,kind:132},disableStream:{value:!1,kind:132},docBaseUrl:{value:"",kind:4},enableHWA:{value:!0,kind:134},enableXfa:{value:!0,kind:132},fontExtraProperties:{value:!1,kind:4},isEvalSupported:{value:!0,kind:4},isOffscreenCanvasSupported:{value:!0,kind:4},maxImageSize:{value:-1,kind:4},pdfBug:{value:!1,kind:4},standardFontDataUrl:{value:"../web/standard_fonts/",kind:4},useSystemFonts:{value:void 0,kind:4,type:An.BOOLEAN+An.UNDEFINED},verbosity:{value:1,kind:4},workerPort:{value:null,kind:8},workerSrc:{value:"../build/pdf.worker.mjs",kind:8},defaultUrl:{value:"compressed.tracemonkey-pldi-09.pdf",kind:2},sandboxBundleSrc:{value:"../build/pdf.sandbox.mjs",kind:2},viewerCssTheme:{value:0,kind:130},enableFakeMLManager:{value:!0,kind:2},disablePreferences:{value:!1,kind:2}};class kc{static eventBus;static#t=new Map;static{for(const t in Bt)this.#t.set(t,Bt[t].value);for(const[t,e]of vn)this.#t.set(t,e);this._hasInvokedSet=!1,this._checkDisablePreferences=()=>!!this.get("disablePreferences")||(this._hasInvokedSet&&console.warn('The Preferences may override manually set AppOptions; please use the "disablePreferences"-option to prevent that.'),!1)}static get(t){return this.#t.get(t)}static getAll(t=null,e=!1){const i=Object.create(null);for(const n in Bt){const s=Bt[n];t&&!(t&s.kind)||(i[n]=e?s.value:this.#t.get(n))}return i}static set(t,e){this.setAll({[t]:e})}static setAll(t,e=!1){let i;this._hasInvokedSet||=!0;for(const n in t){const s=Bt[n],r=t[n];if(!s||!(typeof r==typeof s.value||An[(typeof r).toUpperCase()]&s.type))continue;const{kind:a}=s;e&&!(1&a||128&a)||(this.eventBus&&16&a&&(i||=new Map).set(n,r),this.#t.set(n,r))}if(i)for(const[n,s]of i)this.eventBus.dispatch(n.toLowerCase(),{source:this,value:s})}}class Dc{#t=null;constructor(t){this.pageIndex=t.pageIndex}render(){var t=this;return(0,x.A)(function*(e="display"){"display"!==e||t.#t||t._cancelled||(t.#t=new Th({pageIndex:t.pageIndex}))}).apply(this,arguments)}cancel(){this._cancelled=!0,this.#t&&(this.#t.destroy(),this.#t=null)}setParent(t){this.#t?.setParent(t)}getDrawLayer(){return this.#t}}const mr={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},Oc=/^H(\d+)$/;class br{#t;#e=null;#i;#n=new Map;#s;#r=null;constructor(t,e){this.#t=t.getStructTree(),this.#s=e}render(){var t=this;return(0,x.A)(function*(){if(t.#i)return t.#i;const{promise:e,resolve:i,reject:n}=Promise.withResolvers();t.#i=e;try{t.#e=t.#c(yield t.#t)}catch(s){n(s)}return t.#t=null,t.#e?.classList.add("structTree"),i(t.#e),e})()}getAriaAttributes(t){var e=this;return(0,x.A)(function*(){try{return yield e.render(),e.#n.get(t)}catch{}return null})()}hide(){this.#e&&!this.#e.hidden&&(this.#e.hidden=!0)}show(){this.#e?.hidden&&(this.#e.hidden=!1)}#l(t,e){const{alt:i,id:n,lang:s}=t;if(void 0!==i){let r=!1;const a=Fe(i);for(const l of t.children)if("annotation"===l.type){let h=this.#n.get(l.id);h||(h=new Map,this.#n.set(l.id,h)),h.set("aria-label",a),r=!0}r||e.setAttribute("aria-label",a)}void 0!==n&&e.setAttribute("aria-owns",n),void 0!==s&&e.setAttribute("lang",Fe(s,!0))}#h(t,e){const{alt:i,bbox:n,children:s}=t,r=s?.[0];if(!this.#s||!i||!n||"content"!==r?.type)return!1;const{id:a}=r;if(!a)return!1;e.setAttribute("aria-owns",a);const l=document.createElement("span");(this.#r||=new Map).set(a,l),l.setAttribute("role","img"),l.setAttribute("aria-label",Fe(i));const{pageHeight:h,pageX:c,pageY:d}=this.#s,u="calc(var(--scale-factor)*",{style:f}=l;return f.width=`${u}${n[2]-n[0]}px)`,f.height=`${u}${n[3]-n[1]}px)`,f.left=`${u}${n[0]-c}px)`,f.top=`${u}${h-n[3]+d}px)`,!0}addElementsToTextLayer(){if(this.#r){for(const[t,e]of this.#r)document.getElementById(t)?.append(e);this.#r.clear(),this.#r=null}}#c(t){if(!t)return null;const e=document.createElement("span");if("role"in t){const{role:i}=t,n=i.match(Oc);if(n?(e.setAttribute("role","heading"),e.setAttribute("aria-level",n[1])):mr[i]&&e.setAttribute("role",mr[i]),"Figure"===i&&this.#h(t,e))return e}if(this.#l(t,e),t.children)if(1===t.children.length&&"id"in t.children[0])this.#l(t.children[0],e);else for(const i of t.children)e.append(this.#c(i));return e}}class He{#t=!1;#e=null;#i=new Map;#n=new Map;setTextMapping(t){this.#e=t}static#s(t,e){const i=t.getBoundingClientRect(),n=e.getBoundingClientRect();if(0===i.width&&0===i.height)return 1;if(0===n.width&&0===n.height)return-1;const a=i.y+i.height/2,c=n.y+n.height/2;return a<=n.y&&c>=i.y+i.height?-1:c<=i.y&&a>=n.y+n.height?1:i.x+i.width/2-(n.x+n.width/2)}enable(){if(this.#t)throw new Error("TextAccessibilityManager is already enabled.");if(!this.#e)throw new Error("Text divs and strings have not been set.");if(this.#t=!0,this.#e=this.#e.slice(),this.#e.sort(He.#s),this.#i.size>0){const t=this.#e;for(const[e,i]of this.#i)document.getElementById(e)?this.#r(e,t[i]):this.#i.delete(e)}for(const[t,e]of this.#n)this.addPointerInTextLayer(t,e);this.#n.clear()}disable(){this.#t&&(this.#n.clear(),this.#e=null,this.#t=!1)}removePointerInTextLayer(t){if(!this.#t)return void this.#n.delete(t);const e=this.#e;if(!e||0===e.length)return;const{id:i}=t,n=this.#i.get(i);if(void 0===n)return;const s=e[n];this.#i.delete(i);let r=s.getAttribute("aria-owns");r?.includes(i)&&(r=r.split(" ").filter(a=>a!==i).join(" "),r?s.setAttribute("aria-owns",r):(s.removeAttribute("aria-owns"),s.setAttribute("role","presentation")))}#r(t,e){const i=e.getAttribute("aria-owns");i?.includes(t)||e.setAttribute("aria-owns",i?`${i} ${t}`:t),e.removeAttribute("role")}addPointerInTextLayer(t,e){const{id:i}=t;if(!i)return null;if(!this.#t)return this.#n.set(t,e),null;e&&this.removePointerInTextLayer(t);const n=this.#e;if(!n||0===n.length)return null;const s=Ne(n,h=>He.#s(t,h)<0),r=Math.max(0,s-1),a=n[r];this.#r(i,a),this.#i.set(i,r);const l=a.parentNode;return l?.classList.contains("markedContent")?l.id:null}moveElementInDOM(t,e,i,n){const s=this.addPointerInTextLayer(i,n);if(!t.hasChildNodes())return t.append(e),s;const r=Array.from(t.childNodes).filter(h=>h!==e);if(0===r.length)return s;const a=i||e,l=Ne(r,h=>He.#s(a,h)<0);return 0===l?r[0].before(e):r[l-1].after(e),s}}class Fc{#t=null;constructor({findController:t,eventBus:e,pageIndex:i}){this.findController=t,this.matches=[],this.eventBus=e,this.pageIdx=i,this.textDivs=null,this.textContentItemsStr=null,this.enabled=!1}setTextMapping(t,e){this.textDivs=t,this.textContentItemsStr=e}enable(){if(!this.textDivs||!this.textContentItemsStr)throw new Error("Text divs and strings have not been set.");if(this.enabled)throw new Error("TextHighlighter is already enabled.");this.enabled=!0,this.#t||(this.#t=new AbortController,this.eventBus._on("updatetextlayermatches",t=>{(t.pageIndex===this.pageIdx||-1===t.pageIndex)&&this._updateMatches()},{signal:this.#t.signal})),this._updateMatches()}disable(){this.enabled&&(this.enabled=!1,this.#t?.abort(),this.#t=null,this._updateMatches(!0))}_convertMatches(t,e){if(!t)return[];const{textContentItemsStr:i}=this;let n=0,s=0;const r=i.length-1,a=[];for(let l=0,h=t.length;l<h;l++){let c=t[l];for(;n!==r&&c>=s+i[n].length;)s+=i[n].length,n++;n===i.length&&console.error("Could not find a matching mapping");const d={begin:{divIdx:n,offset:c-s}};for(c+=e[l];n!==r&&c>s+i[n].length;)s+=i[n].length,n++;d.end={divIdx:n,offset:c-s},a.push(d)}return a}_renderMatches(t){if(0===t.length)return;const{findController:e,pageIdx:i}=this,{textContentItemsStr:n,textDivs:s}=this,r=i===e.selected.pageIdx,a=e.selected.matchIdx;let h=null;function d(m,v){const A=m.divIdx;return s[A].textContent="",u(A,0,m.offset,v)}function u(m,v,A,w){let E=s[m];if(E.nodeType===Node.TEXT_NODE){const T=document.createElement("span");E.before(T),T.append(E),s[m]=T,E=T}const C=n[m].substring(v,A),M=document.createTextNode(C);if(w){const T=document.createElement("span");return T.className=`${w} appended`,T.append(M),E.append(T),w.includes("selected")?T.offsetLeft:0}return E.append(M),0}let f=a,p=f+1;if(e.state.highlightAll)f=0,p=t.length;else if(!r)return;let g=-1,b=-1;for(let m=f;m<p;m++){const v=t[m],A=v.begin;if(A.divIdx===g&&A.offset===b)continue;g=A.divIdx,b=A.offset;const w=v.end,E=r&&m===a,C=E?" selected":"";let M=0;if(h&&A.divIdx===h.divIdx?u(h.divIdx,h.offset,A.offset):(null!==h&&u(h.divIdx,h.offset,void 0),d(A)),A.divIdx===w.divIdx)M=u(A.divIdx,A.offset,w.offset,"highlight"+C);else{M=u(A.divIdx,A.offset,void 0,"highlight begin"+C);for(let T=A.divIdx+1,y=w.divIdx;T<y;T++)s[T].className="highlight middle"+C;d(w,"highlight end"+C)}h=w,E&&e.scrollMatchIntoView({element:s[A.divIdx],selectedLeft:M,pageIndex:i,matchIndex:a})}h&&u(h.divIdx,h.offset,void 0)}_updateMatches(t=!1){if(!this.enabled&&!t)return;const{findController:e,matches:i,pageIdx:n}=this,{textContentItemsStr:s,textDivs:r}=this;let a=-1;for(const c of i){for(let u=Math.max(a,c.begin.divIdx),f=c.end.divIdx;u<=f;u++){const p=r[u];p.textContent=s[u],p.className=""}a=c.end.divIdx+1}e?.highlightMatches&&!t&&(this.matches=this._convertMatches(e.pageMatches[n]||null,e.pageMatchesLength[n]||null),this._renderMatches(this.matches))}}class ve{#t=!1;#e=null;#i=!1;#n=null;static#s=new Map;static#r=null;constructor({pdfPage:t,highlighter:e=null,accessibilityManager:i=null,enablePermissions:n=!1,onAppend:s=null}){this.pdfPage=t,this.highlighter=e,this.accessibilityManager=i,this.#t=!0===n,this.#e=s,this.div=document.createElement("div"),this.div.tabIndex=0,this.div.className="textLayer"}render(t){var e=this;return(0,x.A)(function*(i,n=null){if(e.#i&&e.#n)return e.#n.update({viewport:i,onBefore:e.hide.bind(e)}),void e.show();e.cancel(),e.#n=new Dh({textContentSource:e.pdfPage.streamTextContent(n||{includeMarkedContent:!0,disableNormalization:!0}),container:e.div,viewport:i});const{textDivs:s,textContentItemsStr:r}=e.#n;e.highlighter?.setTextMapping(s,r),e.accessibilityManager?.setTextMapping(s),yield e.#n.render(),e.#i=!0;const a=document.createElement("div");a.className="endOfContent",e.div.append(a),e.#l(a),e.#e?.(e.div),e.highlighter?.enable(),e.accessibilityManager?.enable()}).apply(this,arguments)}hide(){!this.div.hidden&&this.#i&&(this.highlighter?.disable(),this.div.hidden=!0)}show(){this.div.hidden&&this.#i&&(this.div.hidden=!1,this.highlighter?.enable())}cancel(){this.#n?.cancel(),this.#n=null,this.highlighter?.disable(),this.accessibilityManager?.disable(),ve.#h(this.div)}#l(t){const{div:e}=this;e.addEventListener("mousedown",()=>{e.classList.add("selecting")}),e.addEventListener("copy",i=>{if(!this.#t){const n=document.getSelection();i.clipboardData.setData("text/plain",Fe(Rh(n.toString())))}i.preventDefault(),i.stopPropagation()}),ve.#s.set(e,t),ve.#c()}static#h(t){this.#s.delete(t),0===this.#s.size&&(this.#r?.abort(),this.#r=null)}static#c(){if(this.#r)return;this.#r=new AbortController;const{signal:t}=this.#r,e=(r,a)=>{a.append(r),r.style.width="",r.style.height="",a.classList.remove("selecting")};let i=!1;var n,s;document.addEventListener("pointerdown",()=>{i=!0},{signal:t}),document.addEventListener("pointerup",()=>{i=!1,this.#s.forEach(e)},{signal:t}),window.addEventListener("blur",()=>{i=!1,this.#s.forEach(e)},{signal:t}),document.addEventListener("keyup",()=>{i||this.#s.forEach(e)},{signal:t}),document.addEventListener("selectionchange",()=>{const r=document.getSelection();if(0===r.rangeCount)return void this.#s.forEach(e);const a=new Set;for(let f=0;f<r.rangeCount;f++){const p=r.getRangeAt(f);for(const g of this.#s.keys())!a.has(g)&&p.intersectsNode(g)&&a.add(g)}for(const[f,p]of this.#s)a.has(f)?f.classList.add("selecting"):e(p,f);if(n??="none"===getComputedStyle(this.#s.values().next().value).getPropertyValue("-moz-user-select"),n)return;const l=r.getRangeAt(0),h=s&&(0===l.compareBoundaryPoints(Range.END_TO_END,s)||0===l.compareBoundaryPoints(Range.START_TO_END,s));let c=h?l.startContainer:l.endContainer;c.nodeType===Node.TEXT_NODE&&(c=c.parentNode);const d=c.parentElement?.closest(".textLayer"),u=this.#s.get(d);u&&(u.style.width=d.style.width,u.style.height=d.style.height,c.parentElement.insertBefore(u,h?c:c.nextSibling)),s=l.cloneRange()},{signal:t})}}class _r{constructor({pdfPage:t,annotationStorage:e=null,linkService:i,xfaHtml:n=null}){this.pdfPage=t,this.annotationStorage=e,this.linkService=i,this.xfaHtml=n,this.div=null,this._cancelled=!1}render(t){var e=this;return(0,x.A)(function*(i,n="display"){if("print"===n){const a={viewport:i.clone({dontFlip:!0}),div:e.div,xfaHtml:e.xfaHtml,annotationStorage:e.annotationStorage,linkService:e.linkService,intent:n};return e.div=document.createElement("div"),a.div=e.div,cn.render(a)}const s=yield e.pdfPage.getXfa();if(e._cancelled||!s)return{textDivs:[]};const r={viewport:i.clone({dontFlip:!0}),div:e.div,xfaHtml:s,annotationStorage:e.annotationStorage,linkService:e.linkService,intent:n};return e.div?cn.update(r):(e.div=document.createElement("div"),r.div=e.div,cn.render(r))}).apply(this,arguments)}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}const Nc={annotationEditorUIManager:null,annotationStorage:null,downloadManager:null,enableScripting:!1,fieldObjectsPromise:null,findController:null,hasJSActionsPromise:null,get linkService(){return new ln}},Bc=new Map([["canvasWrapper",0],["textLayer",1],["annotationLayer",2],["annotationEditorLayer",3],["xfaLayer",3]]);class vr{#t=Gt.ENABLE_FORMS;#e=!1;#i=!1;#n=!1;#s=null;#r=null;#l=null;#h=1;#c=1;#o=null;#d=tt.INITIAL;#a=1;#u={directDrawing:!0,initialOptionalContent:!0,regularAnnotations:!0};#p=new WeakMap;#f=[null,null,null,null];constructor(t){const e=t.container,i=t.defaultViewport;this.id=t.id,this.renderingId="page"+this.id,this.#s=t.layerProperties||Nc,this.pdfPage=null,this.pageLabel=null,this.rotation=0,this.scale=t.scale||1,this.viewport=i,this.pdfPageRotate=i.rotation,this._optionalContentConfigPromise=t.optionalContentConfigPromise||null,this.#a=t.textLayerMode??1,this.#t=t.annotationMode??Gt.ENABLE_FORMS,this.imageResourcesPath=t.imageResourcesPath||"",this.maxCanvasPixels=t.maxCanvasPixels??kc.get("maxCanvasPixels"),this.pageColors=t.pageColors||null,this.#e=t.enableHWA||!1,this.eventBus=t.eventBus,this.renderingQueue=t.renderingQueue,this.l10n=t.l10n,this.l10n||=new Yt,this.renderTask=null,this.resume=null,this._isStandalone=!this.renderingQueue?.hasViewer(),this._container=e,this._annotationCanvasMap=null,this.annotationLayer=null,this.annotationEditorLayer=null,this.textLayer=null,this.zoomLayer=null,this.xfaLayer=null,this.structTreeLayer=null,this.drawLayer=null;const n=document.createElement("div");if(n.className="page",n.setAttribute("data-page-number",this.id),n.setAttribute("role","region"),n.setAttribute("data-l10n-id","pdfjs-page-landmark"),n.setAttribute("data-l10n-args",JSON.stringify({page:this.id})),this.div=n,this.#b(),e?.append(n),this._isStandalone){e?.style.setProperty("--scale-factor",this.scale*$t.PDF_TO_CSS_UNITS),this.pageColors?.background&&e?.style.setProperty("--page-bg-color",this.pageColors.background);const{optionalContentConfigPromise:s}=t;s&&s.then(r=>{s===this._optionalContentConfigPromise&&(this.#u.initialOptionalContent=r.hasInitialVisibility)}),t.l10n||this.l10n.translate(this.div)}}#g(t,e){const i=Bc.get(e),n=this.#f[i];if(this.#f[i]=t,n)n.replaceWith(t);else{for(let s=i-1;s>=0;s--){const r=this.#f[s];if(r)return void r.after(t)}this.div.prepend(t)}}get renderingState(){return this.#d}set renderingState(t){if(t!==this.#d)switch(this.#d=t,this.#r&&(clearTimeout(this.#r),this.#r=null),t){case tt.PAUSED:this.div.classList.remove("loading");break;case tt.RUNNING:this.div.classList.add("loadingIcon"),this.#r=setTimeout(()=>{this.div.classList.add("loading"),this.#r=null},0);break;case tt.INITIAL:case tt.FINISHED:this.div.classList.remove("loadingIcon","loading")}}#b(){const{viewport:t}=this;if(this.pdfPage){if(this.#l===t.rotation)return;this.#l=t.rotation}kh(this.div,t,!0,!1)}setPdfPage(t){this._isStandalone&&("CanvasText"===this.pageColors?.foreground||"Canvas"===this.pageColors?.background)&&(this._container?.style.setProperty("--hcm-highlight-filter",t.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight")),this._container?.style.setProperty("--hcm-highlight-selected-filter",t.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","Highlight"))),this.pdfPage=t,this.pdfPageRotate=t.rotate,this.viewport=t.getViewport({scale:this.scale*$t.PDF_TO_CSS_UNITS,rotation:(this.rotation+this.pdfPageRotate)%360}),this.#b(),this.reset()}destroy(){this.reset(),this.pdfPage?.cleanup()}hasEditableAnnotations(){return!!this.annotationLayer?.hasEditableAnnotations()}get _textHighlighter(){return gi(this,"_textHighlighter",new Fc({pageIndex:this.id-1,eventBus:this.eventBus,findController:this.#s.findController}))}#m(t,e){this.eventBus.dispatch(t,{source:this,pageNumber:this.id,error:e})}#_(){var t=this;return(0,x.A)(function*(){let e=null;try{yield t.annotationLayer.render(t.viewport,{structTreeLayer:t.structTreeLayer},"display")}catch(i){console.error(`#renderAnnotationLayer: "${i}".`),e=i}finally{t.#m("annotationlayerrendered",e)}})()}#A(){var t=this;return(0,x.A)(function*(){let e=null;try{yield t.annotationEditorLayer.render(t.viewport,"display")}catch(i){console.error(`#renderAnnotationEditorLayer: "${i}".`),e=i}finally{t.#m("annotationeditorlayerrendered",e)}})()}#E(){var t=this;return(0,x.A)(function*(){try{yield t.drawLayer.render("display")}catch(e){console.error(`#renderDrawLayer: "${e}".`)}})()}#y(){var t=this;return(0,x.A)(function*(){let e=null;try{const i=yield t.xfaLayer.render(t.viewport,"display");i?.textDivs&&t._textHighlighter&&t.#P(i.textDivs)}catch(i){console.error(`#renderXfaLayer: "${i}".`),e=i}finally{t.xfaLayer?.div&&(t.l10n.pause(),t.#g(t.xfaLayer.div,"xfaLayer"),t.l10n.resume()),t.#m("xfalayerrendered",e)}})()}#w(){var t=this;return(0,x.A)(function*(){if(!t.textLayer)return;let e=null;try{yield t.textLayer.render(t.viewport)}catch(i){if(i instanceof Eh)return;console.error(`#renderTextLayer: "${i}".`),e=i}t.#m("textlayerrendered",e),t.#L()})()}#L(){var t=this;return(0,x.A)(function*(){if(!t.textLayer)return;const e=yield t.structTreeLayer?.render();e&&(t.l10n.pause(),t.structTreeLayer?.addElementsToTextLayer(),t.canvas&&e.parentNode!==t.canvas&&t.canvas.append(e),t.l10n.resume()),t.structTreeLayer?.show()})()}#P(t){var e=this;return(0,x.A)(function*(){const i=yield e.pdfPage.getTextContent(),n=[];for(const s of i.items)n.push(s.str);e._textHighlighter.setTextMapping(t,n),e._textHighlighter.enable()})()}_resetZoomLayer(t=!1){if(!this.zoomLayer)return;const e=this.zoomLayer.firstChild;this.#p.delete(e),e.width=0,e.height=0,t&&this.zoomLayer.remove(),this.zoomLayer=null}reset({keepZoomLayer:t=!1,keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:i=!1,keepXfaLayer:n=!1,keepTextLayer:s=!1}={}){this.cancelRendering({keepAnnotationLayer:e,keepAnnotationEditorLayer:i,keepXfaLayer:n,keepTextLayer:s}),this.renderingState=tt.INITIAL;const r=this.div,a=r.childNodes,l=t&&this.zoomLayer||null,h=e&&this.annotationLayer?.div||null,c=i&&this.annotationEditorLayer?.div||null,d=n&&this.xfaLayer?.div||null,u=s&&this.textLayer?.div||null;for(let f=a.length-1;f>=0;f--){const p=a[f];switch(p){case l:case h:case c:case d:case u:continue}p.remove();const g=this.#f.indexOf(p);g>=0&&(this.#f[g]=null)}r.removeAttribute("data-loaded"),h&&this.annotationLayer.hide(),c&&this.annotationEditorLayer.hide(),d&&this.xfaLayer.hide(),u&&this.textLayer.hide(),this.structTreeLayer?.hide(),l||(this.canvas&&(this.#p.delete(this.canvas),this.canvas.width=0,this.canvas.height=0,delete this.canvas),this._resetZoomLayer())}toggleEditingMode(t){this.hasEditableAnnotations()&&(this.#n=t,this.reset({keepZoomLayer:!0,keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0}))}update({scale:t=0,rotation:e=null,optionalContentConfigPromise:i=null,drawingDelay:n=-1}){if(this.scale=t||this.scale,"number"==typeof e&&(this.rotation=e),i instanceof Promise&&(this._optionalContentConfigPromise=i,i.then(r=>{i===this._optionalContentConfigPromise&&(this.#u.initialOptionalContent=r.hasInitialVisibility)})),this.#u.directDrawing=!0,this.viewport=this.viewport.clone({scale:this.scale*$t.PDF_TO_CSS_UNITS,rotation:(this.rotation+this.pdfPageRotate)%360}),this.#b(),this._isStandalone&&this._container?.style.setProperty("--scale-factor",this.viewport.scale),this.canvas){let r=!1;if(this.#i)if(0===this.maxCanvasPixels)r=!0;else if(this.maxCanvasPixels>0){const{width:l,height:h}=this.viewport,{sx:c,sy:d}=this.outputScale;r=(Math.floor(l)*c|0)*(Math.floor(h)*d|0)>this.maxCanvasPixels}const a=n>=0&&n<1e3;if(a||r){if(a&&!r&&this.renderingState!==tt.FINISHED&&(this.cancelRendering({keepZoomLayer:!0,keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,cancelExtraDelay:n}),this.renderingState=tt.FINISHED,this.#u.directDrawing=!1),this.cssTransform({target:this.canvas,redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!a,hideTextLayer:a}),a)return;return void this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this.#o})}!this.zoomLayer&&!this.canvas.hidden&&(this.zoomLayer=this.canvas.parentNode,this.zoomLayer.style.position="absolute")}this.zoomLayer&&this.cssTransform({target:this.zoomLayer.firstChild}),this.reset({keepZoomLayer:!0,keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0})}cancelRendering({keepAnnotationLayer:t=!1,keepAnnotationEditorLayer:e=!1,keepXfaLayer:i=!1,keepTextLayer:n=!1,cancelExtraDelay:s=0}={}){this.renderTask&&(this.renderTask.cancel(s),this.renderTask=null),this.resume=null,this.textLayer&&(!n||!this.textLayer.div)&&(this.textLayer.cancel(),this.textLayer=null),this.annotationLayer&&(!t||!this.annotationLayer.div)&&(this.annotationLayer.cancel(),this.annotationLayer=null,this._annotationCanvasMap=null),this.structTreeLayer&&!this.textLayer&&(this.structTreeLayer=null),this.annotationEditorLayer&&(!e||!this.annotationEditorLayer.div)&&(this.drawLayer&&(this.drawLayer.cancel(),this.drawLayer=null),this.annotationEditorLayer.cancel(),this.annotationEditorLayer=null),this.xfaLayer&&(!i||!this.xfaLayer.div)&&(this.xfaLayer.cancel(),this.xfaLayer=null,this._textHighlighter?.disable())}cssTransform({target:t,redrawAnnotationLayer:e=!1,redrawAnnotationEditorLayer:i=!1,redrawXfaLayer:n=!1,redrawTextLayer:s=!1,hideTextLayer:r=!1}){if(!t.hasAttribute("zooming")){t.setAttribute("zooming",!0);const{style:l}=t;l.width=l.height=""}const a=this.#p.get(t);if(this.viewport!==a){const l=this.viewport.rotation-a.rotation,h=Math.abs(l);let c=1,d=1;if(90===h||270===h){const{width:u,height:f}=this.viewport;c=f/u,d=u/f}t.style.transform=`rotate(${l}deg) scale(${c}, ${d})`}e&&this.annotationLayer&&this.#_(),i&&this.annotationEditorLayer&&(this.drawLayer&&this.#E(),this.#A()),n&&this.xfaLayer&&this.#y(),this.textLayer&&(r?(this.textLayer.hide(),this.structTreeLayer?.hide()):s&&this.#w())}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(t,e){return this.viewport.convertToPdfPoint(t,e)}#x(t){var e=this;return(0,x.A)(function*(i,n=null){if(i===e.renderTask&&(e.renderTask=null),n instanceof hn)e.#o=null;else if(e.#o=n,e.renderingState=tt.FINISHED,e._resetZoomLayer(!0),e.#u.regularAnnotations=!i.separateAnnots,e.eventBus.dispatch("pagerendered",{source:e,pageNumber:e.id,cssTransform:!1,timestamp:performance.now(),error:e.#o}),n)throw n}).apply(this,arguments)}draw(){var t=this;return(0,x.A)(function*(){t.renderingState!==tt.INITIAL&&(console.error("Must be in new state before drawing"),t.reset());const{div:e,l10n:i,pageColors:n,pdfPage:s,viewport:r}=t;if(!s)throw t.renderingState=tt.FINISHED,new Error("pdfPage is not loaded");t.renderingState=tt.RUNNING;const a=document.createElement("div");if(a.classList.add("canvasWrapper"),t.#g(a,"canvasWrapper"),!t.textLayer&&0!==t.#a&&!s.isPureXfa&&(t._accessibilityManager||=new He,t.textLayer=new ve({pdfPage:s,highlighter:t._textHighlighter,accessibilityManager:t._accessibilityManager,enablePermissions:2===t.#a,onAppend:S=>{t.l10n.pause(),t.#g(S,"textLayer"),t.l10n.resume()}})),!t.annotationLayer&&t.#t!==Gt.DISABLE){const{annotationStorage:S,annotationEditorUIManager:L,downloadManager:z,enableScripting:H,fieldObjectsPromise:W,hasJSActionsPromise:$,linkService:et}=t.#s;t._annotationCanvasMap||=new Map,t.annotationLayer=new Ys({pdfPage:s,annotationStorage:S,imageResourcesPath:t.imageResourcesPath,renderForms:t.#t===Gt.ENABLE_FORMS,linkService:et,downloadManager:z,enableScripting:H,hasJSActionsPromise:$,fieldObjectsPromise:W,annotationCanvasMap:t._annotationCanvasMap,accessibilityManager:t._accessibilityManager,annotationEditorUIManager:L,onAppend:k=>{t.#g(k,"annotationLayer")}})}const{width:h,height:c}=r,d=document.createElement("canvas");d.setAttribute("role","presentation"),d.hidden=!0;const u=!(!n?.background||!n?.foreground);let f=S=>{(!u||S)&&(d.hidden=!1,f=null)};a.append(d),t.canvas=d;const p=d.getContext("2d",{alpha:!1,willReadFrequently:!t.#e}),g=t.outputScale=new Ih;if(0===t.maxCanvasPixels){const S=1/t.scale;g.sx*=S,g.sy*=S,t.#i=!0}else if(t.maxCanvasPixels>0){const L=Math.sqrt(t.maxCanvasPixels/(h*c));g.sx>L||g.sy>L?(g.sx=L,g.sy=L,t.#i=!0):t.#i=!1}const b=Ns(g.sx),m=Ns(g.sy),v=d.width=ci(di(h*g.sx),b[0]),A=d.height=ci(di(c*g.sy),m[0]),w=ci(di(h),b[1]),E=ci(di(c),m[1]);g.sx=v/w,g.sy=A/E,t.#h!==b[1]&&(e.style.setProperty("--scale-round-x",`${b[1]}px`),t.#h=b[1]),t.#c!==m[1]&&(e.style.setProperty("--scale-round-y",`${m[1]}px`),t.#c=m[1]),t.#p.set(d,r);const M={canvasContext:p,transform:g.scaled?[g.sx,0,0,g.sy,0,0]:null,viewport:r,annotationMode:t.#t,optionalContentConfigPromise:t._optionalContentConfigPromise,annotationCanvasMap:t._annotationCanvasMap,pageColors:n,isEditing:t.#n},T=t.renderTask=s.render(M);T.onContinue=S=>{if(f?.(!1),t.renderingQueue&&!t.renderingQueue.isHighestPriority(t))return t.renderingState=tt.PAUSED,void(t.resume=()=>{t.renderingState=tt.RUNNING,S()});S()};const y=T.promise.then((0,x.A)(function*(){f?.(!0),yield t.#x(T),t.structTreeLayer||=new br(s,r.rawDims),t.#w(),t.annotationLayer&&(yield t.#_());const{annotationEditorUIManager:S}=t.#s;S&&(t.drawLayer||=new Dc({pageIndex:t.id}),yield t.#E(),t.drawLayer.setParent(a),t.annotationEditorLayer||=new Ic({uiManager:S,pdfPage:s,l10n:i,structTreeLayer:t.structTreeLayer,accessibilityManager:t._accessibilityManager,annotationLayer:t.annotationLayer?.annotationLayer,textLayer:t.textLayer,drawLayer:t.drawLayer.getDrawLayer(),onAppend:L=>{t.#g(L,"annotationEditorLayer")}}),t.#A())}),S=>(S instanceof hn||f?.(!0),t.#x(T,S)));if(s.isPureXfa){if(!t.xfaLayer){const{annotationStorage:S,linkService:L}=t.#s;t.xfaLayer=new _r({pdfPage:s,annotationStorage:S,linkService:L})}t.#y()}return e.setAttribute("data-loaded",!0),t.eventBus.dispatch("pagerender",{source:t,pageNumber:t.id}),y})()}setPageLabel(t){this.pageLabel="string"==typeof t?t:null,this.div.setAttribute("data-l10n-args",JSON.stringify({page:this.pageLabel??this.id})),null!==this.pageLabel?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}get thumbnailCanvas(){const{directDrawing:t,initialOptionalContent:e,regularAnnotations:i}=this.#u;return t&&e&&i?this.canvas:null}}function yn(){return(yn=(0,x.A)(function*(o){const e="".split("#",1)[0];let{info:i,metadata:n,contentDispositionFilename:s,contentLength:r}=yield o.getMetadata();if(!r){const{length:a}=yield o.getDownloadInfo();r=a}return{...i,baseURL:e,filesize:r,filename:s||Mh(""),metadata:n?.getRaw(),authors:n?.get("dc:creator"),numPages:o.numPages,URL:""}})).apply(this,arguments)}class jc{constructor(t){this._ready=new Promise((e,i)=>{import(t).then(s=>{e(s.QuickJSSandbox())}).catch(i)})}createSandbox(t){var e=this;return(0,x.A)(function*(){(yield e._ready).create(t)})()}dispatchEventInSandbox(t){var e=this;return(0,x.A)(function*(){const i=yield e._ready;setTimeout(()=>i.dispatchEvent(t),0)})()}destroySandbox(){var t=this;return(0,x.A)(function*(){(yield t._ready).nukeSandbox()})()}}class Hc{#t=null;#e=null;#i=null;#n=null;#s=null;#r=null;#l=null;#h=null;#c=!1;#o=null;#d=null;constructor({eventBus:t,externalServices:e=null,docProperties:i=null}){this.#s=t,this.#r=e,this.#i=i}setViewer(t){this.#h=t}setDocument(t){var e=this;return(0,x.A)(function*(){if(e.#l&&(yield e.#g()),e.#l=t,!t)return;const[i,n,s]=yield Promise.all([t.getFieldObjects(),t.getCalculationOrderIds(),t.getJSActions()]);if(!i&&!s)return void(yield e.#g());if(t!==e.#l)return;try{e.#o=e.#f()}catch(l){return console.error(`setDocument: "${l.message}".`),void(yield e.#g())}const r=e.#s;e.#n=new AbortController;const{signal:a}=e.#n;r._on("updatefromsandbox",l=>{l?.source===window&&e.#a(l.detail)},{signal:a}),r._on("dispatcheventinsandbox",l=>{e.#o?.dispatchEventInSandbox(l.detail)},{signal:a}),r._on("pagechanging",({pageNumber:l,previous:h})=>{l!==h&&(e.#p(h),e.#u(l))},{signal:a}),r._on("pagerendered",({pageNumber:l})=>{e._pageOpenPending.has(l)&&l===e.#h.currentPageNumber&&e.#u(l)},{signal:a}),r._on("pagesdestroy",(0,x.A)(function*(){yield e.#p(e.#h.currentPageNumber),yield e.#o?.dispatchEventInSandbox({id:"doc",name:"WillClose"}),e.#t?.resolve()}),{signal:a});try{const l=yield e.#i(t);if(t!==e.#l)return;yield e.#o.createSandbox({objects:i,calculationOrder:n,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...l,actions:s}}),r.dispatch("sandboxcreated",{source:e})}catch(l){return console.error(`setDocument: "${l.message}".`),void(yield e.#g())}yield e.#o?.dispatchEventInSandbox({id:"doc",name:"Open"}),yield e.#u(e.#h.currentPageNumber,!0),Promise.resolve().then(()=>{t===e.#l&&(e.#c=!0)})})()}dispatchWillSave(){var t=this;return(0,x.A)(function*(){return t.#o?.dispatchEventInSandbox({id:"doc",name:"WillSave"})})()}dispatchDidSave(){var t=this;return(0,x.A)(function*(){return t.#o?.dispatchEventInSandbox({id:"doc",name:"DidSave"})})()}dispatchWillPrint(){var t=this;return(0,x.A)(function*(){if(t.#o){yield t.#d?.promise,t.#d=Promise.withResolvers();try{yield t.#o.dispatchEventInSandbox({id:"doc",name:"WillPrint"})}catch(e){throw t.#d.resolve(),t.#d=null,e}yield t.#d.promise}})()}dispatchDidPrint(){var t=this;return(0,x.A)(function*(){return t.#o?.dispatchEventInSandbox({id:"doc",name:"DidPrint"})})()}get destroyPromise(){return this.#e?.promise||null}get ready(){return this.#c}get _pageOpenPending(){return gi(this,"_pageOpenPending",new Set)}get _visitedPages(){return gi(this,"_visitedPages",new Map)}#a(t){var e=this;return(0,x.A)(function*(){const i=e.#h,n=i.isInPresentationMode||i.isChangingPresentationMode,{id:s,siblings:r,command:a,value:l}=t;if(!s){switch(a){case"clear":console.clear();break;case"error":console.error(l);break;case"layout":if(!n){const c=function Jl(o){let t=G.VERTICAL,e=mt.NONE;switch(o){case"SinglePage":t=G.PAGE;break;case"OneColumn":break;case"TwoPageLeft":t=G.PAGE;case"TwoColumnLeft":e=mt.ODD;break;case"TwoPageRight":t=G.PAGE;case"TwoColumnRight":e=mt.EVEN}return{scrollMode:t,spreadMode:e}}(l);i.spreadMode=c.spreadMode}break;case"page-num":i.currentPageNumber=l+1;break;case"print":yield i.pagesPromise,e.#s.dispatch("print",{source:e});break;case"println":console.log(l);break;case"zoom":n||(i.currentScaleValue=l);break;case"SaveAs":e.#s.dispatch("download",{source:e});break;case"FirstPage":i.currentPageNumber=1;break;case"LastPage":i.currentPageNumber=i.pagesCount;break;case"NextPage":i.nextPage();break;case"PrevPage":i.previousPage();break;case"ZoomViewIn":n||i.increaseScale();break;case"ZoomViewOut":n||i.decreaseScale();break;case"WillPrintFinished":e.#d?.resolve(),e.#d=null}return}if(n&&t.focus)return;delete t.id,delete t.siblings;const h=r?[s,...r]:[s];for(const c of h){const d=document.querySelector(`[data-element-id="${c}"]`);d?d.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:t})):e.#l?.annotationStorage.setValue(c,t)}})()}#u(t){var e=this;return(0,x.A)(function*(i,n=!1){const s=e.#l,r=e._visitedPages;if(n&&(e.#t=Promise.withResolvers()),!e.#t)return;const a=e.#h.getPageView(i-1);if(a?.renderingState!==tt.FINISHED)return void e._pageOpenPending.add(i);e._pageOpenPending.delete(i);const l=(0,x.A)(function*(){const h=yield r.has(i)?null:a.pdfPage?.getJSActions();s===e.#l&&(yield e.#o?.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:i,actions:h}))})();r.set(i,l)}).apply(this,arguments)}#p(t){var e=this;return(0,x.A)(function*(){const i=e.#l,n=e._visitedPages;if(!e.#t||e._pageOpenPending.has(t))return;const s=n.get(t);s&&(n.set(t,null),yield s,i===e.#l&&(yield e.#o?.dispatchEventInSandbox({id:"page",name:"PageClose",pageNumber:t})))})()}#f(){if(this.#e=Promise.withResolvers(),this.#o)throw new Error("#initScripting: Scripting already exists.");return this.#r.createScripting()}#g(){var t=this;return(0,x.A)(function*(){if(!t.#o)return t.#l=null,void t.#e?.resolve();t.#t&&(yield Promise.race([t.#t.promise,new Promise(e=>{setTimeout(e,1e3)})]).catch(()=>{}),t.#t=null),t.#l=null;try{yield t.#o.destroySandbox()}catch{}t.#d?.reject(new Error("Scripting destroyed.")),t.#d=null,t.#n?.abort(),t.#n=null,t._pageOpenPending.clear(),t._visitedPages.clear(),t.#o=null,t.#c=!1,t.#e?.resolve()})()}}class zc extends Hc{constructor(t){t.externalServices||window.addEventListener("updatefromsandbox",e=>{t.eventBus.dispatch("updatefromsandbox",{source:window,detail:e.detail})}),t.externalServices||={createScripting:()=>new jc(t.sandboxBundleSrc)},t.docProperties||=e=>function Vc(o){return yn.apply(this,arguments)}(e),super(t)}}class Uc{constructor(){this.pdfViewer=null,this.pdfThumbnailViewer=null,this.onIdle=null,this.highestPriorityPage=null,this.idleTimeout=null,this.printing=!1,this.isThumbnailViewEnabled=!1,Object.defineProperty(this,"hasViewer",{value:()=>!!this.pdfViewer})}setViewer(t){this.pdfViewer=t}setThumbnailViewer(t){this.pdfThumbnailViewer=t}isHighestPriority(t){return this.highestPriorityPage===t.renderingId}renderHighestPriority(t){this.idleTimeout&&(clearTimeout(this.idleTimeout),this.idleTimeout=null),!this.pdfViewer.forceRendering(t)&&(this.isThumbnailViewEnabled&&this.pdfThumbnailViewer?.forceRendering()||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),3e4)))}getHighestPriority(t,e,i,n=!1){const s=t.views,r=s.length;if(0===r)return null;for(let d=0;d<r;d++){const u=s[d].view;if(!this.isViewFinished(u))return u}const a=t.first.id,l=t.last.id;if(l-a+1>r){const d=t.ids;for(let u=1,f=l-a;u<f;u++){const p=i?a+u:l-u;if(d.has(p))continue;const g=e[p-1];if(!this.isViewFinished(g))return g}}let h=i?l:a-2,c=e[h];return c&&!this.isViewFinished(c)||n&&(h+=i?1:-1,c=e[h],c&&!this.isViewFinished(c))?c:null}isViewFinished(t){return t.renderingState===tt.FINISHED}renderView(t){switch(t.renderingState){case tt.FINISHED:return!1;case tt.PAUSED:this.highestPriorityPage=t.renderingId,t.resume();break;case tt.RUNNING:this.highestPriorityPage=t.renderingId;break;case tt.INITIAL:this.highestPriorityPage=t.renderingId,t.draw().finally(()=>{this.renderHighestPriority()}).catch(e=>{e instanceof hn||console.error(`renderView: "${e}"`)})}return!0}}function yr(o){return Object.values(St).includes(o)&&o!==St.DISABLE}class Gc{#t=new Set;#e=0;constructor(t){this.#e=t}push(t){const e=this.#t;e.has(t)&&e.delete(t),e.add(t),e.size>this.#e&&this.#i()}resize(t,e=null){this.#e=t;const i=this.#t;if(e){const n=i.size;let s=1;for(const r of i)if(e.has(r.id)&&(i.delete(r),i.add(r)),++s>n)break}for(;i.size>this.#e;)this.#i()}has(t){return this.#t.has(t)}[Symbol.iterator](){return this.#t.keys()}#i(){const t=this.#t.keys().next().value;t?.destroy(),this.#t.delete(t)}}class wr{#t=null;#e=null;#i=null;#n=St.NONE;#s=null;#r=Gt.ENABLE_FORMS;#l=null;#h=!1;#c=!1;#o=!1;#d=!1;#a=!1;#u=null;#p=null;#f=null;#g=null;#b=!1;#m=null;#_=!1;#A=0;#E=new ResizeObserver(this.#B.bind(this));#y=null;#w=null;#L=1;constructor(t){const e="4.8.69";if(Xs!==e)throw new Error(`The API version "${Xs}" does not match the Viewer version "${e}".`);if(this.container=t.container,this.viewer=t.viewer||t.container.firstElementChild,"DIV"!==this.container?.tagName||"DIV"!==this.viewer?.tagName)throw new Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&"absolute"!==getComputedStyle(this.container).position)throw new Error("The `container` must be absolutely positioned.");this.#E.observe(this.container),this.eventBus=t.eventBus,this.linkService=t.linkService||new ln,this.downloadManager=t.downloadManager||null,this.findController=t.findController||null,this.#e=t.altTextManager||null,this.findController&&(this.findController.onIsPageVisible=n=>this._getVisiblePages().ids.has(n)),this._scriptingManager=t.scriptingManager||null,this.#L=t.textLayerMode??1,this.#r=t.annotationMode??Gt.ENABLE_FORMS,this.#n=t.annotationEditorMode??St.NONE,this.#i=t.annotationEditorHighlightColors||null,this.#c=!0===t.enableHighlightFloatingButton,this.#d=!0===t.enableUpdatedAddImage,this.#a=!0===t.enableNewAltTextWhenAddingImage,this.imageResourcesPath=t.imageResourcesPath||"",this.enablePrintAutoRotate=t.enablePrintAutoRotate||!1,this.removePageBorders=t.removePageBorders||!1,this.maxCanvasPixels=t.maxCanvasPixels,this.l10n=t.l10n,this.l10n||=new Yt,this.#o=t.enablePermissions||!1,this.pageColors=t.pageColors||null,this.#p=t.mlManager||null,this.#h=t.enableHWA||!1,this.defaultRenderingQueue=!t.renderingQueue,this.defaultRenderingQueue?(this.renderingQueue=new Uc,this.renderingQueue.setViewer(this)):this.renderingQueue=t.renderingQueue;const{abortSignal:i}=t;i?.addEventListener("abort",()=>{this.#E.disconnect(),this.#E=null},{once:!0}),this.scroll=function Ul(o,t,e){const i=function(r){s||(s=window.requestAnimationFrame(function(){s=null;const l=o.scrollLeft,h=n.lastX;l!==h&&(n.right=l>h),n.lastX=l;const c=o.scrollTop,d=n.lastY;c!==d&&(n.down=c>d),n.lastY=c,t(n)}))},n={right:!0,down:!0,lastX:o.scrollLeft,lastY:o.scrollTop,_eventHandler:i};let s=null;return o.addEventListener("scroll",i,{useCapture:!0,signal:e}),e?.addEventListener("abort",()=>window.cancelAnimationFrame(s),{once:!0}),n}(this.container,this._scrollUpdate.bind(this),i),this.presentationModeState=0,this._resetView(),this.removePageBorders&&this.viewer.classList.add("removePageBorders"),this.#F(),this.eventBus._on("thumbnailrendered",({pageNumber:n,pdfPage:s})=>{this.#t.has(this._pages[n-1])||s?.cleanup()}),t.l10n||this.l10n.translate(this.container)}get pagesCount(){return this._pages.length}getPageView(t){return this._pages[t]}getCachedPageViews(){return new Set(this.#t)}get pageViewsReady(){return this._pages.every(t=>t?.pdfPage)}get renderForms(){return this.#r===Gt.ENABLE_FORMS}get enableScripting(){return!!this._scriptingManager}get currentPageNumber(){return this._currentPageNumber}set currentPageNumber(t){if(!Number.isInteger(t))throw new Error("Invalid page number.");this.pdfDocument&&(this._setCurrentPageNumber(t,!0)||console.error(`currentPageNumber: "${t}" is not a valid page.`))}_setCurrentPageNumber(t,e=!1){if(this._currentPageNumber===t)return e&&this.#I(),!0;if(!(0<t&&t<=this.pagesCount))return!1;const i=this._currentPageNumber;return this._currentPageNumber=t,this.eventBus.dispatch("pagechanging",{source:this,pageNumber:t,pageLabel:this._pageLabels?.[t-1]??null,previous:i}),e&&this.#I(),!0}get currentPageLabel(){return this._pageLabels?.[this._currentPageNumber-1]??null}set currentPageLabel(t){if(!this.pdfDocument)return;let e=0|t;if(this._pageLabels){const i=this._pageLabels.indexOf(t);i>=0&&(e=i+1)}this._setCurrentPageNumber(e,!0)||console.error(`currentPageLabel: "${t}" is not a valid page.`)}get currentScale(){return 0!==this._currentScale?this._currentScale:1}set currentScale(t){if(isNaN(t))throw new Error("Invalid numeric scale.");this.pdfDocument&&this.#M(t,{noScroll:!1})}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(t){this.pdfDocument&&this.#M(t,{noScroll:!1})}get pagesRotation(){return this._pagesRotation}set pagesRotation(t){if(!Bs(t))throw new Error("Invalid pages rotation angle.");if(!this.pdfDocument||((t%=360)<0&&(t+=360),this._pagesRotation===t))return;this._pagesRotation=t;const e=this._currentPageNumber;this.refresh(!0,{rotation:t}),this._currentScaleValue&&this.#M(this._currentScaleValue,{noScroll:!0}),this.eventBus.dispatch("rotationchanging",{source:this,pagesRotation:t,pageNumber:e}),this.defaultRenderingQueue&&this.update()}get firstPagePromise(){return this.pdfDocument?this._firstPageCapability.promise:null}get onePageRendered(){return this.pdfDocument?this._onePageRenderedCapability.promise:null}get pagesPromise(){return this.pdfDocument?this._pagesCapability.promise:null}get _layerProperties(){const t=this;return gi(this,"_layerProperties",{get annotationEditorUIManager(){return t.#s},get annotationStorage(){return t.pdfDocument?.annotationStorage},get downloadManager(){return t.downloadManager},get enableScripting(){return!!t._scriptingManager},get fieldObjectsPromise(){return t.pdfDocument?.getFieldObjects()},get findController(){return t.findController},get hasJSActionsPromise(){return t.pdfDocument?.hasJSActions()},get linkService(){return t.linkService}})}#P(t){const e={annotationEditorMode:this.#n,annotationMode:this.#r,textLayerMode:this.#L};return t&&(!t.includes(pi.COPY)&&1===this.#L&&(e.textLayerMode=2),t.includes(pi.MODIFY_CONTENTS)||(e.annotationEditorMode=St.DISABLE),!t.includes(pi.MODIFY_ANNOTATIONS)&&!t.includes(pi.FILL_INTERACTIVE_FORMS)&&this.#r===Gt.ENABLE_FORMS&&(e.annotationMode=Gt.ENABLE)),e}#x(t){var e=this;return(0,x.A)(function*(){if("hidden"===document.visibilityState||!e.container.offsetParent||0===e._getVisiblePages().views.length)return;const i=Promise.withResolvers(),n=new AbortController;document.addEventListener("visibilitychange",()=>{"hidden"===document.visibilityState&&i.resolve()},{signal:"function"==typeof AbortSignal.any?AbortSignal.any([t,n.signal]):t}),yield Promise.race([e._onePageRenderedCapability.promise,i.promise]),n.abort()})()}getAllText(){var t=this;return(0,x.A)(function*(){const e=[],i=[];for(let n=1,s=t.pdfDocument.numPages;n<=s;++n){if(t.#_)return null;i.length=0;const r=yield t.pdfDocument.getPage(n),{items:a}=yield r.getTextContent();for(const l of a)l.str&&i.push(l.str),l.hasEOL&&i.push("\n");e.push(Fe(i.join("")))}return e.join("\n")})()}#T(t,e){const i=document.getSelection(),{focusNode:n,anchorNode:s}=i;if(s&&n&&i.containsNode(this.#m)){if(this.#b||2===t)return e.preventDefault(),void e.stopPropagation();this.#b=!0;const{classList:r}=this.viewer;r.add("copyAll");const a=new AbortController;window.addEventListener("keydown",l=>this.#_="Escape"===l.key,{signal:a.signal}),this.getAllText().then(function(){var l=(0,x.A)(function*(h){null!==h&&(yield navigator.clipboard.writeText(h))});return function(h){return l.apply(this,arguments)}}()).catch(l=>{console.warn(`Something goes wrong when extracting the text: ${l.message}`)}).finally(()=>{this.#b=!1,this.#_=!1,a.abort(),r.remove("copyAll")}),e.preventDefault(),e.stopPropagation()}}setDocument(t){var e=this;if(this.pdfDocument&&(this.eventBus.dispatch("pagesdestroy",{source:this}),this._cancelRendering(),this._resetView(),this.findController?.setDocument(null),this._scriptingManager?.setDocument(null),this.#s?.destroy(),this.#s=null),this.pdfDocument=t,!t)return;const i=t.numPages,n=t.getPage(1),s=t.getOptionalContentConfig({intent:"display"}),r=this.#o?t.getPermissions():Promise.resolve(),{eventBus:a,pageColors:l,viewer:h}=this;this.#u=new AbortController;const{signal:c}=this.#u;if(i>1e4){console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");const f=this._scrollMode=G.PAGE;a.dispatch("scrollmodechanged",{source:this,mode:f})}this._pagesCapability.promise.then(()=>{a.dispatch("pagesloaded",{source:this,pagesCount:i})},()=>{}),a._on("pagerender",f=>{const p=this._pages[f.pageNumber-1];p&&this.#t.push(p)},{signal:c});const u=f=>{f.cssTransform||(this._onePageRenderedCapability.resolve({timestamp:f.timestamp}),a._off("pagerendered",u))};a._on("pagerendered",u,{signal:c}),Promise.all([n,r]).then(([f,p])=>{if(t!==this.pdfDocument)return;this._firstPageCapability.resolve(f),this._optionalContentConfigPromise=s;const{annotationEditorMode:g,annotationMode:b,textLayerMode:m}=this.#P(p);if(0!==m){const E=this.#m=document.createElement("div");E.id="hiddenCopyElement",h.before(E)}if("function"==typeof AbortSignal.any&&g!==St.DISABLE){const E=g;t.isPureXfa?console.warn("Warning: XFA-editing is not implemented."):yr(E)?(this.#s=new Ch(this.container,h,this.#e,a,t,l,this.#i,this.#c,this.#d,this.#a,this.#p),a.dispatch("annotationeditoruimanager",{source:this,uiManager:this.#s}),E!==St.NONE&&(E===St.STAMP&&this.#p?.loadModel("altText"),this.#s.updateMode(E))):console.error(`Invalid AnnotationEditor mode: ${E}`)}const v=this._scrollMode===G.PAGE?null:h,A=this.currentScale,w=f.getViewport({scale:A*$t.PDF_TO_CSS_UNITS});h.style.setProperty("--scale-factor",w.scale),l?.background&&h.style.setProperty("--page-bg-color",l.background),("CanvasText"===l?.foreground||"Canvas"===l?.background)&&(h.style.setProperty("--hcm-highlight-filter",t.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight")),h.style.setProperty("--hcm-highlight-selected-filter",t.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","ButtonText")));for(let E=1;E<=i;++E){const C=new vr({container:v,eventBus:a,id:E,scale:A,defaultViewport:w.clone(),optionalContentConfigPromise:s,renderingQueue:this.renderingQueue,textLayerMode:m,annotationMode:b,imageResourcesPath:this.imageResourcesPath,maxCanvasPixels:this.maxCanvasPixels,pageColors:l,l10n:this.l10n,layerProperties:this._layerProperties,enableHWA:this.#h});this._pages.push(C)}this._pages[0]?.setPdfPage(f),this._scrollMode===G.PAGE?this.#S():this._spreadMode!==mt.NONE&&this._updateSpreadMode(),this.#x(c).then((0,x.A)(function*(){if(t!==e.pdfDocument)return;if(e.findController?.setDocument(t),e._scriptingManager?.setDocument(t),e.#m&&document.addEventListener("copy",e.#T.bind(e,m),{signal:c}),e.#s&&a.dispatch("annotationeditormodechanged",{source:e,mode:e.#n}),t.loadingParams.disableAutoFetch||i>5e3)return void e._pagesCapability.resolve();let E=i-1;if(E<=0)e._pagesCapability.resolve();else for(let C=2;C<=i;++C){const M=t.getPage(C).then(T=>{const y=e._pages[C-1];y.pdfPage||y.setPdfPage(T),0===--E&&e._pagesCapability.resolve()},T=>{console.error(`Unable to get page ${C} to initialize viewer`,T),0===--E&&e._pagesCapability.resolve()});C%250==0&&(yield M)}})),a.dispatch("pagesinit",{source:this}),t.getMetadata().then(({info:E})=>{t===this.pdfDocument&&E.Language&&(h.lang=E.Language)}),this.defaultRenderingQueue&&this.update()}).catch(f=>{console.error("Unable to initialize viewer",f),this._pagesCapability.reject(f)})}setPageLabels(t){if(this.pdfDocument){t?Array.isArray(t)&&this.pdfDocument.numPages===t.length?this._pageLabels=t:(this._pageLabels=null,console.error("setPageLabels: Invalid page labels.")):this._pageLabels=null;for(let e=0,i=this._pages.length;e<i;e++)this._pages[e].setPageLabel(this._pageLabels?.[e]??null)}}_resetView(){this._pages=[],this._currentPageNumber=1,this._currentScale=0,this._currentScaleValue=null,this._pageLabels=null,this.#t=new Gc(10),this._location=null,this._pagesRotation=0,this._optionalContentConfigPromise=null,this._firstPageCapability=Promise.withResolvers(),this._onePageRenderedCapability=Promise.withResolvers(),this._pagesCapability=Promise.withResolvers(),this._scrollMode=G.VERTICAL,this._previousScrollMode=G.UNKNOWN,this._spreadMode=mt.NONE,this.#y={previousPageNumber:1,scrollDown:!0,pages:[]},this.#u?.abort(),this.#u=null,this.viewer.textContent="",this._updateScrollMode(),this.viewer.removeAttribute("lang"),this.#m?.remove(),this.#m=null,this.#V()}#S(){if(this._scrollMode!==G.PAGE)throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");const t=this._currentPageNumber,e=this.#y,i=this.viewer;if(i.textContent="",e.pages.length=0,this._spreadMode!==mt.NONE||this.isInPresentationMode){const n=new Set,s=this._spreadMode-1;-1===s?n.add(t-1):t%2!==s?(n.add(t-1),n.add(t)):(n.add(t-2),n.add(t-1));const r=document.createElement("div");if(r.className="spread",this.isInPresentationMode){const a=document.createElement("div");a.className="dummyPage",r.append(a)}for(const a of n){const l=this._pages[a];l&&(r.append(l.div),e.pages.push(l))}i.append(r)}else{const n=this._pages[t-1];i.append(n.div),e.pages.push(n)}e.scrollDown=t>=e.previousPageNumber,e.previousPageNumber=t}_scrollUpdate(){0!==this.pagesCount&&this.update()}#R(t,e=null){const{div:i,id:n}=t;if(this._currentPageNumber!==n&&this._setCurrentPageNumber(n),this._scrollMode===G.PAGE&&(this.#S(),this.update()),!e&&!this.isInPresentationMode){const s=i.offsetLeft+i.clientLeft,r=s+i.clientWidth,{scrollLeft:a,clientWidth:l}=this.container;(this._scrollMode===G.HORIZONTAL||s<a||r>a+l)&&(e={left:0,top:0})}Os(i,e),!this._currentScaleValue&&this._location&&(this._location=null)}#k(t){return t===this._currentScale||Math.abs(t-this._currentScale)<1e-15}#C(t,e,{noScroll:i=!1,preset:n=!1,drawingDelay:s=-1,origin:r=null}){if(this._currentScaleValue=e.toString(),this.#k(t))return void(n&&this.eventBus.dispatch("scalechanging",{source:this,scale:t,presetValue:e}));this.viewer.style.setProperty("--scale-factor",t*$t.PDF_TO_CSS_UNITS);const a=s>=0&&s<1e3;this.refresh(!0,{scale:t,drawingDelay:a?s:-1}),a&&(this.#w=setTimeout(()=>{this.#w=null,this.refresh()},s));const l=this._currentScale;if(this._currentScale=t,!i){let c,h=this._currentPageNumber;if(this._location&&!(this.isInPresentationMode||this.isChangingPresentationMode)&&(h=this._location.pageNumber,c=[null,{name:"XYZ"},this._location.left,this._location.top,null]),this.scrollPageIntoView({pageNumber:h,destArray:c,allowNegativeOffset:!0}),Array.isArray(r)){const d=t/l-1,[u,f]=this.containerTopLeft;this.container.scrollLeft+=(r[0]-f)*d,this.container.scrollTop+=(r[1]-u)*d}}this.eventBus.dispatch("scalechanging",{source:this,scale:t,presetValue:n?e:void 0}),this.defaultRenderingQueue&&this.update()}get#v(){return this._spreadMode!==mt.NONE&&this._scrollMode!==G.HORIZONTAL?2:1}#M(t,e){let i=parseFloat(t);if(i>0)e.preset=!1,this.#C(i,t,e);else{const n=this._pages[this._currentPageNumber-1];if(!n)return;let s=40,r=5;this.isInPresentationMode?(s=r=4,this._spreadMode!==mt.NONE&&(s*=2)):this.removePageBorders?s=r=0:this._scrollMode===G.HORIZONTAL&&([s,r]=[r,s]);const a=(this.container.clientWidth-s)/n.width*n.scale/this.#v,l=(this.container.clientHeight-r)/n.height*n.scale;switch(t){case"page-actual":i=1;break;case"page-width":i=a;break;case"page-height":i=l;break;case"page-fit":i=Math.min(a,l);break;case"auto":const h=Vs(n)?a:Math.min(l,a);i=Math.min(1.25,h);break;default:return void console.error(`#setScale: "${t}" is an unknown zoom value.`)}e.preset=!0,this.#C(i,t,e)}}#I(){const t=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&this.#M(this._currentScaleValue,{noScroll:!0}),this.#R(t)}pageLabelToPageNumber(t){if(!this._pageLabels)return null;const e=this._pageLabels.indexOf(t);return e<0?null:e+1}scrollPageIntoView({pageNumber:t,destArray:e=null,allowNegativeOffset:i=!1,ignoreDestinationZoom:n=!1}){if(!this.pdfDocument)return;const s=Number.isInteger(t)&&this._pages[t-1];if(!s)return void console.error(`scrollPageIntoView: "${t}" is not a valid pageNumber parameter.`);if(this.isInPresentationMode||!e)return void this._setCurrentPageNumber(t,!0);let c,d,r=0,a=0,l=0,h=0;const u=s.rotation%180!=0,f=(u?s.height:s.width)/s.scale/$t.PDF_TO_CSS_UNITS,p=(u?s.width:s.height)/s.scale/$t.PDF_TO_CSS_UNITS;let g=0;switch(e[1].name){case"XYZ":r=e[2],a=e[3],g=e[4],r=null!==r?r:0,a=null!==a?a:p;break;case"Fit":case"FitB":g="page-fit";break;case"FitH":case"FitBH":a=e[2],g="page-width",null===a&&this._location?(r=this._location.left,a=this._location.top):("number"!=typeof a||a<0)&&(a=p);break;case"FitV":case"FitBV":r=e[2],l=f,h=p,g="page-height";break;case"FitR":r=e[2],a=e[3],l=e[4]-r,h=e[5]-a;let A=40,w=5;this.removePageBorders&&(A=w=0),c=(this.container.clientWidth-A)/l/$t.PDF_TO_CSS_UNITS,d=(this.container.clientHeight-w)/h/$t.PDF_TO_CSS_UNITS,g=Math.min(Math.abs(c),Math.abs(d));break;default:return void console.error(`scrollPageIntoView: "${e[1].name}" is not a valid destination type.`)}if(n||(g&&g!==this._currentScale?this.currentScaleValue=g:0===this._currentScale&&(this.currentScaleValue="auto")),"page-fit"===g&&!e[4])return void this.#R(s);const b=[s.viewport.convertToViewportPoint(r,a),s.viewport.convertToViewportPoint(r+l,a+h)];let m=Math.min(b[0][0],b[1][0]),v=Math.min(b[0][1],b[1][1]);i||(m=Math.max(m,0),v=Math.max(v,0)),this.#R(s,{left:m,top:v})}_updateLocation(t){const e=this._currentScale,i=this._currentScaleValue,n=parseFloat(i)===e?Math.round(1e4*e)/100:i,s=t.id,a=this.container,l=this._pages[s-1].getPagePoint(a.scrollLeft-t.x,a.scrollTop-t.y),h=Math.round(l[0]),c=Math.round(l[1]);let d=`#page=${s}`;this.isInPresentationMode||(d+=`&zoom=${n},${h},${c}`),this._location={pageNumber:s,scale:n,top:c,left:h,rotation:this._pagesRotation,pdfOpenParams:d}}update(){const t=this._getVisiblePages(),e=t.views,i=e.length;if(0===i)return;const n=Math.max(10,2*i+1);this.#t.resize(n,t.ids),this.renderingQueue.renderHighestPriority(t);const s=this._spreadMode===mt.NONE&&(this._scrollMode===G.PAGE||this._scrollMode===G.VERTICAL),r=this._currentPageNumber;let a=!1;for(const l of e){if(l.percent<100)break;if(l.id===r&&s){a=!0;break}}this._setCurrentPageNumber(a?r:e[0].id),this._updateLocation(t.first),this.eventBus.dispatch("updateviewarea",{source:this,location:this._location})}#N(){const t=this._getVisiblePages(),e=[],{ids:i,views:n}=t;for(const s of n){const{view:r}=s;r.hasEditableAnnotations()?e.push(s):i.delete(r.id)}return 0===e.length?null:(this.renderingQueue.renderHighestPriority({first:e[0],last:e.at(-1),views:e,ids:i}),i)}containsElement(t){return this.container.contains(t)}focus(){this.container.focus()}get _isContainerRtl(){return"rtl"===getComputedStyle(this.container).direction}get isInPresentationMode(){return 3===this.presentationModeState}get isChangingPresentationMode(){return 2===this.presentationModeState}get isHorizontalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollHeight>this.container.clientHeight}_getVisiblePages(){const t=this._scrollMode===G.PAGE?this.#y.pages:this._pages,e=this._scrollMode===G.HORIZONTAL;return function $l({scrollEl:o,views:t,sortByVisibility:e=!1,horizontal:i=!1,rtl:n=!1}){const s=o.scrollTop,r=s+o.clientHeight,a=o.scrollLeft,l=a+o.clientWidth,d=[],u=new Set,f=t.length;let p=Ne(t,i?function c(v){const A=v.div,w=A.offsetLeft+A.clientLeft;return n?w<l:w+A.clientWidth>a}:function h(v){const A=v.div;return A.offsetTop+A.clientTop+A.clientHeight>s});p>0&&p<f&&!i&&(p=function Gl(o,t,e){if(o<2)return o;let i=t[o].div,n=i.offsetTop+i.clientTop;n>=e&&(i=t[o-1].div,n=i.offsetTop+i.clientTop);for(let s=o-2;s>=0&&(i=t[s].div,!(i.offsetTop+i.clientTop+i.clientHeight<=n));--s)o=s;return o}(p,t,s));let g=i?l:-1;for(let v=p;v<f;v++){const A=t[v],w=A.div,E=w.offsetLeft+w.clientLeft,C=w.offsetTop+w.clientTop,M=w.clientWidth,T=w.clientHeight,y=E+M,S=C+T;if(-1===g)S>=r&&(g=S);else if((i?E:C)>g)break;if(S<=s||C>=r||y<=a||E>=l)continue;const L=Math.max(0,s-C)+Math.max(0,S-r),W=(M-(Math.max(0,a-E)+Math.max(0,y-l)))/M;d.push({id:A.id,x:E,y:C,view:A,percent:(T-L)/T*W*100|0,widthPercent:100*W|0}),u.add(A.id)}const b=d[0],m=d.at(-1);return e&&d.sort(function(v,A){const w=v.percent-A.percent;return Math.abs(w)>.001?-w:v.id-A.id}),{first:b,last:m,views:d,ids:u}}({scrollEl:this.container,views:t,sortByVisibility:!0,horizontal:e,rtl:e&&this._isContainerRtl})}cleanup(){for(const t of this._pages)t.renderingState!==tt.FINISHED&&t.reset()}_cancelRendering(){for(const t of this._pages)t.cancelRendering()}#H(t){var e=this;return(0,x.A)(function*(){if(t.pdfPage)return t.pdfPage;try{const i=yield e.pdfDocument.getPage(t.id);return t.pdfPage||t.setPdfPage(i),i}catch(i){return console.error("Unable to get page for page view",i),null}})()}#j(t){if(1===t.first?.id)return!0;if(t.last?.id===this.pagesCount)return!1;switch(this._scrollMode){case G.PAGE:return this.#y.scrollDown;case G.HORIZONTAL:return this.scroll.right}return this.scroll.down}forceRendering(t){const e=t||this._getVisiblePages(),i=this.#j(e),s=this.renderingQueue.getHighestPriority(e,this._pages,i,this._spreadMode!==mt.NONE&&this._scrollMode!==G.HORIZONTAL);return!!s&&(this.#H(s).then(()=>{this.renderingQueue.renderView(s)}),!0)}get hasEqualPageSizes(){const t=this._pages[0];for(let e=1,i=this._pages.length;e<i;++e){const n=this._pages[e];if(n.width!==t.width||n.height!==t.height)return!1}return!0}getPagesOverview(){let t;return this._pages.map(e=>{const i=e.pdfPage.getViewport({scale:1}),n=Vs(i);if(void 0===t)t=n;else if(this.enablePrintAutoRotate&&n!==t)return{width:i.height,height:i.width,rotation:(i.rotation-90)%360};return{width:i.width,height:i.height,rotation:i.rotation}})}get optionalContentConfigPromise(){return this.pdfDocument?this._optionalContentConfigPromise?this._optionalContentConfigPromise:(console.error("optionalContentConfigPromise: Not initialized yet."),this.pdfDocument.getOptionalContentConfig({intent:"display"})):Promise.resolve(null)}set optionalContentConfigPromise(t){if(!(t instanceof Promise))throw new Error(`Invalid optionalContentConfigPromise: ${t}`);this.pdfDocument&&this._optionalContentConfigPromise&&(this._optionalContentConfigPromise=t,this.refresh(!1,{optionalContentConfigPromise:t}),this.eventBus.dispatch("optionalcontentconfigchanged",{source:this,promise:t}))}get scrollMode(){return this._scrollMode}set scrollMode(t){if(this._scrollMode!==t){if(!function Yl(o){return Number.isInteger(o)&&Object.values(G).includes(o)&&o!==G.UNKNOWN}(t))throw new Error(`Invalid scroll mode: ${t}`);this.pagesCount>1e4||(this._previousScrollMode=this._scrollMode,this._scrollMode=t,this.eventBus.dispatch("scrollmodechanged",{source:this,mode:t}),this._updateScrollMode(this._currentPageNumber))}}_updateScrollMode(t=null){const e=this._scrollMode,i=this.viewer;i.classList.toggle("scrollHorizontal",e===G.HORIZONTAL),i.classList.toggle("scrollWrapped",e===G.WRAPPED),this.pdfDocument&&t&&(e===G.PAGE?this.#S():this._previousScrollMode===G.PAGE&&this._updateSpreadMode(),this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#M(this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(t,!0),this.update())}get spreadMode(){return this._spreadMode}set spreadMode(t){if(this._spreadMode!==t){if(!function Kl(o){return Number.isInteger(o)&&Object.values(mt).includes(o)&&o!==mt.UNKNOWN}(t))throw new Error(`Invalid spread mode: ${t}`);this._spreadMode=t,this.eventBus.dispatch("spreadmodechanged",{source:this,mode:t}),this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(t=null){if(!this.pdfDocument)return;const e=this.viewer,i=this._pages;if(this._scrollMode===G.PAGE)this.#S();else if(e.textContent="",this._spreadMode===mt.NONE)for(const n of this._pages)e.append(n.div);else{const n=this._spreadMode-1;let s=null;for(let r=0,a=i.length;r<a;++r)null===s?(s=document.createElement("div"),s.className="spread",e.append(s)):r%2===n&&(s=s.cloneNode(!1),e.append(s)),s.append(i[r].div)}t&&(this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#M(this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(t,!0),this.update())}_getPageAdvance(t,e=!1){switch(this._scrollMode){case G.WRAPPED:{const{views:i}=this._getVisiblePages(),n=new Map;for(const{id:s,y:r,percent:a,widthPercent:l}of i){if(0===a||l<100)continue;let h=n.get(r);h||n.set(r,h||=[]),h.push(s)}for(const s of n.values()){const r=s.indexOf(t);if(-1===r)continue;const a=s.length;if(1===a)break;if(e)for(let l=r-1,h=0;l>=h;l--){const d=s[l+1]-1;if(s[l]<d)return t-d}else for(let l=r+1,h=a;l<h;l++){const d=s[l-1]+1;if(s[l]>d)return d-t}if(e){const l=s[0];if(l<t)return t-l+1}else{const l=s[a-1];if(l>t)return l-t+1}break}break}case G.HORIZONTAL:break;case G.PAGE:case G.VERTICAL:{if(this._spreadMode===mt.NONE)break;const i=this._spreadMode-1;if(e&&t%2!==i)break;if(!e&&t%2===i)break;const{views:n}=this._getVisiblePages(),s=e?t-1:t+1;for(const{id:r,percent:a,widthPercent:l}of n)if(r===s){if(a>0&&100===l)return 2;break}break}}return 1}nextPage(){const t=this._currentPageNumber,e=this.pagesCount;if(t>=e)return!1;const i=this._getPageAdvance(t,!1)||1;return this.currentPageNumber=Math.min(t+i,e),!0}previousPage(){const t=this._currentPageNumber;if(t<=1)return!1;const e=this._getPageAdvance(t,!0)||1;return this.currentPageNumber=Math.max(t-e,1),!0}updateScale({drawingDelay:t,scaleFactor:e=null,steps:i=null,origin:n}){if(null===i&&null===e)throw new Error("Invalid updateScale options: either `steps` or `scaleFactor` must be provided.");if(!this.pdfDocument)return;let s=this._currentScale;if(e>0&&1!==e)s=Math.round(s*e*100)/100;else if(i){const r=i>0?1.1:1/1.1,a=i>0?Math.ceil:Math.floor;i=Math.abs(i);do{s=a(10*(s*r).toFixed(2))/10}while(--i>0)}s=Math.max(.1,Math.min(10,s)),this.#M(s,{noScroll:!1,drawingDelay:t,origin:n})}increaseScale(t={}){this.updateScale({...t,steps:t.steps??1})}decreaseScale(t={}){this.updateScale({...t,steps:-(t.steps??1)})}#F(t=this.container.clientHeight){t!==this.#A&&(this.#A=t,ql.setProperty("--viewer-container-height",`${t}px`))}#B(t){for(const e of t)if(e.target===this.container){this.#F(Math.floor(e.borderBoxSize[0].blockSize)),this.#l=null;break}}get containerTopLeft(){return this.#l||=[this.container.offsetTop,this.container.offsetLeft]}#V(){this.#f?.abort(),this.#f=null,null!==this.#g&&(clearTimeout(this.#g),this.#g=null)}get annotationEditorMode(){return this.#s?this.#n:St.DISABLE}set annotationEditorMode({mode:t,editId:e=null,isFromKeyboard:i=!1}){if(!this.#s)throw new Error("The AnnotationEditor is not enabled.");if(this.#n===t)return;if(!yr(t))throw new Error(`Invalid AnnotationEditor mode: ${t}`);if(!this.pdfDocument)return;t===St.STAMP&&this.#p?.loadModel("altText");const{eventBus:n}=this,s=()=>{this.#V(),this.#n=t,this.#s.updateMode(t,e,i),n.dispatch("annotationeditormodechanged",{source:this,mode:t})};if(t===St.NONE||this.#n===St.NONE){const r=t!==St.NONE;r||this.pdfDocument.annotationStorage.resetModifiedIds();for(const l of this._pages)l.toggleEditingMode(r);const a=this.#N();if(r&&a){this.#V(),this.#f=new AbortController;const l=AbortSignal.any([this.#u.signal,this.#f.signal]);return void n._on("pagerendered",({pageNumber:h})=>{a.delete(h),0===a.size&&(this.#g=setTimeout(s,0))},{signal:l})}}s()}refresh(t=!1,e=Object.create(null)){if(this.pdfDocument){for(const i of this._pages)i.update(e);null!==this.#w&&(clearTimeout(this.#w),this.#w=null),t||this.update()}}}class $c extends wr{_resetView(){super._resetView(),this._scrollMode=G.PAGE,this._spreadMode=mt.NONE}set scrollMode(t){}_updateScrollMode(){}set spreadMode(t){}_updateSpreadMode(){}}var Xc=q.AnnotationLayerBuilder,Yc=q.DownloadManager,Kc=q.EventBus,qc=q.FindState,Er=q.GenericL10n,Ae=q.LinkTarget,xr=q.PDFFindController,Qc=q.PDFHistory,Cr=q.PDFLinkService,Zc=q.PDFPageView,Jc=q.PDFScriptingManager,Sr=q.PDFSinglePageViewer,Pr=q.PDFViewer,td=q.ProgressBar,ed=q.RenderingStates,id=q.ScrollMode,nd=q.SimpleLinkService,sd=q.SpreadMode,rd=q.StructTreeLayerBuilder,ad=q.TextLayerBuilder,od=q.XfaLayerBuilder,ld=q.parseQueryString;const hd=["pdfViewerContainer"];function wn(o,t,e){o[t]=e}function ze(){return typeof window>"u"}ze()||wn(wt,"verbosity",Ps.INFOS),typeof Promise.withResolvers>"u"&&window&&(window.Promise.withResolvers=()=>{let o,t;return{promise:new Promise((i,n)=>{o=i,t=n}),resolve:o,reject:t}});var En=function(o){return o[o.DISABLED=0]="DISABLED",o[o.ENABLED=1]="ENABLED",o[o.ENHANCED=2]="ENHANCED",o}(En||{});let ud=(()=>{class o{element;ngZone;static CSS_UNITS=96/72;static BORDER_WIDTH=9;pdfViewerContainer;eventBus;pdfLinkService;pdfFindController;pdfViewer;isVisible=!1;_cMapsUrl=`https://unpkg.com/pdfjs-dist@${oi}/cmaps/`;_imageResourcesPath=`https://unpkg.com/pdfjs-dist@${oi}/web/images/`;_renderText=!0;_renderTextMode=En.ENABLED;_stickToPage=!1;_originalSize=!0;_pdf;_page=1;_zoom=1;_zoomScale="page-width";_rotation=0;_showAll=!0;_canAutoResize=!0;_fitToPage=!1;_externalLinkTarget="blank";_showBorders=!1;lastLoaded;_latestScrolledPage;pageScrollTimeout=null;isInitialized=!1;loadingTask;destroy$=new Ur.B;afterLoadComplete=new R.bkB;pageRendered=new R.bkB;pageInitialized=new R.bkB;textLayerRendered=new R.bkB;onError=new R.bkB;onProgress=new R.bkB;pageChange=new R.bkB(!0);src;set cMapsUrl(e){this._cMapsUrl=e}set page(e){const i=e=parseInt(e,10)||1;this._pdf&&(e=this.getValidPageNumber(e)),this._page=e,i!==e&&this.pageChange.emit(e)}set renderText(e){this._renderText=e}set renderTextMode(e){this._renderTextMode=e}set originalSize(e){this._originalSize=e}set showAll(e){this._showAll=e}set stickToPage(e){this._stickToPage=e}set zoom(e){e<=0||(this._zoom=e)}get zoom(){return this._zoom}set zoomScale(e){this._zoomScale=e}get zoomScale(){return this._zoomScale}set rotation(e){"number"==typeof e&&e%90==0?this._rotation=e:console.warn("Invalid pages rotation angle.")}set externalLinkTarget(e){this._externalLinkTarget=e}set autoresize(e){this._canAutoResize=!!e}set fitToPage(e){this._fitToPage=!!e}set showBorders(e){this._showBorders=!!e}static getLinkTarget(e){switch(e){case"blank":return Ae.BLANK;case"none":return Ae.NONE;case"self":return Ae.SELF;case"parent":return Ae.PARENT;case"top":return Ae.TOP}return null}constructor(e,i){if(this.element=e,this.ngZone=i,ze())return;let n;const s=oi;n=window[`pdfWorkerSrc${s}`]||(window.hasOwnProperty("pdfWorkerSrc")&&"string"==typeof window.pdfWorkerSrc&&window.pdfWorkerSrc?window.pdfWorkerSrc:`https://cdn.jsdelivr.net/npm/pdfjs-dist@${s}/legacy/build/pdf.worker.min.mjs`),wn(Ss,"workerSrc",n)}ngAfterViewChecked(){if(this.isInitialized)return;const e=this.pdfViewerContainer.nativeElement.offsetParent;!0!==this.isVisible||null!=e?!1===this.isVisible&&null!=e&&(this.isVisible=!0,setTimeout(()=>{this.initialize(),this.ngOnChanges({src:this.src})})):this.isVisible=!1}ngOnInit(){this.initialize(),this.setupResizeListener()}ngOnDestroy(){this.clear(),this.destroy$.next(),this.loadingTask=null}ngOnChanges(e){if(!ze()&&this.isVisible)if("src"in e)this.loadPDF();else if(this._pdf){if(("renderText"in e||"showAll"in e)&&(this.setupViewer(),this.resetPdfDocument()),"page"in e){const{page:i}=e;if(i.currentValue===this._latestScrolledPage)return;this.pdfViewer.scrollPageIntoView({pageNumber:this._page})}this.update()}}updateSize(){(0,Pn.H)(this._pdf.getPage(this.pdfViewer.currentPageNumber)).pipe((0,J.Q)(this.destroy$)).subscribe({next:e=>{const i=this._rotation+e.rotate,n=e.getViewport({scale:this._zoom,rotation:i}).width*o.CSS_UNITS;let s=this._zoom,r=!0;if(!this._originalSize||this._fitToPage&&n>this.pdfViewerContainer.nativeElement.clientWidth){const a=e.getViewport({scale:1,rotation:i});s=this.getScale(a.width,a.height),r=!this._stickToPage}this.pdfViewer.currentScale=s,r&&this.pdfViewer.scrollPageIntoView({pageNumber:e.pageNumber,ignoreDestinationZoom:!0})}})}clear(){this.loadingTask&&!this.loadingTask.destroyed&&this.loadingTask.destroy(),this._pdf&&(this._latestScrolledPage=0,this._pdf.destroy(),this._pdf=void 0),this.pdfViewer&&this.pdfViewer.setDocument(null),this.pdfLinkService&&this.pdfLinkService.setDocument(null,null),this.pdfFindController&&this.pdfFindController.setDocument(null)}getPDFLinkServiceConfig(){const e=o.getLinkTarget(this._externalLinkTarget);return e?{externalLinkTarget:e}:{}}initEventBus(){this.eventBus=function cd(o,t){const e=new o.EventBus;return function dd(o,t){Z(o,"documentload").pipe((0,J.Q)(t)).subscribe(()=>{const e=document.createEvent("CustomEvent");e.initCustomEvent("documentload",!0,!0,{}),window.dispatchEvent(e)}),Z(o,"pagerendered").pipe((0,J.Q)(t)).subscribe(({pageNumber:e,cssTransform:i,source:n})=>{const s=document.createEvent("CustomEvent");s.initCustomEvent("pagerendered",!0,!0,{pageNumber:e,cssTransform:i}),n.div.dispatchEvent(s)}),Z(o,"textlayerrendered").pipe((0,J.Q)(t)).subscribe(({pageNumber:e,source:i})=>{const n=document.createEvent("CustomEvent");n.initCustomEvent("textlayerrendered",!0,!0,{pageNumber:e}),i.textLayerDiv?.dispatchEvent(n)}),Z(o,"pagechanging").pipe((0,J.Q)(t)).subscribe(({pageNumber:e,source:i})=>{const n=document.createEvent("UIEvents");n.initEvent("pagechanging",!0,!0),n.pageNumber=e,i.container.dispatchEvent(n)}),Z(o,"pagesinit").pipe((0,J.Q)(t)).subscribe(({source:e})=>{const i=document.createEvent("CustomEvent");i.initCustomEvent("pagesinit",!0,!0,null),e.container.dispatchEvent(i)}),Z(o,"pagesloaded").pipe((0,J.Q)(t)).subscribe(({pagesCount:e,source:i})=>{const n=document.createEvent("CustomEvent");n.initCustomEvent("pagesloaded",!0,!0,{pagesCount:e}),i.container.dispatchEvent(n)}),Z(o,"scalechange").pipe((0,J.Q)(t)).subscribe(({scale:e,presetValue:i,source:n})=>{const s=document.createEvent("UIEvents");s.initEvent("scalechange",!0,!0),s.scale=e,s.presetValue=i,n.container.dispatchEvent(s)}),Z(o,"updateviewarea").pipe((0,J.Q)(t)).subscribe(({location:e,source:i})=>{const n=document.createEvent("UIEvents");n.initEvent("updateviewarea",!0,!0),n.location=e,i.container.dispatchEvent(n)}),Z(o,"find").pipe((0,J.Q)(t)).subscribe(({source:e,type:i,query:n,phraseSearch:s,caseSensitive:r,highlightAll:a,findPrevious:l})=>{if(e===window)return;const h=document.createEvent("CustomEvent");h.initCustomEvent("find"+i,!0,!0,{query:n,phraseSearch:s,caseSensitive:r,highlightAll:a,findPrevious:l}),window.dispatchEvent(h)}),Z(o,"attachmentsloaded").pipe((0,J.Q)(t)).subscribe(({attachmentsCount:e,source:i})=>{const n=document.createEvent("CustomEvent");n.initCustomEvent("attachmentsloaded",!0,!0,{attachmentsCount:e}),i.container.dispatchEvent(n)}),Z(o,"sidebarviewchanged").pipe((0,J.Q)(t)).subscribe(({view:e,source:i})=>{const n=document.createEvent("CustomEvent");n.initCustomEvent("sidebarviewchanged",!0,!0,{view:e}),i.outerContainer.dispatchEvent(n)}),Z(o,"pagemode").pipe((0,J.Q)(t)).subscribe(({mode:e,source:i})=>{const n=document.createEvent("CustomEvent");n.initCustomEvent("pagemode",!0,!0,{mode:e}),i.pdfViewer.container.dispatchEvent(n)}),Z(o,"namedaction").pipe((0,J.Q)(t)).subscribe(({action:e,source:i})=>{const n=document.createEvent("CustomEvent");n.initCustomEvent("namedaction",!0,!0,{action:e}),i.pdfViewer.container.dispatchEvent(n)}),Z(o,"presentationmodechanged").pipe((0,J.Q)(t)).subscribe(({active:e,switchInProgress:i})=>{const n=document.createEvent("CustomEvent");n.initCustomEvent("presentationmodechanged",!0,!0,{active:e,switchInProgress:i}),window.dispatchEvent(n)}),Z(o,"outlineloaded").pipe((0,J.Q)(t)).subscribe(({outlineCount:e,source:i})=>{const n=document.createEvent("CustomEvent");n.initCustomEvent("outlineloaded",!0,!0,{outlineCount:e}),i.container.dispatchEvent(n)})}(e,t),e}(ee,this.destroy$),Z(this.eventBus,"pagerendered").pipe((0,J.Q)(this.destroy$)).subscribe(e=>{this.pageRendered.emit(e)}),Z(this.eventBus,"pagesinit").pipe((0,J.Q)(this.destroy$)).subscribe(e=>{this.pageInitialized.emit(e)}),Z(this.eventBus,"pagechanging").pipe((0,J.Q)(this.destroy$)).subscribe(({pageNumber:e})=>{this.pageScrollTimeout&&clearTimeout(this.pageScrollTimeout),this.pageScrollTimeout=window.setTimeout(()=>{this._latestScrolledPage=e,this.pageChange.emit(e)},100)}),Z(this.eventBus,"textlayerrendered").pipe((0,J.Q)(this.destroy$)).subscribe(e=>{this.textLayerRendered.emit(e)})}initPDFServices(){this.pdfLinkService=new Cr({eventBus:this.eventBus,...this.getPDFLinkServiceConfig()}),this.pdfFindController=new xr({eventBus:this.eventBus,linkService:this.pdfLinkService})}getPDFOptions(){return{eventBus:this.eventBus,container:this.element.nativeElement.querySelector("div"),removePageBorders:!this._showBorders,linkService:this.pdfLinkService,textLayerMode:this._renderText?this._renderTextMode:En.DISABLED,findController:this.pdfFindController,l10n:new Er("en"),imageResourcesPath:this._imageResourcesPath,annotationEditorMode:Cs.DISABLE}}setupViewer(){this.pdfViewer&&this.pdfViewer.setDocument(null),wn(wt,"disableTextLayer",!this._renderText),this.initPDFServices(),this.pdfViewer=this._showAll?new Pr(this.getPDFOptions()):new Sr(this.getPDFOptions()),this.pdfLinkService.setViewer(this.pdfViewer),this.pdfViewer._currentPageNumber=this._page}getValidPageNumber(e){return e<1?1:e>this._pdf.numPages?this._pdf.numPages:e}getDocumentParams(){const e=typeof this.src;if(!this._cMapsUrl)return this.src;const i={cMapUrl:this._cMapsUrl,cMapPacked:!0,enableXfa:!0,isEvalSupported:!1};return"string"===e?i.url=this.src:"object"===e&&(void 0!==this.src.byteLength?i.data=this.src:Object.assign(i,this.src)),i}loadPDF(){if(!this.src)return;if(this.lastLoaded===this.src)return void this.update();this.clear(),this.setupViewer(),this.loadingTask=Ts(this.getDocumentParams()),this.loadingTask.onProgress=i=>{this.onProgress.emit(i)};const e=this.src;(0,Pn.H)(this.loadingTask.promise).pipe((0,J.Q)(this.destroy$)).subscribe({next:i=>{this._pdf=i,this.lastLoaded=e,this.afterLoadComplete.emit(i),this.resetPdfDocument(),this.update()},error:i=>{this.lastLoaded=null,this.onError.emit(i)}})}update(){this.page=this._page,this.render()}render(){if(this._page=this.getValidPageNumber(this._page),(0!==this._rotation||this.pdfViewer.pagesRotation!==this._rotation)&&this.pdfViewer.firstPagePromise?.then(()=>this.pdfViewer.pagesRotation=this._rotation),this._stickToPage&&setTimeout(()=>{this.pdfViewer.currentPageNumber=this._page}),this.pdfViewer._pages?.length)this.updateSize();else{const e=this.pageInitialized.subscribe(()=>{this.updateSize(),e.unsubscribe()})}}getScale(e,i){const n=this._showBorders?2*o.BORDER_WIDTH:0,s=this.pdfViewerContainer.nativeElement.clientWidth-n,r=this.pdfViewerContainer.nativeElement.clientHeight-n;if(0===r||0===i||0===s||0===e)return 1;let a=1;switch(this._zoomScale){case"page-fit":a=Math.min(r/i,s/e);break;case"page-height":a=r/i;break;default:a=s/e}return this._zoom*a/o.CSS_UNITS}resetPdfDocument(){this.pdfLinkService.setDocument(this._pdf,null),this.pdfFindController.setDocument(this._pdf),this.pdfViewer.setDocument(this._pdf)}initialize(){ze()||!this.isVisible||(this.isInitialized=!0,this.initEventBus(),this.setupViewer())}setupResizeListener(){ze()||this.ngZone.runOutsideAngular(()=>{Z(window,"resize").pipe(function Yr(o,t=Gr.E){return(0,$r.N)((e,i)=>{let n=null,s=null,r=null;const a=()=>{if(n){n.unsubscribe(),n=null;const h=s;s=null,i.next(h)}};function l(){const h=r+o,c=t.now();if(c<h)return n=this.schedule(void 0,h-c),void i.add(n);a()}e.subscribe((0,Xr._)(i,h=>{s=h,r=t.now(),n||(n=t.schedule(l,o),i.add(n))},()=>{a(),i.complete()},void 0,()=>{s=n=null}))})}(100),(0,Kr.p)(()=>this._canAutoResize&&!!this._pdf),(0,J.Q)(this.destroy$)).subscribe(()=>{this.updateSize()})})}static \u0275fac=function(i){return new(i||o)(_.rXU(_.aKT),_.rXU(R.SKi))};static \u0275cmp=_.VBU({type:o,selectors:[["pdf-viewer"]],viewQuery:function(i,n){if(1&i&&_.GBs(hd,5),2&i){let s;_.mGM(s=_.lsd())&&(n.pdfViewerContainer=s.first)}},inputs:{src:"src",cMapsUrl:[0,"c-maps-url","cMapsUrl"],page:"page",renderText:[0,"render-text","renderText"],renderTextMode:[0,"render-text-mode","renderTextMode"],originalSize:[0,"original-size","originalSize"],showAll:[0,"show-all","showAll"],stickToPage:[0,"stick-to-page","stickToPage"],zoom:"zoom",zoomScale:[0,"zoom-scale","zoomScale"],rotation:"rotation",externalLinkTarget:[0,"external-link-target","externalLinkTarget"],autoresize:"autoresize",fitToPage:[0,"fit-to-page","fitToPage"],showBorders:[0,"show-borders","showBorders"]},outputs:{afterLoadComplete:"after-load-complete",pageRendered:"page-rendered",pageInitialized:"pages-initialized",textLayerRendered:"text-layer-rendered",onError:"error",onProgress:"on-progress",pageChange:"pageChange"},standalone:!1,features:[_.OA$],decls:3,vars:0,consts:[["pdfViewerContainer",""],[1,"ng2-pdf-viewer-container"],[1,"pdfViewer"]],template:function(i,n){1&i&&(_.j41(0,"div",1,0),_.nrm(2,"div",2),_.k0s())},styles:['.ng2-pdf-viewer-container[_ngcontent-%COMP%]{overflow-x:auto;position:absolute;height:100%;width:100%;-webkit-overflow-scrolling:touch}[_nghost-%COMP%]{display:block;position:relative}[_nghost-%COMP%] {--pdfViewer-padding-bottom: 0;--page-margin: 1px auto -8px;--page-border: 9px solid transparent;--spreadHorizontalWrapped-margin-LR: -3.5px;--viewer-container-height: 0;--annotation-unfocused-field-background: url("data:image/svg+xml;charset=UTF-8,<svg width=\'1px\' height=\'1px\' xmlns=\'http://www.w3.org/2000/svg\'><rect width=\'100%\' height=\'100%\' style=\'fill:rgba(0, 54, 255, 0.13);\'/></svg>");--xfa-unfocused-field-background: var( --annotation-unfocused-field-background );--page-border-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAA1ElEQVQ4jbWUWw6EIAxFy2NFs/8NzR4UJhpqLsdi5mOmSSMUOfYWqv3S0gMr4XlYH/64gZa/gN3ANYA7KAXALt4ktoQ5MI9YxqaG8bWmsIysMuT6piSQCa4whZThCu8CM4zP9YJaKci9jicPq3NcBWYoPMGUlhG7ivtkB+gVyFY75wXghOvh8t5mto1Mdim6e+MBqH6XsY+YAwjpq3vGF7weTWQptLEDVCZvPTMl5JZZsdh47FHW6qFMyvLYqjcnmdFfY9Xk/KDOlzCusX2mi/ofM7MPkzBcSp4Q1/wAAAAASUVORK5CYII=) 9 9 repeat;--scale-factor: 1;--focus-outline: solid 2px blue;--hover-outline: dashed 2px blue;--freetext-line-height: 1.35;--freetext-padding: 2px;--editorInk-editing-cursor: pointer}@media screen and (forced-colors: active){[_nghost-%COMP%] {--pdfViewer-padding-bottom: 9px;--page-margin: 8px auto -1px;--page-border: 1px solid CanvasText;--page-border-image: none;--spreadHorizontalWrapped-margin-LR: 3.5px}}@media (forced-colors: active){[_nghost-%COMP%] {--focus-outline: solid 3px ButtonText;--hover-outline: dashed 3px ButtonText}}[_nghost-%COMP%] .textLayer{position:absolute;text-align:initial;inset:0;overflow:hidden;opacity:.2;line-height:1;-webkit-text-size-adjust:none;text-size-adjust:none;forced-color-adjust:none;transform-origin:0 0}[_nghost-%COMP%] .textLayer span, [_nghost-%COMP%] .textLayer br{color:transparent;position:absolute;white-space:pre;cursor:text;transform-origin:0% 0%}[_nghost-%COMP%] .textLayer span.markedContent{top:0;height:0}[_nghost-%COMP%] .textLayer .highlight{margin:-1px;padding:1px;background-color:#b400aa;border-radius:4px}[_nghost-%COMP%] .textLayer .highlight.appended{position:initial}[_nghost-%COMP%] .textLayer .highlight.begin{border-radius:4px 0 0 4px}[_nghost-%COMP%] .textLayer .highlight.end{border-radius:0 4px 4px 0}[_nghost-%COMP%] .textLayer .highlight.middle{border-radius:0}[_nghost-%COMP%] .textLayer .highlight.selected{background-color:#006400}[_nghost-%COMP%] .textLayer ::selection{background:rgb(0,0,255)}[_nghost-%COMP%] .textLayer br::selection{background:transparent}[_nghost-%COMP%] .textLayer .endOfContent{display:block;position:absolute;inset:100% 0 0;z-index:-1;cursor:default;-webkit-user-select:none;user-select:none}[_nghost-%COMP%] .textLayer .endOfContent.active{top:0}@media (forced-colors: active){[_nghost-%COMP%] .annotationLayer .textWidgetAnnotation input:required, [_nghost-%COMP%] .annotationLayer .textWidgetAnnotation textarea:required, [_nghost-%COMP%] .annotationLayer .choiceWidgetAnnotation select:required, [_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.checkBox input:required, [_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.radioButton input:required{outline:1.5px solid selectedItem}}[_nghost-%COMP%] .annotationLayer{position:absolute;top:0;left:0;pointer-events:none;transform-origin:0 0}[_nghost-%COMP%] .annotationLayer section{position:absolute;text-align:initial;pointer-events:auto;box-sizing:border-box;transform-origin:0 0}[_nghost-%COMP%] .annotationLayer .linkAnnotation>a, [_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.pushButton>a{position:absolute;font-size:1em;top:0;left:0;width:100%;height:100%}[_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.pushButton>canvas{width:100%;height:100%}[_nghost-%COMP%] .annotationLayer .linkAnnotation>a:hover, [_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.pushButton>a:hover{opacity:.2;background:rgb(255,255,0);box-shadow:0 2px 10px #ff0}[_nghost-%COMP%] .annotationLayer .textAnnotation img{position:absolute;cursor:pointer;width:100%;height:100%}[_nghost-%COMP%] .annotationLayer .textWidgetAnnotation input, [_nghost-%COMP%] .annotationLayer .textWidgetAnnotation textarea, [_nghost-%COMP%] .annotationLayer .choiceWidgetAnnotation select, [_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.checkBox input, [_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.radioButton input{background-image:var(--annotation-unfocused-field-background);border:1px solid transparent;box-sizing:border-box;font:calc(9px * var(--scale-factor)) sans-serif;height:100%;margin:0;vertical-align:top;width:100%}[_nghost-%COMP%] .annotationLayer .textWidgetAnnotation input:required, [_nghost-%COMP%] .annotationLayer .textWidgetAnnotation textarea:required, [_nghost-%COMP%] .annotationLayer .choiceWidgetAnnotation select:required, [_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.checkBox input:required, [_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.radioButton input:required{outline:1.5px solid red}[_nghost-%COMP%] .annotationLayer .choiceWidgetAnnotation select option{padding:0}[_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.radioButton input{border-radius:50%}[_nghost-%COMP%] .annotationLayer .textWidgetAnnotation textarea{resize:none}[_nghost-%COMP%] .annotationLayer .textWidgetAnnotation input[disabled], [_nghost-%COMP%] .annotationLayer .textWidgetAnnotation textarea[disabled], [_nghost-%COMP%] .annotationLayer .choiceWidgetAnnotation select[disabled], [_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.checkBox input[disabled], [_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.radioButton input[disabled]{background:none;border:1px solid transparent;cursor:not-allowed}[_nghost-%COMP%] .annotationLayer .textWidgetAnnotation input:hover, [_nghost-%COMP%] .annotationLayer .textWidgetAnnotation textarea:hover, [_nghost-%COMP%] .annotationLayer .choiceWidgetAnnotation select:hover, [_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.checkBox input:hover, [_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.radioButton input:hover{border:1px solid rgb(0,0,0)}[_nghost-%COMP%] .annotationLayer .textWidgetAnnotation input:focus, [_nghost-%COMP%] .annotationLayer .textWidgetAnnotation textarea:focus, [_nghost-%COMP%] .annotationLayer .choiceWidgetAnnotation select:focus{background:none;border:1px solid transparent}[_nghost-%COMP%] .annotationLayer .textWidgetAnnotation input :focus, [_nghost-%COMP%] .annotationLayer .textWidgetAnnotation textarea :focus, [_nghost-%COMP%] .annotationLayer .choiceWidgetAnnotation select :focus, [_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.checkBox :focus, [_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.radioButton :focus{background-image:none;background-color:transparent;outline:auto}[_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before, [_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after, [_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.radioButton input:checked:before{background-color:CanvasText;content:"";display:block;position:absolute}[_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before, [_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after{height:80%;left:45%;width:1px}[_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before{transform:rotate(45deg)}[_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after{transform:rotate(-45deg)}[_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.radioButton input:checked:before{border-radius:50%;height:50%;left:30%;top:20%;width:50%}[_nghost-%COMP%] .annotationLayer .textWidgetAnnotation input.comb{font-family:monospace;padding-left:2px;padding-right:0}[_nghost-%COMP%] .annotationLayer .textWidgetAnnotation input.comb:focus{width:103%}[_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.checkBox input, [_nghost-%COMP%] .annotationLayer .buttonWidgetAnnotation.radioButton input{-webkit-appearance:none;appearance:none}[_nghost-%COMP%] .annotationLayer .popupTriggerArea{height:100%;width:100%}[_nghost-%COMP%] .annotationLayer .popupWrapper{position:absolute;font-size:calc(9px * var(--scale-factor));width:100%;min-width:calc(180px * var(--scale-factor));pointer-events:none}[_nghost-%COMP%] .annotationLayer .popup{position:absolute;max-width:calc(180px * var(--scale-factor));background-color:#ff9;box-shadow:0 calc(2px * var(--scale-factor)) calc(5px * var(--scale-factor)) #888;border-radius:calc(2px * var(--scale-factor));padding:calc(6px * var(--scale-factor));margin-left:calc(5px * var(--scale-factor));cursor:pointer;font:message-box;white-space:normal;word-wrap:break-word;pointer-events:auto}[_nghost-%COMP%] .annotationLayer .popup>*{font-size:calc(9px * var(--scale-factor))}[_nghost-%COMP%] .annotationLayer .popup h1{display:inline-block}[_nghost-%COMP%] .annotationLayer .popupDate{display:inline-block;margin-left:calc(5px * var(--scale-factor))}[_nghost-%COMP%] .annotationLayer .popupContent{border-top:1px solid rgb(51,51,51);margin-top:calc(2px * var(--scale-factor));padding-top:calc(2px * var(--scale-factor))}[_nghost-%COMP%] .annotationLayer .richText>*{white-space:pre-wrap;font-size:calc(9px * var(--scale-factor))}[_nghost-%COMP%] .annotationLayer .highlightAnnotation, [_nghost-%COMP%] .annotationLayer .underlineAnnotation, [_nghost-%COMP%] .annotationLayer .squigglyAnnotation, [_nghost-%COMP%] .annotationLayer .strikeoutAnnotation, [_nghost-%COMP%] .annotationLayer .freeTextAnnotation, [_nghost-%COMP%] .annotationLayer .lineAnnotation svg line, [_nghost-%COMP%] .annotationLayer .squareAnnotation svg rect, [_nghost-%COMP%] .annotationLayer .circleAnnotation svg ellipse, [_nghost-%COMP%] .annotationLayer .polylineAnnotation svg polyline, [_nghost-%COMP%] .annotationLayer .polygonAnnotation svg polygon, [_nghost-%COMP%] .annotationLayer .caretAnnotation, [_nghost-%COMP%] .annotationLayer .inkAnnotation svg polyline, [_nghost-%COMP%] .annotationLayer .stampAnnotation, [_nghost-%COMP%] .annotationLayer .fileAttachmentAnnotation{cursor:pointer}[_nghost-%COMP%] .annotationLayer section svg{position:absolute;width:100%;height:100%}[_nghost-%COMP%] .annotationLayer .annotationTextContent{position:absolute;width:100%;height:100%;opacity:0;color:transparent;-webkit-user-select:none;user-select:none;pointer-events:none}[_nghost-%COMP%] .annotationLayer .annotationTextContent span{width:100%;display:inline-block}@media (forced-colors: active){[_nghost-%COMP%] .xfaLayer *:required{outline:1.5px solid selectedItem}}[_nghost-%COMP%] .xfaLayer .highlight{margin:-1px;padding:1px;background-color:#efcbed;border-radius:4px}[_nghost-%COMP%] .xfaLayer .highlight.appended{position:initial}[_nghost-%COMP%] .xfaLayer .highlight.begin{border-radius:4px 0 0 4px}[_nghost-%COMP%] .xfaLayer .highlight.end{border-radius:0 4px 4px 0}[_nghost-%COMP%] .xfaLayer .highlight.middle{border-radius:0}[_nghost-%COMP%] .xfaLayer .highlight.selected{background-color:#cbdfcb}[_nghost-%COMP%] .xfaLayer ::selection{background:rgb(0,0,255)}[_nghost-%COMP%] .xfaPage{overflow:hidden;position:relative}[_nghost-%COMP%] .xfaContentarea{position:absolute}[_nghost-%COMP%] .xfaPrintOnly{display:none}[_nghost-%COMP%] .xfaLayer{position:absolute;text-align:initial;top:0;left:0;transform-origin:0 0;line-height:1.2}[_nghost-%COMP%] .xfaLayer *{color:inherit;font:inherit;font-style:inherit;font-weight:inherit;font-kerning:inherit;letter-spacing:-.01px;text-align:inherit;text-decoration:inherit;box-sizing:border-box;background-color:transparent;padding:0;margin:0;pointer-events:auto;line-height:inherit}[_nghost-%COMP%] .xfaLayer *:required{outline:1.5px solid red}[_nghost-%COMP%] .xfaLayer div{pointer-events:none}[_nghost-%COMP%] .xfaLayer svg{pointer-events:none}[_nghost-%COMP%] .xfaLayer svg *{pointer-events:none}[_nghost-%COMP%] .xfaLayer a{color:#00f}[_nghost-%COMP%] .xfaRich li{margin-left:3em}[_nghost-%COMP%] .xfaFont{color:#000;font-weight:400;font-kerning:none;font-size:10px;font-style:normal;letter-spacing:0;text-decoration:none;vertical-align:0}[_nghost-%COMP%] .xfaCaption{overflow:hidden;flex:0 0 auto}[_nghost-%COMP%] .xfaCaptionForCheckButton{overflow:hidden;flex:1 1 auto}[_nghost-%COMP%] .xfaLabel{height:100%;width:100%}[_nghost-%COMP%] .xfaLeft{display:flex;flex-direction:row;align-items:center}[_nghost-%COMP%] .xfaRight{display:flex;flex-direction:row-reverse;align-items:center}[_nghost-%COMP%] .xfaLeft>.xfaCaption, [_nghost-%COMP%] .xfaLeft>.xfaCaptionForCheckButton, [_nghost-%COMP%] .xfaRight>.xfaCaption, [_nghost-%COMP%] .xfaRight>.xfaCaptionForCheckButton{max-height:100%}[_nghost-%COMP%] .xfaTop{display:flex;flex-direction:column;align-items:flex-start}[_nghost-%COMP%] .xfaBottom{display:flex;flex-direction:column-reverse;align-items:flex-start}[_nghost-%COMP%] .xfaTop>.xfaCaption, [_nghost-%COMP%] .xfaTop>.xfaCaptionForCheckButton, [_nghost-%COMP%] .xfaBottom>.xfaCaption, [_nghost-%COMP%] .xfaBottom>.xfaCaptionForCheckButton{width:100%}[_nghost-%COMP%] .xfaBorder{background-color:transparent;position:absolute;pointer-events:none}[_nghost-%COMP%] .xfaWrapped{width:100%;height:100%}[_nghost-%COMP%] .xfaTextfield:focus, [_nghost-%COMP%] .xfaSelect:focus{background-image:none;background-color:transparent;outline:auto;outline-offset:-1px}[_nghost-%COMP%] .xfaCheckbox:focus, [_nghost-%COMP%] .xfaRadio:focus{outline:auto}[_nghost-%COMP%] .xfaTextfield, [_nghost-%COMP%] .xfaSelect{height:100%;width:100%;flex:1 1 auto;border:none;resize:none;background-image:var(--xfa-unfocused-field-background)}[_nghost-%COMP%] .xfaTop>.xfaTextfield, [_nghost-%COMP%] .xfaTop>.xfaSelect, [_nghost-%COMP%] .xfaBottom>.xfaTextfield, [_nghost-%COMP%] .xfaBottom>.xfaSelect{flex:0 1 auto}[_nghost-%COMP%] .xfaButton{cursor:pointer;width:100%;height:100%;border:none;text-align:center}[_nghost-%COMP%] .xfaLink{width:100%;height:100%;position:absolute;top:0;left:0}[_nghost-%COMP%] .xfaCheckbox, [_nghost-%COMP%] .xfaRadio{width:100%;height:100%;flex:0 0 auto;border:none}[_nghost-%COMP%] .xfaRich{white-space:pre-wrap;width:100%;height:100%}[_nghost-%COMP%] .xfaImage{object-position:left top;object-fit:contain;width:100%;height:100%}[_nghost-%COMP%] .xfaLrTb, [_nghost-%COMP%] .xfaRlTb, [_nghost-%COMP%] .xfaTb{display:flex;flex-direction:column;align-items:stretch}[_nghost-%COMP%] .xfaLr{display:flex;flex-direction:row;align-items:stretch}[_nghost-%COMP%] .xfaRl{display:flex;flex-direction:row-reverse;align-items:stretch}[_nghost-%COMP%] .xfaTb>div{justify-content:left}[_nghost-%COMP%] .xfaPosition{position:relative}[_nghost-%COMP%] .xfaArea{position:relative}[_nghost-%COMP%] .xfaValignMiddle{display:flex;align-items:center}[_nghost-%COMP%] .xfaTable{display:flex;flex-direction:column;align-items:stretch}[_nghost-%COMP%] .xfaTable .xfaRow{display:flex;flex-direction:row;align-items:stretch}[_nghost-%COMP%] .xfaTable .xfaRlRow{display:flex;flex-direction:row-reverse;align-items:stretch;flex:1}[_nghost-%COMP%] .xfaTable .xfaRlRow>div{flex:1}[_nghost-%COMP%] .xfaNonInteractive input, [_nghost-%COMP%] .xfaNonInteractive textarea, [_nghost-%COMP%] .xfaDisabled input, [_nghost-%COMP%] .xfaDisabled textarea, [_nghost-%COMP%] .xfaReadOnly input, [_nghost-%COMP%] .xfaReadOnly textarea{background:initial}@media print{[_nghost-%COMP%] .xfaTextfield, [_nghost-%COMP%] .xfaSelect{background:transparent}[_nghost-%COMP%] .xfaSelect{-webkit-appearance:none;appearance:none;text-indent:1px;text-overflow:""}}[_nghost-%COMP%] [data-editor-rotation="90"]{transform:rotate(90deg)}[_nghost-%COMP%] [data-editor-rotation="180"]{transform:rotate(180deg)}[_nghost-%COMP%] [data-editor-rotation="270"]{transform:rotate(270deg)}[_nghost-%COMP%] .annotationEditorLayer{background:transparent;position:absolute;top:0;left:0;font-size:calc(100px * var(--scale-factor));transform-origin:0 0}[_nghost-%COMP%] .annotationEditorLayer .selectedEditor{outline:var(--focus-outline);resize:none}[_nghost-%COMP%] .annotationEditorLayer .freeTextEditor{position:absolute;background:transparent;border-radius:3px;padding:calc(var(--freetext-padding) * var(--scale-factor));resize:none;width:auto;height:auto;z-index:1;transform-origin:0 0;touch-action:none}[_nghost-%COMP%] .annotationEditorLayer .freeTextEditor .internal{background:transparent;border:none;top:0;left:0;overflow:visible;white-space:nowrap;resize:none;font:10px sans-serif;line-height:var(--freetext-line-height)}[_nghost-%COMP%] .annotationEditorLayer .freeTextEditor .overlay{position:absolute;display:none;background:transparent;top:0;left:0;width:100%;height:100%}[_nghost-%COMP%] .annotationEditorLayer .freeTextEditor .overlay.enabled{display:block}[_nghost-%COMP%] .annotationEditorLayer .freeTextEditor .internal:empty:before{content:attr(default-content);color:gray}[_nghost-%COMP%] .annotationEditorLayer .freeTextEditor .internal:focus{outline:none}[_nghost-%COMP%] .annotationEditorLayer .inkEditor.disabled{resize:none}[_nghost-%COMP%] .annotationEditorLayer .inkEditor.disabled.selectedEditor{resize:horizontal}[_nghost-%COMP%] .annotationEditorLayer .freeTextEditor:hover:not(.selectedEditor), [_nghost-%COMP%] .annotationEditorLayer .inkEditor:hover:not(.selectedEditor){outline:var(--hover-outline)}[_nghost-%COMP%] .annotationEditorLayer .inkEditor{position:absolute;background:transparent;border-radius:3px;overflow:auto;width:100%;height:100%;z-index:1;transform-origin:0 0;cursor:auto}[_nghost-%COMP%] .annotationEditorLayer .inkEditor.editing{resize:none;cursor:var(--editorInk-editing-cursor),pointer}[_nghost-%COMP%] .annotationEditorLayer .inkEditor .inkEditorCanvas{position:absolute;top:0;left:0;width:100%;height:100%;touch-action:none}[_nghost-%COMP%] [data-main-rotation="90"]{transform:rotate(90deg) translateY(-100%)}[_nghost-%COMP%] [data-main-rotation="180"]{transform:rotate(180deg) translate(-100%,-100%)}[_nghost-%COMP%] [data-main-rotation="270"]{transform:rotate(270deg) translate(-100%)}[_nghost-%COMP%] .pdfViewer{padding-bottom:var(--pdfViewer-padding-bottom)}[_nghost-%COMP%] .pdfViewer .canvasWrapper{overflow:hidden}[_nghost-%COMP%] .pdfViewer .canvasWrapper canvas{width:100%}[_nghost-%COMP%] .pdfViewer .page{direction:ltr;width:816px;height:1056px;margin:var(--page-margin);position:relative;overflow:visible;border:var(--page-border);border-image:var(--page-border-image);background-clip:content-box;background-color:#fff}[_nghost-%COMP%] .pdfViewer .dummyPage{position:relative;width:0;height:var(--viewer-container-height)}[_nghost-%COMP%] .pdfViewer.removePageBorders .page{margin:0 auto 10px;border:none}[_nghost-%COMP%] .pdfViewer.singlePageView{display:inline-block}[_nghost-%COMP%] .pdfViewer.singlePageView .page{margin:0;border:none}[_nghost-%COMP%] .pdfViewer.scrollHorizontal, [_nghost-%COMP%] .pdfViewer.scrollWrapped, [_nghost-%COMP%] .spread{margin-left:3.5px;margin-right:3.5px;text-align:center}[_nghost-%COMP%] .pdfViewer.scrollHorizontal, [_nghost-%COMP%] .spread{white-space:nowrap}[_nghost-%COMP%] .pdfViewer.removePageBorders, [_nghost-%COMP%] .pdfViewer.scrollHorizontal .spread, [_nghost-%COMP%] .pdfViewer.scrollWrapped .spread{margin-left:0;margin-right:0}[_nghost-%COMP%] .spread .page, [_nghost-%COMP%] .spread .dummyPage, [_nghost-%COMP%] .pdfViewer.scrollHorizontal .page, [_nghost-%COMP%] .pdfViewer.scrollWrapped .page, [_nghost-%COMP%] .pdfViewer.scrollHorizontal .spread, [_nghost-%COMP%] .pdfViewer.scrollWrapped .spread{display:inline-block;vertical-align:middle}[_nghost-%COMP%] .spread .page, [_nghost-%COMP%] .pdfViewer.scrollHorizontal .page, [_nghost-%COMP%] .pdfViewer.scrollWrapped .page{margin-left:var(--spreadHorizontalWrapped-margin-LR);margin-right:var(--spreadHorizontalWrapped-margin-LR)}[_nghost-%COMP%] .pdfViewer.removePageBorders .spread .page, [_nghost-%COMP%] .pdfViewer.removePageBorders.scrollHorizontal .page, [_nghost-%COMP%] .pdfViewer.removePageBorders.scrollWrapped .page{margin-left:5px;margin-right:5px}[_nghost-%COMP%] .pdfViewer .page canvas{margin:0;display:block}[_nghost-%COMP%] .pdfViewer .page canvas[hidden]{display:none}[_nghost-%COMP%] .pdfViewer .page .loadingIcon{position:absolute;display:block;inset:0;background:url(data:image/gif;base64,R0lGODlhGAAYAPQQAM7Ozvr6+uDg4LCwsOjo6I6OjsjIyJycnNjY2KioqMDAwPLy8nZ2doaGhri4uGhoaP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/ilPcHRpbWl6ZWQgd2l0aCBodHRwczovL2V6Z2lmLmNvbS9vcHRpbWl6ZQAh+QQJBwAQACwAAAAAGAAYAAAFmiAkjiTkOGVaBgjZNGSgkgKjjM8zLoI8iy+BKCdiCX8iBeMAhEEIPRXLxViYUE9CbCQoFAzFhHY3zkaT3oPvBz1zE4UBsr1eWZH4vAowOBwGAHk8AoQLfH6Agm0Ed3qOAXWOIgQKiWyFJQgDgJEpdG+WEACNEFNFmKVlVzJQk6qdkwqBoi1mebJ3ALNGeIZHtGSwNDS1RZKueCEAIfkECQcAEAAsAAAAABgAGAAABZcgJI4kpChlWgYCWRQkEKgjURgjw4zOg9CjVwuiEyEeO6CxkBC9nA+HiuUqLEyoBZI0Mx4SAFFgQCDZuguBoGv6Dtg0gvpqdhxQQDkBzuUr/4A1JwMKP39pc2mDhYCIc4GQYn6QCwCMeY91l0p6dBAEJ0OfcFRimZ91Mwt0alxxAIZyRmuAsKxDLKKvZbM1tJxmvGKRpn8hACH5BAkHABAALAAAAAAYABgAAAWhICSOJGQYZVoGAnkcJBKoI3EAY1GMCtPSosSBINKJBIwGkHdwBGGQA0OhYpEGQxNqkYzNIITBACEKKBaxxNfBeOCO4vMy0Hg8nDHFeCktkKtfNAtoS4UqAicKBj9zBAKPC4iKi4aRkISGmWWBmjUIAIyHkCUEAKCVo2WmREecVqoCgZhgP4NHrGWCj7e3szSpuxAsoVWxnp6cVV4kyZW+KSEAIfkECQcAEAAsAAAAABgAGAAABZkgJI4kBABlWgYEOQykEKgjMSDjcYxG0dKi108nEhQKQN4rCIMkCgbawjWYnSCLY2yGVSgEooBhWqsGGwxc0RtNBgoMhmJ1QgETjANYFeBKyUmBKQQIdT9JDmgPDQ6EhoKJD4sOgpWWgiwChyqEBH5hmptSoSOZgJ4kLKWkYTF7C2SaqaM/hEWygay4mYG8t6uffFuzl1iANCEAIfkECQcAEAAsAAAAABgAGAAABZ0gJI4khCBlmhKkopBCoI6LIozDMAIHO4uuBVBnOiR+I4FrCDwAZsKdQnaCLIwwmRUA8JmioprWUCjcwlwUMnAoG0qL03k2KCS8cC0UjOzDCQKBfHQFDAwFU4CCfgqFhy9+kZJWgzSKSAcPZn+BfQENDw8OljGWJAFeDoZPYTBnC1GdSXqnsoBolSulX2GyP6hgvnG0KrS3NJNhuSQhACH5BAkHABAALAAAAAAYABgAAAWaICSOJCQIZZoupGGQRKCOC0CMijIiwz2LABtQZxoMfjQhxAXszWQ7gOwECRhh0MCJJRJARTUoIHFAgbfI6uBwAJS01J/i4PClVYHvfV8lbLlIBmwFbQt+aGmChG18jXeGT4dICQxlb4g/AQUMDER9XjR6BAdiDQwINDBmkAsPDVh4cX4imw53iLKuaVqAcUsPqEiidkt6j4AzIQAh+QQJBwAQACwAAAAAGAAYAAAFmSAkjiREEGWaBiSCtCoZCMsIAKOg1LEo0KKbaKFQ9EYLoOkFuQlirNxzCQkUW9GZ0hQd4nyDAWr4G/esYSbyZFYZwu3jqiuvr8u8I2BwOAwASXh1e31/doeHC3klWnElfAlTd46MfQUGk2stCVEGBQWSdCciDg5VDAVYKoEiDQ0iBwxGcj9RDw8+qHIzebc2DJJQJK6qiKVyIQAh+QQJBwAQACwAAAAAGAAYAAAFmSAkjiS0LGWaBiRBtCoZCKgoCCMB1DF0sz6cCQDo5W62l28XAyZFpyECBv3lnCbhUqHMIo0Qg4Jbmn1jRCa4iV27TzfXGjEecOFWMN1OdvvfPGUuXSoKBw6EXokrAwcHRVU0UAeEBANAAAmUI1gNDyhjJgUHLW0iDg8FIqOnBQZrDA9TELE2rEYIDw4jta2LMpCrqld/YQpgIQAh+QQJBwAQACwAAAAAGAAYAAAFmyAkjiS0LGWaBiRBkKw6BgIqCsJcyyMe4yJajhcEml5H26o1PN2QQd3uFiv2AADlAgflIbDdZLgkABOJgep5LfWty4p4zeU+w+XsvJWXliEKDwdEBgMKYQ4PDw1qK3EDCCMAiQ5BCV0LCj+FSDQkgCgGBiYHAy2MIgoMghAHqw4HAGsNDEMFBTekdgwKI7aRB2MwkL2rVHoQoWchACH5BAkHABAALAAAAAAYABgAAAWWICSOJLQsZZoGJEGQrDoGAioKwlzLIx7jIlqOFwSaXkfbqjU83ZBB3e4WK0qrCxyU55peid0qcUwuixyNx6PhILsAcAJazXYj4lvz2MkLiFsHDAlEcABKZwwMBX8pBgoKQxAIigpBA1sLBj+PSDQkB4uSACYDlTMyBgWDEKVnl2QFBUigN61gBQYjtLV5JZ4jtlR6omMhACH5BAkHABAALAAAAAAYABgAAAWaICSOJLQsZZoGJEGQrDoGAioKwlzLIx7jIlqOFwSaXkdbidYanm7I4AjwYDh6saJuJ3JUG1mZi9srPA7EcRimJLrfJYWZUVC8TziXnEG3u/E+cIJaPAFrPQl1aQAIbRAGBZGHJQiMUQKRBkEKbQsAPZaEXQcslSYKmjMyAAdXj34ACkNEiUgDA5t+PAQHn6Ogjkuzry2DNwhuIQAh+QQFBwAQACwAAAAAGAAYAAAFnCAkjiS0LGVaBgBJEGSguo8zCsK4CPIsMg+ECCcKEH0ix6MwhJl4KiOp8UCdmrEbo6EoHpxF8A6aBBZ6vhf5dmAkkGr0CoWs21WGQ2FvsI9xC3l7B311fy93iWGKJQQOhHCAJQB6A3IqcWwJLU90i2FkUiMKlhBELEI6MwgDXRAGhQgAYD6tTqRFAJxpA6mvrqazSKJJhUWMpjlIIQA7) center no-repeat}[_nghost-%COMP%] .pdfViewer .page .loadingIcon.notVisible{background:none}[_nghost-%COMP%] .pdfViewer.enablePermissions .textLayer span{-webkit-user-select:none!important;user-select:none!important;cursor:not-allowed}[_nghost-%COMP%] .pdfPresentationMode .pdfViewer{padding-bottom:0}[_nghost-%COMP%] .pdfPresentationMode .spread{margin:0}[_nghost-%COMP%] .pdfPresentationMode .pdfViewer .page{margin:0 auto;border:2px solid transparent}']})}return o})(),fd=(()=>{class o{static \u0275fac=function(i){return new(i||o)};static \u0275mod=_.$C({type:o});static \u0275inj=R.G2t({})}return o})();var pd=F(7089),Tr=F(4015);let Mr=(()=>{class o{getPdfViewerContainer(e){return e.closest("cue-pdf-viewer")?.querySelector(".ng2-pdf-viewer-container")}maintainCenterPosition(e,i,n){const s=this.getPdfViewerContainer(e);if(!s)return{...i,zoom:n(i.zoom)};const r=i.zoom,a=n(r);if(r===a)return i;const c={x:(s.scrollLeft+s.clientWidth/2)*(a/r)-s.clientWidth/2,y:(s.scrollTop+s.clientHeight/2)*(a/r)-s.clientHeight/2};return setTimeout(()=>{s.scrollLeft=Math.max(0,c.x),s.scrollTop=Math.max(0,c.y)},50),{...i,zoom:a,panOffset:c}}zoomAtPoint(e,i,n,s,r){const a=this.getPdfViewerContainer(e);if(!a)return{...i,zoom:n};const l=i.zoom;if(l===n)return i;const h=n/l,u={x:(a.scrollLeft+s)*h-s,y:(a.scrollTop+r)*h-r};return setTimeout(()=>{a.scrollLeft=Math.max(0,u.x),a.scrollTop=Math.max(0,u.y)},50),{...i,zoom:n,panOffset:u}}zoomIn(e,i){return this.maintainCenterPosition(e,i,n=>n+.25)}zoomOut(e,i){return this.maintainCenterPosition(e,i,n=>Math.max(i.minZoom,n-.25))}zoomFit(e,i){return this.maintainCenterPosition(e,i,()=>1)}setPanMode(e,i,n){const s=this.getPdfViewerContainer(e);return s&&(s.style.cursor=n?"grab":"default"),{...i,panMode:n}}startPan(e,i){const n=this.getPdfViewerContainer(e);return n?(i.preventDefault(),n.style.cursor="grabbing",{startX:i.clientX,startY:i.clientY,startScrollX:n.scrollLeft,startScrollY:n.scrollTop}):null}panMove(e,i,n){const s=this.getPdfViewerContainer(e);if(!s)return;i.preventDefault();const a=i.clientY-n.startY;s.scrollLeft=n.startScrollX-(i.clientX-n.startX),s.scrollTop=n.startScrollY-a}endPan(e,i){const n=this.getPdfViewerContainer(e);return n&&(n.style.cursor=i.panMode?"grab":"default"),{...i,panOffset:{x:n?.scrollLeft||0,y:n?.scrollTop||0}}}static \u0275fac=function(i){return new(i||o)};static \u0275prov=R.jDH({token:o,factory:o.\u0275fac,providedIn:"root"})}return o})();var Lr=F(5381),gd=F(5187),Rr=F(2245),md=F(7888),bd=F(1696),_d=F(3319),Ir=F(6149);function vd(o,t){if(1&o){const e=_.RV6();_.j41(0,"cue-flexcontainer",3)(1,"cue-typography",7),_.EFF(2),_.nI1(3,"transloco"),_.k0s(),_.j41(4,"cue-select",8),_.mxI("valueChange",function(n){R.eBV(e);const s=_.XpG();return _.DH7(s.page,n)||(s.page=n),R.Njj(n)}),_.k0s()()}if(2&o){const e=_.XpG();_.R7$(2),_.JRh(_.bMT(3,5,"components.pdfViewer.labelPage")),_.R7$(2),_.R50("value",e.page),_.Y8G("menuPosition",e.selectMenuPositions())("options",e.pageOptions())("underline",!1)}}function Ad(o,t){if(1&o){const e=_.RV6();_.j41(0,"cue-flexcontainer",3)(1,"cue-button",9),_.nI1(2,"transloco"),_.bIt("click",function(){R.eBV(e);const n=_.XpG();return R.Njj(n.handleZoomOut())}),_.nrm(3,"cue-button-icon",10),_.k0s(),_.j41(4,"cue-button",9),_.nI1(5,"transloco"),_.bIt("click",function(){R.eBV(e);const n=_.XpG();return R.Njj(n.handleZoomIn())}),_.nrm(6,"cue-button-icon",11),_.k0s(),_.j41(7,"cue-button",12),_.nI1(8,"transloco"),_.bIt("click",function(){R.eBV(e);const n=_.XpG();return R.Njj(n.handleZoomFit())}),_.nrm(9,"cue-button-icon",13),_.k0s()()}if(2&o){const e=_.XpG();_.AVh("border-left",!e.pageSelectHidden()&&e.options().displayZoom),_.R7$(),_.Y8G("cueTooltip",_.bMT(2,6,"components.pdfViewer.tooltipZoomOut")),_.R7$(3),_.Y8G("cueTooltip",_.bMT(5,8,"components.pdfViewer.tooltipZoomIn")),_.R7$(3),_.Y8G("disabled",1===e.settings().zoom)("cueTooltip",_.bMT(8,10,"components.pdfViewer.tooltipZoomFit"))}}function yd(o,t){if(1&o){const e=_.RV6();_.j41(0,"cue-button",14),_.nI1(1,"transloco"),_.bIt("click",function(){R.eBV(e);const n=_.XpG();return R.Njj(n.handleRotate())}),_.nrm(2,"cue-button-icon",15),_.k0s()}if(2&o){const e=_.XpG();_.AVh("border-left",e.options().displayZoom&&e.options().displayRotate),_.Y8G("cueTooltip",_.bMT(1,3,"components.pdfViewer.tooltipRotate"))}}function wd(o,t){if(1&o){const e=_.RV6();_.j41(0,"cue-button",16),_.nI1(1,"transloco"),_.mxI("selectedChange",function(n){R.eBV(e);const s=_.XpG();return _.DH7(s.panMode,n)||(s.panMode=n),R.Njj(n)}),_.nrm(2,"cue-button-icon",17),_.k0s()}if(2&o){const e=_.XpG();_.AVh("border-left",e.options().displayRotate&&e.options().displayPan),_.Y8G("cueTooltip",_.bMT(1,5,"components.pdfViewer.tooltipPan")),_.R50("selected",e.panMode),_.Y8G("toggleButton",!0)}}let Ed=(()=>{class o{elementRef=(0,R.WQX)(_.aKT);panZoomService=(0,R.WQX)(Mr);options=(0,Q.hFB)(new Ir.g);settings=Q.geq.required();numPages=(0,Q.hFB)(1);page=(0,Q.geq)("1");panMode=(0,Q.geq)(!1);constructor(){(0,R.QZP)(()=>{const e=this.panMode();this.settings.update(i=>i.panMode!==e?this.panZoomService.setPanMode(this.elementRef.nativeElement,i,e):i)})}pageOptions=(0,It.EW)(()=>Array.from({length:this.numPages()},(e,i)=>(i+1).toString()));pageSelectHidden=(0,It.EW)(()=>{const e=this.options().displayPageSelect;return!!(this.options().hidePageSelectOnSinglePageDocument&&this.numPages()<2)||!e});selectMenuPositions=(0,It.EW)(()=>"top"===this.options().position?"bottomright":"topright");handleZoomIn(){this.settings.update(e=>this.panZoomService.zoomIn(this.elementRef.nativeElement,e))}handleZoomOut(){this.settings.update(e=>this.panZoomService.zoomOut(this.elementRef.nativeElement,e))}handleZoomFit(){this.settings.update(e=>this.panZoomService.zoomFit(this.elementRef.nativeElement,e))}handleRotate(){this.settings.update(e=>(e.rotation+=90,e))}static \u0275fac=function(i){return new(i||o)};static \u0275cmp=_.VBU({type:o,selectors:[["cue-pdf-toolbar"]],inputs:{options:[1,"options"],settings:[1,"settings"],numPages:[1,"numPages"],page:[1,"page"],panMode:[1,"panMode"]},outputs:{settings:"settingsChange",page:"pageChange",panMode:"panModeChange"},decls:7,vars:5,consts:[["justify","center",1,"container"],[1,"toolbar",3,"padded"],["align","center"],["align","center","gap","s"],["align","center","gap","s",3,"border-left"],["size","xs","variant","ghost",3,"cueTooltip","border-left"],["size","xs","variant","tertiary",3,"cueTooltip","border-left","selected","toggleButton"],["size","s"],["size","xs","placeholder","Select",3,"valueChange","value","menuPosition","options","underline"],["size","xs","variant","tertiary",3,"click","cueTooltip"],["icon","zoom-out"],["icon","zoom-in"],["size","xs","variant","tertiary",3,"click","disabled","cueTooltip"],["icon","zoom-fit"],["size","xs","variant","ghost",3,"click","cueTooltip"],["icon","rotate-2d"],["size","xs","variant","tertiary",3,"selectedChange","cueTooltip","selected","toggleButton"],["icon","move-click"]],template:function(i,n){1&i&&(_.j41(0,"cue-flexcontainer",0)(1,"cue-card",1)(2,"cue-flexcontainer",2),_.nVh(3,vd,5,7,"cue-flexcontainer",3),_.nVh(4,Ad,10,12,"cue-flexcontainer",4),_.nVh(5,yd,3,5,"cue-button",5),_.nVh(6,wd,3,7,"cue-button",6),_.k0s()()()),2&i&&(_.R7$(),_.Y8G("padded",!1),_.R7$(2),_.vxM(n.options().displayPageSelect&&!n.pageSelectHidden()?3:-1),_.R7$(),_.vxM(n.options().displayZoom?4:-1),_.R7$(),_.vxM(n.options().displayRotate?5:-1),_.R7$(),_.vxM(n.options().displayPan?6:-1))},dependencies:[Lr.n,gd.Z,Rr.o,md.l,bd.$,_d.a,pd.d,Tr.Kj],styles:[".container[_ngcontent-%COMP%]{width:100%;pointer-events:none}.toolbar[_ngcontent-%COMP%]{pointer-events:all;padding:5px 10px}.border-left[_ngcontent-%COMP%]{border-left:1px solid;padding-left:12px}"],changeDetection:0})}return o})();var xd=F(9769),Cd=F(2036),Sd=F(3191);let Or=(()=>{class o{_panZoomService;_hostEl;_settings;_minZoom;_startDistance=0;_startZoom=1;_touchStart=null;_touchMove=null;_touchEnd=null;_wheel=null;_virtualScroll={x:0,y:0};_lastPinchTime=0;pendingScroll=null;init(e,i,n,s){this._panZoomService=e,this._hostEl=i,this._settings=n,this._minZoom=s}attach(){const e=this._getContainer();!e||this._touchStart||(e.style.touchAction="none",this._touchStart=i=>{2===i.touches.length&&(i.preventDefault(),this._startDistance=o._dist(i.touches[0],i.touches[1]),this._startZoom=this._settings().zoom)},this._touchMove=i=>{if(2!==i.touches.length||0===this._startDistance)return;i.preventDefault();const n=o._dist(i.touches[0],i.touches[1])/this._startDistance,s=e.getBoundingClientRect();this._applyTransform(n,(i.touches[0].clientX+i.touches[1].clientX)/2-s.left,(i.touches[0].clientY+i.touches[1].clientY)/2-s.top)},this._touchEnd=i=>{if(i.touches.length>=2||0===this._startDistance)return;const s=this._hostEl.querySelector("pdf-viewer")?.style.transform.match(/scale\(([\d.]+)\)/),r=s?parseFloat(s[1]):1,a=Math.min(5,Math.max(this._minZoom(),this._startZoom*r));this._clearTransform(),this._settings.update(l=>this._panZoomService.zoomAtPoint(this._hostEl,l,a,e.clientWidth/2,e.clientHeight/2)),this._startDistance=0},this._wheel=i=>{if(!i.ctrlKey)return;i.preventDefault(),i.stopPropagation();const n=Date.now();n-this._lastPinchTime>300&&(this._virtualScroll={x:e.scrollLeft,y:e.scrollTop}),this._lastPinchTime=n;const s=this._settings().zoom,r=Math.min(5,Math.max(this._minZoom(),s*(1-.003*i.deltaY)));if(r===s)return;const a=e.getBoundingClientRect(),l=i.clientX-a.left,h=i.clientY-a.top,c=r/s;this._virtualScroll={x:Math.max(0,(this._virtualScroll.x+l)*c-l),y:Math.max(0,(this._virtualScroll.y+h)*c-h)},this.pendingScroll={...this._virtualScroll},this._settings.update(d=>({...d,zoom:r}))},e.addEventListener("touchstart",this._touchStart,{passive:!1}),e.addEventListener("touchmove",this._touchMove,{passive:!1}),e.addEventListener("touchend",this._touchEnd,{passive:!1}),e.addEventListener("wheel",this._wheel,{passive:!1,capture:!0}))}detach(){const e=this._getContainer();e&&(e.style.touchAction=""),this._touchStart&&(e?.removeEventListener("touchstart",this._touchStart),this._touchStart=null),this._touchMove&&(e?.removeEventListener("touchmove",this._touchMove),this._touchMove=null),this._touchEnd&&(e?.removeEventListener("touchend",this._touchEnd),this._touchEnd=null),this._wheel&&(e?.removeEventListener("wheel",this._wheel,{capture:!0}),this._wheel=null)}applyPendingScroll(){if(!this.pendingScroll)return;const e=this.pendingScroll;this.pendingScroll=null;const i=this._getContainer();i&&(i.scrollLeft=e.x,i.scrollTop=e.y)}handleDrawOverlayPinch(e){const i=this._getContainer();if(!i)return;const n=Date.now();n-this._lastPinchTime>300&&(this._virtualScroll={x:i.scrollLeft,y:i.scrollTop}),this._lastPinchTime=n;const s=this._settings().zoom,r=Math.min(5,Math.max(this._minZoom(),s*(1-.003*e.deltaY)));if(r===s)return;const a=i.getBoundingClientRect(),l=e.clientX-a.left,h=e.clientY-a.top,c=r/s;this._virtualScroll={x:Math.max(0,(this._virtualScroll.x+l)*c-l),y:Math.max(0,(this._virtualScroll.y+h)*c-h)},this.pendingScroll={...this._virtualScroll},this._settings.update(d=>({...d,zoom:r}))}handleOverlayTouchStart(e){2!==e.touches.length||!this._getContainer()||(this._startDistance=o._dist(e.touches[0],e.touches[1]),this._startZoom=this._settings().zoom)}handleOverlayTouchMove(e){if(2!==e.touches.length||0===this._startDistance)return;const i=this._getContainer();if(!i)return;const n=o._dist(e.touches[0],e.touches[1])/this._startDistance,s=i.getBoundingClientRect();this._applyTransform(n,(e.touches[0].clientX+e.touches[1].clientX)/2-s.left,(e.touches[0].clientY+e.touches[1].clientY)/2-s.top)}handleOverlayTouchEnd(e){if(e.touches.length>=2||0===this._startDistance)return;const i=this._getContainer();if(!i)return;const s=this._hostEl.querySelector("pdf-viewer")?.style.transform.match(/scale\(([\d.]+)\)/),r=s?parseFloat(s[1]):1,a=Math.min(5,Math.max(this._minZoom(),this._startZoom*r));this._clearTransform(),this._settings.update(l=>this._panZoomService.zoomAtPoint(this._hostEl,l,a,i.clientWidth/2,i.clientHeight/2)),this._startDistance=0}_getContainer(){return this._hostEl?.querySelector(".ng2-pdf-viewer-container")}static _dist(e,i){const n=i.clientX-e.clientX,s=i.clientY-e.clientY;return Math.sqrt(n*n+s*s)}_applyTransform(e,i,n){const s=this._hostEl.querySelector("pdf-viewer");s&&(s.style.transformOrigin=`${i}px ${n}px`,s.style.transform=`scale(${e})`)}_clearTransform(){const e=this._hostEl.querySelector("pdf-viewer");e&&(e.style.transform="",e.style.transformOrigin="")}static \u0275fac=function(i){return new(i||o)};static \u0275prov=R.jDH({token:o,factory:o.\u0275fac})}return o})(),Fr=(()=>{class o{_hostEl;canvasRect=(0,R.vPA)(null);_scrollListener=null;_canvasResizeObserver=null;init(e){this._hostEl=e}updateCanvasRect(){const e=this._hostEl?.querySelector(".container"),i=this._hostEl?.querySelector("pdf-viewer canvas");if(!e||!i)return void this.canvasRect.set(null);const n=e.getBoundingClientRect(),s=i.getBoundingClientRect();this.canvasRect.set({left:s.left-n.left,top:s.top-n.top,width:s.width,height:s.height})}attachCanvasResizeObserver(){if(this._canvasResizeObserver)return;const e=this._hostEl?.querySelector("pdf-viewer canvas");e&&(this._canvasResizeObserver=new ResizeObserver(()=>this.updateCanvasRect()),this._canvasResizeObserver.observe(e))}detachCanvasResizeObserver(){this._canvasResizeObserver?.disconnect(),this._canvasResizeObserver=null}attachScrollListener(){const e=this._hostEl?.querySelector(".ng2-pdf-viewer-container");!e||this._scrollListener||(this._scrollListener=()=>this.updateCanvasRect(),e.addEventListener("scroll",this._scrollListener,{passive:!0}))}detachScrollListener(){this._scrollListener&&(this._hostEl?.querySelector(".ng2-pdf-viewer-container")?.removeEventListener("scroll",this._scrollListener),this._scrollListener=null)}destroy(){this.detachScrollListener(),this.detachCanvasResizeObserver(),this.canvasRect.set(null)}static \u0275fac=function(i){return new(i||o)};static \u0275prov=R.jDH({token:o,factory:o.\u0275fac})}return o})();const Nr="cue-search-highlight";let Br=(()=>{class o{_hostEl;_searchService;_currentPage;_searchResults;pdfDoc=(0,R.vPA)(null);searchTerm=(0,R.vPA)("");allMatches=(0,R.vPA)([]);currentPageHighlights=(0,It.EW)(()=>{const e=this._currentPage?.()??1;return this.allMatches().filter(i=>i.page===e).map(i=>{const n=i.xywhStr.replace("percent:","").split(",").map(h=>parseFloat(h.trim()));if(4!==n.length||n.some(isNaN))return null;const[s,r,a,l]=n;return{x:s,y:r,width:a,height:l}}).filter(Boolean)});_scheduleTimer=null;_canvasResizeObserver=null;init(e){this._hostEl=e.hostEl,this._searchService=e.searchService,this._currentPage=e.currentPage,this._searchResults=e.searchResults}attachCanvasResizeObserver(){if(this._canvasResizeObserver)return;const e=this._hostEl.querySelector("pdf-viewer canvas");e&&(this._canvasResizeObserver=new ResizeObserver(()=>this.scheduleRender()),this._canvasResizeObserver.observe(e))}detachCanvasResizeObserver(){this._canvasResizeObserver?.disconnect(),this._canvasResizeObserver=null}destroy(){this.detachCanvasResizeObserver(),this._scheduleTimer&&clearTimeout(this._scheduleTimer)}runSearch(){var e=this;return(0,x.A)(function*(){const i=e.pdfDoc(),n=e.searchTerm();if(e.allMatches.set([]),!i||!n?.trim())return e.clearHighlights(),void e._searchResults.emit([]);const s=yield e._searchService.searchAll(i,n);e.allMatches.set(s),e._searchResults.emit(s),e.renderHighlights()})()}scheduleRender(){this._scheduleTimer&&clearTimeout(this._scheduleTimer),this._scheduleTimer=setTimeout(()=>this.renderHighlights(),50)}renderHighlights(){this.clearHighlights();const e=this.currentPageHighlights();if(0===e.length)return;const i=this._hostEl.querySelector("pdf-viewer .page"),n=this._hostEl.querySelector("pdf-viewer canvas");if(!i||!n)return;const s=n.clientWidth,r=n.clientHeight,a=i.getBoundingClientRect(),l=n.getBoundingClientRect(),h=l.left-a.left,c=l.top-a.top;for(const d of e){const u=document.createElement("div");u.className=Nr,u.style.cssText=`\n position: absolute;\n left: ${h+d.x/100*s}px;\n top: ${c+d.y/100*r}px;\n width: ${d.width/100*s}px;\n height: ${d.height/100*r}px;\n background-color: rgba(255, 200, 0, 0.40);\n border: 1.5px solid rgba(255, 160, 0, 0.85);\n border-radius: 2px;\n box-sizing: border-box;\n pointer-events: none;\n z-index: 4;\n animation: cue-highlight-pulse 2s ease-in-out infinite;\n `,i.appendChild(u)}o._ensureStyles()}clearHighlights(){this._hostEl?.querySelectorAll(`.${Nr}`).forEach(e=>e.remove())}static _stylesInjected=!1;static _ensureStyles(){if(o._stylesInjected)return;o._stylesInjected=!0;const e=document.createElement("style");e.textContent="\n @keyframes cue-highlight-pulse {\n 0%, 100% { background-color: rgba(255, 200, 0, 0.40); }\n 50% { background-color: rgba(255, 200, 0, 0.62); }\n }\n ",document.head.appendChild(e)}static \u0275fac=function(i){return new(i||o)};static \u0275prov=R.jDH({token:o,factory:o.\u0275fac})}return o})();var xn=F(8560),Td=F(5600);function Md(o,t){1&o&&(_.j41(0,"cue-typography",1),_.EFF(1),_.nI1(2,"transloco"),_.k0s()),2&o&&(_.R7$(),_.JRh(_.bMT(2,1,"components.pdfViewer.infoLoading")))}function Ld(o,t){if(1&o){const e=_.RV6();_.j41(0,"div",4),_.bIt("wheel",function(n){R.eBV(e);const s=_.XpG();return R.Njj(s.onDrawOverlayWheel(n))})("touchstart",function(n){R.eBV(e);const s=_.XpG();return R.Njj(s.onOverlayTouchStart(n))})("touchmove",function(n){R.eBV(e);const s=_.XpG();return R.Njj(s.onOverlayTouchMove(n))})("touchend",function(n){R.eBV(e);const s=_.XpG();return R.Njj(s.onOverlayTouchEnd(n))}),_.j41(1,"cue-image-viewer",5),_.mxI("drawingArtefactsChange",function(n){R.eBV(e);const s=_.XpG();return _.DH7(s.drawingArtefacts,n)||(s.drawingArtefacts=n),R.Njj(n)}),_.bIt("artefactDrawn",function(n){R.eBV(e);const s=_.XpG();return R.Njj(s.artefactDrawn.emit(n))})("artefactRemoved",function(n){R.eBV(e);const s=_.XpG();return R.Njj(s.artefactRemoved.emit(n))})("artefactSelected",function(n){R.eBV(e);const s=_.XpG();return R.Njj(s.artefactSelected.emit(n))})("artefactEdited",function(n){R.eBV(e);const s=_.XpG();return R.Njj(s.artefactEdited.emit(n))}),_.k0s()()}if(2&o){const e=t,i=_.XpG();_.xc7("left",e.left,"px")("top",e.top,"px")("width",e.width,"px")("height",e.height,"px"),_.AVh("draw-active",i.isEditOrDrawModeActive()),_.R7$(),_.Y8G("src",i._drawerSrc())("panDisabled",!0)("zoomDisabled",!0)("drawMode",i._drawMode())("drawnArtefactDef",i.drawnArtefactDef())("contextMenuItems",i.contextMenuItems()),_.R50("drawingArtefacts",i.drawingArtefacts),_.Y8G("toolbarOptions",i._drawerToolbar)}}function Rd(o,t){if(1&o){const e=_.RV6();_.j41(0,"cue-pdf-toolbar",7),_.mxI("pageChange",function(n){R.eBV(e),_.XpG(2);const s=_.r8f(2);return _.DH7(s.page,n)||(s.page=n),R.Njj(n)})("settingsChange",function(n){R.eBV(e);const s=_.XpG(2);return _.DH7(s.settings,n)||(s.settings=n),R.Njj(n)})("panModeChange",function(n){R.eBV(e);const s=_.XpG(2);return _.DH7(s.panMode,n)||(s.panMode=n),R.Njj(n)}),_.k0s()}if(2&o){const e=_.XpG(),i=_.XpG(),n=_.r8f(2);_.Aen(i.toolbarStyle()),_.Y8G("options",e),_.R50("page",n.page)("settings",i.settings),_.Y8G("numPages",i.numPages()),_.R50("panMode",i.panMode)}}function Id(o,t){1&o&&_.nVh(0,Rd,1,7,"cue-pdf-toolbar",6),2&o&&_.vxM(t.hidden?-1:0)}let kd=(()=>{class o{elementRef=(0,R.WQX)(_.aKT);panZoomSvc=(0,R.WQX)(Mr);searchSvc=(0,R.WQX)(Sd.g);drawing=(0,R.WQX)(Fr);pinch=(0,R.WQX)(Or);highlight=(0,R.WQX)(Br);src=(0,Q.hFB)("");settings=(0,Q.geq)(new Ir._);panMode=(0,Q.geq)(!1);drawMode=(0,Q.hFB)("none");contextMenuItems=(0,Q.hFB)([]);drawnArtefactDef=(0,Q.hFB)({allowRemove:!0,color:"rgba(0, 120, 255, 0.8)"});searchTerm=(0,Q.hFB)("");searchResults=(0,Q.CGW)();pdfLoaded=(0,Q.CGW)();drawingArtefacts=(0,Q.geq)((0,Cd.x)());artefactDrawn=(0,Q.CGW)();artefactRemoved=(0,Q.CGW)();artefactSelected=(0,Q.CGW)();artefactEdited=(0,Q.CGW)();_imageViewer=(0,Q.ebz)(xn.ImageViewer);activateEditForBbox(e){const i=this._imageViewer();i&&i.editService.startEditArtefact("bbox",e)}numPages=(0,R.vPA)(1);loading=(0,R.vPA)(!0);minZoom=(0,R.vPA)(.1);isPanning=(0,R.vPA)(!1);panStart=(0,R.vPA)(null);isMiddlePanning=(0,R.vPA)(!1);middlePanStart=(0,R.vPA)(null);_midMoveListener=this._onMiddlePanMove.bind(this);_midUpListener=this._onMiddlePanUp.bind(this);isDrawModeActive=(0,It.EW)(()=>"none"!==this._drawMode());isEditOrDrawModeActive=(0,It.EW)(()=>this.isDrawModeActive()||this.settings().editMode||null!==this._imageViewer()?.editService.editingArtefact());_lastScrolledBbox=null;_drawMode=(0,It.EW)(()=>{const e=this.settings().drawMode||this.drawMode();return"xywh"===e||"polygon"===e||"circle"===e?e:"none"});_drawerSrc=(0,It.EW)(()=>{const e=this.drawing.canvasRect();return e?`data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="${2*Math.round(e.width/2)}" height="${2*Math.round(e.height/2)}"/>`:""});_drawerToolbar=Object.assign(new Td.g,{hidden:!0});currentPageNum=(0,It.EW)(()=>Number(this.settings().page)||1);constructor(){const e=this.elementRef.nativeElement;this.pinch.init(this.panZoomSvc,e,this.settings,this.minZoom),this.drawing.init(e),this.highlight.init({hostEl:e,searchService:this.searchSvc,currentPage:this.currentPageNum,searchResults:this.searchResults}),(0,R.QZP)(()=>{this.settings.update(i=>this.panZoomSvc.setPanMode(e,i,this.panMode()))}),(0,R.QZP)(()=>{this.highlight.pdfDoc();const n=this.searchTerm();this.highlight.searchTerm.set(n),this.highlight.runSearch()}),(0,R.QZP)(()=>{0===this.highlight.currentPageHighlights().length&&this.highlight.clearHighlights(),this.highlight.scheduleRender()}),(0,R.QZP)(()=>{const i=this.settings().drawingArtefacts;this.drawingArtefacts.set(i)}),(0,R.QZP)(()=>{const i=this._imageViewer(),n=this.settings().editMode,s=this.drawingArtefacts();!i||!n||0===s.xywhs.length||queueMicrotask(()=>this.activateEditForBbox(0))}),(0,R.QZP)(()=>{const i=this.drawingArtefacts(),n=this.drawing.canvasRect(),s=i.xywhs[0];s?n&&this._lastScrolledBbox!==s.xywhStr&&(this._lastScrolledBbox=s.xywhStr,this.scrollToBbox(s)):this._lastScrolledBbox=null})}ngOnDestroy(){this.pinch.detach(),this.drawing.destroy(),this.highlight.destroy(),this._stopMiddlePan()}onPdfLoaded(e){var i=this;return(0,x.A)(function*(){i.numPages.set(e.numPages),i.loading.set(!1),i.highlight.pdfDoc.set(e),i.pdfLoaded.emit(e)})()}onPageRendered(){this.drawing.detachScrollListener(),this.drawing.attachScrollListener(),this.drawing.detachCanvasResizeObserver(),this.drawing.attachCanvasResizeObserver(),this.highlight.detachCanvasResizeObserver(),this.highlight.attachCanvasResizeObserver(),this._updateMinZoom(),this.highlight.renderHighlights(),this.pinch.attach(),this.pinch.applyPendingScroll(),requestAnimationFrame(()=>this.drawing.updateCanvasRect())}toolbarStyle(){const e=this.settings().toolbarOptions;return`left:${e.margin};right:${e.margin};${"top"===e.position?"top":"bottom"}:${e.margin}`}_overlayPinching=!1;onOverlayTouchStart(e){e.touches.length>=2&&(e.preventDefault(),this._overlayPinching=!0,this.pinch.handleOverlayTouchStart(e))}onOverlayTouchMove(e){(this._overlayPinching||e.touches.length>=2)&&(e.preventDefault(),this._overlayPinching=!0,this.pinch.handleOverlayTouchMove(e))}onOverlayTouchEnd(e){this._overlayPinching&&(this.pinch.handleOverlayTouchEnd(e),e.touches.length<2&&(this._overlayPinching=!1))}onMouseDown(e){if(1===e.button){e.preventDefault();const n=this.panZoomSvc.startPan(this.elementRef.nativeElement,e);return void(n&&(this.isMiddlePanning.set(!0),this.middlePanStart.set(n),window.addEventListener("mousemove",this._midMoveListener),window.addEventListener("mouseup",this._midUpListener)))}if(!this.panMode()||0!==e.button)return;const i=this.panZoomSvc.startPan(this.elementRef.nativeElement,e);i&&(this.isPanning.set(!0),this.panStart.set(i))}onMouseMove(e){!this.isPanning()||!this.panStart()||this.panZoomSvc.panMove(this.elementRef.nativeElement,e,this.panStart())}onMouseUp(){this.isPanning()&&(this.settings.update(e=>this.panZoomSvc.endPan(this.elementRef.nativeElement,e)),this.isPanning.set(!1),this.panStart.set(null))}_onMiddlePanMove(e){!this.isMiddlePanning()||!this.middlePanStart()||this.panZoomSvc.panMove(this.elementRef.nativeElement,e,this.middlePanStart())}_onMiddlePanUp(e){1===e.button&&this._stopMiddlePan()}_stopMiddlePan(){window.removeEventListener("mousemove",this._midMoveListener),window.removeEventListener("mouseup",this._midUpListener),this.isMiddlePanning()&&(this.settings.update(e=>this.panZoomSvc.endPan(this.elementRef.nativeElement,e)),this.isMiddlePanning.set(!1),this.middlePanStart.set(null))}onDrawOverlayWheel(e){const i=this.elementRef.nativeElement.querySelector(".ng2-pdf-viewer-container");i&&(e.preventDefault(),e.ctrlKey?this.pinch.handleDrawOverlayPinch(e):(i.scrollTop+=e.deltaY,i.scrollLeft+=e.deltaX))}scrollToBbox(e){const i=this.elementRef.nativeElement.querySelector(".ng2-pdf-viewer-container"),n=this.elementRef.nativeElement.querySelector(".container"),s=this.drawing.canvasRect();if(!i||!n||!s)return;const a=e.xywhStr.replace("percent:","").split(",").map(Number);if(a.length<4||a.some(isNaN))return;const[,l,,h]=a,c=n.getBoundingClientRect(),d=i.getBoundingClientRect();i.scrollBy({top:c.top+s.top+l/100*s.height+h/100*s.height/2-(d.top+d.height/2),behavior:"smooth"})}_updateMinZoom(){const e=this.elementRef.nativeElement.querySelector(".ng2-pdf-viewer-container");if(!e)return;const i=e.querySelector("canvas");if(!i)return;const n=this.settings().zoom;if(n<=0)return;const s=i.offsetWidth/n,r=i.offsetHeight/n;if(s<=0||r<=0)return;const a=Math.min(e.clientWidth/s,e.clientHeight/r),l=Math.max(.05,a);this.minZoom.set(l),this.settings.update(h=>({...h,minZoom:l}))}static \u0275fac=function(i){return new(i||o)};static \u0275cmp=_.VBU({type:o,selectors:[["cue-pdf-viewer"]],viewQuery:function(i,n){1&i&&_.wEZ(n._imageViewer,xn.ImageViewer,5),2&i&&_.NyB()},inputs:{src:[1,"src"],settings:[1,"settings"],panMode:[1,"panMode"],drawMode:[1,"drawMode"],contextMenuItems:[1,"contextMenuItems"],drawnArtefactDef:[1,"drawnArtefactDef"],searchTerm:[1,"searchTerm"],drawingArtefacts:[1,"drawingArtefacts"]},outputs:{settings:"settingsChange",panMode:"panModeChange",searchResults:"searchResults",pdfLoaded:"pdfLoaded",drawingArtefacts:"drawingArtefactsChange",artefactDrawn:"artefactDrawn",artefactRemoved:"artefactRemoved",artefactSelected:"artefactSelected",artefactEdited:"artefactEdited"},features:[_.Jv_([Or,Fr,Br])],decls:6,vars:25,consts:[["direction","column","align","center","justify","center",1,"container",3,"mousedown","mousemove","mouseup","mouseleave"],[1,"info"],[2,"width","100%","height","100%",3,"after-load-complete","page-rendered","src","page","render-text","render-text-mode","original-size","stick-to-page","zoom","rotation","external-link-target","autoresize","fit-to-page","show-borders","show-all"],[1,"drawing-overlay",3,"draw-active","left","top","width","height"],[1,"drawing-overlay",3,"wheel","touchstart","touchmove","touchend"],["fitMode","contain",2,"width","100%","height","100%",3,"drawingArtefactsChange","artefactDrawn","artefactRemoved","artefactSelected","artefactEdited","src","panDisabled","zoomDisabled","drawMode","drawnArtefactDef","contextMenuItems","drawingArtefacts","toolbarOptions"],[3,"style","options","page","settings","numPages","panMode"],[3,"pageChange","settingsChange","panModeChange","options","page","settings","numPages","panMode"]],template:function(i,n){if(1&i&&(_.j41(0,"cue-flexcontainer",0),_.bIt("mousedown",function(r){return n.onMouseDown(r)})("mousemove",function(r){return n.onMouseMove(r)})("mouseup",function(){return n.onMouseUp()})("mouseleave",function(){return n.onMouseUp()}),_.nVh(1,Md,3,3,"cue-typography",1),_.SS7(2),_.j41(3,"pdf-viewer",2),_.bIt("after-load-complete",function(r){return n.onPdfLoaded(r)})("page-rendered",function(){return n.onPageRendered()}),_.k0s(),_.nVh(4,Ld,2,18,"div",3),_.nVh(5,Id,1,1),_.k0s()),2&i){let s,r;_.AVh("pan-mode",n.panMode())("draw-mode",n.isDrawModeActive())("edit-mode",n.isEditOrDrawModeActive())("middle-panning",n.isMiddlePanning()),_.R7$(),_.vxM(n.loading()?1:-1),_.R7$();const a=_.bH3(n.settings());_.R7$(),_.Y8G("src",n.src())("page",a.page)("render-text",a.renderText)("render-text-mode",a.renderTextMode)("original-size",a.originalSize)("stick-to-page",a.stickToPage)("zoom",a.zoom)("rotation",a.rotation)("external-link-target",a.externalLinkTarget)("autoresize",a.autoresize)("fit-to-page",a.fitToPage)("show-borders",a.showBorders)("show-all",!1),_.R7$(),_.vxM((s=n.drawing.canvasRect())?4:-1,s),_.R7$(),_.vxM((r=a.toolbarOptions)?5:-1,r)}},dependencies:[fd,ud,Ed,Rr.o,Lr.n,xd.MD,xn.ImageViewer,Tr.Kj],styles:["[_nghost-%COMP%]{display:contents}.container[_ngcontent-%COMP%]{width:100%;height:100%;position:relative}.container.pan-mode[_ngcontent-%COMP%]{cursor:grab;-webkit-user-select:none;user-select:none}.container.pan-mode[_ngcontent-%COMP%]:active{cursor:grabbing}.container.draw-mode[_ngcontent-%COMP%]{cursor:crosshair;-webkit-user-select:none;user-select:none}.container.edit-mode[_ngcontent-%COMP%]{cursor:move;-webkit-user-select:none;user-select:none}.container.middle-panning[_ngcontent-%COMP%], .container.middle-panning[_ngcontent-%COMP%] .drawing-overlay[_ngcontent-%COMP%]{cursor:grabbing!important;-webkit-user-select:none;user-select:none}cue-pdf-toolbar[_ngcontent-%COMP%]{position:absolute;z-index:10}.info[_ngcontent-%COMP%]{position:absolute;top:50%;transform:translateY(-50%)}.drawing-overlay[_ngcontent-%COMP%]{position:absolute;z-index:5;background:transparent;pointer-events:none}.drawing-overlay.draw-active[_ngcontent-%COMP%]{pointer-events:auto}.drawing-overlay[_ngcontent-%COMP%] .container, .drawing-overlay[_ngcontent-%COMP%] cue-pan-zoom, .drawing-overlay[_ngcontent-%COMP%] .image-container{background:transparent!important}.drawing-overlay[_ngcontent-%COMP%] img{opacity:0!important}"],changeDetection:0})}return o})()}}]);