PageSourceSearch

https://lobe-chat-eight-virid-32.vercel.app/_next/static/chunks/9b0008ae-6549c66c18b960cc.js

js lobe-chat-eight-virid-32.vercel.app collected 2026-10-03 07:19:45 UTC 383,013 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[52084],{13126:(t,e,i)=>{i.d(e,{D6:()=>_k,EA:()=>_A,Tm:()=>_y,YE:()=>_S,dU:()=>_b,ng:()=>_w,rE:()=>_x});var s=i(63508),a=i(73141),n=i(95192),r=i(11389),l=i(97451),o=i(80971),h=i(1897),d=i(49125),c=i(28596),u=i(26799),_=i(19194),p=i(87358),f=i(44134).hp,g={};g.d=(t,e)=>{for(var i in e)g.o(e,i)&&!g.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},g.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var v=globalThis.pdfjsLib={};g.d(v,{AbortException:()=>K,AnnotationEditorLayer:()=>_i,AnnotationEditorParamsType:()=>S,AnnotationEditorType:()=>k,AnnotationEditorUIManager:()=>ih,AnnotationLayer:()=>oz,AnnotationMode:()=>y,ColorPicker:()=>dy,DOMSVGFactory:()=>l_,DrawLayer:()=>_f,FeatureTest:()=>J,GlobalWorkerOptions:()=>a4,ImageKind:()=>M,InvalidPDFException:()=>G,MissingPDFException:()=>U,OPS:()=>L,OutputScale:()=>tM,PDFDataRangeTransport:()=>rP,PDFDateString:()=>tw,PDFWorker:()=>rq,PasswordResponses:()=>I,PermissionFlag:()=>x,PixelsPerInch:()=>to,RenderingCancelledException:()=>tc,TextLayer:()=>rc,UnexpectedResponseException:()=>V,Util:()=>$,VerbosityLevel:()=>R,XfaLayer:()=>lp,build:()=>lo,createValidAbsoluteUrl:()=>O,fetchData:()=>th,getDocument:()=>rT,getFilenameFromUrl:()=>tp,getPdfFilenameFromUrl:()=>tf,getXfaPageViewport:()=>ty,isDataScheme:()=>tu,isPdfFile:()=>t_,noContextMenu:()=>tm,normalizeUnicode:()=>ta,setLayerDimensions:()=>tE,shadow:()=>H,version:()=>ll});let m="object"==typeof p&&p+""=="[object process]"&&!p.versions.nw&&!(p.versions.electron&&p.type&&"browser"!==p.type),b=[1,0,0,1,0,0],w=[.001,0,0,.001,0,0],A={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},y={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},k={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},S={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},x={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},E={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},M={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},C={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,WIDGET:20},T={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},R={ERRORS:0,WARNINGS:1,INFOS:5}
1,L={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},I={NEED_PASSWORD:1,INCORRECT_PASSWORD:2},P=R.WARNINGS;function D(t){P>=R.INFOS&&console.log("Info: ".concat(t))}function F(t){P>=R.WARNINGS&&console.log("Warning: ".concat(t))}function W(t){throw Error(t)}function N(t,e){t||W(e)}function O(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(!t)return null;try{if(i&&"string"==typeof t){if(i.addDefaultProtocol&&t.startsWith("www.")){let e=t.match(/\./g);(null==e?void 0:e.length)>=2&&(t="http://".concat(t))}if(i.tryConvertEncoding)try{var s;s=t,t=decodeURIComponent(escape(s))}catch(t){}}let a=e?new URL(t,e):new URL(t);if(function(t){switch(null==t?void 0:t.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(a))return a}catch(t){}return null}function H(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return Object.defineProperty(t,e,{value:i,enumerable:!s,configurable:!0,writable:!1}),i}let B=function(){function t(t,e){this.message=t,this.name=e}return t.prototype=Error(),t.constructor=t,t}();class j extends B{constructor(t,e){super(t,"PasswordException"),this.code=e}}class z extends B{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class G extends B{constructor(t){super(t,"InvalidPDFException")}}class U extends B{constructor(t){super(t,"MissingPDFException")}}class V extends B{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}}class q extends B{constructor(t){super(t,"FormatError")}}class K extends B{constructor(t){super(t,"AbortException")}}function X(t){("object"!=typeof t||(null==t?void 0:t.length)===void 0)&&W("Invalid argument for bytesToString");let e=t.length;if(e<8192)return String.fromCharCode.apply(null,t);let i=[];for(let s=0;s<e;s+=8192){let a=Math.min(s+8192,e),n=t.subarray(s,a);i.push(String.fromCharCode.apply(null,n))}return i.join("")}function Y(t){"string"!=typeof t&&W("Invalid argument for stringToBytes");let e=t.length,i=new Uint8Array(e);for(let s=0;s<e;++s)i[s]=255&t.charCodeAt(s);return i}function Q(t){let e=Object.create(null);for(let[i,s]of t)e[i]=s;return e}class J{static get isLittleEndian(){return H(this,"isLittleEndian",function(){let t=new Uint8Array(4);return t[0]=1,1===new Uint32Array(t.buffer,0,1)[0]}())}static get isEvalSupported(){return H(this,"isEvalSupported",function(){try{return Function(""),!0}catch(t){return!1}}())}static get isOffscreenCanvasSupported(){return H(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}static get platform(){var t,e;return"undefined"!=typeof navigator&&"string"==typeof(null===(t=navigator)||void 0===t?void 0:t.platform)?H(this,"platform",{isMac:navigator.platform.includes("Mac"),isWindows:navigator.platform.includes("Win"),isFirefox:"string"==typeof(null===(e=navigator)||void 0===e?void 0:e.userAgent)&&navigator.userAgent.includes("Firefox")}):H(this,"platform",{isMac:!1,isWindows:!1,isFirefox:!1})}static get isCSSRoundSupported(){var t,e;return H(this,"isCSSRoundSupported",null===(e=globalThis.CSS)||void 0===e?void 0:null===(t=e.supports)||void 0===t?void 0:t.call(e,"width: round(1.5px, 1px)"))}}let Z=Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0"));class ${static makeHexColor(t,e,i){return"#".concat(Z[t]).concat(Z[e]).concat(Z[i])}static scaleMinMax(t,e){let i;t[0]?(t[0]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[3],e[3]*=t[3]):(i=e[0],e[0]=e[1],e[1]=i,i=e[2],e[2]=e[3],e[3]=i,t[1]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static applyTransform(t,e){return[t[0]*e[0]+t[1]*e[2]+e[4],t[0]*e[1]+t[1]*e[3]+e[5]]}static applyInverseTransform(t,e){let i=e[0]*e[3]-e[1]*e[2];return[(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/i,(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/i]}static getAxialAlignedBoundingBox(t,e){let i=this.applyTransform(t,e),s=this.applyTransform(t.slice(2,4),e),a=this.applyTransform([t[0],t[3]],e),n=this.applyTransform([t[2],t[1]],e);return[Math.min(i[0],s[0],a[0],n[0]),Math.min(i[1],s[1],a[1],n[1]),Math.max(i[0],s[0],a[0],n[0]),Math.max(i[1],s[1],a[1],n[1])]}static inverseTransform(t){let e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t){let e=[t[0],t[2],t[1],t[3]],i=t[0]*e[0]+t[1]*e[2],s=t[0]*e[1]+t[1]*e[3],a=t[2]*e[0]+t[3]*e[2],n=t[2]*e[1]+t[3]*e[3],r=(i+n)/2,l=Math.sqrt((i+n)**2-4*(i*n-a*s))/2;return[Math.sqrt(r+l||1),Math.sqrt(r-l||1)]}static normalizeRect(t){let e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){let i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),s=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>s)return null;let a=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),n=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return a>n?null:[i,a,s,n]}static bezierBoundingBox(t,e,i,s,a,n,r,l,o){return o?(o[0]=Math.min(o[0],t,r),o[1]=Math.min(o[1],e,l),o[2]=Math.max(o[2],t,r),o[3]=Math.max(o[3],e,l)):o=[Math.min(t,r),Math.min(e,l),Math.max(t,r),Math.max(e,l)],(0,_._)(this,$,te).call($,t,i,a,r,e,s,n,l,3*(-t+3*(i-a)+r),6*(t-2*i+a),3*(i-t),o),(0,_._)(this,$,te).call($,t,i,a,r,e,s,n,l,3*(-e+3*(s-n)+l),6*(e-2*s+n),3*(s-e),o),o}}function tt(t,e,i,s,a,n,r,l,o,h){if(o<=0||o>=1)return;let d=1-o,c=o*o,u=c*o,_=d*(d*(d*t+3*o*e)+3*c*i)+u*s,p=d*(d*(d*a+3*o*n)+3*c*r)+u*l;h[0]=Math.min(h[0],_),h[1]=Math.min(h[1],p),h[2]=Math.max(h[2],_),h[3]=Math.max(h[3],p)}function te(t,e,i,s,a,n,r,l,o,h,d,c){if(1e-12>Math.abs(o)){Math.abs(h)>=1e-12&&(0,_._)(this,$,tt).call($,t,e,i,s,a,n,r,l,-d/h,c);return}let u=h**2-4*d*o;if(u<0)return;let p=Math.sqrt(u),f=2*o;(0,_._)(this,$,tt).call($,t,e,i,s,a,n,r,l,(-h+p)/f,c),(0,_._)(this,$,tt).call($,t,e,i,s,a,n,r,l,(-h-p)/f,c)}let ti=null,ts=null;function ta(t){return ti||(ti=/([\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,ts=new Map([["ſt","ſt"]])),t.replaceAll(ti,(t,e,i)=>e?e.normalize("NFKC"):ts.get(i))}let tn="pdfjs_internal_id_",tr={BEZIER_CURVE_TO:0,MOVE_TO:1,LINE_TO:2,QUADRATIC_CURVE_TO:3,RESTORE:4,SAVE:5,SCALE:6,TRANSFORM:7,TRANSLATE:8},tl="http://www.w3.org/2000/svg";class to{}async function th(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";if(tv(t,document.baseURI)){let i=await fetch(t);if(!i.ok)throw Error(i.statusText);switch(e){case"arraybuffer":return i.arrayBuffer();case"blob":return i.blob();case"json":return i.json()}return i.text()}return new Promise((i,s)=>{let a=new XMLHttpRequest;a.open("GET",t,!0),a.responseType=e,a.onreadystatechange=()=>{if(a.readyState===XMLHttpRequest.DONE){if(200===a.status||0===a.status){switch(e){case"arraybuffer":case"blob":case"json":i(a.response);return}i(a.responseText);return}s(Error(a.statusText))}},a.send(null)})}to.CSS=96,to.PDF=72,to.PDF_TO_CSS_UNITS=to.CSS/to.PDF;class td{get rawDims(){let{viewBox:t}=this;return H(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone(){let{scale:t=this.scale,rotation:e=this.rotation,offsetX:i=this.offsetX,offsetY:s=this.offsetY,dontFlip:a=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new td({viewBox:this.viewBox.slice(),scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:a})}convertToViewportPoint(t,e){return $.applyTransform([t,e],this.transform)}convertToViewportRectangle(t){let e=$.applyTransform([t[0],t[1]],this.transform),i=$.applyTransform([t[2],t[3]],this.transform);return[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){return $.applyInverseTransform([t,e],this.transform)}constructor({viewBox:t,scale:e,rotation:i,offsetX:s=0,offsetY:a=0,dontFlip:n=!1}){let r,l,o,h,d,c,u,_;this.viewBox=t,this.scale=e,this.rotation=i,this.offsetX=s,this.offsetY=a;let p=(t[2]+t[0])/2,f=(t[3]+t[1])/2;switch((i%=360)<0&&(i+=360),i){case 180:r=-1,l=0,o=0,h=1;break;case 90:r=0,l=1,o=1,h=0;break;case 270:r=0,l=-1,o=-1,h=0;break;case 0:r=1,l=0,o=0,h=-1;break;default:throw Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}n&&(o=-o,h=-h),0===r?(d=Math.abs(f-t[1])*e+s,c=Math.abs(p-t[0])*e+a,u=(t[3]-t[1])*e,_=(t[2]-t[0])*e):(d=Math.abs(p-t[0])*e+s,c=Math.abs(f-t[1])*e+a,u=(t[2]-t[0])*e,_=(t[3]-t[1])*e),this.transform=[r*e,l*e,o*e,h*e,d-r*e*p-o*e*f,c-l*e*p-h*e*f],this.width=u,this.height=_}}class tc extends B{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function tu(t){let e=t.length,i=0;for(;i<e&&""===t[i].trim();)i++;return"data:"===t.substring(i,i+5).toLowerCase()}function t_(t){return"string"==typeof t&&/\.pdf$/i.test(t)}function tp(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)}function tf(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"document.pdf";if("string"!=typeof t)return e;if(tu(t))return F('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;let i=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,s=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(t),a=i.exec(s[1])||i.exec(s[2])||i.exec(s[3]);if(a&&(a=a[0]).includes("%"))try{a=i.exec(decodeURIComponent(a))[0]}catch(t){}return a||e}class tg{time(t){t in this.started&&F("Timer is already running for ".concat(t)),this.started[t]=Date.now()}timeEnd(t){t in this.started||F("Timer has not been started for ".concat(t)),this.times.push({name:t,start:this.started[t],end:Date.now()}),delete this.started[t]}toString(){let t=[],e=0;for(let{name:t}of this.times)e=Math.max(t.length,e);for(let{name:i,start:s,end:a}of this.times)t.push("".concat(i.padEnd(e)," ").concat(a-s,"ms\n"));return t.join("")}constructor(){this.started=Object.create(null),this.times=[]}}function tv(t,e){try{let{protocol:i}=e?new URL(t,e):new URL(t);return"http:"===i||"https:"===i}catch(t){return!1}}function tm(t){t.preventDefault()}function tb(t){console.log("Deprecated API usage: "+t)}class tw{static toDateObject(t){if(!t||"string"!=typeof t)return null;(0,d._)(this,tw,tA,(0,h._)(this,tw,tA)||RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));let e=(0,h._)(this,tw,tA).exec(t);if(!e)return null;let i=parseInt(e[1],10),s=parseInt(e[2],10);s=s>=1&&s<=12?s-1:0;let a=parseInt(e[3],10);a=a>=1&&a<=31?a:1;let n=parseInt(e[4],10);n=n>=0&&n<=23?n:0;let r=parseInt(e[5],10);r=r>=0&&r<=59?r:0;let l=parseInt(e[6],10);l=l>=0&&l<=59?l:0;let o=e[7]||"Z",c=parseInt(e[8],10);c=c>=0&&c<=23?c:0;let u=parseInt(e[9],10)||0;return u=u>=0&&u<=59?u:0,"-"===o?(n+=c,r+=u):"+"===o&&(n-=c,r-=u),new Date(Date.UTC(i,s,a,n,r,l))}}var tA={writable:!0,value:void 0};function ty(t,e){let{scale:i=1,rotation:s=0}=e,{width:a,height:n}=t.attributes.style;return new td({viewBox:[0,0,parseInt(a),parseInt(n)],scale:i,rotation:s})}function tk(t){if(t.startsWith("#")){let e=parseInt(t.slice(1),16);return[(0xff0000&e)>>16,(65280&e)>>8,255&e]}return t.startsWith("rgb(")?t.slice(4,-1).split(",").map(t=>parseInt(t)):t.startsWith("rgba(")?t.slice(5,-1).split(",").map(t=>parseInt(t)).slice(0,3):(F('Not a valid color format: "'.concat(t,'"')),[0,0,0])}function tS(t){let{a:e,b:i,c:s,d:a,e:n,f:r}=t.getTransform();return[e,i,s,a,n,r]}function tx(t){let{a:e,b:i,c:s,d:a,e:n,f:r}=t.getTransform().invertSelf();return[e,i,s,a,n,r]}function tE(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=!(arguments.length>3)||void 0===arguments[3]||arguments[3];if(e instanceof td){let{pageWidth:s,pageHeight:a}=e.rawDims,{style:n}=t,r=J.isCSSRoundSupported,l="var(--scale-factor) * ".concat(s,"px"),o="var(--scale-factor) * ".concat(a,"px"),h=r?"round(down, ".concat(l,", var(--scale-round-x, 1px))"):"calc(".concat(l,")"),d=r?"round(down, ".concat(o,", var(--scale-round-y, 1px))"):"calc(".concat(o,")");i&&e.rotation%180!=0?(n.width=d,n.height=h):(n.width=h,n.height=d)}s&&t.setAttribute("data-main-rotation",e.rotation)}class tM{get scaled(){return 1!==this.sx||1!==this.sy}get symmetric(){return this.sx===this.sy}constructor(){let t=window.devicePixelRatio||1;this.sx=t,this.sy=t}}
1var tC=new WeakMap,tT=new WeakMap,tR=new WeakMap,tL=new WeakMap,tI=new WeakMap,tP=new WeakSet,tD=new WeakSet,tF=new WeakSet,tW=new WeakSet,tN=new WeakMap;class tO{render(){let t=(0,n._)(this,tC,document.createElement("div"));t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");let e=(0,s._)(this,tR)._uiManager._signal;t.addEventListener("contextmenu",tm,{signal:e}),t.addEventListener("pointerdown",(0,_._)(tO,tO,tB),{signal:e});let i=(0,n._)(this,tL,document.createElement("div"));i.className="buttons",t.append(i);let a=(0,s._)(this,tR).toolbarPosition;if(a){let{style:e}=t,i="ltr"===(0,s._)(this,tR)._uiManager.direction?1-a[0]:a[0];e.insetInlineEnd="".concat(100*i,"%"),e.top="calc(".concat(100*a[1],"% + var(--editor-toolbar-vert-offset))")}return(0,l._)(this,tW,tU).call(this),t}get div(){return(0,s._)(this,tC)}hide(){var t;(0,s._)(this,tC).classList.add("hidden"),null===(t=(0,s._)(this,tT))||void 0===t||t.hideDropdown()}show(){var t;(0,s._)(this,tC).classList.remove("hidden"),null===(t=(0,s._)(this,tI))||void 0===t||t.shown()}async addAltText(t){let e=await t.render();(0,l._)(this,tF,tG).call(this,e),(0,s._)(this,tL).prepend(e,(0,s._)(this,tN)),(0,n._)(this,tI,t)}addColorPicker(t){(0,n._)(this,tT,t);let e=t.renderButton();(0,l._)(this,tF,tG).call(this,e),(0,s._)(this,tL).prepend(e,(0,s._)(this,tN))}remove(){var t;(0,s._)(this,tC).remove(),null===(t=(0,s._)(this,tT))||void 0===t||t.destroy(),(0,n._)(this,tT,null)}constructor(t){(0,o._)(this,tP),(0,o._)(this,tD),(0,o._)(this,tF),(0,o._)(this,tW),(0,a._)(this,tN,{get:tV,set:void 0}),(0,a._)(this,tC,{writable:!0,value:void 0}),(0,a._)(this,tT,{writable:!0,value:void 0}),(0,a._)(this,tR,{writable:!0,value:void 0}),(0,a._)(this,tL,{writable:!0,value:void 0}),(0,a._)(this,tI,{writable:!0,value:void 0}),(0,n._)(this,tC,null),(0,n._)(this,tT,null),(0,n._)(this,tL,null),(0,n._)(this,tI,null),(0,n._)(this,tR,t),(0,d._)(tO,tO,tH,(0,h._)(tO,tO,tH)||Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button"}))}}var tH={writable:!0,value:null};function tB(t){t.stopPropagation()}function tj(t){(0,s._)(this,tR)._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()}function tz(t){(0,s._)(this,tR)._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()}function tG(t){let e=(0,s._)(this,tR)._uiManager._signal;t.addEventListener("focusin",(0,l._)(this,tP,tj).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",(0,l._)(this,tD,tz).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",tm,{signal:e})}function tU(){let{editorType:t,_uiManager:e}=(0,s._)(this,tR),i=document.createElement("button");i.className="delete",i.tabIndex=0,i.setAttribute("data-l10n-id",(0,h._)(tO,tO,tH)[t]),(0,l._)(this,tF,tG).call(this,i),i.addEventListener("click",t=>{e.delete()},{signal:e._signal}),(0,s._)(this,tL).append(i)}function tV(){let t=document.createElement("div");return t.className="divider",t}var tq=new WeakMap,tK=new WeakMap,tX=new WeakMap,tY=new WeakSet,tQ=new WeakSet,tJ=new WeakSet;class tZ{show(t,e,i){let[a,r]=(0,l._)(this,tQ,t0).call(this,e,i),{style:o}=(0,n._)(this,tK,(0,s._)(this,tK)||(0,l._)(this,tY,t$).call(this));t.append((0,s._)(this,tK)),o.insetInlineEnd="".concat(100*a,"%"),o.top="calc(".concat(100*r,"% + var(--editor-toolbar-vert-offset))")}hide(){(0,s._)(this,tK).remove()}constructor(t){(0,o._)(this,tY),(0,o._)(this,tQ),(0,o._)(this,tJ),(0,a._)(this,tq,{writable:!0,value:void 0}),(0,a._)(this,tK,{writable:!0,value:void 0}),(0,a._)(this,tX,{writable:!0,value:void 0}),(0,n._)(this,tq,null),(0,n._)(this,tK,null),(0,n._)(this,tX,t)}}function t$(){let t=(0,n._)(this,tK,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",tm,{signal:(0,s._)(this,tX)._signal});let e=(0,n._)(this,tq,document.createElement("div"));return e.className="buttons",t.append(e),(0,l._)(this,tJ,t1).call(this),t}function t0(t,e){let i=0,s=0;for(let a of t){let t=a.y+a.height;if(t<i)continue;let n=a.x+(e?a.width:0);if(t>i){s=n,i=t;continue}e?n>s&&(s=n):n<s&&(s=n)}return[e?1-s:s,i]}function t1(){let t=document.createElement("button");t.className="highlightButton",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");let e=document.createElement("span");t.append(e),e.className="visuallyHidden",e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");let i=(0,s._)(this,tX)._signal;t.addEventListener("contextmenu",tm,{signal:i}),t.addEventListener("click",()=>{(0,s._)(this,tX).highlightSelection("floating_button")},{signal:i}),(0,s._)(this,tq).append(t)}function t2(t,e,i){for(let s of i)e.addEventListener(s,t[s].bind(t))}var t3=new WeakMap;class t5{get id(){return"".concat("pdfjs_internal_editor_").concat((0,r._)(this,t3).value++)}constructor(){(0,a._)(this,t3,{writable:!0,value:void 0}),(0,n._)(this,t3,0)}}var t6=new WeakMap,t4=new WeakMap,t8=new WeakMap,t7=new WeakSet;class t9{static get _isSVGFittingCanvas(){let t=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),e=new Image;return e.src='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',H(this,"_isSVGFittingCanvas",e.decode().then(()=>(t.drawImage(e,0,0,1,1,0,0,1,3),0===new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0])))}async getFromFile(t){let{lastModified:e,name:i,size:s,type:a}=t;return(0,l._)(this,t7,et).call(this,"".concat(e,"_").concat(i,"_").concat(s,"_").concat(a),t)}async getFromUrl(t){return(0,l._)(this,t7,et).call(this,t,t)}async getFromBlob(t,e){let i=await e;return(0,l._)(this,t7,et).call(this,t,i)}async getFromId(t){(0,n._)(this,t8,(0,s._)(this,t8)||new Map);let e=(0,s._)(this,t8).get(t);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){let{blobPromise:t}=e;return delete e.blobPromise,this.getFromBlob(e.id,t)}return this.getFromUrl(e.url)}getFromCanvas(t,e){(0,n._)(this,t8,(0,s._)(this,t8)||new Map);let i=(0,s._)(this,t8).get(t);if(null==i?void 0:i.bitmap)return i.refCounter+=1,i;let a=new OffscreenCanvas(e.width,e.height);return a.getContext("2d").drawImage(e,0,0),i={bitmap:a.transferToImageBitmap(),id:"image_".concat((0,s._)(this,t6),"_").concat((0,r._)(this,t4).value++),refCounter:1,isSvg:!1},(0,s._)(this,t8).set(t,i),(0,s._)(this,t8).set(i.id,i),i}getSvgUrl(t){let e=(0,s._)(this,t8).get(t);return(null==e?void 0:e.isSvg)?e.svgUrl:null}deleteId(t){var e;(0,n._)(this,t8,(0,s._)(this,t8)||new Map);let i=(0,s._)(this,t8).get(t);if(!i||(i.refCounter-=1,0!==i.refCounter))return;let{bitmap:a}=i;if(!i.url&&!i.file){let t=new OffscreenCanvas(a.width,a.height);t.getContext("bitmaprenderer").transferFromImageBitmap(a),i.blobPromise=t.convertToBlob()}null===(e=a.close)||void 0===e||e.call(a),i.bitmap=null}isValidId(t){return t.startsWith("image_".concat((0,s._)(this,t6),"_"))}constructor(){(0,o._)(this,t7),(0,a._)(this,t6,{writable:!0,value:void 0}),(0,a._)(this,t4,{writable:!0,value:void 0}),(0,a._)(this,t8,{writable:!0,value:void 0}),(0,n._)(this,t6,function(){var t,e;if("undefined"!=typeof crypto&&"function"==typeof(null===(t=crypto)||void 0===t?void 0:t.randomUUID))return crypto.randomUUID();let i=new Uint8Array(32);if("undefined"!=typeof crypto&&"function"==typeof(null===(e=crypto)||void 0===e?void 0:e.getRandomValues))crypto.getRandomValues(i);else for(let t=0;t<32;t++)i[t]=Math.floor(255*Math.random());return X(i)}()),(0,n._)(this,t4,0),(0,n._)(this,t8,null)}}async function et(t,e){(0,n._)(this,t8,(0,s._)(this,t8)||new Map);let i=(0,s._)(this,t8).get(t);if(null===i)return null;if(null==i?void 0:i.bitmap)return i.refCounter+=1,i;try{let t;if(i||(i={bitmap:null,id:"image_".concat((0,s._)(this,t6),"_").concat((0,r._)(this,t4).value++),refCounter:0,isSvg:!1}),"string"==typeof e?(i.url=e,t=await th(e,"blob")):e instanceof File?t=i.file=e:e instanceof Blob&&(t=e),"image/svg+xml"===t.type){let e=t9._isSVGFittingCanvas,s=new FileReader,a=new Image,n=new Promise((t,n)=>{a.onload=()=>
1{i.bitmap=a,i.isSvg=!0,t()},s.onload=async()=>{let t=i.svgUrl=s.result;a.src=await e?"".concat(t,"#svgView(preserveAspectRatio(none))"):t},a.onerror=s.onerror=n});s.readAsDataURL(t),await n}else i.bitmap=await createImageBitmap(t);i.refCounter=1}catch(t){console.error(t),i=null}return(0,s._)(this,t8).set(t,i),i&&(0,s._)(this,t8).set(i.id,i),i}var ee=new WeakMap,ei=new WeakMap,es=new WeakMap,ea=new WeakMap;class en{add(t){let{cmd:e,undo:i,post:a,mustExec:r,type:l=NaN,overwriteIfSameType:o=!1,keepUndo:h=!1}=t;if(r&&e(),(0,s._)(this,ei))return;let d={cmd:e,undo:i,post:a,type:l};if(-1===(0,s._)(this,ea)){(0,s._)(this,ee).length>0&&((0,s._)(this,ee).length=0),(0,n._)(this,ea,0),(0,s._)(this,ee).push(d);return}if(o&&(0,s._)(this,ee)[(0,s._)(this,ea)].type===l){h&&(d.undo=(0,s._)(this,ee)[(0,s._)(this,ea)].undo),(0,s._)(this,ee)[(0,s._)(this,ea)]=d;return}let c=(0,s._)(this,ea)+1;c===(0,s._)(this,es)?(0,s._)(this,ee).splice(0,1):((0,n._)(this,ea,c),c<(0,s._)(this,ee).length&&(0,s._)(this,ee).splice(c)),(0,s._)(this,ee).push(d)}undo(){if(-1===(0,s._)(this,ea))return;(0,n._)(this,ei,!0);let{undo:t,post:e}=(0,s._)(this,ee)[(0,s._)(this,ea)];t(),null==e||e(),(0,n._)(this,ei,!1),(0,n._)(this,ea,(0,s._)(this,ea)-1)}redo(){if((0,s._)(this,ea)<(0,s._)(this,ee).length-1){(0,n._)(this,ea,(0,s._)(this,ea)+1),(0,n._)(this,ei,!0);let{cmd:t,post:e}=(0,s._)(this,ee)[(0,s._)(this,ea)];t(),null==e||e(),(0,n._)(this,ei,!1)}}hasSomethingToUndo(){return -1!==(0,s._)(this,ea)}hasSomethingToRedo(){return(0,s._)(this,ea)<(0,s._)(this,ee).length-1}destroy(){(0,n._)(this,ee,null)}constructor(t=128){(0,a._)(this,ee,{writable:!0,value:void 0}),(0,a._)(this,ei,{writable:!0,value:void 0}),(0,a._)(this,es,{writable:!0,value:void 0}),(0,a._)(this,ea,{writable:!0,value:void 0}),(0,n._)(this,ee,[]),(0,n._)(this,ei,!1),(0,n._)(this,ea,-1),(0,n._)(this,es,t)}}var er=new WeakSet;class el{exec(t,e){if(!this.allKeys.has(e.key))return;let i=this.callbacks.get((0,l._)(this,er,eo).call(this,e));if(!i)return;let{callback:s,options:{bubbles:a=!1,args:n=[],checker:r=null}}=i;(!r||r(t,e))&&(s.bind(t,...n,e)(),a||(e.stopPropagation(),e.preventDefault()))}constructor(t){(0,o._)(this,er),this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;let{isMac:e}=J.platform;for(let[i,s,a={}]of t)for(let t of i){let i=t.startsWith("mac+");e&&i?(this.callbacks.set(t.slice(4),{callback:s,options:a}),this.allKeys.add(t.split("+").at(-1))):e||i||(this.callbacks.set(t,{callback:s,options:a}),this.allKeys.add(t.split("+").at(-1)))}}}function eo(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);let e=this.buffer.join("+");return this.buffer.length=0,e}class eh{get _colors(){let t=new Map([["CanvasText",null],["Canvas",null]]);return!function(t){let e=document.createElement("span");for(let i of(e.style.visibility="hidden",document.body.append(e),t.keys())){e.style.color=i;let s=window.getComputedStyle(e).color;t.set(i,tk(s))}e.remove()}(t),H(this,"_colors",t)}convert(t){let e=tk(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(let[t,i]of this._colors)if(i.every((t,i)=>t===e[i]))return eh._colorsMapping.get(t);return e}getHexCode(t){let e=this._colors.get(t);return e?$.makeHexColor(...e):t}}eh._colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);var ed=new WeakMap,ec=new WeakMap,eu=new WeakMap,e_=new WeakMap,ep=new WeakMap,ef=new WeakMap,eg=new WeakMap,ev=new WeakMap,em=new WeakMap,eb=new WeakMap,ew=new WeakMap,eA=new WeakMap,ey=new WeakMap,ek=new WeakMap,eS=new WeakMap,ex=new WeakMap,eE=new WeakMap,eM=new WeakMap,eC=new WeakMap,eT=new WeakMap,eR=new WeakMap,eL=new WeakMap,eI=new WeakMap,eP=new WeakMap,eD=new WeakMap,eF=new WeakMap,eW=new WeakMap,eN=new WeakMap,eO=new WeakMap,eH=new WeakMap,eB=new WeakMap,ej=new WeakMap,ez=new WeakMap,eG=new WeakMap,eU=new WeakMap,eV=new WeakMap,eq=new WeakMap,eK=new WeakMap,eX=new WeakMap,eY=new WeakMap,eQ=new WeakMap,eJ=new WeakSet,eZ=new WeakSet,e$=new WeakSet,e0=new WeakSet,e1=new WeakSet,e2=new WeakSet,e3=new WeakSet,e5=new WeakSet,e6=new WeakSet,e4=new WeakSet,e8=new WeakSet,e7=new WeakSet,e9=new WeakSet,it=new WeakSet,ie=new WeakSet,ii=new WeakSet,is=new WeakSet,ia=new WeakSet,ir=new WeakMap,il=new WeakSet,io=new WeakSet;class ih{static get _keyboardManager(){let t=ih.prototype,e=t=>(0,s._)(t,eX).contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&t.hasSomethingToControl(),i=(t,e)=>{let{target:i}=e;if(i instanceof HTMLInputElement){let{type:t}=i;return"text"!==t&&"number"!==t}return!0},a=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return H(this,"_keyboardManager",new el([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:i}],[["ctrl+z","mac+meta+z"],t.undo,{checker:i}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:i}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:i}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(t,e)=>{let{target:i}=e;return!(i instanceof HTMLButtonElement)&&(0,s._)(t,eX).contains(i)&&!t.isEnterHandled}}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(t,e)=>{let{target:i}=e;return!(i instanceof HTMLButtonElement)&&(0,s._)(t,eX).contains(document.activeElement)}}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-a,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-n,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[a,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[n,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-a],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-n],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,a],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,n],checker:e}]]))}destroy(){var t,e,i,a;for(let i of(null===(t=(0,s._)(this,eQ))||void 0===t||t.resolve(),(0,n._)(this,eQ,null),null===(e=(0,s._)(this,ed))||void 0===e||e.abort(),(0,n._)(this,ed,null),this._signal=null,(0,s._)(this,e_).values())
1)i.destroy();(0,s._)(this,e_).clear(),(0,s._)(this,eu).clear(),(0,s._)(this,ek).clear(),(0,n._)(this,ec,null),(0,s._)(this,ej).clear(),(0,s._)(this,ev).destroy(),null===(i=(0,s._)(this,ep))||void 0===i||i.destroy(),null===(a=(0,s._)(this,eI))||void 0===a||a.hide(),(0,n._)(this,eI,null),(0,s._)(this,eC)&&(clearTimeout((0,s._)(this,eC)),(0,n._)(this,eC,null)),(0,s._)(this,eK)&&(clearTimeout((0,s._)(this,eK)),(0,n._)(this,eK,null))}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return(0,s._)(this,eH)}get useNewAltTextFlow(){return(0,s._)(this,ex)}get useNewAltTextWhenAddingImage(){return(0,s._)(this,eE)}get hcmFilter(){return H(this,"hcmFilter",(0,s._)(this,eG)?(0,s._)(this,eM).addHCMFilter((0,s._)(this,eG).foreground,(0,s._)(this,eG).background):"none")}get direction(){return H(this,"direction",getComputedStyle((0,s._)(this,eX)).direction)}get highlightColors(){return H(this,"highlightColors",(0,s._)(this,eR)?new Map((0,s._)(this,eR).split(",").map(t=>t.split("=").map(t=>t.trim()))):null)}get highlightColorNames(){return H(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}setMainHighlightColorPicker(t){(0,n._)(this,eO,t)}editAltText(t){var e;let i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];null===(e=(0,s._)(this,ep))||void 0===e||e.editAltText(this,t,i)}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:t})}setPreference(t,e){this._eventBus.dispatch("setpreference",{source:this,name:t,value:e})}onSetPreference(t){let{name:e,value:i}=t;"enableNewAltTextWhenAddingImage"===e&&(0,n._)(this,eE,i)}onPageChanging(t){let{pageNumber:e}=t;(0,n._)(this,eb,e-1)}focusMainContainer(){(0,s._)(this,eX).focus()}findParent(t,e){for(let i of(0,s._)(this,e_).values()){let{x:s,y:a,width:n,height:r}=i.div.getBoundingClientRect();if(t>=s&&t<=s+n&&e>=a&&e<=a+r)return i}return null}disableUserSelect(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,s._)(this,eY).classList.toggle("noUserSelect",t)}addShouldRescale(t){(0,s._)(this,ek).add(t)}removeShouldRescale(t){(0,s._)(this,ek).delete(t)}onScaleChanging(t){let{scale:e}=t;for(let t of(this.commitOrRemove(),this.viewParameters.realScale=e*to.PDF_TO_CSS_UNITS,(0,s._)(this,ek)))t.onScaleChanging()}onRotationChanging(t){let{pagesRotation:e}=t;this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=document.getSelection();if(!e||e.isCollapsed)return;let{anchorNode:i,anchorOffset:a,focusNode:n,focusOffset:r}=e,o=e.toString(),h=(0,l._)(this,eJ,id).call(this,e).closest(".textLayer"),d=this.getSelectionBoxes(h);if(!d)return;e.empty();let c=(0,l._)(this,eZ,ic).call(this,h),u=(0,s._)(this,eB)===k.NONE,_=()=>{null==c||c.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:d,anchorNode:i,anchorOffset:a,focusNode:n,focusOffset:r,text:o}),u&&this.showAllEditors("highlight",!0,!0)};if(u){this.switchToMode(k.HIGHLIGHT,_);return}_()}addToAnnotationStorage(t){!t.isEmpty()&&(0,s._)(this,ef)&&!(0,s._)(this,ef).has(t.id)&&(0,s._)(this,ef).setValue(t.id,t)}blur(){if(this.isShiftKeyDown=!1,(0,s._)(this,eL)&&((0,n._)(this,eL,!1),(0,l._)(this,e1,ip).call(this,"main_toolbar")),!this.hasSelection)return;let{activeElement:t}=document;for(let e of(0,s._)(this,ej))if(e.div.contains(t)){(0,n._)(this,eN,[e,t]),e._focusEventsAllowed=!1;break}}focus(){if(!(0,s._)(this,eN))return;let[t,e]=(0,s._)(this,eN);(0,n._)(this,eN,null),e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}addEditListeners(){(0,l._)(this,e6,ib).call(this),(0,l._)(this,e8,iA).call(this)}removeEditListeners(){(0,l._)(this,e4,iw).call(this),(0,l._)(this,e7,iy).call(this)}dragOver(t){for(let{type:e}of t.dataTransfer.items)for(let i of(0,s._)(this,ey))if(i.isHandlingMimeForPasting(e)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(let e of t.dataTransfer.items)for(let i of(0,s._)(this,ey))if(i.isHandlingMimeForPasting(e.type)){i.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){var e;if(t.preventDefault(),null===(e=(0,s._)(this,ec))||void 0===e||e.commitOrRemove(),!this.hasSelection)return;let i=[];for(let t of(0,s._)(this,ej)){let e=t.serialize(!0);e&&i.push(e)}0!==i.length&&t.clipboardData.setData("application/pdfjs",JSON.stringify(i))}cut(t){this.copy(t),this.delete()}async paste(t){t.preventDefault();let{clipboardData:e}=t;for(let t of e.items)for(let e of(0,s._)(this,ey))if(e.isHandlingMimeForPasting(t.type)){e.paste(t,this.currentLayer);return}let i=e.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(t){F('paste: "'.concat(t.message,'".'));return}if(!Array.isArray(i))return;this.unselectAll();let a=this.currentLayer;try{let t=[];for(let e of i){let i=await a.deserialize(e);if(!i)return;t.push(i)}this.addCommands({cmd:()=>{for(let e of t)(0,l._)(this,ia,iC).call(this,e);(0,l._)(this,io,iL).call(this,t)},undo:()=>{for(let e of t)e.remove()},mustExec:!0})}catch(t){F('paste: "'.concat(t.message,'".'))}}keydown(t){this.isShiftKeyDown||"Shift"!==t.key||(this.isShiftKeyDown=!0),(0,s._)(this,eB)===k.NONE||this.isEditorHandlingKeyboard||ih._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&"Shift"===t.key&&(this.isShiftKeyDown=!1,(0,s._)(this,eL)&&((0,n._)(this,eL,!1),(0,l._)(this,e1,ip).call(this,"main_toolbar")))}onEditingAction(t){let{name:e}=t;switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu")}}setEditingState(t){t?((0,l._)(this,e3,iv).call(this),(0,l._)(this,e8,iA).call(this),(0,l._)(this,it,iS).call(this,{isEditing:(0,s._)(this,eB)!==k.NONE,isEmpty:(0,l._)(this,il,iR).c
1all(this),hasSomethingToUndo:(0,s._)(this,ev).hasSomethingToUndo(),hasSomethingToRedo:(0,s._)(this,ev).hasSomethingToRedo(),hasSelectedEditor:!1})):((0,l._)(this,e5,im).call(this),(0,l._)(this,e7,iy).call(this),(0,l._)(this,it,iS).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!(0,s._)(this,ey))for(let e of((0,n._)(this,ey,t),(0,s._)(this,ey)))(0,l._)(this,ie,ix).call(this,e.defaultPropertiesToUpdate)}getId(){return(0,s._)(this,eP).id}get currentLayer(){return(0,s._)(this,e_).get((0,s._)(this,eb))}getLayer(t){return(0,s._)(this,e_).get(t)}get currentPageIndex(){return(0,s._)(this,eb)}addLayer(t){(0,s._)(this,e_).set(t.pageIndex,t),(0,s._)(this,eD)?t.enable():t.disable()}removeLayer(t){(0,s._)(this,e_).delete(t.pageIndex)}async updateMode(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!((0,s._)(this,eB)===t||(0,s._)(this,eQ)&&(await (0,s._)(this,eQ).promise,!(0,s._)(this,eQ)))){if((0,n._)(this,eQ,Promise.withResolvers()),(0,n._)(this,eB,t),t===k.NONE){this.setEditingState(!1),(0,l._)(this,is,iM).call(this),(0,s._)(this,eQ).resolve();return}for(let e of(this.setEditingState(!0),await (0,l._)(this,ii,iE).call(this),this.unselectAll(),(0,s._)(this,e_).values()))e.updateMode(t);if(!e){i&&this.addNewEditorFromKeyboard(),(0,s._)(this,eQ).resolve();return}for(let t of(0,s._)(this,eu).values())t.annotationElementId===e?(this.setSelected(t),t.enterInEditMode()):t.unselect();(0,s._)(this,eQ).resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t!==(0,s._)(this,eB)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:t})}updateParams(t,e){if((0,s._)(this,ey)){switch(t){case S.CREATE:this.currentLayer.addNewEditor();return;case S.HIGHLIGHT_DEFAULT_COLOR:var i;null===(i=(0,s._)(this,eO))||void 0===i||i.updateColor(e);break;case S.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(0,n._)(this,eU,(0,s._)(this,eU)||new Map).set(t,e),this.showAllEditors("highlight",e)}for(let i of(0,s._)(this,ej))i.updateParams(t,e);for(let i of(0,s._)(this,ey))i.updateDefaultParams(t,e)}}showAllEditors(t,e){var i,a;for(let i of(arguments.length>2&&void 0!==arguments[2]&&arguments[2],(0,s._)(this,eu).values()))i.editorType===t&&i.show(e);(null===(a=null===(i=(0,s._)(this,eU))||void 0===i?void 0:i.get(S.HIGHLIGHT_SHOW_ALL))||void 0===a||a)!==e&&(0,l._)(this,ie,ix).call(this,[[S.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if((0,s._)(this,eF)!==t)for(let e of((0,n._)(this,eF,t),(0,s._)(this,e_).values()))t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}getEditors(t){let e=[];for(let i of(0,s._)(this,eu).values())i.pageIndex===t&&e.push(i);return e}getEditor(t){return(0,s._)(this,eu).get(t)}addEditor(t){(0,s._)(this,eu).set(t.id,t)}removeEditor(t){if(t.div.contains(document.activeElement)&&((0,s._)(this,eC)&&clearTimeout((0,s._)(this,eC)),(0,n._)(this,eC,setTimeout(()=>{this.focusMainContainer(),(0,n._)(this,eC,null)},0))),(0,s._)(this,eu).delete(t.id),this.unselect(t),!t.annotationElementId||!(0,s._)(this,ew).has(t.annotationElementId)){var e;null===(e=(0,s._)(this,ef))||void 0===e||e.remove(t.id)}}addDeletedAnnotationElement(t){(0,s._)(this,ew).add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}isDeletedAnnotationElement(t){return(0,s._)(this,ew).has(t)}removeDeletedAnnotationElement(t){(0,s._)(this,ew).delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}setActiveEditor(t){(0,s._)(this,ec)!==t&&((0,n._)(this,ec,t),t&&(0,l._)(this,ie,ix).call(this,t.propertiesToUpdate))}updateUI(t){(0,s._)(this,ir)===t&&(0,l._)(this,ie,ix).call(this,t.propertiesToUpdate)}toggleSelected(t){if((0,s._)(this,ej).has(t)){(0,s._)(this,ej).delete(t),t.unselect(),(0,l._)(this,it,iS).call(this,{hasSelectedEditor:this.hasSelection});return}(0,s._)(this,ej).add(t),t.select(),(0,l._)(this,ie,ix).call(this,t.propertiesToUpdate),(0,l._)(this,it,iS).call(this,{hasSelectedEditor:!0})}setSelected(t){for(let e of(0,s._)(this,ej))e!==t&&e.unselect();(0,s._)(this,ej).clear(),(0,s._)(this,ej).add(t),t.select(),(0,l._)(this,ie,ix).call(this,t.propertiesToUpdate),(0,l._)(this,it,iS).call(this,{hasSelectedEditor:!0})}isSelected(t){return(0,s._)(this,ej).has(t)}get firstSelectedEditor(){return(0,s._)(this,ej).values().next().value}unselect(t){t.unselect(),(0,s._)(this,ej).delete(t),(0,l._)(this,it,iS).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==(0,s._)(this,ej).size}get isEnterHandled(){return 1===(0,s._)(this,ej).size&&this.firstSelectedEditor.isEnterHandled}undo(){(0,s._)(this,ev).undo(),(0,l._)(this,it,iS).call(this,{hasSomethingToUndo:(0,s._)(this,ev).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:(0,l._)(this,il,iR).c
1all(this)})}redo(){(0,s._)(this,ev).redo(),(0,l._)(this,it,iS).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:(0,s._)(this,ev).hasSomethingToRedo(),isEmpty:(0,l._)(this,il,iR).call(this)})}addCommands(t){(0,s._)(this,ev).add(t),(0,l._)(this,it,iS).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:(0,l._)(this,il,iR).call(this)})}delete(){if(this.commitOrRemove(),!this.hasSelection)return;let t=[...(0,s._)(this,ej)];this.addCommands({cmd:()=>{for(let e of t)e.remove()},undo:()=>{for(let e of t)(0,l._)(this,ia,iC).call(this,e)},mustExec:!0})}commitOrRemove(){var t;null===(t=(0,s._)(this,ec))||void 0===t||t.commitOrRemove()}hasSomethingToControl(){return(0,s._)(this,ec)||this.hasSelection}selectAll(){for(let t of(0,s._)(this,ej))t.commit();(0,l._)(this,io,iL).call(this,(0,s._)(this,eu).values())}unselectAll(){if((!(0,s._)(this,ec)||((0,s._)(this,ec).commitOrRemove(),(0,s._)(this,eB)===k.NONE))&&this.hasSelection){for(let t of(0,s._)(this,ej))t.unselect();(0,s._)(this,ej).clear(),(0,l._)(this,it,iS).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(i||this.commitOrRemove(),!this.hasSelection)return;(0,s._)(this,eq)[0]+=t,(0,s._)(this,eq)[1]+=e;let[a,r]=(0,s._)(this,eq),l=[...(0,s._)(this,ej)];for(let i of((0,s._)(this,eK)&&clearTimeout((0,s._)(this,eK)),(0,n._)(this,eK,setTimeout(()=>{(0,n._)(this,eK,null),(0,s._)(this,eq)[0]=(0,s._)(this,eq)[1]=0,this.addCommands({cmd:()=>{for(let t of l)(0,s._)(this,eu).has(t.id)&&t.translateInPage(a,r)},undo:()=>{for(let t of l)(0,s._)(this,eu).has(t.id)&&t.translateInPage(-a,-r)},mustExec:!1})},1e3)),l))i.translateInPage(t,e)}setUpDragSession(){if(this.hasSelection)for(let t of(this.disableUserSelect(!0),(0,n._)(this,eA,new Map),(0,s._)(this,ej)))(0,s._)(this,eA).set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}endDragSession(){if(!(0,s._)(this,eA))return!1;this.disableUserSelect(!1);let t=(0,s._)(this,eA);(0,n._)(this,eA,null);let e=!1;for(let[{x:i,y:s,pageIndex:a},n]of t)n.newX=i,n.newY=s,n.newPageIndex=a,e||(e=i!==n.savedX||s!==n.savedY||a!==n.savedPageIndex);if(!e)return!1;let i=(t,e,i,a)=>{if((0,s._)(this,eu).has(t.id)){let n=(0,s._)(this,e_).get(a);n?t._setParentAndPosition(n,e,i):(t.pageIndex=a,t.x=e,t.y=i)}};return this.addCommands({cmd:()=>{for(let[e,{newX:s,newY:a,newPageIndex:n}]of t)i(e,s,a,n)},undo:()=>{for(let[e,{savedX:s,savedY:a,savedPageIndex:n}]of t)i(e,s,a,n)},mustExec:!0}),!0}dragSelectedEditors(t,e){if((0,s._)(this,eA))for(let i of(0,s._)(this,eA).keys())i.drag(t,e)}rebuild(t){if(null===t.parent){let e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){var t;return(null===(t=this.getActive())||void 0===t?void 0:t.shouldGetKeyboardEvents())||1===(0,s._)(this,ej).size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return(0,s._)(this,ec)===t}getActive(){return(0,s._)(this,ec)}getMode(){return(0,s._)(this,eB)}get imageManager(){return H(this,"imageManager",new t9)}getSelectionBoxes(t){let e;if(!t)return null;let i=document.getSelection();for(let e=0,s=i.rangeCount;e<s;e++)if(!t.contains(i.getRangeAt(e).commonAncestorContainer))return null;let{x:s,y:a,width:n,height:r}=t.getBoundingClientRect();switch(t.getAttribute("data-main-rotation")){case"90":e=(t,e,i,l)=>({x:(e-a)/r,y:1-(t+i-s)/n,width:l/r,height:i/n});break;case"180":e=(t,e,i,l)=>({x:1-(t+i-s)/n,y:1-(e+l-a)/r,width:i/n,height:l/r});break;case"270":e=(t,e,i,l)=>({x:1-(e+l-a)/r,y:(t-s)/n,width:l/r,height:i/n});break;default:e=(t,e,i,l)=>({x:(t-s)/n,y:(e-a)/r,width:i/n,height:l/r})}let l=[];for(let t=0,s=i.rangeCount;t<s;t++){let s=i.getRangeAt(t);if(!s.collapsed)for(let{x:t,y:i,width:a,height:n}of s.getClientRects())0!==a&&0!==n&&l.push(e(t,i,a,n))}return 0===l.length?null:l}addChangedExistingAnnotation(t){let{annotationElementId:e,id:i}=t;(0,n._)(this,eg,(0,s._)(this,eg)||new Map).set(e,i)}removeChangedExistingAnnotation(t){var e;let{annotationElementId:i}=t;null===(e=(0,s._)(this,eg))||void 0===e||e.delete(i)}renderAnnotationElement(t){var e;let i=null===(e=(0,s._)(this,eg))||void 0===e?void 0:e.get(t.data.id);if(!i)return;let a=(0,s._)(this,ef).getRawValue(i);a&&((0,s._)(this,eB)!==k.NONE||a.hasBeenModified)&&a.renderAnnotationElement(t)}constructor(t,e,i,r,h,d,c,u,_,p,f){(0,o._)(this,eJ),(0,o._)(this,eZ),(0,o._)(this,e$),(0,o._)(this,e0),(0,o._)(this,e1),(0,o._)(this,e2),(0,o._)(this,e3),(0,o._)(this,e5),(0,o._)(this,e6),(0,o._)(this,e4),(0,o._)(this,e8),(0,o._)(this,e7),(0,o._)(this,e9),(0,o._)(this,it),(0,o._)(this,ie),(0,o._)(this,ii),(0,o._)(this,is),(0,o._)(this,ia),(0,a._)(this,ir,{get:iT,set:void 0}),(0,o._)(this,il),(0,o._)(this,io),(0,a._)(this,ed,{writable:!0,value:void 0}),(0,a._)(this,ec,{writable:!0,value:void 0}),(0,a._)(this,eu,{writable:!0,value:void 0}),(0,a._)(this,e_,{writable:!0,value:void 0}),(0,a._)(this,ep,{writable:!0,value:void 0}),(0,a._)(this,ef,{writable:!0,value:void 0}),(0,a._)(this,eg,{writable:!0,value:void 0}),(0,a._)(this,ev,{writable:!0,value:void 0}),(0,a._)(this,em,{writable:!0,value:void 0}),(0,a._)(this,eb,{writable:!0,value:void 0}),(0,a._)(this,ew,{writable:!0,value:void 0}),(0,a._)(this,eA,{writable:!0,value:void 0}),(0,a._)(this,ey,{writable:!0,value:void 0}),(0,a._)(this,ek,{writable:!0,value:void 0}),(0,a._)(this,eS,{writable:!0,value:void 0}),(0,a._)(this,ex,{writable:!0,value:void 0}),(0,a._)(this,eE,{writable:!0,value:void 0}),(0,a._)(this,eM,{writable:!0,value:void 0}),(0,a._)(this,eC,{writable:!0,value:void 0}),(0,a._)(this,eT,{writable:!0,value:void 0}),(0,a._)(this,eR,{writable:!0,value:void 0}),(0,a._)(this,eL,{writable:!0,value:void 0}),(0,a._)(this,eI,{writable:!0,value:void 0}),(0,a._)(this,eP,{writable:!0,value:void 0}),(0,a._)(this,eD,{writable:!0,value:void 0}),(0,a._)(this,eF,{writable:!0,value:void 0}),(0,a._)(this,eW,{writable:!0,value:void 0}),(0,a._)(this,eN,{writable:!0,value:void 0}),(0,a._)(this,eO,{writable:!0,value:void 0}),(0,a._)(this,eH,{writable:!0,value:void 0}),(0,a._)(this,eB,{writable:!0,value:void 0}),(0,a._)(this,ej,{writable:!0,value:void 0}),(0,a._)(this,ez,{writable:!0,value:void 0}),(0,a._)(this,eG,{writable:!0,value:void 0}),(0,a._)(this,eU,{writable:!0,value:void 0}),(0,a._)(this,eV,{writable:!0,value:void 0}),(0,a._)(this,eq,{writable:!0,value:void 0}),(0,a._)(this,eK,{writable:!0,value:void 0}),(0,a._)(this,eX,{writable:!0,value:void 0}),(0,a._)(this,eY,{writable:!0,value:void 0}),(0,a._)(this,eQ,{writable:!0,value:void 0}),(0,n._)(this,ed,new AbortController),(0,n._)(this,ec,null),(0,n._)(this,eu,new Map),(0,n._)(this,e_,new Map),(0,n._)(this,ep,null),(0,n._)(this,ef,null),(0,n._)(this,eg,null),(0,n._)(this,ev,new en),(0,n._)(this,em,null),(0,n._)(this,eb,0),(0,n._)(this,ew,new Set),(0,n._)(this,eA,null),(0,n._)(this,ey,null),(0,n._)(this,ek,new Set),(0,n._)(this,eS,!1),(0,n._)(this,ex,!1),(0,n._)(this,eE,!1),(0,n._)(this,eM,null),(0,n._)(this,eC,null),(0,n._)(this,eT,null),(0,n._)(this,eR,null),(0,n._)(this,eL,!1),(0,n._)(this,eI,null),(0,n._)(this,eP,new t5),(0,n._)(this,eD,!1),(0,n._)(this,eF,!1),(0,n._)(this,eW,null),(0,n._)(this,eN,null),(0,n._)(this,eO,null),(0,n._)(this,eH,null),(0,n._)(this,eB,k.NONE),(0,n._)(this,ej,new Set),(0,n._)(this,ez,null),(0,n._)(this,eG,null),(0,n._)(this,eU,null),(0,n._)(this,eV,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1}),(0,n._)(this,eq,[0,0]),(0,n._)(this,eK,null),(0,n._)(this,eX,null),(0,n._)(this,eY,null),(0,n._)(this,eQ,null);let g=this._signal=(0,s._)(this,ed).signal;(0,n._)(this,eX,t),(0,n._)(this,eY,e),(0,n._)(this,ep,i),this._eventBus=r,r._on("editingaction",this.onEditingAction.bind(this),{signal:g}),r._on("pagechanging",this.onPageChanging.bind(this),{signal:g}),r._on("scalechanging",this.onScaleChanging.bind(this),{signal:g}),r._on("rotationchanging",this.onRotationChanging.bind(this),{signal:g}),r._on("setpreference",this.onSetPreference.bind(this),{signal:g}),r._on("switchannotationeditorparams",t=>this.updateParams(t.type,t.value),{signal:g}),(0,l._)(this,e2,ig).call(this),(0,l._)(this,e9,ik).call(this),(0,l._)(this,e6,ib).call(this),(0,n._)(this,ef,h.annotationStorage),(0,n._)(this,eM,h.filterFactory),(0,n._)(this,eG,d),(0,n._)(this,eR,c||null),(0,n._)(this,eS,u),(0,n._)(this,ex,_),(0,n._)(this,eE,p),(0,n._)(this,eH,f||null),this.viewParameters={realScale:to.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}}function id(t){let{anchorNode:e}=t;
1return e.nodeType===Node.TEXT_NODE?e.parentElement:e}function ic(t){let{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(let e of(0,s._)(this,e_).values())if(e.hasTextLayer(t))return e;return null}function iu(){let t=document.getSelection();if(!t||t.isCollapsed)return;let e=(0,l._)(this,eJ,id).call(this,t).closest(".textLayer"),i=this.getSelectionBoxes(e);i&&((0,n._)(this,eI,(0,s._)(this,eI)||new tZ(this)),(0,s._)(this,eI).show(e,i,"ltr"===this.direction))}function i_(){var t,e,i;let a=document.getSelection();if(!a||a.isCollapsed){(0,s._)(this,ez)&&(null===(e=(0,s._)(this,eI))||void 0===e||e.hide(),(0,n._)(this,ez,null),(0,l._)(this,it,iS).call(this,{hasSelectedText:!1}));return}let{anchorNode:r}=a;if(r===(0,s._)(this,ez))return;let o=(0,l._)(this,eJ,id).call(this,a).closest(".textLayer");if(!o){(0,s._)(this,ez)&&(null===(i=(0,s._)(this,eI))||void 0===i||i.hide(),(0,n._)(this,ez,null),(0,l._)(this,it,iS).call(this,{hasSelectedText:!1}));return}if(null===(t=(0,s._)(this,eI))||void 0===t||t.hide(),(0,n._)(this,ez,r),(0,l._)(this,it,iS).call(this,{hasSelectedText:!0}),((0,s._)(this,eB)===k.HIGHLIGHT||(0,s._)(this,eB)===k.NONE)&&((0,s._)(this,eB)===k.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),(0,n._)(this,eL,this.isShiftKeyDown),!this.isShiftKeyDown)){let t=(0,s._)(this,eB)===k.HIGHLIGHT?(0,l._)(this,eZ,ic).call(this,o):null;null==t||t.toggleDrawing();let e=new AbortController,i=this.combinedSignal(e),a=i=>{("pointerup"!==i.type||0===i.button)&&(e.abort(),null==t||t.toggleDrawing(!0),"pointerup"===i.type&&(0,l._)(this,e1,ip).call(this,"main_toolbar"))};window.addEventListener("pointerup",a,{signal:i}),window.addEventListener("blur",a,{signal:i})}}function ip(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";(0,s._)(this,eB)===k.HIGHLIGHT?this.highlightSelection(t):(0,s._)(this,eS)&&(0,l._)(this,e$,iu).call(this)}function ig(){document.addEventListener("selectionchange",(0,l._)(this,e0,i_).bind(this),{signal:this._signal})}function iv(){if((0,s._)(this,eT))return;(0,n._)(this,eT,new AbortController);let t=this.combinedSignal((0,s._)(this,eT));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})}function im(){var t;null===(t=(0,s._)(this,eT))||void 0===t||t.abort(),(0,n._)(this,eT,null)}function ib(){if((0,s._)(this,eW))return;(0,n._)(this,eW,new AbortController);let t=this.combinedSignal((0,s._)(this,eW));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})}function iw(){var t;null===(t=(0,s._)(this,eW))||void 0===t||t.abort(),(0,n._)(this,eW,null)}function iA(){if((0,s._)(this,em))return;(0,n._)(this,em,new AbortController);let t=this.combinedSignal((0,s._)(this,em));document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})}function iy(){var t;null===(t=(0,s._)(this,em))||void 0===t||t.abort(),(0,n._)(this,em,null)}function ik(){let t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})}function iS(t){Object.entries(t).some(t=>{let[e,i]=t;return(0,s._)(this,eV)[e]!==i})&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign((0,s._)(this,eV),t)}),(0,s._)(this,eB)===k.HIGHLIGHT&&!1===t.hasSelectedEditor&&(0,l._)(this,ie,ix).call(this,[[S.HIGHLIGHT_FREE,!0]]))}function ix(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}async function iE(){if(!(0,s._)(this,eD)){(0,n._)(this,eD,!0);let t=[];for(let e of(0,s._)(this,e_).values())t.push(e.enable());for(let e of(await Promise.all(t),(0,s._)(this,eu).values()))e.enable()}}function iM(){if(this.unselectAll(),(0,s._)(this,eD)){for(let t of((0,n._)(this,eD,!1),(0,s._)(this,e_).values()))t.disable();for(let t of(0,s._)(this,eu).values())t.disable()}}function iC(t){let e=(0,s._)(this,e_).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}function iT(){let t=null;for(t of(0,s._)(this,ej));return t}function iR(){if(0===(0,s._)(this,eu).size)return!0;
1if(1===(0,s._)(this,eu).size)for(let t of(0,s._)(this,eu).values())return t.isEmpty();return!1}function iL(t){for(let t of(0,s._)(this,ej))t.unselect();for(let e of((0,s._)(this,ej).clear(),t))!e.isEmpty()&&((0,s._)(this,ej).add(e),e.select());(0,l._)(this,it,iS).call(this,{hasSelectedEditor:this.hasSelection})}ih.TRANSLATE_SMALL=1,ih.TRANSLATE_BIG=10;var iI=new WeakMap,iP=new WeakMap,iD=new WeakMap,iF=new WeakMap,iW=new WeakMap,iN=new WeakMap,iO=new WeakMap,iH=new WeakMap,iB=new WeakMap,ij=new WeakMap,iz=new WeakMap,iG=new WeakMap,iU=new WeakMap,iV=new WeakSet;class iq{static initialize(t){var e;null!==(e=iq._l10n)&&void 0!==e||(iq._l10n=t)}async render(){let t=(0,n._)(this,iD,document.createElement("button"));t.className="altText",t.tabIndex="0";let e=(0,n._)(this,iF,document.createElement("span"));t.append(e),(0,s._)(this,iG)?(t.classList.add("new"),t.setAttribute("data-l10n-id",(0,h._)(iq,iq,iK).missing),e.setAttribute("data-l10n-id",(0,h._)(iq,iq,iK)["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));let i=(0,s._)(this,iB)._uiManager._signal;t.addEventListener("contextmenu",tm,{signal:i}),t.addEventListener("pointerdown",t=>t.stopPropagation(),{signal:i});let a=t=>{t.preventDefault(),(0,s._)(this,iB)._uiManager.editAltText((0,s._)(this,iB)),(0,s._)(this,iG)&&(0,s._)(this,iB)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:(0,s._)(this,iU)}})};return t.addEventListener("click",a,{capture:!0,signal:i}),t.addEventListener("keydown",e=>{e.target===t&&"Enter"===e.key&&((0,n._)(this,iO,!0),a(e))},{signal:i}),await (0,l._)(this,iV,iY).call(this),t}
1finish(){(0,s._)(this,iD)&&((0,s._)(this,iD).focus({focusVisible:(0,s._)(this,iO)}),(0,n._)(this,iO,!1))}isEmpty(){return(0,s._)(this,iG)?null===(0,s._)(this,iI):!(0,s._)(this,iI)&&!(0,s._)(this,iP)}hasData(){return(0,s._)(this,iG)?null!==(0,s._)(this,iI)||!!(0,s._)(this,ij):this.isEmpty()}get guessedText(){return(0,s._)(this,ij)}async setGuessedText(t){null===(0,s._)(this,iI)&&((0,n._)(this,ij,t),(0,n._)(this,iz,await iq._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t})),(0,l._)(this,iV,iY).call(this))}toggleAltTextBadge(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!(0,s._)(this,iG)||(0,s._)(this,iI)){var e;null===(e=(0,s._)(this,iH))||void 0===e||e.remove(),(0,n._)(this,iH,null);return}if(!(0,s._)(this,iH)){let t=(0,n._)(this,iH,document.createElement("div"));t.className="noAltTextBadge",(0,s._)(this,iB).div.append(t)}(0,s._)(this,iH).classList.toggle("hidden",!t)}serialize(t){let e=(0,s._)(this,iI);return t||(0,s._)(this,ij)!==e||(e=(0,s._)(this,iz)),{altText:e,decorative:(0,s._)(this,iP),guessedText:(0,s._)(this,ij),textWithDisclaimer:(0,s._)(this,iz)}}get data(){return{altText:(0,s._)(this,iI),decorative:(0,s._)(this,iP)}}set data(t){let{altText:e,decorative:i,guessedText:a,textWithDisclaimer:r,cancel:o=!1}=t;a&&((0,n._)(this,ij,a),(0,n._)(this,iz,r)),((0,s._)(this,iI)!==e||(0,s._)(this,iP)!==i)&&(o||((0,n._)(this,iI,e),(0,n._)(this,iP,i)),(0,l._)(this,iV,iY).call(this))}toggle(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];
1(0,s._)(this,iD)&&(!t&&(0,s._)(this,iN)&&(clearTimeout((0,s._)(this,iN)),(0,n._)(this,iN,null)),(0,s._)(this,iD).disabled=!t)}shown(){(0,s._)(this,iB)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:(0,s._)(this,iU)}})}destroy(){var t,e;null===(t=(0,s._)(this,iD))||void 0===t||t.remove(),(0,n._)(this,iD,null),(0,n._)(this,iF,null),(0,n._)(this,iW,null),null===(e=(0,s._)(this,iH))||void 0===e||e.remove(),(0,n._)(this,iH,null)}constructor(t){(0,a._)(this,iU,{get:iX,set:void 0}),(0,o._)(this,iV),(0,a._)(this,iI,{writable:!0,value:void 0}),(0,a._)(this,iP,{writable:!0,value:void 0}),(0,a._)(this,iD,{writable:!0,value:void 0}),(0,a._)(this,iF,{writable:!0,value:void 0}),(0,a._)(this,iW,{writable:!0,value:void 0}),(0,a._)(this,iN,{writable:!0,value:void 0}),(0,a._)(this,iO,{writable:!0,value:void 0}),(0,a._)(this,iH,{writable:!0,value:void 0}),(0,a._)(this,iB,{writable:!0,value:void 0}),(0,a._)(this,ij,{writable:!0,value:void 0}),(0,a._)(this,iz,{writable:!0,value:void 0}),(0,a._)(this,iG,{writable:!0,value:void 0}),(0,n._)(this,iI,null),(0,n._)(this,iP,!1),(0,n._)(this,iD,null),(0,n._)(this,iF,null),(0,n._)(this,iW,null),(0,n._)(this,iN,null),(0,n._)(this,iO,!1),(0,n._)(this,iH,null),(0,n._)(this,iB,null),(0,n._)(this,ij,null),(0,n._)(this,iz,null),(0,n._)(this,iG,!1),(0,n._)(this,iB,t),(0,n._)(this,iG,t._uiManager.useNewAltTextFlow),(0,d._)(iq,iq,iK,(0,h._)(iq,iq,iK)||Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"}))}}var iK={writable:!0,value:null};function iX(){return(0,s._)(this,iI)&&"added"||null===(0,s._)(this,iI)&&this.guessedText&&"review"||"missing"}async function iY(){var t,e,i;let a=(0,s._)(this,iD);if(!a)return;if((0,s._)(this,iG)){if(a.classList.toggle("done",!!(0,s._)(this,iI)),a.setAttribute("data-l10n-id",(0,h._)(iq,iq,iK)[(0,s._)(this,iU)]),null===(t=(0,s._)(this,iF))||void 0===t||t.setAttribute("data-l10n-id",(0,h._)(iq,iq,iK)["".concat((0,s._)(this,iU),"-label")]),!(0,s._)(this,iI)){null===(e=(0,s._)(this,iW))||void 0===e||e.remove();return}}else{if(!(0,s._)(this,iI)&&!(0,s._)(this,iP)){a.classList.remove("done"),null===(i=(0,s._)(this,iW))||void 0===i||i.remove();return}a.classList.add("done"),a.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let r=(0,s._)(this,iW);if(!r){(0,n._)(this,iW,r=document.createElement("span")),r.className="tooltip",r.setAttribute("role","tooltip"),r.id="alt-text-tooltip-".concat((0,s._)(this,iB).id);let t=(0,s._)(this,iB)._uiManager._signal;t.addEventListener("abort",()=>{clearTimeout((0,s._)(this,iN)),(0,n._)(this,iN,null)},{once:!0}),a.addEventListener("mouseenter",()=>{(0,n._)(this,iN,setTimeout(()=>{(0,n._)(this,iN,null),(0,s._)(this,iW).classList.add("show"),(0,s._)(this,iB)._reportTelemetry({action:"alt_text_tooltip"})},100))},{signal:t}),a.addEventListener("mouseleave",()=>{var t;(0,s._)(this,iN)&&(clearTimeout((0,s._)(this,iN)),(0,n._)(this,iN,null)),null===(t=(0,s._)(this,iW))||void 0===t||t.classList.remove("show")},{signal:t})}(0,s._)(this,iP)?r.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(r.removeAttribute("data-l10n-id"),r.textContent=(0,s._)(this,iI)),r.parentNode||a.append(r);let l=(0,s._)(this,iB).getImageForAltText();null==l||l.setAttribute("aria-describedby",r.id)}iq._l10n=null;var iQ=new WeakMap,iJ=new WeakMap,iZ=new WeakMap,i$=new WeakMap,i0=new WeakMap,i1=new WeakMap,i2=new WeakMap,i3=new WeakMap,i5=new WeakMap,i6=new WeakMap,i4=new WeakMap,i8=new WeakMap,i7=new WeakMap,i9=new WeakMap,st=new WeakMap,se=new WeakMap,si=new WeakMap,ss=new WeakMap,sa=new WeakMap,sn=new WeakMap,sr=new WeakSet,sl=new WeakSet,so=new WeakSet,sh=new WeakSet,sd=new WeakSet,sc=new WeakSet,su=new WeakSet,s_=new WeakSet,sp=new WeakSet,sf=new WeakSet,sg=new WeakSet,sv=new WeakSet,sm=new WeakSet,sb=ne
1w WeakSet;class sw{static get _resizerKeyboardManager(){let t=sw.prototype._resizeWithKeyboard,e=ih.TRANSLATE_SMALL,i=ih.TRANSLATE_BIG;return H(this,"_resizerKeyboardManager",new el([[["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"],sw.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return H(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){let e=new sW({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){var i;if(null!==(i=sw._l10n)&&void 0!==i||(sw._l10n=t),sw._l10nResizer||(sw._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),-1!==sw._borderLineWidth)return;let s=getComputedStyle(document.documentElement);sw._borderLineWidth=parseFloat(s.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){W("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return(0,s._)(this,sa)}set _isDraggable(t){var e;(0,n._)(this,sa,t),null===(e=this.div)||void 0===e||e.classList.toggle("draggable",t)}get isEnterHandled(){return!0}center(){let[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(2*t),this.y+=this.width*t/(2*e);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(2*t),this.y-=this.width*t/(2*e);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=(0,s._)(this,sn)}setParent(t){null!==t?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):(0,l._)(this,sb,sF).call(this),this.parent=t}focusin(t){this._focusEventsAllowed&&((0,s._)(this,i6)?(0,n._)(this,i6,!1):this.parent.setSelected(this))}focusout(t){var e;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;let i=t.relatedTarget;(null==i||!i.closest("#".concat(this.id)))&&(t.preventDefault(),(null===(e=this.parent)||void 0===e?void 0:e.isMultipleSelection)||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,i,s){let[a,n]=this.parentDimensions;[i,s]=this.screenToPageTranslation(i,s),this.x=(t+i)/a,this.y=(e+s)/n,this.fixAndSetPosition()}translate(t,e){(0,l._)(this,sr,sA).call(this,this.parentDimensions,t,e)}translateInPage(t,e){(0,n._)(this,i4,(0,s._)(this,i4)||[this.x,this.y]),(0,l._)(this,sr,sA).call(this,this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}drag(t,e){(0,n._)(this,i4,(0,s._)(this,i4)||[this.x,this.y]);let[i,a]=this.parentDimensions;if(this.x+=t/i,this.y+=e/a,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:t,y:e}=this.div.getBoundingClientRect();this.parent.findNewParent(this,t,e)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:r,y:l}=this,[o,h]=this.getBaseTranslation();r+=o,l+=h,this.div.style.left="".concat((100*r).toFixed(2),"%"),this.div.style.top="".concat((100*l).toFixed(2),"%"),this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!(0,s._)(this,i4)&&((0,s._)(this,i4)[0]!==this.x||(0,s._)(this,i4)[1]!==this.y)}getBaseTranslation(){let[t,e]=this.parentDimensions,{_borderLineWidth:i}=sw,s=i/t,a=i/e;switch(this.rotation){case 90:return[-s,a];case 180:return[s,a];case 270:return[s,-a];default:return[-s,-a]}}get _mustFixPosition(){return!0}fixAndSetPosition(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.rotation,[e,i]=this.pageDimensions,{x:s,y:a,width:n,height:r}=this;if(n*=e,r*=i,s*=e,a*=i,this._mustFixPosition)switch(t){case 0:s=Math.max(0,Math.min(e-n,s)),a=Math.max(0,Math.min(i-r,a));break;case 90:s=Math.max(0,Math.min(e-r,s)),a=Math.min(i,Math.max(n,a));break;case 180:s=Math.min(e,Math.max(n,s)),a=Math.min(i,Math.max(r,a));break;case 270:s=Math.min(e,Math.max(r,s)),a=Math.max(0,Math.min(i-n,a))}this.x=s/=e,this.y=a/=i;let[l,o]=this.getBaseTranslation();s+=l,a+=o;let{style:h}=this.div;h.left="".concat((100*s).toFixed(2),"%"),h.top="".concat((100*a).toFixed(2),"%"),this.moveInDOM()}screenToPageTranslation(t,e){return(0,_._)(sw,sw,sy).call(sw,t,e,this.parentRotation)}pageTranslationToScreen(t,e){return(0,_._)(sw,sw,sy).call(sw,t,e,3
160-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{parentScale:t,pageDimensions:[e,i]}=this;return[e*t,i*t]}setDims(t,e){let[i,a]=this.parentDimensions;this.div.style.width="".concat((100*t/i).toFixed(2),"%"),(0,s._)(this,i0)||(this.div.style.height="".concat((100*e/a).toFixed(2),"%"))}fixDims(){let{style:t}=this.div,{height:e,width:i}=t,a=i.endsWith("%"),n=!(0,s._)(this,i0)&&e.endsWith("%");if(a&&n)return;let[r,l]=this.parentDimensions;a||(t.width="".concat((100*parseFloat(i)/r).toFixed(2),"%")),(0,s._)(this,i0)||n||(t.height="".concat((100*parseFloat(e)/l).toFixed(2),"%"))}getInitialTranslation(){return[0,0]}altTextFinish(){var t;null===(t=(0,s._)(this,iZ))||void 0===t||t.finish()}async addEditToolbar(){return this._editToolbar||(0,s._)(this,i7)||(this._editToolbar=new tO(this),this.div.append(this._editToolbar.render()),(0,s._)(this,iZ)&&await this._editToolbar.addAltText((0,s._)(this,iZ))),this._editToolbar}removeEditToolbar(){var t;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,null===(t=(0,s._)(this,iZ))||void 0===t||t.destroy())}addContainer(t){var e;let i=null===(e=this._editToolbar)||void 0===e?void 0:e.div;i?i.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){!(0,s._)(this,iZ)&&(iq.initialize(sw._l10n),(0,n._)(this,iZ,new iq(this)),(0,s._)(this,iQ)&&((0,s._)(this,iZ).data=(0,s._)(this,iQ),(0,n._)(this,iQ,null)),await this.addEditToolbar())}get altTextData(){var t;return null===(t=(0,s._)(this,iZ))||void 0===t?void 0:t.data}set altTextData(t){(0,s._)(this,iZ)&&((0,s._)(this,iZ).data=t)}get guessedAltText(){var t;return null===(t=(0,s._)(this,iZ))||void 0===t?void 0:t.guessedText}async setGuessedAltText(t){var e;await (null===(e=(0,s._)(this,iZ))||void 0===e?void 0:e.setGuessedText(t))}serializeAltText(t){var e;return null===(e=(0,s._)(this,iZ))||void 0===e?void 0:e.serialize(t)}hasAltText(){return!!(0,s._)(this,iZ)&&!(0,s._)(this,iZ).isEmpty()}hasAltTextData(){var t,e;return null!==(e=null===(t=(0,s._)(this,iZ))||void 0===t?void 0:t.hasData())&&void 0!==e&&e}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.tabIndex=(0,s._)(this,i$)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),(0,l._)(this,sp,sR).call(this);let[t,e]=this.parentDimensions;this.parentRotation%180!=0&&(this.div.style.maxWidth="".concat((100*e/t).toFixed(2),"%"),this.div.style.maxHeight="".concat((100*t/e).toFixed(2),"%"));let[i,a]=this.getInitialTranslation();return this.translate(i,a),t2(this,this.div,["pointerdown"]),this.div}pointerdown(t){let{isMac:e}=J.platform;if(0!==t.button||t.ctrlKey&&e){t.preventDefault();return}if((0,n._)(this,i6,!0),this._isDraggable){(0,l._)(this,s_,sT).call(this,t);return}(0,l._)(this,su,sC).call(this,t)}get isSelected(){return this._uiManager.isSelected(this)}moveInDOM(){(0,s._)(this,st)&&clearTimeout((0,s._)(this,st)),(0,n._)(this,st,setTimeout(()=>{var t;(0,n._)(this,st,null),null===(t=this.parent)||void 0===t||t.moveEditorInDOM(this)},0))}_setParentAndPosition(t,e,i){t.changeParent(this),this.x=e,this.y=i,this.fixAndSetPosition()}getRect(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.rotation,s=this.parentScale,[a,n]=this.pageDimensions,[r,l]=this.pageTranslation,o=t/s,h=e/s,d=this.x*a,c=this.y*n,u=this.width*a,_=this.height*n;switch(i){case 0:return[d+o+r,n-c-h-_+l,d+o+u+r,n-c-h+l];case 90:return[d+h+r,n-c+o+l,d+h+_+r,n-c+o+u+l];case 180:return[d-o-u+r,n-c+h+l,d-o+r,n-c+h+_+l];case 270:return[d-h-_+r,n-c-o-u+l,d-h+r,n-c-o+l];default:throw Error("Invalid rotation")}}getRectInCurrentCoords(t,e){let[i,s,a,n]=t,r=a-i,l=n-s;switch(this.rotation){case 0:return[i,e-n,r,l];case 90:return[i,e-s,l,r];case 180:return[a,e-s,r,l];case 270:return[a,e-n,l,r];default:throw Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){(0,n._)(this,i7,!0)}disableEditMode(){(0,n._)(this,i7,!1)}isInEditMode(){return(0,s._)(this,i7)}shouldGetKeyboardEvents(){return(0,s._)(this,i9)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){(0,l._)(this,sp,sR).call(this)}rotate(t){}serializeDeleted(){var t;return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:(null===(t=this._initialData)||void 0===t?void 0:t.popupRef)||""}}serialize(){arguments.length>0&&void 0!==arguments[0]&&arguments[0],arguments.length>1&&void 0!==arguments[1]&&arguments[1],W("An editor must be serializable")}static async deserialize(t,e,i){let s=new this.prototype.constructor({parent:e,id:e.getNextId(),uiManager:i});s.rotation=t.rotation,(0,n._)(s,iQ,t.accessibilityData);let[a,r]=s.pageDimensions,[l,o,h,d]=s.getRectInCurrentCoords(t.rect,r);
1return s.x=l/a,s.y=o/r,s.width=h/a,s.height=d/r,s}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}remove(){var t;if(null===(t=(0,s._)(this,i3))||void 0===t||t.abort(),(0,n._)(this,i3,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),(0,s._)(this,st)&&(clearTimeout((0,s._)(this,st)),(0,n._)(this,st,null)),(0,l._)(this,sb,sF).call(this),this.removeEditToolbar(),(0,s._)(this,ss)){for(let t of(0,s._)(this,ss).values())clearTimeout(t);(0,n._)(this,ss,null)}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&((0,l._)(this,so,sS).call(this),(0,s._)(this,i1).classList.remove("hidden"),t2(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(t){if(!this.isResizable||t.target!==this.div||"Enter"!==t.key)return;this._uiManager.setSelected(this),(0,n._)(this,i2,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});let e=(0,s._)(this,i1).children;if(!(0,s._)(this,iJ)){(0,n._)(this,iJ,Array.from(e));let t=(0,l._)(this,sf,sL).bind(this),i=(0,l._)(this,sg,sI).bind(this),a=this._uiManager._signal;for(let e of(0,s._)(this,iJ)){let s=e.getAttribute("data-resizer-name");e.setAttribute("role","spinbutton"),e.addEventListener("keydown",t,{signal:a}),e.addEventListener("blur",i,{signal:a}),e.addEventListener("focus",(0,l._)(this,sv,sP).bind(this,s),{signal:a}),e.setAttribute("data-l10n-id",sw._l10nResizer[s])}}let i=(0,s._)(this,iJ)[0],a=0;for(let t of e){if(t===i)break;a++}let r=(360-this.rotation+this.parentRotation)%360/90*((0,s._)(this,iJ).length/4);if(r!==a){if(r<a)for(let t=0;t<a-r;t++)(0,s._)(this,i1).append((0,s._)(this,i1).firstChild);else if(r>a)for(let t=0;t<r-a;t++)(0,s._)(this,i1).firstChild.before((0,s._)(this,i1).lastChild);let t=0;for(let i of e){let e=(0,s._)(this,iJ)[t++].getAttribute("data-resizer-name");i.setAttribute("data-l10n-id",sw._l10nResizer[e])}}(0,l._)(this,sm,sD).call(this,0),(0,n._)(this,i9,!0),(0,s._)(this,i1).firstChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}_resizeWithKeyboard(t,e){(0,s._)(this,i9)&&(0,l._)(this,sc,sM).call(this,(0,s._)(this,i5),{movementX:t,movementY:e})}_stopResizingWithKeyboard(){(0,l._)(this,sb,sF).call(this),this.div.focus()}select(){var t,e,i;if(this.makeResizable(),null===(t=this.div)||void 0===t||t.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{var t,e;(null===(t=this.div)||void 0===t?void 0:t.classList.contains("selectedEditor"))&&(null===(e=this._editToolbar)||void 0===e||e.show())});return}null===(e=this._editToolbar)||void 0===e||e.show(),null===(i=(0,s._)(this,iZ))||void 0===i||i.toggleAltTextBadge(!1)}unselect(){var t,e,i,a,n;null===(t=(0,s._)(this,i1))||void 0===t||t.classList.add("hidden"),null===(e=this.div)||void 0===e||e.classList.remove("selectedEditor"),(null===(i=this.div)||void 0===i?void 0:i.contains(document.activeElement))&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),null===(a=this._editToolbar)||void 0===a||a.hide(),null===(n=(0,s._)(this,iZ))||void 0===n||n.toggleAltTextBadge(!0)}updateParams(t,e){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return(0,s._)(this,i8)}set isEditing(t){(0,n._)(this,i8,t),this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(t,e){(0,n._)(this,i0,!0);let{style:i}=this.div;i.aspectRatio=t/e,i.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e){(0,n._)(this,ss,(0,s._)(this,ss)||new Map);let{action:e}=t,i=(0,s._)(this,ss).get(e);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),(0,s._)(this,ss).delete(e),0===(0,s._)(this,ss).size&&(0,n._)(this,ss,null)},sw._telemetryTimeout),(0,s._)(this,ss).set(e,i);return}t.type||(t.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}
1show(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),(0,n._)(this,i$,!1)}disable(){this.div&&(this.div.tabIndex=-1),(0,n._)(this,i$,!0)}renderAnnotationElement(t){let e=t.container.querySelector(".annotationContent");if(e){if("CANVAS"===e.nodeName){let t=e;(e=document.createElement("div")).classList.add("annotationContent",this.editorType),t.before(e)}}else(e=document.createElement("div")).classList.add("annotationContent",this.editorType),t.container.prepend(e);return e}resetAnnotationElement(t){let{firstChild:e}=t.container;(null==e?void 0:e.nodeName)==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}constructor(t){(0,o._)(this,sr),(0,o._)(this,sl),(0,o._)(this,so),(0,o._)(this,sh),(0,o._)(this,sd),(0,o._)(this,sc),(0,o._)(this,su),(0,o._)(this,s_),(0,o._)(this,sp),(0,o._)(this,sf),(0,o._)(this,sg),(0,o._)(this,sv),(0,o._)(this,sm),(0,o._)(this,sb),(0,a._)(this,iQ,{writable:!0,value:void 0}),(0,a._)(this,iJ,{writable:!0,value:void 0}),(0,a._)(this,iZ,{writable:!0,value:void 0}),(0,a._)(this,i$,{writable:!0,value:void 0}),(0,a._)(this,i0,{writable:!0,value:void 0}),(0,a._)(this,i1,{writable:!0,value:void 0}),(0,a._)(this,i2,{writable:!0,value:void 0}),(0,a._)(this,i3,{writable:!0,value:void 0}),(0,a._)(this,i5,{writable:!0,value:void 0}),(0,a._)(this,i6,{writable:!0,value:void 0}),(0,a._)(this,i4,{writable:!0,value:void 0}),(0,a._)(this,i8,{writable:!0,value:void 0}),(0,a._)(this,i7,{writable:!0,value:void 0}),(0,a._)(this,i9,{writable:!0,value:void 0}),(0,a._)(this,st,{writable:!0,value:void 0}),(0,a._)(this,se,{writable:!0,value:void 0}),(0,a._)(this,si,{writable:!0,value:void 0}),(0,a._)(this,ss,{writable:!0,value:void 0}),(0,a._)(this,sa,{writable:!0,value:void 0}),(0,a._)(this,sn,{writable:!0,value:void 0}),(0,n._)(this,iQ,null),(0,n._)(this,iJ,null),(0,n._)(this,iZ,null),(0,n._)(this,i$,!1),(0,n._)(this,i0,!1),(0,n._)(this,i1,null),(0,n._)(this,i2,null),(0,n._)(this,i3,null),(0,n._)(this,i5,""),(0,n._)(this,i6,!1),(0,n._)(this,i4,null),(0,n._)(this,i8,!1),(0,n._)(this,i7,!1),(0,n._)(this,i9,!1),(0,n._)(this,st,null),(0,n._)(this,se,0),(0,n._)(this,si,0),(0,n._)(this,ss,null),this._editToolbar=null,this._initialOptions=Object.create(null),this._initialData=null,this._isVisible=!0,this._uiManager=null,this._focusEventsAllowed=!0,(0,n._)(this,sa,!1),(0,n._)(this,sn,sw._zIndex++),this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null;let{rotation:e,rawDims:{pageWidth:i,pageHeight:s,pageX:r,pageY:l}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,s],this.pageTranslation=[r,l];let[h,d]=this.parentDimensions;this.x=t.x/h,this.y=t.y/d,this.isAttachedToDOM=!1,this.deleted=!1}}function sA(t,e,i){let[s,a]=t;[e,i]=this.screenToPageTranslation(e,i),this.x+=e/s,this.y+=i/a,this.fixAndSetPosition()}function sy(t,e,i){switch(i){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}function sk(t){switch(t){case 90:{let[t,e]=this.pageDimensions;return[0,-t/e,e/t,0]}case 180:return[-1,0,0,-1];case 270:{let[t,e]=this.pageDimensions;return[0,t/e,-e/t,0]}default:return[1,0,0,1]}}function sS(){if((0,s._)(this,i1))return;(0,n._)(this,i1,document.createElement("div")),(0,s._)(this,i1).classList.add("resizers");let t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(let i of t){let t=document.createElement("div");(0,s._)(this,i1).append(t),t.classList.add("resizer",i),t.setAttribute("data-resizer-name",i),t.addEventListener("pointerdown",(0,l._)(this,sh,sx).bind(this,i),{signal:e}),t.addEventListener("contextmenu",tm,{signal:e}),t.tabIndex=-1}this.div.prepend((0,s._)(this,i1))}function sx(t,e){var i;e.preventDefault();let{isMac:a}=J.platform;if(0!==e.button||e.ctrlKey&&a)return;null===(i=(0,s._)(this,iZ))||void 0===i||i.toggle(!1);let n=this._isDraggable;this._isDraggable=!1;let r=new AbortController,o=this._uiManager.combinedSignal(r);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",(0,l._)(this,sc,sM).bind(this,t),{passive:!0,capture:!0,signal:o}),window.addEventListener("contextmenu",tm,{signal:o});let h=this.x,d=this.y,c=this.width,u=this.height,_=this.parent.div.style.cursor,p=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;let f=()=>{var t;r.abort(),this.parent.togglePointerEvents(!0),null===(t=(0,s._)(this,iZ))||void 0===t||t.toggle(!0),this._isDraggable=n,this.parent.div.style.cursor=_,this.div.style.cursor=p,(0,l._)(this,sd,sE).call(this,h,d,c,u)};window.addEventListener("pointerup",f,{signal:o}),window.addEventListener("blur",f,{signal:o})}
1function sE(t,e,i,s){let a=this.x,n=this.y,r=this.width,l=this.height;(a!==t||n!==e||r!==i||l!==s)&&this.addCommands({cmd:()=>{this.width=r,this.height=l,this.x=a,this.y=n;let[t,e]=this.parentDimensions;this.setDims(t*r,e*l),this.fixAndSetPosition()},undo:()=>{this.width=i,this.height=s,this.x=t,this.y=e;let[a,n]=this.parentDimensions;this.setDims(a*i,n*s),this.fixAndSetPosition()},mustExec:!0})}function sM(t,e){let i,s,a,n;let[r,o]=this.parentDimensions,h=this.x,d=this.y,c=this.width,u=this.height,_=sw.MIN_SIZE/r,p=sw.MIN_SIZE/o,f=t=>Math.round(1e4*t)/1e4,g=(0,l._)(this,sl,sk).call(this,this.rotation),v=(t,e)=>[g[0]*t+g[2]*e,g[1]*t+g[3]*e],m=(0,l._)(this,sl,sk).call(this,360-this.rotation),b=!1,w=!1;switch(t){case"topLeft":b=!0,i=(t,e)=>[0,0],s=(t,e)=>[t,e];break;case"topMiddle":i=(t,e)=>[t/2,0],s=(t,e)=>[t/2,e];break;case"topRight":b=!0,i=(t,e)=>[t,0],s=(t,e)=>[0,e];break;case"middleRight":w=!0,i=(t,e)=>[t,e/2],s=(t,e)=>[0,e/2];break;case"bottomRight":b=!0,i=(t,e)=>[t,e],s=(t,e)=>[0,0];break;case"bottomMiddle":i=(t,e)=>[t/2,e],s=(t,e)=>[t/2,0];break;case"bottomLeft":b=!0,i=(t,e)=>[0,e],s=(t,e)=>[t,0];break;case"middleLeft":w=!0,i=(t,e)=>[0,e/2],s=(t,e)=>[t,e/2]}let A=i(c,u),y=s(c,u),k=v(...y),S=f(h+k[0]),x=f(d+k[1]),E=1,M=1,[C,T]=this.screenToPageTranslation(e.movementX,e.movementY);if([C,T]=(a=C/r,n=T/o,[m[0]*a+m[2]*n,m[1]*a+m[3]*n]),b){let t=Math.hypot(c,u);E=M=Math.max(Math.min(Math.hypot(y[0]-A[0]-C,y[1]-A[1]-T)/t,1/c,1/u),_/c,p/u)}else w?E=Math.max(_,Math.min(1,Math.abs(y[0]-A[0]-C)))/c:M=Math.max(p,Math.min(1,Math.abs(y[1]-A[1]-T)))/u;let R=f(c*E),L=f(u*M),I=S-(k=v(...s(R,L)))[0],P=x-k[1];this.width=R,this.height=L,this.x=I,this.y=P,this.setDims(r*R,o*L),this.fixAndSetPosition()}function sC(t){let{isMac:e}=J.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}function sT(t){let{isSelected:e}=this;this._uiManager.setUpDragSession();let i=new AbortController,a=this._uiManager.combinedSignal(i);e&&(this.div.classList.add("moving"),(0,n._)(this,se,t.clientX),(0,n._)(this,si,t.clientY),window.addEventListener("pointermove",t=>{let{clientX:e,clientY:i}=t,[a,r]=this.screenToPageTranslation(e-(0,s._)(this,se),i-(0,s._)(this,si));(0,n._)(this,se,e),(0,n._)(this,si,i),this._uiManager.dragSelectedEditors(a,r)},{passive:!0,capture:!0,signal:a}));let r=()=>{i.abort(),e&&this.div.classList.remove("moving"),(0,n._)(this,i6,!1),this._uiManager.endDragSession()||(0,l._)(this,su,sC).call(this,t)};window.addEventListener("pointerup",r,{signal:a}),window.addEventListener("blur",r,{signal:a})}function sR(){if((0,s._)(this,i3)||!this.div)return;(0,n._)(this,i3,new AbortController);let t=this._uiManager.combinedSignal((0,s._)(this,i3));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})}function sL(t){sw._resizerKeyboardManager.exec(this,t)}function sI(t){var e;(0,s._)(this,i9)&&(null===(e=t.relatedTarget)||void 0===e?void 0:e.parentNode)!==(0,s._)(this,i1)&&(0,l._)(this,sb,sF).call(this)}function sP(t){(0,n._)(this,i5,(0,s._)(this,i9)?t:"")}function sD(t){if((0,s._)(this,iJ))for(let e of(0,s._)(this,iJ))e.tabIndex=t}function sF(){if((0,n._)(this,i9,!1),(0,l._)(this,sm,sD).call(this,-1),(0,s._)(this,i2)){let{savedX:t,savedY:e,savedWidth:i,savedHeight:a}=(0,s._)(this,i2);(0,l._)(this,sd,sE).call(this,t,e,i,a),(0,n._)(this,i2,null)}}sw._l10n=null,sw._l10nResizer=null,sw._borderLineWidth=-1,sw._colorManager=new eh,sw._zIndex=1,sw._telemetryTimeout=1e3;class sW extends sw{serialize(){return this.serializeDeleted()}constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}}class sN{update(t){let e,i;if("string"==typeof t){e=new Uint8Array(2*t.length),i=0;for(let s=0,a=t.length;s<a;s++){let a=t.charCodeAt(s);a<=255?e[i++]=a:(e[i++]=a>>>8,e[i++]=255&a)}}else if(ArrayBuffer.isView(t))i=(e=t.slice()).byteLength;else throw Error("Invalid data format, must be a string or TypedArray.");let s=i>>2,a=i-4*s,n=new Uint32Array(e.buffer,0,s),r=0,l=0,o=this.h1,h=this.h2;for(let t=0;t<s;t++)1&t?(o^=r=0x1b873593*(r=(r=0xcc9e2d51*(r=n[t])&0xffff0000|11601*r&65535)<<15|r>>>17)&0xffff0000|13715*r&65535,o=5*(o=o<<13|o>>>19)+0xe6546b64):(h^=l=0x1b873593*(l=(l=0xcc9e2d51*(l=n[t])&0xffff0000|11601*l&65535)<<15|l>>>17)&0xffff0000|13715*l&65535,h=5*(h=h<<13|h>>>19)+0xe6546b64);switch(r=0,a){case 3:r^=e[4*s+2]<<16;case 2:r^=e[4*s+1]<<8;case 1:r^=e[4*s],r=0x1b873593*(r=(r=0xcc9e2d51*r&0xffff0000|11601*r&65535)<<15|r>>>17)&0xffff0000|13715*r&65535,1&s?o^=r:h^=r}this.h1=o,this.h2=h}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,e=0xff51afd7*e&0xffff0000|((e<<16|(t=0xed558ccd*t&0xffff0000|36045*t&65535)>>>16)*0xafd7ed55&0xffff0000)>>>16,t^=e>>>1,e=0xc4ceb9fe*e&0xffff0000|((e<<16|(t=0x1a85ec53*t&0xffff0000|60499*t&65535)>>>16)*0xb9fe1a85&0xffff0000)>>>16,((t^=e>>>1)>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}constructor(t){this.h1=t?0xffffffff&t:0xc3d2e1f0,this.h2=t?0xffffffff&t:0xc3d2e1f0}}let sO=Object.freeze({map:null,hash:"",transfer:void 0});var sH=new WeakMap,sB=new WeakMap,sj=new WeakMap,sz=new WeakSet;class sG{getValue(t,e){let i=(0,s._)(this,sj).get(t);return void 0===i?e:Object.assign(e,i)}getRawValue(t){return(0,s._)(this,sj).get(t)}remove(t){if((0,s._)(this,sj).delete(t),0===(0,s._)(this,sj).size&&this.resetModified(),"function"==typeof this.onAnnotationEditor){for(let t of(0,s._)(this,sj).values())if(t instanceof sw)return;this.onAnnotationEditor(null)}}setValue(t,e){let i=(0,s._)(this,sj).get(t),a=!1;if(void 0!==i)for(let[t,s]of Object.entries(e))i[t]!==s&&(a=!0,i[t]=s);else a=!0,(0,s._)(this,sj).set(t,e);a&&(0,l._)(this,sz,sU).call(this),e instanceof sw&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(e.constructor._type)}has(t){return(0,s._)(this,sj).has(t)}getAll(){return(0,s._)(this,sj).size>0?Q((0,s._)(this,sj)):null}setAll(t){for(let[e,i]of Object.entries(t))this.setValue(e,i)}get size(){return(0,s._)(this,sj).size}resetModified(){(0,s._)(this,sH)&&((0,n._)(this,sH,!1),"function"==typeof this.onResetModified&&this.onResetModified())}get print(){return new sq(this)}get serializable(){if(0===(0,s._)(this,sj).size)return sO;let t=new Map,e=new sN,i=[],a=Object.create(null),n=!1;for(let[i,r]of(0,s._)(this,sj)){let s=r instanceof sw?r.serialize(!1,a):r;s&&(t.set(i,s),e.update("".concat(i,":").concat(JSON.stringify(s))),n||(n=!!s.bitmap))}if(n)for(let e of t.values())e.bitmap&&i.push(e.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:i}:sO}get editorStats(){let t=null,e=new Map;for(let n of(0,s._)(this,sj).values()){var i,a;if(!(n instanceof sw))continue;let s=n.telemetryFinalData;if(!s)continue;let{type:r}=s;e.has(r)||e.set(r,Object.getPrototypeOf(n).constructor),t||(t=Object.create(null));let l=(i=t)[r]||(i[r]=new Map);for(let[t,e]of Object.entries(s)){if("type"===t)continue;let i=l.get(t);i||(i=new Map,l.set(t,i));let s=null!==(a=i.get(e))&&void 0!==a?a:0;i.set(e,s+1)}}for(let[i,s]of e)t[i]=s.computeTelemetryFinalData(t[i]);return t}resetModifiedIds(){(0,n._)(this,sB,null)}get modifiedIds(){if((0,s._)(this,sB))return(0,s._)(this,sB);let t=[];for(let e of(0,s._)(this,sj).values())e instanceof sw&&e.annotationElementId&&e.serialize()&&t.pu
1sh(e.annotationElementId);return(0,n._)(this,sB,{ids:new Set(t),hash:t.join(",")})}constructor(){(0,o._)(this,sz),(0,a._)(this,sH,{writable:!0,value:void 0}),(0,a._)(this,sB,{writable:!0,value:void 0}),(0,a._)(this,sj,{writable:!0,value:void 0}),(0,n._)(this,sH,!1),(0,n._)(this,sB,null),(0,n._)(this,sj,new Map),this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}}function sU(){(0,s._)(this,sH)||((0,n._)(this,sH,!0),"function"==typeof this.onSetModified&&this.onSetModified())}var sV=new WeakMap;class sq extends sG{get print(){W("Should not call PrintAnnotationStorage.print")}get serializable(){return(0,s._)(this,sV)}get modifiedIds(){return H(this,"modifiedIds",{ids:new Set,hash:""})}constructor(t){super(),(0,a._)(this,sV,{writable:!0,value:void 0});let{map:e,hash:i,transfer:s}=t.serializable,r=structuredClone(e,s?{transfer:s}:null);(0,n._)(this,sV,{map:r,hash:i,transfer:s})}}var sK=new WeakMap;class sX{addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));let e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(let t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),(0,s._)(this,sK).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont(t){let{systemFontInfo:e,_inspectFont:i}=t;if(!(!e||(0,s._)(this,sK).has(e.loadedName))){if(N(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:t,src:a,style:n}=e,r=new FontFace(t,a,n);this.addNativeFontFace(r);try{await r.load(),(0,s._)(this,sK).add(t),null==i||i(e)}catch(t){F("Cannot load system font: ".concat(e.baseFontName,", installing it could help to improve PDF rendering.")),this.removeNativeFontFace(r)}return}W("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo){await this.loadSystemFont(t);return}if(this.isFontLoadingAPISupported){let e=t.createNativeFontFace();if(e){this.addNativeFontFace(e);try{await e.loaded}catch(i){throw F("Failed to load font '".concat(e.family,"': '").concat(i,"'.")),t.disableFontFace=!0,i}}return}let e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(e=>{let i=this._queueLoadingCallback(e);this._prepareFontLoadEvent(t,i)})}}get isFontLoadingAPISupported(){var t;return H(this,"isFontLoadingAPISupported",!!(null===(t=this._document)||void 0===t?void 0:t.fonts))}get isSyncFontLoadingSupported(){var t;let e=!1;return m?e=!0:"undefined"!=typeof navigator&&"string"==typeof(null===(t=navigator)||void 0===t?void 0:t.userAgent)&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent)&&(e=!0),H(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(t){let{loadingRequests:e}=this,i={done:!1,complete:function(){for(N(!i.done,"completeRequest() cannot be called twice."),i.done=!0;e.length>0&&e[0].done;)setTimeout(e.shift().callback,0)},callback:t};return e.push(i),i}get _loadTestFont(){return H(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(t,e){var i;let s,a;function n(t,e){return t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|255&t.charCodeAt(e+3)}function r(t,e,i,s){return t.substring(0,e)+s+t.substring(e+i)}let l=this._document.createElement("canvas");l.width=1,l.height=1;let o=l.getContext("2d"),h=0,d="lt".concat(Date.now()).concat(this.loadTestFontId++),c=this._loadTestFont,u=n(c=r(c,976,d.length,d),16);for(s=0,a=d.length-3;s<a;s+=4)u=u-0x58585858+n(d,s)|0;s<d.length&&(u=u-0x58585858+n(d+"XXX",s)|0),c=r(c,16,4,String.fromCharCode((i=u)>>24&255,i>>16&255,i>>8&255,255&i));let _="url(data:font/opentype;base64,".concat(btoa(c),");"),p='@font-face {font-family:"'.concat(d,'";src:').concat(_,"}");this.insertRule(p);let f=this._document.createElement("div");
1for(let e of(f.style.visibility="hidden",f.style.width=f.style.height="10px",f.style.position="absolute",f.style.top=f.style.left="0px",[t.loadedName,d])){let t=this._document.createElement("span");t.textContent="Hi",t.style.fontFamily=e,f.append(t)}this._document.body.append(f),function t(e,i){if(++h>30){F("Load test font never loaded."),i();return}if(o.font="30px "+e,o.fillText(".",0,20),o.getImageData(0,0,1,1).data[3]>0){i();return}setTimeout(t.bind(null,e,i))}(d,()=>{f.remove(),e.complete()})}constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){(0,a._)(this,sK,{writable:!0,value:void 0}),(0,n._)(this,sK,new Set),this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}}class sY{createNativeFontFace(){var t;let e;if(!this.data||this.disableFontFace)return null;if(this.cssFontInfo){let t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style="oblique ".concat(this.cssFontInfo.italicAngle,"deg")),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}else e=new FontFace(this.loadedName,this.data,{});return null===(t=this._inspectFont)||void 0===t||t.call(this,this),e}createFontFaceRule(){var t,e;let i;if(!this.data||this.disableFontFace)return null;let s="url(data:".concat(this.mimetype,";base64,").concat((e=this.data,Uint8Array.prototype.toBase64?e.toBase64():btoa(X(e))),");");if(this.cssFontInfo){let t="font-weight: ".concat(this.cssFontInfo.fontWeight,";");this.cssFontInfo.italicAngle&&(t+="font-style: oblique ".concat(this.cssFontInfo.italicAngle,"deg;")),i='@font-face {font-family:"'.concat(this.cssFontInfo.fontFamily,'";').concat(t,"src:").concat(s,"}")}else i='@font-face {font-family:"'.concat(this.loadedName,'";src:').concat(s,"}");return null===(t=this._inspectFont)||void 0===t||t.call(this,this,s),i}getPathGenerator(t,e){let i;if(void 0!==this.compiledGlyphs[e])return this.compiledGlyphs[e];try{i=t.get(this.loadedName+"_path_"+e)}catch(t){F('getPathGenerator - ignoring character: "'.concat(t,'".'))}if(!Array.isArray(i)||0===i.length)return this.compiledGlyphs[e]=function(t,e){};let s=[];for(let t=0,e=i.length;t<e;)switch(i[t++]){case tr.BEZIER_CURVE_TO:{let[e,a,n,r,l,o]=i.slice(t,t+6);s.push(t=>t.bezierCurveTo(e,a,n,r,l,o)),t+=6}break;case tr.MOVE_TO:{let[e,a]=i.slice(t,t+2);s.push(t=>t.moveTo(e,a)),t+=2}break;case tr.LINE_TO:{let[e,a]=i.slice(t,t+2);s.push(t=>t.lineTo(e,a)),t+=2}break;case tr.QUADRATIC_CURVE_TO:{let[e,a,n,r]=i.slice(t,t+4);s.push(t=>t.quadraticCurveTo(e,a,n,r)),t+=4}break;case tr.RESTORE:s.push(t=>t.restore());break;case tr.SAVE:s.push(t=>t.save());break;case tr.SCALE:N(2===s.length,"Scale command is only valid at the third position.");break;case tr.TRANSFORM:{let[e,a,n,r,l,o]=i.slice(t,t+6);s.push(t=>t.transform(e,a,n,r,l,o)),t+=6}break;case tr.TRANSLATE:{let[e,a]=i.slice(t,t+2);s.push(t=>t.translate(e,a)),t+=2}}return this.compiledGlyphs[e]=function(t,e){s[0](t),s[1](t),t.scale(e,-e);for(let e=2,i=s.length;e<i;e++)s[e](t)}}constructor(t,{disableFontFace:e=!1,inspectFont:i=null}){for(let e in this.compiledGlyphs=Object.create(null),t)this[e]=t[e];this.disableFontFace=!0===e,this._inspectFont=i}}var sQ=new WeakMap;class sJ{create(t,e){if(t<=0||e<=0)throw Error("Invalid canvas size");let i=this._createCanvas(t,e);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!(0,s._)(this,sQ)})}}reset(t,e,i){if(!t.canvas)throw Error("Canvas is not specified");if(e<=0||i<=0)throw Error("Invalid canvas size");t.canvas.width=e,t.canvas.height=i}destroy(t){if(!t.canvas)throw Error("Canvas is not specified");t.canvas.width=0,t.canvas.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){W("Abstract method `_createCanvas` called.")}constructor({enableHWA:t=!1}){(0,a._)(this,sQ,{writable:!0,value:void 0}),(0,n._)(this,sQ,!1),(0,n._)(this,sQ,t)}}class sZ extends sJ{_createCanvas(t,e){let i=this._document.createElement("canvas");return i.width=t,i.height=e,i}constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}}class s${async fetch(t){let{name:e}=t;if(!this.baseUrl)throw Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!e)throw Error("CMap name must be specified.");let i=this.baseUrl+e+(this.isCompressed?".bcmap":"");return this._fetch(i).then(t=>({cMapData:t,isCompressed:this.isCompressed})).catch(t=>{throw Error("Unable to load ".concat(this.isCompressed?"binary ":"","CMap at: ").concat(i))})}async _fetch(t){W("Abstract method `_fetch` called.")}constructor({baseUrl:t=null,isCompressed:e=!0}){this.baseUrl=t,this.isCompressed=e}}class s0 extends s${async _fetch(t){let e=await th(t,this.isCompressed?"arraybuffer":"text");return e instanceof ArrayBuffer?new Uint8Array(e):Y(e)}}class s1{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,i,s,a){return"none"}destroy(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]}}
1var s2=new WeakMap,s3=new WeakMap,s5=new WeakMap,s6=new WeakMap,s4=new WeakMap,s8=new WeakMap,s7=new WeakMap,s9=new WeakMap,at=new WeakMap,ae=new WeakMap,ai=new WeakSet,as=new WeakSet,aa=new WeakSet,an=new WeakSet,ar=new WeakSet,al=new WeakSet,ao=new WeakSet,ah=new WeakSet,ad=new WeakSet;class ac extends s1{addFilter(t){if(!t)return"none";let e=(0,s._)(this,s9).get(t);if(e)return e;let[i,a,n]=(0,l._)(this,ai,af).call(this,t),o=1===t.length?i:"".concat(i).concat(a).concat(n);if(e=(0,s._)(this,s9).get(o))return(0,s._)(this,s9).set(t,e),e;let h="g_".concat((0,s._)(this,s6),"_transfer_map_").concat((0,r._)(this,s7).value++),d=(0,l._)(this,as,ag).call(this,h);(0,s._)(this,s9).set(t,d),(0,s._)(this,s9).set(o,d);let c=(0,l._)(this,ar,ab).call(this,h);return(0,l._)(this,ao,aA).call(this,i,a,n,c),d}addHCMFilter(t,e){let i="".concat(t,"-").concat(e),a="base",n=(0,s._)(this,at).get(a);if((null==n?void 0:n.key)===i)return n.url;if(n){var r;null===(r=n.filter)||void 0===r||r.remove(),n.key=i,n.url="none",n.filter=null}else n={key:i,url:"none",filter:null},(0,s._)(this,at).set(a,n);if(!t||!e)return n.url;let o=(0,l._)(this,ad,ak).call(this,t);t=$.makeHexColor(...o);let h=(0,l._)(this,ad,ak).call(this,e);if(e=$.makeHexColor(...h),(0,s._)(this,ae).style.color="","#000000"===t&&"#ffffff"===e||t===e)return n.url;let d=Array(256);for(let t=0;t<=255;t++){let e=t/255;d[t]=e<=.03928?e/12.92:((e+.055)/1.055)**2.4}let c=d.join(","),u="g_".concat((0,s._)(this,s6),"_hcm_filter"),_=n.filter=(0,l._)(this,ar,ab).call(this,u);(0,l._)(this,ao,aA).call(this,c,c,c,_),(0,l._)(this,an,am).call(this,_);let p=(t,e)=>{let i=o[t]/255,s=h[t]/255,a=Array(e+1);for(let t=0;t<=e;t++)a[t]=i+t/e*(s-i);return a.join(",")};return(0,l._)(this,ao,aA).call(this,p(0,5),p(1,5),p(2,5),_),n.url=(0,l._)(this,as,ag).call(this,u),n.url}addAlphaFilter(t){let e=(0,s._)(this,s9).get(t);if(e)return e;let[i]=(0,l._)(this,ai,af).call(this,[t]),a="alpha_".concat(i);if(e=(0,s._)(this,s9).get(a))return(0,s._)(this,s9).set(t,e),e;let n="g_".concat((0,s._)(this,s6),"_alpha_map_").concat((0,r._)(this,s7).value++),o=(0,l._)(this,as,ag).call(this,n);(0,s._)(this,s9).set(t,o),(0,s._)(this,s9).set(a,o);let h=(0,l._)(this,ar,ab).call(this,n);return(0,l._)(this,ah,ay).call(this,i,h),o}addLuminosityFilter(t){let e,i,a=(0,s._)(this,s9).get(t||"luminosity");if(a)return a;if(t?([e]=(0,l._)(this,ai,af).call(this,[t]),i="luminosity_".concat(e)):i="luminosity",a=(0,s._)(this,s9).get(i))return(0,s._)(this,s9).set(t,a),a;let n="g_".concat((0,s._)(this,s6),"_luminosity_map_").concat((0,r._)(this,s7).value++),o=(0,l._)(this,as,ag).call(this,n);(0,s._)(this,s9).set(t,o),(0,s._)(this,s9).set(i,o);let h=(0,l._)(this,ar,ab).call(this,n);return(0,l._)(this,aa,av).call(this,h),t&&(0,l._)(this,ah,ay).call(this,e,h),o}addHighlightHCMFilter(t,e,i,a,n){let r="".concat(e,"-").concat(i,"-").concat(a,"-").concat(n),o=(0,s._)(this,at).get(t);if((null==o?void 0:o.key)===r)return o.url;if(o){var h;null===(h=o.filter)||void 0===h||h.remove(),o.key=r,o.url="none",o.filter=null}else o={key:r,url:"none",filter:null},(0,s._)(this,at).set(t,o);if(!e||!i)return o.url;let[d,c]=[e,i].map((0,l._)(this,ad,ak).bind(this)),u=Math.round(.2126*d[0]+.7152*d[1]+.0722*d[2]),_=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),[p,f]=[a,n].map((0,l._)(this,ad,ak).bind(this));_<u&&([u,_,p,f]=[_,u,f,p]),(0,s._)(this,ae).style.color="";let g=(t,e,i)=>{let s=Array(256),a=(_-u)/i,n=t/255,r=(e-t)/(255*i),l=0;for(let t=0;t<=i;t++){let e=Math.round(u+t*a),i=n+t*r;for(let t=l;t<=e;t++)s[t]=i;l=e+1}for(let t=l;t<256;t++)s[t]=s[l-1];return s.join(",")},v="g_".concat((0,s._)(this,s6),"_hcm_").concat(t,"_filter"),m=o.filter=(0,l._)(this,ar,ab).call(this,v);return(0,l._)(this,an,am).call(this,m),(0,l._)(this,ao,aA).call(this,g(p[0],f[0],5),g(p[1],f[1],5),g(p[2],f[2],5),m),o.url=(0,l._)(this,as,ag).call(this,v),o.url}destroy(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(!t||0===(0,s._)(this,at).size)&&((0,s._)(this,s5)&&((0,s._)(this,s5).parentNode.parentNode.remove(),(0,n._)(this,s5,null)),(0,s._)(this,s3)&&((0,s._)(this,s3).clear(),(0,n._)(this,s3,null)),(0,n._)(this,s7,0))}constructor({docId:t,ownerDocument:e=globalThis.document}){super(),(0,a._)(this,s9,{get:au,set:void 0}),(0,a._)(this,at,{get:a_,set:void 0}),(0,a._)(this,ae,{get:ap,set:void 0}),(0,o._)(this,ai),(0,o._)(this,as),(0,o._)(this,aa),(0,o._)(this,an),(0,o._)(this,ar),(0,o._)(this,al),(0,o._)(this,ao),(0,o._)(this,ah),(0,o._)(this,ad),(0,a._)(this,s2,{writable:!0,value:void 0}),(0,a._)(this,s3,{writable:!0,value:void 0}),(0,a._)(this,s5,{writable:!0,value:void 0}),(0,a._)(this,s6,{writable:!0,value:void 0}),(0,a._)(this,s4,{writable:!0,value:void 0}),(0,a._)(this,s8,{writable:!0,value:void 0}),(0,a._)(this,s7,{writable:!0,value:void 0}),(0,n._)(this,s7,0),(0,n._)(this,s6,t),(0,n._)(this,s4,e)}}function au(){return(0,n._)(this,s3,(0,s._)(this,s3)||new Map)}function a_(){return(0,n._)(this,s8,(0,s._)(this,s8)||new Map)}
1function ap(){if(!(0,s._)(this,s5)){let t=(0,s._)(this,s4).createElement("div"),{style:e}=t;e.visibility="hidden",e.contain="strict",e.width=e.height=0,e.position="absolute",e.top=e.left=0,e.zIndex=-1;let i=(0,s._)(this,s4).createElementNS(tl,"svg");i.setAttribute("width",0),i.setAttribute("height",0),(0,n._)(this,s5,(0,s._)(this,s4).createElementNS(tl,"defs")),t.append(i),i.append((0,s._)(this,s5)),(0,s._)(this,s4).body.append(t)}return(0,s._)(this,s5)}function af(t){if(1===t.length){let e=t[0],i=Array(256);for(let t=0;t<256;t++)i[t]=e[t]/255;let s=i.join(",");return[s,s,s]}let[e,i,s]=t,a=Array(256),n=Array(256),r=Array(256);for(let t=0;t<256;t++)a[t]=e[t]/255,n[t]=i[t]/255,r[t]=s[t]/255;return[a.join(","),n.join(","),r.join(",")]}function ag(t){if(void 0===(0,s._)(this,s2)){(0,n._)(this,s2,"");let t=(0,s._)(this,s4).URL;t!==(0,s._)(this,s4).baseURI&&(tu(t)?F('#createUrl: ignore "data:"-URL for performance reasons.'):(0,n._)(this,s2,t.split("#",1)[0]))}return"url(".concat((0,s._)(this,s2),"#").concat(t,")")}function av(t){let e=(0,s._)(this,s4).createElementNS(tl,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),t.append(e)}function am(t){let e=(0,s._)(this,s4).createElementNS(tl,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),t.append(e)}function ab(t){let e=(0,s._)(this,s4).createElementNS(tl,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),(0,s._)(this,ae).append(e),e}function aw(t,e,i){let a=(0,s._)(this,s4).createElementNS(tl,e);a.setAttribute("type","discrete"),a.setAttribute("tableValues",i),t.append(a)}function aA(t,e,i,a){let n=(0,s._)(this,s4).createElementNS(tl,"feComponentTransfer");a.append(n),(0,l._)(this,al,aw).call(this,n,"feFuncR",t),(0,l._)(this,al,aw).call(this,n,"feFuncG",e),(0,l._)(this,al,aw).call(this,n,"feFuncB",i)}function ay(t,e){let i=(0,s._)(this,s4).createElementNS(tl,"feComponentTransfer");e.append(i),(0,l._)(this,al,aw).call(this,i,"feFuncA",t)}function ak(t){return(0,s._)(this,ae).style.color=t,tk(getComputedStyle((0,s._)(this,ae)).getPropertyValue("color"))}class aS{async fetch(t){let{filename:e}=t;if(!this.baseUrl)throw Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!e)throw Error("Font filename must be specified.");let i="".concat(this.baseUrl).concat(e);return this._fetch(i).catch(t=>{throw Error("Unable to load font data at: ".concat(i))})}async _fetch(t){W("Abstract method `_fetch` called.")}constructor({baseUrl:t=null}){this.baseUrl=t}}class ax extends aS{async _fetch(t){return new Uint8Array(await th(t,"arraybuffer"))}}if(m){var aE=Promise.withResolvers(),aM=null;(async()=>{let t,e;let i=await import("fs"),s=await import("http");return new Map(Object.entries({fs:i,http:s,https:await import("https"),url:await import("url"),canvas:t,path2d:e}))})().then(t=>{aM=t,aE.resolve()},t=>{F("loadPackages: ".concat(t)),aM=new Map,aE.resolve()})}class aC{static get promise(){return aE.promise}static get(t){return null==aM?void 0:aM.get(t)}}async function aT(t){let e=aC.get("fs");return new Uint8Array(await e.promises.readFile(t))}class aR extends s1{}class aL extends sJ{_createCanvas(t,e){return aC.get("canvas").createCanvas(t,e)}}class aI extends s${async _fetch(t){return aT(t)}}class aP extends aS{async _fetch(t){return aT(t)}}let aD={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function aF(t,e){if(!e)return;let i=e[2]-e[0],s=e[3]-e[1],a=new Path2D;a.rect(e[0],e[1],i,s),t.clip(a)}class aW{getPattern(){W("Abstract method `getPattern` called.")}}class aN extends aW{_createGradient(t){let e;for(let i of("axial"===this._type?e=t.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(e=t.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1)),this._colorStops))e.addColorStop(i[0],i[1]);return e}getPattern(t,e,i,s){let a;if(s===aD.STROKE||s===aD.FILL){let n=e.current.getClippedPathBoundingBox(s,tS(t))||[0,0,0,0],r=M
1ath.ceil(n[2]-n[0])||1,l=Math.ceil(n[3]-n[1])||1,o=e.cachedCanvases.getCanvas("pattern",r,l),h=o.context;h.clearRect(0,0,h.canvas.width,h.canvas.height),h.beginPath(),h.rect(0,0,h.canvas.width,h.canvas.height),h.translate(-n[0],-n[1]),i=$.transform(i,[1,0,0,1,n[0],n[1]]),h.transform(...e.baseTransform),this.matrix&&h.transform(...this.matrix),aF(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),a=t.createPattern(o.canvas,"no-repeat");let d=new DOMMatrix(i);a.setTransform(d)}else aF(t,this._bbox),a=this._createGradient(t);return a}constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}}function aO(t,e,i,s,a,n,r,l){let o,h,d,c,u,_,p,f,g;let v=e.coords,m=e.colors,b=t.data,w=4*t.width;v[i+1]>v[s+1]&&(o=i,i=s,s=o,o=n,n=r,r=o),v[s+1]>v[a+1]&&(o=s,s=a,a=o,o=r,r=l,l=o),v[i+1]>v[s+1]&&(o=i,i=s,s=o,o=n,n=r,r=o);let A=(v[i]+e.offsetX)*e.scaleX,y=(v[i+1]+e.offsetY)*e.scaleY,k=(v[s]+e.offsetX)*e.scaleX,S=(v[s+1]+e.offsetY)*e.scaleY,x=(v[a]+e.offsetX)*e.scaleX,E=(v[a+1]+e.offsetY)*e.scaleY;if(y>=E)return;let M=m[n],C=m[n+1],T=m[n+2],R=m[r],L=m[r+1],I=m[r+2],P=m[l],D=m[l+1],F=m[l+2],W=Math.round(y),N=Math.round(E);for(let t=W;t<=N;t++){let e;if(t<S){let e=t<y?0:(y-t)/(y-S);h=A-(A-k)*e,d=M-(M-R)*e,c=C-(C-L)*e,u=T-(T-I)*e}else{let e;h=k-(k-x)*(e=t>E?1:S===E?0:(S-t)/(S-E)),d=R-(R-P)*e,c=L-(L-D)*e,u=I-(I-F)*e}_=A-(A-x)*(e=t<y?0:t>E?1:(y-t)/(y-E)),p=M-(M-P)*e,f=C-(C-D)*e,g=T-(T-F)*e;let i=Math.round(Math.min(h,_)),s=Math.round(Math.max(h,_)),a=w*t+4*i;for(let t=i;t<=s;t++)(e=(h-t)/(h-_))<0?e=0:e>1&&(e=1),b[a++]=d-(d-p)*e|0,b[a++]=c-(c-f)*e|0,b[a++]=u-(u-g)*e|0,b[a++]=255}}class aH extends aW{_createMeshCanvas(t,e,i){let s=Math.floor(this._bounds[0]),a=Math.floor(this._bounds[1]),n=Math.ceil(this._bounds[2])-s,r=Math.ceil(this._bounds[3])-a,l=Math.min(Math.ceil(Math.abs(n*t[0]*1.1)),3e3),o=Math.min(Math.ceil(Math.abs(r*t[1]*1.1)),3e3),h=n/l,d=r/o,c={coords:this._coords,colors:this._colors,offsetX:-s,offsetY:-a,scaleX:1/h,scaleY:1/d},u=l+4,_=o+4,p=i.getCanvas("mesh",u,_),f=p.context,g=f.createImageData(l,o);if(e){let t=g.data;for(let i=0,s=t.length;i<s;i+=4)t[i]=e[0],t[i+1]=e[1],t[i+2]=e[2],t[i+3]=255}for(let t of this._figures)!function(t,e,i){let s,a;let n=e.coords,r=e.colors;switch(e.type){case"lattice":let l=e.verticesPerRow,o=Math.floor(n.length/l)-1,h=l-1;for(s=0;s<o;s++){let e=s*l;for(let s=0;s<h;s++,e++)aO(t,i,n[e],n[e+1],n[e+l],r[e],r[e+1],r[e+l]),aO(t,i,n[e+l+1],n[e+1],n[e+l],r[e+l+1],r[e+1],r[e+l])}break;case"triangles":for(s=0,a=n.length;s<a;s+=3)aO(t,i,n[s],n[s+1],n[s+2],r[s],r[s+1],r[s+2]);break;default:throw Error("illegal figure")}}(g,t,c);return f.putImageData(g,2,2),{canvas:p.canvas,offsetX:s-2*h,offsetY:a-2*d,scaleX:h,scaleY:d}}getPattern(t,e,i,s){let a;if(aF(t,this._bbox),s===aD.SHADING)a=$.singularValueDecompose2dScale(tS(t));else if(a=$.singularValueDecompose2dScale(e.baseTransform),this.matrix){let t=$.singularValueDecompose2dScale(this.matrix);a=[a[0]*t[0],a[1]*t[1]]}let n=this._createMeshCanvas(a,s===aD.SHADING?null:this._background,e.cachedCanvases);return s!==aD.SHADING&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(n.offsetX,n.offsetY),t.scale(n.scaleX,n.scaleY),t.createPattern(n.canvas,"no-repeat")}constructor(t){super(),this._coords=t[2],this._colors=t[3],this._figures=t[4],this._bounds=t[5],this._bbox=t[7],this._background=t[8],this.matrix=null}}class aB extends aW{getPattern(){return"hotpink"}}let aj={COLORED:1,UNCOLORED:2};class az{createPatternCanvas(t){let{bbox:e,operatorList:i,paintType:s,tilingType:a,color:n,canvasGraphicsFactory:r}=this,{xstep:l,ystep:o}=this;l=Math.abs(l),o=Math.abs(o),D("TilingType: "+a);let h=e[0],d=e[1],c=e[2],u=e[3],_=c-h,p=u-d,f=$.singularValueDecompose2dScale(this.matrix),g=$.singularValueDecompose2dScale(this.baseTransform),v=f[0]*g[0],m=f[1]*g[1],b=_,w=p,A=!1,y=!1,k=Math.ceil(o*m),S=Math.ceil(p*m);Math.ceil(l*v)>=Math.ceil(_*v)?b=l:A=!0,k>=S?w=o:y=!0;let x=this.getSizeAndScale(b,this.ctx.canvas.width,v),E=this.getSizeAndScale(w,this.ctx.canvas.height,m),M=t.cachedCanvases.getCanvas("pattern",x.size,E.size),C=M.context,T=r.createCanvasGraphics(C);if(T.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(T,s,n),C.translate(-x.scale*h,-E.scale*d),T.transform(x.scale,0,0,E.scale,0,0),C.save(),this.clipBbox(T,h,d,c,u),T.baseTransform=tS(T.ctx),T.executeOperatorList(i),T.endDrawing(),C.restore(
1),A||y){let e=M.canvas;A&&(b=l),y&&(w=o);let i=this.getSizeAndScale(b,this.ctx.canvas.width,v),s=this.getSizeAndScale(w,this.ctx.canvas.height,m),a=i.size,n=s.size,r=t.cachedCanvases.getCanvas("pattern-workaround",a,n),c=r.context,u=A?Math.floor(_/l):0,f=y?Math.floor(p/o):0;for(let t=0;t<=u;t++)for(let i=0;i<=f;i++)c.drawImage(e,a*t,n*i,a,n,0,0,a,n);return{canvas:r.canvas,scaleX:i.scale,scaleY:s.scale,offsetX:h,offsetY:d}}return{canvas:M.canvas,scaleX:x.scale,scaleY:E.scale,offsetX:h,offsetY:d}}getSizeAndScale(t,e,i){let s=Math.max(az.MAX_PATTERN_SIZE,e),a=Math.ceil(t*i);return a>=s?a=s:i=a/t,{scale:i,size:a}}clipBbox(t,e,i,s,a){let n=s-e,r=a-i;t.ctx.rect(e,i,n,r),t.current.updateRectMinMax(tS(t.ctx),[e,i,s,a]),t.clip(),t.endPath()}setFillAndStrokeStyleToContext(t,e,i){let s=t.ctx,a=t.current;switch(e){case aj.COLORED:let n=this.ctx;s.fillStyle=n.fillStyle,s.strokeStyle=n.strokeStyle,a.fillColor=n.fillStyle,a.strokeColor=n.strokeStyle;break;case aj.UNCOLORED:let r=$.makeHexColor(i[0],i[1],i[2]);s.fillStyle=r,s.strokeStyle=r,a.fillColor=r,a.strokeColor=r;break;default:throw new q("Unsupported paint type: ".concat(e))}}getPattern(t,e,i,s){let a=i;s!==aD.SHADING&&(a=$.transform(a,e.baseTransform),this.matrix&&(a=$.transform(a,this.matrix)));let n=this.createPatternCanvas(e),r=new DOMMatrix(a);r=(r=r.translate(n.offsetX,n.offsetY)).scale(1/n.scaleX,1/n.scaleY);let l=t.createPattern(n.canvas,"repeat");return l.setTransform(r),l}constructor(t,e,i,s,a){this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.color=e,this.ctx=i,this.canvasGraphicsFactory=s,this.baseTransform=a}}az.MAX_PATTERN_SIZE=3e3;class aG{getCanvas(t,e,i){let s;return void 0!==this.cache[t]?(s=this.cache[t],this.canvasFactory.reset(s,e,i)):(s=this.canvasFactory.create(e,i),this.cache[t]=s),s}delete(t){delete this.cache[t]}clear(){for(let t in this.cache){let e=this.cache[t];this.canvasFactory.destroy(e),delete this.cache[t]}}constructor(t){this.canvasFactory=t,this.cache=Object.create(null)}}function aU(t,e,i,s,a,n,r,l,o,h){let[d,c,u,_,p,f]=tS(t);if(0===c&&0===u){let g=Math.round(r*d+p),v=Math.round(l*_+f),m=Math.abs(Math.round((r+o)*d+p)-g)||1,b=Math.abs(Math.round((l+h)*_+f)-v)||1;return t.setTransform(Math.sign(d),0,0,Math.sign(_),g,v),t.drawImage(e,i,s,a,n,0,0,m,b),t.setTransform(d,c,u,_,p,f),[m,b]}if(0===d&&0===_){let g=Math.round(l*u+p),v=Math.round(r*c+f),m=Math.abs(Math.round((l+h)*u+p)-g)||1,b=Math.abs(Math.round((r+o)*c+f)-v)||1;return t.setTransform(0,Math.sign(c),Math.sign(u),0,g,v),t.drawImage(e,i,s,a,n,0,0,b,m),t.setTransform(d,c,u,_,p,f),[b,m]}return t.drawImage(e,i,s,a,n,r,l,o,h),[Math.hypot(d,c)*o,Math.hypot(u,_)*h]}class aV{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]=$.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=$.applyTransform(e,t),s=$.applyTransform(e.slice(2),t),a=$.applyTransform([e[0],e[3]],t),n=$.applyTransform([e[2],e[1]],t);this.minX=Math.min(this.minX,i[0],s[0],a[0],n[0]),this.minY=Math.min(this.minY,i[1],s[1],a[1],n[1]),this.maxX=Math.max(this.maxX,i[0],s[0],a[0],n[0]),this.maxY=Math.max(this.maxY,i[1],s[1],a[1],n[1])}updateScalingPathMinMax(t,e){$.scaleMinMax(t,e),this.minX=Math.min(this.minX,e[0]),this.minY=Math.min(this.minY,e[1]),this.maxX=Math.max(this.maxX,e[2]),this.maxY=Math.max(this.maxY,e[3])}updateCurvePathMinMax(t,e,i,s,a,n,r,l,o,h){let d=$.bezierBoundingBox(e,i,s,a,n,r,l,o,h);!h&&this.updateRectMinMax(t,d)}getPathBoundingBox(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:aD.FILL,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=[this.minX,this.minY,this.maxX,this.maxY];if(t===aD.STROKE){e||W("Stroke bounding box must include transform.");let t=$.singularValueDecompose2dScale(e),s=t[0]*this.lineWidth/2,a=t[1]*this.lineWidth/2;i[0]-=s,i[1]-=a,i[2]+=s,i[3]+=a}return i}updateClipFromPath(){let t=$.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(t){this.clipBox=t,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:aD.FILL,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return $.intersect(this.clipBox,this.getPathBoundingBox(t,e))}constructor(t,e){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=b,this.textMatrixScale=1,this.fontMatrix=w,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=E.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps="none",this.startNewPathAndClipBox([0,0,t,e])}}function aq(t,e){let i,s,a,n;if("undefined"!=typeof ImageData&&e instanceof ImageData){t.putImageData(e,0,0);return}let r=e.height,l=e.width,o=r%16,h=(r-o)/16,d=0===o?h:h+1,c=t.createImageData(l,16),u=0,_,p=e.data,f=c.data;if(e.kind===M.GRAYSCALE_1BPP){let e=p.byteLength,n=new Uint32Array(f.buffer,0,f.byteLength>>2),r=n.length,g=l+7>>3,v=J.isLittleEndian?0xff000000:255;for(i=0;i<d;i++){for(s=0,a=i<h?16:o,_=0;s<a;s++){let t=e-u,i=0,s=t>g?l:8*t-7,a=-8&s,r=0,o=0;for(;i<a;i+=8)o=p[u++],n[_++]=128&o?0xffffffff:v,n[_++]=64&o?0xffffffff:v,n[_++]=32&o?0xffffffff:v,n[_++]=16&o?0xffffffff:v,n[_++]=8&o?0xffffffff:v,n[_++]=4&o?0xffffffff:v,n[_++]=2&o?0xffffffff:v,n[_++]=1&o?0xffffffff:v;for(;i<s;i++)0===r&&(o=p[u++],r=128),n[_++]=o&r?0xffffffff:v,r>>=1}for(;_<r;)n[_++]=0;t.putImageData(c,0,16*i)}}else if(e.kind===M.RGBA_32BPP){for(i=0,s=0,n=64*l;i<h;i++)f.set(p.subarray(u,u+n)),u+=n,t.putImageData(c,0,s),s+=16;i<d&&(n=l*o*4,f.set(p.subarray(u,u+n)),t.putImageData(c,0,s))}else if(e.kind===M.RGB_24BPP)for(i=0,n=l*(a=16);i<d;i++){for(i>=h&&(n=l*(a=o)),_=0,s=n;s--;)f[_++]=p[u++],f[_++]=p[u++],f[_++]=p[u++],f[_++]=255;t.putImageData(c,0,16*i)}else throw Error("bad image kind: ".concat(e.kind))}function aK(t,e){if(e.bitmap){t.drawImage(e.bitmap,0,0);return}
1let i=e.height,s=e.width,a=i%16,n=(i-a)/16,r=0===a?n:n+1,l=t.createImageData(s,16),o=0,h=e.data,d=l.data;for(let e=0;e<r;e++){let i=e<n?16:a;({srcPos:o}=function(t){let{src:e,srcPos:i=0,dest:s,width:a,height:n,nonBlackColor:r=0xffffffff,inverseDecode:l=!1}=t,o=J.isLittleEndian?0xff000000:255,[h,d]=l?[r,o]:[o,r],c=a>>3,u=7&a,_=e.length;s=new Uint32Array(s.buffer);let p=0;for(let t=0;t<n;t++){for(let t=i+c;i<t;i++){let t=i<_?e[i]:255;s[p++]=128&t?d:h,s[p++]=64&t?d:h,s[p++]=32&t?d:h,s[p++]=16&t?d:h,s[p++]=8&t?d:h,s[p++]=4&t?d:h,s[p++]=2&t?d:h,s[p++]=1&t?d:h}if(0===u)continue;let t=i<_?e[i++]:255;for(let e=0;e<u;e++)s[p++]=t&1<<7-e?d:h}return{srcPos:i,destPos:p}}({src:h,srcPos:o,dest:d,width:s,height:i,nonBlackColor:0})),t.putImageData(l,0,16*e)}}function aX(t,e){for(let i of["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"])void 0!==t[i]&&(e[i]=t[i]);void 0!==t.setLineDash&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function aY(t){if(t.strokeStyle=t.fillStyle="#000000",t.fillRule="nonzero",t.globalAlpha=1,t.lineWidth=1,t.lineCap="butt",t.lineJoin="miter",t.miterLimit=10,t.globalCompositeOperation="source-over",t.font="10px sans-serif",void 0!==t.setLineDash&&(t.setLineDash([]),t.lineDashOffset=0),!m){let{filter:e}=t;"none"!==e&&""!==e&&(t.filter="none")}}function aQ(t,e){if(e)return!0;let i=$.singularValueDecompose2dScale(t);i[0]=Math.fround(i[0]),i[1]=Math.fround(i[1]);let s=Math.fround((globalThis.devicePixelRatio||1)*to.PDF_TO_CSS_UNITS);return i[0]<=s&&i[1]<=s}let aJ=["butt","round","square"],aZ=["miter","round","bevel"],a$={},a0={};var a1=new WeakSet,a2=new WeakSet;class a3{getObject(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return"string"==typeof t?t.startsWith("g_")?this.commonObjs.get(t):this.objs.get(t):e}beginDrawing(t){let{transform:e,viewport:i,transparency:s=!1,background:a=null}=t,n=this.ctx.canvas.width,r=this.ctx.canvas.height,l=this.ctx.fillStyle;if(this.ctx.fillStyle=a||"#ffffff",this.ctx.fillRect(0,0,n,r),this.ctx.fillStyle=l,s){let t=this.cachedCanvases.getCanvas("transparent",n,r);this.compositeCtx=this.ctx,this.transparentCanvas=t.canvas,this.ctx=t.context,this.ctx.save(),this.ctx.transform(...tS(this.compositeCtx))}this.ctx.save(),aY(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...i.transform),this.viewportScale=i.scale,this.baseTransform=tS(this.ctx)}executeOperatorList(t,e,i,s){let a;let n=t.argsArray,r=t.fnArray,l=e||0,o=n.length;if(o===l)return l;let h=o-l>10&&"function"==typeof i,d=h?Date.now()+15:0,c=0,u=this.commonObjs,_=this.objs;for(;;){if(void 0!==s&&l===s.nextBreakPoint)return s.breakIt(l,i),l;if((a=r[l])!==L.dependency)this[a].apply(this,n[l]);else for(let t of n[l]){let e=t.startsWith("g_")?u:_;if(!e.has(t))return e.get(t,i),l}if(++l===o)return l;if(h&&++c>10){if(Date.now()>d)return i(),l;c=0}}}endDrawing(){for(let t of((0,l._)(this,a1,a5).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear(),this._cachedBitmapsMap.values())){for(let e of t.values())"undefined"!=typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),(0,l._)(this,a2,a6).call(this)}_scaleImage(t,e){var i,s;let a,n;let r=null!==(i=t.width)&&void 0!==i?i:t.displayWidth,l=null!==(s=t.height)&&void 0!==s?s:t.displayHeight,o=Math.max(Math.hypot(e[0],e[1]),1),h=Math.max(Math.hypot(e[2],e[3]),1),d=r,c=l,u="prescale1";for(;o>2&&d>1||h>2&&c>1;){let e=d,i=c;o>2&&d>1&&(e=d>=16384?Math.floor(d/2)-1||1:Math.ceil(d/2),o/=d/e),h>2&&c>1&&(i=c>=16384?Math.floor(c/2)-1||1:Math.ceil(c)/2,h/=c/i),(n=(a=this.cachedCanvases.getCanvas(u,e,i)).context).clearRect(0,0,e,i),n.drawImage(t,0,0,d,c,0,0,e,i),t=a.canvas,d=e,c=i,u="prescale1"===u?"prescale2":"prescale1"}return{img:t,paintWidth:d,paintHeight:c}}_createMaskCanvas(t){let e,i,s,a;let n=this.ctx,{width:r,height:l}=t,o=this.current.fillColor,h=this.current.patternFill,d=tS(n);if((t.bitmap||t.data)&&t.count>1){let a=t.bitmap||t.data.buffer;i=JSON.stringify(h?d:[d.slice(0,4),o]),(e=this._cachedBitmapsMap.get(a))||(e=new Map,this._cachedBitmapsMap.set(a,e));let n=e.get(i);if(n&&!h)return{canvas:n,offsetX:Math.round(Math.min(d[0],d[2])+d[4]),offsetY:Math.round(Math.min(d[1],d[3])+d[5])};s=n}s||aK((a=this.cachedCanvases.getCanvas("maskCanvas",r,l)).context,t);let c=$.transform(d,[1/r,0,0,-1/l,0,0]);c=$.transform(c,[1,0,0,1,0,-l]);let[u,_,p,f]=$.getAxialAlignedBoundingBox([0,0,r,l],c),g=Math.round(p-u)||1,v=Math.round(f-_)||1,m=this.cachedCanvases.getCanvas("fillCanvas",g,v),b=m.context;b.translate(-u,-_),b.transform(...c),!s&&(s=(s=this._scaleImage(a.canvas,tx(b))).img,e&&h&&e.set(i,s)),b.imageSmoothingEnabled=aQ(tS(b),t.interpolate),aU(b,s,0,0,s.width,s.height,0,0,r,l),b.globalCompositeOperation="source-in";let w=$.transform(tx(b),[1,0,0,1,-u,-_]);
1return b.fillStyle=h?o.getPattern(n,this,w,aD.FILL):o,b.fillRect(0,0,r,l),e&&!h&&(this.cachedCanvases.delete("fillCanvas"),e.set(i,m.canvas)),{canvas:m.canvas,offsetX:Math.round(u),offsetY:Math.round(_)}}setLineWidth(t){t!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=t,this.ctx.lineWidth=t}setLineCap(t){this.ctx.lineCap=aJ[t]}setLineJoin(t){this.ctx.lineJoin=aZ[t]}setMiterLimit(t){this.ctx.miterLimit=t}setDash(t,e){let i=this.ctx;void 0!==i.setLineDash&&(i.setLineDash(t),i.lineDashOffset=e)}setRenderingIntent(t){}setFlatness(t){}setGState(t){for(let[e,i]of t)switch(e){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i[0],i[1]);break;case"CA":this.current.strokeAlpha=i;break;case"ca":this.current.fillAlpha=i,this.ctx.globalAlpha=i;break;case"BM":this.ctx.globalCompositeOperation=i;break;case"SMask":this.current.activeSMask=i?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(i)}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){let t=this.inSMaskMode;this.current.activeSMask&&!t?this.beginSMaskMode():!this.current.activeSMask&&t&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw Error("beginSMaskMode called while already in smask mode");let t=this.ctx.canvas.width,e=this.ctx.canvas.height,i="smaskGroupAt"+this.groupLevel,s=this.cachedCanvases.getCanvas(i,t,e);this.suspendedCtx=this.ctx,this.ctx=s.context;let a=this.ctx;a.setTransform(...tS(this.suspendedCtx)),aX(this.suspendedCtx,a),function(t,e){if(t._removeMirroring)throw Error("Context is already forwarding operations.");t.__originalSave=t.save,t.__originalRestore=t.restore,t.__originalRotate=t.rotate,t.__originalScale=t.scale,t.__originalTranslate=t.translate,t.__originalTransform=t.transform,t.__originalSetTransform=t.setTransform,t.__originalResetTransform=t.resetTransform,t.__originalClip=t.clip,t.__originalMoveTo=t.moveTo,t.__originalLineTo=t.lineTo,t.__originalBezierCurveTo=t.bezierCurveTo,t.__originalRect=t.rect,t.__originalClosePath=t.closePath,t.__originalBeginPath=t.beginPath,t._removeMirroring=()=>{t.save=t.__originalSave,t.restore=t.__originalRestore,t.rotate=t.__originalRotate,t.scale=t.__originalScale,t.translate=t.__originalTranslate,t.transform=t.__originalTransform,t.setTransform=t.__originalSetTransform,t.resetTransform=t.__originalResetTransform,t.clip=t.__originalClip,t.moveTo=t.__originalMoveTo,t.lineTo=t.__originalLineTo,t.bezierCurveTo=t.__originalBezierCurveTo,t.rect=t.__originalRect,t.closePath=t.__originalClosePath,t.beginPath=t.__originalBeginPath,delete t._removeMirroring},t.save=function(){e.save(),this.__originalSave()},t.restore=function(){e.restore(),this.__originalRestore()},t.translate=function(t,i){e.translate(t,i),this.__originalTranslate(t,i)},t.scale=function(t,i){e.scale(t,i),this.__originalScale(t,i)},t.transform=function(t,i,s,a,n,r){e.transform(t,i,s,a,n,r),this.__originalTransform(t,i,s,a,n,r)},t.setTransform=function(t,i,s,a,n,r){e.setTransform(t,i,s,a,n,r),this.__originalSetTransform(t,i,s,a,n,r)},t.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},t.rotate=function(t){e.rotate(t),this.__originalRotate(t)},t.clip=function(t){e.clip(t),this.__originalClip(t)},t.moveTo=function(t,i){e.moveTo(t,i),this.__originalMoveTo(t,i)},t.lineTo=function(t,i){e.lineTo(t,i),this.__originalLineTo(t,i)},t.bezierCurveTo=function(t,i,s,a,n,r){e.bezierCurveTo(t,i,s,a,n,r),this.__originalBezierCurveTo(t,i,s,a,n,r)},t.rect=function(t,i,s,a){e.rect(t,i,s,a),this.__originalRect(t,i,s,a)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}(a,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),aX(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let e=this.current.activeSMask,i=this.suspendedCtx;this.composeSMask(i,e,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore(
1)}composeSMask(t,e,i,s){let a=s[0],n=s[1],r=s[2]-a,l=s[3]-n;0!==r&&0!==l&&(this.genericComposeSMask(e.context,i,r,l,e.subtype,e.backdrop,e.transferMap,a,n,e.offsetX,e.offsetY),t.save(),t.globalAlpha=1,t.globalCompositeOperation="source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(i.canvas,0,0),t.restore())}genericComposeSMask(t,e,i,s,a,n,r,l,o,h,d){let c=t.canvas,u=l-h,_=o-d;if(n){let e=$.makeHexColor(...n);if(u<0||_<0||u+i>c.width||_+s>c.height){let t=this.cachedCanvases.getCanvas("maskExtension",i,s),a=t.context;a.drawImage(c,-u,-_),a.globalCompositeOperation="destination-atop",a.fillStyle=e,a.fillRect(0,0,i,s),a.globalCompositeOperation="source-over",c=t.canvas,u=_=0}else{t.save(),t.globalAlpha=1,t.setTransform(1,0,0,1,0,0);let a=new Path2D;a.rect(u,_,i,s),t.clip(a),t.globalCompositeOperation="destination-atop",t.fillStyle=e,t.fillRect(u,_,i,s),t.restore()}}e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0),"Alpha"===a&&r?e.filter=this.filterFactory.addAlphaFilter(r):"Luminosity"===a&&(e.filter=this.filterFactory.addLuminosityFilter(r));let p=new Path2D;p.rect(l,o,i,s),e.clip(p),e.globalCompositeOperation="destination-in",e.drawImage(c,u,_,i,s,l,o,i,s),e.restore()}save(){this.inSMaskMode?(aX(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();let t=this.current;this.stateStack.push(t),this.current=t.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),aX(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(t,e,i,s,a,n){this.ctx.transform(t,e,i,s,a,n),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i){let s,a;let n=this.ctx,r=this.current,l=r.x,o=r.y,h=tS(n),d=0===h[0]&&0===h[3]||0===h[1]&&0===h[2],c=d?i.slice(0):null;for(let i=0,u=0,_=t.length;i<_;i++)switch(0|t[i]){case L.rectangle:l=e[u++],o=e[u++];let _=e[u++],p=e[u++],f=l+_,g=o+p;n.moveTo(l,o),0===_||0===p?n.lineTo(f,g):(n.lineTo(f,o),n.lineTo(f,g),n.lineTo(l,g)),d||r.updateRectMinMax(h,[l,o,f,g]),n.closePath();break;case L.moveTo:l=e[u++],o=e[u++],n.moveTo(l,o),d||r.updatePathMinMax(h,l,o);break;case L.lineTo:l=e[u++],o=e[u++],n.lineTo(l,o),d||r.updatePathMinMax(h,l,o);break;case L.curveTo:s=l,a=o,l=e[u+4],o=e[u+5],n.bezierCurveTo(e[u],e[u+1],e[u+2],e[u+3],l,o),r.updateCurvePathMinMax(h,s,a,e[u],e[u+1],e[u+2],e[u+3],l,o,c),u+=6;break;case L.curveTo2:s=l,a=o,n.bezierCurveTo(l,o,e[u],e[u+1],e[u+2],e[u+3]),r.updateCurvePathMinMax(h,s,a,l,o,e[u],e[u+1],e[u+2],e[u+3],c),l=e[u+2],o=e[u+3],u+=4;break;case L.curveTo3:s=l,a=o,l=e[u+2],o=e[u+3],n.bezierCurveTo(e[u],e[u+1],l,o,l,o),r.updateCurvePathMinMax(h,s,a,e[u],e[u+1],l,o,l,o,c),u+=4;break;case L.closePath:n.closePath()}d&&r.updateScalingPathMinMax(h,c),r.setCurrentPoint(l,o)}closePath(){this.ctx.closePath()}stroke(){let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0],e=this.ctx,i=this.current.strokeColor;e.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"==typeof i&&(null==i?void 0:i.getPattern)?(e.save(),e.strokeStyle=i.getPattern(e,this,tx(e),aD.STROKE),this.rescaleAndStroke(!1),e.restore()):this.rescaleAndStroke(!0)),t&&this.consumePath(this.current.getClippedPathBoundingBox()),e.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(){let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0],e=this.ctx,i=this.current.fillColor,s=this.current.patternFill,a=!1;s&&(e.save(),e.fillStyle=i.getPattern(e,this,tx(e),aD.FILL),a=!0);let n=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==n&&(this.pendingEOFill?(e.fill("evenodd"),this.pendingEOFill=!1):e.fill()),a&&e.restore(),t&&this.consumePath(n)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=a$}eoClip(){this.pendingClip=a0}beginText(){this.current.textMatrix=b,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){let t=this.pendingTextPaths,e=this.ctx;if(void 0===t){e.beginPath();return}for(let i of(e.save(),e.beginPath(),t))e.setTransform(...i.transform),e.translate(i.x,i.y),i.addToPath(e,i.fontSize);
1e.restore(),e.clip(),e.beginPath(),delete this.pendingTextPaths}setCharSpacing(t){this.current.charSpacing=t}setWordSpacing(t){this.current.wordSpacing=t}setHScale(t){this.current.textHScale=t/100}setLeading(t){this.current.leading=-t}setFont(t,e){var i;let s=this.commonObjs.get(t),a=this.current;if(!s)throw Error("Can't find font for ".concat(t));if(a.fontMatrix=s.fontMatrix||w,(0===a.fontMatrix[0]||0===a.fontMatrix[3])&&F("Invalid font matrix for font "+t),e<0?(e=-e,a.fontDirection=-1):a.fontDirection=1,this.current.font=s,this.current.fontSize=e,s.isType3Font)return;let n=s.loadedName||"sans-serif",r=(null===(i=s.systemFontInfo)||void 0===i?void 0:i.css)||'"'.concat(n,'", ').concat(s.fallbackName),l="normal";s.black?l="900":s.bold&&(l="bold");let o=s.italic?"italic":"normal",h=e;e<16?h=16:e>100&&(h=100),this.current.fontSizeScale=e/h,this.ctx.font="".concat(o," ").concat(l," ").concat(h,"px ").concat(r)}setTextRenderingMode(t){this.current.textRenderingMode=t}setTextRise(t){this.current.textRise=t}moveText(t,e){this.current.x=this.current.lineX+=t,this.current.y=this.current.lineY+=e}setLeadingMoveText(t,e){this.setLeading(-e),this.moveText(t,e)}setTextMatrix(t,e,i,s,a,n){this.current.textMatrix=[t,e,i,s,a,n],this.current.textMatrixScale=Math.hypot(t,e),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(t,e,i,s){let a;let n=this.ctx,r=this.current,l=r.font,o=r.textRenderingMode,h=r.fontSize/r.fontSizeScale,d=o&E.FILL_STROKE_MASK,c=!!(o&E.ADD_TO_PATH_FLAG),u=r.patternFill&&!l.missingFile;(l.disableFontFace||c||u)&&(a=l.getPathGenerator(this.commonObjs,t)),l.disableFontFace||u?(n.save(),n.translate(e,i),n.beginPath(),a(n,h),s&&n.setTransform(...s),(d===E.FILL||d===E.FILL_STROKE)&&n.fill(),(d===E.STROKE||d===E.FILL_STROKE)&&n.stroke(),n.restore()):((d===E.FILL||d===E.FILL_STROKE)&&n.fillText(t,e,i),(d===E.STROKE||d===E.FILL_STROKE)&&n.strokeText(t,e,i)),c&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:tS(n),x:e,y:i,fontSize:h,addToPath:a})}get isFontSubpixelAAEnabled(){let{context:t}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);t.scale(1.5,1),t.fillText("I",0,10);let e=t.getImageData(0,0,10,10).data,i=!1;for(let t=3;t<e.length;t+=4)if(e[t]>0&&e[t]<255){i=!0;break}return H(this,"isFontSubpixelAAEnabled",i)}showText(t){let e;let i=this.current,s=i.font;if(s.isType3Font)return this.showType3Text(t);let a=i.fontSize;if(0===a)return;let n=this.ctx,r=i.fontSizeScale,l=i.charSpacing,o=i.wordSpacing,h=i.fontDirection,d=i.textHScale*h,c=t.length,u=s.vertical,_=u?1:-1,p=s.defaultVMetrics,f=a*i.fontMatrix[0],g=i.textRenderingMode===E.FILL&&!s.disableFontFace&&!i.patternFill;if(n.save(),n.transform(...i.textMatrix),n.translate(i.x,i.y+i.textRise),h>0?n.scale(d,-1):n.scale(d,1),i.patternFill){n.save();let t=i.fillColor.getPattern(n,this,tx(n),aD.FILL);e=tS(n),n.restore(),n.fillStyle=t}let v=i.lineWidth,m=i.textMatrixScale;if(0===m||0===v){let t=i.textRenderingMode&E.FILL_STROKE_MASK;(t===E.STROKE||t===E.FILL_STROKE)&&(v=this.getSinglePixelWidth())}else v/=m;if(1!==r&&(n.scale(r,r),v/=r),n.lineWidth=v,s.isInvalidPDFjsFont){let e=[],s=0;for(let i of t)e.push(i.unicode),s+=i.width;n.fillText(e.join(""),0,0),i.x+=s*f*d,n.restore(),this.compose();return}let b=0,w;for(w=0;w<c;++w){let i,d;let c=t[w];if("number"==typeof c){b+=_*c*a/1e3;continue}let v=!1,m=(c.isSpace?o:0)+l,A=c.fontChar,y=c.accent,k=c.width;if(u){let t=c.vmetric||p,e=-(c.vmetric?t[1]:.5*k)*f,s=t[2]*f;k=t?-t[0]:k,i=e/r,d=(b+s)/r}else i=b/r,d=0;if(s.remeasure&&k>0){let t=1e3*n.measureText(A).width/a*r;if(k<t&&this.isFontSubpixelAAEnabled){let e=k/t;v=!0,n.save(),n.scale(e,1),i/=e}else k!==t&&(i+=(k-t)/2e3*a/r)}if(this.contentVisible&&(c.isInFont||s.missingFile)){if(g&&!y)n.fillText(A,i,d);else if(this.paintChar(A,i,d,e),y){let t=i+a*y.offset.x/r,s=d-a*y.offset.y/r;this.paintChar(y.fontChar,t,s,e)}}b+=u?k*f-m*h:k*f+m*h,v&&n.restore()}u?i.y-=b:i.x+=b*d,n.restore(),this.compose()}showType3Text(t){let e,i,s,a;let n=this.ctx,r=this.current,l=r.font,o=r.fontSize,h=r.fontDirection,d=l.vertical?1:-1,c=r.charSpacing,u=r.wordSpacing,_=r.textHScale*h,p=r.fontMatrix||w,f=t.length;if(r.textRenderingMode!==E.INVISIBLE&&0!==o){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,n.save(),n.transform(...r.textMatrix),n.translate(r.x,r.y),n.scale(_,h),e=0;e<f;++e){if("number"==typeof(i=t[e])){a=d*i*o/1e3,this.ctx.translate(a,0),r.x+=a*_;continue}let h=(i.isSpace?u:0)+c,f=l.charProcOperatorList[i.operatorListId];if(!f){F('Type3 character "'.concat(i.operatorListId,'" is not available.'));continue}this.contentVisible&&(this.processingType3=i,this.save(),n.scale(o,o),n.transform(...p),this.executeOperatorList(f),this.restore(
1)),s=$.applyTransform([i.width,0],p)[0]*o+h,n.translate(s,0),r.x+=s*_}n.restore(),this.processingType3=null}}setCharWidth(t,e){}setCharWidthAndBounds(t,e,i,s,a,n){this.ctx.rect(i,s,a-i,n-s),this.ctx.clip(),this.endPath()}getColorN_Pattern(t){let e;if("TilingPattern"===t[0]){let i=t[1],s=this.baseTransform||tS(this.ctx);e=new az(t,i,this.ctx,{createCanvasGraphics:t=>new a3(t,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})},s)}else e=this._getPattern(t[1],t[2]);return e}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(t,e,i){this.ctx.strokeStyle=this.current.strokeColor=$.makeHexColor(t,e,i)}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent"}setFillRGBColor(t,e,i){this.ctx.fillStyle=this.current.fillColor=$.makeHexColor(t,e,i),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.cachedPatterns.has(t)?e=this.cachedPatterns.get(t):(e=function(t){switch(t[0]){case"RadialAxial":return new aN(t);case"Mesh":return new aH(t);case"Dummy":return new aB}throw Error("Unknown IR type: ".concat(t[0]))}(this.getObject(t)),this.cachedPatterns.set(t,e)),i&&(e.matrix=i),e}shadingFill(t){if(!this.contentVisible)return;let e=this.ctx;this.save(),e.fillStyle=this._getPattern(t).getPattern(e,this,tx(e),aD.SHADING);let i=tx(e);if(i){let{width:t,height:s}=e.canvas,[a,n,r,l]=$.getAxialAlignedBoundingBox([0,0,t,s],i);this.ctx.fillRect(a,n,r-a,l-n)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){W("Should not call beginInlineImage")}beginImageData(){W("Should not call beginImageData")}paintFormXObjectBegin(t,e){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),t&&this.transform(...t),this.baseTransform=tS(this.ctx),e)){let t=e[2]-e[0],i=e[3]-e[1];this.ctx.rect(e[0],e[1],t,i),this.current.updateRectMinMax(tS(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||D("TODO: Support non-isolated groups."),t.knockout&&F("Knockout groups not supported.");let i=tS(e);if(t.matrix&&e.transform(...t.matrix),!t.bbox)throw Error("Bounding box is required.");let s=$.getAxialAlignedBoundingBox(t.bbox,tS(e)),a=[0,0,e.canvas.width,e.canvas.height],n=Math.floor((s=$.intersect(s,a)||[0,0,0,0])[0]),r=Math.floor(s[1]),l=Math.max(Math.ceil(s[2])-n,1),o=Math.max(Math.ceil(s[3])-r,1);this.current.startNewPathAndClipBox([0,0,l,o]);let h="groupAt"+this.groupLevel;t.smask&&(h+="_smask_"+this.smaskCounter++%2);let d=this.cachedCanvases.getCanvas(h,l,o),c=d.context;c.translate(-n,-r),c.transform(...i),t.smask?this.smaskStack.push({canvas:d.canvas,context:c,offsetX:n,offsetY:r,subtype:t.smask.subtype,backdrop:t.smask.backdrop,transferMap:t.smask.transferMap||null,startTransformInverse:null}):(e.setTransform(1,0,0,1,0,0),e.translate(n,r),e.save()),aX(e,c),this.ctx=c,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(e),this.groupLevel++}endGroup(t){if(!this.contentVisible)return;this.groupLevel--;let e=this.ctx,i=this.groupStack.pop();if(this.ctx=i,this.ctx.imageSmoothingEnabled=!1,t.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();let t=tS(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...t);let i=$.getAxialAlignedBoundingBox([0,0,e.canvas.width,e.canvas.height],t);this.ctx.drawImage(e.canvas,0,0),this.ctx.restore(),this.compose(i)}}beginAnnotation(t,e,i,s,a){if((0,l._)(this,a1,a5).call(this),aY(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),e){let s=e[2]-e[0],n=e[3]-e[1];if(a&&this.annotationCanvasMap){i=i.slice(),i[4]-=e[0],i[5]-=e[1],(e=e.slice())[0]=e[1]=0,e[2]=s,e[3]=n;let[a,r]=$.singularValueDecompose2dScale(tS(this.ctx)),{viewportScale:l}=this,o=Math.ceil(s*this.outputScaleX*l),h=Math.ceil(n*this.outputScaleY*l);this.annotationCanvas=this.canvasFactory.create(o,h);let{canvas:d,context:c}=this.annotationCanvas;this.annotationCanvasMap.set(t,d),this.annotationCanvas.savedCtx=this.ctx,this.ctx=c,this.ctx.save(),this.ctx.setTransform(a,0,0,-r,0,n*r),aY(this.ctx)}else aY(this.ctx),this.endPath(),this.ctx.rect(e[0],e[1],s,n),this.ctx.clip(),this.ctx.beginPath()}
1this.current=new aV(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...i),this.transform(...s)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),(0,l._)(this,a2,a6).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(t){if(!this.contentVisible)return;let e=t.count;(t=this.getObject(t.data,t)).count=e;let i=this.ctx,s=this.processingType3;if(s&&(void 0===s.compiled&&(s.compiled=function(t){let e,i,s;let{width:a,height:n}=t;if(a>1e3||n>1e3)return null;let r=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),l=a+1,o=new Uint8Array(l*(n+1)),h=a+7&-8,d=new Uint8Array(h*n),c=0;for(let e of t.data){let t=128;for(;t>0;)d[c++]=e&t?0:255,t>>=1}let u=0;for(0!==d[c=0]&&(o[0]=1,++u),i=1;i<a;i++)d[c]!==d[c+1]&&(o[i]=d[c]?2:1,++u),c++;for(0!==d[c]&&(o[i]=2,++u),e=1;e<n;e++){c=e*h,s=e*l,d[c-h]!==d[c]&&(o[s]=d[c]?1:8,++u);let t=4*!!d[c]+8*!!d[c-h];for(i=1;i<a;i++)r[t=(t>>2)+4*!!d[c+1]+8*!!d[c-h+1]]&&(o[s+i]=r[t],++u),c++;if(d[c-h]!==d[c]&&(o[s+i]=d[c]?2:4,++u),u>1e3)return null}for(c=h*(n-1),s=e*l,0!==d[c]&&(o[s]=8,++u),i=1;i<a;i++)d[c]!==d[c+1]&&(o[s+i]=d[c]?4:8,++u),c++;if(0!==d[c]&&(o[s+i]=4,++u),u>1e3)return null;let _=new Int32Array([0,l,-1,0,-l,0,0,0,1]),p=new Path2D;for(e=0;u&&e<=n;e++){let t=e*l,i=t+a;for(;t<i&&!o[t];)t++;if(t===i)continue;p.moveTo(t%l,e);let s=t,n=o[t];do{let e=_[n];do t+=e;while(!o[t]);let i=o[t];5!==i&&10!==i?(n=i,o[t]=0):(n=i&51*n>>4,o[t]&=n>>2|n<<2),p.lineTo(t%l,t/l|0),!o[t]&&--u}while(s!==t);--e}return d=null,o=null,function(t){t.save(),t.scale(1/a,-1/n),t.translate(0,-n),t.fill(p),t.beginPath(),t.restore()}}(t)),s.compiled)){s.compiled(i);return}let a=this._createMaskCanvas(t),n=a.canvas;i.save(),i.setTransform(1,0,0,1,0,0),i.drawImage(n,a.offsetX,a.offsetY),i.restore(),this.compose()}paintImageMaskXObjectRepeat(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4?arguments[4]:void 0,n=arguments.length>5?arguments[5]:void 0;if(!this.contentVisible)return;t=this.getObject(t.data,t);let r=this.ctx;r.save();let l=tS(r);r.transform(e,i,s,a,0,0);let o=this._createMaskCanvas(t);r.setTransform(1,0,0,1,o.offsetX-l[4],o.offsetY-l[5]);for(let t=0,h=n.length;t<h;t+=2){let h=$.transform(l,[e,i,s,a,n[t],n[t+1]]),[d,c]=$.applyTransform([0,0],h);r.drawImage(o.canvas,d,c)}r.restore(),this.compose()}paintImageMaskXObjectGroup(t){if(!this.contentVisible)return;let e=this.ctx,i=this.current.fillColor,s=this.current.patternFill;for(let a of t){let{data:t,width:n,height:r,transform:l}=a,o=this.cachedCanvases.getCanvas("maskCanvas",n,r),h=o.context;h.save(),aK(h,this.getObject(t,a)),h.globalCompositeOperation="source-in",h.fillStyle=s?i.getPattern(h,this,tx(e),aD.FILL):i,h.fillRect(0,0,n,r),h.restore(
1),e.save(),e.transform(...l),e.scale(1,-1),aU(e,o.canvas,0,0,n,r,0,-1,1,1),e.restore()}this.compose()}paintImageXObject(t){if(!this.contentVisible)return;let e=this.getObject(t);if(!e){F("Dependent image isn't ready yet");return}this.paintInlineImageXObject(e)}paintImageXObjectRepeat(t,e,i,s){if(!this.contentVisible)return;let a=this.getObject(t);if(!a){F("Dependent image isn't ready yet");return}let n=a.width,r=a.height,l=[];for(let t=0,a=s.length;t<a;t+=2)l.push({transform:[e,0,0,i,s[t],s[t+1]],x:0,y:0,w:n,h:r});this.paintInlineImageXObjectGroup(a,l)}applyTransferMapsToCanvas(t){return"none"!==this.current.transferMaps&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if("none"===this.current.transferMaps)return t.bitmap;let{bitmap:e,width:i,height:s}=t,a=this.cachedCanvases.getCanvas("inlineImage",i,s),n=a.context;return n.filter=this.current.transferMaps,n.drawImage(e,0,0),n.filter="none",a.canvas}paintInlineImageXObject(t){let e;if(!this.contentVisible)return;let i=t.width,s=t.height,a=this.ctx;if(this.save(),!m){let{filter:t}=a;"none"!==t&&""!==t&&(a.filter="none")}if(a.scale(1/i,-1/s),t.bitmap)e=this.applyTransferMapsToBitmap(t);else if("function"==typeof HTMLElement&&t instanceof HTMLElement||!t.data)e=t;else{let a=this.cachedCanvases.getCanvas("inlineImage",i,s).context;aq(a,t),e=this.applyTransferMapsToCanvas(a)}let n=this._scaleImage(e,tx(a));a.imageSmoothingEnabled=aQ(tS(a),t.interpolate),aU(a,n.img,0,0,n.paintWidth,n.paintHeight,0,-s,i,s),this.compose(),this.restore()}paintInlineImageXObjectGroup(t,e){let i;if(!this.contentVisible)return;let s=this.ctx;if(t.bitmap)i=t.bitmap;else{let e=t.width,s=t.height,a=this.cachedCanvases.getCanvas("inlineImage",e,s).context;aq(a,t),i=this.applyTransferMapsToCanvas(a)}for(let t of e)s.save(),s.transform(...t.transform),s.scale(1,-1),aU(s,i,t.x,t.y,t.w,t.h,0,-1,1,1),s.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t){}markPointProps(t,e){}beginMarkedContent(t){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e){"OC"===t?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(e)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(t){let e=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(t);let i=this.ctx;this.pendingClip&&(e||(this.pendingClip===a0?i.clip("evenodd"):i.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),i.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let t=tS(this.ctx);if(0===t[1]&&0===t[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{let e=Math.abs(t[0]*t[3]-t[2]*t[1]),i=Math.hypot(t[0],t[2]),s=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(i,s)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){let t,e;let{lineWidth:i}=this.current,{a:s,b:a,c:n,d:r}=this.ctx.getTransform();if(0===a&&0===n){let a=Math.abs(s),n=Math.abs(r);if(a===n){if(0===i)t=e=1/a;else{let s=a*i;t=e=s<1?1/s:1}}else if(0===i)t=1/a,e=1/n;else{let s=a*i,r=n*i;t=s<1?1/s:1,e=r<1?1/r:1}}else{let l=Math.abs(s*r-a*n),o=Math.hypot(s,a),h=Math.hypot(n,r);if(0===i)t=h/l,e=o/l;else{let s=i*l;t=h>s?h/s:1,e=o>s?o/s:1}}this._cachedScaleForStroking[0]=t,this._cachedScaleForStroking[1]=e}return this._cachedScaleForStroking}rescaleAndStroke(t){let{ctx:e}=this,{lineWidth:i}=this.current,[s,a]=this.getScaleForStroking();if(e.lineWidth=i||1,1===s&&1===a){e.stroke();return}let n=e.getLineDash();if(t&&e.save(),e.scale(s,a),n.length>0){let t=Math.max(s,a);e.setLineDash(n.map(e=>e/t)),e.lineDashOffset/=t}e.stroke(),t&&e.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}constructor(t,e,i,s,a,{optionalContentConfig:n,markedContentStack:r=null},l,h){(0,o._)(this,a1),(0,o._)(this,a2),this.ctx=t,this.current=ne
1w aV(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=e,this.objs=i,this.canvasFactory=s,this.filterFactory=a,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=r||[],this.optionalContentConfig=n,this.cachedCanvases=new aG(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}}function a5(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)}function a6(){if(this.pageColors){let t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==t){let e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}}for(let t in L)void 0!==a3.prototype[t]&&(a3.prototype[L[t]]=a3.prototype[t]);class a4{static get workerPort(){return(0,h._)(this,a4,a8)}static set workerPort(t){if(!("undefined"!=typeof Worker&&t instanceof Worker)&&null!==t)throw Error("Invalid `workerPort` type.");(0,d._)(this,a4,a8,t)}static get workerSrc(){return(0,h._)(this,a4,a7)}static set workerSrc(t){if("string"!=typeof t)throw Error("Invalid `workerSrc` type.");(0,d._)(this,a4,a7,t)}}var a8={writable:!0,value:null},a7={writable:!0,value:""};let a9={DATA:1,ERROR:2},nt={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function ne(t){switch(t instanceof Error||"object"==typeof t&&null!==t||W('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new K(t.message);case"MissingPDFException":return new U(t.message);case"PasswordException":return new j(t.message,t.code);case"UnexpectedResponseException":return new V(t.message,t.status);case"UnknownErrorException":return new z(t.message,t.details);default:return new z(t.message,t.toString())}}var ni=new WeakMap,ns=new WeakSet,na=new WeakSet,nn=new WeakSet,nr=new WeakSet;class nl{on(t,e){let i=this.actionHandler;if(i[t])throw Error('There is already an actionName called "'.concat(t,'"'));i[t]=e}send(t,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},i)}sendWithPromise(t,e,i){let s=this.callbackId++,a=Promise.withResolvers();this.callbackCapabilities[s]=a;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:s,data:e},i)}catch(t){a.reject(t)}return a.promise}sendWithStream(t,e,i,s){let a=this.streamId++,n=this.sourceName,r=this.targetName,l=this.comObj;return new ReadableStream({start:i=>{let o=Promise.withResolvers();return this.streamControllers[a]={controller:i,startCall:o,pullCall:null,cancelCall:null,isClosed:!1},l.postMessage({sourceName:n,targetName:r,action:t,streamId:a,data:e,desiredSize:i.desiredSize},s),o.promise},pull:t=>{let e=Promise.withResolvers();return this.streamControllers[a].pullCall=e,l.postMessage({sourceName:n,targetName:r,stream:nt.PULL,streamId:a,desiredSize:t.desiredSize}),e.promise},cancel:t=>{N(t instanceof Error,"cancel must have a valid reason");let e=Promise.withResolvers();return this.streamControllers[a].cancelCall=e,this.streamControllers[a].isClosed=!0,l.postMessage({sourceName:n,targetName:r,stream:nt.CANCEL,streamId:a,reason:ne(t)}),e.promise}},i)}destroy(){var t;null===(t=(0,s._)(this,ni))||void 0===t||t.abort(),(0,n._)(this,ni,null)}constructor(t,e,i){(0,o._)(this,ns),(0,o._)(this,na),(0,o._)(this,nn),(0,o._)(this,nr),(0,a._)(this,ni,{writable:!0,value:void 0}),(0,n._)(this,ni,new AbortController),this.sourceName=t,this.targetName=e,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),i.addEventListener("message",(0,l._)(this,ns,no).bind(this),{signal:(0,s._)(this,ni).signal})}}function no(t){let{data:e}=t;if(e.targetName!==this.sourceName)return;if(e.stream){(0,l._)(this,nn,nd).call(this,e);return}if(e.callback){let t=e.callbackId,i=this.callbackCapabilities[t];if(!i)throw Error("Cannot resolve callback ".concat(t));if(delete this.callbackCapabilities[t],e.callback===a9.DATA)i.resolve(e.data);else if(e.callback===a9.ERROR)i.reject(ne(e.reason));else throw Error("Unexpected callback case");return}let i=this.actionHandler[e.action];if(!i)throw Error("Unknown action from worker: ".concat(e.action));if(e.callbackId){let t=this.sourceName,s=e.sourceName,a=this.comObj;new Promise(function(t){t(i(e.data))}).then(function(i){a.postMessage({sourceName:t,targetName:s,callback:a9.DATA,callbackId:e.callbackId,data:i})},function(i){a.postMessage({sourceName:t,targetName:s,callback:a9.ERROR,callbackId:e.callbackId,reason:ne(i)})});return}if(e.streamId){(0,l._)(this,na,nh).call(this,e);return}i(e.data)}function nh(t){let e=t.streamId,i=this.sourceName,s=t.sourceName,a=this.comObj,n=this,r=this.actionHandler[t.action],l={enqueue(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2?arguments[2]:void 0;if(this.isCancelled)return;let l=this.desiredSize;this.desiredSize-=n,l>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),a.postMessage({sourceName:i,targetName:s,stream:nt.ENQUEUE,streamId:e,chunk:t},r)},close(){!this.isCancelled&&(this.isCancelled=!0,a.postMessage({sourceName:i,targetName:s,stream:nt.CLOSE,streamId:e}),delete n.streamSinks[e])},error(t){N(t instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,a.postMessage({sourceName:i,targetName:s,stream:nt.ERROR,streamId:e,reason:ne(t)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};l.sinkCapability.resolve(),l.ready=l.sinkCapability.promise,this.streamSinks[e]=l,new Promise(function(e){e(r(t.data,l))}).then(function(){a.postMessage({sourceName:i,targetName:s,stream:nt.START_COMPLETE,streamId:e,success:!0})},function(t){a.postMessage({sourceName:i,targetName:s,stream:nt.START_COMPLETE,streamId:e,reason:ne(t)})})}
1function nd(t){let e=t.streamId,i=this.sourceName,s=t.sourceName,a=this.comObj,n=this.streamControllers[e],r=this.streamSinks[e];switch(t.stream){case nt.START_COMPLETE:t.success?n.startCall.resolve():n.startCall.reject(ne(t.reason));break;case nt.PULL_COMPLETE:t.success?n.pullCall.resolve():n.pullCall.reject(ne(t.reason));break;case nt.PULL:if(!r){a.postMessage({sourceName:i,targetName:s,stream:nt.PULL_COMPLETE,streamId:e,success:!0});break}r.desiredSize<=0&&t.desiredSize>0&&r.sinkCapability.resolve(),r.desiredSize=t.desiredSize,new Promise(function(t){var e;t(null===(e=r.onPull)||void 0===e?void 0:e.call(r))}).then(function(){a.postMessage({sourceName:i,targetName:s,stream:nt.PULL_COMPLETE,streamId:e,success:!0})},function(t){a.postMessage({sourceName:i,targetName:s,stream:nt.PULL_COMPLETE,streamId:e,reason:ne(t)})});break;case nt.ENQUEUE:if(N(n,"enqueue should have stream controller"),n.isClosed)break;n.controller.enqueue(t.chunk);break;case nt.CLOSE:if(N(n,"close should have stream controller"),n.isClosed)break;n.isClosed=!0,n.controller.close(),(0,l._)(this,nr,nc).call(this,n,e);break;case nt.ERROR:N(n,"error should have stream controller"),n.controller.error(ne(t.reason)),(0,l._)(this,nr,nc).call(this,n,e);break;case nt.CANCEL_COMPLETE:t.success?n.cancelCall.resolve():n.cancelCall.reject(ne(t.reason)),(0,l._)(this,nr,nc).call(this,n,e);break;case nt.CANCEL:if(!r)break;new Promise(function(e){var i;e(null===(i=r.onCancel)||void 0===i?void 0:i.call(r,ne(t.reason)))}).then(function(){a.postMessage({sourceName:i,targetName:s,stream:nt.CANCEL_COMPLETE,streamId:e,success:!0})},function(t){a.postMessage({sourceName:i,targetName:s,stream:nt.CANCEL_COMPLETE,streamId:e,reason:ne(t)})}),r.sinkCapability.reject(ne(t.reason)),r.isCancelled=!0,delete this.streamSinks[e];break;default:throw Error("Unexpected stream case")}}async function nc(t,e){var i,s,a;await Promise.allSettled([null===(i=t.startCall)||void 0===i?void 0:i.promise,null===(s=t.pullCall)||void 0===s?void 0:s.promise,null===(a=t.cancelCall)||void 0===a?void 0:a.promise]),delete this.streamControllers[e]}var nu=new WeakMap,n_=new WeakMap;class np{getRaw(){return(0,s._)(this,n_)}get(t){var e;return null!==(e=(0,s._)(this,nu).get(t))&&void 0!==e?e:null}getAll(){return Q((0,s._)(this,nu))}has(t){return(0,s._)(this,nu).has(t)}constructor({parsedData:t,rawData:e}){(0,a._)(this,nu,{writable:!0,value:void 0}),(0,a._)(this,n_,{writable:!0,value:void 0}),(0,n._)(this,nu,t),(0,n._)(this,n_,e)}}let nf=Symbol("INTERNAL");var ng=new WeakMap,nv=new WeakMap,nm=new WeakMap,nb=new WeakMap;class nw{get visible(){if((0,s._)(this,nm))return(0,s._)(this,nb);if(!(0,s._)(this,nb))return!1;let{print:t,view:e}=this.usage;return(0,s._)(this,ng)?(null==e?void 0:e.viewState)!=="OFF":!(0,s._)(this,nv)||(null==t?void 0:t.printState)!=="OFF"}_setVisible(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t!==nf&&W("Internal method `_setVisible` called."),(0,n._)(this,nm,i),(0,n._)(this,nb,e)}constructor(t,{name:e,intent:i,usage:s,rbGroups:r}){(0,a._)(this,ng,{writable:!0,value:void 0}),(0,a._)(this,nv,{writable:!0,value:void 0}),(0,a._)(this,nm,{writable:!0,value:void 0}),(0,a._)(this,nb,{writable:!0,value:void 0}),(0,n._)(this,ng,!1),(0,n._)(this,nv,!1),(0,n._)(this,nm,!1),(0,n._)(this,nb,!0),(0,n._)(this,ng,!!(t&A.DISPLAY)),(0,n._)(this,nv,!!(t&A.PRINT)),this.name=e,this.intent=i,this.usage=s,this.rbGroups=r}}var nA=new WeakMap,ny=new WeakMap,nk=new WeakMap,nS=new WeakMap,nx=new WeakSet;class nE{isVisible(t){if(0===(0,s._)(this,ny).size)return!0;if(!t)return D("Optional content group not defined."),!0;if("OCG"===t.type)return(0,s._)(this,ny).has(t.id)?(0,s._)(this,ny).get(t.id).visible:(F("Optional content group not found: ".concat(t.id)),!0);if("OCMD"===t.type){if(t.expression)return(0,l._)(this,nx,nM).call(this,t.expression);if(t.policy&&"AnyOn"!==t.policy){if("AllOn"===t.policy){for(let e of t.ids){if(!(0,s._)(this,ny).has(e)){F("Optional content group not found: ".concat(e));break}if(!(0,s._)(this,ny).get(e).visible)return!1}return!0}if("AnyOff"===t.policy){for(let e of t.ids){if(!(0,s._)(this,ny).has(e))return F("Optional content group not found: ".concat(e)),!0;if(!(0,s._)(this,ny).get(e).visible)return!0}return!1}else if("AllOff"===t.policy){for(let e of t.ids){if(!(0,s._)(this,ny).has(e)){F("Optional content group not found: ".concat(e));break}if((0,s._)(this,ny).get(e).visible)return!1}return!0}}else{for(let e of t.ids){if(!(0,s._)(this,ny).has(e))return F("Optional content group not found: ".concat(e)),!0;if((0,s._)(this,ny).get(e).visible)return!0}return!1}return F("Unknown optional content policy ".concat(t.policy,".")),!0}return F("Unknown group type ".concat(t.type,".")),!0}setVisibility(t){let e=!(arguments.length>1)||void 0===arguments[1]||arguments[1],i=!(arguments.length>2)||void 0===arguments[2]||arguments[2],a=(0,s._)(this,ny).get(t);if(!a){F("Optional content group not found: ".concat(t));return}if(i&&e&&a.rbGroups.length){for(let e of a.rbGroups)for(let i of e)if(i!==t){var r;null===(r=(0,s._)(this,ny).get(i))||void 0===r||r._setVisible(nf,!1,!0)}}a._setVisible(nf,!!e,!0),(0,n._)(this,nA,null)}setOCGState(t){let e,{state:i,preserveRB:a}=t;for(let t of i){switch(t){case"ON":case"OFF":case"Toggle":e=t;continue}let i=(0,s._)(this,ny).get(t);if(i)switch(e){case"ON":this.setVisibility(t,!0,a);break;case"OFF":this.setVisibility(t,!1,a);break;case"Toggle":this.setVisibility(t,!i.visible,a)}}(0,n._)(this,nA,null)}get hasInitialVisibility(){return null===(0,s._)(this,nk)||this.getHash()===(0,s._)(this,nk)}getOrder(){return(0,s._)(this,ny).size?(0,s._)(this,nS)?(0,s._)(this,nS).slice():[...(0,s._)(this,ny).keys()]:null}getGroups(){return(0,s._)(this,ny).size>0?Q((0,s._)(this,ny)):null}getGroup(t){return(0,s._)(this,ny).get(t)||null}getHash(){if(null!==(0,s._)(this,nA))return(0,s._)(this,nA);let t=new sN;for(let[e,i]of(0,s._)(this,ny))t.update("".concat(e,":").concat(i.visible));return(0,n._)(this,nA,t.hexdigest())}constructor(t,e=A.DISPLAY){if((0,o._)(this,nx),(0,a._)(this,nA,{writable:!0,value:void 0}),(0,a._)(this,ny,{writable:!0,value:void 0}),(0,a._)(this,nk,{writable:!0,value:void 0}),(0,a._)(this,nS,{writable:!0,value:void 0}),(0,n._)(this,nA,null),(0,n._)(this,ny,new Map),(0,n._)(this,nk,null),(0,n._)(this,nS,null),this.renderingIntent=e,this.name=null,this.creator=null,null===t)return;for(let i of(this.name=t.name,this.creator=t.creator,(0,n._)(this,nS,t.order),t.groups))(0,s._)(this,ny).set(i.id,new nw(e,i));if("OFF"===t.baseState)for(let t of(0,s._)(this,ny).values())t._setVisible(nf,!1);for(let e of t.on)(0,s._)(this,ny).get(e)._setVisible(nf,!0);for(let e of t.off)(0,s._)(this,ny).get(e)._setVisible(nf,!1);(0,n._)(this,nk,this.getHash())}}function nM(t){let e=t.length;if(e<2)return!0;let i=t[0];for(let a=1;a<e;a++){let e;let n=t[a];if(Array.isArray(n))e=(0,l._)(this,nx,nM).call(this,n);else{if(!(0,s._)(this,ny).has(n))return F("Optional content group not found: ".concat(n)),!0;e=(0,s._)(this,ny).get(n).visible}switch(i){case"And":if(!e)return!1;break;case"Or":if(e)return!0;break;case"Not":return!e;default:return!0}}return"And"===i}class nC{_onReceiveData(t){let{begin:e,chunk:i}=t,s=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;void 0===e?this._fullRequestReader?this._fullRequestReader._enqueue(s):this._queuedChunks.push(s):N(this._rangeReaders.some(function(t){return t._begin===e&&(t._enqueue(s),!0)}),"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}get _progressiveDataLength(){var t,e;return null!==(e=null===(t=this._fullRequestReader)||void 0===t?void 0:t._loaded)&&void 0!==e?e:0}_onProgress(t){var e,i,s,a;void 0===t.total?null===(i=this._rangeReaders[0])||void 0===i||null===(e=i.onProgress)||void 0===e||e.call(i,{loaded:t.loaded}):null===(a=this._fullRequestReader)||void 0===a||null===(s=a.onProgress)||void 0===s||s.call(a,{loaded:t.loaded,total:t.total})}_onProgressiveDone(){var t;null===(t=this._fullRequestReader)||void 0===t||t.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(t){let e=this._rangeReaders.indexOf(t);e>=0&&this._rangeReaders.splice(e,1)}getFullReader(){N(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");let t=this._queuedChunks;return this._queuedChunks=null,new nT(this,t,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=new nR(this,t,e);return this._pdfDataRangeTransport.requestDataRange(t,e),this._rangeReaders.push(i),i}cancelAllRequests(t){var e;
1for(let i of(null===(e=this._fullRequestReader)||void 0===e||e.cancel(t),this._rangeReaders.slice(0)))i.cancel(t);this._pdfDataRangeTransport.abort()}constructor(t,{disableRange:e=!1,disableStream:i=!1}){N(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');let{length:s,initialData:a,progressiveDone:n,contentDispositionFilename:r}=t;if(this._queuedChunks=[],this._progressiveDone=n,this._contentDispositionFilename=r,(null==a?void 0:a.length)>0){let t=a instanceof Uint8Array&&a.byteLength===a.buffer.byteLength?a.buffer:new Uint8Array(a).buffer;this._queuedChunks.push(t)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!i,this._isRangeSupported=!e,this._contentLength=s,this._fullRequestReader=null,this._rangeReaders=[],t.addRangeListener((t,e)=>{this._onReceiveData({begin:t,chunk:e})}),t.addProgressListener((t,e)=>{this._onProgress({loaded:t,total:e})}),t.addProgressiveReadListener(t=>{this._onReceiveData({chunk:t})}),t.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),t.transportReady()}}class nT{_enqueue(t){!this._done&&(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){for(let t of(this._done=!0,this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){!this._done&&(this._done=!0)}constructor(t,e,i=!1,s=null){for(let a of(this._stream=t,this._done=i||!1,this._filename=t_(s)?s:null,this._queuedChunks=e||[],this._loaded=0,this._queuedChunks))this._loaded+=a.byteLength;this._requests=[],this._headersReady=Promise.resolve(),t._fullRequestReader=this,this.onProgress=null}}class nR{_enqueue(t){if(!this._done){if(0===this._requests.length)this._queuedChunk=t;else{for(let e of(this._requests.shift().resolve({value:t,done:!1}),this._requests))e.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){let t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){for(let t of(this._done=!0,this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}constructor(t,e,i){this._stream=t,this._begin=e,this._end=i,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}}function nL(t,e){let i=new Headers;if(!t||!e||"object"!=typeof e)return i;for(let t in e){let s=e[t];void 0!==s&&i.append(t,s)}return i}function nI(t){let{responseHeaders:e,isHttp:i,rangeChunkSize:s,disableRange:a}=t,n={allowRangeRequests:!1,suggestedLength:void 0},r=parseInt(e.get("Content-Length"),10);return Number.isInteger(r)&&(n.suggestedLength=r,r<=2*s||a||!i||"bytes"!==e.get("Accept-Ranges")||"identity"!==(e.get("Content-Encoding")||"identity")||(n.allowRangeRequests=!0)),n}function nP(t){let e=t.get("Content-Disposition");if(e){let t=function(t){let e=!0,i=s("filename\\*","i").exec(t);if(i){let t=r(i=i[1]);return n(t=o(t=l(t=unescape(t))))}if(i=function(t){let e;let i=[],a=s("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(e=a.exec(t));){let[,t,s,a]=e;if((t=parseInt(t,10))in i){if(0===t)break;continue}i[t]=[s,a]}let n=[];for(let t=0;t<i.length&&t in i;++t){let[e,s]=i[t];s=r(s),e&&(s=unescape(s),0===t&&(s=l(s))),n.push(s)}return n.join("")}(t))return n(o(i));if(i=s("filename","i").exec(t)){let t=r(i=i[1]);return n(t=o(t))}function s(t,e){return RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',e)}function a(t,i){if(t){if(!/^[\x00-\xFF]+$/.test(i))return i;try{let s=new TextDecoder(t,{fatal:!0}),a=Y(i);i=s.decode(a),e=!1}catch(t){}}return i}function n(t){return e&&/[\x80-\xff]/.test(t)&&(t=a("utf-8",t),e&&(t=a("iso-8859-1",t))),t}function r(t){if(t.startsWith('"')){let e=t.slice(1).split('\\"');for(let t=0;t<e.length;++t){let i=e[t].indexOf('"');-1!==i&&(e[t]=e[t].slice(0,i),e.length=t+1),e[t]=e[t].replaceAll(/\\(.)/g,"$1")}t=e.join('"')}return t}function l(t){let e=t.indexOf("'");return -1===e?t:a(t.slice(0,e),t.slice(e+1).replace(/^[^']*'/,""))}function o(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(t,e,
1i,s){if("q"===i||"Q"===i)return a(e,s=(s=s.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,function(t,e){return String.fromCharCode(parseInt(e,16))}));try{s=atob(s)}catch(t){}return a(e,s)})}return""}(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch(t){}if(t_(t))return t}return null}function nD(t,e){return 404===t||0===t&&e.startsWith("file:")?new U('Missing PDF "'+e+'".'):new V("Unexpected server response (".concat(t,') while retrieving PDF "').concat(e,'".'),t)}function nF(t){return 200===t||206===t}function nW(t,e,i){return{method:"GET",headers:t,signal:i.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function nN(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(F("getArrayBuffer - unexpected data format: ".concat(t)),new Uint8Array(t).buffer)}class nO{get _progressiveDataLength(){var t,e;return null!==(e=null===(t=this._fullRequestReader)||void 0===t?void 0:t._loaded)&&void 0!==e?e:0}getFullReader(){return N(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new nH(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=new nB(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;for(let i of(null===(e=this._fullRequestReader)||void 0===e||e.cancel(t),this._rangeRequestReaders.slice(0)))i.cancel(t)}constructor(t){this.source=t,this.isHttp=/^https?:/i.test(t.url),this.headers=nL(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}}class nH{get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;await this._headersCapability.promise;let{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded,total:this._contentLength}),{value:nN(e),done:!1})}cancel(t){var e;null===(e=this._reader)||void 0===e||e.cancel(t),this._abortController.abort()}constructor(t){this._stream=t,this._reader=null,this._loaded=0,this._filename=null;let e=t.source;this._withCredentials=e.withCredentials||!1,this._contentLength=e.length,this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange;let i=new Headers(t.headers),s=e.url;fetch(s,nW(i,this._withCredentials,this._abortController)).then(e=>{if(!nF(e.status))throw nD(e.status,s);this._reader=e.body.getReader(),this._headersCapability.resolve();let i=e.headers,{allowRangeRequests:a,suggestedLength:n}=nI({responseHeaders:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=a,this._contentLength=n||this._contentLength,this._filename=nP(i),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new K("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}}class nB{get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;await this._readCapability.promise;let{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded}),{value:nN(e),done:!1})}cancel(t){var e;null===(e=this._reader)||void 0===e||e.cancel(t),this._abortController.abort()}constructor(t,e,i){this._stream=t,this._reader=null,this._loaded=0;let s=t.source;this._withCredentials=s.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!s.disableStream,this._abortController=new AbortController;let a=new Headers(t.headers);a.append("Range","bytes=".concat(e,"-").concat(i-1));let n=s.url;fetch(n,nW(a,this._withCredentials,this._abortController)).then(t=>{if(!nF(t.status))throw nD(t.status,n);this._readCapability.resolve(),this._reader=t.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}}class nj{requestRange(t,e,i){let s={begin:t,end:e};for(let t in i)s[t]=i[t];return this.request(s)}requestFull(t){return this.request(t)}request(t){let e=new XMLHttpRequest,i=this.currXhrId++,s=this.pendingRequests[i]={xhr:e};for(let[t,i]of(e.open("GET",this.url),e.withCredentials=this.withCredentials,this.headers))e.setRequestHeader(t,i);return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range","bytes=".concat(t.begin,"-").concat(t.end-1)),s.expectedStatus=206):s.expectedStatus=200,e.responseType="arraybuffer",t.onError&&(e.onerror=function(i){t.onError(e.status)}),e.onreadystatechange=this.onStateChange.bind(this,i),e.onprogress=this.onProgress.bind(this,i),s.onHeadersReceived=t.onHeadersReceived,s.onDone=t.onDone,s.onError=t.onError,s.onProgress=t.onProgress,e.send(null),i}onProgress(t,e){var i;let s=this.pendingRequests[t];s&&(null===(i=s.onProgress)||void 0===i||i.call(s,e))}onStateChange(t,e){var i,s,a;let n=this.pendingRequests[t];if(!n)return;let r=n.xhr;if(r.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),4!==r.readyState||!(t in this.pendingRequests))return;if(delete this.pendingRequests[t],0===r.status&&this.isHttp){null===(i=n.onError)||void 0===i||i.call(n,r.status);return}let l=r.status||200;if((200!==l||206!==n.expectedStatus)&&l!==n.expectedStatus){null===(s=n.onError)||void 0===s||s.call(n,r.status);return}let o=function(t){let e=t.response;return"string"!=typeof e?e:Y(e).buffer}(r);if(206===l){let t=r.getResponseHeader("Content-Range"),e=/bytes (\d+)-(\d+)\/(\d+)/.exec(t);n.onDone({begin:parseInt(e[1],10),chunk:o})}else o?n.onDone({begin:0,chunk:o}):null===(a=n.onError)||void 0===a||a.call(n,r.status)}getRequestXhr(t){return this.pendingRequests[t].xhr}isPendingRequest(t){return t in this.pendingRequests}
1abortRequest(t){let e=this.pendingRequests[t].xhr;delete this.pendingRequests[t],e.abort()}constructor({url:t,httpHeaders:e,withCredentials:i}){this.url=t,this.isHttp=/^https?:/i.test(t),this.headers=nL(this.isHttp,e),this.withCredentials=i||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}}class nz{_onRangeRequestReaderClosed(t){let e=this._rangeRequestReaders.indexOf(t);e>=0&&this._rangeRequestReaders.splice(e,1)}getFullReader(){return N(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new nG(this._manager,this._source),this._fullRequestReader}getRangeReader(t,e){let i=new nU(this._manager,t,e);return i.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;for(let i of(null===(e=this._fullRequestReader)||void 0===e||e.cancel(t),this._rangeRequestReaders.slice(0)))i.cancel(t)}constructor(t){this._source=t,this._manager=new nj(t),this._rangeChunkSize=t.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}}class nG{_onHeadersReceived(){let t=this._fullRequestId,e=new Headers(this._manager.getRequestXhr(t).getAllResponseHeaders().trim().split(/[\r\n]+/).map(t=>{let[e,...i]=t.split(": ");return[e,i.join(": ")]})),{allowRangeRequests:i,suggestedLength:s}=nI({responseHeaders:e,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});i&&(this._isRangeSupported=!0),this._contentLength=s||this._contentLength,this._filename=nP(e),this._isRangeSupported&&this._manager.abortRequest(t),this._headersCapability.resolve()}_onDone(t){if(t&&(this._requests.length>0?this._requests.shift().resolve({value:t.chunk,done:!1}):this._cachedChunks.push(t.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(let t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(t){for(let e of(this._storedError=nD(t,this._url),this._headersCapability.reject(this._storedError),this._requests))e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(t){var e;null===(e=this.onProgress)||void 0===e||e.call(this,{loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){for(let e of(this._done=!0,this._headersCapability.reject(t),this._requests))e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}constructor(t,e){this._manager=t;let i={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._fullRequestId=t.requestFull(i),this._headersCapability=Promise.withResolvers(),this._disableRange=e.disableRange||!1,this._contentLength=e.length,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}}class nU{_close(){var t;null===(t=this.onClosed)||void 0===t||t.call(this,this)}_onDone(t){let e=t.chunk;for(let t of(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunk=e,this._done=!0,this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(t){for(let e of(this._storedError=nD(t,this._url),this._requests))e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(t){if(!this.isStreamingSupported){var e;null===(e=this.onProgress)||void 0===e||e.call(this,{loaded:t.loaded})}}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){let t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){for(let t of(this._done=!0,this._requests))t.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest
1(this._requestId),this._close()}constructor(t,e,i){this._manager=t;let s={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._requestId=t.requestRange(e,i,s),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}}let nV=/^[a-z][a-z0-9\-+.]+:/i;function nq(t,e,i){return"http:"===t.protocol?aC.get("http").request(t,{headers:e},i):aC.get("https").request(t,{headers:e},i)}class nK{get _progressiveDataLength(){var t,e;return null!==(e=null===(t=this._fullRequestReader)||void 0===t?void 0:t._loaded)&&void 0!==e?e:0}getFullReader(){return N(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new nZ(this):new nQ(this),this._fullRequestReader}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=this.isFsUrl?new n$(this,t,e):new nJ(this,t,e);return this._rangeRequestReaders.push(i),i}cancelAllRequests(t){var e;for(let i of(null===(e=this._fullRequestReader)||void 0===e||e.cancel(t),this._rangeRequestReaders.slice(0)))i.cancel(t)}constructor(t){this.source=t,this.url=function(t){return new URL(nV.test(t)?t:aC.get("url").pathToFileURL(t))}(t.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.headers=nL(this.isHttp,t.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}}class nX{get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;let e=this._readableStream.read();return null===e?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).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",t=>{this._error(t)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new K("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null;let e=t.source;this._contentLength=e.length,this._loaded=0,this._filename=null,this._disableRange=e.disableRange||!1,this._rangeChunkSize=e.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}}class nY{get isStreamingSupported(){return this._isStreamingSupported}async read(){var t;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;let e=this._readableStream.read();return null===e?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,null===(t=this.onProgress)||void 0===t||t.call(this,{loaded:this._loaded}),{value:new Uint8Array(e).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",t=>{this._error(t)}),this._storedError&&this._readableStream.destroy(this._storedError)}constructor(t){this._url=t.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();let e=t.source;this._isStreamingSupported=!e.disableStream}}class nQ extends nX{constructor(t){super(t);let e=Object.fromEntries(t.headers);this._request=nq(this._url,e,e=>{if(404===e.statusCode){let t=new U('Missing PDF "'.concat(this._url,'".'));this._storedError=t,this._headersCapability.reject(t);return}this._headersCapability.resolve(),this._setReadableStream(e);let i=new Headers(this._readableStream.headers),{allowRangeRequests:s,suggestedLength:a}=nI({responseHeaders:i,isHttp:t.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=a||this._contentLength,this._filename=nP(i)}),this._request.on("error",t=>{this._storedError=t,this._headersCapability.reject(t)}),this._request.end()}}class nJ extends nY{constructor(t,e,i){super(t);let s=Object.fromEntries(t.headers);s.Range="bytes=".concat(e,"-").concat(i-1),this._request=nq(this._url,s,t=>{if(404===t.statusCode){let t=new U('Missing PDF "'.concat(this._url,'".'));this._storedError=t;return}this._setReadableStream(t)}),this._request.on("error",t=>{this._storedError=t}),this._request.end()}}class nZ extends nX{constructor(t){super(t);let e=aC.get("fs");e.promises.lstat(this._url).then(t=>{this._contentLength=t.size,this._setReadableStream(e.createReadStream(this._url)),this._headersCapability.resolve()},t=>{"ENOENT"===t.code&&(t=new U('Missing PDF "'.concat(this._url,'".'))),this._storedError=t,this._headersCapability.reject(t)})}}class n$ extends nY{constructor(t,e,i){super(t);let s=aC.get("fs");this._setReadableStream(s.createReadStream(this._url,{start:e,end:i-1}))}}var n0=new WeakMap,n1=new WeakMap,n2=new WeakMap,n3=new WeakMap,n5=new WeakMap,n6=new WeakMap,n4=new WeakMap,n8=new WeakMap,n7=new WeakMap,n9=new WeakMap,rt=new WeakMap,re=new WeakMap,ri=new WeakMap,rs=new WeakMap,ra=new WeakMap,rn=new WeakMap,rr=new WeakMap,rl=new WeakMap,ro=new WeakSet,rh=new WeakSet,rd=new WeakSet;class rc{static get fontFamilyMap(){let{isWindows:t,isFirefox:e}=J.platform;return H(this,"fontFamilyMap",new Map([["sans-serif","".concat(t&&e?"Calibri, ":"","sans-serif")],["monospace","".concat(t&&e?"Lucida Console, ":"","monospace")]]))}render(){let t=()=>{(0,s._)(this,n7).read().then(e=>{var i;let{value:a,done:r}=e;if(r){(0,s._)(this,n0).resolve();return}(0,n._)(this,n5,null!==(i=(0,s._)(this,n5))&&void 0!==i?i:a.lang),Object.assign((0,s._)(this,ri),a.styles),(0,l._)(this,ro,rv).call(this,a.items),t()},(0,s._)(this,n0).reject)};return(0,n._)(this,n7,(0,s._)(this,ra).getReader()),(0,h._)(rc,rc,rg).add(this),t(),(0,s._)(this,n0).promise}update(t){let{viewport:e,onBefore:i=null}=t,a=e.scale*(globalThis.devicePixelRatio||1),r=e.rotation;if(r!==(0,s._)(this,rt)&&(null==i||i(),(0,n._)(this,rt,r),tE((0,s._)(this,n9),{rotation:r})),a!==(0,s._)(this,re)){null==i||i(),(0,n._)(this,re,a);
1let t={div:null,properties:null,ctx:(0,_._)(rc,rc,rw).call(rc,(0,s._)(this,n5))};for(let e of(0,s._)(this,rn))t.properties=(0,s._)(this,rr).get(e),t.div=e,(0,l._)(this,rd,rb).call(this,t)}}cancel(){var t;let e=new K("TextLayer task cancelled.");null===(t=(0,s._)(this,n7))||void 0===t||t.cancel(e).catch(()=>{}),(0,n._)(this,n7,null),(0,s._)(this,n0).reject(e)}get textDivs(){return(0,s._)(this,rn)}get textContentItemsStr(){return(0,s._)(this,rs)}static cleanup(){if(!((0,h._)(this,rc,rg).size>0)){for(let{canvas:t}of((0,h._)(this,rc,ru).clear(),(0,h._)(this,rc,r_).values()))t.remove();(0,h._)(this,rc,r_).clear()}}constructor({textContentSource:t,container:e,viewport:i}){var r;if((0,o._)(this,ro),(0,o._)(this,rh),(0,o._)(this,rd),(0,a._)(this,n0,{writable:!0,value:void 0}),(0,a._)(this,n1,{writable:!0,value:void 0}),(0,a._)(this,n2,{writable:!0,value:void 0}),(0,a._)(this,n3,{writable:!0,value:void 0}),(0,a._)(this,n5,{writable:!0,value:void 0}),(0,a._)(this,n6,{writable:!0,value:void 0}),(0,a._)(this,n4,{writable:!0,value:void 0}),(0,a._)(this,n8,{writable:!0,value:void 0}),(0,a._)(this,n7,{writable:!0,value:void 0}),(0,a._)(this,n9,{writable:!0,value:void 0}),(0,a._)(this,rt,{writable:!0,value:void 0}),(0,a._)(this,re,{writable:!0,value:void 0}),(0,a._)(this,ri,{writable:!0,value:void 0}),(0,a._)(this,rs,{writable:!0,value:void 0}),(0,a._)(this,ra,{writable:!0,value:void 0}),(0,a._)(this,rn,{writable:!0,value:void 0}),(0,a._)(this,rr,{writable:!0,value:void 0}),(0,a._)(this,rl,{writable:!0,value:void 0}),(0,n._)(this,n0,Promise.withResolvers()),(0,n._)(this,n1,null),(0,n._)(this,n2,!1),(0,n._)(this,n3,!!(null===(r=globalThis.FontInspector)||void 0===r?void 0:r.enabled)),(0,n._)(this,n5,null),(0,n._)(this,n6,null),(0,n._)(this,n4,0),(0,n._)(this,n8,0),(0,n._)(this,n7,null),(0,n._)(this,n9,null),(0,n._)(this,rt,0),(0,n._)(this,re,0),(0,n._)(this,ri,Object.create(null)),(0,n._)(this,rs,[]),(0,n._)(this,ra,null),(0,n._)(this,rn,[]),(0,n._)(this,rr,new WeakMap),(0,n._)(this,rl,null),t instanceof ReadableStream)(0,n._)(this,ra,t);else if("object"==typeof t)(0,n._)(this,ra,new ReadableStream({start(e){e.enqueue(t),e.close()}}));else throw Error('No "textContentSource" parameter specified.');(0,n._)(this,n1,(0,n._)(this,n9,e)),(0,n._)(this,re,i.scale*(globalThis.devicePixelRatio||1)),(0,n._)(this,rt,i.rotation),(0,n._)(this,n6,{div:null,properties:null,ctx:null});let{pageWidth:l,pageHeight:d,pageX:c,pageY:u}=i.rawDims;(0,n._)(this,rl,[1,0,0,-1,-c,u+d]),(0,n._)(this,n8,l),(0,n._)(this,n4,d),(0,_._)(rc,rc,ry).call(rc),tE(e,i),(0,s._)(this,n0).promise.finally(()=>{(0,h._)(rc,rc,rg).delete(this),(0,n._)(this,n6,null),(0,n._)(this,ri,null)}).catch(()=>{})}}var ru={writable:!0,value:new Map},r_={writable:!0,value:new Map},rp={writable:!0,value:new WeakMap},rf={writable:!0,value:null},rg={writable:!0,value:new Set};function rv(t){var e,i;if((0,s._)(this,n2))return;null!==(i=(e=(0,s._)(this,n6)).ctx)&&void 0!==i||(e.ctx=(0,_._)(rc,rc,rw).call(rc,(0,s._)(this,n5)));let a=(0,s._)(this,rn),r=(0,s._)(this,rs);for(let e of t){if(a.length>1e5){F("Ignoring additional textDivs for performance reasons."),(0,n._)(this,n2,!0);return}if(void 0===e.str){if("beginMarkedContentProps"===e.type||"beginMarkedContent"===e.type){let t=(0,s._)(this,n1);(0,n._)(this,n1,document.createElement("span")),(0,s._)(this,n1).classList.add("markedContent"),null!==e.id&&(0,s._)(this,n1).setAttribute("id","".concat(e.id)),t.append((0,s._)(this,n1))}else"endMarkedContent"===e.type&&(0,n._)(this,n1,(0,s._)(this,n1).parentNode);continue}r.push(e.str),(0,l._)(this,rh,rm).call(this,e)}}function rm(t){let e,i;let a=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};(0,s._)(this,rn).push(a);let r=$.transform((0,s._)(this,rl),t.transform),o=Math.atan2(r[1],r[0]),d=(0,s._)(this,ri)[t.fontName];d.vertical&&(o+=Math.PI/2);let c=(0,s._)(this,n3)&&d.fontSubstitution||d.fontFamily;c=rc.fontFamilyMap.get(c)||c;let u=Math.hypot(r[2],r[3]),p=u*(0,_._)(rc,rc,rk).call(rc,c,(0,s._)(this,n5));0===o?(e=r[4],i=r[5]-p):(e=r[4]+p*Math.sin(o),i=r[5]-p*Math.cos(o));let f="calc(var(--scale-factor)*",g=a.style;(0,s._)(this,n1)===(0,s._)(this,n9)?(g.left="".concat((100*e/(0,s._)(this,n8)).toFixed(2),"%"),g.top="".concat((100*i/(0,s._)(this,n4)).toFixed(2),"%")):(g.left="".concat(f).concat(e.toFixed(2),"px)"),g.top="".concat(f).concat(i.toFixed(2),"px)")),g.fontSize="".concat(f).concat(((0,h._)(rc,rc,rf)*u).toFixed(2),"px)"),g.fontFamily=c,n.fontSize=u,a.setAttribute("role","presentation"),a.textContent=t.str,a.dir=t.dir,(0,s._)(this,n3)&&(a.dataset.fontName=d.fontSubstitutionLoadedName||t.fontName),0!==o&&(n.angle=180/Math.PI*o);let v=!1;if(t.str.length>1)v=!0;else if(" "!==t.str&&t.transform[0]!==t.transform[3]){let e=Math.abs(t.transform[0]),i=Math.abs(t.transform[3]);e!==i&&Math.max(e,i)/Math.min(e,i)>1.5&&(v=!0)}if(v&&(n.canvasWidth=d.vertical?t.height:t.width),(0,s._)(this,rr).set(a,n),(0,s._)(this,n6).div=a,(0,s._)(this,n6).properties=n,(0,l._)(this,rd,rb).call(this,(0,s._)(this,n6)),n.hasText&&(0,s._)(this,n1).append(a),n.hasEOL){let t=document.createElement("br");t.setAttribute("role","presentation"),(0,s._)(this,n1).append(t)}}function rb(t){let{div:e,properties:i,ctx:a}=t,{style:n}=e,r="";if((0,h._)(rc,rc,rf)>1&&(r="scale(".concat(1/(0,h._)(rc,rc,rf),")")),0!==i.canvasWidth&&i.hasText){let{fontFamily:t}=n,{canvasWidth:l,fontSize:o}=i;(0,_._)(rc,rc,rA).call(rc,a,o*(0,s._)(this,re),t);let{width:h}=a.measureText(e.textContent);h>0&&(r="scaleX(".concat(l*(0,s._)(this,re)/h,") ").concat(r))}0!==i.angle&&(r="rotate(".concat(i.angle,"deg) ").concat(r)),r.length>0&&(n.transform=r)}function rw(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=(0,h._)(this,rc,r_).get(t||(t=""));if(!e){let i=document.createElement("canvas");i.className="hiddenCanvasElement",i.lang=t,document.body.append(i),e=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),(0,h._)(this,rc,r_).set(t,e),(0,h._)(this,rc,rp).set(e,{size:0,family:""})}return e}function rA(t,e,i){let s=(0,h._)(this,rc,rp).get(t);(e!==s.size||i!==s.family)&&(t.font="".concat(e,"px ").concat(i),s.size=e,s.family=i)}function ry(){if(null!==(0,h._)(this,rc,rf))return;let t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),(0,d._)(this,rc,rf,t.getBoundingClientRect().height),t.remove()}function rk(t,e){let i=(0,h._)(this,rc,ru).get(t);if(i)return i;
1let s=(0,_._)(this,rc,rw).call(rc,e);s.canvas.width=s.canvas.height=30,(0,_._)(this,rc,rA).call(rc,s,30,t);let a=s.measureText(""),n=a.fontBoundingBoxAscent,r=Math.abs(a.fontBoundingBoxDescent);if(n){let e=n/(n+r);return(0,h._)(this,rc,ru).set(t,e),s.canvas.width=s.canvas.height=0,e}s.strokeStyle="red",s.clearRect(0,0,30,30),s.strokeText("g",0,0);let l=s.getImageData(0,0,30,30).data;r=0;for(let t=l.length-1-3;t>=0;t-=4)if(l[t]>0){r=Math.ceil(t/4/30);break}s.clearRect(0,0,30,30),s.strokeText("A",0,30),l=s.getImageData(0,0,30,30).data,n=0;for(let t=0,e=l.length;t<e;t+=4)if(l[t]>0){n=30-Math.floor(t/4/30);break}s.canvas.width=s.canvas.height=0;let o=n?n/(n+r):.8;return(0,h._)(this,rc,ru).set(t,o),o}class rS{static textContent(t){let e=[],i={items:e,styles:Object.create(null)};return!function t(i){var s;if(!i)return;let a=null,n=i.name;if("#text"===n)a=i.value;else{if(!rS.shouldBuildText(n))return;(null==i?void 0:null===(s=i.attributes)||void 0===s?void 0:s.textContent)?a=i.attributes.textContent:i.value&&(a=i.value)}if(null!==a&&e.push({str:a}),i.children)for(let e of i.children)t(e)}(t),i}static shouldBuildText(t){return"textarea"!==t&&"input"!==t&&"option"!==t&&"select"!==t}}let rx=m?aL:sZ,rE=m?aI:s0,rM=m?aR:ac,rC=m?aP:ax;function rT(){var t,e,i;let s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};"string"==typeof s||s instanceof URL?s={url:s}:(s instanceof ArrayBuffer||ArrayBuffer.isView(s))&&(s={data:s});let a=new rL,{docId:n}=a,r=s.url?function(t){if(t instanceof URL)return t.href;try{return new URL(t,window.location).href}catch(e){if(m&&"string"==typeof t)return t}throw Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(s.url):null,l=s.data?function(t){if(m&&void 0!==f&&t instanceof f)throw Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength)return t;if("string"==typeof t)return Y(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||"object"==typeof t&&!isNaN(null==t?void 0:t.length))return new Uint8Array(t);throw Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(s.data):null,o=s.httpHeaders||null,h=!0===s.withCredentials,d=null!==(e=s.password)&&void 0!==e?e:null,c=s.range instanceof rP?s.range:null,u=Number.isInteger(s.rangeChunkSize)&&s.rangeChunkSize>0?s.rangeChunkSize:65536,_=s.worker instanceof rq?s.worker:null,p=s.verbosity,g="string"!=typeof s.docBaseUrl||tu(s.docBaseUrl)?null:s.docBaseUrl,v="string"==typeof s.cMapUrl?s.cMapUrl:null,b=!1!==s.cMapPacked,w=s.CMapReaderFactory||rE,A="string"==typeof s.standardFontDataUrl?s.standardFontDataUrl:null,y=s.StandardFontDataFactory||rC,k=!0!==s.stopAtErrors,S=Number.isInteger(s.maxImageSize)&&s.maxImageSize>-1?s.maxImageSize:-1,x=!1!==s.isEvalSupported,E="boolean"==typeof s.isOffscreenCanvasSupported?s.isOffscreenCanvasSupported:!m,M="boolean"==typeof s.isChrome?s.isChrome:!J.platform.isFirefox&&"undefined"!=typeof window&&!!(null===(t=window)||void 0===t?void 0:t.chrome),C=Number.isInteger(s.canvasMaxAreaInBytes)?s.canvasMaxAreaInBytes:-1,T="boolean"==typeof s.disableFontFace?s.disableFontFace:m,R=!0===s.fontExtraProperties,L=!0===s.enableXfa,I=s.ownerDocument||globalThis.document,D=!0===s.disableRange,F=!0===s.disableStream,W=!0===s.disableAutoFetch,N=!0===s.pdfBug,O=s.CanvasFactory||rx,H=s.FilterFactory||rM,B=!0===s.enableHWA,j=c?c.length:null!==(i=s.length)&&void 0!==i?i:NaN,z="boolean"==typeof s.useSystemFonts?s.useSystemFonts:!m&&!T,G="boolean"==typeof s.useWorkerFetch?s.useWorkerFetch:w===s0&&y===ax&&v&&A&&tv(v,document.baseURI)&&tv(A,document.baseURI);s.canvasFactory&&tb("`canvasFactory`-instance option, please use `CanvasFactory` instead."),s.filterFactory&&tb("`filterFactory`-instance option, please use `FilterFactory` instead."),Number.isInteger(p)&&(P=p);let U={canvasFactory:new O({ownerDocument:I,enableHWA:B}),filterFactory:new H({docId:n,ownerDocument:I}),cMapReaderFactory:G?null:new w({baseUrl:v,isCompressed:b}),standardFontDataFactory:G?null:new y({baseUrl:A})};if(!_){let t={verbosity:p,port:a4.workerPort};a._worker=_=t.port?rq.fromPort(t):new rq(t)}let V={docId:n,apiVersion:"4.8.69",data:l,password:d,disableAutoFetch:W,rangeChunkSize:u,length:j,docBaseUrl:g,enableXfa:L,evaluatorOptions:{maxImageSize:S,disableFontFace:T,ignoreErrors:k,isEvalSupported:x,isOffscreenCanvasSupported:E,isChrome:M,canvasMaxAreaInBytes:C,fontExtraProperties:R,useSystemFonts:z,cMapUrl:G?v:null,standardFontDataUrl:G?A:null}},q={disableFontFace:T,fontExtraProperties:R,ownerDocument:I,pdfBug:N,styleElement:null,loadingParams:{disableAutoFetch:W,enableXfa:L}};return _.promise.then(function(){let t;if(a.destroyed)throw Error("Loading aborted");if(_.destroyed)throw Error("Worker was destroyed");
1let e=_.messageHandler.sendWithPromise("GetDocRequest",V,l?[l.buffer]:null);if(c)t=new nC(c,{disableRange:D,disableStream:F});else if(!l){let e;if(!r)throw Error("getDocument - no `url` parameter provided.");t=new(m?"undefined"!=typeof fetch&&"undefined"!=typeof Response&&"body"in Response.prototype&&tv(r)?nO:nK:tv(r)?nO:nz)({url:r,length:j,httpHeaders:o,withCredentials:h,rangeChunkSize:u,disableRange:D,disableStream:F})}return e.then(e=>{if(a.destroyed)throw Error("Loading aborted");if(_.destroyed)throw Error("Worker was destroyed");let i=new nl(n,e,_.port),s=new r5(i,a,t,q,U);a._transport=s,i.send("Ready",null)})}).catch(a._capability.reject),a}function rR(t){return"object"==typeof t&&Number.isInteger(null==t?void 0:t.num)&&t.num>=0&&Number.isInteger(null==t?void 0:t.gen)&&t.gen>=0}class rL{get promise(){return this._capability.promise}async destroy(){var t,e,i;this.destroyed=!0;try{(null===(t=this._worker)||void 0===t?void 0:t.port)&&(this._worker._pendingDestroy=!0),await (null===(e=this._transport)||void 0===e?void 0:e.destroy())}catch(t){throw(null===(i=this._worker)||void 0===i?void 0:i.port)&&delete this._worker._pendingDestroy,t}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId="d".concat((0,c._)(rL,rL,rI).value++),this.destroyed=!1,this.onPassword=null,this.onProgress=null}}var rI={writable:!0,value:0};class rP{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){W("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}constructor(t,e,i=!1,s=null){this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=s,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}}class rD{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 H(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){let{intent:t="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}constructor(t,e){this._pdfInfo=t,this._transport=e}}var rF=new WeakMap,rW=new WeakMap,rN=new WeakSet,rO=new WeakSet;class rH{get pageNumber(){return this._pageIndex+1}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport(){let{scale:t,rotation:e=this.rotate,offsetX:i=0,offsetY:s=0,dontFlip:a=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new td({viewBox:this.view,scale:t,rotation:e,offsetX:i,offsetY:s,dontFlip:a})}getAnnotations(){let{intent:t="display"}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{renderingIntent:e}
1=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 H(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var t;return(null===(t=this._transport._htmlForXfa)||void 0===t?void 0:t.children[this._pageIndex])||null}render(t){var e,i,s;let{canvasContext:a,viewport:r,intent:o="display",annotationMode:h=y.ENABLE,transform:d=null,background:c=null,optionalContentConfigPromise:u=null,annotationCanvasMap:_=null,pageColors:p=null,printAnnotationStorage:f=null,isEditing:g=!1}=t;null===(e=this._stats)||void 0===e||e.time("Overall");let v=this._transport.getRenderingIntent(o,h,f,g),{renderingIntent:m,cacheKey:b}=v;(0,n._)(this,rW,!1),(0,l._)(this,rO,rj).call(this),u||(u=this._transport.getOptionalContentConfig(m));let w=this._intentStates.get(b);w||(w=Object.create(null),this._intentStates.set(b,w)),w.streamReaderCancelTimeout&&(clearTimeout(w.streamReaderCancelTimeout),w.streamReaderCancelTimeout=null);let k=!!(m&A.PRINT);w.displayReadyCapability||(w.displayReadyCapability=Promise.withResolvers(),w.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null===(s=this._stats)||void 0===s||s.time("Page Request"),this._pumpOperatorList(v));let S=t=>{if(w.renderTasks.delete(x),(this._maybeCleanupAfterRender||k)&&(0,n._)(this,rW,!0),(0,l._)(this,rN,rB).call(this,!k),t?(x.capability.reject(t),this._abortOperatorList({intentState:w,reason:t instanceof Error?t:Error(t)})):x.capability.resolve(),this._stats){var e;this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(null===(e=globalThis.Stats)||void 0===e?void 0:e.enabled)&&globalThis.Stats.add(this.pageNumber,this._stats)}},x=new ln({callback:S,params:{canvasContext:a,viewport:r,transform:d,background:c},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:_,operatorList:w.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!k,pdfBug:this._pdfBug,pageColors:p});((i=w).renderTasks||(i.renderTasks=new Set)).add(x);let E=x.task;return Promise.all([w.displayReadyCapability.promise,u]).then(t=>{var e;let[i,s]=t;if(this.destroyed){S();return}if(null===(e=this._stats)||void 0===e||e.time("Rendering"),!(s.renderingIntent&m))throw Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");x.initializeGraphics({transparency:i,optionalContentConfig:s}),x.operatorListChanged()}).catch(S),E}getOperatorList(){let t,{intent:e="display",annotationMode:i=y.ENABLE,printAnnotationStorage:s=null,isEditing:a=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=this._transport.getRenderingIntent(e,i,s,a,!0),r=this._intentStates.get(n.cacheKey);if(r||(r=Object.create(null),this._intentStates.set(n.cacheKey,r)),!r.opListReadCapability){var l,o;(t=Object.create(null)).operatorListChanged=function(){r.operatorList.lastChunk&&(r.opListReadCapability.resolve(r.operatorList),r.renderTasks.delete(t))},r.opListReadCapability=Promise.withResolvers(),((o=r).renderTasks||(o.renderTasks=new Set)).add(t),r.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},null===(l=this._stats)||void 0===l||l.time("Page Request"),this._pumpOperatorList(n)}return r.opListReadCapability.promise}streamTextContent(){let{includeMarkedContent:t=!1,disableNormalization:e=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:!0===t,disableNormalization:!0===e},{highWaterMark:100,size:t=>t.items.length})}getTextContent(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this._transport._htmlForXfa)return this.getXfa().then(t=>rS.textContent(t));let e=this.streamTextContent(t);return new Promise(function(t,i){let s=e.getReader(),a={items:[],styles:Object.create(null),lang:null};!function e(){s.read().then(function(i){var s;let{value:n,done:r}=i;if(r){t(a);return}null!==(s=a.lang)&&void 0!==s||(a.lang=n.lang),Object.assign(a.styles,n.styles),a.items.push(...n.items),e()},i)}()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let t=[];for(let e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(let i of e.renderTasks)t.push(i.completed),i.cancel();return this.objs.clear(),(0,n._)(this,rW,!1),(0,l._)(this,rO,rj).call(this),Promise.all(t)}cleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];(0,n._)(this,rW,!0);let e=(0,l._)(this,rN,rB).call(this,!1);return t&&e&&this._stats&&(this._stats=new tg),e}_startRenderPage(t,e){var i,s;let a=this._intentStates.get(e);a&&(null===(i=this._stats)||void 0===i||i.timeEnd("Page Request"),null===(s=a.displayReadyCapability)||void 0===s||s.resolve(t))}_renderPageChunk(t,e){for(let i=0,s=t.length;i<s;i++)e.operatorList.fnArray.push(t.fnArray[i]),e.operatorList.argsArray.push(t.argsArray[i]);for(let i of(e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots,e.renderTasks))i.operatorListChanged();
1t.lastChunk&&(0,l._)(this,rN,rB).call(this,!0)}_pumpOperatorList(t){let{renderingIntent:e,cacheKey:i,annotationStorageSerializable:s,modifiedIds:a}=t,{map:n,transfer:r}=s,o=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:i,annotationStorage:n,modifiedIds:a},r).getReader(),h=this._intentStates.get(i);h.streamReader=o;let d=()=>{o.read().then(t=>{let{value:e,done:i}=t;if(i){h.streamReader=null;return}!this._transport.destroyed&&(this._renderPageChunk(e,h),d())},t=>{if(h.streamReader=null,!this._transport.destroyed){if(h.operatorList){for(let t of(h.operatorList.lastChunk=!0,h.renderTasks))t.operatorListChanged();(0,l._)(this,rN,rB).call(this,!0)}if(h.displayReadyCapability)h.displayReadyCapability.reject(t);else if(h.opListReadCapability)h.opListReadCapability.reject(t);else throw t}})};d()}_abortOperatorList(t){let{intentState:e,reason:i,force:s=!1}=t;if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!s){if(e.renderTasks.size>0)return;if(i instanceof tc){let t=100;i.extraDelay>0&&i.extraDelay<1e3&&(t+=i.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:i,force:!0})},t);return}}if(e.streamReader.cancel(new K(i.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(let[t,i]of this._intentStates)if(i===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}constructor(t,e,i,s=!1){(0,o._)(this,rN),(0,o._)(this,rO),(0,a._)(this,rF,{writable:!0,value:void 0}),(0,a._)(this,rW,{writable:!0,value:void 0}),(0,n._)(this,rF,null),(0,n._)(this,rW,!1),this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=s?new tg:null,this._pdfBug=s,this.commonObjs=i.commonObjs,this.objs=new lt,this._maybeCleanupAfterRender=!1,this._intentStates=new Map,this.destroyed=!1}}function rB(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if((0,l._)(this,rO,rj).call(this),!(0,s._)(this,rW)||this.destroyed)return!1;if(t)return(0,n._)(this,rF,setTimeout(()=>{(0,n._)(this,rF,null),(0,l._)(this,rN,rB).call(this,!1)},5e3)),!1;for(let{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),(0,n._)(this,rW,!1),!0}function rj(){(0,s._)(this,rF)&&(clearTimeout((0,s._)(this,rF)),(0,n._)(this,rF,null))}var rz=new WeakMap,rG=new WeakMap;class rU{postMessage(t,e){let i={data:structuredClone(t,e?{transfer:e}:null)};(0,s._)(this,rG).then(()=>{for(let[t]of(0,s._)(this,rz))t.call(this,i)})}addEventListener(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=null;if((null==i?void 0:i.signal)instanceof AbortSignal){let{signal:s}=i;if(s.aborted){F("LoopbackPort - cannot use an `aborted` signal.");return}let n=()=>this.removeEventListener(t,e);a=()=>s.removeEventListener("abort",n),s.addEventListener("abort",n)}(0,s._)(this,rz).set(e,a)}removeEventListener(t,e){let i=(0,s._)(this,rz).get(e);null==i||i(),(0,s._)(this,rz).delete(e)}terminate(){for(let[,t]of(0,s._)(this,rz))null==t||t();(0,s._)(this,rz).clear()}constructor(){(0,a._)(this,rz,{writable:!0,value:void 0}),(0,a._)(this,rG,{writable:!0,value:void 0}),(0,n._)(this,rz,new Map),(0,n._)(this,rG,Promise.resolve())}}var rV=new WeakSet;class rq{get promise(){return m?Promise.all([aC.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 nl("main","worker",t),this._messageHandler.on("ready",function(){}),(0,l._)(this,rV,rJ).call(this)}_initialize(){if((0,h._)(rq,rq,rY)||(0,h._)(rq,rq,rK)){this._setupFakeWorker();return}let{workerSrc:t}=rq;try{rq._isSameOrigin(window.location.href,t)||(t=rq._createCDNWrapper(new URL(t,window.location).href));let e=new Worker(t,{type:"module"}),i=new nl("main","worker",e),s=()=>{a.abort(),i.destroy(),e.terminate(),this.destroyed?this._readyCapability.reject(Error("Worker was destroyed")):this._setupFakeWorker()},a=new AbortController;e.addEventListener("error",()=>{this._webWorker||s()},{signal:a.signal}),i.on("test",t=>{if(a.abort(),this.destroyed||!t){s();return}this._messageHandler=i,this._port=e,this._webWorker=e,(0,l._)(this,rV,rJ).call(this)}),i.on("ready",t=>{if(a.abort(),this.destroyed){s();return}try{n()}catch(t){this._setupFakeWorker()}});let n=()=>{let t=new Uint8Array;i.send("test",t,[t.buffer])};n();return}catch(t){D("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){(0,h._)(rq,rq,rY)||(F("Setting up fake worker."),(0,d._)(rq,rq,rY,!0)),rq._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){this._readyCapability.reject(Error("Worker was destroyed"));return}let e=new rU;this._port=e;let i="fake".concat((0,c._)(rq,rq,rX).value++),s=new nl(i+"_worker",i,e);t.setup(s,e),this._messageHandler=new nl(i,i+"_worker",e),(0,l._)(this,rV,rJ).call(this)}).catch(t=>{this._readyCapability.reject(Error('Setting up fake worker failed: "'.concat(t.message,'".')))})}destroy(){var t;this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),null===(t=(0,h._)(rq,rq,rQ))||void 0===t||t.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(t){var e;if(!(null==t?void 0:t.port))throw Error("PDFWorker.fromPort - invalid method signature.");let i=null===(e=(0,h._)(this,rq,rQ))||void 0===e?void 0:e.get(t.port);
1if(i){if(i._pendingDestroy)throw Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return i}return new rq(t)}static get workerSrc(){if(a4.workerSrc)return a4.workerSrc;throw Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return H(this,"_setupFakeWorkerGlobal",(async()=>(0,h._)(this,rq,rK)?(0,h._)(this,rq,rK):(await import(this.workerSrc)).WorkerMessageHandler)())}constructor({name:t=null,port:e=null,verbosity:i=P}={}){var s;if((0,o._)(this,rV),this.name=t,this.destroyed=!1,this.verbosity=i,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,e){if(null===(s=(0,h._)(rq,rq,rQ))||void 0===s?void 0:s.has(e))throw Error("Cannot use more than one PDFWorker per port.");(0,d._)(rq,rq,rQ,(0,h._)(rq,rq,rQ)||new WeakMap).set(e,this),this._initializeFromPort(e);return}this._initialize()}}var rK={get:function(){try{var t;return(null===(t=globalThis.pdfjsWorker)||void 0===t?void 0:t.WorkerMessageHandler)||null}catch(t){return null}},set:void 0},rX={writable:!0,value:0},rY={writable:!0,value:!1},rQ={writable:!0,value:void 0};function rJ(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})}m&&((0,d._)(rq,rq,rY,!0),a4.workerSrc||(a4.workerSrc="./pdf.worker.mjs")),rq._isSameOrigin=(t,e)=>{let i;try{if(!(i=new URL(t)).origin||"null"===i.origin)return!1}catch(t){return!1}let s=new URL(e,i);return i.origin===s.origin},rq._createCDNWrapper=t=>URL.createObjectURL(new Blob(['await import("'.concat(t,'");')],{type:"text/javascript"}));var rZ=new WeakMap,r$=new WeakMap,r0=new WeakMap,r1=new WeakMap,r2=new WeakMap,r3=new WeakSet;class r5{get annotationStorage(){return H(this,"annotationStorage",new sG)}getRenderingIntent(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:y.ENABLE,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4],n=A.DISPLAY,r=sO;switch(t){case"any":n=A.ANY;break;case"display":break;case"print":n=A.PRINT;break;default:F("getRenderingIntent - invalid intent: ".concat(t))}let l=n&A.PRINT&&i instanceof sq?i:this.annotationStorage;switch(e){case y.DISABLE:n+=A.ANNOTATIONS_DISABLE;break;case y.ENABLE:break;case y.ENABLE_FORMS:n+=A.ANNOTATIONS_FORMS;break;case y.ENABLE_STORAGE:n+=A.ANNOTATIONS_STORAGE,r=l.serializable;break;default:F("getRenderingIntent - invalid annotationMode: ".concat(e))}s&&(n+=A.IS_EDITING),a&&(n+=A.OPLIST);let{ids:o,hash:h}=l.modifiedIds,d=[n,r.hash,h];return{renderingIntent:n,cacheKey:d.join("_"),annotationStorageSerializable:r,modifiedIds:o}}destroy(){var t;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),null===(t=(0,s._)(this,r2))||void 0===t||t.reject(Error("Worker was destroyed during onPassword callback"));let e=[];for(let t of(0,s._)(this,r$).values())e.push(t._destroy());(0,s._)(this,r$).clear(),(0,s._)(this,r0).clear(),(0,s._)(this,r1).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();let i=this.messageHandler.sendWithPromise("Terminate",null);return e.push(i),Promise.all(e).then(()=>{var t;this.commonObjs.clear(),this.fontLoader.clear(),(0,s._)(this,rZ).clear(),this.filterFactory.destroy(),rc.cleanup(),null===(t=this._networkStream)||void 0===t||t.cancelAllRequests(new K("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){let{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(t,e)=>{N(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=t=>{this._lastProgress={loaded:t.loaded,total:t.total}},e.onPull=()=>{this._fullReader.read().then(function(t){let{value:i,done:s}=t;if(s){e.close();return}N(i instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(i),1,[i])}).catch(t=>{e.error(t)})},e.onCancel=t=>{this._fullReader.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}}),t.on("ReaderHeadersReady",async t=>{await this._fullReader.headersReady;let{isStreamingSupported:i,isRangeSupported:s,contentLength:a}=this._fullReader;if(!i||!s){if(this._lastProgress){var n;null===(n=e.onProgress)||void 0===n||n.call(e,this._lastProgress)}this._fullReader.onProgress=t=>{var i;null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded,total:t.total})}}return{isStreamingSupported:i,isRangeSupported:s,contentLength:a}}),t.on("GetRangeReader",(t,e)=>{N(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");let i=this._networkStream.getRangeReader(t.begin,t.end);if(!i){e.close();return}e.onPull=()=>{i.read().then(function(t){let{value:i,done:s}=t;if(s){e.close();return}N(i instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(i),1,[i])}).catch(t=>{e.error(t)})},e.onCancel=t=>{i.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}}),t.on("GetDoc",t=>{let{pdfInfo:i}=t;this._numPages=i.numPages,this._htmlForXfa=i.htmlForXfa,delete i.htmlForXfa,e._capability.resolve(new rD(i,this))}),t.on("DocException",function(t){let i;switch(t.name){case"PasswordException":i=new j(t.message,t.code);break;case"InvalidPDFException":i=new G(t.message);break;case"MissingPDFException":i=new U(t.message);break;case"UnexpectedResponseException":i=new V(t.message,t.status);break;case"UnknownErrorException":i=new z(t.message,t.details);break;default:W("DocException - expected a valid Error.")}e._capability.reject(i)}
1),t.on("PasswordRequest",t=>{if((0,n._)(this,r2,Promise.withResolvers()),e.onPassword)try{e.onPassword(t=>{t instanceof Error?(0,s._)(this,r2).reject(t):(0,s._)(this,r2).resolve({password:t})},t.code)}catch(t){(0,s._)(this,r2).reject(t)}else(0,s._)(this,r2).reject(new j(t.message,t.code));return(0,s._)(this,r2).promise}),t.on("DataLoaded",t=>{var i;null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.length,total:t.length}),this.downloadInfoCapability.resolve(t)}),t.on("StartRenderPage",t=>{!this.destroyed&&(0,s._)(this,r$).get(t.pageIndex)._startRenderPage(t.transparency,t.cacheKey)}),t.on("commonobj",e=>{let[i,a,n]=e;if(this.destroyed||this.commonObjs.has(i))return null;switch(a){case"Font":var r;let{disableFontFace:l,fontExtraProperties:o,pdfBug:h}=this._params;if("error"in n){let t=n.error;F("Error during font loading: ".concat(t)),this.commonObjs.resolve(i,t);break}let d=new sY(n,{disableFontFace:l,inspectFont:h&&(null===(r=globalThis.FontInspector)||void 0===r?void 0:r.enabled)?(t,e)=>globalThis.FontInspector.fontAdded(t,e):null});this.fontLoader.bind(d).catch(()=>t.sendWithPromise("FontFallback",{id:i})).finally(()=>{!o&&d.data&&(d.data=null),this.commonObjs.resolve(i,d)});break;case"CopyLocalImage":let{imageRef:c}=n;for(let t of(N(c,"The imageRef must be defined."),(0,s._)(this,r$).values()))for(let[,e]of t.objs)if((null==e?void 0:e.ref)===c){if(!e.dataLen)return null;return this.commonObjs.resolve(i,structuredClone(e)),e.dataLen}break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(i,n);break;default:throw Error("Got unknown common object type ".concat(a))}return null}),t.on("obj",t=>{let[e,i,a,n]=t;if(this.destroyed)return;let r=(0,s._)(this,r$).get(i);if(!r.objs.has(e)){if(0===r._intentStates.size){var l;null==n||null===(l=n.bitmap)||void 0===l||l.close();return}switch(a){case"Image":r.objs.resolve(e,n),(null==n?void 0:n.dataLen)>1e7&&(r._maybeCleanupAfterRender=!0);break;case"Pattern":r.objs.resolve(e,n);break;default:throw Error("Got unknown object type ".concat(a))}}}),t.on("DocProgress",t=>{var i;!this.destroyed&&(null===(i=e.onProgress)||void 0===i||i.call(e,{loaded:t.loaded,total:t.total}))}),t.on("FetchBuiltInCMap",async t=>{if(this.destroyed)throw Error("Worker was destroyed.");if(!this.cMapReaderFactory)throw Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.");return this.cMapReaderFactory.fetch(t)}),t.on("FetchStandardFontData",async t=>{if(this.destroyed)throw Error("Worker was destroyed.");if(!this.standardFontDataFactory)throw Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.");return this.standardFontDataFactory.fetch(t)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var t,e;this.annotationStorage.size<=0&&F("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:i,transfer:s}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:i,filename:null!==(e=null===(t=this._fullReader)||void 0===t?void 0:t.filename)&&void 0!==e?e:null},s).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this._numPages)return Promise.reject(Error("Invalid page request."));let e=t-1,i=(0,s._)(this,r0).get(e);if(i)return i;let a=this.messageHandler.sendWithPromise("GetPage",{pageIndex:e}).then(i=>{if(this.destroyed)throw Error("Transport destroyed");i.refStr&&(0,s._)(this,r1).set(i.refStr,t);let a=new rH(e,i,this,this._params.pdfBug);return(0,s._)(this,r$).set(e,a),a});return(0,s._)(this,r0).set(e,a),a}getPageIndex(t){return rR(t)?this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}):Promise.reject(Error("Invalid pageIndex request."))}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:t,intent:e})}getFieldObjects(){return(0,l._)(this,r3,r6).call(this,"GetFieldObjects")}hasJSActions(){return(0,l._)(this,r3,r6).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithProm
1ise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return"string"!=typeof t?Promise.reject(Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getDocJSActions(){return(0,l._)(this,r3,r6).call(this,"GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:t})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:t})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return(0,l._)(this,r3,r6).call(this,"GetOptionalContentConfig").then(e=>new nE(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){let t="GetMetadata",e=(0,s._)(this,rZ).get(t);if(e)return e;let i=this.messageHandler.sendWithPromise(t,null).then(t=>{var e,i,s,a;return{info:t[0],metadata:t[1]?new np(t[1]):null,contentDispositionFilename:null!==(s=null===(e=this._fullReader)||void 0===e?void 0:e.filename)&&void 0!==s?s:null,contentLength:null!==(a=null===(i=this._fullReader)||void 0===i?void 0:i.contentLength)&&void 0!==a?a:null}});return(0,s._)(this,rZ).set(t,i),i}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!this.destroyed){for(let t of(await this.messageHandler.sendWithPromise("Cleanup",null),(0,s._)(this,r$).values()))if(!t.cleanup())throw Error("startCleanup: Page ".concat(t.pageNumber," is currently rendering."));this.commonObjs.clear(),t||this.fontLoader.clear(),(0,s._)(this,rZ).clear(),this.filterFactory.destroy(!0),rc.cleanup()}}cachedPageNumber(t){var e;if(!rR(t))return null;let i=0===t.gen?"".concat(t.num,"R"):"".concat(t.num,"R").concat(t.gen);return null!==(e=(0,s._)(this,r1).get(i))&&void 0!==e?e:null}constructor(t,e,i,s,r){(0,o._)(this,r3),(0,a._)(this,rZ,{writable:!0,value:void 0}),(0,a._)(this,r$,{writable:!0,value:void 0}),(0,a._)(this,r0,{writable:!0,value:void 0}),(0,a._)(this,r1,{writable:!0,value:void 0}),(0,a._)(this,r2,{writable:!0,value:void 0}),(0,n._)(this,rZ,new Map),(0,n._)(this,r$,new Map),(0,n._)(this,r0,new Map),(0,n._)(this,r1,new Map),(0,n._)(this,r2,null),this.messageHandler=t,this.loadingTask=e,this.commonObjs=new lt,this.fontLoader=new sX({ownerDocument:s.ownerDocument,styleElement:s.styleElement}),this.loadingParams=s.loadingParams,this._params=s,this.canvasFactory=r.canvasFactory,this.filterFactory=r.filterFactory,this.cMapReaderFactory=r.cMapReaderFactory,this.standardFontDataFactory=r.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=i,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}}function r6(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=(0,s._)(this,rZ).get(t);if(i)return i;let a=this.messageHandler.sendWithPromise(t,e);return(0,s._)(this,rZ).set(t,a),a}let r4=Symbol("INITIAL_DATA");var r8=new WeakMap,r7=new WeakSet;let r9=Symbol.iterator;class lt{get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e){let i=(0,l._)(this,r7,le).call(this,t);return i.promise.then(()=>e(i.data)),null}let i=(0,s._)(this,r8)[t];if(!i||i.data===r4)throw Error("Requesting object that isn't resolved yet ".concat(t,"."));return i.data}has(t){let e=(0,s._)(this,r8)[t];return!!e&&e.data!==r4}resolve(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=(0,l._)(this,r7,le).call(this,t);i.data=e,i.resolve()}clear(){for(let e in(0,s._)(this,r8)){var t;let{data:i}=(0,s._)(this,r8)[e];null==i||null===(t=i.bitmap)||void 0===t||t.close()}(0,n._)(this,r8,Object.create(null))}*[r9](){for(let t in(0,s._)(this,r8)){let{data:e}=(0,s._)(this,r8)[t];e!==r4&&(yield[t,e])}}constructor(){(0,o._)(this,r7),(0,a._)(this,r8,{writable:!0,value:void 0}),(0,n._)(this,r8,Object.create(null))}}function le(t){var e;return(e=(0,s._)(this,r8))[t]||(e[t]={...Promise.withResolvers(),data:r4})}var li=new WeakMap;class ls{get promise(){return(0,s._)(this,li).capability.promise}cancel(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;(0,s._)(this,li).cancel(null,t)}get separateAnnots(){let{separateAnnots:t}=(0,s._)(this,li).operatorList;if(!t)return!1;let{annotationCanvasMap:e}=(0,s._)(this,li);return t.form||t.canvas&&(null==e?void 0:e.size)>0}constructor(t){(0,a._)(this,li,{writable:!0,value:void 0}),(0,n._)(this,li,null),(0,n._)(this,li,t),this.onContinue=null}}var la=new WeakMap;class ln{get completed(){return this.capability.promise.catch(function(){})}initializeGraphics(t){var e,i;let{transparency:s=!1,optionalContentConfig:a}=t;if(this.cancelled)return;
1if(this._canvas){if((0,h._)(ln,ln,lr).has(this._canvas))throw Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");(0,h._)(ln,ln,lr).add(this._canvas)}this._pdfBug&&(null===(e=globalThis.StepperManager)||void 0===e?void 0:e.enabled)&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());let{canvasContext:n,viewport:r,transform:l,background:o}=this.params;this.gfx=new a3(n,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:a},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:l,viewport:r,transparency:s,background:o}),this.operatorListIdx=0,this.graphicsReady=!0,null===(i=this.graphicsReadyCallback)||void 0===i||i.call(this)}cancel(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.running=!1,this.cancelled=!0,null===(t=this.gfx)||void 0===t||t.endDrawing(),(0,s._)(this,la)&&(window.cancelAnimationFrame((0,s._)(this,la)),(0,n._)(this,la,null)),(0,h._)(ln,ln,lr).delete(this._canvas),this.callback(e||new tc("Rendering cancelled, page ".concat(this._pageIndex+1),i))}operatorListChanged(){var t;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}null===(t=this.stepper)||void 0===t||t.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?(0,n._)(this,la,window.requestAnimationFrame(()=>{(0,n._)(this,la,null),this._nextBound().catch(this._cancelBound)})):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){!this.cancelled&&(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),(0,h._)(ln,ln,lr).delete(this._canvas),this.callback())))}constructor({callback:t,params:e,objs:i,commonObjs:s,annotationCanvasMap:r,operatorList:l,pageIndex:o,canvasFactory:h,filterFactory:d,useRequestAnimationFrame:c=!1,pdfBug:u=!1,pageColors:_=null}){(0,a._)(this,la,{writable:!0,value:void 0}),(0,n._)(this,la,null),this.callback=t,this.params=e,this.objs=i,this.commonObjs=s,this.annotationCanvasMap=r,this.operatorListIdx=null,this.operatorList=l,this._pageIndex=o,this.canvasFactory=h,this.filterFactory=d,this._pdfBug=u,this.pageColors=_,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===c&&"undefined"!=typeof window,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new ls(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=e.canvasContext.canvas}}var lr={writable:!0,value:new WeakSet};let ll="4.8.69",lo="3634dab10";function lh(t){return Math.floor(255*Math.max(0,Math.min(1,t))).toString(16).padStart(2,"0")}function ld(t){return Math.max(0,Math.min(255,255*t))}class lc{static CMYK_G(t){let[e,i,s,a]=t;return["G",1-Math.min(1,.3*e+.59*s+.11*i+a)]}static G_CMYK(t){let[e]=t;return["CMYK",0,0,0,1-e]}static G_RGB(t){let[e]=t;return["RGB",e,e,e]}static G_rgb(t){let[e]=t;return[e=ld(e),e,e]}static G_HTML(t){let[e]=t,i=lh(e);return"#".concat(i).concat(i).concat(i)}static RGB_G(t){let[e,i,s]=t;return["G",.3*e+.59*i+.11*s]}static RGB_rgb(t){return t.map(ld)}static RGB_HTML(t){return"#".concat(t.map(lh).join(""))}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB(t){let[e,i,s,a]=t;return["RGB",1-Math.min(1,e+a),1-Math.min(1,s+a),1-Math.min(1,i+a)]}static CMYK_rgb(t){let[e,i,s,a]=t;return[ld(1-Math.min(1,e+a)),ld(1-Math.min(1,s+a)),ld(1-Math.min(1,i+a))]}static CMYK_HTML(t){let e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK(t){let[e,i,s]=t,a=1-e,n=1-i,r=1-s,l=Math.min(a,n,r);return["CMYK",a,n,r,l]}}class lu{create(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(t<=0||e<=0)throw Error("Invalid SVG dimensions");let s=this._createSVG("svg:svg");return s.setAttribute("version","1.1"),i||(s.setAttribute("width","".concat(t,"px")),s.setAttribute("height","".concat(e,"px"))),s.setAttribute("preserveAspectRatio","none"),s.setAttribute("viewBox","0 0 ".concat(t," ").concat(e)),s}createElement(t){if("string"!=typeof t)throw Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){W("Abstract method `_createSVG` called.")}}class l_ extends lu{_createSVG(t){return document.createElementNS(tl,t)}}class lp{static setupStorage(t,e,i,s,a){let n=s.getValue(e,{value:null});switch(i.name){case"textarea":if(null!==n.value&&(t.textContent=n.value),"print"===a)break;t.addEventListener("input",t=>{s.setValue(e,{value:t.target.value})});break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){if(n.value===i.attributes.xfaOn?t.setAttribute("checked",!0):n.value===i.attributes.xfaOff&&t.removeAttribute("checked"),"print"===a)break;t.addEventListener("change",t=>{s.setValue(e,{value:t.target.checked?t.target.getAttribute("xfaOn"):t.target.getAttribute("xfaOff")})})}else{if(null!==n.value&&t.setAttribute("value",n.value),"print"===a)break;t.addEventListener("input",t=>{s.setValue(e,{value:t.target.value})})}break;case"select":if(null!==n.value)for(let e of(t.setAttribute("value",n.value),i.children))e.attributes.value===n.value?e.attributes.selected=!0:e.attributes.hasOwnProperty("selected")&&delete e.attributes.selected;t.addEventListener("input",t=>{let i=t.target.options,a=-1===i.selectedIndex?"":i[i.selectedIndex].value;s.setValue(e,{value:a})})}}static setAttributes(t){let{html:e,element:i,storage:s=null,intent:a,linkService:n}=t,{attributes:r}=i,l=e instanceof HTMLAnchorElement;for(let[t,i]of("radio"===r.type&&(r.name="".concat(r.name,"-").concat(a)),Object.entries(r)))if(null!=i)switch(t){case"class":i.length&&e.setAttribute(t,i.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",i);break;case"style":Object.assign(e.style,i);break;case"textContent":e.textContent=i;break;default:l&&("href"===t||"newWindow"===t)||e.setAttribute(t,i)}l&&n.addLinkAttributes(e,r.href,r.newWindow),s&&r.dataId&&this.setupStorage(e,r.dataId,i,s)}static render(t){let e=t.annotationStorage,i=t.linkService,s=t.xfaHtml,a=t.intent||"display",n=document.createElement(s.name);s.attributes&&this.setAttributes({html:n,element:s,intent:a,linkService:i});let r="richText"!==a,l=t.div;if(l.append(n),t.viewport){let e="matrix(".concat(t.viewport.transform.join(","),")");l.style.transform=e}r&&l.setAttribute("class","xfaLayer xfaFont");let o=[];if(0===s.children.length){if(s.value){let t=document.createTextNode(s.value);n.append(t),r&&rS.shouldBuildText(s.name)&&o.push(t)}return{textDivs:o}}let h=[[s,-1,n]];for(;h.length>0;){var d,c;let[t,s,n]=h.at(-1);if(s+1===t.children.length){h.pop();continue}let l=t.children[++h.at(-1)[1]];if(null===l)continue;let{name:u}=l;if("#text"===u){let t=document.createTextNode(l.value);o.push(t),n.append(t);continue}let _=(null==l?void 0:null===(d=l.attributes)||void 0===d?void 0:d.xmlns)?document.createElementNS(l.attributes.xmlns,u):document.createElement(u);if(n.append(_),l.attributes&&this.setAttributes({html:_,element:l,storage:e,intent:a,linkService:i}),(null===(c=l.children)||void 0===c?void 0:c.length)>0)h.push([l,-1,_]);else if(l.value){let t=document.createTextNode(l.value);r&&rS.shouldBuildText(u)&&o.push(t),_.append(t)}}for(let t of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))t.setAttribute("readOnly",!0);return{textDivs:o}}static update(t){let e="matrix(".concat(t.viewport.transform.join(","),")");t.div.style.transform=e,t.div.hidden=!1}}let lf=new WeakSet;function lg(t){return{width:t[2]-t[0],height:t[3]-t[1]}}class lv{static create(t){switch(t.data.annotationType){case C.LINK:return new lM(t);case C.TEXT:return new lL(t);case C.WIDGET:switch(t.data.fieldType){case"Tx":return new lP(t);case"Btn":if(t.data.radioButton)return new lW(t);if(t.data.checkBox)return new lF(t);return new lN(t);case"Ch":return new lO(t);case"Sig":return new lD(t)}return new lI(t);case C.POPUP:return new lH(t);case C.FREETEXT:return new op(t);case C.LINE:return new og(t);case C.SQUARE:return new om(t);case C.CIRCLE:return new ow(t);case C.POLYLINE:return new oy(t);case C.CARET:return new oS(t);case C.INK:return new oE(t);case C.POLYGON:return new ok(t);case C.HIGHLIGHT:return new oM(t);case C.UNDERLINE:return new oC(t);case C.SQUIGGLY:return new oT(t);case C.STRIKEOUT:return new oR(t);case C.STAMP:return new oL(t);case C.FILEATTACHMENT:return new oD(t);default:return new ly(t)}}}var lm=new WeakMap,lb=new WeakMap,lw=new WeakMap,lA=new WeakSet;class ly{static _hasPopupData(t){let{titleObj:e,contentsObj:i,richText:s}=t;return!!((null==e?void 0:e.str)||(null==i?void 0:i.str)||(null==s?void 0:s.str))}get _isEditable(){return this.data.isEditable}get hasPopupData(){return ly._hasPopupData(this.data)}updateEdited(t){var e;if(!this.container)return;(0,n._)(this,lm,(0,s._)(this,lm)||{rect:this.data.rect.slice(0)});let{rect:i}=t;
1i&&(0,l._)(this,lA,lk).call(this,i),null===(e=(0,s._)(this,lw))||void 0===e||e.popup.updateEdited(t)}resetEdited(){var t;(0,s._)(this,lm)&&((0,l._)(this,lA,lk).call(this,(0,s._)(this,lm).rect),null===(t=(0,s._)(this,lw))||void 0===t||t.popup.resetEdited(),(0,n._)(this,lm,null))}_createContainer(t){let{data:e,parent:{page:i,viewport:s}}=this,a=document.createElement("section");a.setAttribute("data-annotation-id",e.id),this instanceof lI||(a.tabIndex=1e3);let{style:r}=a;if(r.zIndex=this.parent.zIndex++,e.alternativeText&&(a.title=e.alternativeText),e.noRotate&&a.classList.add("norotate"),!e.rect||this instanceof lH){let{rotation:t}=e;return e.hasOwnCanvas||0===t||this.setRotation(t,a),a}let{width:l,height:o}=lg(e.rect);if(!t&&e.borderStyle.width>0){r.borderWidth="".concat(e.borderStyle.width,"px");let t=e.borderStyle.horizontalCornerRadius,i=e.borderStyle.verticalCornerRadius;switch(t>0||i>0?r.borderRadius="calc(".concat(t,"px * var(--scale-factor)) / calc(").concat(i,"px * var(--scale-factor))"):this instanceof lW&&(r.borderRadius="calc(".concat(l,"px * var(--scale-factor)) / calc(").concat(o,"px * var(--scale-factor))")),e.borderStyle.style){case T.SOLID:r.borderStyle="solid";break;case T.DASHED:r.borderStyle="dashed";break;case T.BEVELED:F("Unimplemented border style: beveled");break;case T.INSET:F("Unimplemented border style: inset");break;case T.UNDERLINE:r.borderBottomStyle="solid"}let s=e.borderColor||null;s?((0,n._)(this,lb,!0),r.borderColor=$.makeHexColor(0|s[0],0|s[1],0|s[2])):r.borderWidth=0}let h=$.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:d,pageHeight:c,pageX:u,pageY:_}=s.rawDims;r.left="".concat(100*(h[0]-u)/d,"%"),r.top="".concat(100*(h[1]-_)/c,"%");let{rotation:p}=e;return e.hasOwnCanvas||0===p?(r.width="".concat(100*l/d,"%"),r.height="".concat(100*o/c,"%")):this.setRotation(p,a),a}setRotation(t){let e,i,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.container;if(!this.data.rect)return;let{pageWidth:a,pageHeight:n}=this.parent.viewport.rawDims,{width:r,height:l}=lg(this.data.rect);t%180==0?(e=100*r/a,i=100*l/n):(e=100*l/a,i=100*r/n),s.style.width="".concat(e,"%"),s.style.height="".concat(i,"%"),s.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){let t=(t,e,i)=>{let s=i.detail[t],a=s[0],n=s.slice(1);i.target.style[e]=lc["".concat(a,"_HTML")](n),this.annotationStorage.setValue(this.data.id,{[e]:lc["".concat(a,"_rgb")](n)})};return H(this,"_commonActions",{display:t=>{let{display:e}=t.detail,i=e%2==1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:1===e||2===e})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{let{hidden:e}=t.detail;this.container.style.visibility=e?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:e,noView:e})},focus:t=>{setTimeout(()=>t.target.focus({preventScroll:!1}),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.target.disabled=t.detail.readonly},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:t=>{let e=t.detail.rotation;this.setRotation(e),this.annotationStorage.setValue(this.data.id,{rotation:e})}})}_dispatchEventFromSandbox(t,e){let i=this._commonActions;for(let s of Object.keys(e.detail)){let a=t[s]||i[s];null==a||a(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;let e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;let i=this._commonActions;for(let[s,a]of Object.entries(e)){let n=i[s];n&&(n({detail:{[s]:a},target:t}),delete e[s])}}_createQuadrilaterals(){let t;if(!this.container)return;let{quadPoints:e}=this.data;if(!e)return;let[i,a,n,r]=this.data.rect.map(t=>Math.fround(t));if(8===e.length){let[t,s,l,o]=e.subarray(2,6);if(n===t&&r===s&&i===l&&a===o)return}let{style:l}=this.container;if((0,s._)(this,lb)){let{borderColor:e,borderWidth:i}=l;l.borderWidth=0,t=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">','<g fill="transparent" stroke="'.concat(e,'" stroke-width="').concat(i,'">')],this.container.classList.add("hasBorder")}let o=n-i,h=r-a,{svgFactory:d}=this,c=d.createElement("svg");c.classList.add("quadrilateralsContainer"),c.setAttribute("width",0),c.setAttribute("height",0);let u=d.createElement("defs");c.append(u);let _=d.createElement("clipPath"),p="clippath_".concat(this.data.id);_.setAttribute("id",p),_.setAttribute("clipPathUnits","objectBoundingBox"),u.append(_);for(let s=2,a=e.length;s<a;s+=8){let a=e[s],n=e[s+1],l=e[s+2],c=e[s+3],u=d.createElement("rect"),p=(l-i)/o,f=(r-n)/h,g=(a-l)/o,v=(n-c)/h;u.setAttribute("x",p),u.setAttribute("y",f),u.setAttribute("width",g),u.setAttribute("height",v),_.append(u),null==t||t.push('<rect vector-effect="non-scaling-stroke" x="'.concat(p,'" y="').concat(f,'" width="').concat(g,'" height="').concat(v,'"/>'))}(0,s._)(this,lb)&&(t.push("</g></svg>')"),l.backgroundImage=t.join("")),this.container.append(c),this.container.style.clipPath="url(#".concat(p,")")}_createPopup(){let{data:t}=this,e=(0,n._)(this,lw,new lH({data:{color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,richText:t.richText,parentRect:t.rect,borderStyle:0,id:"popup_".concat(t.id),rotation:t.rotation},parent:this.parent,elements:[this]}));this.parent.div.append(e.render())}render(){W("Abstract method `AnnotationElement.render` called")}_getElementsByName(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=[];if(this._fieldObjects){let s=this._fieldObjects[t];if(s)for(let{page:t,id:a,exportValues:n}of s){if(-1===t||a===e)continue;let s="string"==typeof n?n:null,r=document.querySelector('[data-element-id="'.concat(a,'"]'));if(r&&!lf.has(r)){F("_getElementsByName - element not allowed: ".concat(a));continue}i.push({id:a,exportValue:s,domElement:r})}return i}for(let s of document.getElementsByName(t)){let{exportValue:t}=s,a=s.getAttribute("data-element-id");a!==e&&lf.has(s)&&i.push({id:a,exportValue:t,domElement:s})}return i}show(){var t;this.container&&(this.container.hidden=!1),null===(t=this.popup)||void 0===t||t.maybeShow()}hide(){var t;this.container&&(this.container.hidden=!0),null===(t=this.popup)||void 0===t||t.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){let t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(let e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;let{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{var i;null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e})})}constructor(t,{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:s=!1}={}){(0,o._)(this,lA),(0,a._)(this,lm,{writable:!0,value:void 0}),(0,a._)(this,lb,{writable:!0,value:void 0}),(0,a._)(this,lw,{writable:!0,value:void 0}),(0,n._)(this,lm,null),(0,n._)(this,lb,!1),(0,n._)(this,lw,null),this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,e&&(this.container=this._createContainer(i)),s&&this._createQuadrilaterals()}}function lk(t){let{container:{style:e},data:{rect:i,rotation:s},parent:{viewport:{rawDims:{pageWidth:a,pageHeight:n,pageX:r,pageY:l}}}}=this;null==i||i.splice(0,4,...t);let{width:o,height:h}=lg(t);e.left="".concat(100*(t[0]-r)/a,"%"),e.top="".concat(100*(n-t[3]+l)/n,"%"),0===s?(e.width="".concat(100*o/a,"%"),e.height="".concat(100*h/n,"%")):this.setRotation(s)}var lS=new WeakSet,lx=new WeakSet,lE=new WeakSet;class lM extends ly{render(){let{data:t,linkService:e}=this,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let s=!1;return t.url?(e.addLinkAttributes(i,t.url,t.newWindow),s=!0):t.action?(this._bindNamedAction(i,t.action),s=!0):t.attachment?((0,l._)(this,lx,lT).call(this,i,t.attachment,t.attachmentDest),s=!0):t.setOCGState?((0,l._)(this,lE,lR).call(this,i,t.setOCGState),s=!0):t.dest?(this._bindLink(i,t.dest),s=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),s=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),s=!0):this.isTooltipOnly&&!s&&(this._bindLink(i,""),s=!0)),this.container.classList.add("linkA
1nnotation"),s&&this.container.append(i),this.container}_bindLink(t,e){t.href=this.linkService.getDestinationHash(e),t.onclick=()=>(e&&this.linkService.goToDestination(e),!1),(e||""===e)&&(0,l._)(this,lS,lC).call(this)}_bindNamedAction(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),(0,l._)(this,lS,lC).call(this)}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");let i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(let s of Object.keys(e.actions)){let a=i.get(s);a&&(t[a]=()=>{var t;return null===(t=this.linkService.eventBus)||void 0===t||t.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:s}}),!1})}t.onclick||(t.onclick=()=>!1),(0,l._)(this,lS,lC).call(this)}_bindResetFormAction(t,e){let i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),(0,l._)(this,lS,lC).call(this),!this._fieldObjects){F('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(t.onclick=()=>!1);return}t.onclick=()=>{null==i||i();let{fields:t,refs:s,include:a}=e,n=[];if(0!==t.length||0!==s.length){let e=new Set(s);for(let i of t)for(let{id:t}of this._fieldObjects[i]||[])e.add(t);for(let t of Object.values(this._fieldObjects))for(let i of t)e.has(i.id)===a&&n.push(i)}else for(let t of Object.values(this._fieldObjects))n.push(...t);let r=this.annotationStorage,l=[];for(let t of n){let{id:e}=t;switch(l.push(e),t.type){case"text":{let i=t.defaultValue||"";r.setValue(e,{value:i});break}case"checkbox":case"radiobutton":{let i=t.defaultValue===t.exportValues;r.setValue(e,{value:i});break}case"combobox":case"listbox":{let i=t.defaultValue||"";r.setValue(e,{value:i});break}default:continue}let i=document.querySelector('[data-element-id="'.concat(e,'"]'));if(i){if(!lf.has(i)){F("_bindResetFormAction - element not allowed: ".concat(e));continue}i.dispatchEvent(new Event("resetform"))}}if(this.enableScripting){var o;null===(o=this.linkService.eventBus)||void 0===o||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:l,name:"ResetForm"}})}return!1}}constructor(t,e=null){super(t,{isRenderable:!0,ignoreBorder:!!(null==e?void 0:e.ignoreBorder),createQuadrilaterals:!0}),(0,o._)(this,lS),(0,o._)(this,lx),(0,o._)(this,lE),this.isTooltipOnly=t.data.isTooltipOnly}}function lC(){this.container.setAttribute("data-internal-link","")}function lT(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;t.href=this.linkService.getAnchorUrl(""),e.description&&(t.title=e.description),t.onclick=()=>{var t;return null===(t=this.downloadManager)||void 0===t||t.openOrDownloadData(e.content,e.filename,i),!1},(0,l._)(this,lS,lC).call(this)}function lR(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),(0,l._)(this,lS,lC).call(this)}class lL extends ly{render(){this.container.classList.add("textAnnotation");let t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(t),this.container}constructor(t){super(t,{isRenderable:!0})}}class lI extends ly{render(){return this.container}showElementAndHideCanvas(t){if(this.data.hasOwnCanvas){var e;(null===(e=t.previousSibling)||void 0===e?void 0:e.nodeName)==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1}}_getKeyModifier(t){return J.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,i,s,a){i.includes("mouse")?t.addEventListener(i,t=>{var e;null===(e=this.linkService.eventBus)||void 0===e||e.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:a(t),shift:t.shiftKey,modifier:this._getKeyModifier(t)}})}):t.addEventListener(i,t=>{var n;if("blur"===i){if(!e.focused||!t.relatedTarget)return;e.focused=!1}else if("focus"===i){if(e.focused)return;e.focused=!0}a&&(null===(n=this.linkService.eventBus)||void 0===n||n.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:s,value:a(t)}}))})}_setEventListeners(t,e,i,s){for(let[l,o]of i){var a,n,r;("Action"===o||(null===(a=this.data.actions)||void 0===a?void 0:a[o]))&&(("Focus"===o||"Blur"===o)&&(e||(e={focused:!1})),this._setEventListener(t,e,l,o,s),"Focus"!==o||(null===(n=this.data.actions)||void 0===n?void 0:n.Blur)?"Blur"!==o||(null===(r=this.data.actions)||void 0===r?void 0:r.Focus)||this._setEventListener(t,e,"focus","Focus",null):this._setEventListener(t,e,"blur","Blur",null))}}
1_setBackgroundColor(t){let e=this.data.backgroundColor||null;t.style.backgroundColor=null===e?"transparent":$.makeHexColor(e[0],e[1],e[2])}_setTextStyle(t){let e;let{fontColor:i}=this.data.defaultAppearanceData,s=this.data.defaultAppearanceData.fontSize||9,a=t.style,n=t=>Math.round(10*t)/10;if(this.data.multiLine){let t=Math.abs(this.data.rect[3]-this.data.rect[1]-2),i=Math.round(t/(1.35*s))||1;e=Math.min(s,n(t/i/1.35))}else e=Math.min(s,n(Math.abs(this.data.rect[3]-this.data.rect[1]-2)/1.35));a.fontSize="calc(".concat(e,"px * var(--scale-factor))"),a.color=$.makeHexColor(i[0],i[1],i[2]),null!==this.data.textAlignment&&(a.textAlign=["left","center","right"][this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class lP extends lI{setPropertyOnSiblings(t,e,i,s){let a=this.annotationStorage;for(let n of this._getElementsByName(t.name,t.id))n.domElement&&(n.domElement[e]=i),a.setValue(n.id,{[s]:i})}render(){let t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){var s,a;let n=t.getValue(e,{value:this.data.fieldValue}),r=n.value||"",l=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;l&&r.length>l&&(r=r.slice(0,l));let o=n.formattedValue||(null===(s=this.data.textContent)||void 0===s?void 0:s.join("\n"))||null;o&&this.data.comb&&(o=o.replaceAll(/\s+/g,""));let h={userValue:r,formattedValue:o,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?((i=document.createElement("textarea")).textContent=null!=o?o:r,this.data.doNotScroll&&(i.style.overflowY="hidden")):((i=document.createElement("input")).type="text",i.setAttribute("value",null!=o?o:r),this.data.doNotScroll&&(i.style.overflowX="hidden")),this.data.hasOwnCanvas&&(i.hidden=!0),lf.add(i),i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=1e3,this._setRequired(i,this.data.required),l&&(i.maxLength=l),i.addEventListener("input",s=>{t.setValue(e,{value:s.target.value}),this.setPropertyOnSiblings(i,"value",s.target.value,"value"),h.formattedValue=null}),i.addEventListener("resetform",t=>{var e;let s=null!==(e=this.data.defaultFieldValue)&&void 0!==e?e:"";i.value=h.userValue=s,h.formattedValue=null});let d=t=>{let{formattedValue:e}=h;null!=e&&(t.target.value=e),t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",t=>{var e;if(h.focused)return;let{target:i}=t;h.userValue&&(i.value=h.userValue),h.lastCommittedValue=i.value,h.commitKey=1,(null===(e=this.data.actions)||void 0===e?void 0:e.Focus)||(h.focused=!0)}),i.addEventListener("updatefromsandbox",i=>{this.showElementAndHideCanvas(i.target),this._dispatchEventFromSandbox({value(i){var s;h.userValue=null!==(s=i.detail.value)&&void 0!==s?s:"",t.setValue(e,{value:h.userValue.toString()}),i.target.value=h.userValue},formattedValue(i){let{formattedValue:s}=i.detail;h.formattedValue=s,null!=s&&i.target!==document.activeElement&&(i.target.value=s),t.setValue(e,{formattedValue:s})},selRange(t){t.target.setSelectionRange(...t.detail.selRange)},charLimit:i=>{var s;let{charLimit:a}=i.detail,{target:n}=i;if(0===a){n.removeAttribute("maxLength");return}n.setAttribute("maxLength",a);let r=h.userValue;r&&!(r.length<=a)&&(n.value=h.userValue=r=r.slice(0,a),t.setValue(e,{value:r}),null===(s=this.linkService.eventBus)||void 0===s||s.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:r,willCommit:!0,commitKey:1,selStart:n.selectionStart,selEnd:n.selectionEnd}}))}},i)}),i.addEventListener("keydown",t=>{var i;h.commitKey=1;let s=-1;if("Escape"===t.key?s=0:"Enter"!==t.key||this.data.multiLine?"Tab"===t.key&&(h.commitKey=3):s=2,-1===s)return;let{value:a}=t.target;h.lastCommittedValue!==a&&(h.lastCommittedValue=a,h.userValue=a,null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:a,willCommit:!0,commitKey:s,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}))});let s=d;d=null,i.addEventListener("blur",t=>{var i,a;
1if(!h.focused||!t.relatedTarget)return;(null===(i=this.data.actions)||void 0===i?void 0:i.Blur)||(h.focused=!1);let{value:n}=t.target;h.userValue=n,h.lastCommittedValue!==n&&(null===(a=this.linkService.eventBus)||void 0===a||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:n,willCommit:!0,commitKey:h.commitKey,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}})),s(t)}),(null===(a=this.data.actions)||void 0===a?void 0:a.Keystroke)&&i.addEventListener("beforeinput",t=>{var i;h.lastCommittedValue=null;let{data:s,target:a}=t,{value:n,selectionStart:r,selectionEnd:l}=a,o=r,d=l;switch(t.inputType){case"deleteWordBackward":{let t=n.substring(0,r).match(/\w*[^\w]*$/);t&&(o-=t[0].length);break}case"deleteWordForward":{let t=n.substring(r).match(/^[^\w]*\w*/);t&&(d+=t[0].length);break}case"deleteContentBackward":r===l&&(o-=1);break;case"deleteContentForward":r===l&&(d+=1)}t.preventDefault(),null===(i=this.linkService.eventBus)||void 0===i||i.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:n,change:s||"",willCommit:!1,selStart:o,selEnd:d}})}),this._setEventListeners(i,h,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.value)}if(d&&i.addEventListener("blur",d),this.data.comb){let t=(this.data.rect[2]-this.data.rect[0])/l;i.classList.add("comb"),i.style.letterSpacing="calc(".concat(t,"px * var(--scale-factor) - 1ch)")}}else(i=document.createElement("div")).textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell",this.data.hasOwnCanvas&&(i.hidden=!0);return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}constructor(t){super(t,{isRenderable:t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue})}}class lD extends lI{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class lF extends lI{render(){let t=this.annotationStorage,e=this.data,i=e.id,s=t.getValue(i,{value:e.exportValue===e.fieldValue}).value;"string"==typeof s&&(s="Off"!==s,t.setValue(i,{value:s})),this.container.classList.add("buttonWidgetAnnotation","checkBox");let a=document.createElement("input");return lf.add(a),a.setAttribute("data-element-id",i),a.disabled=e.readOnly,this._setRequired(a,this.data.required),a.type="checkbox",a.name=e.fieldName,s&&a.setAttribute("checked",!0),a.setAttribute("exportValue",e.exportValue),a.tabIndex=1e3,a.addEventListener("change",s=>{let{name:a,checked:n}=s.target;for(let s of this._getElementsByName(a,i)){let i=n&&s.exportValue===e.exportValue;s.domElement&&(s.domElement.checked=i),t.setValue(s.id,{value:i})}t.setValue(i,{value:n})}),a.addEventListener("resetform",t=>{let i=e.defaultFieldValue||"Off";t.target.checked=i===e.exportValue}),this.enableScripting&&this.hasJSActions&&(a.addEventListener("updatefromsandbox",e=>{this._dispatchEventFromSandbox({value(e){e.target.checked="Off"!==e.detail.value,t.setValue(i,{value:e.target.checked})}},e)}),this._setEventListeners(a,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)),this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}constructor(t){super(t,{isRenderable:t.renderForms})}}class lW extends lI{render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");let t=this.annotationStorage,e=this.data,i=e.id,s=t.getValue(i,{value:e.fieldValue===e.buttonValue}).value;if("string"==typeof s&&(s=s!==e.buttonValue,t.setValue(i,{value:s})),s)for(let s of this._getElementsByName(e.fieldName,i))t.setValue(s.id,{value:!1});let a=document.createElement("input");if(lf.add(a),a.setAttribute("data-element-id",i),a.disabled=e.readOnly,this._setRequired(a,this.data.required),a.type="radio",a.name=e.fieldName,s&&a.setAttribute("checked",!0),a.tabIndex=1e3,a.addEventListener("change",e=>{let{name:s,checked:a}=e.target;for(let e of this._getElementsByName(s,i))t.setValue(e.id,{value:!1});t.setValue(i,{value:a})}),a.addEventListener("resetform",t=>{let i=e.defaultFieldValue;t.target.checked=null!=i&&i===e.buttonValue}),this.enableScripting&&this.hasJSActions){let s=e.buttonValue;a.addEventListener("updatefromsandbox",e=>{this._dispatchEventFromSandbox({value:e=>{let a=s===e.detail.value;for(let s of this._getElementsByName(e.target.name)){let e=a&&s.id===i;s.domElement&&(s.domElement.checked=e),t.setValue(s.id,{value:e})}}},e)}),this._setEventListeners(a,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)}
1return this._setBackgroundColor(a),this._setDefaultPropertiesFromJS(a),this.container.append(a),this.container}constructor(t){super(t,{isRenderable:t.renderForms})}}class lN extends lM{render(){let t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");let e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",t=>{this._dispatchEventFromSandbox({},t)})),t}constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}}class lO extends lI{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");lf.add(s),s.setAttribute("data-element-id",e),s.disabled=this.data.readOnly,this._setRequired(s,this.data.required),s.name=this.data.fieldName,s.tabIndex=1e3;let a=this.data.combo&&this.data.options.length>0;for(let t of(!this.data.combo&&(s.size=this.data.options.length,this.data.multiSelect&&(s.multiple=!0)),s.addEventListener("resetform",t=>{let e=this.data.defaultFieldValue;for(let t of s.options)t.selected=t.value===e}),this.data.options)){let e=document.createElement("option");e.textContent=t.displayValue,e.value=t.exportValue,i.value.includes(t.exportValue)&&(e.setAttribute("selected",!0),a=!1),s.append(e)}let n=null;if(a){let t=document.createElement("option");t.value=" ",t.setAttribute("hidden",!0),t.setAttribute("selected",!0),s.prepend(t),n=()=>{t.remove(),s.removeEventListener("input",n),n=null},s.addEventListener("input",n)}let r=t=>{let e=t?"value":"textContent",{options:i,multiple:a}=s;return a?Array.prototype.filter.call(i,t=>t.selected).map(t=>t[e]):-1===i.selectedIndex?null:i[i.selectedIndex][e]},l=r(!1),o=t=>{let e=t.target.options;return Array.prototype.map.call(e,t=>({displayValue:t.textContent,exportValue:t.value}))};return this.enableScripting&&this.hasJSActions?(s.addEventListener("updatefromsandbox",i=>{this._dispatchEventFromSandbox({value(i){null==n||n();let a=i.detail.value,o=new Set(Array.isArray(a)?a:[a]);for(let t of s.options)t.selected=o.has(t.value);t.setValue(e,{value:r(!0)}),l=r(!1)},multipleSelection(t){s.multiple=!0},remove(i){let a=s.options,n=i.detail.remove;a[n].selected=!1,s.remove(n),a.length>0&&-1===Array.prototype.findIndex.call(a,t=>t.selected)&&(a[0].selected=!0),t.setValue(e,{value:r(!0),items:o(i)}),l=r(!1)},clear(i){for(;0!==s.length;)s.remove(0);t.setValue(e,{value:null,items:[]}),l=r(!1)},insert(i){let{index:a,displayValue:n,exportValue:h}=i.detail.insert,d=s.children[a],c=document.createElement("option");c.textContent=n,c.value=h,d?d.before(c):s.append(c),t.setValue(e,{value:r(!0),items:o(i)}),l=r(!1)},items(i){let{items:a}=i.detail;for(;0!==s.length;)s.remove(0);for(let t of a){let{displayValue:e,exportValue:i}=t,a=document.createElement("option");a.textContent=e,a.value=i,s.append(a)}s.options.length>0&&(s.options[0].selected=!0),t.setValue(e,{value:r(!0),items:o(i)}),l=r(!1)},indices(i){let s=new Set(i.detail.indices);for(let t of i.target.options)t.selected=s.has(t.index);t.setValue(e,{value:r(!0)}),l=r(!1)},editable(t){t.target.disabled=!t.detail.editable}},i)}),s.addEventListener("input",i=>{var s;let a=r(!0),n=r(!1);t.setValue(e,{value:a}),i.preventDefault(),null===(s=this.linkService.eventBus)||void 0===s||s.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:l,change:n,changeEx:a,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(s,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],t=>t.target.value)):s.addEventListener("input",function(i){t.setValue(e,{value:r(!0)})}),this.data.combo&&this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}constructor(t){super(t,{isRenderable:t.renderForms})}}class lH extends ly{render(){this.container.classList.add("popupAnnotation");let t=this.popup=new oa({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),e=[];for(let i of this.elements)i.popup=t,i.container.ariaHasPopup="dialog",e.push(i.data.id),i.addHighlightArea();return this.container.setAttribute("aria-controls",e.map(t=>"".concat(tn).concat(t)).join(",")),this.container}constructor(t){let{data:e,elements:i}=t;super(t,{isRenderable:ly._hasPopupData(e)}),this.elements=i,this.popup=null}}var lB=new WeakMap,lj=new WeakMap,lz=new WeakMap,lG=new WeakMap,lU=new WeakMap,lV=new WeakMap,lq=new WeakMap,lK=new WeakMap,lX=new WeakMap,lY=ne
1w WeakMap,lQ=new WeakMap,lJ=new WeakMap,lZ=new WeakMap,l$=new WeakMap,l0=new WeakMap,l1=new WeakMap,l2=new WeakMap,l3=new WeakMap,l5=new WeakMap,l6=new WeakMap,l4=new WeakMap,l8=new WeakMap,l7=new WeakSet,l9=new WeakSet,ot=new WeakSet,oe=new WeakSet,oi=new WeakSet,os=new WeakSet;class oa{render(){if((0,s._)(this,lZ))return;let t=(0,n._)(this,lZ,document.createElement("div"));if(t.className="popup",(0,s._)(this,lU)){let e=t.style.outlineColor=$.makeHexColor(...(0,s._)(this,lU));CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?t.style.backgroundColor="color-mix(in srgb, ".concat(e," 30%, white)"):t.style.backgroundColor=$.makeHexColor(...(0,s._)(this,lU).map(t=>Math.floor(.7*(255-t)+t)))}let e=document.createElement("span");e.className="header";let i=document.createElement("h1");if(e.append(i),{dir:i.dir,str:i.textContent}=(0,s._)(this,l2),t.append(e),(0,s._)(this,lK)){let t=document.createElement("span");t.classList.add("popupDate"),t.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),t.setAttribute("data-l10n-args",JSON.stringify({dateObj:(0,s._)(this,lK).valueOf()})),e.append(t)}let a=(0,s._)(this,l6);if(a)lp.render({xfaHtml:a,intent:"richText",div:t}),t.lastChild.classList.add("richText","popupContent");else{let e=this._formatContents((0,s._)(this,lq));t.append(e)}(0,s._)(this,lV).append(t)}_formatContents(t){let{str:e,dir:i}=t,s=document.createElement("p");s.classList.add("popupContent"),s.dir=i;let a=e.split(/(?:\r\n?|\n)/);for(let t=0,e=a.length;t<e;++t){let i=a[t];s.append(document.createTextNode(i)),t<e-1&&s.append(document.createElement("br"))}return s}updateEdited(t){var e;let{rect:i,popupContent:a}=t;(0,n._)(this,l3,(0,s._)(this,l3)||{contentsObj:(0,s._)(this,lq),richText:(0,s._)(this,l1)}),i&&(0,n._)(this,l$,null),a&&((0,n._)(this,l1,(0,l._)(this,l7,oo).call(this,a)),(0,n._)(this,lq,null)),null===(e=(0,s._)(this,lZ))||void 0===e||e.remove(),(0,n._)(this,lZ,null)}resetEdited(){var t;(0,s._)(this,l3)&&({contentsObj:(0,u._)(this,lq).value,richText:(0,u._)(this,l1).value}=(0,s._)(this,l3),(0,n._)(this,l3,null),null===(t=(0,s._)(this,lZ))||void 0===t||t.remove(),(0,n._)(this,lZ,null),(0,n._)(this,l$,null))}forceHide(){(0,n._)(this,l5,this.isVisible),(0,s._)(this,l5)&&((0,s._)(this,lV).hidden=!0)}maybeShow(){(0,s._)(this,l5)&&((0,s._)(this,lZ)||(0,l._)(this,oi,ou).call(this),(0,n._)(this,l5,!1),(0,s._)(this,lV).hidden=!1)}get isVisible(){return!1===(0,s._)(this,lV).hidden}constructor({container:t,color:e,elements:i,titleObj:r,modificationDate:h,contentsObj:d,richText:c,parent:u,rect:_,parentRect:p,open:f}){for(let f of((0,a._)(this,l6,{get:on,set:void 0}),(0,a._)(this,l4,{get:or,set:void 0}),(0,a._)(this,l8,{get:ol,set:void 0}),(0,o._)(this,l7),(0,o._)(this,l9),(0,o._)(this,ot),(0,o._)(this,oe),(0,o._)(this,oi),(0,o._)(this,os),(0,a._)(this,lB,{writable:!0,value:void 0}),(0,a._)(this,lj,{writable:!0,value:void 0}),(0,a._)(this,lz,{writable:!0,value:void 0}),(0,a._)(this,lG,{writable:!0,value:void 0}),(0,a._)(this,lU,{writable:!0,value:void 0}),(0,a._)(this,lV,{writable:!0,value:void 0}),(0,a._)(this,lq,{writable:!0,value:void 0}),(0,a._)(this,lK,{writable:!0,value:void 0}),(0,a._)(this,lX,{writable:!0,value:void 0}),(0,a._)(this,lY,{writable:!0,value:void 0}),(0,a._)(this,lQ,{writable:!0,value:void 0}),(0,a._)(this,lJ,{writable:!0,value:void 0}),(0,a._)(this,lZ,{writable:!0,value:void 0}),(0,a._)(this,l$,{writable:!0,value:void 0}),(0,a._)(this,l0,{writable:!0,value:void 0}),(0,a._)(this,l1,{writable:!0,value:void 0}),(0,a._)(this,l2,{writable:!0,value:void 0}),(0,a._)(this,l3,{writable:!0,value:void 0}),(0,a._)(this,l5,{writable:!0,value:void 0}),(0,n._)(this,lB,(0,l._)(this,l9,oh).bind(this)),(0,n._)(this,lj,(0,l._)(this,os,o_).bind(this)),(0,n._)(this,lz,(0,l._)(this,oi,ou).bind(this)),(0,n._)(this,lG,(0,l._)(this,oe,oc).bind(this)),(0,n._)(this,lU,null),(0,n._)(this,lV,null),(0,n._)(this,lq,null),(0,n._)(this,lK,null),(0,n._)(this,lX,null),(0,n._)(this,lY,null),(0,n._)(this,lQ,null),(0,n._)(this,lJ,!1),(0,n._)(this,lZ,null),(0,n._)(this,l$,null),(0,n._)(this,l0,null),(0,n._)(this,l1,null),(0,n._)(this,l2,null),(0,n._)(this,l3,null),(0,n._)(this,l5,!1),(0,n._)(this,lV,t),(0,n._)(this,l2,r),(0,n._)(this,lq,d),(0,n._)(this,l1,c),(0,n._)(this,lY,u),(0,n._)(this,lU,e),(0,n._)(this,l0,_),(0,n._)(this,lQ,p),(0,n._)(this,lX,i),(0,n._)(this,lK,tw.toDateObject(h)),this.trigger=i.flatMap(t=>t.getElementsToTriggerPopup()),this.trigger))f.addEventListener("click",(0,s._)(this,lG)),f.addEventListener("mouseenter",(0,s._)(this,lz)),f.addEventListener("mouseleave",(0,s._)(this,lj)),f.classList.add("popupTriggerArea");for(let t of i){var g;null===(g=t.container)||void 0===g||g.addEventListener("keydown",(0,s._)(this,lB))}(0,s._)(this,lV).hidden=!0,f&&(0,l._)(this,oe,oc).call(this)}}function on(){let t=(0,s._)(this,l1),e=(0,s._)(this,lq);return(null==t?void 0:t.str)&&(!(null==e?void 0:e.str)||e.str===t.str)&&(0,s._)(this,l1).html||null}function or(){var t,e,i;return(null===(i=(0,s._)(this,l6))||void 0===i?void 0:null===(e=i.attributes)||void 0===e?void 0:null===(t=e.style)||void 0===t?void 0:t.fontSize)||0}function ol(){var t,e,i;return(null===(i=(0,s._)(this,l6))||void 0===i?void 0:null===(e=i.attributes)||void 0===e?void 0:null===(t=e.style)||void 0===t?void 0:t.color)||null}function oo(t){let e=[],i={style:{color:(0,s._)(this,l8),fontSize:(0,s._)(this,l4)?"calc(".concat((0,s._)(this,l4),"px * var(--scale-factor))"):""}};for(let s of t.split("\n"))e.push({name:"span",value:s,attributes:i});return{str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}}}function oh(t){!t.altKey&&!t.shiftKey&&!t.ctrlKey&&!t.metaKey&&("Enter"===t.key||"Escape"===t.key&&(0,s._)(this,lJ))&&(0,l._)(this,oe,oc).call(this)}function od(){if(null!==(0,s._)(this,l$))return;let{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:a,pageY:r}}}=(0,s._)(this,lY),l=!!(0,s._)(this,lQ),o=l?(0,s._)(this,lQ):(0,s._)(this,l0);for(let t of(0,s._)(this,lX))if(!o||null!==$.intersect(t.data.rect,o)){o=t.data.rect,l=!0;break}let h=$.normalizeRect([o[0],t[3]-o[1]+t[1],o[2],t[3]-o[3]+t[1]]),d=l?o[2]-o[0]+5:0,c=h[0]+d,u=h[1];(0,n._)(this,l$,[100*(c-a)/e,100*(u-r)/i]);let{style:_}=(0,s._)(this,lV);_.left="".concat((0,s._)(this,l$)[0],"%"),_.top="".concat((0,s._)(this,l$)[1],"%")}function oc(){(0,n._)(this,lJ,!(0,s._)(this,lJ)),(0,s._)(this,lJ)?((0,l._)(this,oi,ou).call(this),(0,s._)(this,lV).addEventListener("click",(0,s._)(this,lG)),(0,s._)(this,lV).addEventListener("keydown",(0,s._)(this,lB))):((0,l._)(this,os,o_).call(this),(0,s._)(this,lV).removeEventListener("click",(0,s._)(this,lG)),(0,s._)(this,lV).removeEventListener("keydown",(0,s._)(this,lB)))}function ou(){(0,s._)(this,lZ)||this.render(),this.isVisible?(0,s._)(this,lJ)&&(0,s._)(this,lV).classList.add("focused"):((0,l._)(this,ot,od).call(this),(0,s._)(this,lV).hidden=!1,(0,s._)(this,lV).style.zIndex=parseInt((0,s._)(this,lV).style.zIndex)+1e3)}function o_(){(0,s._)(this,lV).classList.remove("focused"),!(0,s._)(this,lJ)&&this.isVisible&&((0,s._)(this,lV).hidden=!0,(0,s._)(this,lV).style.zIndex=parseInt((0,s._)(this,lV).style.zIndex)-1e3)}
1class op extends ly{render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){let t=document.createElement("div");for(let e of(t.classList.add("annotationTextContent"),t.setAttribute("role","comment"),this.textContent)){let i=document.createElement("span");i.textContent=e,t.append(i)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=k.FREETEXT}}var of=new WeakMap;class og extends ly{render(){this.container.classList.add("lineAnnotation");let t=this.data,{width:e,height:i}=lg(t.rect),s=this.svgFactory.create(e,i,!0),a=(0,n._)(this,of,this.svgFactory.createElement("svg:line"));return a.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),a.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),a.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),a.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),a.setAttribute("stroke-width",t.borderStyle.width||1),a.setAttribute("stroke","transparent"),a.setAttribute("fill","transparent"),s.append(a),this.container.append(s),!t.popupRef&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return(0,s._)(this,of)}addHighlightArea(){this.container.classList.add("highlightArea")}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,a._)(this,of,{writable:!0,value:void 0}),(0,n._)(this,of,null)}}var ov=new WeakMap;class om extends ly{render(){this.container.classList.add("squareAnnotation");let t=this.data,{width:e,height:i}=lg(t.rect),s=this.svgFactory.create(e,i,!0),a=t.borderStyle.width,r=(0,n._)(this,ov,this.svgFactory.createElement("svg:rect"));return r.setAttribute("x",a/2),r.setAttribute("y",a/2),r.setAttribute("width",e-a),r.setAttribute("height",i-a),r.setAttribute("stroke-width",a||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(0,s._)(this,ov)}addHighlightArea(){this.container.classList.add("highlightArea")}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,a._)(this,ov,{writable:!0,value:void 0}),(0,n._)(this,ov,null)}}var ob=new WeakMap;class ow extends ly{render(){this.container.classList.add("circleAnnotation");let t=this.data,{width:e,height:i}=lg(t.rect),s=this.svgFactory.create(e,i,!0),a=t.borderStyle.width,r=(0,n._)(this,ob,this.svgFactory.createElement("svg:ellipse"));return r.setAttribute("cx",e/2),r.setAttribute("cy",i/2),r.setAttribute("rx",e/2-a/2),r.setAttribute("ry",i/2-a/2),r.setAttribute("stroke-width",a||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(0,s._)(this,ob)}addHighlightArea(){this.container.classList.add("highlightArea")}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,a._)(this,ob,{writable:!0,value:void 0}),(0,n._)(this,ob,null)}}var oA=new WeakMap;class oy extends ly{render(){this.container.classList.add(this.containerClassName);let{data:{rect:t,vertices:e,borderStyle:i,popupRef:s}}=this;if(!e)return this.container;let{width:a,height:r}=lg(t),l=this.svgFactory.create(a,r,!0),o=[];for(let i=0,s=e.length;i<s;i+=2){let s=e[i]-t[0],a=t[3]-e[i+1];o.push("".concat(s,",").concat(a))}o=o.join(" ");let h=(0,n._)(this,oA,this.svgFactory.createElement(this.svgElementName));return h.setAttribute("points",o),h.setAttribute("stroke-width",i.width||1),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),l.append(h),this.container.append(l),!s&&this.hasPopupData&&this._createPopup(),this.container}getElementsToTriggerPopup(){return(0,s._)(this,oA)}addHighlightArea(){this.container.classList.add("highlightArea")}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,a._)(this,oA,{writable:!0,value:void 0}),(0,n._)(this,oA,null),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}}class ok extends oy{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class oS extends ly{render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}}var ox=new WeakMap;class oE extends ly{render(){this.container.classList.add(this.containerClassName);let{data:{rect:t,inkLists:e,borderStyle:i,popupRef:a}}=this,{width:n,height:r}=lg(t),l=this.svgFactory.create(n,r,!0);for(let a of e){let e=[];for(let i=0,s=a.length;i<s;i+=2){let s=a[i]-t[0],n=t[3]-a[i+1];e.push("".concat(s,",").concat(n))}e=e.join(" ");let n=this.svgFactory.createElement(this.svgElementName);(0,s._)(this,ox).push(n),n.setAttribute("points",e),n.setAttribute("stroke-width",i.width||1),n.setAttribute("stroke","transparent"),n.setAttribute("fill","transparent"),l.append(n)}return!a&&this.hasPopupData&&this._createPopup(),this.container.append(l),this._editOnDoubleClick(),this.container}getElementsToTriggerPopup(){return(0,s._)(this,ox)}addHighlightArea(){this.container.classList.add("highlightArea")}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),(0,a._)(this,ox,{writable:!0,value:void 0}),(0,n._)(this,ox,[]),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType="InkHighlight"===this.data.it?k.HIGHLIGHT:k.INK}}class oM extends ly{render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),this.container}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=k.HIGHLIGHT}}class oC extends ly{render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("underlineAnnotation"),this.container}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}}class oT extends ly{render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("squigglyAnnotation"),this.container}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}}class oR extends ly{render(){return!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.classList.add("str
1ikeoutAnnotation"),this.container}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}}class oL extends ly{render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this._editOnDoubleClick(),this.container}constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=k.STAMP}}var oI=new WeakMap,oP=new WeakSet;class oD extends ly{render(){let t;this.container.classList.add("fileAttachmentAnnotation");let{container:e,data:i}=this;i.hasAppearance||0===i.fillAlpha?t=document.createElement("div"):((t=document.createElement("img")).src="".concat(this.imageResourcesPath,"annotation-").concat(/paperclip/i.test(i.name)?"paperclip":"pushpin",".svg"),i.fillAlpha&&i.fillAlpha<1&&(t.style="filter: opacity(".concat(Math.round(100*i.fillAlpha),"%);"))),t.addEventListener("dblclick",(0,l._)(this,oP,oF).bind(this)),(0,n._)(this,oI,t);let{isMac:s}=J.platform;return e.addEventListener("keydown",t=>{"Enter"===t.key&&(s?t.metaKey:t.ctrlKey)&&(0,l._)(this,oP,oF).call(this)}),!i.popupRef&&this.hasPopupData?this._createPopup():t.classList.add("popupTriggerArea"),e.append(t),e}getElementsToTriggerPopup(){return(0,s._)(this,oI)}addHighlightArea(){this.container.classList.add("highlightArea")}constructor(t){var e;super(t,{isRenderable:!0}),(0,o._)(this,oP),(0,a._)(this,oI,{writable:!0,value:void 0}),(0,n._)(this,oI,null);let{file:i}=this.data;this.filename=i.filename,this.content=i.content,null===(e=this.linkService.eventBus)||void 0===e||e.dispatch("fileattachmentannotation",{source:this,...i})}}function oF(){var t;null===(t=this.downloadManager)||void 0===t||t.openOrDownloadData(this.content,this.filename)}var oW=new WeakMap,oN=new WeakMap,oO=new WeakMap,oH=new WeakMap,oB=new WeakSet,oj=new WeakSet;class oz{hasEditableAnnotations(){return(0,s._)(this,oO).size>0}async render(t){let{annotations:e}=t,i=this.div;tE(i,this.viewport);let a=new Map,n={data:null,layer:i,linkService:t.linkService,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new l_,annotationStorage:t.annotationStorage||new sG,enableScripting:!0===t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(let t of e){if(t.noHTML)continue;let e=t.annotationType===C.POPUP;if(e){let e=a.get(t.id);if(!e)continue;n.elements=e}else{let{width:e,height:i}=lg(t.rect);if(e<=0||i<=0)continue}n.data=t;let i=lv.create(n);if(!i.isRenderable)continue;if(!e&&t.popupRef){let e=a.get(t.popupRef);e?e.push(i):a.set(t.popupRef,[i])}let o=i.render();if(t.hidden&&(o.style.visibility="hidden"),await (0,l._)(this,oB,oG).call(this,o,t.id),i._isEditable){var r;(0,s._)(this,oO).set(i.data.id,i),null===(r=this._annotationEditorUIManager)||void 0===r||r.renderAnnotationElement(i)}}(0,l._)(this,oj,oU).call(this)}update(t){let{viewport:e}=t,i=this.div;this.viewport=e,tE(i,{rotation:e.rotation}),(0,l._)(this,oj,oU).call(this),i.hidden=!1}getEditableAnnotations(){return Array.from((0,s._)(this,oO).values())}getEditableAnnotation(t){return(0,s._)(this,oO).get(t)}constructor({div:t,accessibilityManager:e,annotationCanvasMap:i,annotationEditorUIManager:s,page:r,viewport:l,structTreeLayer:h}){(0,o._)(this,oB),(0,o._)(this,oj),(0,a._)(this,oW,{writable:!0,value:void 0}),(0,a._)(this,oN,{writable:!0,value:void 0}),(0,a._)(this,oO,{writable:!0,value:void 0}),(0,a._)(this,oH,{writable:!0,value:void 0}),(0,n._)(this,oW,null),(0,n._)(this,oN,null),(0,n._)(this,oO,new Map),(0,n._)(this,oH,null),this.div=t,(0,n._)(this,oW,e),(0,n._)(this,oN,i),(0,n._)(this,oH,h||null),this.page=r,this.viewport=l,this.zIndex=0,this._annotationEditorUIManager=s}}async function oG(t,e){var i,a;let n=t.firstChild||t,r=n.id="".concat(tn).concat(e),l=await (null===(i=(0,s._)(this,oH))||void 0===i?void 0:i.getAriaAttributes(r));if(l)for(let[t,e]of l)n.setAttribute(t,e);this.div.append(t),null===(a=(0,s._)(this,oW))||void 0===a||a.moveElementInDOM(this.div,t,n,!1)}function oU(){if(!(0,s._)(this,oN))return;let t=this.div;for(let[e,i]of(0,s._)(this,oN)){let s=t.querySelector('[data-annotation-id="'.concat(e,'"]'));if(!s)continue;i.className="annotationContent";let{firstChild:a}=s;a?"CANVAS"===a.nodeName?a.replaceWith(i):a.classList.contains("annotationContent")?a.after(i):a.before(i):s.append(i)}(0,s._)(this,oN).clear()}let oV=/\r\n?|\n/g;var oq=new WeakMap,oK=new WeakMap,oX=new WeakMap,oY=new WeakMap,oQ=new WeakMap,oJ=new WeakSet,oZ=new WeakSet,o$=new WeakSet,o0=new WeakSet,o1=new WeakSet,o2=new WeakSet,o3=new WeakSet;
1class o5 extends sw{static get _keyboardManager(){let t=o5.prototype,e=t=>t.isEmpty(),i=ih.TRANSLATE_SMALL,s=ih.TRANSLATE_BIG;return H(this,"_keyboardManager",new el([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-s,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[s,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-s],checker:e}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,s],checker:e}]]))}static initialize(t,e){sw.initialize(t,e);let i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}static updateDefaultParams(t,e){switch(t){case S.FREETEXT_SIZE:o5._defaultFontSize=e;break;case S.FREETEXT_COLOR:o5._defaultColor=e}}updateParams(t,e){switch(t){case S.FREETEXT_SIZE:(0,l._)(this,oJ,o6).call(this,e);break;case S.FREETEXT_COLOR:(0,l._)(this,oZ,o4).call(this,e)}}static get defaultPropertiesToUpdate(){return[[S.FREETEXT_SIZE,o5._defaultFontSize],[S.FREETEXT_COLOR,o5._defaultColor||sw._defaultLineColor]]}get propertiesToUpdate(){return[[S.FREETEXT_SIZE,(0,s._)(this,oQ)],[S.FREETEXT_COLOR,(0,s._)(this,oq)]]}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){let t=this.parentScale;return[-o5._internalPadding*t,-(o5._internalPadding+(0,s._)(this,oQ))*t]}rebuild(){if(this.parent)super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this))}enableEditMode(){if(this.isInEditMode())return;this.parent.setEditingState(!1),this.parent.updateToolbar(k.FREETEXT),super.enableEditMode(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),(0,n._)(this,oY,new AbortController);let t=this._uiManager.combinedSignal((0,s._)(this,oY));this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:t}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:t}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:t}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:t}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:t})}disableEditMode(){var t;this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",(0,s._)(this,oX)),this._isDraggable=!0,null===(t=(0,s._)(this,oY))||void 0===t||t.abort(),(0,n._)(this,oY,null),this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(){var t;!this.width&&(this.enableEditMode(),this.editorDiv.focus(),(null===(t=this._initialOptions)||void 0===t?void 0:t.isCentered)&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();let t=(0,s._)(this,oK),e=(0,n._)(this,oK,(0,l._)(this,o$,o8).call(this).trimEnd());if(t===e)return;let i=t=>{if((0,n._)(this,oK,t),!t){this.remove();return}(0,l._)(this,o1,ht).call(this),this._uiManager.rebuild(this),(0,l._)(this,o0,o7).call(this)};this.addCommands({cmd:()=>{i(e)},undo:()=>{i(t)},mustExec:!1}),(0,l._)(this,o0,o7).call(this)}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}dblclick(t){this.enterInEditMode()}keydown(t){t.target===this.div&&"Enter"===t.key&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){o5._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){let t,e;if(this.div)return this.div;this.width&&(t=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",(0,s._)(this,oX)),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;let{style:i}=this.editorDiv;if(i.fontSize="calc(".concat((0,s._)(this,oQ),"px * var(--scale-factor))"),i.color=(0,s._)(this,oq),this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),t2(this,this.div,["dblclick","keydown"]),this.width){let[i,s]=this.parentDimensions;
1if(this.annotationElementId){let a,n;let{position:r}=this._initialData,[l,o]=this.getInitialTranslation();[l,o]=this.pageTranslationToScreen(l,o);let[h,d]=this.pageDimensions,[c,u]=this.pageTranslation;switch(this.rotation){case 0:a=t+(r[0]-c)/h,n=e+this.height-(r[1]-u)/d;break;case 90:a=t+(r[0]-c)/h,n=e-(r[1]-u)/d,[l,o]=[o,-l];break;case 180:a=t-this.width+(r[0]-c)/h,n=e-(r[1]-u)/d,[l,o]=[-l,-o];break;case 270:a=t+(r[0]-c-this.height*d)/h,n=e+(r[1]-u-this.width*h)/d,[l,o]=[-o,l]}this.setAt(a*i,n*s,l,o)}else this.setAt(t*i,e*s,this.width*i,this.height*s);(0,l._)(this,o1,ht).call(this),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}editorDivPaste(t){let e=t.clipboardData||window.clipboardData,{types:i}=e;if(1===i.length&&"text/plain"===i[0])return;t.preventDefault();let s=(0,_._)(o5,o5,hi).call(o5,e.getData("text")||"").replaceAll(oV,"\n");if(!s)return;let a=window.getSelection();if(!a.rangeCount)return;this.editorDiv.normalize(),a.deleteFromDocument();let r=a.getRangeAt(0);
1if(!s.includes("\n")){r.insertNode(document.createTextNode(s)),this.editorDiv.normalize(),a.collapseToStart();return}let{startContainer:o,startOffset:h}=r,d=[],c=[];if(o.nodeType===Node.TEXT_NODE){let t=o.parentElement;if(c.push(o.nodeValue.slice(h).replaceAll(oV,"")),t!==this.editorDiv){let e=d;for(let i of this.editorDiv.childNodes){if(i===t){e=c;continue}e.push((0,_._)(o5,o5,o9).call(o5,i))}}d.push(o.nodeValue.slice(0,h).replaceAll(oV,""))}else if(o===this.editorDiv){let t=d,e=0;for(let i of this.editorDiv.childNodes)e++===h&&(t=c),t.push((0,_._)(o5,o5,o9).call(o5,i))}(0,n._)(this,oK,"".concat(d.join("\n")).concat(s).concat(c.join("\n"))),(0,l._)(this,o1,ht).call(this);let u=new Range,p=d.reduce((t,e)=>t+e.length,0);for(let{firstChild:t}of this.editorDiv.childNodes)if(t.nodeType===Node.TEXT_NODE){let e=t.nodeValue.length;if(p<=e){u.setStart(t,p),u.setEnd(t,p);break}p-=e}a.removeAllRanges(),a.addRange(u)}get contentDiv(){return this.editorDiv}static async deserialize(t,e,i){let s=null;if(t instanceof op){let{data:{defaultAppearanceData:{fontSize:e,fontColor:i},rect:a,rotation:n,id:r,popupRef:l},textContent:o,textPosition:h,parent:{page:{pageNumber:d}}}=t;if(!o||0===o.length)return null;s=t={annotationType:k.FREETEXT,color:Array.from(i),fontSize:e,value:o.join("\n"),position:h,pageIndex:d-1,rect:a.slice(0),rotation:n,id:r,deleted:!1,popupRef:l}}let a=await super.deserialize(t,e,i);return(0,n._)(a,oQ,t.fontSize),(0,n._)(a,oq,$.makeHexColor(...t.color)),(0,n._)(a,oK,(0,_._)(o5,o5,hi).call(o5,t.value)),a.annotationElementId=t.id||null,a._initialData=s,a}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let e=o5._internalPadding*this.parentScale,i=this.getRect(e,e),a=sw._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:(0,s._)(this,oq)),n={annotationType:k.FREETEXT,color:a,fontSize:(0,s._)(this,oQ),value:(0,l._)(this,o2,he).call(this),pageIndex:this.pageIndex,rect:i,rotation:this.rotation,structTreeParentId:this._structTreeParentId};return t?n:this.annotationElementId&&!(0,l._)(this,o3,hs).call(this,n)?null:(n.id=this.annotationElementId,n)}renderAnnotationElement(t){let e=super.renderAnnotationElement(t);if(this.deleted)return e;let{style:i}=e;for(let t of(i.fontSize="calc(".concat((0,s._)(this,oQ),"px * var(--scale-factor))"),i.color=(0,s._)(this,oq),e.replaceChildren(),(0,s._)(this,oK).split("\n"))){let i=document.createElement("div");i.append(t?document.createTextNode(t):document.createElement("br")),e.append(i)}let a=o5._internalPadding*this.parentScale;return t.updateEdited({rect:this.getRect(a,a),popupContent:(0,s._)(this,oK)}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}constructor(t){super({...t,name:"freeTextEditor"}),(0,o._)(this,oJ),(0,o._)(this,oZ),(0,o._)(this,o$),(0,o._)(this,o0),(0,o._)(this,o1),(0,o._)(this,o2),(0,o._)(this,o3),(0,a._)(this,oq,{writable:!0,value:void 0}),(0,a._)(this,oK,{writable:!0,value:void 0}),(0,a._)(this,oX,{writable:!0,value:void 0}),(0,a._)(this,oY,{writable:!0,value:void 0}),(0,a._)(this,oQ,{writable:!0,value:void 0}),(0,n._)(this,oK,""),(0,n._)(this,oX,"".concat(this.id,"-editor")),(0,n._)(this,oY,null),(0,n._)(this,oq,t.color||o5._defaultColor||sw._defaultLineColor),(0,n._)(this,oQ,t.fontSize||o5._defaultFontSize)}}function o6(t){let e=t=>{this.editorDiv.style.fontSize="calc(".concat(t,"px * var(--scale-factor))"),this.translate(0,-(t-(0,s._)(this,oQ))*this.parentScale),(0,n._)(this,oQ,t),(0,l._)(this,o0,o7).call(this)},i=(0,s._)(this,oQ);this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:S.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}function o4(t){let e=t=>{(0,n._)(this,oq,this.editorDiv.style.color=t)},i=(0,s._)(this,oq);this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:S.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function o8(){let t=[];
1this.editorDiv.normalize();let e=null;for(let i of this.editorDiv.childNodes)((null==e?void 0:e.nodeType)!==Node.TEXT_NODE||"BR"!==i.nodeName)&&(t.push((0,_._)(o5,o5,o9).call(o5,i)),e=i);return t.join("\n")}function o7(){let t;let[e,i]=this.parentDimensions;if(this.isAttachedToDOM)t=this.div.getBoundingClientRect();else{let{currentLayer:e,div:i}=this,s=i.style.display,a=i.classList.contains("hidden");i.classList.remove("hidden"),i.style.display="hidden",e.div.append(this.div),t=i.getBoundingClientRect(),i.remove(),i.style.display=s,i.classList.toggle("hidden",a)}this.rotation%180==this.parentRotation%180?(this.width=t.width/e,this.height=t.height/i):(this.width=t.height/e,this.height=t.width/i),this.fixAndSetPosition()}function o9(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(oV,"")}function ht(){if(this.editorDiv.replaceChildren(),(0,s._)(this,oK))for(let t of(0,s._)(this,oK).split("\n")){let e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}function he(){return(0,s._)(this,oK).replaceAll("\xa0"," ")}function hi(t){return t.replaceAll(" ","\xa0")}function hs(t){let{value:e,fontSize:i,color:s,pageIndex:a}=this._initialData;return this._hasBeenMoved||t.value!==e||t.fontSize!==i||t.color.some((t,e)=>t!==s[e])||t.pageIndex!==a}o5._freeTextDefaultContent="",o5._internalPadding=0,o5._defaultColor=null,o5._defaultFontSize=10,o5._type="freetext",o5._editorType=k.FREETEXT;class ha{toSVGPath(){W("Abstract method `toSVGPath` must be implemented.")}get box(){W("Abstract getter `box` must be implemented.")}serialize(t,e){W("Abstract method `serialize` must be implemented.")}get classNamesForDrawing(){W("Abstract getter `classNamesForDrawing` must be implemented.")}get classNamesForOutlining(){W("Abstract getter `classNamesForOutlining` must be implemented.")}get mustRemoveSelfIntersections(){return!1}}var hn=new WeakMap,hr=new WeakMap,hl=new WeakMap,ho=new WeakMap,hh=new WeakMap,hd=new WeakMap,hc=new WeakMap,hu=new WeakMap,h_=new WeakMap,hp=new WeakMap,hf=new WeakMap,hg=new WeakMap,hv=new WeakMap,hm=new WeakSet,hb=new WeakSet,hw=new WeakSet,hA=new WeakSet,hy=new WeakSet,hk=new WeakSet,hS=new WeakSet;class hx{isEmpty(){return isNaN((0,s._)(this,hd)[8])}add(t){var e;let{x:i,y:a}=t;(0,n._)(this,hc,i),(0,n._)(this,hu,a);let[r,l,o,h]=(0,s._)(this,hn),[d,c,u,_]=(0,s._)(this,hd).subarray(8,12),p=i-u,f=a-_,g=Math.hypot(p,f);if(g<(0,s._)(this,h_))return!1;let v=g-(0,s._)(this,hp),m=v/g,b=m*p,w=m*f,A=d,y=c;d=u,c=_,u+=b,_+=w,null===(e=(0,s._)(this,hv))||void 0===e||e.push(i,a);let k=-w/v*(0,s._)(this,hg),S=b/v*(0,s._)(this,hg);return((0,s._)(this,hd).set((0,s._)(this,hd).subarray(2,8),0),(0,s._)(this,hd).set([u+k,_+S],4),(0,s._)(this,hd).set((0,s._)(this,hd).subarray(14,18),12),(0,s._)(this,hd).set([u-k,_-S],16),isNaN((0,s._)(this,hd)[6]))?(0===(0,s._)(this,hh).length&&((0,s._)(this,hd).set([d+k,c+S],2),(0,s._)(this,hh).push(NaN,NaN,NaN,NaN,(d+k-r)/o,(c+S-l)/h),(0,s._)(this,hd).set([d-k,c-S],14),(0,s._)(this,hr).push(NaN,NaN,NaN,NaN,(d-k-r)/o,(c-S-l)/h)),(0,s._)(this,hd).set([A,y,d,c,u,_],6),!this.isEmpty()):(((0,s._)(this,hd).set([A,y,d,c,u,_],6),Math.abs(Math.atan2(y-c,A-d)-Math.atan2(w,b))<Math.PI/2)?([d,c,u,_]=(0,s._)(this,hd).subarray(2,6),(0,s._)(this,hh).push(NaN,NaN,NaN,NaN,((d+u)/2-r)/o,((c+_)/2-l)/h),[d,c,A,y]=(0,s._)(this,hd).subarray(14,18),(0,s._)(this,hr).push(NaN,NaN,NaN,NaN,((A+d)/2-r)/o,((y+c)/2-l)/h)):([A,y,d,c,u,_]=(0,s._)(this,hd).subarray(0,6),(0,s._)(this,hh).push(((A+5*d)/6-r)/o,((y+5*c)/6-l)/h,((5*d+u)/6-r)/o,((5*c+_)/6-l)/h,((d+u)/2-r)/o,((c+_)/2-l)/h),[u,_,d,c,A,y]=(0,s._)(this,hd).subarray(12,18),(0,s._)(this,hr).push(((A+5*d)/6-r)/o,((y+5*c)/6-l)/h,((5*d+u)/6-r)/o,((5*c+_)/6-l)/h,((d+u)/2-r)/o,((c+_)/2-l)/h)),!0)}toSVGPath(){if(this.isEmpty())return"";let t=(0,s._)(this,hh),e=(0,s._)(this,hr);if(isNaN((0,s._)(this,hd)[6])&&!this.isEmpty())return(0,l._)(this,hb,hT).call(this);let i=[];i.push("M".concat(t[4]," ").concat(t[5]));for(let e=6;e<t.length;e+=6)isNaN(t[e])?i.push("L".concat(t[e+4]," ").concat(t[e+5])):i.push("C".concat(t[e]," ").concat(t[e+1]," ").concat(t[e+2]," ").concat(t[e+3]," ").concat(t[e+4]," ").concat(t[e+5]));(0,l._)(this,hA,hL).call(this,i);for(let t=e.length-6;t>=6;t-=6)isNaN(e[t])?i.push("L".concat(e[t+4]," ").concat(e[t+5])):i.push("C".concat(e[t]," ").concat(e[t+1]," ").concat(e[t+2]," ").concat(e[t+3]," ").concat(e[t+4]," ").concat(e[t+5]));return(0,l._)(this,hw,hR).call(this,i),i.join(" ")}
1newFreeDrawOutline(t,e,i,s,a,n){return new hV(t,e,i,s,a,n)}getOutlines(){var t,e;let i=(0,s._)(this,hh),a=(0,s._)(this,hr),n=(0,s._)(this,hd),[r,o,h,d]=(0,s._)(this,hn),c=new Float64Array((null!==(e=null===(t=(0,s._)(this,hv))||void 0===t?void 0:t.length)&&void 0!==e?e:0)+2);for(let t=0,e=c.length-2;t<e;t+=2)c[t]=((0,s._)(this,hv)[t]-r)/h,c[t+1]=((0,s._)(this,hv)[t+1]-o)/d;if(c[c.length-2]=((0,s._)(this,hc)-r)/h,c[c.length-1]=((0,s._)(this,hu)-o)/d,isNaN(n[6])&&!this.isEmpty())return(0,l._)(this,hy,hI).call(this,c);let u=new Float64Array((0,s._)(this,hh).length+24+(0,s._)(this,hr).length),_=i.length;for(let t=0;t<_;t+=2){if(isNaN(i[t])){u[t]=u[t+1]=NaN;continue}u[t]=i[t],u[t+1]=i[t+1]}_=(0,l._)(this,hS,hD).call(this,u,_);for(let t=a.length-6;t>=6;t-=6)for(let e=0;e<6;e+=2){if(isNaN(a[t+e])){u[_]=u[_+1]=NaN,_+=2;continue}u[_]=a[t+e],u[_+1]=a[t+e+1],_+=2}return(0,l._)(this,hk,hP).call(this,u,_),this.newFreeDrawOutline(u,c,(0,s._)(this,hn),(0,s._)(this,hf),(0,s._)(this,hl),(0,s._)(this,ho))}constructor({x:t,y:e},i,r,l,d,c=0){(0,o._)(this,hm),(0,o._)(this,hb),(0,o._)(this,hw),(0,o._)(this,hA),(0,o._)(this,hy),(0,o._)(this,hk),(0,o._)(this,hS),(0,a._)(this,hn,{writable:!0,value:void 0}),(0,a._)(this,hr,{writable:!0,value:void 0}),(0,a._)(this,hl,{writable:!0,value:void 0}),(0,a._)(this,ho,{writable:!0,value:void 0}),(0,a._)(this,hh,{writable:!0,value:void 0}),(0,a._)(this,hd,{writable:!0,value:void 0}),(0,a._)(this,hc,{writable:!0,value:void 0}),(0,a._)(this,hu,{writable:!0,value:void 0}),(0,a._)(this,h_,{writable:!0,value:void 0}),(0,a._)(this,hp,{writable:!0,value:void 0}),(0,a._)(this,hf,{writable:!0,value:void 0}),(0,a._)(this,hg,{writable:!0,value:void 0}),(0,a._)(this,hv,{writable:!0,value:void 0}),(0,n._)(this,hr,[]),(0,n._)(this,hh,[]),(0,n._)(this,hd,new Float64Array(18)),(0,n._)(this,hv,[]),(0,n._)(this,hn,i),(0,n._)(this,hg,l*r),(0,n._)(this,ho,d),(0,s._)(this,hd).set([NaN,NaN,NaN,NaN,t,e],6),(0,n._)(this,hl,c),(0,n._)(this,hp,(0,h._)(hx,hx,hE)*r),(0,n._)(this,h_,(0,h._)(hx,hx,hM)*r),(0,n._)(this,hf,r),(0,s._)(this,hv).push(t,e)}}var hE={writable:!0,value:8},hM={writable:!0,value:(0,h._)(hx,hx,hE)+(0,h._)(hx,hx,{writable:!0,value:2})};function hC(){let t=(0,s._)(this,hd).subarray(4,6),e=(0,s._)(this,hd).subarray(16,18),[i,a,n,r]=(0,s._)(this,hn);return[((0,s._)(this,hc)+(t[0]-e[0])/2-i)/n,((0,s._)(this,hu)+(t[1]-e[1])/2-a)/r,((0,s._)(this,hc)+(e[0]-t[0])/2-i)/n,((0,s._)(this,hu)+(e[1]-t[1])/2-a)/r]}function hT(){let[t,e,i,a]=(0,s._)(this,hn),[n,r,o,h]=(0,l._)(this,hm,hC).call(this);return"M".concat(((0,s._)(this,hd)[2]-t)/i," ").concat(((0,s._)(this,hd)[3]-e)/a," L").concat(((0,s._)(this,hd)[4]-t)/i," ").concat(((0,s._)(this,hd)[5]-e)/a," L").concat(n," ").concat(r," L").concat(o," ").concat(h," L").concat(((0,s._)(this,hd)[16]-t)/i," ").concat(((0,s._)(this,hd)[17]-e)/a," L").concat(((0,s._)(this,hd)[14]-t)/i," ").concat(((0,s._)(this,hd)[15]-e)/a," Z")}function hR(t){let e=(0,s._)(this,hr);t.push("L".concat(e[4]," ").concat(e[5]," Z"))}function hL(t){let[e,i,a,n]=(0,s._)(this,hn),r=(0,s._)(this,hd).subarray(4,6),o=(0,s._)(this,hd).subarray(16,18),[h,d,c,u]=(0,l._)(this,hm,hC).call(this);t.push("L".concat((r[0]-e)/a," ").concat((r[1]-i)/n," L").concat(h," ").concat(d," L").concat(c," ").concat(u," L").concat((o[0]-e)/a," ").concat((o[1]-i)/n))}function hI(t){let e=(0,s._)(this,hd),[i,a,n,r]=(0,s._)(this,hn),[o,h,d,c]=(0,l._)(this,hm,hC).call(this),u=new Float64Array(36);return u.set([NaN,NaN,NaN,NaN,(e[2]-i)/n,(e[3]-a)/r,NaN,NaN,NaN,NaN,(e[4]-i)/n,(e[5]-a)/r,NaN,NaN,NaN,NaN,o,h,NaN,NaN,NaN,NaN,d,c,NaN,NaN,NaN,NaN,(e[16]-i)/n,(e[17]-a)/r,NaN,NaN,NaN,NaN,(e[14]-i)/n,(e[15]-a)/r],0),this.newFreeDrawOutline(u,t,(0,s._)(this,hn),(0,s._)(this,hf),(0,s._)(this,hl),(0,s._)(this,ho))}function hP(t,e){let i=(0,s._)(this,hr);return t.set([NaN,NaN,NaN,NaN,i[4],i[5]],e),e+6}function hD(t,e){let i=(0,s._)(this,hd).subarray(4,6),a=(0,s._)(this,hd).subarray(16,18),[n,r,o,h]=(0,s._)(this,hn),[d,c,u,_]=(0,l._)(this,hm,hC).call(this);return t.set([NaN,NaN,NaN,NaN,(i[0]-n)/o,(i[1]-r)/h,NaN,NaN,NaN,NaN,d,c,NaN,NaN,NaN,NaN,u,_,NaN,NaN,NaN,NaN,(a[0]-n)/o,(a[1]-r)/h],e),e+24}var hF=new WeakMap,hW=new WeakMap,hN=new WeakMap,hO=new WeakMap,hH=new WeakMap,hB=new WeakMap,hj=new WeakMap,hz=new WeakSet,hG=new WeakSet,hU=new WeakSet;class hV extends ha{toSVGPath(){let t=["M".concat((0,s._)(this,hj)[4]," ").concat((0,s._)(this,hj)[5])];for(let e=6,i=(0,s._)(this,hj).length;e<i;e+=6){if(isNaN((0,s._)(this,hj)[e])){t.push("L".concat((0,s._)(this,hj)[e+4]," ").concat((0,s._)(this,hj)[e+5]));continue}t.push("C".concat((0,s._)(this,hj)[e]," ").concat((0,s._)(this,hj)[e+1]," ").concat((0,s._)(this,hj)[e+2]," ").concat((0,s._)(this,hj)[e+3]," ").concat((0,s._)(this,hj)[e+4]," ").concat((0,s._)(this,hj)[e+5]))}return t.push("Z"),t.join(" ")}serialize(t,e){let i,a,[n,r,o,h]=t,d=o-n,c=h-r;switch(e){case 0:i=(0,l._)(this,hz,hq).call(this,(0,s._)(this,hj),n,h,d,-c),a=(0,l._)(this,hz,hq).call(this,(0,s._)(this,hH),n,h,d,-c);break;case 90:i=(0,l._)(this,hG,hK).call(this,(0,s._)(this,hj),n,r,d,c),a=(0,l._)(this,hG,hK).call(this,(0,s._)(this,hH),n,r,d,c);break;case 180:i=(0,l._)(this,hz,hq).call(this,(0,s._)(this,hj),o,r,-d,c),a=(0,l._)(this,hz,hq).call(this,(0,s._)(this,hH),o,r,-d,c);break;case 270:i=(0,l._)(this,hG,hK).call(this,(0,s._)(this,hj),o,h,-d,-c),a=(0,l._)(this,hG,hK).call(this,(0,s._)(this,hH),o,h,-d,-c)}return{outline:Array.from(i),points:[Array.from(a)]}}get box(){return(0,s._)(this,hW)}newOutliner(t,e,i,s,a){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;return new hx(t,e,i,s,a,n)}getNewOutline(t,e){let{x:i,y:a,width:n,height:r}=(0,s._)(this,hW),[l,o,h,d]=(0,s._)(this,hF),c=n*h,u=r*d,_=i*h+l,p=a*
1d+o,f=this.newOutliner({x:(0,s._)(this,hH)[0]*c+_,y:(0,s._)(this,hH)[1]*u+p},(0,s._)(this,hF),(0,s._)(this,hB),t,(0,s._)(this,hO),null!=e?e:(0,s._)(this,hN));for(let t=2;t<(0,s._)(this,hH).length;t+=2)f.add({x:(0,s._)(this,hH)[t]*c+_,y:(0,s._)(this,hH)[t+1]*u+p});return f.getOutlines()}get mustRemoveSelfIntersections(){return!0}constructor(t,e,i,r,h,d){super(),(0,o._)(this,hz),(0,o._)(this,hG),(0,o._)(this,hU),(0,a._)(this,hF,{writable:!0,value:void 0}),(0,a._)(this,hW,{writable:!0,value:void 0}),(0,a._)(this,hN,{writable:!0,value:void 0}),(0,a._)(this,hO,{writable:!0,value:void 0}),(0,a._)(this,hH,{writable:!0,value:void 0}),(0,a._)(this,hB,{writable:!0,value:void 0}),(0,a._)(this,hj,{writable:!0,value:void 0}),(0,n._)(this,hW,null),(0,n._)(this,hj,t),(0,n._)(this,hH,e),(0,n._)(this,hF,i),(0,n._)(this,hB,r),(0,n._)(this,hN,h),(0,n._)(this,hO,d),(0,l._)(this,hU,hX).call(this,d);let{x:c,y:u,width:_,height:p}=(0,s._)(this,hW);for(let e=0,i=t.length;e<i;e+=2)t[e]=(t[e]-c)/_,t[e+1]=(t[e+1]-u)/p;for(let t=0,i=e.length;t<i;t+=2)e[t]=(e[t]-c)/_,e[t+1]=(e[t+1]-u)/p}}function hq(t,e,i,s,a){let n=new Float64Array(t.length);for(let r=0,l=t.length;r<l;r+=2)n[r]=e+t[r]*s,n[r+1]=i+t[r+1]*a;return n}function hK(t,e,i,s,a){let n=new Float64Array(t.length);for(let r=0,l=t.length;r<l;r+=2)n[r]=e+t[r+1]*s,n[r+1]=i+t[r]*a;return n}function hX(t){let e=(0,s._)(this,hj),i=e[4],a=e[5],r=i,l=a,o=i,h=a,d=i,c=a,u=t?Math.max:Math.min;for(let t=6,s=e.length;t<s;t+=6){if(isNaN(e[t]))r=Math.min(r,e[t+4]),l=Math.min(l,e[t+5]),o=Math.max(o,e[t+4]),h=Math.max(h,e[t+5]),c<e[t+5]?(d=e[t+4],c=e[t+5]):c===e[t+5]&&(d=u(d,e[t+4]));else{let s=$.bezierBoundingBox(i,a,...e.slice(t,t+6));r=Math.min(r,s[0]),l=Math.min(l,s[1]),o=Math.max(o,s[2]),h=Math.max(h,s[3]),c<s[3]?(d=s[2],c=s[3]):c===s[3]&&(d=u(d,s[2]))}i=e[t+4],a=e[t+5]}let _=r-(0,s._)(this,hN),p=l-(0,s._)(this,hN),f=o-r+2*(0,s._)(this,hN),g=h-l+2*(0,s._)(this,hN);(0,n._)(this,hW,{x:_,y:p,width:f,height:g,lastPoint:[d,c]})}var hY=new WeakMap,hQ=new WeakMap,hJ=new WeakMap,hZ=new WeakSet,h$=new WeakSet,h0=new WeakSet,h1=new WeakSet,h2=new WeakSet;class h3{getOutlines(){(0,s._)(this,hQ).sort((t,e)=>t[0]-e[0]||t[1]-e[1]||t[2]-e[2]);let t=[];for(let e of(0,s._)(this,hQ))e[3]?(t.push(...(0,l._)(this,h2,h7).call(this,e)),(0,l._)(this,h0,h4).call(this,e)):((0,l._)(this,h1,h8).call(this,e),t.push(...(0,l._)(this,h2,h7).call(this,e)));return(0,l._)(this,hZ,h5).call(this,t)}constructor(t,e=0,i=0,r=!0){(0,o._)(this,hZ),(0,o._)(this,h$),(0,o._)(this,h0),(0,o._)(this,h1),(0,o._)(this,h2),(0,a._)(this,hY,{writable:!0,value:void 0}),(0,a._)(this,hQ,{writable:!0,value:void 0}),(0,a._)(this,hJ,{writable:!0,value:void 0}),(0,n._)(this,hQ,[]),(0,n._)(this,hJ,[]);let l=1/0,h=-1/0,d=1/0,c=-1/0;for(let{x:i,y:a,width:n,height:r}of t){let t=1e-4*Math.floor((i-e)/1e-4),o=1e-4*Math.ceil((i+n+e)/1e-4),u=1e-4*Math.floor((a-e)/1e-4),_=1e-4*Math.ceil((a+r+e)/1e-4),p=[t,u,_,!0],f=[o,u,_,!1];(0,s._)(this,hQ).push(p,f),l=Math.min(l,t),h=Math.max(h,o),d=Math.min(d,u),c=Math.max(c,_)}let u=h-l+2*i,_=c-d+2*i,p=l-i,f=d-i,g=(0,s._)(this,hQ).at(r?-1:-2),v=[g[0],g[2]];for(let t of(0,s._)(this,hQ)){let[e,i,s]=t;t[0]=(e-p)/u,t[1]=(i-f)/_,t[2]=(s-f)/_}(0,n._)(this,hY,{x:p,y:f,width:u,height:_,lastPoint:v})}}function h5(t){let e;let i=[],a=new Set;for(let e of t){let[t,s,a]=e;i.push([t,s,e],[t,a,e])}i.sort((t,e)=>t[1]-e[1]||t[0]-e[0]);for(let t=0,e=i.length;t<e;t+=2){let e=i[t][2],s=i[t+1][2];e.push(s),s.push(e),a.add(e),a.add(s)}let n=[];for(;a.size>0;){let t=a.values().next().value,[i,s,r,l,o]=t;a.delete(t);let h=i,d=s;for(e=[i,r],n.push(e);;){let t;if(a.has(l))t=l;else if(a.has(o))t=o;else break;a.delete(t),[i,s,r,l,o]=t,h!==i&&(e.push(h,d,i,d===s?s:r),h=i),d=d===s?r:s}e.push(h,d)}return new de(n,(0,s._)(this,hY))}function h6(t){let e=(0,s._)(this,hJ),i=0,a=e.length-1;for(;i<=a;){let s=i+a>>1,n=e[s][0];if(n===t)return s;n<t?i=s+1:a=s-1}return a+1}function h4(t){let[,e,i]=t,a=(0,l._)(this,h$,h6).call(this,e);(0,s._)(this,hJ).splice(a,0,[e,i])}function h8(t){let[,e,i]=t,a=(0,l._)(this,h$,h6).call(this,e);for(let t=a;t<(0,s._)(this,hJ).length;t++){let[a,n]=(0,s._)(this,hJ)[t];if(a!==e)break;if(a===e&&n===i){(0,s._)(this,hJ).splice(t,1);return}}for(let t=a-1;t>=0;t--){let[a,n]=(0,s._)(this,hJ)[t];if(a!==e)break;if(a===e&&n===i){(0,s._)(this,hJ).splice(t,1);return}}}function h7(t){let[e,i,a]=t,n=[[e,i,a]],r=(0,l._)(this,h$,h6).call(this,a);for(let t=0;t<r;t++){let[i,a]=(0,s._)(this,hJ)[t];for(let t=0,s=n.length;t<s;t++){let[,r,l]=n[t];if(!(a<=r)&&!(l<=i)){if(r>=i){if(l>a)n[t][1]=a;else{if(1===s)return[];n.splice(t,1),t--,s--}continue}n[t][2]=i,l>a&&n.push([e,a,l])}}}return n}var h9=new WeakMap,dt=new WeakMap;class de extends ha{toSVGPath(){let t=[];for(let e of(0,s._)(this,dt)){let[i,s]=e;t.push("M".concat(i," ").concat(s));for(let a=2;a<e.length;a+=2){let n=e[a],r=e[a+1];n===i?(t.push("V".concat(r)),s=r):r===s&&(t.push("H".concat(n)),i=n)}t.push("Z")}return t.join(" ")}serialize(t,e){let[i,a,n,r]=t,l=[],o=n-i,h=r-a;for(let t of(0,s._)(this,dt)){let e=Array(t.length);for(let s=0;s<t.length;s+=2)e[s]=i+t[s]*o,e[s+1]=r-t[s+1]*h;l.push(e)}return l}get box(){return(0,s._)(this,h9)}get classNamesForDrawing(){return["highlight"]}get classNamesForOutlining(){return["highlightOutline"]}constructor(t,e){super(),(0,a._)(this,h9,{writable:!0,value:void 0}),(0,a._)(this,dt,{writable:!0,value:void 0}),(0,n._)(this,dt,t),(0,n._)(this,h9,e)}
1}class di extends hx{newFreeDrawOutline(t,e,i,s,a,n){return new ds(t,e,i,s,a,n)}get classNamesForDrawing(){return["highlight","free"]}}class ds extends hV{get classNamesForDrawing(){return["highlight","free"]}get classNamesForOutlining(){return["highlightOutline","free"]}newOutliner(t,e,i,s,a){let n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;return new di(t,e,i,s,a,n)}}var da=new WeakMap,dn=new WeakMap,dr=new WeakMap,dl=new WeakMap,dh=new WeakMap,dd=new WeakMap,dc=new WeakMap,du=new WeakMap,d_=new WeakMap,dp=new WeakMap,df=new WeakMap,dg=new WeakSet,dv=new WeakSet,dm=new WeakSet,db=new WeakSet,dw=new WeakSet,dA=new WeakMap;class dy{static get _keyboardManager(){return H(this,"_keyboardManager",new el([[["Escape","mac+Escape"],dy.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],dy.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],dy.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],dy.prototype._moveToPrevious],[["Home","mac+Home"],dy.prototype._moveToBeginning],[["End","mac+End"],dy.prototype._moveToEnd]]))}renderButton(){let t=(0,n._)(this,da,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=(0,s._)(this,dp)._signal;t.addEventListener("click",(0,l._)(this,db,dM).bind(this),{signal:e}),t.addEventListener("keydown",(0,l._)(this,dm,dE).bind(this),{signal:e});let i=(0,n._)(this,dn,document.createElement("span"));return i.className="swatch",i.setAttribute("aria-hidden",!0),i.style.backgroundColor=(0,s._)(this,dr),t.append(i),t}renderMainDropdown(){let t=(0,n._)(this,dl,(0,l._)(this,dg,dS).call(this));return t.setAttribute("aria-orientation","horizontal"),t.setAttribute("aria-labelledby","highlightColorPickerLabel"),t}_colorSelectFromKeyboard(t){if(t.target===(0,s._)(this,da)){(0,l._)(this,db,dM).call(this,t);return}let e=t.target.getAttribute("data-color");e&&(0,l._)(this,dv,dx).call(this,e,t)}_moveToNext(t){var e,i;if(!(0,s._)(this,dA)){(0,l._)(this,db,dM).call(this,t);return}if(t.target===(0,s._)(this,da)){null===(i=(0,s._)(this,dl).firstChild)||void 0===i||i.focus();return}null===(e=t.target.nextSibling)||void 0===e||e.focus()}_moveToPrevious(t){var e,i;if(t.target===(null===(e=(0,s._)(this,dl))||void 0===e?void 0:e.firstChild)||t.target===(0,s._)(this,da)){(0,s._)(this,dA)&&this._hideDropdownFromKeyboard();return}(0,s._)(this,dA)||(0,l._)(this,db,dM).call(this,t),null===(i=t.target.previousSibling)||void 0===i||i.focus()}_moveToBeginning(t){var e;if(!(0,s._)(this,dA)){(0,l._)(this,db,dM).call(this,t);return}null===(e=(0,s._)(this,dl).firstChild)||void 0===e||e.focus()}_moveToEnd(t){var e;if(!(0,s._)(this,dA)){(0,l._)(this,db,dM).call(this,t);return}null===(e=(0,s._)(this,dl).lastChild)||void 0===e||e.focus()}hideDropdown(){var t,e;null===(t=(0,s._)(this,dl))||void 0===t||t.classList.add("hidden"),null===(e=(0,s._)(this,d_))||void 0===e||e.abort(),(0,n._)(this,d_,null)}_hideDropdownFromKeyboard(){if(!(0,s._)(this,dd)){if(!(0,s._)(this,dA)){var t;null===(t=(0,s._)(this,dc))||void 0===t||t.unselect();return}this.hideDropdown(),(0,s._)(this,da).focus({preventScroll:!0,focusVisible:(0,s._)(this,dh)})}}updateColor(t){if((0,s._)(this,dn)&&((0,s._)(this,dn).style.backgroundColor=t),!(0,s._)(this,dl))return;let e=(0,s._)(this,dp).highlightColors.values();for(let i of(0,s._)(this,dl).children)i.setAttribute("aria-selected",e.next().value===t)}destroy(){var t,e;null===(t=(0,s._)(this,da))||void 0===t||t.remove(),(0,n._)(this,da,null),(0,n._)(this,dn,null),null===(e=(0,s._)(this,dl))||void 0===e||e.remove(),(0,n._)(this,dl,null)}constructor({editor:t=null,uiManager:e=null}){var i;(0,o._)(this,dg),(0,o._)(this,dv),(0,o._)(this,dm),(0,o._)(this,db),(0,o._)(this,dw),(0,a._)(this,dA,{get:dT,set:void 0}),(0,a._)(this,da,{writable:!0,value:void 0}),(0,a._)(this,dn,{writable:!0,value:void 0}),(0,a._)(this,dr,{writable:!0,value:void 0}),(0,a._)(this,dl,{writable:!0,value:void 0}),(0,a._)(this,dh,{writable:!0,value:void 0}),(0,a._)(this,dd,{writable:!0,value:void 0}),(0,a._)(this,dc,{writable:!0,value:void 0}),(0,a._)(this,du,{writable:!0,value:void 0}),(0,a._)(this,d_,{writable:!0,value:void 0}),(0,a._)(this,dp,{writable:!0,value:void 0}),(0,a._)(this,df,{writable:!0,value:void 0}),(0,n._)(this,da,null),(0,n._)(this,dn,null),(0,n._)(this,dl,null),(0,n._)(this,dh,!1),(0,n._)(this,dd,!1),(0,n._)(this,dc,null),(0,n._)(this,d_,null),(0,n._)(this,dp,null),t?((0,n._)(this,dd,!1),(0,n._)(this,df,S.HIGHLIGHT_COLOR),(0,n._)(this,dc,t)):((0,n._)(this,dd,!0),(0,n._)(this,df,S.HIGHLIGHT_DEFAULT_COLOR)),(0,n._)(this,dp,(null==t?void 0:t._uiManager)||e),(0,n._)(this,du,(0,s._)(this,dp)._eventBus),(0,n._)(this,dr,(null==t?void 0:t.color)||(null===(i=(0,s._)(this,dp))||void 0===i?void 0:i.highlightColors.values().next().value)||"#FFFF98"),(0,d._)(dy,dy,dk,(0,h._)(dy,dy,dk)||Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"}))}}var dk={writable:!0,value:null};function dS(){let t=document.createElement("div"),e=(0,s._)(this,dp)._signal;for(let[i,a]of(t.addEventListener("contextmenu",tm,{signal:e}),t.className="dropdown",t.role="listbox",t.setAttribute("aria-multiselectable",!1),t.setAttribute("aria-orientation","vertical"),t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),(0,s._)(this,dp).highlightColors)){let n=document.createElement("button");n.tabIndex="0",n.role="option",n.setAttribute("data-color",a),n.title=i,n.setAttribute("data-l10n-id",(0,h._)(dy,dy,dk)[i]);let r=document.createElement("span");n.append(r),r.className="swatch",r.style.backgroundColor=a,n.setAttribute("aria-selected",a===(0,s._)(this,dr)),n.addEventListener("click",(0,l._)(this,dv,dx).bind(this,a),{signal:e}),t.append(n)}return t.addEventListener("keydown",(0,l._)(this,dm,dE).bind(this),{signal:e}),t}function dx(t,e){e.stopPropagation(),(0,s._)(this,du).dispatch("switchannotationeditorparams",{source:this,type:(0,s._)(this,df),value:t})}function dE(t){dy._keyboardManager.exec(this,t)}function dM(t){if((0,s._)(this,dA)){this.hideDropdown();return}if((0,n._)(this,dh,0===t.detail),(0,s._)(this,d_)||((0,n._)(this,d_,new AbortController),window.addEventListener("pointerdown",(0,l._)(this,dw,dC).bind(this),{signal:(0,s._)(this,dp).combinedSignal((0,s._)(this,d_))})),(0,s._)(this,dl)){(0,s._)(this,dl).classList.remove("hidden");return}let e=(0,n._)(this,dl,(0,l._)(this,dg,dS).call(this));(0,s._)(this,da).append(e)}function dC(t){var e;(null===(e=(0,s._)(this,dl))||void 0===e||!e.contains(t.target))&&this.hideDropdown()}function dT(){return(0,s._)(this,dl)&&!(0,s._)(this,dl).classList.contains("hidden")}var dR=new WeakMap,dL=new WeakMap,dI=new WeakMap,dP=new WeakMap,dD=new WeakMap,dF=new WeakMap,dW=new WeakMap,dN=new WeakMap,dO=new WeakMap,dH=new WeakMap,dB=new WeakMap,dj=new WeakMap,dz=new WeakMap,dG=new WeakMap,dU=new WeakMap,dV=new WeakMap,dq=new WeakMap,dK=new WeakMap,dX=new WeakSet,dY=new WeakSet,dQ=new WeakSet,dJ=new WeakSet,dZ=new WeakSet,d$=new WeakSet,d0=new WeakSet,d1=new WeakSet,d2=new WeakSet,d3=new WeakSet,d5=new WeakSet,d6=new WeakSet,d4=new WeakSet;class d8 extends sw{static get _keyboardManager(){let t=d8.prototype;return H(this,"_keyboardManager",new el([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}get telemetryInitialData(){return{action:"added",type:(0,s._)(this,dj)?"free_highlight":"highlight",color:this._uiManager.highlightColorNames.get(this.color),thickness:(0,s._)(this,dq),methodOfCreation:(0,s._)(this,dK)}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.highlightColorNames.get(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}static initialize(t,e){var i;sw.initialize(t,e),d8._defaultColor||(d8._defaultColor=(null===(i=e.highlightColors)||void 0===i?void 0:i.values().next().value)||"#fff066")}static updateDefaultParams(t,e){switch(t){case S.HIGHLIGHT_DEFAULT_COLOR:d8._defaultColor=e;break;case S.HIGHLIGHT_THICKNESS:d8._defaultThickness=e}}translateInPage(t,e){}get toolbarPosition(){return(0,s._)(this,dz)}updateParams(t,e){switch(t){case S.HIGHLIGHT_COLOR:(0,l._)(this,dQ,ct).call(this,e);break;case S.HIGHLIGHT_THICKNESS:(0,l._)(this,dJ,ce).call(this,e)}}static get defaultPropertiesToUpdate(){return[[S.HIGHLIGHT_DEFAULT_COLOR,d8._defaultColor],[S.HIGHLIGHT_THICKNESS,d8._defaultThickness]]}get propertiesToUpdate(){return[[S.HIGHLIGHT_COLOR,this.color||d8._defaultColor],[S.HIGHLIGHT_THICKNESS,(0,s._)(this,dq)||d8._defaultThickness],[S.HIGHLIGHT_FREE,(0,s._)(this,dj)]]}async addEditToolbar(){let t=await super.addEditToolbar();return t?(this._uiManager.highlightColors&&((0,n._)(this,dD,new dy({editor:this}
1)),t.addColorPicker((0,s._)(this,dD))),t):null}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition((0,l._)(this,d3,co).call(this))}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,(0,l._)(this,d3,co).call(this))}onceAdded(){this.annotationElementId||this.parent.addUndoableEditor(this),this.div.focus()}remove(){(0,l._)(this,d$,cs).call(this),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){if(this.parent)super.rebuild(),null!==this.div&&((0,l._)(this,d0,ca).call(this),this.isAttachedToDOM||this.parent.add(this))}setParent(t){let e=!1;if(this.parent&&!t)(0,l._)(this,d$,cs).call(this);else if(t){var i;(0,l._)(this,d0,ca).call(this,t),e=!this.parent&&(null===(i=this.div)||void 0===i?void 0:i.classList.contains("selectedEditor"))}super.setParent(t),this.show(this._isVisible),e&&this.select()}rotate(t){let e;let{drawLayer:i}=this.parent;(0,s._)(this,dj)?(t=(t-this.rotation+360)%360,e=(0,_._)(d8,d8,cn).call(d8,(0,s._)(this,dH).box,t)):e=(0,_._)(d8,d8,cn).call(d8,this,t),i.rotate((0,s._)(this,dB),t),i.rotate((0,s._)(this,dU),t),i.updateBox((0,s._)(this,dB),e),i.updateBox((0,s._)(this,dU),(0,_._)(d8,d8,cn).call(d8,(0,s._)(this,dF).box,t))}render(){if(this.div)return this.div;let t=super.render();(0,s._)(this,dV)&&(t.setAttribute("aria-label",(0,s._)(this,dV)),t.setAttribute("role","mark")),(0,s._)(this,dj)?t.classList.add("free"):this.div.addEventListener("keydown",(0,l._)(this,d1,cr).bind(this),{signal:this._uiManager._signal});let e=(0,n._)(this,dO,document.createElement("div"));t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=(0,s._)(this,dP);let[i,a]=this.parentDimensions;return this.setDims(this.width*i,this.height*a),t2(this,(0,s._)(this,dO),["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.isSelected||this.parent.drawLayer.addClass((0,s._)(this,dU),"hovered")}pointerleave(){this.isSelected||this.parent.drawLayer.removeClass((0,s._)(this,dU),"hovered")}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:(0,l._)(this,d2,cl).call(this,!0);break;case 1:case 3:(0,l._)(this,d2,cl).call(this,!1)}}select(){var t,e;super.select(),(0,s._)(this,dU)&&(null===(t=this.parent)||void 0===t||t.drawLayer.removeClass((0,s._)(this,dU),"hovered"),null===(e=this.parent)||void 0===e||e.drawLayer.addClass((0,s._)(this,dU),"selected"))}unselect(){var t;super.unselect(),(0,s._)(this,dU)&&(null===(t=this.parent)||void 0===t||t.drawLayer.removeClass((0,s._)(this,dU),"selected"),(0,s._)(this,dj)||(0,l._)(this,d2,cl).call(this,!1))}get _mustFixPosition(){return!(0,s._)(this,dj)}show(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._isVisible;super.show(t),this.parent&&(this.parent.drawLayer.show((0,s._)(this,dB),t),this.parent.drawLayer.show((0,s._)(this,dU),t))}static startHighlighting(t,e,i){let{target:s,x:a,y:n}=i,{x:r,y:l,width:o,height:h}=s.getBoundingClientRect(),d=new AbortController,c=t.combinedSignal(d),u=e=>{d.abort(),(0,_._)(this,d8,cu).call(d8,t,e)};window.addEventListener("blur",u,{signal:c}),window.addEventListener("pointerup",u,{signal:c}),window.addEventListener("pointerdown",t=>{t.preventDefault(),t.stopPropagation()},{capture:!0,passive:!1,signal:c}),window.addEventListener("contextmenu",tm,{signal:c}),s.addEventListener("pointermove",(0,_._)(this,d8,cc).bind(this,t),{signal:c}),this._freeHighlight=new di({x:a,y:n},[r,l,o,h],t.scale,this._defaultThickness/2,e,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.draw(this._freeHighlight,this._defaultColor,this._defaultOpacity,!0)}static async deserialize(t,e,i){let a=null;if(t instanceof oM){let{data:{quadPoints:e,rect:i,rotation:s,id:n,color:r,opacity:l,popupRef:o},parent:{page:{pageNumber:h}}}=t;a=t={annotationType:k.HIGHLIGHT,color:Array.from(r),opacity:l,quadPoints:e,boxes:null,pageIndex:h-1,rect:i.slice(0),rotation:s,id:n,deleted:!1,popupRef:o}}else if(t instanceof oE){let{data:{inkLists:e,rect:i,rotation:s,id:n,color:r,borderStyle:{rawWidth:l},popupRef:o},parent:{page:{pageNumber:h}}}=t;a=t={annotationType:k.HIGHLIGHT,color:Array.from(r),thickness:l,inkLists:e,boxes:null,pageIndex:h-1,rect:i.slice(0),rotation:s,id:n,deleted:!1,popupRef:o}}let{color:r,quadPoints:o,inkLists:h,opacity:d}=t,c=await super.deserialize(t,e,i);c.color=$.makeHexColor(...r),(0,n._)(c,dG,d||1),h&&(0,n._)(c,dq,t.thickness),c.annotationElementId=t.id||null,c._initialData=a;let[u,_]=c.pageDimensions,[p,f]=c.pageTranslation;if(o){let t=(0,n._)(c,dI,[]);for(let e=0;e<o.length;e+=8)t.push({x:(o[e]-p)/u,y:1-(o[e+1]-f)/_,width:(o[e+2]-o[e])/u,height:(o[e+1]-o[e+5])/_});
1(0,l._)(c,dX,d7).call(c),(0,l._)(c,d0,ca).call(c),c.rotate(c.rotation)}else if(h){(0,n._)(c,dj,!0);let t=h[0],i={x:t[0]-p,y:_-(t[1]-f)},a=new di(i,[0,0,u,_],1,(0,s._)(c,dq)/2,!0,.001);for(let e=0,s=t.length;e<s;e+=2)i.x=t[e]-p,i.y=_-(t[e+1]-f),a.add(i);let{id:r,clipPathId:o}=e.drawLayer.draw(a,c.color,c._defaultOpacity,!0);(0,l._)(c,dY,d9).call(c,{highlightOutlines:a.getOutlines(),highlightId:r,clipPathId:o}),(0,l._)(c,d0,ca).call(c)}return c}serialize(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();let e=this.getRect(0,0),i=sw._colorManager.convert(this.color),a={annotationType:k.HIGHLIGHT,color:i,opacity:(0,s._)(this,dG),thickness:(0,s._)(this,dq),quadPoints:(0,l._)(this,d5,ch).call(this),outlines:(0,l._)(this,d6,cd).call(this,e),pageIndex:this.pageIndex,rect:e,rotation:(0,l._)(this,d3,co).call(this),structTreeParentId:this._structTreeParentId};return this.annotationElementId&&!(0,l._)(this,d4,c_).call(this,a)?null:(a.id=this.annotationElementId,a)}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}static canCreateNewEmptyEditor(){return!1}constructor(t){super({...t,name:"highlightEditor"}),(0,o._)(this,dX),(0,o._)(this,dY),(0,o._)(this,dQ),(0,o._)(this,dJ),(0,o._)(this,dZ),(0,o._)(this,d$),(0,o._)(this,d0),(0,o._)(this,d1),(0,o._)(this,d2),(0,o._)(this,d3),(0,o._)(this,d5),(0,o._)(this,d6),(0,o._)(this,d4),(0,a._)(this,dR,{writable:!0,value:void 0}),(0,a._)(this,dL,{writable:!0,value:void 0}),(0,a._)(this,dI,{writable:!0,value:void 0}),(0,a._)(this,dP,{writable:!0,value:void 0}),(0,a._)(this,dD,{writable:!0,value:void 0}),(0,a._)(this,dF,{writable:!0,value:void 0}),(0,a._)(this,dW,{writable:!0,value:void 0}),(0,a._)(this,dN,{writable:!0,value:void 0}),(0,a._)(this,dO,{writable:!0,value:void 0}),(0,a._)(this,dH,{writable:!0,value:void 0}),(0,a._)(this,dB,{writable:!0,value:void 0}),(0,a._)(this,dj,{writable:!0,value:void 0}),(0,a._)(this,dz,{writable:!0,value:void 0}),(0,a._)(this,dG,{writable:!0,value:void 0}),(0,a._)(this,dU,{writable:!0,value:void 0}),(0,a._)(this,dV,{writable:!0,value:void 0}),(0,a._)(this,dq,{writable:!0,value:void 0}),(0,a._)(this,dK,{writable:!0,value:void 0}),(0,n._)(this,dR,null),(0,n._)(this,dL,0),(0,n._)(this,dP,null),(0,n._)(this,dD,null),(0,n._)(this,dF,null),(0,n._)(this,dW,null),(0,n._)(this,dN,0),(0,n._)(this,dO,null),(0,n._)(this,dH,null),(0,n._)(this,dB,null),(0,n._)(this,dj,!1),(0,n._)(this,dz,null),(0,n._)(this,dU,null),(0,n._)(this,dV,""),(0,n._)(this,dK,""),this.color=t.color||d8._defaultColor,(0,n._)(this,dq,t.thickness||d8._defaultThickness),(0,n._)(this,dG,t.opacity||d8._defaultOpacity),(0,n._)(this,dI,t.boxes||null),(0,n._)(this,dK,t.methodOfCreation||""),(0,n._)(this,dV,t.text||""),this._isDraggable=!1,t.highlightId>-1?((0,n._)(this,dj,!0),(0,l._)(this,dY,d9).call(this,t),(0,l._)(this,d0,ca).call(this)):(0,s._)(this,dI)&&((0,n._)(this,dR,t.anchorNode),(0,n._)(this,dL,t.anchorOffset),(0,n._)(this,dW,t.focusNode),(0,n._)(this,dN,t.focusOffset),(0,l._)(this,dX,d7).call(this),(0,l._)(this,d0,ca).call(this),this.rotate(this.rotation))}}function d7(){let t=new h3((0,s._)(this,dI),.001);(0,n._)(this,dH,t.getOutlines()),{x:this.x,y:this.y,width:this.width,height:this.height}=(0,s._)(this,dH).box;let e=new h3((0,s._)(this,dI),.0025,.001,"ltr"===this._uiManager.direction);(0,n._)(this,dF,e.getOutlines());let{lastPoint:i}=(0,s._)(this,dF).box;(0,n._)(this,dz,[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height])}function d9(t){let{highlightOutlines:e,highlightId:i,clipPathId:a}=t;if((0,n._)(this,dH,e),(0,n._)(this,dF,e.getNewOutline((0,s._)(this,dq)/2+1.5,.0025)),i>=0)(0,n._)(this,dB,i),(0,n._)(this,dP,a),this.parent.drawLayer.finalizeLine(i,e),(0,n._)(this,dU,this.parent.drawLayer.drawOutline((0,s._)(this,dF)));else if(this.parent){let t=this.parent.viewport.rotation;this.parent.drawLayer.updateLine((0,s._)(this,dB),e),this.parent.drawLayer.updateBox((0,s._)(this,dB),(0,_._)(d8,d8,cn).call(d8,(0,s._)(this,dH).box,(t-this.rotation+360)%360)),this.parent.drawLayer.updateLine((0,s._)(this,dU),(0,s._)(this,dF)),this.parent.drawLayer.updateBox((0,s._)(this,dU),(0,_._)(d8,d8,cn).call(d8,(0,s._)(this,dF).box,t))}let{x:r,y:l,width:o,height:h}=e.box;switch(this.rotation){case 0:this.x=r,this.y=l,this.width=o,this.height=h;break;case 90:{let[t,e]=this.parentDimensions;this.x=l,this.y=1-r,this.width=o*e/t,this.height=h*t/e;break}case 180:this.x=1-r,this.y=1-l,this.width=o,this.height=h;break;case 270:{let[t,e]=this.parentDimensions;this.x=1-l,this.y=r,this.width=o*e/t,this.height=h*t/e}}let{lastPoint:d}=(0,s._)(this,dF).box;(0,n._)(this,dz,[(d[0]-r)/o,(d[1]-l)/h])}function ct(t){let e=(t,e)=>{var i,a,r;this.color=t,null===(i=this.parent)||void 0===i||i.drawLayer.changeColor((0,s._)(this,dB),t),null===(a=(0,s._)(this,dD)
1)||void 0===a||a.updateColor(t),(0,n._)(this,dG,e),null===(r=this.parent)||void 0===r||r.drawLayer.changeOpacity((0,s._)(this,dB),e)},i=this.color,a=(0,s._)(this,dG);this.addCommands({cmd:e.bind(this,t,d8._defaultOpacity),undo:e.bind(this,i,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:S.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.highlightColorNames.get(t)},!0)}function ce(t){let e=(0,s._)(this,dq),i=t=>{(0,n._)(this,dq,t),(0,l._)(this,dZ,ci).call(this,t)};this.addCommands({cmd:i.bind(this,t),undo:i.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:S.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}function ci(t){if(!(0,s._)(this,dj))return;(0,l._)(this,dY,d9).call(this,{highlightOutlines:(0,s._)(this,dH).getNewOutline(t/2)}),this.fixAndSetPosition();let[e,i]=this.parentDimensions;this.setDims(this.width*e,this.height*i)}function cs(){null!==(0,s._)(this,dB)&&this.parent&&(this.parent.drawLayer.remove((0,s._)(this,dB)),(0,n._)(this,dB,null),this.parent.drawLayer.remove((0,s._)(this,dU)),(0,n._)(this,dU,null))}function ca(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.parent;null===(0,s._)(this,dB)&&({id:(0,u._)(this,dB).value,clipPathId:(0,u._)(this,dP).value}=t.drawLayer.draw((0,s._)(this,dH),this.color,(0,s._)(this,dG)),(0,n._)(this,dU,t.drawLayer.drawOutline((0,s._)(this,dF))),(0,s._)(this,dO)&&((0,s._)(this,dO).style.clipPath=(0,s._)(this,dP)))}function cn(t,e){let{x:i,y:s,width:a,height:n}=t;switch(e){case 90:return{x:1-s-n,y:i,width:n,height:a};case 180:return{x:1-i-a,y:1-s-n,width:a,height:n};case 270:return{x:s,y:1-i-a,width:n,height:a}}return{x:i,y:s,width:a,height:n}}function cr(t){d8._keyboardManager.exec(this,t)}function cl(t){if(!(0,s._)(this,dR))return;let e=window.getSelection();t?e.setPosition((0,s._)(this,dR),(0,s._)(this,dL)):e.setPosition((0,s._)(this,dW),(0,s._)(this,dN))}function co(){return(0,s._)(this,dj)?this.rotation:0}function ch(){if((0,s._)(this,dj))return null;let[t,e]=this.pageDimensions,[i,a]=this.pageTranslation,n=(0,s._)(this,dI),r=new Float32Array(8*n.length),l=0;for(let{x:s,y:o,width:h,height:d}of n){let n=s*t+i,c=(1-o-d)*e+a;r[l]=r[l+4]=n,r[l+1]=r[l+3]=c,r[l+2]=r[l+6]=n+h*t,r[l+5]=r[l+7]=c+d*e,l+=8}return r}function cd(t){return(0,s._)(this,dH).serialize(t,(0,l._)(this,d3,co).call(this))}function cc(t,e){this._freeHighlight.add(e)&&t.drawLayer.updatePath(this._freeHighlightId,this._freeHighlight)}function cu(t,e){this._freeHighlight.isEmpty()?t.drawLayer.remove(this._freeHighlightId):t.createAndAddNewEditor(e,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}function c_(t){let{color:e}=this._initialData;return t.color.some((t,i)=>t!==e[i])}d8._defaultColor=null,d8._defaultOpacity=1,d8._defaultThickness=12,d8._type="highlight",d8._editorType=k.HIGHLIGHT,d8._freeHighlightId=-1,d8._freeHighlight=null,d8._freeHighlightClipId="";var cp=new WeakMap,cf=new WeakMap,cg=new WeakMap,cv=new WeakMap,cm=new WeakMap,cb=new WeakMap,cw=new WeakMap,cA=new WeakMap,cy=new WeakMap,ck=new WeakMap,cS=new WeakMap,cx=new WeakMap,cE=new WeakMap,cM=new WeakSet,cC=new WeakSet,cT=new WeakSet,cR=new WeakSet,cL=new WeakSet,cI=new WeakSet,cP=new WeakSet,cD=new WeakSet,cF=new WeakSet,cW=new WeakSet,cN=new WeakSet,cO=new WeakSet,cH=new WeakSet,cB=new WeakSet,cj=new WeakSet,cz=new WeakSet,cG=new WeakSet,cU=new WeakSet,cV=new WeakSet,cq=new WeakSet,cK=new WeakSet,cX=new WeakSet,cY=new WeakSet,cQ=new WeakSet,cJ=new WeakSet;class cZ extends sw{static initialize(t,e){sw.initialize(t,e)}static updateDefaultParams(t,e){switch(t){case S.INK_THICKNESS:cZ._defaultThickness=e;break;case S.INK_COLOR:cZ._defaultColor=e;break;case S.INK_OPACITY:cZ._defaultOpacity=e/100}}updateParams(t,e){switch(t){case S.INK_THICKNESS:(0,l._)(this,cM,c$).call(this,e);break;case S.INK_COLOR:(0,l._)(this,cC,c0).call(this,e);break;case S.INK_OPACITY:(0,l._)(this,cT,c1).call(this,e)}}static get defaultPropertiesToUpdate(){return[[S.INK_THICKNESS,cZ._defaultThickness],[S.INK_COLOR,cZ._defaultColor||sw._defaultLineColor],[S.INK_OPACITY,Math.round(100*cZ._defaultOpacity)]]}get propertiesToUpdate(){var t;return[[S.INK_THICKNESS,this.thickness||cZ._defaultThickness],[S.INK_COLOR,this.color||cZ._defaultColor||sw._defaultLineColor],[S.INK_OPACITY,Math.round(100*(null!==(t=this.opacity)&&void 0!==t?t:cZ._defaultOpacity))]]}rebuild(){if(this.parent)super.rebuild(),null!==this.div&&(this.canvas||((0,l._)(this,cG,un).call(this),(0,l._)(this,cU,ur).call(this)),this.isAttachedToDOM||(this.parent.add(this),(0,l._)(this,cV,ul).call(this)),(0,l._)(this,cJ,ug).call(this))}remove(){var t;null!==this.canvas&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,(0,s._)(this,cg)&&(clearTimeout((0,s._)(this,cg)),(0,n._)(this,cg,null)),null===(t=(0,s._)(this,cy))||void 0===t||t.disconnect(),(0,n._)(this,cy,null),super.remove())}setParent(t){!this.parent&&t?this._uiManager.removeShouldRescale(this):this.parent&&null===t&&this._uiManager.addShouldRescale(this),super.setParent(t)}onScaleChanging(){let[t,e]=this.parentDimensions,i=this.width*t,s=this.height*e;this.setDimensions(i,s)}enableEditMode(){!(0,s._)(this,cm)&&null!==this.canvas&&(super.enableEditMode(),this._isDraggable=!1,(0,l._)(this,cB,ui).call(this))}disableEditMode(){this.isInEditMode()&&null!==this.canvas&&(super.disableEditMode(),this._isDraggable=!this.isEmpty(),this.div.classList.remove("editing"),(0,l._)(this,cj,us).call(this))}onceAdded(){this._isDraggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}commit(){!(0,s._)(this,cm)&&(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),(0,n._)(this,cm,!0),this.div.classList.add("disabled"),(0,l._)(this,cJ,ug).call(this,!0),this.select(),this.parent.addInkEditorIfNeeded(!0),this.moveInDOM(),this.div.focus({preventScroll:!0}))}focusin(t){this._focusEventsAllowed&&(super.focusin(t),this.enableEditMode())}canvasPointerdown(t){!(0!==t.button||!this.isInEditMode()||(0,s._)(this,cm))&&(this.setInForeground(),t.preventDefault(),this.div.contains(document.activeElement)||this.div.focus({preventScroll:!0}),(0,l._)(this,cI,c5).call(this,t.offsetX,t.offsetY))}canvasPointermove(t){t.preventDefault(),(0,l._)(this,cP,c6).call(this,t.offsetX,t.offsetY)}canvasPointerup(t){t.preventDefault(),(0,l._)(this,cz,ua).call(this,t)}canvasPointerleave(t){(0,l._)(this,cz,ua).call(this,t)}get isResizable(){return!this.isEmpty()&&(0,s._)(this,cm)}render(){let t,e;if(this.div)return this.div;this.width&&(t=this.x,e=this.y),super.render(),this.div.setAttribute("data-l10n-id","pdfjs-ink");let[i,s,a,r]=(0,l._)(this,cR,c2).call(this);if(this.setAt(i,s,0,0),this.setDims(a,r),(0,l._)(this,cG,un).call(this),this.width){let[i,s]=this.parentDimensions;this.setAspectRatio(this.width*i,this.height*s),this.setAt(t*i,e*s,this.width*i,this.height*s),(0,n._)(this,cA,!0),(0,l._)(this,cV,ul).call(this),this.setDims(this.width*i,this.height*s),(0,l._)(this,cH,ue).call(this),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return(0,l._)(this,cU,ur).call(this),this.div}setDimensions(t,e){let i=Math.round(t),a=Math.round(e);if((0,s._)(this,cS)===i&&(0,s._)(this,cx)===a)return;(0,n._)(this,cS,i),(0,n._)(this,cx,a),this.canvas.style.visibility="hidden";let[r,o]=this.parentDimensions;this.width=t/r,this.height=e/o,this.fixAndSetPosition(),(0,s._)(this,cm)&&(0,l._)(this,cq,uo).call(this,t,e),(0,l._)(this,cV,ul).call(this),(0,l._)(this,cH,ue).call(this),this.canvas.style.visibility="visible",this.fixDims()}static async deserialize(t,e,i){if(t instanceof oE)return null;let s=await super.deserialize(t,e,i);s.thickness=t.thickness,s.color=$.makeHexColor(...t.color),s.opacity=t.opacity;let[a,r]=s.pageDimensions,o=s.width*a,h=s.height*r,d=s.parentScale,c=t.thickness/2;(0,n._)(s,cm,!0),(0,n._)(s,cS,Math.round(o)),(0,n._)(s,cx,Math.round(h));let{paths:u,rect:p,rotation:f}=t;for(let{bezier:t}of u){t=(0,_._)(cZ,cZ,uu).call(cZ,t,p,f);let e=[];s.paths.push(e);let i=d*(t[0]-c),a=d*(t[1]-c);for(let s=2,n=t.length;s<n;s+=6){let n=d*(t[s]-c),r=d*(t[s+1]-c),l=d*(t[s+2]-c),o=d*(t[s+3]-c),h=d*(t[s+4]-c),u=d*(t[s+5]-c);e.push([[i,a],[n,r],[l,o],[h,u]]),i=h,a=u}let n=(0,_._)(this,cZ,ud).call(cZ,e);s.bezierPath2D.push(n)}let g=(0,l._)(s,cY,up).call(s);return(0,n._)(s,cf,Math.max(sw.MIN_SIZE,g[2]-g[0])),(0,n._)(s,cp,Math.max(sw.MIN_SIZE,g[3]-g[1])),(0,l._)(s,cq,uo).call(s,o,h),s}serialize(){if(this.isEmpty())return null;let t=this.getRect(0,0),e=sw._colorManager.convert(this.ctx.strokeStyle);return{annotationType:k.INK,color:e,thickness:this.thickness,opacity:this.opacity,paths:(0,l._)(this,cX,u_).call(this,this.scaleFactor/this.parentScale,this.translationX,this.translationY,t),pageIndex:this.pageIndex,rect:t,rotation:this.rotation,structTreeParentId:this._structTreeParentId}}constructor(t){super({...t,name:"inkEditor"}),(0,o._)(this,cM),(0,o._)(this,cC),(0,o._)(this,cT),(0,o._)(this,cR),(0,o._)(this,cL),(0,o._)(this,cI),(0,o._)(this,cP),(0,o._)(this,cD),(0,o._)(this,cF),(0,o._)(this,cW),(0,o._)(this,cN),(0,o._)(this,cO),(0,o._)(this,cH),(0,o._)(this,cB),(0,o._)(this,cj),(0,o._)(this,cz),(0,o._)(this,cG),(0,o._)(this,cU),(0,o._)(this,cV),(0,o._)(this,cq),(0,o._)(this,cK),(0,o._)(this,cX),(0,o._)(this,cY),(0,o._)(this,cQ),(0,o._)(this,cJ),(0,a._)(this,cp,{writable:!0,value:void 0}),(0,a._)(this,cf,{writable:!0,value:void 0}),(0,a._)(this,cg,{writable:!0,value:void 0}),(0,a._)(this,cv,{writable:!0,value:void 0}),(0,a._)(this,cm,{writable:!0,value:void 0}),(0,a._)(this,cb,{writable:!0,value:void 0}),(0,a._)(this,cw,{writable:!0,value:void 0}),(0,a._)(this,cA,{writable:!0,value:void 0}),(0,a._)(this,cy,{writable:!0,value:void 0}),(0,a._)(this,ck,{writable:!0,value:void 0}),(0,a._)(this,cS,{writable:!0,value:void 0}),(0,a._)(this,cx,{writable:!0,value:void 0}),(0,a._)(this,cE,{writable:!0,value:void 0}),(0,n._)(this,cp,0),(0,n._)(this,cf,0),(0,n._)(this,cg,null),(0,n._)(this,cv,new Path2D),(0,n._)(this,cm,!1),(0,n._)(this,cb,null),(0,n._)(this,cw,!1),(0,n._)(this,cA,!1),(0,n._)(this,cy,null),(0,n._)(this,ck,null),(0,n._)(this,cS,0),(0,n._)(this,cx,0),(0,n._)(this,cE,null),this.color=t.color||null,this.thickness=t.thickness||null,this.opacity=t.opacity||null,this.paths=[],this.bezierPath2D=[],this.allRawPaths=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0,this._willKeepAspectRatio=!0}}function c$(t){let e=t=>{this.thickness=t,(0,l._)(this,cJ,ug).call(this)},i=this.thickness;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:S.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}function c0(t){let e=t=>{this.color=t,(0,l._)(this,cH,ue).call(this)},i=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:S.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}function c1(t){let e=t=>{this.opacity=t,(0,l._)(this,cH,ue).call(this)};t/=100;let i=this.opacity;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:S.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}function c2(){let{parentRotation:t,parentDimensions:[e,i]}=this;switch(t){case 90:return[0,i,i,e];case 180:return[e,i,e,i];case 270:return[e,0,i,e];default:return[0,0,e,i]}}function c3(){let{ctx:t,color:e,opacity:i,thickness:s,parentScale:a,scaleFactor:n}=this;
1t.lineWidth=s*a/n,t.lineCap="round",t.lineJoin="round",t.miterLimit=10,t.strokeStyle="".concat(e).concat(Math.round(Math.min(255,Math.max(1,255*i))).toString(16).padStart(2,"0"))}function c5(t,e){this.canvas.addEventListener("contextmenu",tm,{signal:this._uiManager._signal}),(0,l._)(this,cj,us).call(this),(0,n._)(this,cb,new AbortController);let i=this._uiManager.combinedSignal((0,s._)(this,cb));if(this.canvas.addEventListener("pointerleave",this.canvasPointerleave.bind(this),{signal:i}),this.canvas.addEventListener("pointermove",this.canvasPointermove.bind(this),{signal:i}),this.canvas.addEventListener("pointerup",this.canvasPointerup.bind(this),{signal:i}),this.isEditing=!0,!(0,s._)(this,cA)){var a;(0,n._)(this,cA,!0),(0,l._)(this,cV,ul).call(this),this.thickness||(this.thickness=cZ._defaultThickness),this.color||(this.color=cZ._defaultColor||sw._defaultLineColor),null!==(a=this.opacity)&&void 0!==a||(this.opacity=cZ._defaultOpacity)}this.currentPath.push([t,e]),(0,n._)(this,cw,!1),(0,l._)(this,cL,c3).call(this),(0,n._)(this,cE,()=>{(0,l._)(this,cW,c7).call(this),(0,s._)(this,cE)&&window.requestAnimationFrame((0,s._)(this,cE))}),window.requestAnimationFrame((0,s._)(this,cE))}function c6(t,e){let[i,a]=this.currentPath.at(-1);if(this.currentPath.length>1&&t===i&&e===a)return;let r=this.currentPath,o=(0,s._)(this,cv);if(r.push([t,e]),(0,n._)(this,cw,!0),r.length<=2){o.moveTo(...r[0]),o.lineTo(t,e);return}3===r.length&&((0,n._)(this,cv,o=new Path2D),o.moveTo(...r[0])),(0,l._)(this,cN,c9).call(this,o,...r.at(-3),...r.at(-2),t,e)}function c4(){if(0===this.currentPath.length)return;let t=this.currentPath.at(-1);(0,s._)(this,cv).lineTo(...t)}function c8(t,e){let i;if((0,n._)(this,cE,null),t=Math.min(Math.max(t,0),this.canvas.width),e=Math.min(Math.max(e,0),this.canvas.height),(0,l._)(this,cP,c6).call(this,t,e),(0,l._)(this,cD,c4).call(this),1!==this.currentPath.length)i=(0,l._)(this,cO,ut).call(this);else{let s=[t,e];i=[[s,s.slice(),s.slice(),s]]}let a=(0,s._)(this,cv),r=this.currentPath;this.currentPath=[],(0,n._)(this,cv,new Path2D),this.addCommands({cmd:()=>{this.allRawPaths.push(r),this.paths.push(i),this.bezierPath2D.push(a),this._uiManager.rebuild(this)},undo:()=>{this.allRawPaths.pop(),this.paths.pop(),this.bezierPath2D.pop(),0===this.paths.length?this.remove():(this.canvas||((0,l._)(this,cG,un).call(this),(0,l._)(this,cU,ur).call(this)),(0,l._)(this,cJ,ug).call(this))},mustExec:!0})}function c7(){if(!(0,s._)(this,cw))return;(0,n._)(this,cw,!1),this.thickness,this.parentScale;let t=this.currentPath.slice(-3);t.map(t=>t[0]),t.map(t=>t[1]);let{ctx:e}=this;for(let t of(e.save(),e.clearRect(0,0,this.canvas.width,this.canvas.height),this.bezierPath2D))e.stroke(t);e.stroke((0,s._)(this,cv)),e.restore()}function c9(t,e,i,s,a,n,r){let l=(e+s)/2,o=(i+a)/2,h=(s+n)/2,d=(a+r)/2;t.bezierCurveTo(l+2*(s-l)/3,o+2*(a-o)/3,h+2*(s-h)/3,d+2*(a-d)/3,h,d)}function ut(){let t;let e=this.currentPath;if(e.length<=2)return[[e[0],e[0],e.at(-1),e.at(-1)]];let i=[],[s,a]=e[0];for(t=1;t<e.length-2;t++){let[n,r]=e[t],[l,o]=e[t+1],h=(n+l)/2,d=(r+o)/2,c=[s+2*(n-s)/3,a+2*(r-a)/3],u=[h+2*(n-h)/3,d+2*(r-d)/3];i.push([[s,a],c,u,[h,d]]),[s,a]=[h,d]}let[n,r]=e[t],[l,o]=e[t+1],h=[s+2*(n-s)/3,a+2*(r-a)/3];return i.push([[s,a],h,[l+2*(n-l)/3,o+2*(r-o)/3],[l,o]]),i}function ue(){if(this.isEmpty()){(0,l._)(this,cK,uh).call(this);return}(0,l._)(this,cL,c3).call(this);let{canvas:t,ctx:e}=this;for(let i of(e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,t.width,t.height),(0,l._)(this,cK,uh).call(this),this.bezierPath2D))e.stroke(i)}function ui(){if((0,s._)(this,ck))return;(0,n._)(this,ck,new AbortController);let t=this._uiManager.combinedSignal((0,s._)(this,ck));this.canvas.addEventListener("pointerdown",this.canvasPointerdown.bind(this),{signal:t})}function us(){var t;null===(t=this.pointerdownAC)||void 0===t||t.abort(),this.pointerdownAC=null}function ua(t){var e;null===(e=(0,s._)(this,cb))||void 0===e||e.abort(),(0,n._)(this,cb,null),(0,l._)(this,cB,ui).call(this),(0,s._)(this,cg)&&clearTimeout((0,s._)(this,cg)),(0,n._)(this,cg,setTimeout(()=>{(0,n._)(this,cg,null),this.canvas.removeEventListener("contextmenu",tm)},10)),(0,l._)(this,cF,c8).call(this,t.offsetX,t.offsetY),this.addToAnnotationStorage(),this.setInBackgroun
1d()}function un(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",this.canvas.setAttribute("data-l10n-id","pdfjs-ink-canvas"),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")}function ur(){(0,n._)(this,cy,new ResizeObserver(t=>{let e=t[0].contentRect;e.width&&e.height&&this.setDimensions(e.width,e.height)})),(0,s._)(this,cy).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var t;null===(t=(0,s._)(this,cy))||void 0===t||t.disconnect(),(0,n._)(this,cy,null)},{once:!0})}function ul(){if(!(0,s._)(this,cA))return;let[t,e]=this.parentDimensions;this.canvas.width=Math.ceil(this.width*t),this.canvas.height=Math.ceil(this.height*e),(0,l._)(this,cK,uh).call(this)}function uo(t,e){let i=(0,l._)(this,cQ,uf).call(this),a=(t-i)/(0,s._)(this,cf),n=(e-i)/(0,s._)(this,cp);this.scaleFactor=Math.min(a,n)}function uh(){let t=(0,l._)(this,cQ,uf).call(this)/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+t,this.translationY*this.scaleFactor+t)}function ud(t){let e=new Path2D;for(let i=0,s=t.length;i<s;i++){let[s,a,n,r]=t[i];0===i&&e.moveTo(...s),e.bezierCurveTo(a[0],a[1],n[0],n[1],r[0],r[1])}return e}function uc(t,e,i){let[s,a,n,r]=e;switch(i){case 0:for(let e=0,i=t.length;e<i;e+=2)t[e]+=s,t[e+1]=r-t[e+1];break;case 90:for(let e=0,i=t.length;e<i;e+=2){let i=t[e];t[e]=t[e+1]+s,t[e+1]=i+a}break;case 180:for(let e=0,i=t.length;e<i;e+=2)t[e]=n-t[e],t[e+1]+=a;break;case 270:for(let e=0,i=t.length;e<i;e+=2){let i=t[e];t[e]=n-t[e+1],t[e+1]=r-i}break;default:throw Error("Invalid rotation")}return t}function uu(t,e,i){let[s,a,n,r]=e;switch(i){case 0:for(let e=0,i=t.length;e<i;e+=2)t[e]-=s,t[e+1]=r-t[e+1];break;case 90:for(let e=0,i=t.length;e<i;e+=2){let i=t[e];t[e]=t[e+1]-a,t[e+1]=i-s}break;case 180:for(let e=0,i=t.length;e<i;e+=2)t[e]=n-t[e],t[e+1]-=a;break;case 270:for(let e=0,i=t.length;e<i;e+=2){let i=t[e];t[e]=r-t[e+1],t[e+1]=n-i}break;default:throw Error("Invalid rotation")}return t}function u_(t,e,i,s){let a=[],n=this.thickness/2,r=t*e+n,l=t*i+n;for(let e of this.paths){let i=[],n=[];for(let s=0,a=e.length;s<a;s++){let[o,h,d,c]=e[s];if(o[0]===c[0]&&o[1]===c[1]&&1===a){let e=t*o[0]+r,s=t*o[1]+l;i.push(e,s),n.push(e,s);break}let u=t*o[0]+r,_=t*o[1]+l,p=t*h[0]+r,f=t*h[1]+l,g=t*d[0]+r,v=t*d[1]+l,m=t*c[0]+r,b=t*c[1]+l;0===s&&(i.push(u,_),n.push(u,_)),i.push(p,f,g,v,m,b),n.push(p,f),s===a-1&&n.push(m,b)}a.push({bezier:(0,_._)(cZ,cZ,uc).call(cZ,i,s,this.rotation),points:(0,_._)(cZ,cZ,uc).call(cZ,n,s,this.rotation)})}return a}function up(){let t=1/0,e=-1/0,i=1/0,s=-1/0;for(let a of this.paths)for(let[n,r,l,o]of a){let a=$.bezierBoundingBox(...n,...r,...l,...o);t=Math.min(t,a[0]),i=Math.min(i,a[1]),e=Math.max(e,a[2]),s=Math.max(s,a[3])}return[t,i,e,s]}function uf(){return(0,s._)(this,cm)?Math.ceil(this.thickness*this.parentScale):0}function ug(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.isEmpty())return;if(!(0,s._)(this,cm)){(0,l._)(this,cH,ue).call(this);return}let e=(0,l._)(this,cY,up).call(this),i=(0,l._)(this,cQ,uf).call(this);(0,n._)(this,cf,Math.max(sw.MIN_SIZE,e[2]-e[0])),(0,n._)(this,cp,Math.max(sw.MIN_SIZE,e[3]-e[1]));let a=Math.ceil(i+(0,s._)(this,cf)*this.scaleFactor),r=Math.ceil(i+(0,s._)(this,cp)*this.scaleFactor),[o,h]=this.parentDimensions;this.width=a/o,this.height=r/h,this.setAspectRatio(a,r);let d=this.translationX,c=this.translationY;this.translationX=-e[0],this.translationY=-e[1],(0,l._)(this,cV,ul).call(this),(0,l._)(this,cH,ue).call(this),(0,n._)(this,cS,a),(0,n._)(this,cx,r),this.setDims(a,r);let u=t?i/this.scaleFactor/2:0;this.translate(d-this.translationX-u,c-this.translationY-u)}cZ._defaultColor=null,cZ._defaultOpacity=1,cZ._defaultThickness=1,cZ._type="ink",cZ._editorType=k.INK;var uv=new WeakMap,um=new WeakMap,ub=new WeakMap,uw=new WeakMap,uA=new WeakMap,uy=new WeakMap,uk=new WeakMap,uS=new WeakMap,ux=new WeakMap,uE=new WeakMap,uM=new WeakMap,uC=new WeakSet,uT=new WeakSet,uR=new WeakSet,uL=new WeakSet,uI=new WeakSet,uP=new WeakSet,uD=new WeakSet,uF=new WeakSet,uW=new WeakSet,uN=new WeakSet;class uO extends sw{static initialize(t,e){sw.initialize(t,e)}static get supportedTypes(){return H(this,"supportedTypes",["apng","avif","bmp","gif","jpeg","png","svg+xml","webp","x-icon"].map(t=>"image/".concat(t)))}static get supportedTypesStr(){return H(this,"supportedTypesStr",this.supportedTypes.join(","))}static isHandlingMimeForPasting(t){return this.supportedTypes.includes(t)}static paste(t,e){e.pasteEditor(k.STAMP,{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){var t;return{type:"stamp",hasAltText:!!(null===(t=this.altTextData)||void 0===t?void 0:t.altText)}}static computeTelemetryFinalData(t){var e,i;let s=t.get("hasAltText");return{hasAltText:null!==(e=s.get(!0))&&void 0!==e?e:0,hasNoAltText:null!==(i=s.get(!1))&&void 0!==i?i:0}}async mlGuessAltText(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(this.hasAltTextData())return null;let{mlManager:i}=this._uiManager;if(!i)throw Error("No ML.");if(!await i.isEnabledFor("altText"))throw Error("ML isn't enabled for alt text.");let{data:s,width:a,height:n}=t||this.copyCanvas(null,null,!0).imageData,r=await i.guess({name:"altText",request:{data:s,width:a,height:n,
1channels:s.length/(a*n)}});if(!r)throw Error("No response from the AI service.");if(r.error)throw Error("Error from the AI service.");if(r.cancel)return null;if(!r.output)throw Error("No valid response from the AI service.");let l=r.output;return await this.setGuessedAltText(l),e&&!this.hasAltTextData()&&(this.altTextData={alt:l,decorative:!1}),l}remove(){if((0,s._)(this,um)){var t,e;(0,n._)(this,uv,null),this._uiManager.imageManager.deleteId((0,s._)(this,um)),null===(t=(0,s._)(this,uk))||void 0===t||t.remove(),(0,n._)(this,uk,null),null===(e=(0,s._)(this,uS))||void 0===e||e.disconnect(),(0,n._)(this,uS,null),(0,s._)(this,ux)&&(clearTimeout((0,s._)(this,ux)),(0,n._)(this,ux,null))}super.remove()}rebuild(){if(!this.parent){(0,s._)(this,um)&&(0,l._)(this,uR,uj).call(this);return}super.rebuild(),null!==this.div&&((0,s._)(this,um)&&null===(0,s._)(this,uk)&&(0,l._)(this,uR,uj).call(this),this.isAttachedToDOM||this.parent.add(this))}onceAdded(){this._isDraggable=!0,this.div.focus()}isEmpty(){return!((0,s._)(this,ub)||(0,s._)(this,uv)||(0,s._)(this,uw)||(0,s._)(this,uA)||(0,s._)(this,um))}get isResizable(){return!0}render(){let t,e;if(this.div)return this.div;if(this.width&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.div.setAttribute("role","figure"),this.addAltTextButton(),(0,s._)(this,uv)?(0,l._)(this,uL,uz).call(this):(0,l._)(this,uR,uj).call(this),this.width&&!this.annotationElementId){let[i,s]=this.parentDimensions;this.setAt(t*i,e*s,this.width*i,this.height*s)}return this.div}copyCanvas(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];t||(t=224);let{width:a,height:n}=(0,s._)(this,uv),r=new tM,o=(0,s._)(this,uv),h=a,d=n,c=null;if(e){var u,_;if(a>e||n>e){let t=Math.min(e/a,e/n);h=Math.floor(a*t),d=Math.floor(n*t)}let t=(c=document.createElement("canvas")).width=Math.ceil(h*r.sx),i=c.height=Math.ceil(d*r.sy);(0,s._)(this,uE)||(o=(0,l._)(this,uP,uU).call(this,t,i));let p=c.getContext("2d");p.filter=this._uiManager.hcmFilter;let f="white",g="#cfcfd8";"none"!==this._uiManager.hcmFilter?g="black":(null===(u=(_=window).matchMedia)||void 0===u?void 0:u.call(_,"(prefers-color-scheme: dark)").matches)&&(f="#8f8f9d",g="#42414d");let v=15*r.sx,m=15*r.sy,b=new OffscreenCanvas(2*v,2*m),w=b.getContext("2d");w.fillStyle=f,w.fillRect(0,0,2*v,2*m),w.fillStyle=g,w.fillRect(0,0,v,m),w.fillRect(v,m,v,m),p.fillStyle=p.createPattern(b,"repeat"),p.fillRect(0,0,t,i),p.drawImage(o,0,0,o.width,o.height,0,0,t,i)}let p=null;if(i){let e,i;if(r.symmetric&&o.width<t&&o.height<t)e=o.width,i=o.height;else if(o=(0,s._)(this,uv),a>t||n>t){let r=Math.min(t/a,t/n);e=Math.floor(a*r),i=Math.floor(n*r),(0,s._)(this,uE)||(o=(0,l._)(this,uP,uU).call(this,e,i))}let h=new OffscreenCanvas(e,i).getContext("2d",{willReadFrequently:!0});h.drawImage(o,0,0,o.width,o.height,0,0,e,i),p={width:e,height:i,data:h.getImageData(0,0,e,i).data}}return{canvas:c,width:h,height:d,imageData:p}}getImageForAltText(){return(0,s._)(this,uk)}static async deserialize(t,e,i){let s=null;if(t instanceof oL){var a;let{data:{rect:n,rotation:r,id:l,structParent:o,popupRef:h},container:d,parent:{page:{pageNumber:c}}}=t,u=d.querySelector("canvas"),_=i.imageManager.getFromCanvas(d.id,u);u.remove();let p=(null===(a=await e._structTree.getAriaAttributes("".concat(tn).concat(l)))||void 0===a?void 0:a.get("aria-label"))||"";s=t={annotationType:k.STAMP,bitmapId:_.id,bitmap:_.bitmap,pageIndex:c-1,rect:n.slice(0),rotation:r,id:l,deleted:!1,accessibilityData:{decorative:!1,altText:p},isSvg:!1,structParent:o,popupRef:h}}let r=await super.deserialize(t,e,i),{rect:l,bitmap:o,bitmapUrl:h,bitmapId:d,isSvg:c,accessibilityData:u}=t;d&&i.imageManager.isValidId(d)?((0,n._)(r,um,d),o&&(0,n._)(r,uv,o)):(0,n._)(r,uw,h),(0,n._)(r,uE,c);let[_,p]=r.pageDimensions;return r.width=(l[2]-l[0])/_,r.height=(l[3]-l[1])/p,r.annotationElementId=t.id||null,u&&(r.altTextData=u),r._initialData=s,(0,n._)(r,uM,!!s),r}serialize(){var t;let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let a={annotationType:k.STAMP,bitmapId:(0,s._)(this,um),pageIndex:this.pageIndex,rect:this.getRect(0,0),rotation:this.rotation,isSvg:(0,s._)(this,uE),structTreeParentId:this._structTreeParentId};if(e)return a.bitmapUrl=(0,l._)(this,uF,uq).call(this,!0),a.accessibilityData=this.serializeAltText(!0),a;let{decorative:n,altText:r}=this.serializeAltText(!1);if(!n&&r&&(a.accessibilityData={type:"Figure",alt:r}),this.annotationElementId){let e=(0,l._)(this,uN,uX).call(this,a);if(e.isSame)return null;e.isSameAltText?delete a.accessibilityData:a.accessibilityData.structParent=null!==(t=this._initialData.structParent)&&void 0!==t?t:-1}if(a.id=this.annotationElementId,null===i)return a;i.stamps||(i.stamps=new Map);let o=(0,s._)(this,uE)?(a.rect[2]-a.rect[0])*(a.rect[3]-a.rect[1]):null;if(i.stamps.has((0,s._)(this,um))){if((0,s._)(this,uE)){let t=i.stamps.get((0,s._)(this,um));o>t.area&&(t.area=o,t.serialized.bitmap.close(),t.serialized.bitmap=(0,l._)(this,uF,uq).call(this,!1))}}else i.stamps.set((0,s._)(this,um),{area:o,serialized:a}),a.bitmap=(0,l._)(this,uF,uq).call(this,!1);return a}renderAnnotationElement(t){return t.updateEdited({rect:this.getRect(0,0)}),null}constructor(t){super({...t,name:"stampEditor"}),(0,o._)(this,uC),(0,o._)(this,uT),(0,o._)(this,uR),(0,o._)(this,uL),(0,o._)(this,uI),(0,o._)(this,uP),(0,o._)(this,uD),(0,o._)(this,uF),(0,o._)(this,uW),(0,o._)(this,uN),(0,a._)(this,uv,{writable:!0,value:void 0}),(0,a._)(this,um,{writable:!0,value:void 0}),(0,a._)(this,ub,{writable:!0,value:void 0}),(0,a._)(this,uw,{writable:!0,value:void 0}),(0,a._)(this,uA,{writable:!0,value:void 0}),(0,a._)(this,uy,{writable:!0,value:void 0}),(0,a._)(this,uk,{writable:!0,value:void 0}),(0,a._)(this,uS,{writable:!0,value:void 0}),(0,a._)(this,ux,{writable:!0,value:void 0}),(0,a._)(this,uE,{writable:!0,value:void 0}),(0,a._)(this,uM,{writable:!0,value:void 0}
1),(0,n._)(this,uv,null),(0,n._)(this,um,null),(0,n._)(this,ub,null),(0,n._)(this,uw,null),(0,n._)(this,uA,null),(0,n._)(this,uy,""),(0,n._)(this,uk,null),(0,n._)(this,uS,null),(0,n._)(this,ux,null),(0,n._)(this,uE,!1),(0,n._)(this,uM,!1),(0,n._)(this,uw,t.bitmapUrl),(0,n._)(this,uA,t.bitmapFile)}}function uH(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t){this.remove();return}(0,n._)(this,uv,t.bitmap),e||((0,n._)(this,um,t.id),(0,n._)(this,uE,t.isSvg)),t.file&&(0,n._)(this,uy,t.file.name),(0,l._)(this,uL,uz).call(this)}function uB(){if((0,n._)(this,ub,null),this._uiManager.enableWaiting(!1),(0,s._)(this,uk)){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&(0,s._)(this,uv)){this._editToolbar.hide(),this._uiManager.editAltText(this,!0);return}if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&(0,s._)(this,uv)){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch(t){}}this.div.focus()}}function uj(){if((0,s._)(this,um)){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId((0,s._)(this,um)).then(t=>(0,l._)(this,uC,uH).call(this,t,!0)).finally(()=>(0,l._)(this,uT,uB).call(this));return}if((0,s._)(this,uw)){let t=(0,s._)(this,uw);(0,n._)(this,uw,null),this._uiManager.enableWaiting(!0),(0,n._)(this,ub,this._uiManager.imageManager.getFromUrl(t).then(t=>(0,l._)(this,uC,uH).call(this,t)).finally(()=>(0,l._)(this,uT,uB).call(this)));return}if((0,s._)(this,uA)){let t=(0,s._)(this,uA);(0,n._)(this,uA,null),this._uiManager.enableWaiting(!0),(0,n._)(this,ub,this._uiManager.imageManager.getFromFile(t).then(t=>(0,l._)(this,uC,uH).call(this,t)).finally(()=>(0,l._)(this,uT,uB).call(this)));return}let t=document.createElement("input");t.type="file",t.accept=uO.supportedTypesStr;let e=this._uiManager._signal;(0,n._)(this,ub,new Promise(i=>{t.addEventListener("change",async()=>{if(t.files&&0!==t.files.length){this._uiManager.enableWaiting(!0);let e=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),(0,l._)(this,uC,uH).call(this,e)}else this.remove();i()},{signal:e}),t.addEventListener("cancel",()=>{this.remove(),i()},{signal:e})}).finally(()=>(0,l._)(this,uT,uB).call(this))),t.click()}function uz(){let{div:t}=this,{width:e,height:i}=(0,s._)(this,uv),[a,r]=this.pageDimensions;if(this.width)e=this.width*a,i=this.height*r;else if(e>.75*a||i>.75*r){let t=Math.min(.75*a/e,.75*r/i);e*=t,i*=t}let[o,h]=this.parentDimensions;this.setDims(e*o/a,i*h/r),this._uiManager.enableWaiting(!1);let d=(0,n._)(this,uk,document.createElement("canvas"));d.setAttribute("role","img"),this.addContainer(d),this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&!this.annotationElementId||(t.hidden=!1),(0,l._)(this,uD,uV).call(this,e,i),(0,l._)(this,uW,uK).call(this),(0,s._)(this,uM)||(this.parent.addUndoableEditor(this),(0,n._)(this,uM,!0)),this._reportTelemetry({action:"inserted_image"}),(0,s._)(this,uy)&&d.setAttribute("aria-label",(0,s._)(this,uy))}function uG(t,e){var i;let[a,r]=this.parentDimensions;this.width=t/a,this.height=e/r,(null===(i=this._initialOptions)||void 0===i?void 0:i.isCentered)?this.center():this.fixAndSetPosition(),this._initialOptions=null,null!==(0,s._)(this,ux)&&clearTimeout((0,s._)(this,ux)),(0,n._)(this,ux,setTimeout(()=>{(0,n._)(this,ux,null),(0,l._)(this,uD,uV).call(this,t,e)},200))}function uU(t,e){let{width:i,height:a}=(0,s._)(this,uv),n=i,r=a,l=(0,s._)(this,uv);for(;n>2*t||r>2*e;){let i=n,s=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 a=new OffscreenCanvas(n,r);a.getContext("2d").drawImage(l,0,0,i,s,0,0,n,r),l=a.transferToImageBitmap()}return l}function uV(t,e){let i=new tM,a=Math.ceil(t*i.sx),n=Math.ceil(e*i.sy),r=(0,s._)(this,uk);if(!r||r.width===a&&r.height===n)return;r.width=a,r.height=n;let o=(0,s._)(this,uE)?(0,s._)(this,uv):(0,l._)(this,uP,uU).call(this,a,n),h=r.getContext("2d");h.filter=this._uiManager.hcmFilter,h.drawImage(o,0,0,o.width,o.height,0,0,a,n)}function uq(t){if(t){if((0,s._)(this,uE)){let t=this._uiManager.imageManager.getSvgUrl((0,s._)(this,um));if(t)return t}let t=document.createElement("canvas");return{width:t.width,height:t.height}=(0,s._)(this,uv),t.getContext("2d").drawImage((0,s._)(this,uv),0,0),t.toDataURL()}if((0,s._)(this,uE)){let[t,e]=this.pageDimensions,i=Math.round(this.width*t*to.PDF_TO_CSS_UNITS),a=Math.round(this.height*e*to.PDF_TO_CSS_UNITS),n=new OffscreenCanvas(i,a);return n.getContext("2d").drawImage((0,s._)(this,uv),0,0,(0,s._)(this,uv).width,(0,s._)(this,uv).height,0,0,i,a),n.transferToImageBitmap()}return structuredClone((0,s._)(this,uv))}function uK(){this._uiManager._signal&&((0,n._)(this,uS,new ResizeObserver(t=>{let e=t[0].contentRect;e.width&&e.height&&(0,l._)(this,uI,uG).call(this,e.width,e.height)})),(0,s._)(this,uS).observe(this.div),this._uiManager._signal.addEventListener("abort",()=>{var t;null===(t=(0,s._)(this,uS))||void 0===t||t.disconnect(),(0,n._)(this,uS,null)},{once:!0}))}function uX(t){var e;let{rect:i,pageIndex:s,accessibilityData:{altText:a}}=this._initialData,n=t.rect.every((t,e)=>1>Math.abs(t-i[e])),r=t.pageIndex===s,l=((null===(e=t.accessibilityData)||void 0===e?void 0:e.alt)||"")===a;return{isSame:n&&r&&l,isSameAltText:l}}uO._type="stamp",uO._editorType=k.STAMP;var uY=new WeakMap,uQ=new WeakMap,uJ=new WeakMap,uZ=new WeakMap,u$=new WeakMap,u0=new WeakMap,u1=new WeakMap,u2=new WeakMap,u3=new WeakMap,u5=new WeakMap,u6=new WeakMap,u4=new WeakMap,u8=new WeakSet,u7=new WeakMap,u9=new WeakSet,_t=new WeakSet,_e=new WeakSet;class _i{get isEmpty(){return 0===(0,s._)(this,u0).size}get isInvisible(){return this.isEmpty&&(0,s._)(this,u4).getMode()===k.NONE}updateToolbar(t){(0,s._)(this,u4).updateToolbar(t)}updateMode(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(0,s._)(this,u4).getMode();switch((0,l._)(this,_e,_o).call(this),t){case k.NONE:this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case k.INK:this.addInkEditorIfNeeded(!1),this.disableTextSelection(),this.togglePointerEvents(!0),this.disableClick();break;case k.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:e}=this.div;for(let i of(0,h._)(_i,_i,_s).values())e.toggle("".concat(i._type,"Editing"),t===i._editorType);this.div.hidden=!1}hasTextLayer(t){var e;return t===(null===(e=(0,s._)(this,u5))||void 0===e?void 0:e.div)}addInkEditorIfNeeded(t){if((0,s._)(this,u4).getMode()===k.INK){if(!t){for(let t of(0,s._)(this,u0).values())if(t.isEmpty()){t.setInBackgroun
1d();return}}this.createAndAddNewEditor({offsetX:0,offsetY:0},!1).setInBackground()}}setEditingState(t){(0,s._)(this,u4).setEditingState(t)}addCommands(t){(0,s._)(this,u4).addCommands(t)}toggleDrawing(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("drawing",!t)}togglePointerEvents(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(){var t;let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];null===(t=(0,s._)(this,uJ))||void 0===t||t.div.classList.toggle("disabled",!e)}async enable(){this.div.tabIndex=0,this.togglePointerEvents(!0);let t=new Set;for(let e of(0,s._)(this,u0).values())e.enableEditing(),e.show(!0),e.annotationElementId&&((0,s._)(this,u4).removeChangedExistingAnnotation(e),t.add(e.annotationElementId));if((0,s._)(this,uJ))for(let e of(0,s._)(this,uJ).getEditableAnnotations()){if(e.hide(),(0,s._)(this,u4).isDeletedAnnotationElement(e.data.id)||t.has(e.data.id))continue;let i=await this.deserialize(e);i&&(this.addOrRebuild(i),i.enableEditing())}}disable(){(0,n._)(this,u3,!0),this.div.tabIndex=-1,this.togglePointerEvents(!1);let t=new Map,e=new Map;for(let a of(0,s._)(this,u0).values()){var i;if(a.disableEditing(),a.annotationElementId){if(null!==a.serialize()){t.set(a.annotationElementId,a);continue}e.set(a.annotationElementId,a),null===(i=this.getEditableAnnotation(a.annotationElementId))||void 0===i||i.show(),a.remove()}}if((0,s._)(this,uJ))for(let i of(0,s._)(this,uJ).getEditableAnnotations()){let{id:a}=i.data;if((0,s._)(this,u4).isDeletedAnnotationElement(a))continue;let n=e.get(a);if(n){n.resetAnnotationElement(i),n.show(!1),i.show();continue}(n=t.get(a))&&((0,s._)(this,u4).addChangedExistingAnnotation(n),n.renderAnnotationElement(i)&&n.show(!1)),i.show()}(0,l._)(this,_e,_o).call(this),this.isEmpty&&(this.div.hidden=!0);let{classList:a}=this.div;for(let t of(0,h._)(_i,_i,_s).values())a.remove("".concat(t._type,"Editing"));this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),(0,n._)(this,u3,!1)}getEditableAnnotation(t){var e;return(null===(e=(0,s._)(this,uJ))||void 0===e?void 0:e.getEditableAnnotation(t))||null}setActiveEditor(t){(0,s._)(this,u4).getActive()!==t&&(0,s._)(this,u4).setActiveEditor(t)}enableTextSelection(){var t;if(this.div.tabIndex=-1,(null===(t=(0,s._)(this,u5))||void 0===t?void 0:t.div)&&!(0,s._)(this,u6)){(0,n._)(this,u6,new AbortController);let t=(0,s._)(this,u4).combinedSignal((0,s._)(this,u6));(0,s._)(this,u5).div.addEventListener("pointerdown",(0,l._)(this,u8,_a).bind(this),{signal:t}),(0,s._)(this,u5).div.classList.add("highlighting")}}disableTextSelection(){var t;this.div.tabIndex=0,(null===(t=(0,s._)(this,u5))||void 0===t?void 0:t.div)&&(0,s._)(this,u6)&&((0,s._)(this,u6).abort(),(0,n._)(this,u6,null),(0,s._)(this,u5).div.classList.remove("highlighting"))}enableClick(){if((0,s._)(this,uZ))return;(0,n._)(this,uZ,new AbortController);let t=(0,s._)(this,u4).combinedSignal((0,s._)(this,uZ));this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t}),this.div.addEventListener("pointerup",this.pointerup.bind(this),{signal:t})}disableClick(){var t;null===(t=(0,s._)(this,uZ))||void 0===t||t.abort(),(0,n._)(this,uZ,null)}attach(t){(0,s._)(this,u0).set(t.id,t);let{annotationElementId:e}=t;e&&(0,s._)(this,u4).isDeletedAnnotationElement(e)&&(0,s._)(this,u4).removeDeletedAnnotationElement(t)}detach(t){var e;(0,s._)(this,u0).delete(t.id),null===(e=(0,s._)(this,uY))||void 0===e||e.removePointerInTextLayer(t.contentDiv),!(0,s._)(this,u3)&&t.annotationElementId&&(0,s._)(this,u4).addDeletedAnnotationElement(t)}remove(t){this.detach(t),(0,s._)(this,u4).removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1,(0,s._)(this,u2)||this.addInkEditorIfNeeded(!1)}changeParent(t){var e;t.parent!==this&&(t.parent&&t.annotationElementId&&((0,s._)(this,u4).addDeletedAnnotationElement(t.annotationElementId),sw.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),null===(e=t.parent)||void 0===e||e.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(t.parent!==this||!t.isAttachedToDOM){if(this.changeParent(t),(0,s._)(this,u4).addEditor(t),this.attach(t),!t.isAttachedToDOM){let e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(),(0,s._)(this,u4).addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){var e;if(!t.isAttachedToDOM)return;let{activeElement:i}=document;t.div.contains(i)&&!(0,s._)(this,u$)&&(t._focusEventsAllowed=!1,(0,n._)(this,u$,setTimeout(()=>{(0,n._)(this,u$,null),t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:(0,s._)(this,u4)._signal}),i.focus())},0))),t._structTreeParentId=null===(e=(0,s._)(this,uY))||void 0===e?void 0:e.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||(t.parent=this),t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){this.addCommands({cmd:()=>t._uiManager.rebuild(t),undo:()=>{t.remove()},mustExec:!1})}getNextId(){return(0,s._)(this,u4).getId()}combinedSignal(t){return(0,s._)(this,u4).combinedSignal(t)}canCreateNewEmptyEditor(){var t;return null===(t=(0,s._)(this,u7))||void 0===t?void 0:t.canCreateNewEmptyEditor()}pasteEditor(t,e){(0,s._)(this,u4).updateToolbar(t),(0,s._)(this,u4).updateMode(t);let{offsetX:i,offsetY:a}=(0,l._)(this,_t,_l).call(this),n=this.getNextId(),r=(0,l._)(this,u9,_r).call(this,{parent:this,id:n,x:i,y:a,uiManager:(0,s._)(this,u4),isCentered:!0,...e});r&&this.add(r)}async deserialize(t){var e,i;return await (null===(e=(0,h._)(_i,_i,_s).get(null!==(i=t.annotationType)&&void 0!==i?i:t.annotationEditorType))||void 0===e?void 0:e.deserialize(t,this,(0,s._)(this,u4)))||null}createAndAddNewEditor(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},a=this.getNextId(),n=(0,l._)(this,u9,_r).call(this,{parent:this,id:a,x:t.offsetX,y:t.offsetY,uiManager:(0,s._)(this,u4),isCentered:e,...i});return n&&this.add(n),n}addNewEditor(){this.createAndAddNewEditor((0,l._)(this,_t,_l).call(this),!0)}setSelected(t){(0,s._)(this,u4).setSelected(t)}toggleSelected(t){(0,s._)(this,u4).toggleSelected(t)}unselect(t){(0,s._)(this,u4).unselect(t)}pointerup(t){let{isMac:e}=J.platform;if(0===t.button&&(!t.ctrlKey||!e)&&t.target===this.div&&(0,s._)(this,u1)){if((0,n._)(this,u1,!1),!(0,s._)(this,uQ)){(0,n._)(this,uQ,!0);return}if((0,s._)(this,u4).getMode()===k.STAMP){(0,s._)(this,u4).unselectAll();return}this.createAndAddNewEditor(t,!1)}}pointerdown(t){if((0,s._)(this,u4).getMode()===k.HIGHLIGHT&&this.enableTextSelection(),(0,s._)(this,u1)){(0,n._)(this,u1,!1);return}let{isMac:e}=J.platform;if(0!==t.button||t.ctrlKey&&e||t.target!==this.div)return;(0,n._)(this,u1,!0);let i=(0,s._)(this,u4).getActive();(0,n._)(this,uQ,!i||i.isEmpty())}findNewParent(t,e,i){let a=(0,s._)(this,u4).findParent(e,i);return null!==a&&a!==this&&(a.changeParent(t),!0)}destroy(){var t,e;for(let i of((null===(t=(0,s._)(this,u4).getActive())||void 0===t?void 0:t.parent)===this&&((0,s._)(this,u4).commitOrRemove(),(0,s._)(this,u4).setActiveEditor(null)),(0,s._)(this,u$)&&(clearTimeout((0,s._)(this,u$)),(0,n._)(this,u$,null)),(0,s._)(this,u0).values())
1)null===(e=(0,s._)(this,uY))||void 0===e||e.removePointerInTextLayer(i.contentDiv),i.setParent(null),i.isAttachedToDOM=!1,i.div.remove();this.div=null,(0,s._)(this,u0).clear(),(0,s._)(this,u4).removeLayer(this)}render(t){let{viewport:e}=t;for(let t of(this.viewport=e,tE(this.div,e),(0,s._)(this,u4).getEditors(this.pageIndex)))this.add(t),t.rebuild();this.updateMode()}update(t){let{viewport:e}=t;(0,s._)(this,u4).commitOrRemove(),(0,l._)(this,_e,_o).call(this);let i=this.viewport.rotation,a=e.rotation;if(this.viewport=e,tE(this.div,{rotation:a}),i!==a)for(let t of(0,s._)(this,u0).values())t.rotate(a);this.addInkEditorIfNeeded(!1)}get pageDimensions(){let{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return(0,s._)(this,u4).viewParameters.realScale}constructor({uiManager:t,pageIndex:e,div:i,structTreeLayer:r,accessibilityManager:l,annotationLayer:d,drawLayer:c,textLayer:u,viewport:_,l10n:p}){(0,o._)(this,u8),(0,a._)(this,u7,{get:_n,set:void 0}),(0,o._)(this,u9),(0,o._)(this,_t),(0,o._)(this,_e),(0,a._)(this,uY,{writable:!0,value:void 0}),(0,a._)(this,uQ,{writable:!0,value:void 0}),(0,a._)(this,uJ,{writable:!0,value:void 0}),(0,a._)(this,uZ,{writable:!0,value:void 0}),(0,a._)(this,u$,{writable:!0,value:void 0}),(0,a._)(this,u0,{writable:!0,value:void 0}),(0,a._)(this,u1,{writable:!0,value:void 0}),(0,a._)(this,u2,{writable:!0,value:void 0}),(0,a._)(this,u3,{writable:!0,value:void 0}),(0,a._)(this,u5,{writable:!0,value:void 0}),(0,a._)(this,u6,{writable:!0,value:void 0}),(0,a._)(this,u4,{writable:!0,value:void 0}),(0,n._)(this,uQ,!1),(0,n._)(this,uJ,null),(0,n._)(this,uZ,null),(0,n._)(this,u$,null),(0,n._)(this,u0,new Map),(0,n._)(this,u1,!1),(0,n._)(this,u2,!1),(0,n._)(this,u3,!1),(0,n._)(this,u5,null),(0,n._)(this,u6,null);let f=[...(0,h._)(_i,_i,_s).values()];if(!_i._initialized)for(let e of(_i._initialized=!0,f))e.initialize(p,t);t.registerEditorTypes(f),(0,n._)(this,u4,t),this.pageIndex=e,this.div=i,(0,n._)(this,uY,l),(0,n._)(this,uJ,d),this.viewport=_,(0,n._)(this,u5,u),this.drawLayer=c,this._structTree=r,(0,s._)(this,u4).addLayer(this)}}_i._initialized=!1;var _s={writable:!0,value:new Map([o5,cZ,uO,d8].map(t=>[t._editorType,t]))};function _a(t){(0,s._)(this,u4).unselectAll();let{target:e}=t;if(e===(0,s._)(this,u5).div||("img"===e.getAttribute("role")||e.classList.contains("endOfContent"))&&(0,s._)(this,u5).div.contains(e)){let{isMac:e}=J.platform;if(0!==t.button||t.ctrlKey&&e)return;(0,s._)(this,u4).showAllEditors("highlight",!0,!0),(0,s._)(this,u5).div.classList.add("free"),this.toggleDrawing(),d8.startHighlighting(this,"ltr"===(0,s._)(this,u4).direction,{target:(0,s._)(this,u5).div,x:t.x,y:t.y}),(0,s._)(this,u5).div.addEventListener("pointerup",()=>{(0,s._)(this,u5).div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:(0,s._)(this,u4)._signal}),t.preventDefault()}}function _n(){return(0,h._)(_i,_i,_s).get((0,s._)(this,u4).getMode())}function _r(t){let e=(0,s._)(this,u7);return e?new e.prototype.constructor(t):null}function _l(){let{x:t,y:e,width:i,height:s}=this.div.getBoundingClientRect(),a=Math.max(0,t),n=Math.max(0,e),r=Math.min(window.innerWidth,t+i),l=Math.min(window.innerHeight,e+s),o=(a+r)/2-t,h=(n+l)/2-e,[d,c]=this.viewport.rotation%180==0?[o,h]:[h,o];return{offsetX:d,offsetY:c}}function _o(){for(let t of((0,n._)(this,u2,!0),(0,s._)(this,u0).values()))t.isEmpty()&&t.remove();(0,n._)(this,u2,!1)}var _h=new WeakMap,_d=new WeakMap,_c=new WeakMap,_u=new WeakMap,__=new WeakSet,_p=new WeakSet;class _f{setParent(t){if(!(0,s._)(this,_h)){(0,n._)(this,_h,t);return}if((0,s._)(this,_h)!==t){if((0,s._)(this,_c).size>0)for(let e of(0,s._)(this,_c).values())e.remove(),t.append(e);(0,n._)(this,_h,t)}}static get _svgFactory(){return H(this,"_svgFactory",new l_)}draw(t,e,i){let a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=(0,r._)(this,_d).value++,o=(0,l._)(this,__,_v).call(this,t.box);o.classList.add(...t.classNamesForDrawing);let h=_f._svgFactory.createElement("defs");o.append(h);let d=_f._svgFactory.createElement("path");h.append(d);let c="path_p".concat(this.pageIndex,"_").concat(n);d.setAttribute("id",c),d.setAttribute("d",t.toSVGPath()),a&&(0,s._)(this,_u).set(n,d);let u=(0,l._)(this,_p,_m).call(this,h,c),_=_f._svgFactory.createElement("use");return o.append(_),o.setAttribute("fill",e),o.setAttribute("fill-opacity",i),_.setAttribute("href","#".concat(c)),(0,s._)(this,_c).set(n,o),{id:n,clipPathId:"url(#".concat(u,")")}}drawOutline(t){let e;let i=(0,r._)(this,_d).value++,a=(0,l._)(this,__,_v).call(this,t.box);a.classList.add(...t.classNamesForOutlining);let n=_f._svgFactory.createElement("defs");a.append(n);let o=_f._svgFactory.createElement("path");n.append(o);let h="path_p".concat(this.pageIndex,"_").concat(i);if(o.setAttribute("id",h),o.setAttribute("d",t.toSVGPath()),o.setAttribute("vector-effect","non-scaling-stroke"),t.mustRemoveSelfIntersections){let t=_f._svgFactory.createElement("mask");n.append(t),e="mask_p".concat(this.pageIndex,"_").concat(i),t.setAttribute("id",e),t.setAttribute("maskUnits","objectBoundingBox");let s=_f._svgFactory.createElement("rect");t.append(s),s.setAttribute("width","1"),s.setAttribute("height","1"),s.setAttribute("fill","white");let a=_f._svgFactory.createElement("use");t.append(a),a.setAttribute("href","#".concat(h)),a.setAttribute("stroke","none"),a.setAttribute("fill","black"),a.setAttribute("fill-rule","nonzero"),a.classList.add("mask")}let d=_f._svgFactory.createElement("use");a.append(d),d.setAttribute("href","#".concat(h)),e&&d.setAttribute("mask","url(#".concat(e,")"));let c=d.cloneNode();return a.append(c),d.classList.add("mainOutline"),c.classList.add("secondaryOutline"),(0,s._)(this,_c).set(i,a),i}finalizeLine(t,e){let i=(0,s._)(this,_u).get(t);(0,s._)(this,_u).delete(t),this.updateBox(t,e.box),i.setAttribute("d",e.toSVGPath())}updateLine(t,e){(0,s._)(this,_c).get(t).firstChild.firstChild.setAttribute("d",e.toSVGPath())}updatePath(t,e){(0,s._)(this,_u).get(t).setAttribute("d",e.toSVGPath())}updateBox(t,e){(0,_._)(_f,_f,_g).call(_f,(0,s._)(this,_c).get(t),e)}show(t,e){(0,s._)(this,_c).get(t).classList.toggle("hidden",!e)}rotate(t,e){(0,s._)(this,_c).get(t).setAttribute("data-main-rotation",e)}changeColor(t,e){(0,s._)(this,_c).get(t).setAttribute("fill",e)}
1changeOpacity(t,e){(0,s._)(this,_c).get(t).setAttribute("fill-opacity",e)}addClass(t,e){(0,s._)(this,_c).get(t).classList.add(e)}removeClass(t,e){(0,s._)(this,_c).get(t).classList.remove(e)}getSVGRoot(t){return(0,s._)(this,_c).get(t)}remove(t){(0,s._)(this,_u).delete(t),null!==(0,s._)(this,_h)&&((0,s._)(this,_c).get(t).remove(),(0,s._)(this,_c).delete(t))}destroy(){for(let t of((0,n._)(this,_h,null),(0,s._)(this,_c).values()))t.remove();(0,s._)(this,_c).clear(),(0,s._)(this,_u).clear()}constructor({pageIndex:t}){(0,o._)(this,__),(0,o._)(this,_p),(0,a._)(this,_h,{writable:!0,value:void 0}),(0,a._)(this,_d,{writable:!0,value:void 0}),(0,a._)(this,_c,{writable:!0,value:void 0}),(0,a._)(this,_u,{writable:!0,value:void 0}),(0,n._)(this,_h,null),(0,n._)(this,_d,0),(0,n._)(this,_c,new Map),(0,n._)(this,_u,new Map),this.pageIndex=t}}function _g(t){let{x:e=0,y:i=0,width:s=1,height:a=1}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{style:n}=t;n.top="".concat(100*i,"%"),n.left="".concat(100*e,"%"),n.width="".concat(100*s,"%"),n.height="".concat(100*a,"%")}
1function _v(t){let e=_f._svgFactory.create(1,1,!0);return(0,s._)(this,_h).append(e),e.setAttribute("aria-hidden",!0),(0,_._)(_f,_f,_g).call(_f,e,t),e}function _m(t,e){let i=_f._svgFactory.createElement("clipPath");t.append(i);let s="clip_".concat(e);i.setAttribute("id",s),i.setAttribute("clipPathUnits","objectBoundingBox");let a=_f._svgFactory.createElement("use");return i.append(a),a.setAttribute("href","#".concat(e)),a.classList.add("clip"),s}v.AbortException,v.AnnotationEditorLayer,v.AnnotationEditorParamsType,v.AnnotationEditorType,v.AnnotationEditorUIManager;var _b=v.AnnotationLayer,_w=v.AnnotationMode;v.ColorPicker,v.DOMSVGFactory,v.DrawLayer,v.FeatureTest;var _A=v.GlobalWorkerOptions;v.ImageKind,v.InvalidPDFException,v.MissingPDFException,v.OPS,v.OutputScale;var _y=v.PDFDataRangeTransport;v.PDFDateString,v.PDFWorker,v.PasswordResponses,v.PermissionFlag,v.PixelsPerInch,v.RenderingCancelledException;var _k=v.TextLayer;v.UnexpectedResponseException,v.Util,v.VerbosityLevel,v.XfaLayer,v.build,v.createValidAbsoluteUrl,v.fetchData;var _S=v.getDocument;v.getFilenameFromUrl,v.getPdfFilenameFromUrl,v.getXfaPageViewport,v.isDataScheme,v.isPdfFile,v.noContextMenu,v.normalizeUnicode,v.setLayerDimensions,v.shadow;var _x=v.version}}]);

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.