PageSourceSearch

https://portail.cartebtp.fr/chunk-LE2YQXJV.js

js cartebtp.fr collected 2026-09-24 20:01:41 UTC 496,545 bytes, 342 lines download raw bytes

1import{$a as ta,D as ms,Da as Qr,Fa as Jr,Kb as ra,Lb as aa,Mb as oa,N as tt,Qa as Wt,Ra as Zr,S as qr,X as Kr,Xa as bs,a as G,ab as ea,b as vt,f as Wr,ga as q,h as Ur,i as lt,j as zt,k as Ke,l as Ye,m as $r,ma as Yr,n as le,o as C,p as ps,q as gs,r as Gr,tb as ia,ub as sa,v as Xr,vb as na}from"./chunk-MECLTUZI.js";var ge={};Wr(ge,{AbortException:()=>pl,AnnotationEditorLayer:()=>gl,AnnotationEditorParamsType:()=>ml,AnnotationEditorType:()=>Kn,AnnotationEditorUIManager:()=>bl,AnnotationLayer:()=>Al,AnnotationMode:()=>_l,ColorPicker:()=>wl,DOMSVGFactory:()=>yl,DrawLayer:()=>vl,FeatureTest:()=>El,GlobalWorkerOptions:()=>Yn,ImageKind:()=>xl,InvalidPDFException:()=>Cl,MissingPDFException:()=>Sl,OPS:()=>Pl,OutputScale:()=>Tl,PDFDataRangeTransport:()=>Ll,PDFDateString:()=>Ml,PDFWorker:()=>kl,PasswordResponses:()=>Il,PermissionFlag:()=>Rl,PixelsPerInch:()=>Ol,RenderingCancelledException:()=>Dl,TextLayer:()=>Nl,UnexpectedResponseException:()=>Fl,Util:()=>Bl,VerbosityLevel:()=>Qn,XfaLayer:()=>Hl,build:()=>jl,createValidAbsoluteUrl:()=>Vl,fetchData:()=>zl,getDocument:()=>Jn,getFilenameFromUrl:()=>Wl,getPdfFilenameFromUrl:()=>Ul,getXfaPageViewport:()=>$l,isDataScheme:()=>Gl,isPdfFile:()=>Xl,noContextMenu:()=>ql,normalizeUnicode:()=>Kl,setLayerDimensions:()=>Yl,shadow:()=>Ql,version:()=>Ve});var Ce={};Ce.d=(o,t)=>{for(var e in t)Ce.o(t,e)&&!Ce.o(o,e)&&Object.defineProperty(o,e,{enumerable:!0,get:t[e]})};Ce.o=(o,t)=>Object.prototype.hasOwnProperty.call(o,t);var R=globalThis.pdfjsLib={};Ce.d(R,{AbortException:()=>Ft,AnnotationEditorLayer:()=>fl,AnnotationEditorParamsType:()=>I,AnnotationEditorType:()=>O,AnnotationEditorUIManager:()=>ke,AnnotationLayer:()=>Dn,AnnotationMode:()=>Ut,ColorPicker:()=>Bi,DOMSVGFactory:()=>Ne,DrawLayer:()=>Vn,FeatureTest:()=>ot,GlobalWorkerOptions:()=>Zt,ImageKind:()=>si,InvalidPDFException:()=>li,MissingPDFException:()=>Nt,OPS:()=>Et,OutputScale:()=>Me,PDFDataRangeTransport:()=>xi,PDFDateString:()=>ci,PDFWorker:()=>de,PasswordResponses:()=>yo,PermissionFlag:()=>wo,PixelsPerInch:()=>$t,RenderingCancelledException:()=>Le,TextLayer:()=>Oe,UnexpectedResponseException:()=>pe,Util:()=>M,VerbosityLevel:()=>Vi,XfaLayer:()=>Pi,build:()=>dl,createValidAbsoluteUrl:()=>Co,fetchData:()=>$i,getDocument:()=>ol,getFilenameFromUrl:()=>Ro,getPdfFilenameFromUrl:()=>Oo,getXfaPageViewport:()=>Do,isDataScheme:()=>Gi,isPdfFile:()=>Un,noContextMenu:()=>yt,normalizeUnicode:()=>Mo,setLayerDimensions:()=>te,shadow:()=>B,version:()=>cl});var ct=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),Ea=[1,0,0,1,0,0],Es=[.001,0,0,.001,0,0],bo=1e7,ii=1.35,Ao=.35,sd=Ao/ii,mt={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},Ut={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},_o="pdfjs_internal_editor_",O={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},I={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},wo={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},ht={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},si={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},nt={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26};var ye={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5};var Vi={ERRORS:0,WARNINGS:1,INFOS:5},Et={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},yo={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},zi=Vi.WARNINGS;function vo(o){Number.isInteger(o)&&(zi=o)}function Eo(){return zi}function Wi(o){zi>=Vi.INFOS&&console.log(`Info: ${o}`)}function N(o){zi>=Vi.WARNINGS&&console.log(`Warning: ${o}`)}function U(o){throw new Error(o)}function rt(o,t){o||U(t)}function xo(o){switch(o?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function Co(o,t=null,e=null){if(!o)return null;
1try{if(e&&typeof o=="string"&&(e.addDefaultProtocol&&o.startsWith("www.")&&o.match(/\./g)?.length>=2&&(o=`http://${o}`),e.tryConvertEncoding))try{o=Lo(o)}catch{}let i=t?new URL(o,t):new URL(o);if(xo(i))return i}catch{}return null}function B(o,t,e,i=!1){return Object.defineProperty(o,t,{value:e,enumerable:!i,configurable:!0,writable:!1}),e}var Gt=(function(){function t(e,i){this.message=e,this.name=i}return t.prototype=new Error,t.constructor=t,t})(),Se=class extends Gt{constructor(t,e){super(t,"PasswordException"),this.code=e}},Pe=class extends Gt{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}},li=class extends Gt{constructor(t){super(t,"InvalidPDFException")}},Nt=class extends Gt{constructor(t){super(t,"MissingPDFException")}},pe=class extends Gt{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}},xs=class extends Gt{constructor(t){super(t,"FormatError")}},Ft=class extends Gt{constructor(t){super(t,"AbortException")}};function xa(o){(typeof o!="object"||o?.length===void 0)&&U("Invalid argument for bytesToString");let t=o.length,e=8192;if(t<e)return String.fromCharCode.apply(null,o);let i=[];for(let s=0;s<t;s+=e){let n=Math.min(s+e,t),r=o.subarray(s,n);i.push(String.fromCharCode.apply(null,r))}return i.join("")}function Ui(o){typeof o!="string"&&U("Invalid argument for stringToBytes");let t=o.length,e=new Uint8Array(t);for(let i=0;i<t;++i)e[i]=o.charCodeAt(i)&255;return e}function So(o){return String.fromCharCode(o>>24&255,o>>16&255,o>>8&255,o&255)}function zn(o){let t=Object.create(null);for(let[e,i]of o)t[e]=i;return t}function Po(){let o=new Uint8Array(4);return o[0]=1,new Uint32Array(o.buffer,0,1)[0]===1}function To(){try{return new Function(""),!0}catch{return!1}}var ot=class{static get isLittleEndian(){return B(this,"isLittleEndian",Po())}static get isEvalSupported(){return B(this,"isEvalSupported",To())}static get isOffscreenCanvasSupported(){return B(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator<"u"&&typeof navigator?.platform=="string"?B(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:typeof navigator?.userAgent=="string"&&navigator.userAgent.includes("Firefox")}):B(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){return B(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}},As=Array.from(Array(256).keys(),o=>o.toString(16).padStart(2,"0")),M=class{static makeHexColor(t,e,i){return`#${As[t]}${As[e]}${As[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){let i=t[0]*e[0]+t[1]*e[2]+e[4],s=t[0]*e[1]+t[1]*e[3]+e[5];return[i,s]}static applyInverseTransform(t,e){let i=e[0]*e[3]-e[1]*e[2],s=(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/i,n=(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/i;return[s,n]}static getAxialAlignedBoundingBox(t,e){let i=this.applyTransform(t,e),s=this.applyTransform(t.slice(2,4),e),n=this.applyTransform([t[0],t[3]],e),r=this.applyTransform([t[2],t[1]],e);return[Math.min(i[0],s[0],n[0],r[0]),Math.min(i[1],s[1],n[1],r[1]),Math.max(i[0],s[0],n[0],r[0]),Math.max(i[1],s[1],n[1],r[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],n=t[2]*e[0]+t[3]*e[2],r=t[2]*e[1]+t[3]*e[3],a=(i+r)/2,l=Math.sqrt((i+r)**2-4*(i*r-n*s))/2,h=a+l||1,c=a-l||1;return[Math.sqrt(h),Math.sqrt(c)]}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 n=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),r=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return n>r?null:[i,n,s,r]}static#t(t,e,i,s,n,r,a,l,h,c){if(h<=0||h>=1)return;let d=1-h,u=h*h,f=u*h,p=d*(d*(d*t+3*h*e)+3*u*i)+f*s,g=d*(d*(d*n+3*h*r)+3*u*a)+f*l;c[0]=Math.min(c[0],p),c[1]=Math.min(c[1],g),c[2]=Math.max(c[2],p),c[3]=Math.max(c[3],g)}static#e(t,e,i,s,n,r,a,l,h,c,d,u){if(Math.abs(h)<1e-12){Math.abs(c)>=1e-12&&this.#t(t,e,i,s,n,r,a,l,-d/c,u);return}let f=c**2-4*d*h;if(f<0)return;let p=Math.sqrt(f),g=2*h;this.#t(t,e,i,s,n,r,a,l,(-c+p)/g,u),this.#t(t,e,i,s,n,r,a,l,(-c-p)/g,u)}static bezierBoundingBox(t,e,i,s,n,r,a,l,h){return h?(h[0]=Math.min(h[0],t,a),h[1]=Math.min(h[1],e,l),h[2]=Math.max(h[2],t,a),h[3]=Math.max(h[3],e,l)):h=[Math.min(t,a),Math.min(e,l),Math.max(t,a),Math.max(e,l)],this.#e(t,i,n,a,e,s,r,l,3*(-t+3*(i-n)+a),6*(t-2*i+n),3*(i-t),h),this.#e(t,i,n,a,e,s,r,l,3*(-e+3*(s-r)+l),6*(e-2*s+r),3*(s-e),h),h}};function Lo(o){return decodeURIComponent(escape(o))}var _s=null,la=null;function Mo(o){return _s||(_s=/([\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,la=new Map([["\uFB05","\u017Ft"]])),o.replaceAll(_s,(t,e,i)=>e?e.normalize("NFKC"):la.get(i))}function ko(){if(typeof crypto<"u"&&typeof crypto?.randomUUID=="function")return crypto.randomUUID();let o=new Uint8Array(32);if(typeof crypto<"u"&&typeof crypto?.getRandomValues=="function")crypto.getRandomValues(o);else for(let t=0;t<32;t++)o[t]=Math.floor(Math.random()*255);return xa(o)}var Wn="pdfjs_internal_id_",It={BEZIER_CURVE_TO:0,MOVE_TO:1,LINE_TO:2,QUADRATIC_CURVE_TO:3,RESTORE:4,SAVE:5,SCALE:6,TRANSFORM:7,TRANSLATE:8};function Io(o){return Uint8Array.prototype.toBase64?o.toBase64():btoa(xa(o))}var Ot="http://www.w3.org/2000/svg",$t=class{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF};function $i(o,t="text"){return C(this,null,function*(){if(xe(o,document.baseURI)){let e=yield fetch(o);if(!e.ok)throw new Error(e.statusText);switch(t){case"arraybuffer":return e.arrayBuffer();case"blob":return e.blob();case"json":return e.json()}return e.text()}return new Promise((e,i)=>{let s=new XMLHttpRequest;s.open("GET",o,!0),s.responseType=t,s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE){if(s.status===200||s.status===0){switch(t){case"arraybuffer":case"blob":case"json":e(s.response);return}e(s.responseText);return}i(new Error(s.statusText))}},s.send(null)})})}var Te=class o{constructor({viewBox:t,scale:e,rotation:i,offsetX:s=0,offsetY:n=0,dontFlip:r=!1}){this.viewBox=t,this.scale=e,this.rotation=i,this.offsetX=s,this.offsetY=n;let a=(t[2]+t[0])/2,l=(t[3]+t[1])/2,h,c,d,u;switch(i%=360,i<0&&(i+=360),i){case 180:h=-1,c=0,d=0,u=1;break;case 90:h=0,c=1,d=1,u=0;break;case 270:h=0,c=-1,d=-1,u=0;break;case 0:h=1,c=0,d=0,u=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}r&&(d=-d,u=-u);let f,p,g,b;h===0?(f=Math.abs(l-t[1])*e+s,p=Math.abs(a-t[0])*e+n,g=(t[3]-t[1])*e,b=(t[2]-t[0])*e):(f=Math.abs(a-t[0])*e+s,p=Math.abs(l-t[1])*e+n,g=(t[2]-t[0])*e,b=(t[3]-t[1])*e),this.transform=[h*e,c*e,d*e,u*e,f-h*e*a-d*e*l,p-c*e*a-u*e*l],this.width=g,this.height=b}get rawDims(){let{viewBox:t}=this;return B(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:i=this.offsetX,offsetY:s=this.offsetY,dontFlip:n=!1}={}){return new o({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:n})}convertToViewportPoint(t,e){return M.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){let e=M.applyTransform([t[0],t[1]],this.transform),i=M.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){return M.applyInverseTransform([t,e],this.transform)}},Le=class extends Gt{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}};
1function Gi(o){let t=o.length,e=0;for(;e<t&&o[e].trim()==="";)e++;return o.substring(e,e+5).toLowerCase()==="data:"}function Un(o){return typeof o=="string"&&/\.pdf$/i.test(o)}function Ro(o){return[o]=o.split(/[#?]/,1),o.substring(o.lastIndexOf("/")+1)}function Oo(o,t="document.pdf"){if(typeof o!="string")return t;if(Gi(o))return N('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;let e=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,i=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,s=e.exec(o),n=i.exec(s[1])||i.exec(s[2])||i.exec(s[3]);if(n&&(n=n[0],n.includes("%")))try{n=i.exec(decodeURIComponent(n))[0]}catch{}return n||t}var hi=class{started=Object.create(null);times=[];time(t){t in this.started&&N(`Timer is already running for ${t}`),this.started[t]=Date.now()}timeEnd(t){t in this.started||N(`Timer has not been started for ${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:i}of this.times)e=Math.max(i.length,e);for(let{name:i,start:s,end:n}of this.times)t.push(`${i.padEnd(e)} ${n-s}ms
2`);return t.join("")}};function xe(o,t){try{let{protocol:e}=t?new URL(o,t):new URL(o);return e==="http:"||e==="https:"}catch{return!1}}function yt(o){o.preventDefault()}function ha(o){console.log("Deprecated API usage: "+o)}var ci=class{static#t;static toDateObject(t){if(!t||typeof t!="string")return null;this.#t||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");let e=this.#t.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 n=parseInt(e[3],10);n=n>=1&&n<=31?n:1;let r=parseInt(e[4],10);r=r>=0&&r<=23?r:0;let a=parseInt(e[5],10);a=a>=0&&a<=59?a:0;let l=parseInt(e[6],10);l=l>=0&&l<=59?l:0;let h=e[7]||"Z",c=parseInt(e[8],10);c=c>=0&&c<=23?c:0;let d=parseInt(e[9],10)||0;return d=d>=0&&d<=59?d:0,h==="-"?(r+=c,a+=d):h==="+"&&(r-=c,a-=d),new Date(Date.UTC(i,s,n,r,a,l))}};function Do(o,{scale:t=1,rotation:e=0}){let{width:i,height:s}=o.attributes.style,n=[0,0,parseInt(i),parseInt(s)];return new Te({viewBox:n,scale:t,rotation:e})}function $n(o){if(o.startsWith("#")){let t=parseInt(o.slice(1),16);return[(t&16711680)>>16,(t&65280)>>8,t&255]}return o.startsWith("rgb(")?o.slice(4,-1).split(",").map(t=>parseInt(t)):o.startsWith("rgba(")?o.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(N(`Not a valid color format: "${o}"`),[0,0,0])}function No(o){let t=document.createElement("span");t.style.visibility="hidden",document.body.append(t);for(let e of o.keys()){t.style.color=e;let i=window.getComputedStyle(t).color;o.set(e,$n(i))}t.remove()}function K(o){let{a:t,b:e,c:i,d:s,e:n,f:r}=o.getTransform();return[t,e,i,s,n,r]}function Rt(o){let{a:t,b:e,c:i,d:s,e:n,f:r}=o.getTransform().invertSelf();return[t,e,i,s,n,r]}function te(o,t,e=!1,i=!0){if(t instanceof Te){let{pageWidth:s,pageHeight:n}=t.rawDims,{style:r}=o,a=ot.isCSSRoundSupported,l=`var(--scale-factor) * ${s}px`,h=`var(--scale-factor) * ${n}px`,c=a?`round(down, ${l}, var(--scale-round-x, 1px))`:`calc(${l})`,d=a?`round(down, ${h}, var(--scale-round-y, 1px))`:`calc(${h})`;!e||t.rotation%180===0?(r.width=c,r.height=d):(r.width=d,r.height=c)}i&&o.setAttribute("data-main-rotation",t.rotation)}var Me=class{constructor(){let t=window.devicePixelRatio||1;this.sx=t,this.sy=t}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}},Cs=class o{#t=null;#e=null;#i;#s=null;#r=null;static#n=null;constructor(t){this.#i=t,o.#n||=Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button"})}render(){let t=this.#t=document.createElement("div");t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");let e=this.#i._uiManager._signal;t.addEventListener("contextmenu",yt,{signal:e}),t.addEventListener("pointerdown",o.#l,{signal:e});let i=this.#s=document.createElement("div");i.className="buttons",t.append(i);let s=this.#i.toolbarPosition;if(s){let{style:n}=t,r=this.#i._uiManager.direction==="ltr"?1-s[0]:s[0];n.insetInlineEnd=`${100*r}%`,n.top=`calc(${100*s[1]}% + var(--editor-toolbar-vert-offset))`}return this.#d(),t}get div(){return this.#t}static#l(t){t.stopPropagation()}#h(t){this.#i._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()}#c(t){this.#i._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()}#o(t){let e=this.#i._uiManager._signal;t.addEventListener("focusin",this.#h.bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",this.#c.bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",yt,{signal:e})}hide(){this.#t.classList.add("hidden"),this.#e?.hideDropdown()}show(){this.#t.classList.remove("hidden"),this.#r?.shown()}#d(){let{editorType:t,_uiManager:e}=this.#i,i=document.createElement("button");i.className="delete",i.tabIndex=0,i.setAttribute("data-l10n-id",o.#n[t]),this.#o(i),i.addEventListener("click",
2s=>{e.delete()},{signal:e._signal}),this.#s.append(i)}get#a(){let t=document.createElement("div");return t.className="divider",t}addAltText(t){return C(this,null,function*(){let e=yield t.render();this.#o(e),this.#s.prepend(e,this.#a),this.#r=t})}addColorPicker(t){this.#e=t;let e=t.renderButton();this.#o(e),this.#s.prepend(e,this.#a)}remove(){this.#t.remove(),this.#e?.destroy(),this.#e=null}},Ss=class{#t=null;#e=null;#i;constructor(t){this.#i=t}#s(){let t=this.#e=document.createElement("div");t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",yt,{signal:this.#i._signal});let e=this.#t=document.createElement("div");return e.className="buttons",t.append(e),this.#n(),t}#r(t,e){let i=0,s=0;for(let n of t){let r=n.y+n.height;if(r<i)continue;let a=n.x+(e?n.width:0);if(r>i){s=a,i=r;continue}e?a>s&&(s=a):a<s&&(s=a)}return[e?1-s:s,i]}show(t,e,i){let[s,n]=this.#r(e,i),{style:r}=this.#e||=this.#s();t.append(this.#e),r.insetInlineEnd=`${100*s}%`,r.top=`calc(${100*n}% + var(--editor-toolbar-vert-offset))`}hide(){this.#e.remove()}#n(){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=this.#i._signal;t.addEventListener("contextmenu",yt,{signal:i}),t.addEventListener("click",()=>{this.#i.highlightSelection("floating_button")},{signal:i}),this.#t.append(t)}};function di(o,t,e){for(let i of e)t.addEventListener(i,o[i].bind(o))}function Fo(o){return Math.round(Math.min(255,Math.max(1,255*o))).toString(16).padStart(2,"0")}var Ps=class{#t=0;get id(){return`${_o}${this.#t++}`}},Ts=class o{#t=ko();#e=0;#i=null;static get _isSVGFittingCanvas(){let t='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>',i=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),s=new Image;s.src=t;let n=s.decode().then(()=>(i.drawImage(s,0,0,1,1,0,0,1,3),new Uint32Array(i.getImageData(0,0,1,1).data.buffer)[0]===0));return B(this,"_isSVGFittingCanvas",n)}#s(t,e){return C(this,null,function*(){this.#i||=new Map;let i=this.#i.get(t);if(i===null)return null;if(i?.bitmap)return i.refCounter+=1,i;try{i||={bitmap:null,id:`image_${this.#t}_${this.#e++}`,refCounter:0,isSvg:!1};let s;if(typeof e=="string"?(i.url=e,s=yield $i(e,"blob")):e instanceof File?s=i.file=e:e instanceof Blob&&(s=e),s.type==="image/svg+xml"){let n=o._isSVGFittingCanvas,r=new FileReader,a=new Image,l=new Promise((h,c)=>{a.onload=()=>{i.bitmap=a,i.isSvg=!0,h()},r.onload=()=>C(this,null,function*(){let d=i.svgUrl=r.result;a.src=(yield n)?`${d}#svgView(preserveAspectRatio(none))`:d}),a.onerror=r.onerror=c});r.readAsDataURL(s),yield l}else i.bitmap=yield createImageBitmap(s);i.refCounter=1}catch(s){console.error(s),i=null}return this.#i.set(t,i),i&&this.#i.set(i.id,i),i})}getFromFile(t){return C(this,null,function*(){let{lastModified:e,name:i,size:s,type:n}=t;return this.#s(`${e}_${i}_${s}_${n}`,t)})}getFromUrl(t){return C(this,null,function*(){return this.#s(t,t)})}getFromBlob(t,e){return C(this,null,function*(){let i=yield e;return this.#s(t,i)})}getFromId(t){return C(this,null,function*(){this.#i||=new Map;let e=this.#i.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:i}=e;return delete e.blobPromise,this.getFromBlob(e.id,i)}return this.getFromUrl(e.url)})}getFromCanvas(t,e){this.#i||=new Map;let i=this.#i.get(t);if(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_${this.#t}_${this.#e++}`,refCounter:1,isSvg:!1},this.#i.set(t,i),this.#i.set(i.id,i),i}getSvgUrl(t){let e=this.#i.get(t);return e?.isSvg?e.svgUrl:null}deleteId(t){this.#i||=new Map;let e=this.#i.get(t);if(!e||(e.refCounter-=1,e.refCounter!==0))return;let{bitmap:i}=e;if(!e.url&&!e.file){let s=new OffscreenCanvas(i.width,i.height);s.getContext("bitmaprenderer").transferFromImageBitmap(i),e.blobPromise=s.convertToBlob()}i.close?.(),e.bitmap=null}isValidId(t){return t.startsWith(`image_${this.#t}_`)}},Ls=class{#t=[];#e=!1;#i;#s=-1;constructor(t=128){this.#i=t}add({cmd:t,undo:e,post:i,mustExec:s,type:n=NaN,overwriteIfSameType:r=!1,keepUndo:a=!1}){if(s&&t(),this.#e)return;let l={cmd:t,undo:e,post:i,type:n};if(this.#s===-1){this.#t.length>0&&(this.#t.length=0),this.#s=0,this.#t.push(l);return}if(r&&this.#t[this.#s].type===n){a&&(l.undo=this.#t[this.#s].undo),this.#t[this.#s]=l;return}let h=this.#s+1;h===this.#i?this.#t.splice(0,1):(this.#s=h,h<this.#t.length&&this.#t.splice(h)),this.#t.push(l)}undo(){if(this.#s===-1)return;this.#e=!0;let{undo:t,post:e}=this.#t[this.#s];t(),e?.(),this.#e=!1,this.#s-=1}redo(){if(this.#s<this.#t.length-1){this.#s+=1,this.#e=!0;let{cmd:t,post:e}=this.#t[this.#s];t(),e?.(),this.#e=!1}}hasSomethingToUndo(){return this.#s!==-1}hasSomethingToRedo(){return this.#s<this.#t.length-1}destroy(){this.#t=null}},ee=class{constructor(t){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;let{isMac:e}=ot.platform;for(let[i,s,n={}]of t)for(let r of i){let a=r.startsWith("mac+");e&&a?(this.callbacks.set(r.slice(4),{callback:s,options:n}),this.allKeys.add(r.split("+").at(-1))):!e&&!a&&(this.callbacks.set(r,{callback:s,options:n}),this.allKeys.add(r.split("+").at(-1)))}}#t(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);let e=this.buffer.join("+");return this.buffer.length=0,e}exec(t,e){if(!this.allKeys.has(e.key))return;let i=this.callbacks.get(this.#t(e));if(!i)return;let{callback:s,options:{bubbles:n=!1,args:r=[],checker:a=null}}=i;a&&!a(t,e)||(s.bind(t,...r,e)(),n||(e.stopPropagation(),e.preventDefault()))}},Ms=class o{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){let t=new Map([["CanvasText",null],["Canvas",null]]);return No(t),B(this,"_colors",t)}convert(t){let e=$n(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(let[i,s]of this._colors)if(s.every((n,r)=>n===e[r]))return o._colorsMapping.get(i);return e}getHexCode(t){let e=this._colors.get(t);return e?M.makeHexColor(...e):t}},ke=(()=>{class o{#t=new AbortController;#e=null;#i=new Map;#s=new Map;#r=null;#n=null;#l=null;#h=new Ls;#c=null;#o=0;#d=new Set;#a=null;#u=null;#p=new Set;#f=!1;#g=!1;#b=!1;#m=null;#A=null;#w=null;#E=null;#y=!1;#v=null;#M=new Ps;#P=!1;#x=!1;#T=null;#S=null;#k=null;#R=null;#C=O.NONE;#_=new Set;#L=null;#I=null;#F=null;#V={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#j=[0,0];#N=null;#B=null;#H=null;#O=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){let e=o.prototype,i=a=>a.#B.contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&a.hasSomethingToControl(),s=(a,{target:l})=>
2{if(l instanceof HTMLInputElement){let{type:h}=l;return h!=="text"&&h!=="number"}return!0},n=this.TRANSLATE_SMALL,r=this.TRANSLATE_BIG;return B(this,"_keyboardManager",new ee([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:s}],[["ctrl+z","mac+meta+z"],e.undo,{checker:s}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:s}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete,{checker:s}],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(a,{target:l})=>!(l instanceof HTMLButtonElement)&&a.#B.contains(l)&&!a.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(a,{target:l})=>!(l instanceof HTMLButtonElement)&&a.#B.contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-n,0],checker:i}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-r,0],checker:i}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[n,0],checker:i}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[r,0],checker:i}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-n],checker:i}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-r],checker:i}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,n],checker:i}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,r],checker:i}]]))}constructor(e,i,s,n,r,a,l,h,c,d,u){let f=this._signal=this.#t.signal;this.#B=e,this.#H=i,this.#r=s,this._eventBus=n,n._on("editingaction",this.onEditingAction.bind(this),{signal:f}),n._on("pagechanging",this.onPageChanging.bind(this),{signal:f}),n._on("scalechanging",this.onScaleChanging.bind(this),{signal:f}),n._on("rotationchanging",this.onRotationChanging.bind(this),{signal:f}),n._on("setpreference",this.onSetPreference.bind(this),{signal:f}),n._on("switchannotationeditorparams",p=>this.updateParams(p.type,p.value),{signal:f}),this.#tt(),this.#nt(),this.#X(),this.#n=r.annotationStorage,this.#m=r.filterFactory,this.#I=a,this.#E=l||null,this.#f=h,this.#g=c,this.#b=d,this.#R=u||null,this.viewParameters={realScale:$t.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}destroy(){this.#O?.resolve(),this.#O=null,this.#t?.abort(),this.#t=null,this._signal=null;for(let e of this.#s.values())e.destroy();this.#s.clear(),this.#i.clear(),this.#p.clear(),this.#e=null,this.#_.clear(),this.#h.destroy(),this.#r?.destroy(),this.#v?.hide(),this.#v=null,this.#A&&(clearTimeout(this.#A),this.#A=null),this.#N&&(clearTimeout(this.#N),this.#N=null)}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return this.#R}get useNewAltTextFlow(){return this.#g}get useNewAltTextWhenAddingImage(){return this.#b}get hcmFilter(){return B(this,"hcmFilter",this.#I?this.#m.addHCMFilter(this.#I.foreground,this.#I.background):"none")}get direction(){return B(this,"direction",getComputedStyle(this.#B).direction)}get highlightColors(){return B(this,"highlightColors",this.#E?new Map(this.#E.split(",").map(e=>e.split("=").map(i=>i.trim()))):null)}get highlightColorNames(){return B(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}setMainHighlightColorPicker(e){this.#k=e}editAltText(e,i=!1){this.#r?.editAltText(this,e,i)}switchToMode(e,i){this._eventBus.on("annotationeditormodechanged",i,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,i){this._eventBus.dispatch("setpreference",{source:this,name:e,value:i})}onSetPreference({name:e,value:i}){switch(e){case"enableNewAltTextWhenAddingImage":this.#b=i;break}}onPageChanging({pageNumber:e}){this.#o=e-1}focusMainContainer(){this.#B.focus()}findParent(e,i){for(let s of this.#s.values()){let{x:n,y:r,width:a,height:l}=s.div.getBoundingClientRect();if(e>=n&&e<=n+a&&i>=r&&i<=r+l)return s}return null}disableUserSelect(e=!1){this.#H.classList.toggle("noUserSelect",e)}addShouldRescale(e){this.#p.add(e)}removeShouldRescale(e){this.#p.delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*$t.PDF_TO_CSS_UNITS;for(let i of this.#p)i.onScaleChanging()}
2onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}#U({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e}#G(e){let{currentLayer:i}=this;if(i.hasTextLayer(e))return i;for(let s of this.#s.values())if(s.hasTextLayer(e))return s;return null}highlightSelection(e=""){let i=document.getSelection();if(!i||i.isCollapsed)return;let{anchorNode:s,anchorOffset:n,focusNode:r,focusOffset:a}=i,l=i.toString(),c=this.#U(i).closest(".textLayer"),d=this.getSelectionBoxes(c);if(!d)return;i.empty();let u=this.#G(c),f=this.#C===O.NONE,p=()=>{u?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:d,anchorNode:s,anchorOffset:n,focusNode:r,focusOffset:a,text:l}),f&&this.showAllEditors("highlight",!0,!0)};if(f){this.switchToMode(O.HIGHLIGHT,p);return}p()}#J(){let e=document.getSelection();if(!e||e.isCollapsed)return;let s=this.#U(e).closest(".textLayer"),n=this.getSelectionBoxes(s);n&&(this.#v||=new Ss(this),this.#v.show(s,n,this.direction==="ltr"))}addToAnnotationStorage(e){!e.isEmpty()&&this.#n&&!this.#n.has(e.id)&&this.#n.setValue(e.id,e)}#Z(){let e=document.getSelection();if(!e||e.isCollapsed){this.#L&&(this.#v?.hide(),this.#L=null,this.#D({hasSelectedText:!1}));return}let{anchorNode:i}=e;if(i===this.#L)return;let n=this.#U(e).closest(".textLayer");if(!n){this.#L&&(this.#v?.hide(),this.#L=null,this.#D({hasSelectedText:!1}));return}if(this.#v?.hide(),this.#L=i,this.#D({hasSelectedText:!0}),!(this.#C!==O.HIGHLIGHT&&this.#C!==O.NONE)&&(this.#C===O.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#y=this.isShiftKeyDown,!this.isShiftKeyDown)){let r=this.#C===O.HIGHLIGHT?this.#G(n):null;r?.toggleDrawing();let a=new AbortController,l=this.combinedSignal(a),h=c=>{c.type==="pointerup"&&c.button!==0||(a.abort(),r?.toggleDrawing(!0),c.type==="pointerup"&&this.#$("main_toolbar"))};window.addEventListener("pointerup",h,{signal:l}),window.addEventListener("blur",h,{signal:l})}}#$(e=""){this.#C===O.HIGHLIGHT?this.highlightSelection(e):this.#f&&this.#J()}#tt(){document.addEventListener("selectionchange",this.#Z.bind(this),{signal:this._signal})}#et(){if(this.#w)return;this.#w=new AbortController;let e=this.combinedSignal(this.#w);window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})}#it(){this.#w?.abort(),this.#w=null}blur(){if(this.isShiftKeyDown=!1,this.#y&&(this.#y=!1,this.#$("main_toolbar")),!this.hasSelection)return;let{activeElement:e}=document;for(let i of this.#_)if(i.div.contains(e)){this.#S=[i,e],i._focusEventsAllowed=!1;break}}focus(){if(!this.#S)return;let[e,i]=this.#S;this.#S=null,i.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),i.focus()}#X(){if(this.#T)return;this.#T=new AbortController;let e=this.combinedSignal(this.#T);window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})}#st(){this.#T?.abort(),this.#T=null}#q(){if(this.#c)return;this.#c=new AbortController;let e=this.combinedSignal(this.#c);document.addEventListener("copy",this.copy.bind(this),{signal:e}),document.addEventListener("cut",this.cut.bind(this),{signal:e}),document.addEventListener("paste",this.paste.bind(this),{signal:e})}#K(){this.#c?.abort(),this.#c=null}#nt(){let e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})}addEditListeners(){this.#X(),this.#q()}removeEditListeners(){this.#st(),this.#K()}dragOver(e){for(let{type:i}of e.dataTransfer.items)for(let s of this.#u)if(s.isHandlingMimeForPasting(i)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(let i of e.dataTransfer.items)for(let s of this.#u)if(s.isHandlingMimeForPasting(i.type)){s.paste(i,this.currentLayer),e.preventDefault();return}}copy(e){if(e.preventDefault(),this.#e?.commitOrRemove(),!this.hasSelection)return;let i=[];for(let s of this.#_){let n=s.serialize(!0);n&&i.push(n)}i.length!==0&&e.clipboardData.setData("application/pdfjs",JSON.stringify(i))}cut(e){this.copy(e),this.delete()}paste(e){return C(this,null,function*(){e.preventDefault();let{clipboardData:i}=e;for(let r of i.items)for(let a of this.#u)if(a.isHandlingMimeForPasting(r.type)){a.paste(r,this.currentLayer);return}let s=i.getData("application/pdfjs");if(!s)return;try{s=JSON.parse(s)}catch(r){N(`paste: "${r.message}".`);return}if(!Array.isArray(s))return;this.unselectAll();let n=this.currentLayer;try{let r=[];for(let h of s){let c=yield n.deserialize(h);if(!c)return;r.push(c)}let a=()=>{for(let h of r)this.#Y(h);this.#Q(r)},l=()=>{for(let h of r)h.remove()};this.addCommands({cmd:a,undo:l,mustExec:!0})}catch(r){N(`paste: "${r.message}".`)}})}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),this.#C!==O.NONE&&!this.isEditorHandlingKeyboard&&o._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,this.#y&&(this.#y=!1,this.#$("main_toolbar")))}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu");break}}#D(e){Object.entries(e).some(([s,n])=>this.#V[s]!==n)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#V,e)}),this.#C===O.HIGHLIGHT&&e.hasSelectedEditor===!1&&this.#z([[I.HIGHLIGHT_FREE,!0]]))}#z(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})}setEditingState(e){e?(this.#et(),this.#q(),this.#D({isEditing:this.#C!==O.NONE,isEmpty:this.#W(),hasSomethingToUndo:this.#h.hasSomethingToUndo(),hasSomethingToRedo:this.#h.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#it(),this.#K(),this.#D({isEditing:!1}),this.disableUserSelect(!1))}
2registerEditorTypes(e){if(!this.#u){this.#u=e;for(let i of this.#u)this.#z(i.defaultPropertiesToUpdate)}}getId(){return this.#M.id}get currentLayer(){return this.#s.get(this.#o)}getLayer(e){return this.#s.get(e)}get currentPageIndex(){return this.#o}addLayer(e){this.#s.set(e.pageIndex,e),this.#P?e.enable():e.disable()}removeLayer(e){this.#s.delete(e.pageIndex)}updateMode(e,i=null,s=!1){return C(this,null,function*(){if(this.#C!==e&&!(this.#O&&(yield this.#O.promise,!this.#O))){if(this.#O=Promise.withResolvers(),this.#C=e,e===O.NONE){this.setEditingState(!1),this.#at(),this.#O.resolve();return}this.setEditingState(!0),yield this.#rt(),this.unselectAll();for(let n of this.#s.values())n.updateMode(e);if(!i){s&&this.addNewEditorFromKeyboard(),this.#O.resolve();return}for(let n of this.#i.values())n.annotationElementId===i?(this.setSelected(n),n.enterInEditMode()):n.unselect();this.#O.resolve()}})}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e!==this.#C&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:e})}updateParams(e,i){if(this.#u){switch(e){case I.CREATE:this.currentLayer.addNewEditor();return;case I.HIGHLIGHT_DEFAULT_COLOR:this.#k?.updateColor(i);break;case I.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#F||=new Map).set(e,i),this.showAllEditors("highlight",i);break}for(let s of this.#_)s.updateParams(e,i);for(let s of this.#u)s.updateDefaultParams(e,i)}}showAllEditors(e,i,s=!1){for(let r of this.#i.values())r.editorType===e&&r.show(i);(this.#F?.get(I.HIGHLIGHT_SHOW_ALL)??!0)!==i&&this.#z([[I.HIGHLIGHT_SHOW_ALL,i]])}enableWaiting(e=!1){if(this.#x!==e){this.#x=e;for(let i of this.#s.values())e?i.disableClick():i.enableClick(),i.div.classList.toggle("waiting",e)}}#rt(){return C(this,null,function*(){if(!this.#P){this.#P=!0;let e=[];for(let i of this.#s.values())e.push(i.enable());yield Promise.all(e);for(let i of this.#i.values())i.enable()}})}#at(){if(this.unselectAll(),this.#P){this.#P=!1;for(let e of this.#s.values())e.disable();for(let e of this.#i.values())e.disable()}}getEditors(e){let i=[];for(let s of this.#i.values())s.pageIndex===e&&i.push(s);return i}getEditor(e){return this.#i.get(e)}addEditor(e){this.#i.set(e.id,e)}removeEditor(e){e.div.contains(document.activeElement)&&(this.#A&&clearTimeout(this.#A),this.#A=setTimeout(()=>{this.focusMainContainer(),this.#A=null},0)),this.#i.delete(e.id),this.unselect(e),(!e.annotationElementId||!this.#d.has(e.annotationElementId))&&this.#n?.remove(e.id)}addDeletedAnnotationElement(e){this.#d.add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return this.#d.has(e)}removeDeletedAnnotationElement(e){this.#d.delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}#Y(e){let i=this.#s.get(e.pageIndex);i?i.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))}setActiveEditor(e){this.#e!==e&&(this.#e=e,e&&this.#z(e.propertiesToUpdate))}get#ot(){let e=null;for(e of this.#_);return e}updateUI(e){this.#ot===e&&this.#z(e.propertiesToUpdate)}toggleSelected(e){if(this.#_.has(e)){this.#_.delete(e),e.unselect(),this.#D({hasSelectedEditor:this.hasSelection});return}this.#_.add(e),e.select(),this.#z(e.propertiesToUpdate),this.#D({hasSelectedEditor:!0})}setSelected(e){for(let i of this.#_)i!==e&&i.unselect();this.#_.clear(),this.#_.add(e),e.select(),this.#z(e.propertiesToUpdate),this.#D({hasSelectedEditor:!0})}isSelected(e){return this.#_.has(e)}get firstSelectedEditor(){return this.#_.values().next().value}unselect(e){e.unselect(),this.#_.delete(e),this.#D({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#_.size!==0}get isEnterHandled(){return this.#_.size===1&&this.firstSelectedEditor.isEnterHandled}undo(){this.#h.undo(),this.#D({hasSomethingToUndo:this.#h.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#W()})}redo(){this.#h.redo(),this.#D({hasSomethingToUndo:!0,hasSomethingToRedo:this.#h.hasSomethingToRedo(),isEmpty:this.#W()})}addCommands(e){this.#h.add(e),this.#D({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#W()})}
2#W(){if(this.#i.size===0)return!0;if(this.#i.size===1)for(let e of this.#i.values())return e.isEmpty();return!1}delete(){if(this.commitOrRemove(),!this.hasSelection)return;let e=[...this.#_],i=()=>{for(let n of e)n.remove()},s=()=>{for(let n of e)this.#Y(n)};this.addCommands({cmd:i,undo:s,mustExec:!0})}commitOrRemove(){this.#e?.commitOrRemove()}hasSomethingToControl(){return this.#e||this.hasSelection}#Q(e){for(let i of this.#_)i.unselect();this.#_.clear();for(let i of e)i.isEmpty()||(this.#_.add(i),i.select());this.#D({hasSelectedEditor:this.hasSelection})}selectAll(){for(let e of this.#_)e.commit();this.#Q(this.#i.values())}unselectAll(){if(!(this.#e&&(this.#e.commitOrRemove(),this.#C!==O.NONE))&&this.hasSelection){for(let e of this.#_)e.unselect();this.#_.clear(),this.#D({hasSelectedEditor:!1})}}translateSelectedEditors(e,i,s=!1){if(s||this.commitOrRemove(),!this.hasSelection)return;this.#j[0]+=e,this.#j[1]+=i;let[n,r]=this.#j,a=[...this.#_],l=1e3;this.#N&&clearTimeout(this.#N),this.#N=setTimeout(()=>{this.#N=null,this.#j[0]=this.#j[1]=0,this.addCommands({cmd:()=>{for(let h of a)this.#i.has(h.id)&&h.translateInPage(n,r)},undo:()=>{for(let h of a)this.#i.has(h.id)&&h.translateInPage(-n,-r)},mustExec:!1})},l);for(let h of a)h.translateInPage(e,i)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#a=new Map;for(let e of this.#_)this.#a.set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#a)return!1;this.disableUserSelect(!1);let e=this.#a;this.#a=null;let i=!1;for(let[{x:n,y:r,pageIndex:a},l]of e)l.newX=n,l.newY=r,l.newPageIndex=a,i||=n!==l.savedX||r!==l.savedY||a!==l.savedPageIndex;if(!i)return!1;let s=(n,r,a,l)=>{if(this.#i.has(n.id)){let h=this.#s.get(l);h?n._setParentAndPosition(h,r,a):(n.pageIndex=l,n.x=r,n.y=a)}};return this.addCommands({cmd:()=>{for(let[n,{newX:r,newY:a,newPageIndex:l}]of e)s(n,r,a,l)},undo:()=>{for(let[n,{savedX:r,savedY:a,savedPageIndex:l}]of e)s(n,r,a,l)},mustExec:!0}),!0}dragSelectedEditors(e,i){if(this.#a)for(let s of this.#a.keys())s.drag(e,i)}rebuild(e){if(e.parent===null){let i=this.getLayer(e.pageIndex);i?(i.changeParent(e),i.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||this.#_.size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return this.#e===e}getActive(){return this.#e}getMode(){return this.#C}get imageManager(){return B(this,"imageManager",new Ts)}getSelectionBoxes(e){if(!e)return null;let i=document.getSelection();for(let c=0,d=i.rangeCount;c<d;c++)if(!e.contains(i.getRangeAt(c).commonAncestorContainer))return null;let{x:s,y:n,width:r,height:a}=e.getBoundingClientRect(),l;switch(e.getAttribute("data-main-rotation")){case"90":l=(c,d,u,f)=>({x:(d-n)/a,y:1-(c+u-s)/r,width:f/a,height:u/r});break;case"180":l=(c,d,u,f)=>({x:1-(c+u-s)/r,y:1-(d+f-n)/a,width:u/r,height:f/a});break;case"270":l=(c,d,u,f)=>({x:1-(d+f-n)/a,y:(c-s)/r,width:f/a,height:u/r});break;default:l=(c,d,u,f)=>({x:(c-s)/r,y:(d-n)/a,width:u/r,height:f/a});break}let h=[];for(let c=0,d=i.rangeCount;c<d;c++){let u=i.getRangeAt(c);if(!u.collapsed)for(let{x:f,y:p,width:g,height:b}of u.getClientRects())g===0||b===0||h.push(l(f,p,g,b))}return h.length===0?null:h}addChangedExistingAnnotation({annotationElementId:e,id:i}){(this.#l||=new Map).set(e,i)}removeChangedExistingAnnotation({annotationElementId:e}){this.#l?.delete(e)}renderAnnotationElement(e){let i=this.#l?.get(e.data.id);if(!i)return;let s=this.#n.getRawValue(i);s&&(this.#C===O.NONE&&!s.hasBeenModified||s.renderAnnotationElement(e))}}return o})(),ca=(()=>{class o{#t=null;#e=!1;#i=null;#s=null;#r=null;#n=null;#l=!1;#h=null;#c=null;#o=null;#d=null;#a=!1;static#u=null;static _l10n=null;constructor(e){this.#c=e,this.#a=e._uiManager.useNewAltTextFlow,o.#u||=Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"})}static initialize(e){o._l10n??=e}render(){return C(this,null,function*(){let e=this.#i=document.createElement("button");e.className="altText",e.tabIndex="0";let i=this.#s=document.createElement("span");e.append(i),this.#a?(e.classList.add("new"),e.setAttribute("data-l10n-id",o.#u.missing),i.setAttribute("data-l10n-id",o.#u["missing-label"])):(e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),i.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));let s=this.#c._uiManager._signal;e.addEventListener("contextmenu",yt,{signal:s}),e.addEventListener("pointerdown",r=>r.stopPropagation(),{signal:s});let n=r=>{r.preventDefault(),this.#c._uiManager.editAltText(this.#c),this.#a&&this.#c._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:this.#p}})};return e.addEventListener("click",n,{capture:!0,signal:s}),e.addEventListener("keydown",r=>{r.target===e&&r.key==="Enter"&&(this.#l=!0,n(r))},{signal:s}),yield this.#f(),e})}get#p(){return this.#t&&"added"||this.#t===null&&this.guessedText&&"review"||"missing"}finish(){this.#i&&(this.#i.focus({focusVisible:this.#l}),this.#l=!1)}isEmpty(){return this.#a?this.#t===null:!this.#t&&!this.#e}
2hasData(){return this.#a?this.#t!==null||!!this.#o:this.isEmpty()}get guessedText(){return this.#o}setGuessedText(e){return C(this,null,function*(){this.#t===null&&(this.#o=e,this.#d=yield o._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e}),this.#f())})}toggleAltTextBadge(e=!1){if(!this.#a||this.#t){this.#h?.remove(),this.#h=null;return}if(!this.#h){let i=this.#h=document.createElement("div");i.className="noAltTextBadge",this.#c.div.append(i)}this.#h.classList.toggle("hidden",!e)}serialize(e){let i=this.#t;return!e&&this.#o===i&&(i=this.#d),{altText:i,decorative:this.#e,guessedText:this.#o,textWithDisclaimer:this.#d}}get data(){return{altText:this.#t,decorative:this.#e}}set data({altText:e,decorative:i,guessedText:s,textWithDisclaimer:n,cancel:r=!1}){s&&(this.#o=s,this.#d=n),!(this.#t===e&&this.#e===i)&&(r||(this.#t=e,this.#e=i),this.#f())}toggle(e=!1){this.#i&&(!e&&this.#n&&(clearTimeout(this.#n),this.#n=null),this.#i.disabled=!e)}shown(){this.#c._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:this.#p}})}destroy(){this.#i?.remove(),this.#i=null,this.#s=null,this.#r=null,this.#h?.remove(),this.#h=null}#f(){return C(this,null,function*(){let e=this.#i;if(!e)return;if(this.#a){if(e.classList.toggle("done",!!this.#t),e.setAttribute("data-l10n-id",o.#u[this.#p]),this.#s?.setAttribute("data-l10n-id",o.#u[`${this.#p}-label`]),!this.#t){this.#r?.remove();return}}else{if(!this.#t&&!this.#e){e.classList.remove("done"),this.#r?.remove();return}e.classList.add("done"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let i=this.#r;if(!i){this.#r=i=document.createElement("span"),i.className="tooltip",i.setAttribute("role","tooltip"),i.id=`alt-text-tooltip-${this.#c.id}`;let n=100,r=this.#c._uiManager._signal;r.addEventListener("abort",()=>{clearTimeout(this.#n),this.#n=null},{once:!0}),e.addEventListener("mouseenter",()=>{this.#n=setTimeout(()=>{this.#n=null,this.#r.classList.add("show"),this.#c._reportTelemetry({action:"alt_text_tooltip"})},n)},{signal:r}),e.addEventListener("mouseleave",()=>{this.#n&&(clearTimeout(this.#n),this.#n=null),this.#r?.classList.remove("show")},{signal:r})}this.#e?i.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(i.removeAttribute("data-l10n-id"),i.textContent=this.#t),i.parentNode||e.append(i),this.#c.getImageForAltText()?.setAttribute("aria-describedby",i.id)})}}return o})(),z=class o{#t=null;#e=null;#i=null;#s=!1;#r=!1;#n=null;#l=null;#h=null;#c="";#o=!1;#d=null;#a=!1;#u=!1;#p=!1;#f=null;#g=0;#b=0;#m=null;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nResizer=null;#A=!1;#w=o._zIndex++;static _borderLineWidth=-1;static _colorManager=new Ms;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){let t=o.prototype._resizeWithKeyboard,e=ke.TRANSLATE_SMALL,i=ke.TRANSLATE_BIG;return B(this,"_resizerKeyboardManager",new ee([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-i,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[i,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-i]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,i]}],[["Escape","mac+Escape"],o.prototype._stopResizingWithKeyboard]]))}constructor(t){this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null;let{rotation:e,rawDims:{pageWidth:i,pageHeight:s,pageX:n,pageY:r}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,s],this.pageTranslation=[n,r];let[a,l]=this.parentDimensions;this.x=t.x/a,this.y=t.y/l,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return B(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){let e=new ks({id:t.parent.getNextId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){if(o._l10n??=t,o._l10nResizer||=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"}),o._borderLineWidth!==-1)return;let i=getComputedStyle(document.documentElement);o._borderLineWidth=parseFloat(i.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){U("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#A}set _isDraggable(t){this.#A=t,this.div?.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){let[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(t*2),this.y+=this.width*t/(e*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(t*2),this.y-=this.width*t/(e*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}
2setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#w}setParent(t){t!==null?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):this.#F(),this.parent=t}focusin(t){this._focusEventsAllowed&&(this.#o?this.#o=!1:this.parent.setSelected(this))}focusout(t){!this._focusEventsAllowed||!this.isAttachedToDOM||t.relatedTarget?.closest(`#${this.id}`)||(t.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,i,s){let[n,r]=this.parentDimensions;[i,s]=this.screenToPageTranslation(i,s),this.x=(t+i)/n,this.y=(e+s)/r,this.fixAndSetPosition()}#E([t,e],i,s){[i,s]=this.screenToPageTranslation(i,s),this.x+=i/t,this.y+=s/e,this.fixAndSetPosition()}translate(t,e){this.#E(this.parentDimensions,t,e)}translateInPage(t,e){this.#d||=[this.x,this.y],this.#E(this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){this.#d||=[this.x,this.y];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:h,y:c}=this.div.getBoundingClientRect();this.parent.findNewParent(this,h,c)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:n,y:r}=this,[a,l]=this.getBaseTranslation();n+=a,r+=l,this.div.style.left=`${(100*n).toFixed(2)}%`,this.div.style.top=`${(100*r).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!this.#d&&(this.#d[0]!==this.x||this.#d[1]!==this.y)}getBaseTranslation(){let[t,e]=this.parentDimensions,{_borderLineWidth:i}=o,s=i/t,n=i/e;switch(this.rotation){case 90:return[-s,n];case 180:return[s,n];case 270:return[s,-n];default:return[-s,-n]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){let[e,i]=this.pageDimensions,{x:s,y:n,width:r,height:a}=this;if(r*=e,a*=i,s*=e,n*=i,this._mustFixPosition)switch(t){case 0:s=Math.max(0,Math.min(e-r,s)),n=Math.max(0,Math.min(i-a,n));break;case 90:s=Math.max(0,Math.min(e-a,s)),n=Math.min(i,Math.max(r,n));break;case 180:s=Math.min(e,Math.max(r,s)),n=Math.min(i,Math.max(a,n));break;case 270:s=Math.min(e,Math.max(a,s)),n=Math.max(0,Math.min(i-r,n));break}this.x=s/=e,this.y=n/=i;let[l,h]=this.getBaseTranslation();s+=l,n+=h;let{style:c}=this.div;c.left=`${(100*s).toFixed(2)}%`,c.top=`${(100*n).toFixed(2)}%`,this.moveInDOM()}static#y(t,e,i){switch(i){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}screenToPageTranslation(t,e){return o.#y(t,e,this.parentRotation)}pageTranslationToScreen(t,e){return o.#y(t,e,360-this.parentRotation)}#v(t){switch(t){case 90:{let[e,i]=this.pageDimensions;return[0,-e/i,i/e,0]}case 180:return[-1,0,0,-1];case 270:{let[e,i]=this.pageDimensions;return[0,e/i,-i/e,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{parentScale:t,pageDimensions:[e,i]}=this;return[e*t,i*t]}setDims(t,e){let[i,s]=this.parentDimensions;this.div.style.width=`${(100*t/i).toFixed(2)}%`,this.#r||(this.div.style.height=`${(100*e/s).toFixed(2)}%`)}fixDims(){let{style:t}=this.div,{height:e,width:i}=t,s=i.endsWith("%"),n=!this.#r&&e.endsWith("%");if(s&&n)return;let[r,a]=this.parentDimensions;s||(t.width=`${(100*parseFloat(i)/r).toFixed(2)}%`),!this.#r&&!n&&(t.height=`${(100*parseFloat(e)/a).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#M(){if(this.#n)return;this.#n=document.createElement("div"),this.#n.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 s=document.createElement("div");this.#n.append(s),s.classList.add("resizer",i),s.setAttribute("data-resizer-name",i),s.addEventListener("pointerdown",this.#P.bind(this,i),{signal:e}),s.addEventListener("contextmenu",yt,{signal:e}),s.tabIndex=-1}this.div.prepend(this.#n)}#P(t,e){e.preventDefault();let{isMac:i}=ot.platform;if(e.button!==0||e.ctrlKey&&i)return;this.#i?.toggle(!1);let s=this._isDraggable;this._isDraggable=!1;let n=new AbortController,r=this._uiManager.combinedSignal(n);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",this.#T.bind(this,t),{passive:!0,capture:!0,signal:r}),window.addEventListener("contextmenu",yt,{signal:r});let a=this.x,l=this.y,h=this.width,c=this.height,d=this.parent.div.style.cursor,u=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;let f=()=>{n.abort(),this.parent.togglePointerEvents(!0),this.#i?.toggle(!0),this._isDraggable=s,this.parent.div.style.cursor=d,this.div.style.cursor=u,this.#x(a,l,h,c)};window.addEventListener("pointerup",f,{signal:r}),window.addEventListener("blur",f,{signal:r})}
2#x(t,e,i,s){let n=this.x,r=this.y,a=this.width,l=this.height;n===t&&r===e&&a===i&&l===s||this.addCommands({cmd:()=>{this.width=a,this.height=l,this.x=n,this.y=r;let[h,c]=this.parentDimensions;this.setDims(h*a,c*l),this.fixAndSetPosition()},undo:()=>{this.width=i,this.height=s,this.x=t,this.y=e;let[h,c]=this.parentDimensions;this.setDims(h*i,c*s),this.fixAndSetPosition()},mustExec:!0})}#T(t,e){let[i,s]=this.parentDimensions,n=this.x,r=this.y,a=this.width,l=this.height,h=o.MIN_SIZE/i,c=o.MIN_SIZE/s,d=k=>Math.round(k*1e4)/1e4,u=this.#v(this.rotation),f=(k,D)=>[u[0]*k+u[2]*D,u[1]*k+u[3]*D],p=this.#v(360-this.rotation),g=(k,D)=>[p[0]*k+p[2]*D,p[1]*k+p[3]*D],b,m,w=!1,y=!1;switch(t){case"topLeft":w=!0,b=(k,D)=>[0,0],m=(k,D)=>[k,D];break;case"topMiddle":b=(k,D)=>[k/2,0],m=(k,D)=>[k/2,D];break;case"topRight":w=!0,b=(k,D)=>[k,0],m=(k,D)=>[0,D];break;case"middleRight":y=!0,b=(k,D)=>[k,D/2],m=(k,D)=>[0,D/2];break;case"bottomRight":w=!0,b=(k,D)=>[k,D],m=(k,D)=>[0,0];break;case"bottomMiddle":b=(k,D)=>[k/2,D],m=(k,D)=>[k/2,0];break;case"bottomLeft":w=!0,b=(k,D)=>[0,D],m=(k,D)=>[k,0];break;case"middleLeft":y=!0,b=(k,D)=>[0,D/2],m=(k,D)=>[k,D/2];break}let A=b(a,l),v=m(a,l),S=f(...v),P=d(n+S[0]),T=d(r+S[1]),_=1,E=1,[L,V]=this.screenToPageTranslation(e.movementX,e.movementY);if([L,V]=g(L/i,V/s),w){let k=Math.hypot(a,l);_=E=Math.max(Math.min(Math.hypot(v[0]-A[0]-L,v[1]-A[1]-V)/k,1/a,1/l),h/a,c/l)}else y?_=Math.max(h,Math.min(1,Math.abs(v[0]-A[0]-L)))/a:E=Math.max(c,Math.min(1,Math.abs(v[1]-A[1]-V)))/l;let H=d(a*_),F=d(l*E);S=f(...m(H,F));let W=P-S[0],Q=T-S[1];this.width=H,this.height=F,this.x=W,this.y=Q,this.setDims(i*H,s*F),this.fixAndSetPosition()}altTextFinish(){this.#i?.finish()}addEditToolbar(){return C(this,null,function*(){return this._editToolbar||this.#u?this._editToolbar:(this._editToolbar=new Cs(this),this.div.append(this._editToolbar.render()),this.#i&&(yield this._editToolbar.addAltText(this.#i)),this._editToolbar)})}removeEditToolbar(){this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,this.#i?.destroy())}addContainer(t){let e=this._editToolbar?.div;e?e.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}addAltTextButton(){return C(this,null,function*(){this.#i||(ca.initialize(o._l10n),this.#i=new ca(this),this.#t&&(this.#i.data=this.#t,this.#t=null),yield this.addEditToolbar())})}get altTextData(){return this.#i?.data}set altTextData(t){this.#i&&(this.#i.data=t)}get guessedAltText(){return this.#i?.guessedText}setGuessedAltText(t){return C(this,null,function*(){yield this.#i?.setGuessedText(t)})}serializeAltText(t){return this.#i?.serialize(t)}hasAltText(){return!!this.#i&&!this.#i.isEmpty()}hasAltTextData(){return this.#i?.hasData()??!1}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=this.#s?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),this.#R();let[t,e]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*e/t).toFixed(2)}%`,this.div.style.maxHeight=`${(100*t/e).toFixed(2)}%`);let[i,s]=this.getInitialTranslation();return this.translate(i,s),di(this,this.div,["pointerdown"]),this.div}pointerdown(t){let{isMac:e}=ot.platform;if(t.button!==0||t.ctrlKey&&e){t.preventDefault();return}if(this.#o=!0,this._isDraggable){this.#k(t);return}this.#S(t)}get isSelected(){return this._uiManager.isSelected(this)}#S(t){let{isMac:e}=ot.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}#k(t){let{isSelected:e}=this;this._uiManager.setUpDragSession();let i=new AbortController,s=this._uiManager.combinedSignal(i);if(e){this.div.classList.add("moving"),this.#g=t.clientX,this.#b=t.clientY;let r=a=>{let{clientX:l,clientY:h}=a,[c,d]=this.screenToPageTranslation(l-this.#g,h-this.#b);this.#g=l,this.#b=h,this._uiManager.dragSelectedEditors(c,d)};window.addEventListener("pointermove",r,{passive:!0,capture:!0,signal:s})}let n=()=>{i.abort(),e&&this.div.classList.remove("moving"),this.#o=!1,this._uiManager.endDragSession()||this.#S(t)};window.addEventListener("pointerup",n,{signal:s}),window.addEventListener("blur",n,{signal:s})}moveInDOM(){this.#f&&clearTimeout(this.#f),this.#f=setTimeout(()=>{this.#f=null,this.parent?.moveEditorInDOM(this)},0)}
2_setParentAndPosition(t,e,i){t.changeParent(this),this.x=e,this.y=i,this.fixAndSetPosition()}getRect(t,e,i=this.rotation){let s=this.parentScale,[n,r]=this.pageDimensions,[a,l]=this.pageTranslation,h=t/s,c=e/s,d=this.x*n,u=this.y*r,f=this.width*n,p=this.height*r;switch(i){case 0:return[d+h+a,r-u-c-p+l,d+h+f+a,r-u-c+l];case 90:return[d+c+a,r-u+h+l,d+c+p+a,r-u+h+f+l];case 180:return[d-h-f+a,r-u+c+l,d-h+a,r-u+c+p+l];case 270:return[d-c-p+a,r-u-h-f+l,d-c+a,r-u-h+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(t,e){let[i,s,n,r]=t,a=n-i,l=r-s;switch(this.rotation){case 0:return[i,e-r,a,l];case 90:return[i,e-s,l,a];case 180:return[n,e-s,a,l];case 270:return[n,e-r,l,a];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#u=!0}disableEditMode(){this.#u=!1}isInEditMode(){return this.#u}shouldGetKeyboardEvents(){return this.#p}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}#R(){if(this.#h||!this.div)return;this.#h=new AbortController;let t=this._uiManager.combinedSignal(this.#h);this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})}rebuild(){this.#R()}rotate(t){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(t=!1,e=null){U("An editor must be serializable")}static deserialize(t,e,i){return C(this,null,function*(){let s=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:i});s.rotation=t.rotation,s.#t=t.accessibilityData;let[n,r]=s.pageDimensions,[a,l,h,c]=s.getRectInCurrentCoords(t.rect,r);return s.x=a/n,s.y=l/r,s.width=h/n,s.height=c/r,s})}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.#h?.abort(),this.#h=null,this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#f&&(clearTimeout(this.#f),this.#f=null),this.#F(),this.removeEditToolbar(),this.#m){for(let t of this.#m.values())clearTimeout(t);this.#m=null}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#M(),this.#n.classList.remove("hidden"),di(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||t.key!=="Enter")return;this._uiManager.setSelected(this),this.#l={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let e=this.#n.children;if(!this.#e){this.#e=Array.from(e);let r=this.#C.bind(this),a=this.#_.bind(this),l=this._uiManager._signal;for(let h of this.#e){let c=h.getAttribute("data-resizer-name");h.setAttribute("role","spinbutton"),h.addEventListener("keydown",r,{signal:l}),h.addEventListener("blur",a,{signal:l}),h.addEventListener("focus",this.#L.bind(this,c),{signal:l}),h.setAttribute("data-l10n-id",o._l10nResizer[c])}}let i=this.#e[0],s=0;for(let r of e){if(r===i)break;s++}let n=(360-this.rotation+this.parentRotation)%360/90*(this.#e.length/4);if(n!==s){if(n<s)for(let a=0;a<s-n;a++)this.#n.append(this.#n.firstChild);else if(n>s)for(let a=0;a<n-s;a++)this.#n.firstChild.before(this.#n.lastChild);let r=0;for(let a of e){let h=this.#e[r++].getAttribute("data-resizer-name");a.setAttribute("data-l10n-id",o._l10nResizer[h])}}this.#I(0),this.#p=!0,this.#n.firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#C(t){o._resizerKeyboardManager.exec(this,t)}#_(t){this.#p&&t.relatedTarget?.parentNode!==this.#n&&this.#F()}#L(t){this.#c=this.#p?t:""}#I(t){if(this.#e)for(let e of this.#e)e.tabIndex=t}_resizeWithKeyboard(t,e){this.#p&&this.#T(this.#c,{movementX:t,movementY:e})}#F(){if(this.#p=!1,this.#I(-1),this.#l){let{savedX:t,savedY:e,savedWidth:i,savedHeight:s}=this.#l;this.#x(t,e,i,s),this.#l=null}}_stopResizingWithKeyboard(){this.#F(),this.div.focus()}select(){if(this.makeResizable(),this.div?.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()});return}this._editToolbar?.show(),this.#i?.toggleAltTextBadge(!1)}unselect(){this.#n?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),this.#i?.toggleAltTextBadge(!0)}updateParams(t,e){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return this.#a}set isEditing(t){this.#a=t,this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){this.#r=!0;let i=t/e,{style:s}=this.div;s.aspectRatio=i,s.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t,e=!1){if(e){this.#m||=new Map;let{action:i}=t,s=this.#m.get(i);s&&clearTimeout(s),s=setTimeout(()=>{this._reportTelemetry(t),this.#m.delete(i),this.#m.size===0&&(this.#m=null)},o._telemetryTimeout),this.#m.set(i,s);return}t.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}
2show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),this.#s=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#s=!0}renderAnnotationElement(t){let e=t.container.querySelector(".annotationContent");if(!e)e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),t.container.prepend(e);else if(e.nodeName==="CANVAS"){let i=e;e=document.createElement("div"),e.classList.add("annotationContent",this.editorType),i.before(e)}return e}resetAnnotationElement(t){let{firstChild:e}=t.container;e?.nodeName==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}},ks=class extends z{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}},da=3285377520,wt=4294901760,St=65535,ui=class{constructor(t){this.h1=t?t&4294967295:da,this.h2=t?t&4294967295:da}update(t){let e,i;if(typeof t=="string"){e=new Uint8Array(t.length*2),i=0;for(let g=0,b=t.length;g<b;g++){let m=t.charCodeAt(g);m<=255?e[i++]=m:(e[i++]=m>>>8,e[i++]=m&255)}}else if(ArrayBuffer.isView(t))e=t.slice(),i=e.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");let s=i>>2,n=i-s*4,r=new Uint32Array(e.buffer,0,s),a=0,l=0,h=this.h1,c=this.h2,d=3432918353,u=461845907,f=d&St,p=u&St;for(let g=0;g<s;g++)g&1?(a=r[g],a=a*d&wt|a*f&St,a=a<<15|a>>>17,a=a*u&wt|a*p&St,h^=a,h=h<<13|h>>>19,h=h*5+3864292196):(l=r[g],l=l*d&wt|l*f&St,l=l<<15|l>>>17,l=l*u&wt|l*p&St,c^=l,c=c<<13|c>>>19,c=c*5+3864292196);switch(a=0,n){case 3:a^=e[s*4+2]<<16;case 2:a^=e[s*4+1]<<8;case 1:a^=e[s*4],a=a*d&wt|a*f&St,a=a<<15|a>>>17,a=a*u&wt|a*p&St,s&1?h^=a:c^=a}this.h1=h,this.h2=c}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&wt|t*36045&St,e=e*4283543511&wt|((e<<16|t>>>16)*2950163797&wt)>>>16,t^=e>>>1,t=t*444984403&wt|t*60499&St,e=e*3301882366&wt|((e<<16|t>>>16)*3120437893&wt)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}},Is=Object.freeze({map:null,hash:"",transfer:void 0}),Ie=class{#t=!1;#e=null;#i=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(t,e){let i=this.#i.get(t);return i===void 0?e:Object.assign(e,i)}getRawValue(t){return this.#i.get(t)}remove(t){if(this.#i.delete(t),this.#i.size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(let e of this.#i.values())if(e instanceof z)return;this.onAnnotationEditor(null)}}setValue(t,e){let i=this.#i.get(t),s=!1;if(i!==void 0)for(let[n,r]of Object.entries(e))i[n]!==r&&(s=!0,i[n]=r);else s=!0,this.#i.set(t,e);s&&this.#s(),e instanceof z&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(e.constructor._type)}has(t){return this.#i.has(t)}getAll(){return this.#i.size>0?zn(this.#i):null}setAll(t){for(let[e,i]of Object.entries(t))this.setValue(e,i)}get size(){return this.#i.size}#s(){this.#t||(this.#t=!0,typeof this.onSetModified=="function"&&this.onSetModified())}resetModified(){this.#t&&(this.#t=!1,typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new fi(this)}get serializable(){if(this.#i.size===0)return Is;let t=new Map,e=new ui,i=[],s=Object.create(null),n=!1;for(let[r,a]of this.#i){let l=a instanceof z?a.serialize(!1,s):a;l&&(t.set(r,l),e.update(`${r}:${JSON.stringify(l)}`),n||=!!l.bitmap)}if(n)for(let r of t.values())r.bitmap&&i.push(r.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:i}:Is}get editorStats(){let t=null,e=new Map;for(let i of this.#i.values()){if(!(i instanceof z))continue;let s=i.telemetryFinalData;if(!s)continue;let{type:n}=s;e.has(n)||e.set(n,Object.getPrototypeOf(i).constructor),t||=Object.create(null);let r=t[n]||=new Map;for(let[a,l]of Object.entries(s)){if(a==="type")continue;let h=r.get(a);h||(h=new Map,r.set(a,h));let c=h.get(l)??0;h.set(l,c+1)}}for(let[i,s]of e)t[i]=s.computeTelemetryFinalData(t[i]);return t}resetModifiedIds(){this.#e=null}get modifiedIds(){if(this.#e)return this.#e;let t=[];for(let e of this.#i.values())!(e instanceof z)||!e.annotationElementId||!e.serialize()||t.pu
2sh(e.annotationElementId);return this.#e={ids:new Set(t),hash:t.join(",")}}},fi=class extends Ie{#t;constructor(t){super();let{map:e,hash:i,transfer:s}=t.serializable,n=structuredClone(e,s?{transfer:s}:null);this.#t={map:n,hash:i,transfer:s}}get print(){U("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#t}get modifiedIds(){return B(this,"modifiedIds",{ids:new Set,hash:""})}},Rs=class{#t=new Set;constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));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(),this.#t.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}loadSystemFont(i){return C(this,arguments,function*({systemFontInfo:t,_inspectFont:e}){if(!(!t||this.#t.has(t.loadedName))){if(rt(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:s,src:n,style:r}=t,a=new FontFace(s,n,r);this.addNativeFontFace(a);try{yield a.load(),this.#t.add(s),e?.(t)}catch{N(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(a)}return}U("Not implemented: loadSystemFont without the Font Loading API.")}})}bind(t){return C(this,null,function*(){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo){yield this.loadSystemFont(t);return}if(this.isFontLoadingAPISupported){let i=t.createNativeFontFace();if(i){this.addNativeFontFace(i);try{yield i.loaded}catch(s){throw N(`Failed to load font '${i.family}': '${s}'.`),t.disableFontFace=!0,s}}return}let e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;yield new Promise(i=>{let s=this._queueLoadingCallback(i);this._prepareFontLoadEvent(t,s)})}})}get isFontLoadingAPISupported(){let t=!!this._document?.fonts;return B(this,"isFontLoadingAPISupported",t)}get isSyncFontLoadingSupported(){let t=!1;return(ct||typeof navigator<"u"&&typeof navigator?.userAgent=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(t=!0),B(this,"isSyncFontLoadingSupported",t)}_queueLoadingCallback(t){function e(){for(rt(!s.done,"completeRequest() cannot be called twice."),s.done=!0;i.length>0&&i[0].done;){let n=i.shift();setTimeout(n.callback,0)}}let{loadingRequests:i}=this,s={done:!1,complete:e,callback:t};return i.push(s),s}get _loadTestFont(){let t=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return B(this,"_loadTestFont",t)}_prepareFontLoadEvent(t,e){function i(A,v){return A.charCodeAt(v)<<24|A.charCodeAt(v+1)<<16|A.charCodeAt(v+2)<<8|A.charCodeAt(v+3)&255}function s(A,v,S,P){let T=A.substring(0,v),_=A.substring(v+S);return T+P+_}let n,r,a=this._document.createElement("canvas");a.width=1,a.height=1;let l=a.getContext("2d"),h=0;function c(A,v){if(++h>30){N("Load test font never loaded."),v();return}if(l.font="30px "+A,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0){v();return}setTimeout(c.bind(null,A,v))}let d=`lt${Date.now()}${this.loadTestFontId++}`,u=this._loadTestFont;u=s(u,976,d.length,d);let p=16,g=1482184792,b=i(u,p);for(n=0,r=d.length-3;n<r;n+=4)b=b-g+i(d,n)|0;n<d.length&&(b=b-g+i(d+"XXX",n)|0),u=s(u,p,4,So(b));let m=`url(data:font/opentype;base64,${btoa(u)});`,w=`@font-face {font-family:"${d}";src:${m}}`;this.insertRule(w);let y=this._document.createElement("div");y.style.visibility="hidden",y.style.width=y.style.height="10px",y.style.position="absolute",y.style.top=y.style.left="0px";for(let A of[t.loadedName,d]){let v=this._document.createElement("span");v.textContent="Hi",v.style.fontFamily=A,y.append(v)}this._document.body.append(y),c(d,()=>{y.remove(),e.complete()})}}
2,Os=class{constructor(t,{disableFontFace:e=!1,inspectFont:i=null}){this.compiledGlyphs=Object.create(null);for(let s in t)this[s]=t[s];this.disableFontFace=e===!0,this._inspectFont=i}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let t;if(!this.cssFontInfo)t=new FontFace(this.loadedName,this.data,{});else{let e={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(e.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,e)}return this._inspectFont?.(this),t}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;let t=`url(data:${this.mimetype};base64,${Io(this.data)});`,e;if(!this.cssFontInfo)e=`@font-face {font-family:"${this.loadedName}";src:${t}}`;else{let i=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(i+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),e=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${i}src:${t}}`}return this._inspectFont?.(this,t),e}getPathGenerator(t,e){if(this.compiledGlyphs[e]!==void 0)return this.compiledGlyphs[e];let i;try{i=t.get(this.loadedName+"_path_"+e)}catch(n){N(`getPathGenerator - ignoring character: "${n}".`)}if(!Array.isArray(i)||i.length===0)return this.compiledGlyphs[e]=function(n,r){};let s=[];for(let n=0,r=i.length;n<r;)switch(i[n++]){case It.BEZIER_CURVE_TO:{let[a,l,h,c,d,u]=i.slice(n,n+6);s.push(f=>f.bezierCurveTo(a,l,h,c,d,u)),n+=6}break;case It.MOVE_TO:{let[a,l]=i.slice(n,n+2);s.push(h=>h.moveTo(a,l)),n+=2}break;case It.LINE_TO:{let[a,l]=i.slice(n,n+2);s.push(h=>h.lineTo(a,l)),n+=2}break;case It.QUADRATIC_CURVE_TO:{let[a,l,h,c]=i.slice(n,n+4);s.push(d=>d.quadraticCurveTo(a,l,h,c)),n+=4}break;case It.RESTORE:s.push(a=>a.restore());break;case It.SAVE:s.push(a=>a.save());break;case It.SCALE:rt(s.length===2,"Scale command is only valid at the third position.");break;case It.TRANSFORM:{let[a,l,h,c,d,u]=i.slice(n,n+6);s.push(f=>f.transform(a,l,h,c,d,u)),n+=6}break;case It.TRANSLATE:{let[a,l]=i.slice(n,n+2);s.push(h=>h.translate(a,l)),n+=2}break}return this.compiledGlyphs[e]=function(r,a){s[0](r),s[1](r),r.scale(a,-a);for(let l=2,h=s.length;l<h;l++)s[l](r)}}},pi=class{#t=!1;constructor({enableHWA:t=!1}){this.#t=t}create(t,e){if(t<=0||e<=0)throw new Error("Invalid canvas size");let i=this._createCanvas(t,e);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!this.#t})}}reset(t,e,i){if(!t.canvas)throw new Error("Canvas is not specified");if(e<=0||i<=0)throw new Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=i}destroy(t){if(!t.canvas)throw new Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){U("Abstract method `_createCanvas` called.")}},Ds=class extends pi{constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}_createCanvas(t,e){let i=this._document.createElement("canvas");return i.width=t,i.height=e,i}},gi=class{constructor({baseUrl:t=null,isCompressed:e=!0}){this.baseUrl=t,this.isCompressed=e}fetch(e){return C(this,arguments,function*({name:t}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!t)throw new Error("CMap name must be specified.");let i=this.baseUrl+t+(this.isCompressed?".bcmap":"");return this._fetch(i).then(s=>({cMapData:s,isCompressed:this.isCompressed})).catch(s=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${i}`)})})}_fetch(t){return C(this,null,function*(){U("Abstract method `_fetch` called.")})}},mi=class extends gi{_fetch(t){return C(this,null,function*(){let e=yield $i(t,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):Ui(e)})}},bi=class{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,i,s,n){return"none"}destroy(t=!1){}},Ns=class extends bi{#t;#e;#i;#s;#r;#n;#l=0;constructor({docId:t,ownerDocument:e=globalThis.document}){super(),this.#s=t,this.#r=e}get#h(){return this.#e||=new Map}get#c(){return this.#n||=new Map}get#o(){if(!this.#i){let t=this.#r.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=this.#r.createElementNS(Ot,"svg");i.setAttribute("width",0),i.setAttribute("height",0),this.#i=this.#r.createElementNS(Ot,"defs"),t.append(i),i.append(this.#i),this.#r.body.append(t)}return this.#i}#d(t){if(t.length===1){let l=t[0],h=new Array(256);for(let d=0;d<256;d++)h[d]=l[d]/255;let c=h.join(",");return[c,c,c]}let[e,i,s]=t,n=new Array(256),r=new Array(256),a=new Array(256);for(let l=0;l<256;l++)n[l]=e[l]/255,r[l]=i[l]/255,a[l]=s[l]/255;return[n.join(","),r.join(","),a.join(",")]}#a(t){if(this.#t===void 0){this.#t="";let e=this.#r.URL;e!==this.#r.baseURI&&(Gi(e)?N('#createUrl: ignore "data:"-URL for performance reasons.'):this.#t=e.split("#",1)[0])}return`url(${this.#t}#${t})`}addFilter(t){if(!t)return"none";let e=this.#h.get(t);if(e)return e;let[i,s,n]=this.#d(t),r=t.length===1?i:`${i}${s}${n}`;if(e=this.#h.get(r),e)return this.#h.set(t,e),e;let a=`g_${this.#s}_transfer_map_${this.#l++}`,l=this.#a(a);this.#h.set(t,l),this.#h.set(r,l);let h=this.#f(a);return this.#b(i,s,n,h),l}addHCMFilter(t,e){let i=`${t}-${e}`,s="base",n=this.#c.get(s);if(n?.key===i||(n?(n.filter?.remove(),n.key=i,n.url="none",n.filter=null):(n={key:i,url:"none",filter:null},this.#c.set(s,n)),!t||!e))return n.url;let r=this.#A(t);t=M.makeHexColor(...r);let a=this.#A(e);
2if(e=M.makeHexColor(...a),this.#o.style.color="",t==="#000000"&&e==="#ffffff"||t===e)return n.url;let l=new Array(256);for(let f=0;f<=255;f++){let p=f/255;l[f]=p<=.03928?p/12.92:((p+.055)/1.055)**2.4}let h=l.join(","),c=`g_${this.#s}_hcm_filter`,d=n.filter=this.#f(c);this.#b(h,h,h,d),this.#p(d);let u=(f,p)=>{let g=r[f]/255,b=a[f]/255,m=new Array(p+1);for(let w=0;w<=p;w++)m[w]=g+w/p*(b-g);return m.join(",")};return this.#b(u(0,5),u(1,5),u(2,5),d),n.url=this.#a(c),n.url}addAlphaFilter(t){let e=this.#h.get(t);if(e)return e;let[i]=this.#d([t]),s=`alpha_${i}`;if(e=this.#h.get(s),e)return this.#h.set(t,e),e;let n=`g_${this.#s}_alpha_map_${this.#l++}`,r=this.#a(n);this.#h.set(t,r),this.#h.set(s,r);let a=this.#f(n);return this.#m(i,a),r}addLuminosityFilter(t){let e=this.#h.get(t||"luminosity");if(e)return e;let i,s;if(t?([i]=this.#d([t]),s=`luminosity_${i}`):s="luminosity",e=this.#h.get(s),e)return this.#h.set(t,e),e;let n=`g_${this.#s}_luminosity_map_${this.#l++}`,r=this.#a(n);this.#h.set(t,r),this.#h.set(s,r);let a=this.#f(n);return this.#u(a),t&&this.#m(i,a),r}addHighlightHCMFilter(t,e,i,s,n){let r=`${e}-${i}-${s}-${n}`,a=this.#c.get(t);if(a?.key===r||(a?(a.filter?.remove(),a.key=r,a.url="none",a.filter=null):(a={key:r,url:"none",filter:null},this.#c.set(t,a)),!e||!i))return a.url;let[l,h]=[e,i].map(this.#A.bind(this)),c=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),d=Math.round(.2126*h[0]+.7152*h[1]+.0722*h[2]),[u,f]=[s,n].map(this.#A.bind(this));d<c&&([c,d,u,f]=[d,c,f,u]),this.#o.style.color="";let p=(m,w,y)=>{let A=new Array(256),v=(d-c)/y,S=m/255,P=(w-m)/(255*y),T=0;for(let _=0;_<=y;_++){let E=Math.round(c+_*v),L=S+_*P;for(let V=T;V<=E;V++)A[V]=L;T=E+1}for(let _=T;_<256;_++)A[_]=A[T-1];return A.join(",")},g=`g_${this.#s}_hcm_${t}_filter`,b=a.filter=this.#f(g);return this.#p(b),this.#b(p(u[0],f[0],5),p(u[1],f[1],5),p(u[2],f[2],5),b),a.url=this.#a(g),a.url}destroy(t=!1){t&&this.#c.size!==0||(this.#i&&(this.#i.parentNode.parentNode.remove(),this.#i=null),this.#e&&(this.#e.clear(),this.#e=null),this.#l=0)}#u(t){let e=this.#r.createElementNS(Ot,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),t.append(e)}#p(t){let e=this.#r.createElementNS(Ot,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),t.append(e)}#f(t){let e=this.#r.createElementNS(Ot,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),this.#o.append(e),e}#g(t,e,i){let s=this.#r.createElementNS(Ot,e);s.setAttribute("type","discrete"),s.setAttribute("tableValues",i),t.append(s)}#b(t,e,i,s){let n=this.#r.createElementNS(Ot,"feComponentTransfer");
2s.append(n),this.#g(n,"feFuncR",t),this.#g(n,"feFuncG",e),this.#g(n,"feFuncB",i)}#m(t,e){let i=this.#r.createElementNS(Ot,"feComponentTransfer");e.append(i),this.#g(i,"feFuncA",t)}#A(t){return this.#o.style.color=t,$n(getComputedStyle(this.#o).getPropertyValue("color"))}},Ai=class{constructor({baseUrl:t=null}){this.baseUrl=t}fetch(e){return C(this,arguments,function*({filename:t}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!t)throw new Error("Font filename must be specified.");let i=`${this.baseUrl}${t}`;return this._fetch(i).catch(s=>{throw new Error(`Unable to load font data at: ${i}`)})})}_fetch(t){return C(this,null,function*(){U("Abstract method `_fetch` called.")})}},_i=class extends Ai{_fetch(t){return C(this,null,function*(){let e=yield $i(t,"arraybuffer");return new Uint8Array(e)})}};ct&&(ni=Promise.withResolvers(),ri=null,C(null,null,function*(){let t=yield import("./chunk-L2HEV66R.js"),e=yield import("./chunk-BMBYILCS.js"),i=yield import("./chunk-ALIQTIYY.js"),s=yield import("./chunk-NYZOWURK.js"),n,r;return new Map(Object.entries({fs:t,http:e,https:i,url:s,canvas:n,path2d:r}))}).then(t=>{ri=t,ni.resolve()},t=>{N(`loadPackages: ${t}`),ri=new Map,ni.resolve()}));var ni,ri,Pt=class{static get promise(){return ni.promise}static get(t){return ri?.get(t)}};function Ca(o){return C(this,null,function*(){let e=yield Pt.get("fs").promises.readFile(o);return new Uint8Array(e)})}var Fs=class extends bi{},Bs=class extends pi{_createCanvas(t,e){return Pt.get("canvas").createCanvas(t,e)}},Hs=class extends gi{_fetch(t){return C(this,null,function*(){return Ca(t)})}},js=class extends Ai{_fetch(t){return C(this,null,function*(){return Ca(t)})}},ut={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function Vs(o,t){if(!t)return;let e=t[2]-t[0],i=t[3]-t[1],s=new Path2D;s.rect(t[0],t[1],e,i),o.clip(s)}var Re=class{getPattern(){U("Abstract method `getPattern` called.")}},zs=class extends Re{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}_createGradient(t){let e;this._type==="axial"?e=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(e=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(let i of this._colorStops)e.addColorStop(i[0],i[1]);return e}getPattern(t,e,i,s){let n;if(s===ut.STROKE||s===ut.FILL){let r=e.current.getClippedPathBoundingBox(s,K(t))||[0,0,0,0],a=Math.ceil(r[2]-r[0])||1,l=Math.ceil(r[3]-r[1])||1,h=e.cachedCanvases.getCanvas("pattern",a,l),c=h.context;c.clearRect(0,0,c.canvas.width,c.canvas.height),c.beginPath(),c.rect(0,0,c.canvas.width,c.canvas.height),c.translate(-r[0],-r[1]),i=M.transform(i,[1,0,0,1,r[0],r[1]]),c.transform(...e.baseTransform),this.matrix&&c.transform(...this.matrix),Vs(c,this._bbox),c.fillStyle=this._createGradient(c),c.fill(),n=t.createPattern(h.canvas,"no-repeat");let d=new DOMMatrix(i);n.setTransform(d)}else Vs(t,this._bbox),n=this._createGradient(t);return n}};function ws(o,t,e,i,s,n,r,a){let l=t.coords,h=t.colors,c=o.data,d=o.width*4,u;l[e+1]>l[i+1]&&(u=e,e=i,i=u,u=n,n=r,r=u),l[i+1]>l[s+1]&&(u=i,i=s,s=u,u=r,r=a,a=u),l[e+1]>l[i+1]&&(u=e,e=i,i=u,u=n,n=r,r=u);let f=(l[e]+t.offsetX)*t.scaleX,p=(l[e+1]+t.offsetY)*t.scaleY,g=(l[i]+t.offsetX)*t.scaleX,b=(l[i+1]+t.offsetY)*t.scaleY,m=(l[s]+t.offsetX)*t.scaleX,w=(l[s+1]+t.offsetY)*t.scaleY;if(p>=w)return;let y=h[n],A=h[n+1],v=h[n+2],S=h[r],P=h[r+1],T=h[r+2],_=h[a],E=h[a+1],L=h[a+2],V=Math.round(p),H=Math.round(w),F,W,Q,k,D,Vt,Kt,At;for(let at=V;at<=H;at++){if(at<b){let $=at<p?0:(p-at)/(p-b);F=f-(f-g)*$,W=y-(y-S)*$,Q=A-(A-P)*$,k=v-(v-T)*$}else{let $;at>w?$=1:b===w?$=0:$=(b-at)/(b-w),F=g-(g-m)*$,W=S-(S-_)*$,Q=P-(P-E)*$,k=T-(T-L)*$}let it;at<p?it=0:at>w?it=1:it=(p-at)/(p-w),D=f-(f-m)*it,Vt=y-(y-_)*it,Kt=A-(A-E)*it,At=v-(v-L)*it;let oe=Math.round(Math.min(F,D)),we=Math.round(Math.max(F,D)),_t=d*at+oe*4;for(let $=oe;$<=we;$++)it=(F-$)/(F-D),it<0?it=0:it>1&&(it=1),c[_t++]=W-(W-Vt)*it|0,c[_t++]=Q-(Q-Kt)*it|0,c[_t++]=k-(k-At)*it|0,c[_t++]=255}}function Bo(o,t,e){let i=t.coords,s=t.colors,n,r;switch(t.type){case"lattice":let a=t.verticesPerRow,l=Math.floor(i.length/a)-1,h=a-1;for(n=0;n<l;n++){let c=n*a;for(let d=0;d<h;d++,c++)ws(o,e,i[c],i[c+1],i[c+a],s[c],s[c+1],s[c+a]),ws(o,e,i[c+a+1],i[c+1],i[c+a],s[c+a+1],s[c+1],s[c+a])}break;case"triangles":for(n=0,r=i.length;n<r;n+=3)ws(o,e,i[n],i[n+1],i[n+2],s[n],s[n+1],s[n+2]);break;default:throw new Error("illegal figure")}}var Ws=class extends Re{constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[7],this._background=t[8],this.matrix=null}_createMeshCanvas(t,e,i){let a=Math.floor(this._bounds[0]),l=Math.floor(this._bounds[1]),h=Math.ceil(this._bounds[2])-a,c=Math.ceil(this._bounds[3])-l,d=Math.min(Math.ceil(Math.abs(h*t[0]*1.1)),3e3),u=Math.min(Math.ceil(Math.abs(c*t[1]*1.1)),3e3),f=h/d,p=c/u,g={coords:this._coords,colors:this._colors,offsetX:-a,offsetY:-l,scaleX:1/f,scaleY:1/p},b=d+4,m=u+4,w=i.getCanvas("mesh",b,m),y=w.context,A=y.createImageData(d,u);if(e){let S=A.data;for(let P=0,T=S.length;P<T;P+=4)S[P]=e[0],S[P+1]=e[1],S[P+2]=e[2],S[P+3]=255}for(let S of this._figures)Bo(A,S,g);return y.putImageData(A,2,2),{canvas:w.canvas,offsetX:a-2*f,offsetY:l-2*p,scaleX:f,scaleY:p}}getPattern(t,e,i,s){Vs(t,this._bbox);let n;if(s===ut.SHADING)n=M.singularValueDecompose2dScale(K(t));else if(n=M.singularValueDecompose2dScale(e.baseTransform),this.matrix
2){let a=M.singularValueDecompose2dScale(this.matrix);n=[n[0]*a[0],n[1]*a[1]]}let r=this._createMeshCanvas(n,s===ut.SHADING?null:this._background,e.cachedCanvases);return s!==ut.SHADING&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(r.offsetX,r.offsetY),t.scale(r.scaleX,r.scaleY),t.createPattern(r.canvas,"no-repeat")}},Us=class extends Re{getPattern(){return"hotpink"}};function Ho(o){switch(o[0]){case"RadialAxial":return new zs(o);case"Mesh":return new Ws(o);case"Dummy":return new Us}throw new Error(`Unknown IR type: ${o[0]}`)}var ua={COLORED:1,UNCOLORED:2},jo=(()=>{class o{static MAX_PATTERN_SIZE=3e3;constructor(e,i,s,n,r){this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.color=i,this.ctx=s,this.canvasGraphicsFactory=n,this.baseTransform=r}createPatternCanvas(e){let{bbox:i,operatorList:s,paintType:n,tilingType:r,color:a,canvasGraphicsFactory:l}=this,{xstep:h,ystep:c}=this;h=Math.abs(h),c=Math.abs(c),Wi("TilingType: "+r);let d=i[0],u=i[1],f=i[2],p=i[3],g=f-d,b=p-u,m=M.singularValueDecompose2dScale(this.matrix),w=M.singularValueDecompose2dScale(this.baseTransform),y=m[0]*w[0],A=m[1]*w[1],v=g,S=b,P=!1,T=!1,_=Math.ceil(h*y),E=Math.ceil(c*A),L=Math.ceil(g*y),V=Math.ceil(b*A);_>=L?v=h:P=!0,E>=V?S=c:T=!0;let H=this.getSizeAndScale(v,this.ctx.canvas.width,y),F=this.getSizeAndScale(S,this.ctx.canvas.height,A),W=e.cachedCanvases.getCanvas("pattern",H.size,F.size),Q=W.context,k=l.createCanvasGraphics(Q);if(k.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(k,n,a),Q.translate(-H.scale*d,-F.scale*u),k.transform(H.scale,0,0,F.scale,0,0),Q.save(),this.clipBbox(k,d,u,f,p),k.baseTransform=K(k.ctx),k.executeOperatorList(s),k.endDrawing(),Q.restore(
2),P||T){let D=W.canvas;P&&(v=h),T&&(S=c);let Vt=this.getSizeAndScale(v,this.ctx.canvas.width,y),Kt=this.getSizeAndScale(S,this.ctx.canvas.height,A),At=Vt.size,at=Kt.size,it=e.cachedCanvases.getCanvas("pattern-workaround",At,at),oe=it.context,we=P?Math.floor(g/h):0,_t=T?Math.floor(b/c):0;for(let $=0;$<=we;$++)for(let kt=0;kt<=_t;kt++)oe.drawImage(D,At*$,at*kt,At,at,0,0,At,at);return{canvas:it.canvas,scaleX:Vt.scale,scaleY:Kt.scale,offsetX:d,offsetY:u}}return{canvas:W.canvas,scaleX:H.scale,scaleY:F.scale,offsetX:d,offsetY:u}}getSizeAndScale(e,i,s){let n=Math.max(o.MAX_PATTERN_SIZE,i),r=Math.ceil(e*s);return r>=n?r=n:s=r/e,{scale:s,size:r}}clipBbox(e,i,s,n,r){let a=n-i,l=r-s;e.ctx.rect(i,s,a,l),e.current.updateRectMinMax(K(e.ctx),[i,s,n,r]),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,i,s){let n=e.ctx,r=e.current;switch(i){case ua.COLORED:let a=this.ctx;n.fillStyle=a.fillStyle,n.strokeStyle=a.strokeStyle,r.fillColor=a.fillStyle,r.strokeColor=a.strokeStyle;break;case ua.UNCOLORED:let l=M.makeHexColor(s[0],s[1],s[2]);n.fillStyle=l,n.strokeStyle=l,r.fillColor=l,r.strokeColor=l;break;default:throw new xs(`Unsupported paint type: ${i}`)}}getPattern(e,i,s,n){let r=s;n!==ut.SHADING&&(r=M.transform(r,i.baseTransform),this.matrix&&(r=M.transform(r,this.matrix)));let a=this.createPatternCanvas(i),l=new DOMMatrix(r);l=l.translate(a.offsetX,a.offsetY),l=l.scale(1/a.scaleX,1/a.scaleY);let h=e.createPattern(a.canvas,"repeat");return h.setTransform(l),h}}return o})();function Vo({src:o,srcPos:t=0,dest:e,width:i,height:s,nonBlackColor:n=4294967295,inverseDecode:r=!1}){let a=ot.isLittleEndian?4278190080:255,[l,h]=r?[n,a]:[a,n],c=i>>3,d=i&7,u=o.length;e=new Uint32Array(e.buffer);let f=0;for(let p=0;p<s;p++){for(let b=t+c;t<b;t++){let m=t<u?o[t]:255;e[f++]=m&128?h:l,e[f++]=m&64?h:l,e[f++]=m&32?h:l,e[f++]=m&16?h:l,e[f++]=m&8?h:l,e[f++]=m&4?h:l,e[f++]=m&2?h:l,e[f++]=m&1?h:l}if(d===0)continue;let g=t<u?o[t++]:255;for(let b=0;b<d;b++)e[f++]=g&1<<7-b?h:l}return{srcPos:t,destPos:f}}var fa=16,pa=100,zo=15,ga=10,ma=1e3,pt=16;function Wo(o,t){if(o._removeMirroring)throw new Error("Context is already forwarding operations.");o.__originalSave=o.save,o.__originalRestore=o.restore,o.__originalRotate=o.rotate,o.__originalScale=o.scale,o.__originalTranslate=o.translate,o.__originalTransform=o.transform,o.__originalSetTransform=o.setTransform,o.__originalResetTransform=o.resetTransform,o.__originalClip=o.clip,o.__originalMoveTo=o.moveTo,o.__originalLineTo=o.lineTo,o.__originalBezierCurveTo=o.bezierCurveTo,o.__originalRect=o.rect,o.__originalClosePath=o.closePath,o.__originalBeginPath=o.beginPath,o._removeMirroring=()=>{o.save=o.__originalSave,o.restore=o.__originalRestore,o.rotate=o.__originalRotate,o.scale=o.__originalScale,o.translate=o.__originalTranslate,o.transform=o.__originalTransform,o.setTransform=o.__originalSetTransform,o.resetTransform=o.__originalResetTransform,o.clip=o.__originalClip,o.moveTo=o.__originalMoveTo,o.lineTo=o.__originalLineTo,o.bezierCurveTo=o.__originalBezierCurveTo,o.rect=o.__originalRect,o.closePath=o.__originalClosePath,o.beginPath=o.__originalBeginPath,delete o._removeMirroring},o.save=function(){t.save(),this.__originalSave()},o.restore=function(){t.restore(),this.__originalRestore()},o.translate=function(i,s){t.translate(i,s),this.__originalTranslate(i,s)},o.scale=function(i,s){t.scale(i,s),this.__originalScale(i,s)},o.transform=function(i,s,n,r,a,l){t.transform(i,s,n,r,a,l),this.__originalTransform(i,s,n,r,a,l)},o.setTransform=function(i,s,n,r,a,l){t.setTransform(i,s,n,r,a,l),this.__originalSetTransform(i,s,n,r,a,l)},o.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},o.rotate=function(i){t.rotate(i),this.__originalRotate(i)},o.clip=function(i){t.clip(i),this.__originalClip(i)},o.moveTo=function(e,i){t.moveTo(e,i),this.__originalMoveTo(e,i)},o.lineTo=function(e,i){t.lineTo(e,i),this.__originalLineTo(e,i)},o.bezierCurveTo=function(e,i,s,n,r,a){t.bezierCurveTo(e,i,s,n,r,a),this.__originalBezierCurveTo(e,i,s,n,r,a)},o.rect=function(e,i,s,n){t.rect(e,i,s,n),this.__originalRect(e,i,s,n)},o.closePath=function(){t.closePath(),this.__originalClosePath()},o.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}var $s=class{constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}getCanvas(t,e,i){let s;return this.cache[t]!==void 0?(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]}}};function Qe(o,t,e,i,s,n,r,a,l,h){let[c,d,u,f,p,g]=K(o);if(d===0&&u===0){let w=r*c+p,y=Math.round(w),A=a*f+g,v=Math.round(A),S=(r+l)*c+p,P=Math.abs(Math.round(S)-y)||1,T=(a+h)*f+g,_=Math.abs(Math.round(T)-v)||1;return o.setTransform(Math.sign(c),0,0,Math.sign(f),y,v),o.drawImage(t,e,i,s,n,0,0,P,_),o.setTransform(c,d,u,f,p,g),[P,_]}if(c===0&&f===0){let w=a*u+p,y=Math.round(w),A=r*d+g,v=Math.round(A),S=(a+h)*u+p,P=Math.abs(Math.round(S)-y)||1,T=(r+l)*d+g,_=Math.abs(Math.round(T)-v)||1;return o.setTransform(0,Math.sign(d),Math.sign(u),0,y,v),o.drawImage(t,e,i,s,n,0,0,_,P),o.setTransform(c,d,u,f,p,g),[_,P]}o.drawImage(t,e,i,s,n,r,a,l,h);let b=Math.hypot(c,d),m=Math.hypot(u,f);return[b*l,m*h]}function Uo(o){let{width:t,height:e}=o;if(t>ma||e>ma)return null;let i=1e3,s=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),n=t+1,r=new Uint8Array(n*(e+1)),a,l,h,c=t+7&-8,d=new Uint8Array(c*e),u=0;for(let m of o.data){let w=128;for(;w>0;)d[u++]=m&w?0:255,w>>=1}let f=0;for(u=0,d[u]!==0&&(r[0]=1,++f),l=1;l<t;l++)d[u]!==d[u+1]&&(r[l]=d[u]?2:1,++f),u++;for(d[u]!==0&&(r[l]=2,++f),a=1;a<e;a++){u=a*c,h=a*n,d[u-c]!==d[u]&&(r[h]=d[u]?1:8,++f);let m=(d[u]?4:0)+(d[u-c]?8:0);for(l=1;l<t;l++)m=(m>>2)+(d[u+1]?4:0)+(d[u-c+1]?8:0),s[m]&&(r[h+l]=s[m],++f),u++;if(d[u-c]!==d[u]&&(r[h+l]=d[u]?2:4,++f),f>i)return null}for(u=c*(e-1),h=a*n,d[u]!==0&&(r[h]=8,++f),l=1;l<t;l++)d[u]!==d[u+1]&&(r[h+l]=d[u]?4:8,++f),u++;if(d[u]!==0&&(r[h+l]=4,++f),f>i)return null;let p=new Int32Array([0,n,-1,0,-n,0,0,0,1]),g=new Path2D;for(a=0;f&&a<=e;a++){let m=a*n,w=m+t;for(;m<w&&!r[m];)m++;if(m===w)continue;g.moveTo(m%n,a);let y=m,A=r[m];do{let v=p[A];do m+=v;while(!r[m]);let S=r[m];S!==5&&S!==10?(A=S,r[m]=0):(A=S&51*A>>4,r[m]&=A>>2|A<<2),g.lineTo(m%n,m/n|0),r[m]||--f}while(y!==m);--a}return d=null,r=null,function(m){m.save(),m.scale(1/t,-1/e),m.translate(0,-e),m.fill(g),m.beginPath(),m.restore(
2)}}var wi=class{constructor(t,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=Ea,this.textMatrixScale=1,this.fontMatrix=Es,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=ht.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])}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]=M.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=M.applyTransform(e,t),s=M.applyTransform(e.slice(2),t),n=M.applyTransform([e[0],e[3]],t),r=M.applyTransform([e[2],e[1]],t);this.minX=Math.min(this.minX,i[0],s[0],n[0],r[0]),this.minY=Math.min(this.minY,i[1],s[1],n[1],r[1]),this.maxX=Math.max(this.maxX,i[0],s[0],n[0],r[0]),this.maxY=Math.max(this.maxY,i[1],s[1],n[1],r[1])}updateScalingPathMinMax(t,e){M.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,n,r,a,l,h,c){let d=M.bezierBoundingBox(e,i,s,n,r,a,l,h,c);c||this.updateRectMinMax(t,d)}getPathBoundingBox(t=ut.FILL,e=null){let i=[this.minX,this.minY,this.maxX,this.maxY];if(t===ut.STROKE){e||U("Stroke bounding box must include transform.");let s=M.singularValueDecompose2dScale(e),n=s[0]*this.lineWidth/2,r=s[1]*this.lineWidth/2;i[0]-=n,i[1]-=r,i[2]+=n,i[3]+=r}return i}updateClipFromPath(){let t=M.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(t){this.clipBox=t,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(t=ut.FILL,e=null){return M.intersect(this.clipBox,this.getPathBoundingBox(t,e))}};function ba(o,t){if(typeof ImageData<"u"&&t instanceof ImageData){o.putImageData(t,0,0);return}let e=t.height,i=t.width,s=e%pt,n=(e-s)/pt,r=s===0?n:n+1,a=o.createImageData(i,pt),l=0,h,c=t.data,d=a.data,u,f,p,g;if(t.kind===si.GRAYSCALE_1BPP){let b=c.byteLength,m=new Uint32Array(d.buffer,0,d.byteLength>>2),w=m.length,y=i+7>>3,A=4294967295,v=ot.isLittleEndian?4278190080:255;for(u=0;u<r;u++){for(p=u<n?pt:s,h=0,f=0;f<p;f++){let S=b-l,P=0,T=S>y?i:S*8-7,_=T&-8,E=0,L=0;for(;P<_;P+=8)L=c[l++],m[h++]=L&128?A:v,m[h++]=L&64?A:v,m[h++]=L&32?A:v,m[h++]=L&16?A:v,m[h++]=L&8?A:v,m[h++]=L&4?A:v,m[h++]=L&2?A:v,m[h++]=L&1?A:v;for(;P<T;P++)E===0&&(L=c[l++],E=128),m[h++]=L&E?A:v,E>>=1}
2for(;h<w;)m[h++]=0;o.putImageData(a,0,u*pt)}}else if(t.kind===si.RGBA_32BPP){for(f=0,g=i*pt*4,u=0;u<n;u++)d.set(c.subarray(l,l+g)),l+=g,o.putImageData(a,0,f),f+=pt;u<r&&(g=i*s*4,d.set(c.subarray(l,l+g)),o.putImageData(a,0,f))}else if(t.kind===si.RGB_24BPP)for(p=pt,g=i*p,u=0;u<r;u++){for(u>=n&&(p=s,g=i*p),h=0,f=g;f--;)d[h++]=c[l++],d[h++]=c[l++],d[h++]=c[l++],d[h++]=255;o.putImageData(a,0,u*pt)}else throw new Error(`bad image kind: ${t.kind}`)}function Aa(o,t){if(t.bitmap){o.drawImage(t.bitmap,0,0);return}let e=t.height,i=t.width,s=e%pt,n=(e-s)/pt,r=s===0?n:n+1,a=o.createImageData(i,pt),l=0,h=t.data,c=a.data;for(let d=0;d<r;d++){let u=d<n?pt:s;({srcPos:l}=Vo({src:h,srcPos:l,dest:c,width:i,height:u,nonBlackColor:0})),o.putImageData(a,0,d*pt)}}function ve(o,t){let e=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(let i of e)o[i]!==void 0&&(t[i]=o[i]);o.setLineDash!==void 0&&(t.setLineDash(o.getLineDash()),t.lineDashOffset=o.lineDashOffset)}function Je(o){if(o.strokeStyle=o.fillStyle="#000000",o.fillRule="nonzero",o.globalAlpha=1,o.lineWidth=1,o.lineCap="butt",o.lineJoin="miter",o.miterLimit=10,o.globalCompositeOperation="source-over",o.font="10px sans-serif",o.setLineDash!==void 0&&(o.setLineDash([]),o.lineDashOffset=0),!ct){let{filter:t}=o;t!=="none"&&t!==""&&(o.filter="none")}}function _a(o,t){if(t)return!0;let e=M.singularValueDecompose2dScale(o);e[0]=Math.fround(e[0]),e[1]=Math.fround(e[1]);let i=Math.fround((globalThis.devicePixelRatio||1)*$t.PDF_TO_CSS_UNITS);return e[0]<=i&&e[1]<=i}var $o=["butt","round","square"],Go=["miter","round","bevel"],Xo={},wa={},ce=class o{constructor(t,e,i,s,n,{optionalContentConfig:r,markedContentStack:a=null},l,h){this.ctx=t,this.current=new wi(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=n,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=a||[],this.optionalContentConfig=r,this.cachedCanvases=new $s(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=l,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=h,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(t,e=null){return typeof t=="string"?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):e}beginDrawing({transform:t,viewport:e,transparency:i=!1,background:s=null}){let n=this.ctx.canvas.width,r=this.ctx.canvas.height,a=this.ctx.fillStyle;if(this.ctx.fillStyle=s||"#ffffff",this.ctx.fillRect(0,0,n,r),this.ctx.fillStyle=a,i){let l=this.cachedCanvases.getCanvas("transparent",n,r);this.compositeCtx=this.ctx,this.transparentCanvas=l.canvas,this.ctx=l.context,this.ctx.save(),this.ctx.transform(...K(this.compositeCtx))}this.ctx.save(),Je(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[0]),this.ctx.transform(...e.transform),this.viewportScale=e.scale,this.baseTransform=K(this.ctx)}executeOperatorList(t,e,i,s){let n=t.argsArray,r=t.fnArray,a=e||0,l=n.length;if(l===a)return a;let h=l-a>ga&&typeof i=="function",c=h?Date.now()+zo:0,d=0,u=this.commonObjs,f=this.objs,p;for(;;){if(s!==void 0&&a===s.nextBreakPoint)return s.breakIt(a,i),a;if(p=r[a],p!==Et.dependency)this[p].apply(this,n[a]);else for(let g of n[a]){let b=g.startsWith("g_")?u:f;if(!b.has(g))return b.get(g,i),a}if(a++,a===l)return a;
2if(h&&++d>ga){if(Date.now()>c)return i(),a;d=0}}}#t(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}endDrawing(){this.#t(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(let t of this._cachedBitmapsMap.values()){for(let e of t.values())typeof HTMLCanvasElement<"u"&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),this.#e()}#e(){if(this.pageColors){let t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(t!=="none"){let e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}}_scaleImage(t,e){let i=t.width??t.displayWidth,s=t.height??t.displayHeight,n=Math.max(Math.hypot(e[0],e[1]),1),r=Math.max(Math.hypot(e[2],e[3]),1),a=i,l=s,h="prescale1",c,d;for(;n>2&&a>1||r>2&&l>1;){let u=a,f=l;n>2&&a>1&&(u=a>=16384?Math.floor(a/2)-1||1:Math.ceil(a/2),n/=a/u),r>2&&l>1&&(f=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l)/2,r/=l/f),c=this.cachedCanvases.getCanvas(h,u,f),d=c.context,d.clearRect(0,0,u,f),d.drawImage(t,0,0,a,l,0,0,u,f),t=c.canvas,a=u,l=f,h=h==="prescale1"?"prescale2":"prescale1"}return{img:t,paintWidth:a,paintHeight:l}}_createMaskCanvas(t){let e=this.ctx,{width:i,height:s}=t,n=this.current.fillColor,r=this.current.patternFill,a=K(e),l,h,c,d;if((t.bitmap||t.data)&&t.count>1){let T=t.bitmap||t.data.buffer;h=JSON.stringify(r?a:[a.slice(0,4),n]),l=this._cachedBitmapsMap.get(T),l||(l=new Map,this._cachedBitmapsMap.set(T,l));let _=l.get(h);if(_&&!r){let E=Math.round(Math.min(a[0],a[2])+a[4]),L=Math.round(Math.min(a[1],a[3])+a[5]);return{canvas:_,offsetX:E,offsetY:L}}c=_}c||(d=this.cachedCanvases.getCanvas("maskCanvas",i,s),Aa(d.context,t));let u=M.transform(a,[1/i,0,0,-1/s,0,0]);u=M.transform(u,[1,0,0,1,0,-s]);let[f,p,g,b]=M.getAxialAlignedBoundingBox([0,0,i,s],u),m=Math.round(g-f)||1,w=Math.round(b-p)||1,y=this.cachedCanvases.getCanvas("fillCanvas",m,w),A=y.context,v=f,S=p;A.translate(-v,-S),A.transform(...u),c||(c=this._scaleImage(d.canvas,Rt(A)),c=c.img,l&&r&&l.set(h,c)),A.imageSmoothingEnabled=_a(K(A),t.interpolate),Qe(A,c,0,0,c.width,c.height,0,0,i,s),A.globalCompositeOperation="source-in";let P=M.transform(Rt(A),[1,0,0,1,-v,-S]);return A.fillStyle=r?n.getPattern(e,this,P,ut.FILL):n,A.fillRect(0,0,i,s),l&&!r&&(this.cachedCanvases.delete("fillCanvas"),l.set(h,y.canvas)),{canvas:y.canvas,offsetX:Math.round(v),offsetY:Math.round(S)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=$o[t]}setLineJoin(t){this.ctx.lineJoin=Go[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){let i=this.ctx;i.setLineDash!==void 0&&(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);break}}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 new 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 n=this.ctx;n.setTransform(...K(this.suspendedCtx)),ve(this.suspendedCtx,n),Wo(n,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),ve(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(
2)}composeSMask(t,e,i,s){let n=s[0],r=s[1],a=s[2]-n,l=s[3]-r;a===0||l===0||(this.genericComposeSMask(e.context,i,a,l,e.subtype,e.backdrop,e.transferMap,n,r,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(i.canvas,0,0),t.restore())}genericComposeSMask(t,e,i,s,n,r,a,l,h,c,d){let u=t.canvas,f=l-c,p=h-d;if(r){let b=M.makeHexColor(...r);if(f<0||p<0||f+i>u.width||p+s>u.height){let m=this.cachedCanvases.getCanvas("maskExtension",i,s),w=m.context;w.drawImage(u,-f,-p),w.globalCompositeOperation="destination-atop",w.fillStyle=b,w.fillRect(0,0,i,s),w.globalCompositeOperation="source-over",u=m.canvas,f=p=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);let m=new Path2D;m.rect(f,p,i,s),t.clip(m),t.globalCompositeOperation="destination-atop",t.fillStyle=b,t.fillRect(f,p,i,s),t.restore()}}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),n==="Alpha"&&a?e.filter=this.filterFactory.addAlphaFilter(a):n==="Luminosity"&&(e.filter=this.filterFactory.addLuminosityFilter(a));let g=new Path2D;g.rect(l,h,i,s),e.clip(g),e.globalCompositeOperation="destination-in",e.drawImage(u,f,p,i,s,l,h,i,s),e.restore()}save(){this.inSMaskMode?(ve(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();let t=this.current;this.stateStack.push(t),this.current=t.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),ve(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,e,i,s,n,r){this.ctx.transform(t,e,i,s,n,r),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i){let s=this.ctx,n=this.current,r=n.x,a=n.y,l,h,c=K(s),d=c[0]===0&&c[3]===0||c[1]===0&&c[2]===0,u=d?i.slice(0):null;for(let f=0,p=0,g=t.length;f<g;f++)switch(t[f]|0){case Et.rectangle:r=e[p++],a=e[p++];let b=e[p++],m=e[p++],w=r+b,y=a+m;s.moveTo(r,a),b===0||m===0?s.lineTo(w,y):(s.lineTo(w,a),s.lineTo(w,y),s.lineTo(r,y)),d||n.updateRectMinMax(c,[r,a,w,y]),s.closePath();break;case Et.moveTo:r=e[p++],a=e[p++],s.moveTo(r,a),d||n.updatePathMinMax(c,r,a);break;case Et.lineTo:r=e[p++],a=e[p++],s.lineTo(r,a),d||n.updatePathMinMax(c,r,a);break;case Et.curveTo:l=r,h=a,r=e[p+4],a=e[p+5],s.bezierCurveTo(e[p],e[p+1],e[p+2],e[p+3],r,a),n.updateCurvePathMinMax(c,l,h,e[p],e[p+1],e[p+2],e[p+3],r,a,u),p+=6;break;case Et.curveTo2:l=r,h=a,s.bezierCurveTo(r,a,e[p],e[p+1],e[p+2],e[p+3]),n.updateCurvePathMinMax(c,l,h,r,a,e[p],e[p+1],e[p+2],e[p+3],u),r=e[p+2],a=e[p+3],p+=4;break;case Et.curveTo3:l=r,h=a,r=e[p+2],a=e[p+3],s.bezierCurveTo(e[p],e[p+1],r,a,r,a),n.updateCurvePathMinMax(c,l,h,e[p],e[p+1],r,a,r,a,u),p+=4;break;case Et.closePath:s.closePath();break}d&&n.updateScalingPathMinMax(c,u),n.setCurrentPoint(r,a)}closePath(){this.ctx.closePath()}stroke(t=!0){let e=this.ctx,i=this.current.strokeColor;e.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof i=="object"&&i?.getPattern?(e.save(),e.strokeStyle=i.getPattern(e,this,Rt(e),ut.STROKE),this.rescaleAndStroke(!1),e.restore()):this.rescaleAndStroke(!0)),t&&this.consumePath(this.current.getClippedPathBoundingBox()),e.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(t=!0){let e=this.ctx,i=this.current.fillColor,s=this.current.patternFill,n=!1;s&&(e.save(),e.fillStyle=i.getPattern(e,this,Rt(e),ut.FILL),n=!0);let r=this.current.getClippedPathBoundingBox();this.contentVisible&&r!==null&&(this.pendingEOFill?(e.fill("evenodd"),this.pendingEOFill=!1):e.fill()),n&&e.restore(),t&&this.consumePath(r)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=Xo}eoClip(){this.pendingClip=wa}beginText(){this.current.textMatrix=Ea,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(t===void 0){e.beginPath();return}
2e.save(),e.beginPath();for(let i of t)e.setTransform(...i.transform),e.translate(i.x,i.y),i.addToPath(e,i.fontSize);e.restore(),e.clip(),e.beginPath(),delete this.pendingTextPaths}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){let i=this.commonObjs.get(t),s=this.current;if(!i)throw new Error(`Can't find font for ${t}`);if(s.fontMatrix=i.fontMatrix||Es,(s.fontMatrix[0]===0||s.fontMatrix[3]===0)&&N("Invalid font matrix for font "+t),e<0?(e=-e,s.fontDirection=-1):s.fontDirection=1,this.current.font=i,this.current.fontSize=e,i.isType3Font)return;let n=i.loadedName||"sans-serif",r=i.systemFontInfo?.css||`"${n}", ${i.fallbackName}`,a="normal";i.black?a="900":i.bold&&(a="bold");let l=i.italic?"italic":"normal",h=e;e<fa?h=fa:e>pa&&(h=pa),this.current.fontSizeScale=e/h,this.ctx.font=`${l} ${a} ${h}px ${r}`}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,e){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=e}setLeadingMoveText(t,e){this.setLeading(-e),this.moveText(t,e)}setTextMatrix(t,e,i,s,n,r){this.current.textMatrix=[t,e,i,s,n,r],this.current.textMatrixScale=Math.hypot(t,e),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,e,i,s){let n=this.ctx,r=this.current,a=r.font,l=r.textRenderingMode,h=r.fontSize/r.fontSizeScale,c=l&ht.FILL_STROKE_MASK,d=!!(l&ht.ADD_TO_PATH_FLAG),u=r.patternFill&&!a.missingFile,f;(a.disableFontFace||d||u)&&(f=a.getPathGenerator(this.commonObjs,t)),a.disableFontFace||u?(n.save(),n.translate(e,i),n.beginPath(),f(n,h),s&&n.setTransform(...s),(c===ht.FILL||c===ht.FILL_STROKE)&&n.fill(),(c===ht.STROKE||c===ht.FILL_STROKE)&&n.stroke(),n.restore()):((c===ht.FILL||c===ht.FILL_STROKE)&&n.fillText(t,e,i),(c===ht.STROKE||c===ht.FILL_STROKE)&&n.strokeText(t,e,i)),d&&(this.pendingTextPaths||=[]).push({transform:K(n),x:e,y:i,fontSize:h,addToPath:f})}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 s=3;s<e.length;s+=4)if(e[s]>0&&e[s]<255){i=!0;break}return B(this,"isFontSubpixelAAEnabled",i)}showText(t){let e=this.current,i=e.font;if(i.isType3Font)return this.showType3Text(t);let s=e.fontSize;if(s===0)return;let n=this.ctx,r=e.fontSizeScale,a=e.charSpacing,l=e.wordSpacing,h=e.fontDirection,c=e.textHScale*h,d=t.length,u=i.vertical,f=u?1:-1,p=i.defaultVMetrics,g=s*e.fontMatrix[0],b=e.textRenderingMode===ht.FILL&&!i.disableFontFace&&!e.patternFill;n.save(),n.transform(...e.textMatrix),n.translate(e.x,e.y+e.textRise),h>0?n.scale(c,-1):n.scale(c,1);let m;if(e.patternFill){n.save();let S=e.fillColor.getPattern(n,this,Rt(n),ut.FILL);m=K(n),n.restore(),n.fillStyle=S}let w=e.lineWidth,y=e.textMatrixScale;if(y===0||w===0){let S=e.textRenderingMode&ht.FILL_STROKE_MASK;(S===ht.STROKE||S===ht.FILL_STROKE)&&(w=this.getSinglePixelWidth())}else w/=y;if(r!==1&&(n.scale(r,r),w/=r),n.lineWidth=w,i.isInvalidPDFjsFont){let S=[],P=0;for(let T of t)S.push(T.unicode),P+=T.width;n.fillText(S.join(""),0,0),e.x+=P*g*c,n.restore(),this.compose();return}let A=0,v;for(v=0;v<d;++v){let S=t[v];if(typeof S=="number"){A+=f*S*s/1e3;continue}let P=!1,T=(S.isSpace?l:0)+a,_=S.fontChar,E=S.accent,L,V,H=S.width;if(u){let W=S.vmetric||p,Q=-(S.vmetric?W[1]:H*.5)*g,k=W[2]*g;H=W?-W[0]:H,L=Q/r,V=(A+k)/r}else L=A/r,V=0;if(i.remeasure&&H>0){let W=n.measureText(_).width*1e3/s*r;if(H<W&&this.isFontSubpixelAAEnabled){let Q=H/W;P=!0,n.save(),n.scale(Q,1),L/=Q}else H!==W&&(L+=(H-W)/2e3*s/r)}if(this.contentVisible&&(S.isInFont||i.missingFile)){if(b&&!E)n.fillText(_,L,V);else if(this.paintChar(_,L,V,m),E){let W=L+s*E.offset.x/r,Q=V-s*E.offset.y/r;this.paintChar(E.fontChar,W,Q,m)}}let F=u?H*g-T*h:H*g+T*h;A+=F,P&&n.restore()}u?e.y-=A:e.x+=A*c,n.restore(),this.compose()}showType3Text(t){let e=this.ctx,i=this.current,s=i.font,n=i.fontSize,r=i.fontDirection,a=s.vertical?1:-1,l=i.charSpacing,h=i.wordSpacing,c=i.textHScale*r,d=i.fontMatrix||Es,u=t.length,f=i.textRenderingMode===ht.INVISIBLE,p,g,b,m;if(!(f||n===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,e.save(),e.transform(...i.textMatrix),e.translate(i.x,i.y),e.scale(c,r),p=0;p<u;++p){if(g=t[p],typeof g=="number"){m=a*g*n/1e3,this.ctx.translate(m,0),i.x+=m*c;continue}let w=(g.isSpace?h:0)+l,y=s.charProcOperatorList[g.operatorListId];if(!y){N(`Type3 character "${g.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=g,this.save(),e.scale(n,n),e.transform(...d),this.executeOperatorList(y),this.restore(
2)),b=M.applyTransform([g.width,0],d)[0]*n+w,e.translate(b,0),i.x+=b*c}e.restore(),this.processingType3=null}}setCharWidth(t,e){}setCharWidthAndBounds(t,e,i,s,n,r){this.ctx.rect(i,s,n-i,r-s),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let e;if(t[0]==="TilingPattern"){let i=t[1],s=this.baseTransform||K(this.ctx),n={createCanvasGraphics:r=>new o(r,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};e=new jo(t,i,this.ctx,n,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=M.makeHexColor(t,e,i)}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent"}setFillRGBColor(t,e,i){this.ctx.fillStyle=this.current.fillColor=M.makeHexColor(t,e,i),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(t,e=null){let i;return this.cachedPatterns.has(t)?i=this.cachedPatterns.get(t):(i=Ho(this.getObject(t)),this.cachedPatterns.set(t,i)),e&&(i.matrix=e),i}shadingFill(t){if(!this.contentVisible)return;let e=this.ctx;this.save();let i=this._getPattern(t);e.fillStyle=i.getPattern(e,this,Rt(e),ut.SHADING);let s=Rt(e);if(s){let{width:n,height:r}=e.canvas,[a,l,h,c]=M.getAxialAlignedBoundingBox([0,0,n,r],s);this.ctx.fillRect(a,l,h-a,c-l)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){U("Should not call beginInlineImage")}beginImageData(){U("Should not call beginImageData")}paintFormXObjectBegin(t,e){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=K(this.ctx),e)){let i=e[2]-e[0],s=e[3]-e[1];this.ctx.rect(e[0],e[1],i,s),this.current.updateRectMinMax(K(this.ctx),e),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);let e=this.ctx;t.isolated||Wi("TODO: Support non-isolated groups."),t.knockout&&N("Knockout groups not supported.");let i=K(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw new Error("Bounding box is required.");let s=M.getAxialAlignedBoundingBox(t.bbox,K(e)),n=[0,0,e.canvas.width,e.canvas.height];s=M.intersect(s,n)||[0,0,0,0];let r=Math.floor(s[0]),a=Math.floor(s[1]),l=Math.max(Math.ceil(s[2])-r,1),h=Math.max(Math.ceil(s[3])-a,1);this.current.startNewPathAndClipBox([0,0,l,h]);let c="groupAt"+this.groupLevel;t.smask&&(c+="_smask_"+this.smaskCounter++%2);let d=this.cachedCanvases.getCanvas(c,l,h),u=d.context;u.translate(-r,-a),u.transform(...i),t.smask?this.smaskStack.push({canvas:d.canvas,context:u,offsetX:r,offsetY:a,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(e.setTransform(1,0,0,1,0,0),e.translate(r,a),e.save()),ve(e,u),this.ctx=u,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(e),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;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 s=K(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...s);let n=M.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],s);this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(n)}}beginAnnotation(t,e,i,s,n){if(this.#t(),Je(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),e){let r=e[2]-e[0],a=e[3]-e[1];if(n&&this.annotationCanvasMap){i=i.slice(),i[4]-=e[0],i[5]-=e[1],e=e.slice(),e[0]=e[1]=0,e[2]=r,e[3]=a;let[l,h]=M.singularValueDecompose2dScale(K(this.ctx)),{viewportScale:c}=this,d=Math.ceil(r*this.outputScaleX*c),u=Math.ceil(a*this.outputScaleY*c);this.annotationCanvas=this.canvasFactory.create(d,u);let{canvas:f,context:p}=this.annotationCanvas;this.annotationCanvasMap.set(t,f),this.annotationCanvas.savedCtx=this.ctx,this.ctx=p,this.ctx.save(),this.ctx.setTransform(l,0,0,-h,0,a*h),Je(this.ctx)}else Je(this.ctx),this.endPath(),this.ctx.rect(e[0],e[1],r,a),this.ctx.clip(),this.ctx.beginPath()}
2this.current=new wi(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),this.transform(...s)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#e(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t){if(!this.contentVisible)return;let e=t.count;t=this.getObject(t.data,t),t.count=e;let i=this.ctx,s=this.processingType3;if(s&&(s.compiled===void 0&&(s.compiled=Uo(t)),s.compiled)){s.compiled(i);return}let n=this._createMaskCanvas(t),r=n.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(r,n.offsetX,n.offsetY),i.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e,i=0,s=0,n,r){if(!this.contentVisible)return;t=this.getObject(t.data,t);let a=this.ctx;a.save();let l=K(a);a.transform(e,i,s,n,0,0);let h=this._createMaskCanvas(t);a.setTransform(1,0,0,1,h.offsetX-l[4],h.offsetY-l[5]);for(let c=0,d=r.length;c<d;c+=2){let u=M.transform(l,[e,i,s,n,r[c],r[c+1]]),[f,p]=M.applyTransform([0,0],u);a.drawImage(h.canvas,f,p)}a.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;let e=this.ctx,i=this.current.fillColor,s=this.current.patternFill;for(let n of t){let{data:r,width:a,height:l,transform:h}=n,c=this.cachedCanvases.getCanvas("maskCanvas",a,l),d=c.context;d.save();let u=this.getObject(r,n);Aa(d,u),d.globalCompositeOperation="source-in",d.fillStyle=s?i.getPattern(d,this,Rt(e),ut.FILL):i,d.fillRect(0,0,a,l),d.restore(),e.save(),e.transform(...h),e.scale(1,-1),Qe(e,c.canvas,0,0,a,l,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;let e=this.getObject(t);if(!e){N("Dependent image isn't ready yet");return}this.paintInlineImageXObject(e)}paintImageXObjectRepeat(t,e,i,s){if(!this.contentVisible)return;let n=this.getObject(t);if(!n){N("Dependent image isn't ready yet");return}let r=n.width,a=n.height,l=[];for(let h=0,c=s.length;h<c;h+=2)l.push({transform:[e,0,0,i,s[h],s[h+1]],x:0,y:0,w:r,h:a});this.paintInlineImageXObjectGroup(n,l)}applyTransferMapsToCanvas(t){return this.current.transferMaps!=="none"&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if(this.current.transferMaps==="none")return t.bitmap;let{bitmap:e,width:i,height:s}=t,n=this.cachedCanvases.getCanvas("inlineImage",i,s),r=n.context;return r.filter=this.current.transferMaps,r.drawImage(e,0,0),r.filter="none",n.canvas}paintInlineImageXObject(t){if(!this.contentVisible)return;let e=t.width,i=t.height,s=this.ctx;if(this.save(),!ct){let{filter:a}=s;a!=="none"&&a!==""&&(s.filter="none")}s.scale(1/e,-1/i);let n;if(t.bitmap)n=this.applyTransferMapsToBitmap(t);else if(typeof HTMLElement=="function"&&t instanceof HTMLElement||!t.data)n=t;else{let l=this.cachedCanvases.getCanvas("inlineImage",e,i).context;ba(l,t),n=this.applyTransferMapsToCanvas(l)}let r=this._scaleImage(n,Rt(s));s.imageSmoothingEnabled=_a(K(s),t.interpolate),Qe(s,r.img,0,0,r.paintWidth,r.paintHeight,0,-i,e,i),this.compose(),this.restore()}paintInlineImageXObjectGroup(t,e){if(!this.contentVisible)return;let i=this.ctx,s;if(t.bitmap)s=t.bitmap;else{let n=t.width,r=t.height,l=this.cachedCanvases.getCanvas("inlineImage",n,r).context;ba(l,t),s=this.applyTransferMapsToCanvas(l)}for(let n of e)i.save(),i.transform(...n.transform),i.scale(1,-1),Qe(i,s,n.x,n.y,n.w,n.h,0,-1,1,1),i.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t){}markPointProps(t,e){}beginMarkedContent(t){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e){t==="OC"?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===wa?i.clip("evenodd"):i.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),i.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let t=K(this.ctx);if(t[1]===0&&t[2]===0)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(this._cachedScaleForStroking[0]===-1){let{lineWidth:t}=this.current,{a:e,b:i,c:s,d:n}=this.ctx.getTransform(),r,a;if(i===0&&s===0){let l=Math.abs(e),h=Math.abs(n);if(l===h)if(t===0)r=a=1/l;else{let c=l*t;r=a=c<1?1/c:1}else if(t===0)r=1/l,a=1/h;else{let c=l*t,d=h*t;r=c<1?1/c:1,a=d<1?1/d:1}}else{let l=Math.abs(e*n-i*s),h=Math.hypot(e,i),c=Math.hypot(s,n);if(t===0)r=c/l,a=h/l;else{let d=t*l;r=c>d?c/d:1,a=h>d?h/d:1}}this._cachedScaleForStroking[0]=r,this._cachedScaleForStroking[1]=a}return this._cachedScaleForStroking}rescaleAndStroke(t){let{ctx:e}=this,{lineWidth:i}=this.current,[s,n]=this.getScaleForStroking();if(e.lineWidth=i||1,s===1&&n===1){e.stroke();return}let r=e.getLineDash();if(t&&e.save(),e.scale(s,n),r.length>0){let a=Math.max(s,n);e.setLineDash(r.map(l=>l/a)),e.lineDashOffset/=a}
2e.stroke(),t&&e.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}};for(let o in Et)ce.prototype[o]!==void 0&&(ce.prototype[Et[o]]=ce.prototype[o]);var Zt=class{static#t=null;static#e="";static get workerPort(){return this.#t}static set workerPort(t){if(!(typeof Worker<"u"&&t instanceof Worker)&&t!==null)throw new Error("Invalid `workerPort` type.");this.#t=t}static get workerSrc(){return this.#e}static set workerSrc(t){if(typeof t!="string")throw new Error("Invalid `workerSrc` type.");this.#e=t}},Ze={UNKNOWN:0,DATA:1,ERROR:2},st={UNKNOWN:0,CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function gt(o){switch(o instanceof Error||typeof o=="object"&&o!==null||U('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),o.name){case"AbortException":return new Ft(o.message);case"MissingPDFException":return new Nt(o.message);case"PasswordException":return new Se(o.message,o.code);case"UnexpectedResponseException":return new pe(o.message,o.status);case"UnknownErrorException":return new Pe(o.message,o.details);default:return new Pe(o.message,o.toString())}}var Yt=class{#t=new AbortController;constructor(t,e,i){this.sourceName=t,this.targetName=e,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),i.addEventListener("message",this.#e.bind(this),{signal:this.#t.signal})}#e({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){this.#s(t);return}if(t.callback){let i=t.callbackId,s=this.callbackCapabilities[i];if(!s)throw new Error(`Cannot resolve callback ${i}`);if(delete this.callbackCapabilities[i],t.callback===Ze.DATA)s.resolve(t.data);else if(t.callback===Ze.ERROR)s.reject(gt(t.reason));else throw new Error("Unexpected callback case");return}let e=this.actionHandler[t.action];if(!e)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){let i=this.sourceName,s=t.sourceName,n=this.comObj;new Promise(function(r){r(e(t.data))}).then(function(r){n.postMessage({sourceName:i,targetName:s,callback:Ze.DATA,callbackId:t.callbackId,data:r})},function(r){n.postMessage({sourceName:i,targetName:s,callback:Ze.ERROR,callbackId:t.callbackId,reason:gt(r)})});return}if(t.streamId){this.#i(t);return}e(t.data)}on(t,e){let i=this.actionHandler;if(i[t])throw new Error(`There is already an actionName called "${t}"`);i[t]=e}send(t,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},i)}sendWithPromise(t,e,i){let s=this.callbackId++,n=Promise.withResolvers();this.callbackCapabilities[s]=n;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:s,data:e},i)}catch(r){n.reject(r)}return n.promise}sendWithStream(t,e,i,s){let n=this.streamId++,r=this.sourceName,a=this.targetName,l=this.comObj;return new ReadableStream({start:h=>{let c=Promise.withResolvers();return this.streamControllers[n]={controller:h,startCall:c,pullCall:null,cancelCall:null,isClosed:!1},l.postMessage({sourceName:r,targetName:a,action:t,streamId:n,data:e,desiredSize:h.desiredSize},s),c.promise},pull:h=>{let c=Promise.withResolvers();return this.streamControllers[n].pullCall=c,l.postMessage({sourceName:r,targetName:a,stream:st.PULL,streamId:n,desiredSize:h.desiredSize}),c.promise},cancel:h=>{rt(h instanceof Error,"cancel must have a valid reason");let c=Promise.withResolvers();return this.streamControllers[n].cancelCall=c,this.streamControllers[n].isClosed=!0,l.postMessage({sourceName:r,targetName:a,stream:st.CANCEL,streamId:n,reason:gt(h)}),c.promise}},i)}#i(t){let e=t.streamId,i=this.sourceName,s=t.sourceName,n=this.comObj,r=this,a=this.actionHandler[t.action],l={enqueue(h,c=1,d){if(this.isCancelled)return;let u=this.desiredSize;this.desiredSize-=c,u>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),n.postMessage({sourceName:i,targetName:s,stream:st.ENQUEUE,streamId:e,chunk:h},d)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:i,targetName:s,stream:st.CLOSE,streamId:e}),delete r.streamSinks[e])},error(h){rt(h instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,n.postMessage({sourceName:i,targetName:s,stream:st.ERROR,streamId:e,reason:gt(h)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};l.sinkCapability.resolve(),l.ready=l.sinkCapability.promise,this.streamSinks[e]=l,new Promise(function(h){h(a(t.data,l))}).then(function(){n.postMessage({sourceName:i,targetName:s,stream:st.START_COMPLETE,streamId:e,success:!0})},function(h){n.postMessage({sourceName:i,targetName:s,stream:st.START_COMPLETE,streamId:e,reason:gt(h)})})}#s(t){let e=t.streamId,i=this.sourceName,s=t.sourceName,n=this.comObj,r=this.streamControllers[e],a=this.streamSinks[e];switch(t.stream){case st.START_COMPLETE:t.success?r.startCall.resolve():r.startCall.reject(gt(t.reason));break;case st.PULL_COMPLETE:t.success?r.pullCall.resolve():r.pullCall.reject(gt(t.reason));break;case st.PULL:if(!a){n.postMessage({sourceName:i,targetName:s,stream:st.PULL_COMPLETE,streamId:e,success:!0});break}a.desiredSize<=0&&t.desiredSize>0&&a.sinkCapability.resolve(),a.desiredSize=t.desiredSize,new Promise(function(l){l(a.onPull?.())}).then(function(){n.postMessage({sourceName:i,targetName:s,stream:st.PULL_COMPLETE,streamId:e,success:!0})},function(l){n.postMessage({sourceName:i,targetName:s,stream:st.PULL_COMPLETE,streamId:e,reason:gt(l)})});break;case st.ENQUEUE:if(rt(r,"enqueue should have stream controller"),r.isClosed)break;r.controller.enqueue(t.chunk);break;case st.CLOSE:if(rt(r,"close should have stream controller"),r.isClosed)break;r.isClosed=!0,r.controller.close(),this.#r(r,e);break;case st.ERROR:rt(r,"error should have stream controller"),r.controller.error(gt(t.reason)),this.#r(r,e);break;case st.CANCEL_COMPLETE:t.success?r.cancelCall.resolve():r.cancelCall.reject(gt(t.reason)),this.#r(r,e);break;case st.CANCEL:if(!a)break;new Promise(function(l){l(a.onCancel?.(gt(t.reason)))}).then(function(){n.postMessage({sourceName:i,targetName:s,stream:st.CANCEL_COMPLETE,streamId:e,success:!0})},function(l){n.postMessage({sourceName:i,targetName:s,stream:st.CANCEL_COMPLETE,streamId:e,reason:gt(l)})}),a.sinkCapability.reject(gt(t.reason)),a.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}#r(t,e){return C(this,null,function*(){yield Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[e]})}destroy(){this.#t?.abort(),this.#t=null}},Gs=class{#t;#e;constructor({parsedData:t,rawData:e}){this.#t=t,this.#e=e}getRaw(){return this.#e}get(t){return this.#t.get(t)??null}getAll(){return zn(this.#t)}has(t){return this.#t.has(t)}},he=Symbol("INTERNAL"),Xs=class{#t=!1;#e=!1;#i=!1;#s=!0;constructor(t,{name:e,intent:i,usage:s,rbGroups:n}){this.#t=!!(t&mt.DISPLAY),this.#e=!!(t&mt.PRINT),this.name=e,this.intent=i,this.usage=s,this.rbGroups=n}get visible(){if(this.#i)return this.#s;if(!this.#s)return!1;let{print:t,view:e}=this.usage;return this.#t?e?.viewState!=="OFF":this.#e?t?.printState!=="OFF":!0}_setVisible(t,e,i=!1){t!==he&&U("Internal method `_setVisible` called."),this.#i=i,this.#s=e}},qs=class{#t=null;#e=new Map;#i=null;#s=null;constructor(t,e=mt.DISPLAY){if(this.renderingIntent=e,this.name=null,this.creator=null,t!==null){this.name=t.name,this.creator=t.creator,this.#s=t.order;for(let i of t.groups)this.#e.set(i.id,new Xs(e,i));if(t.baseState==="OFF")for(let i of this.#e.values())i._setVisible(he,!1);for(let i of t.on)this.#e.get(i)._setVisible(he,!0);for(let i of t.off)this.#e.get(i)._setVisible(he,!1);this.#i=this.getHash()}}#r(t){let e=t.length;if(e<2)return!0;let i=t[0];for(let s=1;s<e;s++){let n=t[s],r;if(Array.isArray(n))r=this.#r(n);else if(this.#e.has(n))r=this.#e.get(n).visible;else return N(`Optional content group not found: ${n}`),!0;switch(i){case"And":if(!r)return!1;break;case"Or":if(r)return!0;break;case"Not":return!r;default:return!0}}return i==="And"}isVisible(t){if(this.#e.size===0)return!0;
2if(!t)return Wi("Optional content group not defined."),!0;if(t.type==="OCG")return this.#e.has(t.id)?this.#e.get(t.id).visible:(N(`Optional content group not found: ${t.id}`),!0);if(t.type==="OCMD"){if(t.expression)return this.#r(t.expression);if(!t.policy||t.policy==="AnyOn"){for(let e of t.ids){if(!this.#e.has(e))return N(`Optional content group not found: ${e}`),!0;if(this.#e.get(e).visible)return!0}return!1}else if(t.policy==="AllOn"){for(let e of t.ids){if(!this.#e.has(e))return N(`Optional content group not found: ${e}`),!0;if(!this.#e.get(e).visible)return!1}return!0}else if(t.policy==="AnyOff"){for(let e of t.ids){if(!this.#e.has(e))return N(`Optional content group not found: ${e}`),!0;if(!this.#e.get(e).visible)return!0}return!1}else if(t.policy==="AllOff"){for(let e of t.ids){if(!this.#e.has(e))return N(`Optional content group not found: ${e}`),!0;if(this.#e.get(e).visible)return!1}return!0}return N(`Unknown optional content policy ${t.policy}.`),!0}return N(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,i=!0){let s=this.#e.get(t);if(!s){N(`Optional content group not found: ${t}`);return}if(i&&e&&s.rbGroups.length)for(let n of s.rbGroups)for(let r of n)r!==t&&this.#e.get(r)?._setVisible(he,!1,!0);s._setVisible(he,!!e,!0),this.#t=null}setOCGState({state:t,preserveRB:e}){let i;for(let s of t){switch(s){case"ON":case"OFF":case"Toggle":i=s;continue}let n=this.#e.get(s);if(n)switch(i){case"ON":this.setVisibility(s,!0,e);break;case"OFF":this.setVisibility(s,!1,e);break;case"Toggle":this.setVisibility(s,!n.visible,e);break}}this.#t=null}get hasInitialVisibility(){return this.#i===null||this.getHash()===this.#i}getOrder(){return this.#e.size?this.#s?this.#s.slice():[...this.#e.keys()]:null}getGroups(){return this.#e.size>0?zn(this.#e):null}getGroup(t){return this.#e.get(t)||null}getHash(){if(this.#t!==null)return this.#t;let t=new ui;for(let[e,i]of this.#e)t.update(`${e}:${i.visible}`);return this.#t=t.hexdigest()}},Ks=class{constructor(t,{disableRange:e=!1,disableStream:i=!1}){rt(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');let{length:s,initialData:n,progressiveDone:r,contentDispositionFilename:a}=t;if(this._queuedChunks=[],this._progressiveDone=r,this._contentDispositionFilename=a,n?.length>0){let l=n instanceof Uint8Array&&n.byteLength===n.buffer.byteLength?n.buffer:new Uint8Array(n).buffer;this._queuedChunks.push(l)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!i,this._isRangeSupported=!e,this._contentLength=s,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((l,h)=>{this._onReceiveData({begin:l,chunk:h})}),t.addProgressListener((l,h)=>{this._onProgress({loaded:l,total:h})}),t.addProgressiveReadListener(l=>{this._onReceiveData({chunk:l})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}_onReceiveData({begin:t,chunk:e}){let i=e instanceof Uint8Array&&e.byteLength===e.buffer.byteLength?e.buffer:new Uint8Array(e).buffer;if(t===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(i):this._queuedChunks.push(i);else{let s=this._rangeReaders.some(function(n){return n._begin!==t?!1:(n._enqueue(i),!0)});rt(s,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(t){t.total===void 0?this._rangeReaders[0]?.onProgress?.({loaded:t.loaded}):this._fullRequestReader?.onProgress?.({loaded:t.loaded,total:t.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){let e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){rt(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");let t=this._queuedChunks;return this._queuedChunks=null,new Ys(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=new Qs(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(let e of this._rangeReaders.slice(0))e.cancel(t);this._pdfDataRangeTransport.abort()}},Ys=class{constructor(t,e,i=!1,s=null){this._stream=t,this._done=i||!1,this._filename=Un(s)?s:null,this._queuedChunks=e||[],this._loaded=0;for(let n of this._queuedChunks)this._loaded+=n.byteLength;
2this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}read(){return C(this,null,function*(){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){this._done=!0;for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}},Qs=class{constructor(t,e,i){this._stream=t,this._begin=e,this._end=i,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(t){if(!this._done){if(this._requests.length===0)this._queuedChunk=t;else{this._requests.shift().resolve({value:t,done:!1});for(let i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}read(){return C(this,null,function*(){if(this._queuedChunk){let e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise})}cancel(t){this._done=!0;for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}};function qo(o){let t=!0,e=i("filename\\*","i").exec(o);if(e){e=e[1];let c=a(e);return c=unescape(c),c=l(c),c=h(c),n(c)}if(e=r(o),e){let c=h(e);return n(c)}if(e=i("filename","i").exec(o),e){e=e[1];let c=a(e);return c=h(c),n(c)}function i(c,d){return new RegExp("(?:^|;)\\s*"+c+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',d)}function s(c,d){if(c){if(!/^[\x00-\xFF]+$/.test(d))return d;try{let u=new TextDecoder(c,{fatal:!0}),f=Ui(d);d=u.decode(f),t=!1}catch{}}return d}function n(c){return t&&/[\x80-\xff]/.test(c)&&(c=s("utf-8",c),t&&(c=s("iso-8859-1",c))),c}function r(c){let d=[],u,f=i("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(u=f.exec(c))!==null;){let[,g,b,m]=u;if(g=parseInt(g,10),g in d){if(g===0)break;continue}d[g]=[b,m]}let p=[];for(let g=0;g<d.length&&g in d;++g){let[b,m]=d[g];m=a(m),b&&(m=unescape(m),g===0&&(m=l(m))),p.push(m)}return p.join("")}function a(c){if(c.startsWith('"')){let d=c.slice(1).split('\\"');for(let u=0;u<d.length;++u){let f=d[u].indexOf('"');f!==-1&&(d[u]=d[u].slice(0,f),d.length=u+1),d[u]=d[u].replaceAll(/\\(.)/g,"$1")}c=d.join('"')}return c}function l(c){let d=c.indexOf("'");if(d===-1)return c;let u=c.slice(0,d),p=c.slice(d+1).replace(/^[^']*'/,"");return s(u,p)}function h(c){return!c.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(c)?c:c.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(d,u,f,p){if(f==="q"||f==="Q")return p=p.replaceAll("_"," "),p=p.replaceAll(/=([0-9a-fA-F]{2})/g,function(g,b){return String.fromCharCode(parseInt(b,16))}),s(u,p);try{p=atob(p)}catch{}return s(u,p)})}return""}function Gn(o,t){let e=new Headers;if(!o||!t||typeof t!="object")return e;for(let i in t){let s=t[i];s!==void 0&&e.append(i,s)}return e}function Xn({responseHeaders:o,isHttp:t,rangeChunkSize:e,disableRange:i}){let s={allowRangeRequests:!1,suggestedLength:void 0},n=parseInt(o.get("Content-Length"),10);return!Number.isInteger(n)||(s.suggestedLength=n,n<=2*e)||i||!t||o.get("Accept-Ranges")!=="bytes"||(o.get("Content-Encoding")||"identity")!=="identity"||(s.allowRangeRequests=!0),s}function qn(o){let t=o.get("Content-Disposition");if(t){let e=qo(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch{}if(Un(e))return e}return null}function Xi(o,t){return o===404||o===0&&t.startsWith("file:")?new Nt('Missing PDF "'+t+'".'):new pe(`Unexpected server response (${o}) while retrieving PDF "${t}".`,o)}function Sa(o){return o===200||o===206}function Pa(o,t,e){return{method:"GET",headers:o,signal:e.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function Ta(o){return o instanceof Uint8Array?o.buffer:o instanceof ArrayBuffer?o:(N(`getArrayBuffer - unexpected data format: ${o}`),new Uint8Array(o).buffer)}var yi=class{constructor(t){this.source=t,this.isHttp=/^https?:/i.test(t.url),this.headers=Gn(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return rt(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new Js(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=new Zs(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(let e of this._rangeRequestReaders.slice(0))e.cancel(t)}},Js=class{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,Pa(i,this._withCredentials,this._abortController)).then(n=>{if(!Sa(n.status))throw Xi(n.status,s);this._reader=n.body.getReader(),this._headersCapability.resolve();let r=n.headers,{allowRangeRequests:a,suggestedLength:l}=Xn({responseHeaders:r,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=a,this._contentLength=l||this._contentLength,this._filename=qn(r),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Ft("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}read(){return C(this,null,function*(){yield this._headersCapability.promise;let{value:t,done:e}=yield this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:Ta(t),done:!1})})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}},Zs=class{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 n=new Headers(t.headers);n.append("Range",`bytes=${e}-${i-1}`);let r=s.url;fetch(r,Pa(n,this._withCredentials,this._abortController)).then(a=>{if(!Sa(a.status))throw Xi(a.status,r);this._readCapability.resolve(),this._reader=a.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}read(){return C(this,null,function*(){yield this._readCapability.promise;let{value:t,done:e}=yield this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,this.onProgress?.({loaded:this._loaded}),{value:Ta(t),done:!1})})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}},ys=200,vs=206;
2function Ko(o){let t=o.response;return typeof t!="string"?t:Ui(t).buffer}var tn=class{constructor({url:t,httpHeaders:e,withCredentials:i}){this.url=t,this.isHttp=/^https?:/i.test(t),this.headers=Gn(this.isHttp,e),this.withCredentials=i||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(t,e,i){let s={begin:t,end:e};for(let n in i)s[n]=i[n];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};e.open("GET",this.url),e.withCredentials=this.withCredentials;for(let[n,r]of this.headers)e.setRequestHeader(n,r);return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),s.expectedStatus=vs):s.expectedStatus=ys,e.responseType="arraybuffer",t.onError&&(e.onerror=function(n){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){let i=this.pendingRequests[t];i&&i.onProgress?.(e)}onStateChange(t,e){let i=this.pendingRequests[t];if(!i)return;let s=i.xhr;if(s.readyState>=2&&i.onHeadersReceived&&(i.onHeadersReceived(),delete i.onHeadersReceived),s.readyState!==4||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],s.status===0&&this.isHttp){i.onError?.(s.status);return}let n=s.status||ys;if(!(n===ys&&i.expectedStatus===vs)&&n!==i.expectedStatus){i.onError?.(s.status);return}let a=Ko(s);if(n===vs){let l=s.getResponseHeader("Content-Range"),h=/bytes (\d+)-(\d+)\/(\d+)/.exec(l);i.onDone({begin:parseInt(h[1],10),chunk:a})}else a?i.onDone({begin:0,chunk:a}):i.onError?.(s.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}abortRequest(t){let e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}},en=class{constructor(t){this._source=t,this._manager=new tn(t),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(t){let e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return rt(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new sn(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){let i=new nn(this._manager,t,e);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(let e of this._rangeRequestReaders.slice(0))e.cancel(t)}},sn=class{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}_onHeadersReceived(){let t=this._fullRequestId,e=this._manager.getRequestXhr(t),i=new Headers(e.getAllResponseHeaders().trim().split(/[\r\n]+/).map(r=>{let[a,...l]=r.split(": ");return[a,l.join(": ")]})),{allowRangeRequests:s,suggestedLength:n}=Xn({responseHeaders:i,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});s&&(this._isRangeSupported=!0),this._contentLength=n||this._contentLength,this._filename=qn(i),this._isRangeSupported&&this._manager.abortRequest(t),this._headersCapability.resolve()}_onDone(t){if(t&&(this._requests.length>0?this._requests.shift().resolve({value:t.chunk,done:!1}):this._cachedChunks.push(t.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){this._storedError=Xi(t,this._url),this._headersCapability.reject(this._storedError);for(let e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){this.onProgress?.({loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}read(){return C(this,null,function*(){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){this._done=!0,this._headersCapability.reject(t);for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest
2(this._fullRequestId),this._fullRequestReader=null}},nn=class{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}_close(){this.onClosed?.(this)}_onDone(t){let e=t.chunk;this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0;for(let i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){this._storedError=Xi(t,this._url);for(let e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){this.isStreamingSupported||this.onProgress?.({loaded:t.loaded})}get isStreamingSupported(){return!1}read(){return C(this,null,function*(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){let e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise})}cancel(t){this._done=!0;for(let e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}},Yo=/^[a-z][a-z0-9\-+.]+:/i;function Qo(o){if(Yo.test(o))return new URL(o);let t=Pt.get("url");return new URL(t.pathToFileURL(o))}function La(o,t,e){return o.protocol==="http:"?Pt.get("http").request(o,{headers:t},e):Pt.get("https").request(o,{headers:t},e)}var rn=class{constructor(t){this.source=t,this.url=Qo(t.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.headers=Gn(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return rt(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new ln(this):new an(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=this.isFsUrl?new hn(this,t,e):new on(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){this._fullRequestReader?.cancel(t);for(let e of this._rangeRequestReaders.slice(0))e.cancel(t)}},vi=class{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()}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}read(){return C(this,null,function*(){if(yield this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;let t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(t).buffer,done:!1})})}cancel(t){if(!this._readableStream){this._error(t);return}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",e=>{this._error(e)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new Ft("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}},Ei=class{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}get isStreamingSupported(){return this._isStreamingSupported}read(){return C(this,null,function*(){if(yield this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;let t=this._readableStream.read();return t===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=t.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(t).buffer,done:!1})})}cancel(t){if(!this._readableStream){this._error(t);return}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",e=>{this._error(e)}),this._storedError&&this._readableStream.destroy(this._storedError)}},an=class extends vi{constructor(t){super(t);let e=Object.fromEntries(t.headers),i=s=>{if(s.statusCode===404){let l=new Nt(`Missing PDF "${this._url}".`);this._storedError=l,this._headersCapability.reject(l);return}this._headersCapability.resolve(),this._setReadableStream(s);let n=new Headers(this._readableStream.headers),{allowRangeRequests:r,suggestedLength:a}=Xn({responseHeaders:n,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=r,this._contentLength=a||this._contentLength,this._filename=qn(n)};this._request=La(this._url,e,i),this._request.on("error",s=>{this._storedError=s,this._headersCapability.reject(s)}),this._request.end()}}
2,on=class extends Ei{constructor(t,e,i){super(t);let s=Object.fromEntries(t.headers);s.Range=`bytes=${e}-${i-1}`;let n=r=>{if(r.statusCode===404){let a=new Nt(`Missing PDF "${this._url}".`);this._storedError=a;return}this._setReadableStream(r)};this._request=La(this._url,s,n),this._request.on("error",r=>{this._storedError=r}),this._request.end()}},ln=class extends vi{constructor(t){super(t);let e=Pt.get("fs");e.promises.lstat(this._url).then(i=>{this._contentLength=i.size,this._setReadableStream(e.createReadStream(this._url)),this._headersCapability.resolve()},i=>{i.code==="ENOENT"&&(i=new Nt(`Missing PDF "${this._url}".`)),this._storedError=i,this._headersCapability.reject(i)})}},hn=class extends Ei{constructor(t,e,i){super(t);let s=Pt.get("fs");this._setReadableStream(s.createReadStream(this._url,{start:e,end:i-1}))}},Jo=1e5,ft=30,Zo=.8,Oe=class o{#t=Promise.withResolvers();#e=null;#i=!1;#s=!!globalThis.FontInspector?.enabled;#r=null;#n=null;#l=0;#h=0;#c=null;#o=null;#d=0;#a=0;#u=Object.create(null);#p=[];#f=null;#g=[];#b=new WeakMap;#m=null;static#A=new Map;static#w=new Map;static#E=new WeakMap;static#y=null;static#v=new Set;constructor({textContentSource:t,container:e,viewport:i}){if(t instanceof ReadableStream)this.#f=t;else if(typeof t=="object")this.#f=new ReadableStream({start(l){l.enqueue(t),l.close()}});else throw new Error('No "textContentSource" parameter specified.');this.#e=this.#o=e,this.#a=i.scale*(globalThis.devicePixelRatio||1),this.#d=i.rotation,this.#n={div:null,properties:null,ctx:null};let{pageWidth:s,pageHeight:n,pageX:r,pageY:a}=i.rawDims;this.#m=[1,0,0,-1,-r,a+n],this.#h=s,this.#l=n,o.#k(),te(e,i),this.#t.promise.finally(()=>{o.#v.delete(this),this.#n=null,this.#u=null}).catch(()=>{})}static get fontFamilyMap(){let{isWindows:t,isFirefox:e}=ot.platform;return B(this,"fontFamilyMap",new Map([["sans-serif",`${t&&e?"Calibri, ":""}sans-serif`],["monospace",`${t&&e?"Lucida Console, ":""}monospace`]]))}render(){let t=()=>{this.#c.read().then(({value:e,done:i})=>{if(i){this.#t.resolve();return}this.#r??=e.lang,Object.assign(this.#u,e.styles),this.#M(e.items),t()},this.#t.reject)};return this.#c=this.#f.getReader(),o.#v.add(this),t(),this.#t.promise}update({viewport:t,onBefore:e=null}){let i=t.scale*(globalThis.devicePixelRatio||1),s=t.rotation;if(s!==this.#d&&(e?.(),this.#d=s,te(this.#o,{rotation:s})),i!==this.#a){e?.(),this.#a=i;let n={div:null,properties:null,ctx:o.#T(this.#r)};for(let r of this.#g)n.properties=this.#b.get(r),n.div=r,this.#x(n)}}cancel(){let t=new Ft("TextLayer task cancelled.");this.#c?.cancel(t).catch(()=>{}),this.#c=null,this.#t.reject(t)}get textDivs(){return this.#g}get textContentItemsStr(){return this.#p}#M(t){if(this.#i)return;this.#n.ctx??=o.#T(this.#r);let e=this.#g,i=this.#p;for(let s of t){if(e.length>Jo){N("Ignoring additional textDivs for performance reasons."),this.#i=!0;return}if(s.str===void 0){if(s.type==="beginMarkedContentProps"||s.type==="beginMarkedContent"){let n=this.#e;this.#e=document.createElement("span"),this.#e.classList.add("markedContent"),s.id!==null&&this.#e.setAttribute("id",`${s.id}`),n.append(this.#e)}else s.type==="endMarkedContent"&&(this.#e=this.#e.parentNode);continue}i.push(s.str),this.#P(s)}}#P(t){let e=document.createElement("span"),i={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};this.#g.push(e);let s=M.transform(this.#m,t.transform),n=Math.atan2(s[1],s[0]),r=this.#u[t.fontName];r.vertical&&(n+=Math.PI/2);let a=this.#s&&r.fontSubstitution||r.fontFamily;a=o.fontFamilyMap.get(a)||a;let l=Math.hypot(s[2],s[3]),h=l*o.#R(a,this.#r),c,d;n===0?(c=s[4],d=s[5]-h):(c=s[4]+h*Math.sin(n),d=s[5]-h*Math.cos(n));let u="calc(var(--scale-factor)*",f=e.style;this.#e===this.#o?(f.left=`${(100*c/this.#h).toFixed(2)}%`,f.top=`${(100*d/this.#l).toFixed(2)}%`):(f.left=`${u}${c.toFixed(2)}px)`,f.top=`${u}${d.toFixed(2)}px)`),f.fontSize=`${u}${(o.#y*l).toFixed(2)}px)`,f.fontFamily=a,i.fontSize=l,e.setAttribute("role","presentation"),e.textContent=t.str,e.dir=t.dir,this.#s&&(e.dataset.fontName=r.fontSubstitutionLoadedName||t.fontName),n!==0&&(i.angle=n*(180/Math.PI));let p=!1;if(t.str.length>1)p=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){let g=Math.abs(t.transform[0]),b=Math.abs(t.transform[3]);g!==b&&Math.max(g,b)/Math.min(g,b)>1.5&&(p=!0)}if(p&&(i.canvasWidth=r.vertical?t.height:t.width),this.#b.set(e,i),this.#n.div=e,this.#n.properties=i,this.#x(this.#n),i.hasText&&this.#e.append(e),i.hasEOL){let g=document.createElement("br");g.setAttribute("role","presentation"),this.#e.append(g)}}#x(t){let{div:e,properties:i,ctx:s}=t,{style:n}=e,r="";if(o.#y>1&&(r=`scale(${1/o.#y})`),i.canvasWidth!==0&&i.hasText){let{fontFamily:a}=n,{canvasWidth:l,fontSize:h}=i;o.#S(s,h*this.#a,a);let{width:c}=s.measureText(e.textContent);c>0&&(r=`scaleX(${l*this.#a/c}) ${r}`)}i.angle!==0&&(r=`rotate(${i.angle}deg) ${r}`),r.length>0&&(n.transform=r)}static cleanup(){if(!(this.#v.size>0)){this.#A.clear();for(let{canvas:t}of this.#w.values())t.remove();this.#w.clear()}}static#T(t=null){let e=this.#w.get(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}),this.#w.set(t,e),this.#E.set(e,{size:0,family:""})}return e}static#S(t,e,i){let s=this.#E.get(t);e===s.size&&i===s.family||(t.font=`${e}px ${i}`,s.size=e,s.family=i)}static#k(){if(this.#y!==null)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),this.#y=t.getBoundingClientRect().height,t.remove()}static#R(t,e){let i=this.#A.get(t);if(i)return i;let s=this.#T(e);s.canvas.width=s.canvas.height=ft,this.#S(s,ft,t);let n=s.measureText(""),r=n.fontBoundingBoxAscent,a=Math.abs(n.fontBoundingBoxDescent);if(r){let c=r/(r+a);return this.#A.set(t,c),s.canvas.width=s.canvas.height=0,c}s.strokeStyle="red",s.clearRect(0,0,ft,ft),s.strokeText("g",0,0);let l=s.getImageData(0,0,ft,ft).data;a=0;for(let c=l.length-1-3;c>=0;c-=4)if(l[c]>0){a=Math.ceil(c/4/ft);break}s.clearRect(0,0,ft,ft),s.strokeText("A",0,ft),l=s.getImageData(0,0,ft,ft).data,r=0;for(let c=0,d=l.length;c<d;c+=4)if(l[c]>0){r=ft-Math.floor(c/4/ft);break}s.canvas.width=s.canvas.height=0;let h=r?r/(r+a):Zo;return this.#A.set(t,h),h}},De=class o{static textContent(t){let e=[],i={items:e,styles:Object.create(null)};
2function s(n){if(!n)return;let r=null,a=n.name;if(a==="#text")r=n.value;else if(o.shouldBuildText(a))n?.attributes?.textContent?r=n.attributes.textContent:n.value&&(r=n.value);else return;if(r!==null&&e.push({str:r}),!!n.children)for(let l of n.children)s(l)}return s(t),i}static shouldBuildText(t){return!(t==="textarea"||t==="input"||t==="option"||t==="select")}},tl=65536,el=100,il=5e3,sl=ct?Bs:Ds,nl=ct?Hs:mi,rl=ct?Fs:Ns,al=ct?js:_i;function ol(o={}){typeof o=="string"||o instanceof URL?o={url:o}:(o instanceof ArrayBuffer||ArrayBuffer.isView(o))&&(o={data:o});let t=new cn,{docId:e}=t,i=o.url?ll(o.url):null,s=o.data?hl(o.data):null,n=o.httpHeaders||null,r=o.withCredentials===!0,a=o.password??null,l=o.range instanceof xi?o.range:null,h=Number.isInteger(o.rangeChunkSize)&&o.rangeChunkSize>0?o.rangeChunkSize:tl,c=o.worker instanceof de?o.worker:null,d=o.verbosity,u=typeof o.docBaseUrl=="string"&&!Gi(o.docBaseUrl)?o.docBaseUrl:null,f=typeof o.cMapUrl=="string"?o.cMapUrl:null,p=o.cMapPacked!==!1,g=o.CMapReaderFactory||nl,b=typeof o.standardFontDataUrl=="string"?o.standardFontDataUrl:null,m=o.StandardFontDataFactory||al,w=o.stopAtErrors!==!0,y=Number.isInteger(o.maxImageSize)&&o.maxImageSize>-1?o.maxImageSize:-1,A=o.isEvalSupported!==!1,v=typeof o.isOffscreenCanvasSupported=="boolean"?o.isOffscreenCanvasSupported:!ct,S=typeof o.isChrome=="boolean"?o.isChrome:!ot.platform.isFirefox&&typeof window<"u"&&!!window?.chrome,P=Number.isInteger(o.canvasMaxAreaInBytes)?o.canvasMaxAreaInBytes:-1,T=typeof o.disableFontFace=="boolean"?o.disableFontFace:ct,_=o.fontExtraProperties===!0,E=o.enableXfa===!0,L=o.ownerDocument||globalThis.document,V=o.disableRange===!0,H=o.disableStream===!0,F=o.disableAutoFetch===!0,W=o.pdfBug===!0,Q=o.CanvasFactory||sl,k=o.FilterFactory||rl,D=o.enableHWA===!0,Vt=l?l.length:o.length??NaN,Kt=typeof o.useSystemFonts=="boolean"?o.useSystemFonts:!ct&&!T,At=typeof o.useWorkerFetch=="boolean"?o.useWorkerFetch:g===mi&&m===_i&&f&&b&&xe(f,document.baseURI)&&xe(b,document.baseURI);o.canvasFactory&&ha("`canvasFactory`-instance option, please use `CanvasFactory` instead."),o.filterFactory&&ha("`filterFactory`-instance option, please use `FilterFactory` instead.");let at=null;vo(d);let it={canvasFactory:new Q({ownerDocument:L,enableHWA:D}),filterFactory:new k({docId:e,ownerDocument:L}),cMapReaderFactory:At?null:new g({baseUrl:f,isCompressed:p}),standardFontDataFactory:At?null:new m({baseUrl:b})};if(!c){let _t={verbosity:d,port:Zt.workerPort};c=_t.port?de.fromPort(_t):new de(_t),t._worker=c}let oe={docId:e,apiVersion:"4.8.69",data:s,password:a,disableAutoFetch:F,rangeChunkSize:h,length:Vt,docBaseUrl:u,enableXfa:E,evaluatorOptions:{maxImageSize:y,disableFontFace:T,ignoreErrors:w,isEvalSupported:A,isOffscreenCanvasSupported:v,isChrome:S,canvasMaxAreaInBytes:P,fontExtraProperties:_,useSystemFonts:Kt,cMapUrl:At?f:null,standardFontDataUrl:At?b:null}},we={disableFontFace:T,fontExtraProperties:_,ownerDocument:L,pdfBug:W,styleElement:at,loadingParams:{disableAutoFetch:F,enableXfa:E}};return c.promise.then(function(){if(t.destroyed)throw new Error("Loading aborted");if(c.destroyed)throw new Error("Worker was destroyed");let _t=c.messageHandler.sendWithPromise("GetDocRequest",oe,s?[s.buffer]:null),$;if(l)$=new Ks(l,{disableRange:V,disableStream:H});else if(!s){if(!i)throw new Error("getDocument - no `url` parameter provided.");let kt;ct?kt=typeof fetch<"u"&&typeof Response<"u"&&"body"in Response.prototype&&xe(i)?yi:rn:kt=xe(i)?yi:en,$=new kt({url:i,length:Vt,httpHeaders:n,withCredentials:r,rangeChunkSize:h,disableRange:V,disableStream:H})}return _t.then(kt=>{if(t.destroyed)throw new Error("Loading aborted");if(c.destroyed)throw new Error("Worker was destroyed");let fs=new Yt(e,kt,c.port),mo=new pn(fs,t,$,we,it);t._transport=mo,fs.send("Ready",null)})}).catch(t._capability.reject),t}function ll(o){if(o instanceof URL)return o.href;try{return new URL(o,window.location).href}catch{if(ct&&typeof o=="string")return o}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function hl(o){if(ct&&typeof Buffer<"u"&&o instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(o instanceof Uint8Array&&o.byteLength===o.buffer.byteLength)return o;
2if(typeof o=="string")return Ui(o);if(o instanceof ArrayBuffer||ArrayBuffer.isView(o)||typeof o=="object"&&!isNaN(o?.length))return new Uint8Array(o);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function ya(o){return typeof o=="object"&&Number.isInteger(o?.num)&&o.num>=0&&Number.isInteger(o?.gen)&&o.gen>=0}var cn=class o{static#t=0;constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${o.#t++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}destroy(){return C(this,null,function*(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),yield this._transport?.destroy()}catch(t){throw this._worker?.port&&delete this._worker._pendingDestroy,t}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)})}},xi=class{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()}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){U("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}},dn=class{constructor(t,e){this._pdfInfo=t,this._transport=e}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return B(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){let{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}},un=class{#t=null;#e=!1;constructor(t,e,i,s=!1){this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=s?new hi:null,this._pdfBug=s,this.commonObjs=i.commonObjs,this.objs=new Ci,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:t,rotation:e=this.rotate,offsetX:i=0,offsetY:s=0,dontFlip:n=!1}={}){return new Te({viewBox:this.view,scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:n})}getAnnotations({intent:t="display"}={}){let{renderingIntent:e}
2=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 B(this,"isPureXfa",!!this._transport._htmlForXfa)}getXfa(){return C(this,null,function*(){return this._transport._htmlForXfa?.children[this._pageIndex]||null})}render({canvasContext:t,viewport:e,intent:i="display",annotationMode:s=Ut.ENABLE,transform:n=null,background:r=null,optionalContentConfigPromise:a=null,annotationCanvasMap:l=null,pageColors:h=null,printAnnotationStorage:c=null,isEditing:d=!1}){this._stats?.time("Overall");let u=this._transport.getRenderingIntent(i,s,c,d),{renderingIntent:f,cacheKey:p}=u;this.#e=!1,this.#s(),a||=this._transport.getOptionalContentConfig(f);let g=this._intentStates.get(p);g||(g=Object.create(null),this._intentStates.set(p,g)),g.streamReaderCancelTimeout&&(clearTimeout(g.streamReaderCancelTimeout),g.streamReaderCancelTimeout=null);let b=!!(f&mt.PRINT);g.displayReadyCapability||(g.displayReadyCapability=Promise.withResolvers(),g.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(u));let m=A=>{g.renderTasks.delete(w),(this._maybeCleanupAfterRender||b)&&(this.#e=!0),this.#i(!b),A?(w.capability.reject(A),this._abortOperatorList({intentState:g,reason:A instanceof Error?A:new Error(A)})):w.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},w=new mn({callback:m,params:{canvasContext:t,viewport:e,transform:n,background:r},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:l,operatorList:g.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!b,pdfBug:this._pdfBug,pageColors:h});(g.renderTasks||=new Set).add(w);let y=w.task;return Promise.all([g.displayReadyCapability.promise,a]).then(([A,v])=>{if(this.destroyed){m();return}if(this._stats?.time("Rendering"),!(v.renderingIntent&f))throw new Error("Mu
2st use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");w.initializeGraphics({transparency:A,optionalContentConfig:v}),w.operatorListChanged()}).catch(m),y}getOperatorList({intent:t="display",annotationMode:e=Ut.ENABLE,printAnnotationStorage:i=null,isEditing:s=!1}={}){function n(){a.operatorList.lastChunk&&(a.opListReadCapability.resolve(a.operatorList),a.renderTasks.delete(l))}let r=this._transport.getRenderingIntent(t,e,i,s,!0),a=this._intentStates.get(r.cacheKey);a||(a=Object.create(null),this._intentStates.set(r.cacheKey,a));let l;return a.opListReadCapability||(l=Object.create(null),l.operatorListChanged=n,a.opListReadCapability=Promise.withResolvers(),(a.renderTasks||=new Set).add(l),a.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(r)),a.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:t===!0,disableNormalization:e===!0},{highWaterMark:100,size(s){return s.items.length}})}getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(i=>De.textContent(i));let e=this.streamTextContent(t);return new Promise(function(i,s){function n(){r.read().then(function({value:l,done:h}){if(h){i(a);return}a.lang??=l.lang,Object.assign(a.styles,l.styles),a.items.push(...l.items),n()},s)}let r=e.getReader(),a={items:[],styles:Object.create(null),lang:null};n()})}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:new Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(let i of e.renderTasks)t.push(i.completed),i.cancel();return this.objs.clear(),this.#e=!1,this.#s(),Promise.all(t)}cleanup(t=!1){this.#e=!0;let e=this.#i(!1);return t&&e&&(this._stats&&=new hi),e}#i(t=!1){if(this.#s(),!this.#e||this.destroyed)return!1;if(t)return this.#t=setTimeout(()=>{this.#t=null,this.#i(!1)},il),!1;for(let{renderTasks:e,operatorList:i}of this._intentStates.values())if(e.size>0||!i.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#e=!1,!0}#s(){this.#t&&(clearTimeout(this.#t),this.#t=null)}_startRenderPage(t,e){let i=this._intentStates.get(e);i&&(this._stats?.timeEnd("Page Request"),i.displayReadyCapability?.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]);e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots;for(let i of e.renderTasks)i.operatorListChanged();t.lastChunk&&this.#i(!0)}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:i,modifiedIds:s}){let{map:n,transfer:r}=i,l=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:n,modifiedIds:s},r).getReader(),h=this._intentStates.get(e);h.streamReader=l;let c=()=>{l.read().then(({value:d,done:u})=>{if(u){h.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(d,h),c())},d=>{if(h.streamReader=null,!this._transport.destroyed){if(h.operatorList){h.operatorList.lastChunk=!0;for(let u of h.renderTasks)u.operatorListChanged();this.#i(!0)}if(h.displayReadyCapability)h.displayReadyCapability.reject(d);else if(h.opListReadCapability)h.opListReadCapability.reject(d);else throw d}})};c()}_abortOperatorList({intentState:t,reason:e,force:i=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!i){if(t.renderTasks.size>0)return;if(e instanceof Le){let s=el;e.extraDelay>0&&e.extraDelay<1e3&&(s+=e.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},s);return}}if(t.streamReader.cancel(new Ft(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(let[s,n]of this._intentStates)if(n===t){this._intentStates.delete(s);break}this.cleanup()}}}get stats(){return this._stats}},fn=class{#t=new Map;#e=Promise.resolve();postMessage(t,e){let i={data:structuredClone(t,e?{transfer:e}:null)};this.#e.then(()=>{for(let[s]of this.#t)s.call(this,i)})}addEventListener(t,e,i=null){let s=null;if(i?.signal instanceof AbortSignal){let{signal:n}=i;if(n.aborted){N("LoopbackPort - cannot use an `aborted` signal.");return}let r=()=>this.removeEventListener(t,e);s=()=>n.removeEventListener("abort",r),n.addEventListener("abort",r)}this.#t.set(e,s)}removeEventListener(t,e){this.#t.get(e)?.(),this.#t.delete(e)}terminate(){for(let[,t]of this.#t)t?.();this.#t.clear()}},ji,Qt,Jt,ue,ai,fe,oi,X=class X{constructor({name:t=null,port:e=null,verbosity:i=Eo()}={}){zt(this,ue);if(this.name=t,this.destroyed=!1,this.verbosity=i,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,e){if(lt(X,Jt)?.has(e))throw new Error("Cannot use more than one PDFWorker per port.");(lt(X,Jt)||Ke(X,Jt,new WeakMap)).set(e,this),this._initializeFromPort(e);return}this._initialize()}get promise(){return ct?Promise.all([Pt.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 Yt("main","worker",t),this._messageHandler.on("ready",function(){}),Ye(this,ue,ai).call(this)}_initialize(){if(lt(X,Qt)||lt(X,fe,oi)){this._setupFakeWorker();return}let{workerSrc:t}=X;try{X._isSameOrigin(window.location.href,t)||(t=X._createCDNWrapper(new URL(t,window.location).href));let e=new Worker(t,{type:"module"}),i=new Yt("main","worker",e),s=()=>{n.abort(),i.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},n=new AbortController;e.addEventListener("error",()=>{this._webWorker||s()},{signal:n.signal}),i.on("test",a=>{if(n.abort(),this.destroyed||!a){s();return}this._messageHandler=i,this._port=e,this._webWorker=e,Ye(this,ue,ai).call(this)}),i.on("ready",a=>{if(n.abort(),this.destroyed){s();return}try{r()}catch{this._setupFakeWorker()}});let r=()=>{let a=new Uint8Array;i.send("test",a,[a.buffer])};r();return}catch{Wi("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){lt(X,Qt)||(N("Setting up fake worker."),Ke(X,Qt,!0)),X._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}let e=new fn;this._port=e;let i=`fake${$r(X,ji)._++}`,s=new Yt(i+"_worker",i,e);t.setup(s,e),this._messageHandler=new Yt(i,i+"_worker",e),Ye(this,ue,ai).call(this)}).catch(t=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),lt(X,Jt)?.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){if(!t?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");let e=lt(this,Jt)?.get(t.port);
2if(e){if(e._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new X(t)}static get workerSrc(){if(Zt.workerSrc)return Zt.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return B(this,"_setupFakeWorkerGlobal",C(this,null,function*(){return lt(this,fe,oi)?lt(this,fe,oi):(yield import(this.workerSrc)).WorkerMessageHandler}))}};ji=new WeakMap,Qt=new WeakMap,Jt=new WeakMap,ue=new WeakSet,ai=function(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})},fe=new WeakSet,oi=function(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}},zt(X,fe),zt(X,ji,0),zt(X,Qt,!1),zt(X,Jt),ct&&(Ke(X,Qt,!0),Zt.workerSrc||="./pdf.worker.mjs"),X._isSameOrigin=(t,e)=>{let i;try{if(i=new URL(t),!i.origin||i.origin==="null")return!1}catch{return!1}let s=new URL(e,i);return i.origin===s.origin},X._createCDNWrapper=t=>{let e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};var de=X,pn=class{#t=new Map;#e=new Map;#i=new Map;#s=new Map;#r=null;constructor(t,e,i,s,n){this.messageHandler=t,this.loadingTask=e,this.commonObjs=new Ci,this.fontLoader=new Rs({ownerDocument:s.ownerDocument,styleElement:s.styleElement}),this.loadingParams=s.loadingParams,this._params=s,this.canvasFactory=n.canvasFactory,this.filterFactory=n.filterFactory,this.cMapReaderFactory=n.cMapReaderFactory,this.standardFontDataFactory=n.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}#n(t,e=null){let i=this.#t.get(t);if(i)return i;let s=this.messageHandler.sendWithPromise(t,e);return this.#t.set(t,s),s}get annotationStorage(){return B(this,"annotationStorage",new Ie)}getRenderingIntent(t,e=Ut.ENABLE,i=null,s=!1,n=!1){let r=mt.DISPLAY,a=Is;switch(t){case"any":r=mt.ANY;break;case"display":break;case"print":r=mt.PRINT;break;default:N(`getRenderingIntent - invalid intent: ${t}`)}let l=r&mt.PRINT&&i instanceof fi?i:this.annotationStorage;switch(e){case Ut.DISABLE:r+=mt.ANNOTATIONS_DISABLE;break;case Ut.ENABLE:break;case Ut.ENABLE_FORMS:r+=mt.ANNOTATIONS_FORMS;break;case Ut.ENABLE_STORAGE:r+=mt.ANNOTATIONS_STORAGE,a=l.serializable;break;default:N(`getRenderingIntent - invalid annotationMode: ${e}`)}s&&(r+=mt.IS_EDITING),n&&(r+=mt.OPLIST);let{ids:h,hash:c}=l.modifiedIds,d=[r,a.hash,c];return{renderingIntent:r,cacheKey:d.join("_"),annotationStorageSerializable:a,modifiedIds:h}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#r?.reject(new Error("Worker was destroyed during onPassword callback"));let t=[];for(let i of this.#e.values())t.push(i._destroy());this.#e.clear(),this.#i.clear(),this.#s.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();let e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#t.clear(),this.filterFactory.destroy(),Oe.cleanup(),this._networkStream?.cancelAllRequests(new Ft("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",(i,s)=>{rt(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=n=>{this._lastProgress={loaded:n.loaded,total:n.total}},s.onPull=()=>{this._fullReader.read().then(function({value:n,done:r}){if(r){s.close();return}rt(n instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(n),1,[n])}).catch(n=>{s.error(n)})},s.onCancel=n=>{this._fullReader.cancel(n),s.ready.catch(r=>{if(!this.destroyed)throw r})}}),t.on("ReaderHeadersReady",i=>C(this,null,function*(){yield this._fullReader.headersReady;let{isStreamingSupported:s,isRangeSupported:n,contentLength:r}=this._fullReader;return(!s||!n)&&(this._lastProgress&&e.onProgress?.(this._lastProgress),this._fullReader.onProgress=a=>{e.onProgress?.({loaded:a.loaded,total:a.total})}),{isStreamingSupported:s,isRangeSupported:n,contentLength:r}})),t.on("GetRangeReader",(i,s)=>{rt(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");let n=this._networkStream.getRangeReader(i.begin,i.end);if(!n){s.close();return}s.onPull=()=>{n.read().then(function({value:r,done:a}){if(a){s.close();return}rt(r instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),s.enqueue(new Uint8Array(r),1,[r])}).catch(r=>{s.error(r)})},s.onCancel=r=>{n.cancel(r),s.ready.catch(a=>{if(!this.destroyed)throw a})}}),t.on("GetDoc",({pdfInfo:i})=>{this._numPages=i.numPages,this._htmlForXfa=i.htmlForXfa,delete i.htmlForXfa,e._capability.resolve(new dn(i,this))}),t.on("DocException",function(i){let s;switch(i.name){case"PasswordException":s=new Se(i.message,i.code);break;case"InvalidPDFException":s=new li(i.message);break;case"MissingPDFException":s=new Nt(i.message);break;case"UnexpectedResponseException":s=new pe(i.message,i.status);break;
2case"UnknownErrorException":s=new Pe(i.message,i.details);break;default:U("DocException - expected a valid Error.")}e._capability.reject(s)}),t.on("PasswordRequest",i=>{if(this.#r=Promise.withResolvers(),e.onPassword){let s=n=>{n instanceof Error?this.#r.reject(n):this.#r.resolve({password:n})};try{e.onPassword(s,i.code)}catch(n){this.#r.reject(n)}}else this.#r.reject(new Se(i.message,i.code));return this.#r.promise}),t.on("DataLoaded",i=>{e.onProgress?.({loaded:i.length,total:i.length}),this.downloadInfoCapability.resolve(i)}),t.on("StartRenderPage",i=>{if(this.destroyed)return;this.#e.get(i.pageIndex)._startRenderPage(i.transparency,i.cacheKey)}),t.on("commonobj",([i,s,n])=>{if(this.destroyed||this.commonObjs.has(i))return null;switch(s){case"Font":let{disableFontFace:r,fontExtraProperties:a,pdfBug:l}=this._params;if("error"in n){let u=n.error;N(`Error during font loading: ${u}`),this.commonObjs.resolve(i,u);break}let h=l&&globalThis.FontInspector?.enabled?(u,f)=>globalThis.FontInspector.fontAdded(u,f):null,c=new Os(n,{disableFontFace:r,inspectFont:h});this.fontLoader.bind(c).catch(()=>t.sendWithPromise("FontFallback",{id:i})).finally(()=>{!a&&c.data&&(c.data=null),this.commonObjs.resolve(i,c)});break;case"CopyLocalImage":let{imageRef:d}=n;rt(d,"The imageRef must be defined.");for(let u of this.#e.values())for(let[,f]of u.objs)if(f?.ref===d)return f.dataLen?(this.commonObjs.resolve(i,structuredClone(f)),f.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(i,n);break;default:throw new Error(`Got unknown common object type ${s}`)}return null}),t.on("obj",([i,s,n,r])=>{if(this.destroyed)return;let a=this.#e.get(s);if(!a.objs.has(i)){if(a._intentStates.size===0){r?.bitmap?.close();return}switch(n){case"Image":a.objs.resolve(i,r),r?.dataLen>bo&&(a._maybeCleanupAfterRender=!0);break;case"Pattern":a.objs.resolve(i,r);break;default:throw new Error(`Got unknown object type ${n}`)}}}),t.on("DocProgress",i=>{this.destroyed||e.onProgress?.({loaded:i.loaded,total:i.total})}),t.on("FetchBuiltInCMap",i=>C(this,null,function*(){if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.cMapReaderFactory)throw new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");return this.cMapReaderFactory.fetch(i)})),t.on("FetchStandardFontData",i=>C(this,null,function*(){if(this.destroyed)throw new Error("Worker was destroyed.");if(!this.standardFontDataFactory)throw new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");return this.standardFontDataFactory.fetch(i)}))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&N("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:t,transfer:e}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:this._fullReader?.filename??null},e).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(new Error("Invalid page request."));let e=t-1,i=this.#i.get(e);if(i)return i;let s=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(n=>{if(this.destroyed)throw new Error("Transport destroyed");n.refStr&&this.#s.set(n.refStr,t);let r=new un(e,n,this,this._params.pdfBug);return this.#e.set(e,r),r});return this.#i.set(e,s),s}getPageIndex(t){return ya(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getFieldObjects(){return this.#n("GetFieldObjects")}hasJSActions(){return this.#n("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return typeof t!="string"?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithProm
2ise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return this.#n("GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return this.#n("GetOptionalContentConfig").then(e=>new qs(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){let t="GetMetadata",e=this.#t.get(t);if(e)return e;let i=this.messageHandler.sendWithPromise(t,null).then(s=>({info:s[0],metadata:s[1]?new Gs(s[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#t.set(t,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}startCleanup(t=!1){return C(this,null,function*(){if(!this.destroyed){yield this.messageHandler.sendWithPromise("Cleanup",null);for(let e of this.#e.values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),this.#t.clear(),this.filterFactory.destroy(!0),Oe.cleanup()}})}cachedPageNumber(t){if(!ya(t))return null;let e=t.gen===0?`${t.num}R`:`${t.num}R${t.gen}`;return this.#s.get(e)??null}},ti=Symbol("INITIAL_DATA"),Ci=class{#t=Object.create(null);#e(t){return this.#t[t]||=vt(G({},Promise.withResolvers()),{data:ti})}get(t,e=null){if(e){let s=this.#e(t);return s.promise.then(()=>e(s.data)),null}let i=this.#t[t];if(!i||i.data===ti)throw new Error(`Requesting object that isn't resolved yet ${t}.`);return i.data}has(t){let e=this.#t[t];return!!e&&e.data!==ti}resolve(t,e=null){let i=this.#e(t);i.data=e,i.resolve()}clear(){for(let t in this.#t){let{data:e}=this.#t[t];e?.bitmap?.close()}this.#t=Object.create(null)}*[Symbol.iterator](){for(let t in this.#t){let{data:e}=this.#t[t];e!==ti&&(yield[t,e])}}},gn=class{#t=null;constructor(t){this.#t=t,this.onContinue=null}get promise(){return this.#t.capability.promise}cancel(t=0){this.#t.cancel(null,t)}get separateAnnots(){let{separateAnnots:t}=this.#t.operatorList;if(!t)return!1;let{annotationCanvasMap:e}=this.#t;return t.form||t.canvas&&e?.size>0}},mn=class o{#t=null;static#e=new WeakSet;constructor({callback:t,params:e,objs:i,commonObjs:s,annotationCanvasMap:n,operatorList:r,pageIndex:a,canvasFactory:l,filterFactory:h,useRequestAnimationFrame:c=!1,pdfBug:d=!1,pageColors:u=null}){this.callback=t,this.params=e,this.objs=i,this.commonObjs=s,this.annotationCanvasMap=n,this.operatorListIdx=null,this.operatorList=r,this._pageIndex=a,this.canvasFactory=l,this.filterFactory=h,this._pdfBug=d,this.pageColors=u,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=c===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new gn(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=e.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){if(this.cancelled)return;if(this._canvas){if(o.#e.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");o.#e.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());let{canvasContext:i,viewport:s,transform:n,background:r}=this.params;this.gfx=new ce(i,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:n,viewport:s,transparency:t,background:r}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(t=null,e=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#t&&(window.cancelAnimationFrame(this.#t),this.#t=null),o.#e.delete(this._canvas),this.callback(t||new Le(`Rendering cancelled, page ${this._pageIndex+1}`,e))}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}this.stepper?.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?this.#t=window.requestAnimationFrame(()=>{this.#t=null,this._nextBound().catch(this._cancelBound)}
2):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}_next(){return C(this,null,function*(){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(),o.#e.delete(this._canvas),this.callback())))})}},cl="4.8.69",dl="3634dab10";function va(o){return Math.floor(Math.max(0,Math.min(1,o))*255).toString(16).padStart(2,"0")}function Ee(o){return Math.max(0,Math.min(255,255*o))}var Si=class{static CMYK_G([t,e,i,s]){return["G",1-Math.min(1,.3*t+.59*i+.11*e+s)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return t=Ee(t),[t,t,t]}static G_HTML([t]){let e=va(t);return`#${e}${e}${e}`}static RGB_G([t,e,i]){return["G",.3*t+.59*e+.11*i]}static RGB_rgb(t){return t.map(Ee)}static RGB_HTML(t){return`#${t.map(va).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,i,s]){return["RGB",1-Math.min(1,t+s),1-Math.min(1,i+s),1-Math.min(1,e+s)]}static CMYK_rgb([t,e,i,s]){return[Ee(1-Math.min(1,t+s)),Ee(1-Math.min(1,i+s)),Ee(1-Math.min(1,e+s))]}static CMYK_HTML(t){let e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,i]){let s=1-t,n=1-e,r=1-i,a=Math.min(s,n,r);return["CMYK",s,n,r,a]}},bn=class{create(t,e,i=!1){if(t<=0||e<=0)throw new Error("Invalid SVG dimensions");let s=this._createSVG("svg:svg");return s.setAttribute("version","1.1"),i||(s.setAttribute("width",`${t}px`),s.setAttribute("height",`${e}px`)),s.setAttribute("preserveAspectRatio","none"),s.setAttribute("viewBox",`0 0 ${t} ${e}`),s}createElement(t){if(typeof t!="string")throw new Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){U("Abstract method `_createSVG` called.")}},Ne=class extends bn{_createSVG(t){return document.createElementNS(Ot,t)}},Pi=class{static setupStorage(t,e,i,s,n){let r=s.getValue(e,{value:null});switch(i.name){case"textarea":if(r.value!==null&&(t.textContent=r.value),n==="print")break;t.addEventListener("input",a=>{s.setValue(e,{value:a.target.value})});break;case"input":if(i.attributes.type==="radio"||i.attributes.type==="checkbox"){if(r.value===i.attributes.xfaOn?t.setAttribute("checked",!0):r.value===i.attributes.xfaOff&&t.removeAttribute("checked"),n==="print")break;t.addEventListener("change",a=>{s.setValue(e,{value:a.target.checked?a.target.getAttribute("xfaOn"):a.target.getAttribute("xfaOff")})})}else{if(r.value!==null&&t.setAttribute("value",r.value),n==="print")break;t.addEventListener("input",a=>{s.setValue(e,{value:a.target.value})})}break;case"select":if(r.value!==null){t.setAttribute("value",r.value);for(let a of i.children)a.attributes.value===r.value?a.attributes.selected=!0:a.attributes.hasOwnProperty("selected")&&delete a.attributes.selected}t.addEventListener("input",a=>{let l=a.target.options,h=l.selectedIndex===-1?"":l[l.selectedIndex].value;s.setValue(e,{value:h})});break}}static setAttributes({html:t,element:e,storage:i=null,intent:s,linkService:n}){let{attributes:r}=e,a=t instanceof HTMLAnchorElement;r.type==="radio"&&(r.name=`${r.name}-${s}`);for(let[l,h]of Object.entries(r))if(h!=null)switch(l){case"class":h.length&&t.setAttribute(l,h.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",h);break;case"style":Object.assign(t.style,h);break;case"textContent":t.textContent=h;break;default:(!a||l!=="href"&&l!=="newWindow")&&t.setAttribute(l,h)}a&&n.addLinkAttributes(t,r.href,r.newWindow),i&&r.dataId&&this.setupStorage(t,r.dataId,e,i)}static render(t){let e=t.annotationStorage,i=t.linkService,s=t.xfaHtml,n=t.intent||"display",r=document.createElement(s.name);s.attributes&&this.setAttributes({html:r,element:s,intent:n,linkService:i});let a=n!=="richText",l=t.div;if(l.append(r),t.viewport){let d=`matrix(${t.viewport.transform.join(",")})`;l.style.transform=d}a&&l.setAttribute("class","xfaLayer xfaFont");let h=[];if(s.children.length===0){if(s.value){let d=document.createTextNode(s.value);r.append(d),a&&De.shouldBuildText(s.name)&&h.push(d)}return{textDivs:h}}let c=[[s,-1,r]];for(;c.length>0;){let[d,u,f]=c.at(-1);if(u+1===d.children.length){c.pop();continue}let p=d.children[++c.at(-1)[1]];if(p===null)continue;let{name:g}=p;if(g==="#text"){let m=document.createTextNode(p.value);h.push(m),f.append(m);continue}let b=p?.attributes?.xmlns?document.createElementNS(p.attributes.xmlns,g):document.createElement(g);if(f.append(b),p.attributes&&this.setAttributes({html:b,element:p,storage:e,intent:n,linkService:i}),p.children?.length>0)c.push([p,-1,b]);else if(p.value){let m=document.createTextNode(p.value);a&&De.shouldBuildText(g)&&h.push(m),b.append(m)}}for(let d of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))d.setAttribute("readOnly",!0);return{textDivs:h}}static update(t){let e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}},je=1e3,ul=9,ie=new WeakSet;function Dt(o){return{width:o[2]-o[0],height:o[3]-o[1]}}var An=class{static create(t){switch(t.data.annotationType){case nt.LINK:return new Ti(t);case nt.TEXT:return new _n(t);case nt.WIDGET:switch(t.data.fieldType){case"Tx":return new wn(t);case"Btn":return t.data.radioButton?new Li(t):t.data.checkBox?new vn(t):new En(t);case"Ch":return new xn(t);case"Sig":return new yn(t)}return new Bt(t);case nt.POPUP:return new Fe(t);case nt.FREETEXT:return new Mi(t);case nt.LINE:return new Sn(t);case nt.SQUARE:return new Pn(t);case nt.CIRCLE:return new Tn(t);case nt.POLYLINE:return new ki(t);case nt.CARET:return new Mn(t);case nt.INK:return new Be(t);case nt.POLYGON:return new Ln(t);case nt.HIGHLIGHT:return new Ii(t);case nt.UNDERLINE:return new kn(t);case nt.SQUIGGLY:return new In(t);case nt.STRIKEOUT:return new Rn(t);case nt.STAMP:return new Ri(t);case nt.FILEATTACHMENT:return new On(t);default:return new et(t)}}},et=class o{#t=null;#e=!1;#i=null;constructor(t,{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:s=!1}={}){this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,e&&(this.container=this._createContainer(i)),s&&this._createQuadrilaterals()}static _hasPopupData({titleObj:t,contentsObj:e,richText:i}){return!!(t?.str||e?.str||i?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return o._hasPopupData(this.data)}updateEdited(t){if(!this.container)return;this.#t||={rect:this.data.rect.slice(0)};let{rect:e}=t;e&&this.#s(e),this.#i?.popup.updateEdited(t)}resetEdited(){this.#t&&(this.#s(this.#t.rect),this.#i?.popup.resetEdited(),this.#t=null)}#s(t){let{container:{style:e},data:{rect:i,rotation:s},parent:{viewport:{rawDims:{pageWidth:n,pageHeight:r,pageX:a,pageY:l}}}}=this;i?.splice(0,4,...t);let{width:h,height:c}=Dt(t);e.left=`${100*(t[0]-a)/n}
2%`,e.top=`${100*(r-t[3]+l)/r}%`,s===0?(e.width=`${100*h/n}%`,e.height=`${100*c/r}%`):this.setRotation(s)}_createContainer(t){let{data:e,parent:{page:i,viewport:s}}=this,n=document.createElement("section");n.setAttribute("data-annotation-id",e.id),this instanceof Bt||(n.tabIndex=je);let{style:r}=n;if(r.zIndex=this.parent.zIndex++,e.alternativeText&&(n.title=e.alternativeText),e.noRotate&&n.classList.add("norotate"),!e.rect||this instanceof Fe){let{rotation:g}=e;return!e.hasOwnCanvas&&g!==0&&this.setRotation(g,n),n}let{width:a,height:l}=Dt(e.rect);if(!t&&e.borderStyle.width>0){r.borderWidth=`${e.borderStyle.width}px`;let g=e.borderStyle.horizontalCornerRadius,b=e.borderStyle.verticalCornerRadius;if(g>0||b>0){let w=`calc(${g}px * var(--scale-factor)) / calc(${b}px * var(--scale-factor))`;r.borderRadius=w}else if(this instanceof Li){let w=`calc(${a}px * var(--scale-factor)) / calc(${l}px * var(--scale-factor))`;r.borderRadius=w}switch(e.borderStyle.style){case ye.SOLID:r.borderStyle="solid";break;case ye.DASHED:r.borderStyle="dashed";break;case ye.BEVELED:N("Unimplemented border style: beveled");break;case ye.INSET:N("Unimplemented border style: inset");break;case ye.UNDERLINE:r.borderBottomStyle="solid";break;default:break}let m=e.borderColor||null;m?(this.#e=!0,r.borderColor=M.makeHexColor(m[0]|0,m[1]|0,m[2]|0)):r.borderWidth=0}let h=M.normalizeRect([e.rect[0],i.view[3]-e.rect[1]+i.view[1],e.rect[2],i.view[3]-e.rect[3]+i.view[1]]),{pageWidth:c,pageHeight:d,pageX:u,pageY:f}=s.rawDims;r.left=`${100*(h[0]-u)/c}%`,r.top=`${100*(h[1]-f)/d}%`;let{rotation:p}=e;return e.hasOwnCanvas||p===0?(r.width=`${100*a/c}%`,r.height=`${100*l/d}%`):this.setRotation(p,n),n}setRotation(t,e=this.container){if(!this.data.rect)return;let{pageWidth:i,pageHeight:s}=this.parent.viewport.rawDims,{width:n,height:r}=Dt(this.data.rect),a,l;t%180===0?(a=100*n/i,l=100*r/s):(a=100*r/i,l=100*n/s),e.style.width=`${a}%`,e.style.height=`${l}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){let t=(e,i,s)=>{let n=s.detail[e],r=n[0],a=n.slice(1);s.target.style[i]=Si[`${r}_HTML`](a),this.annotationStorage.setValue(this.data.id,{[i]:Si[`${r}_rgb`](a)})};return B(this,"_commonActions",{display:e=>{let{display:i}=e.detail,s=i%2===1;this.container.style.visibility=s?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:s,noPrint:i===1||i===2})},print:e=>{this.annotationStorage.setValue(this.data.id,{noPrint:!e.detail.print})},hidden:e=>{let{hidden:i}=e.detail;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:i,noView:i})},focus:e=>{setTimeout(()=>e.target.focus({preventScroll:!1}),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.target.disabled=e.detail.readonly},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:e=>{let i=e.detail.rotation;this.setRotation(i),this.annotationStorage.setValue(this.data.id,{rotation:i})}})}_dispatchEventFromSandbox(t,e){let i=this._commonActions;for(let s of Object.keys(e.detail))(t[s]||i[s])?.(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,n]of Object.entries(e)){let r=i[s];if(r){let a={detail:{[s]:n},target:t};r(a),delete e[s]}}}
2_createQuadrilaterals(){if(!this.container)return;let{quadPoints:t}=this.data;if(!t)return;let[e,i,s,n]=this.data.rect.map(g=>Math.fround(g));if(t.length===8){let[g,b,m,w]=t.subarray(2,6);if(s===g&&n===b&&e===m&&i===w)return}let{style:r}=this.container,a;if(this.#e){let{borderColor:g,borderWidth:b}=r;r.borderWidth=0,a=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${g}" stroke-width="${b}">`],this.container.classList.add("hasBorder")}let l=s-e,h=n-i,{svgFactory:c}=this,d=c.createElement("svg");d.classList.add("quadrilateralsContainer"),d.setAttribute("width",0),d.setAttribute("height",0);let u=c.createElement("defs");d.append(u);let f=c.createElement("clipPath"),p=`clippath_${this.data.id}`;f.setAttribute("id",p),f.setAttribute("clipPathUnits","objectBoundingBox"),u.append(f);for(let g=2,b=t.length;g<b;g+=8){let m=t[g],w=t[g+1],y=t[g+2],A=t[g+3],v=c.createElement("rect"),S=(y-e)/l,P=(n-w)/h,T=(m-y)/l,_=(w-A)/h;v.setAttribute("x",S),v.setAttribute("y",P),v.setAttribute("width",T),v.setAttribute("height",_),f.append(v),a?.push(`<rect vector-effect="non-scaling-stroke" x="${S}" y="${P}" width="${T}" height="${_}"/>`)}this.#e&&(a.push("</g></svg>')"),r.backgroundImage=a.join("")),this.container.append(d),this.container.style.clipPath=`url(#${p})`}_createPopup(){let{data:t}=this,e=this.#i=new Fe({data:{color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,richText:t.richText,parentRect:t.rect,borderStyle:0,id:`popup_${t.id}`,rotation:t.rotation},parent:this.parent,elements:[this]});this.parent.div.append(e.render())}render(){U("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){let i=[];if(this._fieldObjects){let s=this._fieldObjects[t];if(s)for(let{page:n,id:r,exportValues:a}of s){if(n===-1||r===e)continue;let l=typeof a=="string"?a:null,h=document.querySelector(`[data-element-id="${r}"]`);if(h&&!ie.has(h)){N(`_getElementsByName - element not allowed: ${r}`);continue}i.push({id:r,exportValue:l,domElement:h})}return i}for(let s of document.getElementsByName(t)){let{exportValue:n}=s,r=s.getAttribute("data-element-id");r!==e&&ie.has(s)&&i.push({id:r,exportValue:n,domElement:s})}return i}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){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",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e})})}},Ti=class extends et{constructor(t,e=null){super(t,{isRenderable:!0,ignoreBorder:!!e?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=t.data.isTooltipOnly}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?(this.#e(i,t.attachment,t.attachmentDest),s=!0):t.setOCGState?(this.#i(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("linkAnnotation"),s&&this.container.append(i),this.container}#t(){this.container.setAttribute("data-internal-link","")}_bindLink(t,e){t.href=this.linkService.getDestinationHash(e),t.onclick=()=>(e&&this.linkService.goToDestination(e),!1),(e||e==="")&&this.#t()}_bindNamedAction(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),this.#t()}#e(t,e,i=null){t.href=this.linkService.getAnchorUrl(""),e.description&&(t.title=e.description),t.onclick=()=>(this.downloadManager?.openOrDownloadData(e.content,e.filename,i),!1),this.#t()}#i(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),this.#t()}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");let i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(let s of Object.keys(e.actions)){let n=i.get(s);n&&(t[n]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:s}}),!1))}t.onclick||(t.onclick=()=>!1),this.#t()}_bindResetFormAction(t,e){let i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),this.#t(),!this._fieldObjects){N('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(t.onclick=()=>!1);return}t.onclick=()=>{i?.();let{fields:s,refs:n,include:r}=e,a=[];if(s.length!==0||n.length!==0){let c=new Set(n);for(let d of s){let u=this._fieldObjects[d]||[];for(let{id:f}of u)c.add(f)}for(let d of Object.values(this._fieldObjects))for(let u of d)c.has(u.id)===r&&a.push(u)}else for(let c of Object.values(this._fieldObjects))a.push(...c);let l=this.annotationStorage,h=[];for(let c of a){let{id:d}=c;switch(h.push(d),c.type){case"text":{let f=c.defaultValue||"";l.setValue(d,{value:f});break}case"checkbox":case"radiobutton":{let f=c.defaultValue===c.exportValues;l.setValue(d,{value:f});break}case"combobox":case"listbox":{let f=c.defaultValue||"";l.setValue(d,{value:f});break}default:continue}let u=document.querySelector(`[data-element-id="${d}"]`);if(u){if(!ie.has(u)){N(`_bindResetFormAction - element not allowed: ${d}`);continue}}else continue;u.dispatchEvent(new Event("resetform"))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:h,name:"ResetForm"}}),!1}}},_n=class extends et{constructor(t){super(t,{isRenderable:!0})}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}}
2,Bt=class extends et{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&(t.previousSibling?.nodeName==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return ot.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,i,s,n){i.includes("mouse")?t.addEventListener(i,r=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:n(r),shift:r.shiftKey,modifier:this._getKeyModifier(r)}})}):t.addEventListener(i,r=>{if(i==="blur"){if(!e.focused||!r.relatedTarget)return;e.focused=!1}else if(i==="focus"){if(e.focused)return;e.focused=!0}n&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:n(r)}})})}_setEventListeners(t,e,i,s){for(let[n,r]of i)(r==="Action"||this.data.actions?.[r])&&((r==="Focus"||r==="Blur")&&(e||={focused:!1}),this._setEventListener(t,e,n,r,s),r==="Focus"&&!this.data.actions?.Blur?this._setEventListener(t,e,"blur","Blur",null):r==="Blur"&&!this.data.actions?.Focus&&this._setEventListener(t,e,"focus","Focus",null))}_setBackgroundColor(t){let e=this.data.backgroundColor||null;t.style.backgroundColor=e===null?"transparent":M.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){let e=["left","center","right"],{fontColor:i}=this.data.defaultAppearanceData,s=this.data.defaultAppearanceData.fontSize||ul,n=t.style,r,a=2,l=h=>Math.round(10*h)/10;if(this.data.multiLine){let h=Math.abs(this.data.rect[3]-this.data.rect[1]-a),c=Math.round(h/(ii*s))||1,d=h/c;r=Math.min(s,l(d/ii))}else{let h=Math.abs(this.data.rect[3]-this.data.rect[1]-a);r=Math.min(s,l(h/ii))}n.fontSize=`calc(${r}px * var(--scale-factor))`,n.color=M.makeHexColor(i[0],i[1],i[2]),this.data.textAlignment!==null&&(n.textAlign=e[this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}},wn=class extends Bt{constructor(t){let e=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:e})}setPropertyOnSiblings(t,e,i,s){let n=this.annotationStorage;
vendor: 3,691 bytes, lines 2-3
2for(let r of this._getElementsByName(t.name,t.id))r.domElement&&(r.domElement[e]=i),n.setValue(r.id,{[s]:i})}render(){let t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){let s=t.getValue(e,{value:this.data.fieldValue}),n=s.value||"",r=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;r&&n.length>r&&(n=n.slice(0,r));let a=s.formattedValue||this.data.textContent?.join(`
3`)||null;a&&this.data.comb&&(a=a.replaceAll(/\s+/g,""));let l={userValue:n,formattedValue:a,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(i=document.createElement("textarea"),i.textContent=a??n,this.data.doNotScroll&&(i.style.overflowY="hidden")):(i=document.createElement("input"),i.type="text",i.setAttribute("value",a??n),this.data.doNotScroll&&(i.style.overflowX="hidden")),this.data.hasOwnCanvas&&(i.hidden=!0),ie.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=je,this._setRequired(i,this.data.required),r&&(i.maxLength=r),i.addEventListener("input",c=>{t.setValue(e,{value:c.target.value}),this.setPropertyOnSiblings(i,"value",c.target.value,"value"),l.formattedValue=null}),i.addEventListener("resetform",c=>{let d=this.data.defaultFieldValue??"";i.value=l.userValue=d,l.formattedValue=null});let h=c=>{let{formattedValue:d}=l;d!=null&&(c.target.value=d),c.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",d=>{if(l.focused)return;let{target:u}=d;l.userValue&&(u.value=l.userValue),l.lastCommittedValue=u.value,l.commitKey=1,this.data.actions?.Focus||(l.focused=!0)}),i.addEventListener("updatefromsandbox",d=>{this.showElementAndHideCanvas(d.target);let u={value(f){l.userValue=f.detail.value??"",t.setValue(e,{value:l.userValue.toString()}),f.target.value=l.userValue},formattedValue(f){let{formattedValue:p}=f.detail;l.formattedValue=p,p!=null&&f.target!==document.activeElement&&(f.target.value=p),t.setValue(e,{formattedValue:p})},selRange(f){f.target.setSelectionRange(...f.detail.selRange)},charLimit:f=>{let{charLimit:p}=f.detail,{target:g}=f;if(p===0){g.removeAttribute("maxLength");return}g.setAttribute("maxLength",p);let b=l.userValue;!b||b.length<=p||(b=b.slice(0,p),g.value=l.userValue=b,t.setValue(e,{value:b}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:b,willCommit:!0,commitKey:1,selStart:g.selectionStart,selEnd:g.selectionEnd}}))}};this._dispatchEventFromSandbox(u,d)}),i.addEventListener("keydown",d=>{l.commitKey=1;let u=-1;if(d.key==="Escape"?u=0:d.key==="Enter"&&!this.data.multiLine?u=2:d.key==="Tab"&&(l.commitKey=3),u===-1)return;let{value:f}=d.target;l.lastCommittedValue!==f&&(l.lastCommittedValue=f,l.userValue=f,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:f,willCommit:!0,commitKey:u,selStart:d.target.selectionStart,selEnd:d.target.selectionEnd}}))});let c=h;h=null,i.addEventListener("blur",d=>{if(!l.focused||!d.relatedTarget)return;this.data.actions?.Blur||(l.focused=!1);let{value:u}=d.target;l.userValue=u,l.lastCommittedValue!==u&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:u,willCommit:!0,commitKey:l.commitKey,selStart:d.target.selectionStart,selEnd:d.target.selectionEnd}}),c(d)}),this.data.actions?.Keystroke&&i.addEventListener("beforeinput",d=>{l.lastCommittedValue=null;let{data:u,target:f}=d,{value:p,selectionStart:g,selectionEnd:b}=f,m=g,w=b;switch(d.inputType){case"deleteWordBackward":{let y=p.substring(0,g).match(/\w*[^\w]*$/);y&&(m-=y[0].length);break}
3case"deleteWordForward":{let y=p.substring(g).match(/^[^\w]*\w*/);y&&(w+=y[0].length);break}case"deleteContentBackward":g===b&&(m-=1);break;case"deleteContentForward":g===b&&(w+=1);break}d.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:p,change:u||"",willCommit:!1,selStart:m,selEnd:w}})}),this._setEventListeners(i,l,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],d=>d.target.value)}if(h&&i.addEventListener("blur",h),this.data.comb){let d=(this.data.rect[2]-this.data.rect[0])/r;i.classList.add("comb"),i.style.letterSpacing=`calc(${d}px * var(--scale-factor) - 1ch)`}}else i=document.createElement("div"),i.textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell",this.data.hasOwnCanvas&&(i.hidden=!0);return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}},yn=class extends Bt{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}},vn=class extends Bt{constructor(t){super(t,{isRenderable:t.renderForms})}render(){let t=this.annotationStorage,e=this.data,i=e.id,s=t.getValue(i,{value:e.exportValue===e.fieldValue}).value;typeof s=="string"&&(s=s!=="Off",t.setValue(i,{value:s})),this.container.classList.add("buttonWidgetAnnotation","checkBox");let n=document.createElement("input");return ie.add(n),n.setAttribute("data-element-id",i),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="checkbox",n.name=e.fieldName,s&&n.setAttribute("checked",!0),n.setAttribute("exportValue",e.exportValue),n.tabIndex=je,n.addEventListener("change",r=>{let{name:a,checked:l}=r.target;for(let h of this._getElementsByName(a,i)){let c=l&&h.exportValue===e.exportValue;h.domElement&&(h.domElement.checked=c),t.setValue(h.id,{value:c})}t.setValue(i,{value:l})}),n.addEventListener("resetform",r=>{let a=e.defaultFieldValue||"Off";r.target.checked=a===e.exportValue}),this.enableScripting&&this.hasJSActions&&(n.addEventListener("updatefromsandbox",r=>{let a={value(l){l.target.checked=l.detail.value!=="Off",t.setValue(i,{value:l.target.checked})}};this._dispatchEventFromSandbox(a,r)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],r=>r.target.checked)),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}},Li=class extends Bt{constructor(t){super(t,{isRenderable:t.renderForms})}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(typeof s=="string"&&(s=s!==e.buttonValue,t.setValue(i,{value:s})),s)for(let r of this._getElementsByName(e.fieldName,i))t.setValue(r.id,{value:!1});let n=document.createElement("input");if(ie.add(n),n.setAttribute("data-element-id",i),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="radio",n.name=e.fieldName,s&&n.setAttribute("checked",!0),n.tabIndex=je,n.addEventListener("change",r=>{let{name:a,checked:l}=r.target;for(let h of this._getElementsByName(a,i))t.setValue(h.id,{value:!1});t.setValue(i,{value:l})}),n.addEventListener("resetform",r=>{let a=e.defaultFieldValue;r.target.checked=a!=null&&a===e.buttonValue}),this.enableScripting&&this.hasJSActions){let r=e.buttonValue;n.addEventListener("updatefromsandbox",a=>{let l={value:h=>{let c=r===h.detail.value;for(let d of this._getElementsByName(h.target.name)){let u=c&&d.id===i;d.domElement&&(d.domElement.checked=u),t.setValue(d.id,{value:u})}}};this._dispatchEventFromSandbox(l,a)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],a=>a.target.checked)}
3return this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}},En=class extends Ti{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}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",i=>{this._dispatchEventFromSandbox({},i)})),t}},xn=class extends Bt{constructor(t){super(t,{isRenderable:t.renderForms})}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");ie.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=je;let n=this.data.combo&&this.data.options.length>0;this.data.combo||(s.size=this.data.options.length,this.data.multiSelect&&(s.multiple=!0)),s.addEventListener("resetform",c=>{let d=this.data.defaultFieldValue;for(let u of s.options)u.selected=u.value===d});for(let c of this.data.options){let d=document.createElement("option");d.textContent=c.displayValue,d.value=c.exportValue,i.value.includes(c.exportValue)&&(d.setAttribute("selected",!0),n=!1),s.append(d)}let r=null;if(n){let c=document.createElement("option");c.value=" ",c.setAttribute("hidden",!0),c.setAttribute("selected",!0),s.prepend(c),r=()=>{c.remove(),s.removeEventListener("input",r),r=null},s.addEventListener("input",r)}let a=c=>{let d=c?"value":"textContent",{options:u,multiple:f}=s;return f?Array.prototype.filter.call(u,p=>p.selected).map(p=>p[d]):u.selectedIndex===-1?null:u[u.selectedIndex][d]},l=a(!1),h=c=>{let d=c.target.options;return Array.prototype.map.call(d,u=>({displayValue:u.textContent,exportValue:u.value}))};return this.enableScripting&&this.hasJSActions?(s.addEventListener("updatefromsandbox",c=>{let d={value(u){r?.();let f=u.detail.value,p=new Set(Array.isArray(f)?f:[f]);for(let g of s.options)g.selected=p.has(g.value);t.setValue(e,{value:a(!0)}),l=a(!1)},multipleSelection(u){s.multiple=!0},remove(u){let f=s.options,p=u.detail.remove;f[p].selected=!1,s.remove(p),f.length>0&&Array.prototype.findIndex.call(f,b=>b.selected)===-1&&(f[0].selected=!0),t.setValue(e,{value:a(!0),items:h(u)}),l=a(!1)},clear(u){for(;s.length!==0;)s.remove(0);t.setValue(e,{value:null,items:[]}),l=a(!1)},insert(u){let{index:f,displayValue:p,exportValue:g}=u.detail.insert,b=s.children[f],m=document.createElement("option");m.textContent=p,m.value=g,b?b.before(m):s.append(m),t.setValue(e,{value:a(!0),items:h(u)}),l=a(!1)},items(u){let{items:f}=u.detail;for(;s.length!==0;)s.remove(0);for(let p of f){let{displayValue:g,exportValue:b}=p,m=document.createElement("option");m.textContent=g,m.value=b,s.append(m)}s.options.length>0&&(s.options[0].selected=!0),t.setValue(e,{value:a(!0),items:h(u)}),l=a(!1)},indices(u){let f=new Set(u.detail.indices);for(let p of u.target.options)p.selected=f.has(p.index);t.setValue(e,{value:a(!0)}),l=a(!1)},editable(u){u.target.disabled=!u.detail.editable}};this._dispatchEventFromSandbox(d,c)}),s.addEventListener("input",c=>{let d=a(!0),u=a(!1);t.setValue(e,{value:d}),c.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:l,change:u,changeEx:d,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(s,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],c=>c.target.value)):s.addEventListener("input",function(c){t.setValue(e,{value:a(!0)})}),this.data.combo&&this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}},Fe=class extends et{constructor(t){let{data:e,elements:i}=t;super(t,{isRenderable:et._hasPopupData(e)}),this.elements=i,this.popup=null}render(){this.container.classList.add("popupAnnotation");let t=this.popup=new Cn({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(i=>`${Wn}${i}`).join(",")),this.container}}
3,Cn=class{#t=this.#M.bind(this);#e=this.#S.bind(this);#i=this.#T.bind(this);#s=this.#x.bind(this);#r=null;#n=null;#l=null;#h=null;#c=null;#o=null;#d=null;#a=!1;#u=null;#p=null;#f=null;#g=null;#b=null;#m=null;#A=!1;constructor({container:t,color:e,elements:i,titleObj:s,modificationDate:n,contentsObj:r,richText:a,parent:l,rect:h,parentRect:c,open:d}){this.#n=t,this.#b=s,this.#l=r,this.#g=a,this.#o=l,this.#r=e,this.#f=h,this.#d=c,this.#c=i,this.#h=ci.toDateObject(n),this.trigger=i.flatMap(u=>u.getElementsToTriggerPopup());for(let u of this.trigger)u.addEventListener("click",this.#s),u.addEventListener("mouseenter",this.#i),u.addEventListener("mouseleave",this.#e),u.classList.add("popupTriggerArea");for(let u of i)u.container?.addEventListener("keydown",this.#t);this.#n.hidden=!0,d&&this.#x()}render(){if(this.#u)return;let t=this.#u=document.createElement("div");if(t.className="popup",this.#r){let n=t.style.outlineColor=M.makeHexColor(...this.#r);CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?t.style.backgroundColor=`color-mix(in srgb, ${n} 30%, white)`:t.style.backgroundColor=M.makeHexColor(...this.#r.map(a=>Math.floor(.7*(255-a)+a)))}let e=document.createElement("span");e.className="header";let i=document.createElement("h1");if(e.append(i),{dir:i.dir,str:i.textContent}=this.#b,t.append(e),this.#h){let n=document.createElement("span");n.classList.add("popupDate"),n.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),n.setAttribute("data-l10n-args",JSON.stringify({dateObj:this.#h.valueOf()})),e.append(n)}let s=this.#w;if(s)Pi.render({xfaHtml:s,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{let n=this._formatContents(this.#l);t.append(n)}this.#n.append(t)}get#w(){let t=this.#g,e=this.#l;return t?.str&&(!e?.str||e.str===t.str)&&this.#g.html||null}get#E(){return this.#w?.attributes?.style?.fontSize||0}get#y(){return this.#w?.attributes?.style?.color||null}#v(t){let e=[],i={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},s={style:{color:this.#y,fontSize:this.#E?`calc(${this.#E}px * var(--scale-factor))`:""}};for(let n of t.split(`
4`))e.push({name:"span",value:n,attributes:s});return i}_formatContents({str:t,dir:e}){let i=document.createElement("p");i.classList.add("popupContent"),i.dir=e;let s=t.split(/(?:\r\n?|\n)/);for(let n=0,r=s.length;n<r;++n){let a=s[n];i.append(document.createTextNode(a)),n<r-1&&i.append(document.createElement("br"))}return i}#M(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||(t.key==="Enter"||t.key==="Escape"&&this.#a)&&this.#x()}updateEdited({rect:t,popupContent:e}){this.#m||={contentsObj:this.#l,richText:this.#g},t&&(this.#p=null),e&&(this.#g=this.#v(e),this.#l=null),this.#u?.remove(),this.#u=null}resetEdited(){this.#m&&({contentsObj:this.#l,richText:this.#g}=this.#m,this.#m=null,this.#u?.remove(),this.#u=null,this.#p=null)}#P(){if(this.#p!==null)return;let{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:s,pageY:n}}}=this.#o,r=!!this.#d,a=r?this.#d:this.#f;for(let p of this.#c)if(!a||M.intersect(p.data.rect,a)!==null){a=p.data.rect,r=!0;break}let l=M.normalizeRect([a[0],t[3]-a[1]+t[1],a[2],t[3]-a[3]+t[1]]),c=r?a[2]-a[0]+5:0,d=l[0]+c,u=l[1];this.#p=[100*(d-s)/e,100*(u-n)/i];let{style:f}=this.#n;f.left=`${this.#p[0]}%`,f.top=`${this.#p[1]}%`}#x(){this.#a=!this.#a,this.#a?(this.#T(),this.#n.addEventListener("click",this.#s),this.#n.addEventListener("keydown",this.#t)):(this.#S(),this.#n.removeEventListener("click",this.#s),this.#n.removeEventListener("keydown",this.#t))}#T(){this.#u||this.render(),this.isVisible?this.#a&&this.#n.classList.add("focused"):(this.#P(),this.#n.hidden=!1,this.#n.style.zIndex=parseInt(this.#n.style.zIndex)+1e3)}#S(){this.#n.classList.remove("focused"),!(this.#a||!this.isVisible)&&(this.#n.hidden=!0,this.#n.style.zIndex=parseInt(this.#n.style.zIndex)-1e3)}forceHide(){this.#A=this.isVisible,this.#A&&(this.#n.hidden=!0)}maybeShow(){this.#A&&(this.#u||this.#T(),this.#A=!1,this.#n.hidden=!1)}get isVisible(){return this.#n.hidden===!1}},Mi=class extends et{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=O.FREETEXT}
4render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){let t=document.createElement("div");t.classList.add("annotationTextContent"),t.setAttribute("role","comment");for(let e of 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}},Sn=class extends et{#t=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");let t=this.data,{width:e,height:i}=Dt(t.rect),s=this.svgFactory.create(e,i,!0),n=this.#t=this.svgFactory.createElement("svg:line");return n.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),n.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),n.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),n.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),n.setAttribute("stroke-width",t.borderStyle.width||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 this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}},Pn=class extends et{#t=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");let t=this.data,{width:e,height:i}=Dt(t.rect),s=this.svgFactory.create(e,i,!0),n=t.borderStyle.width,r=this.#t=this.svgFactory.createElement("svg:rect");return r.setAttribute("x",n/2),r.setAttribute("y",n/2),r.setAttribute("width",e-n),r.setAttribute("height",i-n),r.setAttribute("stroke-width",n||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),s.append(r),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}},Tn=class extends et{#t=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");let t=this.data,{width:e,height:i}=Dt(t.rect),s=this.svgFactory.create(e,i,!0),n=t.borderStyle.width,r=this.#t=this.svgFactory.createElement("svg:ellipse");return r.setAttribute("cx",e/2),r.setAttribute("cy",i/2),r.setAttribute("rx",e/2-n/2),r.setAttribute("ry",i/2-n/2),r.setAttribute("stroke-width",n||1),r.setAttribute("stroke","transparent"),r.setAttribute("fill","transparent"),s.append(r),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}},ki=class extends et{#t=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}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:n,height:r}=Dt(t),a=this.svgFactory.create(n,r,!0),l=[];for(let c=0,d=e.length;c<d;c+=2){let u=e[c]-t[0],f=t[3]-e[c+1];l.push(`${u},${f}`)}l=l.join(" ");let h=this.#t=this.svgFactory.createElement(this.svgElementName);return h.setAttribute("points",l),h.setAttribute("stroke-width",i.width||1),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),a.append(h),this.container.append(a),!s&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}},Ln=class extends ki{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}},Mn=class extends et{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}},Be=class extends et{#t=[];constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType=this.data.it==="InkHighlight"?O.HIGHLIGHT:O.INK}render(){this.container.classList.add(this.containerClassName);let{data:{rect:t,inkLists:e,borderStyle:i,popupRef:s}}=this,{width:n,height:r}=Dt(t),a=this.svgFactory.create(n,r,!0);for(let l of e){let h=[];for(let d=0,u=l.length;d<u;d+=2){let f=l[d]-t[0],p=t[3]-l[d+1];h.push(`${f},${p}`)}h=h.join(" ");let c=this.svgFactory.createElement(this.svgElementName);this.#t.push(c),c.setAttribute("points",h),c.setAttribute("stroke-width",i.width||1),c.setAttribute("stroke","transparent"),c.setAttribute("fill","transparent"),a.append(c)}return!s&&this.hasPopupData&&this._createPopup(),this.container.append(a),this._editOnDoubleClick(),this.container}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}},Ii=class extends et{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=O.HIGHLIGHT}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),this.container}}
4,kn=class extends et{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}},In=class extends et{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}},Rn=class extends et{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("strikeoutAnnotation"),this.container}},Ri=class extends et{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=O.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}},On=class extends et{#t=null;constructor(t){super(t,{isRenderable:!0});let{file:e}=this.data;this.filename=e.filename,this.content=e.content,this.linkService.eventBus?.dispatch("fileattachmentannotation",G({source:this},e))}render(){this.container.classList.add("fileAttachmentAnnotation");let{container:t,data:e}=this,i;e.hasAppearance||e.fillAlpha===0?i=document.createElement("div"):(i=document.createElement("img"),i.src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(e.name)?"paperclip":"pushpin"}.svg`,e.fillAlpha&&e.fillAlpha<1&&(i.style=`filter: opacity(${Math.round(e.fillAlpha*100)}%);`)),i.addEventListener("dblclick",this.#e.bind(this)),this.#t=i;let{isMac:s}=ot.platform;return t.addEventListener("keydown",n=>{n.key==="Enter"&&(s?n.metaKey:n.ctrlKey)&&this.#e()}),!e.popupRef&&this.hasPopupData?this._createPopup():i.classList.add("popupTriggerArea"),t.append(i),t}getElementsToTriggerPopup(){return this.#t}addHighlightArea(){this.container.classList.add("highlightArea")}#e(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}},Dn=class{#t=null;#e=null;#i=new Map;#s=null;constructor({div:t,accessibilityManager:e,annotationCanvasMap:i,annotationEditorUIManager:s,page:n,viewport:r,structTreeLayer:a}){this.div=t,this.#t=e,this.#e=i,this.#s=a||null,this.page=n,this.viewport=r,this.zIndex=0,this._annotationEditorUIManager=s}hasEditableAnnotations(){return this.#i.size>0}#r(t,e){return C(this,null,function*(){let i=t.firstChild||t,s=i.id=`${Wn}${e}`,n=yield this.#s?.getAriaAttributes(s);if(n)for(let[r,a]of n)i.setAttribute(r,a);this.div.append(t),this.#t?.moveElementInDOM(this.div,t,i,!1)})}render(t){return C(this,null,function*(){let{annotations:e}=t,i=this.div;te(i,this.viewport);let s=new Map,n={data:null,layer:i,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:t.renderForms!==!1,svgFactory:new Ne,annotationStorage:t.annotationStorage||new Ie,enableScripting:t.enableScripting===!0,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(let r of e){if(r.noHTML)continue;let a=r.annotationType===nt.POPUP;if(a){let c=s.get(r.id);if(!c)continue;n.elements=c}else{let{width:c,height:d}=Dt(r.rect);if(c<=0||d<=0)continue}n.data=r;let l=An.create(n);if(!l.isRenderable)continue;if(!a&&r.popupRef){let c=s.get(r.popupRef);c?c.push(l):s.set(r.popupRef,[l])}let h=l.render();r.hidden&&(h.style.visibility="hidden"),yield this.#r(h,r.id),l._isEditable&&(this.#i.set(l.data.id,l),this._annotationEditorUIManager?.renderAnnotationElement(l))}this.#n()})}update({viewport:t}){let e=this.div;this.viewport=t,te(e,{rotation:t.rotation}),this.#n(),e.hidden=!1}#n(){if(!this.#e)return;let t=this.div;for(let[e,i]of this.#e){let s=t.querySelector(`[data-annotation-id="${e}"]`);if(!s)continue;i.className="annotationContent";let{firstChild:n}=s;n?n.nodeName==="CANVAS"?n.replaceWith(i):n.classList.contains("annotationContent")?n.after(i):n.before(i):s.append(i)}this.#e.clear()}getEditableAnnotations(){return Array.from(this.#i.values())}getEditableAnnotation(t){return this.#i.get(t)}},ei=/\r\n?|\n/g,Nn=class o extends z{#t;#e="";#i=`${this.id}-editor`;#s=null;#r;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;
4static get _keyboardManager(){let t=o.prototype,e=n=>n.isEmpty(),i=ke.TRANSLATE_SMALL,s=ke.TRANSLATE_BIG;return B(this,"_keyboardManager",new ee([[["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 _type="freetext";static _editorType=O.FREETEXT;constructor(t){super(vt(G({},t),{name:"freeTextEditor"})),this.#t=t.color||o._defaultColor||z._defaultLineColor,this.#r=t.fontSize||o._defaultFontSize}static initialize(t,e){z.initialize(t,e);let i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,e){switch(t){case I.FREETEXT_SIZE:o._defaultFontSize=e;break;case I.FREETEXT_COLOR:o._defaultColor=e;break}}updateParams(t,e){switch(t){case I.FREETEXT_SIZE:this.#n(e);break;case I.FREETEXT_COLOR:this.#l(e);break}}static get defaultPropertiesToUpdate(){return[[I.FREETEXT_SIZE,o._defaultFontSize],[I.FREETEXT_COLOR,o._defaultColor||z._defaultLineColor]]}get propertiesToUpdate(){return[[I.FREETEXT_SIZE,this.#r],[I.FREETEXT_COLOR,this.#t]]}#n(t){let e=s=>{this.editorDiv.style.fontSize=`calc(${s}px * var(--scale-factor))`,this.translate(0,-(s-this.#r)*this.parentScale),this.#r=s,this.#c()},i=this.#r;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:I.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#l(t){let e=s=>{this.#t=this.editorDiv.style.color=s},i=this.#t;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:I.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){let t=this.parentScale;return[-o._internalPadding*t,-(o._internalPadding+this.#r)*t]}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(O.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.#s=new AbortController;let t=this._uiManager.combinedSignal(this.#s);this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:t}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:t}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:t}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:t}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:t})}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#i),this._isDraggable=!0,this.#s?.abort(),this.#s=null,this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){this.width||(this.enableEditMode(),this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||this.editorDiv.innerText.trim()===""}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}#h(){let t=[];
4this.editorDiv.normalize();let e=null;for(let i of this.editorDiv.childNodes)e?.nodeType===Node.TEXT_NODE&&i.nodeName==="BR"||(t.push(o.#o(i)),e=i);return t.join(`
5`)}#c(){let[t,e]=this.parentDimensions,i;if(this.isAttachedToDOM)i=this.div.getBoundingClientRect();else{let{currentLayer:s,div:n}=this,r=n.style.display,a=n.classList.contains("hidden");n.classList.remove("hidden"),n.style.display="hidden",s.div.append(this.div),i=n.getBoundingClientRect(),n.remove(),n.style.display=r,n.classList.toggle("hidden",a)}this.rotation%180===this.parentRotation%180?(this.width=i.width/t,this.height=i.height/e):(this.width=i.height/t,this.height=i.width/e),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();let t=this.#e,e=this.#e=this.#h().trimEnd();if(t===e)return;let i=s=>{if(this.#e=s,!s){this.remove();return}this.#d(),this._uiManager.rebuild(this),this.#c()};this.addCommands({cmd:()=>{i(e)},undo:()=>{i(t)},mustExec:!1}),this.#c()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(t){this.enterInEditMode()}keydown(t){t.target===this.div&&t.key==="Enter"&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){o._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let t,e;this.width&&(t=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#i),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;let{style:i}=this.editorDiv;if(i.fontSize=`calc(${this.#r}px * var(--scale-factor))`,i.color=this.#t,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),di(this,this.div,["dblclick","keydown"]),this.width){let[s,n]=this.parentDimensions;if(this.annotationElementId){let{position:r}=this._initialData,[a,l]=this.getInitialTranslation();[a,l]=this.pageTranslationToScreen(a,l);let[h,c]=this.pageDimensions,[d,u]=this.pageTranslation,f,p;switch(this.rotation){case 0:f=t+(r[0]-d)/h,p=e+this.height-(r[1]-u)/c;break;case 90:f=t+(r[0]-d)/h,p=e-(r[1]-u)/c,[a,l]=[l,-a];break;case 180:f=t-this.width+(r[0]-d)/h,p=e-(r[1]-u)/c,[a,l]=[-a,-l];break;case 270:f=t+(r[0]-d-this.height*c)/h,p=e+(r[1]-u-this.width*h)/c,[a,l]=[-l,a];break}this.setAt(f*s,p*n,a,l)}else this.setAt(t*s,e*n,this.width*s,this.height*n);this.#d(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static#o(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(ei,"")}editorDivPaste(t){let e=t.clipboardData||window.clipboardData,{types:i}=e;if(i.length===1&&i[0]==="text/plain")return;t.preventDefault();let s=o.#u(e.getData("text")||"").replaceAll(ei,`
6`);if(!s)return;let n=window.getSelection();if(!n.rangeCount)return;this.editorDiv.normalize(),n.deleteFromDocument();let r=n.getRangeAt(0);if(!s.includes(`
7`)){r.insertNode(document.createTextNode(s)),this.editorDiv.normalize(),n.collapseToStart();return}let{startContainer:a,startOffset:l}=r,h=[],c=[];if(a.nodeType===Node.TEXT_NODE){let f=a.parentElement;if(c.push(a.nodeValue.slice(l).replaceAll(ei,"")),f!==this.editorDiv){let p=h;for(let g of this.editorDiv.childNodes){if(g===f){p=c;continue}p.push(o.#o(g))}}h.push(a.nodeValue.slice(0,l).replaceAll(ei,""))}else if(a===this.editorDiv){let f=h,p=0;for(let g of this.editorDiv.childNodes)p++===l&&(f=c),f.push(o.#o(g))}this.#e=`${h.join(`
8`)}${s}${c.join(`
9`)}`,this.#d();let d=new Range,u=h.reduce((f,p)=>f+p.length,0);for(let{firstChild:f}of this.editorDiv.childNodes)if(f.nodeType===Node.TEXT_NODE){let p=f.nodeValue.length;if(u<=p){d.setStart(f,u),d.setEnd(f,u);break}u-=p}n.removeAllRanges(),n.addRange(d)}#d(){if(this.editorDiv.replaceChildren(),!!this.#e)for(let t of this.#e.split(`
10`)){let e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}#a(){return this.#e.replaceAll("\xA0"," ")}static#u(t){return t.replaceAll(" ","\xA0")}get contentDiv(){return this.editorDiv}static deserialize(t,e,i){return C(this,null,function*(){let s=null;if(t instanceof Mi){let{data:{defaultAppearanceData:{fontSize:r,fontColor:a},rect:l,rotation:h,id:c,popupRef:d},textContent:u,textPosition:f,parent:{page:{pageNumber:p}}}=t;if(!u||u.length===0)return null;s=t={annotationType:O.FREETEXT,color:Array.from(a),fontSize:r,value:u.join(`
11`),position:f,pageIndex:p-1,rect:l.slice(0),rotation:h,id:c,deleted:!1,popupRef:d}}let n=yield le(o,this,"deserialize").call(this,t,e,i);return n.#r=t.fontSize,n.#t=M.makeHexColor(...t.color),n.#e=o.#u(t.value),n.annotationElementId=t.id||null,n._initialData=s,n})}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let e=o._internalPadding*this.parentScale,i=this.getRect(e,e),s=z._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.#t),n={annotationType:O.FREETEXT,color:s,fontSize:this.#r,value:this.#a(),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?n:this.annotationElementId&&!this.#p(n)?null:(n.id=this.annotationElementId,n)}#p(t){let{value:e,fontSize:i,color:s,pageIndex:n}=this._initialData;return this._hasBeenMoved||t.value!==e||t.fontSize!==i||t.color.some((r,a)=>r!==s[a])||t.pageIndex!==n}renderAnnotationElement(t){let e=super.renderAnnotationElement(t);if(this.deleted)return e;let{style:i}=e;i.fontSize=`calc(${this.#r}px * var(--scale-factor))`,i.color=this.#t,e.replaceChildren();for(let n of this.#e.split(`
12`)){let r=document.createElement("div");r.append(n?document.createTextNode(n):document.createElement("br")),e.append(r)}let s=o._internalPadding*this.parentScale;return t.updateEdited({rect:this.getRect(s,s),popupContent:this.#e}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}},Oi=class{toSVGPath(){U("Abstract method `toSVGPath` must be implemented.")}get box(){U("Abstract getter `box` must be implemented.")}serialize(t,e){U("Abstract method `serialize` must be implemented.")}get classNamesForDrawing(){U("Abstract getter `classNamesForDrawing` must be implemented.")}get classNamesForOutlining(){U("Abstract getter `classNamesForOutlining` must be implemented.")}get mustRemoveSelfIntersections(){return!1}},Di=class o{#t;#e=[];#i;#s;#r=[];#n=new Float64Array(18);#l;#h;#c;#o;#d;#a;#u=[];static#p=8;static#f=2;static#g=o.#p+o.#f;constructor({x:t,y:e},i,s,n,r,a=0){this.#t=i,this.#a=n*s,this.#s=r,this.#n.set([NaN,NaN,NaN,NaN,t,e],6),this.#i=a,this.#o=o.#p*s,this.#c=o.#g*s,this.#d=s,this.#u.push(t,e)}isEmpty(){return isNaN(this.#n[8])}#b(){let t=this.#n.subarray(4,6),e=this.#n.subarray(16,18),[i,s,n,r]=this.#t;return[(this.#l+(t[0]-e[0])/2-i)/n,(this.#h+(t[1]-e[1])/2-s)/r,(this.#l+(e[0]-t[0])/2-i)/n,(this.#h+(e[1]-t[1])/2-s)/r]}add({x:t,y:e}){this.#l=t,this.#h=e;let[i,s,n,r]=this.#t,[a,l,h,c]=this.#n.subarray(8,12),d=t-h,u=e-c,f=Math.hypot(d,u);if(f<this.#c)return!1;let p=f-this.#o,g=p/f,b=g*d,m=g*u,w=a,y=l;a=h,l=c,h+=b,c+=m,this.#u?.push(t,e);let A=-m/p,v=b/p,S=A*this.#a,P=v*this.#a;return this.#n.set(this.#n.subarray(2,8),0),this.#n.set([h+S,c+P],4),this.#n.set(this.#n.subarray(14,18),12),this.#n.set([h-S,c-P],16),isNaN(this.#n[6])?(this.#r.length===0&&(this.#n.set([a+S,l+P],2),this.#r.push(NaN,NaN,NaN,NaN,(a+S-i)/n,(l+P-s)/r),this.#n.set([a-S,l-P],14),this.#e.push(NaN,NaN,NaN,NaN,(a-S-i)/n,(l-P-s)/r)),this.#n.set([w,y,a,l,h,c],6),!this.isEmpty()):(this.#n.set([w,y,a,l,h,c],6),Math.abs(Math.atan2(y-l,w-a)-Math.atan2(m,b))<Math.PI/2?([a,l,h,c]=this.#n.subarray(2,6),this.#r.push(NaN,NaN,NaN,NaN,((a+h)/2-i)/n,((l+c)/2-s)/r),[a,l,w,y]=this.#n.subarray(14,18),this.#e.push(NaN,NaN,NaN,NaN,((w+a)/2-i)/n,((y+l)/2-s)/r),!0):([w,y,a,l,h,c]=this.#n.subarray(0,6),this.#r.push(((w+5*a)/6-i)/n,((y+5*l)/6-s)/r,((5*a+h)/6-i)/n,((5*l+c)/6-s)/r,((a+h)/2-i)/n,((l+c)/2-s)/r),[h,c,a,l,w,y]=this.#n.subarray(12,18),this.#e.push(((w+5*a)/6-i)/n,((y+5*l)/6-s)/r,((5*a+h)/6-i)/n,((5*l+c)/6-s)/r,((a+h)/2-i)/n,((l+c)/2-s)/r),!0))}toSVGPath(){if(this.isEmpty())return"";let t=this.#r,e=this.#e;if(isNaN(this.#n[6])&&!this.isEmpty())return this.#m();let i=[];i.push(`M${t[4]} ${t[5]}`);for(let s=6;s<t.length;s+=6)isNaN(t[s])?i.push(`L${t[s+4]} ${t[s+5]}`):i.push(`C${t[s]} ${t[s+1]} ${t[s+2]} ${t[s+3]} ${t[s+4]} ${t[s+5]}`);this.#w(i);for(let s=e.length-6;s>=6;s-=6)isNaN(e[s])?i.push(`L${e[s+4]} ${e[s+5]}`):i.push(`C${e[s]} ${e[s+1]} ${e[s+2]} ${e[s+3]} ${e[s+4]} ${e[s+5]}`);return this.#A(i),i.join(" ")}#m(){let[t,e,i,s]=this.#t,[n,r,a,l]=this.#b();return`M${(this.#n[2]-t)/i} ${(this.#n[3]-e)/s} L${(this.#n[4]-t)/i} ${(this.#n[5]-e)/s} L${n} ${r} L${a} ${l} L${(this.#n[16]-t)/i} ${(this.#n[17]-e)/s} L${(this.#n[14]-t)/i} ${(this.#n[15]-e)/s} Z`}#A(t){let e=this.#e;t.push(`L${e[4]} ${e[5]} Z`)}#w(t){let[e,i,s,n]=this.#t,r=this.#n.subarray(4,6),a=this.#n.subarray(16,18),[l,h,c,d]=this.#b();t.push(`L${(r[0]-e)/s} ${(r[1]-i)/n} L${l} ${h} L${c} ${d} L${(a[0]-e)/s} ${(a[1]-i)/n}`)}
12newFreeDrawOutline(t,e,i,s,n,r){return new Ni(t,e,i,s,n,r)}getOutlines(){let t=this.#r,e=this.#e,i=this.#n,[s,n,r,a]=this.#t,l=new Float64Array((this.#u?.length??0)+2);for(let d=0,u=l.length-2;d<u;d+=2)l[d]=(this.#u[d]-s)/r,l[d+1]=(this.#u[d+1]-n)/a;if(l[l.length-2]=(this.#l-s)/r,l[l.length-1]=(this.#h-n)/a,isNaN(i[6])&&!this.isEmpty())return this.#E(l);let h=new Float64Array(this.#r.length+24+this.#e.length),c=t.length;for(let d=0;d<c;d+=2){if(isNaN(t[d])){h[d]=h[d+1]=NaN;continue}h[d]=t[d],h[d+1]=t[d+1]}c=this.#v(h,c);for(let d=e.length-6;d>=6;d-=6)for(let u=0;u<6;u+=2){if(isNaN(e[d+u])){h[c]=h[c+1]=NaN,c+=2;continue}h[c]=e[d+u],h[c+1]=e[d+u+1],c+=2}return this.#y(h,c),this.newFreeDrawOutline(h,l,this.#t,this.#d,this.#i,this.#s)}#E(t){let e=this.#n,[i,s,n,r]=this.#t,[a,l,h,c]=this.#b(),d=new Float64Array(36);return d.set([NaN,NaN,NaN,NaN,(e[2]-i)/n,(e[3]-s)/r,NaN,NaN,NaN,NaN,(e[4]-i)/n,(e[5]-s)/r,NaN,NaN,NaN,NaN,a,l,NaN,NaN,NaN,NaN,h,c,NaN,NaN,NaN,NaN,(e[16]-i)/n,(e[17]-s)/r,NaN,NaN,NaN,NaN,(e[14]-i)/n,(e[15]-s)/r],0),this.newFreeDrawOutline(d,t,this.#t,this.#d,this.#i,this.#s)}#y(t,e){let i=this.#e;return t.set([NaN,NaN,NaN,NaN,i[4],i[5]],e),e+=6}#v(t,e){let i=this.#n.subarray(4,6),s=this.#n.subarray(16,18),[n,r,a,l]=this.#t,[h,c,d,u]=this.#b();return t.set([NaN,NaN,NaN,NaN,(i[0]-n)/a,(i[1]-r)/l,NaN,NaN,NaN,NaN,h,c,NaN,NaN,NaN,NaN,d,u,NaN,NaN,NaN,NaN,(s[0]-n)/a,(s[1]-r)/l],e),e+=24}},Ni=class extends Oi{#t;#e=null;#i;#s;#r;#n;#l;constructor(t,e,i,s,n,r){super(),this.#l=t,this.#r=e,this.#t=i,this.#n=s,this.#i=n,this.#s=r,this.#o(r);let{x:a,y:l,width:h,height:c}=this.#e;for(let d=0,u=t.length;d<u;d+=2)t[d]=(t[d]-a)/h,t[d+1]=(t[d+1]-l)/c;for(let d=0,u=e.length;d<u;d+=2)e[d]=(e[d]-a)/h,e[d+1]=(e[d+1]-l)/c}toSVGPath(){let t=[`M${this.#l[4]} ${this.#l[5]}`];for(let e=6,i=this.#l.length;e<i;e+=6){if(isNaN(this.#l[e])){t.push(`L${this.#l[e+4]} ${this.#l[e+5]}`);continue}t.push(`C${this.#l[e]} ${this.#l[e+1]} ${this.#l[e+2]} ${this.#l[e+3]} ${this.#l[e+4]} ${this.#l[e+5]}`)}return t.push("Z"),t.join(" ")}serialize([t,e,i,s],n){let r=i-t,a=s-e,l,h;switch(n){case 0:l=this.#h(this.#l,t,s,r,-a),h=this.#h(this.#r,t,s,r,-a);break;case 90:l=this.#c(this.#l,t,e,r,a),h=this.#c(this.#r,t,e,r,a);break;case 180:l=this.#h(this.#l,i,e,-r,a),h=this.#h(this.#r,i,e,-r,a);break;case 270:l=this.#c(this.#l,i,s,-r,-a),h=this.#c(this.#r,i,s,-r,-a);break}return{outline:Array.from(l),points:[Array.from(h)]}}#h(t,e,i,s,n){let r=new Float64Array(t.length);for(let a=0,l=t.length;a<l;a+=2)r[a]=e+t[a]*s,r[a+1]=i+t[a+1]*n;return r}#c(t,e,i,s,n){let r=new Float64Array(t.length);for(let a=0,l=t.length;a<l;a+=2)r[a]=e+t[a+1]*s,r[a+1]=i+t[a]*n;return r}#o(t){let e=this.#l,i=e[4],s=e[5],n=i,r=s,a=i,l=s,h=i,c=s,d=t?Math.max:Math.min;for(let b=6,m=e.length;b<m;b+=6){if(isNaN(e[b]))n=Math.min(n,e[b+4]),r=Math.min(r,e[b+5]),a=Math.max(a,e[b+4]),l=Math.max(l,e[b+5]),c<e[b+5]?(h=e[b+4],c=e[b+5]):c===e[b+5]&&(h=d(h,e[b+4]));else{let w=M.bezierBoundingBox(i,s,...e.slice(b,b+6));n=Math.min(n,w[0]),r=Math.min(r,w[1]),a=Math.max(a,w[2]),l=Math.max(l,w[3]),c<w[3]?(h=w[2],c=w[3]):c===w[3]&&(h=d(h,w[2]))}i=e[b+4],s=e[b+5]}let u=n-this.#i,f=r-this.#i,p=a-n+2*this.#i,g=l-r+2*this.#i;this.#e={x:u,y:f,width:p,height:g,lastPoint:[h,c]}}get box(){return this.#e}newOutliner(t,e,i,s,n,r=0){return new Di(t,e,i,s,n,r)}getNewOutline(t,e){let{x:i,y:s,width:n,height:r}=this.#e,[a,l,h,c]=this.#t,d=n*h,u=r*c,f=i*h+a,p=s*c+l,g=this.newOutliner({x:this.#r[0]*d+f,y:this.#r[1]*u+p},this.#t,this.#n,t,this.#s,e??this.#i);for(let b=2;b<this.#r.length;b+=2)g.add({x:this.#r[b]*d+f,y:this.#r[b+1]*u+p});return g.getOutlines()}get mustRemoveSelfIntersections(){return!0}},Fi=class{#t;#e=[];#i=[];constructor(t,e=0,i=0,s=!0){let n=1/0,r=-1/0,a=1/0,l=-1/0,c=10**-4;for(let{x:m,y:w,width:y,height:A}of t){let v=Math.floor((m-e)/c)*c,S=Math.ceil((m+y+e)/c)*c,P=Math.floor((w-e)/c)*c,T=Math.ceil((w+A+e)/c)*c,_=[v,P,T,!0],E=[S,P,T,!1];this.#e.push(_,E),n=Math.min(n,v),r=Math.max(r,S),a=Math.min(a,P),l=Math.max(l,T)}let d=r-n+2*i,u=l-a+2*i,f=n-i,p=a-i,g=this.#e.at(s?-1:-2),b=[g[0],g[2]];for(let m of this.#e){let[w,y,A]=m;m[0]=(w-f)/d,m[1]=(y-p)/u,m[2]=(A-p)/u}this.#t={x:f,y:p,width:d,height:u,lastPoint:b}}getOutlines(){this.#e.sort((e,i)=>e[0]-i[0]||e[1]-i[1]||e[2]-i[2]);let t=[];for(let e of this.#e)e[3]?(t.push(...this.#h(e)),this.#n(e)):(this.#l(e),t.pu
12sh(...this.#h(e)));return this.#s(t)}#s(t){let e=[],i=new Set;for(let r of t){let[a,l,h]=r;e.push([a,l,r],[a,h,r])}e.sort((r,a)=>r[1]-a[1]||r[0]-a[0]);for(let r=0,a=e.length;r<a;r+=2){let l=e[r][2],h=e[r+1][2];l.push(h),h.push(l),i.add(l),i.add(h)}let s=[],n;for(;i.size>0;){let r=i.values().next().value,[a,l,h,c,d]=r;i.delete(r);let u=a,f=l;for(n=[a,h],s.push(n);;){let p;if(i.has(c))p=c;else if(i.has(d))p=d;else break;i.delete(p),[a,l,h,c,d]=p,u!==a&&(n.push(u,f,a,f===l?l:h),u=a),f=f===l?h:l}n.push(u,f)}return new Fn(s,this.#t)}#r(t){let e=this.#i,i=0,s=e.length-1;for(;i<=s;){let n=i+s>>1,r=e[n][0];if(r===t)return n;r<t?i=n+1:s=n-1}return s+1}#n([,t,e]){let i=this.#r(t);this.#i.splice(i,0,[t,e])}#l([,t,e]){let i=this.#r(t);for(let s=i;s<this.#i.length;s++){let[n,r]=this.#i[s];if(n!==t)break;if(n===t&&r===e){this.#i.splice(s,1);return}}for(let s=i-1;s>=0;s--){let[n,r]=this.#i[s];if(n!==t)break;if(n===t&&r===e){this.#i.splice(s,1);return}}}#h(t){let[e,i,s]=t,n=[[e,i,s]],r=this.#r(s);for(let a=0;a<r;a++){let[l,h]=this.#i[a];for(let c=0,d=n.length;c<d;c++){let[,u,f]=n[c];if(!(h<=u||f<=l)){if(u>=l){if(f>h)n[c][1]=h;else{if(d===1)return[];n.splice(c,1),c--,d--}continue}n[c][2]=l,f>h&&n.push([e,h,f])}}}return n}},Fn=class extends Oi{#t;#e;constructor(t,e){super(),this.#e=t,this.#t=e}toSVGPath(){let t=[];for(let e of this.#e){let[i,s]=e;t.push(`M${i} ${s}`);for(let n=2;n<e.length;n+=2){let r=e[n],a=e[n+1];r===i?(t.push(`V${a}`),s=a):a===s&&(t.push(`H${r}`),i=r)}t.push("Z")}return t.join(" ")}serialize([t,e,i,s],n){let r=[],a=i-t,l=s-e;for(let h of this.#e){let c=new Array(h.length);for(let d=0;d<h.length;d+=2)c[d]=t+h[d]*a,c[d+1]=s-h[d+1]*l;r.push(c)}return r}get box(){return this.#t}get classNamesForDrawing(){return["highlight"]}get classNamesForOutlining(){return["highlightOutline"]}},He=class extends Di{newFreeDrawOutline(t,e,i,s,n,r){return new Bn(t,e,i,s,n,r)}get classNamesForDrawing(){return["highlight","free"]}},Bn=class extends Ni{get classNamesForDrawing(){return["highlight","free"]}get classNamesForOutlining(){return["highlightOutline","free"]}newOutliner(t,e,i,s,n,r=0){return new He(t,e,i,s,n,r)}},Bi=class o{#t=null;#e=null;#i;#s=null;#r=!1;#n=!1;#l=null;#h;#c=null;#o=null;#d;static#a=null;static get _keyboardManager(){return B(this,"_keyboardManager",new ee([[["Escape","mac+Escape"],o.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],o.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],o.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],o.prototype._moveToPrevious],[["Home","mac+Home"],o.prototype._moveToBeginning],[["End","mac+End"],o.prototype._moveToEnd]]))}constructor({editor:t=null,uiManager:e=null}){t?(this.#n=!1,this.#d=I.HIGHLIGHT_COLOR,this.#l=t):(this.#n=!0,this.#d=I.HIGHLIGHT_DEFAULT_COLOR),this.#o=t?._uiManager||e,this.#h=this.#o._eventBus,this.#i=t?.color||this.#o?.highlightColors.values().next().value||"#FFFF98",o.#a||=Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"})}renderButton(){let t=this.#t=document.createElement("button");t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.setAttribute("aria-haspopup",!0);let e=this.#o._signal;t.addEventListener("click",this.#g.bind(this),{signal:e}),t.addEventListener("keydown",this.#f.bind(this),{signal:e});let i=this.#e=document.createElement("span");return i.className="swatch",i.setAttribute("aria-hidden",!0),i.style.backgroundColor=this.#i,t.append(i),t}renderMainDropdown(){let t=this.#s=this.#u();return t.setAttribute("aria-orientation","horizontal"),t.setAttribute("aria-labelledby","highlightColorPickerLabel"),t}#u(){let t=document.createElement("div"),e=this.#o._signal;t.addEventListener("contextmenu",yt,{signal:e}),t.className="dropdown",t.role="listbox",t.setAttribute("aria-multiselectable",!1),t.setAttribute("aria-orientation","vertical"),t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown");for(let[i,s]of this.#o.highlightColors){let n=document.createElement("button");n.tabIndex="0",n.role="option",n.setAttribute("data-color",s),n.title=i,n.setAttribute("data-l10n-id",o.#a[i]);let r=document.createElement("span");n.append(r),r.className="swatch",r.style.backgroundColor=s,n.setAttribute("aria-selected",s===this.#i),n.addEventListener("click",this.#p.bind(this,s),{signal:e}),t.append(n)}return t.addEventListener("keydown",this.#f.bind(this),{signal:e}),t}#p(t,e){e.stopPropagation(),this.#h.dispatch("switchannotationeditorparams",{source:this,type:this.#d,value:t})}_colorSelectFromKeyboard(t){if(t.target===this.#t){this.#g(t);return}let e=t.target.getAttribute("data-color");e&&this.#p(e,t)}_moveToNext(t){if(!this.#m){this.#g(t);return}if(t.target===this.#t){this.#s.firstChild?.focus();return}t.target.nextSibling?.focus()}_moveToPrevious(t){if(t.target===this.#s?.firstChild||t.target===this.#t){this.#m&&this._hideDropdownFromKeyboard();return}this.#m||this.#g(t),t.target.previousSibling?.focus()}_moveToBeginning(t){if(!this.#m){this.#g(t);return}this.#s.firstChild?.focus()}_moveToEnd(t){if(!this.#m){this.#g(t);return}this.#s.lastChild?.focus()}#f(t){o._keyboardManager.exec(this,t)}#g(t){if(this.#m){this.hideDropdown();return}if(this.#r=t.detail===0,this.#c||(this.#c=new AbortController,window.addEventListener("pointerdown",this.#b.bind(this),{signal:this.#o.combinedSignal(this.#c)})),this.#s){this.#s.classList.remove("hidden");return}let e=this.#s=this.#u();this.#t.append(e)}#b(t){this.#s?.contains(t.target)||this.hideDropdown()}hideDropdown(){this.#s?.classList.add("hidden"),this.#c?.abort(),this.#c=null}get#m(){return this.#s&&!this.#s.classList.contains("hidden")}_hideDropdownFromKeyboard(){if(!this.#n){if(!this.#m){this.#l?.unselect();return}this.hideDropdown(),this.#t.focus({preventScroll:!0,focusVisible:this.#r})}}updateColor(t){if(this.#e&&(this.#e.style.backgroundColor=t),!this.#s)return;let e=this.#o.highlightColors.values();for(let i of this.#s.children)i.setAttribute("aria-selected",e.next().value===t)}destroy(){this.#t?.remove(),this.#t=null,this.#e=null,this.#s?.remove(),this.#s=null}},Hi=class o extends z{#t=null;#e=0;#i;#s=null;#r=null;#n=null;#l=null;#h=0;#c=null;#o=null;#d=null;#a=!1;#u=null;#p;#f=null;#g="";#b;#m="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _type="highlight";static _editorType=O.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";
12static get _keyboardManager(){let t=o.prototype;return B(this,"_keyboardManager",new ee([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}constructor(t){super(vt(G({},t),{name:"highlightEditor"})),this.color=t.color||o._defaultColor,this.#b=t.thickness||o._defaultThickness,this.#p=t.opacity||o._defaultOpacity,this.#i=t.boxes||null,this.#m=t.methodOfCreation||"",this.#g=t.text||"",this._isDraggable=!1,t.highlightId>-1?(this.#a=!0,this.#w(t),this.#P()):this.#i&&(this.#t=t.anchorNode,this.#e=t.anchorOffset,this.#l=t.focusNode,this.#h=t.focusOffset,this.#A(),this.#P(),this.rotate(this.rotation))}get telemetryInitialData(){return{action:"added",type:this.#a?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:this.#b,methodOfCreation:this.#m}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}#A(){let t=new Fi(this.#i,.001);this.#o=t.getOutlines(),{x:this.x,y:this.y,width:this.width,height:this.height}=this.#o.box;let e=new Fi(this.#i,.0025,.001,this._uiManager.direction==="ltr");this.#n=e.getOutlines();let{lastPoint:i}=this.#n.box;this.#u=[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height]}#w({highlightOutlines:t,highlightId:e,clipPathId:i}){this.#o=t;let s=1.5;if(this.#n=t.getNewOutline(this.#b/2+s,.0025),e>=0)this.#d=e,this.#s=i,this.parent.drawLayer.finalizeLine(e,t),this.#f=this.parent.drawLayer.drawOutline(this.#n);else if(this.parent){let c=this.parent.viewport.rotation;this.parent.drawLayer.updateLine(this.#d,t),this.parent.drawLayer.updateBox(this.#d,o.#x(this.#o.box,(c-this.rotation+360)%360)),this.parent.drawLayer.updateLine(this.#f,this.#n),this.parent.drawLayer.updateBox(this.#f,o.#x(this.#n.box,c))}let{x:n,y:r,width:a,height:l}=t.box;switch(this.rotation){case 0:this.x=n,this.y=r,this.width=a,this.height=l;break;case 90:{let[c,d]=this.parentDimensions;this.x=r,this.y=1-n,this.width=a*d/c,this.height=l*c/d;break}case 180:this.x=1-n,this.y=1-r,this.width=a,this.height=l;break;case 270:{let[c,d]=this.parentDimensions;this.x=1-r,this.y=n,this.width=a*d/c,this.height=l*c/d;break}}let{lastPoint:h}=this.#n.box;this.#u=[(h[0]-n)/a,(h[1]-r)/l]}static initialize(t,e){z.initialize(t,e),o._defaultColor||=e.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(t,e){switch(t){case I.HIGHLIGHT_DEFAULT_COLOR:o._defaultColor=e;break;case I.HIGHLIGHT_THICKNESS:o._defaultThickness=e;break}}translateInPage(t,e){}get toolbarPosition(){return this.#u}updateParams(t,e){switch(t){case I.HIGHLIGHT_COLOR:this.#E(e);break;case I.HIGHLIGHT_THICKNESS:this.#y(e);break}}static get defaultPropertiesToUpdate(){return[[I.HIGHLIGHT_DEFAULT_COLOR,o._defaultColor],[I.HIGHLIGHT_THICKNESS,o._defaultThickness]]}get propertiesToUpdate(){return[[I.HIGHLIGHT_COLOR,this.color||o._defaultColor],[I.HIGHLIGHT_THICKNESS,this.#b||o._defaultThickness],[I.HIGHLIGHT_FREE,this.#a]]}#E(t){let e=(n,r)=>{this.color=n,this.parent?.drawLayer.changeColor(this.#d,n),this.#r?.updateColor(n),this.#p=r,this.parent?.drawLayer.changeOpacity(this.#d,r)},i=this.color,s=this.#p;this.addCommands({cmd:e.bind(this,t,o._defaultOpacity),undo:e.bind(this,i,s),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:I.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(t)},!0)}#y(t){let e=this.#b,i=s=>{this.#b=s,this.#v(s)};this.addCommands({cmd:i.bind(this,t),undo:i.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:I.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}addEditToolbar(){return C(this,null,function*(){let t=yield le(o.prototype,this,"addEditToolbar").call(this);return t?(this._uiManager.highlightColors&&(this.#r=new Bi({editor:this}),t.addColorPicker(this.#r)),t):null})}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#k())}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,this.#k())}onceAdded(){this.annotationElementId||this.parent.addUndoableEditor(this),this.div.focus()}remove(){this.#M(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.#P(),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;this.parent&&!t?this.#M():t&&(this.#P(t),e=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),this.show(this._isVisible),e&&this.select()}#v(t){if(!this.#a)return;this.#w({highlightOutlines:this.#o.getNewOutline(t/2)}),this.fixAndSetPosition();let[e,i]=this.parentDimensions;this.setDims(this.width*e,this.height*i)}#M(){this.#d===null||!this.parent||(this.parent.drawLayer.remove(this.#d),this.#d=null,this.parent.drawLayer.remove(this.#f),this.#f=null)}#P(t=this.parent){this.#d===null&&({id:this.#d,clipPathId:this.#s}=t.drawLayer.draw(this.#o,this.color,this.#p),this.#f=t.drawLayer.drawOutline(this.#n),this.#c&&(this.#c.style.clipPath=this.#s))}static#x({x:t,y:e,width:i,height:s},n){switch(n){case 90:return{x:1-e-s,y:t,width:s,height:i};case 180:return{x:1-t-i,y:1-e-s,width:i,height:s};case 270:return{x:e,y:1-t-i,width:s,height:i}}return{x:t,y:e,width:i,height:s}}rotate(t){let{drawLayer:e}=this.parent,i;this.#a?(t=(t-this.rotation+360)%360,i=o.#x(this.#o.box,t)):i=o.#x(this,t),e.rotate(this.#d,t),e.rotate(this.#f,t),e.updateBox(this.#d,i),e.updateBox(this.#f,o.#x(this.#n.box,t))}
12render(){if(this.div)return this.div;let t=super.render();this.#g&&(t.setAttribute("aria-label",this.#g),t.setAttribute("role","mark")),this.#a?t.classList.add("free"):this.div.addEventListener("keydown",this.#T.bind(this),{signal:this._uiManager._signal});let e=this.#c=document.createElement("div");t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=this.#s;let[i,s]=this.parentDimensions;return this.setDims(this.width*i,this.height*s),di(this,this.#c,["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.isSelected||this.parent.drawLayer.addClass(this.#f,"hovered")}pointerleave(){this.isSelected||this.parent.drawLayer.removeClass(this.#f,"hovered")}#T(t){o._keyboardManager.exec(this,t)}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:this.#S(!0);break;case 1:case 3:this.#S(!1);break}}#S(t){if(!this.#t)return;let e=window.getSelection();t?e.setPosition(this.#t,this.#e):e.setPosition(this.#l,this.#h)}select(){super.select(),this.#f&&(this.parent?.drawLayer.removeClass(this.#f,"hovered"),this.parent?.drawLayer.addClass(this.#f,"selected"))}unselect(){super.unselect(),this.#f&&(this.parent?.drawLayer.removeClass(this.#f,"selected"),this.#a||this.#S(!1))}get _mustFixPosition(){return!this.#a}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.show(this.#d,t),this.parent.drawLayer.show(this.#f,t))}#k(){return this.#a?this.rotation:0}#R(){if(this.#a)return null;let[t,e]=this.pageDimensions,[i,s]=this.pageTranslation,n=this.#i,r=new Float32Array(n.length*8),a=0;for(let{x:l,y:h,width:c,height:d}of n){let u=l*t+i,f=(1-h-d)*e+s;r[a]=r[a+4]=u,r[a+1]=r[a+3]=f,r[a+2]=r[a+6]=u+c*t,r[a+5]=r[a+7]=f+d*e,a+=8}return r}#C(t){return this.#o.serialize(t,this.#k())}static startHighlighting(t,e,{target:i,x:s,y:n}){let{x:r,y:a,width:l,height:h}=i.getBoundingClientRect(),c=new AbortController,d=t.combinedSignal(c),u=p=>{p.preventDefault(),p.stopPropagation()},f=p=>{c.abort(),this.#L(t,p)};window.addEventListener("blur",f,{signal:d}),window.addEventListener("pointerup",f,{signal:d}),window.addEventListener("pointerdown",u,{capture:!0,passive:!1,signal:d}),window.addEventListener("contextmenu",yt,{signal:d}),i.addEventListener("pointermove",this.#_.bind(this,t),{signal:d}),this._freeHighlight=new He({x:s,y:n},[r,a,l,h],t.scale,this._defaultThickness/2,e,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.draw(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0)}static#_(t,e){this._freeHighlight.add(e)&&t.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)}static#L(t,e){this._freeHighlight.isEmpty()?t.drawLayer.remove(this._freeHighlightId):t.createAndAddNewEditor(e,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static deserialize(t,e,i){return C(this,null,function*(){let s=null;if(t instanceof Ii){let{data:{quadPoints:p,rect:g,rotation:b,id:m,color:w,opacity:y,popupRef:A},parent:{page:{pageNumber:v}}}=t;s=t={annotationType:O.HIGHLIGHT,color:Array.from(w),opacity:y,quadPoints:p,boxes:null,pageIndex:v-1,rect:g.slice(0),rotation:b,id:m,deleted:!1,popupRef:A}}else if(t instanceof Be){let{data:{inkLists:p,rect:g,rotation:b,id:m,color:w,borderStyle:{rawWidth:y},popupRef:A},parent:{page:{pageNumber:v}}}=t;s=t={annotationType:O.HIGHLIGHT,color:Array.from(w),thickness:y,inkLists:p,boxes:null,pageIndex:v-1,rect:g.slice(0),rotation:b,id:m,deleted:!1,popupRef:A}}let{color:n,quadPoints:r,inkLists:a,opacity:l}=t,h=yield le(o,this,"deserialize").call(this,t,e,i);h.color=M.makeHexColor(...n),h.#p=l||1,a&&(h.#b=t.thickness),h.annotationElementId=t.id||null,h._initialData=s;let[c,d]=h.pageDimensions,[u,f]=h.pageTranslation;if(r){let p=h.#i=[];for(let g=0;g<r.length;g+=8)p.push({x:(r[g]-u)/c,y:1-(r[g+1]-f)/d,width:(r[g+2]-r[g])/c,height:(r[g+1]-r[g+5])/
12d});h.#A(),h.#P(),h.rotate(h.rotation)}else if(a){h.#a=!0;let p=a[0],g={x:p[0]-u,y:d-(p[1]-f)},b=new He(g,[0,0,c,d],1,h.#b/2,!0,.001);for(let y=0,A=p.length;y<A;y+=2)g.x=p[y]-u,g.y=d-(p[y+1]-f),b.add(g);let{id:m,clipPathId:w}=e.drawLayer.draw(b,h.color,h._defaultOpacity,!0);h.#w({highlightOutlines:b.getOutlines(),highlightId:m,clipPathId:w}),h.#P()}return h})}serialize(t=!1){if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();let e=this.getRect(0,0),i=z._colorManager.convert(this.color),s={annotationType:O.HIGHLIGHT,color:i,opacity:this.#p,thickness:this.#b,quadPoints:this.#R(),outlines:this.#C(e),pageIndex:this.pageIndex,rect:e,rotation:this.#k(),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!this.#I(s)?null:(s.id=this.annotationElementId,s)}#I(t){let{color:e}=this._initialData;return t.color.some((i,s)=>i!==e[s])}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}},Hn=class o extends z{#t=0;#e=0;#i=null;#s=new Path2D;#r=!1;#n=null;#l=!1;#h=!1;#c=null;#o=null;#d=0;#a=0;#u=null;static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=1;static _type="ink";static _editorType=O.INK;constructor(t){super(vt(G({},t),{name:"inkEditor"})),this.color=t.color||null,this.thickness=t.thickness||null,this.opacity=t.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}static initialize(t,e){z.initialize(t,e)}static updateDefaultParams(t,e){switch(t){case I.INK_THICKNESS:o._defaultThickness=e;break;case I.INK_COLOR:o._defaultColor=e;break;case I.INK_OPACITY:o._defaultOpacity=e/100;break}}updateParams(t,e){switch(t){case I.INK_THICKNESS:this.#p(e);break;case I.INK_COLOR:this.#f(e);break;case I.INK_OPACITY:this.#g(e);break}}static get defaultPropertiesToUpdate(){return[[I.INK_THICKNESS,o._defaultThickness],[I.INK_COLOR,o._defaultColor||z._defaultLineColor],[I.INK_OPACITY,Math.round(o._defaultOpacity*100)]]}get propertiesToUpdate(){return[[I.INK_THICKNESS,this.thickness||o._defaultThickness],[I.INK_COLOR,this.color||o._defaultColor||z._defaultLineColor],[I.INK_OPACITY,Math.round(100*(this.opacity??o._defaultOpacity))]]}#p(t){let e=s=>{this.thickness=s,this.#O()},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:I.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#f(t){let e=s=>{this.color=s,this.#x()},i=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:I.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#g(t){let e=s=>{this.opacity=s,this.#x()};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:I.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){this.parent&&(super.rebuild(),this.div!==null&&(this.canvas||(this.#R(),this.#C()),this.isAttachedToDOM||(this.parent.add(this),this.#_()),this.#O()))}remove(){this.canvas!==null&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.#i&&(clearTimeout(this.#i),this.#i=null),this.#c?.disconnect(),this.#c=null,super.remove())}setParent(t){!this.parent&&t?this._uiManager.removeShouldRescale(this):this.parent&&t===null&&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(){this.#r||this.canvas===null||(super.enableEditMode(),this._isDraggable=!1,this.#T())}disableEditMode(){!this.isInEditMode()||this.canvas===null||(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),this.#S())}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return this.paths.length===0||this.paths.length===1&&this.paths[0].length===0}#b(){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]}}#m(){let{ctx:t,color:e,opacity:i,thickness:s,parentScale:n,scaleFactor:r}=this;
12t.lineWidth=s*n/r,t.lineCap="round",t.lineJoin="round",t.miterLimit=10,t.strokeStyle=`${e}${Fo(i)}`}#A(t,e){this.canvas.addEventListener("contextmenu",yt,{signal:this._uiManager._signal}),this.#S(),this.#n=new AbortController;let i=this._uiManager.combinedSignal(this.#n);this.canvas.addEventListener("pointerleave",this.canvasPointerleave.bind(this),{signal:i}),this.canvas.addEventListener("pointermove",this.canvasPointermove.bind(this),{signal:i}),this.canvas.addEventListener("pointerup",this.canvasPointerup.bind(this),{signal:i}),this.isEditing=!0,this.#h||(this.#h=!0,this.#_(),this.thickness||=o._defaultThickness,this.color||=o._defaultColor||z._defaultLineColor,this.opacity??=o._defaultOpacity),this.currentPath.push([t,e]),this.#l=!1,this.#m(),this.#u=()=>{this.#v(),this.#u&&window.requestAnimationFrame(this.#u)},window.requestAnimationFrame(this.#u)}#w(t,e){let[i,s]=this.currentPath.at(-1);if(this.currentPath.length>1&&t===i&&e===s)return;let n=this.currentPath,r=this.#s;if(n.push([t,e]),this.#l=!0,n.length<=2){r.moveTo(...n[0]),r.lineTo(t,e);return}n.length===3&&(this.#s=r=new Path2D,r.moveTo(...n[0])),this.#M(r,...n.at(-3),...n.at(-2),t,e)}#E(){if(this.currentPath.length===0)return;let t=this.currentPath.at(-1);this.#s.lineTo(...t)}#y(t,e){this.#u=null,t=Math.min(Math.max(t,0),this.canvas.width),e=Math.min(Math.max(e,0),this.canvas.height),this.#w(t,e),this.#E();let i;if(this.currentPath.length!==1)i=this.#P();else{let l=[t,e];i=[[l,l.slice(),l.slice(),l]]}let s=this.#s,n=this.currentPath;this.currentPath=[],this.#s=new Path2D;let r=()=>{this.allRawPaths.push(n),this.paths.push(i),this.bezierPath2D.push(s),this._uiManager.rebuild(this)},a=()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),this.paths.length===0?this.remove():(this.canvas||(this.#R(),this.#C()),this.#O())};this.addCommands({cmd:r,undo:a,mustExec:!0})}#v(){if(!this.#l)return;this.#l=!1;let t=Math.ceil(this.thickness*this.parentScale),e=this.currentPath.slice(-3),i=e.map(c=>c[0]),s=e.map(c=>c[1]),n=Math.min(...i)-t,r=Math.max(...i)+t,a=Math.min(...s)-t,l=Math.max(...s)+t,{ctx:h}=this;h.save(),h.clearRect(0,0,this.canvas.width,this.canvas.height);for(let c of this.bezierPath2D)h.stroke(c);h.stroke(this.#s),h.restore()}#M(t,e,i,s,n,r,a){let l=(e+s)/2,h=(i+n)/2,c=(s+r)/2,d=(n+a)/2;t.bezierCurveTo(l+2*(s-l)/3,h+2*(n-h)/3,c+2*(s-c)/3,d+2*(n-d)/3,c,d)}#P(){let t=this.currentPath;if(t.length<=2)return[[t[0],t[0],t.at(-1),t.at(-1)]];let e=[],i,[s,n]=t[0];for(i=1;i<t.length-2;i++){let[u,f]=t[i],[p,g]=t[i+1],b=(u+p)/2,m=(f+g)/2,w=[s+2*(u-s)/3,n+2*(f-n)/3],y=[b+2*(u-b)/3,m+2*(f-m)/3];e.push([[s,n],w,y,[b,m]]),[s,n]=[b,m]}let[r,a]=t[i],[l,h]=t[i+1],c=[s+2*(r-s)/3,n+2*(a-n)/3],d=[l+2*(r-l)/3,h+2*(a-h)/3];return e.push([[s,n],c,d,[l,h]]),e}#x(){if(this.isEmpty()){this.#I();return}this.#m();let{canvas:t,ctx:e}=this;e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t.width,t.height),this.#I();for(let i of this.bezierPath2D)e.stroke(i)}commit(){this.#r||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),this.#r=!0,this.div.classList.add("disabled"),this.#O(!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),this.enableEditMode())}#T(){if(this.#o)return;this.#o=new AbortController;let t=this._uiManager.combinedSignal(this.#o);this.canvas.addEventListener("pointerdown",this.canvasPointerdown.bind(this),{signal:t})}#S(){this.pointerdownAC?.abort(),this.pointerdownAC=null}canvasPointerdown(t){t.button!==0||!this.isInEditMode()||this.#r||(this.setInForeground(),t.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),this.#A(t.offsetX,t.offsetY))}canvasPointermove(t){t.preventDefault(),this.#w(t.offsetX,t.offsetY)}canvasPointerup(t){t.preventDefault(),this.#k(t)}canvasPointerleave(t){this.#k(t)}#k(t){this.#n?.abort(),this.#n=null,this.#T(),this.#i&&clearTimeout(this.#i),this.#i=setTimeout(()=>{this.#i=null,this.canvas.removeEventListener("contextmenu",yt)},10),this.#y(t.offsetX,t.offsetY),this.addToAnnotationStorage(),this.setInBackgroun
12d()}#R(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")}#C(){this.#c=new ResizeObserver(t=>{let e=t[0].contentRect;e.width&&e.height&&this.setDimensions(e.width,e.height)}),this.#c.observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{this.#c?.disconnect(),this.#c=null},{once:!0})}get isResizable(){return!this.isEmpty()&&this.#r}render(){if(this.div)return this.div;let t,e;this.width&&(t=this.x,e=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");let[i,s,n,r]=this.#b();if(this.setAt(i,s,0,0),this.setDims(n,r),this.#R(),this.width){let[a,l]=this.parentDimensions;this.setAspectRatio(this.width*a,this.height*l),this.setAt(t*a,e*l,this.width*a,this.height*l),this.#h=!0,this.#_(),this.setDims(this.width*a,this.height*l),this.#x(),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return this.#C(),this.div}#_(){if(!this.#h)return;let[t,e]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*e),this.#I()}setDimensions(t,e){let i=Math.round(t),s=Math.round(e);if(this.#d===i&&this.#a===s)return;this.#d=i,this.#a=s,this.canvas.style.visibility="hidden";let[n,r]=this.parentDimensions;this.width=t/n,this.height=e/r,this.fixAndSetPosition(),this.#r&&this.#L(t,e),this.#_(),this.#x(),this.canvas.style.visibility="visible",this.fixDims()}#L(t,e){let i=this.#H(),s=(t-i)/this.#e,n=(e-i)/this.#t;this.scaleFactor=Math.min(s,n)}#I(){let t=this.#H()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)}static#F(t){let e=new Path2D;for(let i=0,s=t.length;i<s;i++){let[n,r,a,l]=t[i];i===0&&e.moveTo(...n),e.bezierCurveTo(r[0],r[1],a[0],a[1],l[0],l[1])}return e}static#V(t,e,i){let[s,n,r,a]=e;switch(i){case 0:for(let l=0,h=t.length;l<h;l+=2)t[l]+=s,t[l+1]=a-t[l+1];break;case 90:for(let l=0,h=t.length;l<h;l+=2){let c=t[l];t[l]=t[l+1]+s,t[l+1]=c+n}break;case 180:for(let l=0,h=t.length;l<h;l+=2)t[l]=r-t[l],t[l+1]+=n;break;case 270:for(let l=0,h=t.length;l<h;l+=2){let c=t[l];t[l]=r-t[l+1],t[l+1]=a-c}break;default:throw new Error("Invalid rotation")}return t}static#j(t,e,i){let[s,n,r,a]=e;switch(i){case 0:for(let l=0,h=t.length;l<h;l+=2)t[l]-=s,t[l+1]=a-t[l+1];break;case 90:for(let l=0,h=t.length;l<h;l+=2){let c=t[l];t[l]=t[l+1]-n,t[l+1]=c-s}break;case 180:for(let l=0,h=t.length;l<h;l+=2)t[l]=r-t[l],t[l+1]-=n;break;case 270:for(let l=0,h=t.length;l<h;l+=2){let c=t[l];t[l]=a-t[l+1],t[l+1]=r-c}break;default:throw new Error("Invalid rotation")}return t}#N(t,e,i,s){let n=[],r=this.thickness/2,a=t*e+r,l=t*i+r;for(let h of this.paths){let c=[],d=[];for(let u=0,f=h.length;u<f;u++){let[p,g,b,m]=h[u];if(p[0]===m[0]&&p[1]===m[1]&&f===1){let E=t*p[0]+a,L=t*p[1]+l;c.push(E,L),d.push(E,L);break}let w=t*p[0]+a,y=t*p[1]+l,A=t*g[0]+a,v=t*g[1]+l,S=t*b[0]+a,P=t*b[1]+l,T=t*m[0]+a,_=t*m[1]+l;u===0&&(c.push(w,y),d.push(w,y)),c.push(A,v,S,P,T,_),d.push(A,v),u===f-1&&d.push(T,_)}n.push({bezier:o.#V(c,s,this.rotation),points:o.#V(d,s,this.rotation)})}return n}#B(){let t=1/0,e=-1/0,i=1/0,s=-1/0;for(let n of this.paths)for(let[r,a,l,h]of n){let c=M.bezierBoundingBox(...r,...a,...l,...h);t=Math.min(t,c[0]),i=Math.min(i,c[1]),e=Math.max(e,c[2]),s=Math.max(s,c[3])}return[t,i,e,s]}#H(){return this.#r?Math.ceil(this.thickness*this.parentScale):0}#O(t=!1){if(this.isEmpty())return;if(!this.#r){this.#x();return}let e=this.#B(),i=this.#H();this.#e=Math.max(z.MIN_SIZE,e[2]-e[0]),this.#t=Math.max(z.MIN_SIZE,e[3]-e[1]);let s=Math.ceil(i+this.#e*this.scaleFactor),n=Math.ceil(i+this.#t*this.scaleFactor),[r,a]=this.parentDimensions;this.width=s/r,this.height=n/a,this.setAspectRatio(s,n);let l=this.translationX,h=this.translationY;this.translationX=-e[0],this.translationY=-e[1],this.#_(),this.#x(),this.#d=s,this.#a=n,this.setDims(s,n);let c=t?i/this.scaleFactor/2:0;this.translate(l-this.translationX-c,h-this.translationY-c)}static deserialize(t,e,i){return C(this,null,function*(){if(t instanceof Be)return null;let s=yield le(o,this,"deserialize").call(this,t,e,i);s.thickness=t.thickness,s.color=M.makeHexColor(...t.color),s.opacity=t.opacity;let[n,r]=s.pageDimensions,a=s.width*n,l=s.height*r,h=s.parentScale,c=t.thickness/2;s.#r=!0,s.#d=Math.round(a),s.#a=Math.round(l);let{paths:d,rect:u,rotation:f}=t;for(let{bezier:g}of d){g=o.#j(g,u,f);let b=[];s.paths.push(b);let m=h*(g[0]-c),w=h*(g[1]-c);for(let A=2,v=g.length;A<v;A+=6){let S=h*(g[A]-c),P=h*(g[A+1]-c),T=h*(g[A+2]-c),_=h*(g[A+3]-c),E=h*(g[A+4]-c),L=h*(g[A+5]-c);b.push([[m,w],[S,P],[T,_],[E,L]]),m=E,w=L}let y=this.#F(b);s.bezierPath2D.push(y)}let p=s.#B();return s.#e=Math.max(z.MIN_SIZE,p[2]-p[0]),s.#t=Math.max(z.MIN_SIZE,p[3]-p[1]),s.#L(a,l),s})}serialize(){if(this.isEmpty())return null;let t=this.getRect(0,0),e=z._colorManager.convert(this.ctx.strokeStyle);return{annotationType:O.INK,color:e,thickness:this.thickness,opacity:this.opacity,paths:this.#N(this.scaleFactor/this.parentScale,this.translationX,this.translationY,t),pageIndex:this.pageIndex,rect:t,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}},jn=class o extends z{#t=null;#e=null;#i=null;#s=null;#r=null;#n="";#l=null;#h=null;#c=null;#o=!1;#d=!1;static _type="stamp";static _editorType=O.STAMP;constructor(t){super(vt(G({},t),{name:"stampEditor"})),this.#s=t.bitmapUrl,this.#r=t.bitmapFile}static initialize(t,e){z.initialize(t,e)}static get supportedTypes(){return B(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map(e=>`image/${e}`))}static get supportedTypesStr(){return B(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(t){return this.supportedTypes.includes(t)}static paste(t,e){e.pasteEditor(O.STAMP,{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(t){let e=t.get("hasAltText");return{hasAltText:e.get(!0)??0,hasNoAltText:e.get(!1)??0}}#a(t,e=!1){if(!t){this.remove();return}this.#t=t.bitmap,e||(this.#e=t.id,this.#o=t.isSvg),t.file&&(this.#n=t.file.name),this.#f()}#u(){if(this.#i=null,this._uiManager.enableWaiting(!1),!!this.#l){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#t){this._editToolbar.hide(),this._uiManager.editAltText(this,!0);return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#t){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}mlGuessAltText(t=null,e=!0){return C(this,null,function*(){if(this.hasAltTextData())return null;let{mlManager:i}=this._uiManager;if(!i)throw new Error("No ML.");if(!(yield i.isEnabledFor("altText")))throw new Error("ML isn't enabled for alt text.");let{data:s,width:n,height:r}=t||this.copyCanvas(null,null,!0).imageData,a=yield i.guess({name:"altText",request:{data:s,width:n,height:r,channels:s.length/(n*r)}});if(!a)throw new Error("No response from the AI service.");if(a.error)throw new Error("Error from the AI service.");if(a.cancel)return null;if(!a.output)throw new Error("No valid response from the AI service.");let l=a.output;return yield this.setGuessedAltText(l),e&&!this.hasAltTextData()&&(this.altTextData={alt:l,decorative:!1}),l})}#p(){if(this.#e){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#e).then(i=>this.#a(i,!0)).finally(()=>this.#u());return}if(this.#s){let i=this.#s;this.#s=null,this._uiManager.enableWaiting(!0),this.#i=this._uiManager.imageManager.getFromUrl(i).then(s=>this.#a(s)).finally(()=>this.#u());return}if(this.#r){let i=this.#r;this.#r=null,this._uiManager.enableWaiting(!0),this.#i=this._uiManager.imageManager.getFromFile(i).then(s=>this.#a(s)).finally(()=>this.#u());return}let t=document.createElement("input");t.type="file",t.accept=o.supportedTypesStr;let e=this._uiManager._signal;this.#i=new Promise(i=>{t.addEventListener("change",()=>C(this,null,function*(){if(!t.files||t.files.length===0)this.remove();else{this._uiManager.enableWaiting(!0);let s=yield this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#a(s)}i()}),{signal:e}),t.addEventListener("cancel",()=>{this.remove(),i()},{signal:e})}).finally(()=>this.#u()),t.click()}remove(){this.#e&&(this.#t=null,this._uiManager.imageManager.deleteId(this.#e),this.#l?.remove(),this.#l=null,this.#h?.disconnect(),this.#h=null,this.#c&&(clearTimeout(this.#c),this.#c=null)),super.remove()}rebuild(){if(!this.parent){this.#e&&this.#p();return}super.rebuild(),this.div!==null&&(this.#e&&this.#l===null&&this.#p(),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!(this.#i||this.#t||this.#s||this.#r||this.#e)}get isResizable(){return!0}
12render(){if(this.div)return this.div;let t,e;if(this.width&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.div.setAttribute("role","figure"),this.addAltTextButton(),this.#t?this.#f():this.#p(),this.width&&!this.annotationElementId){let[i,s]=this.parentDimensions;this.setAt(t*i,e*s,this.width*i,this.height*s)}return this.div}#f(){let{div:t}=this,{width:e,height:i}=this.#t,[s,n]=this.pageDimensions,r=.75;if(this.width)e=this.width*s,i=this.height*n;else if(e>r*s||i>r*n){let c=Math.min(r*s/e,r*n/i);e*=c,i*=c}let[a,l]=this.parentDimensions;this.setDims(e*a/s,i*l/n),this._uiManager.enableWaiting(!1);let h=this.#l=document.createElement("canvas");h.setAttribute("role","img"),this.addContainer(h),(!this._uiManager.useNewAltTextWhenAddingImage||!this._uiManager.useNewAltTextFlow||this.annotationElementId)&&(t.hidden=!1),this.#m(e,i),this.#w(),this.#d||(this.parent.addUndoableEditor(this),this.#d=!0),this._reportTelemetry({action:"inserted_image"}),this.#n&&h.setAttribute("aria-label",this.#n)}copyCanvas(t,e,i=!1){t||(t=224);let{width:s,height:n}=this.#t,r=new Me,a=this.#t,l=s,h=n,c=null;if(e){if(s>e||n>e){let S=Math.min(e/s,e/n);l=Math.floor(s*S),h=Math.floor(n*S)}c=document.createElement("canvas");let u=c.width=Math.ceil(l*r.sx),f=c.height=Math.ceil(h*r.sy);this.#o||(a=this.#b(u,f));let p=c.getContext("2d");p.filter=this._uiManager.hcmFilter;let g="white",b="#cfcfd8";this._uiManager.hcmFilter!=="none"?b="black":window.matchMedia?.("(prefers-color-scheme: dark)").matches&&(g="#8f8f9d",b="#42414d");let m=15,w=m*r.sx,y=m*r.sy,A=new OffscreenCanvas(w*2,y*2),v=A.getContext("2d");v.fillStyle=g,v.fillRect(0,0,w*2,y*2),v.fillStyle=b,v.fillRect(0,0,w,y),v.fillRect(w,y,w,y),p.fillStyle=p.createPattern(A,"repeat"),p.fillRect(0,0,u,f),p.drawImage(a,0,0,a.width,a.height,0,0,u,f)}let d=null;if(i){let u,f;if(r.symmetric&&a.width<t&&a.height<t)u=a.width,f=a.height;else if(a=this.#t,s>t||n>t){let b=Math.min(t/s,t/n);u=Math.floor(s*b),f=Math.floor(n*b),this.#o||(a=this.#b(u,f))}let g=new OffscreenCanvas(u,f).getContext("2d",{willReadFrequently:!0});g.drawImage(a,0,0,a.width,a.height,0,0,u,f),d={width:u,height:f,data:g.getImageData(0,0,u,f).data}}return{canvas:c,width:l,height:h,imageData:d}}#g(t,e){let[i,s]=this.parentDimensions;this.width=t/i,this.height=e/s,this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,this.#c!==null&&clearTimeout(this.#c);let n=200;this.#c=setTimeout(()=>{this.#c=null,this.#m(t,e)},n)}#b(t,e){let{width:i,height:s}=this.#t,n=i,r=s,a=this.#t;for(;n>2*t||r>2*e;){let l=n,h=r;n>2*t&&(n=n>=16384?Math.floor(n/2)-1:Math.ceil(n/2)),r>2*e&&(r=r>=16384?Math.floor(r/2)-1:Math.ceil(r/2));let c=new OffscreenCanvas(n,r);c.getContext("2d").drawImage(a,0,0,l,h,0,0,n,r),a=c.transferToImageBitmap()}return a}#m(t,e){let i=new Me,s=Math.ceil(t*i.sx),n=Math.ceil(e*i.sy),r=this.#l;if(!r||r.width===s&&r.height===n)return;r.width=s,r.height=n;let a=this.#o?this.#t:this.#b(s,n),l=r.getContext("2d");l.filter=this._uiManager.hcmFilter,l.drawImage(a,0,0,a.width,a.height,0,0,s,n)}getImageForAltText(){return this.#l}#A(t){if(t){if(this.#o){let s=this._uiManager.imageManager.getSvgUrl(this.#e);if(s)return s}let e=document.createElement("canvas");return{width:e.width,height:e.height}=this.#t,e.getContext("2d").drawImage(this.#t,0,0),e.toDataURL()}if(this.#o){let[e,i]=this.pageDimensions,s=Math.round(this.width*e*$t.PDF_TO_CSS_UNITS),n=Math.round(this.height*i*$t.PDF_TO_CSS_UNITS),r=new OffscreenCanvas(s,n);return r.getContext("2d").drawImage(this.#t,0,0,this.#t.width,this.#t.height,0,0,s,n),r.transferToImageBitmap()}return structuredClone(this.#t)}#w(){this._uiManager._signal&&(this.#h=new ResizeObserver(t=>{let e=t[0].contentRect;e.width&&e.height&&this.#g(e.width,e.height)}),this.#h.observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{this.#h?.disconnect(),this.#h=null},{once:!0}))}static deserialize(t,e,i){return C(this,null,function*(){let s=null;if(t instanceof Ri){let{data:{rect:p,rotation:g,id:b,structParent:m,popupRef:w},container:y,parent:{page:{pageNumber:A}}}=t,v=y.querySelector("canvas"),S=i.imageManager.getFromCanvas(y.id,v);v.remove();let P=(yield e._structTree.getAriaAttributes(`${Wn}${b}`))?.get("aria-label")||"";s=t={annotationType:O.STAMP,bitmapId:S.id,bitmap:S.bitmap,pageIndex:A-1,rect:p.slice(0),rotation:g,id:b,deleted:!1,accessibilityData:{decorative:!1,altText:P},isSvg:!1,structParent:m,popupRef:w}}let n=yield le(o,this,"deserialize").call(this,t,e,i),{rect:r,bitmap:a,bitmapUrl:l,bitmapId:h,isSvg:c,accessibilityData:d}=t;h&&i.imageManager.isValidId(h)?(n.#e=h,a&&(n.#t=a)):n.#s=l,n.#o=c;let[u,f]=n.pageDimensions;return n.width=(r[2]-r[0])/u,n.height=(r[3]-r[1])/f,n.annotationElementId=t.id||null,d&&(n.altTextData=d),n._initialData=s,n.#d=!!s,n})}serialize(t=!1,e=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let i={annotationType:O.STAMP,bitmapId:this.#e,pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:this.#o,structTreeParentId:this._structTreeParentId};if(t)return i.bitmapUrl=this.#A(!0),i.accessibilityData=this.serializeAltText(!0),i;let{decorative:s,altText:n}=this.serializeAltText(!1);if(!s&&n&&(i.accessibilityData={type:"Figure",alt:n}),this.annotationElementId){let a=this.#E(i);if(a.isSame)return null;a.isSameAltText?delete i.accessibilityData:i.accessibilityData.structParent=this._initialData.structParent??-1}if(i.id=this.annotationElementId,e===null)return i;e.stamps||=new Map;let r=this.#o?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(!e.stamps.has(this.#e))e.stamps.set(this.#e,{area:r,serialized:i}),i.bitmap=this.#A(!1);else if(this.#o){let a=e.stamps.get(this.#e);r>a.area&&(a.area=r,a.serialized.bitmap.close(),a.serialized.bitmap=this.#A(!1))}return i}#E(t){let{rect:e,pageIndex:i,accessibilityData:{altText:s}}=this._initialData,n=t.rect.every((l,h)=>Math.abs(l-e[h])<1),r=t.pageIndex===i,a=(t.accessibilityData?.alt||"")===s;return{isSame:n&&r&&a,isSameAltText:a}}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}},fl=(()=>{class o{#t;#e=!1;#i=null;#s=null;#r=null;#n=new Map;#l=!1;#h=!1;#c=!1;#o=null;#d=null;#a;static _initialized=!1;static#u=new Map([Nn,Hn,jn,Hi].map(e=>[e._editorType,e]));constructor({uiManager:e,pageIndex:i,div:s,structTreeLayer:n,accessibilityManager:r,annotationLayer:a,drawLayer:l,textLayer:h,viewport:c,l10n:d}){let u=[...o.#u.values()];if(!o._initialized){o._initialized=!0;for(let f of u)f.initialize(d,e)}
12e.registerEditorTypes(u),this.#a=e,this.pageIndex=i,this.div=s,this.#t=r,this.#i=a,this.viewport=c,this.#o=h,this.drawLayer=l,this._structTree=n,this.#a.addLayer(this)}get isEmpty(){return this.#n.size===0}get isInvisible(){return this.isEmpty&&this.#a.getMode()===O.NONE}updateToolbar(e){this.#a.updateToolbar(e)}updateMode(e=this.#a.getMode()){switch(this.#m(),e){case O.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case O.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case O.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:i}=this.div;for(let s of o.#u.values())i.toggle(`${s._type}Editing`,e===s._editorType);this.div.hidden=!1}hasTextLayer(e){return e===this.#o?.div}addInkEditorIfNeeded(e){if(this.#a.getMode()!==O.INK)return;if(!e){for(let s of this.#n.values())if(s.isEmpty()){s.setInBackground();return}}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}setEditingState(e){this.#a.setEditingState(e)}addCommands(e){this.#a.addCommands(e)}toggleDrawing(e=!1){this.div.classList.toggle("drawing",!e)}togglePointerEvents(e=!1){this.div.classList.toggle("disabled",!e)}toggleAnnotationLayerPointerEvents(e=!1){this.#i?.div.classList.toggle("disabled",!e)}enable(){return C(this,null,function*(){this.div.tabIndex=0,this.togglePointerEvents(!0);let e=new Set;for(let s of this.#n.values())s.enableEditing(),s.show(!0),s.annotationElementId&&(this.#a.removeChangedExistingAnnotation(s),e.add(s.annotationElementId));if(!this.#i)return;let i=this.#i.getEditableAnnotations();for(let s of i){if(s.hide(),this.#a.isDeletedAnnotationElement(s.data.id)||e.has(s.data.id))continue;let n=yield this.deserialize(s);n&&(this.addOrRebuild(n),n.enableEditing())}})}disable(){this.#c=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1);let e=new Map,i=new Map;for(let n of this.#n.values())if(n.disableEditing(),!!n.annotationElementId){if(n.serialize()!==null){e.set(n.annotationElementId,n);continue}else i.set(n.annotationElementId,n);this.getEditableAnnotation(n.annotationElementId)?.show(),n.remove()}if(this.#i){let n=this.#i.getEditableAnnotations();for(let r of n){let{id:a}=r.data;if(this.#a.isDeletedAnnotationElement(a))continue;let l=i.get(a);if(l){l.resetAnnotationElement(r),l.show(!1),r.show();continue}l=e.get(a),l&&(this.#a.addChangedExistingAnnotation(l),l.renderAnnotationElement(r)&&l.show(!1)),r.show()}}this.#m(),this.isEmpty&&(this.div.hidden=!0);let{classList:s}=this.div;for(let n of o.#u.values())s.remove(`${n._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),this.#c=!1}getEditableAnnotation(e){return this.#i?.getEditableAnnotation(e)||null}setActiveEditor(e){this.#a.getActive()!==e&&this.#a.setActiveEditor(e)}enableTextSelection(){if(this.div.tabIndex=-1,this.#o?.div&&!this.#d){this.#d=new AbortController;let e=this.#a.combinedSignal(this.#d);this.#o.div.addEventListener("pointerdown",this.#p.bind(this),{signal:e}),this.#o.div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,this.#o?.div&&this.#d&&(this.#d.abort(),this.#d=null,this.#o.div.classList.remove("highlighting"))}#p(e){this.#a.unselectAll();let{target:i}=e;if(i===this.#o.div||(i.getAttribute("role")==="img"||i.classList.contains("endOfContent"))&&this.#o.div.contains(i)){let{isMac:s}=ot.platform;if(e.button!==0||e.ctrlKey&&s)return;this.#a.showAllEditors("highlight",!0,!0),this.#o.div.classList.add("free"),this.toggleDrawing(),Hi.startHighlighting(this,this.#a.direction==="ltr",{target:this.#o.div,x:e.x,y:e.y}),this.#o.div.addEventListener("pointerup",()=>{this.#o.div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:this.#a._signal}),e.preventDefault()}}enableClick(){if(this.#s)return;this.#s=new AbortController;let e=this.#a.combinedSignal(this.#s);this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:e}),this.div.addEventListener("pointerup",this.pointerup.bind(this),{signal:e})}disableClick(){this.#s?.abort(),this.#s=null}attach(e){this.#n.set(e.id,e);let{annotationElementId:i}=e;i&&this.#a.isDeletedAnnotationElement(i)&&this.#a.removeDeletedAnnotationElement(e)}detach(e){this.#n.delete(e.id),this.#t?.removePointerInTextLayer(e.contentDiv),!this.#c&&e.annotationElementId&&this.#a.addDeletedAnnotationElement(e)}remove(e){this.detach(e),this.#a.removeEditor(e),e.div.remove(),e.isAttachedToDOM=!1,this.#h||this.addInkEditorIfNeeded(!1)}changeParent(e){e.parent!==this&&(e.parent&&e.annotationElementId&&(this.#a.addDeletedAnnotationElement(e.annotationElementId),z.deleteAnnotationElement(e),e.annotationElementId=null),this.attach(e),e.parent?.detach(e),e.setParent(this),e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}
12add(e){if(!(e.parent===this&&e.isAttachedToDOM)){if(this.changeParent(e),this.#a.addEditor(e),this.attach(e),!e.isAttachedToDOM){let i=e.render();this.div.append(i),e.isAttachedToDOM=!0}e.fixAndSetPosition(),e.onceAdded(),this.#a.addToAnnotationStorage(e),e._reportTelemetry(e.telemetryInitialData)}}moveEditorInDOM(e){if(!e.isAttachedToDOM)return;let{activeElement:i}=document;e.div.contains(i)&&!this.#r&&(e._focusEventsAllowed=!1,this.#r=setTimeout(()=>{this.#r=null,e.div.contains(document.activeElement)?e._focusEventsAllowed=!0:(e.div.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this.#a._signal}),i.focus())},0)),e._structTreeParentId=this.#t?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addOrRebuild(e){e.needsToBeRebuilt()?(e.parent||=this,e.rebuild(),e.show()):this.add(e)}addUndoableEditor(e){let i=()=>e._uiManager.rebuild(e),s=()=>{e.remove()};this.addCommands({cmd:i,undo:s,mustExec:!1})}getNextId(){return this.#a.getId()}get#f(){return o.#u.get(this.#a.getMode())}combinedSignal(e){return this.#a.combinedSignal(e)}#g(e){let i=this.#f;return i?new i.prototype.constructor(e):null}canCreateNewEmptyEditor(){return this.#f?.canCreateNewEmptyEditor()}pasteEditor(e,i){this.#a.updateToolbar(e),this.#a.updateMode(e);let{offsetX:s,offsetY:n}=this.#b(),r=this.getNextId(),a=this.#g(G({parent:this,id:r,x:s,y:n,uiManager:this.#a,isCentered:!0},i));a&&this.add(a)}deserialize(e){return C(this,null,function*(){return(yield o.#u.get(e.annotationType??e.annotationEditorType)?.deserialize(e,this,this.#a))||null})}createAndAddNewEditor(e,i,s={}){let n=this.getNextId(),r=this.#g(G({parent:this,id:n,x:e.offsetX,y:e.offsetY,uiManager:this.#a,isCentered:i},s));return r&&this.add(r),r}#b(){let{x:e,y:i,width:s,height:n}=this.div.getBoundingClientRect(),r=Math.max(0,e),a=Math.max(0,i),l=Math.min(window.innerWidth,e+s),h=Math.min(window.innerHeight,i+n),c=(r+l)/2-e,d=(a+h)/2-i,[u,f]=this.viewport.rotation%180===0?[c,d]:[d,c];return{offsetX:u,offsetY:f}}addNewEditor(){this.createAndAddNewEditor(this.#b(),!0)}setSelected(e){this.#a.setSelected(e)}toggleSelected(e){this.#a.toggleSelected(e)}unselect(e){this.#a.unselect(e)}pointerup(e){let{isMac:i}=ot.platform;if(!(e.button!==0||e.ctrlKey&&i)&&e.target===this.div&&this.#l){if(this.#l=!1,!this.#e){this.#e=!0;return}if(this.#a.getMode()===O.STAMP){this.#a.unselectAll();return}this.createAndAddNewEditor(e,!1)}}pointerdown(e){if(this.#a.getMode()===O.HIGHLIGHT&&this.enableTextSelection(),this.#l){this.#l=!1;return}let{isMac:i}=ot.platform;if(e.button!==0||e.ctrlKey&&i||e.target!==this.div)return;this.#l=!0;let s=this.#a.getActive();this.#e=!s||s.isEmpty()}findNewParent(e,i,s){let n=this.#a.findParent(i,s);return n===null||n===this?!1:(n.changeParent(e),!0)}destroy(){this.#a.getActive()?.parent===this&&(this.#a.commitOrRemove(),this.#a.setActiveEditor(null)),this.#r&&(clearTimeout(this.#r),this.#r=null);for(let e of this.#n.values())this.#t?.removePointerInTextLayer(e.contentDiv),e.setParent(null),e.isAttachedToDOM=!1,e.div.remove();this.div=null,this.#n.clear(),this.#a.removeLayer(this)}#m(){this.#h=!0;for(let e of this.#n.values())e.isEmpty()&&e.remove();this.#h=!1}render({viewport:e}){this.viewport=e,te(this.div,e);for(let i of this.#a.getEditors(this.pageIndex))this.add(i),i.rebuild();this.updateMode()}update({viewport:e}){this.#a.commitOrRemove(),this.#m();let i=this.viewport.rotation,s=e.rotation;if(this.viewport=e,te(this.div,{rotation:s}),i!==s)for(let n of this.#n.values())n.rotate(s);this.addInkEditorIfNeeded(!1)}get pageDimensions(){let{pageWidth:e,pageHeight:i}=this.viewport.rawDims;return[e,i]}get scale(){return this.#a.viewParameters.realScale}}return o})(),Vn=class o{#t=null;#e=0;#i=new Map;#s=new Map;constructor({pageIndex:t}){this.pageIndex=t}setParent(t){if(!this.#t){this.#t=t;return}if(this.#t!==t){if(this.#i.size>0)for(let e of this.#i.values())e.remove(),t.append(e);this.#t=t}}static get _svgFactory(){return B(this,"_svgFactory",new Ne)}static#r(t,{x:e=0,y:i=0,width:s=1,height:n=1}={}){let{style:r}=t;r.top=`${100*i}%`,r.left=`${100*e}%`,r.width=`${100*s}%`,r.height=`${100*n}%`}#n(t){let e=o._svgFactory.create(1,1,!0);return this.#t.append(e),e.setAttribute("aria-hidden",!0),o.#r(e,t),e}#l(t,e){let i=o._svgFactory.createElement("clipPath");t.append(i);let s=`clip_${e}`;i.setAttribute("id",s),i.setAttribute("clipPathUnits","objectBoundingBox");let n=o._svgFactory.createElement("use");return i.append(n),n.setAttribute("href",`#${e}`),n.classList.add("clip"),s}draw(t,e,i,s=!1){let n=this.#e++,r=this.#n(t.box);r.classList.add(...t.classNamesForDrawing);let a=o._svgFactory.createElement("defs");r.append(a);let l=o._svgFactory.createElement("path");a.append(l);let h=`path_p${this.pageIndex}_${n}`;l.setAttribute("id",h),l.setAttribute("d",t.toSVGPath()),s&&this.#s.set(n,l);let c=this.#l(a,h),d=o._svgFactory.createElement("use");return r.append(d),r.setAttribute("fill",e),r.setAttribute("fill-opacity",i),d.setAttribute("href",`#${h}`),this.#i.set(n,r),{id:n,clipPathId:`url(#${c})`}}drawOutline(t){let e=this.#e++,i=this.#n(t.box);i.classList.add(...t.classNamesForOutlining);let s=o._svgFactory.createElement("defs");i.append(s);let n=o._svgFactory.createElement("path");s.append(n);let r=`path_p${this.pageIndex}_${e}`;n.setAttribute("id",r),n.setAttribute("d",t.toSVGPath()),n.setAttribute("vector-effect","non-scaling-stroke");let a;if(t.mustRemoveSelfIntersections){let c=o._svgFactory.createElement("mask");s.append(c),a=`mask_p${this.pageIndex}_${e}`,c.setAttribute("id",a),c.setAttribute("maskUnits","objectBoundingBox");let d=o._svgFactory.createElement("rect");c.append(d),d.setAttribute("width","1"),d.setAttribute("height","1"),d.setAttribute("fill","white");let u=o._svgFactory.createElement("use");c.append(u),u.setAttribute("href",`#${r}`),u.setAttribute("stroke","none"),u.setAttribute("fill","black"),u.setAttribute("fill-rule","nonzero"),u.classList.add("mask")}let l=o._svgFactory.createElement("use");i.append(l),l.setAttribute("href",`#${r}`),a&&l.setAttribute("mask",`url(#${a})`);let h=l.cloneNode();return i.append(h),l.classList.add("mainOutline"),h.classList.add("secondaryOutline"),this.#i.set(e,i),e}finalizeLine(t,e){let i=this.#s.get(t);this.#s.delete(t),this.updateBox(t,e.box),i.setAttribute("d",e.toSVGPath())}updateLine(t,e){this.#i.get(t).firstChild.firstChild.setAttribute("d",e.toSVGPath())}updatePath(t,e){this.#s.get(t).setAttribute("d",e.toSVGPath())}updateBox(t,e){o.#r(this.#i.get(t),e)}show(t,e){this.#i.get(t).classList.toggle("hidden",!e)}rotate(t,e){this.#i.get(t).setAttribute("data-main-rotation",e)}changeColor(t,e){this.#i.get(t).setAttribute("fill",e)}
12changeOpacity(t,e){this.#i.get(t).setAttribute("fill-opacity",e)}addClass(t,e){this.#i.get(t).classList.add(e)}removeClass(t,e){this.#i.get(t).classList.remove(e)}getSVGRoot(t){return this.#i.get(t)}remove(t){this.#s.delete(t),this.#t!==null&&(this.#i.get(t).remove(),this.#i.delete(t))}destroy(){this.#t=null;for(let t of this.#i.values())t.remove();this.#i.clear(),this.#s.clear()}};var pl=R.AbortException,gl=R.AnnotationEditorLayer,ml=R.AnnotationEditorParamsType,Kn=R.AnnotationEditorType,bl=R.AnnotationEditorUIManager,Al=R.AnnotationLayer,_l=R.AnnotationMode,wl=R.ColorPicker,yl=R.DOMSVGFactory,vl=R.DrawLayer,El=R.FeatureTest,Yn=R.GlobalWorkerOptions,xl=R.ImageKind,Cl=R.InvalidPDFException,Sl=R.MissingPDFException,Pl=R.OPS,Tl=R.OutputScale,Ll=R.PDFDataRangeTransport,Ml=R.PDFDateString,kl=R.PDFWorker,Il=R.PasswordResponses,Rl=R.PermissionFlag,Ol=R.PixelsPerInch,Dl=R.RenderingCancelledException,Nl=R.TextLayer,Fl=R.UnexpectedResponseException,Bl=R.Util,Qn=R.VerbosityLevel,Hl=R.XfaLayer,jl=R.build,Vl=R.createValidAbsoluteUrl,zl=R.fetchData,Jn=R.getDocument,Wl=R.getFilenameFromUrl,Ul=R.getPdfFilenameFromUrl,$l=R.getXfaPageViewport,Gl=R.isDataScheme,Xl=R.isPdfFile,ql=R.noContextMenu,Kl=R.normalizeUnicode,Yl=R.setLayerDimensions,Ql=R.shadow,Ve=R.version;var jr={};Wr(jr,{AnnotationLayerBuilder:()=>Bc,DownloadManager:()=>Hc,EventBus:()=>jc,FindState:()=>Vc,GenericL10n:()=>Dr,LinkTarget:()=>ae,PDFFindController:()=>Nr,PDFHistory:()=>zc,PDFLinkService:()=>Fr,PDFPageView:()=>Wc,PDFScriptingManager:()=>Uc,PDFSinglePageViewer:()=>Br,PDFViewer:()=>Hr,ProgressBar:()=>$c,RenderingStates:()=>Gc,ScrollMode:()=>Xc,SimpleLinkService:()=>qc,SpreadMode:()=>Kc,StructTreeLayerBuilder:()=>Yc,TextLayerBuilder:()=>Qc,XfaLayerBuilder:()=>Jc,parseQueryString:()=>Zc});var We={};We.d=(o,t)=>{for(var e in t)We.o(t,e)&&!We.o(o,e)&&Object.defineProperty(o,e,{enumerable:!0,get:t[e]})};We.o=(o,t)=>Object.prototype.hasOwnProperty.call(o,t);var Y=globalThis.pdfjsViewer={};We.d(Y,{AnnotationLayerBuilder:()=>ss,DownloadManager:()=>dr,EventBus:()=>ns,FindState:()=>Xt,GenericL10n:()=>_e,LinkTarget:()=>se,PDFFindController:()=>hr,PDFHistory:()=>vr,PDFLinkService:()=>es,PDFPageView:()=>cs,PDFScriptingManager:()=>kr,PDFSinglePageViewer:()=>Or,PDFViewer:()=>ds,ProgressBar:()=>lr,RenderingStates:()=>J,ScrollMode:()=>j,SimpleLinkService:()=>Ge,SpreadMode:()=>dt,StructTreeLayerBuilder:()=>os,TextLayerBuilder:()=>ls,XfaLayerBuilder:()=>hs,parseQueryString:()=>us});var Jl="auto",ho=1,Ma=1.1,Zl=.1,th=10,Zn=0,eh=1.25,ka=40,Ia=5,J={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},me={UNKNOWN:0,NORMAL:1,CHANGING:2,FULLSCREEN:3};var Lt={DISABLE:0,ENABLE:1,ENABLE_PERMISSIONS:2},j={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3},dt={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2};function co(o,t,e=!1){let i=o.offsetParent;if(!i){console.error("offsetParent is not set -- cannot scroll");return}let s=o.offsetTop+o.clientTop,n=o.offsetLeft+o.clientLeft;for(;i.clientHeight===i.scrollHeight&&i.clientWidth===i.scrollWidth||e&&(i.classList.contains("markedContent")||getComputedStyle(i).overflow==="hidden");)if(s+=i.offsetTop,n+=i.offsetLeft,i=i.offsetParent,!i)return;t&&(t.top!==void 0&&(s+=t.top),t.left!==void 0&&(n+=t.left,i.scrollLeft=n)),i.scrollTop=s}function ih(o,t,e=void 0){let i=function(r){n||(n=window.requestAnimationFrame(function(){n=null;let l=o.scrollLeft,h=s.lastX;l!==h&&(s.right=l>h),s.lastX=l;let c=o.scrollTop,d=s.lastY;c!==d&&(s.down=c>d),s.lastY=c,t(s)}))},s={right:!0,down:!0,lastX:o.scrollLeft,lastY:o.scrollTop,_eventHandler:i},n=null;return o.addEventListener("scroll",i,{useCapture:!0,signal:e}),e?.addEventListener("abort",()=>window.cancelAnimationFrame(n),{once:!0}),s}function us(o){let t=new Map;for(let[e,i]of new URLSearchParams(o))t.set(e.toLowerCase(),i);return t}var Ra=/[\x00-\x1F]/g;function Ue(o,t=!1){return Ra.test(o)?t?o.replaceAll(Ra,e=>e==="\0"?"":" "):o.replaceAll("\0",""):o}function $e(o,t,e=0){let i=e,s=o.length-1;if(s<0||!t(o[s]))return o.length;if(t(o[i]))return i;for(;i<s;){let n=i+s>>1,r=o[n];t(r)?s=n:i=n+1}return i}function Oa(o){if(Math.floor(o)===o)return[o,1];let t=1/o,e=8;if(t>e)return[1,e];if(Math.floor(t)===t)return[1,t];let i=o>1?t:o,s=0,n=1,r=1,a=1;for(;;){let h=s+r,c=n+a;if(c>e)break;i<=h/c?(r=h,a=c):(s=h,n=c)}let l;return i-s/n<r/a-i?l=i===o?[s,n]:[n,s]:l=i===o?[r,a]:[a,r],l}function qi(o,t){return o-o%t}function sh(o,t,e){if(o<2)return o;let i=t[o].div,s=i.offsetTop+i.clientTop;s>=e&&(i=t[o-1].div,s=i.offsetTop+i.clientTop);for(let n=o-2;n>=0&&(i=t[n].div,!(i.offsetTop+i.clientTop+i.clientHeight<=s));--n)o=n;return o}function nh({scrollEl:o,views:t,sortByVisibility:e=!1,horizontal:i=!1,rtl:s=!1}
12){let n=o.scrollTop,r=n+o.clientHeight,a=o.scrollLeft,l=a+o.clientWidth;function h(w){let y=w.div;return y.offsetTop+y.clientTop+y.clientHeight>n}function c(w){let y=w.div,A=y.offsetLeft+y.clientLeft,v=A+y.clientWidth;return s?A<l:v>a}let d=[],u=new Set,f=t.length,p=$e(t,i?c:h);p>0&&p<f&&!i&&(p=sh(p,t,n));let g=i?l:-1;for(let w=p;w<f;w++){let y=t[w],A=y.div,v=A.offsetLeft+A.clientLeft,S=A.offsetTop+A.clientTop,P=A.clientWidth,T=A.clientHeight,_=v+P,E=S+T;if(g===-1)E>=r&&(g=E);else if((i?v:S)>g)break;if(E<=n||S>=r||_<=a||v>=l)continue;let L=Math.max(0,n-S)+Math.max(0,E-r),V=Math.max(0,a-v)+Math.max(0,_-l),H=(T-L)/T,F=(P-V)/P,W=H*F*100|0;d.push({id:y.id,x:v,y:S,view:y,percent:W,widthPercent:F*100|0}),u.add(y.id)}let b=d[0],m=d.at(-1);return e&&d.sort(function(w,y){let A=w.percent-y.percent;return Math.abs(A)>.001?-A:w.id-y.id}),{first:b,last:m,views:d,ids:u}}function uo(o){return Number.isInteger(o)&&o%90===0}function rh(o){return Number.isInteger(o)&&Object.values(j).includes(o)&&o!==j.UNKNOWN}function ah(o){return Number.isInteger(o)&&Object.values(dt).includes(o)&&o!==dt.UNKNOWN}function Da(o){return o.width<=o.height}var rd=new Promise(function(o){window.requestAnimationFrame(o)}),oh=document.documentElement.style;function lh(o,t,e){return Math.min(Math.max(o,t),e)}var lr=class{#t=null;#e=null;#i=0;#s=null;#r=!0;constructor(t){this.#t=t.classList,this.#s=t.style}get percent(){return this.#i}set percent(t){if(this.#i=lh(t,0,100),isNaN(t)){this.#t.add("indeterminate");return}this.#t.remove("indeterminate"),this.#s.setProperty("--progressBar-percent",`${this.#i}%`)}setWidth(t){if(!t)return;let i=t.parentNode.offsetWidth-t.offsetWidth;i>0&&this.#s.setProperty("--progressBar-end-offset",`${i}px`)}setDisableAutoFetch(t=5e3){this.#i===100||isNaN(this.#i)||(this.#e&&clearTimeout(this.#e),this.show(),this.#e=setTimeout(()=>{this.#e=null,this.hide()},t))}hide(){this.#r&&(this.#r=!1,this.#t.add("hidden"))}show(){this.#r||(this.#r=!0,this.#t.remove("hidden"))}};function hh(o){let t=j.VERTICAL,e=dt.NONE;switch(o){case"SinglePage":t=j.PAGE;break;case"OneColumn":break;case"TwoPageLeft":t=j.PAGE;case"TwoColumnLeft":e=dt.ODD;break;case"TwoPageRight":t=j.PAGE;case"TwoColumnRight":e=dt.EVEN;break}return{scrollMode:t,spreadMode:e}}var Ki=(function(){let o=document.createElement("div");return o.style.width="round(down, calc(1.6666666666666665 * 792px), 1px)",o.style.width==="calc(1320px)"?Math.fround:t=>t})(),xt={SPACE:0,ALPHA_LETTER:1,PUNCT:2,HAN_LETTER:3,KATAKANA_LETTER:4,HIRAGANA_LETTER:5,HALFWIDTH_KATAKANA_LETTER:6,THAI_LETTER:7};function ch(o){return o<11904}function dh(o){return(o&65408)===0}function uh(o){return o>=97&&o<=122||o>=65&&o<=90}function fh(o){return o>=48&&o<=57}function ph(o){return o===32||o===9||o===13||o===10}function gh(o){return o>=13312&&o<=40959||o>=63744&&o<=64255}function mh(o){return o>=12448&&o<=12543}function bh(o){return o>=12352&&o<=12447}function Ah(o){return o>=65376&&o<=65439}function _h(o){return(o&65408)===3584}function Yi(o){return ch(o)?dh(o)?ph(o)?xt.SPACE:uh(o)||fh(o)||o===95?xt.ALPHA_LETTER:xt.PUNCT:_h(o)?xt.THAI_LETTER:o===160?xt.SPACE:xt.ALPHA_LETTER:gh(o)?xt.HAN_LETTER:mh(o)?xt.KATAKANA_LETTER:bh(o)?xt.HIRAGANA_LETTER:Ah(o)?xt.HALFWIDTH_KATAKANA_LETTER:xt.ALPHA_LETTER}var Na;function wh(){return Na||="\xA0\xA8\xAA\xAF\xB2-\xB5\xB8-\xBA\xBC-\xBE\u0132-\u0133\u013F-\u0140\u0149\u017F\u01C4-\u01CC\u01F1-\u01F3\u02B0-\u02B8\u02D8-\u02DD\u02E0-\u02E4\u0374\u037A\u037E\u0384-\u0385\u0387\u03D0-\u03D6\u03F0-\u03F2\u03F4-\u03F5\u03F9\u0587\u0675-\u0678\u0958-\u095F\u09DC-\u09DD\u09DF\u0A33\u0A36\u0A59-\u0A5B\u0A5E\u0B5C-\u0B5D\u0E33\u0EB3\u0EDC-\u0EDD\u0F0C\u0F43\u0F4D\u0F52\u0F57\u0F5C\u0F69\u10FC\u1D2C-\u1D2E\u1D30-\u1D3A\u1D3C-\u1D4D\u1D4F-\u1D6A\u1D78\u1D9B-\u1DBF\u1E9A-\u1E9B\u1F71\u1F73\u1F75\u1F77\u1F79\u1F7B\u1F7D\u1FBB\u1FBD-\u1FC1\u1FC9\u1FCB\u1FCD-\u1FCF\u1FD3\u1FDB\u1FDD-\u1FDF\u1FE3\u1FEB\u1FED-\u1FEF\u1FF9\u1FFB\u1FFD-\u1FFE\u2000-\u200A\u2011\u2017\u2024-\u2026\u202F\u2033-\u2034\u2036-\u2037\u203C\u203E\u2047-\u2049\u2057\u205F\u2070-\u2071\u2074-\u208E\u2090-\u209C\u20A8\u2100-\u2103\u2105-\u2107\u2109-\u2113\u2115-\u2116\u2119-\u211D\u2120-\u2122\u2124\u2126\u2128\u212A-\u212D\u212F-\u2131\u2133-\u2139\u213B-\u2140\u2145-\u2149\u2150-\u217F\u2189\u222C-\u222D\u222F-\u2230\u2329-\u232A\u2460-\u24EA\u2A0C\u2A74-\u2A76\u2ADC\u2C7C-\u2C7D\u2D6F\u2E9F\u2EF3\u2F00-\u2FD5\u3000\u3036\u3038-\u303A\u309B-\u309C\u309F\u30FF\u3131-\u318E\u3192-\u319F\u3200-\u321E\u3220-\u3247\u3250-\u327E\u3280-\u33FF\uA69C-\uA69D\uA770\uA7F2-\uA7F4\uA7F8-\uA7F9\uAB5C-\uAB5F\uAB69\uF900-\uFA0D\uFA10\uFA12\uFA15-\uFA1E\uFA20\uFA22\uFA25-\uFA26\uFA2A-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB36\uFB38-\uFB3C\uFB3E\uFB40-\uFB41\uFB43-\uFB44\uFB46-\uFBB1\uFB
12D3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFC\uFE10-\uFE19\uFE30-\uFE44\uFE47-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFE70-\uFE72\uFE74\uFE76-\uFEFC\uFF01-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\uFFE0-\uFFE6",Na}var Xt={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3},yh=250,vh=-50,Eh=-400,Fa={"\u2010":"-","\u2018":"'","\u2019":"'","\u201A":"'","\u201B":"'","\u201C":'"',"\u201D":'"',"\u201E":'"',"\u201F":'"',"\xBC":"1/4","\xBD":"1/2","\xBE":"3/4"},Ba=new Set([12441,12442,2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,3642,3770,3972,4153,4154,5908,5940,6098,6752,6980,7082,7083,7154,7155,11647,43014,43052,43204,43347,43456,43766,44013,3158,3953,3954,3962,3963,3964,3965,3968,3956]),Ha,xh=new RegExp("\\p{M}+","gu"),Ch=new RegExp("([.*+?^${}()|[\\]\\\\])|(\\p{P})|(\\s+)|(\\p{M})|(\\p{L})","gu"),Sh=new RegExp("([^\\p{M}])\\p{M}*$","u"),Ph=new RegExp("^\\p{M}*([^\\p{M}])","u"),Th=/[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g,ja=new Map,Lh="[\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f]",Va=new Map,tr=null,er=null;function ir(o){let t=[],e;for(;(e=Th.exec(o))!==null;){let{index:f}=e;for(let p of e[0]){let g=ja.get(p);g||(g=p.normalize("NFD").length,ja.set(p,g)),t.push([g,f++])}}let i;if(t.length===0&&tr)i=tr;else if(t.length>0&&er)i=er;else{let f=Object.keys(Fa).join(""),p=wh(),w=`([${f}])|([${p}])|((?:\u3099|\u309A)\\n)|(\\p{M}+(?:-\\n)?)|(\\p{Ll}-\\n\\p{Lu})|(\\S-\\n)|((?:\\p{Ideographic}|[\u3040-\u30FF])\\n)|(\\n)`;t.length===0?i=tr=new RegExp(w+"|(\\u0000)","gum"):i=er=new RegExp(w+`|(${Lh})`,"gum")}let s=[];for(;(e=xh.exec(o))!==null;)s.push([e[0].length,e.index]);let n=o.normalize("NFD"),r=[[0,0]],a=0,l=0,h=0,c=0,d=0,u=!1;return n=n.replace(i,(f,p,g,b,m,w,y,A,v,S,P)=>{if(P-=c,p){let T=Fa[p],_=T.length;for(let E=1;E<_;E++)r.push([P-h+E,h-E]);return h-=_-1,T}if(g){let T=Va.get(g);T||(T=g.normalize("NFKC"),Va.set(g,T));let _=T.length;for(let E=1;E<_;E++)r.push([P-h+E,h-E]);return h-=_-1,T}if(b)return u=!0,P+d===s[a]?.[1]?++a:(r.push([P-1-h+1,h-1]),h-=1,c+=1),r.push([P-h+1,h]),c+=1,d+=1,b.charAt(0);if(m){let T=m.endsWith(`
13`),_=T?m.length-2:m.length;u=!0;let E=_;P+d===s[a]?.[1]&&(E-=s[a][0],++a);for(let L=1;L<=E;L++)r.push([P-1-h+L,h-L]);return h-=E,c+=E,T?(P+=_-1,r.push([P-h+1,1+h]),h+=1,c+=1,d+=1,m.slice(0,_)):m}if(w)return r.push([P-h+3,1+h]),h+=1,c+=1,d+=1,w.replace(`
14`,"");if(y){let T=y.length-2;return r.push([P-h+T,1+h]),h+=1,c+=1,d+=1,y.slice(0,-2)}if(A){let T=A.length-1;return r.push([P-h+T,h]),c+=1,d+=1,A.slice(0,-1)}if(v)return r.push([P-h+1,h-1]),h-=1,c+=1,d+=1," ";if(P+d===t[l]?.[1]){let T=t[l][0]-1;++l;for(let _=1;_<=T;_++)r.push([P-(h-_),h-_]);h-=T,c+=T}return S}),r.push([n.length,h]),[n,r,u]}function Mh(o,t,e){if(!o)return[t,e];let i=t,s=t+e-1,n=$e(o,c=>c[0]>=i);o[n][0]>i&&--n;let r=$e(o,c=>c[0]>=s,n);o[r][0]>s&&--r;let a=i+o[n][1],h=s+o[r][1]+1-a;return[a,h]}var hr=class{#t=null;#e=!0;#i=0;constructor({linkService:t,eventBus:e,updateMatchesCountOnProgress:i=!0}){this._linkService=t,this._eventBus=e,this.#e=i,this.onIsPageVisible=null,this.#r(),e._on("find",this.#s.bind(this)),e._on("findbarclose",this.#A.bind(this))}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return this.#t}setDocument(t){this._pdfDocument&&this.#r(),t&&(this._pdfDocument=t,this._firstPageCapability.resolve())}#s(t){if(!t)return;let e=this._pdfDocument,{type:i}=t;(this.#t===null||this.#l(t))&&(this._dirtyMatch=!0),this.#t=t,i!=="highlightallchange"&&this.#y(Xt.PENDING),this._firstPageCapability.promise.then(()=>{if(!this._pdfDocument||e&&this._pdfDocument!==e)return;this.#d();let s=!this._highlightMatches,n=!!this._findTimeout;this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),i?this._dirtyMatch?this.#p():i==="again"?(this.#p(),s&&this.#t.highlightAll&&this.#u()):i==="highlightallchange"?(n?this.#p():this._highlightMatches=!0,this.#u()):this.#p():this._findTimeout=setTimeout(()=>{this.#p(),this._findTimeout=null},yh)})}scrollMatchIntoView({element:t=null,selectedLeft:e=0,pageIndex:i=-1,matchIndex:s=-1}){if(!this._scrollMatches||!t)return;if(s===-1||s!==this._selected.matchIdx)return;if(i===-1||i!==this._selected.pageIdx)return;this._scrollMatches=!1;let n={top:vh,left:e+Eh};co(t,n,!0)}#r(){this._highlightMatches=!1,this._scrollMatches=!1,this._pdfDocument=null,this._pageMatches=[],this._pageMatchesLength=[],this.#i=0,this.#t=null,this._selected={pageIdx:-1,matchIdx:-1},this._offset={pageIdx:null,matchIdx:null,wrapped:!1},this._extractTextPromises=[],this._pageContents=[],this._pageDiffs=[],this._hasDiacritics=[],this._matchesCountTotal=0,this._pagesToSearch=null,this._pendingFindMatches=new Set,this._resumePageIdx=null,this._dirtyMatch=!1,clearTimeout(this._findTimeout),this._findTimeout=null,this._firstPageCapability=Promise.withResolvers()}get#n(){let{query:t}=this.#t;return typeof t=="string"?(t!==this._rawQuery&&(this._rawQuery=t,[this._normalizedQuery]=ir(t)),this._normalizedQuery):(t||[]).filter(e=>!!e).map(e=>ir(e)[0])}#l(t){let e=t.query,i=this.#t.query,s=typeof e;if(s!==typeof i)return!0;
14if(s==="string"){if(e!==i)return!0}else if(JSON.stringify(e)!==JSON.stringify(i))return!0;switch(t.type){case"again":let r=this._selected.pageIdx+1,a=this._linkService;return r>=1&&r<=a.pagesCount&&r!==a.page&&!(this.onIsPageVisible?.(r)??!0);case"highlightallchange":return!1}return!0}#h(t,e,i){let s=t.slice(0,e).match(Sh);if(s){let n=t.charCodeAt(e),r=s[1].charCodeAt(0);if(Yi(n)===Yi(r))return!1}if(s=t.slice(e+i).match(Ph),s){let n=t.charCodeAt(e+i-1),r=s[1].charCodeAt(0);if(Yi(n)===Yi(r))return!1}return!0}#c(t,e){let{matchDiacritics:i}=this.#t,s=!1;t=t.replaceAll(Ch,(r,a,l,h,c,d)=>a?`[ ]*\\${a}[ ]*`:l?`[ ]*${l}[ ]*`:h?"[ ]+":i?c||d:c?Ba.has(c.charCodeAt(0))?c:"":e?(s=!0,`${d}\\p{M}*`):d);let n="[ ]*";return t.endsWith(n)&&(t=t.slice(0,t.length-n.length)),i&&e&&(Ha||=String.fromCharCode(...Ba),s=!0,t=`${t}(?=[${Ha}]|[^\\p{M}]|$)`),[s,t]}#o(t){let e=this.#n;if(e.length===0)return;let i=this._pageContents[t],s=this.match(e,i,t),n=this._pageMatches[t]=[],r=this._pageMatchesLength[t]=[],a=this._pageDiffs[t];s?.forEach(({index:h,length:c})=>{let[d,u]=Mh(a,h,c);u&&(n.push(d),r.push(u))}),this.#t.highlightAll&&this.#a(t),this._resumePageIdx===t&&(this._resumePageIdx=null,this.#g());let l=n.length;this._matchesCountTotal+=l,this.#e?l>0&&this.#E():++this.#i===this._linkService.pagesCount&&this.#E()}match(t,e,i){let s=this._hasDiacritics[i],n=!1;if(typeof t=="string"?[n,t]=this.#c(t,s):t=t.sort().reverse().map(d=>{let[u,f]=this.#c(d,s);return n||=u,`(${f})`}).join("|"),!t)return;let{caseSensitive:r,entireWord:a}=this.#t,l=`g${n?"u":""}${r?"":"i"}`;t=new RegExp(t,l);let h=[],c;for(;(c=t.exec(e))!==null;)a&&!this.#h(e,c.index,c[0].length)||h.push({index:c.index,length:c[0].length});return h}#d(){if(this._extractTextPromises.length>0)return;let t=Promise.resolve(),e={disableNormalization:!0};for(let i=0,s=this._linkService.pagesCount;i<s;i++){let{promise:n,resolve:r}=Promise.withResolvers();this._extractTextPromises[i]=n,t=t.then(()=>this._pdfDocument.getPage(i+1).then(a=>a.getTextContent(e)).then(a=>{let l=[];for(let h of a.items)l.push(h.str),h.hasEOL&&l.push(`
15`);[this._pageContents[i],this._pageDiffs[i],this._hasDiacritics[i]]=ir(l.join("")),r()},a=>{console.error(`Unable to get text content for page ${i+1}`,a),this._pageContents[i]="",this._pageDiffs[i]=null,this._hasDiacritics[i]=!1,r()}))}}#a(t){this._scrollMatches&&this._selected.pageIdx===t&&(this._linkService.page=t+1),this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:t})}#u(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})}#p(){let t=this.#t.findPrevious,e=this._linkService.page-1,i=this._linkService.pagesCount;if(this._highlightMatches=!0,this._dirtyMatch){this._dirtyMatch=!1,this._selected.pageIdx=this._selected.matchIdx=-1,this._offset.pageIdx=e,this._offset.matchIdx=null,this._offset.wrapped=!1,this._resumePageIdx=null,this._pageMatches.length=0,this._pageMatchesLength.length=0,this.#i=0,this._matchesCountTotal=0,this.#u();for(let r=0;r<i;r++)this._pendingFindMatches.has(r)||(this._pendingFindMatches.add(r),this._extractTextPromises[r].then(()=>{this._pendingFindMatches.delete(r),this.#o(r)}))}if(this.#n.length===0){this.#y(Xt.FOUND);return}if(this._resumePageIdx)return;let n=this._offset;if(this._pagesToSearch=i,n.matchIdx!==null){let r=this._pageMatches[n.pageIdx].length;if(!t&&n.matchIdx+1<r||t&&n.matchIdx>0){n.matchIdx=t?n.matchIdx-1:n.matchIdx+1,this.#m(!0);return}this.#b(t)}this.#g()}#f(t){let e=this._offset,i=t.length,s=this.#t.findPrevious;return i?(e.matchIdx=s?i-1:0,this.#m(!0),!0):(this.#b(s),e.wrapped&&(e.matchI
15dx=null,this._pagesToSearch<0)?(this.#m(!1),!0):!1)}#g(){this._resumePageIdx!==null&&console.error("There can only be one pending page.");let t=null;do{let e=this._offset.pageIdx;if(t=this._pageMatches[e],!t){this._resumePageIdx=e;break}}while(!this.#f(t))}#b(t){let e=this._offset,i=this._linkService.pagesCount;e.pageIdx=t?e.pageIdx-1:e.pageIdx+1,e.matchIdx=null,this._pagesToSearch--,(e.pageIdx>=i||e.pageIdx<0)&&(e.pageIdx=t?i-1:0,e.wrapped=!0)}#m(t=!1){let e=Xt.NOT_FOUND,i=this._offset.wrapped;if(this._offset.wrapped=!1,t){let s=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx,this._selected.matchIdx=this._offset.matchIdx,e=i?Xt.WRAPPED:Xt.FOUND,s!==-1&&s!==this._selected.pageIdx&&this.#a(s)}this.#y(e,this.#t.findPrevious),this._selected.pageIdx!==-1&&(this._scrollMatches=!0,this.#a(this._selected.pageIdx))}#A(t){let e=this._pdfDocument;this._firstPageCapability.promise.then(()=>{!this._pdfDocument||e&&this._pdfDocument!==e||(this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),this._resumePageIdx&&(this._resumePageIdx=null,this._dirtyMatch=!0),this.#y(Xt.FOUND),this._highlightMatches=!1,this.#u())})}#w(){let{pageIdx:t,matchIdx:e}=this._selected,i=0,s=this._matchesCountTotal;if(e!==-1){for(let n=0;n<t;n++)i+=this._pageMatches[n]?.length||0;i+=e+1}return(i<1||i>s)&&(i=s=0),{current:i,total:s}}#E(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:this.#w()})}#y(t,e=!1){!this.#e&&(this.#i!==this._linkService.pagesCount||t===Xt.PENDING)||this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:t,previous:e,entireWord:this.#t?.entireWord??null,matchesCount:this.#w(),rawQuery:this.#t?.query??null})}},kh="noopener noreferrer nofollow",se={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4},es=class o{externalLinkEnabled=!0;constructor({eventBus:t,externalLinkTarget:e=null,externalLinkRel:i=null,ignoreDestinationZoom:s=!1}={}){this.eventBus=t,this.externalLinkTarget=e,this.externalLinkRel=i,this._ignoreDestinationZoom=s,this.baseUrl=null,this.pdfDocument=null,this.pdfViewer=null,this.pdfHistory=null}setDocument(t,e=null){this.baseUrl=e,this.pdfDocument=t}setViewer(t){this.pdfViewer=t}setHistory(t){this.pdfHistory=t}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return this.pdfDocument?this.pdfViewer.currentPageNumber:1}set page(t){this.pdfDocument&&(this.pdfViewer.currentPageNumber=t)}get rotation(){return this.pdfDocument?this.pdfViewer.pagesRotation:0}set rotation(t){this.pdfDocument&&(this.pdfViewer.pagesRotation=t)}get isInPresentationMode(){return this.pdfDocument?this.pdfViewer.isInPresentationMode:!1}goToDestination(t){return C(this,null,function*(){if(!this.pdfDocument)return;let e,i,s;if(typeof t=="string"?(e=t,i=yield this.pdfDocument.getDestination(t)):(e=null,i=yield t),!Array.isArray(i)){console.error(`goToDestination: "${i}" is not a valid destination array, for dest="${t}".`);return}let[n]=i;if(n&&typeof n=="object"){if(s=this.pdfDocument.cachedPageNumber(n),!s)try{s=(yield this.pdfDocument.getPageIndex(n))+1}catch{console.error(`goToDestination: "${n}" is not a valid page reference, for dest="${t}".`);return}}else Number.isInteger(n)&&(s=n+1);if(!s||s<1||s>this.pagesCount){console.error(`goToDestination: "${s}" is not a valid page number, for dest="${t}".`);return}this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.push({namedDest:e,explicitDest:i,pageNumber:s})),this.pdfViewer.scrollPageIntoView({pageNumber:s,destArray:i,ignoreDestinationZoom:this._ignoreDestinationZoom})})}goToPage(t){if(!this.pdfDocument)return;let e=typeof t=="string"&&this.pdfViewer.pageLabelToPageNumber(t)||t|0;if(!(Number.isInteger(e)&&e>0&&e<=this.pagesCount)){console.error(`PDFLinkService.goToPage: "${t}" is not a valid page.`);return}this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.pushPage(e)),this.pdfViewer.scrollPageIntoView({pageNumber:e})}addLinkAttributes(t,e,i=!1){if(!e||typeof e!="string")throw new Error('A valid "url" parameter must provided.');let s=i?se.BLANK:this.externalLinkTarget,n=this.externalLinkRel;this.externalLinkEnabled?t.href=t.title=e:(t.href="",t.title=`Disabled: ${e}`,t.onclick=()=>!1);let r="";switch(s){case se.NONE:break;case se.SELF:r="_self";break;case se.BLANK:r="_blank";break;case se.PARENT:r="_parent";break;case se.TOP:r="_top";break}t.target=r,t.rel=typeof n=="string"?n:kh}getDestinationHash(t){if(typeof t=="string"){if(t.length>0)return this.getAnchorUrl("#"+escape(t))}else if(Array.isArray(t)){let e=JSON.stringify(t);if(e.length>0)return this.getAnchorUrl("#"+escape(e))}return this.getAnchorUrl("")}getAnchorUrl(t){return this.baseUrl?this.baseUrl+t:t}setHash(t){if(!this.pdfDocument)return;let e,i;if(t.includes("=")){let s=us(t);if(s.has("search")){let n=s.get("search").replaceAll('"',""),r=s.get("phrase")==="true";this.eventBus.dispatch("findfromurlhash",{source:this,query:r?n:n.match(/\S+/g)})}if(s.has("page")&&(e=s.get("page")|0||1),s.has("zoom")){let n=s.get("zoom").split(","),r=n[0],a=parseFloat(r);r.includes("Fit")?r==="Fit"||r==="FitB"?i=[null,{name:r}
15]:r==="FitH"||r==="FitBH"||r==="FitV"||r==="FitBV"?i=[null,{name:r},n.length>1?n[1]|0:null]:r==="FitR"?n.length!==5?console.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):i=[null,{name:r},n[1]|0,n[2]|0,n[3]|0,n[4]|0]:console.error(`PDFLinkService.setHash: "${r}" is not a valid zoom value.`):i=[null,{name:"XYZ"},n.length>1?n[1]|0:null,n.length>2?n[2]|0:null,a?a/100:r]}i?this.pdfViewer.scrollPageIntoView({pageNumber:e||this.page,destArray:i,allowNegativeOffset:!0}):e&&(this.page=e),s.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:s.get("pagemode")}),s.has("nameddest")&&this.goToDestination(s.get("nameddest"));return}i=unescape(t);try{i=JSON.parse(i),Array.isArray(i)||(i=i.toString())}catch{}if(typeof i=="string"||o.#t(i)){this.goToDestination(i);return}console.error(`PDFLinkService.setHash: "${unescape(t)}" is not a valid destination.`)}executeNamedAction(t){if(this.pdfDocument){switch(t){case"GoBack":this.pdfHistory?.back();break;case"GoForward":this.pdfHistory?.forward();break;case"NextPage":this.pdfViewer.nextPage();break;case"PrevPage":this.pdfViewer.previousPage();break;case"LastPage":this.page=this.pagesCount;break;case"FirstPage":this.page=1;break;default:break}this.eventBus.dispatch("namedaction",{source:this,action:t})}}executeSetOCGState(t){return C(this,null,function*(){if(!this.pdfDocument)return;let e=this.pdfDocument,i=yield this.pdfViewer.optionalContentConfigPromise;e===this.pdfDocument&&(i.setOCGState(t),this.pdfViewer.optionalContentConfigPromise=Promise.resolve(i))})}static#t(t){if(!Array.isArray(t)||t.length<2)return!1;let[e,i,...s]=t;if(!(typeof e=="object"&&Number.isInteger(e?.num)&&Number.isInteger(e?.gen))&&!Number.isInteger(e)||!(typeof i=="object"&&typeof i?.name=="string"))return!1;let n=s.length,r=!0;switch(i.name){case"XYZ":if(n<2||n>3)return!1;break;case"Fit":case"FitB":return n===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(n>1)return!1;break;case"FitR":if(n!==4)return!1;r=!1;break;default:return!1}for(let a of s)if(!(typeof a=="number"||r&&a===null))return!1;return!0}},Ge=class extends es{setDocument(t,e=null){}},{AbortException:Ih,AnnotationEditorLayer:Rh,AnnotationEditorParamsType:ad,AnnotationEditorType:bt,AnnotationEditorUIManager:Oh,AnnotationLayer:Dh,AnnotationMode:jt,build:od,ColorPicker:ld,createValidAbsoluteUrl:Nh,DOMSVGFactory:hd,DrawLayer:Fh,FeatureTest:cd,fetchData:za,getDocument:dd,getFilenameFromUrl:ud,getPdfFilenameFromUrl:Bh,getXfaPageViewport:fd,GlobalWorkerOptions:pd,ImageKind:gd,InvalidPDFException:md,isDataScheme:bd,isPdfFile:Hh,MissingPDFException:Ad,noContextMenu:_d,normalizeUnicode:jh,OPS:wd,OutputScale:Vh,PasswordResponses:yd,PDFDataRangeTransport:vd,PDFDateString:Ed,PDFWorker:xd,PermissionFlag:Qi,PixelsPerInch:Ht,RenderingCancelledException:cr,setLayerDimensions:zh,shadow:is,TextLayer:Wh,UnexpectedResponseException:Cd,Util:Sd,VerbosityLevel:Pd,version:Wa,XfaLayer:sr}=globalThis.pdfjsLib,ss=class{#t=null;#e=null;constructor({pdfPage:t,linkService:e,downloadManager:i,annotationStorage:s=null,imageResourcesPath:n="",renderForms:r=!0,enableScripting:a=!1,hasJSActionsPromise:l=null,fieldObjectsPromise:h=null,annotationCanvasMap:c=null,accessibilityManager:d=null,annotationEditorUIManager:u=null,onAppend:f=null}){this.pdfPage=t,this.linkService=e,this.downloadManager=i,this.imageResourcesPath=n,this.renderForms=r,this.annotationStorage=s,this.enableScripting=a,this._hasJSActionsPromise=l||Promise.resolve(!1),this._fieldObjectsPromise=h||Promise.resolve(null),this._annotationCanvasMap=c,this._accessibilityManager=d,this._annotationEditorUIManager=u,this.#t=f,this.annotationLayer=null,this.div=null,this._cancelled=!1,this._eventBus=e.eventBus}render(t,e,i="display"){return C(this,null,function*(){if(this.div){if(this._cancelled||!this.annotationLayer)return;this.annotationLayer.update({viewport:t.clone({dontFlip:!0})});return}let[s,n,r]=yield Promise.all([this.pdfPage.getAnnotations({intent:i}),this._hasJSActionsPromise,this._fieldObjectsPromise]);if(this._cancelled)return;let a=this.div=document.createElement("div");if(a.className="annotationLayer",this.#t?.(a),s.length===0){this.hide();return}this.annotationLayer=new Dh({div:a,accessibilityManager:this._accessibilityManager,annotationCanvasMap:this._annotationCanvasMap,annotationEditorUIManager:this._annotationEditorUIManager,page:this.pdfPage,viewport:t.clone({dontFlip:!0}),structTreeLayer:e?.structTreeLayer||null}),yield this.annotationLayer.render({annotations:s,imageResourcesPath:this.imageResourcesPath,renderForms:this.renderForms,linkService:this.linkService,downloadManager:this.downloadManager,annotationStorage:this.annotationStorage,enableScripting:this.enableScripting,hasJSActions:n,fieldObjects:r}),this.linkService.isInPresentationMode&&this.#i(me.FULLSCREEN),this.#e||(this.#e=new AbortController,this._eventBus?._on("presentationmodechanged",l=>{this.#i(l.state)},{signal:this.#e.signal}))})}cancel(){this._cancelled=!0,this.#e?.abort(),this.#e=null}hide(){this.div&&(this.div.hidden=!0)}hasEditableAnnotations(){return!!this.annotationLayer?.hasEditableAnnotations()}#i(t){if(!this.div)return;let e=!1;switch(t){case me.FULLSCREEN:e=!0;break;case me.NORMAL:break;default:return}for(let i of this.div.childNodes)i.hasAttribute("data-internal-link")||(i.inert=e)}};function Ua(o,t){let e=document.createElement("a");if(!e.click)throw new Error('DownloadManager: "a.click()" is not supported.');e.href=o,e.target="_parent","download"in e&&(e.download=t),(document.body||document.documentElement).append(e),e.click(),e.remove()}var dr=class{#t=new WeakMap;
15downloadData(t,e,i){let s=URL.createObjectURL(new Blob([t],{type:i}));Ua(s,e)}openOrDownloadData(t,e,i=null){let n=Hh(e)?"application/pdf":"";return this.downloadData(t,e,n),!1}download(t,e,i){let s;if(t)s=URL.createObjectURL(new Blob([t],{type:"application/pdf"}));else{if(!Nh(e,"http://example.com")){console.error(`download - not a valid URL: ${e}`);return}s=e+"#pdfjs.action=download"}Ua(s,i)}},$a={EVENT:"event",TIMEOUT:"timeout"};function Uh(i){return C(this,arguments,function*({target:o,name:t,delay:e=0}){if(typeof o!="object"||!(t&&typeof t=="string")||!(Number.isInteger(e)&&e>=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");let{promise:s,resolve:n}=Promise.withResolvers(),r=new AbortController;function a(c){r.abort(),clearTimeout(h),n(c)}let l=o instanceof ns?"_on":"addEventListener";o[l](t,a.bind(null,$a.EVENT),{signal:r.signal});let h=setTimeout(a.bind(null,$a.TIMEOUT),e);return s})}var ns=class{#t=Object.create(null);on(t,e,i=null){this._on(t,e,{external:!0,once:i?.once,signal:i?.signal})}off(t,e,i=null){this._off(t,e)}dispatch(t,e){let i=this.#t[t];if(!i||i.length===0)return;let s;for(let{listener:n,external:r,once:a}of i.slice(0)){if(a&&this._off(t,n),r){(s||=[]).push(n);continue}n(e)}if(s){for(let n of s)n(e);s=null}}_on(t,e,i=null){let s=null;if(i?.signal instanceof AbortSignal){let{signal:r}=i;if(r.aborted){console.error("Cannot use an `aborted` signal.");return}let a=()=>this._off(t,e);s=()=>r.removeEventListener("abort",a),r.addEventListener("abort",a)}(this.#t[t]||=[]).push({listener:e,external:i?.external===!0,once:i?.once===!0,rmAbort:s})}_off(t,e,i=null){let s=this.#t[t];if(s)for(let n=0,r=s.length;n<r;n++){let a=s[n];if(a.listener===e){a.rmAbort?.(),s.splice(n,1);return}}}};var be=class{constructor(t){this.value=t}valueOf(){return this.value}},Z=class extends be{constructor(t="???"){super(t)}toString(t){return`{${this.value}}`}},Ct=class extends be{constructor(t,e={}){super(t),this.opts=e}toString(t){try{return t.memoizeIntlObject(Intl.NumberFormat,this.opts).format(this.value)}catch(e){return t.reportError(e),this.value.toString(10)}}},re=class extends be{constructor(t,e={}){super(t),this.opts=e}toString(t){try{return t.memoizeIntlObject(Intl.DateTimeFormat,this.opts).format(this.value)}catch(e){return t.reportError(e),new Date(this.value).toISOString()}}},Ga=100,$h="\u2068",Gh="\u2069";function Xh(o,t,e){if(e===t||e instanceof Ct&&t instanceof Ct&&e.value===t.value)return!0;if(t instanceof Ct&&typeof e=="string"){let i=o.memoizeIntlObject(Intl.PluralRules,t.opts).select(t.value);if(e===i)return!0}return!1}function Xa(o,t,e){return t[e]?Ae(o,t[e].value):(o.reportError(new RangeError("No default")),new Z)}function ur(o,t){let e=[],i=Object.create(null);for(let s of t)s.type==="narg"?i[s.name]=Xe(o,s.value):e.push(Xe(o,s));return{positional:e,named:i}}function Xe(o,t){switch(t.type){case"str":return t.value;case"num":return new Ct(t.value,{minimumFractionDigits:t.precision});case"var":return qh(o,t);case"mesg":return Kh(o,t);case"term":return Yh(o,t);case"func":return Qh(o,t);case"select":return Jh(o,t);default:return new Z}}function qh(o,{name:t}){let e;if(o.params)if(Object.prototype.hasOwnProperty.call(o.params,t))e=o.params[t];else return new Z(`$${t}`);else if(o.args&&Object.prototype.hasOwnProperty.call(o.args,t))e=o.args[t];else return o.reportError(new ReferenceError(`Unknown variable: $${t}`)),new Z(`$${t}`);if(e instanceof be)return e;switch(typeof e){case"string":return e;case"number":return new Ct(e);case"object":if(e instanceof Date)return new re(e.getTime());default:return o.reportError(new TypeError(`Variable type not supported: $${t}, ${typeof e}`)),new Z(`$${t}`)}}function Kh(o,{name:t,attr:e}){let i=o.bundle._messages.get(t);if(!i)return o.reportError(new ReferenceError(`Unknown message: ${t}`)),new Z(t);if(e){let s=i.attributes[e];return s?Ae(o,s):(o.reportError(new ReferenceError(`Unknown attribute: ${e}`)),new Z(`${t}.${e}`))}return i.value?Ae(o,i.value):(o.reportError(new ReferenceError(`No value: ${t}`)),new Z(t))}function Yh(o,{name:t,attr:e,args:i}){let s=`-${t}`,n=o.bundle._terms.get(s);if(!n)return o.reportError(new ReferenceError(`Unknown term: ${s}`)),new Z(s);if(e){let a=n.attributes[e];if(a){o.params=ur(o,i).named;let l=Ae(o,a);return o.params=null,l}return o.reportError(new ReferenceError(`Unknown attribute: ${e}`)),new Z(`${s}.${e}`)}o.params=ur(o,i).named;let r=Ae(o,n.value);return o.params=null,r}function Qh(o,{name:t,args:e}){let i=o.bundle._functions[t];if(!i)return o.reportError(new ReferenceError(`Unknown function: ${t}()`)),new Z(`${t}()`);if(typeof i!="function")return o.reportError(new TypeError(`Function ${t}() is not callable`)),new Z(`${t}()`);try{let s=ur(o,e);return i(s.positional,s.named)}catch(s){return o.reportError(s),new Z(`${t}()`)}}function Jh(o,{selector:t,variants:e,star:i}){let s=Xe(o,t);if(s instanceof Z)return Xa(o,e,i);for(let n of e){let r=Xe(o,n.key);if(Xh(o,s,r))return Ae(o,n.value)}return Xa(o,e,i)}function fo(o,t){if(o.dirty.has(t))return o.reportError(new RangeError("Cyclic reference")),new Z;o.dirty.add(t);let e=[],i=o.bundle._useIsolating&&t.length>1;for(let s of t){if(typeof s=="string"){e.push(o.bundle._transform(s));continue}if(o.placeables++,o.placeables>Ga)throw o.dirty.delete(t),new RangeError(`Too many placeables expanded: ${o.placeables}, max allowed is ${Ga}`);i&&e.push($h),e.push(Xe(o,s).toString(o)),i&&e.push(Gh)}return o.dirty.delete(t),e.join("")}function Ae(o,t){return typeof t=="string"?o.bundle._transform(t):fo(o,t)}var fr=class{constructor(t,e,i){this.dirty=new WeakSet,this.params=null,this.placeables=0,this.bundle=t,this.errors=e,this.args=i}reportError(t){if(!this.errors||!(t instanceof Error))throw t;this.errors.push(t)}
15memoizeIntlObject(t,e){let i=this.bundle._intls.get(t);i||(i={},this.bundle._intls.set(t,i));let s=JSON.stringify(e);return i[s]||(i[s]=new t(this.bundle.locales,e)),i[s]}};function rs(o,t){let e=Object.create(null);for(let[i,s]of Object.entries(o))t.includes(i)&&(e[i]=s.valueOf());return e}var qa=["unitDisplay","currencyDisplay","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits"];function Zh(o,t){let e=o[0];if(e instanceof Z)return new Z(`NUMBER(${e.valueOf()})`);if(e instanceof Ct)return new Ct(e.valueOf(),G(G({},e.opts),rs(t,qa)));if(e instanceof re)return new Ct(e.valueOf(),G({},rs(t,qa)));throw new TypeError("Invalid argument to NUMBER")}var Ka=["dateStyle","timeStyle","fractionalSecondDigits","dayPeriod","hour12","weekday","era","year","month","day","hour","minute","second","timeZoneName"];function tc(o,t){let e=o[0];if(e instanceof Z)return new Z(`DATETIME(${e.valueOf()})`);if(e instanceof re)return new re(e.valueOf(),G(G({},e.opts),rs(t,Ka)));if(e instanceof Ct)return new re(e.valueOf(),G({},rs(t,Ka)));throw new TypeError("Invalid argument to DATETIME")}var Ya=new Map;function ec(o){let t=Array.isArray(o)?o.join(" "):o,e=Ya.get(t);return e===void 0&&(e=new Map,Ya.set(t,e)),e}var pr=class{constructor(t,{functions:e,useIsolating:i=!0,transform:s=n=>n}={}){this._terms=new Map,this._messages=new Map,this.locales=Array.isArray(t)?t:[t],this._functions=G({NUMBER:Zh,DATETIME:tc},e),this._useIsolating=i,this._transform=s,this._intls=ec(t)}hasMessage(t){return this._messages.has(t)}getMessage(t){return this._messages.get(t)}addResource(t,{allowOverrides:e=!1}={}){let i=[];for(let s=0;s<t.body.length;s++){let n=t.body[s];if(n.id.startsWith("-")){if(e===!1&&this._terms.has(n.id)){i.push(new Error(`Attempt to override an existing term: "${n.id}"`));continue}this._terms.set(n.id,n)}else{if(e===!1&&this._messages.has(n.id)){i.push(new Error(`Attempt to override an existing message: "${n.id}"`));continue}this._messages.set(n.id,n)}}return i}formatPattern(t,e=null,i=null){if(typeof t=="string")return this._transform(t);let s=new fr(this,i,e);try{return fo(s,t).toString(s)}catch(n){if(s.errors&&n instanceof Error)return s.errors.push(n),new Z().toString(s);throw n}}}
vendor: 4,616 bytes, lines 15-16
15,nr=/^(-?[a-zA-Z][\w-]*) *= */gm,Qa=/\.([a-zA-Z][\w-]*) *= */y,ic=/\*?\[/y,rr=/(-?[0-9]+(?:\.([0-9]+))?)/y,sc=/([a-zA-Z][\w-]*)/y,Ja=/([$-])?([a-zA-Z][\w-]*)(?:\.([a-zA-Z][\w-]*))?/y,nc=/^[A-Z][A-Z0-9_-]*$/,Ji=/([^{}\n\r]+)/y,rc=/([^\\"\n\r]*)/y,Za=/\\([\\"])/y,to=/\\u([a-fA-F0-9]{4})|\\U([a-fA-F0-9]{6})/y,ac=/^\n+/,eo=/ +$/,oc=/ *\r?\n/g,lc=/( *)$/,hc=/{\s*/y,io=/\s*}/y,cc=/\[\s*/y,dc=/\s*] */y,uc=/\s*\(\s*/y,fc=/\s*->\s*/y,pc=/\s*:\s*/y,gc=/\s*,?\s*/y,mc=/\s+/y,gr=class{constructor(t){this.body=[],nr.lastIndex=0;let e=0;for(;;){let _=nr.exec(t);if(_===null)break;e=nr.lastIndex;try{this.body.push(l(_[1]))}catch(E){if(E instanceof SyntaxError)continue;throw E}}function i(_){return _.lastIndex=e,_.test(t)}function s(_,E){if(t[e]===_)return e++,!0;if(E)throw new E(`Expected ${_}`);return!1}function n(_,E){if(i(_))return e=_.lastIndex,!0;if(E)throw new E(`Expected ${_.toString()}`);return!1}function r(_){_.lastIndex=e;let E=_.exec(t);if(E===null)throw new SyntaxError(`Expected ${_.toString()}`);return e=_.lastIndex,E}function a(_){return r(_)[1]}function l(_){let E=c(),L=h();if(E===null&&Object.keys(L).length===0)throw new SyntaxError("Expected message value or attributes");return{id:_,value:E,attributes:L}}function h(){let _=Object.create(null);for(;i(Qa);){let E=a(Qa),L=c();if(L===null)throw new SyntaxError("Expected attribute value");_[E]=L}return _}function c(){let _;if(i(Ji)&&(_=a(Ji)),t[e]==="{"||t[e]==="}")return d(_?[_]:[],1/0);let E=S();return E?_?d([_,E],E.length):(E.value=P(E.value,ac),d([E],E.length)):_?P(_,eo):null}function d(_=[],E){for(;;){if(i(Ji)){_.push(a(Ji));continue}if(t[e]==="{"){_.push(u());continue}if(t[e]==="}")throw new SyntaxError("Unbalanced closing brace");let F=S();if(F){_.push(F),E=Math.min(E,F.length);continue}break}let L=_.length-1,V=_[L];typeof V=="string"&&(_[L]=P(V,eo));let H=[];for(let F of _)F instanceof as&&(F=F.value.slice(0,F.value.length-E)),F&&H.push(F);return H}function u(){n(hc,SyntaxError);let _=f();if(n(io))return _;if(n(fc)){let E=b();return n(io,SyntaxError),G({type:"select",selector:_},E)}throw new SyntaxError("Unclosed placeable")}function f(){if(t[e]==="{")return u();if(i(Ja)){let[,_,E,L=null]=r(Ja);if(_==="$")return{type:"var",name:E};if(n(uc)){let V=p();if(_==="-")return{type:"term",name:E,attr:L,args:V};if(nc.test(E))return{type:"func",name:E,args:V};throw new SyntaxError("Function names must be all upper-case")}return _==="-"?{type:"term",name:E,attr:L,args:[]}:{type:"mesg",name:E,attr:L}}return w()}function p(){let _=[];for(;;){switch(t[e]){case")":return e++,_;case void 0:throw new SyntaxError("Unclosed argument list")}_.push(g()),n(gc)}}function g(){let _=f();return _.type!=="mesg"?_:n(pc)?{type:"narg",name:_.name,value:w()}:_}function b(){let _=[],E=0,L;for(;i(ic);){s("*")&&(L=E);let V=m(),H=c();if(H===null)throw new SyntaxError("Expected variant value");_[E++]={key:V,value:H}}if(E===0)return null;if(L===void 0)throw new SyntaxError("Expected default variant");return{variants:_,star:L}}function m(){n(cc,SyntaxError);let _;return i(rr)?_=y():_={type:"str",value:a(sc)},n(dc,SyntaxError),_}function w(){if(i(rr))return y();if(t[e]==='"')return A();throw new SyntaxError("Invalid expression")}function y(){let[,_,E=""]=r(rr),L=E.length;return{type:"num",value:parseFloat(_),precision:L}}function A(){s('"',SyntaxError);let _="";for(;;){if(_+=a(rc),t[e]==="\\"){_+=v();continue}if(s('"'))return{type:"str",value:_};throw new SyntaxError("Unclosed string literal")}}function v(){if(i(Za))return a(Za);if(i(to)){let[,_,E]=r(to),L=parseInt(_||E,16);return L<=55295||57344<=L?String.fromCodePoint(L):"\uFFFD"}throw new SyntaxError("Unknown escape sequence")}function S(){let _=e;switch(n(mc),t[e]){case".":case"[":case"*":case"}":case void 0:return!1;case"{":return T(t.slice(_,e))}return t[e-1]===" "?T(t.slice(_,e)):!1}function P(_,E){return _.replace(E,"")}function T(_){let E=_.replace(oc,`
16`),L=lc.exec(_)[1].length;return new as(E,L)}}},as=class{constructor(t,e){this.value=t,this.length=e}},bc=/<|&#?\w+;/,Ac={"http://www.w3.org/1999/xhtml":["em","strong","small","s","cite","q","dfn","abbr","data","time","code","var","samp","kbd","sub","sup","i","b","u","mark","bdi","bdo","span","br","wbr"]},_c={"http://www.w3.org/1999/xhtml":{global:["title","aria-label","aria-valuetext"],a:["download"],area:["download","alt"],input:["alt","placeholder"],menuitem:["label"],menu:["label"],optgroup:["label"],option:["label"],track:["label"],img:["alt"],textarea:["placeholder"],th:["abbr"]},"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul":{global:["accesskey","aria-label","aria-valuetext","label","t
16itle","tooltiptext"],description:["value"],key:["key","keycode"],label:["value"],textbox:["placeholder","value"]}};function wc(o,t){let{value:e}=t;if(typeof e=="string")if(o.localName==="title"&&o.namespaceURI==="http://www.w3.org/1999/xhtml")o.textContent=e;else if(!bc.test(e))o.textContent=e;else{let i=o.ownerDocument.createElementNS("http://www.w3.org/1999/xhtml","template");i.innerHTML=e,yc(i.content,o)}po(t,o)}function yc(o,t){for(let e of o.childNodes)if(e.nodeType!==e.TEXT_NODE){if(e.hasAttribute("data-l10n-name")){let i=Ec(t,e);o.replaceChild(i,e);continue}if(Cc(e)){let i=xc(e);o.replaceChild(i,e);continue}console.warn(`An element of forbidden type "${e.localName}" was found in the translation. Only safe text-level elements and elements with data-l10n-name are allowed.`),o.replaceChild(mr(e),e)}t.textContent="",t.appendChild(o)}function vc(o,t){if(!o)return!1;for(let e of o)if(e.name===t)return!0;return!1}function po(o,t){let e=t.hasAttribute("data-l10n-attrs")?t.getAttribute("data-l10n-attrs").split(",").map(i=>i.trim()):null;for(let i of Array.from(t.attributes))so(i.name,t,e)&&!vc(o.attributes,i.name)&&t.removeAttribute(i.name);if(o.attributes)for(let i of Array.from(o.attributes))so(i.name,t,e)&&t.getAttribute(i.name)!==i.value&&t.setAttribute(i.name,i.value)}function Ec(o,t){let e=t.getAttribute("data-l10n-name"),i=o.querySelector(`[data-l10n-name="${e}"]`);if(!i)return console.warn(`An element named "${e}" wasn't found in the source.`),mr(t);if(i.localName!==t.localName)return console.warn(`An element named "${e}" was found in the translation but its type ${t.localName} didn't match the element found in the source (${i.localName}).`),mr(t);o.removeChild(i);let s=i.cloneNode(!1);return go(t,s)}
16function xc(o){let t=o.ownerDocument.createElement(o.localName);return go(o,t)}function mr(o){return o.ownerDocument.createTextNode(o.textContent)}function Cc(o){let t=Ac[o.namespaceURI];return t&&t.includes(o.localName)}function so(o,t,e=null){if(e&&e.includes(o))return!0;let i=_c[t.namespaceURI];if(!i)return!1;let s=o.toLowerCase(),n=t.localName;if(i.global.includes(s))return!0;if(!i[n])return!1;if(i[n].includes(s))return!0;if(t.namespaceURI==="http://www.w3.org/1999/xhtml"&&n==="input"&&s==="value"){let r=t.type.toLowerCase();if(r==="submit"||r==="button"||r==="reset")return!0}return!1}function go(o,t){return t.textContent=o.textContent,po(o,t),t}var br=class extends Array{static from(t){return t instanceof this?t:new this(t)}};var Ar=class extends br{constructor(t){if(super(),Symbol.asyncIterator in Object(t))this.iterator=t[Symbol.asyncIterator]();else if(Symbol.iterator in Object(t))this.iterator=t[Symbol.iterator]();else throw new TypeError("Argument must implement the iteration protocol.")}[Symbol.asyncIterator](){let t=this,e=0;return{next(){return C(this,null,function*(){return t.length<=e&&t.push(t.iterator.next()),t[e++]})}}}touchNext(t=1){return C(this,null,function*(){let e=0;for(;e++<t;){let i=this[this.length-1];if(i&&(yield i).done)break;this.push(this.iterator.next())}return this[this.length-1]})}},_r=class{constructor(t=[],e){this.resourceIds=t,this.generateBundles=e,this.onChange(!0)}addResourceIds(t,e=!1){return this.resourceIds.push(...t),this.onChange(e),this.resourceIds.length}removeResourceIds(t){return this.resourceIds=this.resourceIds.filter(e=>!t.includes(e)),this.onChange(),this.resourceIds.length}formatWithFallback(t,e){return C(this,null,function*(){let i=[],s=!1;try{for(var n=Gr(this.bundles),r,a,l;r=!(a=yield n.next()).done;r=!1){let h=a.value;s=!0;let c=Tc(e,h,t,i);if(c.size===0)break;if(typeof console<"u"){let d=h.locales[0],u=Array.from(c).join(", ");console.warn(`[fluent] Missing translations in ${d}: ${u}`)}}}catch{l=[a]}finally{try{r&&(a=n.return)&&(yield a.call(n))}finally{if(l)throw l[0]}}return!s&&typeof console<"u"&&console.warn(`[fluent] Request for keys failed because no resource bundles got generated.
17  keys: ${JSON.stringify(t)}.
18  resourceIds: ${JSON.stringify(this.resourceIds)}.`),i})}formatMessages(t){return this.formatWithFallback(t,Pc)}formatValues(t){return this.formatWithFallback(t,Sc)}formatValue(t,e){return C(this,null,function*(){let[i]=yield this.formatValues([{id:t,args:e}]);return i})}handleEvent(){this.onChange()}onChange(t=!1){this.bundles=Ar.from(this.generateBundles(this.resourceIds)),t&&this.bundles.touchNext(2)}};function Sc(o,t,e,i){return e.value?o.formatPattern(e.value,i,t):null}function Pc(o,t,e,i){let s={value:null,attributes:null};e.value&&(s.value=o.formatPattern(e.value,i,t));let n=Object.keys(e.attributes);if(n.length>0){s.attributes=new Array(n.length);for(let[r,a]of n.entries()){let l=o.formatPattern(e.attributes[a],i,t);s.attributes[r]={name:a,value:l}}}return s}function Tc(o,t,e,i){let s=[],n=new Set;return e.forEach(({id:r,args:a},l)=>{if(i[l]!==void 0)return;let h=t.getMessage(r);if(h){if(s.length=0,i[l]=o(t,s,h,a),s.length>0&&typeof console<"u"){let c=t.locales[0],d=s.join(", ");console.warn(`[fluent][resolver] errors in ${c}/${r}: ${d}.`)}}else n.add(r)}),n}var ne="data-l10n-id",ze="data-l10n-args",Lc=`[${ne}]`,wr=class extends _r{constructor(t,e){super(t,e),this.roots=new Set,this.pendingrAF=null,this.pendingElements=new Set,this.windowElement=null,this.mutationObserver=null,this.observerConfig={attributes:!0,characterData:!1,childList:!0,subtree:!0,attributeFilter:[ne,ze]}}onChange(t=!1){super.onChange(t),this.roots&&this.translateRoots()}setAttributes(t,e,i){return t.setAttribute(ne,e),i?t.setAttribute(ze,JSON.stringify(i)):t.removeAttribute(ze),t}getAttributes(t){return{id:t.getAttribute(ne),args:JSON.parse(t.getAttribute(ze)||null)}}connectRoot(t){for(let e of this.roots)if(e===t||e.contains(t)||t.contains(e))throw new Error("Cannot add a root that overlaps with existing root.");if(this.windowElement){if(this.windowElement!==t.ownerDocument.defaultView)throw new Error(`Cannot connect a root:
19          DOMLocalization already has a root from a different window.`)}else this.windowElement=t.ownerDocument.defaultView,this.mutationObserver=new this.windowElement.MutationObserver(e=>this.translateMutations(e));this.roots.add(t),this.mutationObserver.observe(t,this.observerConfig)}disconnectRoot(t){return this.roots.delete(t),this.pauseObserving(),this.roots.size===0?(this.mutationObserver=null,this.windowElement&&this.pendingrAF&&this.windowElement.cancelAnimationFrame(this.pendingrAF),this.windowElement=null,this.pendingrAF=null,this.pendingElements.clear(),!0):(this.resumeObserving(),!1)}translateRoots(){let t=Array.from(this.roots);return Promise.all(t.map(e=>this.translateFragment(e)))}pauseObserving(){this.mutationObserver&&(this.translateMutations(this.mutationObserver.takeRecords()),this.mutationObserver.disconnect())}resumeObserving(){if(this.mutationObserver)for(let t of this.roots)this.mutationObserver.observe(t,this.observerConfig)}translateMutations(t){for(let e of t)switch(e.type){case"attributes":e.target.hasAttribute("data-l10n-id")&&this.pendingElements.add(e.target);break;case"childList":for(let i of e.addedNodes)if(i.nodeType===i.ELEMENT_NODE)if(i.childElementCount)for(let s of this.getTranslatables(i))this.pendingElements.add(s);else i.hasAttribute(ne)&&this.pendingElements.add(i);break}this.pendingElements.size>0&&this.pendingrAF===null&&(this.pendingrAF=this.windowElement.requestAnimationFrame(()=>{this.translateElements(Array.from(this.pendingElements)),this.pendingElements.clear(),this.pendingrAF=null}))}translateFragment(t){return this.translateElements(this.getTranslatables(t))}translateElements(t){return C(this,null,function*(){if(!t.length)return;
19let e=t.map(this.getKeysForElement),i=yield this.formatMessages(e);return this.applyTranslations(t,i)})}applyTranslations(t,e){this.pauseObserving();for(let i=0;i<t.length;i++)e[i]!==void 0&&wc(t[i],e[i]);this.resumeObserving()}getTranslatables(t){let e=Array.from(t.querySelectorAll(Lc));return typeof t.hasAttribute=="function"&&t.hasAttribute(ne)&&e.push(t),e}getKeysForElement(t){return{id:t.getAttribute(ne),args:JSON.parse(t.getAttribute(ze)||null)}}},yr=class o{#t;#e;#i;#s;constructor({lang:t,isRTL:e},i=null){this.#i=o.#r(t),this.#s=i,this.#t=e??o.#n(this.#i)?"rtl":"ltr"}_setL10n(t){this.#s=t}getLanguage(){return this.#i}getDirection(){return this.#t}get(t,e=null,i){return C(this,null,function*(){return Array.isArray(t)?(t=t.map(r=>({id:r})),(yield this.#s.formatMessages(t)).map(r=>r.value)):(yield this.#s.formatMessages([{id:t,args:e}]))[0]?.value||i})}translate(t){return C(this,null,function*(){(this.#e||=new Set).add(t);try{this.#s.connectRoot(t),yield this.#s.translateRoots()}catch{}})}translateOnce(t){return C(this,null,function*(){try{yield this.#s.translateElements([t])}catch(e){console.error(`translateOnce: "${e}".`)}})}destroy(){return C(this,null,function*(){if(this.#e){for(let t of this.#e)this.#s.disconnectRoot(t);this.#e.clear(),this.#e=null}this.#s.pauseObserving()})}pause(){this.#s.pauseObserving()}resume(){this.#s.resumeObserving()}static#r(t){return t=t?.toLowerCase()||"en-us",{en:"en-us",es:"es-es",fy:"fy-nl",ga:"ga-ie",gu:"gu-in",hi:"hi-in",hy:"hy-am",nb:"nb-no",ne:"ne-np",nn:"nn-no",pa:"pa-in",pt:"pt-pt",sv:"sv-se",zh:"zh-cn"}[t]||t}static#n(t){let e=t.split("-",1)[0];return["ar","he","fa","ps","ur"].includes(e)}};function no(o,t){let e=new gr(t),i=new pr(o),s=i.addResource(e);return s.length&&console.error("L10n errors",s),i}var _e=class o extends yr{constructor(t){super({lang:t});let e=t?o.#t.bind(o,"en-us",this.getLanguage()):o.#s.bind(o,this.getLanguage());this._setL10n(new wr([],e))}static#t(t,e){return gs(this,null,function*(){let{baseURL:i,paths:s}=yield new ps(this.#i()),n=[e];if(t!==e){let r=e.split("-",1)[0];r!==e&&n.push(r),n.push(t)}for(let r of n){let a=yield new ps(this.#e(r,i,s));a?yield a:r==="en-us"&&(yield this.#r(r))}})}static#e(t,e,i){return C(this,null,function*(){let s=i[t];if(!s)return null;let n=new URL(s,e),r=yield za(n,"text");return no(t,r)})}static#i(){return C(this,null,function*(){try{let{href:t}=document.querySelector('link[type="application/l10n"]'),e=yield za(t,"json");return{baseURL:t.replace(/[^/]*$/,"")||"./",paths:e}}catch{}return{baseURL:"./",paths:Object.create(null)}})}static#s(t){return gs(this,null,function*(){yield this.#r(t)})}static#r(t){return C(this,null,function*(){return no(t,`pdfjs-previous-button =
20    .title = Previous Page
21pdfjs-previous-button-label = Previous
22pdfjs-next-button =
23    .title = Next Page
24pdfjs-next-button-label = Next
25pdfjs-page-input =
26    .title = Page
27pdfjs-of-pages = of { $pagesCount }
28pdfjs-page-of-pages = ({ $pageNumber } of { $pagesCount })
29pdfjs-zoom-out-button =
30    .title = Zoom Out
31pdfjs-zoom-out-button-label = Zoom Out
32pdfjs-zoom-in-button =
33    .title = Zoom In
34pdfjs-zoom-in-button-label = Zoom In
35pdfjs-zoom-select =
36    .title = Zoom
37pdfjs-presentation-mode-button =
38    .title = Switch to Presentation Mode
39pdfjs-presentation-mode-button-label = Presentation Mode
40pdfjs-open-file-button =
41    .title = Open File
42pdfjs-open-file-button-label = Open
43pdfjs-print-button =
44    .title = Print
45pdfjs-print-button-label = Print
46pdfjs-save-button =
47    .title = Save
48pdfjs-save-button-label = Save
49pdfjs-download-button =
50    .title = Download
51pdfjs-download-button-label = Download
52pdfjs-bookmark-button =
53    .title = Current Page (View URL from Current Page)
54pdfjs-bookmark-button-label = Current Page
55pdfjs-tools-button =
56    .title = Tools
57pdfjs-tools-button-label = Tools
58pdfjs-first-page-button =
59    .title = Go to First Page
60pdfjs-first-page-button-label = Go to First Page
61pdfjs-last-page-button =
62    .title = Go to Last Page
63pdfjs-last-page-button-label = Go to Last Page
64pdfjs-page-rotate-cw-button =
65    .title = Rotate Clockwise
66pdfjs-page-rotate-cw-button-label = Rotate Clockwise
67pdfjs-page-rotate-ccw-button =
68    .title = Rotate Counterclockwise
69pdfjs-page-rotate-ccw-button-label = Rotate Counterclockwise
70pdfjs-cursor-text-select-tool-button =
71    .title = Enable Text Selection Tool
72pdfjs-cursor-text-select-tool-button-label = Text Selection Tool
73pdfjs-cursor-hand-tool-button =
74    .title = Enable Hand Tool
75pdfjs-cursor-hand-tool-button-label = Hand Tool
76pdfjs-scroll-page-button =
77    .title = Use Page Scrolling
78pdfjs-scroll-page-button-label = Page Scrolling
79pdfjs-scroll-vertical-button =
80    .title = Use Vertical Scrolling
81pdfjs-scroll-vertical-button-label = Vertical Scrolling
82pdfjs-scroll-horizontal-button =
83    .title = Use Horizontal Scrolling
84pdfjs-scroll-horizontal-button-label = Horizontal Scrolling
85pdfjs-scroll-wrapped-button =
86    .title = Use Wrapped Scrolling
87pdfjs-scroll-wrapped-button-label = Wrapped Scrolling
88pdfjs-spread-none-button =
89    .title = Do not join page spreads
90pdfjs-spread-none-button-label = No Spreads
91pdfjs-spread-odd-button =
92    .title = Join page spreads starting with odd-numbered pages
93pdfjs-spread-odd-button-label = Odd Spreads
94pdfjs-spread-even-button =
95    .title = Join page spreads starting with even-numbered pages
96pdfjs-spread-even-button-label = Even Spreads
97pdfjs-document-properties-button =
98    .title = Document Properties\u2026
99pdfjs-document-properties-button-label = Document Properties\u2026
100pdfjs-document-properties-file-name = File name:
101pdfjs-document-properties-file-size = File size:
102pdfjs-document-properties-size-kb = { NUMBER($kb, maximumSignificantDigits: 3) } KB ({ $b } bytes)
103pdfjs-document-properties-size-mb = { NUMBER($mb, maximumSignificantDigits: 3) } MB ({ $b } bytes)
104pdfjs-document-properties-title = Title:
105pdfjs-document-properties-author = Author:
106pdfjs-document-properties-subject = Subject:
107pdfjs-document-properties-keywords = Keywords:
108pdfjs-document-properties-creation-date = Creation Date:
109pdfjs-document-properties-modification-date = Modification Date:
110pdfjs-document-properties-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }
111pdfjs-document-properties-creator = Creator:
112pdfjs-document-properties-producer = PDF Producer:
113pdfjs-document-properties-version = PDF Version:
114pdfjs-document-properties-page-count = Page Count:
115pdfjs-document-properties-page-size = Page Size:
116pdfjs-document-properties-page-size-unit-inches = in
117pdfjs-document-properties-page-size-unit-millimeters = mm
118pdfjs-document-properties-page-size-orientation-portrait = portrait
119pdfjs-document-properties-page-size-orientation-landscape = landscape
120pdfjs-document-properties-page-size-name-a-three = A3
121pdfjs-document-properties-page-size-name-a-four = A4
122pdfjs-document-properties-page-size-name-letter = Letter
123pdfjs-document-properties-page-size-name-legal = Legal
124pdfjs-document-properties-page-size-dimension-string = { $width } \xD7 { $height } { $unit } ({ $orientation })
125pdfjs-document-properties-page-size-dimension-name-string = { $width } \xD7 { $height } { $unit } ({ $name }, { $orientation })
126pdfjs-document-properties-linearized = Fast Web View:
127pdfjs-document-properties-linearized-yes = Yes
128pdfjs-document-properties-linearized-no = No
129pdfjs-document-properties-close-button = Close
130pdfjs-print-progress-message = Preparing document for printing\u2026
131pdfjs-print-progress-percent = { $progress }%
132pdfjs-print-progress-close-button = Cancel
133pdfjs-printing-not-supported = Warning: Printing is not fully supported by this browser.
134pdfjs-printing-not-ready = Warning: The PDF is not fully loaded for printing.
135pdfjs-toggle-sidebar-button =
136    .title = Toggle Sidebar
137pdfjs-toggle-sidebar-notification-button =
138    .title = Toggle Sidebar (document contains outline/attachments/layers)
139pdfjs-toggle-sidebar-button-label = Toggle Sidebar
140pdfjs-document-outline-button =
141    .title = Show Document Outline (double-click to expand/collapse all items)
142pdfjs-document-outline-button-label = Document Outline
143pdfjs-attachments-button =
144    .title = Show Attachments
145pdfjs-attachments-button-label = Attachments
146pdfjs-layers-button =
147    .title = Show Layers (double-click to reset all layers to the default state)
148pdfjs-layers-button-label = Layers
149pdfjs-thumbs-button =
150    .title = Show Thumbnails
151pdfjs-thumbs-button-label = Thumbnails
152pdfjs-current-outline-item-button =
153    .title = Find Current Outline Item
154pdfjs-current-outline-item-button-label = Current Outline Item
155pdfjs-findbar-button =
156    .title = Find in Document
157pdfjs-findbar-button-label = Find
158pdfjs-additional-layers = Additional Layers
159pdfjs-thumb-page-title =
160    .title = Page { $page }
161pdfjs-thumb-page-canvas =
162    .aria-label = Thumbnail of Page { $page }
163pdfjs-find-input =
164    .title = Find
165    .placeholder = Find in document\u2026
166pdfjs-find-previous-button =
167    .title = Find the previous occurrence of the phrase
168pdfjs-find-previous-button-label = Previous
169pdfjs-find-next-button =
170    .title = Find the next occurrence of the phrase
171pdfjs-find-next-button-label = Next
172pdfjs-find-highlight-checkbox = Highlight All
173pdfjs-find-match-case-checkbox-label = Match Case
174pdfjs-find-match-diacritics-checkbox-label = Match Diacritics
175pdfjs-find-entire-word-checkbox-label = Whole Words
176pdfjs-find-reached-top = Reached top of document, continued from bottom
177pdfjs-find-reached-bottom = Reached end of document, continued from top
178pdfjs-find-match-count =
179    { $total ->
180        [one] { $current } of { $total } match
181       *[other] { $current } of { $total } matches
182    }
183pdfjs-find-match-count-limit =
184    { $limit ->
185        [one] More than { $limit } match
186       *[other] More than { $limit } matches
187    }
188pdfjs-find-not-found = Phrase not found
189pdfjs-page-scale-width = Page Width
190pdfjs-page-scale-fit = Page Fit
191pdfjs-page-scale-auto = Automatic Zoom
192pdfjs-page-scale-actual = Actual Size
193pdfjs-page-scale-percent = { $scale }%
194pdfjs-page-landmark =
195    .aria-label = Page { $page }
196pdfjs-loading-error = An error occurred while loading the PDF.
197pdfjs-invalid-file-error = Invalid or corrupted PDF file.
198pdfjs-missing-file-error = Missing PDF file.
199pdfjs-unexpected-response-error = Unexpected server response.
200pdfjs-rendering-error = An error occurred while rendering the page.
201pdfjs-annotation-date-time-string = { DATETIME($dateObj, dateStyle: "short", timeStyle: "medium") }
202pdfjs-text-annotation-type =
203    .alt = [{ $type } Annotation]
204pdfjs-password-label = Enter the password to open this PDF file.
205pdfjs-password-invalid = Invalid password. Please try again.
206pdfjs-password-ok-button = OK
207pdfjs-password-cancel-button = Cancel
208pdfjs-web-fonts-disabled = Web fonts are disabled: unable to use embedded PDF fonts.
209pdfjs-editor-free-text-button =
210    .title = Text
211pdfjs-editor-free-text-button-label = Text
212pdfjs-editor-ink-button =
213    .title = Draw
214pdfjs-editor-ink-button-label = Draw
215pdfjs-editor-stamp-button =
216    .title = Add or edit images
217pdfjs-editor-stamp-button-label = Add or edit images
218pdfjs-editor-highlight-button =
219    .title = Highlight
220pdfjs-editor-highlight-button-label = Highlight
221pdfjs-highlight-floating-button1 =
222    .title = Highlight
223    .aria-label = Highlight
224pdfjs-highlight-floating-button-label = Highlight
225pdfjs-editor-remove-ink-button =
226    .title = Remove drawing
227pdfjs-editor-remove-freetext-button =
228    .title = Remove text
229pdfjs-editor-remove-stamp-button =
230    .title = Remove image
231pdfjs-editor-remove-highlight-button =
232    .title = Remove highlight
233pdfjs-editor-free-text-color-input = Color
234pdfjs-editor-free-text-size-input = Size
235pdfjs-editor-ink-color-input = Color
236pdfjs-editor-ink-thickness-input = Thickness
237pdfjs-editor-ink-opacity-input = Opacity
238pdfjs-editor-stamp-add-image-button =
239    .title = Add image
240pdfjs-editor-stamp-add-image-button-label = Add image
241pdfjs-editor-free-highlight-thickness-input = Thickness
242pdfjs-editor-free-highlight-thickness-title =
243    .title = Change thickness when highlighting items other than text
244pdfjs-free-text2 =
245    .aria-label = Text Editor
246    .default-content = Start typing\u2026
247pdfjs-ink =
248    .aria-label = Draw Editor
249pdfjs-ink-canvas =
250    .aria-label = User-created image
251pdfjs-editor-alt-text-button =
252    .aria-label = Alt text
253pdfjs-editor-alt-text-button-label = Alt text
254pdfjs-editor-alt-text-edit-button =
255    .aria-label = Edit alt text
256pdfjs-editor-alt-text-dialog-label = Choose an option
257pdfjs-editor-alt-text-dialog-description = Alt text (alternative text) helps when people can\u2019t see the image or when it doesn\u2019t load.
258pdfjs-editor-alt-text-add-description-label = Add a description
259pdfjs-editor-alt-text-add-description-description = Aim for 1-2 sentences that describe the subject, setting, or actions.
260pdfjs-editor-alt-text-mark-decorative-label = Mark as decorative
261pdfjs-editor-alt-text-mark-decorative-description = This is used for ornamental images, like borders or watermarks.
262pdfjs-editor-alt-text-cancel-button = Cancel
263pdfjs-editor-alt-text-save-button = Save
264pdfjs-editor-alt-text-decorative-tooltip = Marked as decorative
265pdfjs-editor-alt-text-textarea =
266    .placeholder = For example, \u201CA young man sits down at a table to eat a meal\u201D
267pdfjs-editor-resizer-top-left =
268    .aria-label = Top left corner \u2014 resize
269pdfjs-editor-resizer-top-middle =
270    .aria-label = Top middle \u2014 resize
271pdfjs-editor-resizer-top-right =
272    .aria-label = Top right corner \u2014 resize
273pdfjs-editor-resizer-middle-right =
274    .aria-label = Middle right \u2014 resize
275pdfjs-editor-resizer-bottom-right =
276    .aria-label = Bottom right corner \u2014 resize
277pdfjs-editor-resizer-bottom-middle =
278    .aria-label = Bottom middle \u2014 resize
279pdfjs-editor-resizer-bottom-left =
280    .aria-label = Bottom left corner \u2014 resize
281pdfjs-editor-resizer-middle-left =
282    .aria-label = Middle left \u2014 resize
283pdfjs-editor-highlight-colorpicker-label = Highlight color
284pdfjs-editor-colorpicker-button =
285    .title = Change color
286pdfjs-editor-colorpicker-dropdown =
287    .aria-label = Color choices
288pdfjs-editor-colorpicker-yellow =
289    .title = Yellow
290pdfjs-editor-colorpicker-green =
291    .title = Green
292pdfjs-editor-colorpicker-blue =
293    .title = Blue
294pdfjs-editor-colorpicker-pink =
295    .title = Pink
296pdfjs-editor-colorpicker-red =
297    .title = Red
298pdfjs-editor-highlight-show-all-button-label = Show all
299pdfjs-editor-highlight-show-all-button =
300    .title = Show all
301pdfjs-editor-new-alt-text-dialog-edit-label = Edit alt text (image description)
302pdfjs-editor-new-alt-text-dialog-add-label = Add alt text (image description)
303pdfjs-editor-new-alt-text-textarea =
304    .placeholder = Write your description here\u2026
305pdfjs-editor-new-alt-text-description = Short description for people who can\u2019t see the image or when the image doesn\u2019t load.
306pdfjs-editor-new-alt-text-disclaimer1 = This alt text was created automatically and may be inaccurate.
307pdfjs-editor-new-alt-text-disclaimer-learn-more-url = Learn more
308pdfjs-editor-new-alt-text-create-automatically-button-label = Create alt text automatically
309pdfjs-editor-new-alt-text-not-now-button = Not now
310pdfjs-editor-new-alt-text-error-title = Couldn\u2019t create alt text automatically
311pdfjs-editor-new-alt-text-error-description = Please write your own alt text or try again later.
312pdfjs-editor-new-alt-text-error-close-button = Close
313pdfjs-editor-new-alt-text-ai-model-downloading-progress = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)
314    .aria-valuetext = Downloading alt text AI model ({ $downloadedSize } of { $totalSize } MB)
315pdfjs-editor-new-alt-text-added-button =
316    .aria-label = Alt text added
317pdfjs-editor-new-alt-text-added-button-label = Alt text added
318pdfjs-editor-new-alt-text-missing-button =
319    .aria-label = Missing alt text
320pdfjs-editor-new-alt-text-missing-button-label = Missing alt text
321pdfjs-editor-new-alt-text-to-review-button =
322    .aria-label = Review alt text
323pdfjs-editor-new-alt-text-to-review-button-label = Review alt text
324pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer = Created automatically: { $generatedAltText }
325pdfjs-image-alt-text-settings-button =
326    .title = Image alt text settings
327pdfjs-image-alt-text-settings-button-label = Image alt text settings
328pdfjs-editor-alt-text-settings-dialog-label = Image alt text settings
329pdfjs-editor-alt-text-settings-automatic-title = Automatic alt text
330pdfjs-editor-alt-text-settings-create-model-button-label = Create alt text automatically
331pdfjs-editor-alt-text-settings-create-model-description = Suggests descriptions to help people who can\u2019t see the image or when the image doesn\u2019t load.
332pdfjs-editor-alt-text-settings-download-model-label = Alt text AI model ({ $totalSize } MB)
333pdfjs-editor-alt-text-settings-ai-model-description = Runs locally on your device so your data stays private. Required for automatic alt text.
334pdfjs-editor-alt-text-settings-delete-model-button = Delete
335pdfjs-editor-alt-text-settings-download-model-button = Download
336pdfjs-editor-alt-text-settings-downloading-model-button = Downloading\u2026
337pdfjs-editor-alt-text-settings-editor-title = Alt text editor
338pdfjs-editor-alt-text-settings-show-dialog-button-label = Show alt text editor right away when adding an image
339pdfjs-editor-alt-text-settings-show-dialog-description = Helps you make sure all your images have alt text.
340pdfjs-editor-alt-text-settings-close-button = Close`)})}},Mc=1e3,ar=50,ro=1e3;function or(){return document.location.hash}var vr=class{#t=null;constructor({linkService:t,eventBus:e}){this.linkService=t,this.eventBus=e,this._initialized=!1,this._fingerprint="",this.reset(),this.eventBus._on("pagesinit",()=>{this._isPagesLoaded=!1,this.eventBus._on("pagesloaded",i=>{this._isPagesLoaded=!!i.pagesCount},{once:!0})})}initialize({fingerprint:t,resetHistory:e=!1,updateUrl:i=!1}){if(!t||typeof t!="string"){console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');return}this._initialized&&this.reset();let s=this._fingerprint!==""&&this._fingerprint!==t;this._fingerprint=t,this._updateUrl=i===!0,this._initialized=!0,this.#d();let n=window.history.state;if(this._popStateInProgress=!1,this._blockHashChange=0,this._currentHash=or(),this._numPositionUpdates=0,this._uid=this._maxUid=0,this._destination=null,this._position=null,!this.#r(n,!0)||e){let{hash:a,page:l,rotation:h}=this.#l(!0);if(!a||s||e){this.#e(null,!0);return}this.#e({hash:a,page:l,rotation:h},!0);return}let r=n.destination;this.#n(r,n.uid,!0),r.rotation!==void 0&&(this._initialRotation=r.rotation),r.dest?(this._initialBookmark=JSON.stringify(r.dest),this._destination.page=null):r.hash?this._initialBookmark=r.hash:r.page&&(this._initialBookmark=`page=${r.page}`)}reset(){this._initialized&&(this.#o(),this._initialized=!1,this.#a()),this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._initialBookmark=null,this._initialRotation=null}push({namedDest:t=null,explicitDest:e,pageNumber:i}){if(!this._initialized)return;if(t&&typeof t!="string"){console.error(`PDFHistory.push: "${t}" is not a valid namedDest parameter.`);return}else if(Array.isArray(e)){if(!this.#s(i)&&(i!==null||this._destination)){console.error(`PDFHistory.push: "${i}" is not a valid pageNumber parameter.`);return}}else{console.error(`PDFHistory.push: "${e}" is not a valid explicitDest parameter.`);return}let s=t||JSON.stringify(e);if(!s)return;let n=!1;if(this._destination&&(kc(this._destination.hash,s)||Ic(this._destination.dest,e))){if
340(this._destination.page)return;n=!0}this._popStateInProgress&&!n||(this.#e({dest:e,hash:s,page:i,rotation:this.linkService.rotation},n),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1})))}pushPage(t){if(this._initialized){if(!this.#s(t)){console.error(`PDFHistory.pushPage: "${t}" is not a valid page number.`);return}this._destination?.page!==t&&(this._popStateInProgress||(this.#e({dest:null,hash:`page=${t}`,page:t,rotation:this.linkService.rotation}),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then(()=>{this._popStateInProgress=!1}))))}}pushCurrentPosition(){!this._initialized||this._popStateInProgress||this.#i()}back(){if(!this._initialized||this._popStateInProgress)return;let t=window.history.state;this.#r(t)&&t.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;let t=window.history.state;this.#r(t)&&t.uid<this._maxUid&&window.history.forward()}get popStateInProgress(){return this._initialized&&(this._popStateInProgress||this._blockHashChange>0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}#e(t,e=!1){let i=e||!this._destination,s={fingerprint:this._fingerprint,uid:i?this._uid:this._uid+1,destination:t};this.#n(t,s.uid);let n;if(this._updateUrl&&t?.hash){let r=document.location.href.split("#",1)[0];r.startsWith("file://")||(n=`${r}#${t.hash}`)}i?window.history.replaceState(s,"",n):window.history.pushState(s,"",n)}#i(t=!1){if(!this._position)return;let e=this._position;if(t&&(e=Object.assign(Object.create(null),this._position),e.temporary=!0),!this._destination){this.#e(e);return}if(this._destination.temporary){this.#e(e,!0);return}if(this._destination.hash===e.hash||!this._destination.page&&(ar<=0||this._numPositionUpdates<=ar))return;let i=!1;if(this._destination.page>=e.first&&this._destination.page<=e.page){if(this._destination.dest!==void 0||!this._destination.first)return;i=!0}this.#e(e,i)}#s(t){return Number.isInteger(t)&&t>0&&t<=this.linkService.pagesCount}#r(t,e=!1){if(!t)return!1;if(t.fingerprint!==this._fingerprint)if(e){if(typeof t.fingerprint!="string"||t.fingerprint.length!==this._fingerprint.length)return!1;let[i]=performance.getEntriesByType("navigation");if(i?.type!=="reload")return!1}else return!1;return!(!Number.isInteger(t.uid)||t.uid<0||t.destination===null||typeof t.destination!="object")}#n(t,e,i=!1){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),i&&t?.temporary&&delete t.temporary,this._destination=t,this._uid=e,this._maxUid=Math.max(this._maxUid,e),this._numPositionUpdates=0}#l(t=!1){let e=unescape(or()).substring(1),i=us(e),s=i.get("nameddest")||"",n=i.get("page")|0;return(!this.#s(n)||t&&s.length>0)&&(n=null),{hash:e,page:n,rotation:this.linkService.rotation}}#h({location:t}){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._position={hash:t.pdfOpenParams.substring(1),page:this.linkService.page,first:t.pageNumber,rotation:t.rotation},!this._popStateInProgress&&(ar>0&&this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++,ro>0&&(this._updateViewareaTimeout=setTimeout(()=>{this._popStateInProgress||this.#i(!0),this._updateViewareaTimeout=null},ro)))}#c({state:t}){let e=or(),i=this._currentHash!==e;if(this._currentHash=e,!t){this._uid++;let{hash:n,page:r,rotation:a}=this.#l();this.#e({hash:n,page:r,rotation:a},!0);return}if(!this.#r(t))return;this._popStateInProgress=!0,i&&(this._blockHashChange++,Uh({target:window,name:"hashchange",delay:Mc}).then(()=>{this._blockHashChange--}));let s=t.destination;this.#n(s,t.uid,!0),uo(s.rotation)&&(this.linkService.rotation=s.rotation),s.dest?this.linkService.goToDestination(s.dest):s.hash?this.linkService.setHash(s.hash):s.page&&(this.linkService.page=s.page),Promise.resolve().then(()=>{this._popStateInProgress=!1})}#o(){(!this._destination||this._destination.temporary)&&this.#i()}#d(){if(this.#t)return;this.#t=new AbortController;let{signal:t}=this.#t;this.eventBus._on("updateviewarea",this.#h.bind(this),{signal:t}),window.addEventListener("popstate",this.#c.bind(this),{signal:t}),window.addEventListener("pagehide",this.#o.bind(this),{signal:t})}#a(){this.#t?.abort(),this.#t=null}};function kc(o,t){return typeof o!="string"||typeof t!="string"?!1:o===t||us(o).get("nameddest")===t}
340function Ic(o,t){function e(i,s){if(typeof i!=typeof s||Array.isArray(i)||Array.isArray(s))return!1;if(i!==null&&typeof i=="object"&&s!==null){if(Object.keys(i).length!==Object.keys(s).length)return!1;for(let n in i)if(!e(i[n],s[n]))return!1;return!0}return i===s||Number.isNaN(i)&&Number.isNaN(s)}if(!(Array.isArray(o)&&Array.isArray(t))||o.length!==t.length)return!1;for(let i=0,s=o.length;i<s;i++)if(!e(o[i],t[i]))return!1;return!0}var Er=class{#t=null;#e=null;#i=null;#s=null;#r=null;#n;constructor(t){this.pdfPage=t.pdfPage,this.accessibilityManager=t.accessibilityManager,this.l10n=t.l10n,this.l10n||=new _e,this.annotationEditorLayer=null,this.div=null,this._cancelled=!1,this.#n=t.uiManager,this.#t=t.annotationLayer||null,this.#r=t.textLayer||null,this.#e=t.drawLayer||null,this.#i=t.onAppend||null,this.#s=t.structTreeLayer||null}render(t,e="display"){return C(this,null,function*(){if(e!=="display"||this._cancelled)return;let i=t.clone({dontFlip:!0});if(this.div){this.annotationEditorLayer.update({viewport:i}),this.show();return}let s=this.div=document.createElement("div");s.className="annotationEditorLayer",s.hidden=!0,s.dir=this.#n.direction,this.#i?.(s),this.annotationEditorLayer=new Rh({uiManager:this.#n,div:s,structTreeLayer:this.#s,accessibilityManager:this.accessibilityManager,pageIndex:this.pdfPage.pageNumber-1,l10n:this.l10n,viewport:i,annotationLayer:this.#t,textLayer:this.#r,drawLayer:this.#e});let n={viewport:i,div:s,annotations:null,intent:e};this.annotationEditorLayer.render(n),this.show()})}cancel(){this._cancelled=!0,this.div&&this.annotationEditorLayer.destroy()}hide(){this.div&&(this.div.hidden=!0)}show(){!this.div||this.annotationEditorLayer.isInvisible||(this.div.hidden=!1)}};{ts=new Map;let o=navigator.userAgent||"",t=navigator.platform||"",e=navigator.maxTouchPoints||1,i=/Android/.test(o),s=/\b(iPad|iPhone|iPod)(?=;)/.test(o)||t==="MacIntel"&&e>1;(function(){(s||i)&&ts.set("maxCanvasPixels",5242880)})(),(function(){i&&ts.set("useSystemFonts",!1)})()}var ts,x={BROWSER:1,VIEWER:2,API:4,WORKER:8,EVENT_DISPATCH:16,PREFERENCE:128},xr={BOOLEAN:1,NUMBER:2,OBJECT:4,STRING:8,UNDEFINED:16},Mt={allowedGlobalEvents:{value:null,kind:x.BROWSER},canvasMaxAreaInBytes:{value:-1,kind:x.BROWSER+x.API},isInAutomation:{value:!1,kind:x.BROWSER},localeProperties:{value:{lang:navigator.language||"en-US"},kind:x.BROWSER},nimbusDataStr:{value:"",kind:x.BROWSER},supportsCaretBrowsingMode:{value:!1,kind:x.BROWSER},supportsDocumentFonts:{value:!0,kind:x.BROWSER},supportsIntegratedFind:{value:!1,kind:x.BROWSER},supportsMouseWheelZoomCtrlKey:{value:!0,kind:x.BROWSER},supportsMouseWheelZoomMetaKey:{value:!0,kind:x.BROWSER},supportsPinchToZoom:{value:!0,kind:x.BROWSER},toolbarDensity:{value:0,kind:x.BROWSER+x.EVENT_DISPATCH},altTextLearnMoreUrl:{value:"",kind:x.VIEWER+x.PREFERENCE},annotationEditorMode:{value:0,kind:x.VIEWER+x.PREFERENCE},annotationMode:{value:2,kind:x.VIEWER+x.PREFERENCE},cursorToolOnLoad:{value:0,kind:x.VIEWER+x.PREFERENCE},debuggerSrc:{value:"./debugger.mjs",kind:x.VIEWER},defaultZoomDelay:{value:400,kind:x.VIEWER+x.PREFERENCE},defaultZoomValue:{value:"",kind:x.VIEWER+x.PREFERENCE},disableHistory:{value:!1,kind:x.VIEWER},disablePageLabels:{value:!1,kind:x.VIEWER+x.PREFERENCE},enableAltText:{value:!1,kind:x.VIEWER+x.PREFERENCE},enableAltTextModelDownload:{value:!0,kind:x.VIEWER+x.PREFERENCE+x.EVENT_DISPATCH},enableGuessAltText:{value:!0,kind:x.VIEWER+x.PREFERENCE+x.EVENT_DISPATCH},enableHighlightFloatingButton:{value:!1,kind:x.VIEWER+x.PREFERENCE},enableNewAltTextWhenAddingImage:{value:!0,kind:x.VIEWER+x.PREFERENCE},enablePermissions:{value:!1,kind:x.VIEWER+x.PREFERENCE},enablePrintAutoRotate:{value:!0,kind:x.VIEWER+x.PREFERENCE},enableScripting:{value:!0,kind:x.VIEWER+x.PREFERENCE},enableUpdatedAddImage:{value:!1,kind:x.VIEWER+x.PREFERENCE},externalLinkRel:{value:"noopener noreferrer nofollow",kind:x.VIEWER},externalLinkTarget:{value:0,kind:x.VIEWER+x.PREFERENCE},highlightEditorColors:{value:"yellow=#FFFF98,green=#53FFBC,blue=#80EBFF,pink=#FFCBE6,red=#FF4F5F",kind:x.VIEWER+x.PREFERENCE},historyUpdateUrl:{value:!1,kind:x.VIEWER+x.PREFERENCE},ignoreDestinationZoom:{value:!1,kind:x.VIEWER+x.PREFERENCE},imageResourcesPath:{value:"./images/",kind:x.VIEWER},maxCanvasPixels:{value:2**25,kind:x.VIEWER},forcePageColors:{value:!1,kind:x.VIEWER+x.PREFERENCE}
340,pageColorsBackground:{value:"Canvas",kind:x.VIEWER+x.PREFERENCE},pageColorsForeground:{value:"CanvasText",kind:x.VIEWER+x.PREFERENCE},pdfBugEnabled:{value:!1,kind:x.VIEWER+x.PREFERENCE},printResolution:{value:150,kind:x.VIEWER},sidebarViewOnLoad:{value:-1,kind:x.VIEWER+x.PREFERENCE},scrollModeOnLoad:{value:-1,kind:x.VIEWER+x.PREFERENCE},spreadModeOnLoad:{value:-1,kind:x.VIEWER+x.PREFERENCE},textLayerMode:{value:1,kind:x.VIEWER+x.PREFERENCE},viewOnLoad:{value:0,kind:x.VIEWER+x.PREFERENCE},cMapPacked:{value:!0,kind:x.API},cMapUrl:{value:"../web/cmaps/",kind:x.API},disableAutoFetch:{value:!1,kind:x.API+x.PREFERENCE},disableFontFace:{value:!1,kind:x.API+x.PREFERENCE},disableRange:{value:!1,kind:x.API+x.PREFERENCE},disableStream:{value:!1,kind:x.API+x.PREFERENCE},docBaseUrl:{value:"",kind:x.API},enableHWA:{value:!0,kind:x.API+x.VIEWER+x.PREFERENCE},enableXfa:{value:!0,kind:x.API+x.PREFERENCE},fontExtraProperties:{value:!1,kind:x.API},isEvalSupported:{value:!0,kind:x.API},isOffscreenCanvasSupported:{value:!0,kind:x.API},maxImageSize:{value:-1,kind:x.API},pdfBug:{value:!1,kind:x.API},standardFontDataUrl:{value:"../web/standard_fonts/",kind:x.API},useSystemFonts:{value:void 0,kind:x.API,type:xr.BOOLEAN+xr.UNDEFINED},verbosity:{value:1,kind:x.API},workerPort:{value:null,kind:x.WORKER},workerSrc:{value:"../build/pdf.worker.mjs",kind:x.WORKER}};Mt.defaultUrl={value:"compressed.tracemonkey-pldi-09.pdf",kind:x.VIEWER},Mt.sandboxBundleSrc={value:"../build/pdf.sandbox.mjs",kind:x.VIEWER},Mt.viewerCssTheme={value:0,kind:x.VIEWER+x.PREFERENCE},Mt.enableFakeMLManager={value:!0,kind:x.VIEWER};Mt.disablePreferences={value:!1,kind:x.VIEWER};var qt,Tt=class Tt{static get(t){return lt(this,qt).get(t)}static getAll(t=null,e=!1){let i=Object.create(null);for(let s in Mt){let n=Mt[s];t&&!(t&n.kind)||(i[s]=e?n.value:lt(this,qt).get(s))}return i}static set(t,e){this.setAll({[t]:e})}static setAll(t,e=!1){this._hasInvokedSet||=!0;let i;for(let s in t){let n=Mt[s],r=t[s];if(!n||!(typeof r==typeof n.value||xr[(typeof r).toUpperCase()]&n.type))continue;let{kind:a}=n;e&&!(a&x.BROWSER||a&x.PREFERENCE)||(this.eventBus&&a&x.EVENT_DISPATCH&&(i||=new Map).set(s,r),lt(this,qt).set(s,r))}if(i)for(let[s,n]of i)this.eventBus.dispatch(s.toLowerCase(),{source:this,value:n})}};qt=new WeakMap,Ur(Tt,"eventBus"),zt(Tt,qt,new Map),(()=>{for(let t in Mt)lt(Tt,qt).set(t,Mt[t].value);for(let[t,e]of ts)lt(Tt,qt).set(t,e);Tt._hasInvokedSet=!1,Tt._checkDisablePreferences=()=>Tt.get("disablePreferences")?!0:(Tt._hasInvokedSet&&console.warn('The Preferences may override manually set AppOptions; please use the "disablePreferences"-option to prevent that.'),!1)})();var Cr=Tt,Sr=class{#t=null;constructor(t){this.pageIndex=t.pageIndex}render(t="display"){return C(this,null,function*(){t!=="display"||this.#t||this._cancelled||(this.#t=new Fh({pageIndex:this.pageIndex}))})}cancel(){this._cancelled=!0,this.#t&&(this.#t.destroy(),this.#t=null)}setParent(t){this.#t?.setParent(t)}getDrawLayer(){return this.#t}},ao={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},Rc=/^H(\d+)$/,os=class{#t;#e=null;#i;#s=new Map;#r;#n=null;constructor(t,e){this.#t=t.getStructTree(),this.#r=e}render(){return C(this,null,function*(){if(this.#i)return this.#i;let{promise:t,resolve:e,reject:i}=Promise.withResolvers();this.#i=t;try{this.#e=this.#c(yield this.#t)}catch(s){i(s)}return this.#t=null,this.#e?.classList.add("structTree"),e(this.#e),t})}getAriaAttributes(t){return C(this,null,function*(){try{return yield this.render(),this.#s.get(t)}catch{}return null})}hide(){this.#e&&!this.#e.hidden&&(this.#e.hidden=!0)}show(){this.#e?.hidden&&(this.#e.hidden=!1)}#l(t,e){let{alt:i,id:s,lang:n}=t;if(i!==void 0){let r=!1,a=Ue(i);for(let l of t.children)if(l.type==="annotation"){let h=this.#s.get(l.id);h||(h=new Map,this.#s.set(l.id,h)),h.set("aria-label",a),r=!0}r||e.setAttribute("aria-label",a)}s!==void 0&&e.setAttribute("aria-owns",s),n!==void 0&&e.setAttribute("lang",Ue(n,!0))}#h(t,e){let{alt:i,bbox:s,children:n}=t,r=n?.[0];if(!this.#r||!i||!s||r?.type!=="content")return!1;let{id:a}=r;if(!a)return!1;e.setAttribute("aria-owns",a);
340let l=document.createElement("span");(this.#n||=new Map).set(a,l),l.setAttribute("role","img"),l.setAttribute("aria-label",Ue(i));let{pageHeight:h,pageX:c,pageY:d}=this.#r,u="calc(var(--scale-factor)*",{style:f}=l;return f.width=`${u}${s[2]-s[0]}px)`,f.height=`${u}${s[3]-s[1]}px)`,f.left=`${u}${s[0]-c}px)`,f.top=`${u}${h-s[3]+d}px)`,!0}addElementsToTextLayer(){if(this.#n){for(let[t,e]of this.#n)document.getElementById(t)?.append(e);this.#n.clear(),this.#n=null}}#c(t){if(!t)return null;let e=document.createElement("span");if("role"in t){let{role:i}=t,s=i.match(Rc);if(s?(e.setAttribute("role","heading"),e.setAttribute("aria-level",s[1])):ao[i]&&e.setAttribute("role",ao[i]),i==="Figure"&&this.#h(t,e))return e}if(this.#l(t,e),t.children)if(t.children.length===1&&"id"in t.children[0])this.#l(t.children[0],e);else for(let i of t.children)e.append(this.#c(i));return e}},Pr=class o{#t=!1;#e=null;#i=new Map;#s=new Map;setTextMapping(t){this.#e=t}static#r(t,e){let i=t.getBoundingClientRect(),s=e.getBoundingClientRect();if(i.width===0&&i.height===0)return 1;if(s.width===0&&s.height===0)return-1;let n=i.y,r=i.y+i.height,a=i.y+i.height/2,l=s.y,h=s.y+s.height,c=s.y+s.height/2;if(a<=l&&c>=r)return-1;if(c<=n&&a>=h)return 1;let d=i.x+i.width/2,u=s.x+s.width/2;return d-u}enable(){if(this.#t)throw new Error("TextAccessibilityManager is already enabled.");if(!this.#e)throw new Error("Text divs and strings have not been set.");if(this.#t=!0,this.#e=this.#e.slice(),this.#e.sort(o.#r),this.#i.size>0){let t=this.#e;for(let[e,i]of this.#i){if(!document.getElementById(e)){this.#i.delete(e);continue}this.#n(e,t[i])}}for(let[t,e]of this.#s)this.addPointerInTextLayer(t,e);this.#s.clear()}disable(){this.#t&&(this.#s.clear(),this.#e=null,this.#t=!1)}removePointerInTextLayer(t){if(!this.#t){this.#s.delete(t);return}let e=this.#e;if(!e||e.length===0)return;let{id:i}=t,s=this.#i.get(i);if(s===void 0)return;let n=e[s];this.#i.delete(i);let r=n.getAttribute("aria-owns");r?.includes(i)&&(r=r.split(" ").filter(a=>a!==i).join(" "),r?n.setAttribute("aria-owns",r):(n.removeAttribute("aria-owns"),n.setAttribute("role","presentation")))}#n(t,e){let i=e.getAttribute("aria-owns");i?.includes(t)||e.setAttribute("aria-owns",i?`${i} ${t}`:t),e.removeAttribute("role")}addPointerInTextLayer(t,e){let{id:i}=t;if(!i)return null;if(!this.#t)return this.#s.set(t,e),null;e&&this.removePointerInTextLayer(t);let s=this.#e;if(!s||s.length===0)return null;let n=$e(s,h=>o.#r(t,h)<0),r=Math.max(0,n-1),a=s[r];this.#n(i,a),this.#i.set(i,r);let l=a.parentNode;return l?.classList.contains("markedContent")?l.id:null}moveElementInDOM(t,e,i,s){let n=this.addPointerInTextLayer(i,s);if(!t.hasChildNodes())return t.append(e),n;let r=Array.from(t.childNodes).filter(h=>h!==e);if(r.length===0)return n;let a=i||e,l=$e(r,h=>o.#r(a,h)<0);return l===0?r[0].before(e):r[l-1].after(e),n}},Tr=class{#t=null;constructor({findController:t,eventBus:e,pageIndex:i}){this.findController=t,this.matches=[],this.eventBus=e,this.pageIdx=i,this.textDivs=null,this.textContentItemsStr=null,this.enabled=!1}setTextMapping(t,e){this.textDivs=t,this.textContentItemsStr=e}enable(){if(!this.textDivs||!this.textContentItemsStr)throw new Error("Text divs and strings have not been set.");if(this.enabled)throw new Error("TextHighlighter is already enabled.");this.enabled=!0,this.#t||(this.#t=new AbortController,this.eventBus._on("updatetextlayermatches",t=>{(t.pageIndex===this.pageIdx||t.pageIndex===-1)&&this._updateMatches()},{signal:this.#t.signal})),this._updateMatches()}disable(){this.enabled&&(this.enabled=!1,this.#t?.abort(),this.#t=null,this._updateMatches(!0))}_convertMatches(t,e){if(!t)return[];let{textContentItemsStr:i}=this,s=0,n=0,r=i.length-1,a=[];for(let l=0,h=t.length;l<h;l++){let c=t[l];for(;s!==r&&c>=n+i[s].length;)n+=i[s].length,s++;s===i.length&&console.error("Could not find a matching mapping");let d={begin:{divIdx:s,offset:c-n}};for(c+=e[l];s!==r&&c>n+i[s].length;)n+=i[s].length,s++;d.end={divIdx:s,offset:c-n},a.push(d)}return a}_renderMatches(t){if(t.length===0)return;let{findController:e,pageIdx:i}=this,{textContentItemsStr:s,textDivs:n}=this,r=i===e.selected.pageIdx,a=e.selected.matchIdx,l=e.state.highlightAll,h=null,c={divIdx:-1,offset:void 0};function d(m,w){let y=m.divIdx;return n[y].textContent="",u(y,0,m.offset,w)}function u(m,w,y,A){let v=n[m];if(v.nodeType===Node.TEXT_NODE){let T=document.createElement("span");v.before(T),T.append(v),n[m]=T,v=T}let S=s[m].substring(w,y),P=document.createTextNode(S);if(A){let T=document.createElement("span");return T.className=`${A}
340 appended`,T.append(P),v.append(T),A.includes("selected")?T.offsetLeft:0}return v.append(P),0}let f=a,p=f+1;if(l)f=0,p=t.length;else if(!r)return;let g=-1,b=-1;for(let m=f;m<p;m++){let w=t[m],y=w.begin;if(y.divIdx===g&&y.offset===b)continue;g=y.divIdx,b=y.offset;let A=w.end,v=r&&m===a,S=v?" selected":"",P=0;if(!h||y.divIdx!==h.divIdx?(h!==null&&u(h.divIdx,h.offset,c.offset),d(y)):u(h.divIdx,h.offset,y.offset),y.divIdx===A.divIdx)P=u(y.divIdx,y.offset,A.offset,"highlight"+S);else{P=u(y.divIdx,y.offset,c.offset,"highlight begin"+S);for(let T=y.divIdx+1,_=A.divIdx;T<_;T++)n[T].className="highlight middle"+S;d(A,"highlight end"+S)}h=A,v&&e.scrollMatchIntoView({element:n[y.divIdx],selectedLeft:P,pageIndex:i,matchIndex:a})}h&&u(h.divIdx,h.offset,c.offset)}_updateMatches(t=!1){if(!this.enabled&&!t)return;let{findController:e,matches:i,pageIdx:s}=this,{textContentItemsStr:n,textDivs:r}=this,a=-1;for(let c of i){let d=Math.max(a,c.begin.divIdx);for(let u=d,f=c.end.divIdx;u<=f;u++){let p=r[u];p.textContent=n[u],p.className=""}a=c.end.divIdx+1}if(!e?.highlightMatches||t)return;let l=e.pageMatches[s]||null,h=e.pageMatchesLength[s]||null;this.matches=this._convertMatches(l,h),this._renderMatches(this.matches)}},ls=class o{#t=!1;#e=null;#i=!1;#s=null;static#r=new Map;static#n=null;constructor({pdfPage:t,highlighter:e=null,accessibilityManager:i=null,enablePermissions:s=!1,onAppend:n=null}){this.pdfPage=t,this.highlighter=e,this.accessibilityManager=i,this.#t=s===!0,this.#e=n,this.div=document.createElement("div"),this.div.tabIndex=0,this.div.className="textLayer"}render(t,e=null){return C(this,null,function*(){if(this.#i&&this.#s){this.#s.update({viewport:t,onBefore:this.hide.bind(this)}),this.show();return}this.cancel(),this.#s=new Wh({textContentSource:this.pdfPage.streamTextContent(e||{includeMarkedContent:!0,disableNormalization:!0}),container:this.div,viewport:t});let{textDivs:i,textContentItemsStr:s}=this.#s;this.highlighter?.setTextMapping(i,s),this.accessibilityManager?.setTextMapping(i),yield this.#s.render(),this.#i=!0;let n=document.createElement("div");n.className="endOfContent",this.div.append(n),this.#l(n),this.#e?.(this.div),this.highlighter?.enable(),this.accessibilityManager?.enable()})}hide(){!this.div.hidden&&this.#i&&(this.highlighter?.disable(),this.div.hidden=!0)}show(){this.div.hidden&&this.#i&&(this.div.hidden=!1,this.highlighter?.enable())}cancel(){this.#s?.cancel(),this.#s=null,this.highlighter?.disable(),this.accessibilityManager?.disable(),o.#h(this.div)}#l(t){let{div:e}=this;e.addEventListener("mousedown",()=>{e.classList.add("selecting")}),e.addEventListener("copy",i=>{if(!this.#t){let s=document.getSelection();i.clipboardData.setData("text/plain",Ue(jh(s.toString())))}i.preventDefault(),i.stopPropagation()}),o.#r.set(e,t),o.#c()}static#h(t){this.#r.delete(t),this.#r.size===0&&(this.#n?.abort(),this.#n=null)}static#c(){if(this.#n)return;this.#n=new AbortController;let{signal:t}=this.#n,e=(r,a)=>{a.append(r),r.style.width="",r.style.height="",a.classList.remove("selecting")},i=!1;document.addEventListener("pointerdown",()=>{i=!0},{signal:t}),document.addEventListener("pointerup",()=>{i=!1,this.#r.forEach(e)},{signal:t}),window.addEventListener("blur",()=>{i=!1,this.#r.forEach(e)},{signal:t}),document.addEventListener("keyup",()=>{i||this.#r.forEach(e)},{signal:t});var s,n;document.addEventListener("selectionchange",()=>{let r=document.getSelection();if(r.rangeCount===0){this.#r.forEach(e);return}let a=new Set;for(let f=0;f<r.rangeCount;f++){let p=r.getRangeAt(f);for(let g of this.#r.keys())!a.has(g)&&p.intersectsNode(g)&&a.add(g)}for(let[f,p]of this.#r)a.has(f)?f.classList.add("selecting"):e(p,f);if(s??=getComputedStyle(this.#r.values().next().value).getPropertyValue("-moz-user-select")==="none",s)return;let l=r.getRangeAt(0),h=n&&(l.compareBoundaryPoints(Range.END_TO_END,n)===0||l.compareBoundaryPoints(Range.START_TO_END,n)===0),c=h?l.startContainer:l.endContainer;c.nodeType===Node.TEXT_NODE&&(c=c.parentNode);let d=c.parentElement?.closest(".textLayer"),u=this.#r.get(d);u&&(u.style.width=d.style.width,u.style.height=d.style.height,c.parentElement.insertBefore(u,h?c:c.nextSibling)),n=l.cloneRange()},{signal:t})}},hs=class{constructor({pdfPage:t,annotationStorage:e=null,linkService:i,xfaHtml:s=null}){this.pdfPage=t,this.annotationStorage=e,this.linkService=i,this.xfaHtml=s,this.div=null,this._cancelled=!1}render(t,e="display"){return C(this,null,function*(){if(e==="print"){let n={viewport:t.clone({dontFlip:!0}),div:this.div,xfaHtml:this.xfaHtml,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:e};return this.div=document.createElement("div"),n.div=this.div,sr.render(n)}let i=yield this.pdfPage.getXfa();if(this._cancelled||!i)return{textDivs:[]};let s={viewport:t.clone({dontFlip:!0}),div:this.div,xfaHtml:i,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:e};return this.div?sr.update(s):(this.div=document.createElement("div"),s.div=this.div,sr.render(s))})}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}},Oc={annotationEditorUIManager:null,annotationStorage:null,downloadManager:null,enableScripting:!1,fieldObjectsPromise:null,findController:null,hasJSActionsProm
340ise:null,get linkService(){return new Ge}},Dc=new Map([["canvasWrapper",0],["textLayer",1],["annotationLayer",2],["annotationEditorLayer",3],["xfaLayer",3]]),cs=class{#t=jt.ENABLE_FORMS;#e=!1;#i=!1;#s=!1;#r=null;#n=null;#l=null;#h=1;#c=1;#o=null;#d=J.INITIAL;#a=Lt.ENABLE;#u={directDrawing:!0,initialOptionalContent:!0,regularAnnotations:!0};#p=new WeakMap;#f=[null,null,null,null];constructor(t){let e=t.container,i=t.defaultViewport;this.id=t.id,this.renderingId="page"+this.id,this.#r=t.layerProperties||Oc,this.pdfPage=null,this.pageLabel=null,this.rotation=0,this.scale=t.scale||ho,this.viewport=i,this.pdfPageRotate=i.rotation,this._optionalContentConfigPromise=t.optionalContentConfigPromise||null,this.#a=t.textLayerMode??Lt.ENABLE,this.#t=t.annotationMode??jt.ENABLE_FORMS,this.imageResourcesPath=t.imageResourcesPath||"",this.maxCanvasPixels=t.maxCanvasPixels??Cr.get("maxCanvasPixels"),this.pageColors=t.pageColors||null,this.#e=t.enableHWA||!1,this.eventBus=t.eventBus,this.renderingQueue=t.renderingQueue,this.l10n=t.l10n,this.l10n||=new _e,this.renderTask=null,this.resume=null,this._isStandalone=!this.renderingQueue?.hasViewer(),this._container=e,this._annotationCanvasMap=null,this.annotationLayer=null,this.annotationEditorLayer=null,this.textLayer=null,this.zoomLayer=null,this.xfaLayer=null,this.structTreeLayer=null,this.drawLayer=null;let s=document.createElement("div");if(s.className="page",s.setAttribute("data-page-number",this.id),s.setAttribute("role","region"),s.setAttribute("data-l10n-id","pdfjs-page-landmark"),s.setAttribute("data-l10n-args",JSON.stringify({page:this.id})),this.div=s,this.#b(),e?.append(s),this._isStandalone){e?.style.setProperty("--scale-factor",this.scale*Ht.PDF_TO_CSS_UNITS),this.pageColors?.background&&e?.style.setProperty("--page-bg-color",this.pageColors.background);let{optionalContentConfigPromise:n}=t;n&&n.then(r=>{n===this._optionalContentConfigPromise&&(this.#u.initialOptionalContent=r.hasInitialVisibility)}),t.l10n||this.l10n.translate(this.div)}}#g(t,e){let i=Dc.get(e),s=this.#f[i];if(this.#f[i]=t,s){s.replaceWith(t);return}for(let n=i-1;n>=0;n--){let r=this.#f[n];if(r){r.after(t);return}}this.div.prepend(t)}get renderingState(){return this.#d}set renderingState(t){if(t!==this.#d)switch(this.#d=t,this.#n&&(clearTimeout(this.#n),this.#n=null),t){case J.PAUSED:this.div.classList.remove("loading");break;case J.RUNNING:this.div.classList.add("loadingIcon"),this.#n=setTimeout(()=>{this.div.classList.add("loading"),this.#n=null},0);break;case J.INITIAL:case J.FINISHED:this.div.classList.remove("loadingIcon","loading");break}}#b(){let{viewport:t}=this;if(this.pdfPage){if(this.#l===t.rotation)return;this.#l=t.rotation}zh(this.div,t,!0,!1)}setPdfPage(t){this._isStandalone&&(this.pageColors?.foreground==="CanvasText"||this.pageColors?.background==="Canvas")&&(this._container?.style.setProperty("--hcm-highlight-filter",t.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight")),this._container?.style.setProperty("--hcm-highlight-selected-filter",t.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","Highlight"))),this.pdfPage=t,this.pdfPageRotate=t.rotate;let e=(this.rotation+this.pdfPageRotate)%360;this.viewport=t.getViewport({scale:this.scale*Ht.PDF_TO_CSS_UNITS,rotation:e}),this.#b(),this.reset()}destroy(){this.reset(),this.pdfPage?.cleanup()}hasEditableAnnotations(){return!!this.annotationLayer?.hasEditableAnnotations()}get _textHighlighter(){return is(this,"_textHighlighter",new Tr({pageIndex:this.id-1,eventBus:this.eventBus,findController:this.#r.findController}))}#m(t,e){this.eventBus.dispatch(t,{source:this,pageNumber:this.id,error:e})}#A(){return C(this,null,function*(){let t=null;try{yield this.annotationLayer.render(this.viewport,{structTreeLayer:this.structTreeLayer},"display")}catch(e){console.error(`#renderAnnotationLayer: "${e}".`),t=e}finally{this.#m("annotationlayerrendered",t)}})}#w(){return C(this,null,function*(){let t=null;try{yield this.annotationEditorLayer.render(this.viewport,"display")}catch(e){console.error(`#renderAnnotationEditorLayer: "${e}".`),t=e}finally{this.#m("annotationeditorlayerrendered",t)}})}#E(){return C(this,null,function*(){try{yield this.drawLayer.render("display")}catch(t){console.error(`#renderDrawLayer: "${t}".`)}})}#y(){return C(this,null,function*(){let t=null;try{let e=yield this.xfaLayer.render(this.viewport,"display");e?.textDivs&&this._textHighlighter&&this.#P(e.textDivs)}catch(e){console.error(`#renderXfaLayer: "${e}".`),t=e}finally{this.xfaLayer?.div&&(this.l10n.pause(),this.#g(this.xfaLayer.div,"xfaLayer"),this.l10n.resume()),this.#m("xfalayerrendered",t)}})}#v(){return C(this,null,function*(){if(!this.textLayer)return;let t=null;try{yield this.textLayer.render(this.viewport)}catch(e){if(e instanceof Ih)return;console.error(`#renderTextLayer: "${e}".`),t=e}this.#m("textlayerrendered",t),this.#M()})}#M(){return C(this,null,function*(){if(!this.textLayer)return;let t=yield this.structTreeLayer?.render();t&&(this.l10n.pause(),this.structTreeLayer?.addElementsToTextLayer(),this.canvas&&t.parentNode!==this.canvas&&this.canvas.append(t),this.l10n.resume()),this.structTreeLayer?.show()})}#P(t){return C(this,null,function*(){let e=yield this.pdfPage.getTextContent(),i=[];for(let s of e.items)i.push(s.str);this._textHighlighter.setTextMapping(t,i),this._textHighlighter.enable()})}
340_resetZoomLayer(t=!1){if(!this.zoomLayer)return;let e=this.zoomLayer.firstChild;this.#p.delete(e),e.width=0,e.height=0,t&&this.zoomLayer.remove(),this.zoomLayer=null}reset({keepZoomLayer:t=!1,keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:i=!1,keepXfaLayer:s=!1,keepTextLayer:n=!1}={}){this.cancelRendering({keepAnnotationLayer:e,keepAnnotationEditorLayer:i,keepXfaLayer:s,keepTextLayer:n}),this.renderingState=J.INITIAL;let r=this.div,a=r.childNodes,l=t&&this.zoomLayer||null,h=e&&this.annotationLayer?.div||null,c=i&&this.annotationEditorLayer?.div||null,d=s&&this.xfaLayer?.div||null,u=n&&this.textLayer?.div||null;for(let f=a.length-1;f>=0;f--){let p=a[f];switch(p){case l:case h:case c:case d:case u:continue}p.remove();let g=this.#f.indexOf(p);g>=0&&(this.#f[g]=null)}r.removeAttribute("data-loaded"),h&&this.annotationLayer.hide(),c&&this.annotationEditorLayer.hide(),d&&this.xfaLayer.hide(),u&&this.textLayer.hide(),this.structTreeLayer?.hide(),l||(this.canvas&&(this.#p.delete(this.canvas),this.canvas.width=0,this.canvas.height=0,delete this.canvas),this._resetZoomLayer())}toggleEditingMode(t){this.hasEditableAnnotations()&&(this.#s=t,this.reset({keepZoomLayer:!0,keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0}))}update({scale:t=0,rotation:e=null,optionalContentConfigPromise:i=null,drawingDelay:s=-1}){this.scale=t||this.scale,typeof e=="number"&&(this.rotation=e),i instanceof Promise&&(this._optionalContentConfigPromise=i,i.then(r=>{i===this._optionalContentConfigPromise&&(this.#u.initialOptionalContent=r.hasInitialVisibility)})),this.#u.directDrawing=!0;let n=(this.rotation+this.pdfPageRotate)%360;if(this.viewport=this.viewport.clone({scale:this.scale*Ht.PDF_TO_CSS_UNITS,rotation:n}),this.#b(),this._isStandalone&&this._container?.style.setProperty("--scale-factor",this.viewport.scale),this.canvas){let r=!1;if(this.#i){if(this.maxCanvasPixels===0)r=!0;else if(this.maxCanvasPixels>0){let{width:l,height:h}=this.viewport,{sx:c,sy:d}=this.outputScale;r=(Math.floor(l)*c|0)*(Math.floor(h)*d|0)>this.maxCanvasPixels}}let a=s>=0&&s<1e3;if(a||r){if(a&&!r&&this.renderingState!==J.FINISHED&&(this.cancelRendering({keepZoomLayer:!0,keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0,cancelExtraDelay:s}),this.renderingState=J.FINISHED,this.#u.directDrawing=!1),this.cssTransform({target:this.canvas,redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0,redrawTextLayer:!a,hideTextLayer:a}),a)return;this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this.#o});return}!this.zoomLayer&&!this.canvas.hidden&&(this.zoomLayer=this.canvas.parentNode,this.zoomLayer.style.position="absolute")}this.zoomLayer&&this.cssTransform({target:this.zoomLayer.firstChild}),this.reset({keepZoomLayer:!0,keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0,keepTextLayer:!0})}cancelRendering({keepAnnotationLayer:t=!1,keepAnnotationEditorLayer:e=!1,keepXfaLayer:i=!1,keepTextLayer:s=!1,cancelExtraDelay:n=0}={}){this.renderTask&&(this.renderTask.cancel(n),this.renderTask=null),this.resume=null,this.textLayer&&(!s||!this.textLayer.div)&&(this.textLayer.cancel(),this.textLayer=null),this.annotationLayer&&(!t||!this.annotationLayer.div)&&(this.annotationLayer.cancel(),this.annotationLayer=null,this._annotationCanvasMap=null),this.structTreeLayer&&!this.textLayer&&(this.structTreeLayer=null),this.annotationEditorLayer&&(!e||!this.annotationEditorLayer.div)&&(this.drawLayer&&(this.drawLayer.cancel(),this.drawLayer=null),this.annotationEditorLayer.cancel(),this.annotationEditorLayer=null),this.xfaLayer&&(!i||!this.xfaLayer.div)&&(this.xfaLayer.cancel(),this.xfaLayer=null,this._textHighlighter?.disable())}cssTransform({target:t,redrawAnnotationLayer:e=!1,redrawAnnotationEditorLayer:i=!1,redrawXfaLayer:s=!1,redrawTextLayer:n=!1,hideTextLayer:r=!1}){if(!t.hasAttribute("zooming")){t.setAttribute("zooming",!0);let{style:l}=t;l.width=l.height=""}let a=this.#p.get(t);if(this.viewport!==a){let l=this.viewport.rotation-a.rotation,h=Math.abs(l),c=1,d=1;if(h===90||h===270){let{width:u,height:f}=this.viewport;c=f/u,d=u/f}t.style.transform=`rotate(${l}deg) scale(${c}, ${d})`}e&&this.annotationLayer&&this.#A(),i&&this.annotationEditorLayer&&(this.drawLayer&&this.#E(),this.#w()),s&&this.xfaLayer&&this.#y(),this.textLayer&&(r?(this.textLayer.hide(),this.structTreeLayer?.hide()):n&&this.#v())}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(t,e){return this.viewport.convertToPdfPoint(t,e)}#x(t,e=null){return C(this,null,function*(){if(t===this.renderTask&&(this.renderTask=null),e instanceof cr){this.#o=null;return}if(this.#o=e,this.renderingState=J.FINISHED,this._resetZoomLayer(!0),this.#u.regularAnnotations=!t.separateAnnots,this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!1,timestamp:performance.now(),error:this.#o}),e)throw e})}draw(){return C(this,null,function*(){this.renderingState!==J.INITIAL&&(console.error("Must be in new state before drawing"),this.reset());
340let{div:t,l10n:e,pageColors:i,pdfPage:s,viewport:n}=this;if(!s)throw this.renderingState=J.FINISHED,new Error("pdfPage is not loaded");this.renderingState=J.RUNNING;let r=document.createElement("div");if(r.classList.add("canvasWrapper"),this.#g(r,"canvasWrapper"),!this.textLayer&&this.#a!==Lt.DISABLE&&!s.isPureXfa&&(this._accessibilityManager||=new Pr,this.textLayer=new ls({pdfPage:s,highlighter:this._textHighlighter,accessibilityManager:this._accessibilityManager,enablePermissions:this.#a===Lt.ENABLE_PERMISSIONS,onAppend:_=>{this.l10n.pause(),this.#g(_,"textLayer"),this.l10n.resume()}})),!this.annotationLayer&&this.#t!==jt.DISABLE){let{annotationStorage:_,annotationEditorUIManager:E,downloadManager:L,enableScripting:V,fieldObjectsPromise:H,hasJSActionsPromise:F,linkService:W}=this.#r;this._annotationCanvasMap||=new Map,this.annotationLayer=new ss({pdfPage:s,annotationStorage:_,imageResourcesPath:this.imageResourcesPath,renderForms:this.#t===jt.ENABLE_FORMS,linkService:W,downloadManager:L,enableScripting:V,hasJSActionsPromise:F,fieldObjectsPromise:H,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager,annotationEditorUIManager:E,onAppend:Q=>{this.#g(Q,"annotationLayer")}})}let a=_=>{if(u?.(!1),this.renderingQueue&&!this.renderingQueue.isHighestPriority(this)){this.renderingState=J.PAUSED,this.resume=()=>{this.renderingState=J.RUNNING,_()};return}_()},{width:l,height:h}=n,c=document.createElement("canvas");c.setAttribute("role","presentation"),c.hidden=!0;let d=!!(i?.background&&i?.foreground),u=_=>{(!d||_)&&(c.hidden=!1,u=null)};r.append(c),this.canvas=c;let f=c.getContext("2d",{alpha:!1,willReadFrequently:!this.#e}),p=this.outputScale=new Vh;if(this.maxCanvasPixels===0){let _=1/this.scale;p.sx*=_,p.sy*=_,this.#i=!0}else if(this.maxCanvasPixels>0){let _=l*h,E=Math.sqrt(this.maxCanvasPixels/_);p.sx>E||p.sy>E?(p.sx=E,p.sy=E,this.#i=!0):this.#i=!1}let g=Oa(p.sx),b=Oa(p.sy),m=c.width=qi(Ki(l*p.sx),g[0]),w=c.height=qi(Ki(h*p.sy),b[0]),y=qi(Ki(l),g[1]),A=qi(Ki(h),b[1]);p.sx=m/y,p.sy=w/A,this.#h!==g[1]&&(t.style.setProperty("--scale-round-x",`${g[1]}px`),this.#h=g[1]),this.#c!==b[1]&&(t.style.setProperty("--scale-round-y",`${b[1]}px`),this.#c=b[1]),this.#p.set(c,n);let v=p.scaled?[p.sx,0,0,p.sy,0,0]:null,S={canvasContext:f,transform:v,viewport:n,annotationMode:this.#t,optionalContentConfigPromise:this._optionalContentConfigPromise,annotationCanvasMap:this._annotationCanvasMap,pageColors:i,isEditing:this.#s},P=this.renderTask=s.render(S);P.onContinue=a;let T=P.promise.then(()=>C(this,null,function*(){u?.(!0),yield this.#x(P),this.structTreeLayer||=new os(s,n.rawDims),this.#v(),this.annotationLayer&&(yield this.#A());let{annotationEditorUIManager:_}=this.#r;_&&(this.drawLayer||=new Sr({pageIndex:this.id}),yield this.#E(),this.drawLayer.setParent(r),this.annotationEditorLayer||=new Er({uiManager:_,pdfPage:s,l10n:e,structTreeLayer:this.structTreeLayer,accessibilityManager:this._accessibilityManager,annotationLayer:this.annotationLayer?.annotationLayer,textLayer:this.textLayer,drawLayer:this.drawLayer.getDrawLayer(),onAppend:E=>{this.#g(E,"annotationEditorLayer")}}),this.#w())}),_=>(_ instanceof cr||u?.(!0),this.#x(P,_)));if(s.isPureXfa){if(!this.xfaLayer){let{annotationStorage:_,linkService:E}=this.#r;this.xfaLayer=new hs({pdfPage:s,annotationStorage:_,linkService:E})}this.#y()}return t.setAttribute("data-loaded",!0),this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id}),T})}setPageLabel(t){this.pageLabel=typeof t=="string"?t:null,this.div.setAttribute("data-l10n-args",JSON.stringify({page:this.pageLabel??this.id})),this.pageLabel!==null?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}get thumbnailCanvas(){let{directDrawing:t,initialOptionalContent:e,regularAnnotations:i}=this.#u;return t&&e&&i?this.canvas:null}};function Nc(o){return C(this,null,function*(){let e="".split("#",1)[0],{info:i,metadata:s,contentDispositionFilename:n,contentLength:r}=yield o.getMetadata();if(!r){let{length:a}=yield o.getDownloadInfo();r=a}return vt(G({},i),{baseURL:e,filesize:r,filename:n||Bh(""),metadata:s?.getRaw(),authors:s?.get("dc:creator"),numPages:o.numPages,URL:""})})}var Lr=class{constructor(t){this._ready=new Promise((e,i)=>{import(t).then(n=>{e(n.QuickJSSandbox())}).catch(i)})}createSandbox(t){return C(this,null,function*(){(yield this._ready).create(t)})}dispatchEventInSandbox(t){return C(this,null,function*(){let e=yield this._ready;setTimeout(()=>
340e.dispatchEvent(t),0)})}destroySandbox(){return C(this,null,function*(){(yield this._ready).nukeSandbox()})}},Mr=class{#t=null;#e=null;#i=null;#s=null;#r=null;#n=null;#l=null;#h=null;#c=!1;#o=null;#d=null;constructor({eventBus:t,externalServices:e=null,docProperties:i=null}){this.#r=t,this.#n=e,this.#i=i}setViewer(t){this.#h=t}setDocument(t){return C(this,null,function*(){if(this.#l&&(yield this.#g()),this.#l=t,!t)return;let[e,i,s]=yield Promise.all([t.getFieldObjects(),t.getCalculationOrderIds(),t.getJSActions()]);if(!e&&!s){yield this.#g();return}if(t!==this.#l)return;try{this.#o=this.#f()}catch(a){console.error(`setDocument: "${a.message}".`),yield this.#g();return}let n=this.#r;this.#s=new AbortController;let{signal:r}=this.#s;n._on("updatefromsandbox",a=>{a?.source===window&&this.#a(a.detail)},{signal:r}),n._on("dispatcheventinsandbox",a=>{this.#o?.dispatchEventInSandbox(a.detail)},{signal:r}),n._on("pagechanging",({pageNumber:a,previous:l})=>{a!==l&&(this.#p(l),this.#u(a))},{signal:r}),n._on("pagerendered",({pageNumber:a})=>{this._pageOpenPending.has(a)&&a===this.#h.currentPageNumber&&this.#u(a)},{signal:r}),n._on("pagesdestroy",()=>C(this,null,function*(){yield this.#p(this.#h.currentPageNumber),yield this.#o?.dispatchEventInSandbox({id:"doc",name:"WillClose"}),this.#t?.resolve()}),{signal:r});try{let a=yield this.#i(t);if(t!==this.#l)return;yield this.#o.createSandbox({objects:e,calculationOrder:i,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:vt(G({},a),{actions:s})}),n.dispatch("sandboxcreated",{source:this})}catch(a){console.error(`setDocument: "${a.message}".`),yield this.#g();return}yield this.#o?.dispatchEventInSandbox({id:"doc",name:"Open"}),yield this.#u(this.#h.currentPageNumber,!0),Promise.resolve().then(()=>{t===this.#l&&(this.#c=!0)})})}dispatchWillSave(){return C(this,null,function*(){return this.#o?.dispatchEventInSandbox({id:"doc",name:"WillSave"})})}dispatchDidSave(){return C(this,null,function*(){return this.#o?.dispatchEventInSandbox({id:"doc",name:"DidSave"})})}dispatchWillPrint(){return C(this,null,function*(){if(this.#o){yield this.#d?.promise,this.#d=Promise.withResolvers();try{yield this.#o.dispatchEventInSandbox({id:"doc",name:"WillPrint"})}catch(t){throw this.#d.resolve(),this.#d=null,t}yield this.#d.promise}})}dispatchDidPrint(){return C(this,null,function*(){return this.#o?.dispatchEventInSandbox({id:"doc",name:"DidPrint"})})}get destroyPromise(){return this.#e?.promise||null}get ready(){return this.#c}get _pageOpenPending(){return is(this,"_pageOpenPending",new Set)}get _visitedPages(){return is(this,"_visitedPages",new Map)}#a(t){return C(this,null,function*(){let e=this.#h,i=e.isInPresentationMode||e.isChangingPresentationMode,{id:s,siblings:n,command:r,value:a}=t;if(!s){switch(r){case"clear":console.clear();break;case"error":console.error(a);break;case"layout":if(!i){let h=hh(a);e.spreadMode=h.spreadMode}break;case"page-num":e.currentPageNumber=a+1;break;case"print":yield e.pagesPromise,this.#r.dispatch("print",{source:this});break;case"println":console.log(a);break;case"zoom":i||(e.currentScaleValue=a);break;case"SaveAs":this.#r.dispatch("download",{source:this});break;case"FirstPage":e.currentPageNumber=1;break;case"LastPage":e.currentPageNumber=e.pagesCount;break;case"NextPage":e.nextPage();break;case"PrevPage":e.previousPage();break;case"ZoomViewIn":i||e.increaseScale();break;case"ZoomViewOut":i||e.decreaseScale();break;case"WillPrintFinished":this.#d?.resolve(),this.#d=null;break}return}if(i&&t.focus)return;delete t.id,delete t.siblings;let l=n?[s,...n]:[s];for(let h of l){let c=document.querySelector(`[data-element-id="${h}"]`);c?c.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:t})):this.#l?.annotationStorage.setValue(h,t)}})}#u(t,e=!1){return C(this,null,function*(){let i=this.#l,s=this._visitedPages;if(e&&(this.#t=Promise.withResolvers()),!this.#t)return;let n=this.#h.getPageView(t-1);if(n?.renderingState!==J.FINISHED){this._pageOpenPending.add(t);return}this._pageOpenPending.delete(t);let r=C(this,null,function*(){let a=yield s.has(t)?null:n.pdfPage?.getJSActions();i===this.#l&&(yield this.#o?.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:t,actions:a}))});s.set(t,r)})}#p(t){return C(this,null,function*(){let e=this.#l,i=this._visitedPages;if(!this.#t||this._pageOpenPending.has(t))return;let s=i.get(t);s&&(i.set(t,null),yield s,e===this.#l&&(yield this.#o?.dispatchEventInSandbox({id:"page",name:"PageClose",pageNumber:t})))})}
340#f(){if(this.#e=Promise.withResolvers(),this.#o)throw new Error("#initScripting: Scripting already exists.");return this.#n.createScripting()}#g(){return C(this,null,function*(){if(!this.#o){this.#l=null,this.#e?.resolve();return}this.#t&&(yield Promise.race([this.#t.promise,new Promise(t=>{setTimeout(t,1e3)})]).catch(()=>{}),this.#t=null),this.#l=null;try{yield this.#o.destroySandbox()}catch{}this.#d?.reject(new Error("Scripting destroyed.")),this.#d=null,this.#s?.abort(),this.#s=null,this._pageOpenPending.clear(),this._visitedPages.clear(),this.#o=null,this.#c=!1,this.#e?.resolve()})}},kr=class extends Mr{constructor(t){t.externalServices||window.addEventListener("updatefromsandbox",e=>{t.eventBus.dispatch("updatefromsandbox",{source:window,detail:e.detail})}),t.externalServices||={createScripting:()=>new Lr(t.sandboxBundleSrc)},t.docProperties||=e=>Nc(e),super(t)}},Fc=3e4,Ir=class{constructor(){this.pdfViewer=null,this.pdfThumbnailViewer=null,this.onIdle=null,this.highestPriorityPage=null,this.idleTimeout=null,this.printing=!1,this.isThumbnailViewEnabled=!1,Object.defineProperty(this,"hasViewer",{value:()=>!!this.pdfViewer})}setViewer(t){this.pdfViewer=t}setThumbnailViewer(t){this.pdfThumbnailViewer=t}isHighestPriority(t){return this.highestPriorityPage===t.renderingId}renderHighestPriority(t){this.idleTimeout&&(clearTimeout(this.idleTimeout),this.idleTimeout=null),!this.pdfViewer.forceRendering(t)&&(this.isThumbnailViewEnabled&&this.pdfThumbnailViewer?.forceRendering()||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),Fc)))}getHighestPriority(t,e,i,s=!1){let n=t.views,r=n.length;if(r===0)return null;for(let d=0;d<r;d++){let u=n[d].view;if(!this.isViewFinished(u))return u}let a=t.first.id,l=t.last.id;if(l-a+1>r){let d=t.ids;for(let u=1,f=l-a;u<f;u++){let p=i?a+u:l-u;if(d.has(p))continue;let g=e[p-1];if(!this.isViewFinished(g))return g}}let h=i?l:a-2,c=e[h];return c&&!this.isViewFinished(c)||s&&(h+=i?1:-1,c=e[h],c&&!this.isViewFinished(c))?c:null}isViewFinished(t){return t.renderingState===J.FINISHED}renderView(t){switch(t.renderingState){case J.FINISHED:return!1;case J.PAUSED:this.highestPriorityPage=t.renderingId,t.resume();break;case J.RUNNING:this.highestPriorityPage=t.renderingId;break;case J.INITIAL:this.highestPriorityPage=t.renderingId,t.draw().finally(()=>{this.renderHighestPriority()}).catch(e=>{e instanceof cr||console.error(`renderView: "${e}"`)});break}return!0}},oo=10,Zi={FORCE_SCROLL_MODE_PAGE:1e4,FORCE_LAZY_PAGE_INIT:5e3,PAUSE_EAGER_PAGE_INIT:250};function lo(o){return Object.values(bt).includes(o)&&o!==bt.DISABLE}var Rr=class{#t=new Set;#e=0;constructor(t){this.#e=t}push(t){let e=this.#t;e.has(t)&&e.delete(t),e.add(t),e.size>this.#e&&this.#i()}resize(t,e=null){this.#e=t;let i=this.#t;if(e){let s=i.size,n=1;for(let r of i)if(e.has(r.id)&&(i.delete(r),i.add(r)),++n>s)break}for(;i.size>this.#e;)this.#i()}has(t){return this.#t.has(t)}[Symbol.iterator](){return this.#t.keys()}#i(){let t=this.#t.keys().next().value;t?.destroy(),this.#t.delete(t)}},ds=class{#t=null;#e=null;#i=null;#s=bt.NONE;#r=null;#n=jt.ENABLE_FORMS;#l=null;#h=!1;#c=!1;#o=!1;#d=!1;#a=!1;#u=null;#p=null;#f=null;#g=null;#b=!1;#m=null;#A=!1;#w=0;#E=new ResizeObserver(this.#B.bind(this));#y=null;#v=null;#M=Lt.ENABLE;constructor(t){let e="4.8.69";if(Wa!==e)throw new Error(`The API version "${Wa}" does not match the Viewer version "${e}".`);if(this.container=t.container,this.viewer=t.viewer||t.container.firstElementChild,this.container?.tagName!=="DIV"||this.viewer?.tagName!=="DIV")throw new Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&getComputedStyle(this.container).position!=="absolute")throw new Error("The `container` must be absolutely positioned.");this.#E.observe(this.container),this.eventBus=t.eventBus,this.linkService=t.linkService||new Ge,this.downloadManager=t.downloadManager||null,this.findController=t.findController||null,this.#e=t.altTextManager||null,this.findController&&(this.findController.onIsPageVisible=s=>this._getVisiblePages().ids.has(s)),this._scriptingManager=t.scriptingManager||null,this.#M=t.textLayerMode??Lt.ENABLE,this.#n=t.annotationMode??jt.ENABLE_FORMS,this.#s=t.annotationEditorMode??bt.NONE,this.#i=t.annotationEditorHighlightColors||null,this.#c=t.enableHighlightFloatingButton===!0,this.#d=t.enableUpdatedAddImage===!0,this.#a=t.enableNewAltTextWhenAddingImage===!0,this.imageResourcesPath=t.imageResourcesPath||"",this.enablePrintAutoRotate=t.enablePrintAutoRotate||!1,this.removePageBorders=t.removePageBorders||!1,this.maxCanvasPixels=t.maxCanvasPixels,this.l10n=t.l10n,this.l10n||=new _e,this.#o=t.enablePermissions||!1,this.pageColors=t.pageColors||null,this.#p=t.mlManager||null,this.#h=t.enableHWA||!1,this.defaultRenderingQueue=!t.renderingQueue,this.defaultRenderingQueue?(this.renderingQueue=new Ir,this.renderingQueue.setViewer(this)):this.renderingQueue=t.renderingQueue;let{abortSignal:i}=t;i?.addEventListener("abort",()=>
340{this.#E.disconnect(),this.#E=null},{once:!0}),this.scroll=ih(this.container,this._scrollUpdate.bind(this),i),this.presentationModeState=me.UNKNOWN,this._resetView(),this.removePageBorders&&this.viewer.classList.add("removePageBorders"),this.#N(),this.eventBus._on("thumbnailrendered",({pageNumber:s,pdfPage:n})=>{let r=this._pages[s-1];this.#t.has(r)||n?.cleanup()}),t.l10n||this.l10n.translate(this.container)}get pagesCount(){return this._pages.length}getPageView(t){return this._pages[t]}getCachedPageViews(){return new Set(this.#t)}get pageViewsReady(){return this._pages.every(t=>t?.pdfPage)}get renderForms(){return this.#n===jt.ENABLE_FORMS}get enableScripting(){return!!this._scriptingManager}get currentPageNumber(){return this._currentPageNumber}set currentPageNumber(t){if(!Number.isInteger(t))throw new Error("Invalid page number.");this.pdfDocument&&(this._setCurrentPageNumber(t,!0)||console.error(`currentPageNumber: "${t}" is not a valid page.`))}_setCurrentPageNumber(t,e=!1){if(this._currentPageNumber===t)return e&&this.#I(),!0;if(!(0<t&&t<=this.pagesCount))return!1;let i=this._currentPageNumber;return this._currentPageNumber=t,this.eventBus.dispatch("pagechanging",{source:this,pageNumber:t,pageLabel:this._pageLabels?.[t-1]??null,previous:i}),e&&this.#I(),!0}get currentPageLabel(){return this._pageLabels?.[this._currentPageNumber-1]??null}set currentPageLabel(t){if(!this.pdfDocument)return;let e=t|0;if(this._pageLabels){let i=this._pageLabels.indexOf(t);i>=0&&(e=i+1)}this._setCurrentPageNumber(e,!0)||console.error(`currentPageLabel: "${t}" is not a valid page.`)}get currentScale(){return this._currentScale!==Zn?this._currentScale:ho}set currentScale(t){if(isNaN(t))throw new Error("Invalid numeric scale.");this.pdfDocument&&this.#L(t,{noScroll:!1})}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(t){this.pdfDocument&&this.#L(t,{noScroll:!1})}get pagesRotation(){return this._pagesRotation}set pagesRotation(t){if(!uo(t))throw new Error("Invalid pages rotation angle.");if(!this.pdfDocument||(t%=360,t<0&&(t+=360),this._pagesRotation===t))return;this._pagesRotation=t;let e=this._currentPageNumber;this.refresh(!0,{rotation:t}),this._currentScaleValue&&this.#L(this._currentScaleValue,{noScroll:!0}),this.eventBus.dispatch("rotationchanging",{source:this,pagesRotation:t,pageNumber:e}),this.defaultRenderingQueue&&this.update()}get firstPagePromise(){return this.pdfDocument?this._firstPageCapability.promise:null}get onePageRendered(){return this.pdfDocument?this._onePageRenderedCapability.promise:null}get pagesPromise(){return this.pdfDocument?this._pagesCapability.promise:null}get _layerProperties(){let t=this;return is(this,"_layerProperties",{get annotationEditorUIManager(){return t.#r},get annotationStorage(){return t.pdfDocument?.annotationStorage},get downloadManager(){return t.downloadManager},get enableScripting(){return!!t._scriptingManager},get fieldObjectsPromise(){return t.pdfDocument?.getFieldObjects()},get findController(){return t.findController},get hasJSActionsPromise(){return t.pdfDocument?.hasJSActions()},get linkService(){return t.linkService}})}#P(t){let e={annotationEditorMode:this.#s,annotationMode:this.#n,textLayerMode:this.#M};return t&&(!t.includes(Qi.COPY)&&this.#M===Lt.ENABLE&&(e.textLayerMode=Lt.ENABLE_PERMISSIONS),t.includes(Qi.MODIFY_CONTENTS)||(e.annotationEditorMode=bt.DISABLE),!t.includes(Qi.MODIFY_ANNOTATIONS)&&!t.includes(Qi.FILL_INTERACTIVE_FORMS)&&this.#n===jt.ENABLE_FORMS&&(e.annotationMode=jt.ENABLE)),e}#x(t){return C(this,null,function*(){if(document.visibilityState==="hidden"||!this.container.offsetParent||this._getVisiblePages().views.length===0)return;let e=Promise.withResolvers(),i=new AbortController;document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&e.resolve()},{signal:typeof AbortSignal.any=="function"?AbortSignal.any([t,i.signal]):t}),yield Promise.race([this._onePageRenderedCapability.promise,e.promise]),i.abort()})}getAllText(){return C(this,null,function*(){let t=[],e=[];for(let i=1,s=this.pdfDocument.numPages;i<=s;++i){if(this.#A)return null;e.length=0;let n=yield this.pdfDocument.getPage(i),{items:r}=yield n.getTextContent();for(let a of r)a.str&&e.push(a.str),a.hasEOL&&e.push(`
341`);t.push(Ue(e.join("")))}return t.join(`
342`)})}#T(t,e){let i=document.getSelection(),{focusNode:s,anchorNode:n}=i;if(n&&s&&i.containsNode(this.#m)){if(this.#b||t===Lt.ENABLE_PERMISSIONS){e.preventDefault(),e.stopPropagation();return}this.#b=!0;let{classList:r}=this.viewer;r.add("copyAll");let a=new AbortController;window.addEventListener("keydown",l=>this.#A=l.key==="Escape",{signal:a.signal}),this.getAllText().then(l=>C(this,null,function*(){l!==null&&(yield navigator.clipboard.writeText(l))})).catch(l=>{console.warn(`Something goes wrong when extracting the text: ${l.message}`)}).finally(()=>{this.#b=!1,this.#A=!1,a.abort(),r.remove("copyAll")}),e.preventDefault(),e.stopPropagation()}}setDocument(t){if(this.pdfDocument&&(this.eventBus.dispatch("pagesdestroy",{source:this}),this._cancelRendering(),this._resetView(),this.findController?.setDocument(null),this._scriptingManager?.setDocument(null),this.#r?.destroy(),this.#r=null),this.pdfDocument=t,!t)return;let e=t.numPages,i=t.getPage(1),s=t.getOptionalContentConfig({intent:"display"}),n=this.#o?t.getPermissions():Promise.resolve(),{eventBus:r,pageColors:a,viewer:l}=this;this.#u=new AbortController;let{signal:h}=this.#u;if(e>Zi.FORCE_SCROLL_MODE_PAGE){console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");let u=this._scrollMode=j.PAGE;r.dispatch("scrollmodechanged",{source:this,mode:u})}this._pagesCapability.promise.then(()=>
342{r.dispatch("pagesloaded",{source:this,pagesCount:e})},()=>{});let c=u=>{let f=this._pages[u.pageNumber-1];f&&this.#t.push(f)};r._on("pagerender",c,{signal:h});let d=u=>{u.cssTransform||(this._onePageRenderedCapability.resolve({timestamp:u.timestamp}),r._off("pagerendered",d))};r._on("pagerendered",d,{signal:h}),Promise.all([i,n]).then(([u,f])=>{if(t!==this.pdfDocument)return;this._firstPageCapability.resolve(u),this._optionalContentConfigPromise=s;let{annotationEditorMode:p,annotationMode:g,textLayerMode:b}=this.#P(f);if(b!==Lt.DISABLE){let A=this.#m=document.createElement("div");A.id="hiddenCopyElement",l.before(A)}if(typeof AbortSignal.any=="function"&&p!==bt.DISABLE){let A=p;t.isPureXfa?console.warn("Warning: XFA-editing is not implemented."):lo(A)?(this.#r=new Oh(this.container,l,this.#e,r,t,a,this.#i,this.#c,this.#d,this.#a,this.#p),r.dispatch("annotationeditoruimanager",{source:this,uiManager:this.#r}),A!==bt.NONE&&(A===bt.STAMP&&this.#p?.loadModel("altText"),this.#r.updateMode(A))):console.error(`Invalid AnnotationEditor mode: ${A}`)}let m=this._scrollMode===j.PAGE?null:l,w=this.currentScale,y=u.getViewport({scale:w*Ht.PDF_TO_CSS_UNITS});l.style.setProperty("--scale-factor",y.scale),a?.background&&l.style.setProperty("--page-bg-color",a.background),(a?.foreground==="CanvasText"||a?.background==="Canvas")&&(l.style.setProperty("--hcm-highlight-filter",t.filterFactory.addHighlightHCMFilter("highlight","CanvasText","Canvas","HighlightText","Highlight")),l.style.setProperty("--hcm-highlight-selected-filter",t.filterFactory.addHighlightHCMFilter("highlight_selected","CanvasText","Canvas","HighlightText","ButtonText")));for(let A=1;A<=e;++A){let v=new cs({container:m,eventBus:r,id:A,scale:w,defaultViewport:y.clone(),optionalContentConfigPromise:s,renderingQueue:this.renderingQueue,textLayerMode:b,annotationMode:g,imageResourcesPath:this.imageResourcesPath,maxCanvasPixels:this.maxCanvasPixels,pageColors:a,l10n:this.l10n,layerProperties:this._layerProperties,enableHWA:this.#h});this._pages.push(v)}this._pages[0]?.setPdfPage(u),this._scrollMode===j.PAGE?this.#S():this._spreadMode!==dt.NONE&&this._updateSpreadMode(),this.#x(h).then(()=>C(this,null,function*(){if(t!==this.pdfDocument)return;if(this.findController?.setDocument(t),this._scriptingManager?.setDocument(t),this.#m&&document.addEventListener("copy",this.#T.bind(this,b),{signal:h}),this.#r&&r.dispatch("annotationeditormodechanged",{source:this,mode:this.#s}),t.loadingParams.disableAutoFetch||e>Zi.FORCE_LAZY_PAGE_INIT){this._pagesCapability.resolve();return}let A=e-1;if(A<=0){this._pagesCapability.resolve();return}for(let v=2;v<=e;++v){let S=t.getPage(v).then(P=>{let T=this._pages[v-1];T.pdfPage||T.setPdfPage(P),--A===0&&this._pagesCapability.resolve()},P=>{console.error(`Unable to get page ${v} to initialize viewer`,P),--A===0&&this._pagesCapability.resolve()});v%Zi.PAUSE_EAGER_PAGE_INIT===0&&(yield S)}})),r.dispatch("pagesinit",{source:this}),t.getMetadata().then(({info:A})=>{t===this.pdfDocument&&A.Language&&(l.lang=A.Language)}),this.defaultRenderingQueue&&this.update()}).catch(u=>{console.error("Unable to initialize viewer",u),this._pagesCapability.reject(u)})}setPageLabels(t){if(this.pdfDocument){t?Array.isArray(t)&&this.pdfDocument.numPages===t.length?this._pageLabels=t:(this._pageLabels=null,console.error("setPageLabels: Invalid page labels.")):this._pageLabels=null;for(let e=0,i=this._pages.length;e<i;e++)this._pages[e].setPageLabel(this._pageLabels?.[e]??null)}}_resetView(){this._pages=[],this._currentPageNumber=1,this._currentScale=Zn,this._currentScaleValue=null,this._pageLabels=null,this.#t=new Rr(oo),this._location=null,this._pagesRotation=0,this._optionalContentConfigPromise=null,this._firstPageCapability=Promise.withResolvers(),this._onePageRenderedCapability=Promise.withResolvers(),this._pagesCapability=Promise.withResolvers(),this._scrollMode=j.VERTICAL,this._previousScrollMode=j.UNKNOWN,this._spreadMode=dt.NONE,this.#y={previousPageNumber:1,scrollDown:!0,pages:[]},this.#u?.abort(),this.#u=null,this.viewer.textContent="",this._updateScrollMode(),this.viewer.removeAttribute("lang"),this.#m?.remove(),this.#m=null,this.#H()}#S(){if(this._scrollMode!==j.PAGE)throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");let t=this._currentPageNumber,e=this.#y,i=this.viewer;if(i.textContent="",e.pages.length=0,this._spreadMode===dt.NONE&&!this.isInPresentationMode){let s=this._pages[t-1];i.append(s.div),e.pages.push(s)}else{let s=new Set,n=this._spreadMode-1;n===-1?s.add(t-1):t%2!==n?(s.add(t-1),s.add(t)):(s.add(t-2),s.add(t-1));let r=document.createElement("div");if(r.className="spread",this.isInPresentationMode){let a=document.createElement("div");a.className="dummyPage",r.append(a)}for(let a of s){let l=this._pages[a];l&&(r.append(l.div),e.pages.push(l))}i.append(r)}e.scrollDown=t>=e.previousPageNumber,e.previousPageNumber=t}_scrollUpdate(){this.pagesCount!==0&&this.update()}#k(t,e=null){let{div:i,id:s}=t;if(this._currentPageNumber!==s&&this._setCurrentPageNumber(s),this._scrollMode===j.PAGE&&(this.#S(),this.update()),!e&&!this.isInPresentationMode){let n=i.offsetLeft+i.clientLeft,r=n+i.clientWidth,{scrollLeft:a,clientWidth:l}=this.container;(this._scrollMode===j.HORIZONTAL||n<a||r>a+l)&&(e={left:0,top:0})}co(i,e),!this._currentScaleValue&&this._location&&(this._location=null)}#R(t){return t===this._currentScale||Math.abs(t-this._currentScale)<1e-15}
342#C(t,e,{noScroll:i=!1,preset:s=!1,drawingDelay:n=-1,origin:r=null}){if(this._currentScaleValue=e.toString(),this.#R(t)){s&&this.eventBus.dispatch("scalechanging",{source:this,scale:t,presetValue:e});return}this.viewer.style.setProperty("--scale-factor",t*Ht.PDF_TO_CSS_UNITS);let a=n>=0&&n<1e3;this.refresh(!0,{scale:t,drawingDelay:a?n:-1}),a&&(this.#v=setTimeout(()=>{this.#v=null,this.refresh()},n));let l=this._currentScale;if(this._currentScale=t,!i){let h=this._currentPageNumber,c;if(this._location&&!(this.isInPresentationMode||this.isChangingPresentationMode)&&(h=this._location.pageNumber,c=[null,{name:"XYZ"},this._location.left,this._location.top,null]),this.scrollPageIntoView({pageNumber:h,destArray:c,allowNegativeOffset:!0}),Array.isArray(r)){let d=t/l-1,[u,f]=this.containerTopLeft;this.container.scrollLeft+=(r[0]-f)*d,this.container.scrollTop+=(r[1]-u)*d}}this.eventBus.dispatch("scalechanging",{source:this,scale:t,presetValue:s?e:void 0}),this.defaultRenderingQueue&&this.update()}get#_(){return this._spreadMode!==dt.NONE&&this._scrollMode!==j.HORIZONTAL?2:1}#L(t,e){let i=parseFloat(t);if(i>0)e.preset=!1,this.#C(i,t,e);else{let s=this._pages[this._currentPageNumber-1];if(!s)return;let n=ka,r=Ia;this.isInPresentationMode?(n=r=4,this._spreadMode!==dt.NONE&&(n*=2)):this.removePageBorders?n=r=0:this._scrollMode===j.HORIZONTAL&&([n,r]=[r,n]);let a=(this.container.clientWidth-n)/s.width*s.scale/this.#_,l=(this.container.clientHeight-r)/s.height*s.scale;switch(t){case"page-actual":i=1;break;case"page-width":i=a;break;case"page-height":i=l;break;case"page-fit":i=Math.min(a,l);break;case"auto":let h=Da(s)?a:Math.min(l,a);i=Math.min(eh,h);break;default:console.error(`#setScale: "${t}" is an unknown zoom value.`);return}e.preset=!0,this.#C(i,t,e)}}#I(){let t=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&this.#L(this._currentScaleValue,{noScroll:!0}),this.#k(t)}pageLabelToPageNumber(t){if(!this._pageLabels)return null;let e=this._pageLabels.indexOf(t);return e<0?null:e+1}scrollPageIntoView({pageNumber:t,destArray:e=null,allowNegativeOffset:i=!1,ignoreDestinationZoom:s=!1}){if(!this.pdfDocument)return;let n=Number.isInteger(t)&&this._pages[t-1];if(!n){console.error(`scrollPageIntoView: "${t}" is not a valid pageNumber parameter.`);return}if(this.isInPresentationMode||!e){this._setCurrentPageNumber(t,!0);return}let r=0,a=0,l=0,h=0,c,d,u=n.rotation%180!==0,f=(u?n.height:n.width)/n.scale/Ht.PDF_TO_CSS_UNITS,p=(u?n.width:n.height)/n.scale/Ht.PDF_TO_CSS_UNITS,g=0;switch(e[1].name){case"XYZ":r=e[2],a=e[3],g=e[4],r=r!==null?r:0,a=a!==null?a:p;break;case"Fit":case"FitB":g="page-fit";break;case"FitH":case"FitBH":a=e[2],g="page-width",a===null&&this._location?(r=this._location.left,a=this._location.top):(typeof a!="number"||a<0)&&(a=p);break;case"FitV":case"FitBV":r=e[2],l=f,h=p,g="page-height";break;case"FitR":r=e[2],a=e[3],l=e[4]-r,h=e[5]-a;let y=ka,A=Ia;this.removePageBorders&&(y=A=0),c=(this.container.clientWidth-y)/l/Ht.PDF_TO_CSS_UNITS,d=(this.container.clientHeight-A)/h/Ht.PDF_TO_CSS_UNITS,g=Math.min(Math.abs(c),Math.abs(d));break;default:console.error(`scrollPageIntoView: "${e[1].name}" is not a valid destination type.`);return}if(s||(g&&g!==this._currentScale?this.currentScaleValue=g:this._currentScale===Zn&&(this.currentScaleValue=Jl)),g==="page-fit"&&!e[4]){this.#k(n);return}let b=[n.viewport.convertToViewportPoint(r,a),n.viewport.convertToViewportPoint(r+l,a+h)],m=Math.min(b[0][0],b[1][0]),w=Math.min(b[0][1],b[1][1]);i||(m=Math.max(m,0),w=Math.max(w,0)),this.#k(n,{left:m,top:w})}_updateLocation(t){let e=this._currentScale,i=this._currentScaleValue,s=parseFloat(i)===e?Math.round(e*1e4)/100:i,n=t.id,r=this._pages[n-1],a=this.container,l=r.getPagePoint(a.scrollLeft-t.x,a.scrollTop-t.y),h=Math.round(l[0]),c=Math.round(l[1]),d=`#page=${n}`;this.isInPresentationMode||(d+=`&zoom=${s},${h},${c}`),this._location={pageNumber:n,scale:s,top:c,left:h,rotation:this._pagesRotation,pdfOpenParams:d}}update(){let t=this._getVisiblePages(),e=t.views,i=e.length;if(i===0)return;let s=Math.max(oo,2*i+1);this.#t.resize(s,t.ids),this.renderingQueue.renderHighestPriority(t);let n=this._spreadMode===dt.NONE&&(this._scrollMode===j.PAGE||this._scrollMode===j.VERTICAL),r=this._currentPageNumber,a=!1;for(let l of e){if(l.percent<100)break;if(l.id===r&&n){a=!0;break}}this._setCurrentPageNumber(a?r:e[0].id),this._updateLocation(t.first),this.eventBus.dispatch("updateviewarea",{source:this,location:this._location})}#F(){let t=this._getVisiblePages(),e=[],{ids:i,views:s}=t;
342for(let n of s){let{view:r}=n;if(!r.hasEditableAnnotations()){i.delete(r.id);continue}e.push(n)}return e.length===0?null:(this.renderingQueue.renderHighestPriority({first:e[0],last:e.at(-1),views:e,ids:i}),i)}containsElement(t){return this.container.contains(t)}focus(){this.container.focus()}get _isContainerRtl(){return getComputedStyle(this.container).direction==="rtl"}get isInPresentationMode(){return this.presentationModeState===me.FULLSCREEN}get isChangingPresentationMode(){return this.presentationModeState===me.CHANGING}get isHorizontalScrollbarEnabled(){return this.isInPresentationMode?!1:this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return this.isInPresentationMode?!1:this.container.scrollHeight>this.container.clientHeight}_getVisiblePages(){let t=this._scrollMode===j.PAGE?this.#y.pages:this._pages,e=this._scrollMode===j.HORIZONTAL,i=e&&this._isContainerRtl;return nh({scrollEl:this.container,views:t,sortByVisibility:!0,horizontal:e,rtl:i})}cleanup(){for(let t of this._pages)t.renderingState!==J.FINISHED&&t.reset()}_cancelRendering(){for(let t of this._pages)t.cancelRendering()}#V(t){return C(this,null,function*(){if(t.pdfPage)return t.pdfPage;try{let e=yield this.pdfDocument.getPage(t.id);return t.pdfPage||t.setPdfPage(e),e}catch(e){return console.error("Unable to get page for page view",e),null}})}#j(t){if(t.first?.id===1)return!0;if(t.last?.id===this.pagesCount)return!1;switch(this._scrollMode){case j.PAGE:return this.#y.scrollDown;case j.HORIZONTAL:return this.scroll.right}return this.scroll.down}forceRendering(t){let e=t||this._getVisiblePages(),i=this.#j(e),s=this._spreadMode!==dt.NONE&&this._scrollMode!==j.HORIZONTAL,n=this.renderingQueue.getHighestPriority(e,this._pages,i,s);return n?(this.#V(n).then(()=>{this.renderingQueue.renderView(n)}),!0):!1}get hasEqualPageSizes(){let t=this._pages[0];for(let e=1,i=this._pages.length;e<i;++e){let s=this._pages[e];if(s.width!==t.width||s.height!==t.height)return!1}return!0}getPagesOverview(){let t;return this._pages.map(e=>{let i=e.pdfPage.getViewport({scale:1}),s=Da(i);if(t===void 0)t=s;else if(this.enablePrintAutoRotate&&s!==t)return{width:i.height,height:i.width,rotation:(i.rotation-90)%360};return{width:i.width,height:i.height,rotation:i.rotation}})}get optionalContentConfigPromise(){return this.pdfDocument?this._optionalContentConfigPromise?this._optionalContentConfigPromise:(console.error("optionalContentConfigPromise: Not initialized yet."),this.pdfDocument.getOptionalContentConfig({intent:"display"})):Promise.resolve(null)}set optionalContentConfigPromise(t){if(!(t instanceof Promise))throw new Error(`Invalid optionalContentConfigPromise: ${t}`);this.pdfDocument&&this._optionalContentConfigPromise&&(this._optionalContentConfigPromise=t,this.refresh(!1,{optionalContentConfigPromise:t}),this.eventBus.dispatch("optionalcontentconfigchanged",{source:this,promise:t}))}get scrollMode(){return this._scrollMode}set scrollMode(t){if(this._scrollMode!==t){if(!rh(t))throw new Error(`Invalid scroll mode: ${t}`);this.pagesCount>Zi.FORCE_SCROLL_MODE_PAGE||(this._previousScrollMode=this._scrollMode,this._scrollMode=t,this.eventBus.dispatch("scrollmodechanged",{source:this,mode:t}),this._updateScrollMode(this._currentPageNumber))}}_updateScrollMode(t=null){let e=this._scrollMode,i=this.viewer;i.classList.toggle("scrollHorizontal",e===j.HORIZONTAL),i.classList.toggle("scrollWrapped",e===j.WRAPPED),!(!this.pdfDocument||!t)&&(e===j.PAGE?this.#S():this._previousScrollMode===j.PAGE&&this._updateSpreadMode(),this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#L(this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(t,!0),this.update())}get spreadMode(){return this._spreadMode}set spreadMode(t){if(this._spreadMode!==t){if(!ah(t))throw new Error(`Invalid spread mode: ${t}`);this._spreadMode=t,this.eventBus.dispatch("spreadmodechanged",{source:this,mode:t}),this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(t=null){if(!this.pdfDocument)return;let e=this.viewer,i=this._pages;if(this._scrollMode===j.PAGE)this.#S();else if(e.textContent="",this._spreadMode===dt.NONE)for(let s of this._pages)e.append(s.div);else{let s=this._spreadMode-1,n=null;for(let r=0,a=i.length;r<a;++r)n===null?(n=document.createElement("div"),n.className="spread",e.append(n)):r%2===s&&(n=n.cloneNode(!1),e.append(n)),n.append(i[r].div)}t&&(this._currentScaleValue&&isNaN(this._currentScaleValue)&&this.#L(this._currentScaleValue,{noScroll:!0}),this._setCurrentPageNumber(t,!0),this.update())}_getPageAdvance(t,e=!1){switch(this._scrollMode){case j.WRAPPED:{let{views:i}=this._getVisiblePages(),s=new Map;for(let{id:n,y:r,percent:a,widthPercent:l}of i){if(a===0||l<100)continue;let h=s.get(r);h||s.set(r,h||=[]),h.push(n)}for(let n of s.values()){let r=n.indexOf(t);if(r===-1)continue;let a=n.length;if(a===1)break;if(e)for(let l=r-1,h=0;l>=h;l--){let c=n[l],d=n[l+1]-1;if(c<d)return t-d}else for(let l=r+1,h=a;l<h;l++){let c=n[l],d=n[l-1]+1;if(c>d)return d-t}if(e){let l=n[0];if(l<t)return t-l+1}else{let l=n[a-1];if(l>t)return l-t+1}break}break}case j.HORIZONTAL:break;case j.PAGE:case j.VERTICAL:{if(this._spreadMode===dt.NONE)break;let i=this._spreadMode-1;if(e&&t%2!==i)break;if(!e&&t%2===i)break;let{views:s}=this._getVisiblePages(),n=e?t-1:t+1;for(let{id:r,percent:a,widthPercent:l}of s)if(r===n){if(a>0&&l===100)return 2;break}break}}return 1}nextPage(){let t=this._currentPageNumber,e=this.pagesCount;if(t>=e)return!1;let i=this._getPageAdvance(t,!1)||1;return this.currentPageNumber=Math.min(t+i,e),!0}previousPage(){let t=this._currentPageNumber;if(t<=1)return!1;let e=this._getPageAdvance(t,!0)||1;return this.currentPageNumber=Math.max(t-e,1),!0}updateScale({drawingDelay:t,scaleFactor:e=null,steps:i=null,origin:s}){if(i===null&&e===null)throw new Error("Invalid updateScale options: either `steps` or `scaleFactor` must be provided.");if(!this.pdfDocument)return;let n=this._currentScale;if(e>0&&e!==1)n=Math.round(n*e*100)/100;else if(i){let r=i>0?Ma:1/Ma,a=i>0?Math.ceil:Math.floor;i=Math.abs(i);do n=a((n*r).toFixed(2)*10)/10;while(--i>0)}n=Math.max(Zl,Math.min(th,n)),this.#L(n,{noScroll:!1,drawingDelay:t,origin:s})}increaseScale(t={}){this.updateScale(vt(G({},t),{steps:t.steps??1}))}decreaseScale(t={}){this.updateScale(vt(G({},t),{steps:-(t.steps??1)}
342))}#N(t=this.container.clientHeight){t!==this.#w&&(this.#w=t,oh.setProperty("--viewer-container-height",`${t}px`))}#B(t){for(let e of t)if(e.target===this.container){this.#N(Math.floor(e.borderBoxSize[0].blockSize)),this.#l=null;break}}get containerTopLeft(){return this.#l||=[this.container.offsetTop,this.container.offsetLeft]}#H(){this.#f?.abort(),this.#f=null,this.#g!==null&&(clearTimeout(this.#g),this.#g=null)}get annotationEditorMode(){return this.#r?this.#s:bt.DISABLE}set annotationEditorMode({mode:t,editId:e=null,isFromKeyboard:i=!1}){if(!this.#r)throw new Error("The AnnotationEditor is not enabled.");if(this.#s===t)return;if(!lo(t))throw new Error(`Invalid AnnotationEditor mode: ${t}`);if(!this.pdfDocument)return;t===bt.STAMP&&this.#p?.loadModel("altText");let{eventBus:s}=this,n=()=>{this.#H(),this.#s=t,this.#r.updateMode(t,e,i),s.dispatch("annotationeditormodechanged",{source:this,mode:t})};if(t===bt.NONE||this.#s===bt.NONE){let r=t!==bt.NONE;r||this.pdfDocument.annotationStorage.resetModifiedIds();for(let l of this._pages)l.toggleEditingMode(r);let a=this.#F();if(r&&a){this.#H(),this.#f=new AbortController;let l=AbortSignal.any([this.#u.signal,this.#f.signal]);s._on("pagerendered",({pageNumber:h})=>{a.delete(h),a.size===0&&(this.#g=setTimeout(n,0))},{signal:l});return}}n()}refresh(t=!1,e=Object.create(null)){if(this.pdfDocument){for(let i of this._pages)i.update(e);this.#v!==null&&(clearTimeout(this.#v),this.#v=null),t||this.update()}}},Or=class extends ds{_resetView(){super._resetView(),this._scrollMode=j.PAGE,this._spreadMode=dt.NONE}set scrollMode(t){}_updateScrollMode(){}set spreadMode(t){}_updateSpreadMode(){}};var Bc=Y.AnnotationLayerBuilder,Hc=Y.DownloadManager,jc=Y.EventBus,Vc=Y.FindState,Dr=Y.GenericL10n,ae=Y.LinkTarget,Nr=Y.PDFFindController,zc=Y.PDFHistory,Fr=Y.PDFLinkService,Wc=Y.PDFPageView,Uc=Y.PDFScriptingManager,Br=Y.PDFSinglePageViewer,Hr=Y.PDFViewer,$c=Y.ProgressBar,Gc=Y.RenderingStates,Xc=Y.ScrollMode,qc=Y.SimpleLinkService,Kc=Y.SpreadMode,Yc=Y.StructTreeLayerBuilder,Qc=Y.TextLayerBuilder,Jc=Y.XfaLayerBuilder,Zc=Y.parseQueryString;var td=["pdfViewerContainer"];function ed(o,t){let e=new o.EventBus;return id(e,t),e}function id(o,t){tt(o,"documentload").pipe(q(t)).subscribe(()=>{let e=document.createEvent("CustomEvent");e.initCustomEvent("documentload",!0,!0,{}),window.dispatchEvent(e)}),tt(o,"pagerendered").pipe(q(t)).subscribe(({pageNumber:e,cssTransform:i,source:s})=>{let n=document.createEvent("CustomEvent");n.initCustomEvent("pagerendered",!0,!0,{pageNumber:e,cssTransform:i}),s.div.dispatchEvent(n)}),tt(o,"textlayerrendered").pipe(q(t)).subscribe(({pageNumber:e,source:i})=>{let s=document.createEvent("CustomEvent");s.initCustomEvent("textlayerrendered",!0,!0,{pageNumber:e}),i.textLayerDiv?.dispatchEvent(s)}),tt(o,"pagechanging").pipe(q(t)).subscribe(({pageNumber:e,source:i})=>{let s=document.createEvent("UIEvents");s.initEvent("pagechanging",!0,!0),s.pageNumber=e,i.container.dispatchEvent(s)}),tt(o,"pagesinit").pipe(q(t)).subscribe(({source:e})=>{let i=document.createEvent("CustomEvent");i.initCustomEvent("pagesinit",!0,!0,null),e.container.dispatchEvent(i)}),tt(o,"pagesloaded").pipe(q(t)).subscribe(({pagesCount:e,source:i})=>{let s=document.createEvent("CustomEvent");s.initCustomEvent("pagesloaded",!0,!0,{pagesCount:e}),i.container.dispatchEvent(s)}),tt(o,"scalechange").pipe(q(t)).subscribe(({scale:e,presetValue:i,source:s})=>{let n=document.createEvent("UIEvents");n.initEvent("scalechange",!0,!0),n.scale=e,n.presetValue=i,s.container.dispatchEvent(n)}),tt(o,"updateviewarea").pipe(q(t)).subscribe(({location:e,source:i})=>{let s=document.createEvent("UIEvents");s.initEvent("updateviewarea",!0,!0),s.location=e,i.container.dispatchEvent(s)}),tt(o,"find").pipe(q(t)).subscribe(({source:e,type:i,query:s,phraseSearch:n,caseSensitive:r,highlightAll:a,findPrevious:l})=>{if(e===window)return;let h=document.createEvent("CustomEvent");h.initCustomEvent("find"+i,!0,!0,{query:s,phraseSearch:n,caseSensitive:r,highlightAll:a,findPrevious:l}),window.dispatchEvent(h)}),tt(o,"attachmentsloaded").pipe(q(t)).subscribe(({attachmentsCount:e,source:i})=>{let s=document.createEvent("CustomEvent");s.initCustomEvent("attachmentsloaded",!0,!0,{attachmentsCount:e}
342),i.container.dispatchEvent(s)}),tt(o,"sidebarviewchanged").pipe(q(t)).subscribe(({view:e,source:i})=>{let s=document.createEvent("CustomEvent");s.initCustomEvent("sidebarviewchanged",!0,!0,{view:e}),i.outerContainer.dispatchEvent(s)}),tt(o,"pagemode").pipe(q(t)).subscribe(({mode:e,source:i})=>{let s=document.createEvent("CustomEvent");s.initCustomEvent("pagemode",!0,!0,{mode:e}),i.pdfViewer.container.dispatchEvent(s)}),tt(o,"namedaction").pipe(q(t)).subscribe(({action:e,source:i})=>{let s=document.createEvent("CustomEvent");s.initCustomEvent("namedaction",!0,!0,{action:e}),i.pdfViewer.container.dispatchEvent(s)}),tt(o,"presentationmodechanged").pipe(q(t)).subscribe(({active:e,switchInProgress:i})=>{let s=document.createEvent("CustomEvent");s.initCustomEvent("presentationmodechanged",!0,!0,{active:e,switchInProgress:i}),window.dispatchEvent(s)}),tt(o,"outlineloaded").pipe(q(t)).subscribe(({outlineCount:e,source:i})=>{let s=document.createEvent("CustomEvent");s.initCustomEvent("outlineloaded",!0,!0,{outlineCount:e}),i.container.dispatchEvent(s)})}function Vr(o,t,e){o[t]=e}function qe(){return typeof window>"u"}qe()||Vr(ge,"verbosity",Qn.INFOS);typeof Promise.withResolvers>"u"&&window&&(window.Promise.withResolvers=()=>{let o,t;return{promise:new Promise((i,s)=>{o=i,t=s}),resolve:o,reject:t}});var zr=(function(o){return o[o.DISABLED=0]="DISABLED",o[o.ENABLED=1]="ENABLED",o[o.ENHANCED=2]="ENHANCED",o})(zr||{}),Hd=(()=>{class o{element;ngZone;static CSS_UNITS=96/72;static BORDER_WIDTH=9;pdfViewerContainer;eventBus;pdfLinkService;pdfFindController;pdfViewer;isVisible=!1;_cMapsUrl=typeof ge<"u"?`https://unpkg.com/pdfjs-dist@${Ve}/cmaps/`:null;_imageResourcesPath=typeof ge<"u"?`https://unpkg.com/pdfjs-dist@${Ve}/web/images/`:void 0;_renderText=!0;_renderTextMode=zr.ENABLED;_stickToPage=!1;_originalSize=!0;_pdf;_page=1;_zoom=1;_zoomScale="page-width";_rotation=0;_showAll=!0;_canAutoResize=!0;_fitToPage=!1;_externalLinkTarget="blank";_showBorders=!1;lastLoaded;_latestScrolledPage;pageScrollTimeout=null;isInitialized=!1;loadingTask;destroy$=new Xr;afterLoadComplete=new Wt;pageRendered=new Wt;pageInitialized=new Wt;textLayerRendered=new Wt;onError=new Wt;onProgress=new Wt;pageChange=new Wt(!0);src;set cMapsUrl(e){this._cMapsUrl=e}set page(e){e=parseInt(e,10)||1;let i=e;this._pdf&&(e=this.getValidPageNumber(e)),this._page=e,i!==e&&this.pageChange.emit(e)}set renderText(e){this._renderText=e}set renderTextMode(e){this._renderTextMode=e}set originalSize(e){this._originalSize=e}set showAll(e){this._showAll=e}set stickToPage(e){this._stickToPage=e}set zoom(e){e<=0||(this._zoom=e)}get zoom(){return this._zoom}set zoomScale(e){this._zoomScale=e}get zoomScale(){return this._zoomScale}set rotation(e){if(!(typeof e=="number"&&e%90===0)){console.warn("Invalid pages rotation angle.");return}this._rotation=e}set externalLinkTarget(e){this._externalLinkTarget=e}set autoresize(e){this._canAutoResize=!!e}set fitToPage(e){this._fitToPage=!!e}set showBorders(e){this._showBorders=!!e}static getLinkTarget(e){switch(e){case"blank":return ae.BLANK;case"none":return ae.NONE;case"self":return ae.SELF;case"parent":return ae.PARENT;case"top":return ae.TOP}return null}constructor(e,i){if(this.element=e,this.ngZone=i,qe())return;let s,n=Ve,r=window[`pdfWorkerSrc${n}`];r?s=r:window.hasOwnProperty("pdfWorkerSrc")&&typeof window.pdfWorkerSrc=="string"&&window.pdfWorkerSrc?s=window.pdfWorkerSrc:s=`https://cdn.jsdelivr.net/npm/pdfjs-dist@${n}/legacy/build/pdf.worker.min.mjs`,Vr(Yn,"workerSrc",s)}ngAfterViewChecked(){if(this.isInitialized)return;let e=this.pdfViewerContainer.nativeElement.offsetParent;if(this.isVisible===!0&&e==null){this.isVisible=!1;return}this.isVisible===!1&&e!=null&&(this.isVisible=!0,setTimeout(()=>{this.initialize(),this.ngOnChanges({src:this.src})}))}ngOnInit(){this.initialize(),this.setupResizeListener()}ngOnDestroy(){this.clear(),this.destroy$.next(),this.loadingTask=null}ngOnChanges(e){if(!(qe()||!this.isVisible)){if("src"in e)this.loadPDF();else if(this._pdf){if(("renderText"in e||"showAll"in e)&&(this.setupViewer(),this.resetPdfDocument()),"page"in e){let{page:i}=e;if(i.currentValue===this._latestScrolledPage)return;this.pdfViewer.scrollPageIntoView({pageNumber:this._page})}this.update()}}}updateSize(){ms(this._pdf.getPage(this.pdfViewer.currentPageNumber)).pipe(q(this.destroy$)).subscribe({next:e=>{let i=this._rotation+e.rotate,s=e.getViewport({scale:this._zoom,rotation:i}).width*o.CSS_UNITS,n=this._zoom,r=!0;if(!this._originalSize||this._fitToPage&&s>this.pdfViewerContainer.nativeElement.clientWidth){let a=e.getViewport({scale:1,rotation:i});n=this.getScale(a.width,a.height),r=!this._stickToPage}this.pdfViewer.currentScale=n,r&&this.pdfViewer.scrollPageIntoView({pageNumber:e.pageNumber,ignoreDestinationZoom:!0})}})}clear(){this.loadingTask&&!this.loadingTask.destroyed&&this.loadingTask.destroy(),this._pdf&&(this._latestScrolledPage=0,this._pdf.de
342stroy(),this._pdf=void 0),this.pdfViewer&&this.pdfViewer.setDocument(null),this.pdfLinkService&&this.pdfLinkService.setDocument(null,null),this.pdfFindController&&this.pdfFindController.setDocument(null)}getPDFLinkServiceConfig(){let e=o.getLinkTarget(this._externalLinkTarget);return e?{externalLinkTarget:e}:{}}initEventBus(){this.eventBus=ed(jr,this.destroy$),tt(this.eventBus,"pagerendered").pipe(q(this.destroy$)).subscribe(e=>{this.pageRendered.emit(e)}),tt(this.eventBus,"pagesinit").pipe(q(this.destroy$)).subscribe(e=>{this.pageInitialized.emit(e)}),tt(this.eventBus,"pagechanging").pipe(q(this.destroy$)).subscribe(({pageNumber:e})=>{this.pageScrollTimeout&&clearTimeout(this.pageScrollTimeout),this.pageScrollTimeout=window.setTimeout(()=>{this._latestScrolledPage=e,this.pageChange.emit(e)},100)}),tt(this.eventBus,"textlayerrendered").pipe(q(this.destroy$)).subscribe(e=>{this.textLayerRendered.emit(e)})}initPDFServices(){this.pdfLinkService=new Fr(G({eventBus:this.eventBus},this.getPDFLinkServiceConfig())),this.pdfFindController=new Nr({eventBus:this.eventBus,linkService:this.pdfLinkService})}getPDFOptions(){return{eventBus:this.eventBus,container:this.element.nativeElement.querySelector("div"),removePageBorders:!this._showBorders,linkService:this.pdfLinkService,textLayerMode:this._renderText?this._renderTextMode:zr.DISABLED,findController:this.pdfFindController,l10n:new Dr("en"),imageResourcesPath:this._imageResourcesPath,annotationEditorMode:Kn.DISABLE}}setupViewer(){this.pdfViewer&&this.pdfViewer.setDocument(null),Vr(ge,"disableTextLayer",!this._renderText),this.initPDFServices(),this._showAll?this.pdfViewer=new Hr(this.getPDFOptions()):this.pdfViewer=new Br(this.getPDFOptions()),this.pdfLinkService.setViewer(this.pdfViewer),this.pdfViewer._currentPageNumber=this._page}getValidPageNumber(e){return e<1?1:e>this._pdf.numPages?this._pdf.numPages:e}getDocumentParams(){let e=typeof this.src;if(!this._cMapsUrl)return this.src;let i={cMapUrl:this._cMapsUrl,cMapPacked:!0,enableXfa:!0};return i.isEvalSupported=!1,e==="string"?i.url=this.src:e==="object"&&(this.src.byteLength!==void 0?i.data=this.src:Object.assign(i,this.src)),i}loadPDF(){if(!this.src)return;if(this.lastLoaded===this.src){this.update();return}this.clear(),this.setupViewer(),this.loadingTask=Jn(this.getDocumentParams()),this.loadingTask.onProgress=i=>{this.onProgress.emit(i)};let e=this.src;ms(this.loadingTask.promise).pipe(q(this.destroy$)).subscribe({next:i=>{this._pdf=i,this.lastLoaded=e,this.afterLoadComplete.emit(i),this.resetPdfDocument(),this.update()},error:i=>{this.lastLoaded=null,this.onError.emit(i)}})}update(){this.page=this._page,this.render()}render(){if(this._page=this.getValidPageNumber(this._page),(this._rotation!==0||this.pdfViewer.pagesRotation!==this._rotation)&&this.pdfViewer.firstPagePromise?.then(()=>this.pdfViewer.pagesRotation=this._rotation),this._stickToPage&&setTimeout(()=>{this.pdfViewer.currentPageNumber=this._page}),this.pdfViewer._pages?.length)this.updateSize();else{let e=this.pageInitialized.subscribe(()=>{this.updateSize(),e.unsubscribe()})}}getScale(e,i){let s=this._showBorders?2*o.BORDER_WIDTH:0,n=this.pdfViewerContainer.nativeElement.clientWidth-s,r=this.pdfViewerContainer.nativeElement.clientHeight-s;if(r===0||i===0||n===0||e===0)return 1;let a=1;switch(this._zoomScale){case"page-fit":a=Math.min(r/i,n/e);break;case"page-height":a=r/i;break;case"page-width":default:a=n/e;break}return this._zoom*a/o.CSS_UNITS}resetPdfDocument(){this.pdfLinkService.setDocument(this._pdf,null),this.pdfFindController.setDocument(this._pdf),this.pdfViewer.setDocument(this._pdf)}initialize(){qe()||!this.isVisible||(this.isInitialized=!0,this.initEventBus(),this.setupViewer())}setupResizeListener(){qe()||this.ngZone.runOutsideAngular(()=>{tt(window,"resize").pipe(Kr(100),qr(()=>this._canAutoResize&&!!this._pdf),q(this.destroy$)).subscribe(()=>{this.updateSize()})})}static \u0275fac=function(i){return new(i||o)(bs(Jr),bs(Zr))};static \u0275cmp=ta({type:o,selectors:[["pdf-viewer"]],viewQuery:function(i,s){if(i&1&&ra(td,5),i&2){let n;aa(n=oa())&&(s.pdfViewerContainer=n.first)}},inputs:{src:"src",cMapsUrl:[0,"c-maps-url","cMapsUrl"],page:"page",renderText:[0,"render-text","renderText"],renderTextMode:[0,"render-text-mode","renderTextMode"],originalSize:[0,"original-size","originalSize"],showAll:[0,"show-all","showAll"],stickToPage:[0,"stick-to-page","stickToPage"],zoom:"zoom",zoomScale:[0,"zoom-scale","zoomScale"],rotation:"rotation",externalLinkTarget:[0,"external-link-target","externalLinkTarget"],autoresize:"autoresize",fitToPage:[0,"fit-to-page","fitToPage"],showBorders:[0,"show-borders","showBorders"]},outputs:{afterLoadComplete:"after-load-complete",pageRendered:"page-rendered",pageInitialized:"pages-initialized",textLayerRendered:"text-layer-rendered",onError:"error",onProgress:"on-progress",pageChange:"pageChange"},standalone:!1,features:[Qr],decls:3,vars:0,consts:[["pdfViewerContainer",""],[1,"ng2-pdf-viewer-container"],[1,"pdfViewer"]],template:function(i,s){i&1&&(ia(0,"div",1,0),na(2,"div",2),sa())},styles:[`.ng2-pdf-viewer-container[_ngcontent-%COMP%]{overflow-x:auto;position:absolute;height:100%;width:100%;-webkit-overflow-scrolling:touch}[_nghost-%COMP%]{display:block;position:relative}[_nghost-%COMP%]    {--pdfViewer-padding-bottom: 0;--page-margin: 1px auto -8px;--page-border: 9px solid transparent;--spreadHorizontalWrapped-margin-LR: -3.5px;--viewer-container-height: 0;--annotation-unfocused-field-background: url("data:image/svg+xml;charset=UTF-8,<svg width='1px' height='1px' xmlns='http://www.w3.org/2000/svg'><rect width='100%' height='100%' style='fill:rgba(0, 54, 255, 0.13);'/></svg>");--xfa-unfocused-field-background: var( --annotation-unfocused-field-background );--page-border-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAA1ElEQVQ4jbWUWw6EIAxFy2NFs/8NzR4UJhpqLsdi5mOmSSMUOfYWqv3S0gMr4XlYH/64gZa/gN3ANYA7KAXALt4ktoQ5MI9YxqaG8bWmsIysMuT6piSQCa4whZThCu8CM4zP9YJaKci9jicPq3NcBWYoPMGUlhG7ivtkB+gVyFY75wXghOvh8t5mto1Mdim6e+MBqH6XsY+YAwjpq3vGF7weTWQptLEDVCZvPTMl5JZZsdh47FHW6qFMyvLYqjcnmdFfY9Xk/KDOlzCusX2mi/ofM7MPkzBcSp4Q1/wAAAAASUVORK5CYII=) 9 9 repeat;--scale-factor: 1;--focus-outline: solid 2px blue;--hover-outline: dashed 2px blue;--freetext-line-height: 1.35;--freetext-padding: 2px;--editorInk-editing-cursor: pointer}@media screen and (forced-colors: active){[_nghost-%COMP%]    {--pdfViewer-padding-bottom: 9px;--page-margin: 8px auto -1px;--page-border: 1px solid CanvasText;--page-border-image: none;--spreadHorizontalWrapped-margin-LR: 3.5px}}@media (forced-colors: active){[_nghost-%COMP%]    {--focus-outline: solid 3px ButtonText;--hover-outline: dashed 3px ButtonText}}[_nghost-%COMP%]     .textLayer{position:absolute;text-align:initial;inset:0;overflow:hidden;opacity:.2;line-height:1;-webkit-text-size-adjust:none;text-size-adjust:none;forced-color-adjust:none;transform-origin:0 0}[_nghost-%COMP%]     .textLayer span, [_nghost-%COMP%]     .textLayer br{color:transparent;position:absolute;white-space:pre;cursor:text;transform-origin:0% 0%}[_nghost-%COMP%]     .textLayer span.markedContent{top:0;height:0}[_nghost-%COMP%]     .textLayer .highlight{margin:-1px;padding:1px;background-color:#b400aa;border-radius:4px}[_nghost-%COMP%]     .textLayer .highlight.appended{position:initial}[_nghost-%COMP%]     .textLayer .highlight.begin{border-radius:4px 0 0 4px}[_nghost-%COMP%]     .textLayer .highlight.end{border-radius:0 4px 4px 0}[_nghost-%COMP%]     .textLayer .highlight.middle{border-radius:0}[_nghost-%COMP%]     .textLayer .highlight.selected{background-color:#006400}[_nghost-%COMP%]     .textLayer ::selection{background:rgb(0,0,255)}[_nghost-%COMP%]     .textLayer br::selection{background:transparent}[_nghost-%COMP%]     .textLayer .endOfContent{display:block;position:absolute;inset:100% 0 0;z-index:-1;cursor:default;-webkit-user-select:none;user-select:none}[_nghost-%COMP%]     .textLayer .endOfContent.active{top:0}@media (forced-colors: active){[_nghost-%COMP%]     .annotationLayer .textWidgetAnnotation input:required, [_nghost-%COMP%]     .annotationLayer .textWidgetAnnotation textarea:required, [_nghost-%COMP%]     .annotationLayer .choiceWidgetAnnotation select:required, [_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.checkBox input:required, [_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.radioButton input:required{outline:1.5px solid selectedItem}}[_nghost-%COMP%]     .annotationLayer{position:absolute;top:0;left:0;pointer-events:none;transform-origin:0 0}[_nghost-%COMP%]     .annotationLayer section{position:absolute;text-align:initial;pointer-events:auto;box-sizing:border-box;transform-origin:0 0}[_nghost-%COMP%]     .annotationLayer .linkAnnotation>a, [_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.pushButton>a{position:absolute;font-size:1em;top:0;left:0;width:100%;height:100%}[_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.pushButton>canvas{width:100%;height:100%}[_nghost-%COMP%]     .annotationLayer .linkAnnotation>a:hover, [_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.pushButton>a:hover{opacity:.2;background:rgb(255,255,0);box-shadow:0 2px 10px #ff0}[_nghost-%COMP%]     .annotationLayer .textAnnotation img{position:absolute;cursor:pointer;width:100%;height:100%}[_nghost-%COMP%]     .annotationLayer .textWidgetAnnotation input, [_nghost-%COMP%]     .annotationLayer .textWidgetAnnotation textarea, [_nghost-%COMP%]     .annotationLayer .choiceWidgetAnnotation select, [_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.checkBox input, [_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.radioButton input{background-image:var(--annotation-unfocused-field-background);border:1px solid transparent;box-sizing:border-box;font:calc(9px * var(--scale-factor)) sans-serif;height:100%;margin:0;vertical-align:top;width:100%}[_nghost-%COMP%]     .annotationLayer .textWidgetAnnotation input:required, [_nghost-%COMP%]     .annotationLayer .textWidgetAnnotation textarea:required, [_nghost-%COMP%]     .annotationLayer .choiceWidgetAnnotation select:required, [_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.checkBox input:required, [_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.radioButton input:required{outline:1.5px solid red}[_nghost-%COMP%]     .annotationLayer .choiceWidgetAnnotation select option{padding:0}[_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.radioButton input{border-radius:50%}[_nghost-%COMP%]     .annotationLayer .textWidgetAnnotation textarea{resize:none}[_nghost-%COMP%]     .annotationLayer .textWidgetAnnotation input[disabled], [_nghost-%COMP%]     .annotationLayer .textWidgetAnnotation textarea[disabled], [_nghost-%COMP%]     .annotationLayer .choiceWidgetAnnotation select[disabled], [_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.checkBox input[disabled], [_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.radioButton input[disabled]{background:none;border:1px solid transparent;cursor:not-allowed}[_nghost-%COMP%]     .annotationLayer .textWidgetAnnotation input:hover, [_nghost-%COMP%]     .annotationLayer .textWidgetAnnotation textarea:hover, [_nghost-%COMP%]     .annotationLayer .choiceWidgetAnnotation select:hover, [_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.checkBox input:hover, [_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.radioButton input:hover{border:1px solid rgb(0,0,0)}[_nghost-%COMP%]     .annotationLayer .textWidgetAnnotation input:focus, [_nghost-%COMP%]     .annotationLayer .textWidgetAnnotation textarea:focus, [_nghost-%COMP%]     .annotationLayer .choiceWidgetAnnotation select:focus{background:none;border:1px solid transparent}[_nghost-%COMP%]     .annotationLayer .textWidgetAnnotation input :focus, [_nghost-%COMP%]     .annotationLayer .textWidgetAnnotation textarea :focus, [_nghost-%COMP%]     .annotationLayer .choiceWidgetAnnotation select :focus, [_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.checkBox :focus, [_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.radioButton :focus{background-image:none;background-color:transparent;outline:auto}[_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before, [_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after, [_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.radioButton input:checked:before{background-color:CanvasText;content:"";display:block;position:absolute}[_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before, [_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after{height:80%;left:45%;width:1px}[_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.checkBox input:checked:before{transform:rotate(45deg)}[_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.checkBox input:checked:after{transform:rotate(-45deg)}[_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.radioButton input:checked:before{border-radius:50%;height:50%;left:30%;top:20%;width:50%}[_nghost-%COMP%]     .annotationLayer .textWidgetAnnotation input.comb{font-family:monospace;padding-left:2px;padding-right:0}[_nghost-%COMP%]     .annotationLayer .textWidgetAnnotation input.comb:focus{width:103%}[_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.checkBox input, [_nghost-%COMP%]     .annotationLayer .buttonWidgetAnnotation.radioButton input{-webkit-appearance:none;appearance:none}[_nghost-%COMP%]     .annotationLayer .popupTriggerArea{height:100%;width:100%}[_nghost-%COMP%]     .annotationLayer .popupWrapper{position:absolute;font-size:calc(9px * var(--scale-factor));width:100%;min-width:calc(180px * var(--scale-factor));pointer-events:none}[_nghost-%COMP%]     .annotationLayer .popup{position:absolute;max-width:calc(180px * var(--scale-factor));background-color:#ff9;box-shadow:0 calc(2px * var(--scale-factor)) calc(5px * var(--scale-factor)) #888;border-radius:calc(2px * var(--scale-factor));padding:calc(6px * var(--scale-factor));margin-left:calc(5px * var(--scale-factor));cursor:pointer;font:message-box;white-space:normal;word-wrap:break-word;pointer-events:auto}[_nghost-%COMP%]     .annotationLayer .popup>*{font-size:calc(9px * var(--scale-factor))}
342[_nghost-%COMP%]     .annotationLayer .popup h1{display:inline-block}[_nghost-%COMP%]     .annotationLayer .popupDate{display:inline-block;margin-left:calc(5px * var(--scale-factor))}[_nghost-%COMP%]     .annotationLayer .popupContent{border-top:1px solid rgb(51,51,51);margin-top:calc(2px * var(--scale-factor));padding-top:calc(2px * var(--scale-factor))}[_nghost-%COMP%]     .annotationLayer .richText>*{white-space:pre-wrap;font-size:calc(9px * var(--scale-factor))}[_nghost-%COMP%]     .annotationLayer .highlightAnnotation, [_nghost-%COMP%]     .annotationLayer .underlineAnnotation, [_nghost-%COMP%]     .annotationLayer .squigglyAnnotation, [_nghost-%COMP%]     .annotationLayer .strikeoutAnnotation, [_nghost-%COMP%]     .annotationLayer .freeTextAnnotation, [_nghost-%COMP%]     .annotationLayer .lineAnnotation svg line, [_nghost-%COMP%]     .annotationLayer .squareAnnotation svg rect, [_nghost-%COMP%]     .annotationLayer .circleAnnotation svg ellipse, [_nghost-%COMP%]     .annotationLayer .polylineAnnotation svg polyline, [_nghost-%COMP%]     .annotationLayer .polygonAnnotation svg polygon, [_nghost-%COMP%]     .annotationLayer .caretAnnotation, [_nghost-%COMP%]     .annotationLayer .inkAnnotation svg polyline, [_nghost-%COMP%]     .annotationLayer .stampAnnotation, [_nghost-%COMP%]     .annotationLayer .fileAttachmentAnnotation{cursor:pointer}[_nghost-%COMP%]     .annotationLayer section svg{position:absolute;width:100%;height:100%}[_nghost-%COMP%]     .annotationLayer .annotationTextContent{position:absolute;width:100%;height:100%;opacity:0;color:transparent;-webkit-user-select:none;user-select:none;pointer-events:none}[_nghost-%COMP%]     .annotationLayer .annotationTextContent span{width:100%;display:inline-block}@media (forced-colors: active){[_nghost-%COMP%]     .xfaLayer *:required{outline:1.5px solid selectedItem}}[_nghost-%COMP%]     .xfaLayer .highlight{margin:-1px;padding:1px;background-color:#efcbed;border-radius:4px}[_nghost-%COMP%]     .xfaLayer .highlight.appended{position:initial}[_nghost-%COMP%]     .xfaLayer .highlight.begin{border-radius:4px 0 0 4px}[_nghost-%COMP%]     .xfaLayer .highlight.end{border-radius:0 4px 4px 0}[_nghost-%COMP%]     .xfaLayer .highlight.middle{border-radius:0}[_nghost-%COMP%]     .xfaLayer .highlight.selected{background-color:#cbdfcb}[_nghost-%COMP%]     .xfaLayer ::selection{background:rgb(0,0,255)}[_nghost-%COMP%]     .xfaPage{overflow:hidden;position:relative}[_nghost-%COMP%]     .xfaContentarea{position:absolute}[_nghost-%COMP%]     .xfaPrintOnly{display:none}[_nghost-%COMP%]     .xfaLayer{position:absolute;text-align:initial;top:0;left:0;transform-origin:0 0;line-height:1.2}[_nghost-%COMP%]     .xfaLayer *{color:inherit;font:inherit;font-style:inherit;font-weight:inherit;font-kerning:inherit;letter-spacing:-.01px;text-align:inherit;text-decoration:inherit;box-sizing:border-box;background-color:transparent;padding:0;margin:0;pointer-events:auto;line-height:inherit}[_nghost-%COMP%]     .xfaLayer *:required{outline:1.5px solid red}[_nghost-%COMP%]     .xfaLayer div{pointer-events:none}[_nghost-%COMP%]     .xfaLayer svg{pointer-events:none}[_nghost-%COMP%]     .xfaLayer svg *{pointer-events:none}[_nghost-%COMP%]     .xfaLayer a{color:#00f}[_nghost-%COMP%]     .xfaRich li{margin-left:3em}[_nghost-%COMP%]     .xfaFont{color:#000;font-weight:400;font-kerning:none;font-size:10px;font-style:normal;letter-spacing:0;text-decoration:none;vertical-align:0}[_nghost-%COMP%]     .xfaCaption{overflow:hidden;flex:0 0 auto}[_nghost-%COMP%]     .xfaCaptionForCheckButton{overflow:hidden;flex:1 1 auto}[_nghost-%COMP%]     .xfaLabel{height:100%;width:100%}[_nghost-%COMP%]     .xfaLeft{display:flex;flex-direction:row;align-items:center}[_nghost-%COMP%]     .xfaRight{display:flex;flex-direction:row-reverse;align-items:center}[_nghost-%COMP%]     .xfaLeft>.xfaCaption, [_nghost-%COMP%]     .xfaLeft>.xfaCaptionForCheckButton, [_nghost-%COMP%]     .xfaRight>.xfaCaption, [_nghost-%COMP%]     .xfaRight>.xfaCaptionForCheckButton{max-height:100%}[_nghost-%COMP%]     .xfaTop{display:flex;flex-direction:column;align-items:flex-start}[_nghost-%COMP%]     .xfaBottom{display:flex;flex-direction:column-reverse;align-items:flex-start}[_nghost-%COMP%]     .xfaTop>.xfaCaption, [_nghost-%COMP%]     .xfaTop>.xfaCaptionForCheckButton, [_nghost-%COMP%]     .xfaBottom>.xfaCaption, [_nghost-%COMP%]     .xfaBottom>.xfaCaptionForCheckButton{width:100%}[_nghost-%COMP%]     .xfaBorder{background-color:transparent;position:absolute;pointer-events:none}[_nghost-%COMP%]     .xfaWrapped{width:100%;height:100%}[_nghost-%COMP%]     .xfaTextfield:focus, [_nghost-%COMP%]     .xfaSelect:focus{background-image:none;background-color:transparent;outline:auto;outline-offset:-1px}[_nghost-%COMP%]     .xfaCheckbox:focus, [_nghost-%COMP%]     .xfaRadio:focus{outline:auto}[_nghost-%COMP%]     .xfaTextfield, [_nghost-%COMP%]     .xfaSelect{height:100%;width:100%;flex:1 1 auto;border:none;resize:none;background-image:var(--xfa-unfocused-field-background)}[_nghost-%COMP%]     .xfaTop>.xfaTextfield, [_nghost-%COMP%]     .xfaTop>.xfaSelect, [_nghost-%COMP%]     .xfaBottom>.xfaTextfield, [_nghost-%COMP%]     .xfaBottom>.xfaSelect{flex:0 1 auto}
342[_nghost-%COMP%]     .xfaButton{cursor:pointer;width:100%;height:100%;border:none;text-align:center}[_nghost-%COMP%]     .xfaLink{width:100%;height:100%;position:absolute;top:0;left:0}[_nghost-%COMP%]     .xfaCheckbox, [_nghost-%COMP%]     .xfaRadio{width:100%;height:100%;flex:0 0 auto;border:none}[_nghost-%COMP%]     .xfaRich{white-space:pre-wrap;width:100%;height:100%}[_nghost-%COMP%]     .xfaImage{object-position:left top;object-fit:contain;width:100%;height:100%}[_nghost-%COMP%]     .xfaLrTb, [_nghost-%COMP%]     .xfaRlTb, [_nghost-%COMP%]     .xfaTb{display:flex;flex-direction:column;align-items:stretch}[_nghost-%COMP%]     .xfaLr{display:flex;flex-direction:row;align-items:stretch}[_nghost-%COMP%]     .xfaRl{display:flex;flex-direction:row-reverse;align-items:stretch}[_nghost-%COMP%]     .xfaTb>div{justify-content:left}[_nghost-%COMP%]     .xfaPosition{position:relative}[_nghost-%COMP%]     .xfaArea{position:relative}[_nghost-%COMP%]     .xfaValignMiddle{display:flex;align-items:center}[_nghost-%COMP%]     .xfaTable{display:flex;flex-direction:column;align-items:stretch}[_nghost-%COMP%]     .xfaTable .xfaRow{display:flex;flex-direction:row;align-items:stretch}[_nghost-%COMP%]     .xfaTable .xfaRlRow{display:flex;flex-direction:row-reverse;align-items:stretch;flex:1}[_nghost-%COMP%]     .xfaTable .xfaRlRow>div{flex:1}[_nghost-%COMP%]     .xfaNonInteractive input, [_nghost-%COMP%]     .xfaNonInteractive textarea, [_nghost-%COMP%]     .xfaDisabled input, [_nghost-%COMP%]     .xfaDisabled textarea, [_nghost-%COMP%]     .xfaReadOnly input, [_nghost-%COMP%]     .xfaReadOnly textarea{background:initial}@media print{[_nghost-%COMP%]     .xfaTextfield, [_nghost-%COMP%]     .xfaSelect{background:transparent}[_nghost-%COMP%]     .xfaSelect{-webkit-appearance:none;appearance:none;text-indent:1px;text-overflow:""}}[_nghost-%COMP%]     [data-editor-rotation="90"]{transform:rotate(90deg)}[_nghost-%COMP%]     [data-editor-rotation="180"]{transform:rotate(180deg)}[_nghost-%COMP%]     [data-editor-rotation="270"]{transform:rotate(270deg)}[_nghost-%COMP%]     .annotationEditorLayer{background:transparent;position:absolute;top:0;left:0;font-size:calc(100px * var(--scale-factor));transform-origin:0 0}[_nghost-%COMP%]     .annotationEditorLayer .selectedEditor{outline:var(--focus-outline);resize:none}[_nghost-%COMP%]     .annotationEditorLayer .freeTextEditor{position:absolute;background:transparent;border-radius:3px;padding:calc(var(--freetext-padding) * var(--scale-factor));resize:none;width:auto;height:auto;z-index:1;transform-origin:0 0;touch-action:none}[_nghost-%COMP%]     .annotationEditorLayer .freeTextEditor .internal{background:transparent;border:none;top:0;left:0;overflow:visible;white-space:nowrap;resize:none;font:10px sans-serif;line-height:var(--freetext-line-height)}[_nghost-%COMP%]     .annotationEditorLayer .freeTextEditor .overlay{position:absolute;display:none;background:transparent;top:0;left:0;width:100%;height:100%}[_nghost-%COMP%]     .annotationEditorLayer .freeTextEditor .overlay.enabled{display:block}[_nghost-%COMP%]     .annotationEditorLayer .freeTextEditor .internal:empty:before{content:attr(default-content);color:gray}[_nghost-%COMP%]     .annotationEditorLayer .freeTextEditor .internal:focus{outline:none}[_nghost-%COMP%]     .annotationEditorLayer .inkEditor.disabled{resize:none}[_nghost-%COMP%]     .annotationEditorLayer .inkEditor.disabled.selectedEditor{resize:horizontal}[_nghost-%COMP%]     .annotationEditorLayer .freeTextEditor:hover:not(.selectedEditor), [_nghost-%COMP%]     .annotationEditorLayer .inkEditor:hover:not(.selectedEditor){outline:var(--hover-outline)}[_nghost-%COMP%]     .annotationEditorLayer .inkEditor{position:absolute;background:transparent;border-radius:3px;overflow:auto;width:100%;height:100%;z-index:1;transform-origin:0 0;
342cursor:auto}[_nghost-%COMP%]     .annotationEditorLayer .inkEditor.editing{resize:none;cursor:var(--editorInk-editing-cursor),pointer}[_nghost-%COMP%]     .annotationEditorLayer .inkEditor .inkEditorCanvas{position:absolute;top:0;left:0;width:100%;height:100%;touch-action:none}[_nghost-%COMP%]     [data-main-rotation="90"]{transform:rotate(90deg) translateY(-100%)}[_nghost-%COMP%]     [data-main-rotation="180"]{transform:rotate(180deg) translate(-100%,-100%)}[_nghost-%COMP%]     [data-main-rotation="270"]{transform:rotate(270deg) translate(-100%)}[_nghost-%COMP%]     .pdfViewer{padding-bottom:var(--pdfViewer-padding-bottom)}[_nghost-%COMP%]     .pdfViewer .canvasWrapper{overflow:hidden}[_nghost-%COMP%]     .pdfViewer .canvasWrapper canvas{width:100%}[_nghost-%COMP%]     .pdfViewer .page{direction:ltr;width:816px;height:1056px;margin:var(--page-margin);position:relative;overflow:visible;border:var(--page-border);border-image:var(--page-border-image);background-clip:content-box;background-color:#fff}[_nghost-%COMP%]     .pdfViewer .dummyPage{position:relative;width:0;height:var(--viewer-container-height)}[_nghost-%COMP%]     .pdfViewer.removePageBorders .page{margin:0 auto 10px;border:none}[_nghost-%COMP%]     .pdfViewer.singlePageView{display:inline-block}[_nghost-%COMP%]     .pdfViewer.singlePageView .page{margin:0;border:none}[_nghost-%COMP%]     .pdfViewer.scrollHorizontal, [_nghost-%COMP%]     .pdfViewer.scrollWrapped, [_nghost-%COMP%]     .spread{margin-left:3.5px;margin-right:3.5px;text-align:center}[_nghost-%COMP%]     .pdfViewer.scrollHorizontal, [_nghost-%COMP%]     .spread{white-space:nowrap}[_nghost-%COMP%]     .pdfViewer.removePageBorders, [_nghost-%COMP%]     .pdfViewer.scrollHorizontal .spread, [_nghost-%COMP%]     .pdfViewer.scrollWrapped .spread{margin-left:0;margin-right:0}[_nghost-%COMP%]     .spread .page, [_nghost-%COMP%]     .spread .dummyPage, [_nghost-%COMP%]     .pdfViewer.scrollHorizontal .page, [_nghost-%COMP%]     .pdfViewer.scrollWrapped .page, [_nghost-%COMP%]     .pdfViewer.scrollHorizontal .spread, [_nghost-%COMP%]     .pdfViewer.scrollWrapped .spread{display:inline-block;vertical-align:middle}[_nghost-%COMP%]     .spread .page, [_nghost-%COMP%]     .pdfViewer.scrollHorizontal .page, [_nghost-%COMP%]     .pdfViewer.scrollWrapped .page{margin-left:var(--spreadHorizontalWrapped-margin-LR);margin-right:var(--spreadHorizontalWrapped-margin-LR)}[_nghost-%COMP%]     .pdfViewer.removePageBorders .spread .page, [_nghost-%COMP%]     .pdfViewer.removePageBorders.scrollHorizontal .page, [_nghost-%COMP%]     .pdfViewer.removePageBorders.scrollWrapped .page{margin-left:5px;margin-right:5px}[_nghost-%COMP%]     .pdfViewer .page canvas{margin:0;display:block}[_nghost-%COMP%]     .pdfViewer .page canvas[hidden]{display:none}[_nghost-%COMP%]     .pdfViewer .page .loadingIcon{position:absolute;display:block;inset:0;background:url(data:image/gif;base64,R0lGODlhGAAYAPQQAM7Ozvr6+uDg4LCwsOjo6I6OjsjIyJycnNjY2KioqMDAwPLy8nZ2doaGhri4uGhoaP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/ilPcHRpbWl6ZWQgd2l0aCBodHRwczovL2V6Z2lmLmNvbS9vcHRpbWl6ZQAh+QQJBwAQACwAAAAAGAAYAAAFmiAkjiTkOGVaBgjZNGSgkgKjjM8zLoI8iy+BKCdiCX8iBeMAhEEIPRXLxViYUE9CbCQoFAzFhHY3zkaT3oPvBz1zE4UBsr1eWZH4vAowOBwGAHk8AoQLfH6Agm0Ed3qOAXWOIgQKiWyFJQgDgJEpdG+WEACNEFNFmKVlVzJQk6qdkwqBoi1mebJ3ALNGeIZHtGSwNDS1RZKueCEAIfkECQcAEAAsAAAAABgAGAAABZcgJI4kpChlWgYCWRQkEKgjURgjw4zOg9CjVwuiEyEeO6CxkBC9nA+HiuUqLEyoBZI0Mx4SAFFgQCDZuguBoGv6Dtg0gvpqdhxQQDkBzuUr/4A1JwMKP39pc2mDhYCIc4GQYn6QCwCMeY91l0p6dBAEJ0OfcFRimZ91Mwt0alxxAIZyRmuAsKxDLKKvZbM1tJxmvGKRpn8hACH5BAkHABAALAAAAAAYABgAAAWhICSOJGQYZVoGAnkcJBKoI3EAY1GMCtPSosSBINKJBIwGkHdwBGGQA0OhYpEGQxNqkYzNIITBACEKKBaxxNfBeOCO4vMy0Hg8nDHFeCktkKtfNAtoS4UqAicKBj9zBAKPC4iKi4aRkISGmWWBmjUIAIyHkCUEAKCVo2WmREecVqoCgZhgP4NHrGWCj7e3szSpuxAsoVWxnp6cVV4kyZW+KSEAIfkECQcAEAAsAAAAABgAGAAABZkgJI4kBABlWgYEOQykEKgjMSDjcYxG0dKi108nEhQKQN4rCIMkCgbawjWYnSCLY2yGVSgEooBhWqsGGwxc0RtNBgoMhmJ1QgETjANYFeBKyUmBKQQIdT9JDmgPDQ6EhoKJD4sOgpWWgiwChyqEBH5hmptSoSOZgJ4kLKWkYTF7C2SaqaM/hEWygay4mYG8t6uffFuzl1iANCEAIfkECQcAEAAsAAAAABgAGAAABZ0gJI4khCBlmhKkop
342BCoI6LIozDMAIHO4uuBVBnOiR+I4FrCDwAZsKdQnaCLIwwmRUA8JmioprWUCjcwlwUMnAoG0qL03k2KCS8cC0UjOzDCQKBfHQFDAwFU4CCfgqFhy9+kZJWgzSKSAcPZn+BfQENDw8OljGWJAFeDoZPYTBnC1GdSXqnsoBolSulX2GyP6hgvnG0KrS3NJNhuSQhACH5BAkHABAALAAAAAAYABgAAAWaICSOJCQIZZoupGGQRKCOC0CMijIiwz2LABtQZxoMfjQhxAXszWQ7gOwECRhh0MCJJRJARTUoIHFAgbfI6uBwAJS01J/i4PClVYHvfV8lbLlIBmwFbQt+aGmChG18jXeGT4dICQxlb4g/AQUMDER9XjR6BAdiDQwINDBmkAsPDVh4cX4imw53iLKuaVqAcUsPqEiidkt6j4AzIQAh+QQJBwAQACwAAAAAGAAYAAAFmSAkjiREEGWaBiSCtCoZCMsIAKOg1LEo0KKbaKFQ9EYLoOkFuQlirNxzCQkUW9GZ0hQd4nyDAWr4G/esYSbyZFYZwu3jqiuvr8u8I2BwOAwASXh1e31/doeHC3klWnElfAlTd46MfQUGk2stCVEGBQWSdCciDg5VDAVYKoEiDQ0iBwxGcj9RDw8+qHIzebc2DJJQJK6qiKVyIQAh+QQJBwAQACwAAAAAGAAYAAAFmSAkjiS0LGWaBiRBtCoZCKgoCCMB1DF0sz6cCQDo5W62l28XAyZFpyECBv3lnCbhUqHMIo0Qg4Jbmn1jRCa4iV27TzfXGjEecOFWMN1OdvvfPGUuXSoKBw6EXokrAwcHRVU0UAeEBANAAAmUI1gNDyhjJgUHLW0iDg8FIqOnBQZrDA9TELE2rEYIDw4jta2LMpCrqld/YQpgIQAh+QQJBwAQACwAAAAAGAAYAAAFmyAkjiS0LGWaBiRBkKw6BgIqCsJcyyMe4yJajhcEml5H26o1PN2QQd3uFiv2AADlAgflIbDdZLgkABOJgep5LfWty4p4zeU+w+XsvJWXliEKDwdEBgMKYQ4PDw1qK3EDCCMAiQ5BCV0LCj+FSDQkgCgGBiYHAy2MIgoMghAHqw4HAGsNDEMFBTekdgwKI7aRB2MwkL2rVHoQoWchACH5BAkHABAALAAAAAAYABgAAAWWICSOJLQsZZoGJEGQrDoGAioKwlzLIx7jIlqOFwSaXkfbqjU83ZBB3e4WK0qrCxyU55peid0qcUwuixyNx6PhILsAcAJazXYj4lvz2MkLiFsHDAlEcABKZwwMBX8pBgoKQxAIigpBA1sLBj+PSDQkB4uSACYDlTMyBgWDEKVnl2QFBUigN61gBQYjtLV5JZ4jtlR6omMhACH5BAkHABAALAAAAAAYABgAAAWaICSOJLQsZZoGJEGQrDoGAioKwlzLIx7jIlqOFwSaXkdbidYanm7I4AjwYDh6saJuJ3JUG1mZi9srPA7EcRimJLrfJYWZUVC8TziXnEG3u/E+cIJaPAFrPQl1aQAIbRAGBZGHJQiMUQKRBkEKbQsAPZaEXQcslSYKmjMyAAdXj34ACkNEiUgDA5t+PAQHn6Ogjkuzry2DNwhuIQAh+QQFBwAQACwAAAAAGAAYAAAFnCAkjiS0LGVaBgBJEGSguo8zCsK4CPIsMg+ECCcKEH0ix6MwhJl4KiOp8UCdmrEbo6EoHpxF8A6aBBZ6vhf5dmAkkGr0CoWs21WGQ2FvsI9xC3l7B311fy93iWGKJQQOhHCAJQB6A3IqcWwJLU90i2FkUiMKlhBELEI6MwgDXRAGhQgAYD6tTqRFAJxpA6mvrqazSKJJhUWMpjlIIQA7) center no-repeat}[_nghost-%COMP%]     .pdfViewer .page .loadingIcon.notVisible{background:none}[_nghost-%COMP%]     .pdfViewer.enablePermissions .textLayer span{-webkit-user-select:none!important;user-select:none!important;cursor:not-allowed}[_nghost-%COMP%]     .pdfPresentationMode .pdfViewer{padding-bottom:0}[_nghost-%COMP%]     .pdfPresentationMode .spread{margin:0}[_nghost-%COMP%]     .pdfPresentationMode .pdfViewer .page{margin:0 auto;border:2px solid transparent}`]})}return o})(),jd=(()=>{class o{static \u0275fac=function(i){return new(i||o)};static \u0275mod=ea({type:o});static \u0275inj=Yr({})}return o})();export{Hd as a,jd as b};

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.