PageSourceSearch

https://www.warc.com/_next/static/chunks/f174e5b3-0913cbaa908ae545.js

js warc.com collected 2026-09-24 06:57:35 UTC 407,941 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8318],{87229:(t,e,i)=>{i.r(e),i.d(e,{default:()=>pJ});var s,a,n,r,l,o,h,d,c,u,_,p,f,g,m,v,b,w,A,y,S,x,E,k,M,C,T,R,L,P,I,D,F,O=i(50304),W=i(51198),N=i(17596),j=i(19017),H=i(9479),B=i(40247),G=i(23581),z=i(38081),U=i(71904),V=i(35353),q=i(11862),K=i(95155),X=i(83299),Y=i(12115),Q=i(4262),J=i(41112),Z=i(32586),$=i(721),tt=i(24900),te=i(97071),ti=i(7804),ts={};ts.d=(t,e)=>{for(var i in e)ts.o(e,i)&&!ts.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},ts.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var ta=globalThis.pdfjsLib={};ts.d(ta,{AbortException:()=>tD,AnnotationEditorLayer:()=>_e,AnnotationEditorParamsType:()=>tc,AnnotationEditorType:()=>td,AnnotationEditorUIManager:()=>iJ,AnnotationLayer:()=>oz,AnnotationMode:()=>th,ColorPicker:()=>dA,DOMSVGFactory:()=>lw,DrawLayer:()=>_p,FeatureTest:()=>tN,GlobalWorkerOptions:()=>nW,ImageKind:()=>tp,InvalidPDFException:()=>tR,MissingPDFException:()=>tL,OPS:()=>tv,OutputScale:()=>ea,PDFDataRangeTransport:()=>rB,PDFDateString:()=>t8,PDFWorker:()=>r0,PasswordResponses:()=>tb,PermissionFlag:()=>tu,PixelsPerInch:()=>tY,RenderingCancelledException:()=>tZ,TextLayer:()=>rL,UnexpectedResponseException:()=>tP,Util:()=>tH,VerbosityLevel:()=>tm,XfaLayer:()=>lA,build:()=>lf,createValidAbsoluteUrl:()=>tE,fetchData:()=>tQ,getDocument:()=>rW,getFilenameFromUrl:()=>t1,getPdfFilenameFromUrl:()=>t2,getXfaPageViewport:()=>t9,isDataScheme:()=>t$,isPdfFile:()=>t0,noContextMenu:()=>t6,normalizeUnicode:()=>tV,setLayerDimensions:()=>es,shadow:()=>tk,version:()=>lp});let tn="object"==typeof tt.p&&tt.p+""=="[object process]"&&!tt.p.versions.nw&&!(tt.p.versions.electron&&tt.p.type&&"browser"!==tt.p.type),tr=[1,0,0,1,0,0],tl=[.001,0,0,.001,0,0],to={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},th={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},td={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},tc={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},tu={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},t_={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},tp={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},tf={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,WIDGET:20},tg={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},tm={ERRORS:0,WARNINGS:1,INFOS:5},tv={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},tb={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},tw=tm.WARNINGS;function tA(t){tw>=tm.INFOS&&console.log("Info: ".concat(t))}function ty(t){tw>=tm.WARNINGS&&console.log("Warning: ".concat(t))}function tS(t){throw Error(t)}function tx(t,e){t||tS(e)}function tE(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!t)return null;try{if(i&&"string"==typeof t){if(i.addDefaultProtocol&&t.startsWith("www.")){let e=t.match(/\./g);(null==e?void 0:e.length)>=2&&(t="http://".concat(t))}if(i.tryConvertEncoding)try{var s;s=t,t=decodeURIComponent(escape(s))}catch(t){}}let a=e?new URL(t,e):new URL(t);if(function(t){switch(null==t?void 0:t.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(a))return a}catch(t){}return null}function tk(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return Object.defineProperty(t,e,{value:i,enumerable:!s,configurable:!0,writable:!1}),i}let tM=function(){function t(t,e){this.message=t,this.name=e}return t.prototype=Error(),t.constructor=t,t}();class tC extends tM{constructor(t,e){super(t,"PasswordException"),this.code=e}}class tT extends tM{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class tR extends tM{constructor(t){super(t,"InvalidPDFException")}}class tL extends tM{constructor(t){super(t,"MissingPDFException")}}class tP extends tM{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class tI extends tM{constructor(t){super(t,"FormatError")}}class tD extends tM{constructor(t){super(t,"AbortException")}}function tF(t){("object"!=typeof t||(null==t?void 0:t.length)===void 0)&&tS("Invalid argument for bytesToString");let e=t.length;if(e<8192)return String.fromCharCode.apply(null,t);let i=[];for(let s=0;s<e;s+=8192){let a=Math.min(s+8192,e),n=t.subarray(s,a);i.push(String.fromCharCode.apply(null,n))}return i.join("")}function tO(t){"string"!=typeof t&&tS("Invalid argument for stringToBytes");let e=t.length,i=new Uint8Array(e);for(let s=0;s<e;++s)i[s]=255&t.charCodeAt(s);return i}function tW(t){let e=Object.create(null);for(let[i,s]of t)e[i]=s;return e}class tN{static get isLittleEndian(){return tk(this,"isLittleEndian",function(){let t=new Uint8Array(4);return t[0]=1,1===new Uint32Array(t.buffer,0,1)[0]}())}static get isEvalSupported(){return tk(this,"isEvalSupported",function(){try{return Function(""),!0}catch(t){return!1}}())}static get isOffscreenCanvasSupported(){return tk(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get platform(){var t,e;return"undefined"!=typeof navigator&&"string"==typeof(null==(t=navigator)?void 0:t.platform)?tk(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:"string"==typeof(null==(e=navigator)?void 0:e.userAgent)&&navigator.userAgent.includes("Firefox")}):tk(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){var t,e;return tk(this,"isCSSRoundSupported",null==(e=globalThis.CSS)||null==(t=e.supports)?void 0:t.call(e,"width: round(1.5px, 1px)"))}}let tj=Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0"));class tH{static makeHexColor(t,e,i){return"#".concat(tj[t]).concat(tj[e]).concat(tj[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){let 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){let i=this.applyTransform(t,e),s=this.applyTransform(t.slice(2,4),e),a=this.applyTransform([t[0],t[3]],e),n=this.applyTransform([t[2],t[1]],e);return[Math.min(i[0],s[0],a[0],n[0]),Math.min(i[1],s[1],a[1],n[1]),Math.max(i[0],s[0],a[0],n[0]),Math.max(i[1],s[1],a[1],n[1])]}static inverseTransform(t){let 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){let e=[t[0],t[2],t[1],t[3]],i=t[0]*e[0]+t[1]*e[2],s=t[0]*e[1]+t[1]*e[3],a=t[2]*e[0]+t[3]*e[2],n=t[2]*e[1]+t[3]*e[3],r=(i+n)/2,l=Math.sqrt((i+n)**2-4*(i*n-a*s))/2;return[Math.sqrt(r+l||1),Math.sqrt(r-l||1)]}static normalizeRect(t){let 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){let i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),s=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>s)return null;let a=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),n=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return a>n?null:[i,a,s,n]}static bezierBoundingBox(t,e,i,s,a,n,r,l,o){return o?(o[0]=Math.min(o[0],t,r),o[1]=Math.min(o[1],e,l),o[2]=Math.max(o[2],t,r),o[3]=Math.max(o[3],e,l)):o=[Math.min(t,r),Math.min(e,l),Math.max(t,r),Math.max(e,l)],(0,q._)(this,tH,tG).call(tH,t,i,a,r,e,s,n,l,3*(-t+3*(i-a)+r),6*(t-2*i+a),3*(i-t),o),(0,q._)(this,tH,tG).call(tH,t,i,a,r,e,s,n,l,3*(-e+3*(s-n)+l),6*(e-2*s+n),3*(s-e),o),o}}function tB(t,e,i,s,a,n,r,l,o,h){if(o<=0||o>=1)return;let d=1-o,c=o*o,u=c*o,_=d*(d*(d*t+3*o*e)+3*c*i)+u*s,p=d*(d*(d*a+3*o*n)+3*c*r)+u*l;h[0]=Math.min(h[0],_),h[1]=Math.min(h[1],p),h[2]=Math.max(h[2],_),h[3]=Math.max(h[3],p)}function tG(t,e,i,s,a,n,r,l,o,h,d,c){if(1e-12>Math.abs(o)){Math.abs(h)>=1e-12&&(0,q._)(this,tH,tB).call(tH,t,e,i,s,a,n,r,l,-d/h,c);return}let u=h**2-4*d*o;if(u<0)return;let _=Math.sqrt(u),p=2*o;(0,q._)(this,tH,tB).call(tH,t,e,i,s,a,n,r,l,(-h+_)/p,c),(0,q._)(this,tH,tB).call(tH,t,e,i,s,a,n,r,l,(-h-_)/p,c)}let tz=null,tU=null;function tV(t){return tz||(tz=/([\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,tU=new Map([["ſt","ſt"]])),t.replaceAll(tz,(t,e,i)=>e?e.normalize("NFKC"):tU.get(i))}let tq="pdfjs_internal_id_",tK={BEZIER_CURVE_TO:0,MOVE_TO:1,LINE_TO:2,QUADRATIC_CURVE_TO:3,RESTORE:4,SAVE:5,SCALE:6,TRANSFORM:7,TRANSLATE:8},tX="http://www.w3.org/2000/svg";class tY{}async function tQ(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";if(t5(t,document.baseURI)){let i=await fetch(t);if(!i.ok)throw Error(i.statusText);switch(e){case"arraybuffer":return i.arrayBuffer();case"blob":return i.blob();case"json":return i.json()}return i.text()}return new Promise((i,s)=>{let a=new XMLHttpRequest;a.open("GET",t,!0),a.responseType=e,a.onreadystatechange=()=>{if(a.readyState===XMLHttpRequest.DONE){if(200===a.status||0===a.status){switch(e){case"arraybuffer":case"blob":case"json":i(a.response);return}i(a.responseText);return}s(Error(a.statusText))}},a.send(null)})}tY.CSS=96,tY.PDF=72,tY.PDF_TO_CSS_UNITS=tY.CSS/tY.PDF;class tJ{get rawDims(){let{viewBox:t}=this;return tk(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone(){let{scale:t=this.scale,rotation:e=this.rotation,offsetX:i=this.offsetX,offsetY:s=this.offsetY,dontFlip:a=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new tJ({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:a})}convertToViewportPoint(t,e){return tH.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){let e=tH.applyTransform([t[0],t[1]],this.transform),i=tH.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){return tH.applyInverseTransform([t,e],this.transform)}constructor({viewBox:t,scale:e,rotation:i,offsetX:s=0,offsetY:a=0,dontFlip:n=!1}){let r,l,o,h,d,c,u,_;this.viewBox=t,this.scale=e,this.rotation=i,this.offsetX=s,this.offsetY=a;let p=(t[2]+t[0])/2,f=(t[3]+t[1])/2;switch((i%=360)<0&&(i+=360),i){case 180:r=-1,l=0,o=0,h=1;break;case 90:r=0,l=1,o=1,h=0;break;case 270:r=0,l=-1,o=-1,h=0;break;case 0:r=1,l=0,o=0,h=-1;break;default:throw Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}n&&(o=-o,h=-h),0===r?(d=Math.abs(f-t[1])*e+s,c=Math.abs(p-t[0])*e+a,u=(t[3]-t[1])*e,_=(t[2]-t[0])*e):(d=Math.abs(p-t[0])*e+s,c=Math.abs(f-t[1])*e+a,u=(t[2]-t[0])*e,_=(t[3]-t[1])*e),this.transform=[r*e,l*e,o*e,h*e,d-r*e*p-o*e*f,c-l*e*p-h*e*f],this.width=u,this.height=_}}class tZ extends tM{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function t$(t){let e=t.length,i=0;for(;i<e&&""===t[i].trim();)i++;return"data:"===t.substring(i,i+5).toLowerCase()}function t0(t){return"string"==typeof t&&/\.pdf$/i.test(t)}function t1(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)}function t2(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"document.pdf";if("string"!=typeof t)return e;if(t$(t))return ty('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;let i=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,s=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(t),a=i.exec(s[1])||i.exec(s[2])||i.exec(s[3]);if(a&&(a=a[0]).includes("%"))try{a=i.exec(decodeURIComponent(a))[0]}catch(t){}return a||e}class t3{time(t){t in this.started&&ty("Timer is already running for ".concat(t)),this.started[t]=Date.now()}timeEnd(t){t in this.started||ty("Timer has not been started for ".concat(t)),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){let t=[],e=0;for(let{name:t}of this.times)e=Math.max(t.length,e);for(let{name:i,start:s,end:a}of this.times)t.push("".concat(i.padEnd(e)," ").concat(a-s,"ms\n"));return t.join("")}constructor(){this.started=Object.create(null),this.times=[]}}function t5(t,e){try{let{protocol:i}=e?new URL(t,e):new URL(t);return"http:"===i||"https:"===i}catch(t){return!1}}function t6(t){t.preventDefault()}function t4(t){console.log("Deprecated API usage: "+t)}class t8{static toDateObject(t){if(!t||"string"!=typeof t)return null;(0,z._)(this,t8,t7,(0,G._)(this,t8,t7)||RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));let e=(0,G._)(this,t8,t7).exec(t);if(!e)return null;let i=parseInt(e[1],10),s=parseInt(e[2],10);s=s>=1&&s<=12?s-1:0;let a=parseInt(e[3],10);a=a>=1&&a<=31?a:1;let n=parseInt(e[4],10);n=n>=0&&n<=23?n:0;let r=parseInt(e[5],10);r=r>=0&&r<=59?r:0;let l=parseInt(e[6],10);l=l>=0&&l<=59?l:0;let o=e[7]||"Z",h=parseInt(e[8],10);h=h>=0&&h<=23?h:0;let d=parseInt(e[9],10)||0;return d=d>=0&&d<=59?d:0,"-"===o?(n+=h,r+=d):"+"===o&&(n-=h,r-=d),new Date(Date.UTC(i,s,a,n,r,l))}}var t7={writable:!0,value:void 0};function t9(t,e){let{scale:i=1,rotation:s=0}=e,{width:a,height:n}=t.attributes.style;return new tJ({viewBox:[0,0,parseInt(a),parseInt(n)],scale:i,rotation:s})}function et(t){if(t.startsWith("#")){let e=parseInt(t.slice(1),16);return[(0xff0000&e)>>16,(65280&e)>>8,255&e]}return t.startsWith("rgb(")?t.slice(4,-1).split(",").map(t=>parseInt(t)):t.startsWith("rgba(")?t.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(ty('Not a valid color format: "'.concat(t,'"')),[0,0,0])}function ee(t){let{a:e,b:i,c:s,d:a,e:n,f:r}=t.getTransform();return[e,i,s,a,n,r]}function ei(t){let{a:e,b:i,c:s,d:a,e:n,f:r}=t.getTransform().invertSelf();return[e,i,s,a,n,r]}function es(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=!(arguments.length>3)||void 0===arguments[3]||arguments[3];if(e instanceof tJ){let{pageWidth:s,pageHeight:a}=e.rawDims,{style:n}=t,r=tN.isCSSRoundSupported,l="var(--scale-factor) * ".concat(s,"px"),o="var(--scale-factor) * ".concat(
1a,"px"),h=r?"round(down, ".concat(l,", var(--scale-round-x, 1px))"):"calc(".concat(l,")"),d=r?"round(down, ".concat(o,", var(--scale-round-y, 1px))"):"calc(".concat(o,")");i&&e.rotation%180!=0?(n.width=d,n.height=h):(n.width=h,n.height=d)}s&&t.setAttribute("data-main-rotation",e.rotation)}class ea{get scaled(){return 1!==this.sx||1!==this.sy}get symmetric(){return this.sx===this.sy}constructor(){let t=window.devicePixelRatio||1;this.sx=t,this.sy=t}}var en=new WeakMap,er=new WeakMap,el=new WeakMap,eo=new WeakMap,eh=new WeakMap,ed=new WeakSet,ec=new WeakSet,eu=new WeakSet,e_=new WeakSet,ep=new WeakMap;class ef{render(){let t=(0,N._)(this,en,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");let e=(0,O._)(this,el)._uiManager._signal;t.addEventListener("contextmenu",t6,{signal:e}),t.addEventListener("pointerdown",(0,q._)(ef,ef,em),{signal:e});let i=(0,N._)(this,eo,document.createElement("div"));i.className="buttons",t.append(i);let s=(0,O._)(this,el).toolbarPosition;if(s){let{style:e}=t,i="ltr"===(0,O._)(this,el)._uiManager.direction?1-s[0]:s[0];e.insetInlineEnd="".concat(100*i,"%"),e.top="calc(".concat(100*s[1],"% + var(--editor-toolbar-vert-offset))")}return(0,H._)(this,e_,eA).call(this),t}get div(){return(0,O._)(this,en)}hide(){var t;(0,O._)(this,en).classList.add("hidden"),null==(t=(0,O._)(this,er))||t.hideDropdown()}show(){var t;(0,O._)(this,en).classList.remove("hidden"),null==(t=(0,O._)(this,eh))||t.shown()}async addAltText(t){let e=await t.render();(0,H._)(this,eu,ew).call(this,e),(0,O._)(this,eo).prepend(e,(0,O._)(this,ep)),(0,N._)(this,eh,t)}addColorPicker(t){(0,N._)(this,er,t);let e=t.renderButton();(0,H._)(this,eu,ew).call(this,e),(0,O._)(this,eo).prepend(e,(0,O._)(this,ep))}remove(){var t;(0,O._)(this,en).remove(),null==(t=(0,O._)(this,er))||t.destroy(),(0,N._)(this,er,null)}constructor(t){(0,B._)(this,ed),(0,B._)(this,ec),(0,B._)(this,eu),(0,B._)(this,e_),(0,W._)(this,ep,{get:ey,set:void 0}),(0,W._)(this,en,{writable:!0,value:void 0}),(0,W._)(this,er,{writable:!0,value:void 0}),(0,W._)(this,el,{writable:!0,value:void 0}),(0,W._)(this,eo,{writable:!0,value:void 0}),(0,W._)(this,eh,{writable:!0,value:void 0}),(0,N._)(this,en,null),(0,N._)(this,er,null),(0,N._)(this,eo,null),(0,N._)(this,eh,null),(0,N._)(this,el,t),(0,z._)(ef,ef,eg,(0,G._)(ef,ef,eg)||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"}))}}var eg={writable:!0,value:null};function em(t){t.stopPropagation()}function ev(t){(0,O._)(this,el)._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()}function eb(t){(0,O._)(this,el)._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()}function ew(t){let e=(0,O._)(this,el)._uiManager._signal;t.addEventListener("focusin",(0,H._)(this,ed,ev).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",(0,H._)(this,ec,eb).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",t6,{signal:e})}function eA(){let{editorType:t,_uiManager:e}=(0,O._)(this,el),i=document.createElement("button");i.className="delete",i.tabIndex=0,i.setAttribute("data-l10n-id",(0,G._)(ef,ef,eg)[t]),(0,H._)(this,eu,ew).call(this,i),i.addEventListener("click",t=>{e.delete()},{signal:e._signal}),(0,O._)(this,eo).append(i)}function ey(){let t=document.createElement("div");return t.className="divider",t}var eS=new WeakMap,ex=new WeakMap,eE=new WeakMap,ek=new WeakSet,eM=new WeakSet,eC=new WeakSet;class eT{show(t,e,i){let[s,a]=(0,H._)(this,eM,eL).call(this,e,i),{style:n}=(0,N._)(this,ex,(0,O._)(this,ex)||(0,H._)(this,ek,eR).call(this));t.append((0,O._)(this,ex)),n.insetInlineEnd="".concat(100*s,"%"),n.top="calc(".concat(100*a,"% + var(--editor-toolbar-vert-offset))")}hide(){(0,O._)(this,ex).remove()}constructor(t){(0,B._)(this,ek),(0,B._)(this,eM),(0,B._)(this,eC),(0,W._)(this,eS,{writable:!0,value:void 0}),(0,W._)(this,ex,{writable:!0,value:void 0}),(0,W._)(this,eE,{writable:!0,value:void 0}),(0,N._)(this,eS,null),(0,N._)(this,ex,null),(0,N._)(this,eE,t)}}function eR(){let t=(0,N._)(this,ex,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",t6,{signal:(0,O._)(this,eE)._signal});let e=(0,N._)(this,eS,document.createElement("div"));return e.className="buttons",t.append(e),(0,H._)(this,eC,eP).call(this),t}function eL(t,e){let i=0,s=0;for(let a of t){let t=a.y+a.height;if(t<i)continue;let n=a.x+(e?a.width:0);if(t>i){s=n,i=t;continue}e?n>s&&(s=n):n<s&&(s=n)}return[e?1-s:s,i]}function eP(){let t=document.createElement("button");t.className="highlightButton",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");let e=document.createElement("span");t.append(e),e.className="visuallyHidden",e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");let i=(0,O._)(this,eE)._signal;t.addEventListener("contextmenu",t6,{signal:i}),t.addEventListener("click",()=>{(0,O._)(this,eE).highlightSelection("floating_button")},{signal:i}),(0,O._)(this,eS).append(t)}function eI(t,e,i){for(let s of i)e.addEventListener(s,t[s].bind(t))}var eD=new WeakMap;class eF{get id(){return"".concat("pdfjs_internal_editor_").concat((0,j._)(this,eD).value++)}constructor(){(0,W._)(this,eD,{writable:!0,value:void 0}),(0,N._)(this,eD,0)}}var eO=new WeakMap,eW=new WeakMap,eN=new WeakMap,ej=new WeakSet;class eH{static get _isSVGFittingCanvas(){let t=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),e=new Image;return e.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>',tk(this,"_isSVGFittingCanvas",e.decode().then(()=>(t.drawImage(e,0,0,1,1,0,0,1,3),0===new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0])))}async getFromFile(t){let{lastModified:e,name:i,size:s,type:a}=t;return(0,H._)(this,ej,eB).call(this,"".concat(e,"_").concat(i,"_").concat(s,"_").concat(a),t)}async getFromUrl(t){return(0,H._)(this,ej,eB).call(this,t,t)}async getFromBlob(t,e){let i=await e;return(0,H._)(this,ej,eB).call(this,t,i)}async getFromId(t){(0,N._)(this,eN,(0,O._)(this,eN)||new Map);let e=(0,O._)(this,eN).get(t);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){let{blobPromise:t}=e;return delete e.blobPromise,this.getFromBlob(e.id,t)}return this.getFromUrl(e.url)}getFromCanvas(t,e){(0,N._)(this,eN,(0,O._)(this,eN)||new Map);let i=(0,O._)(this,eN).get(t);if(null==i?void 0:i.bitmap)return i.refCounter+=1,i;let s=new OffscreenCanvas(e.width,e.height);return s.getContext("2d").drawImage(e,0,0),i={bitmap:s.transferToImageBitmap(),id:"image_".concat((0,O._)(this,eO),"_").concat((0,j._)(this,eW).value++),refCounter:1,isSvg:!1},(0,O._)(this,eN).set(t,i),(0,O._)(this,eN).set(i.id,i),i}getSvgUrl(t){let e=(0,O._)(this,eN).get(t);return(null==e?void 0:e.isSvg)?e.svgUrl:null}deleteId(t){var e;(0,N._)(this,eN,(0,O._)(this,eN)||new Map);let i=(0,O._)(this,eN).get(t);if(!i||(i.refCounter-=1,0!==i.refCounter))return;let{bitmap:s}=i;
1if(!i.url&&!i.file){let t=new OffscreenCanvas(s.width,s.height);t.getContext("bitmaprenderer").transferFromImageBitmap(s),i.blobPromise=t.convertToBlob()}null==(e=s.close)||e.call(s),i.bitmap=null}isValidId(t){return t.startsWith("image_".concat((0,O._)(this,eO),"_"))}constructor(){(0,B._)(this,ej),(0,W._)(this,eO,{writable:!0,value:void 0}),(0,W._)(this,eW,{writable:!0,value:void 0}),(0,W._)(this,eN,{writable:!0,value:void 0}),(0,N._)(this,eO,function(){var t,e;if("undefined"!=typeof crypto&&"function"==typeof(null==(t=crypto)?void 0:t.randomUUID))return crypto.randomUUID();let i=new Uint8Array(32);if("undefined"!=typeof crypto&&"function"==typeof(null==(e=crypto)?void 0:e.getRandomValues))crypto.getRandomValues(i);else for(let t=0;t<32;t++)i[t]=Math.floor(255*Math.random());return tF(i)}()),(0,N._)(this,eW,0),(0,N._)(this,eN,null)}}async function eB(t,e){(0,N._)(this,eN,(0,O._)(this,eN)||new Map);let i=(0,O._)(this,eN).get(t);if(null===i)return null;if(null==i?void 0:i.bitmap)return i.refCounter+=1,i;try{let t;if(i||(i={bitmap:null,id:"image_".concat((0,O._)(this,eO),"_").concat((0,j._)(this,eW).value++),refCounter:0,isSvg:!1}),"string"==typeof e?(i.url=e,t=await tQ(e,"blob")):e instanceof File?t=i.file=e:e instanceof Blob&&(t=e),"image/svg+xml"===t.type){let e=eH._isSVGFittingCanvas,s=new FileReader,a=new Image,n=new Promise((t,n)=>{a.onload=()=>{i.bitmap=a,i.isSvg=!0,t()},s.onload=async()=>{let t=i.svgUrl=s.result;a.src=await e?"".concat(t,"#svgView(preserveAspectRatio(none))"):t},a.onerror=s.onerror=n});s.readAsDataURL(t),await n}else i.bitmap=await createImageBitmap(t);i.refCounter=1}catch(t){console.error(t),i=null}return(0,O._)(this,eN).set(t,i),i&&(0,O._)(this,eN).set(i.id,i),i}var eG=new WeakMap,ez=new WeakMap,eU=new WeakMap,eV=new WeakMap;class eq{add(t){let{cmd:e,undo:i,post:s,mustExec:a,type:n=NaN,overwriteIfSameType:r=!1,keepUndo:l=!1}=t;if(a&&e(),(0,O._)(this,ez))return;let o={cmd:e,undo:i,post:s,type:n};if(-1===(0,O._)(this,eV)){(0,O._)(this,eG).length>0&&((0,O._)(this,eG).length=0),(0,N._)(this,eV,0),(0,O._)(this,eG).push(o);return}if(r&&(0,O._)(this,eG)[(0,O._)(this,eV)].type===n){l&&(o.undo=(0,O._)(this,eG)[(0,O._)(this,eV)].undo),(0,O._)(this,eG)[(0,O._)(this,eV)]=o;return}let h=(0,O._)(this,eV)+1;h===(0,O._)(this,eU)?(0,O._)(this,eG).splice(0,1):((0,N._)(this,eV,h),h<(0,O._)(this,eG).length&&(0,O._)(this,eG).splice(h)),(0,O._)(this,eG).push(o)}undo(){if(-1===(0,O._)(this,eV))return;(0,N._)(this,ez,!0);let{undo:t,post:e}=(0,O._)(this,eG)[(0,O._)(this,eV)];t(),null==e||e(),(0,N._)(this,ez,!1),(0,N._)(this,eV,(0,O._)(this,eV)-1)}redo(){if((0,O._)(this,eV)<(0,O._)(this,eG).length-1){(0,N._)(this,eV,(0,O._)(this,eV)+1),(0,N._)(this,ez,!0);let{cmd:t,post:e}=(0,O._)(this,eG)[(0,O._)(this,eV)];t(),null==e||e(),(0,N._)(this,ez,!1)}}hasSomethingToUndo(){return -1!==(0,O._)(this,eV)}hasSomethingToRedo(){return(0,O._)(this,eV)<(0,O._)(this,eG).length-1}destroy(){(0,N._)(this,eG,null)}constructor(t=128){(0,W._)(this,eG,{writable:!0,value:void 0}),(0,W._)(this,ez,{writable:!0,value:void 0}),(0,W._)(this,eU,{writable:!0,value:void 0}),(0,W._)(this,eV,{writable:!0,value:void 0}),(0,N._)(this,eG,[]),(0,N._)(this,ez,!1),(0,N._)(this,eV,-1),(0,N._)(this,eU,t)}}var eK=new WeakSet;class eX{exec(t,e){if(!this.allKeys.has(e.key))return;let i=this.callbacks.get((0,H._)(this,eK,eY).call(this,e));if(!i)return;let{callback:s,options:{bubbles:a=!1,args:n=[],checker:r=null}}=i;(!r||r(t,e))&&(s.bind(t,...n,e)(),a||(e.stopPropagation(),e.preventDefault()))}constructor(t){(0,B._)(this,eK),this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;let{isMac:e}=tN.platform;for(let[i,s,a={}]of t)for(let t of i){let i=t.startsWith("mac+");e&&i?(this.callbacks.set(t.slice(4),{callback:s,options:a}),this.allKeys.add(t.split("+").at(-1))):e||i||(this.callbacks.set(t,{callback:s,options:a}),this.allKeys.add(t.split("+").at(-1)))}}}function eY(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);let e=this.buffer.join("+");return this.buffer.length=0,e}class eQ{get _colors(){let t=new Map([["CanvasText",null],["Canvas",null]]),e=document.createElement("span");for(let i of(e.style.visibility="hidden",document.body.append(e),t.keys())){e.style.color=i;let s=window.getComputedStyle(e).color;t.set(i,et(s))}return e.remove(),tk(this,"_colors",t)}convert(t){let e=et(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(let[t,i]of this._colors)if(i.every((t,i)=>t===e[i]))return eQ._colorsMapping.get(t);return e}getHexCode(t){let e=this._colors.get(t);return e?tH.makeHexColor(...e):t}}eQ._colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);var eJ=new WeakMap,eZ=new WeakMap,e$=new WeakMap,e0=new WeakMap,e1=new WeakMap,e2=new WeakMap,e3=new WeakMap,e5=new WeakMap,e6=new WeakMap,e4=new WeakMap,e8=new WeakMap,e7=new WeakMap,e9=new WeakMap,it=new WeakMap,ie=new WeakMap,ii=new WeakMap,is=new WeakMap,ia=new WeakMap,ir=new WeakMap,il=new WeakMap,io=new WeakMap,ih=new WeakMap,id=new WeakMap,ic=new WeakMap,iu=new WeakMap,i_=new WeakMap,ip=new WeakMap,ig=new WeakMap,im=new WeakMap,iv=new WeakMap,ib=new WeakMap,iw=new WeakMap,iA=new WeakMap,iy=new WeakMap,iS=new WeakMap,ix=new WeakMap,iE=new WeakMap,ik=new WeakMap,iM=new WeakMap,iC=new WeakMap,iT=new WeakMap,iR=new WeakSet,iL=new WeakSet,iP=new WeakSet,iI=new WeakSet,iD=new WeakSet,iF=new WeakSet,iO=new WeakSet,iW=new WeakSet,iN=new WeakSet,ij=new WeakSet,iH=new WeakSet,iB=new WeakSet,iG=new WeakSet,iz=new WeakSet,iU=new WeakSet,iV=new WeakSet,iq=new WeakSet,iK=new WeakSet,iX=new WeakMap,iY=new WeakSet,iQ=new WeakSet;class iJ{static get _keyboardManager(){let t=iJ.prototype,e=t=>(0,O._)(t,iM).contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&t.hasSomethingToControl(),i=(t,e)=>{let{target:i}=e;if(i instanceof HTMLInputElement){let{type:t}=i;return"text"!==t&&"number"!==t}return!0},s=this.TRANSLATE_SMALL,a=this.TRANSLATE_BIG;return tk(this,"_keyboardManager",new eX([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:i}],[["ctrl+z","mac+meta+z"],t.undo,{checker:i}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:i}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:i}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(t,e)=>{let{target:i}=e;return!(i instanceof HTMLButtonElement)&&(0,O._)(t,iM).contains(i)&&!t.isEnterHandled}}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(t,e)=>{let{target:i}=e;return!(i instanceof HTMLButtonElement)&&(0,O._)(t,iM).contains(document.activeElement)}}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-s,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-a,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[s,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[a,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-s],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-a],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,s],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,a],checker:e}]]))}destroy(){var t,e,i,s;for(let i of(null==(t=(0,O._)(this,iT))||t.resolve(),(0,N._)(this,iT,null),null==(e=(0,O._)(this,eJ))||e.abort(),(0,N._)(this,eJ,null),this._signal=null,(0,O._)(this,e0).values())
1)i.destroy();(0,O._)(this,e0).clear(),(0,O._)(this,e$).clear(),(0,O._)(this,it).clear(),(0,N._)(this,eZ,null),(0,O._)(this,iw).clear(),(0,O._)(this,e5).destroy(),null==(i=(0,O._)(this,e1))||i.destroy(),null==(s=(0,O._)(this,id))||s.hide(),(0,N._)(this,id,null),(0,O._)(this,ir)&&(clearTimeout((0,O._)(this,ir)),(0,N._)(this,ir,null)),(0,O._)(this,ik)&&(clearTimeout((0,O._)(this,ik)),(0,N._)(this,ik,null))}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return(0,O._)(this,iv)}get useNewAltTextFlow(){return(0,O._)(this,ii)}get useNewAltTextWhenAddingImage(){return(0,O._)(this,is)}get hcmFilter(){return tk(this,"hcmFilter",(0,O._)(this,iy)?(0,O._)(this,ia).addHCMFilter((0,O._)(this,iy).foreground,(0,O._)(this,iy).background):"none")}get direction(){return tk(this,"direction",getComputedStyle((0,O._)(this,iM)).direction)}get highlightColors(){return tk(this,"highlightColors",(0,O._)(this,io)?new Map((0,O._)(this,io).split(",").map(t=>t.split("=").map(t=>t.trim()))):null)}get highlightColorNames(){return tk(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}setMainHighlightColorPicker(t){(0,N._)(this,im,t)}editAltText(t){var e;let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];null==(e=(0,O._)(this,e1))||e.editAltText(this,t,i)}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:t})}setPreference(t,e){this._eventBus.dispatch("setpreference",{source:this,name:t,value:e})}onSetPreference(t){let{name:e,value:i}=t;"enableNewAltTextWhenAddingImage"===e&&(0,N._)(this,is,i)}onPageChanging(t){let{pageNumber:e}=t;(0,N._)(this,e4,e-1)}focusMainContainer(){(0,O._)(this,iM).focus()}findParent(t,e){for(let i of(0,O._)(this,e0).values()){let{x:s,y:a,width:n,height:r}=i.div.getBoundingClientRect();if(t>=s&&t<=s+n&&e>=a&&e<=a+r)return i}return null}disableUserSelect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,O._)(this,iC).classList.toggle("noUserSelect",t)}addShouldRescale(t){(0,O._)(this,it).add(t)}removeShouldRescale(t){(0,O._)(this,it).delete(t)}onScaleChanging(t){let{scale:e}=t;for(let t of(this.commitOrRemove(),this.viewParameters.realScale=e*tY.PDF_TO_CSS_UNITS,(0,O._)(this,it)))t.onScaleChanging()}onRotationChanging(t){let{pagesRotation:e}=t;this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=document.getSelection();if(!e||e.isCollapsed)return;let{anchorNode:i,anchorOffset:s,focusNode:a,focusOffset:n}=e,r=e.toString(),l=(0,H._)(this,iR,iZ).call(this,e).closest(".textLayer"),o=this.getSelectionBoxes(l);if(!o)return;e.empty();let h=(0,H._)(this,iL,i$).call(this,l),d=(0,O._)(this,ib)===td.NONE,c=()=>{null==h||h.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:o,anchorNode:i,anchorOffset:s,focusNode:a,focusOffset:n,text:r}),d&&this.showAllEditors("highlight",!0,!0)};if(d)return void this.switchToMode(td.HIGHLIGHT,c);c()}addToAnnotationStorage(t){!t.isEmpty()&&(0,O._)(this,e2)&&!(0,O._)(this,e2).has(t.id)&&(0,O._)(this,e2).setValue(t.id,t)}blur(){if(this.isShiftKeyDown=!1,(0,O._)(this,ih)&&((0,N._)(this,ih,!1),(0,H._)(this,iD,i2).call(this,"main_toolbar")),!this.hasSelection)return;let{activeElement:t}=document;for(let e of(0,O._)(this,iw))if(e.div.contains(t)){(0,N._)(this,ig,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!(0,O._)(this,ig))return;let[t,e]=(0,O._)(this,ig);(0,N._)(this,ig,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){(0,H._)(this,iN,i4).call(this),(0,H._)(this,iH,i7).call(this)}removeEditListeners(){(0,H._)(this,ij,i8).call(this),(0,H._)(this,iB,i9).call(this)}dragOver(t){for(let{type:e}of t.dataTransfer.items)for(let i of(0,O._)(this,e9))if(i.isHandlingMimeForPasting(e)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(let e of t.dataTransfer.items)for(let i of(0,O._)(this,e9))if(i.isHandlingMimeForPasting(e.type)){i.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){var e;if(t.preventDefault(),null==(e=(0,O._)(this,eZ))||e.commitOrRemove(),!this.hasSelection)return;let i=[];for(let t of(0,O._)(this,iw)){let e=t.serialize(!0);e&&i.push(e)}0!==i.length&&t.clipboardData.setData("application/pdfjs",JSON.stringify(i))}cut(t){this.copy(t),this.delete()}async paste(t){t.preventDefault();let{clipboardData:e}=t;for(let t of e.items)for(let e of(0,O._)(this,e9))if(e.isHandlingMimeForPasting(t.type))return void e.paste(t,this.currentLayer);let i=e.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(t){ty('paste: "'.concat(t.message,'".'));return}if(!Array.isArray(i))return;this.unselectAll();let s=this.currentLayer;try{let t=[];for(let e of i){let i=await s.deserialize(e);if(!i)return;t.push(i)}let e=()=>{for(let e of t)(0,H._)(this,iK,sn).call(this,e);(0,H._)(this,iQ,so).call(this,t)};this.addCommands({cmd:e,undo:()=>{for(let e of t)e.remove()},mustExec:!0})}catch(t){ty('paste: "'.concat(t.message,'".'))}}keydown(t){this.isShiftKeyDown||"Shift"!==t.key||(this.isShiftKeyDown=!0),(0,O._)(this,ib)===td.NONE||this.isEditorHandlingKeyboard||iJ._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&"Shift"===t.key&&(this.isShiftKeyDown=!1,(0,O._)(this,ih)&&((0,N._)(this,ih,!1),(0,H._)(this,iD,i2).call(this,"main_toolbar")))}onEditingAction(t){let{name:e}=t;switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu")}}setEditingState(t){t?((0,H._)(this,iO,i5).call(this),(0,H._)(this,iH,i7).call(this),(0,H._)(this,iz,se).call(this,{isEditing:(0,O._)(this,ib)!==td.NONE,isEmpty:(0,H._)(this,iY,sl).call(this),hasSomethingToUndo:(0,O._)(this,e5).hasSomethingToUndo(),hasSomethingToRedo:(0,O._)(this,e5).hasSomethingToRedo(),hasSelectedEditor:!1})):((0,H._)(this,iW,i6).call(this),(0,H._)(this,iB,i9).call(this),(0,H._)(this,iz,se).call(this,{isEditing:!1}),this.disableUserSelect(!1))}
1registerEditorTypes(t){if(!(0,O._)(this,e9))for(let e of((0,N._)(this,e9,t),(0,O._)(this,e9)))(0,H._)(this,iU,si).call(this,e.defaultPropertiesToUpdate)}getId(){return(0,O._)(this,ic).id}get currentLayer(){return(0,O._)(this,e0).get((0,O._)(this,e4))}getLayer(t){return(0,O._)(this,e0).get(t)}get currentPageIndex(){return(0,O._)(this,e4)}addLayer(t){(0,O._)(this,e0).set(t.pageIndex,t),(0,O._)(this,iu)?t.enable():t.disable()}removeLayer(t){(0,O._)(this,e0).delete(t.pageIndex)}async updateMode(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if((0,O._)(this,ib)!==t){if((0,O._)(this,iT)&&(await (0,O._)(this,iT).promise,!(0,O._)(this,iT)))return;if((0,N._)(this,iT,Promise.withResolvers()),(0,N._)(this,ib,t),t===td.NONE){this.setEditingState(!1),(0,H._)(this,iq,sa).call(this),(0,O._)(this,iT).resolve();return}for(let e of(this.setEditingState(!0),await (0,H._)(this,iV,ss).call(this),this.unselectAll(),(0,O._)(this,e0).values()))e.updateMode(t);if(!e){i&&this.addNewEditorFromKeyboard(),(0,O._)(this,iT).resolve();return}for(let t of(0,O._)(this,e$).values())t.annotationElementId===e?(this.setSelected(t),t.enterInEditMode()):t.unselect();(0,O._)(this,iT).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==(0,O._)(this,ib)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){if((0,O._)(this,e9)){switch(t){case tc.CREATE:this.currentLayer.addNewEditor();return;case tc.HIGHLIGHT_DEFAULT_COLOR:var i;null==(i=(0,O._)(this,im))||i.updateColor(e);break;case tc.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(0,N._)(this,iS,(0,O._)(this,iS)||new Map).set(t,e),this.showAllEditors("highlight",e)}for(let i of(0,O._)(this,iw))i.updateParams(t,e);for(let i of(0,O._)(this,e9))i.updateDefaultParams(t,e)}}showAllEditors(t,e){var i,s;for(let i of(arguments.length>2&&void 0!==arguments[2]&&arguments[2],(0,O._)(this,e$).values()))i.editorType===t&&i.show(e);(null==(s=null==(i=(0,O._)(this,iS))?void 0:i.get(tc.HIGHLIGHT_SHOW_ALL))||s)!==e&&(0,H._)(this,iU,si).call(this,[[tc.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if((0,O._)(this,i_)!==t)for(let e of((0,N._)(this,i_,t),(0,O._)(this,e0).values()))t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}getEditors(t){let e=[];for(let i of(0,O._)(this,e$).values())i.pageIndex===t&&e.push(i);return e}getEditor(t){return(0,O._)(this,e$).get(t)}addEditor(t){(0,O._)(this,e$).set(t.id,t)}removeEditor(t){if(t.div.contains(document.activeElement)&&((0,O._)(this,ir)&&clearTimeout((0,O._)(this,ir)),(0,N._)(this,ir,setTimeout(()=>{this.focusMainContainer(),(0,N._)(this,ir,null)},0))),(0,O._)(this,e$).delete(t.id),this.unselect(t),!t.annotationElementId||!(0,O._)(this,e8).has(t.annotationElementId)){var e;null==(e=(0,O._)(this,e2))||e.remove(t.id)}}addDeletedAnnotationElement(t){(0,O._)(this,e8).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return(0,O._)(this,e8).has(t)}removeDeletedAnnotationElement(t){(0,O._)(this,e8).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){(0,O._)(this,eZ)!==t&&((0,N._)(this,eZ,t),t&&(0,H._)(this,iU,si).call(this,t.propertiesToUpdate))}updateUI(t){(0,O._)(this,iX)===t&&(0,H._)(this,iU,si).call(this,t.propertiesToUpdate)}toggleSelected(t){if((0,O._)(this,iw).has(t)){(0,O._)(this,iw).delete(t),t.unselect(),(0,H._)(this,iz,se).call(this,{hasSelectedEditor:this.hasSelection});return}(0,O._)(this,iw).add(t),t.select(),(0,H._)(this,iU,si).call(this,t.propertiesToUpdate),(0,H._)(this,iz,se).call(this,{hasSelectedEditor:!0})}setSelected(t){for(let e of(0,O._)(this,iw))e!==t&&e.unselect();(0,O._)(this,iw).clear(),(0,O._)(this,iw).add(t),t.select(),(0,H._)(this,iU,si).call(this,t.propertiesToUpdate),(0,H._)(this,iz,se).call(this,{hasSelectedEditor:!0})}isSelected(t){return(0,O._)(this,iw).has(t)}get firstSelectedEditor(){return(0,O._)(this,iw).values().next().value}unselect(t){t.unselect(),(0,O._)(this,iw).delete(t),(0,H._)(this,iz,se).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==(0,O._)(this,iw).size}get isEnterHandled(){return 1===(0,O._)(this,iw).size&&this.firstSelectedEditor.isEnterHandled}undo(){(0,O._)(this,e5).undo(),(0,H._)(this,iz,se).call(this,{hasSomethingToUndo:(0,O._)(this,e5).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:(0,H._)(this,iY,sl).call(this)})}redo(){(0,O._)(this,e5).redo(),(0,H._)(this,iz,se).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:(0,O._)(this,e5).hasSomethingToRedo(),isEmpty:(0,H._)(this,iY,sl).call(this)})}addCommands(t){(0,O._)(this,e5).add(t),(0,H._)(this,iz,se).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:(0,H._)(this,iY,sl).call(this)})}delete(){if(this.commitOrRemove(),!this.hasSelection)return;let t=[...(0,O._)(this,iw)],e=()=>{for(let e of t)(0,H._)(this,iK,sn).call(this,e)};this.addCommands({cmd:()=>{for(let e of t)e.remove()},undo:e,mustExec:!0})}commitOrRemove(){var t;null==(t=(0,O._)(this,eZ))||t.commitOrRemove()}hasSomethingToControl(){return(0,O._)(this,eZ)||this.hasSelection}selectAll(){for(let t of(0,O._)(this,iw))t.commit();(0,H._)(this,iQ,so).call(this,(0,O._)(this,e$).values())}unselectAll(){if((!(0,O._)(this,eZ)||((0,O._)(this,eZ).commitOrRemove(),(0,O._)(this,ib)===td.NONE))&&this.hasSelection){for(let t of(0,O._)(this,iw))t.unselect();(0,O._)(this,iw).clear(),(0,H._)(this,iz,se).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(i||this.commitOrRemove(),!this.hasSelection)return;(0,O._)(this,iE)[0]+=t,(0,O._)(this,iE)[1]+=e;let[s,a]=(0,O._)(this,iE),n=[...(0,O._)(this,iw)];for(let i of((0,O._)(this,ik)&&clearTimeout((0,O._)(this,ik)),(0,N._)(this,ik,setTimeout(()=>{(0,N._)(this,ik,null),(0,O._)(this,iE)[0]=(0,O._)(this,iE)[1]=0,this.addCommands({cmd:()=>{for(let t of n)(0,O._)(this,e$).has(t.id)&&t.translateInPage(s,a)},undo:()=>{for(let t of n)(0,O._)(this,e$).has(t.id)&&t.translateInPage(-s,-a
1)},mustExec:!1})},1e3)),n))i.translateInPage(t,e)}setUpDragSession(){if(this.hasSelection)for(let t of(this.disableUserSelect(!0),(0,N._)(this,e7,new Map),(0,O._)(this,iw)))(0,O._)(this,e7).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}endDragSession(){if(!(0,O._)(this,e7))return!1;this.disableUserSelect(!1);let t=(0,O._)(this,e7);(0,N._)(this,e7,null);let e=!1;for(let[{x:i,y:s,pageIndex:a},n]of t)n.newX=i,n.newY=s,n.newPageIndex=a,e||(e=i!==n.savedX||s!==n.savedY||a!==n.savedPageIndex);if(!e)return!1;let i=(t,e,i,s)=>{if((0,O._)(this,e$).has(t.id)){let a=(0,O._)(this,e0).get(s);a?t._setParentAndPosition(a,e,i):(t.pageIndex=s,t.x=e,t.y=i)}};return this.addCommands({cmd:()=>{for(let[e,{newX:s,newY:a,newPageIndex:n}]of t)i(e,s,a,n)},undo:()=>{for(let[e,{savedX:s,savedY:a,savedPageIndex:n}]of t)i(e,s,a,n)},mustExec:!0}),!0}dragSelectedEditors(t,e){if((0,O._)(this,e7))for(let i of(0,O._)(this,e7).keys())i.drag(t,e)}rebuild(t){if(null===t.parent){let e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){var t;return(null==(t=this.getActive())?void 0:t.shouldGetKeyboardEvents())||1===(0,O._)(this,iw).size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return(0,O._)(this,eZ)===t}getActive(){return(0,O._)(this,eZ)}getMode(){return(0,O._)(this,ib)}get imageManager(){return tk(this,"imageManager",new eH)}getSelectionBoxes(t){let e;if(!t)return null;let i=document.getSelection();for(let e=0,s=i.rangeCount;e<s;e++)if(!t.contains(i.getRangeAt(e).commonAncestorContainer))return null;let{x:s,y:a,width:n,height:r}=t.getBoundingClientRect();switch(t.getAttribute("data-main-rotation")){case"90":e=(t,e,i,l)=>({x:(e-a)/r,y:1-(t+i-s)/n,width:l/r,height:i/n});break;case"180":e=(t,e,i,l)=>({x:1-(t+i-s)/n,y:1-(e+l-a)/r,width:i/n,height:l/r});break;case"270":e=(t,e,i,l)=>({x:1-(e+l-a)/r,y:(t-s)/n,width:l/r,height:i/n});break;default:e=(t,e,i,l)=>({x:(t-s)/n,y:(e-a)/r,width:i/n,height:l/r})}let l=[];for(let t=0,s=i.rangeCount;t<s;t++){let s=i.getRangeAt(t);if(!s.collapsed)for(let{x:t,y:i,width:a,height:n}of s.getClientRects())0!==a&&0!==n&&l.push(e(t,i,a,n))}return 0===l.length?null:l}addChangedExistingAnnotation(t){let{annotationElementId:e,id:i}=t;(0,N._)(this,e3,(0,O._)(this,e3)||new Map).set(e,i)}removeChangedExistingAnnotation(t){var e;let{annotationElementId:i}=t;null==(e=(0,O._)(this,e3))||e.delete(i)}renderAnnotationElement(t){var e;let i=null==(e=(0,O._)(this,e3))?void 0:e.get(t.data.id);if(!i)return;let s=(0,O._)(this,e2).getRawValue(i);s&&((0,O._)(this,ib)!==td.NONE||s.hasBeenModified)&&s.renderAnnotationElement(t)}constructor(t,e,i,s,a,n,r,l,o,h,d){(0,B._)(this,iR),(0,B._)(this,iL),(0,B._)(this,iP),(0,B._)(this,iI),(0,B._)(this,iD),(0,B._)(this,iF),(0,B._)(this,iO),(0,B._)(this,iW),(0,B._)(this,iN),(0,B._)(this,ij),(0,B._)(this,iH),(0,B._)(this,iB),(0,B._)(this,iG),(0,B._)(this,iz),(0,B._)(this,iU),(0,B._)(this,iV),(0,B._)(this,iq),(0,B._)(this,iK),(0,W._)(this,iX,{get:sr,set:void 0}),(0,B._)(this,iY),(0,B._)(this,iQ),(0,W._)(this,eJ,{writable:!0,value:void 0}),(0,W._)(this,eZ,{writable:!0,value:void 0}),(0,W._)(this,e$,{writable:!0,value:void 0}),(0,W._)(this,e0,{writable:!0,value:void 0}),(0,W._)(this,e1,{writable:!0,value:void 0}),(0,W._)(this,e2,{writable:!0,value:void 0}),(0,W._)(this,e3,{writable:!0,value:void 0}),(0,W._)(this,e5,{writable:!0,value:void 0}),(0,W._)(this,e6,{writable:!0,value:void 0}),(0,W._)(this,e4,{writable:!0,value:void 0}),(0,W._)(this,e8,{writable:!0,value:void 0}),(0,W._)(this,e7,{writable:!0,value:void 0}),(0,W._)(this,e9,{writable:!0,value:void 0}),(0,W._)(this,it,{writable:!0,value:void 0}),(0,W._)(this,ie,{writable:!0,value:void 0}),(0,W._)(this,ii,{writable:!0,value:void 0}),(0,W._)(this,is,{writable:!0,value:void 0}),(0,W._)(this,ia,{writable:!0,value:void 0}),(0,W._)(this,ir,{writable:!0,value:void 0}),(0,W._)(this,il,{writable:!0,value:void 0}),(0,W._)(this,io,{writable:!0,value:void 0}),(0,W._)(this,ih,{writable:!0,value:void 0}),(0,W._)(this,id,{writable:!0,value:void 0}),(0,W._)(this,ic,{writable:!0,value:void 0}),(0,W._)(this,iu,{writable:!0,value:void 0}),(0,W._)(this,i_,{writable:!0,value:void 0}),(0,W._)(this,ip,{writable:!0,value:void 0}),(0,W._)(this,ig,{writable:!0,value:void 0}),(0,W._)(this,im,{writable:!0,value:void 0}),(0,W._)(this,iv,{writable:!0,value:void 0}),(0,W._)(this,ib,{writable:!0,value:void 0}),(0,W._)(this,iw,{writable:!0,value:void 0}),(0,W._)(this,iA,{writable:!0,value:void 0}),(0,W._)(this,iy,{writable:!0,value:void 0}),(0,W._)(this,iS,{writable:!0,value:void 0}),(0,W._)(this,ix,{writable:!0,value:void 0}),(0,W._)(this,iE,{writable:!0,value:void 0}),(0,W._)(this,ik,{writable:!0,value:void 0}),(0,W._)(this,iM,{writable:!0,value:void 0}),(0,W._)(this,iC,{writable:!0,value:void 0}),(0,W._)(this,iT,{writable:!0,value:void 0}),(0,N._)(this,eJ,new AbortController),(0,N._)(this,eZ,null),(0,N._)(this,e$,new Map),(0,N._)(this,e0,new Map),(0,N._)(this,e1,null),(0,N._)(this,e2,null),(0,N._)(this,e3,null),(0,N._)(this,e5,new eq),(0,N._)(this,e6,null),(0,N._)(this,e4,0),(0,N._)(this,e8,new Set),(0,N._)(this,e7,null),(0,N._)(this,e9,null),(0,N._)(this,it,new Set),(0,N._)(this,ie,!1),(0,N._)(this,ii,!1),(0,N._)(this,is,!1),(0,N._)(this,ia,null),(0,N._)(this,ir,null),(0,N._)(this,il,null),(0,N._)(this,io,null),(0,N._)(this,ih,!1),(0,N._)(this,id,null),(0,N._)(this,ic,new eF),(0,N._)(this,iu,!1),(0,N._)(this,i_,!1),(0,N._)(this,ip,null),(0,N._)(this,ig,null),(0,N._)(this,im,null),(0,N._)(this,iv,null),(0,N._)(this,ib,td.NONE),(0,N._)(this,iw,new Set),(0,N._)(this,iA,null),(0,N._)(this,iy,null),(0,N._)(this,iS,null),(0,N._)(this,ix,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1}),(0,N._)(this,iE,[0,0]),(0,N._)(this,ik,null),(0,N._)(this,iM,null),(0,N._)(this,iC,null),(0,N._)(this,iT,null);let c=this._signal=(0,O._)(this,eJ).signal;(0,N._)(this,iM,t),(0,N._)(this,iC,e),(0,N._)(this,e1,i),this._eventBus=s,s._on("editingaction",this.onEditingAction.bind(this),{signal:c}),s._on("pagechanging",this.onPageChanging.bind(this),{signal:c}),s._on("scalechanging",this.onScaleChanging.bind(this),{signal:c}),s._on("rotationchanging",this.onRotationChanging.bind(this),{signal:c}),s._on("setpreference",this.onSetPreference.bind(this),{signal:c}),s._on("switchannotationeditorparams",t=>this.updateParams(t.type,t.value),{signal:c}),(0,H._)(this,iF,i3).call(this),(0,H._)(this,iG,st).call(this),(0,H._)(this,iN,i4).call(this),(0,N._)(this,e2,a.annotationStorage),(0,N._)(this,ia,a.filterFactory),(0,N._)(this,iy,n),(0,N._)(this,io,r||null),(0,N._)(this,ie,l),(0,N._)(this,ii,o),(0,N._)(this,is,h),(0,N._)(this,iv,d||null),this.viewParameters={realScale:tY.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}}function iZ(t){let{anchorNode:e}=t;
1return e.nodeType===Node.TEXT_NODE?e.parentElement:e}function i$(t){let{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(let e of(0,O._)(this,e0).values())if(e.hasTextLayer(t))return e;return null}function i0(){let t=document.getSelection();if(!t||t.isCollapsed)return;let e=(0,H._)(this,iR,iZ).call(this,t).closest(".textLayer"),i=this.getSelectionBoxes(e);i&&((0,N._)(this,id,(0,O._)(this,id)||new eT(this)),(0,O._)(this,id).show(e,i,"ltr"===this.direction))}function i1(){var t,e,i;let s=document.getSelection();if(!s||s.isCollapsed){(0,O._)(this,iA)&&(null==(e=(0,O._)(this,id))||e.hide(),(0,N._)(this,iA,null),(0,H._)(this,iz,se).call(this,{hasSelectedText:!1}));return}let{anchorNode:a}=s;if(a===(0,O._)(this,iA))return;let n=(0,H._)(this,iR,iZ).call(this,s).closest(".textLayer");if(!n){(0,O._)(this,iA)&&(null==(i=(0,O._)(this,id))||i.hide(),(0,N._)(this,iA,null),(0,H._)(this,iz,se).call(this,{hasSelectedText:!1}));return}if(null==(t=(0,O._)(this,id))||t.hide(),(0,N._)(this,iA,a),(0,H._)(this,iz,se).call(this,{hasSelectedText:!0}),((0,O._)(this,ib)===td.HIGHLIGHT||(0,O._)(this,ib)===td.NONE)&&((0,O._)(this,ib)===td.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),(0,N._)(this,ih,this.isShiftKeyDown),!this.isShiftKeyDown)){let t=(0,O._)(this,ib)===td.HIGHLIGHT?(0,H._)(this,iL,i$).call(this,n):null;null==t||t.toggleDrawing();let e=new AbortController,i=this.combinedSignal(e),s=i=>{("pointerup"!==i.type||0===i.button)&&(e.abort(),null==t||t.toggleDrawing(!0),"pointerup"===i.type&&(0,H._)(this,iD,i2).call(this,"main_toolbar"))};window.addEventListener("pointerup",s,{signal:i}),window.addEventListener("blur",s,{signal:i})}}function i2(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";(0,O._)(this,ib)===td.HIGHLIGHT?this.highlightSelection(t):(0,O._)(this,ie)&&(0,H._)(this,iP,i0).call(this)}function i3(){document.addEventListener("selectionchange",(0,H._)(this,iI,i1).bind(this),{signal:this._signal})}function i5(){if((0,O._)(this,il))return;(0,N._)(this,il,new AbortController);let t=this.combinedSignal((0,O._)(this,il));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})}function i6(){var t;null==(t=(0,O._)(this,il))||t.abort(),(0,N._)(this,il,null)}function i4(){if((0,O._)(this,ip))return;(0,N._)(this,ip,new AbortController);let t=this.combinedSignal((0,O._)(this,ip));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})}function i8(){var t;null==(t=(0,O._)(this,ip))||t.abort(),(0,N._)(this,ip,null)}function i7(){if((0,O._)(this,e6))return;(0,N._)(this,e6,new AbortController);let t=this.combinedSignal((0,O._)(this,e6));document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})}function i9(){var t;null==(t=(0,O._)(this,e6))||t.abort(),(0,N._)(this,e6,null)}function st(){let t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})}function se(t){Object.entries(t).some(t=>{let[e,i]=t;return(0,O._)(this,ix)[e]!==i})&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign((0,O._)(this,ix),t)}),(0,O._)(this,ib)===td.HIGHLIGHT&&!1===t.hasSelectedEditor&&(0,H._)(this,iU,si).call(this,[[tc.HIGHLIGHT_FREE,!0]]))}function si(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}async function ss(){if(!(0,O._)(this,iu)){(0,N._)(this,iu,!0);let t=[];for(let e of(0,O._)(this,e0).values())t.push(e.enable());for(let e of(await Promise.all(t),(0,O._)(this,e$).values()))e.enable()}}function sa(){if(this.unselectAll(),(0,O._)(this,iu)){for(let t of((0,N._)(this,iu,!1),(0,O._)(this,e0).values()))t.disable();for(let t of(0,O._)(this,e$).values())t.disable()}}function sn(t){let e=(0,O._)(this,e0).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}function sr(){let t=null;for(t of(0,O._)(this,iw));return t}function sl(){if(0===(0,O._)(this,e$).size)return!0;
1if(1===(0,O._)(this,e$).size)for(let t of(0,O._)(this,e$).values())return t.isEmpty();return!1}function so(t){for(let t of(0,O._)(this,iw))t.unselect();for(let e of((0,O._)(this,iw).clear(),t))e.isEmpty()||((0,O._)(this,iw).add(e),e.select());(0,H._)(this,iz,se).call(this,{hasSelectedEditor:this.hasSelection})}iJ.TRANSLATE_SMALL=1,iJ.TRANSLATE_BIG=10;var sh=new WeakMap,sd=new WeakMap,sc=new WeakMap,su=new WeakMap,s_=new WeakMap,sp=new WeakMap,sf=new WeakMap,sg=new WeakMap,sm=new WeakMap,sv=new WeakMap,sb=new WeakMap,sw=new WeakMap,sA=new WeakMap,sy=new WeakSet;class sS{static initialize(t){null!=sS._l10n||(sS._l10n=t)}async render(){let t=(0,N._)(this,sc,document.createElement("button"));t.className="altText",t.tabIndex="0";let e=(0,N._)(this,su,document.createElement("span"));t.append(e),(0,O._)(this,sw)?(t.classList.add("new"),t.setAttribute("data-l10n-id",(0,G._)(sS,sS,sx).missing),e.setAttribute("data-l10n-id",(0,G._)(sS,sS,sx)["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));let i=(0,O._)(this,sm)._uiManager._signal;t.addEventListener("contextmenu",t6,{signal:i}),t.addEventListener("pointerdown",t=>t.stopPropagation(),{signal:i});let s=t=>{t.preventDefault(),(0,O._)(this,sm)._uiManager.editAltText((0,O._)(this,sm)),(0,O._)(this,sw)&&(0,O._)(this,sm)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:(0,O._)(this,sA)}})};return t.addEventListener("click",s,{capture:!0,signal:i}),t.addEventListener("keydown",e=>{e.target===t&&"Enter"===e.key&&((0,N._)(this,sf,!0),s(e))},{signal:i}),await (0,H._)(this,sy,sk).call(this),t}finish(){(0,O._)(this,sc)&&((0,O._)(this,sc).focus({focusVisible:(0,O._)(this,sf)}),(0,N._)(this,sf,!1))}isEmpty(){return(0,O._)(this,sw)?null===(0,O._)(this,sh):!(0,O._)(this,sh)&&!(0,O._)(this,sd)}hasData(){return(0,O._)(this,sw)?null!==(0,O._)(this,sh)||!!(0,O._)(this,sv):this.isEmpty()}get guessedText(){return(0,O._)(this,sv)}async setGuessedText(t){null===(0,O._)(this,sh)&&((0,N._)(this,sv,t),(0,N._)(this,sb,await sS._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),(0,H._)(this,sy,sk).call(this))}toggleAltTextBadge(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!(0,O._)(this,sw)||(0,O._)(this,sh)){var e;null==(e=(0,O._)(this,sg))||e.remove(),(0,N._)(this,sg,null);return}if(!(0,O._)(this,sg)){let t=(0,N._)(this,sg,document.createElement("div"));t.className="noAltTextBadge",(0,O._)(this,sm).div.append(t)}(0,O._)(this,sg).classList.toggle("hidden",!t)}serialize(t){let e=(0,O._)(this,sh);return t||(0,O._)(this,sv)!==e||(e=(0,O._)(this,sb)),{altText:e,decorative:(0,O._)(this,sd),guessedText:(0,O._)(this,sv),textWithDisclaimer:(0,O._)(this,sb)}}get data(){return{altText:(0,O._)(this,sh),decorative:(0,O._)(this,sd)}}set data(t){let{altText:e,decorative:i,guessedText:s,textWithDisclaimer:a,cancel:n=!1}=t;s&&((0,N._)(this,sv,s),(0,N._)(this,sb,a)),((0,O._)(this,sh)!==e||(0,O._)(this,sd)!==i)&&(n||((0,N._)(this,sh,e),(0,N._)(this,sd,i)),(0,H._)(this,sy,sk).call(this))}toggle(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,O._)(this,sc)&&(!t&&(0,O._)(this,sp)&&(clearTimeout((0,O._)(this,sp)),(0,N._)(this,sp,null)),(0,O._)(this,sc).disabled=!t)}shown(){(0,O._)(this,sm)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:(0,O._)(this,sA)}})}destroy(){var t,e;null==(t=(0,O._)(this,sc))||t.remove(),(0,N._)(this,sc,null),(0,N._)(this,su,null),(0,N._)(this,s_,null),null==(e=(0,O._)(this,sg))||e.remove(),(0,N._)(this,sg,null)}constructor(t){(0,W._)(this,sA,{get:sE,set:void 0}),(0,B._)(this,sy),(0,W._)(this,sh,{writable:!0,value:void 0}),(0,W._)(this,sd,{writable:!0,value:void 0}),(0,W._)(this,sc,{writable:!0,value:void 0}),(0,W._)(this,su,{writable:!0,value:void 0}),(0,W._)(this,s_,{writable:!0,value:void 0}),(0,W._)(this,sp,{writable:!0,value:void 0}),(0,W._)(this,sf,{writable:!0,value:void 0}),(0,W._)(this,sg,{writable:!0,value:void 0}),(0,W._)(this,sm,{writable:!0,value:void 0}),(0,W._)(this,sv,{writable:!0,value:void 0}),(0,W._)(this,sb,{writable:!0,value:void 0}),(0,W._)(this,sw,{writable:!0,value:void 0}),(0,N._)(this,sh,null),(0,N._)(this,sd,!1),(0,N._)(this,sc,null),(0,N._)(this,su,null),(0,N._)(this,s_,null),(0,N._)(this,sp,null),(0,N._)(this,sf,!1),(0,N._)(this,sg,null),(0,N._)(this,sm,null),(0,N._)(this,sv,null),(0,N._)(this,sb,null),(0,N._)(this,sw,!1),(0,N._)(this,sm,t),(0,N._)(this,sw,t._uiManager.useNewAltTextFlow),(0,z._)(sS,sS,sx,(0,G._)(sS,sS,sx)||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"}))}}var sx={writable:!0,value:null};function sE(){return(0,O._)(this,sh)&&"added"||null===(0,O._)(this,sh)&&this.guessedText&&"review"||"missing"}async function sk(){var t,e,i;let s=(0,O._)(this,sc);if(!s)return;if((0,O._)(this,sw)){if(s.classList.toggle("done",!!(0,O._)(this,sh)),s.setAttribute("data-l10n-id",(0,G._)(sS,sS,sx)[(0,O._)(this,sA)]),null==(t=(0,O._)(this,su))||t.setAttribute("data-l10n-id",(0,G._)(sS,sS,sx)["".concat((0,O._)(this,sA),"-label")]),!(0,O._)(this,sh)){
1null==(e=(0,O._)(this,s_))||e.remove();return}}else{if(!(0,O._)(this,sh)&&!(0,O._)(this,sd)){s.classList.remove("done"),null==(i=(0,O._)(this,s_))||i.remove();return}s.classList.add("done"),s.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let a=(0,O._)(this,s_);if(!a){(0,N._)(this,s_,a=document.createElement("span")),a.className="tooltip",a.setAttribute("role","tooltip"),a.id="alt-text-tooltip-".concat((0,O._)(this,sm).id);let t=(0,O._)(this,sm)._uiManager._signal;t.addEventListener("abort",()=>{clearTimeout((0,O._)(this,sp)),(0,N._)(this,sp,null)},{once:!0}),s.addEventListener("mouseenter",()=>{(0,N._)(this,sp,setTimeout(()=>{(0,N._)(this,sp,null),(0,O._)(this,s_).classList.add("show"),(0,O._)(this,sm)._reportTelemetry({action:"alt_text_tooltip"})},100))},{signal:t}),s.addEventListener("mouseleave",()=>{var t;(0,O._)(this,sp)&&(clearTimeout((0,O._)(this,sp)),(0,N._)(this,sp,null)),null==(t=(0,O._)(this,s_))||t.classList.remove("show")},{signal:t})}(0,O._)(this,sd)?a.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(a.removeAttribute("data-l10n-id"),a.textContent=(0,O._)(this,sh)),a.parentNode||s.append(a);let n=(0,O._)(this,sm).getImageForAltText();null==n||n.setAttribute("aria-describedby",a.id)}sS._l10n=null;var sM=new WeakMap,sC=new WeakMap,sT=new WeakMap,sR=new WeakMap,sL=new WeakMap,sP=new WeakMap,sI=new WeakMap,sD=new WeakMap,sF=new WeakMap,sO=new WeakMap,sW=new WeakMap,sN=new WeakMap,sj=new WeakMap,sH=new WeakMap,sB=new WeakMap,sG=new WeakMap,sz=new WeakMap,sU=new WeakMap,sV=new WeakMap,sq=new WeakMap,sK=new WeakSet,sX=new WeakSet,sY=new WeakSet,sQ=new WeakSet,sJ=new WeakSet,sZ=new WeakSet,s$=new WeakSet,s0=new WeakSet,s1=new WeakSet,s2=new WeakSet,s3=new WeakSet,s5=new WeakSet,s6=new WeakSet,s4=new WeakSet;class s8{static get _resizerKeyboardManager(){let t=s8.prototype._resizeWithKeyboard,e=iJ.TRANSLATE_SMALL,i=iJ.TRANSLATE_BIG;return tk(this,"_resizerKeyboardManager",new eX([[["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"],s8.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return tk(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){let e=new a_({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(null!=s8._l10n||(s8._l10n=t),s8._l10nResizer||(s8._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!==s8._borderLineWidth)return;let i=getComputedStyle(document.documentElement);s8._borderLineWidth=parseFloat(i.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){tS("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return(0,O._)(this,sV)}set _isDraggable(t){var e;(0,N._)(this,sV,t),null==(e=this.div)||e.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){let[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}
1setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=(0,O._)(this,sq)}setParent(t){null!==t?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):(0,H._)(this,s4,au).call(this),this.parent=t}focusin(t){this._focusEventsAllowed&&((0,O._)(this,sO)?(0,N._)(this,sO,!1):this.parent.setSelected(this))}focusout(t){var e;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;let i=t.relatedTarget;(null==i||!i.closest("#".concat(this.id)))&&(t.preventDefault(),(null==(e=this.parent)?void 0:e.isMultipleSelection)||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,i,s){let[a,n]=this.parentDimensions;[i,s]=this.screenToPageTranslation(i,s),this.x=(t+i)/a,this.y=(e+s)/n,this.fixAndSetPosition()}translate(t,e){(0,H._)(this,sK,s7).call(this,this.parentDimensions,t,e)}translateInPage(t,e){(0,N._)(this,sW,(0,O._)(this,sW)||[this.x,this.y]),(0,H._)(this,sK,s7).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){(0,N._)(this,sW,(0,O._)(this,sW)||[this.x,this.y]);let[i,s]=this.parentDimensions;if(this.x+=t/i,this.y+=e/s,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:t,y:e}=this.div.getBoundingClientRect();this.parent.findNewParent(this,t,e)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:a,y:n}=this,[r,l]=this.getBaseTranslation();a+=r,n+=l,this.div.style.left="".concat((100*a).toFixed(2),"%"),this.div.style.top="".concat((100*n).toFixed(2),"%"),this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!(0,O._)(this,sW)&&((0,O._)(this,sW)[0]!==this.x||(0,O._)(this,sW)[1]!==this.y)}getBaseTranslation(){let[t,e]=this.parentDimensions,{_borderLineWidth:i}=s8,s=i/t,a=i/e;switch(this.rotation){case 90:return[-s,a];case 180:return[s,a];case 270:return[s,-a];default:return[-s,-a]}}get _mustFixPosition(){return!0}fixAndSetPosition(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.rotation,[e,i]=this.pageDimensions,{x:s,y:a,width:n,height:r}=this;if(n*=e,r*=i,s*=e,a*=i,this._mustFixPosition)switch(t){case 0:s=Math.max(0,Math.min(e-n,s)),a=Math.max(0,Math.min(i-r,a));break;case 90:s=Math.max(0,Math.min(e-r,s)),a=Math.min(i,Math.max(n,a));break;case 180:s=Math.min(e,Math.max(n,s)),a=Math.min(i,Math.max(r,a));break;case 270:s=Math.min(e,Math.max(r,s)),a=Math.max(0,Math.min(i-n,a))}this.x=s/=e,this.y=a/=i;let[l,o]=this.getBaseTranslation();s+=l,a+=o;let{style:h}=this.div;h.left="".concat((100*s).toFixed(2),"%"),h.top="".concat((100*a).toFixed(2),"%"),this.moveInDOM()}screenToPageTranslation(t,e){return(0,q._)(s8,s8,s9).call(s8,t,e,this.parentRotation)}pageTranslationToScreen(t,e){return(0,q._)(s8,s8,s9).call(s8,t,e,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{parentScale:t,pageDimensions:[e,i]}=this;return[e*t,i*t]}setDims(t,e){let[i,s]=this.parentDimensions;this.div.style.width="".concat((100*t/i).toFixed(2),"%"),(0,O._)(this,sL)||(this.div.style.height="".concat((100*e/s).toFixed(2),"%"))}fixDims(){let{style:t}=this.div,{height:e,width:i}=t,s=i.endsWith("%"),a=!(0,O._)(this,sL)&&e.endsWith("%");if(s&&a)return;let[n,r]=this.parentDimensions;s||(t.width="".concat((100*parseFloat(i)/n).toFixed(2),"%")),(0,O._)(this,sL)||a||(t.height="".concat((100*parseFloat(e)/r).toFixed(2),"%"))}getInitialTranslation(){return[0,0]}altTextFinish(){var t;null==(t=(0,O._)(this,sT))||t.finish()}async addEditToolbar(){return this._editToolbar||(0,O._)(this,sj)||(this._editToolbar=new ef(this),this.div.append(this._editToolbar.render()),(0,O._)(this,sT)&&await this._editToolbar.addAltText((0,O._)(this,sT))),this._editToolbar}removeEditToolbar(){var t;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,null==(t=(0,O._)(this,sT))||t.destroy())}addContainer(t){var e;let i=null==(e=this._editToolbar)?void 0:e.div;i?i.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){(0,O._)(this,sT)||(sS.initialize(s8._l10n),(0,N._)(this,sT,new sS(this)),(0,O._)(this,sM)&&((0,O._)(this,sT).data=(0,O._)(this,sM),(0,N._)(this,sM,null)),await this.addEditToolbar())}get altTextData(){var t;return null==(t=(0,O._)(this,sT))?void 0:t.data}set altTextData(t){(0,O._)(this,sT)&&((0,O._)(this,sT).data=t)}get guessedAltText(){var t;return null==(t=(0,O._)(this,sT))?void 0:t.guessedText}async setGuessedAltText(t){var e;await (null==(e=(0,O._)(this,sT))?void 0:e.setGuessedText(t))}serializeAltText(t){var e;return null==(e=(0,O._)(this,sT))?void 0:e.serialize(t)}hasAltText(){return!!(0,O._)(this,sT)&&!(0,O._)(this,sT).isEmpty()}hasAltTextData(){var t,e;return null!=(e=null==(t=(0,O._)(this,sT))?void 0:t.hasData())&&e}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=(0,O._)(this,sR)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),(0,H._)(this,s1,al).call(this);let[t,e]=this.parentDimensions;this.parentRotation%180!=0&&(this.div.style.maxWidth="".concat((100*e/t).toFixed(2),"%"),this.div.style.maxHeight="".concat((100*t/e).toFixed(2),"%"));let[i,s]=this.getInitialTranslation();return this.translate(i,s),eI(this,this.div,["pointerdown"]),this.div}pointerdown(t){let{isMac:e}=tN.platform;return 0!==t.button||t.ctrlKey&&e?void t.preventDefault():((0,N._)(this,sO,!0),this._isDraggable)?void(0,H._)(this,s0,ar).call(this,t):void(0,H._)(this,s$,an).call(this,t)}get isSelected(){return this._uiManager.isSelected(this)}moveInDOM(){(0,O._)(this,sB)&&clearTimeout((0,O._)(this,sB)),(0,N._)(this,sB,setTimeout(()=>{var t;(0,N._)(this,sB,null),null==(t=this.parent)||t.moveEditorInDOM(this)},0))}
1_setParentAndPosition(t,e,i){t.changeParent(this),this.x=e,this.y=i,this.fixAndSetPosition()}getRect(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.rotation,s=this.parentScale,[a,n]=this.pageDimensions,[r,l]=this.pageTranslation,o=t/s,h=e/s,d=this.x*a,c=this.y*n,u=this.width*a,_=this.height*n;switch(i){case 0:return[d+o+r,n-c-h-_+l,d+o+u+r,n-c-h+l];case 90:return[d+h+r,n-c+o+l,d+h+_+r,n-c+o+u+l];case 180:return[d-o-u+r,n-c+h+l,d-o+r,n-c+h+_+l];case 270:return[d-h-_+r,n-c-o-u+l,d-h+r,n-c-o+l];default:throw Error("Invalid rotation")}}getRectInCurrentCoords(t,e){let[i,s,a,n]=t,r=a-i,l=n-s;switch(this.rotation){case 0:return[i,e-n,r,l];case 90:return[i,e-s,l,r];case 180:return[a,e-s,r,l];case 270:return[a,e-n,l,r];default:throw Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){(0,N._)(this,sj,!0)}disableEditMode(){(0,N._)(this,sj,!1)}isInEditMode(){return(0,O._)(this,sj)}shouldGetKeyboardEvents(){return(0,O._)(this,sH)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){(0,H._)(this,s1,al).call(this)}rotate(t){}serializeDeleted(){var t;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:(null==(t=this._initialData)?void 0:t.popupRef)||""}}serialize(){arguments.length>0&&void 0!==arguments[0]&&arguments[0],arguments.length>1&&void 0!==arguments[1]&&arguments[1],tS("An editor must be serializable")}static async deserialize(t,e,i){let s=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:i});s.rotation=t.rotation,(0,N._)(s,sM,t.accessibilityData);let[a,n]=s.pageDimensions,[r,l,o,h]=s.getRectInCurrentCoords(t.rect,n);return s.x=r/a,s.y=l/n,s.width=o/a,s.height=h/n,s}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}remove(){var t;if(null==(t=(0,O._)(this,sD))||t.abort(),(0,N._)(this,sD,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),(0,O._)(this,sB)&&(clearTimeout((0,O._)(this,sB)),(0,N._)(this,sB,null)),(0,H._)(this,s4,au).call(this),this.removeEditToolbar(),(0,O._)(this,sU)){for(let t of(0,O._)(this,sU).values())clearTimeout(t);(0,N._)(this,sU,null)}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&((0,H._)(this,sY,ae).call(this),(0,O._)(this,sP).classList.remove("hidden"),eI(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),(0,N._)(this,sI,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});let e=(0,O._)(this,sP).children;if(!(0,O._)(this,sC)){(0,N._)(this,sC,Array.from(e));let t=(0,H._)(this,s2,ao).bind(this),i=(0,H._)(this,s3,ah).bind(this),s=this._uiManager._signal;for(let e of(0,O._)(this,sC)){let a=e.getAttribute("data-resizer-name");e.setAttribute("role","spinbutton"),e.addEventListener("keydown",t,{signal:s}),e.addEventListener("blur",i,{signal:s}),e.addEventListener("focus",(0,H._)(this,s5,ad).bind(this,a),{signal:s}),e.setAttribute("data-l10n-id",s8._l10nResizer[a])}}let i=(0,O._)(this,sC)[0],s=0;for(let t of e){if(t===i)break;s++}let a=(360-this.rotation+this.parentRotation)%360/90*((0,O._)(this,sC).length/4);if(a!==s){if(a<s)for(let t=0;t<s-a;t++)(0,O._)(this,sP).append((0,O._)(this,sP).firstChild);else if(a>s)for(let t=0;t<a-s;t++)(0,O._)(this,sP).firstChild.before((0,O._)(this,sP).lastChild);let t=0;for(let i of e){let e=(0,O._)(this,sC)[t++].getAttribute("data-resizer-name");i.setAttribute("data-l10n-id",s8._l10nResizer[e])}}(0,H._)(this,s6,ac).call(this,0),(0,N._)(this,sH,!0),(0,O._)(this,sP).firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){(0,O._)(this,sH)&&(0,H._)(this,sZ,aa).call(this,(0,O._)(this,sF),{movementX:t,movementY:e})}_stopResizingWithKeyboard(){(0,H._)(this,s4,au).call(this),this.div.focus()}select(){var t,e,i;if(this.makeResizable(),null==(t=this.div)||t.classList.add("selectedEditor"),!this._editToolbar)return void this.addEditToolbar().then(()=>{var t,e;(null==(t=this.div)?void 0:t.classList.contains("selectedEditor"))&&(null==(e=this._editToolbar)||e.show())});null==(e=this._editToolbar)||e.show(),null==(i=(0,O._)(this,sT))||i.toggleAltTextBadge(!1)}unselect(){var t,e,i,s,a;null==(t=(0,O._)(this,sP))||t.classList.add("hidden"),null==(e=this.div)||e.classList.remove("selectedEditor"),(null==(i=this.div)?void 0:i.contains(document.activeElement))&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),null==(s=this._editToolbar)||s.hide(),null==(a=(0,O._)(this,sT))||a.toggleAltTextBadge(!0)}updateParams(t,e){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return(0,O._)(this,sN)}set isEditing(t){(0,N._)(this,sN,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){(0,N._)(this,sL,!0);let{style:i}=this.div;i.aspectRatio=t/e,i.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e){(0,N._)(this,sU,(0,O._)(this,sU)||new Map);let{action:e}=t,i=(0,O._)(this,sU).get(e);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),(0,O._)(this,sU).delete(e),0===(0,O._)(this,sU).size&&(0,N._)(this,sU,null)},s8._telemetryTimeout),(0,O._)(this,sU).set(e,i);return}t.type||(t.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}
1show(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),(0,N._)(this,sR,!1)}disable(){this.div&&(this.div.tabIndex=-1),(0,N._)(this,sR,!0)}renderAnnotationElement(t){let e=t.container.querySelector(".annotationContent");if(e){if("CANVAS"===e.nodeName){let t=e;(e=document.createElement("div")).classList.add("annotationContent",this.editorType),t.before(e)}}else(e=document.createElement("div")).classList.add("annotationContent",this.editorType),t.container.prepend(e);return e}resetAnnotationElement(t){let{firstChild:e}=t.container;(null==e?void 0:e.nodeName)==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}constructor(t){(0,B._)(this,sK),(0,B._)(this,sX),(0,B._)(this,sY),(0,B._)(this,sQ),(0,B._)(this,sJ),(0,B._)(this,sZ),(0,B._)(this,s$),(0,B._)(this,s0),(0,B._)(this,s1),(0,B._)(this,s2),(0,B._)(this,s3),(0,B._)(this,s5),(0,B._)(this,s6),(0,B._)(this,s4),(0,W._)(this,sM,{writable:!0,value:void 0}),(0,W._)(this,sC,{writable:!0,value:void 0}),(0,W._)(this,sT,{writable:!0,value:void 0}),(0,W._)(this,sR,{writable:!0,value:void 0}),(0,W._)(this,sL,{writable:!0,value:void 0}),(0,W._)(this,sP,{writable:!0,value:void 0}),(0,W._)(this,sI,{writable:!0,value:void 0}),(0,W._)(this,sD,{writable:!0,value:void 0}),(0,W._)(this,sF,{writable:!0,value:void 0}),(0,W._)(this,sO,{writable:!0,value:void 0}),(0,W._)(this,sW,{writable:!0,value:void 0}),(0,W._)(this,sN,{writable:!0,value:void 0}),(0,W._)(this,sj,{writable:!0,value:void 0}),(0,W._)(this,sH,{writable:!0,value:void 0}),(0,W._)(this,sB,{writable:!0,value:void 0}),(0,W._)(this,sG,{writable:!0,value:void 0}),(0,W._)(this,sz,{writable:!0,value:void 0}),(0,W._)(this,sU,{writable:!0,value:void 0}),(0,W._)(this,sV,{writable:!0,value:void 0}),(0,W._)(this,sq,{writable:!0,value:void 0}),(0,N._)(this,sM,null),(0,N._)(this,sC,null),(0,N._)(this,sT,null),(0,N._)(this,sR,!1),(0,N._)(this,sL,!1),(0,N._)(this,sP,null),(0,N._)(this,sI,null),(0,N._)(this,sD,null),(0,N._)(this,sF,""),(0,N._)(this,sO,!1),(0,N._)(this,sW,null),(0,N._)(this,sN,!1),(0,N._)(this,sj,!1),(0,N._)(this,sH,!1),(0,N._)(this,sB,null),(0,N._)(this,sG,0),(0,N._)(this,sz,0),(0,N._)(this,sU,null),this._editToolbar=null,this._initialOptions=Object.create(null),this._initialData=null,this._isVisible=!0,this._uiManager=null,this._focusEventsAllowed=!0,(0,N._)(this,sV,!1),(0,N._)(this,sq,s8._zIndex++),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;let{rotation:e,rawDims:{pageWidth:i,pageHeight:s,pageX:a,pageY:n}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,s],this.pageTranslation=[a,n];let[r,l]=this.parentDimensions;this.x=t.x/r,this.y=t.y/l,this.isAttachedToDOM=!1,this.deleted=!1}}function s7(t,e,i){let[s,a]=t;[e,i]=this.screenToPageTranslation(e,i),this.x+=e/s,this.y+=i/a,this.fixAndSetPosition()}function s9(t,e,i){switch(i){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}function at(t){switch(t){case 90:{let[t,e]=this.pageDimensions;return[0,-t/e,e/t,0]}case 180:return[-1,0,0,-1];case 270:{let[t,e]=this.pageDimensions;return[0,t/e,-e/t,0]}default:return[1,0,0,1]}}function ae(){if((0,O._)(this,sP))return;(0,N._)(this,sP,document.createElement("div")),(0,O._)(this,sP).classList.add("resizers");let t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(let i of t){let t=document.createElement("div");(0,O._)(this,sP).append(t),t.classList.add("resizer",i),t.setAttribute("data-resizer-name",i),t.addEventListener("pointerdown",(0,H._)(this,sQ,ai).bind(this,i),{signal:e}),t.addEventListener("contextmenu",t6,{signal:e}),t.tabIndex=-1}this.div.prepend((0,O._)(this,sP))}function ai(t,e){var i;e.preventDefault();let{isMac:s}=tN.platform;if(0!==e.button||e.ctrlKey&&s)return;null==(i=(0,O._)(this,sT))||i.toggle(!1);let a=this._isDraggable;this._isDraggable=!1;let n=new AbortController,r=this._uiManager.combinedSignal(n);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",(0,H._)(this,sZ,aa).bind(this,t),{passive:!0,capture:!0,signal:r}),window.addEventListener("contextmenu",t6,{signal:r});let l=this.x,o=this.y,h=this.width,d=this.height,c=this.parent.div.style.cursor,u=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;let _=()=>{var t;n.abort(),this.parent.togglePointerEvents(!0),null==(t=(0,O._)(this,sT))||t.toggle(!0),this._isDraggable=a,this.parent.div.style.cursor=c,this.div.style.cursor=u,(0,H._)(this,sJ,as).call(this,l,o,h,d)};window.addEventListener("pointerup",_,{signal:r}),window.addEventListener("blur",_,{signal:r})}function as(t,e,i,s){let a=this.x,n=this.y,r=this.width,l=this.height;(a!==t||n!==e||r!==i||l!==s)&&this.addCommands({cmd:()=>{this.width=r,this.height=l,this.x=a,this.y=n;let[t,e]=this.parentDimensions;this.setDims(t*r,e*l),this.fixAndSetPosition()},undo:()=>{this.width=i,this.height=s,this.x=t,this.y=e;let[a,n]=this.parentDimensions;this.setDims(a*i,n*s),this.fixAndSetPosition()},mustExec:!0})}function aa(t,e){let i,s,a,n,[r,l]=this.parentDimensions,o=this.x,h=this.y,d=this.width,c=this.height,u=s8.MIN_SIZE/r,_=s8.MIN_SIZE/l,p=t=>Math.round(1e4*t)/1e4,f=(0,H._)(this,sX,at).call(this,this.rotation),g=(t,e)=>[f[0]*t+f[2]*e,f[1]*t+f[3]*e],m=(0,H._)(this,sX,at).call(this,360-this.rotation),v=!1,b=!1;switch(t){case"topLeft":v=!0,i=(t,e)=>
1[0,0],s=(t,e)=>[t,e];break;case"topMiddle":i=(t,e)=>[t/2,0],s=(t,e)=>[t/2,e];break;case"topRight":v=!0,i=(t,e)=>[t,0],s=(t,e)=>[0,e];break;case"middleRight":b=!0,i=(t,e)=>[t,e/2],s=(t,e)=>[0,e/2];break;case"bottomRight":v=!0,i=(t,e)=>[t,e],s=(t,e)=>[0,0];break;case"bottomMiddle":i=(t,e)=>[t/2,e],s=(t,e)=>[t/2,0];break;case"bottomLeft":v=!0,i=(t,e)=>[0,e],s=(t,e)=>[t,0];break;case"middleLeft":b=!0,i=(t,e)=>[0,e/2],s=(t,e)=>[t,e/2]}let w=i(d,c),A=s(d,c),y=g(...A),S=p(o+y[0]),x=p(h+y[1]),E=1,k=1,[M,C]=this.screenToPageTranslation(e.movementX,e.movementY);if([M,C]=(a=M/r,n=C/l,[m[0]*a+m[2]*n,m[1]*a+m[3]*n]),v){let t=Math.hypot(d,c);E=k=Math.max(Math.min(Math.hypot(A[0]-w[0]-M,A[1]-w[1]-C)/t,1/d,1/c),u/d,_/c)}else b?E=Math.max(u,Math.min(1,Math.abs(A[0]-w[0]-M)))/d:k=Math.max(_,Math.min(1,Math.abs(A[1]-w[1]-C)))/c;let T=p(d*E),R=p(c*k),L=S-(y=g(...s(T,R)))[0],P=x-y[1];this.width=T,this.height=R,this.x=L,this.y=P,this.setDims(r*T,l*R),this.fixAndSetPosition()}function an(t){let{isMac:e}=tN.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}function ar(t){let{isSelected:e}=this;this._uiManager.setUpDragSession();let i=new AbortController,s=this._uiManager.combinedSignal(i);if(e){this.div.classList.add("moving"),(0,N._)(this,sG,t.clientX),(0,N._)(this,sz,t.clientY);let e=t=>{let{clientX:e,clientY:i}=t,[s,a]=this.screenToPageTranslation(e-(0,O._)(this,sG),i-(0,O._)(this,sz));(0,N._)(this,sG,e),(0,N._)(this,sz,i),this._uiManager.dragSelectedEditors(s,a)};window.addEventListener("pointermove",e,{passive:!0,capture:!0,signal:s})}let a=()=>{i.abort(),e&&this.div.classList.remove("moving"),(0,N._)(this,sO,!1),this._uiManager.endDragSession()||(0,H._)(this,s$,an).call(this,t)};window.addEventListener("pointerup",a,{signal:s}),window.addEventListener("blur",a,{signal:s})}function al(){if((0,O._)(this,sD)||!this.div)return;(0,N._)(this,sD,new AbortController);let t=this._uiManager.combinedSignal((0,O._)(this,sD));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})}function ao(t){s8._resizerKeyboardManager.exec(this,t)}function ah(t){var e;(0,O._)(this,sH)&&(null==(e=t.relatedTarget)?void 0:e.parentNode)!==(0,O._)(this,sP)&&(0,H._)(this,s4,au).call(this)}function ad(t){(0,N._)(this,sF,(0,O._)(this,sH)?t:"")}function ac(t){if((0,O._)(this,sC))for(let e of(0,O._)(this,sC))e.tabIndex=t}function au(){if((0,N._)(this,sH,!1),(0,H._)(this,s6,ac).call(this,-1),(0,O._)(this,sI)){let{savedX:t,savedY:e,savedWidth:i,savedHeight:s}=(0,O._)(this,sI);(0,H._)(this,sJ,as).call(this,t,e,i,s),(0,N._)(this,sI,null)}}s8._l10n=null,s8._l10nResizer=null,s8._borderLineWidth=-1,s8._colorManager=new eQ,s8._zIndex=1,s8._telemetryTimeout=1e3;class a_ extends s8{serialize(){return this.serializeDeleted()}constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}}class ap{update(t){let e,i;if("string"==typeof t){e=new Uint8Array(2*t.length),i=0;for(let s=0,a=t.length;s<a;s++){let a=t.charCodeAt(s);a<=255?e[i++]=a:(e[i++]=a>>>8,e[i++]=255&a)}}else if(ArrayBuffer.isView(t))i=(e=t.slice()).byteLength;else throw Error("Invalid data format, must be a string or TypedArray.");let s=i>>2,a=i-4*s,n=new Uint32Array(e.buffer,0,s),r=0,l=0,o=this.h1,h=this.h2;for(let t=0;t<s;t++)1&t?(o^=r=0x1b873593*(r=(r=0xcc9e2d51*(r=n[t])&0xffff0000|11601*r&65535)<<15|r>>>17)&0xffff0000|13715*r&65535,o=5*(o=o<<13|o>>>19)+0xe6546b64):(h^=l=0x1b873593*(l=(l=0xcc9e2d51*(l=n[t])&0xffff0000|11601*l&65535)<<15|l>>>17)&0xffff0000|13715*l&65535,h=5*(h=h<<13|h>>>19)+0xe6546b64);switch(r=0,a){case 3:r^=e[4*s+2]<<16;case 2:r^=e[4*s+1]<<8;case 1:r^=e[4*s],r=0x1b873593*(r=(r=0xcc9e2d51*r&0xffff0000|11601*r&65535)<<15|r>>>17)&0xffff0000|13715*r&65535,1&s?o^=r:h^=r}this.h1=o,this.h2=h}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,e=0xff51afd7*e&0xffff0000|((e<<16|(t=0xed558ccd*t&0xffff0000|36045*t&65535)>>>16)*0xafd7ed55&0xffff0000)>>>16,t^=e>>>1,e=0xc4ceb9fe*e&0xffff0000|((e<<16|(t=0x1a85ec53*t&0xffff0000|60499*t&65535)>>>16)*0xb9fe1a85&0xffff0000)>>>16,((t^=e>>>1)>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}constructor(t){this.h1=t?0|t:0xc3d2e1f0,this.h2=t?0|t:0xc3d2e1f0}}let af=Object.freeze({map:null,hash:"",transfer:void 0});var ag=new WeakMap,am=new WeakMap,av=new WeakMap,ab=new WeakSet;class aw{getValue(t,e){let i=(0,O._)(this,av).get(t);return void 0===i?e:Object.assign(e,i)}getRawValue(t){return(0,O._)(this,av).get(t)}remove(t){if((0,O._)(this,av).delete(t),0===(0,O._)(this,av).size&&this.resetModified(),"function"==typeof this.onAnnotationEditor){for(let t of(0,O._)(this,av).values())if(t instanceof s8)return;this.onAnnotationEditor(null)}}setValue(t,e){let i=(0,O._)(this,av).get(t),s=!1;if(void 0!==i)for(let[t,a]of Object.entries(e))i[t]!==a&&(s=!0,i[t]=a);else s=!0,(0,O._)(this,av).set(t,e);s&&(0,H._)(this,ab,aA).call(this),e instanceof s8&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(e.constructor._type)}has(t){return(0,O._)(this,av).has(t)}getAll(){return(0,O._)(this,av).size>0?tW((0,O._)(this,av)):null}setAll(t){for(let[e,i]of Object.entries(t))this.setValue(e,i)}get size(){return(0,O._)(this,av).size}resetModified(){(0,O._)(this,ag)&&((0,N._)(this,ag,!1),"function"==typeof this.onResetModified&&this.onResetModified())}get print(){return new aS(this)}get serializable(){if(0===(0,O._)(this,av).size)return af;let t=new Map,e=new ap,i=[],s=Object.create(null),a=!1;for(let[i,n]of(0,O._)(this,av)){let r=n instanceof s8?n.serialize(!1,s):n;r&&(t.set(i,r),e.update("".concat(i,":").concat(JSON.stringify(r))),a||(a=!!r.bitmap))}if(a)for(let e of t.values())e.bitmap&&i.push(e.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:i}:af}get editorStats(){let t=null,e=new Map;for(let a of(0,O._)(this,av).values()){var i,s;if(!(a instanceof s8))continue;let n=a.telemetryFinalData;if(!n)continue;let{type:r}=n;e.has(r)||e.set(r,Object.getPrototypeOf(a).constructor),t||(t=Object.create(null));let l=(i=t)[r]||(i[r]=new Map);for(let[t,e]of Object.entries(n)){if("type"===t)continue;let i=l.get(t);i||(i=new Map,l.set(t,i));let a=null!=(s=i.get(e))?s:0;i.set(e,a+1)}}for(let[i,s]of e)t[i]=s.computeTelemetryFinalData(t[i]);return t}resetModifiedIds(){(0,N._)(this,am,null)}get modifiedIds(){if((0,O._)(this,am))return(0,O._)(this,am);let t=[];for(let e of(0,O._)(this,av).values())e instanceof s8&&e.annotationElementId&&e.serialize()&&t.pu
1sh(e.annotationElementId);return(0,N._)(this,am,{ids:new Set(t),hash:t.join(",")})}constructor(){(0,B._)(this,ab),(0,W._)(this,ag,{writable:!0,value:void 0}),(0,W._)(this,am,{writable:!0,value:void 0}),(0,W._)(this,av,{writable:!0,value:void 0}),(0,N._)(this,ag,!1),(0,N._)(this,am,null),(0,N._)(this,av,new Map),this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}}function aA(){(0,O._)(this,ag)||((0,N._)(this,ag,!0),"function"==typeof this.onSetModified&&this.onSetModified())}var ay=new WeakMap;class aS extends aw{get print(){tS("Should not call PrintAnnotationStorage.print")}get serializable(){return(0,O._)(this,ay)}get modifiedIds(){return tk(this,"modifiedIds",{ids:new Set,hash:""})}constructor(t){super(),(0,W._)(this,ay,{writable:!0,value:void 0});let{map:e,hash:i,transfer:s}=t.serializable,a=structuredClone(e,s?{transfer:s}:null);(0,N._)(this,ay,{map:a,hash:i,transfer:s})}}var ax=new WeakMap;class aE{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));let e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(let t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),(0,O._)(this,ax).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont(t){let{systemFontInfo:e,_inspectFont:i}=t;if(!(!e||(0,O._)(this,ax).has(e.loadedName))){if(tx(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:t,src:s,style:a}=e,n=new FontFace(t,s,a);this.addNativeFontFace(n);try{await n.load(),(0,O._)(this,ax).add(t),null==i||i(e)}catch(t){ty("Cannot load system font: ".concat(e.baseFontName,", installing it could help to improve PDF rendering.")),this.removeNativeFontFace(n)}return}tS("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo)return void await this.loadSystemFont(t);if(this.isFontLoadingAPISupported){let e=t.createNativeFontFace();if(e){this.addNativeFontFace(e);try{await e.loaded}catch(i){throw ty("Failed to load font '".concat(e.family,"': '").concat(i,"'.")),t.disableFontFace=!0,i}}return}let e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(e=>{let i=this._queueLoadingCallback(e);this._prepareFontLoadEvent(t,i)})}}get isFontLoadingAPISupported(){var t;return tk(this,"isFontLoadingAPISupported",!!(null==(t=this._document)?void 0:t.fonts))}get isSyncFontLoadingSupported(){var t;let e=!1;return tn?e=!0:"undefined"!=typeof navigator&&"string"==typeof(null==(t=navigator)?void 0:t.userAgent)&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent)&&(e=!0),tk(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(t){let{loadingRequests:e}=this,i={done:!1,complete:function(){for(tx(!i.done,"completeRequest() cannot be called twice."),i.done=!0;e.length>0&&e[0].done;)setTimeout(e.shift().callback,0)},callback:t};return e.push(i),i}get _loadTestFont(){return tk(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(t,e){var i;let s,a;function n(t,e){return t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|255&t.charCodeAt(e+3)}function r(t,e,i,s){return t.substring(0,e)+s+t.substring(e+i)}let l=this._document.createElement("canvas");l.width=1,l.height=1;let o=l.getContext("2d"),h=0,d="lt".concat(Date.now()).concat(this.loadTestFontId++),c=this._loadTestFont,u=n(c=r(c,976,d.length,d),16);for(s=0,a=d.length-3;s<a;s+=4)u=u-0x58585858+n(d,s)|0;s<d.length&&(u=u-0x58585858+n(d+"XXX",s)|0),c=r(c,16,4,String.fromCharCode((i=u)>>24&255,i>>16&255,i>>8&255,255&i));let _="url(data:font/opentype;base64,".concat(btoa(c),");"),p='@font-face {font-family:"'.concat(d,'";src:').concat(_,"}");this.insertRule(p);let f=this._document.createElement("div");
1for(let e of(f.style.visibility="hidden",f.style.width=f.style.height="10px",f.style.position="absolute",f.style.top=f.style.left="0px",[t.loadedName,d])){let t=this._document.createElement("span");t.textContent="Hi",t.style.fontFamily=e,f.append(t)}this._document.body.append(f),function t(e,i){if(++h>30){ty("Load test font never loaded."),i();return}if(o.font="30px "+e,o.fillText(".",0,20),o.getImageData(0,0,1,1).data[3]>0)return void i();setTimeout(t.bind(null,e,i))}(d,()=>{f.remove(),e.complete()})}constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){(0,W._)(this,ax,{writable:!0,value:void 0}),(0,N._)(this,ax,new Set),this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}}class ak{createNativeFontFace(){var t;let e;if(!this.data||this.disableFontFace)return null;if(this.cssFontInfo){let t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style="oblique ".concat(this.cssFontInfo.italicAngle,"deg")),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}else e=new FontFace(this.loadedName,this.data,{});return null==(t=this._inspectFont)||t.call(this,this),e}createFontFaceRule(){var t,e;let i;if(!this.data||this.disableFontFace)return null;let s="url(data:".concat(this.mimetype,";base64,").concat((e=this.data,Uint8Array.prototype.toBase64?e.toBase64():btoa(tF(e))),");");if(this.cssFontInfo){let t="font-weight: ".concat(this.cssFontInfo.fontWeight,";");this.cssFontInfo.italicAngle&&(t+="font-style: oblique ".concat(this.cssFontInfo.italicAngle,"deg;")),i='@font-face {font-family:"'.concat(this.cssFontInfo.fontFamily,'";').concat(t,"src:").concat(s,"}")}else i='@font-face {font-family:"'.concat(this.loadedName,'";src:').concat(s,"}");return null==(t=this._inspectFont)||t.call(this,this,s),i}getPathGenerator(t,e){let i;if(void 0!==this.compiledGlyphs[e])return this.compiledGlyphs[e];try{i=t.get(this.loadedName+"_path_"+e)}catch(t){ty('getPathGenerator - ignoring character: "'.concat(t,'".'))}if(!Array.isArray(i)||0===i.length)return this.compiledGlyphs[e]=function(t,e){};let s=[];for(let t=0,e=i.length;t<e;)switch(i[t++]){case tK.BEZIER_CURVE_TO:{let[e,a,n,r,l,o]=i.slice(t,t+6);s.push(t=>t.bezierCurveTo(e,a,n,r,l,o)),t+=6}break;case tK.MOVE_TO:{let[e,a]=i.slice(t,t+2);s.push(t=>t.moveTo(e,a)),t+=2}break;case tK.LINE_TO:{let[e,a]=i.slice(t,t+2);s.push(t=>t.lineTo(e,a)),t+=2}break;case tK.QUADRATIC_CURVE_TO:{let[e,a,n,r]=i.slice(t,t+4);s.push(t=>t.quadraticCurveTo(e,a,n,r)),t+=4}break;case tK.RESTORE:s.push(t=>t.restore());break;case tK.SAVE:s.push(t=>t.save());break;case tK.SCALE:tx(2===s.length,"Scale command is only valid at the third position.");break;case tK.TRANSFORM:{let[e,a,n,r,l,o]=i.slice(t,t+6);s.push(t=>t.transform(e,a,n,r,l,o)),t+=6}break;case tK.TRANSLATE:{let[e,a]=i.slice(t,t+2);s.push(t=>t.translate(e,a)),t+=2}}return this.compiledGlyphs[e]=function(t,e){s[0](t),s[1](t),t.scale(e,-e);for(let e=2,i=s.length;e<i;e++)s[e](t)}}constructor(t,{disableFontFace:e=!1,inspectFont:i=null}){for(let e in this.compiledGlyphs=Object.create(null),t)this[e]=t[e];this.disableFontFace=!0===e,this._inspectFont=i}}var aM=new WeakMap;class aC{create(t,e){if(t<=0||e<=0)throw Error("Invalid canvas size");let i=this._createCanvas(t,e);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!(0,O._)(this,aM)})}}reset(t,e,i){if(!t.canvas)throw Error("Canvas is not specified");if(e<=0||i<=0)throw Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=i}destroy(t){if(!t.canvas)throw Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){tS("Abstract method `_createCanvas` called.")}constructor({enableHWA:t=!1}){(0,W._)(this,aM,{writable:!0,value:void 0}),(0,N._)(this,aM,!1),(0,N._)(this,aM,t)}}class aT extends aC{_createCanvas(t,e){let i=this._document.createElement("canvas");return i.width=t,i.height=e,i}constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}}class aR{async fetch(t){let{name:e}=t;if(!this.baseUrl)throw Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!e)throw Error("CMap name must be specified.");let i=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(i).then(t=>({cMapData:t,isCompressed:this.isCompressed})).catch(t=>{throw Error("Unable to load ".concat(this.isCompressed?"binary ":"","CMap at: ").concat(i))})}async _fetch(t){tS("Abstract method `_fetch` called.")}constructor({baseUrl:t=null,isCompressed:e=!0}){this.baseUrl=t,this.isCompressed=e}}class aL extends aR{async _fetch(t){let e=await tQ(t,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):tO(e)}}class aP{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,i,s,a){return"none"}destroy(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]}}var aI=new WeakMap,aD=new WeakMap,aF=new WeakMap,aO=new WeakMap,aW=new WeakMap,aN=new WeakMap,aj=new WeakMap,aH=new WeakMap,aB=new WeakMap,aG=new WeakMap,az=new WeakSet,aU=new WeakSet,aV=new WeakSet,aq=new WeakSet,aK=new WeakSet,aX=new WeakSet,aY=new WeakSet,aQ=new WeakSet,aJ=new WeakSet;class aZ extends aP{addFilter(t){if(!t)return"none";let e=(0,O._)(this,aH).get(t);if(e)return e;
1let[i,s,a]=(0,H._)(this,az,a2).call(this,t),n=1===t.length?i:"".concat(i).concat(s).concat(a);if(e=(0,O._)(this,aH).get(n))return(0,O._)(this,aH).set(t,e),e;let r="g_".concat((0,O._)(this,aO),"_transfer_map_").concat((0,j._)(this,aj).value++),l=(0,H._)(this,aU,a3).call(this,r);(0,O._)(this,aH).set(t,l),(0,O._)(this,aH).set(n,l);let o=(0,H._)(this,aK,a4).call(this,r);return(0,H._)(this,aY,a7).call(this,i,s,a,o),l}addHCMFilter(t,e){let i="".concat(t,"-").concat(e),s="base",a=(0,O._)(this,aB).get(s);if((null==a?void 0:a.key)===i)return a.url;if(a){var n;null==(n=a.filter)||n.remove(),a.key=i,a.url="none",a.filter=null}else a={key:i,url:"none",filter:null},(0,O._)(this,aB).set(s,a);if(!t||!e)return a.url;let r=(0,H._)(this,aJ,nt).call(this,t);t=tH.makeHexColor(...r);let l=(0,H._)(this,aJ,nt).call(this,e);if(e=tH.makeHexColor(...l),(0,O._)(this,aG).style.color="","#000000"===t&&"#ffffff"===e||t===e)return a.url;let o=Array(256);for(let t=0;t<=255;t++){let e=t/255;o[t]=e<=.03928?e/12.92:((e+.055)/1.055)**2.4}let h=o.join(","),d="g_".concat((0,O._)(this,aO),"_hcm_filter"),c=a.filter=(0,H._)(this,aK,a4).call(this,d);(0,H._)(this,aY,a7).call(this,h,h,h,c),(0,H._)(this,aq,a6).call(this,c);let u=(t,e)=>{let i=r[t]/255,s=l[t]/255,a=Array(e+1);for(let t=0;t<=e;t++)a[t]=i+t/e*(s-i);return a.join(",")};return(0,H._)(this,aY,a7).call(this,u(0,5),u(1,5),u(2,5),c),a.url=(0,H._)(this,aU,a3).call(this,d),a.url}addAlphaFilter(t){let e=(0,O._)(this,aH).get(t);if(e)return e;let[i]=(0,H._)(this,az,a2).call(this,[t]),s="alpha_".concat(i);if(e=(0,O._)(this,aH).get(s))return(0,O._)(this,aH).set(t,e),e;let a="g_".concat((0,O._)(this,aO),"_alpha_map_").concat((0,j._)(this,aj).value++),n=(0,H._)(this,aU,a3).call(this,a);(0,O._)(this,aH).set(t,n),(0,O._)(this,aH).set(s,n);let r=(0,H._)(this,aK,a4).call(this,a);return(0,H._)(this,aQ,a9).call(this,i,r),n}addLuminosityFilter(t){let e,i,s=(0,O._)(this,aH).get(t||"luminosity");if(s)return s;if(t?([e]=(0,H._)(this,az,a2).call(this,[t]),i="luminosity_".concat(e)):i="luminosity",s=(0,O._)(this,aH).get(i))return(0,O._)(this,aH).set(t,s),s;let a="g_".concat((0,O._)(this,aO),"_luminosity_map_").concat((0,j._)(this,aj).value++),n=(0,H._)(this,aU,a3).call(this,a);(0,O._)(this,aH).set(t,n),(0,O._)(this,aH).set(i,n);let r=(0,H._)(this,aK,a4).call(this,a);return(0,H._)(this,aV,a5).call(this,r),t&&(0,H._)(this,aQ,a9).call(this,e,r),n}addHighlightHCMFilter(t,e,i,s,a){let n="".concat(e,"-").concat(i,"-").concat(s,"-").concat(a),r=(0,O._)(this,aB).get(t);if((null==r?void 0:r.key)===n)return r.url;if(r){var l;null==(l=r.filter)||l.remove(),r.key=n,r.url="none",r.filter=null}else r={key:n,url:"none",filter:null},(0,O._)(this,aB).set(t,r);if(!e||!i)return r.url;let[o,h]=[e,i].map((0,H._)(this,aJ,nt).bind(this)),d=Math.round(.2126*o[0]+.7152*o[1]+.0722*o[2]),c=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),[u,_]=[s,a].map((0,H._)(this,aJ,nt).bind(this));c<d&&([d,c,u,_]=[c,d,_,u]),(0,O._)(this,aG).style.color="";let p=(t,e,i)=>{let s=Array(256),a=(c-d)/i,n=t/255,r=(e-t)/(255*i),l=0;for(let t=0;t<=i;t++){let e=Math.round(d+t*a),i=n+t*r;for(let t=l;t<=e;t++)s[t]=i;l=e+1}for(let t=l;t<256;t++)s[t]=s[l-1];return s.join(",")},f="g_".concat((0,O._)(this,aO),"_hcm_").concat(t,"_filter"),g=r.filter=(0,H._)(this,aK,a4).call(this,f);return(0,H._)(this,aq,a6).call(this,g),(0,H._)(this,aY,a7).call(this,p(u[0],_[0],5),p(u[1],_[1],5),p(u[2],_[2],5),g),r.url=(0,H._)(this,aU,a3).call(this,f),r.url}destroy(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];t&&0!==(0,O._)(this,aB).size||((0,O._)(this,aF)&&((0,O._)(this,aF).parentNode.parentNode.remove(),(0,N._)(this,aF,null)),(0,O._)(this,aD)&&((0,O._)(this,aD).clear(),(0,N._)(this,aD,null)),(0,N._)(this,aj,0))}constructor({docId:t,ownerDocument:e=globalThis.document}){super(),(0,W._)(this,aH,{get:a$,set:void 0}),(0,W._)(this,aB,{get:a0,set:void 0}),(0,W._)(this,aG,{get:a1,set:void 0}),(0,B._)(this,az),(0,B._)(this,aU),(0,B._)(this,aV),(0,B._)(this,aq),(0,B._)(this,aK),(0,B._)(this,aX),(0,B._)(this,aY),(0,B._)(this,aQ),(0,B._)(this,aJ),(0,W._)(this,aI,{writable:!0,value:void 0}),(0,W._)(this,aD,{writable:!0,value:void 0}),(0,W._)(this,aF,{writable:!0,value:void 0}),(0,W._)(this,aO,{writable:!0,value:void 0}),(0,W._)(this,aW,{writable:!0,value:void 0}),(0,W._)(this,aN,{writable:!0,value:void 0}),(0,W._)(this,aj,{writable:!0,value:void 0}),(0,N._)(this,aj,0),(0,N._)(this,aO,t),(0,N._)(this,aW,e)}}function a$(){return(0,N._)(this,aD,(0,O._)(this,aD)||new Map)}function a0(){return(0,N._)(this,aN,(0,O._)(this,aN)||new Map)}function a1(){if(!(0,O._)(this,aF)){let t=(0,O._)(this,aW).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;let i=(0,O._)(this,aW).createElementNS(tX,"svg");i.setAttribute("width",0),i.setAttribute("height",0),(0,N._)(this,aF,(0,O._)(this,aW).createElementNS(tX,"defs")),t.append(i),i.append((0,O._)(this,aF)),(0,O._)(this,aW).body.append(t)}return(0,O._)(this,aF)}function a2(t){if(1===t.length){let e=t[0],i=Array(256);for(let t=0;t<256;t++)i[t]=e[t]/255;let s=i.join(",");return[s,s,s]}let[e,i,s]=t,a=Array(256),n=Array(256),r=Array(256);for(let t=0;t<256;t++)a[t]=e[t]/255,n[t]=i[t]/255,r[t]=s[t]/255;return[a.join(","),n.join(","),r.join(",")]}function a3(t){if(void 0===(0,O._)(this,aI)){(0,N._)(this,aI,"");let t=(0,O._)(this,aW).URL;t!==(0,O._)(this,aW).baseURI&&(t$(t)?ty('#createUrl: ignore "data:"-URL for performance reasons.'):(0,N._)(this,aI,t.split("#",1)[0]))}
1return"url(".concat((0,O._)(this,aI),"#").concat(t,")")}function a5(t){let e=(0,O._)(this,aW).createElementNS(tX,"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)}function a6(t){let e=(0,O._)(this,aW).createElementNS(tX,"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)}function a4(t){let e=(0,O._)(this,aW).createElementNS(tX,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),(0,O._)(this,aG).append(e),e}function a8(t,e,i){let s=(0,O._)(this,aW).createElementNS(tX,e);s.setAttribute("type","discrete"),s.setAttribute("tableValues",i),t.append(s)}function a7(t,e,i,s){let a=(0,O._)(this,aW).createElementNS(tX,"feComponentTransfer");s.append(a),(0,H._)(this,aX,a8).call(this,a,"feFuncR",t),(0,H._)(this,aX,a8).call(this,a,"feFuncG",e),(0,H._)(this,aX,a8).call(this,a,"feFuncB",i)}function a9(t,e){let i=(0,O._)(this,aW).createElementNS(tX,"feComponentTransfer");e.append(i),(0,H._)(this,aX,a8).call(this,i,"feFuncA",t)}function nt(t){return(0,O._)(this,aG).style.color=t,et(getComputedStyle((0,O._)(this,aG)).getPropertyValue("color"))}class ne{async fetch(t){let{filename:e}=t;if(!this.baseUrl)throw Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!e)throw Error("Font filename must be specified.");let i="".concat(this.baseUrl).concat(e);return this._fetch(i).catch(t=>{throw Error("Unable to load font data at: ".concat(i))})}async _fetch(t){tS("Abstract method `_fetch` called.")}constructor({baseUrl:t=null}){this.baseUrl=t}}class ni extends ne{async _fetch(t){return new Uint8Array(await tQ(t,"arraybuffer"))}}if(tn){var ns=Promise.withResolvers(),na=null;(async()=>{let t,e,i=await import("../../empty-bpjotJsQ.js"),s=await import("../../index-DLYzfqHG.js").then(t=>t.i);return new Map(Object.entries({fs:i,http:s,https:await import("../../index-gV5VjNEh.js").then(t=>t.i),url:await import("../../url-BttYXSOp.js").then(t=>t.u),canvas:t,path2d:e}))})().then(t=>{na=t,ns.resolve()},t=>{ty("loadPackages: ".concat(t)),na=new Map,ns.resolve()})}class nn{static get promise(){return ns.promise}static get(t){return null==na?void 0:na.get(t)}}async function nr(t){let e=nn.get("fs");return new Uint8Array(await e.promises.readFile(t))}class nl extends aP{}class no extends aC{_createCanvas(t,e){return nn.get("canvas").createCanvas(t,e)}}class nh extends aR{async _fetch(t){return nr(t)}}class nd extends ne{async _fetch(t){return nr(t)}}let nc={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function nu(t,e){if(!e)return;let i=e[2]-e[0],s=e[3]-e[1],a=new Path2D;a.rect(e[0],e[1],i,s),t.clip(a)}class n_{getPattern(){tS("Abstract method `getPattern` called.")}}class np extends n_{_createGradient(t){let e;for(let i of("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)),this._colorStops))e.addColorStop(i[0],i[1]);return e}getPattern(t,e,i,s){let a;if(s===nc.STROKE||s===nc.FILL){let n=e.current.getClippedPathBoundingBox(s,ee(t))||[0,0,0,0],r=Math.ceil(n[2]-n[0])||1,l=Math.ceil(n[3]-n[1])||1,o=e.cachedCanvases.getCanvas("pattern",r,l),h=o.context;h.clearRect(0,0,h.canvas.width,h.canvas.height),h.beginPath(),h.rect(0,0,h.canvas.width,h.canvas.height),h.translate(-n[0],-n[1]),i=tH.transform(i,[1,0,0,1,n[0],n[1]]),h.transform(...e.baseTransform),this.matrix&&h.transform(...this.matrix),nu(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),a=t.createPattern(o.canvas,"no-repeat");let d=new DOMMatrix(i);a.setTransform(d)}else nu(t,this._bbox),a=this._createGradient(t);return a}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}}function nf(t,e,i,s,a,n,r,l){let o,h,d,c,u,_,p,f,g,m=e.coords,v=e.colors,b=t.data,w=4*t.width;m[i+1]>m[s+1]&&(o=i,i=s,s=o,o=n,n=r,r=o),m[s+1]>m[a+1]&&(o=s,s=a,a=o,o=r,r=l,l=o),m[i+1]>m[s+1]&&(o=i,i=s,s=o,o=n,n=r,r=o);let A=(m[i]+e.offsetX)*e.scaleX,y=(m[i+1]+e.offsetY)*e.scaleY,S=(m[s]+e.offsetX)*e.scaleX,x=(m[s+1]+e.offsetY)*e.scaleY,E=(m[a]+e.offsetX)*e.scaleX,k=(m[a+1]+e.offsetY)*e.scaleY;if(y>=k)return;let M=v[n],C=v[n+1],T=v[n+2],R=v[r],L=v[r+1],P=v[r+2],I=v[l],D=v[l+1],F=v[l+2],O=Math.round(y),W=Math.round(k);for(let t=O;t<=W;t++){let e;if(t<x){let e=t<y?0:(y-t)/(y-x);h=A-(A-S)*e,d=M-(M-R)*e,c=C-(C-L)*e,u=T-(T-P)*e}else{let e;h=S-(S-E)*(e=t>k?1:x===k?0:(x-t)/(x-k)),d=R-(R-I)*e,c=L-(L-D)*e,u=P-(P-F)*e}
1_=A-(A-E)*(e=t<y?0:t>k?1:(y-t)/(y-k)),p=M-(M-I)*e,f=C-(C-D)*e,g=T-(T-F)*e;let i=Math.round(Math.min(h,_)),s=Math.round(Math.max(h,_)),a=w*t+4*i;for(let t=i;t<=s;t++)(e=(h-t)/(h-_))<0?e=0:e>1&&(e=1),b[a++]=d-(d-p)*e|0,b[a++]=c-(c-f)*e|0,b[a++]=u-(u-g)*e|0,b[a++]=255}}class ng extends n_{_createMeshCanvas(t,e,i){let s=Math.floor(this._bounds[0]),a=Math.floor(this._bounds[1]),n=Math.ceil(this._bounds[2])-s,r=Math.ceil(this._bounds[3])-a,l=Math.min(Math.ceil(Math.abs(n*t[0]*1.1)),3e3),o=Math.min(Math.ceil(Math.abs(r*t[1]*1.1)),3e3),h=n/l,d=r/o,c={coords:this._coords,colors:this._colors,offsetX:-s,offsetY:-a,scaleX:1/h,scaleY:1/d},u=l+4,_=o+4,p=i.getCanvas("mesh",u,_),f=p.context,g=f.createImageData(l,o);if(e){let t=g.data;for(let i=0,s=t.length;i<s;i+=4)t[i]=e[0],t[i+1]=e[1],t[i+2]=e[2],t[i+3]=255}for(let t of this._figures)!function(t,e,i){let s,a,n=e.coords,r=e.colors;switch(e.type){case"lattice":let l=e.verticesPerRow,o=Math.floor(n.length/l)-1,h=l-1;for(s=0;s<o;s++){let e=s*l;for(let s=0;s<h;s++,e++)nf(t,i,n[e],n[e+1],n[e+l],r[e],r[e+1],r[e+l]),nf(t,i,n[e+l+1],n[e+1],n[e+l],r[e+l+1],r[e+1],r[e+l])}break;case"triangles":for(s=0,a=n.length;s<a;s+=3)nf(t,i,n[s],n[s+1],n[s+2],r[s],r[s+1],r[s+2]);break;default:throw Error("illegal figure")}}(g,t,c);return f.putImageData(g,2,2),{canvas:p.canvas,offsetX:s-2*h,offsetY:a-2*d,scaleX:h,scaleY:d}}getPattern(t,e,i,s){let a;if(nu(t,this._bbox),s===nc.SHADING)a=tH.singularValueDecompose2dScale(ee(t));else if(a=tH.singularValueDecompose2dScale(e.baseTransform),this.matrix){let t=tH.singularValueDecompose2dScale(this.matrix);a=[a[0]*t[0],a[1]*t[1]]}let n=this._createMeshCanvas(a,s===nc.SHADING?null:this._background,e.cachedCanvases);return s!==nc.SHADING&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(n.offsetX,n.offsetY),t.scale(n.scaleX,n.scaleY),t.createPattern(n.canvas,"no-repeat")}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}}class nm extends n_{getPattern(){return"hotpink"}}let nv={COLORED:1,UNCOLORED:2};class nb{createPatternCanvas(t){let{bbox:e,operatorList:i,paintType:s,tilingType:a,color:n,canvasGraphicsFactory:r}=this,{xstep:l,ystep:o}=this;l=Math.abs(l),o=Math.abs(o),tA("TilingType: "+a);let h=e[0],d=e[1],c=e[2],u=e[3],_=c-h,p=u-d,f=tH.singularValueDecompose2dScale(this.matrix),g=tH.singularValueDecompose2dScale(this.baseTransform),m=f[0]*g[0],v=f[1]*g[1],b=_,w=p,A=!1,y=!1,S=Math.ceil(o*v),x=Math.ceil(p*v);Math.ceil(l*m)>=Math.ceil(_*m)?b=l:A=!0,S>=x?w=o:y=!0;let E=this.getSizeAndScale(b,this.ctx.canvas.width,m),k=this.getSizeAndScale(w,this.ctx.canvas.height,v),M=t.cachedCanvases.getCanvas("pattern",E.size,k.size),C=M.context,T=r.createCanvasGraphics(C);if(T.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(T,s,n),C.translate(-E.scale*h,-k.scale*d),T.transform(E.scale,0,0,k.scale,0,0),C.save(),this.clipBbox(T,h,d,c,u),T.baseTransform=ee(T.ctx),T.executeOperatorList(i),T.endDrawing(),C.restore(),A||y){let e=M.canvas;A&&(b=l),y&&(w=o);let i=this.getSizeAndScale(b,this.ctx.canvas.width,m),s=this.getSizeAndScale(w,this.ctx.canvas.height,v),a=i.size,n=s.size,r=t.cachedCanvases.getCanvas("pattern-workaround",a,n),c=r.context,u=A?Math.floor(_/l):0,f=y?Math.floor(p/o):0;for(let t=0;t<=u;t++)for(let i=0;i<=f;i++)c.drawImage(e,a*t,n*i,a,n,0,0,a,n);return{canvas:r.canvas,scaleX:i.scale,scaleY:s.scale,offsetX:h,offsetY:d}}return{canvas:M.canvas,scaleX:E.scale,scaleY:k.scale,offsetX:h,offsetY:d}}getSizeAndScale(t,e,i){let s=Math.max(nb.MAX_PATTERN_SIZE,e),a=Math.ceil(t*i);return a>=s?a=s:i=a/t,{scale:i,size:a}}clipBbox(t,e,i,s,a){let n=s-e,r=a-i;t.ctx.rect(e,i,n,r),t.current.updateRectMinMax(ee(t.ctx),[e,i,s,a]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){let s=t.ctx,a=t.current;switch(e){case nv.COLORED:let n=this.ctx;s.fillStyle=n.fillStyle,s.strokeStyle=n.strokeStyle,a.fillColor=n.fillStyle,a.strokeColor=n.strokeStyle;break;case nv.UNCOLORED:let r=tH.makeHexColor(i[0],i[1],i[2]);s.fillStyle=r,s.strokeStyle=r,a.fillColor=r,a.strokeColor=r;break;default:throw new tI("Unsupported paint type: ".concat(e))}}getPattern(t,e,i,s){let a=i;s!==nc.SHADING&&(a=tH.transform(a,e.baseTransform),this.matrix&&(a=tH.transform(a,this.matrix
1)));let n=this.createPatternCanvas(e),r=new DOMMatrix(a);r=(r=r.translate(n.offsetX,n.offsetY)).scale(1/n.scaleX,1/n.scaleY);let l=t.createPattern(n.canvas,"repeat");return l.setTransform(r),l}constructor(t,e,i,s,a){this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.color=e,this.ctx=i,this.canvasGraphicsFactory=s,this.baseTransform=a}}nb.MAX_PATTERN_SIZE=3e3;class nw{getCanvas(t,e,i){let s;return void 0!==this.cache[t]?(s=this.cache[t],this.canvasFactory.reset(s,e,i)):(s=this.canvasFactory.create(e,i),this.cache[t]=s),s}delete(t){delete this.cache[t]}clear(){for(let t in this.cache){let e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}}function nA(t,e,i,s,a,n,r,l,o,h){let[d,c,u,_,p,f]=ee(t);if(0===c&&0===u){let g=Math.round(r*d+p),m=Math.round(l*_+f),v=Math.abs(Math.round((r+o)*d+p)-g)||1,b=Math.abs(Math.round((l+h)*_+f)-m)||1;return t.setTransform(Math.sign(d),0,0,Math.sign(_),g,m),t.drawImage(e,i,s,a,n,0,0,v,b),t.setTransform(d,c,u,_,p,f),[v,b]}if(0===d&&0===_){let g=Math.round(l*u+p),m=Math.round(r*c+f),v=Math.abs(Math.round((l+h)*u+p)-g)||1,b=Math.abs(Math.round((r+o)*c+f)-m)||1;return t.setTransform(0,Math.sign(c),Math.sign(u),0,g,m),t.drawImage(e,i,s,a,n,0,0,b,v),t.setTransform(d,c,u,_,p,f),[b,v]}return t.drawImage(e,i,s,a,n,r,l,o,h),[Math.hypot(d,c)*o,Math.hypot(u,_)*h]}class ny{clone(){let 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]=tH.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){let i=tH.applyTransform(e,t),s=tH.applyTransform(e.slice(2),t),a=tH.applyTransform([e[0],e[3]],t),n=tH.applyTransform([e[2],e[1]],t);this.minX=Math.min(this.minX,i[0],s[0],a[0],n[0]),this.minY=Math.min(this.minY,i[1],s[1],a[1],n[1]),this.maxX=Math.max(this.maxX,i[0],s[0],a[0],n[0]),this.maxY=Math.max(this.maxY,i[1],s[1],a[1],n[1])}updateScalingPathMinMax(t,e){tH.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,s,a,n,r,l,o,h){let d=tH.bezierBoundingBox(e,i,s,a,n,r,l,o,h);h||this.updateRectMinMax(t,d)}getPathBoundingBox(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:nc.FILL,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=[this.minX,this.minY,this.maxX,this.maxY];if(t===nc.STROKE){e||tS("Stroke bounding box must include transform.");let t=tH.singularValueDecompose2dScale(e),s=t[0]*this.lineWidth/2,a=t[1]*this.lineWidth/2;i[0]-=s,i[1]-=a,i[2]+=s,i[3]+=a}return i}updateClipFromPath(){let t=tH.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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:nc.FILL,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return tH.intersect(this.clipBox,this.getPathBoundingBox(t,e))}constructor(t,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=tr,this.textMatrixScale=1,this.fontMatrix=tl,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=t_.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,t,e])}}function nS(t,e){let i,s,a,n;if("undefined"!=typeof ImageData&&e instanceof ImageData)return void t.putImageData(e,0,0);let r=e.height,l=e.width,o=r%16,h=(r-o)/16,d=0===o?h:h+1,c=t.createImageData(l,16),u=0,_,p=e.data,f=c.data;if(e.kind===tp.GRAYSCALE_1BPP){let e=p.byteLength,n=new Uint32Array(f.buffer,0,f.byteLength>>2),r=n.length,g=l+7>>3,m=tN.isLittleEndian?0xff000000:255;for(i=0;i<d;i++){for(s=0,a=i<h?16:o,_=0;s<a;s++){let t=e-u,i=0,s=t>g?l:8*t-7,a=-8&s,r=0,o=0;for(;i<a;i+=8)o=p[u++],n[_++]=128&o?0xffffffff:m,n[_++]=64&o?0xffffffff:m,n[_++]=32&o?0xffffffff:m,n[_++]=16&o?0xffffffff:m,n[_++]=8&o?0xffffffff:m,n[_++]=4&o?0xffffffff:m,n[_++]=2&o?0xffffffff:m,n[_++]=1&o?0xffffffff:m;for(;i<s;i++)0===r&&(o=p[u++],r=128),n[_++]=o&r?0xffffffff:m,r>>=1}for(;_<r;)n[_++]=0;t.putImageData(c,0,16*i)}}else if(e.kind===tp.RGBA_32BPP){for(i=0,s=0,n=16*l*4;i<h;i++)f.set(p.subarray(u,u+n)),u+=n,t.putImageData(c,0,s),s+=16;i<d&&(n=l*o*4,f.set(p.subarray(u,u+n)),t.putImageData(c,0,s))}else if(e.kind===tp.RGB_24BPP)for(i=0,n=l*(a=16);i<d;i++){for(i>=h&&(n=l*(a=o)),_=0,s=n;s--;)f[_++]=p[u++],f[_++]=p[u++],f[_++]=p[u++],f[_++]=255;t.putImageData(c,0,16*i)}else throw Error("bad image kind: ".concat(e.kind))}function nx(t,e){if(e.bitmap)return void t.drawImage(e.bitmap,0,0);
1let i=e.height,s=e.width,a=i%16,n=(i-a)/16,r=0===a?n:n+1,l=t.createImageData(s,16),o=0,h=e.data,d=l.data;for(let e=0;e<r;e++){let i=e<n?16:a;({srcPos:o}=function(t){let{src:e,srcPos:i=0,dest:s,width:a,height:n,nonBlackColor:r=0xffffffff,inverseDecode:l=!1}=t,o=tN.isLittleEndian?0xff000000:255,[h,d]=l?[r,o]:[o,r],c=a>>3,u=7&a,_=e.length;s=new Uint32Array(s.buffer);let p=0;for(let t=0;t<n;t++){for(let t=i+c;i<t;i++){let t=i<_?e[i]:255;s[p++]=128&t?d:h,s[p++]=64&t?d:h,s[p++]=32&t?d:h,s[p++]=16&t?d:h,s[p++]=8&t?d:h,s[p++]=4&t?d:h,s[p++]=2&t?d:h,s[p++]=1&t?d:h}if(0===u)continue;let t=i<_?e[i++]:255;for(let e=0;e<u;e++)s[p++]=t&1<<7-e?d:h}return{srcPos:i,destPos:p}}({src:h,srcPos:o,dest:d,width:s,height:i,nonBlackColor:0})),t.putImageData(l,0,16*e)}}function nE(t,e){for(let i of["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"])void 0!==t[i]&&(e[i]=t[i]);void 0!==t.setLineDash&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function nk(t){if(t.strokeStyle=t.fillStyle="#000000",t.fillRule="nonzero",t.globalAlpha=1,t.lineWidth=1,t.lineCap="butt",t.lineJoin="miter",t.miterLimit=10,t.globalCompositeOperation="source-over",t.font="10px sans-serif",void 0!==t.setLineDash&&(t.setLineDash([]),t.lineDashOffset=0),!tn){let{filter:e}=t;"none"!==e&&""!==e&&(t.filter="none")}}function nM(t,e){if(e)return!0;let i=tH.singularValueDecompose2dScale(t);i[0]=Math.fround(i[0]),i[1]=Math.fround(i[1]);let s=Math.fround((globalThis.devicePixelRatio||1)*tY.PDF_TO_CSS_UNITS);return i[0]<=s&&i[1]<=s}let nC=["butt","round","square"],nT=["miter","round","bevel"],nR={},nL={};var nP=new WeakSet,nI=new WeakSet;class nD{getObject(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return"string"==typeof t?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):e}beginDrawing(t){let{transform:e,viewport:i,transparency:s=!1,background:a=null}=t,n=this.ctx.canvas.width,r=this.ctx.canvas.height,l=this.ctx.fillStyle;if(this.ctx.fillStyle=a||"#ffffff",this.ctx.fillRect(0,0,n,r),this.ctx.fillStyle=l,s){let t=this.cachedCanvases.getCanvas("transparent",n,r);this.compositeCtx=this.ctx,this.transparentCanvas=t.canvas,this.ctx=t.context,this.ctx.save(),this.ctx.transform(...ee(this.compositeCtx))}this.ctx.save(),nk(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...i.transform),this.viewportScale=i.scale,this.baseTransform=ee(this.ctx)}executeOperatorList(t,e,i,s){let a,n=t.argsArray,r=t.fnArray,l=e||0,o=n.length;if(o===l)return l;let h=o-l>10&&"function"==typeof i,d=h?Date.now()+15:0,c=0,u=this.commonObjs,_=this.objs;for(;;){if(void 0!==s&&l===s.nextBreakPoint)return s.breakIt(l,i),l;if((a=r[l])!==tv.dependency)this[a].apply(this,n[l]);else for(let t of n[l]){let e=t.startsWith("g_")?u:_;if(!e.has(t))return e.get(t,i),l}if(++l===o)return l;if(h&&++c>10){if(Date.now()>d)return i(),l;c=0}}}endDrawing(){for(let t of((0,H._)(this,nP,nF).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear(),this._cachedBitmapsMap.values())){for(let e of t.values())"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),(0,H._)(this,nI,nO).call(this)}_scaleImage(t,e){var i,s;let a,n,r=null!=(i=t.width)?i:t.displayWidth,l=null!=(s=t.height)?s:t.displayHeight,o=Math.max(Math.hypot(e[0],e[1]),1),h=Math.max(Math.hypot(e[2],e[3]),1),d=r,c=l,u="prescale1";for(;o>2&&d>1||h>2&&c>1;){let e=d,i=c;o>2&&d>1&&(e=d>=16384?Math.floor(d/2)-1||1:Math.ceil(d/2),o/=d/e),h>2&&c>1&&(i=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c)/2,h/=c/i),(n=(a=this.cachedCanvases.getCanvas(u,e,i)).context).clearRect(0,0,e,i),n.drawImage(t,0,0,d,c,0,0,e,i),t=a.canvas,d=e,c=i,u="prescale1"===u?"prescale2":"prescale1"}return{img:t,paintWidth:d,paintHeight:c}}_createMaskCanvas(t){let e,i,s,a,n=this.ctx,{width:r,height:l}=t,o=this.current.fillColor,h=this.current.patternFill,d=ee(n);if((t.bitmap||t.data)&&t.count>1){let a=t.bitmap||t.data.buffer;i=JSON.stringify(h?d:[d.slice(0,4),o]),(e=this._cachedBitmapsMap.get(a))||(e=new Map,this._cachedBitmapsMap.set(a,e));let n=e.get(i);if(n&&!h)return{canvas:n,offsetX:Math.round(Math.min(d[0],d[2])+d[4]),offsetY:Math.round(Math.min(d[1],d[3])+d[5])};s=n}s||nx((a=this.cachedCanvases.getCanvas("maskCanvas",r,l)).context,t);let c=tH.transform(d,[1/r,0,0,-1/l,0,0]);c=tH.transform(c,[1,0,0,1,0,-l]);let[u,_,p,f]=tH.getAxialAlignedBoundingBox([0,0,r,l],c),g=Math.round(p-u)||1,m=Math.round(f-_)||1,v=this.cachedCanvases.getCanvas("fillCanvas",g,m),b=v.context;b.translate(-u,-_),b.transform(...c),!s&&(s=(s=this._scaleImage(a.canvas,ei(b))).img,e&&h&&e.set(i,s)),b.imageSmoothingEnabled=nM(ee(b),t.interpolate),nA(b,s,0,0,s.width,s.height,0,0,r,l),b.globalCompositeOperation="source-in";let w=tH.transform(ei(b),[1,0,0,1,-u,-_]);
1return b.fillStyle=h?o.getPattern(n,this,w,nc.FILL):o,b.fillRect(0,0,r,l),e&&!h&&(this.cachedCanvases.delete("fillCanvas"),e.set(i,v.canvas)),{canvas:v.canvas,offsetX:Math.round(u),offsetY:Math.round(_)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=nC[t]}setLineJoin(t){this.ctx.lineJoin=nT[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){let i=this.ctx;void 0!==i.setLineDash&&(i.setLineDash(t),i.lineDashOffset=e)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(let[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(){let t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw Error("beginSMaskMode called while already in smask mode");let t=this.ctx.canvas.width,e=this.ctx.canvas.height,i="smaskGroupAt"+this.groupLevel,s=this.cachedCanvases.getCanvas(i,t,e);this.suspendedCtx=this.ctx,this.ctx=s.context;let a=this.ctx;a.setTransform(...ee(this.suspendedCtx)),nE(this.suspendedCtx,a);var n=this.suspendedCtx;if(a._removeMirroring)throw Error("Context is already forwarding operations.");a.__originalSave=a.save,a.__originalRestore=a.restore,a.__originalRotate=a.rotate,a.__originalScale=a.scale,a.__originalTranslate=a.translate,a.__originalTransform=a.transform,a.__originalSetTransform=a.setTransform,a.__originalResetTransform=a.resetTransform,a.__originalClip=a.clip,a.__originalMoveTo=a.moveTo,a.__originalLineTo=a.lineTo,a.__originalBezierCurveTo=a.bezierCurveTo,a.__originalRect=a.rect,a.__originalClosePath=a.closePath,a.__originalBeginPath=a.beginPath,a._removeMirroring=()=>{a.save=a.__originalSave,a.restore=a.__originalRestore,a.rotate=a.__originalRotate,a.scale=a.__originalScale,a.translate=a.__originalTranslate,a.transform=a.__originalTransform,a.setTransform=a.__originalSetTransform,a.resetTransform=a.__originalResetTransform,a.clip=a.__originalClip,a.moveTo=a.__originalMoveTo,a.lineTo=a.__originalLineTo,a.bezierCurveTo=a.__originalBezierCurveTo,a.rect=a.__originalRect,a.closePath=a.__originalClosePath,a.beginPath=a.__originalBeginPath,delete a._removeMirroring},a.save=function(){n.save(),this.__originalSave()},a.restore=function(){n.restore(),this.__originalRestore()},a.translate=function(t,e){n.translate(t,e),this.__originalTranslate(t,e)},a.scale=function(t,e){n.scale(t,e),this.__originalScale(t,e)},a.transform=function(t,e,i,s,a,r){n.transform(t,e,i,s,a,r),this.__originalTransform(t,e,i,s,a,r)},a.setTransform=function(t,e,i,s,a,r){n.setTransform(t,e,i,s,a,r),this.__originalSetTransform(t,e,i,s,a,r)},a.resetTransform=function(){n.resetTransform(),this.__originalResetTransform()},a.rotate=function(t){n.rotate(t),this.__originalRotate(t)},a.clip=function(t){n.clip(t),this.__originalClip(t)},a.moveTo=function(t,e){n.moveTo(t,e),this.__originalMoveTo(t,e)},a.lineTo=function(t,e){n.lineTo(t,e),this.__originalLineTo(t,e)},a.bezierCurveTo=function(t,e,i,s,a,r){n.bezierCurveTo(t,e,i,s,a,r),this.__originalBezierCurveTo(t,e,i,s,a,r)},a.rect=function(t,e,i,s){n.rect(t,e,i,s),this.__originalRect(t,e,i,s)},a.closePath=function(){n.closePath(),this.__originalClosePath()},a.beginPath=function(){n.beginPath(),this.__originalBeginPath()},this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),nE(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let e=this.current.activeSMask,i=this.suspendedCtx;this.composeSMask(i,e,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore(
1)}composeSMask(t,e,i,s){let a=s[0],n=s[1],r=s[2]-a,l=s[3]-n;0!==r&&0!==l&&(this.genericComposeSMask(e.context,i,r,l,e.subtype,e.backdrop,e.transferMap,a,n,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,s,a,n,r,l,o,h,d){let c=t.canvas,u=l-h,_=o-d;if(n){let e=tH.makeHexColor(...n);if(u<0||_<0||u+i>c.width||_+s>c.height){let t=this.cachedCanvases.getCanvas("maskExtension",i,s),a=t.context;a.drawImage(c,-u,-_),a.globalCompositeOperation="destination-atop",a.fillStyle=e,a.fillRect(0,0,i,s),a.globalCompositeOperation="source-over",c=t.canvas,u=_=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);let a=new Path2D;a.rect(u,_,i,s),t.clip(a),t.globalCompositeOperation="destination-atop",t.fillStyle=e,t.fillRect(u,_,i,s),t.restore()}}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),"Alpha"===a&&r?e.filter=this.filterFactory.addAlphaFilter(r):"Luminosity"===a&&(e.filter=this.filterFactory.addLuminosityFilter(r));let p=new Path2D;p.rect(l,o,i,s),e.clip(p),e.globalCompositeOperation="destination-in",e.drawImage(c,u,_,i,s,l,o,i,s),e.restore()}save(){this.inSMaskMode?(nE(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();let 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(),nE(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,e,i,s,a,n){this.ctx.transform(t,e,i,s,a,n),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i){let s,a,n=this.ctx,r=this.current,l=r.x,o=r.y,h=ee(n),d=0===h[0]&&0===h[3]||0===h[1]&&0===h[2],c=d?i.slice(0):null;for(let i=0,u=0,_=t.length;i<_;i++)switch(0|t[i]){case tv.rectangle:l=e[u++],o=e[u++];let _=e[u++],p=e[u++],f=l+_,g=o+p;n.moveTo(l,o),0===_||0===p?n.lineTo(f,g):(n.lineTo(f,o),n.lineTo(f,g),n.lineTo(l,g)),d||r.updateRectMinMax(h,[l,o,f,g]),n.closePath();break;case tv.moveTo:l=e[u++],o=e[u++],n.moveTo(l,o),d||r.updatePathMinMax(h,l,o);break;case tv.lineTo:l=e[u++],o=e[u++],n.lineTo(l,o),d||r.updatePathMinMax(h,l,o);break;case tv.curveTo:s=l,a=o,l=e[u+4],o=e[u+5],n.bezierCurveTo(e[u],e[u+1],e[u+2],e[u+3],l,o),r.updateCurvePathMinMax(h,s,a,e[u],e[u+1],e[u+2],e[u+3],l,o,c),u+=6;break;case tv.curveTo2:s=l,a=o,n.bezierCurveTo(l,o,e[u],e[u+1],e[u+2],e[u+3]),r.updateCurvePathMinMax(h,s,a,l,o,e[u],e[u+1],e[u+2],e[u+3],c),l=e[u+2],o=e[u+3],u+=4;break;case tv.curveTo3:s=l,a=o,l=e[u+2],o=e[u+3],n.bezierCurveTo(e[u],e[u+1],l,o,l,o),r.updateCurvePathMinMax(h,s,a,e[u],e[u+1],l,o,l,o,c),u+=4;break;case tv.closePath:n.closePath()}d&&r.updateScalingPathMinMax(h,c),r.setCurrentPoint(l,o)}closePath(){this.ctx.closePath()}stroke(){let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0],e=this.ctx,i=this.current.strokeColor;e.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"==typeof i&&(null==i?void 0:i.getPattern)?(e.save(),e.strokeStyle=i.getPattern(e,this,ei(e),nc.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(){let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0],e=this.ctx,i=this.current.fillColor,s=this.current.patternFill,a=!1;s&&(e.save(),e.fillStyle=i.getPattern(e,this,ei(e),nc.FILL),a=!0);let n=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==n&&(this.pendingEOFill?(e.fill("evenodd"),this.pendingEOFill=!1):e.fill()),a&&e.restore(),t&&this.consumePath(n)}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=nR}eoClip(){this.pendingClip=nL}beginText(){this.current.textMatrix=tr,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){let t=this.pendingTextPaths,e=this.ctx;if(void 0===t)return void e.beginPath();for(let i of(e.save(),e.beginPath(),t))e.setTransform(...i.transform),e.translate(i.x,i.y),i.addToPath(e,i.fontSize);
1e.restore(),e.clip(),e.beginPath(),delete this.pendingTextPaths}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){var i;let s=this.commonObjs.get(t),a=this.current;if(!s)throw Error("Can't find font for ".concat(t));if(a.fontMatrix=s.fontMatrix||tl,(0===a.fontMatrix[0]||0===a.fontMatrix[3])&&ty("Invalid font matrix for font "+t),e<0?(e=-e,a.fontDirection=-1):a.fontDirection=1,this.current.font=s,this.current.fontSize=e,s.isType3Font)return;let n=s.loadedName||"sans-serif",r=(null==(i=s.systemFontInfo)?void 0:i.css)||'"'.concat(n,'", ').concat(s.fallbackName),l="normal";s.black?l="900":s.bold&&(l="bold");let o=s.italic?"italic":"normal",h=e;e<16?h=16:e>100&&(h=100),this.current.fontSizeScale=e/h,this.ctx.font="".concat(o," ").concat(l," ").concat(h,"px ").concat(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,s,a,n){this.current.textMatrix=[t,e,i,s,a,n],this.current.textMatrixScale=Math.hypot(t,e),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,e,i,s){let a,n=this.ctx,r=this.current,l=r.font,o=r.textRenderingMode,h=r.fontSize/r.fontSizeScale,d=o&t_.FILL_STROKE_MASK,c=!!(o&t_.ADD_TO_PATH_FLAG),u=r.patternFill&&!l.missingFile;(l.disableFontFace||c||u)&&(a=l.getPathGenerator(this.commonObjs,t)),l.disableFontFace||u?(n.save(),n.translate(e,i),n.beginPath(),a(n,h),s&&n.setTransform(...s),(d===t_.FILL||d===t_.FILL_STROKE)&&n.fill(),(d===t_.STROKE||d===t_.FILL_STROKE)&&n.stroke(),n.restore()):((d===t_.FILL||d===t_.FILL_STROKE)&&n.fillText(t,e,i),(d===t_.STROKE||d===t_.FILL_STROKE)&&n.strokeText(t,e,i)),c&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:ee(n),x:e,y:i,fontSize:h,addToPath:a})}get isFontSubpixelAAEnabled(){let{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);let e=t.getImageData(0,0,10,10).data,i=!1;for(let t=3;t<e.length;t+=4)if(e[t]>0&&e[t]<255){i=!0;break}return tk(this,"isFontSubpixelAAEnabled",i)}showText(t){let e,i=this.current,s=i.font;if(s.isType3Font)return this.showType3Text(t);let a=i.fontSize;if(0===a)return;let n=this.ctx,r=i.fontSizeScale,l=i.charSpacing,o=i.wordSpacing,h=i.fontDirection,d=i.textHScale*h,c=t.length,u=s.vertical,_=u?1:-1,p=s.defaultVMetrics,f=a*i.fontMatrix[0],g=i.textRenderingMode===t_.FILL&&!s.disableFontFace&&!i.patternFill;if(n.save(),n.transform(...i.textMatrix),n.translate(i.x,i.y+i.textRise),h>0?n.scale(d,-1):n.scale(d,1),i.patternFill){n.save();let t=i.fillColor.getPattern(n,this,ei(n),nc.FILL);e=ee(n),n.restore(),n.fillStyle=t}let m=i.lineWidth,v=i.textMatrixScale;if(0===v||0===m){let t=i.textRenderingMode&t_.FILL_STROKE_MASK;(t===t_.STROKE||t===t_.FILL_STROKE)&&(m=this.getSinglePixelWidth())}else m/=v;if(1!==r&&(n.scale(r,r),m/=r),n.lineWidth=m,s.isInvalidPDFjsFont){let e=[],s=0;for(let i of t)e.push(i.unicode),s+=i.width;n.fillText(e.join(""),0,0),i.x+=s*f*d,n.restore(),this.compose();return}let b=0,w;for(w=0;w<c;++w){let i,d,c=t[w];if("number"==typeof c){b+=_*c*a/1e3;continue}let m=!1,v=(c.isSpace?o:0)+l,A=c.fontChar,y=c.accent,S=c.width;if(u){let t=c.vmetric||p,e=-(c.vmetric?t[1]:.5*S)*f,s=t[2]*f;S=t?-t[0]:S,i=e/r,d=(b+s)/r}else i=b/r,d=0;if(s.remeasure&&S>0){let t=1e3*n.measureText(A).width/a*r;if(S<t&&this.isFontSubpixelAAEnabled){let e=S/t;m=!0,n.save(),n.scale(e,1),i/=e}else S!==t&&(i+=(S-t)/2e3*a/r)}if(this.contentVisible&&(c.isInFont||s.missingFile)){if(g&&!y)n.fillText(A,i,d);else if(this.paintChar(A,i,d,e),y){let t=i+a*y.offset.x/r,s=d-a*y.offset.y/r;this.paintChar(y.fontChar,t,s,e)}}b+=u?S*f-v*h:S*f+v*h,m&&n.restore()}u?i.y-=b:i.x+=b*d,n.restore(),this.compose()}showType3Text(t){let e,i,s,a,n=this.ctx,r=this.current,l=r.font,o=r.fontSize,h=r.fontDirection,d=l.vertical?1:-1,c=r.charSpacing,u=r.wordSpacing,_=r.textHScale*h,p=r.fontMatrix||tl,f=t.length;if(r.textRenderingMode!==t_.INVISIBLE&&0!==o){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,n.save(),n.transform(...r.textMatrix),n.translate(r.x,r.y),n.scale(_,h),e=0;e<f;++e){if("number"==typeof(i=t[e])){a=d*i*o/1e3,this.ctx.translate(a,0),r.x+=a*_;continue}let h=(i.isSpace?u:0)+c,f=l.charProcOperatorList[i.operatorListId];if(!f){ty('Type3 character "'.concat(i.operatorListId,'" is not available.'));continue}this.contentVisible&&(this.processingType3=i,this.save(),n.scale(o,o),n.transform(...p),this.executeOperatorList(f),this.restore(
1)),s=tH.applyTransform([i.width,0],p)[0]*o+h,n.translate(s,0),r.x+=s*_}n.restore(),this.processingType3=null}}setCharWidth(t,e){}setCharWidthAndBounds(t,e,i,s,a,n){this.ctx.rect(i,s,a-i,n-s),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let e;if("TilingPattern"===t[0]){let i=t[1],s=this.baseTransform||ee(this.ctx);e=new nb(t,i,this.ctx,{createCanvasGraphics:t=>new nD(t,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})},s)}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=tH.makeHexColor(t,e,i)}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent"}setFillRGBColor(t,e,i){this.ctx.fillStyle=this.current.fillColor=tH.makeHexColor(t,e,i),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.cachedPatterns.has(t)?e=this.cachedPatterns.get(t):(e=function(t){switch(t[0]){case"RadialAxial":return new np(t);case"Mesh":return new ng(t);case"Dummy":return new nm}throw Error("Unknown IR type: ".concat(t[0]))}(this.getObject(t)),this.cachedPatterns.set(t,e)),i&&(e.matrix=i),e}shadingFill(t){if(!this.contentVisible)return;let e=this.ctx;this.save(),e.fillStyle=this._getPattern(t).getPattern(e,this,ei(e),nc.SHADING);let i=ei(e);if(i){let{width:t,height:s}=e.canvas,[a,n,r,l]=tH.getAxialAlignedBoundingBox([0,0,t,s],i);this.ctx.fillRect(a,n,r-a,l-n)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){tS("Should not call beginInlineImage")}beginImageData(){tS("Should not call beginImageData")}paintFormXObjectBegin(t,e){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=ee(this.ctx),e)){let t=e[2]-e[0],i=e[3]-e[1];this.ctx.rect(e[0],e[1],t,i),this.current.updateRectMinMax(ee(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);let e=this.ctx;
1t.isolated||tA("TODO: Support non-isolated groups."),t.knockout&&ty("Knockout groups not supported.");let i=ee(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw Error("Bounding box is required.");let s=tH.getAxialAlignedBoundingBox(t.bbox,ee(e)),a=[0,0,e.canvas.width,e.canvas.height],n=Math.floor((s=tH.intersect(s,a)||[0,0,0,0])[0]),r=Math.floor(s[1]),l=Math.max(Math.ceil(s[2])-n,1),o=Math.max(Math.ceil(s[3])-r,1);this.current.startNewPathAndClipBox([0,0,l,o]);let h="groupAt"+this.groupLevel;t.smask&&(h+="_smask_"+this.smaskCounter++%2);let d=this.cachedCanvases.getCanvas(h,l,o),c=d.context;c.translate(-n,-r),c.transform(...i),t.smask?this.smaskStack.push({canvas:d.canvas,context:c,offsetX:n,offsetY:r,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(n,r),e.save()),nE(e,c),this.ctx=c,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(e),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;let 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();let t=ee(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...t);let i=tH.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],t);this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(i)}}beginAnnotation(t,e,i,s,a){if((0,H._)(this,nP,nF).call(this),nk(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),e){let s=e[2]-e[0],n=e[3]-e[1];if(a&&this.annotationCanvasMap){i=i.slice(),i[4]-=e[0],i[5]-=e[1],(e=e.slice())[0]=e[1]=0,e[2]=s,e[3]=n;let[a,r]=tH.singularValueDecompose2dScale(ee(this.ctx)),{viewportScale:l}=this,o=Math.ceil(s*this.outputScaleX*l),h=Math.ceil(n*this.outputScaleY*l);this.annotationCanvas=this.canvasFactory.create(o,h);let{canvas:d,context:c}=this.annotationCanvas;this.annotationCanvasMap.set(t,d),this.annotationCanvas.savedCtx=this.ctx,this.ctx=c,this.ctx.save(),this.ctx.setTransform(a,0,0,-r,0,n*r),nk(this.ctx)}else nk(this.ctx),this.endPath(),this.ctx.rect(e[0],e[1],s,n),this.ctx.clip(),this.ctx.beginPath()}this.current=new ny(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),this.transform(...s)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),(0,H._)(this,nI,nO).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t){if(!this.contentVisible)return;let e=t.count;(t=this.getObject(t.data,t)).count=e;let i=this.ctx,s=this.processingType3;if(s&&(void 0===s.compiled&&(s.compiled=function(t){let e,i,s,{width:a,height:n}=t;if(a>1e3||n>1e3)return null;let r=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),l=a+1,o=new Uint8Array(l*(n+1)),h=a+7&-8,d=new Uint8Array(h*n),c=0;for(let e of t.data){let t=128;for(;t>0;)d[c++]=e&t?0:255,t>>=1}let u=0;for(0!==d[c=0]&&(o[0]=1,++u),i=1;i<a;i++)d[c]!==d[c+1]&&(o[i]=d[c]?2:1,++u),c++;for(0!==d[c]&&(o[i]=2,++u),e=1;e<n;e++){c=e*h,s=e*l,d[c-h]!==d[c]&&(o[s]=d[c]?1:8,++u);let t=4*!!d[c]+8*!!d[c-h];for(i=1;i<a;i++)r[t=(t>>2)+4*!!d[c+1]+8*!!d[c-h+1]]&&(o[s+i]=r[t],++u),c++;if(d[c-h]!==d[c]&&(o[s+i]=d[c]?2:4,++u),u>1e3)return null}for(c=h*(n-1),s=e*l,0!==d[c]&&(o[s]=8,++u),i=1;i<a;i++)d[c]!==d[c+1]&&(o[s+i]=d[c]?4:8,++u),c++;if(0!==d[c]&&(o[s+i]=4,++u),u>1e3)return null;let _=new Int32Array([0,l,-1,0,-l,0,0,0,1]),p=new Path2D;for(e=0;u&&e<=n;e++){let t=e*l,i=t+a;for(;t<i&&!o[t];)t++;if(t===i)continue;p.moveTo(t%l,e);let s=t,n=o[t];do{let e=_[n];do t+=e;while(!o[t]);let i=o[t];5!==i&&10!==i?(n=i,o[t]=0):(n=i&51*n>>4,o[t]&=n>>2|n<<2),p.lineTo(t%l,t/l|0),!o[t]&&--u}while(s!==t);--e}return d=null,o=null,function(t){t.save(),t.scale(1/a,-1/n),t.translate(0,-n),t.fill(p),t.beginPath(),t.restore()}}(t)),s.compiled))return void s.compiled(i);let a=this._createMaskCanvas(t),n=a.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(n,a.offsetX,a.offsetY),i.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4?arguments[4]:void 0,n=arguments.length>5?arguments[5]:void 0;if(!this.contentVisible)return;t=this.getObject(t.data,t);let r=this.ctx;r.save();let l=ee(r);r.transform(e,i,s,a,0,0);let o=this._createMaskCanvas(t);r.setTransform(1,0,0,1,o.offsetX-l[4],o.offsetY-l[5]);for(let t=0,h=n.length;t<h;t+=2){let h=tH.transform(l,[e,i,s,a,n[t],n[t+1]]),[d,c]=tH.applyTransform([0,0],h);r.drawImage(o.canvas,d,c)}
1r.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;let e=this.ctx,i=this.current.fillColor,s=this.current.patternFill;for(let a of t){let{data:t,width:n,height:r,transform:l}=a,o=this.cachedCanvases.getCanvas("maskCanvas",n,r),h=o.context;h.save(),nx(h,this.getObject(t,a)),h.globalCompositeOperation="source-in",h.fillStyle=s?i.getPattern(h,this,ei(e),nc.FILL):i,h.fillRect(0,0,n,r),h.restore(),e.save(),e.transform(...l),e.scale(1,-1),nA(e,o.canvas,0,0,n,r,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;let e=this.getObject(t);if(!e)return void ty("Dependent image isn't ready yet");this.paintInlineImageXObject(e)}paintImageXObjectRepeat(t,e,i,s){if(!this.contentVisible)return;let a=this.getObject(t);if(!a)return void ty("Dependent image isn't ready yet");let n=a.width,r=a.height,l=[];for(let t=0,a=s.length;t<a;t+=2)l.push({transform:[e,0,0,i,s[t],s[t+1]],x:0,y:0,w:n,h:r});this.paintInlineImageXObjectGroup(a,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;let{bitmap:e,width:i,height:s}=t,a=this.cachedCanvases.getCanvas("inlineImage",i,s),n=a.context;return n.filter=this.current.transferMaps,n.drawImage(e,0,0),n.filter="none",a.canvas}paintInlineImageXObject(t){let e;if(!this.contentVisible)return;let i=t.width,s=t.height,a=this.ctx;if(this.save(),!tn){let{filter:t}=a;"none"!==t&&""!==t&&(a.filter="none")}if(a.scale(1/i,-1/s),t.bitmap)e=this.applyTransferMapsToBitmap(t);else if("function"==typeof HTMLElement&&t instanceof HTMLElement||!t.data)e=t;else{let a=this.cachedCanvases.getCanvas("inlineImage",i,s).context;nS(a,t),e=this.applyTransferMapsToCanvas(a)}let n=this._scaleImage(e,ei(a));a.imageSmoothingEnabled=nM(ee(a),t.interpolate),nA(a,n.img,0,0,n.paintWidth,n.paintHeight,0,-s,i,s),this.compose(),this.restore()}paintInlineImageXObjectGroup(t,e){let i;if(!this.contentVisible)return;let s=this.ctx;if(t.bitmap)i=t.bitmap;else{let e=t.width,s=t.height,a=this.cachedCanvases.getCanvas("inlineImage",e,s).context;nS(a,t),i=this.applyTransferMapsToCanvas(a)}for(let t of e)s.save(),s.transform(...t.transform),s.scale(1,-1),nA(s,i,t.x,t.y,t.w,t.h,0,-1,1,1),s.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t){}markPointProps(t,e){}beginMarkedContent(t){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e){"OC"===t?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(e)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(t){let e=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);let i=this.ctx;this.pendingClip&&(e||(this.pendingClip===nL?i.clip("evenodd"):i.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),i.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let t=ee(this.ctx);if(0===t[1]&&0===t[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{let e=Math.abs(t[0]*t[3]-t[2]*t[1]),i=Math.hypot(t[0],t[2]),s=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(i,s)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){let t,e,{lineWidth:i}=this.current,{a:s,b:a,c:n,d:r}=this.ctx.getTransform();if(0===a&&0===n){let a=Math.abs(s),n=Math.abs(r);if(a===n)if(0===i)t=e=1/a;else{let s=a*i;t=e=s<1?1/s:1}else if(0===i)t=1/a,e=1/n;else{let s=a*i,r=n*i;t=s<1?1/s:1,e=r<1?1/r:1}}else{let l=Math.abs(s*r-a*n),o=Math.hypot(s,a),h=Math.hypot(n,r);if(0===i)t=h/l,e=o/l;else{let s=i*l;t=h>s?h/s:1,e=o>s?o/s:1}}this._cachedScaleForStroking[0]=t,this._cachedScaleForStroking[1]=e}return this._cachedScaleForStroking}rescaleAndStroke(t){let{ctx:e}=this,{lineWidth:i}=this.current,[s,a]=this.getScaleForStroking();if(e.lineWidth=i||1,1===s&&1===a)return void e.stroke();let n=e.getLineDash();if(t&&e.save(),e.scale(s,a),n.length>0){let t=Math.max(s,a);e.setLineDash(n.map(e=>e/t)),e.lineDashOffset/=t}
1e.stroke(),t&&e.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}constructor(t,e,i,s,a,{optionalContentConfig:n,markedContentStack:r=null},l,o){(0,B._)(this,nP),(0,B._)(this,nI),this.ctx=t,this.current=new ny(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=s,this.filterFactory=a,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=r||[],this.optionalContentConfig=n,this.cachedCanvases=new nw(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=l,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=o,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}}function nF(){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)}function nO(){if(this.pageColors){let t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==t){let e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}}for(let t in tv)void 0!==nD.prototype[t]&&(nD.prototype[tv[t]]=nD.prototype[t]);class nW{static get workerPort(){return(0,G._)(this,nW,nN)}static set workerPort(t){if(!("undefined"!=typeof Worker&&t instanceof Worker)&&null!==t)throw Error("Invalid `workerPort` type.");(0,z._)(this,nW,nN,t)}static get workerSrc(){return(0,G._)(this,nW,nj)}static set workerSrc(t){if("string"!=typeof t)throw Error("Invalid `workerSrc` type.");(0,z._)(this,nW,nj,t)}}var nN={writable:!0,value:null},nj={writable:!0,value:""};let nH={DATA:1,ERROR:2},nB={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function nG(t){switch(!(t instanceof Error||"object"==typeof t&&null!==t)&&tS('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new tD(t.message);case"MissingPDFException":return new tL(t.message);case"PasswordException":return new tC(t.message,t.code);case"UnexpectedResponseException":return new tP(t.message,t.status);case"UnknownErrorException":return new tT(t.message,t.details);default:return new tT(t.message,t.toString())}}var nz=new WeakMap,nU=new WeakSet,nV=new WeakSet,nq=new WeakSet,nK=new WeakSet;class nX{on(t,e){let i=this.actionHandler;if(i[t])throw Error('There is already an actionName called "'.concat(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){let s=this.callbackId++,a=Promise.withResolvers();this.callbackCapabilities[s]=a;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:s,data:e},i)}catch(t){a.reject(t)}return a.promise}sendWithStream(t,e,i,s){let a=this.streamId++,n=this.sourceName,r=this.targetName,l=this.comObj;return new ReadableStream({start:i=>{let o=Promise.withResolvers();return this.streamControllers[a]={controller:i,startCall:o,pullCall:null,cancelCall:null,isClosed:!1},l.postMessage({sourceName:n,targetName:r,action:t,streamId:a,data:e,desiredSize:i.desiredSize},s),o.promise},pull:t=>{let e=Promise.withResolvers();return this.streamControllers[a].pullCall=e,l.postMessage({sourceName:n,targetName:r,stream:nB.PULL,streamId:a,desiredSize:t.desiredSize}),e.promise},cancel:t=>{tx(t instanceof Error,"cancel must have a valid reason");let e=Promise.withResolvers();return this.streamControllers[a].cancelCall=e,this.streamControllers[a].isClosed=!0,l.postMessage({sourceName:n,targetName:r,stream
1:nB.CANCEL,streamId:a,reason:nG(t)}),e.promise}},i)}destroy(){var t;null==(t=(0,O._)(this,nz))||t.abort(),(0,N._)(this,nz,null)}constructor(t,e,i){(0,B._)(this,nU),(0,B._)(this,nV),(0,B._)(this,nq),(0,B._)(this,nK),(0,W._)(this,nz,{writable:!0,value:void 0}),(0,N._)(this,nz,new AbortController),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",(0,H._)(this,nU,nY).bind(this),{signal:(0,O._)(this,nz).signal})}}function nY(t){let{data:e}=t;if(e.targetName!==this.sourceName)return;if(e.stream)return void(0,H._)(this,nq,nJ).call(this,e);if(e.callback){let t=e.callbackId,i=this.callbackCapabilities[t];if(!i)throw Error("Cannot resolve callback ".concat(t));if(delete this.callbackCapabilities[t],e.callback===nH.DATA)i.resolve(e.data);else if(e.callback===nH.ERROR)i.reject(nG(e.reason));else throw Error("Unexpected callback case");return}let i=this.actionHandler[e.action];if(!i)throw Error("Unknown action from worker: ".concat(e.action));if(e.callbackId){let t=this.sourceName,s=e.sourceName,a=this.comObj;new Promise(function(t){t(i(e.data))}).then(function(i){a.postMessage({sourceName:t,targetName:s,callback:nH.DATA,callbackId:e.callbackId,data:i})},function(i){a.postMessage({sourceName:t,targetName:s,callback:nH.ERROR,callbackId:e.callbackId,reason:nG(i)})});return}if(e.streamId)return void(0,H._)(this,nV,nQ).call(this,e);i(e.data)}function nQ(t){let e=t.streamId,i=this.sourceName,s=t.sourceName,a=this.comObj,n=this,r=this.actionHandler[t.action],l={enqueue(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2?arguments[2]:void 0;if(this.isCancelled)return;let l=this.desiredSize;this.desiredSize-=n,l>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),a.postMessage({sourceName:i,targetName:s,stream:nB.ENQUEUE,streamId:e,chunk:t},r)},close(){this.isCancelled||(this.isCancelled=!0,a.postMessage({sourceName:i,targetName:s,stream:nB.CLOSE,streamId:e}),delete n.streamSinks[e])},error(t){tx(t instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,a.postMessage({sourceName:i,targetName:s,stream:nB.ERROR,streamId:e,reason:nG(t)}))},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(e){e(r(t.data,l))}).then(function(){a.postMessage({sourceName:i,targetName:s,stream:nB.START_COMPLETE,streamId:e,success:!0})},function(t){a.postMessage({sourceName:i,targetName:s,stream:nB.START_COMPLETE,streamId:e,reason:nG(t)})})}function nJ(t){let e=t.streamId,i=this.sourceName,s=t.sourceName,a=this.comObj,n=this.streamControllers[e],r=this.streamSinks[e];switch(t.stream){case nB.START_COMPLETE:t.success?n.startCall.resolve():n.startCall.reject(nG(t.reason));break;case nB.PULL_COMPLETE:t.success?n.pullCall.resolve():n.pullCall.reject(nG(t.reason));break;case nB.PULL:if(!r){a.postMessage({sourceName:i,targetName:s,stream:nB.PULL_COMPLETE,streamId:e,success:!0});break}r.desiredSize<=0&&t.desiredSize>0&&r.sinkCapability.resolve(),r.desiredSize=t.desiredSize,new Promise(function(t){var e;t(null==(e=r.onPull)?void 0:e.call(r))}).then(function(){a.postMessage({sourceName:i,targetName:s,stream:nB.PULL_COMPLETE,streamId:e,success:!0})},function(t){a.postMessage({sourceName:i,targetName:s,stream:nB.PULL_COMPLETE,streamId:e,reason:nG(t)})});break;case nB.ENQUEUE:if(tx(n,"enqueue should have stream controller"),n.isClosed)break;n.controller.enqueue(t.chunk);break;case nB.CLOSE:if(tx(n,"close should have stream controller"),n.isClosed)break;n.isClosed=!0,n.controller.close(),(0,H._)(this,nK,nZ).call(this,n,e);break;case nB.ERROR:tx(n,"error should have stream controller"),n.controller.error(nG(t.reason)),(0,H._)(this,nK,nZ).call(this,n,e);break;case nB.CANCEL_COMPLETE:t.success?n.cancelCall.resolve():n.cancelCall.reject(nG(t.reason)),(0,H._)(this,nK,nZ).call(this,n,e);break;case nB.CANCEL:if(!r)break;new Promise(function(e){var i;e(null==(i=r.onCancel)?void 0:i.call(r,nG(t.reason)))}).then(function(){a.postMessage({sourceName:i,targetName:s,stream:nB.CANCEL_COMPLETE,streamId:e,success:!0})},function(t){a.postMessage({sourceName:i,targetName:s,stream:nB.CANCEL_COMPLETE,streamId:e,reason:nG(t)})}),r.sinkCapability.reject(nG(t.reason)),r.isCancelled=!0,delete this.streamSinks[e];break;default:throw Error("Unexpected stream case")}}async function nZ(t,e){var i,s,a;await Promise.allSettled([null==(i=t.startCall)?void 0:i.promise,null==(s=t.pullCall)?void 0:s.promise,null==(a=t.cancelCall)?void 0:a.promise]),delete this.streamControllers[e]}var n$=new WeakMap,n0=new WeakMap;
1class n1{getRaw(){return(0,O._)(this,n0)}get(t){var e;return null!=(e=(0,O._)(this,n$).get(t))?e:null}getAll(){return tW((0,O._)(this,n$))}has(t){return(0,O._)(this,n$).has(t)}constructor({parsedData:t,rawData:e}){(0,W._)(this,n$,{writable:!0,value:void 0}),(0,W._)(this,n0,{writable:!0,value:void 0}),(0,N._)(this,n$,t),(0,N._)(this,n0,e)}}let n2=Symbol("INTERNAL");var n3=new WeakMap,n5=new WeakMap,n6=new WeakMap,n4=new WeakMap;class n8{get visible(){if((0,O._)(this,n6))return(0,O._)(this,n4);if(!(0,O._)(this,n4))return!1;let{print:t,view:e}=this.usage;return(0,O._)(this,n3)?(null==e?void 0:e.viewState)!=="OFF":!(0,O._)(this,n5)||(null==t?void 0:t.printState)!=="OFF"}_setVisible(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t!==n2&&tS("Internal method `_setVisible` called."),(0,N._)(this,n6,i),(0,N._)(this,n4,e)}constructor(t,{name:e,intent:i,usage:s,rbGroups:a}){(0,W._)(this,n3,{writable:!0,value:void 0}),(0,W._)(this,n5,{writable:!0,value:void 0}),(0,W._)(this,n6,{writable:!0,value:void 0}),(0,W._)(this,n4,{writable:!0,value:void 0}),(0,N._)(this,n3,!1),(0,N._)(this,n5,!1),(0,N._)(this,n6,!1),(0,N._)(this,n4,!0),(0,N._)(this,n3,!!(t&to.DISPLAY)),(0,N._)(this,n5,!!(t&to.PRINT)),this.name=e,this.intent=i,this.usage=s,this.rbGroups=a}}var n7=new WeakMap,n9=new WeakMap,rt=new WeakMap,re=new WeakMap,ri=new WeakSet;class rs{isVisible(t){if(0===(0,O._)(this,n9).size)return!0;if(!t)return tA("Optional content group not defined."),!0;if("OCG"===t.type)return(0,O._)(this,n9).has(t.id)?(0,O._)(this,n9).get(t.id).visible:(ty("Optional content group not found: ".concat(t.id)),!0);if("OCMD"===t.type){if(t.expression)return(0,H._)(this,ri,ra).call(this,t.expression);if(t.policy&&"AnyOn"!==t.policy){if("AllOn"===t.policy){for(let e of t.ids){if(!(0,O._)(this,n9).has(e)){ty("Optional content group not found: ".concat(e));break}if(!(0,O._)(this,n9).get(e).visible)return!1}return!0}else if("AnyOff"===t.policy){for(let e of t.ids){if(!(0,O._)(this,n9).has(e))return ty("Optional content group not found: ".concat(e)),!0;if(!(0,O._)(this,n9).get(e).visible)return!0}return!1}else if("AllOff"===t.policy){for(let e of t.ids){if(!(0,O._)(this,n9).has(e)){ty("Optional content group not found: ".concat(e));break}if((0,O._)(this,n9).get(e).visible)return!1}return!0}}else{for(let e of t.ids){if(!(0,O._)(this,n9).has(e))return ty("Optional content group not found: ".concat(e)),!0;if((0,O._)(this,n9).get(e).visible)return!0}return!1}return ty("Unknown optional content policy ".concat(t.policy,".")),!0}return ty("Unknown group type ".concat(t.type,".")),!0}setVisibility(t){let e=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],s=(0,O._)(this,n9).get(t);if(!s)return void ty("Optional content group not found: ".concat(t));if(i&&e&&s.rbGroups.length){for(let e of s.rbGroups)for(let i of e)if(i!==t){var a;null==(a=(0,O._)(this,n9).get(i))||a._setVisible(n2,!1,!0)}}s._setVisible(n2,!!e,!0),(0,N._)(this,n7,null)}setOCGState(t){let e,{state:i,preserveRB:s}=t;for(let t of i){switch(t){case"ON":case"OFF":case"Toggle":e=t;continue}let i=(0,O._)(this,n9).get(t);if(i)switch(e){case"ON":this.setVisibility(t,!0,s);break;case"OFF":this.setVisibility(t,!1,s);break;case"Toggle":this.setVisibility(t,!i.visible,s)}}(0,N._)(this,n7,null)}get hasInitialVisibility(){return null===(0,O._)(this,rt)||this.getHash()===(0,O._)(this,rt)}getOrder(){return(0,O._)(this,n9).size?(0,O._)(this,re)?(0,O._)(this,re).slice():[...(0,O._)(this,n9).keys()]:null}getGroups(){return(0,O._)(this,n9).size>0?tW((0,O._)(this,n9)):null}getGroup(t){return(0,O._)(this,n9).get(t)||null}getHash(){if(null!==(0,O._)(this,n7))return(0,O._)(this,n7);let t=new ap;for(let[e,i]of(0,O._)(this,n9))t.update("".concat(e,":").concat(i.visible));return(0,N._)(this,n7,t.hexdigest())}constructor(t,e=to.DISPLAY){if((0,B._)(this,ri),(0,W._)(this,n7,{writable:!0,value:void 0}),(0,W._)(this,n9,{writable:!0,value:void 0}),(0,W._)(this,rt,{writable:!0,value:void 0}),(0,W._)(this,re,{writable:!0,value:void 0}),(0,N._)(this,n7,null),(0,N._)(this,n9,new Map),(0,N._)(this,rt,null),(0,N._)(this,re,null),this.renderingIntent=e,this.name=null,this.creator=null,null===t)return;for(let i of(this.name=t.name,this.creator=t.creator,(0,N._)(this,re,t.order),t.groups))(0,O._)(this,n9).set(i.id,new n8(e,i));if("OFF"===t.baseState)for(let t of(0,O._)(this,n9).values())t._setVisible(n2,!1);for(let e of t.on)(0,O._)(this,n9).get(e)._setVisible(n2,!0);for(let e of t.off)(0,O._)(this,n9).get(e)._setVisible(n2,!1);(0,N._)(this,rt,this.getHash())}}function ra(t){let e=t.length;if(e<2)return!0;let i=t[0];for(let s=1;s<e;s++){let e,a=t[s];if(Array.isArray(a))e=(0,H._)(this,ri,ra).call(this,a);else{if(!(0,O._)(this,n9).has(a))return ty("Optional content group not found: ".concat(a)),!0;e=(0,O._)(this,n9).get(a).visible}switch(i){case"And":if(!e)return!1;break;case"Or":if(e)return!0;break;case"Not":return!e;default:return!0}}return"And"===i}class rn{_onReceiveData(t){let{begin:e,chunk:i}=t,s=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;void 0===e?this._fullRequestReader?this._fullRequestReader._enqueue(s):this._queuedChunks.push(s):tx(this._rangeReaders.some(function(t){return t._begin===e&&(t._enqueue(s),!0)}),"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}get _progressiveDataLength(){var t,e;return null!=(e=null==(t=this._fullRequestReader)?void 0:t._loaded)?e:0}_onProgress(t){var e,i,s,a;void 0===t.total?null==(i=this._rangeReaders[0])||null==(e=i.onProgress)||e.call(i,{loaded:t.loaded}):null==(a=this._fullRequestReader)||null==(s=a.onProgress)||s.call(a,{loaded:t.loaded,total:t.total})}_onProgressiveDone(){var t;null==(t=this._fullRequestReader)||t.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){let e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){tx(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");let t=this._queuedChunks;return this._queuedChunks=null,new rr(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=new rl(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(i),i}cancelAllRequests(t){var e;
1for(let i of(null==(e=this._fullRequestReader)||e.cancel(t),this._rangeReaders.slice(0)))i.cancel(t);this._pdfDataRangeTransport.abort()}constructor(t,{disableRange:e=!1,disableStream:i=!1}){tx(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');let{length:s,initialData:a,progressiveDone:n,contentDispositionFilename:r}=t;if(this._queuedChunks=[],this._progressiveDone=n,this._contentDispositionFilename=r,(null==a?void 0:a.length)>0){let t=a instanceof Uint8Array&&a.byteLength===a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer;this._queuedChunks.push(t)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!i,this._isRangeSupported=!e,this._contentLength=s,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((t,e)=>{this._onReceiveData({begin:t,chunk:e})}),t.addProgressListener((t,e)=>{this._onProgress({loaded:t,total:e})}),t.addProgressiveReadListener(t=>{this._onReceiveData({chunk:t})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}}class rr{_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){for(let t of(this._done=!0,this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}constructor(t,e,i=!1,s=null){for(let a of(this._stream=t,this._done=i||!1,this._filename=t0(s)?s:null,this._queuedChunks=e||[],this._loaded=0,this._queuedChunks))this._loaded+=a.byteLength;this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}}class rl{_enqueue(t){if(!this._done){if(0===this._requests.length)this._queuedChunk=t;else{for(let e of(this._requests.shift().resolve({value:t,done:!1}),this._requests))e.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){let t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){for(let t of(this._done=!0,this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}constructor(t,e,i){this._stream=t,this._begin=e,this._end=i,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}}function ro(t,e){let i=new Headers;if(!t||!e||"object"!=typeof e)return i;for(let t in e){let s=e[t];void 0!==s&&i.append(t,s)}return i}function rh(t){let{responseHeaders:e,isHttp:i,rangeChunkSize:s,disableRange:a}=t,n={allowRangeRequests:!1,suggestedLength:void 0},r=parseInt(e.get("Content-Length"),10);return Number.isInteger(r)&&(n.suggestedLength=r,r<=2*s||a||!i||"bytes"!==e.get("Accept-Ranges")||"identity"!==(e.get("Content-Encoding")||"identity")||(n.allowRangeRequests=!0)),n}function rd(t){let e=t.get("Content-Disposition");if(e){let t=function(t){let e=!0,i=s("filename\\*","i").exec(t);if(i){let t=r(i=i[1]);return n(t=o(t=l(t=unescape(t))))}if(i=function(t){let e,i=[],a=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(e=a.exec(t));){let[,t,s,a]=e;if((t=parseInt(t,10))in i){if(0===t)break;continue}i[t]=[s,a]}let n=[];for(let t=0;t<i.length&&t in i;++t){let[e,s]=i[t];s=r(s),e&&(s=unescape(s),0===t&&(s=l(s))),n.push(s)}return n.join("")}(t))return n(o(i));if(i=s("filename","i").exec(t)){let t=r(i=i[1]);return n(t=o(t))}function s(t,e){return RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',e)}function a(t,i){if(t){if(!/^[\x00-\xFF]+$/.test(i))return i;try{let s=new TextDecoder(t,{fatal:!0}),a=tO(i);i=s.decode(a),e=!1}catch(t){}}return i}function n(t){return e&&/[\x80-\xff]/.test(t)&&(t=a("utf-8",t),e&&(t=a("iso-8859-1",t))),t}function r(t){if(t.startsWith('"')){let e=t.slice(1).split('\\"');for(let t=0;t<e.length;++t){let i=e[t].indexOf('"');-1!==i&&(e[t]=e[t].slice(0,i),e.length=t+1),e[t]=e[t].replaceAll(/\\(.)/g,"$1")}t=e.join('"')}return t}function l(t){let e=t.indexOf("'");return -1===e?t:a(t.slice(0,e),t.slice(e+1).replace(/^[^']*'/,""))}function o(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(t,e,
1i,s){if("q"===i||"Q"===i)return a(e,s=(s=s.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,function(t,e){return String.fromCharCode(parseInt(e,16))}));try{s=atob(s)}catch(t){}return a(e,s)})}return""}(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch(t){}if(t0(t))return t}return null}function rc(t,e){return 404===t||0===t&&e.startsWith("file:")?new tL('Missing PDF "'+e+'".'):new tP("Unexpected server response (".concat(t,') while retrieving PDF "').concat(e,'".'),t)}function ru(t){return 200===t||206===t}function r_(t,e,i){return{method:"GET",headers:t,signal:i.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function rp(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(ty("getArrayBuffer - unexpected data format: ".concat(t)),new Uint8Array(t).buffer)}class rf{get _progressiveDataLength(){var t,e;return null!=(e=null==(t=this._fullRequestReader)?void 0:t._loaded)?e:0}getFullReader(){return tx(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new rg(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=new rm(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;for(let i of(null==(e=this._fullRequestReader)||e.cancel(t),this._rangeRequestReaders.slice(0)))i.cancel(t)}constructor(t){this.source=t,this.isHttp=/^https?:/i.test(t.url),this.headers=ro(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}}class rg{get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;await this._headersCapability.promise;let{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,null==(t=this.onProgress)||t.call(this,{loaded:this._loaded,total:this._contentLength}),{value:rp(e),done:!1})}cancel(t){var e;null==(e=this._reader)||e.cancel(t),this._abortController.abort()}constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;let 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;let i=new Headers(t.headers),s=e.url;fetch(s,r_(i,this._withCredentials,this._abortController)).then(e=>{if(!ru(e.status))throw rc(e.status,s);this._reader=e.body.getReader(),this._headersCapability.resolve();let i=e.headers,{allowRangeRequests:a,suggestedLength:n}=rh({responseHeaders:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=a,this._contentLength=n||this._contentLength,this._filename=rd(i),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new tD("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}}class rm{get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;await this._readCapability.promise;let{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,null==(t=this.onProgress)||t.call(this,{loaded:this._loaded}),{value:rp(e),done:!1})}cancel(t){var e;null==(e=this._reader)||e.cancel(t),this._abortController.abort()}constructor(t,e,i){this._stream=t,this._reader=null,this._loaded=0;let s=t.source;this._withCredentials=s.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!s.disableStream,this._abortController=new AbortController;let a=new Headers(t.headers);a.append("Range","bytes=".concat(e,"-").concat(i-1));let n=s.url;fetch(n,r_(a,this._withCredentials,this._abortController)).then(t=>{if(!ru(t.status))throw rc(t.status,n);this._readCapability.resolve(),this._reader=t.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}}class rv{requestRange(t,e,i){let s={begin:t,end:e};for(let t in i)s[t]=i[t];return this.request(s)}requestFull(t){return this.request(t)}request(t){let e=new XMLHttpRequest,i=this.currXhrId++,s=this.pendingRequests[i]={xhr:e};for(let[t,i]of(e.open("GET",this.url),e.withCredentials=this.withCredentials,this.headers))e.setRequestHeader(t,i);return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range","bytes=".concat(t.begin,"-").concat(t.end-1)),s.expectedStatus=206):s.expectedStatus=200,e.responseType="arraybuffer",t.onError&&(e.onerror=function(i){t.onError(e.status)}),e.onreadystatechange=this.onStateChange.bind(this,i),e.onprogress=this.onProgress.bind(this,i),s.onHeadersReceived=t.onHeadersReceived,s.onDone=t.onDone,s.onError=t.onError,s.onProgress=t.onProgress,e.send(null),i}onProgress(t,e){var i;let s=this.pendingRequests[t];s&&(null==(i=s.onProgress)||i.call(s,e))}onStateChange(t,e){var i,s,a;let n=this.pendingRequests[t];if(!n)return;let r=n.xhr;if(r.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),4!==r.readyState||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],0===r.status&&this.isHttp){null==(i=n.onError)||i.call(n,r.status);return}let l=r.status||200;if((200!==l||206!==n.expectedStatus)&&l!==n.expectedStatus){null==(s=n.onError)||s.call(n,r.status);return}let o=function(t){let e=t.response;return"string"!=typeof e?e:tO(e).buffer}(r);if(206===l){let t=r.getResponseHeader("Content-Range"),e=/bytes (\d+)-(\d+)\/(\d+)/.exec(t);n.onDone({begin:parseInt(e[1],10),chunk:o})}else o?n.onDone({begin:0,chunk:o}):null==(a=n.onError)||a.call(n,r.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}
1abortRequest(t){let e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}constructor({url:t,httpHeaders:e,withCredentials:i}){this.url=t,this.isHttp=/^https?:/i.test(t),this.headers=ro(this.isHttp,e),this.withCredentials=i||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}}class rb{_onRangeRequestReaderClosed(t){let e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return tx(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new rw(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){let i=new rA(this._manager,t,e);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;for(let i of(null==(e=this._fullRequestReader)||e.cancel(t),this._rangeRequestReaders.slice(0)))i.cancel(t)}constructor(t){this._source=t,this._manager=new rv(t),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}}class rw{_onHeadersReceived(){let t=this._fullRequestId,e=new Headers(this._manager.getRequestXhr(t).getAllResponseHeaders().trim().split(/[\r\n]+/).map(t=>{let[e,...i]=t.split(": ");return[e,i.join(": ")]})),{allowRangeRequests:i,suggestedLength:s}=rh({responseHeaders:e,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});i&&(this._isRangeSupported=!0),this._contentLength=s||this._contentLength,this._filename=rd(e),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(let t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){for(let e of(this._storedError=rc(t,this._url),this._headersCapability.reject(this._storedError),this._requests))e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){var e;null==(e=this.onProgress)||e.call(this,{loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){for(let e of(this._done=!0,this._headersCapability.reject(t),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}constructor(t,e){this._manager=t;let 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}}class rA{_close(){var t;null==(t=this.onClosed)||t.call(this,this)}_onDone(t){let e=t.chunk;for(let t of(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0,this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){for(let e of(this._storedError=rc(t,this._url),this._requests))e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){if(!this.isStreamingSupported){var e;null==(e=this.onProgress)||e.call(this,{loaded:t.loaded})}}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){let t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){for(let t of(this._done=!0,this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest
1(this._requestId),this._close()}constructor(t,e,i){this._manager=t;let s={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,s),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}}let ry=/^[a-z][a-z0-9\-+.]+:/i;function rS(t,e,i){return"http:"===t.protocol?nn.get("http").request(t,{headers:e},i):nn.get("https").request(t,{headers:e},i)}class rx{get _progressiveDataLength(){var t,e;return null!=(e=null==(t=this._fullRequestReader)?void 0:t._loaded)?e:0}getFullReader(){return tx(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new rT(this):new rM(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=this.isFsUrl?new rR(this,t,e):new rC(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;for(let i of(null==(e=this._fullRequestReader)||e.cancel(t),this._rangeRequestReaders.slice(0)))i.cancel(t)}constructor(t){this.source=t,this.url=function(t){return new URL(ry.test(t)?t:nn.get("url").pathToFileURL(t))}(t.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.headers=ro(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}}class rE{get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;let e=this._readableStream.read();return null===e?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,null==(t=this.onProgress)||t.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(t){if(!this._readableStream)return void this._error(t);this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",t=>{this._error(t)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new tD("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;let 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()}}class rk{get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;let e=this._readableStream.read();return null===e?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,null==(t=this.onProgress)||t.call(this,{loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(t){if(!this._readableStream)return void this._error(t);this._readableStream.destroy(t)}_error(t){this._storedError=t,this._readCapability.resolve()}_setReadableStream(t){this._readableStream=t,t.on("readable",()=>{this._readCapability.resolve()}),t.on("end",()=>{t.destroy(),this._done=!0,this._readCapability.resolve()}),t.on("error",t=>{this._error(t)}),this._storedError&&this._readableStream.destroy(this._storedError)}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();let e=t.source;this._isStreamingSupported=!e.disableStream}}class rM extends rE{constructor(t){super(t);let e=Object.fromEntries(t.headers),i=e=>{if(404===e.statusCode){let t=new tL('Missing PDF "'.concat(this._url,'".'));this._storedError=t,this._headersCapability.reject(t);return}this._headersCapability.resolve(),this._setReadableStream(e);let i=new Headers(this._readableStream.headers),{allowRangeRequests:s,suggestedLength:a}=rh({responseHeaders:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=a||this._contentLength,this._filename=rd(i)};this._request=rS(this._url,e,i),this._request.on("error",t=>{this._storedError=t,this._headersCapability.reject(t)}),this._request.end()}}class rC extends rk{constructor(t,e,i){super(t);let s=Object.fromEntries(t.headers);s.Range="bytes=".concat(e,"-").concat(i-1);let a=t=>{if(404===t.statusCode){let t=new tL('Missing PDF "'.concat(this._url,'".'));this._storedError=t;return}this._setReadableStream(t)};this._request=rS(this._url,s,a),this._request.on("error",t=>{this._storedError=t}),this._request.end()}}class rT extends rE{constructor(t){super(t);let e=nn.get("fs");e.promises.lstat(this._url).then(t=>{this._contentLength=t.size,this._setReadableStream(e.createReadStream(this._url)),this._headersCapability.resolve()},t=>{"ENOENT"===t.code&&(t=new tL('Missing PDF "'.concat(this._url,'".'))),this._storedError=t,this._headersCapability.reject(t)})}}class rR extends rk{constructor(t,e,i){super(t);let s=nn.get("fs");this._setReadableStream(s.createReadStream(this._url,{start:e,end:i-1}))}}let rL=(s=new WeakMap,a=new WeakMap,n=new WeakMap,r=new WeakMap,l=new WeakMap,o=new WeakMap,h=new WeakMap,d=new WeakMap,c=new WeakMap,u=new WeakMap,_=new WeakMap,p=new WeakMap,f=new WeakMap,g=new WeakMap,m=new WeakMap,v=new WeakMap,b=new WeakMap,w=new WeakMap,A=new WeakSet,y=new WeakSet,S=new WeakSet,x=class t{static get fontFamilyMap(){let{isWindows:t,isFirefox:e}=tN.platform;return tk(this,"fontFamilyMap",new Map([["sans-serif","".concat(t&&e?"Calibri, ":"","sans-serif")],["monospace","".concat(t&&e?"Lucida Console, ":"","monospace")]]))}render(){let e=()=>{(0,O._)(this,c).read().then(t=>{var i;let{value:a,done:n}=t;if(n)return void(0,O._)(this,s).resolve();(0,N._)(this,l,null!=(i=(0,O._)(this,l))?i:a.lang),Object.assign((0,O._)(this,f),a.styles),(0,H._)(this,A,pZ).call(this,a.items),e()},(0,O._)(this,s).reject)};return(0,N._)(this,c,(0,O._)(this,m).getReader()),(0,G._)(t,x,T).add(this),e(),(0,O._)(this,s).promise}update(e){let{viewport:i,onBefore:s=null}=e,a=i.scale*(globalThis.devicePixelRatio||1),n=i.rotation;if(n!==(0,O._)(this,_)&&(null==s||s(),(0,N._)(this,_,n),es((0,O._)(this,u),{rotation:n})),a!==(0,O._)(this,p)){null==s||s(),(0,N._)(this,p,a);let e={div:null,properties:null,ctx:(0,q._)(t,x,p1).call(x,(0,O._)(this,l))};for(let t of(0,O._)(this,v))e.properties=(0,O._)(this,b).get(t),e.div=t,(0,H._)(this,S,p0).call(this,e)}}cancel(){var t;let e=new tD("TextLayer task cancelled.");null==(t=(0,O._)(this,c))||t.cancel(e).catch(()=>{}),(0,N._)(this,c,null),(0,O._)(this,s).reject(e)}get textDivs(){return(0,O._)(this,v)}get textContentItemsStr(){return(0,O._)(this,g)}static cleanup(){if(!((0,G._)(this,x,T).size>0)){for(let{canvas:t}
1of((0,G._)(this,x,E).clear(),(0,G._)(this,x,k).values()))t.remove();(0,G._)(this,x,k).clear()}}constructor({textContentSource:e,container:i,viewport:E}){var k;if((0,B._)(this,A),(0,B._)(this,y),(0,B._)(this,S),(0,W._)(this,s,{writable:!0,value:void 0}),(0,W._)(this,a,{writable:!0,value:void 0}),(0,W._)(this,n,{writable:!0,value:void 0}),(0,W._)(this,r,{writable:!0,value:void 0}),(0,W._)(this,l,{writable:!0,value:void 0}),(0,W._)(this,o,{writable:!0,value:void 0}),(0,W._)(this,h,{writable:!0,value:void 0}),(0,W._)(this,d,{writable:!0,value:void 0}),(0,W._)(this,c,{writable:!0,value:void 0}),(0,W._)(this,u,{writable:!0,value:void 0}),(0,W._)(this,_,{writable:!0,value:void 0}),(0,W._)(this,p,{writable:!0,value:void 0}),(0,W._)(this,f,{writable:!0,value:void 0}),(0,W._)(this,g,{writable:!0,value:void 0}),(0,W._)(this,m,{writable:!0,value:void 0}),(0,W._)(this,v,{writable:!0,value:void 0}),(0,W._)(this,b,{writable:!0,value:void 0}),(0,W._)(this,w,{writable:!0,value:void 0}),(0,N._)(this,s,Promise.withResolvers()),(0,N._)(this,a,null),(0,N._)(this,n,!1),(0,N._)(this,r,!!(null==(k=globalThis.FontInspector)?void 0:k.enabled)),(0,N._)(this,l,null),(0,N._)(this,o,null),(0,N._)(this,h,0),(0,N._)(this,d,0),(0,N._)(this,c,null),(0,N._)(this,u,null),(0,N._)(this,_,0),(0,N._)(this,p,0),(0,N._)(this,f,Object.create(null)),(0,N._)(this,g,[]),(0,N._)(this,m,null),(0,N._)(this,v,[]),(0,N._)(this,b,new WeakMap),(0,N._)(this,w,null),e instanceof ReadableStream)(0,N._)(this,m,e);else if("object"==typeof e)(0,N._)(this,m,new ReadableStream({start(t){t.enqueue(e),t.close()}}));else throw Error('No "textContentSource" parameter specified.');(0,N._)(this,a,(0,N._)(this,u,i)),(0,N._)(this,p,E.scale*(globalThis.devicePixelRatio||1)),(0,N._)(this,_,E.rotation),(0,N._)(this,o,{div:null,properties:null,ctx:null});let{pageWidth:M,pageHeight:C,pageX:R,pageY:L}=E.rawDims;(0,N._)(this,w,[1,0,0,-1,-R,L+C]),(0,N._)(this,d,M),(0,N._)(this,h,C),(0,q._)(t,x,p3).call(x),es(i,E),(0,O._)(this,s).promise.finally(()=>{(0,G._)(t,x,T).delete(this),(0,N._)(this,o,null),(0,N._)(this,f,null)}).catch(()=>{})}},E={writable:!0,value:new Map},k={writable:!0,value:new Map},M={writable:!0,value:new WeakMap},C={writable:!0,value:null},T={writable:!0,value:new Set},x);class rP{static textContent(t){let e=[],i={items:e,styles:Object.create(null)};return!function t(i){var s;if(!i)return;let a=null,n=i.name;if("#text"===n)a=i.value;else{if(!rP.shouldBuildText(n))return;(null==i||null==(s=i.attributes)?void 0:s.textContent)?a=i.attributes.textContent:i.value&&(
1a=i.value)}if(null!==a&&e.push({str:a}),i.children)for(let e of i.children)t(e)}(t),i}static shouldBuildText(t){return"textarea"!==t&&"input"!==t&&"option"!==t&&"select"!==t}}let rI=tn?no:aT,rD=tn?nh:aL,rF=tn?nl:aZ,rO=tn?nd:ni;function rW(){var t,e,i;let s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"string"==typeof s||s instanceof URL?s={url:s}:(s instanceof ArrayBuffer||ArrayBuffer.isView(s))&&(s={data:s});let a=new rj,{docId:n}=a,r=s.url?function(t){if(t instanceof URL)return t.href;try{return new URL(t,window.location).href}catch(e){if(tn&&"string"==typeof t)return t}throw Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(s.url):null,l=s.data?function(t){if(tn&&void 0!==te.B&&t instanceof te.B)throw Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength)return t;if("string"==typeof t)return tO(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||"object"==typeof t&&!isNaN(null==t?void 0:t.length))return new Uint8Array(t);throw Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(s.data):null,o=s.httpHeaders||null,h=!0===s.withCredentials,d=null!=(e=s.password)?e:null,c=s.range instanceof rB?s.range:null,u=Number.isInteger(s.rangeChunkSize)&&s.rangeChunkSize>0?s.rangeChunkSize:65536,_=s.worker instanceof r0?s.worker:null,p=s.verbosity,f="string"!=typeof s.docBaseUrl||t$(s.docBaseUrl)?null:s.docBaseUrl,g="string"==typeof s.cMapUrl?s.cMapUrl:null,m=!1!==s.cMapPacked,v=s.CMapReaderFactory||rD,b="string"==typeof s.standardFontDataUrl?s.standardFontDataUrl:null,w=s.StandardFontDataFactory||rO,A=!0!==s.stopAtErrors,y=Number.isInteger(s.maxImageSize)&&s.maxImageSize>-1?s.maxImageSize:-1,S=!1!==s.isEvalSupported,x="boolean"==typeof s.isOffscreenCanvasSupported?s.isOffscreenCanvasSupported:!tn,E="boolean"==typeof s.isChrome?s.isChrome:!tN.platform.isFirefox&&"undefined"!=typeof window&&!!(null==(t=window)?void 0:t.chrome),k=Number.isInteger(s.canvasMaxAreaInBytes)?s.canvasMaxAreaInBytes:-1,M="boolean"==typeof s.disableFontFace?s.disableFontFace:tn,C=!0===s.fontExtraProperties,T=!0===s.enableXfa,R=s.ownerDocument||globalThis.document,L=!0===s.disableRange,P=!0===s.disableStream,I=!0===s.disableAutoFetch,D=!0===s.pdfBug,F=s.CanvasFactory||rI,O=s.FilterFactory||rF,W=!0===s.enableHWA,N=c?c.length:null!=(i=s.length)?i:NaN,j="boolean"==typeof s.useSystemFonts?s.useSystemFonts:!tn&&!M,H="boolean"==typeof s.useWorkerFetch?s.useWorkerFetch:v===aL&&w===ni&&g&&b&&t5(g,document.baseURI)&&t5(b,document.baseURI);s.canvasFactory&&t4("`canvasFactory`-instance option, please use `CanvasFactory` instead."),s.filterFactory&&t4("`filterFactory`-instance option, please use `FilterFactory` instead."),Number.isInteger(p)&&(tw=p);let B={canvasFactory:new F({ownerDocument:R,enableHWA:W}),filterFactory:new O({docId:n,ownerDocument:R}),cMapReaderFactory:H?null:new v({baseUrl:g,isCompressed:m}),standardFontDataFactory:H?null:new w({baseUrl:b})};if(!_){let t={verbosity:p,port:nW.workerPort};a._worker=_=t.port?r0.fromPort(t):new r0(t)}let G={docId:n,apiVersion:"4.8.69",data:l,password:d,disableAutoFetch:I,rangeChunkSize:u,length:N,docBaseUrl:f,enableXfa:T,evaluatorOptions:{maxImageSize:y,disableFontFace:M,ignoreErrors:A,isEvalSupported:S,isOffscreenCanvasSupported:x,isChrome:E,canvasMaxAreaInBytes:k,fontExtraProperties:C,useSystemFonts:j,cMapUrl:H?g:null,standardFontDataUrl:H?b:null}},z={disableFontFace:M,fontExtraProperties:C,ownerDocument:R,pdfBug:D,styleElement:null,loadingParams:{disableAutoFetch:I,enableXfa:T}};return _.promise.then(function(){let t;if(a.destroyed)throw Error("Loading aborted");if(_.destroyed)throw Error("Worker was destroyed");let e=_.messageHandler.sendWithPromise("GetDocRequest",G,l?[l.buffer]:null);if(c)t=new rn(c,{disableRange:L,disableStream:P});else if(!l){if(!r)throw Error("getDocument - no `url` parameter provided.");t=new(tn?"undefined"!=typeof fetch&&"undefined"!=typeof Response&&"body"in Response.prototype&&t5(r)?rf:rx:t5(r)?rf:rb)({url:r,length:N,httpHeaders:o,withCredentials:h,rangeChunkSize:u,disableRange:L,disableStream:P})}return e.then(e=>{if(a.destroyed)throw Error("Loading aborted");if(_.destroyed)throw Error("Worker was destroyed");let i=new nX(n,e,_.port),s=new li(i,a,t,z,B);a._transport=s,i.send("Ready",null)})}).catch(a._capability.reject),a}function rN(t){return"object"==typeof t&&Number.isInteger(null==t?void 0:t.num)&&t.num>=0&&Number.isInteger(null==t?void 0:t.gen)&&t.gen>=0}class rj{get promise(){return this._capability.promise}async destroy(){var t,e,i;this.destroyed=!0;try{(null==(t=this._worker)?void 0:t.port)&&(this._worker._pendingDestroy=!0),await (null==(e=this._transport)?void 0:e.destroy())}catch(t){throw(null==(i=this._worker)?void 0:i.port)&&delete this._worker._pendingDestroy,t}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId="d".concat((0,U._)(rj,rj,rH).value++),this.destroyed=!1,this.onPassword=null,this.onProgress=null}}var rH={writable:!0,value:0};let rB=class{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(let i of this._rangeListeners)i(t,e)}onDataProgress(t,e){this._readyCapability.promise.then(()=>{for(let i of this._progressListeners)i(t,e)})}onDataProgressiveRead(t){this._readyCapability.promise.then(()=>{for(let e of this._progressiveReadListeners)e(t)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(let t of this._progressiveDoneListeners)t()})}transportReady(){this._readyCapability.resolve()}requestDataRange(t,e){tS("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}constructor(t,e,i=!1,s=null){this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=s,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}};class rG{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 tk(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(){let{intent:t="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{renderingIntent:e}
1=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(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];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()}constructor(t,e){this._pdfInfo=t,this._transport=e}}var rz=new WeakMap,rU=new WeakMap,rV=new WeakSet,rq=new WeakSet;class rK{get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport(){let{scale:t,rotation:e=this.rotate,offsetX:i=0,offsetY:s=0,dontFlip:a=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new tJ({viewBox:this.view,scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:a})}getAnnotations(){let{intent:t="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{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 tk(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var t;return(null==(t=this._transport._htmlForXfa)?void 0:t.children[this._pageIndex])||null}render(t){var e,i,s;let{canvasContext:a,viewport:n,intent:r="display",annotationMode:l=th.ENABLE,transform:o=null,background:h=null,optionalContentConfigPromise:d=null,annotationCanvasMap:c=null,pageColors:u=null,printAnnotationStorage:_=null,isEditing:p=!1}=t;null==(e=this._stats)||e.time("Overall");let f=this._transport.getRenderingIntent(r,l,_,p),{renderingIntent:g,cacheKey:m}=f;(0,N._)(this,rU,!1),(0,H._)(this,rq,rY).call(this),d||(d=this._transport.getOptionalContentConfig(g));let v=this._intentStates.get(m);v||(v=Object.create(null),this._intentStates.set(m,v)),v.streamReaderCancelTimeout&&(clearTimeout(v.streamReaderCancelTimeout),v.streamReaderCancelTimeout=null);let b=!!(g&to.PRINT);v.displayReadyCapability||(v.displayReadyCapability=Promise.withResolvers(),v.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null==(s=this._stats)||s.time("Page Request"),this._pumpOperatorList(f));let w=t=>{if(v.renderTasks.delete(A),(this._maybeCleanupAfterRender||b)&&(0,N._)(this,rU,!0),(0,H._)(this,rV,rX).call(this,!b),t?(A.capability.reject(t),this._abortOperatorList({intentState:v,reason:t instanceof Error?t:Error(t)})):A.capability.resolve(),this._stats){var e;this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(null==(e=globalThis.Stats)?void 0:e.enabled)&&globalThis.Stats.add(this.pageNumber,this._stats)}},A=new lu({callback:w,params:{canvasContext:a,viewport:n,transform:o,background:h},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:v.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!b,pdfBug:this._pdfBug,pageColors:u});((i=v).renderTasks||(i.renderTasks=new Set)).add(A);let y=A.task;return Promise.all([v.displayReadyCapability.promise,d]).then(t=>{var e;let[i,s]=t;if(this.destroyed)return void w();if(null==(e=this._stats)||e.time("Rendering"),!(s.renderingIntent&g))throw Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");A.initializeGraphics({transparency:i,optionalContentConfig:s}),A.operatorListChanged()}).catch(w),y}getOperatorList(){let t,{intent:e="display",annotationMode:i=th.ENABLE,printAnnotationStorage:s=null,isEditing:a=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}
1,n=this._transport.getRenderingIntent(e,i,s,a,!0),r=this._intentStates.get(n.cacheKey);if(r||(r=Object.create(null),this._intentStates.set(n.cacheKey,r)),!r.opListReadCapability){var l,o;(t=Object.create(null)).operatorListChanged=function(){r.operatorList.lastChunk&&(r.opListReadCapability.resolve(r.operatorList),r.renderTasks.delete(t))},r.opListReadCapability=Promise.withResolvers(),((o=r).renderTasks||(o.renderTasks=new Set)).add(t),r.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null==(l=this._stats)||l.time("Page Request"),this._pumpOperatorList(n)}return r.opListReadCapability.promise}streamTextContent(){let{includeMarkedContent:t=!1,disableNormalization:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===t,disableNormalization:!0===e},{highWaterMark:100,size:t=>t.items.length})}getTextContent(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._transport._htmlForXfa)return this.getXfa().then(t=>rP.textContent(t));let e=this.streamTextContent(t);return new Promise(function(t,i){let s=e.getReader(),a={items:[],styles:Object.create(null),lang:null};!function e(){s.read().then(function(i){let{value:s,done:n}=i;if(n)return void t(a);null!=a.lang||(a.lang=s.lang),Object.assign(a.styles,s.styles),a.items.push(...s.items),e()},i)}()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let t=[];for(let e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(let i of e.renderTasks)t.push(i.completed),i.cancel();return this.objs.clear(),(0,N._)(this,rU,!1),(0,H._)(this,rq,rY).call(this),Promise.all(t)}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,N._)(this,rU,!0);let e=(0,H._)(this,rV,rX).call(this,!1);return t&&e&&this._stats&&(this._stats=new t3),e}_startRenderPage(t,e){var i,s;let a=this._intentStates.get(e);a&&(null==(i=this._stats)||i.timeEnd("Page Request"),null==(s=a.displayReadyCapability)||s.resolve(t))}_renderPageChunk(t,e){for(let i=0,s=t.length;i<s;i++)e.operatorList.fnArray.push(t.fnArray[i]),e.operatorList.argsArray.push(t.argsArray[i]);for(let i of(e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots,e.renderTasks))i.operatorListChanged();t.lastChunk&&(0,H._)(this,rV,rX).call(this,!0)}_pumpOperatorList(t){let{renderingIntent:e,cacheKey:i,annotationStorageSerializable:s,modifiedIds:a}=t,{map:n,transfer:r}=s,l=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:i,annotationStorage:n,modifiedIds:a},r).getReader(),o=this._intentStates.get(i);o.streamReader=l;let h=()=>{l.read().then(t=>{let{value:e,done:i}=t;if(i){o.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(e,o),h())},t=>{if(o.streamReader=null,!this._transport.destroyed){if(o.operatorList){for(let t of(o.operatorList.lastChunk=!0,o.renderTasks))t.operatorListChanged();(0,H._)(this,rV,rX).call(this,!0)}if(o.displayReadyCapability)o.displayReadyCapability.reject(t);else if(o.opListReadCapability)o.opListReadCapability.reject(t);else throw t}})};h()}_abortOperatorList(t){let{intentState:e,reason:i,force:s=!1}=t;if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!s){if(e.renderTasks.size>0)return;if(i instanceof tZ){let t=100;i.extraDelay>0&&i.extraDelay<1e3&&(t+=i.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:i,force:!0})},t);return}}if(e.streamReader.cancel(new tD(i.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(let[t,i]of this._intentStates)if(i===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}constructor(t,e,i,s=!1){(0,B._)(this,rV),(0,B._)(this,rq),(0,W._)(this,rz,{writable:!0,value:void 0}),(0,W._)(this,rU,{writable:!0,value:void 0}),(0,N._)(this,rz,null),(0,N._)(this,rU,!1),this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=s?new t3:null,this._pdfBug=s,this.commonObjs=i.commonObjs,this.objs=new ll,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}}function rX(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if((0,H._)(this,rq,rY).call(this),!(0,O._)(this,rU)||this.destroyed)return!1;if(t)return(0,N._)(this,rz,setTimeout(()=>{(0,N._)(this,rz,null),(0,H._)(this,rV,rX).call(this,!1)},5e3)),!1;for(let{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),(0,N._)(this,rU,!1),!0}function rY(){(0,O._)(this,rz)&&(clearTimeout((0,O._)(this,rz)),(0,N._)(this,rz,null))}var rQ=new WeakMap,rJ=new WeakMap;class rZ{postMessage(t,e){let i={data:structuredClone(t,e?{transfer:e}:null)};(0,O._)(this,rJ).then(()=>{for(let[t]of(0,O._)(this,rQ))t.call(this,i)})}addEventListener(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=null;if((null==i?void 0:i.signal)instanceof AbortSignal){let{signal:a}=i;if(a.aborted)return void ty("LoopbackPort - cannot use an `aborted` signal.");let n=()=>this.removeEventListener(t,e);s=()=>a.removeEventListener("abort",n),a.addEventListener("abort",n)}(0,O._)(this,rQ).set(e,s)}removeEventListener(t,e){let i=(0,O._)(this,rQ).get(e);null==i||i(),(0,O._)(this,rQ).delete(e)}terminate(){for(let[,t]of(0,O._)(this,rQ))null==t||t();(0,O._)(this,rQ).clear()}constructor(){(0,W._)(this,rQ,{writable:!0,value:void 0}),(0,W._)(this,rJ,{writable:!0,value:void 0}),(0,N._)(this,rQ,new Map),(0,N._)(this,rJ,Promise.resolve())}}var r$=new WeakSet;class r0{get promise(){return tn?Promise.all([nn.promise,this._readyCapability.promise]):this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(t){this._port=t,this._messageHandler=new nX("main","worker",t),this._messageHandler.on("ready",function(){}),(0,H._)(this,r$,r6).call(this)}_initialize(){if((0,G._)(r0,r0,r3)||(0,G._)(r0,r0,r1))return void this._setupFakeWorker();let{workerSrc:t}=r0;try{r0._isSameOrigin(window.location.href,t)||(t=r0._createCDNWrapper(new URL(t,window.location).href));let e=new Worker(t,{type:"module"}),i=new nX("main","worker",e),s=()=>{a.abort(),i.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(Error("Worker was destroyed")):this._setupFakeWorker()},a=new AbortController;e.addEventListener("error",()=>{this._webWorker||s()},{signal:a.signal}),i.on("test",t=>{if(a.abort(),this.destroyed||!t)return void s();this._messageHandler=i,this._port=e,this._webWorker=e,(0,H._)(this,r$,r6).call(this)}),i.on("ready",t=>{if(a.abort(),this.destroyed)return void s();try{n()}catch(t){this._setupFakeWorker()}});let n=()=>{let t=new Uint8Array;i.send("test",t,[t.buffer])};n();return}catch(t){tA("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){(0,G._)(r0,r0,r3)||(ty("Setting up fake worker."),(0,z._)(r0,r0,r3,!0)),r0._setupFakeWorkerGlobal.then(t=>{if(this.destroyed)return void this._readyCapability.reject(Error("Worker was destroyed"));let e=new rZ;this._port=e;let i="fake".concat((0,U._)(r0,r0,r2).value++),s=new nX(i+"_worker",i,e);t.setup(s,e),this._messageHandler=new nX(i,i+"_worker",e),(0,H._)(this,r$,r6).call(this)}).catch(t=>{this._readyCapability.reject(Error('Setting up fake worker failed: "'.concat(t.message,'".')))})}destroy(){var t;this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),null==(t=(0,G._)(r0,r0,r5))||t.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){var e;if(!(null==t?void 0:t.port))throw Error("PDFWorker.fromPort - invalid method signature.");let i=null==(e=(0,G._)(this,r0,r5))?void 0:e.get(t.port);
1if(i){if(i._pendingDestroy)throw Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return i}return new r0(t)}static get workerSrc(){if(nW.workerSrc)return nW.workerSrc;throw Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return tk(this,"_setupFakeWorkerGlobal",(async()=>(0,G._)(this,r0,r1)?(0,G._)(this,r0,r1):(await import(this.workerSrc)).WorkerMessageHandler)())}constructor({name:t=null,port:e=null,verbosity:i=tw}={}){if((0,B._)(this,r$),this.name=t,this.destroyed=!1,this.verbosity=i,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,e){var s;if(null==(s=(0,G._)(r0,r0,r5))?void 0:s.has(e))throw Error("Cannot use more than one PDFWorker per port.");(0,z._)(r0,r0,r5,(0,G._)(r0,r0,r5)||new WeakMap).set(e,this),this._initializeFromPort(e);return}this._initialize()}}var r1={get:function(){try{var t;return(null==(t=globalThis.pdfjsWorker)?void 0:t.WorkerMessageHandler)||null}catch(t){return null}},set:void 0},r2={writable:!0,value:0},r3={writable:!0,value:!1},r5={writable:!0,value:void 0};function r6(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}tn&&((0,z._)(r0,r0,r3,!0),nW.workerSrc||(nW.workerSrc="./pdf.worker.mjs")),r0._isSameOrigin=(t,e)=>{let i;try{if(!(i=new URL(t)).origin||"null"===i.origin)return!1}catch(t){return!1}let s=new URL(e,i);return i.origin===s.origin},r0._createCDNWrapper=t=>URL.createObjectURL(new Blob(['await import("'.concat(t,'");')],{type:"text/javascript"}));var r4=new WeakMap,r8=new WeakMap,r7=new WeakMap,r9=new WeakMap,lt=new WeakMap,le=new WeakSet;class li{get annotationStorage(){return tk(this,"annotationStorage",new aw)}getRenderingIntent(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:th.ENABLE,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4],n=to.DISPLAY,r=af;switch(t){case"any":n=to.ANY;break;case"display":break;case"print":n=to.PRINT;break;default:ty("getRenderingIntent - invalid intent: ".concat(t))}let l=n&to.PRINT&&i instanceof aS?i:this.annotationStorage;switch(e){case th.DISABLE:n+=to.ANNOTATIONS_DISABLE;break;case th.ENABLE:break;case th.ENABLE_FORMS:n+=to.ANNOTATIONS_FORMS;break;case th.ENABLE_STORAGE:n+=to.ANNOTATIONS_STORAGE,r=l.serializable;break;default:ty("getRenderingIntent - invalid annotationMode: ".concat(e))}s&&(n+=to.IS_EDITING),a&&(n+=to.OPLIST);let{ids:o,hash:h}=l.modifiedIds,d=[n,r.hash,h];return{renderingIntent:n,cacheKey:d.join("_"),annotationStorageSerializable:r,modifiedIds:o}}destroy(){var t;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),null==(t=(0,O._)(this,lt))||t.reject(Error("Worker was destroyed during onPassword callback"));let e=[];for(let t of(0,O._)(this,r8).values())e.push(t._destroy());(0,O._)(this,r8).clear(),(0,O._)(this,r7).clear(),(0,O._)(this,r9).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();let i=this.messageHandler.sendWithPromise("Terminate",null);return e.push(i),Promise.all(e).then(()=>{var t;this.commonObjs.clear(),this.fontLoader.clear(),(0,O._)(this,r4).clear(),this.filterFactory.destroy(),rL.cleanup(),null==(t=this._networkStream)||t.cancelAllRequests(new tD("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){let{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(t,e)=>{tx(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=t=>{this._lastProgress={loaded:t.loaded,total:t.total}},e.onPull=()=>{this._fullReader.read().then(function(t){let{value:i,done:s}=t;if(s)return void e.close();tx(i instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(i),1,[i])}).catch(t=>{e.error(t)})},e.onCancel=t=>{this._fullReader.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}}),t.on("ReaderHeadersReady",async t=>{await this._fullReader.headersReady;let{isStreamingSupported:i,isRangeSupported:s,contentLength:a}=this._fullReader;if(!i||!s){if(this._lastProgress){var n;null==(n=e.onProgress)||n.call(e,this._lastProgress)}this._fullReader.onProgress=t=>{var i;null==(i=e.onProgress)||i.call(e,{loaded:t.loaded,total:t.total})}}return{isStreamingSupported:i,isRangeSupported:s,contentLength:a}}),t.on("GetRangeReader",(t,e)=>{tx(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");let i=this._networkStream.getRangeReader(t.begin,t.end);if(!i)return void e.close();e.onPull=()=>{i.read().then(function(t){let{value:i,done:s}=t;if(s)return void e.close();tx(i instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(i),1,[i])}).catch(t=>{e.error(t)})},e.onCancel=t=>{i.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}}),t.on("GetDoc",t=>{let{pdfInfo:i}=t;this._numPages=i.numPages,this._htmlForXfa=i.htmlForXfa,delete i.htmlForXfa,e._capability.resolve(new rG(i,this))}),t.on("DocException",function(t){let i;switch(t.name){case"PasswordException":i=new tC(t.message,t.code);break;case"InvalidPDFException":i=new tR(t.message);break;case"MissingPDFException":i=new tL(t.message);break;case"UnexpectedResponseException":i=new tP(t.message,t.status);break;case"UnknownErrorException":i=new tT(t.message,t.details);break;default:tS("DocException - expected a valid Error.")}e._capability.reject(i)}
1),t.on("PasswordRequest",t=>{if((0,N._)(this,lt,Promise.withResolvers()),e.onPassword){let i=t=>{t instanceof Error?(0,O._)(this,lt).reject(t):(0,O._)(this,lt).resolve({password:t})};try{e.onPassword(i,t.code)}catch(t){(0,O._)(this,lt).reject(t)}}else(0,O._)(this,lt).reject(new tC(t.message,t.code));return(0,O._)(this,lt).promise}),t.on("DataLoaded",t=>{var i;null==(i=e.onProgress)||i.call(e,{loaded:t.length,total:t.length}),this.downloadInfoCapability.resolve(t)}),t.on("StartRenderPage",t=>{this.destroyed||(0,O._)(this,r8).get(t.pageIndex)._startRenderPage(t.transparency,t.cacheKey)}),t.on("commonobj",e=>{let[i,s,a]=e;if(this.destroyed||this.commonObjs.has(i))return null;switch(s){case"Font":var n;let{disableFontFace:r,fontExtraProperties:l,pdfBug:o}=this._params;if("error"in a){let t=a.error;ty("Error during font loading: ".concat(t)),this.commonObjs.resolve(i,t);break}let h=new ak(a,{disableFontFace:r,inspectFont:o&&(null==(n=globalThis.FontInspector)?void 0:n.enabled)?(t,e)=>globalThis.FontInspector.fontAdded(t,e):null});this.fontLoader.bind(h).catch(()=>t.sendWithPromise("FontFallback",{id:i})).finally(()=>{!l&&h.data&&(h.data=null),this.commonObjs.resolve(i,h)});break;case"CopyLocalImage":let{imageRef:d}=a;for(let t of(tx(d,"The imageRef must be defined."),(0,O._)(this,r8).values()))for(let[,e]of t.objs)if((null==e?void 0:e.ref)===d){if(!e.dataLen)return null;return this.commonObjs.resolve(i,structuredClone(e)),e.dataLen}break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(i,a);break;default:throw Error("Got unknown common object type ".concat(s))}return null}),t.on("obj",t=>{let[e,i,s,a]=t;if(this.destroyed)return;let n=(0,O._)(this,r8).get(i);if(!n.objs.has(e)){if(0===n._intentStates.size){var r;null==a||null==(r=a.bitmap)||r.close();return}switch(s){case"Image":n.objs.resolve(e,a),(null==a?void 0:a.dataLen)>1e7&&(n._maybeCleanupAfterRender=!0);break;case"Pattern":n.objs.resolve(e,a);break;default:throw Error("Got unknown object type ".concat(s))}}}),t.on("DocProgress",t=>{var i;this.destroyed||null==(i=e.onProgress)||i.call(e,{loaded:t.loaded,total:t.total})}),t.on("FetchBuiltInCMap",async t=>{if(this.destroyed)throw Error("Worker was destroyed.");if(!this.cMapReaderFactory)throw Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");return this.cMapReaderFactory.fetch(t)}),t.on("FetchStandardFontData",async t=>{if(this.destroyed)throw Error("Worker was destroyed.");if(!this.standardFontDataFactory)throw Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");return this.standardFontDataFactory.fetch(t)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var t,e;this.annotationStorage.size<=0&&ty("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:i,transfer:s}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:i,filename:null!=(e=null==(t=this._fullReader)?void 0:t.filename)?e:null},s).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(Error("Invalid page request."));let e=t-1,i=(0,O._)(this,r7).get(e);if(i)return i;let s=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(i=>{if(this.destroyed)throw Error("Transport destroyed");i.refStr&&(0,O._)(this,r9).set(i.refStr,t);let s=new rK(e,i,this,this._params.pdfBug);return(0,O._)(this,r8).set(e,s),s});return(0,O._)(this,r7).set(e,s),s}getPageIndex(t){return rN(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(Error("Invalid pageIndex request."))}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getFieldObjects(){return(0,H._)(this,le,ls).call(this,"GetFieldObjects")}hasJSActions(){return(0,H._)(this,le,ls).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}
1getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return"string"!=typeof t?Promise.reject(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(0,H._)(this,le,ls).call(this,"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(0,H._)(this,le,ls).call(this,"GetOptionalContentConfig").then(e=>new rs(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){let t="GetMetadata",e=(0,O._)(this,r4).get(t);if(e)return e;let i=this.messageHandler.sendWithPromise(t,null).then(t=>{var e,i,s,a;return{info:t[0],metadata:t[1]?new n1(t[1]):null,contentDispositionFilename:null!=(s=null==(e=this._fullReader)?void 0:e.filename)?s:null,contentLength:null!=(a=null==(i=this._fullReader)?void 0:i.contentLength)?a:null}});return(0,O._)(this,r4).set(t,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.destroyed){for(let t of(await this.messageHandler.sendWithPromise("Cleanup",null),(0,O._)(this,r8).values()))if(!t.cleanup())throw Error("startCleanup: Page ".concat(t.pageNumber," is currently rendering."));this.commonObjs.clear(),t||this.fontLoader.clear(),(0,O._)(this,r4).clear(),this.filterFactory.destroy(!0),rL.cleanup()}}cachedPageNumber(t){var e;if(!rN(t))return null;let i=0===t.gen?"".concat(t.num,"R"):"".concat(t.num,"R").concat(t.gen);return null!=(e=(0,O._)(this,r9).get(i))?e:null}constructor(t,e,i,s,a){(0,B._)(this,le),(0,W._)(this,r4,{writable:!0,value:void 0}),(0,W._)(this,r8,{writable:!0,value:void 0}),(0,W._)(this,r7,{writable:!0,value:void 0}),(0,W._)(this,r9,{writable:!0,value:void 0}),(0,W._)(this,lt,{writable:!0,value:void 0}),(0,N._)(this,r4,new Map),(0,N._)(this,r8,new Map),(0,N._)(this,r7,new Map),(0,N._)(this,r9,new Map),(0,N._)(this,lt,null),this.messageHandler=t,this.loadingTask=e,this.commonObjs=new ll,this.fontLoader=new aE({ownerDocument:s.ownerDocument,styleElement:s.styleElement}),this.loadingParams=s.loadingParams,this._params=s,this.canvasFactory=a.canvasFactory,this.filterFactory=a.filterFactory,this.cMapReaderFactory=a.cMapReaderFactory,this.standardFontDataFactory=a.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}}function ls(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=(0,O._)(this,r4).get(t);if(i)return i;let s=this.messageHandler.sendWithPromise(t,e);return(0,O._)(this,r4).set(t,s),s}let la=Symbol("INITIAL_DATA");var ln=new WeakMap,lr=new WeakSet;class ll{get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e){let i=(0,H._)(this,lr,lo).call(this,t);return i.promise.then(()=>e(i.data)),null}let i=(0,O._)(this,ln)[t];if(!i||i.data===la)throw Error("Requesting object that isn't resolved yet ".concat(t,"."));return i.data}has(t){let e=(0,O._)(this,ln)[t];return!!e&&e.data!==la}resolve(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=(0,H._)(this,lr,lo).call(this,t);i.data=e,i.resolve()}clear(){for(let e in(0,O._)(this,ln)){var t;let{data:i}=(0,O._)(this,ln)[e];null==i||null==(t=i.bitmap)||t.close()}(0,N._)(this,ln,Object.create(null))}*[Symbol.iterator](){for(let t in(0,O._)(this,ln)){let{data:e}=(0,O._)(this,ln)[t];e!==la&&(yield[t,e])}}constructor(){(0,B._)(this,lr),(0,W._)(this,ln,{writable:!0,value:void 0}),(0,N._)(this,ln,Object.create(null))}}function lo(t){var e;return(e=(0,O._)(this,ln))[t]||(e[t]={...Promise.withResolvers(),data:la})}var lh=new WeakMap;class ld{get promise(){return(0,O._)(this,lh).capability.promise}cancel(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;(0,O._)(this,lh).cancel(null,t)}get separateAnnots(){let{separateAnnots:t}=(0,O._)(this,lh).operatorList;if(!t)return!1;let{annotationCanvasMap:e}=(0,O._)(this,lh);return t.form||t.canvas&&(null==e?void 0:e.size)>0}constructor(t){(0,W._)(this,lh,{writable:!0,value:void 0}),(0,N._)(this,lh,null),(0,N._)(this,lh,t),this.onContinue=null}}var lc=new WeakMap;class lu{get completed(){return this.capability.promise.catch(function(){})}initializeGraphics(t){var e,i;let{transparency:s=!1,optionalContentConfig:a}=t;if(this.cancelled)return;
1if(this._canvas){if((0,G._)(lu,lu,l_).has(this._canvas))throw Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");(0,G._)(lu,lu,l_).add(this._canvas)}this._pdfBug&&(null==(e=globalThis.StepperManager)?void 0:e.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());let{canvasContext:n,viewport:r,transform:l,background:o}=this.params;this.gfx=new nD(n,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:a},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:l,viewport:r,transparency:s,background:o}),this.operatorListIdx=0,this.graphicsReady=!0,null==(i=this.graphicsReadyCallback)||i.call(this)}cancel(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.running=!1,this.cancelled=!0,null==(t=this.gfx)||t.endDrawing(),(0,O._)(this,lc)&&(window.cancelAnimationFrame((0,O._)(this,lc)),(0,N._)(this,lc,null)),(0,G._)(lu,lu,l_).delete(this._canvas),this.callback(e||new tZ("Rendering cancelled, page ".concat(this._pageIndex+1),i))}operatorListChanged(){var t;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}null==(t=this.stepper)||t.updateOperatorList(this.operatorList),this.running||this._continue()}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?(0,N._)(this,lc,window.requestAnimationFrame(()=>{(0,N._)(this,lc,null),this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){!this.cancelled&&(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),(0,G._)(lu,lu,l_).delete(this._canvas),this.callback())))}constructor({callback:t,params:e,objs:i,commonObjs:s,annotationCanvasMap:a,operatorList:n,pageIndex:r,canvasFactory:l,filterFactory:o,useRequestAnimationFrame:h=!1,pdfBug:d=!1,pageColors:c=null}){(0,W._)(this,lc,{writable:!0,value:void 0}),(0,N._)(this,lc,null),this.callback=t,this.params=e,this.objs=i,this.commonObjs=s,this.annotationCanvasMap=a,this.operatorListIdx=null,this.operatorList=n,this._pageIndex=r,this.canvasFactory=l,this.filterFactory=o,this._pdfBug=d,this.pageColors=c,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===h&&"undefined"!=typeof window,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new ld(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}}var l_={writable:!0,value:new WeakSet};let lp="4.8.69",lf="3634dab10";function lg(t){return Math.floor(255*Math.max(0,Math.min(1,t))).toString(16).padStart(2,"0")}function lm(t){return Math.max(0,Math.min(255,255*t))}class lv{static CMYK_G(t){let[e,i,s,a]=t;return["G",1-Math.min(1,.3*e+.59*s+.11*i+a)]}static G_CMYK(t){let[e]=t;return["CMYK",0,0,0,1-e]}static G_RGB(t){let[e]=t;return["RGB",e,e,e]}static G_rgb(t){let[e]=t;return[e=lm(e),e,e]}static G_HTML(t){let[e]=t,i=lg(e);return"#".concat(i).concat(i).concat(i)}static RGB_G(t){let[e,i,s]=t;return["G",.3*e+.59*i+.11*s]}static RGB_rgb(t){return t.map(lm)}static RGB_HTML(t){return"#".concat(t.map(lg).join(""))}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB(t){let[e,i,s,a]=t;return["RGB",1-Math.min(1,e+a),1-Math.min(1,s+a),1-Math.min(1,i+a)]}static CMYK_rgb(t){let[e,i,s,a]=t;return[lm(1-Math.min(1,e+a)),lm(1-Math.min(1,s+a)),lm(1-Math.min(1,i+a))]}static CMYK_HTML(t){let e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK(t){let[e,i,s]=t,a=1-e,n=1-i,r=1-s,l=Math.min(a,n,r);return["CMYK",a,n,r,l]}}class lb{create(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t<=0||e<=0)throw Error("Invalid SVG dimensions");let s=this._createSVG("svg:svg");return s.setAttribute("version","1.1"),i||(s.setAttribute("width","".concat(t,"px")),s.setAttribute("height","".concat(e,"px"))),s.setAttribute("preserveAspectRatio","none"),s.setAttribute("viewBox","0 0 ".concat(t," ").concat(e)),s}createElement(t){if("string"!=typeof t)throw Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){tS("Abstract method `_createSVG` called.")}}class lw extends lb{_createSVG(t){return document.createElementNS(tX,t)}}class lA{static setupStorage(t,e,i,s,a){let n=s.getValue(e,{value:null});switch(i.name){case"textarea":if(null!==n.value&&(t.textContent=n.value),"print"===a)break;t.addEventListener("input",t=>{s.setValue(e,{value:t.target.value})});break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){if(n.value===i.attributes.xfaOn?t.setAttribute("checked",!0):n.value===i.attributes.xfaOff&&t.removeAttribute("checked"),"print"===a)break;t.addEventListener("change",t=>{s.setValue(e,{value:t.target.checked?t.target.getAttribute("xfaOn"):t.target.getAttribute("xfaOff")})})}else{if(null!==n.value&&t.setAttribute("value",n.value),"print"===a)break;t.addEventListener("input",t=>{s.setValue(e,{value:t.target.value})})}break;case"select":if(null!==n.value)for(let e of(t.setAttribute("value",n.value),i.children))e.attributes.value===n.value?e.attributes.selected=!0:e.attributes.hasOwnProperty("selected")&&delete e.attributes.selected;t.addEventListener("input",t=>{let i=t.target.options,a=-1===i.selectedIndex?"":i[i.selectedIndex].value;s.setValue(e,{value:a})})}}static setAttributes(t){let{html:e,element:i,storage:s=null,intent:a,linkService:n}=t,{attributes:r}=i,l=e instanceof HTMLAnchorElement;for(let[t,i]of("radio"===r.type&&(r.name="".concat(r.name,"-").concat(a)),Object.entries(r)))if(null!=i)switch(t){case"class":i.length&&e.setAttribute(t,i.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",i);break;case"style":Object.assign(e.style,i);break;case"textContent":e.textContent=i;break;default:l&&("href"===t||"newWindow"===t)||e.setAttribute(t,i)}l&&n.addLinkAttributes(e,r.href,r.newWindow),s&&r.dataId&&this.setupStorage(e,r.dataId,i,s)}static render(t){let e=t.annotationStorage,i=t.linkService,s=t.xfaHtml,a=t.intent||"display",n=document.createElement(s.name);s.attributes&&this.setAttributes({html:n,element:s,intent:a,linkService:i});let r="richText"!==a,l=t.div;if(l.append(n),t.viewport){let e="matrix(".concat(t.viewport.transform.join(","),")");l.style.transform=e}r&&l.setAttribute("class","xfaLayer xfaFont");let o=[];if(0===s.children.length){if(s.value){let t=document.createTextNode(s.value);n.append(t),r&&rP.shouldBuildText(s.name)&&o.push(t)}return{textDivs:o}}let h=[[s,-1,n]];for(;h.length>0;){var d,c;let[t,s,n]=h.at(-1);if(s+1===t.children.length){h.pop();continue}let l=t.children[++h.at(-1)[1]];if(null===l)continue;let{name:u}=l;if("#text"===u){let t=document.createTextNode(l.value);o.push(t),n.append(t);continue}let _=(null==l||null==(d=l.attributes)?void 0:d.xmlns)?document.createElementNS(l.attributes.xmlns,u):document.createElement(u);if(n.append(_),l.attributes&&this.setAttributes({html:_,element:l,storage:e,intent:a,linkService:i}),(null==(c=l.children)?void 0:c.length)>0)h.push([l,-1,_]);else if(l.value){let t=document.createTextNode(l.value);r&&rP.shouldBuildText(u)&&o.push(t),_.append(t)}}for(let t of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))t.setAttribute("readOnly",!0);return{textDivs:o}}static update(t){let e="matrix(".concat(t.viewport.transform.join(","),")");t.div.style.transform=e,t.div.hidden=!1}}let ly=new WeakSet;function lS(t){return{width:t[2]-t[0],height:t[3]-t[1]}}class lx{static create(t){switch(t.data.annotationType){case tf.LINK:return new lD(t);case tf.TEXT:return new lN(t);case tf.WIDGET:switch(t.data.fieldType){case"Tx":return new lH(t);case"Btn":if(t.data.radioButton)return new lz(t);if(t.data.checkBox)return new lG(t);return new lU(t);case"Ch":return new lV(t);case"Sig":return new lB(t)}return new lj(t);case tf.POPUP:return new lq(t);case tf.FREETEXT:return new oA(t);case tf.LINE:return new oS(t);case tf.SQUARE:return new oE(t);
1case tf.CIRCLE:return new oM(t);case tf.POLYLINE:return new oT(t);case tf.CARET:return new oL(t);case tf.INK:return new oI(t);case tf.POLYGON:return new oR(t);case tf.HIGHLIGHT:return new oD(t);case tf.UNDERLINE:return new oF(t);case tf.SQUIGGLY:return new oO(t);case tf.STRIKEOUT:return new oW(t);case tf.STAMP:return new oN(t);case tf.FILEATTACHMENT:return new oB(t);default:return new lT(t)}}}var lE=new WeakMap,lk=new WeakMap,lM=new WeakMap,lC=new WeakSet;class lT{static _hasPopupData(t){let{titleObj:e,contentsObj:i,richText:s}=t;return!!((null==e?void 0:e.str)||(null==i?void 0:i.str)||(null==s?void 0:s.str))}get _isEditable(){return this.data.isEditable}get hasPopupData(){return lT._hasPopupData(this.data)}updateEdited(t){var e;if(!this.container)return;(0,N._)(this,lE,(0,O._)(this,lE)||{rect:this.data.rect.slice(0)});let{rect:i}=t;i&&(0,H._)(this,lC,lR).call(this,i),null==(e=(0,O._)(this,lM))||e.popup.updateEdited(t)}resetEdited(){var t;(0,O._)(this,lE)&&((0,H._)(this,lC,lR).call(this,(0,O._)(this,lE).rect),null==(t=(0,O._)(this,lM))||t.popup.resetEdited(),(0,N._)(this,lE,null))}_createContainer(t){let{data:e,parent:{page:i,viewport:s}}=this,a=document.createElement("section");a.setAttribute("data-annotation-id",e.id),this instanceof lj||(a.tabIndex=1e3);let{style:n}=a;if(n.zIndex=this.parent.zIndex++,e.alternativeText&&(a.title=e.alternativeText),e.noRotate&&a.classList.add("norotate"),!e.rect||this instanceof lq){let{rotation:t}=e;return e.hasOwnCanvas||0===t||this.setRotation(t,a),a}let{width:r,height:l}=lS(e.rect);if(!t&&e.borderStyle.width>0){n.borderWidth="".concat(e.borderStyle.width,"px");let t=e.borderStyle.horizontalCornerRadius,i=e.borderStyle.verticalCornerRadius;switch(t>0||i>0?n.borderRadius="calc(".concat(t,"px * var(--scale-factor)) / calc(").concat(i,"px * var(--scale-factor))"):this instanceof lz&&(n.borderRadius="calc(".concat(r,"px * var(--scale-factor)) / calc(").concat(l,"px * var(--scale-factor))")),e.borderStyle.style){case tg.SOLID:n.borderStyle="solid";break;case tg.DASHED:n.borderStyle="dashed";break;case tg.BEVELED:ty("Unimplemented border style: beveled");break;case tg.INSET:ty("Unimplemented border style: inset");break;case tg.UNDERLINE:n.borderBottomStyle="solid"}let s=e.borderColor||null;s?((0,N._)(this,lk,!0),n.borderColor=tH.makeHexColor(0|s[0],0|s[1],0|s[2])):n.borderWidth=0}let o=tH.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:h,pageHeight:d,pageX:c,pageY:u}=s.rawDims;n.left="".concat(100*(o[0]-c)/h,"%"),n.top="".concat(100*(o[1]-u)/d,"%");let{rotation:_}=e;return e.hasOwnCanvas||0===_?(n.width="".concat(100*r/h,"%"),n.height="".concat(100*l/d,"%")):this.setRotation(_,a),a}setRotation(t){let e,i,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.container;if(!this.data.rect)return;let{pageWidth:a,pageHeight:n}=this.parent.viewport.rawDims,{width:r,height:l}=lS(this.data.rect);t%180==0?(e=100*r/a,i=100*l/n):(e=100*l/a,i=100*r/n),s.style.width="".concat(e,"%"),s.style.height="".concat(i,"%"),s.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){let t=(t,e,i)=>{let s=i.detail[t],a=s[0],n=s.slice(1);i.target.style[e]=lv["".concat(a,"_HTML")](n),this.annotationStorage.setValue(this.data.id,{[e]:lv["".concat(a,"_rgb")](n)})};return tk(this,"_commonActions",{display:t=>{let{display:e}=t.detail,i=e%2==1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:1===e||2===e})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{let{hidden:e}=t.detail;this.container.style.visibility=e?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:e,noView:e})},focus:t=>{setTimeout(()=>t.target.focus({preventScroll:!1}),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.target.disabled=t.detail.readonly},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:t=>{let e=t.detail.rotation;this.setRotation(e),this.annotationStorage.setValue(this.data.id,{rotation:e})}})}_dispatchEventFromSandbox(t,e){let i=this._commonActions;for(let s of Object.keys(e.detail)){let a=t[s]||i[s];null==a||a(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;let e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;let i=this._commonActions;for(let[s,a]of Object.entries(e)){let n=i[s];n&&(n({detail:{[s]:a},target:t}),delete e[s])}}_createQuadrilaterals(){let t;if(!this.container)return;let{quadPoints:e}=this.data;if(!e)return;let[i,s,a,n]=this.data.rect.map(t=>Math.fround(t));if(8===e.length){let[t,r,l,o]=e.subarray(2,6);if(a===t&&n===r&&i===l&&s===o)return}let{style:r}=this.container;if((0,O._)(this,lk)){let{borderColor:e,borderWidth:i}=r;r.borderWidth=0,t=["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="'.concat(e,'" stroke-width="').concat(i,'">')],this.container.classList.add("hasBorder")}let l=a-i,o=n-s,{svgFactory:h}=this,d=h.createElement("svg");d.classList.add("quadrilateralsContainer"),d.setAttribute("width",0),d.setAttribute("height",0);let c=h.createElement("defs");d.append(c);let u=h.createElement("clipPath"),_="clippath_".concat(this.data.id);u.setAttribute("id",_),u.setAttribute("clipPathUnits","objectBoundingBox"),c.append(u);for(let s=2,a=e.length;s<a;s+=8){let a=e[s],r=e[s+1],d=e[s+2],c=e[s+3],_=h.createElement("rect"),p=(d-i)/l,f=(n-r)/o,g=(a-d)/l,m=(r-c)/o;_.setAttribute("x",p),_.setAttribute("y",f),_.setAttribute("width",g),_.setAttribute("height",m),u.append(_),null==t||t.push('<rect vector-effect="non-scaling-stroke" x="'.concat(p,'" y="').concat(f,'" width="').concat(g,'" height="').concat(m,'"/>'))}(0,O._)(this,lk)&&(t.push("</g></svg>')"),r.backgroundImage=t.join("")),this.container.append(d),this.container.style.clipPath="url(#".concat(_,")")}_createPopup(){let{data:t}=this,e=(0,N._)(this,lM,new lq({data:{color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,richText:t.richText,parentRect:t.rect,borderStyle:0,id:"popup_".concat(t.id),rotation:t.rotation},parent:this.parent,elements:[this]}));this.parent.div.append(e.render())}render(){tS("Abstract method `AnnotationElement.render` called")}_getElementsByName(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=[];if(this._fieldObjects){let s=this._fieldObjects[t];if(s)for(let{page:t,id:a,exportValues:n}of s){if(-1===t||a===e)continue;let s="string"==typeof n?n:null,r=document.querySelector('[data-element-id="'.concat(a,'"]'));if(r&&!ly.has(r)){ty("_getElementsByName - element not allowed: ".concat(a));continue}i.push({id:a,exportValue:s,domElement:r})}return i}for(let s of document.getElementsByName(t)){let{exportValue:t}=s,a=s.getAttribute("data-element-id");a!==e&&ly.has(s)&&i.push({id:a,exportValue:t,domElement:s})}return i}show(){var t;this.container&&(this.container.hidden=!1),null==(t=this.popup)||t.maybeShow()}hide(){var t;this.container&&(this.container.hidden=!0),null==(t=this.popup)||t.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){let t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(let e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;let{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{var i;null==(i=this.linkService.eventBus)||i.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e})})}constructor(t,{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:s=!1}={}){(0,B._)(this,lC),(0,W._)(this,lE,{writable:!0,value:void 0}),(0,W._)(this,lk,{writable:!0,value:void 0}),(0,W._)(this,lM,{writable:!0,value:void 0}),(0,N._)(this,lE,null),(0,N._)(this,lk,!1),(0,N._)(this,lM,null),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)),s&&this._createQuadrilaterals()}}function lR(t){let{container:{style:e},data:{rect:i,rotation:s},parent:{viewport:{rawDims:{pageWidth:a,pageHeight:n,pageX:r,pageY:l}}}}=this;null==i||i.splice(0,4,...t);let{width:o,height:h}=lS(t);e.left="".concat(100*(t[0]-r)/a,"%"),e.top="".concat(100*(n-t[3]+l)/n,"%"),0===s?(e.width="".concat(100*o/a,"%"),e.height="".concat(100*h/n,"%")):this.setRotation(s)}var lL=new WeakSet,lP=new WeakSet,lI=new WeakSet;class lD extends lT{render(){let{data:t,linkService:e}=this,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let s=!1;return t.url?(e.addLinkAttributes(i,t.url,t.newWindow),s=!0):t.action?(this._bindNamedAction(i,t.action),s=!0):t.attachment?((0,H._)(this,lP,lO).call(this,i,t.attachment,t.attachmentDest),s=!0):t.setOCGState?((0,H._)(this,lI,lW).call(this,i,t.setOCGState),s=!0):t.dest?(this._bindLink(i,t.dest),s=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),s=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),s=!0):this.isTooltipOnly&&!s&&(this._bindLink(i,""),s=!0)),this.container.classList.add("linkA
1nnotation"),s&&this.container.append(i),this.container}_bindLink(t,e){t.href=this.linkService.getDestinationHash(e),t.onclick=()=>(e&&this.linkService.goToDestination(e),!1),(e||""===e)&&(0,H._)(this,lL,lF).call(this)}_bindNamedAction(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),(0,H._)(this,lL,lF).call(this)}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");let i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(let s of Object.keys(e.actions)){let a=i.get(s);a&&(t[a]=()=>{var t;return null==(t=this.linkService.eventBus)||t.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:s}}),!1})}t.onclick||(t.onclick=()=>!1),(0,H._)(this,lL,lF).call(this)}_bindResetFormAction(t,e){let i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),(0,H._)(this,lL,lF).call(this),!this._fieldObjects){ty('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(t.onclick=()=>!1);return}t.onclick=()=>{null==i||i();let{fields:t,refs:s,include:a}=e,n=[];if(0!==t.length||0!==s.length){let e=new Set(s);for(let i of t)for(let{id:t}of this._fieldObjects[i]||[])e.add(t);for(let t of Object.values(this._fieldObjects))for(let i of t)e.has(i.id)===a&&n.push(i)}else for(let t of Object.values(this._fieldObjects))n.push(...t);let r=this.annotationStorage,l=[];for(let t of n){let{id:e}=t;switch(l.push(e),t.type){case"text":{let i=t.defaultValue||"";r.setValue(e,{value:i});break}case"checkbox":case"radiobutton":{let i=t.defaultValue===t.exportValues;r.setValue(e,{value:i});break}case"combobox":case"listbox":{let i=t.defaultValue||"";r.setValue(e,{value:i});break}default:continue}let i=document.querySelector('[data-element-id="'.concat(e,'"]'));if(i){if(!ly.has(i)){ty("_bindResetFormAction - element not allowed: ".concat(e));continue}i.dispatchEvent(new Event("resetform"))}}if(this.enableScripting){var o;null==(o=this.linkService.eventBus)||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:l,name:"ResetForm"}})}return!1}}constructor(t,e=null){super(t,{isRenderable:!0,ignoreBorder:!!(null==e?void 0:e.ignoreBorder),createQuadrilaterals:!0}),(0,B._)(this,lL),(0,B._)(this,lP),(0,B._)(this,lI),this.isTooltipOnly=t.data.isTooltipOnly}}function lF(){this.container.setAttribute("data-internal-link","")}function lO(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;t.href=this.linkService.getAnchorUrl(""),e.description&&(t.title=e.description),t.onclick=()=>{var t;return null==(t=this.downloadManager)||t.openOrDownloadData(e.content,e.filename,i),!1},(0,H._)(this,lL,lF).call(this)}function lW(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),(0,H._)(this,lL,lF).call(this)}class lN extends lT{render(){this.container.classList.add("textAnnotation");let 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}constructor(t){super(t,{isRenderable:!0})}}class lj extends lT{render(){return this.container}showElementAndHideCanvas(t){if(this.data.hasOwnCanvas){var e;(null==(e=t.previousSibling)?void 0:e.nodeName)==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1}}_getKeyModifier(t){return tN.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,i,s,a){i.includes("mouse")?t.addEventListener(i,t=>{var e;null==(e=this.linkService.eventBus)||e.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:a(t),shift:t.shiftKey,modifier:this._getKeyModifier(t)}})}):t.addEventListener(i,t=>{var n;if("blur"===i){if(!e.focused||!t.relatedTarget)return;e.focused=!1}else if("focus"===i){if(e.focused)return;e.focused=!0}a&&(null==(n=this.linkService.eventBus)||n.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:a(t)}}))})}_setEventListeners(t,e,i,s){for(let[l,o]of i){var a,n,r;("Action"===o||(null==(a=this.data.actions)?void 0:a[o]))&&(("Focus"===o||"Blur"===o)&&(e||(e={focused:!1})),this._setEventListener(t,e,l,o,s),"Focus"!==o||(null==(n=this.data.actions)?void 0:n.Blur)?"Blur"!==o||(null==(r=this.data.actions)?void 0:r.Focus)||this._setEventListener(t,e,"focus","Focus",null):this._setEventListener(t,e,"blur","Blur",null))}}
1_setBackgroundColor(t){let e=this.data.backgroundColor||null;t.style.backgroundColor=null===e?"transparent":tH.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){let e,{fontColor:i}=this.data.defaultAppearanceData,s=this.data.defaultAppearanceData.fontSize||9,a=t.style,n=t=>Math.round(10*t)/10;if(this.data.multiLine){let t=Math.abs(this.data.rect[3]-this.data.rect[1]-2),i=Math.round(t/(1.35*s))||1;e=Math.min(s,n(t/i/1.35))}else e=Math.min(s,n(Math.abs(this.data.rect[3]-this.data.rect[1]-2)/1.35));a.fontSize="calc(".concat(e,"px * var(--scale-factor))"),a.color=tH.makeHexColor(i[0],i[1],i[2]),null!==this.data.textAlignment&&(a.textAlign=["left","center","right"][this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class lH extends lj{setPropertyOnSiblings(t,e,i,s){let a=this.annotationStorage;for(let n of this._getElementsByName(t.name,t.id))n.domElement&&(n.domElement[e]=i),a.setValue(n.id,{[s]:i})}render(){let t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){var s,a;let n=t.getValue(e,{value:this.data.fieldValue}),r=n.value||"",l=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;l&&r.length>l&&(r=r.slice(0,l));let o=n.formattedValue||(null==(s=this.data.textContent)?void 0:s.join("\n"))||null;o&&this.data.comb&&(o=o.replaceAll(/\s+/g,""));let h={userValue:r,formattedValue:o,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?((i=document.createElement("textarea")).textContent=null!=o?o:r,this.data.doNotScroll&&(i.style.overflowY="hidden")):((i=document.createElement("input")).type="text",i.setAttribute("value",null!=o?o:r),this.data.doNotScroll&&(i.style.overflowX="hidden")),this.data.hasOwnCanvas&&(i.hidden=!0),ly.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=1e3,this._setRequired(i,this.data.required),l&&(i.maxLength=l),i.addEventListener("input",s=>{t.setValue(e,{value:s.target.value}),this.setPropertyOnSiblings(i,"value",s.target.value,"value"),h.formattedValue=null}),i.addEventListener("resetform",t=>{var e;let s=null!=(e=this.data.defaultFieldValue)?e:"";i.value=h.userValue=s,h.formattedValue=null});let d=t=>{let{formattedValue:e}=h;null!=e&&(t.target.value=e),t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",t=>{var e;if(h.focused)return;let{target:i}=t;h.userValue&&(i.value=h.userValue),h.lastCommittedValue=i.value,h.commitKey=1,(null==(e=this.data.actions)?void 0:e.Focus)||(h.focused=!0)}),i.addEventListener("updatefromsandbox",i=>{this.showElementAndHideCanvas(i.target),this._dispatchEventFromSandbox({value(i){var s;h.userValue=null!=(s=i.detail.value)?s:"",t.setValue(e,{value:h.userValue.toString()}),i.target.value=h.userValue},formattedValue(i){let{formattedValue:s}=i.detail;h.formattedValue=s,null!=s&&i.target!==document.activeElement&&(i.target.value=s),t.setValue(e,{formattedValue:s})},selRange(t){t.target.setSelectionRange(...t.detail.selRange)},charLimit:i=>{var s;let{charLimit:a}=i.detail,{target:n}=i;if(0===a)return void n.removeAttribute("maxLength");n.setAttribute("maxLength",a);let r=h.userValue;r&&!(r.length<=a)&&(n.value=h.userValue=r=r.slice(0,a),t.setValue(e,{value:r}),null==(s=this.linkService.eventBus)||s.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:r,willCommit:!0,commitKey:1,selStart:n.selectionStart,selEnd:n.selectionEnd}}))}},i)}),i.addEventListener("keydown",t=>{var i;h.commitKey=1;let s=-1;if("Escape"===t.key?s=0:"Enter"!==t.key||this.data.multiLine?"Tab"===t.key&&(h.commitKey=3):s=2,-1===s)return;let{value:a}=t.target;h.lastCommittedValue!==a&&(h.lastCommittedValue=a,h.userValue=a,null==(i=this.linkService.eventBus)||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:a,willCommit:!0,commitKey:s,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}))});let s=d;d=null,i.addEventListener("blur",t=>{var i,a;if(!h.focused||!t.relatedTarget)return;(null==(i=this.data.actions)?void 0:i.Blur)||(h.focused=!1);let{value:n}=t.target;h.userValue=n,h.lastCommittedValue!==n&&(null==(a=this.linkService.eventBus)||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:n,willCommit:!0,
1commitKey:h.commitKey,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}})),s(t)}),(null==(a=this.data.actions)?void 0:a.Keystroke)&&i.addEventListener("beforeinput",t=>{var i;h.lastCommittedValue=null;let{data:s,target:a}=t,{value:n,selectionStart:r,selectionEnd:l}=a,o=r,d=l;switch(t.inputType){case"deleteWordBackward":{let t=n.substring(0,r).match(/\w*[^\w]*$/);t&&(o-=t[0].length);break}case"deleteWordForward":{let t=n.substring(r).match(/^[^\w]*\w*/);t&&(d+=t[0].length);break}case"deleteContentBackward":r===l&&(o-=1);break;case"deleteContentForward":r===l&&(d+=1)}t.preventDefault(),null==(i=this.linkService.eventBus)||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:n,change:s||"",willCommit:!1,selStart:o,selEnd:d}})}),this._setEventListeners(i,h,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.value)}if(d&&i.addEventListener("blur",d),this.data.comb){let t=(this.data.rect[2]-this.data.rect[0])/l;i.classList.add("comb"),i.style.letterSpacing="calc(".concat(t,"px * var(--scale-factor) - 1ch)")}}else(i=document.createElement("div")).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}constructor(t){super(t,{isRenderable:t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue})}}class lB extends lj{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class lG extends lj{render(){let t=this.annotationStorage,e=this.data,i=e.id,s=t.getValue(i,{value:e.exportValue===e.fieldValue}).value;"string"==typeof s&&(s="Off"!==s,t.setValue(i,{value:s})),this.container.classList.add("buttonWidgetAnnotation","checkBox");let a=document.createElement("input");return ly.add(a),a.setAttribute("data-element-id",i),a.disabled=e.readOnly,this._setRequired(a,this.data.required),a.type="checkbox",a.name=e.fieldName,s&&a.setAttribute("checked",!0),a.setAttribute("exportValue",e.exportValue),a.tabIndex=1e3,a.addEventListener("change",s=>{let{name:a,checked:n}=s.target;for(let s of this._getElementsByName(a,i)){let i=n&&s.exportValue===e.exportValue;s.domElement&&(s.domElement.checked=i),t.setValue(s.id,{value:i})}t.setValue(i,{value:n})}),a.addEventListener("resetform",t=>{let i=e.defaultFieldValue||"Off";t.target.checked=i===e.exportValue}),this.enableScripting&&this.hasJSActions&&(a.addEventListener("updatefromsandbox",e=>{this._dispatchEventFromSandbox({value(e){e.target.checked="Off"!==e.detail.value,t.setValue(i,{value:e.target.checked})}},e)}),this._setEventListeners(a,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)),this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}constructor(t){super(t,{isRenderable:t.renderForms})}}class lz extends lj{render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");let t=this.annotationStorage,e=this.data,i=e.id,s=t.getValue(i,{value:e.fieldValue===e.buttonValue}).value;if("string"==typeof s&&(s=s!==e.buttonValue,t.setValue(i,{value:s})),s)for(let s of this._getElementsByName(e.fieldName,i))t.setValue(s.id,{value:!1});let a=document.createElement("input");if(ly.add(a),a.setAttribute("data-element-id",i),a.disabled=e.readOnly,this._setRequired(a,this.data.required),a.type="radio",a.name=e.fieldName,s&&a.setAttribute("checked",!0),a.tabIndex=1e3,a.addEventListener("change",e=>{let{name:s,checked:a}=e.target;for(let e of this._getElementsByName(s,i))t.setValue(e.id,{value:!1});t.setValue(i,{value:a})}),a.addEventListener("resetform",t=>{let i=e.defaultFieldValue;t.target.checked=null!=i&&i===e.buttonValue}),this.enableScripting&&this.hasJSActions){let s=e.buttonValue;a.addEventListener("updatefromsandbox",e=>{this._dispatchEventFromSandbox({value:e=>{let a=s===e.detail.value;for(let s of this._getElementsByName(e.target.name)){let e=a&&s.id===i;s.domElement&&(s.domElement.checked=e),t.setValue(s.id,{value:e})}}},e)}),this._setEventListeners(a,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)}
1return this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}constructor(t){super(t,{isRenderable:t.renderForms})}}class lU extends lD{render(){let t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");let e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",t=>{this._dispatchEventFromSandbox({},t)})),t}constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}}class lV extends lj{render(){this.container.classList.add("choiceWidgetAnnotation");let t=this.annotationStorage,e=this.data.id,i=t.getValue(e,{value:this.data.fieldValue}),s=document.createElement("select");ly.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,this._setRequired(s,this.data.required),s.name=this.data.fieldName,s.tabIndex=1e3;let a=this.data.combo&&this.data.options.length>0;for(let t of(!this.data.combo&&(s.size=this.data.options.length,this.data.multiSelect&&(s.multiple=!0)),s.addEventListener("resetform",t=>{let e=this.data.defaultFieldValue;for(let t of s.options)t.selected=t.value===e}),this.data.options)){let e=document.createElement("option");e.textContent=t.displayValue,e.value=t.exportValue,i.value.includes(t.exportValue)&&(e.setAttribute("selected",!0),a=!1),s.append(e)}let n=null;if(a){let t=document.createElement("option");t.value=" ",t.setAttribute("hidden",!0),t.setAttribute("selected",!0),s.prepend(t),n=()=>{t.remove(),s.removeEventListener("input",n),n=null},s.addEventListener("input",n)}let r=t=>{let e=t?"value":"textContent",{options:i,multiple:a}=s;return a?Array.prototype.filter.call(i,t=>t.selected).map(t=>t[e]):-1===i.selectedIndex?null:i[i.selectedIndex][e]},l=r(!1),o=t=>{let e=t.target.options;return Array.prototype.map.call(e,t=>({displayValue:t.textContent,exportValue:t.value}))};return this.enableScripting&&this.hasJSActions?(s.addEventListener("updatefromsandbox",i=>{this._dispatchEventFromSandbox({value(i){null==n||n();let a=i.detail.value,o=new Set(Array.isArray(a)?a:[a]);for(let t of s.options)t.selected=o.has(t.value);t.setValue(e,{value:r(!0)}),l=r(!1)},multipleSelection(t){s.multiple=!0},remove(i){let a=s.options,n=i.detail.remove;a[n].selected=!1,s.remove(n),a.length>0&&-1===Array.prototype.findIndex.call(a,t=>t.selected)&&(a[0].selected=!0),t.setValue(e,{value:r(!0),items:o(i)}),l=r(!1)},clear(i){for(;0!==s.length;)s.remove(0);t.setValue(e,{value:null,items:[]}),l=r(!1)},insert(i){let{index:a,displayValue:n,exportValue:h}=i.detail.insert,d=s.children[a],c=document.createElement("option");c.textContent=n,c.value=h,d?d.before(c):s.append(c),t.setValue(e,{value:r(!0),items:o(i)}),l=r(!1)},items(i){let{items:a}=i.detail;for(;0!==s.length;)s.remove(0);for(let t of a){let{displayValue:e,exportValue:i}=t,a=document.createElement("option");a.textContent=e,a.value=i,s.append(a)}s.options.length>0&&(s.options[0].selected=!0),t.setValue(e,{value:r(!0),items:o(i)}),l=r(!1)},indices(i){let s=new Set(i.detail.indices);for(let t of i.target.options)t.selected=s.has(t.index);t.setValue(e,{value:r(!0)}),l=r(!1)},editable(t){t.target.disabled=!t.detail.editable}},i)}),s.addEventListener("input",i=>{var s;let a=r(!0),n=r(!1);t.setValue(e,{value:a}),i.preventDefault(),null==(s=this.linkService.eventBus)||s.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:l,change:n,changeEx:a,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(s,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],t=>t.target.value)):s.addEventListener("input",function(i){t.setValue(e,{value:r(!0)})}),this.data.combo&&this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}constructor(t){super(t,{isRenderable:t.renderForms})}}class lq extends lT{render(){this.container.classList.add("popupAnnotation");let t=this.popup=new oc({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(let 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(t=>"".concat(tq).concat(t)).join(",")),this.container}constructor(t){let{data:e,elements:i}=t;super(t,{isRenderable:lT._hasPopupData(e)}),this.elements=i,this.popup=null}}
1var lK=new WeakMap,lX=new WeakMap,lY=new WeakMap,lQ=new WeakMap,lJ=new WeakMap,lZ=new WeakMap,l$=new WeakMap,l0=new WeakMap,l1=new WeakMap,l2=new WeakMap,l3=new WeakMap,l5=new WeakMap,l6=new WeakMap,l4=new WeakMap,l8=new WeakMap,l7=new WeakMap,l9=new WeakMap,ot=new WeakMap,oe=new WeakMap,oi=new WeakMap,os=new WeakMap,oa=new WeakMap,on=new WeakSet,or=new WeakSet,ol=new WeakSet,oo=new WeakSet,oh=new WeakSet,od=new WeakSet;class oc{render(){if((0,O._)(this,l6))return;let t=(0,N._)(this,l6,document.createElement("div"));if(t.className="popup",(0,O._)(this,lJ)){let e=t.style.outlineColor=tH.makeHexColor(...(0,O._)(this,lJ));CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?t.style.backgroundColor="color-mix(in srgb, ".concat(e," 30%, white)"):t.style.backgroundColor=tH.makeHexColor(...(0,O._)(this,lJ).map(t=>Math.floor(.7*(255-t)+t)))}let e=document.createElement("span");e.className="header";let i=document.createElement("h1");if(e.append(i),{dir:i.dir,str:i.textContent}=(0,O._)(this,l9),t.append(e),(0,O._)(this,l0)){let t=document.createElement("span");t.classList.add("popupDate"),t.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),t.setAttribute("data-l10n-args",JSON.stringify({dateObj:(0,O._)(this,l0).valueOf()})),e.append(t)}let s=(0,O._)(this,oi);if(s)lA.render({xfaHtml:s,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{let e=this._formatContents((0,O._)(this,l$));t.append(e)}(0,O._)(this,lZ).append(t)}_formatContents(t){let{str:e,dir:i}=t,s=document.createElement("p");s.classList.add("popupContent"),s.dir=i;let a=e.split(/(?:\r\n?|\n)/);for(let t=0,e=a.length;t<e;++t){let i=a[t];s.append(document.createTextNode(i)),t<e-1&&s.append(document.createElement("br"))}return s}updateEdited(t){var e;let{rect:i,popupContent:s}=t;(0,N._)(this,ot,(0,O._)(this,ot)||{contentsObj:(0,O._)(this,l$),richText:(0,O._)(this,l7)}),i&&(0,N._)(this,l4,null),s&&((0,N._)(this,l7,(0,H._)(this,on,of).call(this,s)),(0,N._)(this,l$,null)),null==(e=(0,O._)(this,l6))||e.remove(),(0,N._)(this,l6,null)}resetEdited(){var t;(0,O._)(this,ot)&&({contentsObj:(0,V._)(this,l$).value,richText:(0,V._)(this,l7).value}=(0,O._)(this,ot),(0,N._)(this,ot,null),null==(t=(0,O._)(this,l6))||t.remove(),(0,N._)(this,l6,null),(0,N._)(this,l4,null))}forceHide(){(0,N._)(this,oe,this.isVisible),(0,O._)(this,oe)&&((0,O._)(this,lZ).hidden=!0)}maybeShow(){(0,O._)(this,oe)&&((0,O._)(this,l6)||(0,H._)(this,oh,ob).call(this),(0,N._)(this,oe,!1),(0,O._)(this,lZ).hidden=!1)}get isVisible(){return!1===(0,O._)(this,lZ).hidden}constructor({container:t,color:e,elements:i,titleObj:s,modificationDate:a,contentsObj:n,richText:r,parent:l,rect:o,parentRect:h,open:d}){for(let d of((0,W._)(this,oi,{get:ou,set:void 0}),(0,W._)(this,os,{get:o_,set:void 0}),(0,W._)(this,oa,{get:op,set:void 0}),(0,B._)(this,on),(0,B._)(this,or),(0,B._)(this,ol),(0,B._)(this,oo),(0,B._)(this,oh),(0,B._)(this,od),(0,W._)(this,lK,{writable:!0,value:void 0}),(0,W._)(this,lX,{writable:!0,value:void 0}),(0,W._)(this,lY,{writable:!0,value:void 0}),(0,W._)(this,lQ,{writable:!0,value:void 0}),(0,W._)(this,lJ,{writable:!0,value:void 0}),(0,W._)(this,lZ,{writable:!0,value:void 0}),(0,W._)(this,l$,{writable:!0,value:void 0}),(0,W._)(this,l0,{writable:!0,value:void 0}),(0,W._)(this,l1,{writable:!0,value:void 0}),(0,W._)(this,l2,{writable:!0,value:void 0}),(0,W._)(this,l3,{writable:!0,value:void 0}),(0,W._)(this,l5,{writable:!0,value:void 0}),(0,W._)(this,l6,{writable:!0,value:void 0}),(0,W._)(this,l4,{writable:!0,value:void 0}),(0,W._)(this,l8,{writable:!0,value:void 0}),(0,W._)(this,l7,{writable:!0,value:void 0}),(0,W._)(this,l9,{writable:!0,value:void 0}),(0,W._)(this,ot,{writable:!0,value:void 0}),(0,W._)(this,oe,{writable:!0,value:void 0}),(0,N._)(this,lK,(0,H._)(this,or,og).bind(this)),(0,N._)(this,lX,(0,H._)(this,od,ow).bind(this)),(0,N._)(this,lY,(0,H._)(this,oh,ob).bind(this)),(0,N._)(this,lQ,(0,H._)(this,oo,ov).bind(this)),(0,N._)(this,lJ,null),(0,N._)(this,lZ,null),(0,N._)(this,l$,null),(0,N._)(this,l0,null),(0,N._)(this,l1,null),(0,N._)(this,l2,null),(0,N._)(this,l3,null),(0,N._)(this,l5,!1),(0,N._)(this,l6,null),(0,N._)(this,l4,null),(0,N._)(this,l8,null),(0,N._)(this,l7,null),(0,N._)(this,l9,null),(0,N._)(this,ot,null),(0,N._)(this,oe,!1),(0,N._)(this,lZ,t),(0,N._)(this,l9,s),(0,N._)(this,l$,n),(0,N._)(this,l7,r),(0,N._)(this,l2,l),(0,N._)(this,lJ,e),(0,N._)(this,l8,o),(0,N._)(this,l3,h),(0,N._)(this,l1,i),(0,N._)(this,l0,t8.toDateObject(a)),this.trigger=i.flatMap(t=>t.getElementsToTriggerPopup()),this.trigger))d.addEventListener("click",(0,O._)(this,lQ)),d.addEventListener("mouseenter",(0,O._)(this,lY)),d.addEventListener("mouseleave",(0,O._)(this,lX)),d.classList.add("popupTriggerArea");for(let t of i){var c;null==(c=t.container)||c.addEventListener("keydown",(0,O._)(this,lK))}(0,O._)(this,lZ).hidden=!0,d&&(0,H._)(this,oo,ov).call(this)}}function ou(){let t=(0,O._)(this,l7),e=(0,O._)(this,l$);return(null==t?void 0:t.str)&&(!(null==e?void 0:e.str)||e.str===t.str)&&(0,O._)(this,l7).html||null}function o_(){var t,e,i;return(null==(i=(0,O._)(this,oi))||null==(e=i.attributes)||null==(t=e.style)?void 0:t.fontSize)||0}function op(){var t,e,i;return(null==(i=(0,O._)(this,oi))||null==(e=i.attributes)||null==(t=e.style)?void 0:t.color)||null}function of(t){let e=[],i={style:{color:(0,O._)(this,oa),fontSize:(0,O._)(this,os)?"calc(".concat((0,O._)(this,os),"px * var(--scale-factor))"):""}};for(let s of t.split("\n"))e.push({name:"span",value:s,attributes:i});return{str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}}}function og(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||("Enter"===t.key||"Escape"===t.key&&(0,O._)(this,l5))&&(0,H._)(this,oo,ov).call(this)}function om(){if(null!==(0,O._)(this,l4))return;let{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:s,pageY:a}}}=(0,O._)(this,l2),n=!!(0,O._)(this,l3),r=n?(0,O._)(this,l3):(0,O._)(this,l8);for(let t of(0,O._)(this,l1))if(!r||null!==tH.intersect(t.data.rect,r)){r=t.data.rect,n=!0;break}let l=tH.normalizeRect([r[0],t[3]-r[1]+t[1],r[2],t[3]-r[3]+t[1]]),o=n?r[2]-r[0]+5:0,h=l[0]+o,d=l[1];(0,N._)(this,l4,[100*(h-s)/e,100*(d-a)/i]);let{style:c}=(0,O._)(this,lZ);c.left="".concat((0,O._)(this,l4)[0],"%"),c.top="".concat((0,O._)(this,l4)[1],"%")}function ov(){(0,N._)(this,l5,!(0,O._)(this,l5)),(0,O._)(this,l5)?((0,H._)(this,oh,ob).call(this),(0,O._)(this,lZ).addEventListener("click",(0,O._)(this,lQ)),(0,O._)(this,lZ).addEventListener("keydown",(0,O._)(this,lK))):((0,H._)(this,od,ow).call(this),(0,O._)(this,lZ).removeEventListener("click",(0,O._)(this,lQ)),(0,O._)(this,lZ).removeEventListener("keydown",(0,O._)(this,lK)))}function ob(){(0,O._)(this,l6)||this.render(),this.isVisible?(0,O._)(this,l5)&&(0,O._)(this,lZ).classList.add("focused"):((0,H._)(this,ol,om).call(this),(0,O._)(this,lZ).hidden=!1,(0,O._)(this,lZ).style.zIndex=parseInt((0,O._)(this,lZ).style.zIndex)+1e3)}function ow(){(0,O._)(this,lZ).classList.remove("focused"),!(0,O._)(this,l5)&&this.isVisible&&((0,O._)(this,lZ).hidden=!0,(0,O._)(this,lZ).style.zIndex=parseInt((0,O._)(this,lZ).style.zIndex)-1e3)}
1class oA extends lT{render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){let t=document.createElement("div");for(let e of(t.classList.add("annotationTextContent"),t.setAttribute("role","comment"),this.textContent)){let 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}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=td.FREETEXT}}var oy=new WeakMap;class oS extends lT{render(){this.container.classList.add("lineAnnotation");let t=this.data,{width:e,height:i}=lS(t.rect),s=this.svgFactory.create(e,i,!0),a=(0,N._)(this,oy,this.svgFactory.createElement("svg:line"));return a.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),a.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),a.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),a.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),a.setAttribute("stroke-width",t.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),s.append(a),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return(0,O._)(this,oy)}addHighlightArea(){this.container.classList.add("highlightArea")}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,W._)(this,oy,{writable:!0,value:void 0}),(0,N._)(this,oy,null)}}var ox=new WeakMap;class oE extends lT{render(){this.container.classList.add("squareAnnotation");let t=this.data,{width:e,height:i}=lS(t.rect),s=this.svgFactory.create(e,i,!0),a=t.borderStyle.width,n=(0,N._)(this,ox,this.svgFactory.createElement("svg:rect"));return n.setAttribute("x",a/2),n.setAttribute("y",a/2),n.setAttribute("width",e-a),n.setAttribute("height",i-a),n.setAttribute("stroke-width",a||1),n.setAttribute("stroke","transparent"),n.setAttribute("fill","transparent"),s.append(n),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return(0,O._)(this,ox)}addHighlightArea(){this.container.classList.add("highlightArea")}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,W._)(this,ox,{writable:!0,value:void 0}),(0,N._)(this,ox,null)}}var ok=new WeakMap;class oM extends lT{render(){this.container.classList.add("circleAnnotation");let t=this.data,{width:e,height:i}=lS(t.rect),s=this.svgFactory.create(e,i,!0),a=t.borderStyle.width,n=(0,N._)(this,ok,this.svgFactory.createElement("svg:ellipse"));return n.setAttribute("cx",e/2),n.setAttribute("cy",i/2),n.setAttribute("rx",e/2-a/2),n.setAttribute("ry",i/2-a/2),n.setAttribute("stroke-width",a||1),n.setAttribute("stroke","transparent"),n.setAttribute("fill","transparent"),s.append(n),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return(0,O._)(this,ok)}addHighlightArea(){this.container.classList.add("highlightArea")}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,W._)(this,ok,{writable:!0,value:void 0}),(0,N._)(this,ok,null)}}var oC=new WeakMap;class oT extends lT{render(){this.container.classList.add(this.containerClassName);let{data:{rect:t,vertices:e,borderStyle:i,popupRef:s}}=this;if(!e)return this.container;let{width:a,height:n}=lS(t),r=this.svgFactory.create(a,n,!0),l=[];for(let i=0,s=e.length;i<s;i+=2){let s=e[i]-t[0],a=t[3]-e[i+1];l.push("".concat(s,",").concat(a))}l=l.join(" ");let o=(0,N._)(this,oC,this.svgFactory.createElement(this.svgElementName));return o.setAttribute("points",l),o.setAttribute("stroke-width",i.width||1),o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),r.append(o),this.container.append(r),!s&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return(0,O._)(this,oC)}addHighlightArea(){this.container.classList.add("highlightArea")}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,W._)(this,oC,{writable:!0,value:void 0}),(0,N._)(this,oC,null),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}}class oR extends oT{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class oL extends lT{render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}}var oP=new WeakMap;class oI extends lT{render(){this.container.classList.add(this.containerClassName);let{data:{rect:t,inkLists:e,borderStyle:i,popupRef:s}}=this,{width:a,height:n}=lS(t),r=this.svgFactory.create(a,n,!0);for(let s of e){let e=[];for(let i=0,a=s.length;i<a;i+=2){let a=s[i]-t[0],n=t[3]-s[i+1];e.push("".concat(a,",").concat(n))}e=e.join(" ");let a=this.svgFactory.createElement(this.svgElementName);(0,O._)(this,oP).push(a),a.setAttribute("points",e),a.setAttribute("stroke-width",i.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),r.append(a)}return!s&&this.hasPopupData&&this._createPopup(),this.container.append(r),this._editOnDoubleClick(),this.container}getElementsToTriggerPopup(){return(0,O._)(this,oP)}addHighlightArea(){this.container.classList.add("highlightArea")}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,W._)(this,oP,{writable:!0,value:void 0}),(0,N._)(this,oP,[]),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType="InkHighlight"===this.data.it?td.HIGHLIGHT:td.INK}}class oD extends lT{render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),this.container}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=td.HIGHLIGHT}}class oF extends lT{render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}}class oO extends lT{render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}}class oW extends lT{render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("str
1ikeoutAnnotation"),this.container}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}}class oN extends lT{render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=td.STAMP}}var oj=new WeakMap,oH=new WeakSet;class oB extends lT{render(){let t;this.container.classList.add("fileAttachmentAnnotation");let{container:e,data:i}=this;i.hasAppearance||0===i.fillAlpha?t=document.createElement("div"):((t=document.createElement("img")).src="".concat(this.imageResourcesPath,"annotation-").concat(/paperclip/i.test(i.name)?"paperclip":"pushpin",".svg"),i.fillAlpha&&i.fillAlpha<1&&(t.style="filter: opacity(".concat(Math.round(100*i.fillAlpha),"%);"))),t.addEventListener("dblclick",(0,H._)(this,oH,oG).bind(this)),(0,N._)(this,oj,t);let{isMac:s}=tN.platform;return e.addEventListener("keydown",t=>{"Enter"===t.key&&(s?t.metaKey:t.ctrlKey)&&(0,H._)(this,oH,oG).call(this)}),!i.popupRef&&this.hasPopupData?this._createPopup():t.classList.add("popupTriggerArea"),e.append(t),e}getElementsToTriggerPopup(){return(0,O._)(this,oj)}addHighlightArea(){this.container.classList.add("highlightArea")}constructor(t){var e;super(t,{isRenderable:!0}),(0,B._)(this,oH),(0,W._)(this,oj,{writable:!0,value:void 0}),(0,N._)(this,oj,null);let{file:i}=this.data;this.filename=i.filename,this.content=i.content,null==(e=this.linkService.eventBus)||e.dispatch("fileattachmentannotation",{source:this,...i})}}function oG(){var t;null==(t=this.downloadManager)||t.openOrDownloadData(this.content,this.filename)}let oz=(R=new WeakMap,L=new WeakMap,P=new WeakMap,I=new WeakMap,D=new WeakSet,F=new WeakSet,class{hasEditableAnnotations(){return(0,O._)(this,P).size>0}async render(t){let{annotations:e}=t,i=this.div;es(i,this.viewport);let s=new Map,a={data:null,layer:i,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new lw,annotationStorage:t.annotationStorage||new aw,enableScripting:!0===t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(let t of e){if(t.noHTML)continue;let e=t.annotationType===tf.POPUP;if(e){let e=s.get(t.id);if(!e)continue;a.elements=e}else{let{width:e,height:i}=lS(t.rect);if(e<=0||i<=0)continue}a.data=t;let i=lx.create(a);if(!i.isRenderable)continue;if(!e&&t.popupRef){let e=s.get(t.popupRef);e?e.push(i):s.set(t.popupRef,[i])}let r=i.render();if(t.hidden&&(r.style.visibility="hidden"),await (0,H._)(this,D,p6).call(this,r,t.id),i._isEditable){var n;(0,O._)(this,P).set(i.data.id,i),null==(n=this._annotationEditorUIManager)||n.renderAnnotationElement(i)}}(0,H._)(this,F,p4).call(this)}update(t){let{viewport:e}=t,i=this.div;this.viewport=e,es(i,{rotation:e.rotation}),(0,H._)(this,F,p4).call(this),i.hidden=!1}getEditableAnnotations(){return Array.from((0,O._)(this,P).values())}getEditableAnnotation(t){return(0,O._)(this,P).get(t)}constructor({div:t,accessibilityManager:e,annotationCanvasMap:i,annotationEditorUIManager:s,page:a,viewport:n,structTreeLayer:r}){(0,B._)(this,D),(0,B._)(this,F),(0,W._)(this,R,{writable:!0,value:void 0}),(0,W._)(this,L,{writable:!0,value:void 0}),(0,W._)(this,P,{writable:!0,value:void 0}),(0,W._)(this,I,{writable:!0,value:void 0}),(0,N._)(this,R,null),(0,N._)(this,L,null),(0,N._)(this,P,new Map),(0,N._)(this,I,null),this.div=t,(0,N._)(this,R,e),(0,N._)(this,L,i),(0,N._)(this,I,r||null),this.page=a,this.viewport=n,this.zIndex=0,this._annotationEditorUIManager=s}}),oU=/\r\n?|\n/g;var oV=new WeakMap,oq=new WeakMap,oK=new WeakMap,oX=new WeakMap,oY=new WeakMap,oQ=new WeakSet,oJ=new WeakSet,oZ=new WeakSet,o$=new WeakSet,o0=new WeakSet,o1=new WeakSet,o2=new WeakSet;class o3 extends s8{static get _keyboardManager(){let t=o3.prototype,e=t=>t.isEmpty(),i=iJ.TRANSLATE_SMALL,s=iJ.TRANSLATE_BIG;return tk(this,"_keyboardManager",new eX([[["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:[-s,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[s,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-s],checker:e}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,s],checker:e}]]))}static initialize(t,e){s8.initialize(t,e);let i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}
1static updateDefaultParams(t,e){switch(t){case tc.FREETEXT_SIZE:o3._defaultFontSize=e;break;case tc.FREETEXT_COLOR:o3._defaultColor=e}}updateParams(t,e){switch(t){case tc.FREETEXT_SIZE:(0,H._)(this,oQ,o5).call(this,e);break;case tc.FREETEXT_COLOR:(0,H._)(this,oJ,o6).call(this,e)}}static get defaultPropertiesToUpdate(){return[[tc.FREETEXT_SIZE,o3._defaultFontSize],[tc.FREETEXT_COLOR,o3._defaultColor||s8._defaultLineColor]]}get propertiesToUpdate(){return[[tc.FREETEXT_SIZE,(0,O._)(this,oY)],[tc.FREETEXT_COLOR,(0,O._)(this,oV)]]}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){let t=this.parentScale;return[-o3._internalPadding*t,-(o3._internalPadding+(0,O._)(this,oY))*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(td.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),(0,N._)(this,oX,new AbortController);let t=this._uiManager.combinedSignal((0,O._)(this,oX));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(){var t;this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",(0,O._)(this,oK)),this._isDraggable=!0,null==(t=(0,O._)(this,oX))||t.abort(),(0,N._)(this,oX,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(){var t;this.width||(this.enableEditMode(),this.editorDiv.focus(),(null==(t=this._initialOptions)?void 0:t.isCentered)&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();let t=(0,O._)(this,oq),e=(0,N._)(this,oq,(0,H._)(this,oZ,o4).call(this).trimEnd());if(t===e)return;let i=t=>{if((0,N._)(this,oq,t),!t)return void this.remove();(0,H._)(this,o0,o9).call(this),this._uiManager.rebuild(this),(0,H._)(this,o$,o8).call(this)};this.addCommands({cmd:()=>{i(e)},undo:()=>{i(t)},mustExec:!1}),(0,H._)(this,o$,o8).call(this)}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){o3._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(){let t,e;if(this.div)return this.div;this.width&&(t=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",(0,O._)(this,oK)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;let{style:i}=this.editorDiv;if(i.fontSize="calc(".concat((0,O._)(this,oY),"px * var(--scale-factor))"),i.color=(0,O._)(this,oV),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),eI(this,this.div,["dblclick","keydown"]),this.width){let[i,s]=this.parentDimensions;
1if(this.annotationElementId){let a,n,{position:r}=this._initialData,[l,o]=this.getInitialTranslation();[l,o]=this.pageTranslationToScreen(l,o);let[h,d]=this.pageDimensions,[c,u]=this.pageTranslation;switch(this.rotation){case 0:a=t+(r[0]-c)/h,n=e+this.height-(r[1]-u)/d;break;case 90:a=t+(r[0]-c)/h,n=e-(r[1]-u)/d,[l,o]=[o,-l];break;case 180:a=t-this.width+(r[0]-c)/h,n=e-(r[1]-u)/d,[l,o]=[-l,-o];break;case 270:a=t+(r[0]-c-this.height*d)/h,n=e+(r[1]-u-this.width*h)/d,[l,o]=[-o,l]}this.setAt(a*i,n*s,l,o)}else this.setAt(t*i,e*s,this.width*i,this.height*s);(0,H._)(this,o0,o9).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(t){let e=t.clipboardData||window.clipboardData,{types:i}=e;if(1===i.length&&"text/plain"===i[0])return;t.preventDefault();let s=(0,q._)(o3,o3,he).call(o3,e.getData("text")||"").replaceAll(oU,"\n");if(!s)return;let a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();let n=a.getRangeAt(0);if(!s.includes("\n")){n.insertNode(document.createTextNode(s)),this.editorDiv.normalize(),a.collapseToStart();return}let{startContainer:r,startOffset:l}=n,o=[],h=[];if(r.nodeType===Node.TEXT_NODE){let t=r.parentElement;if(h.push(r.nodeValue.slice(l).replaceAll(oU,"")),t!==this.editorDiv){let e=o;for(let i of this.editorDiv.childNodes){if(i===t){e=h;continue}e.push((0,q._)(o3,o3,o7).call(o3,i))}}o.push(r.nodeValue.slice(0,l).replaceAll(oU,""))}else if(r===this.editorDiv){let t=o,e=0;for(let i of this.editorDiv.childNodes)e++===l&&(t=h),t.push((0,q._)(o3,o3,o7).call(o3,i))}(0,N._)(this,oq,"".concat(o.join("\n")).concat(s).concat(h.join("\n"))),(0,H._)(this,o0,o9).call(this);let d=new Range,c=o.reduce((t,e)=>t+e.length,0);for(let{firstChild:t}of this.editorDiv.childNodes)if(t.nodeType===Node.TEXT_NODE){let e=t.nodeValue.length;if(c<=e){d.setStart(t,c),d.setEnd(t,c);break}c-=e}a.removeAllRanges(),a.addRange(d)}get contentDiv(){return this.editorDiv}static async deserialize(t,e,i){let s=null;if(t instanceof oA){let{data:{defaultAppearanceData:{fontSize:e,fontColor:i},rect:a,rotation:n,id:r,popupRef:l},textContent:o,textPosition:h,parent:{page:{pageNumber:d}}}=t;if(!o||0===o.length)return null;s=t={annotationType:td.FREETEXT,color:Array.from(i),fontSize:e,value:o.join("\n"),position:h,pageIndex:d-1,rect:a.slice(0),rotation:n,id:r,deleted:!1,popupRef:l}}let a=await super.deserialize(t,e,i);return(0,N._)(a,oY,t.fontSize),(0,N._)(a,oV,tH.makeHexColor(...t.color)),(0,N._)(a,oq,(0,q._)(o3,o3,he).call(o3,t.value)),a.annotationElementId=t.id||null,a._initialData=s,a}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let e=o3._internalPadding*this.parentScale,i=this.getRect(e,e),s=s8._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:(0,O._)(this,oV)),a={annotationType:td.FREETEXT,color:s,fontSize:(0,O._)(this,oY),value:(0,H._)(this,o1,ht).call(this),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?a:this.annotationElementId&&!(0,H._)(this,o2,hi).call(this,a)?null:(a.id=this.annotationElementId,a)}renderAnnotationElement(t){let e=super.renderAnnotationElement(t);if(this.deleted)return e;let{style:i}=e;for(let t of(i.fontSize="calc(".concat((0,O._)(this,oY),"px * var(--scale-factor))"),i.color=(0,O._)(this,oV),e.replaceChildren(),(0,O._)(this,oq).split("\n"))){let i=document.createElement("div");i.append(t?document.createTextNode(t):document.createElement("br")),e.append(i)}let s=o3._internalPadding*this.parentScale;return t.updateEdited({rect:this.getRect(s,s),popupContent:(0,O._)(this,oq)}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}constructor(t){super({...t,name:"freeTextEditor"}),(0,B._)(this,oQ),(0,B._)(this,oJ),(0,B._)(this,oZ),(0,B._)(this,o$),(0,B._)(this,o0),(0,B._)(this,o1),(0,B._)(this,o2),(0,W._)(this,oV,{writable:!0,value:void 0}),(0,W._)(this,oq,{writable:!0,value:void 0}),(0,W._)(this,oK,{writable:!0,value:void 0}),(0,W._)(this,oX,{writable:!0,value:void 0}),(0,W._)(this,oY,{writable:!0,value:void 0}),(0,N._)(this,oq,""),(0,N._)(this,oK,"".concat(this.id,"-editor")),(0,N._)(this,oX,null),(0,N._)(this,oV,t.color||o3._defaultColor||s8._defaultLineColor),(0,N._)(this,oY,t.fontSize||o3._defaultFontSize)}}function o5(t){let e=t=>{this.editorDiv.style.fontSize="calc(".concat(t,"px * var(--scale-factor))"),this.translate(0,-(t-(0,O._)(this,oY))*this.parentScale),(0,N._)(this,oY,t),(0,H._)(this,o$,o8).call(this)},i=(0,O._)(this,oY);this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:tc.FREETEXT_S
1IZE,overwriteIfSameType:!0,keepUndo:!0})}function o6(t){let e=t=>{(0,N._)(this,oV,this.editorDiv.style.color=t)},i=(0,O._)(this,oV);this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:tc.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function o4(){let t=[];this.editorDiv.normalize();let e=null;for(let i of this.editorDiv.childNodes)((null==e?void 0:e.nodeType)!==Node.TEXT_NODE||"BR"!==i.nodeName)&&(t.push((0,q._)(o3,o3,o7).call(o3,i)),e=i);return t.join("\n")}function o8(){let t,[e,i]=this.parentDimensions;if(this.isAttachedToDOM)t=this.div.getBoundingClientRect();else{let{currentLayer:e,div:i}=this,s=i.style.display,a=i.classList.contains("hidden");i.classList.remove("hidden"),i.style.display="hidden",e.div.append(this.div),t=i.getBoundingClientRect(),i.remove(),i.style.display=s,i.classList.toggle("hidden",a)}this.rotation%180==this.parentRotation%180?(this.width=t.width/e,this.height=t.height/i):(this.width=t.height/e,this.height=t.width/i),this.fixAndSetPosition()}function o7(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(oU,"")}function o9(){if(this.editorDiv.replaceChildren(),(0,O._)(this,oq))for(let t of(0,O._)(this,oq).split("\n")){let e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}function ht(){return(0,O._)(this,oq).replaceAll("\xa0"," ")}function he(t){return t.replaceAll(" ","\xa0")}function hi(t){let{value:e,fontSize:i,color:s,pageIndex:a}=this._initialData;return this._hasBeenMoved||t.value!==e||t.fontSize!==i||t.color.some((t,e)=>t!==s[e])||t.pageIndex!==a}o3._freeTextDefaultContent="",o3._internalPadding=0,o3._defaultColor=null,o3._defaultFontSize=10,o3._type="freetext",o3._editorType=td.FREETEXT;class hs{toSVGPath(){tS("Abstract method `toSVGPath` must be implemented.")}get box(){tS("Abstract getter `box` must be implemented.")}serialize(t,e){tS("Abstract method `serialize` must be implemented.")}get classNamesForDrawing(){tS("Abstract getter `classNamesForDrawing` must be implemented.")}get classNamesForOutlining(){tS("Abstract getter `classNamesForOutlining` must be implemented.")}get mustRemoveSelfIntersections(){return!1}}var ha=new WeakMap,hn=new WeakMap,hr=new WeakMap,hl=new WeakMap,ho=new WeakMap,hh=new WeakMap,hd=new WeakMap,hc=new WeakMap,hu=new WeakMap,h_=new WeakMap,hp=new WeakMap,hf=new WeakMap,hg=new WeakMap,hm=new WeakSet,hv=new WeakSet,hb=new WeakSet,hw=new WeakSet,hA=new WeakSet,hy=new WeakSet,hS=new WeakSet;class hx{isEmpty(){return isNaN((0,O._)(this,hh)[8])}add(t){var e;let{x:i,y:s}=t;(0,N._)(this,hd,i),(0,N._)(this,hc,s);let[a,n,r,l]=(0,O._)(this,ha),[o,h,d,c]=(0,O._)(this,hh).subarray(8,12),u=i-d,_=s-c,p=Math.hypot(u,_);if(p<(0,O._)(this,hu))return!1;let f=p-(0,O._)(this,h_),g=f/p,m=g*u,v=g*_,b=o,w=h;o=d,h=c,d+=m,c+=v,null==(e=(0,O._)(this,hg))||e.push(i,s);let A=-v/f*(0,O._)(this,hf),y=m/f*(0,O._)(this,hf);return((0,O._)(this,hh).set((0,O._)(this,hh).subarray(2,8),0),(0,O._)(this,hh).set([d+A,c+y],4),(0,O._)(this,hh).set((0,O._)(this,hh).subarray(14,18),12),(0,O._)(this,hh).set([d-A,c-y],16),isNaN((0,O._)(this,hh)[6]))?(0===(0,O._)(this,ho).length&&((0,O._)(this,hh).set([o+A,h+y],2),(0,O._)(this,ho).push(NaN,NaN,NaN,NaN,(o+A-a)/r,(h+y-n)/l),(0,O._)(this,hh).set([o-A,h-y],14),(0,O._)(this,hn).push(NaN,NaN,NaN,NaN,(o-A-a)/r,(h-y-n)/l)),(0,O._)(this,hh).set([b,w,o,h,d,c],6),!this.isEmpty()):(((0,O._)(this,hh).set([b,w,o,h,d,c],6),Math.abs(Math.atan2(w-h,b-o)-Math.atan2(v,m))<Math.PI/2)?([o,h,d,c]=(0,O._)(this,hh).subarray(2,6),(0,O._)(this,ho).push(NaN,NaN,NaN,NaN,((o+d)/2-a)/r,((h+c)/2-n)/l),[o,h,b,w]=(0,O._)(this,hh).subarray(14,18),(0,O._)(this,hn).push(NaN,NaN,NaN,NaN,((b+o)/2-a)/r,((w+h)/2-n)/l)):([b,w,o,h,d,c]=(0,O._)(this,hh).subarray(0,6),(0,O._)(this,ho).push(((b+5*o)/6-a)/r,((w+5*h)/6-n)/l,((5*o+d)/6-a)/r,((5*h+c)/6-n)/l,((o+d)/2-a)/r,((h+c)/2-n)/l),[d,c,o,h,b,w]=(0,O._)(this,hh).subarray(12,18),(0,O._)(this,hn).push(((b+5*o)/6-a)/r,((w+5*h)/6-n)/l,((5*o+d)/6-a)/r,((5*h+c)/6-n)/l,((o+d)/2-a)
1/r,((h+c)/2-n)/l)),!0)}toSVGPath(){if(this.isEmpty())return"";let t=(0,O._)(this,ho),e=(0,O._)(this,hn);if(isNaN((0,O._)(this,hh)[6])&&!this.isEmpty())return(0,H._)(this,hv,hC).call(this);let i=[];i.push("M".concat(t[4]," ").concat(t[5]));for(let e=6;e<t.length;e+=6)isNaN(t[e])?i.push("L".concat(t[e+4]," ").concat(t[e+5])):i.push("C".concat(t[e]," ").concat(t[e+1]," ").concat(t[e+2]," ").concat(t[e+3]," ").concat(t[e+4]," ").concat(t[e+5]));(0,H._)(this,hw,hR).call(this,i);for(let t=e.length-6;t>=6;t-=6)isNaN(e[t])?i.push("L".concat(e[t+4]," ").concat(e[t+5])):i.push("C".concat(e[t]," ").concat(e[t+1]," ").concat(e[t+2]," ").concat(e[t+3]," ").concat(e[t+4]," ").concat(e[t+5]));return(0,H._)(this,hb,hT).call(this,i),i.join(" ")}newFreeDrawOutline(t,e,i,s,a,n){return new hU(t,e,i,s,a,n)}getOutlines(){var t,e;let i=(0,O._)(this,ho),s=(0,O._)(this,hn),a=(0,O._)(this,hh),[n,r,l,o]=(0,O._)(this,ha),h=new Float64Array((null!=(e=null==(t=(0,O._)(this,hg))?void 0:t.length)?e:0)+2);for(let t=0,e=h.length-2;t<e;t+=2)h[t]=((0,O._)(this,hg)[t]-n)/l,h[t+1]=((0,O._)(this,hg)[t+1]-r)/o;if(h[h.length-2]=((0,O._)(this,hd)-n)/l,h[h.length-1]=((0,O._)(this,hc)-r)/o,isNaN(a[6])&&!this.isEmpty())return(0,H._)(this,hA,hL).call(this,h);let d=new Float64Array((0,O._)(this,ho).length+24+(0,O._)(this,hn).length),c=i.length;for(let t=0;t<c;t+=2){if(isNaN(i[t])){d[t]=d[t+1]=NaN;continue}d[t]=i[t],d[t+1]=i[t+1]}c=(0,H._)(this,hS,hI).call(this,d,c);for(let t=s.length-6;t>=6;t-=6)for(let e=0;e<6;e+=2){if(isNaN(s[t+e])){d[c]=d[c+1]=NaN,c+=2;continue}d[c]=s[t+e],d[c+1]=s[t+e+1],c+=2}return(0,H._)(this,hy,hP).call(this,d,c),this.newFreeDrawOutline(d,h,(0,O._)(this,ha),(0,O._)(this,hp),(0,O._)(this,hr),(0,O._)(this,hl))}constructor({x:t,y:e},i,s,a,n,r=0){(0,B._)(this,hm),(0,B._)(this,hv),(0,B._)(this,hb),(0,B._)(this,hw),(0,B._)(this,hA),(0,B._)(this,hy),(0,B._)(this,hS),(0,W._)(this,ha,{writable:!0,value:void 0}),(0,W._)(this,hn,{writable:!0,value:void 0}),(0,W._)(this,hr,{writable:!0,value:void 0}),(0,W._)(this,hl,{writable:!0,value:void 0}),(0,W._)(this,ho,{writable:!0,value:void 0}),(0,W._)(this,hh,{writable:!0,value:void 0}),(0,W._)(this,hd,{writable:!0,value:void 0}),(0,W._)(this,hc,{writable:!0,value:void 0}),(0,W._)(this,hu,{writable:!0,value:void 0}),(0,W._)(this,h_,{writable:!0,value:void 0}),(0,W._)(this,hp,{writable:!0,value:void 0}),(0,W._)(this,hf,{writable:!0,value:void 0}),(0,W._)(this,hg,{writable:!0,value:void 0}),(0,N._)(this,hn,[]),(0,N._)(this,ho,[]),(0,N._)(this,hh,new Float64Array(18)),(0,N._)(this,hg,[]),(0,N._)(this,ha,i),(0,N._)(this,hf,a*s),(0,N._)(this,hl,n),(0,O._)(this,hh).set([NaN,NaN,NaN,NaN,t,e],6),(0,N._)(this,hr,r),(0,N._)(this,h_,(0,G._)(hx,hx,hE)*s),(0,N._)(this,hu,(0,G._)(hx,hx,hk)*s),(0,N._)(this,hp,s),(0,O._)(this,hg).push(t,e)}}var hE={writable:!0,value:8},hk={writable:!0,value:(0,G._)(hx,hx,hE)+(0,G._)(hx,hx,{writable:!0,value:2})};function hM(){let t=(0,O._)(this,hh).subarray(4,6),e=(0,O._)(this,hh).subarray(16,18),[i,s,a,n]=(0,O._)(this,ha);return[((0,O._)(this,hd)+(t[0]-e[0])/2-i)/a,((0,O._)(this,hc)+(t[1]-e[1])/2-s)/n,((0,O._)(this,hd)+(e[0]-t[0])/2-i)/a,((0,O._)(this,hc)+(e[1]-t[1])/2-s)/n]}function hC(){let[t,e,i,s]=(0,O._)(this,ha),[a,n,r,l]=(0,H._)(this,hm,hM).call(this);return"M".concat(((0,O._)(this,hh)[2]-t)/i," ").concat(((0,O._)(this,hh)[3]-e)/s," L").concat(((0,O._)(this,hh)[4]-t)/i," ").concat(((0,O._)(this,hh)[5]-e)/s," L").concat(a," ").concat(n," L").concat(r," ").concat(l," L").concat(((0,O._)(this,hh)[16]-t)/i," ").concat(((0,O._)(this,hh)[17]-e)/s," L").concat(((0,O._)(this,hh)[14]-t)/i," ").concat(((0,O._)(this,hh)[15]-e)/s," Z")}function hT(t){let e=(0,O._)(this,hn);t.push("L".concat(e[4]," ").concat(e[5]," Z"))}function hR(t){let[e,i,s,a]=(0,O._)(this,ha),n=(0,O._)(this,hh).subarray(4,6),r=(0,O._)(this,hh).subarray(16,18),[l,o,h,d]=(0,H._)(this,hm,hM).call(this);t.push("L".concat((n[0]-e)/s," ").concat((n[1]-i)/a," L").concat(l," ").concat(o," L").concat(h," ").concat(d," L").concat((r[0]-e)/s," ").concat((r[1]-i)/a))}function hL(t){let e=(0,O._)(this,hh),[i,s,a,n]=(0,O._)(this,ha),[r,l,o,h]=(0,H._)(this,hm,hM).call(this),d=new Float64Array(36);return d.set([NaN,NaN,NaN,NaN,(e[2]-i)/a,(e[3]-s)/n,NaN,NaN,NaN,NaN,(e[4]-i)/a,(e[5]-s)/n,NaN,NaN,NaN,NaN,r,l,NaN,NaN,NaN,NaN,o,h,NaN,NaN,NaN,NaN,(e[16]-i)/a,(e[17]-s)/n,NaN,NaN,NaN,NaN,(e[14]-i)/a,(e[15]-s)/n],0),this.newFreeDrawOutline(d,t,(0,O._)(this,ha),(0,O._)(this,hp),(0,O._)(this,hr),(0,O._)(this,hl))}function hP(t,e){let i=(0,O._)(this,hn);return t.set([NaN,NaN,NaN,NaN,i[4],i[5]],e),e+6}function hI(t,e){let i=(0,O._)(this,hh).subarray(4,6),s=(0,O._)(this,hh).subarray(16,18),[a,n,r,l]=(0,O._)(this,ha),[o,h,d,c]=(0,H._)(this,hm,hM).call(this);return t.set([NaN,NaN,NaN,NaN,(i[0]-a)/r,(i[1]-n)/l,NaN,NaN,NaN,NaN,o,h,NaN,NaN,NaN,NaN,d,c,NaN,NaN,NaN,NaN,(s[0]-a)/r,(s[1]-n)/l],e),e+24}var hD=new WeakMap,hF=new WeakMap,hO=new WeakMap,hW=new WeakMap,hN=new WeakMap,hj=new WeakMap,hH=new WeakMap,hB=new WeakSet,hG=new WeakSet,hz=new WeakSet;class hU extends hs{toSVGPath(){let t=["M".concat((0,O._)(this,hH)[4]," ").concat((0,O._)(this,hH)[5])];for(let e=6,i=(0,O._)(this,hH).length;e<i;e+=6){if(isNaN((0,O._)(this,hH)[e])){t.push("L".concat((0,O._)(this,hH)[e+4]," ").concat((0,O._)(this,hH)[e+5]));continue}t.push("C".concat((0,O._)(this,hH)[e]," ").concat((0,O._)(this,hH)[e+1]," ").concat((0,O._)(this,hH)[e+2]," ").concat((0,O._)(this,hH)[e+3]," ").concat((0,O._)(this,hH)[e+4]," ").concat((0,O._)(this,hH)[e+5]))}return t.push("Z"),t.join(" ")}serialize(t,e){let i,s,[a,n,r,l]=t,o=r-a,h=l-n;switch(e){case 0:i=(0,H._)(this,hB,hV).call(this,(0,O._)(this,hH),a,l,o,-h),s=(0,H._)(this,hB,hV).call(this,(0,O._)(this,hN),a,l,o,-h);break;case 90:i=(0,H._)(this,hG,hq).call(this,(0,O._)(this,hH),a,n,o,h),s=(0,H._)(this,hG,hq).call(this,(0,O._)(this,hN),a,n,o,h);break;case 180:i=(0,H._)(this,hB,hV).call(this,(0,O._)(this,hH),r,n,-o,h),s=(0,H._)(this,hB,hV).call(this,(0,O._)(this,hN),r,n,-o,h);break;case 270:i=(0,H._)(this,hG,hq).call(this,(0,O._)(this,hH),r,l,-o,-h),s=(0,H._)(this,hG,hq).call(this,(0,O._)(this,hN),r,l,-o,-h)}return{outline:Array.from(i),points:[Array.from(s)]}}get box(){return(0,O._)(this,hF)}newOutliner(t,e,i,s,a){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;return new hx(t,e,i,s,a,n)}getNewOutline(t,e){let{x:i,y:s,width:a,height:n}=(0,O._)(this,hF),[r,l,o,h]=(0,O._)(this,hD),d=a*o,c=n*h,u=i*o+r,_=s*h+l,p=this.newOutliner({x:(0,O._)(this,hN)[0]
1*d+u,y:(0,O._)(this,hN)[1]*c+_},(0,O._)(this,hD),(0,O._)(this,hj),t,(0,O._)(this,hW),null!=e?e:(0,O._)(this,hO));for(let t=2;t<(0,O._)(this,hN).length;t+=2)p.add({x:(0,O._)(this,hN)[t]*d+u,y:(0,O._)(this,hN)[t+1]*c+_});return p.getOutlines()}get mustRemoveSelfIntersections(){return!0}constructor(t,e,i,s,a,n){super(),(0,B._)(this,hB),(0,B._)(this,hG),(0,B._)(this,hz),(0,W._)(this,hD,{writable:!0,value:void 0}),(0,W._)(this,hF,{writable:!0,value:void 0}),(0,W._)(this,hO,{writable:!0,value:void 0}),(0,W._)(this,hW,{writable:!0,value:void 0}),(0,W._)(this,hN,{writable:!0,value:void 0}),(0,W._)(this,hj,{writable:!0,value:void 0}),(0,W._)(this,hH,{writable:!0,value:void 0}),(0,N._)(this,hF,null),(0,N._)(this,hH,t),(0,N._)(this,hN,e),(0,N._)(this,hD,i),(0,N._)(this,hj,s),(0,N._)(this,hO,a),(0,N._)(this,hW,n),(0,H._)(this,hz,hK).call(this,n);let{x:r,y:l,width:o,height:h}=(0,O._)(this,hF);for(let e=0,i=t.length;e<i;e+=2)t[e]=(t[e]-r)/o,t[e+1]=(t[e+1]-l)/h;for(let t=0,i=e.length;t<i;t+=2)e[t]=(e[t]-r)/o,e[t+1]=(e[t+1]-l)/h}}function hV(t,e,i,s,a){let n=new Float64Array(t.length);for(let r=0,l=t.length;r<l;r+=2)n[r]=e+t[r]*s,n[r+1]=i+t[r+1]*a;return n}function hq(t,e,i,s,a){let n=new Float64Array(t.length);for(let r=0,l=t.length;r<l;r+=2)n[r]=e+t[r+1]*s,n[r+1]=i+t[r]*a;return n}function hK(t){let e=(0,O._)(this,hH),i=e[4],s=e[5],a=i,n=s,r=i,l=s,o=i,h=s,d=t?Math.max:Math.min;for(let t=6,c=e.length;t<c;t+=6){if(isNaN(e[t]))a=Math.min(a,e[t+4]),n=Math.min(n,e[t+5]),r=Math.max(r,e[t+4]),l=Math.max(l,e[t+5]),h<e[t+5]?(o=e[t+4],h=e[t+5]):h===e[t+5]&&(o=d(o,e[t+4]));else{let c=tH.bezierBoundingBox(i,s,...e.slice(t,t+6));a=Math.min(a,c[0]),n=Math.min(n,c[1]),r=Math.max(r,c[2]),l=Math.max(l,c[3]),h<c[3]?(o=c[2],h=c[3]):h===c[3]&&(o=d(o,c[2]))}i=e[t+4],s=e[t+5]}let c=a-(0,O._)(this,hO),u=n-(0,O._)(this,hO),_=r-a+2*(0,O._)(this,hO),p=l-n+2*(0,O._)(this,hO);(0,N._)(this,hF,{x:c,y:u,width:_,height:p,lastPoint:[o,h]})}var hX=new WeakMap,hY=new WeakMap,hQ=new WeakMap,hJ=new WeakSet,hZ=new WeakSet,h$=new WeakSet,h0=new WeakSet,h1=new WeakSet;class h2{getOutlines(){(0,O._)(this,hY).sort((t,e)=>t[0]-e[0]||t[1]-e[1]||t[2]-e[2]);let t=[];for(let e of(0,O._)(this,hY))e[3]?(t.push(...(0,H._)(this,h1,h8).call(this,e)),(0,H._)(this,h$,h6).call(this,e)):((0,H._)(this,h0,h4).call(this,e),t.push(...(0,H._)(this,h1,h8).call(this,e)));return(0,H._)(this,hJ,h3).call(this,t)}constructor(t,e=0,i=0,s=!0){(0,B._)(this,hJ),(0,B._)(this,hZ),(0,B._)(this,h$),(0,B._)(this,h0),(0,B._)(this,h1),(0,W._)(this,hX,{writable:!0,value:void 0}),(0,W._)(this,hY,{writable:!0,value:void 0}),(0,W._)(this,hQ,{writable:!0,value:void 0}),(0,N._)(this,hY,[]),(0,N._)(this,hQ,[]);let a=1/0,n=-1/0,r=1/0,l=-1/0;for(let{x:i,y:s,width:o,height:h}of t){let t=1e-4*Math.floor((i-e)/1e-4),d=1e-4*Math.ceil((i+o+e)/1e-4),c=1e-4*Math.floor((s-e)/1e-4),u=1e-4*Math.ceil((s+h+e)/1e-4),_=[t,c,u,!0],p=[d,c,u,!1];(0,O._)(this,hY).push(_,p),a=Math.min(a,t),n=Math.max(n,d),r=Math.min(r,c),l=Math.max(l,u)}let o=n-a+2*i,h=l-r+2*i,d=a-i,c=r-i,u=(0,O._)(this,hY).at(s?-1:-2),_=[u[0],u[2]];for(let t of(0,O._)(this,hY)){let[e,i,s]=t;t[0]=(e-d)/o,t[1]=(i-c)/h,t[2]=(s-c)/h}(0,N._)(this,hX,{x:d,y:c,width:o,height:h,lastPoint:_})}}function h3(t){let e,i=[],s=new Set;for(let e of t){let[t,s,a]=e;i.push([t,s,e],[t,a,e])}i.sort((t,e)=>t[1]-e[1]||t[0]-e[0]);for(let t=0,e=i.length;t<e;t+=2){let e=i[t][2],a=i[t+1][2];e.push(a),a.push(e),s.add(e),s.add(a)}let a=[];for(;s.size>0;){let t=s.values().next().value,[i,n,r,l,o]=t;s.delete(t);let h=i,d=n;for(e=[i,r],a.push(e);;){let t;if(s.has(l))t=l;else if(s.has(o))t=o;else break;s.delete(t),[i,n,r,l,o]=t,h!==i&&(e.push(h,d,i,d===n?n:r),h=i),d=d===n?r:n}e.push(h,d)}return new dt(a,(0,O._)(this,hX))}function h5(t){let e=(0,O._)(this,hQ),i=0,s=e.length-1;for(;i<=s;){let a=i+s>>1,n=e[a][0];if(n===t)return a;n<t?i=a+1:s=a-1}return s+1}function h6(t){let[,e,i]=t,s=(0,H._)(this,hZ,h5).call(this,e);(0,O._)(this,hQ).splice(s,0,[e,i])}function h4(t){let[,e,i]=t,s=(0,H._)(this,hZ,h5).call(this,e);for(let t=s;t<(0,O._)(this,hQ).length;t++){let[s,a]=(0,O._)(this,hQ)[t];if(s!==e)break;if(s===e&&a===i)return void(0,O._)(this,hQ).splice(t,1)}for(let t=s-1;t>=0;t--){let[s,a]=(0,O._)(this,hQ)[t];if(s!==e)break;if(s===e&&a===i)return void(0,O._)(this,hQ).splice(t,1)}}function h8(t){let[e,i,s]=t,a=[[e,i,s]],n=(0,H._)(this,hZ,h5).call(this,s);for(let t=0;t<n;t++){let[i,s]=(0,O._)(this,hQ)[t];for(let t=0,n=a.length;t<n;t++){let[,r,l]=a[t];if(!(s<=r)&&!(l<=i)){if(r>=i){if(l>s)a[t][1]=s;else{if(1===n)return[];a.splice(t,1),t--,n--}continue}a[t][2]=i,l>s&&a.push([e,s,l])}}}return a}var h7=new WeakMap,h9=new WeakMap;class dt extends hs{toSVGPath(){let t=[];for(let e of(0,O._)(this,h9)){let[i,s]=e;t.push("M".concat(i," ").concat(s));for(let a=2;a<e.length;a+=2){let n=e[a],r=e[a+1];n===i?(t.push("V".concat(r)),s=r):r===s&&(t.push("H".concat(n)),i=n)}t.push("Z")}return t.join(" ")}serialize(t,e){let[i,s,a,n]=t,r=[],l=a-i,o=n-s;for(let t of(0,O._)(this,h9)){let e=Array(t.length);for(let s=0;s<t.length;s+=2)e[s]=i+t[s]*l,e[s+1]=n-t[s+1]*o;r.push(e)}return r}get box(){return(0,O._)(this,h7)}get classNamesForDrawing(){return["highlight"]}get classNamesForOutlining(){return["highlightOutline"]}constructor(t,e){super(),(0,W._)(this,h7,{writable:!0,value:void 0}),(0,W._)(this,h9,{writable:!0,value:void 0}),(0,N._)(this,h9,t),(0,N._)(this,h7,e)}}class de extends hx{newFreeDrawOutline(t,e,i,s,a,n){return new di(t,e,i,s,a,n)}get classNamesForDrawing(){return["highlight","free"]}}class di extends hU{get classNamesForDrawing(){return["highlight","free"]}get classNamesForOutlining(){return["highlightOutline","free"]}newOutliner(t,e,i,s,a){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;return new de(t,e,i,s,a,n)}}var ds=new WeakMap,da=new WeakMap,dn=new WeakMap,dr=new WeakMap,dl=new WeakMap,dh=new WeakMap,dd=new WeakMap,dc=new WeakMap,du=new WeakMap,d_=new WeakMap,dp=new WeakMap,df=new WeakSet,dg=new WeakSet,dm=new WeakSet,dv=new WeakSet,db=new WeakSet,dw=new WeakMap;class dA{static get _keyboardManager(){return tk(this,"_keyboardManager",new eX([[["Escape","mac+Escape"],dA.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],dA.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],dA.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],dA.prototype._moveToPrevious],[["Home","mac+Home"],dA.prototype._moveToBeginning],[["End","mac+End"],dA.prototype._moveToEnd]]))}renderButton(){let t=(0,N._)(this,ds,document.createElement("button"));
1t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.setAttribute("aria-haspopup",!0);let e=(0,O._)(this,d_)._signal;t.addEventListener("click",(0,H._)(this,dv,dk).bind(this),{signal:e}),t.addEventListener("keydown",(0,H._)(this,dm,dE).bind(this),{signal:e});let i=(0,N._)(this,da,document.createElement("span"));return i.className="swatch",i.setAttribute("aria-hidden",!0),i.style.backgroundColor=(0,O._)(this,dn),t.append(i),t}renderMainDropdown(){let t=(0,N._)(this,dr,(0,H._)(this,df,dS).call(this));return t.setAttribute("aria-orientation","horizontal"),t.setAttribute("aria-labelledby","highlightColorPickerLabel"),t}_colorSelectFromKeyboard(t){if(t.target===(0,O._)(this,ds))return void(0,H._)(this,dv,dk).call(this,t);let e=t.target.getAttribute("data-color");e&&(0,H._)(this,dg,dx).call(this,e,t)}_moveToNext(t){var e,i;if(!(0,O._)(this,dw))return void(0,H._)(this,dv,dk).call(this,t);if(t.target===(0,O._)(this,ds)){null==(i=(0,O._)(this,dr).firstChild)||i.focus();return}null==(e=t.target.nextSibling)||e.focus()}_moveToPrevious(t){var e,i;if(t.target===(null==(e=(0,O._)(this,dr))?void 0:e.firstChild)||t.target===(0,O._)(this,ds)){(0,O._)(this,dw)&&this._hideDropdownFromKeyboard();return}(0,O._)(this,dw)||(0,H._)(this,dv,dk).call(this,t),null==(i=t.target.previousSibling)||i.focus()}_moveToBeginning(t){var e;if(!(0,O._)(this,dw))return void(0,H._)(this,dv,dk).call(this,t);null==(e=(0,O._)(this,dr).firstChild)||e.focus()}_moveToEnd(t){var e;if(!(0,O._)(this,dw))return void(0,H._)(this,dv,dk).call(this,t);null==(e=(0,O._)(this,dr).lastChild)||e.focus()}hideDropdown(){var t,e;null==(t=(0,O._)(this,dr))||t.classList.add("hidden"),null==(e=(0,O._)(this,du))||e.abort(),(0,N._)(this,du,null)}_hideDropdownFromKeyboard(){if(!(0,O._)(this,dh)){if(!(0,O._)(this,dw)){var t;null==(t=(0,O._)(this,dd))||t.unselect();return}this.hideDropdown(),(0,O._)(this,ds).focus({preventScroll:!0,focusVisible:(0,O._)(this,dl)})}}updateColor(t){if((0,O._)(this,da)&&((0,O._)(this,da).style.backgroundColor=t),!(0,O._)(this,dr))return;let e=(0,O._)(this,d_).highlightColors.values();for(let i of(0,O._)(this,dr).children)i.setAttribute("aria-selected",e.next().value===t)}destroy(){var t,e;null==(t=(0,O._)(this,ds))||t.remove(),(0,N._)(this,ds,null),(0,N._)(this,da,null),null==(e=(0,O._)(this,dr))||e.remove(),(0,N._)(this,dr,null)}constructor({editor:t=null,uiManager:e=null}){var i;(0,B._)(this,df),(0,B._)(this,dg),(0,B._)(this,dm),(0,B._)(this,dv),(0,B._)(this,db),(0,W._)(this,dw,{get:dC,set:void 0}),(0,W._)(this,ds,{writable:!0,value:void 0}),(0,W._)(this,da,{writable:!0,value:void 0}),(0,W._)(this,dn,{writable:!0,value:void 0}),(0,W._)(this,dr,{writable:!0,value:void 0}),(0,W._)(this,dl,{writable:!0,value:void 0}),(0,W._)(this,dh,{writable:!0,value:void 0}),(0,W._)(this,dd,{writable:!0,value:void 0}),(0,W._)(this,dc,{writable:!0,value:void 0}),(0,W._)(this,du,{writable:!0,value:void 0}),(0,W._)(this,d_,{writable:!0,value:void 0}),(0,W._)(this,dp,{writable:!0,value:void 0}),(0,N._)(this,ds,null),(0,N._)(this,da,null),(0,N._)(this,dr,null),(0,N._)(this,dl,!1),(0,N._)(this,dh,!1),(0,N._)(this,dd,null),(0,N._)(this,du,null),(0,N._)(this,d_,null),t?((0,N._)(this,dh,!1),(0,N._)(this,dp,tc.HIGHLIGHT_COLOR),(0,N._)(this,dd,t)):((0,N._)(this,dh,!0),(0,N._)(this,dp,tc.HIGHLIGHT_DEFAULT_COLOR)),(0,N._)(this,d_,(null==t?void 0:t._uiManager)||e),(0,N._)(this,dc,(0,O._)(this,d_)._eventBus),(0,N._)(this,dn,(null==t?void 0:t.color)||(null==(i=(0,O._)(this,d_))?void 0:i.highlightColors.values().next().value)||"#FFFF98"),(0,z._)(dA,dA,dy,(0,G._)(dA,dA,dy)||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"}))}}var dy={writable:!0,value:null};function dS(){let t=document.createElement("div"),e=(0,O._)(this,d_)._signal;for(let[i,s]of(t.addEventListener("contextmenu",t6,{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"),(0,O._)(this,d_).highlightColors)){let a=document.createElement("button");a.tabIndex="0",a.role="option",a.setAttribute("data-color",s),a.title=i,a.setAttribute("data-l10n-id",(0,G._)(dA,dA,dy)[i]);let n=document.createElement("span");a.append(n),n.className="swatch",n.style.backgroundColor=s,a.setAttribute("aria-selected",s===(0,O._)(this,dn)),a.addEventListener("click",(0,H._)(this,dg,dx).bind(this,s),{signal:e}),t.append(a)}return t.addEventListener("keydown",(0,H._)(this,dm,dE).bind(this),{signal:e}),t}function dx(t,e){e.stopPropagation(),(0,O._)(this,dc).dispatch("switchannotationeditorparams",{source:this,type:(0,O._)(this,dp),value:t})}function dE(t){dA._keyboardManager.exec(this,t)}function dk(t){if((0,O._)(this,dw))return void this.hideDropdown();if((0,N._)(this,dl,0===t.detail),(0,O._)(this,du)||((0,N._)(this,du,new AbortController),window.addEventListener("pointerdown",(0,H._)(this,db,dM).bind(this),{signal:(0,O._)(this,d_).combinedSignal((0,O._)(this,du))})),(0,O._)(this,dr))return void(0,O._)(this,dr).classList.remove("hidden");let e=(0,N._)(this,dr,(0,H._)(this,df,dS).call(this));(0,O._)(this,ds).append(e)}function dM(t){var e;null!=(e=(0,O._)(this,dr))&&e.contains(t.target)||this.hideDropdown()}function dC(){return(0,O._)(this,dr)&&!(0,O._)(this,dr).classList.contains("hidden")}var dT=new WeakMap,dR=new WeakMap,dL=new WeakMap,dP=new WeakMap,dI=new WeakMap,dD=new WeakMap,dF=new WeakMap,dO=new WeakMap,dW=new WeakMap,dN=new WeakMap,dj=new WeakMap,dH=new WeakMap,dB=new WeakMap,dG=new WeakMap,dz=new WeakMap,dU=new WeakMap,dV=new WeakMap,dq=new WeakMap,dK=new WeakSet,dX=new WeakSet,dY=new WeakSet,dQ=new WeakSet,dJ=new WeakSet,dZ=new WeakSet,d$=new WeakSet,d0=new WeakSet,d1=new WeakSet,d2=new WeakSet,d3=new WeakSet,d5=new WeakSet,d6=new WeakSet;class d4 extends s8{static get _keyboardManager(){let t=d4.prototype;return tk(this,"_keyboardManager",new eX([[["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]}]]))}get telemetryInitialData(){return{action:"added",type:(0,O._)(this,dH)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:(0,O._)(this,dV),methodOfCreation:(0,O._)(this,dq)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}static initialize(t,e){var i;s8.initialize(t,e),d4._defaultColor||(d4._defaultColor=(null==(i=e.highlightColors)?void 0:i.values().next().value)||"#fff066")}static updateDefaultParams(t,e){switch(t){case tc.HIGHLIGHT_DEFAULT_COLOR:d4._defaultColor=e;break;case tc.HIGHLIGHT_THICKNESS:d4._defaultThickness=e}}translateInPage(t,e){}get toolbarPosition(){return(0,O._)(this,dB)}updateParams(t,e){switch(t){case tc.HIGHLIGHT_COLOR:(0,H._)(this,dY,d9).call(this,e);break;case tc.HIGHLIGHT_THICKNESS:(0,H._)(this,dQ,ct).call(this,e)}}static get defaultPropertiesToUpdate(){return[[tc.HIGHLIGHT_DEFAULT_COLOR,d4._defaultColor],[tc.HIGHLIGHT_THICKNESS,d4._defaultThickness]]}get propertiesToUpdate(){return[[tc.HIGHLIGHT_COLOR,this.color||d4._defaultColor],[tc.HIGHLIGHT_THICKNESS,(0,O._)(this,dV)||d4._defaultThickness],[tc.HIGHLIGHT_FREE,(0,O._)(this,dH)]]}async addEditToolbar(){let t=await super.addEditToolbar();return t?(this._uiManager.highlightColors&&((0,N._)(this,dI,new dA({editor:this})),t.addColorPicker((0,O._)(this,dI))),t):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition((0,H._)(this,d2,cl).call(this))}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,(0,H._)(this,d2,cl).call(this))}onceAdded(){this.annotationElementId||this.parent.addUndoableEditor(this),this.div.focus()}remove(){(0,H._)(this,dZ,ci).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&((0,H._)(this,d$,cs).call(this),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;if(this.parent&&!t)(0,H._)(this,dZ,ci).call(this);else if(t){var i;(0,H._)(this,d$,cs).call(this,t),e=!this.parent&&(null==(i=this.div)?void 0:i.classList.contains("selectedEditor"))}super.setParent(t),this.show(this._isVisible),e&&this.select()}rotate(t){let e,{drawLayer:i}
1=this.parent;(0,O._)(this,dH)?(t=(t-this.rotation+360)%360,e=(0,q._)(d4,d4,ca).call(d4,(0,O._)(this,dN).box,t)):e=(0,q._)(d4,d4,ca).call(d4,this,t),i.rotate((0,O._)(this,dj),t),i.rotate((0,O._)(this,dz),t),i.updateBox((0,O._)(this,dj),e),i.updateBox((0,O._)(this,dz),(0,q._)(d4,d4,ca).call(d4,(0,O._)(this,dD).box,t))}render(){if(this.div)return this.div;let t=super.render();(0,O._)(this,dU)&&(t.setAttribute("aria-label",(0,O._)(this,dU)),t.setAttribute("role","mark")),(0,O._)(this,dH)?t.classList.add("free"):this.div.addEventListener("keydown",(0,H._)(this,d0,cn).bind(this),{signal:this._uiManager._signal});let e=(0,N._)(this,dW,document.createElement("div"));t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=(0,O._)(this,dP);let[i,s]=this.parentDimensions;return this.setDims(this.width*i,this.height*s),eI(this,(0,O._)(this,dW),["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.isSelected||this.parent.drawLayer.addClass((0,O._)(this,dz),"hovered")}pointerleave(){this.isSelected||this.parent.drawLayer.removeClass((0,O._)(this,dz),"hovered")}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:(0,H._)(this,d1,cr).call(this,!0);break;case 1:case 3:(0,H._)(this,d1,cr).call(this,!1)}}select(){var t,e;super.select(),(0,O._)(this,dz)&&(null==(t=this.parent)||t.drawLayer.removeClass((0,O._)(this,dz),"hovered"),null==(e=this.parent)||e.drawLayer.addClass((0,O._)(this,dz),"selected"))}unselect(){var t;super.unselect(),(0,O._)(this,dz)&&(null==(t=this.parent)||t.drawLayer.removeClass((0,O._)(this,dz),"selected"),(0,O._)(this,dH)||(0,H._)(this,d1,cr).call(this,!1))}get _mustFixPosition(){return!(0,O._)(this,dH)}show(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;super.show(t),this.parent&&(this.parent.drawLayer.show((0,O._)(this,dj),t),this.parent.drawLayer.show((0,O._)(this,dz),t))}static startHighlighting(t,e,i){let{target:s,x:a,y:n}=i,{x:r,y:l,width:o,height:h}=s.getBoundingClientRect(),d=new AbortController,c=t.combinedSignal(d),u=e=>{d.abort(),(0,q._)(this,d4,cc).call(d4,t,e)};window.addEventListener("blur",u,{signal:c}),window.addEventListener("pointerup",u,{signal:c}),window.addEventListener("pointerdown",t=>{t.preventDefault(),t.stopPropagation()},{capture:!0,passive:!1,signal:c}),window.addEventListener("contextmenu",t6,{signal:c}),s.addEventListener("pointermove",(0,q._)(this,d4,cd).bind(this,t),{signal:c}),this._freeHighlight=new de({x:a,y:n},[r,l,o,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 async deserialize(t,e,i){let s=null;if(t instanceof oD){let{data:{quadPoints:e,rect:i,rotation:a,id:n,color:r,opacity:l,popupRef:o},parent:{page:{pageNumber:h}}}=t;s=t={annotationType:td.HIGHLIGHT,color:Array.from(r),opacity:l,quadPoints:e,boxes:null,pageIndex:h-1,rect:i.slice(0),rotation:a,id:n,deleted:!1,popupRef:o}}else if(t instanceof oI){let{data:{inkLists:e,rect:i,rotation:a,id:n,color:r,borderStyle:{rawWidth:l},popupRef:o},parent:{page:{pageNumber:h}}}=t;s=t={annotationType:td.HIGHLIGHT,color:Array.from(r),thickness:l,inkLists:e,boxes:null,pageIndex:h-1,rect:i.slice(0),rotation:a,id:n,deleted:!1,popupRef:o}}let{color:a,quadPoints:n,inkLists:r,opacity:l}=t,o=await super.deserialize(t,e,i);o.color=tH.makeHexColor(...a),(0,N._)(o,dG,l||1),r&&(0,N._)(o,dV,t.thickness),o.annotationElementId=t.id||null,o._initialData=s;let[h,d]=o.pageDimensions,[c,u]=o.pageTranslation;if(n){let t=(0,N._)(o,dL,[]);for(let e=0;e<n.length;e+=8)t.push({x:(n[e]-c)/h,y:1-(n[e+1]-u)/d,width:(n[e+2]-n[e])/h,height:(n[e+1]-n[e+5])/d});(0,H._)(o,dK,d8).call(o),(0,H._)(o,d$,cs).call(o),o.rotate(o.rotation)}else if(r){(0,N._)(o,dH,!0);let t=r[0],i={x:t[0]-c,y:d-(t[1]-u)},s=new de(i,[0,0,h,d],1,(0,O._)(o,dV)/2,!0,.001);for(let e=0,a=t.length;e<a;e+=2)i.x=t[e]-c,i.y=d-(t[e+1]-u),s.add(i);let{id:a,clipPathId:n}=e.drawLayer.draw(s,o.color,o._defaultOpacity,!0);(0,H._)(o,dX,d7).call(o,{highlightOutlines:s.getOutlines(),highlightId:a,clipPathId:n}),(0,H._)(o,d$,cs).call(o)}return o}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();let e=this.getRect(0,0),i=s8._colorManager.convert(this.color),s={annotationType:td.HIGHLIGHT,color:i,opacity:(0,O._)(this,dG),thickness:(0,O._)(this,dV),quadPoints:(0,H._)(this,d3,co).call(this),outlines:(0,H._)(this,d5,ch).call(this,e),pageIndex:this.pageIndex,rect:e,rotation:(0,H._)(this,d2,cl).call(this),structTreeParentId:this._structTreeParentId};
1return this.annotationElementId&&!(0,H._)(this,d6,cu).call(this,s)?null:(s.id=this.annotationElementId,s)}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}constructor(t){super({...t,name:"highlightEditor"}),(0,B._)(this,dK),(0,B._)(this,dX),(0,B._)(this,dY),(0,B._)(this,dQ),(0,B._)(this,dJ),(0,B._)(this,dZ),(0,B._)(this,d$),(0,B._)(this,d0),(0,B._)(this,d1),(0,B._)(this,d2),(0,B._)(this,d3),(0,B._)(this,d5),(0,B._)(this,d6),(0,W._)(this,dT,{writable:!0,value:void 0}),(0,W._)(this,dR,{writable:!0,value:void 0}),(0,W._)(this,dL,{writable:!0,value:void 0}),(0,W._)(this,dP,{writable:!0,value:void 0}),(0,W._)(this,dI,{writable:!0,value:void 0}),(0,W._)(this,dD,{writable:!0,value:void 0}),(0,W._)(this,dF,{writable:!0,value:void 0}),(0,W._)(this,dO,{writable:!0,value:void 0}),(0,W._)(this,dW,{writable:!0,value:void 0}),(0,W._)(this,dN,{writable:!0,value:void 0}),(0,W._)(this,dj,{writable:!0,value:void 0}),(0,W._)(this,dH,{writable:!0,value:void 0}),(0,W._)(this,dB,{writable:!0,value:void 0}),(0,W._)(this,dG,{writable:!0,value:void 0}),(0,W._)(this,dz,{writable:!0,value:void 0}),(0,W._)(this,dU,{writable:!0,value:void 0}),(0,W._)(this,dV,{writable:!0,value:void 0}),(0,W._)(this,dq,{writable:!0,value:void 0}),(0,N._)(this,dT,null),(0,N._)(this,dR,0),(0,N._)(this,dP,null),(0,N._)(this,dI,null),(0,N._)(this,dD,null),(0,N._)(this,dF,null),(0,N._)(this,dO,0),(0,N._)(this,dW,null),(0,N._)(this,dN,null),(0,N._)(this,dj,null),(0,N._)(this,dH,!1),(0,N._)(this,dB,null),(0,N._)(this,dz,null),(0,N._)(this,dU,""),(0,N._)(this,dq,""),this.color=t.color||d4._defaultColor,(0,N._)(this,dV,t.thickness||d4._defaultThickness),(0,N._)(this,dG,t.opacity||d4._defaultOpacity),(0,N._)(this,dL,t.boxes||null),(0,N._)(this,dq,t.methodOfCreation||""),(0,N._)(this,dU,t.text||""),this._isDraggable=!1,t.highlightId>-1?((0,N._)(this,dH,!0),(0,H._)(this,dX,d7).call(this,t),(0,H._)(this,d$,cs).call(this)):(0,O._)(this,dL)&&((0,N._)(this,dT,t.anchorNode),(0,N._)(this,dR,t.anchorOffset),(0,N._)(this,dF,t.focusNode),(0,N._)(this,dO,t.focusOffset),(0,H._)(this,dK,d8).call(this),(0,H._)(this,d$,cs).call(this),this.rotate(this.rotation))}}function d8(){let t=new h2((0,O._)(this,dL),.001);(0,N._)(this,dN,t.getOutlines()),{x:this.x,y:this.y,width:this.width,height:this.height}=(0,O._)(this,dN).box;let e=new h2((0,O._)(this,dL),.0025,.001,"ltr"===this._uiManager.direction);(0,N._)(this,dD,e.getOutlines());let{lastPoint:i}=(0,O._)(this,dD).box;(0,N._)(this,dB,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height])}function d7(t){let{highlightOutlines:e,highlightId:i,clipPathId:s}=t;if((0,N._)(this,dN,e),(0,N._)(this,dD,e.getNewOutline((0,O._)(this,dV)/2+1.5,.0025)),i>=0)(0,N._)(this,dj,i),(0,N._)(this,dP,s),this.parent.drawLayer.finalizeLine(i,e),(0,N._)(this,dz,this.parent.drawLayer.drawOutline((0,O._)(this,dD)));else if(this.parent){let t=this.parent.viewport.rotation;this.parent.drawLayer.updateLine((0,O._)(this,dj),e),this.parent.drawLayer.updateBox((0,O._)(this,dj),(0,q._)(d4,d4,ca).call(d4,(0,O._)(this,dN).box,(t-this.rotation+360)%360)),this.parent.drawLayer.updateLine((0,O._)(this,dz),(0,O._)(this,dD)),this.parent.drawLayer.updateBox((0,O._)(this,dz),(0,q._)(d4,d4,ca).call(d4,(0,O._)(this,dD).box,t))}let{x:a,y:n,width:r,height:l}=e.box;switch(this.rotation){case 0:this.x=a,this.y=n,this.width=r,this.height=l;break;case 90:{let[t,e]=this.parentDimensions;this.x=n,this.y=1-a,this.width=r*e/t,this.height=l*t/e;break}case 180:this.x=1-a,this.y=1-n,this.width=r,this.height=l;break;case 270:{let[t,e]=this.parentDimensions;this.x=1-n,this.y=a,this.width=r*e/t,this.height=l*t/e}}let{lastPoint:o}=(0,O._)(this,dD).box;(0,N._)(this,dB,[(o[0]-a)/r,(o[1]-n)/l])}function d9(t){let e=(t,e)=>{var i,s,a;this.color=t,null==(i=this.parent)||i.drawLayer.changeColor((0,O._)(this,dj),t),null==(s=(0,O._)(this,dI))||s.updateColor(t),(0,N._)(this,dG,e),null==(a=this.parent)||a.drawLayer.changeOpacity((0,O._)(this,dj),e)},i=this.color,s=(0,O._)(this,dG);this.addCommands({cmd:e.bind(this,t,d4._defaultOpacity),undo:e.bind(this,i,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:tc.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(t)},!0)}function ct(t){let e=(0,O._)(this,dV),i=t=>{(0,N._)(this,dV,t),(0,H._)(this,dJ,ce).call(this,t)};this.addCommands({cmd:i.bind(this,t),undo:i.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:tc.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}function ce(t){if(!(0,O._)(this,dH))return;(0,H._)(this,dX,d7).call(this,{highlightOutlines:(0,O._)(this,dN).getNewOutline(t/2)}),this.fixAndSetPosition();let[e,i]=this.parentDimensions;this.setDims(this.width*e,this.height*i)}function ci(){null!==(0,O._)(this,dj)&&this.parent&&(this.parent.drawLayer.remove((0,O._)(this,dj)),(0,N._)(this,dj,null),this.parent.drawLayer.remove((0,O._)(this,dz)),(0,N._)(this,dz,null))}function cs(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.parent;
1null===(0,O._)(this,dj)&&({id:(0,V._)(this,dj).value,clipPathId:(0,V._)(this,dP).value}=t.drawLayer.draw((0,O._)(this,dN),this.color,(0,O._)(this,dG)),(0,N._)(this,dz,t.drawLayer.drawOutline((0,O._)(this,dD))),(0,O._)(this,dW)&&((0,O._)(this,dW).style.clipPath=(0,O._)(this,dP)))}function ca(t,e){let{x:i,y:s,width:a,height:n}=t;switch(e){case 90:return{x:1-s-n,y:i,width:n,height:a};case 180:return{x:1-i-a,y:1-s-n,width:a,height:n};case 270:return{x:s,y:1-i-a,width:n,height:a}}return{x:i,y:s,width:a,height:n}}function cn(t){d4._keyboardManager.exec(this,t)}function cr(t){if(!(0,O._)(this,dT))return;let e=window.getSelection();t?e.setPosition((0,O._)(this,dT),(0,O._)(this,dR)):e.setPosition((0,O._)(this,dF),(0,O._)(this,dO))}function cl(){return(0,O._)(this,dH)?this.rotation:0}function co(){if((0,O._)(this,dH))return null;let[t,e]=this.pageDimensions,[i,s]=this.pageTranslation,a=(0,O._)(this,dL),n=new Float32Array(8*a.length),r=0;for(let{x:l,y:o,width:h,height:d}of a){let a=l*t+i,c=(1-o-d)*e+s;n[r]=n[r+4]=a,n[r+1]=n[r+3]=c,n[r+2]=n[r+6]=a+h*t,n[r+5]=n[r+7]=c+d*e,r+=8}return n}function ch(t){return(0,O._)(this,dN).serialize(t,(0,H._)(this,d2,cl).call(this))}function cd(t,e){this._freeHighlight.add(e)&&t.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)}function cc(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=""}function cu(t){let{color:e}=this._initialData;return t.color.some((t,i)=>t!==e[i])}d4._defaultColor=null,d4._defaultOpacity=1,d4._defaultThickness=12,d4._type="highlight",d4._editorType=td.HIGHLIGHT,d4._freeHighlightId=-1,d4._freeHighlight=null,d4._freeHighlightClipId="";var c_=new WeakMap,cp=new WeakMap,cf=new WeakMap,cg=new WeakMap,cm=new WeakMap,cv=new WeakMap,cb=new WeakMap,cw=new WeakMap,cA=new WeakMap,cy=new WeakMap,cS=new WeakMap,cx=new WeakMap,cE=new WeakMap,ck=new WeakSet,cM=new WeakSet,cC=new WeakSet,cT=new WeakSet,cR=new WeakSet,cL=new WeakSet,cP=new WeakSet,cI=new WeakSet,cD=new WeakSet,cF=new WeakSet,cO=new WeakSet,cW=new WeakSet,cN=new WeakSet,cj=new WeakSet,cH=new WeakSet,cB=new WeakSet,cG=new WeakSet,cz=new WeakSet,cU=new WeakSet,cV=new WeakSet,cq=new WeakSet,cK=new WeakSet,cX=new WeakSet,cY=new WeakSet,cQ=new WeakSet;class cJ extends s8{static initialize(t,e){s8.initialize(t,e)}static updateDefaultParams(t,e){switch(t){case tc.INK_THICKNESS:cJ._defaultThickness=e;break;case tc.INK_COLOR:cJ._defaultColor=e;break;case tc.INK_OPACITY:cJ._defaultOpacity=e/100}}updateParams(t,e){switch(t){case tc.INK_THICKNESS:(0,H._)(this,ck,cZ).call(this,e);break;case tc.INK_COLOR:(0,H._)(this,cM,c$).call(this,e);break;case tc.INK_OPACITY:(0,H._)(this,cC,c0).call(this,e)}}static get defaultPropertiesToUpdate(){return[[tc.INK_THICKNESS,cJ._defaultThickness],[tc.INK_COLOR,cJ._defaultColor||s8._defaultLineColor],[tc.INK_OPACITY,Math.round(100*cJ._defaultOpacity)]]}get propertiesToUpdate(){var t;return[[tc.INK_THICKNESS,this.thickness||cJ._defaultThickness],[tc.INK_COLOR,this.color||cJ._defaultColor||s8._defaultLineColor],[tc.INK_OPACITY,Math.round(100*(null!=(t=this.opacity)?t:cJ._defaultOpacity))]]}rebuild(){this.parent&&(super.rebuild(),null!==this.div&&(this.canvas||((0,H._)(this,cG,ua).call(this),(0,H._)(this,cz,un).call(this)),this.isAttachedToDOM||(this.parent.add(this),(0,H._)(this,cU,ur).call(this)),(0,H._)(this,cQ,uf).call(this)))}remove(){var t;null!==this.canvas&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,(0,O._)(this,cf)&&(clearTimeout((0,O._)(this,cf)),(0,N._)(this,cf,null)),null==(t=(0,O._)(this,cA))||t.disconnect(),(0,N._)(this,cA,null),super.remove())}setParent(t){!this.parent&&t?this._uiManager.removeShouldRescale(this):this.parent&&null===t&&this._uiManager.addShouldRescale(this),super.setParent(t)}onScaleChanging(){let[t,e]=this.parentDimensions,i=this.width*t,s=this.height*e;this.setDimensions(i,s)}enableEditMode(){(0,O._)(this,cm)||null===this.canvas||(super.enableEditMode(),this._isDraggable=!1,(0,H._)(this,cj,ue).call(this))}disableEditMode(){this.isInEditMode()&&null!==this.canvas&&(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),(0,H._)(this,cH,ui).call(this))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}commit(){(0,O._)(this,cm)||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),(0,N._)(this,cm,!0),this.div.classList.add("disabled"),(0,H._)(this,cQ,uf).
1call(this,!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),this.enableEditMode())}canvasPointerdown(t){0!==t.button||!this.isInEditMode()||(0,O._)(this,cm)||(this.setInForeground(),t.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),(0,H._)(this,cL,c3).call(this,t.offsetX,t.offsetY))}canvasPointermove(t){t.preventDefault(),(0,H._)(this,cP,c5).call(this,t.offsetX,t.offsetY)}canvasPointerup(t){t.preventDefault(),(0,H._)(this,cB,us).call(this,t)}canvasPointerleave(t){(0,H._)(this,cB,us).call(this,t)}get isResizable(){return!this.isEmpty()&&(0,O._)(this,cm)}render(){let t,e;if(this.div)return this.div;this.width&&(t=this.x,e=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");let[i,s,a,n]=(0,H._)(this,cT,c1).call(this);if(this.setAt(i,s,0,0),this.setDims(a,n),(0,H._)(this,cG,ua).call(this),this.width){let[i,s]=this.parentDimensions;this.setAspectRatio(this.width*i,this.height*s),this.setAt(t*i,e*s,this.width*i,this.height*s),(0,N._)(this,cw,!0),(0,H._)(this,cU,ur).call(this),this.setDims(this.width*i,this.height*s),(0,H._)(this,cN,ut).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return(0,H._)(this,cz,un).call(this),this.div}setDimensions(t,e){let i=Math.round(t),s=Math.round(e);if((0,O._)(this,cS)===i&&(0,O._)(this,cx)===s)return;(0,N._)(this,cS,i),(0,N._)(this,cx,s),this.canvas.style.visibility="hidden";let[a,n]=this.parentDimensions;this.width=t/a,this.height=e/n,this.fixAndSetPosition(),(0,O._)(this,cm)&&(0,H._)(this,cV,ul).call(this,t,e),(0,H._)(this,cU,ur).call(this),(0,H._)(this,cN,ut).call(this),this.canvas.style.visibility="visible",this.fixDims()}static async deserialize(t,e,i){if(t instanceof oI)return null;let s=await super.deserialize(t,e,i);s.thickness=t.thickness,s.color=tH.makeHexColor(...t.color),s.opacity=t.opacity;let[a,n]=s.pageDimensions,r=s.width*a,l=s.height*n,o=s.parentScale,h=t.thickness/2;(0,N._)(s,cm,!0),(0,N._)(s,cS,Math.round(r)),(0,N._)(s,cx,Math.round(l));let{paths:d,rect:c,rotation:u}=t;for(let{bezier:t}of d){t=(0,q._)(cJ,cJ,uc).call(cJ,t,c,u);let e=[];s.paths.push(e);let i=o*(t[0]-h),a=o*(t[1]-h);for(let s=2,n=t.length;s<n;s+=6){let n=o*(t[s]-h),r=o*(t[s+1]-h),l=o*(t[s+2]-h),d=o*(t[s+3]-h),c=o*(t[s+4]-h),u=o*(t[s+5]-h);e.push([[i,a],[n,r],[l,d],[c,u]]),i=c,a=u}let n=(0,q._)(this,cJ,uh).call(cJ,e);s.bezierPath2D.push(n)}let _=(0,H._)(s,cX,u_).call(s);return(0,N._)(s,cp,Math.max(s8.MIN_SIZE,_[2]-_[0])),(0,N._)(s,c_,Math.max(s8.MIN_SIZE,_[3]-_[1])),(0,H._)(s,cV,ul).call(s,r,l),s}serialize(){if(this.isEmpty())return null;let t=this.getRect(0,0),e=s8._colorManager.convert(this.ctx.strokeStyle);return{annotationType:td.INK,color:e,thickness:this.thickness,opacity:this.opacity,paths:(0,H._)(this,cK,uu).call(this,this.scaleFactor/this.parentScale,this.translationX,this.translationY,t),pageIndex:this.pageIndex,rect:t,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}constructor(t){super({...t,name:"inkEditor"}),(0,B._)(this,ck),(0,B._)(this,cM),(0,B._)(this,cC),(0,B._)(this,cT),(0,B._)(this,cR),(0,B._)(this,cL),(0,B._)(this,cP),(0,B._)(this,cI),(0,B._)(this,cD),(0,B._)(this,cF),(0,B._)(this,cO),(0,B._)(this,cW),(0,B._)(this,cN),(0,B._)(this,cj),(0,B._)(this,cH),(0,B._)(this,cB),(0,B._)(this,cG),(0,B._)(this,cz),(0,B._)(this,cU),(0,B._)(this,cV),(0,B._)(this,cq),(0,B._)(this,cK),(0,B._)(this,cX),(0,B._)(this,cY),(0,B._)(this,cQ),(0,W._)(this,c_,{writable:!0,value:void 0}),(0,W._)(this,cp,{writable:!0,value:void 0}),(0,W._)(this,cf,{writable:!0,value:void 0}),(0,W._)(this,cg,{writable:!0,value:void 0}),(0,W._)(this,cm,{writable:!0,value:void 0}),(0,W._)(this,cv,{writable:!0,value:void 0}),(0,W._)(this,cb,{writable:!0,value:void 0}),(0,W._)(this,cw,{writable:!0,value:void 0}),(0,W._)(this,cA,{writable:!0,value:void 0}),(0,W._)(this,cy,{writable:!0,value:void 0}),(0,W._)(this,cS,{writable:!0,value:void 0}),(0,W._)(this,cx,{writable:!0,value:void 0}),(0,W._)(this,cE,{writable:!0,value:void 0}),(0,N._)(this,c_,0),(0,N._)(this,cp,0),(0,N._)(this,cf,null),(0,N._)(this,cg,new Path2D),(0,N._)(this,cm,!1),(0,N._)(this,cv,null),(0,N._)(this,cb,!1),(0,N._)(this,cw,!1),(0,N._)(this,cA,null),(0,N._)(this,cy,null),(0,N._)(this,cS,0),(0,N._)(this,cx,0),(0,N._)(this,cE,null),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}}function cZ(t){let e=t=>
1{this.thickness=t,(0,H._)(this,cQ,uf).call(this)},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:tc.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}function c$(t){let e=t=>{this.color=t,(0,H._)(this,cN,ut).call(this)},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:tc.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function c0(t){let e=t=>{this.opacity=t,(0,H._)(this,cN,ut).call(this)};t/=100;let i=this.opacity;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:tc.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}function c1(){let{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]}}function c2(){let{ctx:t,color:e,opacity:i,thickness:s,parentScale:a,scaleFactor:n}=this;t.lineWidth=s*a/n,t.lineCap="round",t.lineJoin="round",t.miterLimit=10,t.strokeStyle="".concat(e).concat(Math.round(Math.min(255,Math.max(1,255*i))).toString(16).padStart(2,"0"))}function c3(t,e){this.canvas.addEventListener("contextmenu",t6,{signal:this._uiManager._signal}),(0,H._)(this,cH,ui).call(this),(0,N._)(this,cv,new AbortController);let i=this._uiManager.combinedSignal((0,O._)(this,cv));(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,!(0,O._)(this,cw))&&((0,N._)(this,cw,!0),(0,H._)(this,cU,ur).call(this),this.thickness||(this.thickness=cJ._defaultThickness),this.color||(this.color=cJ._defaultColor||s8._defaultLineColor),null!=this.opacity||(this.opacity=cJ._defaultOpacity));this.currentPath.push([t,e]),(0,N._)(this,cb,!1),(0,H._)(this,cR,c2).call(this),(0,N._)(this,cE,()=>{(0,H._)(this,cF,c8).call(this),(0,O._)(this,cE)&&window.requestAnimationFrame((0,O._)(this,cE))}),window.requestAnimationFrame((0,O._)(this,cE))}function c5(t,e){let[i,s]=this.currentPath.at(-1);if(this.currentPath.length>1&&t===i&&e===s)return;let a=this.currentPath,n=(0,O._)(this,cg);if(a.push([t,e]),(0,N._)(this,cb,!0),a.length<=2){n.moveTo(...a[0]),n.lineTo(t,e);return}3===a.length&&((0,N._)(this,cg,n=new Path2D),n.moveTo(...a[0])),(0,H._)(this,cO,c7).call(this,n,...a.at(-3),...a.at(-2),t,e)}function c6(){if(0===this.currentPath.length)return;let t=this.currentPath.at(-1);(0,O._)(this,cg).lineTo(...t)}function c4(t,e){let i;if((0,N._)(this,cE,null),t=Math.min(Math.max(t,0),this.canvas.width),e=Math.min(Math.max(e,0),this.canvas.height),(0,H._)(this,cP,c5).call(this,t,e),(0,H._)(this,cI,c6).call(this),1!==this.currentPath.length)i=(0,H._)(this,cW,c9).call(this);else{let s=[t,e];i=[[s,s.slice(),s.slice(),s]]}let s=(0,O._)(this,cg),a=this.currentPath;this.currentPath=[],(0,N._)(this,cg,new Path2D);let n=()=>{this.allRawPaths.push(a),this.paths.push(i),this.bezierPath2D.push(s),this._uiManager.rebuild(this)},r=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),0===this.paths.length?this.remove():(this.canvas||((0,H._)(this,cG,ua).call(this),(0,H._)(this,cz,un).call(this)),(0,H._)(this,cQ,uf).call(this))};this.addCommands({cmd:n,undo:r,mustExec:!0})}function c8(){if(!(0,O._)(this,cb))return;(0,N._)(this,cb,!1),this.thickness,this.parentScale;let t=this.currentPath.slice(-3);t.map(t=>t[0]),t.map(t=>t[1]);let{ctx:e}=this;for(let t of(e.save(),e.clearRect(0,0,this.canvas.width,this.canvas.height),this.bezierPath2D))e.stroke(t);e.stroke((0,O._)(this,cg)),e.restore()}function c7(t,e,i,s,a,n,r){let l=(e+s)/2,o=(i+a)/2,h=(s+n)/2,d=(a+r)/2;t.bezierCurveTo(l+2*(s-l)/3,o+2*(a-o)/3,h+2*(s-h)/3,d+2*(a-d)/3,h,d)}function c9(){let t,e=this.currentPath;if(e.length<=2)return[[e[0],e[0],e.at(-1),e.at(-1)]];let i=[],[s,a]=e[0];for(t=1;t<e.length-2;t++){let[n,r]=e[t],[l,o]=e[t+1],h=(n+l)/2,d=(r+o)/2,c=[s+2*(n-s)/3,a+2*(r-a)
1/3],u=[h+2*(n-h)/3,d+2*(r-d)/3];i.push([[s,a],c,u,[h,d]]),[s,a]=[h,d]}let[n,r]=e[t],[l,o]=e[t+1],h=[s+2*(n-s)/3,a+2*(r-a)/3];return i.push([[s,a],h,[l+2*(n-l)/3,o+2*(r-o)/3],[l,o]]),i}function ut(){if(this.isEmpty())return void(0,H._)(this,cq,uo).call(this);(0,H._)(this,cR,c2).call(this);let{canvas:t,ctx:e}=this;for(let i of(e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t.width,t.height),(0,H._)(this,cq,uo).call(this),this.bezierPath2D))e.stroke(i)}function ue(){if((0,O._)(this,cy))return;(0,N._)(this,cy,new AbortController);let t=this._uiManager.combinedSignal((0,O._)(this,cy));this.canvas.addEventListener("pointerdown",this.canvasPointerdown.bind(this),{signal:t})}function ui(){var t;null==(t=this.pointerdownAC)||t.abort(),this.pointerdownAC=null}function us(t){var e;null==(e=(0,O._)(this,cv))||e.abort(),(0,N._)(this,cv,null),(0,H._)(this,cj,ue).call(this),(0,O._)(this,cf)&&clearTimeout((0,O._)(this,cf)),(0,N._)(this,cf,setTimeout(()=>{(0,N._)(this,cf,null),this.canvas.removeEventListener("contextmenu",t6)},10)),(0,H._)(this,cD,c4).call(this,t.offsetX,t.offsetY),this.addToAnnotationStorage(),this.setInBackground()}function ua(){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")}function un(){(0,N._)(this,cA,new ResizeObserver(t=>{let e=t[0].contentRect;e.width&&e.height&&this.setDimensions(e.width,e.height)})),(0,O._)(this,cA).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var t;null==(t=(0,O._)(this,cA))||t.disconnect(),(0,N._)(this,cA,null)},{once:!0})}function ur(){if(!(0,O._)(this,cw))return;let[t,e]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*e),(0,H._)(this,cq,uo).call(this)}function ul(t,e){let i=(0,H._)(this,cY,up).call(this),s=(t-i)/(0,O._)(this,cp),a=(e-i)/(0,O._)(this,c_);this.scaleFactor=Math.min(s,a)}function uo(){let t=(0,H._)(this,cY,up).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)}function uh(t){let e=new Path2D;for(let i=0,s=t.length;i<s;i++){let[s,a,n,r]=t[i];0===i&&e.moveTo(...s),e.bezierCurveTo(a[0],a[1],n[0],n[1],r[0],r[1])}return e}function ud(t,e,i){let[s,a,n,r]=e;switch(i){case 0:for(let e=0,i=t.length;e<i;e+=2)t[e]+=s,t[e+1]=r-t[e+1];break;case 90:for(let e=0,i=t.length;e<i;e+=2){let i=t[e];t[e]=t[e+1]+s,t[e+1]=i+a}break;case 180:for(let e=0,i=t.length;e<i;e+=2)t[e]=n-t[e],t[e+1]+=a;break;case 270:for(let e=0,i=t.length;e<i;e+=2){let i=t[e];t[e]=n-t[e+1],t[e+1]=r-i}break;default:throw Error("Invalid rotation")}return t}function uc(t,e,i){let[s,a,n,r]=e;switch(i){case 0:for(let e=0,i=t.length;e<i;e+=2)t[e]-=s,t[e+1]=r-t[e+1];break;case 90:for(let e=0,i=t.length;e<i;e+=2){let i=t[e];t[e]=t[e+1]-a,t[e+1]=i-s}break;case 180:for(let e=0,i=t.length;e<i;e+=2)t[e]=n-t[e],t[e+1]-=a;break;case 270:for(let e=0,i=t.length;e<i;e+=2){let i=t[e];t[e]=r-t[e+1],t[e+1]=n-i}break;default:throw Error("Invalid rotation")}return t}function uu(t,e,i,s){let a=[],n=this.thickness/2,r=t*e+n,l=t*i+n;for(let e of this.paths){let i=[],n=[];for(let s=0,a=e.length;s<a;s++){let[o,h,d,c]=e[s];if(o[0]===c[0]&&o[1]===c[1]&&1===a){let e=t*o[0]+r,s=t*o[1]+l;i.push(e,s),n.push(e,s);break}let u=t*o[0]+r,_=t*o[1]+l,p=t*h[0]+r,f=t*h[1]+l,g=t*d[0]+r,m=t*d[1]+l,v=t*c[0]+r,b=t*c[1]+l;0===s&&(i.push(u,_),n.push(u,_)),i.push(p,f,g,m,v,b),n.push(p,f),s===a-1&&n.push(v,b)}a.push({bezier:(0,q._)(cJ,cJ,ud).call(cJ,i,s,this.rotation),points:(0,q._)(cJ,cJ,ud).call(cJ,n,s,this.rotation)})}return a}function u_(){let t=1/0,e=-1/0,i=1/0,s=-1/0;for(let a of this.paths)for(let[n,r,l,o]of a){let a=tH.bezierBoundingBox(...n,...r,...l,...o);t=Math.min(t,a[0]),i=Math.min(i,a[1]),e=Math.max(e,a[2]),s=Math.max(s,a[3])}return[t,i,e,s]}function up(){return(0,O._)(this,cm)?Math.ceil(this.thickness*this.parentScale):0}function uf(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return;if(!(0,O._)(this,cm))return void(0,H._)(this,cN,ut).call(this);let e=(0,H._)(this,cX,u_).call(this),i=(0,H._)(this,cY,up).call(this);(0,N._)(this,cp,Math.max(s8.MIN_SIZE,e[2]-e[0])),(0,N._)(this,c_,Math.max(s8.MIN_SIZE,e[3]-e[1]));let s=Math.ceil(i+(0,O._)(this,cp)*this.scaleFactor),a=Math.ceil(i+(0,O._)(this,c_)*this.scaleFactor),[n,r]=this.parentDimensions;this.width=s/n,this.height=a/r,this.setAspectRatio(s,a);let l=this.translationX,o=this.translationY;this.translationX=-e[0],this.translationY=-e[1],(0,H._)(this,cU,ur).call(this),(0,H._)(this,cN,ut).call(this),(0,N._)(this,cS,s),(0,N._)(this,cx,a),this.setDims(s,a);let h=t?i/this.scaleFactor/2:0;this.translate(l-this.translationX-h,o-this.translationY-h)}cJ._defaultColor=null,cJ._defaultOpacity=1,cJ._defaultThickness=1,cJ._type="ink",cJ._editorType=td.INK;var ug=new WeakMap,um=new WeakMap,uv=new WeakMap,ub=new WeakMap,uw=new WeakMap,uA=new WeakMap,uy=new WeakMap,uS=new WeakMap,ux=new WeakMap,uE=new WeakMap,uk=new WeakMap,uM=new WeakSet,uC=new WeakSet,uT=new WeakSet,uR=new WeakSet,uL=new WeakSet,uP=new WeakSet,uI=new WeakSet,uD=new WeakSet,uF=new WeakSet,uO=new WeakSet;class uW extends s8{static initialize(t,e){s8.initialize(t,e)}static get supportedTypes(){return tk(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map(t=>"image/".concat(t)))}static get supportedTypesStr(){return tk(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(t){return this.supportedTypes.includes(t)}static paste(t,e){e.pasteEditor(td.STAMP,{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var t;return{type:"stamp",hasAltText:!!(null==(t=this.altTextData)?void 0:t.altText)}}static computeTelemetryFinalData(t){var e,i;let s=t.get("hasAltText");return{hasAltText:null!=(e=s.get(!0))?e:0,hasNoAltText:null!=(i=s.get(!1))?i:0}}async mlGuessAltText(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(this.hasAltTextData())return null;let{mlManager:i}=this._uiManager;if(!i)throw Error("No ML.");if(!await i.isEnabledFor("altText"))throw Error("ML isn't enabled for alt text.");let{data:s,width:a,height:n}=t||this.copyCanvas(null,null,!0).imageData,r=await i.guess({name:"altText",request:{data:s,width:a,height:n,
1channels:s.length/(a*n)}});if(!r)throw Error("No response from the AI service.");if(r.error)throw Error("Error from the AI service.");if(r.cancel)return null;if(!r.output)throw Error("No valid response from the AI service.");let l=r.output;return await this.setGuessedAltText(l),e&&!this.hasAltTextData()&&(this.altTextData={alt:l,decorative:!1}),l}remove(){if((0,O._)(this,um)){var t,e;(0,N._)(this,ug,null),this._uiManager.imageManager.deleteId((0,O._)(this,um)),null==(t=(0,O._)(this,uy))||t.remove(),(0,N._)(this,uy,null),null==(e=(0,O._)(this,uS))||e.disconnect(),(0,N._)(this,uS,null),(0,O._)(this,ux)&&(clearTimeout((0,O._)(this,ux)),(0,N._)(this,ux,null))}super.remove()}rebuild(){if(!this.parent){(0,O._)(this,um)&&(0,H._)(this,uT,uH).call(this);return}super.rebuild(),null!==this.div&&((0,O._)(this,um)&&null===(0,O._)(this,uy)&&(0,H._)(this,uT,uH).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!((0,O._)(this,uv)||(0,O._)(this,ug)||(0,O._)(this,ub)||(0,O._)(this,uw)||(0,O._)(this,um))}get isResizable(){return!0}render(){let t,e;if(this.div)return this.div;if(this.width&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.div.setAttribute("role","figure"),this.addAltTextButton(),(0,O._)(this,ug)?(0,H._)(this,uR,uB).call(this):(0,H._)(this,uT,uH).call(this),this.width&&!this.annotationElementId){let[i,s]=this.parentDimensions;this.setAt(t*i,e*s,this.width*i,this.height*s)}return this.div}copyCanvas(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t||(t=224);let{width:s,height:a}=(0,O._)(this,ug),n=new ea,r=(0,O._)(this,ug),l=s,o=a,h=null;if(e){var d,c;if(s>e||a>e){let t=Math.min(e/s,e/a);l=Math.floor(s*t),o=Math.floor(a*t)}let t=(h=document.createElement("canvas")).width=Math.ceil(l*n.sx),i=h.height=Math.ceil(o*n.sy);(0,O._)(this,uE)||(r=(0,H._)(this,uP,uz).call(this,t,i));let u=h.getContext("2d");u.filter=this._uiManager.hcmFilter;let _="white",p="#cfcfd8";"none"!==this._uiManager.hcmFilter?p="black":(null==(d=(c=window).matchMedia)?void 0:d.call(c,"(prefers-color-scheme: dark)").matches)&&(_="#8f8f9d",p="#42414d");let f=15*n.sx,g=15*n.sy,m=new OffscreenCanvas(2*f,2*g),v=m.getContext("2d");v.fillStyle=_,v.fillRect(0,0,2*f,2*g),v.fillStyle=p,v.fillRect(0,0,f,g),v.fillRect(f,g,f,g),u.fillStyle=u.createPattern(m,"repeat"),u.fillRect(0,0,t,i),u.drawImage(r,0,0,r.width,r.height,0,0,t,i)}let u=null;if(i){let e,i;if(n.symmetric&&r.width<t&&r.height<t)e=r.width,i=r.height;else if(r=(0,O._)(this,ug),s>t||a>t){let n=Math.min(t/s,t/a);e=Math.floor(s*n),i=Math.floor(a*n),(0,O._)(this,uE)||(r=(0,H._)(this,uP,uz).call(this,e,i))}let l=new OffscreenCanvas(e,i).getContext("2d",{willReadFrequently:!0});l.drawImage(r,0,0,r.width,r.height,0,0,e,i),u={width:e,height:i,data:l.getImageData(0,0,e,i).data}}return{canvas:h,width:l,height:o,imageData:u}}getImageForAltText(){return(0,O._)(this,uy)}static async deserialize(t,e,i){let s=null;if(t instanceof oN){var a;let{data:{rect:n,rotation:r,id:l,structParent:o,popupRef:h},container:d,parent:{page:{pageNumber:c}}}=t,u=d.querySelector("canvas"),_=i.imageManager.getFromCanvas(d.id,u);u.remove();let p=(null==(a=await e._structTree.getAriaAttributes("".concat(tq).concat(l)))?void 0:a.get("aria-label"))||"";s=t={annotationType:td.STAMP,bitmapId:_.id,bitmap:_.bitmap,pageIndex:c-1,rect:n.slice(0),rotation:r,id:l,deleted:!1,accessibilityData:{decorative:!1,altText:p},isSvg:!1,structParent:o,popupRef:h}}let n=await super.deserialize(t,e,i),{rect:r,bitmap:l,bitmapUrl:o,bitmapId:h,isSvg:d,accessibilityData:c}=t;h&&i.imageManager.isValidId(h)?((0,N._)(n,um,h),l&&(0,N._)(n,ug,l)):(0,N._)(n,ub,o),(0,N._)(n,uE,d);let[u,_]=n.pageDimensions;return n.width=(r[2]-r[0])/u,n.height=(r[3]-r[1])/_,n.annotationElementId=t.id||null,c&&(n.altTextData=c),n._initialData=s,(0,N._)(n,uk,!!s),n}serialize(){var t;let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let s={annotationType:td.STAMP,bitmapId:(0,O._)(this,um),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:(0,O._)(this,uE),structTreeParentId:this._structTreeParentId};if(e)return s.bitmapUrl=(0,H._)(this,uD,uV).call(this,!0),s.accessibilityData=this.serializeAltText(!0),s;let{decorative:a,altText:n}=this.serializeAltText(!1);if(!a&&n&&(s.accessibilityData={type:"Figure",alt:n}),this.annotationElementId){let e=(0,H._)(this,uO,uK).call(this,s);if(e.isSame)return null;e.isSameAltText?delete s.accessibilityData:s.accessibilityData.structParent=null!=(t=this._initialData.structParent)?t:-1}if(s.id=this.annotationElementId,null===i)return s;i.stamps||(i.stamps=new Map);let r=(0,O._)(this,uE)?(s.rect[2]-s.rect[0])*(s.rect[3]-s.rect[1]):null;if(i.stamps.has((0,O._)(this,um))){if((0,O._)(this,uE)){let t=i.stamps.get((0,O._)(this,um));r>t.area&&(t.area=r,t.serialized.bitmap.close(),t.serialized.bitmap=(0,H._)(this,uD,uV).call(this,!1))}}else i.stamps.set((0,O._)(this,um),{area:r,serialized:s}),s.bitmap=(0,H._)(this,uD,uV).call(this,!1);return s}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}constructor(t){super({...t,name:"stampEditor"}),(0,B._)(this,uM),(0,B._)(this,uC),(0,B._)(this,uT),(0,B._)(this,uR),(0,B._)(this,uL),(0,B._)(this,uP),(0,B._)(this,uI),(0,B._)(this,uD),(0,B._)(this,uF),(0,B._)(this,uO),(0,W._)(this,ug,{writable:!0,value:void 0}),(0,W._)(this,um,{writable:!0,value:void 0}),(0,W._)(this,uv,{writable:!0,value:void 0}),(0,W._)(this,ub,{writable:!0,value:void 0}),(0,W._)(this,uw,{writable:!0,value:void 0}),(0,W._)(this,uA,{writable:!0,value:void 0}),(0,W._)(this,uy,{writable:!0,value:void 0}),(0,W._)(this,uS,{writable:!0,value:void 0}),(0,W._)(this,ux,{writable:!0,value:void 0}),(0,W._)(this,uE,{writable:!0,value:void 0}),(0,W._)(this,uk,{writable:!0,value:void 0}
1),(0,N._)(this,ug,null),(0,N._)(this,um,null),(0,N._)(this,uv,null),(0,N._)(this,ub,null),(0,N._)(this,uw,null),(0,N._)(this,uA,""),(0,N._)(this,uy,null),(0,N._)(this,uS,null),(0,N._)(this,ux,null),(0,N._)(this,uE,!1),(0,N._)(this,uk,!1),(0,N._)(this,ub,t.bitmapUrl),(0,N._)(this,uw,t.bitmapFile)}}function uN(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t)return void this.remove();(0,N._)(this,ug,t.bitmap),e||((0,N._)(this,um,t.id),(0,N._)(this,uE,t.isSvg)),t.file&&(0,N._)(this,uA,t.file.name),(0,H._)(this,uR,uB).call(this)}function uj(){if((0,N._)(this,uv,null),this._uiManager.enableWaiting(!1),(0,O._)(this,uy)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&(0,O._)(this,ug)){this._editToolbar.hide(),this._uiManager.editAltText(this,!0);return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&(0,O._)(this,ug)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch(t){}}this.div.focus()}}function uH(){if((0,O._)(this,um)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId((0,O._)(this,um)).then(t=>(0,H._)(this,uM,uN).call(this,t,!0)).finally(()=>(0,H._)(this,uC,uj).call(this));return}if((0,O._)(this,ub)){let t=(0,O._)(this,ub);(0,N._)(this,ub,null),this._uiManager.enableWaiting(!0),(0,N._)(this,uv,this._uiManager.imageManager.getFromUrl(t).then(t=>(0,H._)(this,uM,uN).call(this,t)).finally(()=>(0,H._)(this,uC,uj).call(this)));return}if((0,O._)(this,uw)){let t=(0,O._)(this,uw);(0,N._)(this,uw,null),this._uiManager.enableWaiting(!0),(0,N._)(this,uv,this._uiManager.imageManager.getFromFile(t).then(t=>(0,H._)(this,uM,uN).call(this,t)).finally(()=>(0,H._)(this,uC,uj).call(this)));return}let t=document.createElement("input");t.type="file",t.accept=uW.supportedTypesStr;let e=this._uiManager._signal;(0,N._)(this,uv,new Promise(i=>{t.addEventListener("change",async()=>{if(t.files&&0!==t.files.length){this._uiManager.enableWaiting(!0);let e=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),(0,H._)(this,uM,uN).call(this,e)}else this.remove();i()},{signal:e}),t.addEventListener("cancel",()=>{this.remove(),i()},{signal:e})}).finally(()=>(0,H._)(this,uC,uj).call(this))),t.click()}function uB(){let{div:t}=this,{width:e,height:i}=(0,O._)(this,ug),[s,a]=this.pageDimensions;if(this.width)e=this.width*s,i=this.height*a;else if(e>.75*s||i>.75*a){let t=Math.min(.75*s/e,.75*a/i);e*=t,i*=t}let[n,r]=this.parentDimensions;this.setDims(e*n/s,i*r/a),this._uiManager.enableWaiting(!1);let l=(0,N._)(this,uy,document.createElement("canvas"));l.setAttribute("role","img"),this.addContainer(l),this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&!this.annotationElementId||(t.hidden=!1),(0,H._)(this,uI,uU).call(this,e,i),(0,H._)(this,uF,uq).call(this),(0,O._)(this,uk)||(this.parent.addUndoableEditor(this),(0,N._)(this,uk,!0)),this._reportTelemetry({action:"inserted_image"}),(0,O._)(this,uA)&&l.setAttribute("aria-label",(0,O._)(this,uA))}function uG(t,e){var i;let[s,a]=this.parentDimensions;this.width=t/s,this.height=e/a,(null==(i=this._initialOptions)?void 0:i.isCentered)?this.center():this.fixAndSetPosition(),this._initialOptions=null,null!==(0,O._)(this,ux)&&clearTimeout((0,O._)(this,ux)),(0,N._)(this,ux,setTimeout(()=>{(0,N._)(this,ux,null),(0,H._)(this,uI,uU).call(this,t,e)},200))}function uz(t,e){let{width:i,height:s}=(0,O._)(this,ug),a=i,n=s,r=(0,O._)(this,ug);for(;a>2*t||n>2*e;){let i=a,s=n;a>2*t&&(a=a>=16384?Math.floor(a/2)-1:Math.ceil(a/2)),n>2*e&&(n=n>=16384?Math.floor(n/2)-1:Math.ceil(n/2));let l=new OffscreenCanvas(a,n);l.getContext("2d").drawImage(r,0,0,i,s,0,0,a,n),r=l.transferToImageBitmap()}return r}function uU(t,e){let i=new ea,s=Math.ceil(t*i.sx),a=Math.ceil(e*i.sy),n=(0,O._)(this,uy);if(!n||n.width===s&&n.height===a)return;n.width=s,n.height=a;let r=(0,O._)(this,uE)?(0,O._)(this,ug):(0,H._)(this,uP,uz).call(this,s,a),l=n.getContext("2d");l.filter=this._uiManager.hcmFilter,l.drawImage(r,0,0,r.width,r.height,0,0,s,a)}function uV(t){if(t){if((0,O._)(this,uE)){let t=this._uiManager.imageManager.getSvgUrl((0,O._)(this,um));if(t)return t}let t=document.createElement("canvas");return{width:t.width,height:t.height}=(0,O._)(this,ug),t.getContext("2d").drawImage((0,O._)(this,ug),0,0),t.toDataURL()}if((0,O._)(this,uE)){let[t,e]=this.pageDimensions,i=Math.round(this.width*t*tY.PDF_TO_CSS_UNITS),s=Math.round(this.height*e*tY.PDF_TO_CSS_UNITS),a=new OffscreenCanvas(i,s);return a.getContext("2d").drawImage((0,O._)(this,ug),0,0,(0,O._)(this,ug).width,(0,O._)(this,ug).height,0,0,i,s),a.transferToImageBitmap()}return structuredClone((0,O._)(this,ug))}function uq(){this._uiManager._signal&&((0,N._)(this,uS,new ResizeObserver(t=>{let e=t[0].contentRect;e.width&&e.height&&(0,H._)(this,uL,uG).call(this,e.width,e.height)})),(0,O._)(this,uS).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var t;null==(t=(0,O._)(this,uS))||t.disconnect(),(0,N._)(this,uS,null)},{once:!0}))}function uK(t){var e;let{rect:i,pageIndex:s,accessibilityData:{altText:a}}=this._initialData,n=t.rect.every((t,e)=>1>Math.abs(t-i[e])),r=t.pageIndex===s,l=((null==(e=t.accessibilityData)?void 0:e.alt)||"")===a;return{isSame:n&&r&&l,isSameAltText:l}}uW._type="stamp",uW._editorType=td.STAMP;var uX=new WeakMap,uY=new WeakMap,uQ=new WeakMap,uJ=new WeakMap,uZ=new WeakMap,u$=new WeakMap,u0=new WeakMap,u1=new WeakMap,u2=new WeakMap,u3=new WeakMap,u5=new WeakMap,u6=new WeakMap,u4=new WeakSet,u8=new WeakMap,u7=new WeakSet,u9=new WeakSet,_t=new WeakSet;class _e{get isEmpty(){return 0===(0,O._)(this,u$).size}get isInvisible(){return this.isEmpty&&(0,O._)(this,u6).getMode()===td.NONE}updateToolbar(t){(0,O._)(this,u6).updateToolbar(t)}updateMode(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,O._)(this,u6).getMode();switch((0,H._)(this,_t,_l).call(this),t){case td.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case td.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case td.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:e}=this.div;for(let i of(0,G._)(_e,_e,_i).values())e.toggle("".concat(i._type,"Editing"),t===i._editorType);this.div.hidden=!1}hasTextLayer(t){var e;return t===(null==(e=(0,O._)(this,u3))?void 0:e.div)}addInkEditorIfNeeded(t){if((0,O._)(this,u6).getMode()===td.INK){if(!t){for(let t of(0,O._)(this,u$).values())if(t.isEmpty())return void t.setInBackgroun
1d()}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}}setEditingState(t){(0,O._)(this,u6).setEditingState(t)}addCommands(t){(0,O._)(this,u6).addCommands(t)}toggleDrawing(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("drawing",!t)}togglePointerEvents(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(){var t;let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];null==(t=(0,O._)(this,uQ))||t.div.classList.toggle("disabled",!e)}async enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);let t=new Set;for(let e of(0,O._)(this,u$).values())e.enableEditing(),e.show(!0),e.annotationElementId&&((0,O._)(this,u6).removeChangedExistingAnnotation(e),t.add(e.annotationElementId));if((0,O._)(this,uQ))for(let e of(0,O._)(this,uQ).getEditableAnnotations()){if(e.hide(),(0,O._)(this,u6).isDeletedAnnotationElement(e.data.id)||t.has(e.data.id))continue;let i=await this.deserialize(e);i&&(this.addOrRebuild(i),i.enableEditing())}}disable(){(0,N._)(this,u2,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1);let t=new Map,e=new Map;for(let s of(0,O._)(this,u$).values()){var i;if(s.disableEditing(),s.annotationElementId){if(null!==s.serialize()){t.set(s.annotationElementId,s);continue}e.set(s.annotationElementId,s),null==(i=this.getEditableAnnotation(s.annotationElementId))||i.show(),s.remove()}}if((0,O._)(this,uQ))for(let i of(0,O._)(this,uQ).getEditableAnnotations()){let{id:s}=i.data;if((0,O._)(this,u6).isDeletedAnnotationElement(s))continue;let a=e.get(s);if(a){a.resetAnnotationElement(i),a.show(!1),i.show();continue}(a=t.get(s))&&((0,O._)(this,u6).addChangedExistingAnnotation(a),a.renderAnnotationElement(i)&&a.show(!1)),i.show()}(0,H._)(this,_t,_l).call(this),this.isEmpty&&(this.div.hidden=!0);let{classList:s}=this.div;for(let t of(0,G._)(_e,_e,_i).values())s.remove("".concat(t._type,"Editing"));this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),(0,N._)(this,u2,!1)}getEditableAnnotation(t){var e;return(null==(e=(0,O._)(this,uQ))?void 0:e.getEditableAnnotation(t))||null}setActiveEditor(t){(0,O._)(this,u6).getActive()!==t&&(0,O._)(this,u6).setActiveEditor(t)}enableTextSelection(){var t;if(this.div.tabIndex=-1,(null==(t=(0,O._)(this,u3))?void 0:t.div)&&!(0,O._)(this,u5)){(0,N._)(this,u5,new AbortController);let t=(0,O._)(this,u6).combinedSignal((0,O._)(this,u5));(0,O._)(this,u3).div.addEventListener("pointerdown",(0,H._)(this,u4,_s).bind(this),{signal:t}),(0,O._)(this,u3).div.classList.add("highlighting")}}disableTextSelection(){var t;this.div.tabIndex=0,(null==(t=(0,O._)(this,u3))?void 0:t.div)&&(0,O._)(this,u5)&&((0,O._)(this,u5).abort(),(0,N._)(this,u5,null),(0,O._)(this,u3).div.classList.remove("highlighting"))}enableClick(){if((0,O._)(this,uJ))return;(0,N._)(this,uJ,new AbortController);let t=(0,O._)(this,u6).combinedSignal((0,O._)(this,uJ));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t}),this.div.addEventListener("pointerup",this.pointerup.bind(this),{signal:t})}disableClick(){var t;null==(t=(0,O._)(this,uJ))||t.abort(),(0,N._)(this,uJ,null)}attach(t){(0,O._)(this,u$).set(t.id,t);let{annotationElementId:e}=t;e&&(0,O._)(this,u6).isDeletedAnnotationElement(e)&&(0,O._)(this,u6).removeDeletedAnnotationElement(t)}detach(t){var e;(0,O._)(this,u$).delete(t.id),null==(e=(0,O._)(this,uX))||e.removePointerInTextLayer(t.contentDiv),!(0,O._)(this,u2)&&t.annotationElementId&&(0,O._)(this,u6).addDeletedAnnotationElement(t)}remove(t){this.detach(t),(0,O._)(this,u6).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1,(0,O._)(this,u1)||this.addInkEditorIfNeeded(!1)}changeParent(t){var e;t.parent!==this&&(t.parent&&t.annotationElementId&&((0,O._)(this,u6).addDeletedAnnotationElement(t.annotationElementId),s8.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),null==(e=t.parent)||e.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(t.parent!==this||!t.isAttachedToDOM){if(this.changeParent(t),(0,O._)(this,u6).addEditor(t),this.attach(t),!t.isAttachedToDOM){let e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(),(0,O._)(this,u6).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){var e;if(!t.isAttachedToDOM)return;let{activeElement:i}=document;t.div.contains(i)&&!(0,O._)(this,uZ)&&(t._focusEventsAllowed=!1,(0,N._)(this,uZ,setTimeout(()=>{(0,N._)(this,uZ,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:(0,O._)(this,u6)._signal}),i.focus())},0))),t._structTreeParentId=null==(e=(0,O._)(this,uX))?void 0:e.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||(t.parent=this),t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){this.addCommands({cmd:()=>t._uiManager.rebuild(t),undo:()=>{t.remove()},mustExec:!1})}getNextId(){return(0,O._)(this,u6).getId()}combinedSignal(t){return(0,O._)(this,u6).combinedSignal(t)}canCreateNewEmptyEditor(){var t;return null==(t=(0,O._)(this,u8))?void 0:t.canCreateNewEmptyEditor()}pasteEditor(t,e){(0,O._)(this,u6).updateToolbar(t),(0,O._)(this,u6).updateMode(t);let{offsetX:i,offsetY:s}=(0,H._)(this,u9,_r).call(this),a=this.getNextId(),n=(0,H._)(this,u7,_n).call(this,{parent:this,id:a,x:i,y:s,uiManager:(0,O._)(this,u6),isCentered:!0,...e});n&&this.add(n)}async deserialize(t){var e,i;return await (null==(e=(0,G._)(_e,_e,_i).get(null!=(i=t.annotationType)?i:t.annotationEditorType))?void 0:e.deserialize(t,this,(0,O._)(this,u6)))||null}createAndAddNewEditor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},s=this.getNextId(),a=(0,H._)(this,u7,_n).call(this,{parent:this,id:s,x:t.offsetX,y:t.offsetY,uiManager:(0,O._)(this,u6),isCentered:e,...i});return a&&this.add(a),a}addNewEditor(){this.createAndAddNewEditor((0,H._)(this,u9,_r).call(this),!0)}setSelected(t){(0,O._)(this,u6).setSelected(t)}toggleSelected(t){(0,O._)(this,u6).toggleSelected(t)}unselect(t){(0,O._)(this,u6).unselect(t)}pointerup(t){let{isMac:e}=tN.platform;if(0===t.button&&(!t.ctrlKey||!e)&&t.target===this.div&&(0,O._)(this,u0)){if((0,N._)(this,u0,!1),!(0,O._)(this,uY))return void(0,N._)(this,uY,!0);if((0,O._)(this,u6).getMode()===td.STAMP)return void(0,O._)(this,u6).unselectAll();this.createAndAddNewEditor(t,!1)}}pointerdown(t){if((0,O._)(this,u6).getMode()===td.HIGHLIGHT&&this.enableTextSelection(),(0,O._)(this,u0))return void(0,N._)(this,u0,!1);let{isMac:e}=tN.platform;if(0!==t.button||t.ctrlKey&&e||t.target!==this.div)return;(0,N._)(this,u0,!0);let i=(0,O._)(this,u6).getActive();(0,N._)(this,uY,!i||i.isEmpty())}findNewParent(t,e,i){let s=(0,O._)(this,u6).findParent(e,i);return null!==s&&s!==this&&(s.changeParent(t),!0)}destroy(){var t,e;for(let i of((null==(t=(0,O._)(this,u6).getActive())?void 0:t.parent)===this&&((0,O._)(this,u6).commitOrRemove(),(0,O._)(this,u6).setA
1ctiveEditor(null)),(0,O._)(this,uZ)&&(clearTimeout((0,O._)(this,uZ)),(0,N._)(this,uZ,null)),(0,O._)(this,u$).values()))null==(e=(0,O._)(this,uX))||e.removePointerInTextLayer(i.contentDiv),i.setParent(null),i.isAttachedToDOM=!1,i.div.remove();this.div=null,(0,O._)(this,u$).clear(),(0,O._)(this,u6).removeLayer(this)}render(t){let{viewport:e}=t;for(let t of(this.viewport=e,es(this.div,e),(0,O._)(this,u6).getEditors(this.pageIndex)))this.add(t),t.rebuild();this.updateMode()}update(t){let{viewport:e}=t;(0,O._)(this,u6).commitOrRemove(),(0,H._)(this,_t,_l).call(this);let i=this.viewport.rotation,s=e.rotation;if(this.viewport=e,es(this.div,{rotation:s}),i!==s)for(let t of(0,O._)(this,u$).values())t.rotate(s);this.addInkEditorIfNeeded(!1)}get pageDimensions(){let{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return(0,O._)(this,u6).viewParameters.realScale}constructor({uiManager:t,pageIndex:e,div:i,structTreeLayer:s,accessibilityManager:a,annotationLayer:n,drawLayer:r,textLayer:l,viewport:o,l10n:h}){(0,B._)(this,u4),(0,W._)(this,u8,{get:_a,set:void 0}),(0,B._)(this,u7),(0,B._)(this,u9),(0,B._)(this,_t),(0,W._)(this,uX,{writable:!0,value:void 0}),(0,W._)(this,uY,{writable:!0,value:void 0}),(0,W._)(this,uQ,{writable:!0,value:void 0}),(0,W._)(this,uJ,{writable:!0,value:void 0}),(0,W._)(this,uZ,{writable:!0,value:void 0}),(0,W._)(this,u$,{writable:!0,value:void 0}),(0,W._)(this,u0,{writable:!0,value:void 0}),(0,W._)(this,u1,{writable:!0,value:void 0}),(0,W._)(this,u2,{writable:!0,value:void 0}),(0,W._)(this,u3,{writable:!0,value:void 0}),(0,W._)(this,u5,{writable:!0,value:void 0}),(0,W._)(this,u6,{writable:!0,value:void 0}),(0,N._)(this,uY,!1),(0,N._)(this,uQ,null),(0,N._)(this,uJ,null),(0,N._)(this,uZ,null),(0,N._)(this,u$,new Map),(0,N._)(this,u0,!1),(0,N._)(this,u1,!1),(0,N._)(this,u2,!1),(0,N._)(this,u3,null),(0,N._)(this,u5,null);let d=[...(0,G._)(_e,_e,_i).values()];if(!_e._initialized)for(let e of(_e._initialized=!0,d))e.initialize(h,t);t.registerEditorTypes(d),(0,N._)(this,u6,t),this.pageIndex=e,this.div=i,(0,N._)(this,uX,a),(0,N._)(this,uQ,n),this.viewport=o,(0,N._)(this,u3,l),this.drawLayer=r,this._structTree=s,(0,O._)(this,u6).addLayer(this)}}_e._initialized=!1;var _i={writable:!0,value:new Map([o3,cJ,uW,d4].map(t=>[t._editorType,t]))};function _s(t){(0,O._)(this,u6).unselectAll();let{target:e}=t;if(e===(0,O._)(this,u3).div||("img"===e.getAttribute("role")||e.classList.contains("endOfContent"))&&(0,O._)(this,u3).div.contains(e)){let{isMac:e}=tN.platform;if(0!==t.button||t.ctrlKey&&e)return;(0,O._)(this,u6).showAllEditors("highlight",!0,!0),(0,O._)(this,u3).div.classList.add("free"),this.toggleDrawing(),d4.startHighlighting(this,"ltr"===(0,O._)(this,u6).direction,{target:(0,O._)(this,u3).div,x:t.x,y:t.y}),(0,O._)(this,u3).div.addEventListener("pointerup",()=>{(0,O._)(this,u3).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:(0,O._)(this,u6)._signal}),t.preventDefault()}}function _a(){return(0,G._)(_e,_e,_i).get((0,O._)(this,u6).getMode())}function _n(t){let e=(0,O._)(this,u8);return e?new e.prototype.constructor(t):null}function _r(){let{x:t,y:e,width:i,height:s}=this.div.getBoundingClientRect(),a=Math.max(0,t),n=Math.max(0,e),r=Math.min(window.innerWidth,t+i),l=Math.min(window.innerHeight,e+s),o=(a+r)/2-t,h=(n+l)/2-e,[d,c]=this.viewport.rotation%180==0?[o,h]:[h,o];return{offsetX:d,offsetY:c}}function _l(){for(let t of((0,N._)(this,u1,!0),(0,O._)(this,u$).values()))t.isEmpty()&&t.remove();(0,N._)(this,u1,!1)}var _o=new WeakMap,_h=new WeakMap,_d=new WeakMap,_c=new WeakMap,_u=new WeakSet,__=new WeakSet;class _p{setParent(t){if(!(0,O._)(this,_o))return void(0,N._)(this,_o,t);if((0,O._)(this,_o)!==t){if((0,O._)(this,_d).size>0)for(let e of(0,O._)(this,_d).values())e.remove(),t.append(e);(0,N._)(this,_o,t)}}static get _svgFactory(){return tk(this,"_svgFactory",new lw)}draw(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=(0,j._)(this,_h).value++,n=(0,H._)(this,_u,_g).call(this,t.box);n.classList.add(...t.classNamesForDrawing);let r=_p._svgFactory.createElement("defs");n.append(r);let l=_p._svgFactory.createElement("path");r.append(l);let o="path_p".concat(this.pageIndex,"_").concat(a);l.setAttribute("id",o),l.setAttribute("d",t.toSVGPath()),s&&(0,O._)(this,_c).set(a,l);let h=(0,H._)(this,__,_m).call(this,r,o),d=_p._svgFactory.createElement("use");return n.append(d),n.setAttribute("fill",e),n.setAttribute("fill-opacity",i),d.setAttribute("href","#".concat(o)),(0,O._)(this,_d).set(a,n),{id:a,clipPathId:"url(#".concat(h,")")}}drawOutline(t){let e,i=(0,j._)(this,_h).value++,s=(0,H._)(this,_u,_g).call(this,t.box);s.classList.add(...t.classNamesForOutlining);let a=_p._svgFactory.createElement("defs");s.append(a);let n=_p._svgFactory.createElement("path");a.append(n);let r="path_p".concat(this.pageIndex,"_").concat(i);if(n.setAttribute("id",r),n.setAttribute("d",t.toSVGPath()),n.setAttribute("vector-effect","non-scaling-stroke"),t.mustRemoveSelfIntersections){let t=_p._svgFactory.createElement("mask");a.append(t),e="mask_p".concat(this.pageIndex,"_").concat(i),t.setAttribute("id",e),t.setAttribute("maskUnits","objectBoundingBox");let s=_p._svgFactory.createElement("rect");t.append(s),s.setAttribute("width","1"),s.setAttribute("height","1"),s.setAttribute("fill","white");let n=_p._svgFactory.createElement("use");t.append(n),n.setAttribute("href","#".concat(r)),n.setAttribute("stroke","none"),n.setAttribute("fill","black"),n.setAttribute("fill-rule","nonzero"),n.classList.add("mask")}let l=_p._svgFactory.createElement("use");s.append(l),l.setAttribute("href","#".concat(r)),e&&l.setAttribute("mask","url(#".concat(e,")"));let o=l.cloneNode();return s.append(o),l.classList.add("mainOutline"),o.classList.add("secondaryOutline"),(0,O._)(this,_d).set(i,s),i}finalizeLine(t,e){let i=(0,O._)(this,_c).get(t);(0,O._)(this,_c).delete(t),this.updateBox(t,e.box),i.setAttribute("d",e.toSVGPath())}updateLine(t,e){(0,O._)(this,_d).get(t).firstChild.firstChild.setAttribute("d",e.toSVGPath())}updatePath(t,e){(0,O._)(this,_c).get(t).setAttribute("d",e.toSVGPath())}updateBox(t,e){(0,q._)(_p,_p,_f).call(_p,(0,O._)(this,_d).get(t),e)}show(t,e){(0,O._)(this,_d).get(t).classList.toggle("hidden",!e)}rotate(t,e){(0,O._)(this,_d).get(t).setAttribute("data-main-rotation",e)}changeColor(t,e){(0,O._)(this,_d).get(t).setAttribute("fill",e)}
1changeOpacity(t,e){(0,O._)(this,_d).get(t).setAttribute("fill-opacity",e)}addClass(t,e){(0,O._)(this,_d).get(t).classList.add(e)}removeClass(t,e){(0,O._)(this,_d).get(t).classList.remove(e)}getSVGRoot(t){return(0,O._)(this,_d).get(t)}remove(t){(0,O._)(this,_c).delete(t),null!==(0,O._)(this,_o)&&((0,O._)(this,_d).get(t).remove(),(0,O._)(this,_d).delete(t))}destroy(){for(let t of((0,N._)(this,_o,null),(0,O._)(this,_d).values()))t.remove();(0,O._)(this,_d).clear(),(0,O._)(this,_c).clear()}constructor({pageIndex:t}){(0,B._)(this,_u),(0,B._)(this,__),(0,W._)(this,_o,{writable:!0,value:void 0}),(0,W._)(this,_h,{writable:!0,value:void 0}),(0,W._)(this,_d,{writable:!0,value:void 0}),(0,W._)(this,_c,{writable:!0,value:void 0}),(0,N._)(this,_o,null),(0,N._)(this,_h,0),(0,N._)(this,_d,new Map),(0,N._)(this,_c,new Map),this.pageIndex=t}}function _f(t){let{x:e=0,y:i=0,width:s=1,height:a=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{style:n}=t;n.top="".concat(100*i,"%"),n.left="".concat(100*e,"%"),n.width="".concat(100*s,"%"),n.height="".concat(100*a,"%")}
1function _g(t){let e=_p._svgFactory.create(1,1,!0);return(0,O._)(this,_o).append(e),e.setAttribute("aria-hidden",!0),(0,q._)(_p,_p,_f).call(_p,e,t),e}function _m(t,e){let i=_p._svgFactory.createElement("clipPath");t.append(i);let s="clip_".concat(e);i.setAttribute("id",s),i.setAttribute("clipPathUnits","objectBoundingBox");let a=_p._svgFactory.createElement("use");return i.append(a),a.setAttribute("href","#".concat(e)),a.classList.add("clip"),s}var _v=ta.AbortException,_b=ta.AnnotationEditorLayer,_w=ta.AnnotationEditorParamsType,_A=ta.AnnotationEditorType,_y=ta.AnnotationEditorUIManager,_S=ta.AnnotationLayer,_x=ta.AnnotationMode,_E=ta.ColorPicker,_k=ta.DOMSVGFactory,_M=ta.DrawLayer,_C=ta.FeatureTest,_T=ta.GlobalWorkerOptions,_R=ta.ImageKind,_L=ta.InvalidPDFException,_P=ta.MissingPDFException,_I=ta.OPS,_D=ta.OutputScale,_F=ta.PDFDataRangeTransport,_O=ta.PDFDateString,_W=ta.PDFWorker,_N=ta.PasswordResponses,_j=ta.PermissionFlag,_H=ta.PixelsPerInch,_B=ta.RenderingCancelledException,_G=ta.TextLayer,_z=ta.UnexpectedResponseException,_U=ta.Util,_V=ta.VerbosityLevel,_q=ta.XfaLayer,_K=ta.build,_X=ta.createValidAbsoluteUrl,_Y=ta.fetchData,_Q=ta.getDocument,_J=ta.getFilenameFromUrl,_Z=ta.getPdfFilenameFromUrl,_$=ta.getXfaPageViewport,_0=ta.isDataScheme,_1=ta.isPdfFile,_2=ta.noContextMenu,_3=ta.normalizeUnicode,_5=ta.setLayerDimensions,_6=ta.shadow,_4=ta.version;let _8=Object.freeze(Object.defineProperty({__proto__:null,AbortException:_v,AnnotationEditorLayer:_b,AnnotationEditorParamsType:_w,AnnotationEditorType:_A,AnnotationEditorUIManager:_y,AnnotationLayer:_S,AnnotationMode:_x,ColorPicker:_E,DOMSVGFactory:_k,DrawLayer:_M,FeatureTest:_C,GlobalWorkerOptions:_T,ImageKind:_R,InvalidPDFException:_L,MissingPDFException:_P,OPS:_I,OutputScale:_D,PDFDataRangeTransport:_F,PDFDateString:_O,PDFWorker:_W,PasswordResponses:_N,PermissionFlag:_j,PixelsPerInch:_H,RenderingCancelledException:_B,TextLayer:_G,UnexpectedResponseException:_z,Util:_U,VerbosityLevel:_V,XfaLayer:_q,build:_K,createValidAbsoluteUrl:_X,fetchData:_Y,getDocument:_Q,getFilenameFromUrl:_J,getPdfFilenameFromUrl:_Z,getXfaPageViewport:_$,isDataScheme:_0,isPdfFile:_1,noContextMenu:_2,normalizeUnicode:_3,setLayerDimensions:_5,shadow:_6,version:_4},Symbol.toStringTag,{value:"Module"}));var _7=function(t,e,i){if(i||2==arguments.length)for(var s,a=0,n=e.length;a<n;a++)!s&&a in e||(s||(s=Array.prototype.slice.call(e,0,a)),s[a]=e[a]);return t.concat(s||Array.prototype.slice.call(e))},_9=_7(_7(_7(_7(_7(_7(_7(_7(_7(_7(_7(_7(_7(_7(_7(_7(_7(_7([],["onCopy","onCut","onPaste"],!0),["onCompositionEnd","onCompositionStart","onCompositionUpdate"],!0),["onFocus","onBlur"],!0),["onInput","onInvalid","onReset","onSubmit"],!0),["onLoad","onError"],!0),["onKeyDown","onKeyPress","onKeyUp"],!0),["onAbort","onCanPlay","onCanPlayThrough","onDurationChange","onEmptied","onEncrypted","onEnded","onError","onLoadedData","onLoadedMetadata","onLoadStart","onPause","onPlay","onPlaying","onProgress","onRateChange","onSeeked","onSeeking","onStalled","onSuspend","onTimeUpdate","onVolumeChange","onWaiting"],!0),["onClick","onContextMenu","onDoubleClick","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp"],!0),["onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop"],!0),["onSelect"],!0),["onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],!0),["onPointerDown","onPointerMove","onPointerUp","onPointerCancel","onGotPointerCapture","onLostPointerCapture","onPointerEnter","onPointerLeave","onPointerOver","onPointerOut"],!0),["onScroll"],!0),["onWheel"],!0),["onAnimationStart","onAnimationEnd","onAnimationIteration"],!0),["onTransitionEnd"],!0),["onChange"],!0),["onToggle"],!0);function pt(t,e){var i={};return _9.forEach(function(s){var a=t[s];a&&(e?i[s]=function(t){return a(t,e(s))}:i[s]=a)}),i}function pe(t){var e=!1;return{promise:new Promise(function(i,s){t.then(function(t){return!e&&i(t)}).catch(function(t){return!e&&s(t)})}),cancel:function(){e=!0}}}function pi(){for(var t,e,i=0,s="",a=arguments.length;i<a;i++)(t=arguments[i])&&(e=function t(e){var i,s,a="";if("string"==typeof e||"number"==typeof e)a+=e;else if("object"==typeof e)if(Array.isArray(e)){var n=e.length;for(i=0;i<n;
1i++)e[i]&&(s=t(e[i]))&&(a&&(a+=" "),a+=s)}else for(s in e)e[s]&&(a&&(a+=" "),a+=s);return a}(t))&&(s&&(s+=" "),s+=e);return s}var ps="production"===tt.p.env.NODE_ENV,pa="Invariant failed";function pn(t,e){if(!t){if(ps)throw Error(pa);var i="function"==typeof e?e():e;throw Error(i?"".concat(pa,": ").concat(i):pa)}}var pr="production"!==tt.p.env.NODE_ENV,pl=function(){};if(pr){var po=function(t,e){var i=arguments.length;e=Array(i>1?i-1:0);for(var s=1;s<i;s++)e[s-1]=arguments[s];var a=0,n="Warning: "+t.replace(/%s/g,function(){return e[a++]});"undefined"!=typeof console&&console.error(n);try{throw Error(n)}catch(t){}};pl=function(t,e,i){var s=arguments.length;i=Array(s>2?s-2:0);for(var a=2;a<s;a++)i[a-2]=arguments[a];if(void 0===e)throw Error("`warning(condition, format, ...args)` requires a warning message argument");t||po.apply(null,[e].concat(i))}}var ph=pl;let pd=(0,ti.g)(ph);var pc=Object.prototype.hasOwnProperty;function pu(t,e,i){for(i of t.keys())if(p_(i,e))return i}function p_(t,e){var i,s,a;if(t===e)return!0;if(t&&e&&(i=t.constructor)===e.constructor){if(i===Date)return t.getTime()===e.getTime();if(i===RegExp)return t.toString()===e.toString();if(i===Array){if((s=t.length)===e.length)for(;s--&&p_(t[s],e[s]););return -1===s}if(i===Set){if(t.size!==e.size)return!1;for(s of t)if((a=s)&&"object"==typeof a&&!(a=pu(e,a))||!e.has(a))return!1;return!0}if(i===Map){if(t.size!==e.size)return!1;for(s of t)if((a=s[0])&&"object"==typeof a&&!(a=pu(e,a))||!p_(s[1],e.get(a)))return!1;return!0}if(i===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(i===DataView){if((s=t.byteLength)===e.byteLength)for(;s--&&t.getInt8(s)===e.getInt8(s););return -1===s}if(ArrayBuffer.isView(t)){if((s=t.byteLength)===e.byteLength)for(;s--&&t[s]===e[s];);return -1===s}if(!i||"object"==typeof t){for(i in s=0,t)if(pc.call(t,i)&&++s&&!pc.call(e,i)||!(i in e)||!p_(t[i],e[i]))return!1;return Object.keys(e).length===s}}return t!=t&&e!=e}let pp=(0,Y.createContext)(null);function pf(t){let{children:e,type:i}=t;return(0,K.jsx)("div",{className:"react-pdf__message react-pdf__message--".concat(i),children:e})}class pg{setDocument(t){this.pdfDocument=t}setViewer(t){this.pdfViewer=t}setExternalLinkRel(t){this.externalLinkRel=t}setExternalLinkTarget(t){this.externalLinkTarget=t}setHistory(){}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return pn(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber||0}set page(t){pn(this.pdfViewer,"PDF viewer is not initialized."),this.pdfViewer.currentPageNumber=t}get rotation(){return 0}set rotation(t){}goToDestination(t){return new Promise(e=>{pn(this.pdfDocument,"PDF document not loaded."),pn(t,"Destination is not specified."),"string"==typeof t?this.pdfDocument.getDestination(t).then(e):Array.isArray(t)?e(t):t.then(e)}).then(t=>{pn(Array.isArray(t),'"'.concat(t,'" is not a valid destination array.'));let e=t[0];new Promise(t=>{pn(this.pdfDocument,"PDF document not loaded."),e instanceof Object?this.pdfDocument.getPageIndex(e).then(e=>{t(e)}).catch(()=>{pn(!1,'"'.concat(e,'" is not a valid page reference.'))}):"number"==typeof e?t(e):pn(!1,'"'.concat(e,'" is not a valid destination reference.'))}).then(e=>{let i=e+1;pn(this.pdfViewer,"PDF viewer is not initialized."),pn(i>=1&&i<=this.pagesCount,'"'.concat(i,'" is not a valid page number.')),this.pdfViewer.scrollPageIntoView({dest:t,pageIndex:e,pageNumber:i})})})}navigateTo(t){this.goToDestination(t)}goToPage(t){pn(this.pdfViewer,"PDF viewer is not initialized."),pn(t>=1&&t<=this.pagesCount,'"'.concat(t,'" is not a valid page number.')),this.pdfViewer.scrollPageIntoView({pageIndex:t-1,pageNumber:t})}addLinkAttributes(t,e,i){t.href=e,t.rel=this.externalLinkRel||"noopener noreferrer nofollow",t.target=i?"_blank":this.externalLinkTarget||""}getDestinationHash(){return"#"}getAnchorUrl(){return"#"}setHash(){}executeNamedAction(){}cachePageRef(){}isPageVisible(){return!0}isPageCached(){return!0}executeSetOCGState(){}constructor(){this.externalLinkEnabled=!0,this.externalLinkRel=void 0,this.externalLinkTarget=void 0,this.isInPresentationMode=!1,this.pdfDocument=void 0,this.pdfViewer=void 0}}let pm={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},pv="undefined"!=typeof window,pb=pv&&"file:"===window.location.protocol;function pw(t){return null!=t}function pA(t){return"string"==typeof t&&/^data:/.test(t)}function py(t){pn(pA(t),"Invalid data URI.");let[e="",i=""]=t.split(",");return -1!==e.split(";").indexOf("base64")?atob(i):unescape(i)}let pS="On Chromium based browsers, you can use --allow-file-access-from-files flag for debugging purposes.";function px(){pd(!pb,"Loading PDF as base64 strings/URLs may not work on protocols other than HTTP/HTTPS. ".concat(pS))}function pE(t){(null==t?void 0:t.cancel)&&t.cancel()}function pk(t,e){return Object.defineProperty(t,"width",{get(){return this.view[2]*e},configurable:!0}),Object.defineProperty(t,"height",{get(){return this.view[3]*e},configurable:!0}),Object.defineProperty(t,"originalWidth",{get(){return this.view[2]},configurable:!0}),Object.defineProperty(t,"originalHeight",{get(){return this.view[3]},configurable:!0}),t}function pM(t,e){switch(e.type){case"RESOLVE":return{value:e.value,error:void 0};case"REJECT":return{value:!1,error:e.error};case"RESET":return{value:void 0,error:void 0};default:return t}}function pC(){return(0,Y.useReducer)(pM,{value:void 0,error:void 0})}var pT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&0>e.indexOf(s)&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,s=Object.getOwnPropertySymbols(t);a<s.length;a++)0>e.indexOf(s[a])&&Object.prototype.propertyIsEnumerable.call(t,s[a])&&(i[s[a]]=t[s[a]]);return i};let{PDFDataRangeTransport:pR}=_8,pL=(t,e)=>{switch(e){case pm.NEED_PASSWORD:t(prompt("Enter the password to open this PDF file."));break;case pm.INCORRECT_PASSWORD:t(prompt("Invalid password. Please try again."))}};function pP(t){return"object"==typeof t&&null!==t&&("data"in t||"range"in t||"url"in t)}let pI=(0,Y.forwardRef)(function(t,e){var{children:i,className:s,error:a="Failed to load PDF file.",externalLinkRel:n,externalLinkTarget:r,file:l,inputRef:o,imageResourcesPath:h,loading:d="Loading PDF…",noData:c="No PDF file specified.",onItemClick:u,onLoadError:_,onLoadProgress:p,onLoadSuccess:f,onPassword:g=pL,onSourceError:m,onSourceSuccess:v,options:b,renderMode:w,rotate:A}=t,y=pT(t,["children","className","error","externalLinkRel","externalLinkTarget","file","inputRef","imageResourcesPath","loading","noData","onItemClick","onLoadError","onLoadProgress","onLoadSuccess","onPassword","onSourceError","onSourceSuccess","options","renderMode","rotate"]);let[S,x]=pC(),{value:E,error:k}=S,[M,C]=pC(),{value:T,error:R}=M,L=(0,Y.useRef)(new pg),P=(0,Y.useRef)([]),I=(0,Y.useRef)(void 0),D=(0,Y.useRef)(void 0);l&&l!==I.current&&pP(l)&&(pd(!p_(l,I.current),'File prop passed to <Document /> changed, but it\'s equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "file" prop.'),I.current=l),b&&b!==D.current&&(pd(!p_(b,D.current),'Options prop passed to <Document /> changed, but it\'s equal to previous one. This might result in unnecessary reloads. Consider memoizing the value passed to "options" prop.'),D.current=b);let F=(0,Y.useRef)({scrollPageIntoView:t=>{let{dest:e,pageNumber:i,pageIndex:s=i-1}=t;if(u)return void u({dest:e,pageIndex:s,pageNumber:i});let a=P.current[s];if(a)return void a.scrollIntoView();pd(!1,"An internal link leading to page ".concat(i," was clicked, but neither <Document> was provided with onItemClick nor it was able to find the page within itself. Either provide onItemClick to <Document>
1 and handle navigating by yourself or ensure that all pages are rendered within <Document>."))}});(0,Y.useImperativeHandle)(e,()=>({linkService:L,pages:P,viewer:F}),[]),(0,Y.useEffect)(function(){x({type:"RESET"})},[l,x]);let O=(0,Y.useCallback)(()=>{var t,e,i,s;return t=this,e=void 0,i=void 0,s=function*(){if(!l)return null;if("string"==typeof l)return pA(l)?{data:py(l)}:(px(),{url:l});if(l instanceof pR)return{range:l};if(l instanceof ArrayBuffer)return{data:l};if(pv&&(pn(pv,"isBlob can only be used in a browser environment"),l instanceof Blob))return{data:yield new Promise((t,e)=>{let i=new FileReader;i.onload=()=>{if(!i.result)return e(Error("Error while reading a file."));t(i.result)},i.onerror=t=>{if(!t.target)return e(Error("Error while reading a file."));let{error:i}=t.target;if(!i)return e(Error("Error while reading a file."));switch(i.code){case i.NOT_FOUND_ERR:return e(Error("Error while reading a file: File not found."));case i.SECURITY_ERR:return e(Error("Error while reading a file: Security error."));case i.ABORT_ERR:return e(Error("Error while reading a file: Aborted."));default:return e(Error("Error while reading a file."))}},i.readAsArrayBuffer(l)})};if(pn("object"==typeof l,"Invalid parameter in file, need either Uint8Array, string or a parameter object"),pn(pP(l),"Invalid parameter object: need either .data, .range or .url"),"url"in l&&"string"==typeof l.url){if(pA(l.url)){let{url:t}=l,e=pT(l,["url"]);return Object.assign({data:py(t)},e)}px()}return l},new(i||(i=Promise))(function(a,n){function r(t){try{o(s.next(t))}catch(t){n(t)}}function l(t){try{o(s.throw(t))}catch(t){n(t)}}function o(t){var e;t.done?a(t.value):((e=t.value)instanceof i?e:new i(function(t){t(e)})).then(r,l)}o((s=s.apply(t,e||[])).next())})},[l]);(0,Y.useEffect)(()=>{let t=pe(O());return t.promise.then(t=>{x({type:"RESOLVE",value:t})}).catch(t=>{x({type:"REJECT",error:t})}),()=>{pE(t)}},[O,x]),(0,Y.useEffect)(()=>{if(void 0!==E){if(!1===E)return void(k&&(pd(!1,k.toString()),m&&m(k)));v&&v()}},[E]),(0,Y.useEffect)(function(){C({type:"RESET"})},[C,E]),(0,Y.useEffect)(function(){if(!E)return;let t=_Q(b?Object.assign(Object.assign({},E),b):E);p&&(t.onProgress=p),g&&(t.onPassword=g);let e=t.promise.then(t=>{C({type:"RESOLVE",value:t})}).catch(e=>{t.destroyed||C({type:"REJECT",error:e})});return()=>{e.finally(()=>t.destroy())}},[b,C,E]),(0,Y.useEffect)(()=>{if(void 0!==T){if(!1===T)return void(R&&(pd(!1,R.toString()),_&&_(R)));T&&(f&&f(T),P.current=Array(T.numPages),L.current.setDocument(T))}},[T]),(0,Y.useEffect)(function(){L.current.setViewer(F.current),L.current.setExternalLinkRel(n),L.current.setExternalLinkTarget(r)},[n,r]);let W=(0,Y.useCallback)((t,e)=>{P.current[t]=e},[]),N=(0,Y.useCallback)(t=>{delete P.current[t]},[]),j=(0,Y.useMemo)(()=>({imageResourcesPath:h,linkService:L.current,onItemClick:u,pdf:T,registerPage:W,renderMode:w,rotate:A,unregisterPage:N}),[h,u,T,W,w,A,N]),H=(0,Y.useMemo)(()=>pt(y,()=>T),[y,T]);return(0,K.jsx)("div",Object.assign({className:pi("react-pdf__Document",s),ref:o,style:{"--scale-factor":"1"}},H,{children:l?null==T?(0,K.jsx)(pf,{type:"loading",children:"function"==typeof d?d():d}):!1===T?(0,K.jsx)(pf,{type:"error",children:"function"==typeof a?a():a}):(0,K.jsx)(pp.Provider,{value:j,children:i}):(0,K.jsx)(pf,{type:"no-data",children:"function"==typeof c?c():c})}))});function pD(){return(0,Y.useContext)(pp)}function pF(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=t.filter(Boolean);return i.length<=1?i[0]||null:function(t){i.forEach(function(e){"function"==typeof e?e(t):e&&(e.current=t)})}}let pO=(0,Y.createContext)(null),pW={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},pN=/^H(\d+)$/;function pj(t){return"children"in t}function pH(t){return!!pj(t)&&1===t.children.length&&0 in t.children&&"id"in t.children[0]}function pB(t){let{className:e,node:i}
1=t,s=(0,Y.useMemo)(()=>i?Object.assign(Object.assign({},function(t){let e={};if(pj(t)){let{role:i}=t,s=i.match(pN);if(s)e.role="heading",e["aria-level"]=Number(s[1]);else if(i in pW){let t=pW[i];t&&(e.role=t)}}return e}(i)),function t(e){let i={};if(pj(e)){if(void 0!==e.alt&&(i["aria-label"]=e.alt),void 0!==e.lang&&(i.lang=e.lang),pH(e)){let[s]=e.children;if(s){let e=t(s);return Object.assign(Object.assign({},i),e)}}}else"id"in e&&(i["aria-owns"]=e.id);return i}(i)):null,[i]),a=(0,Y.useMemo)(()=>!pj(i)||pH(i)?null:i.children.map((t,e)=>(0,K.jsx)(pB,{node:t},e)),[i]);return(0,K.jsx)("span",Object.assign({className:e},s,{children:a}))}function pG(){return(0,Y.useContext)(pO)}function pz(){let t=pG();pn(t,"Unable to find Page context.");let{onGetStructTreeError:e,onGetStructTreeSuccess:i}=t,[s,a]=pC(),{value:n,error:r}=s,{customTextRenderer:l,page:o}=t;return((0,Y.useEffect)(function(){a({type:"RESET"})},[a,o]),(0,Y.useEffect)(function(){if(l||!o)return;let t=pe(o.getStructTree());return t.promise.then(t=>{a({type:"RESOLVE",value:t})}).catch(t=>{a({type:"REJECT",error:t})}),()=>pE(t)},[l,o,a]),(0,Y.useEffect)(()=>{if(void 0!==n){if(!1===n)return void(r&&(pd(!1,r.toString()),e&&e(r)));n&&i&&i(n)}},[n]),n)?(0,K.jsx)(pB,{className:"react-pdf__Page__structTree structTree",node:n}):null}function pU(t){let e=pG();pn(e,"Unable to find Page context.");let{_className:i,canvasBackground:s,devicePixelRatio:a=pv&&window.devicePixelRatio||1,onRenderError:n,onRenderSuccess:r,page:l,renderForms:o,renderTextLayer:h,rotate:d,scale:c}=Object.assign(Object.assign({},e),t),{canvasRef:u}=t;pn(l,"Attempted to render page canvas, but no page was specified.");let _=(0,Y.useRef)(null);function p(t){"RenderingCancelledException"!==t.name&&(pd(!1,t.toString()),n&&n(t))}let f=(0,Y.useMemo)(()=>l.getViewport({scale:c*a,rotation:d}),[a,l,d,c]),g=(0,Y.useMemo)(()=>l.getViewport({scale:c,rotation:d}),[l,d,c]);(0,Y.useEffect)(function(){if(!l)return;l.cleanup();let{current:t}=_;if(!t)return;t.width=f.width,t.height=f.height,t.style.width="".concat(Math.floor(g.width),"px"),t.style.height="".concat(Math.floor(g.height),"px"),t.style.visibility="hidden";let e={annotationMode:o?_x.ENABLE_FORMS:_x.ENABLE,canvasContext:t.getContext("2d",{alpha:!1}),viewport:f};s&&(e.background=s);let i=l.render(e);return i.promise.then(()=>{t.style.visibility="",l&&r&&r(pk(l,c))}).catch(p),()=>pE(i)},[s,l,o,f,g]);let m=(0,Y.useCallback)(()=>{let{current:t}=_;t&&(t.width=0,t.height=0)},[]);return(0,Y.useEffect)(()=>m,[m]),(0,K.jsx)("canvas",{className:"".concat(i,"__canvas"),dir:"ltr",ref:pF(u,_),style:{display:"block",userSelect:"none"},children:h?(0,K.jsx)(pz,{}):null})}function pV(){let t=pG();pn(t,"Unable to find Page context.");let{customTextRenderer:e,onGetTextError:i,onGetTextSuccess:s,onRenderTextLayerError:a,onRenderTextLayerSuccess:n,page:r,pageIndex:l,pageNumber:o,rotate:h,scale:d}=t;pn(r,"Attempted to load page text content, but no page was specified.");let[c,u]=pC(),{value:_,error:p}=c,f=(0,Y.useRef)(null);pd(1===Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-text-layer"),10),"TextLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-text-layer"),(0,Y.useEffect)(function(){u({type:"RESET"})},[r,u]),(0,Y.useEffect)(function(){if(!r)return;let t=pe(r.getTextContent());return t.promise.then(t=>{u({type:"RESOLVE",value:t})}).catch(t=>{u({type:"REJECT",error:t})}),()=>pE(t)},[r,u]),(0,Y.useEffect)(()=>{if(void 0!==_){if(!1===_)return void(p&&(pd(!1,p.toString()),i&&i(p)));_&&s&&s(_)}},[_]);let g=(0,Y.useCallback)(()=>{n&&n()},[n]),m=(0,Y.useCallback)(t=>{pd(!1,t.toString()),a&&a(t)},[a]),v=(0,Y.useMemo)(()=>r.getViewport({scale:d,rotation:h}),[r,h,d]);return(0,Y.useLayoutEffect)(function(){if(!r||!_)return;let{current:t}=f;if(!t)return;t.innerHTML="";let i=new _G({container:t,textContentSource:r.streamTextContent({includeMarkedContent:!0}),viewport:v});return i.render().then(()=>{let i=document.createElement("div");i.className="endOfContent",t.append(i);let s=t.querySelectorAll('[role="presentation"]');if(e){let t=0;
1_.items.forEach((i,a)=>{if(!("str"in i))return;let n=s[t];n&&(n.innerHTML=e(Object.assign({pageIndex:l,pageNumber:o,itemIndex:a},i)),t+=i.str&&i.hasEOL?2:1)})}g()}).catch(m),()=>pE(i)},[e,m,g,r,l,o,_,v]),(0,K.jsx)("div",{className:pi("react-pdf__Page__textContent","textLayer"),onMouseUp:function(){let t=f.current;t&&t.classList.remove("selecting")},onMouseDown:function(){let t=f.current;t&&t.classList.add("selecting")},ref:f})}function pq(){let t=pD(),e=pG();pn(e,"Unable to find Page context.");let{imageResourcesPath:i,linkService:s,onGetAnnotationsError:a,onGetAnnotationsSuccess:n,onRenderAnnotationLayerError:r,onRenderAnnotationLayerSuccess:l,page:o,pdf:h,renderForms:d,rotate:c,scale:u=1}=Object.assign(Object.assign({},t),e);pn(h,"Attempted to load page annotations, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop."),pn(o,"Attempted to load page annotations, but no page was specified."),pn(s,"Attempted to load page annotations, but no linkService was specified.");let[_,p]=pC(),{value:f,error:g}=_,m=(0,Y.useRef)(null);pd(1===Number.parseInt(window.getComputedStyle(document.body).getPropertyValue("--react-pdf-annotation-layer"),10),"AnnotationLayer styles not found. Read more: https://github.com/wojtekmaj/react-pdf#support-for-annotations"),(0,Y.useEffect)(function(){p({type:"RESET"})},[p,o]),(0,Y.useEffect)(function(){if(!o)return;let t=pe(o.getAnnotations());return t.promise.then(t=>{p({type:"RESOLVE",value:t})}).catch(t=>{p({type:"REJECT",error:t})}),()=>{pE(t)}},[p,o]),(0,Y.useEffect)(()=>{if(void 0!==f){if(!1===f)return void(g&&(pd(!1,g.toString()),a&&a(g)));f&&n&&n(f)}},[f]);let v=(0,Y.useMemo)(()=>o.getViewport({scale:u,rotation:c}),[o,c,u]);return(0,Y.useEffect)(function(){if(!h||!o||!s||!f)return;let{current:t}=m;if(!t)return;let e=v.clone({dontFlip:!0}),a={annotations:f,annotationStorage:h.annotationStorage,div:t,imageResourcesPath:i,linkService:s,page:o,renderForms:d,viewport:e};t.innerHTML="";try{new _S({accessibilityManager:null,annotationCanvasMap:null,annotationEditorUIManager:null,div:t,l10n:null,page:o,structTreeLayer:null,viewport:e}).render(a),l&&l()}catch(t){pd(!1,"".concat(t)),r&&r(t)}return()=>{}},[f,i,s,o,h,d,v]),(0,K.jsx)("div",{className:pi("react-pdf__Page__annotations","annotationLayer"),ref:m})}var pK=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&0>e.indexOf(s)&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,s=Object.getOwnPropertySymbols(t);a<s.length;a++)0>e.indexOf(s[a])&&Object.prototype.propertyIsEnumerable.call(t,s[a])&&(i[s[a]]=t[s[a]]);return i};function pX(t){let e=Object.assign(Object.assign({},pD()),t),{_className:i="react-pdf__Page",_enableRegisterUnregisterPage:s=!0,canvasBackground:a,canvasRef:n,children:r,className:l,customRenderer:o,customTextRenderer:h,devicePixelRatio:d,error:c="Failed to load the page.",height:u,inputRef:_,loading:p="Loading page…",noData:f="No page specified.",onGetAnnotationsError:g,onGetAnnotationsSuccess:m,onGetStructTreeError:v,onGetStructTreeSuccess:b,onGetTextError:w,onGetTextSuccess:A,onLoadError:y,onLoadSuccess:S,onRenderAnnotationLayerError:x,onRenderAnnotationLayerSuccess:E,onRenderError:k,onRenderSuccess:M,onRenderTextLayerError:C,onRenderTextLayerSuccess:T,pageIndex:R,pageNumber:L,pdf:P,registerPage:I,renderAnnotationLayer:D=!0,renderForms:F=!1,renderMode:O="canvas",renderTextLayer:W=!0,rotate:N,scale:j=1,unregisterPage:H,width:B}=e,G=pK(e,["_className","_enableRegisterUnregisterPage","canvasBackground","canvasRef","children","className","customRenderer","customTextRenderer","devicePixelRatio","error","height","inputRef","loading","noData","onGetAnnotationsError","onGetAnnotationsSuccess","onGetStructTreeError","onGetStructTreeSuccess","onGetTextError","onGetTextSuccess","onLoadError","onLoadSuccess","onRenderAnnotationLayerError","onRenderAnnotationLayerSuccess","onRenderError","onRenderSuccess","onRenderTextLayerError","onRenderTextLayerSuccess","pageIndex","pageNumber","pdf","registerPage","renderAnnotationLayer","renderForms","renderMode","renderTextLayer","rotate","scale","unregisterPage","width"]),[z,U]=pC(),{value:V,error:q}=z,X=(0,Y.useRef)(null);pn(P,"Attempted to load a page, but no document was specified. Wrap <Page /> in a <Document /> or pass explicit `pdf` prop.");let Q=pw(L)?L-1:null!=R?R:null,J=null!=L?L:pw(R)?R+1:null,Z=null!=N?N:V?V.rotate:null,$=(0,Y.useMemo)(()=>
1{if(!V)return null;let t=1,e=null!=j?j:1;if(B||u){let e=V.getViewport({scale:1,rotation:Z});B?t=B/e.width:u&&(t=u/e.height)}return e*t},[u,V,Z,j,B]);(0,Y.useEffect)(function(){return()=>{pw(Q)&&s&&H&&H(Q)}},[s,P,Q,H]),(0,Y.useEffect)(function(){U({type:"RESET"})},[U,P,Q]),(0,Y.useEffect)(function(){if(!P||!J)return;let t=pe(P.getPage(J));return t.promise.then(t=>{U({type:"RESOLVE",value:t})}).catch(t=>{U({type:"REJECT",error:t})}),()=>pE(t)},[U,P,J]),(0,Y.useEffect)(()=>{if(void 0!==V){if(!1===V)return void(q&&(pd(!1,q.toString()),y&&y(q)));!function(){if(S){if(!V||!$)return;S(pk(V,$))}if(s&&I){if(!pw(Q)||!X.current)return;I(Q,X.current)}}()}},[V,$]);let tt=(0,Y.useMemo)(()=>V&&pw(Q)&&J&&pw(Z)&&pw($)?{_className:i,canvasBackground:a,customTextRenderer:h,devicePixelRatio:d,onGetAnnotationsError:g,onGetAnnotationsSuccess:m,onGetStructTreeError:v,onGetStructTreeSuccess:b,onGetTextError:w,onGetTextSuccess:A,onRenderAnnotationLayerError:x,onRenderAnnotationLayerSuccess:E,onRenderError:k,onRenderSuccess:M,onRenderTextLayerError:C,onRenderTextLayerSuccess:T,page:V,pageIndex:Q,pageNumber:J,renderForms:F,renderTextLayer:W,rotate:Z,scale:$}:null,[i,a,h,d,g,m,v,b,w,A,x,E,k,M,C,T,V,Q,J,F,W,Z,$]),te=(0,Y.useMemo)(()=>pt(G,()=>V?$?pk(V,$):void 0:V),[G,V,$]),ti="".concat(Q,"@").concat($,"/").concat(Z);return(0,K.jsx)("div",Object.assign({className:pi(i,l),"data-page-number":J,ref:pF(_,X),style:{"--scale-factor":"".concat($),backgroundColor:a||"white",position:"relative",minWidth:"min-content",minHeight:"min-content"}},te,{children:J?null===P||null==V?(0,K.jsx)(pf,{type:"loading",children:"function"==typeof p?p():p}):!1===P||!1===V?(0,K.jsx)(pf,{type:"error",children:"function"==typeof c?c():c}):(0,K.jsxs)(pO.Provider,{value:tt,children:[function(){switch(O){case"custom":return pn(o,'renderMode was set to "custom", but no customRenderer was passed.'),(0,K.jsx)(o,{},"".concat(ti,"_custom"));case"none":return null;default:return(0,K.jsx)(pU,{canvasRef:n},"".concat(ti,"_canvas"))}}(),W?(0,K.jsx)(pV,{},"".concat(ti,"_text")):null,D?(0,K.jsx)(pq,{},"".concat(ti,"_annotations")):null,r]}):(0,K.jsx)(pf,{type:"no-data",children:"function"==typeof f?f():f})}))}pd(!pb,"Loading PDF.js worker may not work on protocols other than HTTP/HTTPS. ".concat(pS)),_T.workerSrc="pdf.worker.mjs",_T.workerSrc="//unpkg.com/pdfjs-dist@".concat(_4,"/build/pdf.worker.min.mjs");let pY="//unpkg.com/pdfjs-dist@".concat(_4,"/cmaps/"),pQ=t=>{let{height:e}=t;return(0,K.jsx)(X.B,{minH:null!=e?e:"svh",children:(0,K.jsx)(Q.A,{})})},pJ=t=>{let{href:e,initialPage:i,onError:s,onPageChange:a,onPageLoad:n,constrainHeight:r=!1,scrollToTopOnPageChange:l=!1,fullScreenButtonProps:o}=t,[h,d]=(0,Y.useState)(1),[c,u]=(0,Y.useState)(null!=i?i:1),[_,p]=(0,Y.useState)(!1),[f,g]=(0,Y.useState)(null),[m,v]=(0,Y.useState)(null),b=(0,Y.useRef)(null),w=(0,$.F)(b,_,r);(0,Y.useLayoutEffect)(()=>{if(!r||!f||null==w.width||null==w.height||w.width<=0||w.height<=0)return void v(null);let t=!1,e=w.width,i=w.height;return f.getPage(c).then(s=>{if(t)return;let a=s.getViewport({scale:1});v({scale:Math.min(e/a.width,i/a.height),width:a.width,height:a.height})}).catch(()=>v(null)),()=>{t=!0}},[r,f,w.width,w.height,c]),(0,Y.useEffect)(()=>{l&&window.scrollTo(0,0)},[c,l]),(0,Y.useEffect)(()=>{i&&i>0&&i<=h&&u(i)},[i,h]);let A=(0,Y.useMemo)(()=>({cMapUrl:pY,cMapPacked:!0}),[]),y=(0,K.jsx)(pI,{file:e,options:A,externalLinkTarget:"_blank",externalLinkRel:"noopener noreferrer",onLoadSuccess:t=>{d(t.numPages),g(t)},onItemClick:t=>u(t.pageNumber),onError:s,loading:(0,K.jsx)(pQ,{}),children:(0,K.jsx)(pX,{...r&&null!=m?{scale:1}:{width:w.width,height:w.height},pageNumber:c,onLoadSuccess:()=>{p(!0),null==n||n(c)},loading:(0,K.jsx)(pQ,{height:w.height})})});return(0,K.jsxs)(Z.$,{constrainHeight:r,children:[(0,K.jsx)(Z.r,{ref:b,constrainHeight:r,children:r&&null!=m?(0,K.jsx)("div",{style:{width:m.width*m.scale,height:m.height*m.scale},children:(0,K.jsx)("div",{style:{width:m.width,height:m.height,transform:"scale(".concat(m.scale,")"),transformOrigin:"top left"},children:y})}):y}),_&&(0,K.jsx)(J.A,{totalPages:h,pageNumber:c,onPageChange:t=>{u(t),null==a||a(t)},fullScreenButtonProps:o})]})};function pZ(t){var e;if((0,O._)(this,n))return;null!=(e=(0,O._)(this,o)).ctx||(e.ctx=(0,q._)(x,x,p1).call(x,(0,O._)(this,l)));let i=(0,O._)(this,v),s=(0,O._)(this,g);for(let e of t){if(i.length>1e5){ty("Ignoring additional textDivs for performance reasons."),(0,N._)(this,n,!0);return}if(void 0===e.str){if("beginMarkedContentProps"===e.type||"beginMarkedContent"===e.type){let t=(0,O._)(this,a);(0,N._)(this,a,document.createElement("span")),(0,O._)(this,a).classList.add("markedContent"),null!==e.id&&(0,O._)(this,a).setAttribute("id","".concat(e.id)),t.append((0,O._)(this,a))}else"endMarkedContent"===e.type&&(0,N._)(this,a,(0,O._)(this,a).parentNode);continue}s.push(e.str),(0,H._)(this,y,p$).call(this,e)}}function p$(t){let e,i,s=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};(0,O._)(this,v).push(s);let c=tH.transform((0,O._)(this,w),t.transform),_=Math.atan2(c[1],c[0]),p=(0,O._)(this,f)[t.fontName];p.vertical&&(_+=Math.PI/2);let g=(0,O._)(this,r)&&p.fontSubstitution||p.fontFamily;g=x.fontFamilyMap.get(g)||g;
1let m=Math.hypot(c[2],c[3]),A=m*(0,q._)(x,x,p5).call(x,g,(0,O._)(this,l));0===_?(e=c[4],i=c[5]-A):(e=c[4]+A*Math.sin(_),i=c[5]-A*Math.cos(_));let y="calc(var(--scale-factor)*",E=s.style;(0,O._)(this,a)===(0,O._)(this,u)?(E.left="".concat((100*e/(0,O._)(this,d)).toFixed(2),"%"),E.top="".concat((100*i/(0,O._)(this,h)).toFixed(2),"%")):(E.left="".concat(y).concat(e.toFixed(2),"px)"),E.top="".concat(y).concat(i.toFixed(2),"px)")),E.fontSize="".concat(y).concat(((0,G._)(x,x,C)*m).toFixed(2),"px)"),E.fontFamily=g,n.fontSize=m,s.setAttribute("role","presentation"),s.textContent=t.str,s.dir=t.dir,(0,O._)(this,r)&&(s.dataset.fontName=p.fontSubstitutionLoadedName||t.fontName),0!==_&&(n.angle=180/Math.PI*_);let k=!1;if(t.str.length>1)k=!0;else if(" "!==t.str&&t.transform[0]!==t.transform[3]){let e=Math.abs(t.transform[0]),i=Math.abs(t.transform[3]);e!==i&&Math.max(e,i)/Math.min(e,i)>1.5&&(k=!0)}if(k&&(n.canvasWidth=p.vertical?t.height:t.width),(0,O._)(this,b).set(s,n),(0,O._)(this,o).div=s,(0,O._)(this,o).properties=n,(0,H._)(this,S,p0).call(this,(0,O._)(this,o)),n.hasText&&(0,O._)(this,a).append(s),n.hasEOL){let t=document.createElement("br");t.setAttribute("role","presentation"),(0,O._)(this,a).append(t)}}function p0(t){let{div:e,properties:i,ctx:s}=t,{style:a}=e,n="";if((0,G._)(x,x,C)>1&&(n="scale(".concat(1/(0,G._)(x,x,C),")")),0!==i.canvasWidth&&i.hasText){let{fontFamily:t}=a,{canvasWidth:r,fontSize:l}=i;(0,q._)(x,x,p2).call(x,s,l*(0,O._)(this,p),t);let{width:o}=s.measureText(e.textContent);o>0&&(n="scaleX(".concat(r*(0,O._)(this,p)/o,") ").concat(n))}0!==i.angle&&(n="rotate(".concat(i.angle,"deg) ").concat(n)),n.length>0&&(a.transform=n)}function p1(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=(0,G._)(this,x,k).get(t||(t=""));if(!e){let i=document.createElement("canvas");i.className="hiddenCanvasElement",i.lang=t,document.body.append(i),e=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),(0,G._)(this,x,k).set(t,e),(0,G._)(this,x,M).set(e,{size:0,family:""})}return e}function p2(t,e,i){let s=(0,G._)(this,x,M).get(t);(e!==s.size||i!==s.family)&&(t.font="".concat(e,"px ").concat(i),s.size=e,s.family=i)}function p3(){if(null!==(0,G._)(this,x,C))return;let 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),(0,z._)(this,x,C,t.getBoundingClientRect().height),t.remove()}function p5(t,e){let i=(0,G._)(this,x,E).get(t);if(i)return i;let s=(0,q._)(this,x,p1).call(x,e);s.canvas.width=s.canvas.height=30,(0,q._)(this,x,p2).call(x,s,30,t);let a=s.measureText(""),n=a.fontBoundingBoxAscent,r=Math.abs(a.fontBoundingBoxDescent);if(n){let e=n/(n+r);return(0,G._)(this,x,E).set(t,e),s.canvas.width=s.canvas.height=0,e}s.strokeStyle="red",s.clearRect(0,0,30,30),s.strokeText("g",0,0);let l=s.getImageData(0,0,30,30).data;r=0;for(let t=l.length-1-3;t>=0;t-=4)if(l[t]>0){r=Math.ceil(t/4/30);break}s.clearRect(0,0,30,30),s.strokeText("A",0,30),l=s.getImageData(0,0,30,30).data,n=0;for(let t=0,e=l.length;t<e;t+=4)if(l[t]>0){n=30-Math.floor(t/4/30);break}s.canvas.width=s.canvas.height=0;let o=n?n/(n+r):.8;return(0,G._)(this,x,E).set(t,o),o}async function p6(t,e){var i,s;let a=t.firstChild||t,n=a.id="".concat(tq).concat(e),r=await (null==(i=(0,O._)(this,I))?void 0:i.getAriaAttributes(n));if(r)for(let[t,e]of r)a.setAttribute(t,e);this.div.append(t),null==(s=(0,O._)(this,R))||s.moveElementInDOM(this.div,t,a,!1)}function p4(){if(!(0,O._)(this,L))return;let t=this.div;for(let[e,i]of(0,O._)(this,L)){let s=t.querySelector('[data-annotation-id="'.concat(e,'"]'));if(!s)continue;i.className="annotationContent";let{firstChild:a}=s;a?"CANVAS"===a.nodeName?a.replaceWith(i):a.classList.contains("annotationContent")?a.after(i):a.before(i):s.append(i)}(0,O._)(this,L).clear()}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.